/* #TEACH brand: palette and type from the 2026 brand board. */
@font-face {
  font-family: "Inter";
  src: url("/fonts/inter-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}
:root {
  --navy: #002e5d;
  --navy-dark: #001f40;
  --red: #8b0000;
  --sky: #12a7e6;
  --grey: #c5c5c5;
  --bg: #f5f5f5;
  --slate: #2b3a47;          /* the logo's wordmark colour */
  --ink: #1b2733;
  --muted: #55616e;
  --line: var(--grey);
  --card: #fff;
  --good: #11734b;
  --good-bg: #e3f4ea;
  --bad: var(--red);
  --bad-bg: #f9e6e6;
  --warn-bg: #fff4d6;
  --radius: 6px;
  /* kept so older rules keep working */
  --blue: var(--navy);
  --blue-dark: var(--navy-dark);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 400 15px/1.55 "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; color: var(--ink); background: var(--bg); }
h1, h2, h3 { line-height: 1.2; margin: 0; font-weight: 800; letter-spacing: -0.01em; color: var(--navy); }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }

.btn { border: 1px solid var(--line); background: var(--card); padding: 7px 14px; border-radius: var(--radius); cursor: pointer; }
.btn:hover { border-color: #9aa7b5; }
.btn:disabled { opacity: .55; cursor: default; }
.btn-primary { background: var(--navy); border-color: var(--navy); color: #fff; font-weight: 700; }
.btn-primary:hover { background: var(--blue-dark); border-color: var(--blue-dark); }
.btn-danger { color: var(--bad); }
.btn-link { border: 0; background: none; padding: 0; color: var(--navy); cursor: pointer; text-decoration: underline; }
:focus-visible { outline: 3px solid var(--sky); outline-offset: 2px; }

input[type=text], input[type=email], input[type=date], input[type=search], select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid #aab4c0; border-radius: var(--radius); background: #fff;
}
textarea { resize: vertical; min-height: 70px; }

.notice { border-radius: var(--radius); padding: 14px 16px; border: 1px solid transparent; }
.notice h2 { font-size: 17px; margin-bottom: 4px; }
.notice.good { background: var(--good-bg); border-color: #b4dcc4; }
.notice.good h2 { color: var(--good); }
.notice.bad { background: var(--bad-bg); border-color: #efc2bc; }
.notice.bad h2 { color: var(--bad); }
.notice.warn { background: var(--warn-bg); border-color: #ecd58f; }

/* ---------- Student form ---------- */
.form-page { background: var(--navy); min-height: 100vh; padding: 28px 16px 48px; font-weight: 300; font-size: 16px; }
.form-page b, .form-page strong { font-weight: 700; }
.brand-banner { max-width: 640px; margin: 0 auto 22px; text-align: center; }
.brand-banner img { height: 56px; width: auto; max-width: 80%; }
.brand-logo { height: 44px; width: auto; display: block; margin-bottom: 18px; }
.form-card { max-width: 640px; margin: 0 auto; background: var(--card); border-radius: 8px; padding: 32px clamp(18px, 5vw, 40px); border-top: 6px solid var(--red); }
.form-card h1 { font-size: 26px; margin-bottom: 24px; }
.field { margin-bottom: 20px; }
.field > label, .field > legend { display: block; font-weight: 700; color: var(--navy); margin-bottom: 4px; padding: 0; }
.field .req { color: var(--bad); }
.field .hint { color: var(--muted); font-size: 13px; margin: 0 0 6px; }
.field .error { color: var(--bad); font-size: 13px; margin: 4px 0 0; }
.field .soft { color: #7a5a00; font-size: 13px; margin: 4px 0 0; }
.field.invalid input, .field.invalid select { border-color: var(--bad); }
fieldset.field { border: 0; padding: 0; margin-inline: 0; }
.choice { display: flex; gap: 10px; align-items: flex-start; padding: 5px 0; font-weight: inherit; }
input[type=checkbox] { accent-color: var(--navy); }
.choice input { margin-top: 4px; width: 16px; height: 16px; flex: none; }
.hp { position: absolute; left: -5000px; height: 1px; overflow: hidden; }
.form-actions { margin-top: 28px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.form-actions .btn-primary { padding: 10px 28px; }
.form-error { color: var(--bad); }

/* ---------- Staff tracker ---------- */
.topbar { background: var(--navy); color: #fff; padding: 10px 16px; display: flex; gap: 16px; align-items: center; flex-wrap: wrap; border-bottom: 4px solid var(--red); }
.topbar .logo { height: 26px; width: auto; display: block; }
.topbar h1 { font-size: 16px; margin-right: auto; color: #fff; font-weight: 300; letter-spacing: 0; padding-left: 14px; border-left: 1px solid rgba(255,255,255,.35); }
.topbar nav { display: flex; gap: 4px; }
.topbar nav button { background: none; border: 0; color: #c9d8e6; padding: 6px 12px; border-radius: var(--radius); cursor: pointer; }
.topbar nav button[aria-current=page] { background: rgba(255,255,255,.16); color: #fff; }
.topbar .who { font-size: 13px; color: #c9d8e6; }

.toolbar { padding: 12px 16px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.toolbar input[type=search] { width: 240px; max-width: 100%; }
.toolbar select { width: auto; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 4px 12px; cursor: pointer; font-size: 13px; }
.chip b { font-weight: 600; margin-left: 4px; }
.chip[aria-pressed=true] { background: var(--navy); border-color: var(--navy); color: #fff; }
.spacer { margin-left: auto; }

.grid-wrap { margin: 0 16px 24px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); overflow: auto; max-height: calc(100vh - 170px); }
table.grid { border-collapse: separate; border-spacing: 0; width: max-content; min-width: 100%; font-size: 13.5px; }
.grid th, .grid td { border-bottom: 1px solid var(--line); border-right: 1px solid #e8ecf0; padding: 6px 8px; text-align: left; vertical-align: middle; white-space: nowrap; }
.grid thead th { position: sticky; top: 0; z-index: 2; background: #eef1f5; font-weight: 600; white-space: normal; max-width: 150px; vertical-align: bottom; font-size: 12.5px; }
.grid thead tr.groups th { top: 0; text-align: center; color: #fff; font-size: 12px; letter-spacing: .03em; text-transform: uppercase; padding: 3px 8px; height: 24px; }
.grid thead tr.cols th { top: 24px; }
.g-student { background: var(--navy) !important; }
.g-academic { background: #0b6fa4 !important; }
.g-decision { background: var(--red) !important; }
.g-finance { background: var(--slate) !important; }
.g-access { background: #5a6470 !important; }
.grid td.center, .grid th.center { text-align: center; }
.grid tbody tr:hover td { background: #f6f9fc; }
.grid tbody tr.flash td { background: #fff7d1; }
.grid td select { padding: 3px 6px; width: auto; min-width: 64px; }
.grid td input[type=checkbox] { width: 16px; height: 16px; }
.grid td.name { position: sticky; left: 0; background: var(--card); z-index: 1; font-weight: 600; }
.grid tbody tr:hover td.name { background: #f6f9fc; }
.grid thead th.name { left: 0; z-index: 3; }
.grid td.notes { max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.grid td.areas { white-space: normal; min-width: 230px; font-size: 12.5px; }
.empty { padding: 40px; text-align: center; color: var(--muted); }

.stage { display: inline-block; white-space: nowrap; padding: 1px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.stage[data-s="Academic review"] { background: #d9f0fb; color: #07507a; }
.stage[data-s="Finance"] { background: #dff1e8; color: #1f5f43; }
.stage[data-s="Ready for access"] { background: #fdebd2; color: #83490c; }
.stage[data-s="Complete"] { background: #e4e7eb; color: #3c4854; }
.stage[data-s="Denied"], .stage[data-s="Not eligible"] { background: var(--bad-bg); color: var(--bad); }
.sent { color: var(--good); font-weight: 600; }
.idwarn { color: #946c00; cursor: help; }

.drawer-back { position: fixed; inset: 0; background: rgba(10,25,40,.35); z-index: 10; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(520px, 100vw); background: var(--card); z-index: 11; overflow-y: auto; box-shadow: -6px 0 24px rgba(0,0,0,.18); padding: 20px 22px 40px; }
.drawer header { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.drawer header h2 { font-size: 20px; margin-right: auto; }
.drawer section { border-top: 1px solid var(--line); padding: 14px 0; }
.drawer section h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-bottom: 8px; }
.kv { display: grid; grid-template-columns: 170px 1fr; gap: 4px 12px; font-size: 14px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.comment { background: var(--bg); border-radius: var(--radius); padding: 8px 10px; margin-bottom: 8px; white-space: pre-wrap; overflow-wrap: anywhere; }
.meta { color: var(--muted); font-size: 12px; }
.log { list-style: none; padding: 0; margin: 0; font-size: 13px; }
.log li { padding: 3px 0; border-bottom: 1px dotted var(--line); overflow-wrap: anywhere; }

dialog { border: 0; border-radius: 8px; padding: 22px; width: min(560px, 94vw); box-shadow: 0 10px 40px rgba(0,0,0,.3); }
dialog::backdrop { background: rgba(10,25,40,.45); }
dialog h2 { font-size: 18px; margin-bottom: 10px; }
dialog pre { background: var(--bg); padding: 12px; border-radius: var(--radius); white-space: pre-wrap; overflow-wrap: anywhere; max-height: 40vh; overflow: auto; font-family: inherit; font-size: 13px; line-height: 1.5; }
dialog .row-actions { justify-content: flex-end; margin-top: 16px; }

.settings { max-width: 760px; margin: 0 auto; padding: 20px 16px 60px; }
.settings .card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 16px; }
.settings h2 { font-size: 17px; margin-bottom: 4px; }
.settings label { color: var(--navy); }
.settings p.help { color: var(--muted); font-size: 13px; margin: 0 0 12px; }
.settings label { display: block; font-weight: 600; margin: 12px 0 4px; }
.settings textarea.tall { min-height: 170px; }
.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 9px 16px; border-radius: var(--radius); z-index: 30; max-width: 90vw; }
.toast.err { background: var(--bad); }
#mail-warning { margin: 0 16px 12px; }

/* Imported rows can hold very long text (the sheet has spam in a name field),
   so pinned and free-text cells truncate instead of stretching the grid. */
.grid td.name { max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.grid td.name .btn-link { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; }
.grid td.clip { max-width: 240px; overflow: hidden; text-overflow: ellipsis; }
a.btn { text-decoration: none; color: inherit; display: inline-block; }
.drawer header h2 { overflow-wrap: anywhere; }

/* ---------- Admin ---------- */
.subnav { display: flex; gap: 4px; padding: 12px 16px 0; max-width: 1100px; margin: 0 auto; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.subnav button { border: 0; background: none; padding: 9px 14px; cursor: pointer; font-weight: 700; color: var(--muted); border-bottom: 3px solid transparent; margin-bottom: -1px; }
.subnav button[aria-selected=true] { color: var(--navy); border-bottom-color: var(--red); }
.admin { max-width: 1100px; margin: 0 auto; padding: 18px 16px 60px; }
.admin .card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 16px; }
.admin h2 { font-size: 18px; margin-bottom: 4px; }
.admin p.help { color: var(--muted); font-size: 13px; margin: 0 0 12px; }
.admin label { display: block; font-weight: 700; color: var(--navy); margin: 12px 0 4px; }
.admin label.choice { display: flex; font-weight: 400; color: var(--ink); margin: 8px 0; }
.admin textarea.tall { min-height: 180px; }
.admin .row { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; }
.admin .row > div { flex: 1 1 200px; }
.admin .row > div.narrow { flex: 0 0 150px; }
table.plain { border-collapse: collapse; width: 100%; font-size: 14px; }
table.plain th, table.plain td { text-align: left; padding: 8px 10px; border-bottom: 1px solid #e3e6ea; vertical-align: top; }
table.plain th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; }
table.plain td.wrap { overflow-wrap: anywhere; min-width: 190px; }
.table-scroll { overflow-x: auto; }
.pill { display: inline-block; padding: 1px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; background: #e4e7eb; color: #3c4854; white-space: nowrap; }
.pill.admin-role { background: var(--navy); color: #fff; }
.pill.sent { background: var(--good-bg); color: var(--good); }
.pill.failed { background: var(--bad-bg); color: var(--bad); }
.pill.not_configured, .pill.off { background: var(--warn-bg); color: #7a5a00; }
.auto-head { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.auto-head h2 { margin-right: auto; }
details.mail summary { cursor: pointer; color: var(--navy); text-decoration: underline; }
details.mail pre { background: var(--bg); padding: 10px 12px; border-radius: var(--radius); white-space: pre-wrap; overflow-wrap: anywhere; font-family: inherit; font-size: 13px; line-height: 1.5; margin: 8px 0 0; max-width: 640px; }
.savebar { position: sticky; bottom: 0; background: rgba(245,245,245,.95); border-top: 1px solid var(--line); padding: 12px 0; display: flex; gap: 12px; align-items: center; }

/* ---------- How it works ---------- */
.help-page { max-width: 1000px; margin: 0 auto; padding: 22px 16px 70px; }
.help-page .card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; margin-bottom: 16px; scroll-margin-top: 12px; }
.help-page h1 { font-size: 26px; margin-bottom: 6px; }
.help-page h2 { font-size: 19px; margin-bottom: 10px; }
.help-page h3 { font-size: 15px; margin: 16px 0 6px; color: var(--red); }
.help-page p { margin: 0 0 10px; max-width: 78ch; }
.help-page p.help { color: var(--muted); font-size: 13.5px; margin-top: 12px; }
.help-page ul { margin: 0 0 8px; padding-left: 20px; max-width: 78ch; }
.help-page li { margin-bottom: 5px; }
.help-hero { display: flex; gap: 18px; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; margin-bottom: 18px; }
.help-hero > div:first-child { flex: 1 1 420px; }
.flow { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-bottom: 16px; }
.flow-step { background: var(--navy); color: #fff; border-radius: var(--radius); padding: 14px 16px; border-bottom: 4px solid var(--red); }
.flow-step b { display: block; font-weight: 800; font-size: 16px; margin: 6px 0 4px; }
.flow-step p { margin: 0; font-size: 13.5px; font-weight: 300; color: #dbe6f1; }
.flow-n { display: inline-flex; width: 26px; height: 26px; border-radius: 50%; background: var(--sky); color: var(--navy); font-weight: 800; align-items: center; justify-content: center; }
.practice-head { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; padding: 10px 14px; background: var(--bg); border-radius: var(--radius); margin-bottom: 12px; }
.practice-head .btn-link { margin-left: auto; }
.practice-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 8px 22px; margin-bottom: 8px; }
.practice-grid h3 { margin-top: 6px; }
.practice-grid label { display: block; font-weight: 700; color: var(--navy); margin-bottom: 10px; font-size: 14px; }
.practice-grid label.choice { display: flex; font-weight: 400; color: var(--ink); }
.practice-grid select { margin-top: 4px; }

/* ---------- Guided tour ---------- */
.tour-block { position: fixed; inset: 0; z-index: 40; }
.tour-ring { position: fixed; z-index: 41; border-radius: 8px; pointer-events: none; box-shadow: 0 0 0 3px var(--sky), 0 0 0 9999px rgba(0, 20, 45, .55); transition: all .2s ease; }
.tour-pop { position: fixed; z-index: 42; background: var(--card); border-radius: 8px; padding: 16px 18px; box-shadow: 0 10px 40px rgba(0,0,0,.35); border-top: 5px solid var(--red); }
.tour-pop h2 { font-size: 17px; margin: 2px 0 6px; }
.tour-pop p { margin: 0 0 12px; font-size: 14.5px; }
.tour-offer { margin: 12px 16px 0; background: #e6f5fc; border-color: #a9dcf3; }
@media (prefers-reduced-motion: reduce) { .tour-ring { transition: none; } }

/* ---------- Permissions ---------- */
input:disabled, select:disabled, textarea:disabled { background: #eef0f3; color: #4a5561; cursor: not-allowed; opacity: 1; }
.grid td input[type=checkbox]:disabled { opacity: .55; }
.btn-link.danger { color: var(--red); }
.btn-danger.solid { background: var(--red); border-color: var(--red); color: #fff; font-weight: 700; }
.btn-danger.solid:disabled { background: #c9a3a3; border-color: #c9a3a3; }
dialog label { display: block; font-weight: 700; color: var(--navy); margin: 12px 0 4px; }
.role-boxes { display: flex; flex-wrap: wrap; gap: 4px 16px; }
.role-boxes label.choice { margin: 2px 0; font-size: 14px; }
table.matrix th.role, table.matrix td.tick { text-align: center; white-space: nowrap; }
table.matrix td.tick input { width: 17px; height: 17px; }
table.matrix th.role small { display: block; font-weight: 400; text-transform: none; letter-spacing: 0; }
.topbar .who { max-width: 340px; text-align: right; line-height: 1.3; }
