@font-face {
  font-family: "Archivo"; font-style: normal; font-display: swap; font-weight: 100 900; font-stretch: 62% 125%;
  src: url(/fonts/archivo-latin-standard-normal.woff2) format("woff2-variations");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: "Archivo"; font-style: normal; font-display: swap; font-weight: 100 900; font-stretch: 62% 125%;
  src: url(/fonts/archivo-latin-ext-standard-normal.woff2) format("woff2-variations");
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+1E00-1E9F,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}

:root {
  --paper: #eef3f1;
  --surface: #ffffff;
  --ink: #10302e;
  --ink-2: #4a6461;
  --line: #cfdcd8;
  --teal: #1f7a6e;
  --teal-soft: #d9ece7;
  --amber: #e8a33d;
  --amber-soft: #fbedd5;
  --danger: #b4412f;
  --danger-soft: #f6e0dc;
  --focus: #2b62d9;
  --radius-sm: 6px;
  --radius-lg: 14px;
  --font: "Archivo", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 16px/1.55 var(--font);
  font-variation-settings: "wdth" 100;
}
a { color: var(--teal); text-underline-offset: 3px; }
a:hover { color: var(--ink); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3 { margin: 0; line-height: 1.15; font-weight: 700; }
h1 { font-size: clamp(1.75rem, 1.3rem + 1.6vw, 2.4rem); font-variation-settings: "wdth" 112; letter-spacing: -0.01em; }
h2 { font-size: 1.3rem; font-variation-settings: "wdth" 108; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 0.75em; max-width: 68ch; }
.muted { color: var(--ink-2); }
.small { font-size: 0.875rem; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.side {
  background: var(--ink);
  color: #dbe7e4;
  padding: 28px 18px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand { display: flex; flex-direction: column; gap: 2px; }
.brand b { font-size: 1.35rem; font-variation-settings: "wdth" 125; color: #fff; letter-spacing: 0.01em; }
.brand span { font-size: 0.8rem; color: #9fbab5; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav .group { font-size: 0.8rem; color: #8aa7a2; margin: 16px 10px 6px; }
.nav a {
  color: #dbe7e4; text-decoration: none; padding: 9px 10px; border-radius: var(--radius-sm);
  display: flex; justify-content: space-between; align-items: center;
}
.nav a:hover { background: rgba(255,255,255,0.07); color: #fff; }
.nav a[aria-current="page"] { background: var(--teal); color: #fff; }
.nav .count { background: var(--amber); color: var(--ink); font-size: 0.75rem; font-weight: 700; border-radius: 99px; padding: 0 7px; }
.who { margin-top: auto; font-size: 0.875rem; border-top: 1px solid rgba(255,255,255,0.12); padding-top: 16px; }
.who b { color: #fff; display: block; }
.who button { margin-top: 10px; }
.main { padding: 36px clamp(16px, 4vw, 48px) 64px; max-width: 1180px; width: 100%; }
.topbar { display: none; }

.page-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 28px; }
.page-head p { margin: 8px 0 0; color: var(--ink-2); }

/* ---------- buttons & forms ---------- */
.btn {
  font: 600 0.95rem/1 var(--font); border: 1.5px solid var(--ink); background: var(--ink); color: #fff;
  padding: 11px 16px; border-radius: var(--radius-sm); cursor: pointer; text-decoration: none; display: inline-flex; gap: 8px; align-items: center;
}
.btn:hover { background: var(--teal); border-color: var(--teal); color: #fff; }
.btn.quiet { background: transparent; color: var(--ink); }
.btn.quiet:hover { background: var(--teal-soft); color: var(--ink); border-color: var(--ink); }
.btn.danger { background: transparent; color: var(--danger); border-color: var(--danger); }
.btn.danger:hover { background: var(--danger-soft); }
.btn.small { padding: 7px 10px; font-size: 0.85rem; }
.btn[disabled] { opacity: 0.55; cursor: progress; }
.side .btn.quiet { color: #dbe7e4; border-color: rgba(255,255,255,0.35); }
.side .btn.quiet:hover { background: rgba(255,255,255,0.08); color: #fff; }
.linkbtn { background: none; border: 0; padding: 0; font: inherit; color: var(--teal); text-decoration: underline; cursor: pointer; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field label, .field legend { font-weight: 600; font-size: 0.95rem; }
.field .hint { font-size: 0.85rem; color: var(--ink-2); }
input, select, textarea {
  font: inherit; color: var(--ink); background: #fff; border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  padding: 10px 12px; width: 100%;
}
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--teal); outline: none; box-shadow: 0 0 0 3px var(--teal-soft); }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0 16px; }
fieldset { border: 0; padding: 0; margin: 0; }
.check { display: flex; gap: 8px; align-items: center; font-weight: 500; }
.check input { width: auto; }

/* 1 to 5 scale */
.scale { display: grid; grid-template-columns: repeat(5, 1fr); max-width: 340px; border: 1.5px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.scale input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.scale label { text-align: center; padding: 9px 0; cursor: pointer; font-weight: 600; border-left: 1px solid var(--line); background: #fff; }
.scale label:first-of-type { border-left: 0; }
.scale input:checked + label { background: var(--teal); color: #fff; }
.scale input:focus-visible + label { outline: 3px solid var(--focus); outline-offset: -3px; }
.scale-ends { display: flex; justify-content: space-between; max-width: 340px; font-size: 0.8rem; color: var(--ink-2); }

.alert { padding: 12px 14px; border-radius: var(--radius-sm); margin-bottom: 16px; border-left: 4px solid; }
.alert.error { background: var(--danger-soft); border-color: var(--danger); }
.alert.ok { background: var(--teal-soft); border-color: var(--teal); }
.alert.warn { background: var(--amber-soft); border-color: var(--amber); }

/* ---------- auth screens ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-art { background: var(--ink); color: #dbe7e4; padding: clamp(28px, 5vw, 64px); display: flex; flex-direction: column; justify-content: space-between; overflow: hidden; }
.auth-art .codes { display: flex; flex-wrap: wrap; gap: 6px 14px; font-weight: 800; font-variation-settings: "wdth" 125; font-size: clamp(2.2rem, 1.2rem + 3.6vw, 4.6rem); line-height: 1; color: #2c524e; }
.auth-art .codes span:last-child { color: var(--amber); }
.auth-art h1 { color: #fff; margin-top: 28px; }
.auth-art p { color: #a9c3be; }
.auth-form { display: flex; align-items: center; justify-content: center; padding: 32px 20px; }
.auth-form form { width: 100%; max-width: 380px; }
.auth-form h2 { margin-bottom: 6px; }
.auth-form .lead { color: var(--ink-2); margin-bottom: 24px; }

/* ---------- programme track ---------- */
.track { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 22px 22px 18px; margin-bottom: 28px; }
.track-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.track ol { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(var(--n), minmax(64px, 1fr)); overflow-x: auto; }
.track li { position: relative; padding: 0 6px 0 0; }
.track li::before { content: ""; position: absolute; top: 15px; left: 0; right: 0; height: 3px; background: var(--line); }
.track li.done::before { background: var(--teal); }
.track li.live::before { background: linear-gradient(90deg, var(--teal) 50%, var(--line) 50%); }
.track a { position: relative; display: block; text-decoration: none; color: var(--ink); padding-top: 34px; }
.track .dot { position: absolute; top: 7px; left: 0; width: 19px; height: 19px; border-radius: 50%; background: #fff; border: 3px solid var(--line); }
.track li.done .dot { background: var(--teal); border-color: var(--teal); }
.track li.live .dot { background: var(--amber); border-color: var(--amber); box-shadow: 0 0 0 5px var(--amber-soft); }
.track .code { display: block; font-weight: 800; font-variation-settings: "wdth" 125; font-size: 1.35rem; line-height: 1; }
.track li.todo .code { color: #8aa29e; }
.track .when { display: block; font-size: 0.78rem; color: var(--ink-2); margin-top: 4px; white-space: nowrap; }
.track a:hover .code { color: var(--teal); }

/* ---------- panels ---------- */
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 20px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 20px 22px; }
.panel h2 { margin-bottom: 12px; }
.panel.attention { border-color: var(--amber); box-shadow: inset 4px 0 0 var(--amber); }
.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: 12px 0; border-top: 1px solid var(--line); display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.list li:first-child { border-top: 0; padding-top: 4px; }
.empty { color: var(--ink-2); padding: 8px 0; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 24px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 16px 18px; }
.stat b { display: block; font-size: 1.9rem; font-variation-settings: "wdth" 115; line-height: 1.1; }
.stat span { color: var(--ink-2); font-size: 0.9rem; }
.meter { height: 8px; background: var(--teal-soft); border-radius: 99px; overflow: hidden; margin-top: 10px; }
.meter i { display: block; height: 100%; background: var(--teal); }

/* ---------- modules ---------- */
.modules { display: grid; gap: 12px; }
.module-row {
  display: grid; grid-template-columns: 84px 1fr auto; gap: 18px; align-items: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 16px 20px;
  text-decoration: none; color: inherit;
}
.module-row:hover { border-color: var(--teal); }
.module-row .code { font-weight: 800; font-variation-settings: "wdth" 125; font-size: 2rem; line-height: 1; }
.module-row h3 { margin-bottom: 3px; }
.module-row .meta { font-size: 0.875rem; color: var(--ink-2); }
.module-row .side-meta { text-align: right; font-size: 0.875rem; color: var(--ink-2); white-space: nowrap; }
.tag { display: inline-block; font-size: 0.78rem; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: var(--teal-soft); color: var(--ink); }
.tag.amber { background: var(--amber-soft); }
.tag.grey { background: #e6ebea; color: var(--ink-2); }
.tag.red { background: var(--danger-soft); color: var(--danger); }

.module-hero { display: grid; grid-template-columns: auto 1fr; gap: 24px; align-items: start; margin-bottom: 28px; }
.module-hero .big { font-weight: 800; font-variation-settings: "wdth" 125; font-size: clamp(3.5rem, 2rem + 6vw, 6.5rem); line-height: 0.85; color: var(--teal); }
.facts { display: flex; flex-wrap: wrap; gap: 8px 22px; font-size: 0.92rem; color: var(--ink-2); margin-top: 10px; }
.facts b { color: var(--ink); font-weight: 600; }

.material { display: grid; grid-template-columns: 40px 1fr auto; gap: 14px; align-items: center; padding: 14px 0; border-top: 1px solid var(--line); }
.material:first-child { border-top: 0; }
.material .icon { width: 40px; height: 40px; border-radius: 8px; background: var(--teal-soft); display: grid; place-items: center; font-weight: 800; font-size: 0.7rem; color: var(--teal); }
.material .actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: end; }

/* ---------- feedback cards ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1.5px solid var(--line); margin-bottom: 22px; overflow-x: auto; }
.tabs button { font: 600 0.95rem var(--font); background: none; border: 0; padding: 10px 14px; color: var(--ink-2); cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -1.5px; white-space: nowrap; }
.tabs button[aria-selected="true"] { color: var(--ink); border-color: var(--teal); }
.choice { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; margin-bottom: 28px; }
.choice button {
  text-align: left; font: inherit; color: inherit; background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--radius-lg);
  padding: 16px 18px; cursor: pointer;
}
.choice button:hover { border-color: var(--teal); }
.choice button b { display: block; margin-bottom: 4px; }
.choice button span { color: var(--ink-2); font-size: 0.9rem; }

.fb { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 16px 20px; margin-bottom: 12px; }
.fb-head { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin-bottom: 8px; }
.fb-head .grow { flex: 1; }
.fb dl { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; margin: 8px 0 0; }
.fb dt { color: var(--ink-2); font-size: 0.9rem; }
.fb dd { margin: 0; white-space: pre-wrap; }
.pips { display: inline-flex; gap: 3px; vertical-align: middle; }
.pips i { width: 10px; height: 10px; border-radius: 2px; background: var(--line); }
.pips i.on { background: var(--teal); }

.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 18px; align-items: end; }
.filters .field { margin: 0; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); }
table { border-collapse: collapse; width: 100%; font-size: 0.93rem; }
th, td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-weight: 600; color: var(--ink-2); background: #f6f9f8; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td .sub { display: block; color: var(--ink-2); font-size: 0.85rem; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.toolbar .grow { flex: 1; min-width: 200px; }

/* ---------- dialog ---------- */
dialog { border: 0; border-radius: var(--radius-lg); padding: 0; width: min(620px, calc(100vw - 24px)); color: var(--ink); max-height: calc(100vh - 32px); }
dialog::backdrop { background: rgba(16, 48, 46, 0.55); }
.dlg { padding: 24px; }
.dlg h2 { margin-bottom: 14px; }
.dlg-actions { display: flex; justify-content: end; gap: 10px; margin-top: 8px; flex-wrap: wrap; }
.creds { font-variant-numeric: tabular-nums; }
.creds td:last-child { font-weight: 700; letter-spacing: 0.03em; }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 12px 18px; border-radius: var(--radius-sm); z-index: 50; }

/* ---------- responsive ---------- */
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 30% 0 0; z-index: 40; transform: translateX(-100%); transition: transform 0.2s; height: auto; overflow-y: auto; }
  .side.open { transform: none; }
  .topbar { display: flex; align-items: center; justify-content: space-between; background: var(--ink); color: #fff; padding: 12px 16px; position: sticky; top: 0; z-index: 30; }
  .topbar b { font-variation-settings: "wdth" 125; }
  .topbar button { background: none; border: 1.5px solid rgba(255,255,255,0.4); color: #fff; border-radius: var(--radius-sm); padding: 6px 10px; font: inherit; }
  .main { padding-top: 24px; }
  .auth { grid-template-columns: 1fr; }
  .auth-art { min-height: 0; padding-bottom: 28px; }
  .module-row { grid-template-columns: 60px 1fr; }
  .module-row .code { font-size: 1.5rem; }
  .module-row .side-meta { grid-column: 2; text-align: left; }
  .module-hero { grid-template-columns: 1fr; gap: 8px; }
  .material { grid-template-columns: 40px 1fr; }
  .material .actions { grid-column: 2; justify-content: start; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- refinements after review ---------- */
.shell { background: linear-gradient(to right, var(--ink) 240px, transparent 240px); }
.btn { white-space: nowrap; }
.fb { container-type: inline-size; }
@container (max-width: 460px) {
  .fb dl { grid-template-columns: 1fr; gap: 0; }
  .fb dt { margin-top: 8px; }
  .fb-head .grow { flex-basis: 100%; order: 2; }
}
@media (max-width: 860px) { .shell { background: none; } }
.shell > *, .main { min-width: 0; }
.track { min-width: 0; overflow: hidden; }
.track ol { padding-bottom: 6px; }
.grid2 { grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr)); }
.tag { white-space: nowrap; }
.filters input, .filters select, .toolbar input, .toolbar select { height: 44px; }

/* ---------- e27 ATP ---------- */
.atp-mark { font-weight: 800; font-variation-settings: "wdth" 125; color: var(--amber); margin: 0 0 6px; font-size: 1rem; letter-spacing: 0.02em; }
.team-facts { display: grid; grid-template-columns: max-content 1fr; gap: 2px 12px; margin: 10px 0 6px; font-size: 0.9rem; }
.team-facts dt { color: var(--ink-2); }
.team-facts dd { margin: 0; }
details summary { cursor: pointer; color: var(--teal); font-weight: 600; }
details p { margin-top: 6px; }
.list li.team-li { display: block; }
.team-li-row { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.demo-logins { margin-top: 28px; padding-top: 18px; border-top: 1px solid var(--line); }
.demo-logins h3 { margin-bottom: 4px; }
.demo-logins .btn { margin: 6px 6px 0 0; }
.auth-art .atp-mark { color: var(--amber); font-size: 1.1rem; }

/* ---------- portal level ---------- */
.auth-art .wordmark { display: flex; flex-direction: column; font-weight: 800; font-variation-settings: "wdth" 125; line-height: 0.88; font-size: clamp(4.5rem, 2rem + 9vw, 10rem); letter-spacing: -0.02em; }
.auth-art .wordmark span:first-child { color: #2c524e; }
.auth-art .wordmark span:last-child { color: var(--amber); }
.nav a.back-link { color: #9fbab5; font-size: 0.9rem; margin-bottom: 6px; }
.nav a.back-link::before { content: "‹"; margin-right: 8px; }
.nav a.back-link span { flex: 1; }
.prog-list { display: grid; gap: 12px; }
.prog-card {
  display: grid; grid-template-columns: 120px 1fr auto; gap: 20px; align-items: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 18px 22px;
  text-decoration: none; color: inherit;
}
.prog-card:hover { border-color: var(--teal); }
.prog-card.archived { opacity: 0.65; }
.prog-short { font-weight: 800; font-variation-settings: "wdth" 125; font-size: 1.6rem; line-height: 1; color: var(--teal); overflow-wrap: anywhere; }
.prog-body { display: flex; flex-direction: column; gap: 3px; }
.prog-body b { font-size: 1.1rem; }
.prog-meta { text-align: right; white-space: nowrap; }
.template { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: start; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: var(--radius-sm); margin-bottom: 8px; cursor: pointer; }
.template:has(input:checked) { border-color: var(--teal); background: var(--teal-soft); }
.template.used { opacity: 0.55; cursor: not-allowed; }
.template input { width: auto; margin-top: 4px; }
.template span { display: flex; flex-direction: column; }
@media (max-width: 860px) {
  .prog-card { grid-template-columns: 1fr; gap: 8px; }
  .prog-meta { text-align: left; }
}
