/* ============================================================
   AmbientOs Admin — design system
   Two themes via [data-theme] on .admin-shell:
     light  → clean neutral, blue accent
     dark   → near-black, navy-light accent
   ============================================================ */

.admin-shell {
    /* ── Core palette: ALIASES of the canonical tokens (tokens.css) ──
       One source of truth. These resolve per-element, and because the
       same .admin-shell carries data-theme, the canonical channels flip
       light↔dark and these aliases flip with them — no duplicate values. */
    /* ── Core palette: ALIASES of the canonical primitives (tokens.css) ──
       One source of truth. Surfaces layer by lightness (--surface-1..3) and
       flip light↔dark with the theme; admin names map onto them. */
    --bg:           hsl(var(--background));
    --panel:        var(--surface-1);
    --panel-2:      var(--surface-2);
    --panel-hover:  var(--surface-2);
    --border:       var(--border-subtle);
    --border-strong:var(--border-strong);
    --text:         var(--text-primary);
    --text-muted:   var(--text-secondary);
    --text-faint:   var(--text-muted);
    --accent:       hsl(var(--primary));
    --accent-fg:    hsl(var(--primary-foreground));
    --accent-hover: var(--accent-hover);
    --accent-soft:  var(--accent-soft);
    --danger:       var(--danger);
    --danger-soft:  var(--danger-soft);
    --success:      var(--success);
    --warn:         var(--warning);
    --ring:         hsl(var(--ui-ring) / 0.35);
    --radius:    12px;
    --radius-sm: 8px;

    /* Content-type accents (Video / Reading / Interactive) */
    --video:      #2563eb; --video-soft:#e8f0ff;
    --read:       #d97706; --read-soft: #fdf1e1;
    --inter:      #0d9488; --inter-soft:#e3f6f3;

    background: var(--bg);
    color: var(--text);
    font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
}

.admin-shell[data-theme="dark"] {
    /* ── Admin-only extras — dark overrides. Core vars (surfaces, text,
       semantic, shadow) already flip via the canonical tokens; only the
       content-type accents (no shadcn equivalent) live here. ── */

    /* Content-type accents — dark */
    --video:      #60a5fa; --video-soft:#16233b;
    --read:       #fbbf24; --read-soft: #2a200d;
    --inter:      #2dd4bf; --inter-soft:#10241f;
}

/* ── Page header ───────────────────────────────────────────── */
.ad-page__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 22px;
    flex-wrap: wrap;
}
.ad-page__title {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--text);
}
.ad-page__hint {
    font-size: 14px;
    color: var(--text-muted);
    margin-top: 4px;
}
.ad-page__head-acts {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* ── Card ──────────────────────────────────────────────────── */
.ad-card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.ad-card__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}
.ad-card__title { font-size: 15px; font-weight: 700; }
.ad-card__body { padding: 20px; }

/* ── Stat cards ────────────────────────────────────────────── */
.ad-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.ad-stat {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 20px;
    box-shadow: var(--shadow);
}
.ad-stat__label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}
.ad-stat__value {
    font-size: 30px;
    font-weight: 800;
    margin-top: 6px;
    color: var(--text);
    letter-spacing: -0.02em;
}
.ad-stat__sub { font-size: 12.5px; color: var(--text-faint); margin-top: 2px; }
.ad-stat__icon {
    width: 40px; height: 40px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    background: var(--accent-soft); color: var(--accent);
    float: right;
}

/* ── Buttons ───────────────────────────────────────────────── */
.ad-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 38px;
    padding: 0 16px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 130ms ease, border-color 130ms ease, transform 90ms ease;
    white-space: nowrap;
}
.ad-btn:active { transform: translateY(1px); }
.ad-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); }
.ad-btn--primary { background: var(--accent); color: var(--accent-fg); }
.ad-btn--primary:hover { background: var(--accent-hover); }
.ad-btn--ghost { background: transparent; color: var(--text); border-color: var(--border-strong); }
.ad-btn--ghost:hover { background: var(--panel-hover); }
.ad-btn--danger { background: transparent; color: var(--danger); border-color: var(--border-strong); }
.ad-btn--danger:hover { background: var(--danger-soft); border-color: var(--danger); }
.ad-btn--icon { width: 38px; padding: 0; justify-content: center; }
.ad-btn--sm { height: 32px; padding: 0 12px; font-size: 13px; }
.ad-btn--eye { width: 32px; height: 32px; padding: 0; flex-shrink: 0; justify-content: center; }

/* ── TV logout code ───────────────────────────────────────────── */
.ad-tv-code-cell { display: inline-flex; align-items: center; gap: 8px; height: 32px; }
.ad-tv-code {
    display: inline-flex;
    align-items: center;
    height: 32px;
    min-width: 7ch;
    font-family: ui-monospace, "Cascadia Code", "SFMono-Regular", Consolas, monospace;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.05em;
    text-align: left;
    line-height: 1;
}

/* ── Table ─────────────────────────────────────────────────── */
.ad-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.ad-table th {
    text-align: left;
    font-size: 11.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--panel-2);
}
.ad-table td {
    padding: 13px 16px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    vertical-align: middle;
}
.ad-table tr:last-child td { border-bottom: none; }
.ad-table tbody tr:hover { background: var(--panel-hover); }
.ad-table__actions { display: flex; gap: 8px; justify-content: flex-end; }

/* ── Forms ─────────────────────────────────────────────────── */
.ad-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; min-width: 0; }
.ad-label { font-size: 13px; font-weight: 600; color: var(--text); }
.ad-label__hint { font-weight: 400; color: var(--text-faint); }
.ad-input, .ad-select, .ad-textarea {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    height: 40px;
    padding: 0 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-strong);
    background: var(--panel);
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
    transition: border-color 120ms ease, box-shadow 120ms ease;
}
.ad-textarea { height: auto; min-height: 84px; padding: 10px 12px; resize: vertical; }
.ad-input:focus, .ad-select:focus, .ad-textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--ring);
}
.ad-input::placeholder, .ad-textarea::placeholder { color: var(--text-faint); }
.ad-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.ad-form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 8px; }
.ad-form-row--full { display: block; margin-bottom: 16px; }
.ad-form-row--full > label { font-size: 13px; font-weight: 600; display: block; margin-bottom: 8px; }
.ad-form-toggle { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; cursor: pointer; }
.ad-form-error { font-size: 13px; color: var(--danger); background: var(--danger-soft); border-radius: var(--radius-sm); padding: 10px 12px; margin-bottom: 12px; }
.ad-check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 6px 16px; }
.ad-check-item { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; padding: 4px 0; }
.ad-check-item input[type="checkbox"] { width: 15px; height: 15px; accent-color: var(--accent); flex: none; cursor: pointer; }

/* ── Badge ─────────────────────────────────────────────────── */
.ad-badge {
    display: inline-flex; align-items: center; gap: 6px;
    height: 24px; padding: 0 10px;
    border-radius: 999px;
    font-size: 12px; font-weight: 700;
    background: var(--panel-2); color: var(--text-muted);
}
.ad-badge--ok      { background: color-mix(in srgb, var(--success) 16%, transparent); color: var(--success); }
.ad-badge--warn    { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }
.ad-badge--danger  { background: color-mix(in srgb, var(--danger) 16%, transparent); color: var(--danger); }
.ad-badge--accent  { background: var(--accent-soft); color: var(--accent); }
.ad-badge--muted   { background: var(--panel-2); color: var(--text-muted); }
.ad-badge__dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

/* ── Empty / loading ───────────────────────────────────────── */
.ad-empty {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 12px; padding: 48px 24px; text-align: center;
    color: var(--text-muted);
}
.ad-empty svg { opacity: 0.5; }
.ad-skel {
    display: block; border-radius: 6px;
    background: linear-gradient(90deg, var(--panel-2) 25%, var(--panel-hover) 37%, var(--panel-2) 63%);
    background-size: 400% 100%;
    animation: ad-shimmer 1.3s ease-in-out infinite;
}
@keyframes ad-shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }

/* ── Toast / inline message ────────────────────────────────── */
.ad-note { font-size: 13px; padding: 10px 14px; border-radius: var(--radius-sm); }
.ad-note--ok { background: color-mix(in srgb, var(--success) 12%, transparent); color: var(--success); }
.ad-note--err { background: var(--danger-soft); color: var(--danger); }

/* ── Segmented control ─────────────────────────────────────── */
.ad-seg {
    display: inline-flex;
    background: var(--panel-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 3px;
    gap: 3px;
    width: fit-content;
}
.ad-seg__btn {
    height: 32px;
    padding: 0 20px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: color 120ms ease, background 120ms ease;
}
.ad-seg__btn:hover { color: var(--text); }
.ad-seg__btn.is-on { background: var(--panel); color: var(--text); box-shadow: var(--shadow); }

/* ── Scope bar (class + week) ───────────────────────────────── */
.ad-scope {
    display: flex;
    align-items: flex-end;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}
.ad-weeknav { display: flex; align-items: center; gap: 10px; }
.ad-weeknav__label {
    display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 175px;
}
.ad-weeknav__range { font-size: 14px; font-weight: 700; }

/* ── Day tabs ───────────────────────────────────────────────── */
.ad-daytabs { display: flex; gap: 8px; margin-bottom: 20px; flex-wrap: wrap; }
.ad-daytab {
    display: flex; flex-direction: column; align-items: center; gap: 3px;
    min-width: 80px; padding: 10px 14px;
    border: 1px solid var(--border); border-radius: 10px;
    background: var(--panel); color: var(--text-muted);
    cursor: pointer;
    transition: border-color 120ms ease, color 120ms ease, background 120ms ease;
}
.ad-daytab:hover { border-color: var(--border-strong); color: var(--text); }
.ad-daytab__day { font-size: 13px; font-weight: 700; }
.ad-daytab__date { font-size: 11px; }
.ad-daytab.is-on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.ad-daytab.is-today .ad-daytab__day::after { content: " •"; color: var(--accent); }

/* ── Control bar (class + week) as a card ──────────────────── */
.ad-bar {
    display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
    background: var(--panel); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 12px 16px;
    box-shadow: var(--shadow); margin-bottom: 14px;
}
.ad-bar__sep { width: 1px; align-self: stretch; background: var(--border); margin: 2px 0; }
.ad-bar__right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.ad-weeknav__now {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 11.5px; font-weight: 700; color: var(--accent); margin-top: 2px;
}
.ad-weeknav__now::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }

/* ── Day tabs: count badge ─────────────────────────────────── */
.ad-daytab { position: relative; }
.ad-daytab__count {
    position: absolute; top: 7px; right: 8px;
    font-size: 10px; font-weight: 800; line-height: 1;
    color: var(--accent); background: var(--panel);
    border: 1px solid var(--border); border-radius: 20px; padding: 2px 6px;
}
.ad-daytab.is-on .ad-daytab__count { border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.ad-daytab__count.is-zero { color: var(--text-faint); }

/* ── Timetable timeline ────────────────────────────────────── */
.ad-sched { padding: 6px 12px 12px; }
.ad-slot { display: grid; grid-template-columns: 92px 1fr; }
.ad-slot__time { padding: 16px 10px 16px 4px; text-align: right; position: relative; }
.ad-slot__from { font-weight: 750; font-size: 13.5px; }
.ad-slot__to { font-size: 11.5px; color: var(--text-faint); margin-top: 2px; }
.ad-slot__time::after { content: ""; position: absolute; right: 0; top: 18px; bottom: -8px; width: 2px; background: var(--border); }
.ad-slot:last-child .ad-slot__time::after { display: none; }
.ad-slot__dot {
    position: absolute; right: -5px; top: 17px; width: 12px; height: 12px;
    border-radius: 50%; background: var(--panel); border: 3px solid var(--subj, var(--accent)); z-index: 2;
}
.ad-slot__body { padding: 10px 4px 10px 22px; }
.ad-slotcard {
    display: flex; align-items: center; gap: 14px; padding: 13px 16px;
    border: 1px solid var(--border); border-radius: 12px; background: var(--panel-2);
    border-left: 4px solid var(--subj, var(--accent));
    transition: box-shadow 130ms ease, transform 90ms ease;
}
.ad-slotcard:hover { box-shadow: var(--shadow-lg); transform: translateY(-1px); }
.ad-slotcard__main { min-width: 0; flex: 1; }
.ad-slotcard__subject { font-weight: 750; font-size: 14.5px; }
.ad-slotcard__meta { display: flex; gap: 14px; margin-top: 5px; font-size: 12.5px; color: var(--text-muted); flex-wrap: wrap; align-items: center; }
.ad-slotcard__meta svg { width: 14px; height: 14px; opacity: 0.7; vertical-align: middle; }
.ad-teacher { display: inline-flex; align-items: center; gap: 6px; }
.ad-teacher__av {
    width: 20px; height: 20px; border-radius: 6px; background: var(--subj, var(--accent));
    color: #fff; font-size: 10px; font-weight: 700; display: flex; align-items: center; justify-content: center;
}
.ad-pill { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 700; padding: 4px 10px; border-radius: 8px; white-space: nowrap; }
.ad-pill--lesson   { color: var(--video); background: var(--video-soft); }
.ad-pill--eat      { color: var(--read); background: var(--read-soft); }
.ad-pill--activity { color: var(--inter); background: var(--inter-soft); }
.ad-pill--break    { color: var(--text-muted); background: var(--panel-hover); }
.ad-rowacts { display: flex; gap: 4px; opacity: 0; transition: opacity 120ms ease; }
.ad-slotcard:hover .ad-rowacts, .ad-res:hover .ad-rowacts { opacity: 1; }
.ad-act {
    width: 32px; height: 32px; border-radius: 9px; border: 1px solid transparent;
    background: transparent; color: var(--text-faint); cursor: pointer;
    display: flex; align-items: center; justify-content: center; transition: background 120ms, color 120ms;
}
.ad-act:hover { background: var(--panel-hover); color: var(--text); }
.ad-act--danger:hover { background: var(--danger-soft); color: var(--danger); }
.ad-act svg { width: 16px; height: 16px; }

/* ── Coursera resource groups ──────────────────────────────── */
.ad-resgroup { padding: 4px 14px 12px; }
.ad-resgroup__head { display: flex; align-items: center; gap: 10px; padding: 14px 2px 9px; }
.ad-resgroup__time { font-size: 12px; font-weight: 800; color: #fff; background: var(--subj, var(--accent)); border-radius: 7px; padding: 3px 8px; }
.ad-resgroup__subj { font-weight: 750; font-size: 14px; }
.ad-resgroup__cnt { font-size: 12px; color: var(--text-faint); font-weight: 600; margin-left: auto; }
.ad-res {
    display: flex; align-items: center; gap: 13px; padding: 11px 14px;
    border: 1px solid var(--border); border-radius: 12px; background: var(--panel-2);
    margin-bottom: 8px; transition: box-shadow 130ms ease, transform 90ms ease;
}
.ad-res:hover { box-shadow: var(--shadow-lg); transform: translateY(-1px); }
.ad-res__thumb { width: 52px; height: 40px; border-radius: 9px; flex: none; display: flex; align-items: center; justify-content: center; }
.ad-res__thumb svg { width: 22px; height: 22px; }
.ad-res__thumb--video { background: var(--video-soft); color: var(--video); }
.ad-res__thumb--read  { background: var(--read-soft);  color: var(--read); }
.ad-res__thumb--inter { background: var(--inter-soft); color: var(--inter); }
.ad-res__main { min-width: 0; flex: 1; }
.ad-res__title { font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ad-res__src { font-size: 12px; color: var(--text-faint); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ad-kind { font-size: 11px; font-weight: 800; padding: 3px 9px; border-radius: 7px; white-space: nowrap; }
.ad-kind--video { color: var(--video); background: var(--video-soft); }
.ad-kind--read  { color: var(--read);  background: var(--read-soft); }
.ad-kind--inter { color: var(--inter); background: var(--inter-soft); }

/* ── Legend ────────────────────────────────────────────────── */
.ad-legend { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-top: 16px; font-size: 12.5px; color: var(--text-muted); }
.ad-legend__item { display: inline-flex; align-items: center; gap: 6px; }
.ad-legend__sw { width: 11px; height: 11px; border-radius: 4px; }
.ad-legend__spacer { margin-left: auto; color: var(--text-faint); }

/* ── Settings list (row + divider) ─────────────────────────── */
.ad-setlist { display: flex; flex-direction: column; }
.ad-setrow {
    display: flex; align-items: center; justify-content: space-between;
    gap: 24px; padding: 20px 0; border-bottom: 1px solid var(--border);
}
.ad-setrow:first-child { padding-top: 4px; }
.ad-setrow:last-child { border-bottom: none; padding-bottom: 4px; }
.ad-setrow__info { min-width: 0; }
.ad-setrow__title { font-size: 14.5px; font-weight: 700; }
.ad-setrow__hint { font-size: 12.5px; color: var(--text-muted); margin-top: 4px; line-height: 1.5; }
.ad-setrow__control { flex: none; }

/* Text-size sample buttons (A small → large), TV-style */
.ad-sizebtns { display: inline-flex; align-items: center; gap: 7px; }
.ad-sizebtn {
    width: 46px; height: 46px; display: flex; align-items: center; justify-content: center;
    border: 1px solid var(--border-strong); border-radius: 11px; background: var(--panel);
    color: var(--text-muted); font-weight: 800; line-height: 1; cursor: pointer;
    transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
}
.ad-sizebtn:hover { background: var(--panel-hover); color: var(--text); }
.ad-sizebtn.is-on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }

/* ── Confirm modal (in-page) ───────────────────────────────── */
.ad-backdrop {
    position: fixed; inset: 0; z-index: 80;
    background: rgba(0, 0, 0, 0.5);
    display: flex; align-items: center; justify-content: center; padding: 24px;
    animation: ad-fade 120ms ease;
}
.ad-modal {
    width: min(440px, 96vw);
    background: var(--panel); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow-lg);
    overflow: hidden; animation: ad-pop 140ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
.ad-modal__body { padding: 22px 22px 6px; }
.ad-modal__icon {
    width: 44px; height: 44px; border-radius: 12px; margin-bottom: 14px;
    display: flex; align-items: center; justify-content: center;
    background: var(--accent-soft); color: var(--accent);
}
.ad-modal__title { font-size: 17px; font-weight: 800; letter-spacing: -0.01em; }
.ad-modal__text { font-size: 13.5px; color: var(--text-muted); margin-top: 8px; line-height: 1.55; }
.ad-modal__foot { display: flex; justify-content: flex-end; gap: 10px; padding: 18px 22px; }
@keyframes ad-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes ad-pop { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: none; } }

/* ── Pager (ad-pager) ──────────────────────────────────────── */
.ad-pager {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    border-top: 1px solid var(--border);
    justify-content: flex-end;
    flex-wrap: wrap;
}
.ad-pager > span { font-size: 13px; color: var(--text-muted); margin-right: auto; }

/* ── UiSearchBox ───────────────────────────────────────────── */
.ui-search {
    position: relative;
    display: inline-flex;
    align-items: center;
    height: 36px;
    min-width: 160px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: var(--panel);
    transition: border-color 120ms ease, box-shadow 120ms ease;
}
.ui-search--focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--ring);
}
.ui-search--disabled { opacity: 0.55; pointer-events: none; }
.ui-search__icon {
    flex: none;
    width: 16px; height: 16px;
    margin-left: 10px;
    color: var(--text-muted);
    pointer-events: none;
}
.ui-search__input {
    flex: 1;
    height: 100%;
    padding: 0 8px;
    border: none;
    background: transparent;
    color: var(--text);
    font-size: 13px;
    font-family: inherit;
    outline: none;
    min-width: 0;
}
.ui-search__input::placeholder { color: var(--text-faint); }
.ui-search__input::-webkit-search-cancel-button { display: none; }
.ui-search__clear {
    flex: none;
    width: 28px; height: 28px;
    margin-right: 4px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background 100ms ease, color 100ms ease;
}
.ui-search__clear:hover { background: var(--panel-hover); color: var(--text); }

/* ── UiPager ───────────────────────────────────────────────── */
.ui-pager {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 12px 20px;
    border-top: 1px solid var(--border);
    justify-content: flex-end;
    flex-wrap: wrap;
}
.ui-pager__info {
    font-size: 13px;
    color: var(--text-muted);
    margin-right: auto;
}
.ui-pager__size {
    height: 30px;
    padding: 0 6px;
    border: 1px solid var(--border-strong);
    border-radius: 6px;
    background: var(--panel);
    color: var(--text);
    font-size: 12px;
    font-family: inherit;
    cursor: pointer;
}
.ui-pager__btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    height: 30px;
    padding: 0 10px;
    border: 1px solid var(--border-strong);
    border-radius: 6px;
    background: transparent;
    color: var(--text);
    font-size: 12px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background 120ms ease, border-color 120ms ease;
    white-space: nowrap;
}
.ui-pager__btn:hover:not(:disabled) { background: var(--panel-hover); }
.ui-pager__btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); }
.ui-pager__btn:disabled { opacity: 0.4; cursor: default; }

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 720px) {
    .ad-form-row { grid-template-columns: 1fr; }
    .ad-scope { gap: 12px; }
    .ad-slot { grid-template-columns: 70px 1fr; }
    .ad-setrow { flex-direction: column; align-items: flex-start; gap: 12px; }
}

/* ── Hub link cards (LearningHub + ManagementHub) ──────────── */
.lr-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
    margin-top: 8px;
}

.lr-card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 20px;
    cursor: pointer;
    transition: box-shadow 0.15s, border-color 0.15s;
}

.lr-card:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow);
}

.lr-card__priority {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 4px;
    background: var(--accent);
    color: var(--accent-fg);
    margin-bottom: 8px;
}

.lr-card__title {
    margin: 0 0 4px;
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
}

.lr-card__desc {
    margin: 0 0 8px;
    font-size: 13px;
    color: var(--text-muted);
}

.lr-card__route {
    font-size: 12px;
    color: var(--text-faint);
}

/* ── Role + campus scope selector (AdminStaff) ─────────────── */
.ad-role-scope-list { display: flex; flex-direction: column; gap: 8px; }
.ad-role-scope-row { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 12px; }
.ad-role-scope-row__check { font-weight: 600; }
.ad-role-scope-row__scope {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 16px;
    margin-top: 6px;
    padding-left: 24px;
    border-top: 1px solid var(--border);
    padding-top: 6px;
}
.ad-check-item input[type="radio"] { width: 15px; height: 15px; accent-color: var(--accent); flex: none; cursor: pointer; }
.ad-btn--danger { color: var(--danger); }
.ad-btn--danger:hover { background: var(--danger-soft); }

/* ── Direct-pick role chips + classroom-by-campus picker (#279) ─────────────── */
.ad-role-chip-list { display: flex; flex-wrap: wrap; gap: 8px; }
.ad-role-chip {
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--panel);
    color: var(--text);
    padding: 6px 12px;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.ad-role-chip:hover { border-color: var(--accent); }
.ad-role-chip.is-selected {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--accent-contrast, #fff);
    font-weight: 500;
}
.ad-classroom-group { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 12px; margin-bottom: 8px; }
.ad-classroom-group__header { font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.03em; color: var(--text-faint); margin-bottom: 6px; }
.ad-empty-hint { color: var(--text-faint); font-size: 13px; padding: 8px 0; }
.ad-selected-chip {
    display: inline-flex;
    align-items: center;
    background: hsl(var(--primary) / 0.12);
    color: var(--accent);
    border-radius: var(--radius-sm);
    padding: 3px 8px;
    font-size: 13px;
    font-weight: 500;
    gap: 6px;
}
.ad-selected-chip__remove {
    background: none;
    border: none;
    color: inherit;
    display: flex;
    align-items: center;
    padding: 0;
    cursor: pointer;
    opacity: 0.65;
}
.ad-selected-chip__remove:hover { opacity: 1; }

/* ── Segmented control (e.g. "This campus | All org") ────────── */
.ad-segmented {
    display: flex;
    align-items: center;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--surface-2);
}
.ad-segmented__btn {
    padding: 5px 14px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 100ms ease, color 100ms ease;
    white-space: nowrap;
}
.ad-segmented__btn + .ad-segmented__btn { border-left: 1px solid var(--border); }
.ad-segmented__btn:hover { background: var(--panel-hover); color: var(--text); }
.ad-segmented__btn.is-active { background: var(--accent); color: var(--accent-fg); }
.ad-segmented__btn:disabled { opacity: 0.5; cursor: not-allowed; }
.ad-segmented--inline { display: inline-flex; width: auto; }

/* ── Card scope hint (AdminStaff) ─────────────────────────────── */
.ad-card__scope-hint {
    padding: 6px 20px;
    font-size: 12px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-subtle);
    background: var(--surface-2);
    margin: 0;
}

/* ── Shared editor shell (EditorShell.razor) — extracted from ActivityEditor
   so ActivityEditor / ActivityTemplateEditor / WeekTopicEditor share one look ── */
/* ── Two-column layout: tab form (left) + persistent Curriculum/Taxonomy (right) ── */
.ae-layout {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 24px;
    align-items: start;
}

.ae-layout__side {
    display: flex;
    flex-direction: column;
    gap: 16px;
    position: sticky;
    top: 16px;
}

@media (max-width: 900px) {
    .ae-layout {
        grid-template-columns: 1fr;
    }
}

/* ── Full-page tab bar ────────────────────────────────────────── */
.ae-tabbar {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 20px;
}

.ae-tab {
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.1s, border-color 0.1s;
}

.ae-tab:hover {
    color: var(--text);
}

.ae-tab--active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

/* ── Tab panel content (full-width, single tab visible) ─────────── */
.ae-tabpanel {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.ae-tabpanel .ui-field {
    margin-bottom: 0;
}

.ui-field--err input,
.ui-field--err input {
    border-color: crimson !important;
    box-shadow: 0 0 0 2px color-mix(in srgb, crimson 25%, transparent) !important;
}

/* Two-field inline row (e.g. age from/to) */
.ae-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

/* Generic field wrapper (e.g. rich-text description) */
.ae-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* ── Section card ──────────────────────────────────────────────── */
.ae-section {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius, 10px);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ae-section__title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
    margin: 0;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.ae-section__summary {
    margin: 0;
    font-size: 12px;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── Milestone search box ──────────────────────────────────────── */
.ae-ms-search {
    margin-bottom: 0;
}

.ae-ms-search .ui-field {
    margin-bottom: 0;
}

/* ── Open-picker button ────────────────────────────────────────── */
.ae-ms-open {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    text-align: left;
    background: var(--panel-2, var(--panel));
    border: 1px solid var(--border);
    border-radius: var(--radius-sm, 8px);
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    cursor: pointer;
    transition: background 0.1s;
}

.ae-ms-open:hover {
    background: var(--border);
}

/* ── Picker modal card width ───────────────────────────────────── */
.ae-ms-modal {
    min-width: 420px;
    max-width: 560px;
}

.ae-ms-modal--wide {
    max-width: 640px;
}

/* ── Taxonomy block inside the milestone picker modal ─────────────── */
.ae-tax-block {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-bottom: 12px;
    margin-bottom: 4px;
    border-bottom: 1px solid var(--border);
}

.ae-tax-link {
    color: var(--accent);
    text-decoration: underline;
    margin-left: 4px;
}

.ae-ms-code {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    white-space: nowrap;
    flex-shrink: 0;
}

.ae-ms-title {
    flex: 1;
    font-weight: 500;
}

/* ── Tree view ─────────────────────────────────────────────────── */
.ae-ms-tree {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 340px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm, 8px);
    padding: 4px;
    background: var(--panel-2, var(--panel));
}

.ae-ms-area {
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}

.ae-ms-area__hd {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    text-align: left;
    background: var(--panel-2, var(--border));
    border: none;
    padding: 8px 10px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
    transition: background 0.1s;
}

.ae-ms-area__hd:hover {
    background: var(--border);
}

.ae-ms-area__dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.ae-ms-chevron {
    margin-left: auto;
    font-size: 11px;
    color: var(--text-muted);
}

/* ── Milestone list inside an area ────────────────────────────── */
.ae-ms-list {
    list-style: none;
    margin: 0;
    padding: 4px 0;
    display: flex;
    flex-direction: column;
}

.ae-ms-node {
    display: block;
    width: 100%;
    box-sizing: border-box;
}

.ae-ms-row {
    display: flex;
    align-items: center;
    gap: 4px;
    min-height: 26px;
    padding: 2px 8px;
    border-radius: 6px;
    transition: background 0.1s;
}

.ae-ms-row:hover {
    background: var(--border);
}

.ae-ms-row--sel {
    background: color-mix(in srgb, var(--accent) 10%, transparent);
}

.ae-ms-expand {
    background: none;
    border: none;
    padding: 2px 4px;
    font-size: 10px;
    color: var(--text-muted);
    cursor: pointer;
    flex-shrink: 0;
}

.ae-ms-pick {
    background: none;
    border: none;
    text-align: left;
    font-size: 13px;
    color: var(--text);
    cursor: pointer;
    padding: 4px 0;
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: baseline;
    gap: 6px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.ae-ms-row--sel .ae-ms-pick {
    color: var(--accent);
    font-weight: 500;
}

/* ── Selected chips label ──────────────────────────────────────── */
.ae-ms-chips-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding-top: 4px;
    border-top: 1px solid var(--border);
}

/* ── Card resources (ADR-38) ───────────────────────────────────── */
.ae-res-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ae-res-row {
    display: grid;
    grid-template-columns: 1fr 1.4fr auto;
    gap: 6px;
    align-items: start;
}

/* ── Chips container ───────────────────────────────────────────── */
.ae-ms-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.ae-ms-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: color-mix(in srgb, var(--accent) 14%, transparent);
    border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
    color: var(--accent);
    border-radius: 6px;
    padding: 3px 6px 3px 8px;
    font-size: 12px;
    font-weight: 600;
    max-width: 100%;
}

.ae-ms-chip > span:first-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Code badge inside chip */
.ae-ms-chip__code {
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.03em;
    background: color-mix(in srgb, var(--accent) 22%, transparent);
    border-radius: 4px;
    padding: 1px 4px;
    white-space: nowrap;
    flex-shrink: 0;
}

/* Title text inside chip */
.ae-ms-chip__title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
}

.ae-ms-chip__del {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0 2px;
    font-size: 14px;
    line-height: 1;
    color: var(--accent);
    opacity: 0.6;
    border-radius: 3px;
    flex-shrink: 0;
    transition: opacity 0.1s;
}

.ae-ms-chip__del:hover {
    opacity: 1;
    background: color-mix(in srgb, var(--accent) 20%, transparent);
}

/* ── Empty hint ────────────────────────────────────────────────── */
.ae-ms-empty {
    font-size: 12px;
    color: var(--text-muted);
    margin: 0;
    padding: 4px 0;
}

/* ── ADR-35 D3: approval status badge ─────────────────────────────── */
.ae-approval-badge {
    display: inline-block;
    margin-top: 4px;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}

.ae-approval-badge--draft { background: color-mix(in srgb, var(--text-muted) 20%, transparent); color: var(--text-muted); }
.ae-approval-badge--review { background: color-mix(in srgb, orange 20%, transparent); color: darkorange; }
.ae-approval-badge--approved { background: color-mix(in srgb, seagreen 20%, transparent); color: seagreen; }
.ae-approval-badge--archived { background: color-mix(in srgb, gray 20%, transparent); color: gray; }
.ae-approval-badge--donotuse { background: color-mix(in srgb, crimson 20%, transparent); color: crimson; }

/* ── Collapsible card sections (native <details>) ─────────────────── */
.ae-section > summary.ae-section__title {
    cursor: pointer;
    list-style: none;
}

.ae-section > summary.ae-section__title::-webkit-details-marker {
    display: none;
}

/* Single-column variant when EditorShell has no Side content */
.ae-layout--full {
    grid-template-columns: 1fr;
}
