/* Nik Cosmo Studio.
   Layout: an app shell in the colours of Nik's posters. Sidebar on desktop, tab bar on phones,
   one main column of panels; editors open as a side sheet (a bottom sheet on phones).
   Students get the same shell with their own menu (body.is-portal); the sign-in screen is one centred column (body.is-solo).
   One typeface (Archivo) at two widths: condensed capitals for titles, normal width for everything else. */
:root {
  color-scheme: dark;
  --bg: #0b0a09;
  --bg-2: #110f0d;
  --surface: #181511;
  --surface-2: #211d18;
  --line: #2b2621;
  --line-2: #3a332b;
  --text: #f2ece3;
  --text-2: #c3b8a9;
  --text-3: #978c7e;
  --gold: #cba574;
  --gold-text: #dfbf91;
  --gold-wash: rgba(203, 165, 116, 0.1);
  --on-gold: #17110a;
  --nord: #c8161e;
  --ok: #93c79b;
  --warn: #f0a35e;
  --bad: #f2998b;
  --shadow: 0 24px 64px rgba(0, 0, 0, 0.55);
  --font: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --gutter: clamp(16px, 3.5vw, 40px);
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;
    --bg: #f3f1ec; --bg-2: #ebe7df; --surface: #fcfbf8; --surface-2: #f1ede6;
    --line: #e1dbd0; --line-2: #cfc6b7;
    --text: #16120d; --text-2: #4f463c; --text-3: #776c5e;
    --gold: #b58c55; --gold-text: #7a5a2e; --gold-wash: rgba(181, 140, 85, 0.13); --on-gold: #17110a;
    --nord: #c8161e; --ok: #2d7a45; --warn: #a8500c; --bad: #b3261e;
    --shadow: 0 24px 64px rgba(40, 30, 15, 0.18);
  }
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f3f1ec; --bg-2: #ebe7df; --surface: #fcfbf8; --surface-2: #f1ede6;
  --line: #e1dbd0; --line-2: #cfc6b7;
  --text: #16120d; --text-2: #4f463c; --text-3: #776c5e;
  --gold: #b58c55; --gold-text: #7a5a2e; --gold-wash: rgba(181, 140, 85, 0.13); --on-gold: #17110a;
  --nord: #c8161e; --ok: #2d7a45; --warn: #a8500c; --bad: #b3261e;
  --shadow: 0 24px 64px rgba(40, 30, 15, 0.18);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
img { max-width: 100%; }
[hidden] { display: none !important; }
body {
  margin: 0;
  min-height: 100vh;
  padding-top: env(safe-area-inset-top, 0px);
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  font-synthesis: none;
}
h1, h2, h3, p, ul, ol, dl, dd { margin: 0; }
ul, ol { padding: 0; list-style: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--gold-text); text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 6px; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.ic { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- type ---------- */
.h1 {
  font-stretch: 62%;
  font-weight: 800;
  text-transform: uppercase;
  font-size: clamp(2.1rem, 1.5rem + 2.4vw, 3.2rem);
  line-height: 0.92;
  letter-spacing: 0.005em;
  text-wrap: balance;
}
.h2 {
  font-stretch: 62%;
  font-weight: 780;
  text-transform: uppercase;
  font-size: 1.3rem;
  line-height: 1.05;
  letter-spacing: 0.02em;
}
.eyebrow {
  font-size: 11.5px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--gold-text);
}
.muted { color: var(--text-3); }
.sub { color: var(--text-2); }

/* ---------- shell ---------- */
.app { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100vh; }
.side {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  align-self: start;
  height: calc(100vh - env(safe-area-inset-top, 0px));
  display: flex;
  flex-direction: column;
  gap: 26px;
  padding: 22px 14px 18px;
  background: var(--bg-2);
  border-right: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 11px; padding-inline: 8px; }
.mark { width: 38px; height: 26px; flex: none; }
.brand-name { display: block; font-stretch: 62%; font-weight: 820; text-transform: uppercase; font-size: 1.32rem; line-height: 0.95; letter-spacing: 0.02em; }
.brand-sub { display: block; font-size: 10.5px; font-weight: 400; text-transform: uppercase; letter-spacing: 0.16em; color: var(--gold-text); margin-top: 3px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav button {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 9px 10px; border: 0; border-radius: 9px;
  background: none; color: var(--text-2); font-weight: 600; text-align: left;
}
.nav button:hover { background: var(--surface); color: var(--text); }
.nav button[aria-current="page"] { background: var(--surface-2); color: var(--text); }
.nav button[aria-current="page"] .ic { color: var(--gold); }
.nav .count { margin-left: auto; font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.nav .count.is-due { color: var(--on-gold); background: var(--gold); border-radius: 999px; padding: 0 7px; font-weight: 700; }
.side-actions { display: flex; flex-direction: column; gap: 8px; margin-top: auto; }
.side-foot { font-size: 12px; color: var(--text-3); padding-inline: 8px; line-height: 1.4; }

.topbar { display: none; }
.tabbar { display: none; }

main { min-width: 0; width: 100%; max-width: 1240px; padding-inline: var(--gutter); padding-block: 30px 72px; }

@media (max-width: 899px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .side { display: none; }
  .topbar {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    position: sticky; top: env(safe-area-inset-top, 0px); z-index: 15;
    padding: 10px var(--gutter);
    background: var(--bg-2); border-bottom: 1px solid var(--line);
  }
  .tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px));
    background: var(--bg-2); border-top: 1px solid var(--line);
  }
  .tabbar button {
    flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 3px;
    padding: 6px 2px; border: 0; background: none; color: var(--text-3);
    font-size: 11px; font-weight: 600; border-radius: 8px;
  }
  .tabbar button[aria-current="page"] { color: var(--gold-text); }
  main { padding-block: 22px calc(96px + env(safe-area-inset-bottom, 0px)); }
}

/* ---------- controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 38px; padding: 0 15px;
  border: 1px solid var(--line-2); border-radius: 999px;
  background: transparent; color: var(--text);
  font-size: 14px; font-weight: 620; white-space: nowrap; text-decoration: none;
}
.btn:hover { border-color: var(--gold); }
.btn-primary { background: var(--gold); border-color: var(--gold); color: var(--on-gold); }
.btn-primary:hover { filter: brightness(1.08); }
.btn-sm { min-height: 32px; padding: 0 12px; font-size: 13px; }
.btn-danger { background: var(--bad); border-color: var(--bad); color: var(--bg); }
.btn-quiet-danger { color: var(--bad); border-color: transparent; padding-inline: 8px; }
.btn-quiet-danger:hover { border-color: var(--bad); }
.btn[disabled] { opacity: 0.55; cursor: progress; }
.icon-btn {
  display: inline-grid; place-items: center; width: 34px; height: 34px; flex: none;
  border: 1px solid var(--line-2); border-radius: 50%; background: transparent; color: var(--text-2);
}
.icon-btn:hover { color: var(--text); border-color: var(--gold); }
.linkish { border: 0; background: none; padding: 0; color: var(--gold-text); font-weight: 620; text-decoration: underline; text-underline-offset: 3px; }

.in {
  width: 100%; min-height: 40px; padding: 8px 11px;
  border: 1px solid var(--line-2); border-radius: 9px;
  background: var(--bg-2); color: var(--text); font-size: 15px;
}
textarea.in { min-height: 0; resize: vertical; line-height: 1.5; }
.in:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-wash); }
select.in { appearance: auto; }
.search { max-width: 280px; }

.seg { display: inline-flex; flex-wrap: wrap; gap: 3px; padding: 3px; border-radius: 11px; background: var(--bg-2); border: 1px solid var(--line); }
.seg label, .seg button { position: relative; display: block; }
.seg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg span, .seg button {
  display: block; padding: 6px 11px; border-radius: 8px; border: 0; background: none;
  font-size: 13px; font-weight: 600; color: var(--text-2); white-space: nowrap;
}
.seg input:checked + span, .seg button[aria-pressed="true"] { background: var(--surface-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--line-2); }
.seg input:focus-visible + span { outline: 2px solid var(--gold); outline-offset: 1px; }
.seg small { color: var(--text-3); font-weight: 500; margin-left: 4px; font-variant-numeric: tabular-nums; }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 9px; border-radius: 999px; border: 1px solid var(--line-2);
  font-size: 11.5px; font-weight: 650; letter-spacing: 0.03em; color: var(--text-2); white-space: nowrap;
}
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.s-planned { color: var(--gold-text); }
.chip.s-planned { border-color: color-mix(in srgb, var(--gold) 50%, transparent); }
.s-done { color: var(--ok); }
.chip.s-done { border-color: color-mix(in srgb, var(--ok) 45%, transparent); }
.s-cancelled { color: var(--text-3); }
.s-noshow { color: var(--bad); }
.chip.s-noshow { border-color: color-mix(in srgb, var(--bad) 45%, transparent); }
.chip-ex { border-style: dashed; color: var(--text-3); }
.chip-rec { color: var(--nord); border-color: color-mix(in srgb, var(--nord) 55%, transparent); }
.chip-ready { color: var(--ok); }
.chip-polishing { color: var(--gold-text); }

/* ---------- page header ---------- */
.vh { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px 24px; margin-bottom: 22px; }
.vh-title { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.vh-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.vh-id { display: flex; align-items: center; gap: 16px; min-width: 0; }
.back { margin-bottom: 14px; }

.banner {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 18px;
  padding: 12px 16px; margin-bottom: 22px;
  border: 1px dashed var(--line-2); border-radius: 12px; color: var(--text-2); font-size: 14px;
}
.banner b { color: var(--text); }
.banner-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- panels and rows ---------- */
.cols { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
@media (max-width: 1099px) { .cols { grid-template-columns: minmax(0, 1fr); } }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 18px 18px 14px; min-width: 0; }
.panel-h { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.panel-h .muted { font-size: 13px; }
.empty { color: var(--text-3); font-size: 14px; padding: 6px 0 8px; }
.empty .linkish { font-size: 14px; }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
@media (max-width: 640px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.stat {
  display: flex; flex-direction: column; gap: 2px; text-align: left;
  padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--text-2);
  font-size: 13px;
}
button.stat:hover { border-color: var(--gold); }
.stat b { font-stretch: 62%; font-weight: 800; font-size: 2rem; line-height: 1; color: var(--text); font-variant-numeric: tabular-nums; }
.stat.is-due b { color: var(--warn); }

.rows { display: flex; flex-direction: column; }
.row {
  display: grid; align-items: center; gap: 4px 14px; width: 100%;
  padding: 11px 4px; border: 0; border-top: 1px solid var(--line); background: none; color: var(--text); text-align: left;
}
.rows > .row:first-child { border-top: 0; }
button.row:hover, .row.is-click:hover { background: var(--gold-wash); }
.row .t { font-weight: 620; min-width: 0; overflow-wrap: anywhere; }
.row .m { color: var(--text-3); font-size: 13px; min-width: 0; }
.row-mini { grid-template-columns: 92px minmax(0, 1fr) auto; }
.row-mini .d { font-size: 13px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.row-mini .cta { font-size: 13px; color: var(--gold-text); font-weight: 620; }

/* lesson cards (today, week) */
.lc {
  display: flex; flex-direction: column; gap: 3px; width: 100%; text-align: left;
  padding: 9px 10px; border-radius: 9px; border: 1px solid var(--line-2); background: var(--surface-2); color: var(--text);
}
.lc:hover { border-color: var(--gold); }
.lc-top { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.lc-top .st { margin-left: auto; font-weight: 650; }
.lc-name { font-weight: 650; font-size: 14px; line-height: 1.25; overflow-wrap: anywhere; }
.lc-meta { font-size: 12px; color: var(--text-3); }
.lc-plan { font-size: 12.5px; color: var(--text-2); line-height: 1.4; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.lc.s-planned { border-color: color-mix(in srgb, var(--gold) 45%, var(--line-2)); }
.lc.s-cancelled { opacity: 0.62; }
.lc.s-cancelled .lc-name { text-decoration: line-through; }
.lc.ghost { background: transparent; border-style: dashed; color: var(--text-2); }
.lc.ghost .lc-name { color: var(--text-2); }
.lc.ghost.is-late { border-color: color-mix(in srgb, var(--warn) 55%, transparent); }
.lc.ghost.is-late .lc-meta { color: var(--warn); }
.lc-list { display: flex; flex-direction: column; gap: 8px; }

/* week */
.week-nav { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.day { display: flex; flex-direction: column; min-width: 0; min-height: 240px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.day.is-today { border-color: var(--gold); }
.day.is-past .day-num { color: var(--text-3); }
.day-h { display: flex; align-items: center; gap: 7px; padding: 10px 8px 9px 11px; border-bottom: 1px solid var(--line); }
.day-name { font-size: 11px; font-weight: 650; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-3); }
.day-num { font-stretch: 62%; font-weight: 800; font-size: 1.65rem; line-height: 1; font-variant-numeric: tabular-nums; }
.led { width: 7px; height: 7px; border-radius: 50%; background: var(--nord); box-shadow: 0 0 0 3px color-mix(in srgb, var(--nord) 22%, transparent); }
.day-add { margin-left: auto; width: 28px; height: 28px; }
.day-list { display: flex; flex-direction: column; gap: 6px; padding: 8px; flex: 1; }
.day-empty { font-size: 12px; color: var(--text-3); padding: 2px 3px; }
@media (max-width: 1099px) {
  .week { grid-template-columns: minmax(0, 1fr); }
  .day { flex-direction: row; min-height: 0; }
  .day-h { flex-direction: column; align-items: flex-start; gap: 4px; width: 74px; flex: none; border-bottom: 0; border-right: 1px solid var(--line); padding: 11px 10px; }
  .day-add { margin: 4px 0 0; }
  .day-list { min-width: 0; }
}

/* students */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.toolbar .grow { flex: 1; }
.avatar {
  display: inline-grid; place-items: center; width: 38px; height: 38px; flex: none; border-radius: 50%;
  background: var(--gold-wash); color: var(--gold-text); border: 1px solid color-mix(in srgb, var(--gold) 35%, transparent);
  font-stretch: 62%; font-weight: 800; font-size: 15px; letter-spacing: 0.04em;
}
.avatar-lg { width: 64px; height: 64px; font-size: 24px; }
.srow { grid-template-columns: 38px minmax(0, 1.5fr) minmax(0, 1fr) minmax(0, 1fr) minmax(0, 0.9fr); }
.srow .stack { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.row-head { padding-block: 0 8px; border-top: 0; font-size: 11px; font-weight: 650; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-3); }
@media (max-width: 760px) {
  .srow { grid-template-columns: 38px minmax(0, 1fr); }
  .srow > :nth-child(n + 3) { grid-column: 2; }
  .row-head { display: none; }
}
.meter { display: flex; gap: 3px; max-width: 160px; }
.meter i { flex: 1; height: 9px; border-radius: 2px; background: var(--line-2); }
.meter i.on { background: var(--gold); }
.meter.is-low i.on { background: var(--warn); }
.meter-t { font-size: 12.5px; color: var(--text-2); margin-top: 4px; }
.meter-t.is-low { color: var(--warn); font-weight: 620; }

/* student detail */
.facts { display: grid; grid-template-columns: 118px minmax(0, 1fr); gap: 9px 14px; font-size: 14px; }
.facts dt { color: var(--text-3); font-size: 13px; }
.facts dd { min-width: 0; overflow-wrap: anywhere; }
.copyable { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.copyable button { border: 0; background: none; padding: 0; color: var(--gold-text); font-size: 12.5px; font-weight: 620; }
.prose { white-space: pre-wrap; overflow-wrap: anywhere; max-width: 68ch; }
.tl { display: grid; grid-template-columns: 104px minmax(0, 1fr); gap: 4px 16px; padding: 14px 0; border-top: 1px solid var(--line); }
.tl:first-child { border-top: 0; padding-top: 4px; }
.tl-when { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.tl-date { border: 0; background: none; padding: 0; color: var(--text); font-weight: 680; font-size: 14px; text-align: left; font-variant-numeric: tabular-nums; }
.tl-date:hover { color: var(--gold-text); }
.tl-when small { color: var(--text-3); font-size: 12px; font-variant-numeric: tabular-nums; }
.tl-body { display: flex; flex-direction: column; gap: 8px; min-width: 0; font-size: 14px; }
.tl-body h4 { margin: 0; font-size: 11px; font-weight: 650; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-3); }
.tl-files { display: flex; flex-wrap: wrap; gap: 6px; }
@media (max-width: 560px) { .tl { grid-template-columns: minmax(0, 1fr); } .tl-when { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px; } }
.rep { display: flex; flex-direction: column; }
.rep li { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 8px; padding: 9px 0; border-top: 1px solid var(--line); }
.rep li:first-child { border-top: 0; }
.rep .t { font-weight: 620; font-size: 14px; overflow-wrap: anywhere; }
.rep .by { color: var(--text-3); font-size: 13px; }
.rep select { min-height: 32px; padding: 4px 8px; font-size: 13px; width: auto; }
.rep-add { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) auto; gap: 8px; margin-top: 10px; }
@media (max-width: 520px) { .rep-add { grid-template-columns: minmax(0, 1fr); } .rep li { grid-template-columns: minmax(0, 1fr) auto; } .rep li select { grid-column: 1; } }
.next { display: flex; flex-direction: column; gap: 10px; }
.next-when { font-stretch: 62%; font-weight: 800; text-transform: uppercase; font-size: 1.55rem; line-height: 1; }

/* lessons list */
.month { margin-top: 18px; }
.month:first-child { margin-top: 0; }
.month-h { font-size: 11.5px; font-weight: 650; letter-spacing: 0.14em; text-transform: uppercase; color: var(--gold-text); padding: 0 4px 6px; border-bottom: 1px solid var(--line); }
.lrow { grid-template-columns: 96px minmax(0, 0.9fr) auto minmax(0, 2fr) auto; }
.lrow .d { display: flex; flex-direction: column; font-variant-numeric: tabular-nums; font-size: 14px; font-weight: 650; }
.lrow .d small { font-weight: 500; color: var(--text-3); font-size: 12px; }
.lrow .x { color: var(--text-2); font-size: 13.5px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lrow .x.is-missing { color: var(--warn); }
.lrow .fcount { font-size: 12px; color: var(--text-3); white-space: nowrap; }
@media (max-width: 760px) {
  .lrow { grid-template-columns: 82px minmax(0, 1fr) auto; }
  .lrow .x { grid-column: 2 / -1; white-space: normal; }
  .lrow .fcount { display: none; }
}

/* files */
.drop {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; text-align: center;
  padding: 22px 16px; border: 1.5px dashed var(--line-2); border-radius: 12px; color: var(--text-2); cursor: pointer;
}
.drop b { color: var(--gold-text); }
.drop small { color: var(--text-3); font-size: 12.5px; }
.drop.is-over { border-color: var(--gold); background: var(--gold-wash); }
.frow { grid-template-columns: 44px minmax(0, 1.6fr) minmax(0, 1fr) auto; }
.ftype {
  display: grid; place-items: center; width: 44px; height: 52px; border-radius: 6px; overflow: hidden;
  background: var(--surface-2); border: 1px solid var(--line-2);
  font-stretch: 62%; font-weight: 800; font-size: 12px; letter-spacing: 0.06em; color: var(--text-2);
}
.ftype img { width: 100%; height: 100%; object-fit: cover; }
.ftype.is-pdf { color: var(--nord); }
.ftype.is-video { color: var(--gold-text); }
.fname { border: 0; background: none; padding: 0; text-align: left; color: var(--text); font-weight: 620; overflow-wrap: anywhere; }
.fname:hover { color: var(--gold-text); }
.frow .acts { display: flex; gap: 6px; }
@media (max-width: 640px) {
  .frow { grid-template-columns: 44px minmax(0, 1fr) auto; }
  .frow .cat { grid-column: 2; }
  .frow .acts { grid-row: 1; grid-column: 3; }
}
.file-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 8px;
  border: 1px solid var(--line-2); font-size: 12.5px; color: var(--text-2); text-decoration: none; max-width: 100%;
}
.file-chip:hover { border-color: var(--gold); color: var(--text); }
.file-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

/* ---------- sheet (editor) ---------- */
dialog.sheet {
  padding: 0; border: 0; margin: 0 0 0 auto;
  width: min(600px, 100vw); max-width: 100vw; height: 100%; max-height: 100%;
  background: var(--surface); color: var(--text); box-shadow: var(--shadow); border-left: 1px solid var(--line);
}
dialog.sheet[open] { display: flex; flex-direction: column; }
dialog.sheet::backdrop { background: rgba(8, 6, 4, 0.55); }
.sf { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; }
.sf-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: calc(18px + env(safe-area-inset-top, 0px)) 22px 14px; border-bottom: 1px solid var(--line); }
.sf-title { font-stretch: 62%; font-weight: 800; text-transform: uppercase; font-size: 1.75rem; line-height: 0.95; margin-top: 6px; overflow-wrap: anywhere; }
.sf-body { flex: 1 1 auto; min-height: 0; overflow: auto; display: flex; flex-direction: column; gap: 16px; padding: 18px 22px 26px; }
.sf-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 12px 22px calc(12px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--line); background: var(--surface); }
.sf-foot .grow { flex: 1; }
.sf-foot .q { font-size: 14px; color: var(--text); font-weight: 600; margin-right: 6px; }
@media (max-width: 640px) {
  dialog.sheet { margin: auto 0 0; width: 100vw; height: auto; max-height: 94dvh; border-left: 0; border-top: 1px solid var(--line); border-radius: 16px 16px 0 0; }
  .sf-head { padding-top: 18px; }
  .sf-body, .sf-head, .sf-foot { padding-inline: 16px; }
}
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > .lab { font-size: 11.5px; font-weight: 650; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-2); }
.field > .hint { margin-top: -3px; font-size: 12.5px; color: var(--text-3); }
.fg { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.fg .span2 { grid-column: 1 / -1; }
@media (max-width: 480px) { .fg { grid-template-columns: minmax(0, 1fr); } }
.check { display: flex; align-items: flex-start; gap: 9px; font-size: 14px; color: var(--text-2); }
.check input { margin-top: 3px; accent-color: var(--gold); width: 16px; height: 16px; flex: none; }
.checks { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.preview { border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: var(--bg-2); }
.preview img, .preview video { display: block; width: 100%; max-height: 340px; object-fit: contain; }
.uplist { display: flex; flex-direction: column; gap: 6px; }
.uplist li { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 9px; font-size: 14px; }
.uplist .nm { overflow-wrap: anywhere; }
.uplist .sz { color: var(--text-3); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.uplist .err { grid-column: 1 / -1; color: var(--bad); font-size: 13px; }
.uplist .ok { color: var(--ok); font-size: 12.5px; font-weight: 650; }
.uplist .wait { color: var(--gold-text); font-size: 12.5px; font-weight: 650; }
.copy-fallback { font-size: 13px; }

/* ---------- toast & gate ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); z-index: 60;
  transform: translate(-50%, 16px); opacity: 0; pointer-events: none;
  max-width: min(520px, calc(100vw - 32px)); padding: 11px 16px; border-radius: 11px;
  background: var(--text); color: var(--bg); font-size: 14px; font-weight: 600; box-shadow: var(--shadow);
  transition: opacity 0.18s, transform 0.18s;
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }
.toast.is-err { background: var(--bad); color: var(--bg); }
@media (max-width: 899px) { .toast { bottom: calc(86px + env(safe-area-inset-bottom, 0px)); } }
.gate { max-width: 520px; margin: 12vh auto 0; display: flex; flex-direction: column; gap: 12px; }
.gate p { color: var(--text-2); }
.welcome { display: flex; flex-direction: column; gap: 12px; max-width: 62ch; }
.welcome ul { display: flex; flex-direction: column; gap: 6px; color: var(--text-2); }
.welcome li::before { content: "·"; color: var(--gold); font-weight: 800; margin-right: 8px; }
/* ---------- student page, sign-in, account ---------- */
/* Students get the same shell as the hub (sidebar on desktop, tab bar on phones) with their own menu. */
.is-portal [data-for="hub"], .is-hub [data-for="portal"], .is-portal .topbar-new { display: none !important; }
.is-portal .side-account { margin-top: auto; }
.is-solo .app { grid-template-columns: minmax(0, 1fr); }
.is-solo .side, .is-solo .tabbar, .is-solo .topbar { display: none; }
.is-solo main { margin-inline: auto; max-width: 560px; padding-block: 8vh 56px; }
.pcol { display: flex; flex-direction: column; gap: 16px; max-width: 820px; }
.ptabs { margin-bottom: 18px; }
.more-link { padding-top: 10px; font-size: 14px; }

/* a past session, folded to its date; opening slides the details down */
.accs { display: flex; flex-direction: column; }
.acc { border-top: 1px solid var(--line); }
.acc:first-child { border-top: 0; }
.acc-head {
  display: grid; grid-template-columns: 112px minmax(0, 1fr) auto 18px; align-items: center; gap: 12px;
  width: 100%; padding: 12px 2px; border: 0; background: none; color: var(--text); text-align: left;
}
.acc-head:hover .acc-date b, .acc.is-open .acc-date b { color: var(--gold-text); }
.acc-date { display: flex; flex-direction: column; gap: 1px; }
.acc-date b { font-size: 14.5px; font-weight: 680; font-variant-numeric: tabular-nums; transition: color 0.15s ease; }
.acc-date small { font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.acc-peek { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13.5px; color: var(--text-3); transition: opacity 0.2s ease; }
.acc.is-open .acc-peek { opacity: 0; }
.acc-head .ic { width: 16px; height: 16px; color: var(--text-2); transition: transform 0.28s cubic-bezier(0.2, 0.7, 0.2, 1); }
.acc.is-open .acc-head .ic { transform: rotate(180deg); }
.acc-body { display: grid; grid-template-rows: 0fr; transition: grid-template-rows 0.32s cubic-bezier(0.2, 0.7, 0.2, 1); }
.acc.is-open .acc-body { grid-template-rows: 1fr; }
.acc-inner { min-height: 0; overflow: hidden; }
.acc-inner > .tl-body { padding: 2px 2px 16px; opacity: 0; transform: translateY(-6px); transition: opacity 0.22s ease, transform 0.32s cubic-bezier(0.2, 0.7, 0.2, 1); }
.acc.is-open .acc-inner > .tl-body { opacity: 1; transform: none; transition-delay: 0.06s; }
@media (max-width: 560px) {
  .acc-head { grid-template-columns: minmax(0, 1fr) auto 18px; }
  .acc-peek { display: none; }
}
@media (prefers-reduced-motion: reduce) { .acc-body, .acc-inner > .tl-body, .acc-head .ic, .acc-peek { transition: none; } }
.acc-peek.is-missing { color: var(--warn); }
.acc-head.acc-wide { grid-template-columns: 190px minmax(0, 1fr) auto 18px; }
.acc-who { color: var(--text-2); font-weight: 620; }
@media (max-width: 560px) { .acc-head.acc-wide { grid-template-columns: minmax(0, 1fr) auto 18px; } }

/* the hub's session history: a folder per month, each holding folded sessions */
.mfolds { display: flex; flex-direction: column; gap: 8px; }
.mfold { border: 1px solid var(--line); border-radius: 11px; transition: border-color 0.2s ease; }
.mfold.is-open { border-color: var(--line-2); }
.mfold-head {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; width: 100%;
  padding: 12px 14px; border: 0; border-radius: 11px; background: none; color: var(--text); text-align: left;
}
.mfold-head:hover .mfold-title { color: var(--gold-text); }
.mfold-title { font-stretch: 62%; font-weight: 780; font-size: 1.1rem; letter-spacing: 0.03em; text-transform: uppercase; transition: color 0.15s ease; }
.mfold-meta { flex: 1; font-size: 12.5px; color: var(--text-3); }
.mfold-meta .is-due { color: var(--warn); font-weight: 620; }
.mfold-head .ic { width: 16px; height: 16px; color: var(--text-2); transition: transform 0.28s cubic-bezier(0.2, 0.7, 0.2, 1); }
.mfold.is-open .mfold-head .ic { transform: rotate(180deg); }
.mfold-body { display: grid; grid-template-rows: 0fr; transition: grid-template-rows 0.34s cubic-bezier(0.2, 0.7, 0.2, 1); }
.mfold.is-open .mfold-body { grid-template-rows: 1fr; }
.mfold-inner { min-height: 0; overflow: hidden; }
.mfold-inner > .accs { padding: 0 14px 4px; border-top: 1px solid var(--line); }
@media (prefers-reduced-motion: reduce) { .mfold, .mfold-body, .mfold-head .ic, .mfold-title { transition: none; } }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.side-account {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; border-radius: 9px;
  background: none; color: var(--text-2); text-align: left;
}
.side-account:hover { background: var(--surface); color: var(--text); }
.side-account > span { display: flex; flex-direction: column; min-width: 0; }
.side-account .me-email { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-account small { font-size: 11.5px; color: var(--text-3); }
.side-actions { margin-top: auto; }
.auth { display: flex; flex-direction: column; gap: 18px; }
.auth .brand { padding: 0; }
.auth form { display: flex; flex-direction: column; gap: 14px; }
.auth .err { color: var(--bad); font-size: 14px; }
.auth .fine { color: var(--text-3); font-size: 13px; }
.creds {
  display: flex; flex-direction: column; gap: 6px; margin-top: 12px; padding: 12px 14px; border-radius: 10px;
  border: 1px solid var(--gold); background: var(--gold-wash); font-size: 14px;
}
.creds code { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 13.5px; overflow-wrap: anywhere; }
.inline-form { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; margin-top: 12px; }
.inline-form .span2 { grid-column: 1 / -1; }
.inline-form .acts { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; }
@media (max-width: 520px) { .inline-form { grid-template-columns: minmax(0, 1fr); } }
button.file-chip { background: none; font: inherit; font-size: 12.5px; cursor: pointer; }
a.fname, button.fname { text-decoration: none; cursor: pointer; font: inherit; font-weight: 620; }
.steps { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; font-size: 14px; color: var(--text-2); counter-reset: step; }
.steps li { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 9px; counter-increment: step; }
.steps li::before {
  content: counter(step); display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%;
  border: 1px solid var(--line-2); font-size: 12px; font-weight: 700; color: var(--gold-text);
}
.chip-on { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 45%, transparent); }
.banner-live { border-style: solid; border-color: var(--gold); background: var(--gold-wash); }
.banner-live select { width: auto; max-width: 220px; min-height: 32px; padding: 4px 8px; font-size: 13px; }
.stack-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
/* opening splash: the little red piano plays a C major 7 chord, key by key, then fades into the app.
   If the script never runs, the safety animation clears it after 8 seconds. */
.splash {
  position: fixed; inset: 0; z-index: 100; display: grid; place-items: center;
  background: var(--bg); cursor: pointer; transition: opacity 0.38s ease;
  animation: splash-safety 0s linear 8s forwards;
}
.splash.is-out { opacity: 0; pointer-events: none; }
@keyframes splash-safety { to { opacity: 0; visibility: hidden; pointer-events: none; } }
.splash-inner { position: relative; display: flex; flex-direction: column; align-items: center; gap: 24px; }
.splash-glow {
  position: absolute; left: 50%; top: 34%; width: 360px; height: 240px; border-radius: 50%; pointer-events: none;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--gold) 34%, transparent), transparent);
  opacity: 0; transform: translate(-50%, -50%) scale(0.8);
  transition: opacity 0.7s ease, transform 0.9s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.splash.is-glow .splash-glow { opacity: 1; transform: translate(-50%, -50%) scale(1.05); }
.splash-piano {
  position: relative; width: min(220px, 52vw); height: auto; filter: drop-shadow(0 18px 40px rgba(0, 0, 0, 0.45));
  opacity: 0; transform: translateY(10px) scale(0.94);
  transition: opacity 0.45s ease, transform 0.6s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.splash.is-in .splash-piano { opacity: 1; transform: none; }
.sp-body { fill: var(--nord); }
.sp-key { fill: #f2ece3; transform-box: fill-box; transform-origin: 50% 0; transition: transform 0.09s ease-out, fill 0.14s ease; }
.sp-key.is-down { transform: scaleY(0.965); fill: #e8c99a; }
.sp-black rect { fill: #0b0a09; }
.splash-word {
  display: flex; flex-direction: column; align-items: center;
  opacity: 0; transform: translateY(6px); transition: opacity 0.5s ease 0.2s, transform 0.6s cubic-bezier(0.2, 0.7, 0.2, 1) 0.2s;
}
.splash.is-in .splash-word { opacity: 1; transform: none; }
.splash-word .brand-name { font-size: 1.9rem; }
.splash-word .brand-sub { margin-top: 6px; font-size: 11.5px; }
.splash-hint {
  position: absolute; left: 0; right: 0; bottom: calc(32px + env(safe-area-inset-bottom, 0px)); margin: 0;
  text-align: center; font-size: 12.5px; letter-spacing: 0.04em; color: var(--text-3); opacity: 0; transition: opacity 0.4s ease;
}
.splash.show-hint .splash-hint { opacity: 1; }
@media (prefers-reduced-motion: reduce) { .splash, .splash-piano, .splash-word, .sp-key, .splash-glow { transition: none; } }

/* month calendar: chips on wide screens, dots on phones; the chosen day's sessions list below */
.mgrid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.mdow { padding: 0 6px 2px; font-size: 11px; font-weight: 650; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-3); }
.mcell {
  display: flex; flex-direction: column; gap: 3px; min-width: 0; min-height: 116px; padding: 5px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px; cursor: pointer;
  transition: border-color 0.15s ease;
}
.mcell:hover { border-color: var(--line-2); }
.mcell.is-out { background: transparent; border-style: dashed; }
.mcell.is-out .mnum, .mcell.is-out .mchip { opacity: 0.5; }
.mcell.is-sel { border-color: var(--gold); box-shadow: inset 0 0 0 1px var(--gold); }
.mnum {
  align-self: flex-start; min-width: 26px; padding: 2px 6px; border: 0; border-radius: 7px; background: none; color: var(--text);
  font-stretch: 62%; font-weight: 800; font-size: 1.05rem; line-height: 1.15; font-variant-numeric: tabular-nums; text-align: center;
}
.mcell.is-today .mnum { background: var(--gold); color: var(--on-gold); }
.mchip {
  display: block; width: 100%; padding: 3px 6px; border: 1px solid var(--line-2); border-radius: 6px;
  background: var(--surface-2); color: var(--text); font-size: 11.5px; line-height: 1.3; text-align: left;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.mchip:hover { border-color: var(--gold); }
.mchip b { margin-right: 4px; font-weight: 650; color: var(--text-2); font-variant-numeric: tabular-nums; }
.mchip.s-planned { border-color: color-mix(in srgb, var(--gold) 45%, var(--line-2)); }
.mchip.s-done b { color: var(--ok); }
.mchip.s-cancelled { opacity: 0.6; text-decoration: line-through; }
.mchip.s-noshow b { color: var(--bad); }
.mchip.ghost { background: transparent; border-style: dashed; color: var(--text-2); }
.mchip.ghost.is-late { border-color: color-mix(in srgb, var(--warn) 55%, transparent); }
.mmore { padding: 0 6px; font-size: 11px; font-weight: 620; color: var(--gold-text); }
.mdots { display: none; flex-wrap: wrap; gap: 3px; padding: 2px 6px 0; }
.mdots i { width: 6px; height: 6px; border-radius: 50%; background: var(--gold); }
.mdots i.s-done { background: var(--ok); }
.mdots i.s-cancelled { background: var(--text-3); }
.mdots i.s-noshow { background: var(--bad); }
.mdots i.ghost { background: transparent; box-shadow: inset 0 0 0 1px var(--text-2); }
.mdots i.ghost.is-late { box-shadow: inset 0 0 0 1px var(--warn); }
.magenda { margin-top: 16px; }
@media (max-width: 760px) {
  .mgrid { gap: 4px; }
  .mdow { padding: 0 2px; font-size: 10px; letter-spacing: 0.06em; text-align: center; }
  .mcell { min-height: 54px; padding: 4px 2px; align-items: center; }
  .mnum { align-self: center; }
  .mchip, .mmore { display: none; }
  .mdots { display: flex; justify-content: center; padding: 0; }
}

/* file filter: a pill button that opens a small menu */
.panel-h-acts { display: flex; align-items: center; gap: 14px; }
.fmenu { position: relative; }
.fmenu-btn {
  display: inline-flex; align-items: center; gap: 7px; min-height: 32px; padding: 0 10px 0 13px;
  border: 1px solid var(--line-2); border-radius: 999px; background: var(--surface-2); color: var(--text);
  font-size: 13px; font-weight: 620; white-space: nowrap;
}
.fmenu-btn:hover { border-color: var(--gold); }
.fmenu-btn small { color: var(--text-3); font-weight: 500; font-variant-numeric: tabular-nums; }
.fmenu-btn .ic { width: 15px; height: 15px; color: var(--text-2); transition: transform 0.22s cubic-bezier(0.2, 0.7, 0.2, 1); }
.fmenu.is-open .fmenu-btn { border-color: var(--gold); }
.fmenu.is-open .fmenu-btn .ic { transform: rotate(180deg); }
.fmenu-pop {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 30; min-width: 230px; padding: 6px;
  display: flex; flex-direction: column; gap: 1px;
  background: var(--surface); border: 1px solid var(--line-2); border-radius: 13px; box-shadow: var(--shadow);
  opacity: 0; visibility: hidden; pointer-events: none;
  transform: translateY(-6px) scale(0.97); transform-origin: top right;
  transition: opacity 0.16s ease, transform 0.2s cubic-bezier(0.2, 0.7, 0.2, 1), visibility 0s linear 0.2s;
}
.fmenu.is-open .fmenu-pop {
  opacity: 1; visibility: visible; pointer-events: auto; transform: none;
  transition: opacity 0.16s ease, transform 0.2s cubic-bezier(0.2, 0.7, 0.2, 1), visibility 0s;
}
.fmenu-pop button {
  display: flex; align-items: center; gap: 9px; width: 100%; padding: 9px 10px;
  border: 0; border-radius: 8px; background: none; color: var(--text-2); font-size: 14px; text-align: left;
}
.fmenu-pop button:hover, .fmenu-pop button:focus-visible { background: var(--surface-2); color: var(--text); outline: none; }
.fmenu-pop button[aria-checked="true"] { color: var(--text); font-weight: 620; }
.fmenu-pop button.is-zero { color: var(--text-3); }
.fmenu-pop small { margin-left: auto; padding-left: 12px; color: var(--text-3); font-weight: 500; font-variant-numeric: tabular-nums; }
.fmenu-pop .ic { width: 15px; height: 15px; color: var(--gold); visibility: hidden; }
.fmenu-pop button[aria-checked="true"] .ic { visibility: visible; }
@media (prefers-reduced-motion: reduce) { .fmenu-pop, .fmenu.is-open .fmenu-pop, .fmenu-btn .ic { transition: none; } }
.practice { font-size: 15.5px; line-height: 1.55; }
.then { display: flex; flex-direction: column; gap: 4px; margin-top: 4px; font-size: 13.5px; color: var(--text-2); font-variant-numeric: tabular-nums; }
@media (prefers-reduced-motion: reduce) { .toast { transition: none; } }
