/* Staff console extras (loaded after portal.css) */
.topbar-actions { display: flex; gap: 8px; }
.view { max-width: 1100px; }

.badge { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; margin-left: 6px;
  border-radius: 999px; background: var(--gold-grad); color: #1a1204; font: 700 .75rem var(--sans); vertical-align: middle; }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.toolbar input[type="search"] { flex: 1 1 240px; }
.toolbar select { flex: 0 1 220px; }

.rows { display: flex; flex-direction: column; gap: 10px; }
.clickable { cursor: pointer; transition: border-color .2s, transform .15s; }
.clickable:hover { border-color: var(--gold); transform: translateY(-1px); }
.row-end { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.block-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.block-head select { max-width: 260px; }
.quick { display: flex; gap: 10px; flex-wrap: wrap; }
.tile-button { text-align: left; font: inherit; color: inherit; cursor: pointer; }
.tile-button:hover { border-color: var(--gold); }
.tiles.small .tile strong { font-size: 1.4rem; }
.danger-zone { display: flex; gap: 10px; flex-wrap: wrap; border-top: 1px dashed var(--line); padding-top: 16px; }

/* status pills */
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: .78rem; font-weight: 700; padding: .35em .75em; border-radius: 999px; white-space: nowrap; }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill-new { color: var(--info); background: rgba(110,168,255,.12); }
.pill-contacted, .pill-pending { color: var(--warn); background: rgba(242,183,30,.12); }
.pill-enrolled, .pill-active { color: var(--good); background: rgba(79,209,139,.12); }
.pill-not_interested, .pill-suspended { color: var(--muted); background: rgba(169,165,155,.14); }

/* drawer */
.scrim { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 30; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100%); z-index: 40; background: var(--bg-alt);
  border-left: 1px solid var(--line); overflow-y: auto; transform: translateX(100%);
  transition: transform .28s cubic-bezier(.2,.7,.2,1); }
.drawer.open { transform: none; }
.d-head { position: sticky; top: 0; z-index: 2; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 18px 20px; background: var(--bg-alt); border-bottom: 1px solid var(--line-soft); }
.d-head h2 { font-size: 1.35rem; }
.icon-btn { background: var(--surface); border: 1px solid var(--line); color: var(--text); width: 36px; height: 36px;
  border-radius: 10px; font-size: 1.3rem; line-height: 1; cursor: pointer; flex: none; }
.d-body { padding: 18px 20px 40px; display: flex; flex-direction: column; gap: 14px; }
.d-section { margin-top: 10px; padding-top: 14px; border-top: 1px solid var(--line-soft); font-size: 1rem; color: var(--gold-hi); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.field { display: flex; flex-direction: column; }
.field label { margin-top: 0; }
.drawer-actions { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 6px; }

.detail { margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.detail div { display: grid; grid-template-columns: 130px 1fr; gap: 10px; padding: 9px 14px; border-bottom: 1px solid var(--line-soft); }
.detail div:last-child { border-bottom: 0; }
.detail dt { color: var(--muted); font-size: .85rem; }
.detail dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; white-space: pre-wrap; }

/* marking */
.work-view { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.work-view img { width: 100%; border-radius: var(--radius); border: 1px solid var(--line); background: #000; }

@media (max-width: 720px) {
  .view { padding: 18px 14px 60px; }
  .topbar, .tabbar { padding-left: 14px; padding-right: 14px; }
  .row-card { flex-direction: column; align-items: flex-start; }
  .row-end { justify-content: flex-start; }
  .detail div { grid-template-columns: 1fr; gap: 0; }
  .d-body { padding: 16px 14px 36px; }
}
.marking-filters,.class-tabs { display:flex; flex-wrap:wrap; gap:10px; margin:18px 0; }
.marking-filters select { width:auto; max-width:100%; flex:1; min-width:200px; }
.marking-filters .selected,.class-tabs .selected { background:var(--gold); color:#15110a; border-color:var(--gold); }
.class-marking { margin:20px 0; border:1px solid var(--line); border-radius:16px; background:var(--surface); }
.class-marking > summary { font-size:1.3rem; font-weight:700; padding:22px; cursor:pointer; }
.assignment-marking { border-top:1px solid var(--line); padding:18px 22px; }
.assignment-marking > summary { padding:4px 0 14px; cursor:pointer; font-weight:600; }
.marking-student { display:flex; justify-content:space-between; gap:20px; margin-top:12px; align-items:flex-start; }
.marking-student-info { min-width:0; }
.marking-student-info p { margin:6px 0 12px; }
.marking-student-actions { display:flex; flex-direction:column; flex-shrink:0; gap:8px; }
.course-fee { display:grid; grid-template-columns:minmax(180px,2fr) minmax(100px,1fr) minmax(110px,1fr) auto; gap:14px; align-items:end; margin:12px 0; padding:16px; border:1px solid var(--line); border-radius:14px; }
.course-fee .field { min-width:0; }
.course-fee label { margin-bottom:8px; }
.deadline-card { margin-top:18px; }
@media(max-width:720px) { .marking-student {flex-direction:column} .marking-student-actions {flex-direction:row;flex-wrap:wrap} .assignment-marking {padding:14px} .course-fee {grid-template-columns:1fr} }

/* ---------- online lessons ---------- */
.sub-head { font-size: 1rem; margin: 22px 0 10px; }
.plain-list { margin: 0; padding-left: 18px; color: var(--muted); }
.plain-list li { margin: 4px 0; }
.plain-list li.failed { color: var(--low); }
.message-preview { white-space: pre-wrap; overflow-wrap: anywhere; font: .9rem/1.5 var(--sans); background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin: 0 0 10px; }
.lesson-add-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 0 12px; }
.status.good { color: var(--good); }
.qr-box { display: grid; justify-items: center; gap: 12px; text-align: center; }
.qr-box svg { width: min(280px, 80vw); height: auto; border-radius: 12px; }
.phone-link { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin-top: 14px; }
.phone-link .field { flex: 1 1 220px; margin: 0; }
.steps { margin: 0 0 16px; padding-left: 20px; color: var(--muted); display: grid; gap: 6px; }
.copy-row { display: flex; gap: 8px; }
.copy-row input { flex: 1; min-width: 0; }
.zoom-joins:empty { display: none; }
.zoom-join { border-left: 3px solid var(--gold); }
.zoom-join select { max-width: 220px; }
.recordings-extras:empty { display: none; }
.recordings-extras { display: grid; gap: 8px; margin-bottom: 12px; }
.check-view { width: min(900px, 100%); text-align: left; display: grid; gap: 10px; }
.practice-edit { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 12px; }
.practice-edit summary { cursor: pointer; color: var(--gold-hi); font-weight: 600; }
.practice-correction { display: grid; gap: 10px; margin-top: 14px; }
.practice-correction textarea { width: 100%; }
.practice-correction input[type="checkbox"] { width: 20px; height: 20px; }
.practice-latest { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 300px; overflow: auto; }
.practice-requests { display: grid; gap: 12px; }
.practice-requests textarea { width: 100%; margin: 8px 0; }
.practice-annotation { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 14px; }
.row-card.is-failed { border-left: 3px solid var(--danger); }
.lesson-files { margin: 18px 0; }
.file-send h3 { overflow-wrap: anywhere; }
.file-send-list { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.file-send-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; color: var(--muted); font-size: .92rem; }
.file-send-list li span { flex: 1 1 220px; overflow-wrap: anywhere; }
.file-send-list li.sent { color: var(--good); }
.file-send-list li.failed { color: var(--low); }
.file-send-form h4 { margin: 14px 0 0; text-transform: uppercase; letter-spacing: .08em; }

/* ---------- developer tab ---------- */
.dev-view { display: flex; flex-direction: column; gap: 22px; min-width: 0; }
.dev-head { display: flex; flex-direction: column; gap: 6px; }
.dev-note:empty { display: none; }
.dev-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(230px, 100%), 1fr)); gap: 12px; }
.dev-card { min-width: 0; display: flex; flex-direction: column; gap: 6px; border-top: 3px solid var(--line); }
.dev-card h3 { font: 700 .78rem var(--sans); text-transform: uppercase; letter-spacing: .07em; color: var(--muted); overflow-wrap: anywhere; }
.dev-card .fine { overflow-wrap: anywhere; }
.dev-value { font-family: var(--display); font-size: 1.45rem; font-weight: 800; line-height: 1.15; overflow-wrap: anywhere; }
.dev-value.is-long { font-size: 1.05rem; }
.dev-card.is-missing .dev-value { font: 600 1rem var(--sans); color: var(--muted); }
.dev-card.is-good { border-top-color: var(--good); }
.dev-card.is-good .dev-value { color: var(--good); }
.dev-card.is-warn { border-color: rgba(242,183,30,.45); border-top-color: var(--warn); background: rgba(242,183,30,.07); }
.dev-card.is-warn .dev-value { color: var(--gold-hi); }
.dev-card.is-bad { border-color: rgba(255,107,91,.5); border-top-color: var(--danger); background: rgba(255,107,91,.08); }
.dev-card.is-bad .dev-value { color: var(--danger); }
.dev-meter { height: 8px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--line); overflow: hidden; }
.dev-meter span { display: block; height: 100%; border-radius: inherit; background: var(--good); }
.dev-meter span.is-warn { background: var(--warn); }
.dev-meter span.is-bad { background: var(--danger); }
.dev-counts { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.dev-count { display: inline-flex; align-items: baseline; gap: 6px; min-width: 0; }
.dev-count strong { font-family: var(--display); font-size: 1.4rem; line-height: 1; }
.dev-count span { color: var(--muted); font-size: .85rem; }
.dev-count.is-warn strong, .dev-count.is-warn span { color: var(--gold-hi); }
.dev-count.is-bad strong, .dev-count.is-bad span { color: var(--danger); }
.dev-locked { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; }
.dev-locked li { overflow-wrap: anywhere; }
.dev-locked-card { border-left: 3px solid var(--warn); }
.dev-error { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.dev-error-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.dev-message { font-weight: 700; white-space: pre-wrap; overflow-wrap: anywhere; }
.dev-where { overflow-wrap: anywhere; }
.dev-details summary { cursor: pointer; color: var(--gold-hi); font-weight: 600; font-size: .88rem; }
.dev-pre { margin: 8px 0 0; padding: 12px; max-height: 360px; overflow: auto; white-space: pre; background: var(--bg);
  border: 1px solid var(--line); border-radius: 10px; font: .78rem/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.dev-tools { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.dev-tools .field { flex: 1 1 130px; min-width: 0; max-width: 220px; }
.dev-auto { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; margin: 0; cursor: pointer; }
.dev-auto input { width: 18px; height: 18px; padding: 0; margin: 0; flex: none; accent-color: var(--gold); }
.dev-log-box { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.dev-log { max-height: 65vh; overflow: auto; padding: 8px 0; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius);
  font: .8rem/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.dev-log-line { display: flex; gap: 12px; width: max-content; min-width: 100%; padding: 1px 14px; white-space: pre; }
.dev-log-line:hover { background: var(--surface); }
.dev-log-time { flex: none; color: var(--muted); }
.dev-log-level { flex: none; width: 9ch; font-weight: 700; }
.dev-log-line.p-error { color: var(--danger); }
.dev-log-line.p-warning { color: var(--gold-hi); }
.dev-log-line.p-notice .dev-log-level { color: var(--info); }
.dev-log-line.p-info .dev-log-level { color: var(--good); }
.dev-log-line.p-debug, .dev-log-line.p-debug .dev-log-level { color: var(--muted); }
@media (max-width: 720px) { .dev-tools .field { max-width: none; } }

/* Personal checks keep editable marks visible while longer descriptions expand on demand. */
.practice-edit-controls { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.practice-quick-mark { display: flex; align-items: center; gap: 12px; }
.practice-quick-mark input { width: 100px; font-size: 1.35rem; font-weight: 700; text-align: center; color: var(--gold); }
.practice-edit { margin: 10px 0; }
.practice-edit summary { cursor: pointer; padding: 10px 0; font-weight: 600; }
.practice-correction { display: grid; gap: 10px; padding: 10px 0; }
.practice-correction textarea { width: 100%; }
.practice-latest { white-space: pre-wrap; overflow-wrap: anywhere; }
/* ---------- lessons (console-lessons.js) and their files ---------- */
.pill-cancelled { color: var(--low); background: rgba(255,143,107,.12); }
.lesson-card.is-cancelled h3 { color: var(--muted); }
.lesson-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.lesson-head .muted { margin: 0; }
.ended-lesson { border-left: 3px solid var(--gold); display: grid; gap: 6px; margin-bottom: 12px; }
.lesson-recordings:empty { display: none; }
.lesson-materials { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.lesson-materials li { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 10px 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.lesson-materials li > div { flex: 1 1 220px; min-width: 0; overflow-wrap: anywhere; }
.lesson-materials a { color: var(--gold-hi); font-weight: 600; text-decoration: none; }
.lesson-materials a:hover { text-decoration: underline; }
.lesson-materials .fine { margin: 2px 0 0; }
.lesson-files-sub { margin: 16px 0 0; text-transform: uppercase; letter-spacing: .08em; }
.lesson-files-groups { display: grid; gap: 6px; margin: 4px 0 0 12px; padding-left: 12px; border-left: 2px solid var(--line); }
/* Settings > Help chat: this month's spending against its limit (a still bar, no stripes) */
.help-spend .progress-fill::after { animation: none; background: none; }
.help-spend.is-high .progress-fill { background: var(--low); }
.help-spend .progress-text { white-space: normal; }
.help-usage h3 { margin: 14px 0 4px; font-size: 1rem; }
.help-usage h3:first-child { margin-top: 0; }
/* Settings > AI costs (console-ai-costs.js) */
.ai-costs .card + .card { margin-top: 14px; }
.ai-costs h3 { margin: 14px 0 6px; font-size: 1rem; }
.ai-costs h3:first-child { margin-top: 0; }
.ai-costs h4 { margin: 12px 0 4px; font-size: .95rem; }
.ai-costs-totals { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 12px 0; }
.ai-stat { display: grid; gap: 2px; padding: 10px 12px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; }
.ai-stat small { color: var(--muted); font-size: .8rem; }
.ai-stat strong { font-size: 1.2rem; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.ai-budget.is-reached .progress-fill { background: var(--danger); }
.ai-costs .table-wrap { overflow-x: auto; max-width: 100%; }
.ai-costs-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.ai-costs-table th, .ai-costs-table td { padding: 6px 8px; border-bottom: 1px solid var(--line-soft); text-align: left; vertical-align: middle; }
.ai-costs-table th { color: var(--muted); font-weight: 600; white-space: nowrap; }
.ai-costs-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ai-prices input { width: 100%; min-width: 80px; }
.ai-prices td:first-child input { min-width: 170px; }
.ai-costs-filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px 14px; }
.ai-costs-month .field, .ai-costs-filters .field { margin: 0; max-width: 280px; }
