/* Flex1: central sign-in pages, My account and (later) the admin area.
   Started as a copy of the Teaching Portal's static/app.css, so both look the same;
   in phase 3 the portal's own pages load this file instead, leaving one source.
   Pastel, quiet, mostly white space. Light and dark. System fonts only. */
:root {
  --bg: #fbfaf7; --card: #ffffff; --ink: #2f2b3a; --muted: #7b7690; --line: #ebe7f2;
  --accent: #6f63a8; --ok: #3f8a64; --bad: #b4535f; --warn: #a77a1c;
  --mint: #dcf2e7; --lilac: #ebe5fb; --peach: #fde5d8; --sky: #dcebfa; --butter: #faf1cc; --rose: #fadfe7;
  --r: 14px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #17161d; --card: #1f1d27; --ink: #ece9f5; --muted: #a39db8; --line: #2f2c3b;
    --accent: #c4b9f2; --ok: #8fd3ad; --bad: #f0a0aa; --warn: #e8c46e;
    --mint: #1f3a2f; --lilac: #2c2742; --peach: #3e2c25; --sky: #1f3042; --butter: #3a3420; --rose: #3d2530;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.55 system-ui, -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; }
a { color: var(--accent); text-underline-offset: 3px; }
h1 { font-size: 30px; line-height: 1.15; margin: 4px 0 18px; font-weight: 650; letter-spacing: -.01em; }
h2 { font-size: 15px; margin: 0 0 12px; font-weight: 650; }
.muted { color: var(--muted); } .small { font-size: 13px; } .ok { color: var(--ok); } .bad { color: var(--bad); }
.kicker { color: var(--muted); font-size: 13px; letter-spacing: .04em; margin: 0; }

/* brand: two quiet lines, a dot of colour */
.brand { display: inline-block; text-decoration: none; color: var(--ink); font-weight: 650; font-size: 17px; line-height: 1.2; }
.brand span { display: block; font-weight: 450; font-size: 13px; color: var(--muted); }
.brand::after { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #8fd1b0; margin-left: 4px; vertical-align: 2px; }

/* forms */
label { display: block; font-size: 14px; color: var(--ink); }
label small, .stack small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 4px; }
input[type=text], input[type=email], input[type=password], input[type=search], input[type=number], input[type=date], input:not([type]), select {
  width: 100%; margin-top: 6px; padding: 11px 13px; font: inherit; color: var(--ink); background: var(--card);
  border: 1px solid var(--line); border-radius: 10px; outline: none; transition: border-color .15s, box-shadow .15s;
}
textarea { display: block; width: 100%; margin-top: 6px; padding: 11px 13px; font: inherit; color: var(--ink); background: var(--card);
  border: 1px solid var(--line); border-radius: 10px; outline: none; resize: vertical; }
input[type=file] { display: block; margin-top: 6px; font: inherit; font-size: 13.5px; color: var(--muted); max-width: 100%; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
button { font: inherit; font-weight: 600; cursor: pointer; border: 0; border-radius: 999px; padding: 11px 22px; background: var(--ink); color: var(--bg); transition: transform .1s, opacity .15s; }
button:hover { opacity: .9; } button:active { transform: translateY(1px); }
button.small { padding: 7px 14px; font-size: 13px; }
button.ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
button.danger { background: transparent; color: var(--bad); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--bad) 35%, transparent); }
button.link { background: none; color: var(--accent); padding: 0; font-weight: 500; text-decoration: underline; text-underline-offset: 3px; border-radius: 0; }
.stack { display: grid; gap: 16px; } .stack-tight { display: grid; gap: 12px; justify-items: start; align-content: start; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; } .row input { width: auto; flex: 1; min-width: 180px; margin: 0; }
.inline { display: inline; } .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.check { display: flex; gap: 8px; align-items: center; font-size: 14px; }
.note { padding: 11px 14px; border-radius: 10px; background: var(--sky); margin: 0 0 14px; font-size: 14px; }
.note.ok { background: var(--mint); } .note.bad { background: var(--rose); }
.links { display: flex; gap: 18px; flex-wrap: wrap; font-size: 14px; margin-top: 20px; }

/* course pills (register, settings, student page) */
fieldset.courses, .courses { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
fieldset.courses legend { font-size: 14px; margin-bottom: 8px; padding: 0; }
.pill { position: relative; }
.pill input { position: absolute; opacity: 0; inset: 0; cursor: pointer; margin: 0; }
.pill span { display: inline-block; padding: 7px 13px; border-radius: 999px; font-size: 13.5px; border: 1px solid var(--line); background: var(--card); transition: background .15s, border-color .15s; }
.pill input:checked + span { border-color: transparent; font-weight: 600; }
.pill input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.t0 input:checked + span, .t0.tile, .card.t0 { background: var(--mint); }
.t1 input:checked + span, .t1.tile, .card.t1 { background: var(--lilac); }
.t2 input:checked + span, .t2.tile, .card.t2 { background: var(--peach); }
.t3 input:checked + span, .t3.tile, .card.t3 { background: var(--sky); }
.t4 input:checked + span, .t4.tile, .card.t4 { background: var(--butter); }
.t5 input:checked + span, .t5.tile, .card.t5 { background: var(--rose); }
.privacy { background: var(--bg); border: 1px dashed var(--line); border-radius: 12px; padding: 14px 16px; font-size: 13.5px; }
.privacy p { margin: 6px 0 10px; color: var(--muted); }

/* ---------- sign-in pages: one card, three drifting pastel clouds ---------- */
.m-auth { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px 16px 24px; overflow-x: hidden; }
.blobs { position: fixed; inset: 0; z-index: 0; pointer-events: none; }
.blobs i { position: absolute; width: 46vmax; height: 46vmax; border-radius: 50%; filter: blur(60px); opacity: .75; animation: drift 28s ease-in-out infinite alternate; }
.blobs i:nth-child(1) { background: var(--mint);  top: -18vmax; left: -12vmax; }
.blobs i:nth-child(2) { background: var(--lilac); bottom: -22vmax; right: -14vmax; animation-delay: -9s; }
.blobs i:nth-child(3) { background: var(--peach); top: 40%; left: 55%; width: 26vmax; height: 26vmax; animation-delay: -18s; }
@keyframes drift { to { transform: translate(4vmax, -3vmax) scale(1.08); } }
@media (prefers-reduced-motion: reduce) { .blobs i { animation: none; } }
.auth { position: relative; z-index: 1; width: 100%; max-width: 420px; background: color-mix(in srgb, var(--card) 88%, transparent);
        backdrop-filter: blur(10px); border: 1px solid var(--line); border-radius: 22px; padding: 30px 30px 26px; box-shadow: 0 20px 60px rgba(70,60,110,.08); }
.auth .brand { margin-bottom: 26px; }
.m-auth .foot { position: relative; z-index: 1; }
.foot { color: var(--muted); font-size: 12px; text-align: center; padding: 22px 16px; }

/* ---------- student home ---------- */
.top { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 22px max(16px, calc((100vw - 880px) / 2)); }
.who { font-size: 13px; color: var(--muted); }
.wrap { max-width: 880px; margin: 0 auto; padding: 24px 16px 40px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; margin: 10px 0 26px; }
.card { position: relative; display: block; padding: 22px 22px 24px; border-radius: 18px; color: var(--ink); text-decoration: none; min-height: 132px; transition: transform .15s; }
.card:hover { transform: translateY(-2px); }
.card .code { display: block; font-size: 34px; font-weight: 700; letter-spacing: -.02em; }
.card .name { display: block; font-size: 14px; color: color-mix(in srgb, var(--ink) 75%, transparent); margin-top: 4px; }
.card .go { position: absolute; right: 20px; bottom: 16px; font-size: 18px; opacity: .5; }

/* ---------- dashboard ---------- */
.admin { display: grid; grid-template-columns: 210px 1fr; min-height: 100vh; }
.side { position: sticky; top: 0; align-self: start; height: 100vh; display: flex; flex-direction: column; gap: 2px; padding: 26px 18px; border-right: 1px solid var(--line); }
.side .brand { margin: 0 8px 26px; }
.side a:not(.brand), .side .link { display: block; padding: 7px 10px; border-radius: 9px; color: var(--ink); text-decoration: none; font-size: 14px; text-align: left; font-weight: 450; }
.side a:not(.brand):hover { background: var(--lilac); }
.side a[aria-current] { background: var(--lilac); font-weight: 600; }
.side .sep { flex: 1; }
.side .link { color: var(--muted); text-decoration: none; }
.content { padding: 30px 36px 60px; max-width: 1180px; min-width: 0; }
section { margin: 0 0 30px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 30px; }
.tile { border-radius: 16px; padding: 16px 18px; text-decoration: none; color: var(--ink); }
.tile b { display: block; font-size: 30px; line-height: 1.1; font-weight: 700; }
.tile span { font-size: 13px; color: color-mix(in srgb, var(--ink) 70%, transparent); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 30px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12.5px; padding: 8px 10px; border-bottom: 1px solid var(--line); }
td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.compact td { padding: 8px 10px; }
tr.failed td { background: color-mix(in srgb, var(--rose) 45%, transparent); }
.right { text-align: right; white-space: nowrap; }
.badge { display: inline-block; font-size: 12px; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.s-active { background: var(--mint); } .s-pending { background: var(--butter); } .s-unverified { background: var(--sky); } .s-suspended { background: var(--rose); }
.chip { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 6px; background: var(--lilac); margin: 0 4px 2px 0; }
.flag { display: inline-block; font-size: 11.5px; padding: 1px 8px; border-radius: 999px; background: var(--butter); color: var(--warn); font-weight: 600; }
.flag.bad { background: var(--rose); color: var(--bad); }
.dot-on { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #5ec28f; box-shadow: 0 0 0 3px var(--mint); vertical-align: 1px; margin-left: 4px; }
.alerts { list-style: none; padding: 0; margin: 0; } .alerts li { padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin: 0 0 18px; }
.filters input, .filters select { width: auto; margin: 0; padding: 8px 11px; font-size: 14px; }
.filters label { display: flex; gap: 6px; align-items: center; font-size: 13px; color: var(--muted); }
.small-link { font-size: 13px; padding-bottom: 8px; }
.pager { display: flex; gap: 18px; justify-content: center; padding: 16px; font-size: 14px; }
.more { font-size: 13px; margin: 10px 0 0; }
.crumb { margin: 0 0 6px; font-size: 13px; }
.facts { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; font-size: 14px; color: var(--muted); margin: -6px 0 26px; }
.domains { list-style: none; padding: 0; margin: 0 0 12px; display: flex; flex-wrap: wrap; gap: 8px; }
.domains li { background: var(--mint); padding: 6px 12px; border-radius: 999px; font-size: 14px; }
.domains .link { font-size: 12.5px; margin-left: 6px; }
.toggle { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.toggle input { margin-top: 4px; width: 17px; height: 17px; accent-color: var(--accent); flex: none; }
.toggle small { display: block; color: var(--muted); font-size: 13px; font-weight: 400; margin-top: 2px; }

/* ---------- My account ---------- */
.access { list-style: none; padding: 0; margin: 0 0 14px; display: grid; gap: 10px; }
.access li { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
             background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px 16px; }
.s-approved { background: var(--mint); } .s-requested { background: var(--butter); } .s-revoked { background: var(--rose); }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 22px; margin: 0 0 22px; }
.panel h2 { margin-bottom: 14px; }
/* ---------- admin extras (phase 2) ---------- */
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
code { font: 12.5px ui-monospace, Consolas, monospace; background: var(--lilac); padding: 1px 5px; border-radius: 5px; }
.alarm { border: 2px solid var(--bad); font-size: 14.5px; }
.alarm ul { margin: 6px 0 0; padding-left: 20px; }
.preview .tiles { margin-bottom: 18px; }
tr.p-invalid td, tr.p-dup td { color: var(--muted); }
tr.p-add td:first-child { box-shadow: inset 3px 0 0 #8fd1b0; }
details.decline { margin-top: 8px; font-size: 13.5px; }
details.decline summary { cursor: pointer; color: var(--muted); }
details.decline form { margin-top: 10px; max-width: 360px; }
.m-admin .foot { display: none; }
/* Admin > Classes: units per class, and the student import preview */
details.panel > summary { cursor: pointer; list-style-position: outside; }
details.course-units[open] > summary { margin-bottom: 4px; }
fieldset.unit-sec { border: 0; border-top: 1px solid var(--line); margin: 12px 0 0; padding: 10px 0 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 6px 18px; }
fieldset.unit-sec legend { padding: 0 6px 0 0; }
.unit-row { font-size: 13.5px; align-items: flex-start; }
.unit-row input { margin-top: 3px; }
.uid { font-variant-numeric: tabular-nums; font-weight: 600; min-width: 2.6em; display: inline-block; }
tr.p-new td:first-child, tr.p-update td:first-child { box-shadow: inset 3px 0 0 #8fd1b0; }
tr.p-invalid td:first-child { box-shadow: inset 3px 0 0 var(--bad); }
.pick-list { max-height: 320px; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 6px 18px;
             border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; width: 100%; box-sizing: border-box; }
.pick-list .check { align-items: flex-start; } .pick-list input { margin-top: 3px; }
.trap { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* Self-assessment (phase 3b, spec section 5A): rating colours are soft pastels with dark text,
   kept the same in dark mode so the contrast stays high. The word or letter is always shown too. */
.rate { display: inline-block; font-size: 12.5px; font-weight: 600; padding: 2px 10px; border-radius: 999px; white-space: nowrap; }
.r-not_yet { background: #f8d7da; color: #5c1d24; }
.r-getting_there { background: #fde8c4; color: #573a06; }
.r-confident { background: #d4f0dd; color: #1b4a2c; }
.r-none { background: #e9e7ee; color: #46424f; }
.revisit { list-style: none; padding: 0; margin: 0 0 10px; } .revisit li { padding: 7px 0; border-bottom: 1px solid var(--line); }
.revisit li .small { margin-left: 6px; }
h3.sec { font-size: 12.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 18px 0 6px; font-weight: 650; }
table.progress td.uid { width: 3.5em; }
/* Class heatmap: one cell per student and unit */
.legend { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; font-size: 13px; color: var(--muted); margin: 0 0 14px; }
.heat-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; }
table.heat { display: table; width: auto; min-width: 100%; font-size: 13px; }
table.heat th, table.heat td { border-bottom: 1px solid var(--line); padding: 6px 8px; white-space: nowrap; }
table.heat th.u { text-align: center; font-variant-numeric: tabular-nums; }
table.heat th.u small { display: block; font-weight: 400; max-width: 7em; overflow: hidden; text-overflow: ellipsis; }
table.heat td.cell { text-align: center; padding: 4px; }
table.heat td.cell span { display: block; min-width: 2.2em; padding: 5px 4px; border-radius: 7px; font-weight: 700; }
table.heat th.who { position: sticky; left: 0; background: var(--card); z-index: 1; font-weight: 500; color: var(--ink); text-align: left; }
table.heat tr.count td { font-size: 12px; text-align: center; color: var(--muted); }
table.heat tr.count td b { color: var(--ink); }
.help-note { max-width: 32em; overflow-wrap: anywhere; }
.ks3-acc { border-top: 1px solid var(--line); padding: 12px 0 16px; }
.ks3-acc p { margin: 0 0 8px; }

@media (max-width: 820px) {
  .admin { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; border-right: 0; border-bottom: 1px solid var(--line); padding: 14px 16px; }
  .side .brand { width: 100%; margin: 0 0 8px; } .side .sep { display: none; }
  .content { padding: 22px 16px 50px; }
  .two { grid-template-columns: 1fr; }
  table { display: block; overflow-x: auto; }
  /* Tables with buttons: one cell under another, so no button is off-screen */
  table.stack-sm, table.stack-sm tbody, table.stack-sm tr, table.stack-sm td { display: block; overflow: visible; }
  table.stack-sm th { display: none; }
  table.stack-sm td { border-bottom: 0; padding: 6px 0; }
  table.stack-sm tr { border-bottom: 1px solid var(--line); padding: 8px 0; }
  .auth { padding: 24px 20px; }
}

/* Flex1 Campus logo (phase 5b): the one-line SVG in place of the old "Mr Ova's Flex1" text */
.brand.logo { line-height: 0; }
.brand.logo::after { content: none; }
.brand.logo img { display: block; width: 150px; height: auto; }
.foot a { color: inherit; }

/* Admin side menu (2026-11-06): the flex1 campus logo (links home), then "Admin" (links to the Overview) */
.side .brand.logo { margin: 0 8px 6px; }
.side a.side-title { font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); font-weight: 600; margin-bottom: 18px; }
.side a.side-title:hover { background: none; color: var(--ink); }
@media (max-width: 820px) { .side a.side-title { margin-bottom: 4px; } }

/* Admin (2026-11-06): page numbers under long lists, and a small "Manage" button */
.pager { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 16px 0; font-size: 14px; }
.pager a, .pager b { display: inline-block; min-width: 34px; text-align: center; padding: 5px 10px; border-radius: 99px; border: 1px solid var(--line); text-decoration: none; color: var(--ink); }
.pager b { background: var(--ink); color: var(--bg, #fff); border-color: var(--ink); }
.btn-link { display: inline-block; font-size: 13px; padding: 4px 12px; border-radius: 99px; border: 1px solid var(--line); text-decoration: none; color: var(--ink); white-space: nowrap; }
.btn-link:hover { border-color: var(--muted); }

/* Admin sub-pages as rounded tabs (2026-11-06), first used by Admin > Seats:
   Overview · Plans · Logs · Settings. The current tab is filled in. */
.subtabs { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; margin: -4px 0 26px; background: var(--card); border: 1px solid var(--line); border-radius: 99px; }
.subtabs a { padding: 7px 16px; border-radius: 99px; font-size: 14px; font-weight: 500; color: var(--muted); text-decoration: none; }
.subtabs a:hover { color: var(--ink); }
.subtabs a[aria-current] { background: var(--ink); color: var(--bg); font-weight: 600; }
.subtabs a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (max-width: 560px) { .subtabs { border-radius: 16px; } }
.page-lead { margin: -8px 0 22px; max-width: 70ch; }
/* small rounded filters above a list (All, Info, Warnings, Errors) */
.filter-pills { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 0 0 16px; }
.filter-pills a { font-size: 13px; padding: 5px 13px; border-radius: 99px; border: 1px solid var(--line); text-decoration: none; color: var(--ink); }
.filter-pills a:hover { border-color: var(--muted); }
.filter-pills a[aria-current] { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.filter-pills form { margin-left: auto; }
.lvl { display: inline-block; font-size: 11.5px; font-weight: 650; padding: 1px 8px; border-radius: 99px; letter-spacing: .03em; }
.lvl-info { background: var(--sky); } .lvl-warning { background: var(--butter); color: var(--warn); } .lvl-error { background: var(--rose); color: var(--bad); }
.nowrap { white-space: nowrap; }
