/* Colours, layout, sidebar, top bar, buttons. */
:root {
  --bg: #f7f6f2;
  --surface: #ffffff;
  --ink: #1f2328;
  --muted: #6b6f76;
  --line: #e4e2dc;
  --accent: #2f6f5e;
  --accent-soft: #e3efe9;
  --rec: #c2412d;
  --good: #2f8a4f;
  --mid: #c98a12;
  --bad: #c2412d;
  --ins: #7a4fb3;
  --active: #fff8e1;
  --radius: 10px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17191c; --surface: #202327; --ink: #e8e6e1; --muted: #9a9ea5; --line: #33373c;
    --accent: #6cc3a5; --accent-soft: #23362f; --rec: #ef6b55; --good: #5fc283; --mid: #e3b04b;
    --bad: #ef6b55; --ins: #b28ae6; --active: #2d2a1f;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--ink);
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", sans-serif;
}
button, select, input { font: inherit; color: inherit; }
.hidden { display: none !important; }

.app { display: grid; grid-template-columns: 260px minmax(0, 1fr); height: 100vh; }

/* sidebar */
.sidebar { border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; background: var(--surface); }
.brand { font-weight: 700; font-size: 17px; padding: 18px 16px 10px; letter-spacing: .2px; }
.search { margin: 0 12px 8px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); }
.lesson-list { list-style: none; margin: 0; padding: 0 6px 16px; overflow-y: auto; flex: 1; }
.lesson-list li { padding: 7px 10px; border-radius: 8px; cursor: pointer; display: flex; gap: 8px; align-items: baseline; }
.lesson-list li:hover { background: var(--bg); }
.lesson-list li.current { background: var(--accent-soft); }
.lesson-list li.pending { color: var(--muted); cursor: default; }
.lesson-list .n { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 12px; width: 32px; flex: none; }
.lesson-list .t { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lesson-list .s { font-size: 12px; font-variant-numeric: tabular-nums; }

/* main */
.main { overflow-y: auto; overflow-x: hidden; padding: 0 32px 80px; min-width: 0; }
.topbar { display: flex; justify-content: space-between; align-items: flex-end; padding: 22px 0 12px; position: sticky; top: 0; background: var(--bg); z-index: 5; }
.lesson-num { color: var(--muted); font-size: 13px; }
h1 { margin: 2px 0 0; font-size: 24px; overflow-wrap: anywhere; }
.banner { background: var(--active); border: 1px solid var(--line); padding: 10px 14px; border-radius: var(--radius); margin-bottom: 12px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; position: sticky; top: 76px; background: var(--bg); z-index: 5; }
.tabs button { border: 0; background: none; padding: 10px 14px; cursor: pointer; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button.active { color: var(--ink); border-bottom-color: var(--accent); font-weight: 600; }

button.primary, button.ghost, button.record, button.small {
  white-space: nowrap; border-radius: 8px; padding: 7px 14px; cursor: pointer; border: 1px solid var(--line); background: var(--surface);
}
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.record { color: var(--rec); border-color: var(--rec); background: var(--surface); }
button.record.on { background: var(--rec); color: #fff; }
button:disabled { opacity: .45; cursor: default; }
button.link { border: 0; background: none; color: var(--accent); cursor: pointer; text-decoration: underline; }
button.small { padding: 3px 9px; font-size: 13px; }

.toolbar { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; color: var(--muted); font-size: 13px; margin-bottom: 12px; }
.hint { margin-left: auto; }

/* phone menu button and the dark layer behind the open menu (shown only on narrow screens) */
.menu-btn { display: none; border: 1px solid var(--line); background: var(--surface); border-radius: 8px;
  padding: 6px 10px; cursor: pointer; white-space: nowrap; }
.menu-shade { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 39; }

/* login screen */
body.locked .app { display: none; }
body:not(.locked) .auth { display: none; }
.auth { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.auth-card { width: min(360px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 24px; }
.auth-brand { font-size: 22px; font-weight: 700; margin-bottom: 4px; }
.auth-card label { display: block; margin: 12px 0; font-size: 14px; }
.auth-card input { display: block; width: 100%; margin-top: 4px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); font-size: 16px; }
.auth-card button { width: 100%; padding: 10px; margin-top: 4px; }
.auth-card .warn:empty { display: none; }
body.not-admin .admin-only { display: none !important; }
.hint-narrow { display: none; }
@media (max-width: 760px) { .hint-wide { display: none; } .hint-narrow { display: inline; } }
