/* Academy platform. Colours, fonts and corner radius come from the brand (set as CSS variables in the page head).
   Staff (mentors, admins) get the neutral platform theme defined here. */
:root {
  --bg: #f4f3f0; --surface: #ffffff; --surface2: #f0eee9; --ink: #18181b; --muted: #6b6a72; --line: #e2e0da;
  --accent: #c9a227; --accent-ink: #18181b; --action: #18181b; --action-ink: #ffffff; --good: #2f8a57; --develop: #d9822b; --bad: #d64545;
  --radius: 16px; --display: "Figtree", system-ui, sans-serif; --display-case: none; --display-stretch: 100%;
  --body: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not(.branded) { --bg: #101114; --surface: #17181c; --surface2: #1f2026; --ink: #f2f2f4; --muted: #9a9aa5; --line: #2a2b31;
    --accent: #e0bd4e; --accent-ink: #101114; --action: #f2f2f4; --action-ink: #101114; --good: #4cc283; --develop: #f0a04b; color-scheme: dark; }
}
:root.branded { color-scheme: dark; --bad: #ff6b6b; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 var(--body); min-height: 100vh; }
a { color: inherit; }
img { max-width: 100%; }
h1, h2, h3 { font-family: var(--display); font-stretch: var(--display-stretch); text-transform: var(--display-case); line-height: 1.05; margin: 0; letter-spacing: .005em; text-wrap: balance; }
h1 { font-size: clamp(26px, 6vw, 38px); font-weight: 900; }
h2 { font-size: clamp(18px, 4vw, 22px); font-weight: 800; }
h3 { font-size: 16px; font-weight: 800; }
p { margin: 0; }
small, .muted { color: var(--muted); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }

/* ---------- shell */
.shell { display: grid; grid-template-columns: 1fr; min-height: 100vh; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: calc(10px + env(safe-area-inset-top, 0px)) 16px 10px;
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.topbar .logo { height: 42px; width: auto; display: block; }
.topbar .wordmark { font-family: var(--display); font-stretch: var(--display-stretch); text-transform: var(--display-case); font-weight: 900; font-size: 17px; text-decoration: none; }
.topbar .sp { flex: 1; }
.iconbtn { position: relative; display: inline-grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); text-decoration: none; color: var(--ink); }
.iconbtn svg { width: 20px; height: 20px; }
.iconbtn .dot { position: absolute; top: 6px; right: 7px; width: 9px; height: 9px; border-radius: 50%; background: var(--action); border: 2px solid var(--surface); }
.main { width: 100%; max-width: 1080px; margin: 0 auto; padding: 18px 16px calc(96px + env(safe-area-inset-bottom, 0px)); display: grid; gap: 16px; align-content: start; }
.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; justify-content: space-around; gap: 4px;
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px)); background: var(--surface); border-top: 1px solid var(--line); }
.tabs a { flex: 1; display: grid; justify-items: center; gap: 2px; padding: 6px 4px; border-radius: 12px; text-decoration: none; color: var(--muted); font-size: 12px; font-weight: 700; min-height: 52px; }
.tabs a svg { width: 24px; height: 24px; }
.tabs a[aria-current] { color: var(--ink); background: var(--surface2); }
.tabs a[aria-current] svg { color: var(--accent); }
@media (min-width: 900px) {
  .shell { grid-template-columns: 220px 1fr; }
  .tabs { position: sticky; top: 0; height: 100vh; flex-direction: column; justify-content: flex-start; gap: 4px; padding: 84px 12px 16px; border-top: 0; border-right: 1px solid var(--line); grid-row: 1 / 3; }
  .tabs a { flex: none; display: flex; align-items: center; gap: 12px; font-size: 15px; padding: 10px 14px; min-height: 0; }
  .topbar { grid-column: 2; }
  .main { grid-column: 2; padding-bottom: 40px; }
  .shell.notabs { grid-template-columns: 1fr; } .shell.notabs .topbar, .shell.notabs .main { grid-column: 1; }
}

/* ---------- building blocks */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; display: grid; gap: 12px; min-width: 0; }
.card.flat { background: transparent; }
.card.hero { padding: 20px; }
.grid2 { display: grid; gap: 16px; grid-template-columns: 1fr; }
.grid3 { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 760px) { .grid2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1000px) { .grid4 { grid-template-columns: repeat(4, minmax(0, 1fr)) !important; } }
.row { display: flex; align-items: center; gap: 12px; min-width: 0; }
.row.wrap { flex-wrap: wrap; }
.row .grow { flex: 1; min-width: 0; }
.stack { display: grid; gap: 8px; }
.eyebrow { font-size: 12px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); }
.big { font-family: var(--display); font-stretch: var(--display-stretch); font-weight: 900; font-size: 32px; line-height: 1; font-variant-numeric: tabular-nums; }
.kpi { display: grid; gap: 4px; padding: 14px 16px; }
.kpi .big { font-size: 30px; }
.kpi.alert .big { color: var(--bad); }
.kpi a { text-decoration: none; }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 700; border-radius: 999px; padding: 3px 10px; background: var(--surface2); color: var(--ink); white-space: nowrap; }
.pill .sw { width: 8px; height: 8px; border-radius: 50%; }
.pill.good { background: color-mix(in srgb, var(--good) 18%, transparent); }
.pill.warn { background: color-mix(in srgb, var(--develop) 20%, transparent); }
.pill.bad { background: color-mix(in srgb, var(--bad) 18%, transparent); }
.avatar { flex: none; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 15px; background: var(--surface2); color: var(--ink); overflow: hidden; border: 2px solid var(--line); }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.lg { width: 72px; height: 72px; font-size: 24px; }
.list { display: grid; }
.list > a, .list > div { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); text-decoration: none; min-width: 0; }
.list > :first-child { border-top: 0; }
.list .t { font-weight: 700; } .list .s { font-size: 14px; color: var(--muted); }
.list .chev { margin-left: auto; color: var(--muted); }
.empty { color: var(--muted); padding: 8px 0; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 20px; border-radius: 999px; border: 2px solid transparent;
  background: var(--action); color: var(--action-ink); font: 800 16px var(--body); text-decoration: none; cursor: pointer; }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.small { min-height: 38px; padding: 0 14px; font-size: 14px; }
.btn.block { width: 100%; }
.btn.accent { background: var(--accent); color: var(--accent-ink); }
.btn.danger { background: var(--bad); color: #fff; }
.flash { border-radius: var(--radius); padding: 12px 16px; font-weight: 700; background: color-mix(in srgb, var(--good) 18%, var(--surface)); border: 1px solid color-mix(in srgb, var(--good) 40%, transparent); }
.flash.err { background: color-mix(in srgb, var(--bad) 14%, var(--surface)); border-color: color-mix(in srgb, var(--bad) 40%, transparent); }
.seg { display: inline-flex; background: var(--surface2); border-radius: 999px; padding: 4px; gap: 4px; overflow-x: auto; max-width: 100%; }
.seg a { padding: 8px 14px; border-radius: 999px; text-decoration: none; font-weight: 700; font-size: 14px; white-space: nowrap; color: var(--muted); }
.seg a[aria-current] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.12); }

/* ---------- forms */
form { display: grid; gap: 12px; }
label { display: grid; gap: 6px; font-weight: 700; font-size: 14px; }
input, select, textarea { font: 500 16px var(--body); color: var(--ink); background: var(--surface); border: 1.5px solid var(--line); border-radius: 12px; padding: 11px 12px; width: 100%; min-height: 46px; }
textarea { min-height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); }
input[type=checkbox], input[type=radio] { width: 20px; height: 20px; min-height: 0; accent-color: var(--accent); }
.check { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.fields { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .fields { grid-template-columns: repeat(2, minmax(0, 1fr)); } .fields .full { grid-column: 1 / -1; } }
details.more > summary { cursor: pointer; font-weight: 800; list-style: none; display: flex; align-items: center; gap: 8px; min-height: 44px; }
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary::after { content: "+"; margin-left: auto; font-size: 22px; color: var(--muted); }
details.more[open] > summary::after { content: "–"; }

/* ---------- progress ring + journey */
.ring { position: relative; width: 132px; height: 132px; flex: none; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring .track { stroke: var(--surface2); }
.ring .fill { stroke: var(--accent); stroke-linecap: round; transition: stroke-dashoffset .8s ease; }
.ring .lbl { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.ring .lbl b { font-family: var(--display); font-stretch: var(--display-stretch); font-weight: 900; font-size: 30px; line-height: 1; }
.ring .lbl span { font-size: 12px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.ring.sm { width: 56px; height: 56px; } .ring.sm .lbl b { font-size: 15px; } .ring.sm .lbl span { display: none; }
.weekbar { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 5px; }
.weekbar i { height: 10px; border-radius: 99px; background: var(--surface2); }
.weekbar i.done { background: var(--accent); }
.weekbar i.now { background: color-mix(in srgb, var(--accent) 45%, var(--surface2)); outline: 2px solid var(--accent); outline-offset: 1px; }
.journey { display: grid; gap: 0; }
.jweek { display: grid; grid-template-columns: 44px 1fr; gap: 12px; position: relative; padding-bottom: 18px; }
.jweek::before { content: ""; position: absolute; left: 21px; top: 44px; bottom: 0; width: 2px; background: var(--line); }
.jweek:last-child::before { display: none; }
.jweek .num { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font-weight: 900; background: var(--surface2); color: var(--muted); border: 2px solid var(--line); font-family: var(--display); }
.jweek.done .num { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.jweek.now .num { border-color: var(--accent); color: var(--ink); }
.jweek .body { display: grid; gap: 6px; padding-top: 4px; min-width: 0; }
.skills { display: flex; flex-wrap: wrap; gap: 6px; }
.skill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 999px; font-size: 13px; font-weight: 700; background: var(--surface2); color: var(--muted); }
.skill i { width: 9px; height: 9px; border-radius: 50%; border: 2px solid currentColor; }
.skill.completed { color: var(--ink); background: color-mix(in srgb, var(--good) 22%, var(--surface2)); }
.skill.completed i { background: var(--good); border-color: var(--good); }
.skill.developing i, .skill.needs_practice i { background: linear-gradient(90deg, var(--develop) 50%, transparent 50%); border-color: var(--develop); }
.skill.developing, .skill.needs_practice { color: var(--ink); }
.stagebar { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; }
.stagebar div { display: grid; gap: 6px; font-size: 11.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.stagebar div::before { content: ""; height: 4px; background: var(--surface2); }
.stagebar .done::before { background: var(--ink); } .stagebar .active::before { background: var(--accent); } .stagebar .active { color: var(--ink); }

/* ---------- achievements */
.badges { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 700px) { .badges { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.badge { display: grid; justify-items: center; text-align: center; gap: 8px; padding: 16px 10px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); }
.badge .ico { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; background: var(--surface2); color: var(--muted); }
.badge .ico svg { width: 32px; height: 32px; }
.badge b { font-size: 14px; } .badge small { font-size: 12px; }
.badge.on .ico { background: var(--accent); color: var(--accent-ink); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 25%, transparent); }
.badge:not(.on) { opacity: .62; }
.badge:not(.on) b { color: var(--muted); }
.milestones .badge { justify-items: start; text-align: left; grid-template-columns: auto 1fr; align-items: center; padding: 12px 14px; }
.milestones .badge .ico { width: 36px; height: 36px; border-radius: 4px; }
.milestones .badge .ico svg { width: 18px; height: 18px; }
.milestones { grid-template-columns: 1fr !important; } @media (min-width: 700px) { .milestones { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; } }
.celebrate { position: relative; overflow: hidden; border: 2px solid var(--accent); }
.celebrate .ico { animation: pop .7s cubic-bezier(.2,1.6,.4,1) both; }
@keyframes pop { from { transform: scale(.3); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .celebrate .ico, .ring .fill { animation: none; transition: none; } }

/* ---------- mentor lesson update */
.srow { display: grid; gap: 8px; padding: 12px 0; border-top: 1px solid var(--line); }
.srow:first-of-type { border-top: 0; }
.srow .nm { font-weight: 800; }
.tri { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.tri input { position: absolute; opacity: 0; pointer-events: none; }
.tri label { display: grid; place-items: center; min-height: 48px; border-radius: 12px; border: 1.5px solid var(--line); font-size: 13.5px; font-weight: 800; text-align: center; padding: 4px; cursor: pointer; background: var(--surface); }
.tri input:checked + label.c { background: var(--good); border-color: var(--good); color: #fff; }
.tri input:checked + label.d { background: var(--develop); border-color: var(--develop); color: #fff; }
.tri input:checked + label.n { background: var(--bad); border-color: var(--bad); color: #fff; }
.tri input:focus-visible + label { outline: 3px solid var(--accent); }
.att { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.att input { position: absolute; opacity: 0; pointer-events: none; }
.att label { display: grid; place-items: center; min-height: 48px; border-radius: 12px; border: 1.5px solid var(--line); font-weight: 800; font-size: 14px; cursor: pointer; background: var(--surface); }
.att input:checked + label { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.quick { display: flex; flex-wrap: wrap; gap: 6px; }
.quick button { border: 1.5px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 999px; padding: 7px 12px; font: 700 13.5px var(--body); cursor: pointer; }
.stickybar { position: sticky; bottom: calc(76px + env(safe-area-inset-bottom, 0px)); z-index: 10; padding: 10px 0 0; background: linear-gradient(transparent, var(--bg) 30%); }
@media (min-width: 900px) { .stickybar { bottom: 0; } }

/* ---------- tables (admin) */
.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: 14.5px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; white-space: nowrap; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); background: var(--surface2); }
tr:last-child td { border-bottom: 0; }
td.wrap { white-space: normal; min-width: 220px; }
td a { font-weight: 700; }
.brandtag { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 800; padding: 2px 8px; border-radius: 6px; background: var(--surface2); white-space: nowrap; }
.brandtag i { width: 8px; height: 8px; border-radius: 2px; }

/* ---------- auth + certificate */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.auth .card { width: 100%; max-width: 420px; padding: 28px; }
.cert { background: #fff; color: #111; max-width: 900px; margin: 0 auto; aspect-ratio: 1.414; padding: 6% 7%; display: grid; align-content: space-between; text-align: center; border: 14px solid var(--cert-frame, #111); position: relative; }
.cert.dark { background: #050608; color: #fff; }
.cert h1 { font-size: clamp(22px, 4.6vw, 46px); }
.cert .name { font-family: var(--display); font-stretch: var(--display-stretch); font-weight: 900; font-size: clamp(28px, 6vw, 64px); text-transform: var(--display-case); color: var(--cert-accent, #111); line-height: 1; }
.cert .logo { height: clamp(48px, 10vw, 110px); width: auto; margin: 0 auto; }
.cert .meta { display: flex; justify-content: space-between; gap: 16px; font-size: clamp(11px, 1.6vw, 14px); text-align: left; }
@media print { .noprint { display: none !important; } body { background: #fff; } .cert { border-width: 10px; } .main { padding: 0; } .tabs, .topbar { display: none; } }
.btn svg { width: 20px; height: 20px; flex: none; }
.pill svg { width: 14px; height: 14px; flex: none; }
.row > svg, p > svg, a > svg { width: 20px; height: 20px; flex: none; }
.list > a > svg, .list > div > svg { width: 22px; height: 22px; flex: none; color: var(--muted); }
.chev svg { width: 18px; height: 18px; }
.req { display: flex; gap: 10px; align-items: center; }
.req .tick { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; border: 2px solid var(--line); flex: none; }
.req .tick svg { width: 14px; height: 14px; }
.req.met .tick { background: var(--good); border-color: var(--good); color: var(--bg); }
@media (min-width: 520px) { .hero .ring { margin-left: auto; } }
.card { align-content: start; }
@media (min-width: 900px) { .tabs { background: var(--bg); } }
