/* Member portal: phone-first, light and dark. */
:root {
  --bg: #f6f5f3;
  --surface: #ffffff;
  --ink: #1c1917;
  --muted: #6b6560;
  --line: #e7e3df;
  --accent: #b8322a;
  --accent-soft: #f9ece9;
  --good: #15803d;
  --good-soft: #e8f5ec;
  --info: #1d4ed8;
  --info-soft: #e8eefc;
  --track: #ece8e4;
  --radius: 12px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141211;
    --surface: #1e1b19;
    --ink: #f3f0ed;
    --muted: #a8a19b;
    --line: #34302d;
    --accent: #e0544a;
    --accent-soft: #3a1f1c;
    --good: #4ade80;
    --good-soft: #17301f;
    --info: #93b4ff;
    --info-soft: #1c2640;
    --track: #2f2b28;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
}
a { color: var(--accent); }
h1, h2, h3 { line-height: 1.25; margin: 0; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.1rem; }
h3 { font-size: 1rem; }
p { margin: 0; }

.wrap { max-width: 720px; margin: 0 auto; padding: 0 16px; }
main.wrap { padding-top: 16px; padding-bottom: 48px; display: flex; flex-direction: column; gap: 16px; }

/* header */
.top { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 1; }
.top-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; }
.brand { font-weight: 700; color: var(--ink); text-decoration: none; }
.top-links { display: flex; align-items: center; gap: 16px; font-size: .95rem; }
.top-links a { text-decoration: none; }
button.link { background: none; border: 0; padding: 0; color: var(--muted); font: inherit; cursor: pointer; }
button.link:hover { color: var(--ink); text-decoration: underline; }

.people, .tabs { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding-bottom: 10px; }
.people::-webkit-scrollbar, .tabs::-webkit-scrollbar { display: none; }
.people a {
  flex: none; padding: 4px 12px; border-radius: 999px; border: 1px solid var(--line);
  color: var(--ink); text-decoration: none; font-size: .9rem;
}
.people a[aria-current="true"] { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.tabs { gap: 4px; padding-bottom: 0; }
.tabs a {
  flex: none; padding: 8px 12px; color: var(--muted); text-decoration: none; font-weight: 500;
  border-bottom: 2px solid transparent;
}
.tabs a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); }

/* building blocks */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.card-head a { font-size: .9rem; text-decoration: none; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 4px; }
.empty { color: var(--muted); font-size: .95rem; }

.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .8rem; font-weight: 600; background: var(--track); color: var(--ink); white-space: nowrap; }
.pill.good { background: var(--good-soft); color: var(--good); }
.pill.info { background: var(--info-soft); color: var(--info); }
.pill.accent { background: var(--accent-soft); color: var(--accent); }

.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
@media (min-width: 560px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stat { background: var(--bg); border-radius: 10px; padding: 10px 12px; }
.stat b { display: block; font-size: 1.5rem; line-height: 1.2; font-variant-numeric: tabular-nums; }
.stat span { font-size: .8rem; color: var(--muted); }

.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.list li:first-child { border-top: 0; padding-top: 0; }
.list li:last-child { padding-bottom: 0; }
.when { font-variant-numeric: tabular-nums; white-space: nowrap; }
.cancelled { text-decoration: line-through; color: var(--muted); }

/* belts */
.belt-hero { display: flex; flex-direction: column; gap: 8px; }
.tapes { display: flex; flex-wrap: wrap; gap: 6px; }
.tape { display: inline-flex; align-items: center; gap: 6px; font-size: .85rem; padding: 2px 8px 2px 4px; border-radius: 6px; background: var(--bg); }
.tape i { display: inline-block; width: 10px; height: 16px; border-radius: 2px; }
.tape.todo { color: var(--muted); }
.tape.todo i { background: transparent !important; }

.meter { display: flex; flex-direction: column; gap: 4px; font-size: .9rem; }
.meter .bar { height: 8px; border-radius: 999px; background: var(--track); overflow: hidden; }
.meter .bar span { display: block; height: 100%; border-radius: 999px; background: var(--accent); }
.meter.met .bar span { background: var(--good); }

/* history */
.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0; }
.timeline > li { display: flex; flex-direction: column; gap: 8px; padding: 14px 0; border-top: 1px solid var(--line); }
.timeline > li:first-child { border-top: 0; padding-top: 0; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: 8px 8px 8px 0; border-top: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 500; border-top: 0; }

/* curriculum */
details { border-top: 1px solid var(--line); padding-top: 12px; }
summary { cursor: pointer; display: flex; align-items: center; gap: 10px; font-weight: 600; list-style: none; }
summary::-webkit-details-marker { display: none; }
summary::after { content: "▸"; margin-left: auto; color: var(--muted); }
details[open] summary::after { content: "▾"; }
.items { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.items li { display: flex; gap: 10px; align-items: flex-start; }
.check { flex: none; width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; font-size: .75rem; margin-top: 1px; }
.check.done { background: var(--good); border-color: var(--good); color: var(--surface); }

/* announcements */
.news { display: flex; flex-direction: column; gap: 4px; padding-top: 12px; border-top: 1px solid var(--line); }
.news:first-of-type { border-top: 0; padding-top: 0; }
.news .body { font-size: .95rem; overflow-wrap: anywhere; }
.news .body p + p { margin-top: 8px; }

/* sign in */
.signin { max-width: 380px; margin: 48px auto 0; width: 100%; }
.signin form { display: flex; flex-direction: column; gap: 12px; }
label { display: flex; flex-direction: column; gap: 4px; font-size: .9rem; font-weight: 500; }
input[type=text], input[type=password] {
  font: inherit; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--bg); color: var(--ink);
}
.button { font: inherit; font-weight: 600; padding: 12px; border: 0; border-radius: 8px; background: var(--accent); color: var(--surface); cursor: pointer; }
.errors { color: var(--accent); font-size: .9rem; }

/* curriculum content */
.item-link { display: flex; flex-direction: column; gap: 2px; color: inherit; text-decoration: none; min-width: 0; }
.item-link:hover strong { text-decoration: underline; }
.media { color: var(--accent); font-weight: 500; }
.frame { display: block; width: 100%; aspect-ratio: 16 / 9; border: 0; border-radius: 8px; background: #000; }
.frame iframe { width: 100%; height: 100%; border: 0; border-radius: 8px; }
.card .body p + p { margin-top: 8px; }

/* main sections: a bottom bar on phones, in the header on wider screens */
.top-row { flex-wrap: nowrap; }
.appnav { display: flex; gap: 4px; }
.appnav a {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 6px 12px; color: var(--muted); text-decoration: none; font-size: .75rem; font-weight: 500;
}
.appnav svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.appnav a[aria-current="page"] { color: var(--accent); }
.badge {
  position: absolute; top: 0; right: 4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
  background: var(--accent); color: var(--surface); font-size: .7rem; font-weight: 700; line-height: 18px; text-align: center;
}
@media (max-width: 719px) {
  .appnav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 2; justify-content: space-around;
    background: var(--surface); border-top: 1px solid var(--line);
    padding: 4px 8px calc(4px + env(safe-area-inset-bottom));
  }
  body.has-appnav main.wrap { padding-bottom: calc(88px + env(safe-area-inset-bottom)); }
}
@media (min-width: 720px) {
  .appnav { margin-left: auto; }
  .appnav a { flex-direction: row; gap: 6px; font-size: .9rem; }
  .appnav svg { width: 18px; height: 18px; }
  .badge { position: static; }
}

/* home: each section gets the same header (its nav icon, title, link), with a divider and
   more space between sections than inside one */
.stack-lg { display: flex; flex-direction: column; gap: 12px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.home-section { display: flex; flex-direction: column; gap: 12px; }
.home-section + .home-section { margin-top: 12px; padding-top: 24px; border-top: 1px solid var(--line); }
.section-head { display: flex; align-items: center; gap: 10px; }
.section-head h2 { font-size: 1.3rem; }
.section-head a { margin-left: auto; font-size: .9rem; text-decoration: none; white-space: nowrap; }
.section-icon {
  flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px;
  background: var(--accent-soft); color: var(--accent);
}
.section-icon svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.student-card h3 { font-size: 1.1rem; }
.highlight .news {
  background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--accent);
  border-radius: var(--radius); padding: 16px; margin-bottom: 12px;
}
.highlight .news:last-child { margin-bottom: 0; }
.highlight .news h3 { font-size: 1.1rem; }
.student-card { color: inherit; text-decoration: none; }
.student-card:hover { border-color: var(--muted); }
.day { gap: 10px; }
.day.today { border-left: 4px solid var(--accent); }
.day-head { font-size: 1rem; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.day-head .muted { font-weight: 400; margin-left: 4px; }
.day .list li:first-child { padding-top: 0; }

/* connecting an app (OAuth consent) */
.button.secondary { background: var(--track); color: var(--ink); }
.consent { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; }
