/* Components added in v2: folder tree, upload dock, designers, messages, ads, tracer. */
:root { --series-1: #2a78d6; --series-2: #eb6834; }
@media (prefers-color-scheme: dark) { :root { --series-1: #3987e5; --series-2: #d95926; } }
.main-wide { max-width: none; }
.nav-badge.danger { background: var(--danger); color: #fff; }
#toast-root { bottom: auto; top: 20px; }

/* ---------- Folder tree ---------- */
.tree { display: flex; flex-direction: column; }
.tree-row { display: grid; grid-template-columns: 28px 96px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 16px 10px calc(16px + var(--depth, 0) * 28px); border-bottom: 1px solid var(--border); background: var(--surface); position: relative; }
.tree-row:last-child { border-bottom: 0; }
.tree-row:hover { background: var(--surface-2); }
.folder-row { grid-template-columns: 32px 72px minmax(0, 1fr) auto; background: color-mix(in srgb, var(--surface-2) 55%, var(--surface)); }
.folder-row .lesson-title { font-weight: 650; }
.tree-row .thumb { position: relative; }
.tree-row .thumb.small { width: 72px; color: var(--accent); }
.tree-row .thumb .num { position: absolute; left: 4px; top: 4px; background: rgba(0, 0, 0, .65); color: #fff; font-size: 11px; font-weight: 700; padding: 0 6px; border-radius: 5px; }
.tree-row.dragging { opacity: .4; }
.tree-row.drop-before { box-shadow: inset 0 3px 0 var(--accent); }
.tree-row.drop-after { box-shadow: inset 0 -3px 0 var(--accent); }
.tree-row.drop-into { outline: 2px dashed var(--accent); outline-offset: -3px; background: var(--accent-soft); }
.tree-row .toggle { width: 28px; height: 28px; }
.has-text { display: inline-flex; gap: 4px; align-items: center; color: var(--accent); }
.has-text .icon, .lesson-meta .icon { width: 14px; height: 14px; }
.lesson-meta span { display: inline-flex; align-items: center; gap: 4px; }
.row-error { display: flex; gap: 10px; align-items: center; background: var(--danger-soft); color: var(--danger); padding: 6px 10px; border-radius: 8px; flex-wrap: wrap; }
.row-error .icon { width: 16px; height: 16px; }
.dropzone.compact { display: flex; align-items: center; gap: 16px; padding: 16px 20px; text-align: left; cursor: default; flex-wrap: wrap; }
.dropzone.compact .big-icon { margin: 0; }
.preview-frame { width: 100%; height: 72vh; border: 0; border-radius: 10px; background: #fff; }
.preview-image { max-width: 100%; display: block; margin: 0 auto; border-radius: 10px; }
@media (max-width: 760px) {
  .tree-row, .folder-row { grid-template-columns: 28px minmax(0, 1fr); }
  .tree-row .thumb, .tree-row .lesson-actions { display: none; }
}

/* ---------- Upload dock ---------- */
.upload-dock { position: fixed; right: 20px; bottom: 20px; width: min(460px, calc(100vw - 32px)); background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lg); z-index: 40; overflow: hidden; }
.upload-dock.has-failed { border-color: var(--danger); }
.dock-head { display: flex; gap: 10px; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.dock-list { max-height: 46vh; overflow-y: auto; }
.dock-item { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.dock-item:last-child { border-bottom: 0; }
.dock-icon { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); }
.dock-icon .icon { width: 15px; height: 15px; }
.dock-item.failed { background: var(--danger-soft); }
.dock-item.failed .dock-icon { background: var(--danger); color: #fff; }
.dock-item.done .dock-icon { background: var(--success-soft); color: var(--success); }
.dock-error { color: var(--danger); font-size: 12.5px; font-weight: 560; margin-top: 3px; }

/* ---------- Choices & cover editor ---------- */
.choice-row { display: grid; gap: 10px; }
.choice { display: flex; gap: 12px; align-items: flex-start; border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; cursor: pointer; }
.choice:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.choice input { margin-top: 3px; accent-color: var(--accent); }
.choice b { display: flex; align-items: center; gap: 6px; }
.choice b .icon { width: 16px; height: 16px; }
.choice span { display: block; color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.cover-editor { display: grid; grid-template-columns: 280px 1fr; gap: 16px; align-items: start; }
.cover-box { aspect-ratio: 16 / 9; border-radius: 10px; background: #000; display: grid; place-items: center; overflow: hidden; border: 1px solid var(--border); }
.cover-box img { width: 100%; height: 100%; object-fit: contain; }
.cover-box .muted { display: flex; gap: 6px; align-items: center; }
@media (max-width: 640px) { .cover-editor { grid-template-columns: 1fr; } }

/* ---------- Watermark designer ---------- */
.wm-designer { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 20px; align-items: start; }
@media (max-width: 760px) { .wm-designer { grid-template-columns: 1fr; } }
.wm-controls { display: flex; flex-direction: column; gap: 14px; transition: opacity .15s; }
.wm-controls.disabled { opacity: .4; pointer-events: none; }
.seg { display: flex; background: var(--surface-2); border-radius: 9px; padding: 3px; gap: 2px; }
.seg button { flex: 1; border: 0; background: transparent; padding: 6px 8px; border-radius: 7px; cursor: pointer; font-weight: 560; font-size: 13px; color: var(--muted); }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
input[type="color"] { width: 44px; height: 32px; border: 1px solid var(--border); border-radius: 8px; padding: 2px; background: var(--surface); }
.wm-stage { position: relative; aspect-ratio: 16 / 9; border-radius: 12px; overflow: hidden; background: #000; }
.wm-fake { position: absolute; inset: -20%; background: radial-gradient(circle at 30% 40%, #3b3f8f, transparent 45%), radial-gradient(circle at 70% 70%, #7a2f5d, transparent 40%), linear-gradient(135deg, #111827, #1f2937); animation: fakeVideo 14s ease-in-out infinite alternate; }
@keyframes fakeVideo { to { transform: translate(8%, -6%) scale(1.1); } }
.wm-play { position: absolute; inset: 0; display: grid; place-items: center; color: rgba(255, 255, 255, .18); }
.wm-play .icon { width: 48px; height: 48px; }
.wm-invisible { position: absolute; right: 8px; bottom: 8px; font-size: 11px; color: rgba(255, 255, 255, .55); display: flex; gap: 4px; align-items: center; background: rgba(0, 0, 0, .4); padding: 2px 8px; border-radius: 99px; }
.wm-invisible .icon { width: 12px; height: 12px; }
.wm-text { position: absolute; left: 0; top: 0; white-space: nowrap; font-weight: 650; text-shadow: 0 0 3px rgba(0, 0, 0, .9); will-change: transform; }

/* ---------- Mini stats ---------- */
.mini-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.mini-stat { background: var(--surface-2); border-radius: 10px; padding: 12px 14px; }

/* ---------- Messages ---------- */
.chat-shell { display: grid; grid-template-columns: 330px minmax(0, 1fr); height: calc(100vh - 170px); min-height: 480px; overflow: hidden; }
.chat-list { border-right: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; }
.chat-list-body { overflow-y: auto; flex: 1; }
.chat-group-head { display: flex; align-items: center; gap: 6px; width: 100%; border: 0; background: var(--surface-2); padding: 8px 12px; font-weight: 650; cursor: pointer; text-align: left; }
.chat-group-head .icon { width: 15px; height: 15px; }
.chat-thread { display: flex; gap: 10px; align-items: center; width: 100%; border: 0; background: transparent; padding: 10px 12px; cursor: pointer; border-bottom: 1px solid var(--border); }
.chat-thread:hover { background: var(--surface-2); }
.chat-thread.active { background: var(--accent-soft); }
.chat-thread .icon { width: 12px; height: 12px; display: inline; vertical-align: -1px; }
.chat-main { display: flex; flex-direction: column; min-height: 0; }
.chat-head { display: flex; gap: 12px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.chat-messages { flex: 1; overflow-y: auto; padding: 16px 20px; display: flex; flex-direction: column; gap: 8px; background: var(--bg); }
.chat-day { align-self: center; font-size: 12px; color: var(--muted); background: var(--surface); padding: 2px 10px; border-radius: 99px; margin: 8px 0; }
.bubble { max-width: min(560px, 80%); align-self: flex-start; background: var(--surface); border: 1px solid var(--border); border-radius: 14px 14px 14px 4px; padding: 8px 12px; display: flex; flex-direction: column; gap: 6px; }
.bubble.mine { align-self: flex-end; background: var(--accent-soft); border-color: transparent; border-radius: 14px 14px 4px 14px; }
.bubble-text { word-wrap: break-word; line-height: 1.55; }
.bubble-time { align-self: flex-end; font-size: 11px; color: var(--muted); }
.time-link { align-self: flex-start; display: inline-flex; gap: 6px; align-items: center; border: 0; background: var(--accent); color: var(--accent-text); padding: 3px 10px; border-radius: 99px; font-size: 12px; font-weight: 600; cursor: pointer; }
.time-link .icon { width: 12px; height: 12px; }
.chat-image { max-width: 100%; max-height: 320px; border-radius: 10px; cursor: zoom-in; display: block; }
.chat-audio { width: 280px; }
.chat-file { display: flex; gap: 8px; align-items: center; background: var(--surface-2); padding: 8px 10px; border-radius: 10px; color: inherit; }
.chat-composer { display: flex; gap: 8px; align-items: flex-end; padding: 10px 12px; border-top: 1px solid var(--border); }
.composer-body { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.chat-composer .textarea { min-height: 40px; resize: none; }
.pending-file { display: flex; gap: 8px; align-items: center; background: var(--surface-2); border-radius: 8px; padding: 4px 4px 4px 10px; }
.btn.recording { background: var(--danger); color: #fff; animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .6; } }
@media (max-width: 860px) {
  .chat-shell { grid-template-columns: 1fr; height: auto; }
  .chat-list { max-height: 260px; }
  .chat-messages { min-height: 360px; }
}

/* ---------- Ads ---------- */
.package-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.package { padding: 16px 18px; display: flex; flex-direction: column; gap: 8px; }
.package .price { font-size: 20px; font-weight: 700; }
.ad-thumb { width: 64px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 6px; }
.ad-image-drop { aspect-ratio: 16 / 9; border: 2px dashed var(--border); border-radius: 10px; display: grid; place-items: center; align-content: center; gap: 6px; cursor: pointer; color: var(--muted); overflow: hidden; }
.ad-image-drop img { width: 100%; height: 100%; object-fit: contain; background: #000; }
.ad-card-preview { display: flex; gap: 10px; background: #161a23; color: #eceef3; border-radius: 12px; overflow: hidden; }
.ad-card-preview img, .ad-card-preview .ph { width: 45%; aspect-ratio: 16 / 9; object-fit: cover; display: grid; place-items: center; background: #262c3a; }
.ad-card-preview .body { display: flex; flex-direction: column; gap: 3px; padding: 8px 8px 8px 0; font-size: 12.5px; min-width: 0; }
.chart-wrap { position: relative; }
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart .grid { stroke: var(--border); stroke-width: 1; }
.chart .baseline { stroke: var(--muted); stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.chart .bar.hover path { filter: brightness(1.15); }
.chart-tip { position: absolute; pointer-events: none; background: var(--text); color: var(--bg); padding: 4px 8px; border-radius: 6px; font-size: 12px; font-weight: 600; white-space: nowrap; }

/* ---------- Tracer ---------- */
.trace-signal { display: flex; gap: 10px; align-items: center; padding: 10px 14px; border-radius: 10px; background: var(--surface-2); flex: 1; }
.trace-signal .icon { color: var(--muted); }
.trace-signal.ok { background: var(--success-soft); }
.trace-signal.ok .icon { color: var(--success); }
.trace-hit { display: flex; gap: 16px; align-items: center; padding: 18px; border-radius: 12px; background: var(--danger-soft); flex-wrap: wrap; }
.trace-hit .big-icon { width: 52px; height: 52px; border-radius: 14px; background: var(--danger); color: #fff; display: grid; place-items: center; }
.trace-hit h2 { font-size: 22px; }
.chart-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 20px; }

/* ---------- Tabbed settings + help ---------- */
.tabbed { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 20px; align-items: start; }
.tab-list { display: flex; flex-direction: column; gap: 4px; position: sticky; top: 24px; }
.tab-item { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; border: 1px solid transparent;
  background: transparent; padding: 10px 14px; border-radius: 10px; cursor: pointer; font-weight: 560; color: var(--muted); }
.tab-item:hover { background: var(--surface-2); color: var(--text); }
.tab-item.active { background: var(--accent-soft); color: var(--accent); }
.tab-item .icon { width: 17px; height: 17px; flex: none; }
.tab-panel { padding: 22px; }
@media (max-width: 860px) {
  .tabbed { grid-template-columns: 1fr; }
  .tab-list { flex-direction: row; overflow-x: auto; position: static; }
  .tab-item span { white-space: nowrap; }
}
.help-list { display: flex; flex-direction: column; gap: 8px; }
.help-item { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--surface); }
.help-item summary { display: flex; align-items: center; gap: 10px; padding: 12px 14px; cursor: pointer; font-weight: 600; list-style: none; }
.help-item summary::-webkit-details-marker { display: none; }
.help-item summary .icon:first-child { color: var(--accent); }
.help-item summary .icon:last-child { margin-left: auto; transition: transform .15s; }
.help-item[open] summary .icon:last-child { transform: rotate(180deg); }
.help-item ul { margin: 0; padding: 0 20px 14px 38px; color: var(--muted); display: flex; flex-direction: column; gap: 8px; line-height: 1.6; }
.help-item .kv, .help-item .shortcuts { padding: 0 16px 16px; }

/* ---------- Messages list: course > lesson > student ---------- */
.chat-filters { display: flex; flex-direction: column; gap: 8px; padding: 12px; border-bottom: 1px solid var(--border); background: var(--surface); }
.chat-filters .search { margin: 0; }
.chat-filters .input.sm { height: 30px; padding: 0 8px; font-size: 12.5px; flex: 1; }
.chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border); background: var(--surface);
  color: var(--muted); border-radius: 99px; padding: 5px 12px; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip .icon { width: 13px; height: 13px; }

/* Three clearly separate levels: the course is the darkest band, the lesson sits under it,
   and the conversations themselves stay on the plain surface. */
.chat-group-head { background: var(--surface-3, #e7e9f2); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 2; font-size: 13.5px; }
.chat-group-head:hover { filter: brightness(.97); }
.chat-lesson-head { display: flex; align-items: center; gap: 6px; width: 100%; border: 0; cursor: pointer; text-align: left;
  background: var(--surface-2); border-bottom: 1px solid var(--border); padding: 6px 12px 6px 22px;
  font-size: 12.5px; font-weight: 600; color: var(--muted); }
.chat-lesson-head:hover { color: var(--text); }
.chat-lesson-head .icon { width: 13px; height: 13px; flex: none; }
.chat-lesson-head .ellipsis { flex: 1; }
.chat-thread { background: var(--surface); padding-left: 22px; }

/* ---------- Rich text editor + rendered text ---------- */
.rt { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--surface); }
.rt-bar { display: flex; align-items: center; gap: 2px; padding: 6px 8px; border-bottom: 1px solid var(--border);
  background: var(--surface-2); flex-wrap: wrap; }
.rt-bar .divider { width: 1px; height: 18px; background: var(--border); margin: 0 5px; }
.rt-bar .input.sm { height: 28px; padding: 0 6px; font-size: 12.5px; width: auto; margin-right: 4px; }
.rt-btn { border: 0; background: transparent; color: var(--muted); border-radius: 6px; padding: 5px; cursor: pointer;
  display: grid; place-items: center; }
.rt-btn:hover { background: var(--surface); color: var(--text); }
.rt-btn .icon { width: 15px; height: 15px; }
.rt-body { min-height: 130px; max-height: 340px; overflow-y: auto; padding: 12px 14px; outline: none; line-height: 1.65; }

.rich-text { line-height: 1.7; }
.rich-text > :first-child { margin-top: 0; }
.rich-text > :last-child { margin-bottom: 0; }
.rich-text p { margin: 0 0 10px; }
.rich-text h2 { font-size: 17px; margin: 16px 0 8px; }
.rich-text h3 { font-size: 15px; margin: 14px 0 6px; }
.rich-text ul, .rich-text ol { margin: 0 0 10px; padding-left: 22px; }
.rich-text li { margin: 3px 0; }
.rich-text blockquote { margin: 0 0 10px; padding: 4px 0 4px 12px; border-left: 3px solid var(--border); color: var(--muted); }
.rich-text a { color: var(--accent); text-decoration: underline; }
.rich-text img { max-width: 100%; height: auto; border-radius: 8px; margin: 6px 0; }

/* ---------- Dashboard ---------- */
.stat-link { position: relative; color: inherit; text-decoration: none; transition: transform .12s, border-color .12s; }
.stat-link:hover { border-color: var(--accent); transform: translateY(-1px); }
.stat-link.accent .stat-value { color: var(--accent); }
.stat-go { margin-left: auto; color: var(--muted); opacity: 0; transition: opacity .12s; }
.stat-link:hover .stat-go { opacity: 1; }
.alert-strip { display: flex; align-items: center; gap: 10px; width: 100%; margin-bottom: 16px; padding: 12px 16px; cursor: pointer;
  border: 1px solid var(--danger); border-radius: 12px; background: var(--danger-soft); color: var(--danger); text-align: left; font: inherit; }
.alert-strip span { color: var(--text); opacity: .8; flex: 1; }
.dash-bar { display: flex; align-items: center; gap: 10px; justify-content: flex-end; margin-bottom: 12px; }
.dash-bar .seg { flex: none; }
.scroll-box { max-height: 560px; overflow-y: auto; }
.chip.sev { display: inline-flex; align-items: center; gap: 6px; }
.sev-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.sev-dot.danger { background: var(--danger); }
.sev-dot.warning { background: var(--warning); }
.sev-dot.normal { background: var(--success); }
.chip.sev.danger.on { background: var(--danger); border-color: var(--danger); }
.chip.sev.warning.on { background: var(--warning); border-color: var(--warning); }
.chip.sev.normal.on { background: var(--success); border-color: var(--success); }
.chip.on .sev-dot { background: #fff; }
.feed .dot.warning { background: var(--warning-soft); color: var(--warning); }
.feed li.sev-danger { background: var(--danger-soft); box-shadow: inset 3px 0 0 var(--danger); }
.feed li.sev-warning { box-shadow: inset 3px 0 0 var(--warning); }

/* ---------- Licenses table ---------- */
.filter-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 16px; }
.filter-bar .search { margin: 0; }
.license-table td { vertical-align: middle; }
.license-table a.strong { font-weight: 650; color: var(--text); text-decoration: none; }
.license-table a.strong:hover { color: var(--accent); }
.license-table tr.row-revoked td { background: var(--danger-soft); }
.license-table tr.row-revoked a.strong { text-decoration: line-through; opacity: .75; }
.table-foot { padding: 10px 16px; border-top: 1px solid var(--border); }
.copy-chip.secret .mono { letter-spacing: .02em; }
.phone-chip { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; color: var(--muted); }
.phone-chip button { border: 0; background: transparent; color: var(--muted); padding: 2px; border-radius: 5px; cursor: pointer; display: grid; place-items: center; }
.phone-chip button:hover, .phone-chip button.on { color: var(--accent); background: var(--accent-soft); }
.phone-chip .icon { width: 14px; height: 14px; }
.stepper { display: inline-flex; align-items: center; gap: 2px; border: 1px solid var(--border); border-radius: 8px; padding: 2px; }
.stepper span { min-width: 44px; text-align: center; font-size: 13px; }
.stepper button { border: 0; background: transparent; border-radius: 6px; padding: 3px; cursor: pointer; color: var(--muted); display: grid; place-items: center; }
.stepper button:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }
.stepper button:disabled { opacity: .35; cursor: default; }
.stepper .icon { width: 13px; height: 13px; }
.row-menu { position: fixed; z-index: 60; min-width: 210px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: 0 12px 40px rgba(0,0,0,.18); padding: 5px; }
.row-menu button { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: transparent; padding: 8px 10px;
  border-radius: 8px; cursor: pointer; font: inherit; font-size: 13.5px; color: var(--text); text-align: left; }
.row-menu button:hover { background: var(--surface-2); }
.row-menu button.danger { color: var(--danger); }
.row-menu hr { border: 0; border-top: 1px solid var(--border); margin: 4px 0; }
.row-menu .icon { width: 15px; height: 15px; }

/* ---------- Messages filter bar ---------- */
.msg-filters { padding: 12px 14px; margin-bottom: 14px; display: flex; flex-direction: column; gap: 10px; }
.mf-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.mf-row .search { margin: 0; }
.mf-row .seg { flex: none; }
.mf-row .divider { width: 1px; height: 22px; background: var(--border); margin: 0 4px; }
.mf-row select.input.sm { height: 32px; padding: 0 8px; font-size: 13px; width: auto; max-width: 240px; }
.mf-row .chip b { font-weight: 700; margin-left: 2px; }
.mf-date { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.mf-date .icon { width: 14px; height: 14px; }
.mf-date .input.sm { height: 32px; padding: 0 8px; }
.mf-active { padding-top: 8px; border-top: 1px dashed var(--border); }
.filter-pill { display: inline-flex; align-items: center; gap: 4px; background: var(--accent-soft); color: var(--accent);
  border-radius: 99px; padding: 3px 4px 3px 10px; font-size: 12.5px; font-weight: 600; }
.filter-pill button { border: 0; background: transparent; color: inherit; border-radius: 50%; padding: 2px; cursor: pointer; display: grid; place-items: center; }
.filter-pill button:hover { background: rgba(0,0,0,.08); }
.filter-pill .icon { width: 12px; height: 12px; }
.await-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--warning); flex: none; }
.chat-shell { height: calc(100vh - 330px); min-height: 460px; }

.stale-notice { position: sticky; top: 0; z-index: 100; display: flex; gap: 12px; align-items: flex-start; padding: 12px 18px;
  background: var(--warning-soft); color: var(--text); border-bottom: 1px solid var(--warning); font-size: 13.5px; }
.stale-notice .icon { color: var(--warning); flex: none; margin-top: 2px; }

/* ---------- Comments (teacher) ---------- */
.cm-bar { display: flex; align-items: center; gap: 8px; padding: 10px 16px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface); z-index: 2; }
.cm-item { display: flex; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.cm-item.status-pending { box-shadow: inset 3px 0 0 var(--warning); }
.cm-item.status-rejected { opacity: .6; }
.cm-check { margin-top: 10px; }
.cm-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.cm-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cm-where .icon, .cm-parent .icon, .cm-answer .icon { width: 13px; height: 13px; vertical-align: -2px; }
.cm-parent { color: var(--muted); border-left: 2px solid var(--border); padding-left: 8px; }
.cm-text { line-height: 1.6; white-space: pre-wrap; }
.cm-answer { color: var(--success); }
.cm-image { max-width: 320px; max-height: 220px; border-radius: 10px; cursor: zoom-in; }
.cm-actions { display: flex; gap: 6px; align-items: center; margin-top: 4px; }
.cm-quote { background: var(--surface-2); border-radius: 10px; padding: 10px 12px; white-space: pre-wrap; }
.avatar.img { object-fit: cover; padding: 0; }
.switch-row { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; cursor: pointer; }
.switch-row input { margin-top: 3px; }
.switch-row > div { display: flex; flex-direction: column; gap: 3px; }
.switch-row .icon { width: 15px; height: 15px; vertical-align: -2px; }
.msg-filters .seg button { white-space: nowrap; }

/* ---------- Wallet & plan, website sales ---------- */
.wallet-alerts { display: flex; flex-direction: column; gap: 10px; margin-bottom: 18px; }
.wallet-alert { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 12px; border: 1px solid transparent; }
.wallet-alert > .icon { flex: none; width: 20px; height: 20px; }
.wallet-alert.danger { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 30%, transparent); }
.wallet-alert.danger > .icon { color: var(--danger); }
.wallet-alert.warning { background: var(--warning-soft); border-color: color-mix(in srgb, var(--warning) 30%, transparent); }
.wallet-alert.warning > .icon { color: var(--warning); }
.wallet-alert.info { background: var(--surface-2); }
.wa-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.wa-text span { font-size: 13px; color: var(--muted); }
.wallet-alerts.compact .wallet-alert { padding: 8px 12px; }
#alert-bar { margin-bottom: 16px; }
#alert-bar .wallet-alerts { margin-bottom: 0; }
.wallet-top { display: grid; grid-template-columns: minmax(260px, 1fr) minmax(320px, 1.4fr); gap: 18px; }
.wallet-top > .card { padding: 20px; }
.wb-amount { font-size: 32px; font-weight: 700; letter-spacing: -.01em; margin: 6px 0 4px; font-variant-numeric: tabular-nums; }
.wb-amount.empty { color: var(--danger); }
.progress.full > div { background: var(--danger); }
.plan-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.plan-card { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 14px; border: 1.5px solid var(--border); border-radius: 12px;
  background: var(--surface); color: var(--text); cursor: pointer; text-align: left; font: inherit; }
.plan-card b { font-size: 18px; }
.plan-card:hover { border-color: var(--accent); }
.plan-card.on { border-color: var(--accent); background: var(--accent-soft); }
.plan-card.custom { cursor: default; }
.plan-card.custom .row { flex-wrap: wrap; }
.plan-card.custom .input { width: 72px !important; }
.btn.danger-text { color: var(--danger); }
.plan-courses { display: flex; flex-direction: column; gap: 6px; max-height: 260px; overflow-y: auto; padding: 2px; }
.plan-course { display: grid; grid-template-columns: auto 1fr 140px; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px; cursor: pointer; }
.plan-course .input.sm { height: 30px; font-size: 12px; }
.guide-steps { margin: 12px 0 0; padding-left: 20px; display: flex; flex-direction: column; gap: 10px; line-height: 1.55; }
.faded { opacity: .45; }
@media (max-width: 900px) { .wallet-top { grid-template-columns: 1fr; } }
