/* ============================================================
   MeDofE v2 design system — mobile-first
   Mendip brand palette (blue family) with a warm XP gold.
   External/student-facing app: friendlier shapes than the
   internal apps, same colours.
   ============================================================ */

:root {
  --brand: #005e85;        /* Mendip primary blue */
  --brand-dark: #004669;
  --brand-deep: #00344e;
  --brand-light: #e8f4fd;
  --accent: #00a8e0;       /* Mendip bright cyan */
  --accent-light: #d9f1fb;
  --gold: #ffd166;         /* XP & celebration */
  --success: #1a8c4e;
  --success-bg: #d1e7dd;
  --warn: #856404;
  --warn-bg: #fff3cd;
  --danger: #842029;
  --danger-bg: #f8d7da;
  --bg: #f4f6f9;
  --paper: #ffffff;
  --ink: #1a1a2e;
  --ink-soft: #6b7280;
  --line: #dde1e7;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(0, 52, 78, .08);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: 'Nunito', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
  min-height: 100dvh;
}
.app-shell { min-height: 100dvh; display: flex; flex-direction: column; }

/* ---------- side navigation ---------- */
:root { --sn-w: 230px; --sn-w-mini: 66px; }
.sidenav {
  position: fixed; top: 0; bottom: 0; left: 0; z-index: 90;
  width: var(--sn-w);
  background: linear-gradient(180deg, var(--brand) 0%, var(--brand-dark) 100%);
  color: #fff;
  display: flex; flex-direction: column;
  transition: width .18s ease, transform .22s ease;
  overflow: hidden;
}
.sn-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: .8rem .8rem .8rem 1rem; gap: .5rem;
}
.sn-brand {
  display: flex; align-items: center; gap: .55rem; min-width: 0;
  color: #fff; text-decoration: none; font-weight: 900; font-size: 1.2rem;
  letter-spacing: -.02em; white-space: nowrap;
}
.sn-brand img { height: 28px; width: auto; border-radius: 0; flex-shrink: 0; }
.sn-collapse {
  flex-shrink: 0; width: 30px; height: 30px; border-radius: 8px;
  border: 0; cursor: pointer; font-weight: 900; font-size: 1rem;
  background: rgba(255,255,255,.14); color: #fff; font-family: inherit;
}
.sn-collapse:hover { background: rgba(255,255,255,.28); }
.sn-links { flex: 1; padding: .4rem .55rem; display: flex; flex-direction: column; gap: .2rem; overflow-y: auto; }
.sn-link {
  display: flex; align-items: center; gap: .7rem;
  color: rgba(255,255,255,.82); text-decoration: none;
  font-weight: 700; font-size: .97rem; white-space: nowrap;
  padding: .55rem .65rem; border-radius: 10px;
}
.sn-link:hover { background: rgba(255,255,255,.1); color: #fff; }
.sn-link.active { background: rgba(255,255,255,.18); color: #fff; }
.sn-ico { font-size: 1.15rem; width: 1.4rem; text-align: center; flex-shrink: 0; }
.sn-link.sn-sub { margin-left: 1.6rem; font-size: .9rem; padding: .4rem .6rem; }
.sn-link.sn-sub .sn-ico { font-size: .95rem; width: 1.1rem; }
html.nav-mini .sn-link.sn-sub { display: none; }
.sn-foot { padding: .4rem .55rem .8rem; border-top: 1px solid rgba(255,255,255,.15); }
.sn-user { cursor: default; opacity: .85; }

body.has-sidenav .app-shell { margin-left: var(--sn-w); transition: margin-left .18s ease; }
html.nav-mini .sidenav { width: var(--sn-w-mini); }
html.nav-mini body.has-sidenav .app-shell { margin-left: var(--sn-w-mini); }
html.nav-mini .sn-label { display: none; }
html.nav-mini .sn-head { padding: .8rem 0; justify-content: center; flex-direction: column; gap: .6rem; }
html.nav-mini .sn-link { justify-content: center; padding: .55rem .3rem; }
html.nav-mini .sn-ico { width: auto; }

.topbar.topbar-mobile { display: none; }
.hamburger {
  width: 2.2rem; height: 2.2rem; border: 0; border-radius: 8px; cursor: pointer;
  background: rgba(255,255,255,.14); color: #fff; font-size: 1.2rem; font-family: inherit;
}
.topbar-go {
  width: 2.2rem; height: 2.2rem; border-radius: 8px; text-decoration: none;
  background: rgba(255,255,255,.14); font-size: 1.2rem;
  display: inline-flex; align-items: center; justify-content: center;
}
.nav-overlay {
  display: none; position: fixed; inset: 0; z-index: 85;
  background: rgba(0, 32, 48, .5);
}

@media (max-width: 1019px) {
  .sidenav { transform: translateX(-105%); width: var(--sn-w) !important; box-shadow: 4px 0 24px rgba(0,0,0,.25); }
  html.nav-open .sidenav { transform: none; }
  html.nav-open .nav-overlay { display: block; }
  body.has-sidenav .app-shell { margin-left: 0 !important; }
  .sn-collapse { display: none; }
  .topbar.topbar-mobile { display: flex; justify-content: space-between; }
  html.nav-mini .sn-label { display: inline; }   /* drawer always full width */
  html.nav-mini .sn-link { justify-content: flex-start; padding: .55rem .65rem; }
  html.nav-mini .sn-head { padding: .8rem .8rem .8rem 1rem; flex-direction: row; }
}
img, video { max-width: 100%; height: auto; border-radius: 10px; }
a { color: var(--brand); }

/* ---------- impersonation bar ---------- */
.imp-bar {
  background: var(--gold); color: var(--brand-deep);
  display: flex; align-items: center; justify-content: center; gap: 1rem;
  flex-wrap: wrap; padding: .45rem 1rem; font-size: .9rem; font-weight: 700;
  position: sticky; top: 0; z-index: 60;
}
.imp-bar form { margin: 0; }
.imp-bar button {
  font-family: inherit; font-weight: 800; font-size: .82rem; cursor: pointer;
  background: var(--brand-deep); color: #fff; border: 0; border-radius: 999px;
  padding: .3rem .9rem;
}

/* ---------- top bar ---------- */
.topbar {
  background: var(--brand);
  color: #fff;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .35rem 1rem;
  padding: .65rem 1rem;
  padding-top: max(.65rem, env(safe-area-inset-top));
  position: sticky; top: 0; z-index: 50;
}
.brand {
  display: flex; align-items: center; gap: .55rem;
  font-weight: 900; font-size: 1.25rem; color: #fff; text-decoration: none;
  letter-spacing: -.02em; white-space: nowrap;
}
.brand img { height: 30px; width: auto; border-radius: 0; display: block; }
.brand-mark { color: var(--accent); }
.topnav { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; justify-content: flex-end; }
.topnav a { color: rgba(255,255,255,.8); text-decoration: none; font-weight: 700; font-size: .95rem; }
.topnav a:hover { color: #fff; }
.nav-user { opacity: .85; }

/* ---------- layout ---------- */
.page { flex: 1; width: 100%; max-width: 720px; margin: 0 auto; padding: 1.25rem 1rem 3rem; }
.footer { text-align: center; color: var(--ink-soft); font-size: .85rem; padding: 1.5rem 1rem; }
.footer a { color: inherit; }

h1 { font-size: 1.7rem; font-weight: 900; letter-spacing: -.02em; margin: .5rem 0 .75rem; }
h2 { font-size: 1.25rem; font-weight: 800; margin: 1.5rem 0 .5rem; }
.lead { font-size: 1.05rem; color: var(--ink-soft); }

/* ---------- cards, buttons, forms ---------- */
.card {
  background: var(--paper); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 1.25rem; margin-bottom: 1rem;
}
.btn {
  display: inline-block; background: var(--brand); color: #fff;
  font-family: inherit; font-weight: 800; font-size: 1rem;
  border: 0; border-radius: 999px; padding: .8rem 1.6rem;
  cursor: pointer; text-decoration: none; text-align: center;
  transition: transform .08s, background .15s;
}
.btn:hover { background: var(--brand-dark); }
.btn:active { transform: scale(.97); }
.btn-block { display: block; width: 100%; }
.btn-small { padding: .4rem 1rem; font-size: .9rem; }
.btn-quiet { background: transparent; color: var(--brand); box-shadow: inset 0 0 0 2px var(--brand); }
.btn-gold { background: var(--gold); color: #5b4800; }
.btn-quiet:hover { background: var(--brand-light); }

label { display: block; font-weight: 800; font-size: .92rem; margin: .9rem 0 .25rem; }
input[type=text], input[type=password], input[type=email], input[type=date],
input[type=number], input[type=tel], input[type=search], input[type=url], select, textarea {
  width: 100%; font-family: inherit; font-size: 1.05rem;
  padding: .7rem .9rem; border: 2px solid var(--line); border-radius: 10px;
  background: #fff; color: var(--ink);
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent);
}
.hint { font-size: .85rem; color: var(--ink-soft); margin-top: .25rem; }

.code-input { text-transform: uppercase; letter-spacing: .15em; font-weight: 800; text-align: center; font-size: 1.3rem; }

/* ---------- flash messages ---------- */
.flash {
  max-width: 720px; margin: .75rem auto 0; padding: .7rem 1rem;
  border-radius: 10px; font-weight: 700; width: calc(100% - 2rem);
}
.flash-success { background: var(--success-bg); color: var(--success); }
.flash-error { background: var(--danger-bg); color: var(--danger); }

/* ---------- student home ---------- */
.trail-hero {
  display: block; text-decoration: none; color: inherit;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
  color: #fff; padding: 1.25rem 1.4rem;
}
.trail-hero:hover { transform: translateY(-2px); transition: transform .1s; }
.th-top { display: flex; justify-content: space-between; align-items: center; gap: .75rem; }
.th-title { font-size: 1.25rem; font-weight: 900; }
.trail-hero .xp-chip { background: rgba(255,255,255,.18); }
.th-bar {
  height: 14px; border-radius: 999px; background: rgba(255,255,255,.22);
  margin: .9rem 0 .5rem; overflow: hidden;
}
.th-bar span { display: block; height: 100%; border-radius: 999px; background: var(--gold); }
.th-meta { font-size: .95rem; opacity: .95; }
.th-next {
  margin-top: .7rem; background: rgba(255,255,255,.14); border-radius: 10px;
  padding: .55rem .8rem; font-size: .95rem;
}

.tile-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: .8rem; margin: 1rem 0;
}
@media (min-width: 560px) { .tile-grid { grid-template-columns: repeat(4, 1fr); } }
.tile {
  aspect-ratio: 1; text-decoration: none; color: inherit;
  background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: .15rem; border: 2px solid transparent;
  transition: transform .08s, border-color .12s;
}
.tile:hover { border-color: var(--accent); transform: translateY(-2px); }
.tile:active { transform: scale(.97); }
.tile-ico { font-size: 2.2rem; }
.tile-label { font-weight: 900; font-size: 1.02rem; }
.tile-sub { font-size: .8rem; font-weight: 700; color: var(--ink-soft); }
/* admin dashboard panels: smaller squares, grows as panels are added */
.tile-grid-admin { grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr)); }
@media (min-width: 560px) { .tile-grid-admin { grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr)); } }

/* ---------- year planner (admin dashboard) ---------- */
.cal-head { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.cal-nav { margin-left: auto; display: flex; align-items: center; gap: .5rem; }
.cal-year-label { font-size: 1.15rem; }
.cal-key {
  display: inline-block; padding: .05rem .55rem; border-radius: 999px;
  font-size: .75rem; font-weight: 800; margin-left: .35rem;
}
.cal-year {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr));
  gap: 1rem .9rem; margin-top: .25rem;
}
.cal-month h3 { margin: 0 0 .25rem; font-size: .95rem; color: var(--brand); }
.cal-month table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.cal-month th {
  font-size: .68rem; font-weight: 800; color: var(--ink-soft);
  text-transform: uppercase; padding: 0 0 .2rem; text-align: center;
}
.cal-month td {
  text-align: center; font-size: .8rem; font-weight: 600; color: var(--ink);
  padding: .22rem 0; border-radius: 7px;
}
.cal-month td.cal-wkend { color: var(--ink-soft); background: var(--bg); }
.cal-month td.cal-today { box-shadow: inset 0 0 0 2px var(--accent); }
.cal-month td.cal-ev { color: #fff; font-weight: 900; padding: 0; }
.cal-month td.cal-ev .cal-daylink {
  display: block; padding: .22rem 0; color: inherit; text-decoration: none; border-radius: 7px;
}
.cal-month td.cal-ev .cal-daylink:hover { box-shadow: inset 0 0 0 2px rgba(255,255,255,.7); }
/* day cells — scoped to beat .cal-month td.cal-wkend on weekend event days */
.cal-month td.cal-ev.lvl-multi { background: var(--brand); color: #fff; }
.cal-month td.cal-ev.lvl-bronze { background: #b06a28; color: #fff; }
.cal-month td.cal-ev.lvl-silver { background: #64748b; color: #fff; }
.cal-month td.cal-ev.lvl-gold { background: var(--gold); color: #5b4800; }
/* legend chips */
.cal-key.lvl-multi { background: var(--brand); color: #fff; }
.cal-key.lvl-bronze { background: #b06a28; color: #fff; }
.cal-key.lvl-silver { background: #64748b; color: #fff; }
.cal-key.lvl-gold { background: var(--gold); color: #5b4800; }

/* ---------- the trail ---------- */
.trail-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.xp-chip {
  background: var(--brand-dark); color: var(--gold);
  border-radius: 999px; padding: .35rem .9rem; font-weight: 900; white-space: nowrap;
}
.trail { list-style: none; margin: 0; padding: 0; position: relative; }
.trail::before {
  content: ''; position: absolute; left: 27px; top: 20px; bottom: 20px;
  width: 4px; border-radius: 2px;
  background: repeating-linear-gradient(to bottom, var(--accent) 0 10px, transparent 10px 18px);
  opacity: .45;
}
.trail-item {
  display: flex; gap: .9rem; align-items: center; position: relative;
  background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: .9rem 1rem; margin-bottom: .8rem; text-decoration: none; color: inherit;
  transition: transform .08s;
}
a.trail-item:hover { transform: translateX(3px); }
.trail-icon {
  flex: 0 0 56px; height: 56px; border-radius: 50%;
  background: var(--brand-light); display: grid; place-items: center;
  font-size: 1.6rem; position: relative; z-index: 1;
}
.trail-item.done .trail-icon { background: var(--success-bg); }
.trail-item.locked { opacity: .55; }
.trail-body { flex: 1; min-width: 0; }
.trail-title { font-weight: 900; font-size: 1.05rem; }
.trail-sub { font-size: .85rem; color: var(--ink-soft); }
.trail-progress { font-size: .8rem; font-weight: 800; color: var(--brand); white-space: nowrap; }

.ring {
  --pct: 0;
  width: 44px; height: 44px; border-radius: 50%;
  background: conic-gradient(var(--accent) calc(var(--pct) * 1%), var(--line) 0);
  display: grid; place-items: center; font-size: .7rem; font-weight: 900;
}
.ring::after { content: attr(data-label); background: var(--paper); width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; }

/* ---------- step page ---------- */
.crumb { font-size: .85rem; font-weight: 800; color: var(--ink-soft); text-decoration: none; display: inline-block; margin-bottom: .25rem; }
.step-meta { color: var(--ink-soft); font-size: .85rem; font-weight: 700; margin-bottom: 1rem; }
.block { margin: 1rem 0; }
.block-callout {
  border-radius: var(--radius); padding: 1rem 1.1rem; font-size: .98rem;
}
.block-callout.info { background: var(--brand-light); }
.block-callout.tip { background: var(--warn-bg); }
.block-callout .callout-title { font-weight: 900; margin-bottom: .25rem; }
.block-checklist { list-style: none; padding: 0; }
.block-checklist li {
  padding: .55rem .75rem .55rem 2.3rem; position: relative;
  background: var(--paper); border-radius: 10px; margin-bottom: .4rem; box-shadow: var(--shadow);
}
.block-checklist li::before {
  content: '✓'; position: absolute; left: .75rem; color: var(--accent); font-weight: 900;
}

/* ---------- quiz ---------- */
.question { background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.1rem; margin-bottom: 1rem; }
.q-text { font-weight: 800; margin-bottom: .6rem; }
.answer {
  display: flex; align-items: center; gap: .6rem;
  border: 2px solid var(--line); border-radius: 10px;
  padding: .65rem .8rem; margin-bottom: .5rem; cursor: pointer;
  font-weight: 700; transition: border-color .1s, background .1s;
}
.answer:hover { border-color: var(--accent); }
.answer input { accent-color: var(--brand); width: 1.2rem; height: 1.2rem; }
.answer.is-right { border-color: var(--success); background: var(--success-bg); }
.answer.is-wrong { border-color: var(--danger); background: var(--danger-bg); }
.q-explain { border-radius: 10px; padding: .6rem .8rem; font-size: .92rem; margin-top: .5rem; }
.q-explain.good { background: var(--success-bg); }
.q-explain.bad { background: var(--warn-bg); }
.quiz-score { text-align: center; padding: 1.25rem; }
.quiz-score .big { font-size: 2.2rem; font-weight: 900; }

/* ---------- tables (dashboards) ---------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
table.data th, table.data td { text-align: left; padding: .6rem .8rem; font-size: .92rem; vertical-align: middle; }
table.data th { background: var(--brand); color: #fff; font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; }
table.data tr:nth-child(even) td { background: var(--bg); }
.bar { background: var(--line); border-radius: 6px; height: 10px; min-width: 80px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--accent); border-radius: 6px; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: .8rem; margin-bottom: 1.25rem; }
.stat { background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1rem; }
.stat .n { font-size: 1.8rem; font-weight: 900; color: var(--brand); }
.stat .l { font-size: .8rem; font-weight: 800; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .04em; }

.summary-chips { display: flex; gap: .5rem; flex-wrap: wrap; margin: .5rem 0 .85rem; }
.chip {
  background: var(--brand-light); color: var(--brand-dark);
  border-radius: 999px; padding: .25rem .8rem; font-weight: 800; font-size: .85rem;
}
.check-row { display: flex; align-items: center; gap: .5rem; font-weight: 700; }
.check-row input { width: 1.15rem; height: 1.15rem; accent-color: var(--brand); }

.join-code {
  font-family: ui-monospace, monospace; font-weight: 700; letter-spacing: .08em;
  background: var(--brand-light); color: var(--brand-dark);
  border-radius: 8px; padding: .15rem .5rem; white-space: nowrap;
}
.pill { border-radius: 999px; padding: .1rem .6rem; font-size: .78rem; font-weight: 800; }
.pill-bronze { background: #f3d5b5; color: #7f4f24; }
.pill-silver { background: #e2e8f0; color: #475569; }
.pill-gold { background: #ffe8a3; color: #8a6d00; }

/* ---------- hero (landing) ---------- */
.hero { text-align: center; padding: 2.5rem 0 1rem; }
.hero h1 { font-size: 2.1rem; }
.hero .lead { max-width: 34rem; margin: 0 auto 1.5rem; }
.hero-actions { display: flex; gap: .75rem; justify-content: center; flex-wrap: wrap; }

/* ---------- time picker ---------- */
.tp-pop {
  position: absolute; z-index: 200; width: 320px;
  background: var(--paper); border-radius: 14px; box-shadow: 0 8px 30px rgba(0,52,78,.25);
  padding: .75rem; border: 2px solid var(--line);
}
.tp-pop hr { border: 0; border-top: 2px solid var(--accent-light); margin: .6rem 0; }
.tp-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: .3rem; }
.tp-mins { grid-template-columns: repeat(6, 1fr); }
.tp-grid button {
  font-family: inherit; font-weight: 800; font-size: .9rem; cursor: pointer;
  background: var(--brand-light); color: var(--brand-dark);
  border: 2px solid transparent; border-radius: 8px; padding: .35rem 0;
}
.tp-grid button:hover { border-color: var(--accent); }
.tp-grid button.on { background: var(--brand); color: #fff; }
.tp-clear {
  margin-top: .6rem; width: 100%; font-family: inherit; font-weight: 700;
  font-size: .85rem; cursor: pointer; background: none; border: 0; color: var(--ink-soft);
}
.tp-clear:hover { color: var(--danger); }
input.time-pick { max-width: 7rem; text-align: center; font-weight: 800; cursor: pointer; }

.flash-card { outline: 3px solid var(--accent); transition: outline .3s; border-radius: var(--radius); }

/* ---------- collapsed package events ---------- */
.hidden { display: none !important; }
.event-card { padding: .7rem 1.1rem; }
.event-line { display: flex; align-items: center; gap: .9rem; }
.event-line.editing { opacity: .45; }
.event-when { flex: 0 0 9.5rem; white-space: nowrap; }
.event-what { flex: 1; min-width: 0; }
.event-what .hint { display: block; }
.event-edit { border-top: 2px solid var(--line); margin-top: .7rem; padding-top: .25rem; }
@media (max-width: 560px) {
  .event-line { flex-wrap: wrap; gap: .25rem .9rem; }
  .event-when { flex-basis: 100%; }
}

/* event types (Library) — same shape as event cards */
.et-card { padding: .7rem 1.1rem; }
.et-line { display: flex; align-items: center; gap: .9rem; }
.et-body { flex: 1; min-width: 0; }
.et-body .hint { display: block; }
.et-edit { border-top: 2px solid var(--line); margin-top: .7rem; padding-top: .25rem; }
.pill-quiet { background: var(--bg); color: var(--ink-soft); }
/* event-type picker in the package builder */
.ev-type-select { font-weight: 700; }
/* a whole card that's a link (team cards → team detail, sighting → maps) */
.card-link { text-decoration: none; color: inherit; display: block; border: 2px solid transparent; transition: border-color .12s, transform .08s; }
.card-link:hover { border-color: var(--accent); transform: translateY(-2px); }
.sighting-list { display: flex; flex-direction: column; gap: .6rem; }
.sighting-row { display: flex; gap: 1rem; align-items: flex-start; }
.sg-when { flex: 0 0 2.8rem; display: flex; flex-direction: column; align-items: center; text-align: center; line-height: 1.15; }
.sg-body { flex: 1; min-width: 0; }

/* Out-of-size team (not 4–7) — flagged reddish-pink wherever a team shows */
.team-oob { background: #ffdcea; color: #c01556; }
.team-oob-text { color: #c01556; font-weight: 800; }
.team-card-oob { box-shadow: inset 0 0 0 2px #e3326e, var(--shadow); }
.team-card-oob .team-name, .team-card-oob > strong:first-child { color: #c01556; }

/* Users areas: header with an Add button, group headings, customer tiles */
.area-head { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.area-head h1 { flex: 1 1 auto; }
.area-head .btn { flex-shrink: 0; }
.group-head { display: flex; align-items: center; gap: .5rem; font-size: 1.05rem; margin: 1.25rem 0 .4rem; color: var(--brand-dark); }
.cust-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: .8rem; }
.cust-tile {
  display: flex; flex-direction: column; gap: .3rem; text-decoration: none; color: inherit;
  background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 1rem 1.1rem; border: 2px solid transparent; transition: transform .08s, border-color .12s;
}
.cust-tile:hover { border-color: var(--accent); transform: translateY(-2px); }
.cust-tile strong { font-size: 1.05rem; }
/* instructor home: cohort tiles with the next date */
.cohort-tile .ct-pills { display: flex; gap: .35rem; flex-wrap: wrap; }
.ct-next {
  display: flex; flex-direction: column; gap: .1rem;
  background: var(--brand-light); border-radius: 10px; padding: .5rem .65rem; margin: .15rem 0;
}
.ct-next-date { font-weight: 900; color: var(--brand-dark); }
.ct-next-title { font-size: .9rem; color: var(--ink); }
.ct-next-none { background: transparent; padding: 0; }
.content-tile { border-color: var(--accent); }
.content-tile .ct-head strong { color: var(--brand); }
/* clickable "N students" summary link */
.summary-students {
  border: 0; background: transparent; cursor: pointer; font: inherit;
  font-weight: 800; color: var(--brand); padding: .2rem .1rem;
}
.summary-students:hover { text-decoration: underline; }
/* assessor row in the team builder */
.team-assessor { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin-top: .75rem; }
.team-assessor .team-action { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin: 0; }

/* Users page — board of clickable squares + detail panel below */
.tile-board { display: grid; grid-template-columns: repeat(auto-fill, minmax(13.5rem, 1fr)); gap: .8rem; margin: .25rem 0 1rem; }
.tile-cell { position: relative; }
.user-tile {
  width: 100%; min-height: 5.5rem; text-align: left; cursor: pointer; font: inherit;
  display: flex; flex-direction: column; gap: .25rem;
  background: var(--paper); border: 2px solid transparent; border-radius: var(--radius);
  box-shadow: var(--shadow); padding: .85rem 1rem; transition: border-color .12s, transform .08s;
}
.user-tile:hover:not([disabled]) { border-color: var(--accent); transform: translateY(-2px); }
.user-tile.active { border-color: var(--brand); }
.user-tile[disabled] { cursor: default; opacity: .8; }
.user-tile .ut-name { font-weight: 900; font-size: 1.02rem; }
.ut-pills { display: flex; gap: .3rem; flex-wrap: wrap; }
.user-tile .ut-pills { min-height: 1.2rem; }
.user-tile .ut-foot { margin-top: auto; }
.tile-go { position: absolute; top: .5rem; right: .5rem; }
.detail-wrap:empty { display: none; }
.detail-panel { margin-bottom: 1rem; }
.detail-head { display: flex; align-items: center; gap: .75rem; margin-bottom: .5rem; }
.detail-head h3 { flex: 1; }

/* Users page — clean list rows with an expanding edit panel */
.user-list { padding: 0; overflow: hidden; }
.user-list .user-item + .user-item,
.user-list-plain .user-item + .user-item { border-top: 1px solid var(--line); }
.user-row { display: flex; align-items: center; gap: .5rem 1rem; flex-wrap: wrap; padding: .7rem 1.1rem; }
.user-list-plain .user-row { padding: .6rem 0; }
.user-id { flex: 1 1 15rem; min-width: 0; }
.user-name { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.user-when { flex: 0 0 auto; min-width: 4.5rem; }
.user-row .block-controls { margin-left: auto; display: flex; gap: .25rem; flex-shrink: 0; }
.user-edit {
  background: var(--brand-light); border-radius: 12px; margin: 0 .6rem .6rem;
  padding: .9rem 1.1rem;
}
.user-list-plain .user-edit { margin: 0 0 .6rem; }
.edit-line { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin-top: .75rem; }
.edit-line-block { flex-direction: column; align-items: flex-start; }
.edit-line-label { font-weight: 800; font-size: .9rem; }
.edit-actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin-top: .75rem; }
.btn-danger { background: var(--danger); color: #fff; }
.staff-link-mini { display: inline-flex; align-items: center; gap: .3rem; }
.staff-link-mini input { width: 6rem; padding: .3rem .5rem; font-size: .9rem; }

/* segmented toggle (add-person: Mendip team / Teacher) */
.seg-toggle { display: flex; gap: .3rem; background: var(--bg); border-radius: 12px; padding: .25rem; margin-bottom: 1rem; }
.seg-toggle button, .seg-toggle a.seg {
  flex: 1; border: 0; background: transparent; cursor: pointer; text-align: center;
  text-decoration: none; font: inherit; font-weight: 800; font-size: .9rem; color: var(--ink-soft);
  padding: .5rem .4rem; border-radius: 9px; transition: background .12s, color .12s;
}
.seg-toggle button.active, .seg-toggle a.seg.active { background: var(--paper); color: var(--brand-dark); box-shadow: var(--shadow); }
.staff-lookup { background: var(--bg); border-radius: 12px; padding: .75rem .9rem; margin-bottom: 1rem; }
.lookup-row { display: flex; gap: .4rem; align-items: stretch; }
.lookup-row input { flex: 1; min-width: 0; }
.lookup-row .btn { white-space: nowrap; }

/* instructor assignment table (cohort Manage) */
.instr-assign th:nth-child(2), .instr-assign th:nth-child(3),
.instr-assign td:nth-child(2), .instr-assign td:nth-child(3) { text-align: center; width: 6rem; }
.instr-assign input[type=checkbox], .instr-assign input[type=radio] { width: 1.15rem; height: 1.15rem; accent-color: var(--brand); }

/* ---------- teacher "Your expedition" ---------- */
.cohort-pills { display: flex; gap: .5rem; flex-wrap: wrap; margin: 0 0 1rem; }
.cohort-pill {
  font-family: inherit; font-weight: 800; font-size: .95rem; cursor: pointer;
  background: var(--paper); color: var(--ink-soft);
  border: 2px solid var(--line); border-radius: 999px; padding: .45rem 1rem;
  display: inline-flex; align-items: center; gap: .45rem;
}
.cohort-pill.active { border-color: var(--brand); color: var(--ink); box-shadow: var(--shadow); }
.exp-summary-head { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; font-size: 1.1rem; margin-bottom: .35rem; }
.exp-tabs {
  display: flex; gap: .4rem; margin: 0 0 1rem; overflow-x: auto;
  -webkit-overflow-scrolling: touch; padding-bottom: .25rem;
  scrollbar-width: none;
}
.exp-tabs::-webkit-scrollbar { display: none; }
.exp-tabs .tab { flex-shrink: 0; border: 2px solid var(--line); background: var(--paper); cursor: pointer; font-family: inherit; }
.exp-tabs .tab.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.tab-n {
  display: inline-block; min-width: 1.4em; text-align: center;
  background: rgba(0,0,0,.08); border-radius: 999px; padding: 0 .35em;
  font-size: .8em; margin-left: .15rem;
}
.tab.active .tab-n { background: rgba(255,255,255,.25); }
.exp-empty { text-align: center; padding: 2rem 1.25rem; }
.exp-empty p { margin: .25rem 0; }

/* section panels: tap a stat card to open that section */
.sec-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: .7rem; margin: 0 0 1.25rem;
}
.sec-panel {
  font-family: inherit; cursor: pointer;
  background: var(--paper); border: 2px solid var(--line); border-radius: var(--radius);
  padding: .8rem .4rem .65rem;
  display: flex; flex-direction: column; align-items: center; gap: .1rem;
  transition: transform .08s, border-color .12s;
  box-shadow: var(--shadow);
}
.sec-panel:hover { border-color: var(--accent); transform: translateY(-2px); }
.sec-panel:active { transform: scale(.97); }
.sec-panel.active { background: var(--brand); border-color: var(--brand); }
.sp-ico { font-size: 1.45rem; line-height: 1.2; }
.sp-n { font-size: 1.35rem; font-weight: 900; color: var(--brand); line-height: 1.1; }
.sp-n small { font-size: .8rem; font-weight: 800; color: var(--ink-soft); }
.sec-panel.active .sp-n, .sec-panel.active .sp-n small { color: #fff; }
.sp-l { font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-soft); }
.sec-panel.active .sp-l { color: rgba(255,255,255,.85); }

/* event timeline cards */
.ev-item { display: flex; gap: 1rem; align-items: flex-start; padding: .9rem 1.1rem; }
.ev-date {
  flex: 0 0 64px; text-align: center; background: var(--brand-light);
  border-radius: 12px; padding: .45rem .25rem; line-height: 1.15;
}
.ev-date .ev-dow { display: block; font-size: .72rem; font-weight: 800; text-transform: uppercase; color: var(--brand); }
.ev-date .ev-day { display: block; font-size: 1.5rem; font-weight: 900; color: var(--brand-dark); }
.ev-date .ev-mon { display: block; font-size: .75rem; font-weight: 800; color: var(--brand); }
.ev-body { flex: 1; min-width: 0; }
.ev-notes {
  margin-top: .4rem; background: var(--warn-bg); border-radius: 8px;
  padding: .35rem .6rem; font-size: .9rem;
}

/* student reflection call-to-action on the home page */
.reflect-cta {
  display: flex; align-items: center; gap: 1rem; text-decoration: none; color: var(--ink);
  border: 2px solid var(--gold); background: linear-gradient(135deg, #fff8e1, #fff);
}
.reflect-cta:hover { transform: translateY(-2px); }
.reflect-cta .rc-ico { font-size: 2rem; flex: 0 0 auto; }
.reflect-cta .rc-body { display: flex; flex-direction: column; gap: .15rem; }
.reflect-cta .rc-body strong { font-size: 1.1rem; color: var(--brand-dark); }
.reflect-cta .rc-body span { font-size: .9rem; color: var(--ink-soft); }
.reflect-cta .rc-go { margin-left: auto; font-size: 1.6rem; font-weight: 900; color: var(--brand); }

/* attendance register roster — big tap rows */
.reg-roster { display: flex; flex-direction: column; gap: .35rem; }
.reg-row {
  display: flex; align-items: center; gap: .7rem; flex-wrap: wrap;
  padding: .6rem .75rem; border: 1px solid var(--line); border-radius: 10px;
  background: #fff; cursor: pointer; transition: background .12s, border-color .12s;
}
.reg-row:hover { border-color: var(--accent); }
.reg-row input[type="checkbox"] { width: 1.35rem; height: 1.35rem; flex: 0 0 auto; accent-color: var(--brand); }
.reg-row .reg-name { font-weight: 700; display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.reg-row.reg-flagged { background: var(--warn-bg); border-color: #f3b8cf; }
.reg-flag-form { border-top: 1px dashed var(--line); padding-top: .9rem; }

/* checkpoint map — numbered round pins */
.sight-pin span {
  display: flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--brand); color: #fff; font-weight: 800; font-size: .8rem;
  border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.4);
}
.sight-pin.d2 span { background: #e8590c; }   /* day 2 of a route */

/* route planner */
.plan-pin span {
  display: flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--brand); color: #fff; font-weight: 800; font-size: .78rem;
  border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.4);
}
.plan-pin.mand span { background: #c01556; }
.planner-split { display: grid; grid-template-columns: 1fr; gap: 1rem; }
@media (min-width: 60rem) { .planner-split { grid-template-columns: 1.1fr 1fr; align-items: start; } }
.planner-totals { padding: .55rem .8rem; margin: 0 0 .6rem; font-size: .92rem; }
.leg-card { border: 1px solid var(--line); border-radius: 10px; padding: .4rem .6rem; margin-bottom: .4rem; background: #fff; }
.leg-card.mand { border-color: #f3b8cf; }
.leg-card.open { border-color: var(--accent); box-shadow: var(--shadow); }
.leg-head { display: flex; align-items: center; gap: .4rem; }
.leg-toggle {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: .5rem;
  background: none; border: 0; cursor: pointer; font: inherit; color: inherit; text-align: left; padding: .15rem 0;
}
.leg-grip { flex: 0 0 auto; cursor: grab; color: var(--ink-soft); font-size: 1.15rem; line-height: 1; padding: .1rem .2rem; touch-action: none; user-select: none; }
.leg-grip:active { cursor: grabbing; }
.leg-card.dragging { opacity: .65; border-color: var(--accent); box-shadow: var(--shadow); }
.leg-title { flex: 1 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.leg-title .leg-tname { font-weight: 600; color: var(--ink-soft); }
.leg-title .leg-unnamed { font-weight: 400; color: var(--warn); }
.leg-ctrls { flex: 0 0 auto; display: flex; gap: .15rem; }
.leg-body { display: none; margin-top: .4rem; }
.leg-card.open .leg-body { display: block; }
.leg-namefield { display: flex; flex-direction: column; gap: .15rem; font-size: .78rem; font-weight: 700; color: var(--ink-soft); }
.leg-namefield input { margin: 0 0 .2rem; }
.leg-metrics { display: flex; flex-wrap: wrap; gap: .15rem .5rem; font-size: .8rem; font-weight: 700; color: var(--brand-dark); margin-left: auto; }
.leg-metrics-body { display: none; margin: 0 0 .4rem; }   /* shown only on mobile when a leg is open */
.planner-map { height: 60vh; min-height: 340px; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); }
.plan-choose-tile { min-height: 5.5rem; gap: .5rem; }
@media (max-width: 48rem) {
  .leg-metrics-head { display: none; }                    /* clean collapsed rows on phones */
  .leg-card.open .leg-metrics-body { display: flex; }
  .leg-grip { font-size: 1.45rem; padding: .3rem .45rem; }
  .leg-head .leg-ctrls .btn-icon { width: 2.1rem; height: 2.1rem; font-size: 1rem; }
  .planner-map { height: 50vh; min-height: 300px; }
  .rc-prefix { display: none; }                           /* mobile: just "Practice"/"Qualifying" */
  .btn-label { display: none; }                           /* mobile: print button shrinks to its icon */
}
.leg-inputs { display: grid; grid-template-columns: 1fr 1fr; gap: .4rem .6rem; margin-top: .3rem; }
.leg-inputs label { font-size: .78rem; font-weight: 700; color: var(--ink-soft); display: flex; flex-direction: column; gap: .15rem; }
.leg-inputs label.wide { grid-column: 1 / -1; }
.leg-inputs input { margin: 0; }
.rc-actionbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.route-card-sheet { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 1rem 1.1rem; margin-bottom: 1.25rem; }
.rc-head-grid { display: flex; flex-wrap: wrap; gap: .25rem 1.1rem; margin: .35rem 0; font-size: .9rem; }
.rc-aim, .rc-team { font-size: .9rem; margin-top: .15rem; }
.rc-table th, .rc-table td { font-size: .8rem; padding: .3rem .4rem; vertical-align: top; }
.rc-start td { background: var(--brand-light); }
.rc-totals td { background: var(--bg); }
.rc-foot { margin-top: .6rem; font-size: .85rem; color: var(--ink-soft); }
@media print {
  body { background: #fff; }
  .sidenav, .topbar, .topnav, .imp-bar, .nav-overlay, .no-print, .crumb { display: none !important; }
  body.has-sidenav { margin: 0 !important; }
  main, .main, .content { margin: 0 !important; padding: 0 !important; max-width: none !important; }
  .route-card-sheet { border: 0; padding: 0; margin: 0 0 1rem; page-break-inside: avoid; }
  .rc-table th, .rc-table td { font-size: .72rem; }
}
.map-list { margin: 0; padding-left: 1.4rem; display: grid; gap: .5rem; }
.map-list li { line-height: 1.35; }
/* Leaflet sits under the sticky sidenav/overlay; keep it below modals */
.leaflet-pane, .leaflet-top, .leaflet-bottom { z-index: 400; }

/* users page */
.teacher-row {
  display: flex; align-items: flex-start; gap: 1rem; flex-wrap: wrap;
  padding: .6rem 0; border-bottom: 2px solid var(--bg);
}
.teacher-id { flex: 1 1 14rem; min-width: 0; }
.teacher-cohorts { display: flex; gap: .25rem .9rem; flex-wrap: wrap; align-items: center; flex: 1 1 12rem; }
.teacher-cohorts .check-row { margin: 0; }
.cohort-group {
  margin-top: .75rem; background: var(--bg); border-radius: 12px; padding: .6rem .8rem;
}
.cohort-group summary {
  cursor: pointer; display: flex; align-items: center; gap: .6rem; flex-wrap: wrap;
  list-style: none; font-size: 1rem;
}
.cohort-group summary::-webkit-details-marker { display: none; }

/* teams */
.vis-toggle {
  display: flex; align-items: center; gap: .75rem; flex-wrap: wrap;
  background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: .6rem 1.1rem; margin-bottom: 1rem; font-size: .95rem;
}
.vis-toggle .btn { margin-left: auto; }

/* shareable link + copy button (student join links, colleague invites) */
.copy-row { display: flex; gap: .4rem; align-items: center; margin-top: .4rem; }
.copy-row input {
  flex: 1; min-width: 0; font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: .82rem; padding: .4rem .55rem; color: var(--ink-soft); background: var(--bg);
}
.copy-row .btn { white-space: nowrap; flex-shrink: 0; }
.invite-row {
  display: flex; align-items: center; gap: .5rem .75rem; flex-wrap: wrap;
  padding: .55rem 0; border-top: 1px solid var(--line);
}
.invite-row .copy-row { margin-top: 0; }
.pick-list { display: flex; flex-direction: column; gap: .35rem; margin: .5rem 0; }
.pick-row {
  display: flex; align-items: center; gap: .6rem;
  background: var(--bg); border-radius: 10px; padding: .55rem .8rem;
  font-size: .98rem; cursor: pointer;
}
.pick-row input[type=checkbox] { width: 1.2rem; height: 1.2rem; accent-color: var(--brand); }
.team-actions { display: flex; gap: 1.25rem; flex-wrap: wrap; margin-top: .9rem; align-items: center; }
.team-action { display: flex; gap: .5rem; align-items: center; }
.team-card summary {
  cursor: pointer; display: flex; align-items: center; gap: .75rem; flex-wrap: wrap;
  font-size: 1.05rem; list-style: none;
}
.team-card summary::-webkit-details-marker { display: none; }
.team-card .team-name { font-weight: 900; }
.team-card .team-body { border-top: 2px solid var(--line); margin-top: .75rem; padding-top: .75rem; display: flex; flex-direction: column; gap: .35rem; }

/* resources list */
.res-item {
  display: flex; align-items: center; gap: .8rem;
  padding: .7rem .5rem; text-decoration: none; color: inherit;
  border-bottom: 2px solid var(--bg);
}
.res-item:last-child { border-bottom: 0; }
.res-item:hover { background: var(--brand-light); border-radius: 10px; }
.res-ico { font-size: 1.4rem; }
.res-body { flex: 1; min-width: 0; }
.res-body .hint { display: block; }
.res-dl { font-size: 1.1rem; color: var(--brand); font-weight: 900; }

/* ---------- library tabs ---------- */
.tabs { display: flex; gap: .4rem; margin: 0 0 1.25rem; flex-wrap: wrap; }
.tab {
  text-decoration: none; font-weight: 800; font-size: .95rem; color: var(--ink-soft);
  background: var(--paper); border: 2px solid var(--line);
  border-radius: 999px; padding: .45rem 1.1rem;
}
.tab:hover { border-color: var(--accent); color: var(--ink); }
.tab.active { background: var(--brand); border-color: var(--brand); color: #fff; }

details.route-fold { margin: .5rem 0; }
details.route-fold summary {
  cursor: pointer; font-weight: 800; padding: .5rem .75rem;
  background: var(--brand-light); border-radius: 10px;
}
details.route-fold[open] summary { border-radius: 10px 10px 0 0; }

/* ---------- content studio ---------- */
.pill-live { background: var(--success-bg); color: var(--success); }
.pill-draft { background: var(--line); color: var(--ink-soft); }
.inline { display: inline-flex; gap: .3rem; }
.nowrap { white-space: nowrap; }
.btn-icon {
  display: inline-grid; place-items: center;
  width: 34px; height: 34px;
  border: 2px solid var(--line); background: var(--paper); border-radius: 8px;
  font-weight: 900; cursor: pointer; font-size: .9rem;
  font-family: inherit; color: var(--ink); line-height: 1;
}
.btn-icon:hover { border-color: var(--accent); }
.btn-icon.danger { color: var(--danger); }
.btn-icon.danger:hover { border-color: var(--danger); }

.block-editor { padding: 1rem 1.25rem; }
.block-editor-head {
  display: flex; justify-content: space-between; align-items: center; gap: .5rem;
  margin: 0 0 .25rem;
}
.block-editor-head strong { font-size: .95rem; text-transform: uppercase; letter-spacing: .04em; color: var(--brand); }
.block-controls { display: flex; gap: .3rem; align-items: center; flex-shrink: 0; }
.block-controls form { display: inline-flex; gap: .3rem; margin: 0; }

.field-row {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0 .8rem; align-items: end;
}
.mono { font-family: ui-monospace, Consolas, monospace; font-size: .88rem; }

/* ---------- studio layout: editor + live preview ---------- */
.page-wide { max-width: 1280px; }

/* ---------- admin split layout: add-panel left, results right ----------
   Grid areas mean DOM order doesn't matter: on phones the results come
   first and the add-panel tucks below; on desktop the add-panel docks
   left and sticks while the results scroll. */
.split {
  display: grid; gap: 1.25rem; align-items: start;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "main" "aside";
}
.split-aside { grid-area: aside; min-width: 0; }
.split-main { grid-area: main; min-width: 0; }
.split-aside .card { margin-bottom: 1rem; }
@media (min-width: 1020px) {
  .split {
    grid-template-columns: 360px minmax(0, 1fr);
    grid-template-areas: "aside main";
  }
  .split-aside { position: sticky; top: 72px; }
}
.page-actions {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap; margin: .5rem 0 1rem;
}
.studio-cols { display: grid; gap: 1.25rem; align-items: start; }
@media (min-width: 1080px) {
  .studio-cols { grid-template-columns: minmax(0, 1fr) 400px; }
  .studio-preview { position: sticky; top: 72px; }
}
.pv-head { display: flex; justify-content: space-between; align-items: center; font-weight: 900; margin-bottom: .4rem; }
.pv-status { font-size: .75rem; font-weight: 800; color: var(--success); text-transform: uppercase; letter-spacing: .05em; }
.pv-status.busy { color: var(--ink-soft); }
.pv-frame {
  background: var(--brand-deep); border-radius: 26px; padding: 10px;
  box-shadow: var(--shadow);
}
.pv-screen {
  background: var(--bg); border-radius: 18px; padding: 1rem;
  max-height: calc(100dvh - 190px); min-height: 320px; overflow-y: auto;
}
.pv-title { font-size: 1.25rem; margin: 0 0 .15rem; }
.pv-correct { font-size: .72rem; color: var(--success); font-weight: 900; margin-left: .4rem; text-transform: uppercase; }
.staff-banner {
  background: var(--warn-bg); color: var(--warn); font-weight: 800;
  border-radius: 10px; padding: .5rem .8rem; margin: .5rem 0 1rem; font-size: .9rem;
}
.staff-banner a { color: inherit; }
.form-actions { display: flex; gap: .5rem; align-items: center; margin-top: 1.1rem; }
.form-actions .btn-block { flex: 1; }
.form-actions .wys-toggle { margin: 0; height: 34px; width: auto; padding: 0 .6rem; font-size: .8rem; }
.add-row { display: flex; gap: .5rem; align-items: center; }
.add-row select { flex: 1; }
.add-row .btn { flex-shrink: 0; }

/* ---------- studio WYSIWYG ---------- */
.wys-wrap { background: #fff; border-radius: 10px; border: 2px solid var(--line); }
.wys-wrap .ql-toolbar { border: 0; border-bottom: 2px solid var(--line); border-radius: 10px 10px 0 0; }
.wys-wrap .ql-container { border: 0; font-family: inherit; font-size: 1rem; min-height: 10rem; }
.wys-editor { border-radius: 0 0 10px 10px; }
.wys-toggle { margin-top: .4rem; width: auto; padding: 0 .6rem; font-size: .8rem; }

/* ---------- match & sort questions ---------- */
.match-row {
  display: flex; align-items: center; gap: .8rem; margin-bottom: .6rem;
  background: #fff; border: 2px solid var(--line); border-radius: 10px; padding: .5rem .7rem;
}
.match-row select { flex: 1; max-width: 14rem; }
.match-item { flex: 1; }
.match-item img { max-height: 64px; width: auto; border-radius: 6px; }

/* ---------- interactive widgets ---------- */
.widget {
  background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 1.25rem; margin: 1.25rem 0;
}
.wg-head { font-weight: 900; font-size: 1.15rem; margin-bottom: .25rem; }
.wg-sub { color: var(--ink-soft); font-size: .92rem; margin: .25rem 0 .75rem; }
.wg-count { float: right; color: var(--ink-soft); font-size: .9rem; }
.widget label { margin-top: .8rem; }
.widget input[type=range] { width: 100%; accent-color: var(--accent); }
.wg-row { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .35rem; }
.wg-row button, .wg-zones button, .wg-choices button, .wg-restart {
  font-family: inherit; font-weight: 800; font-size: .95rem;
  border: 2px solid var(--line); background: #fff; color: var(--ink);
  border-radius: 10px; padding: .6rem .9rem; cursor: pointer;
}
.wg-row button.on { border-color: var(--accent); background: var(--accent-light); }
.wg-result {
  margin-top: 1rem; background: var(--brand-light); border-radius: 10px;
  padding: .9rem 1rem; font-weight: 700;
}
.wg-result strong { font-size: 1.3rem; color: var(--brand-dark); }
.wg-result.big { text-align: center; font-size: 1.1rem; }
.wg-item {
  text-align: center; font-size: 2rem; background: var(--bg);
  border-radius: 10px; padding: 1rem; margin: .75rem 0;
}
.wg-item strong { font-size: 1.1rem; }
.wg-zones { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.wg-zones button.good { border-color: var(--success); background: var(--success-bg); }
.wg-zones button.bad { border-color: var(--danger); background: var(--danger-bg); }
.wg-feedback { margin-top: .6rem; min-height: 2.2rem; }
.wg-good { background: var(--success-bg); border-radius: 10px; padding: .5rem .8rem; }
.wg-bad { background: var(--danger-bg); border-radius: 10px; padding: .5rem .8rem; }
.wg-story { font-size: 1.02rem; margin: .5rem 0 1rem; }
.wg-choices { display: flex; flex-direction: column; gap: .5rem; }
.wg-choices button:hover, .wg-zones button:hover { border-color: var(--accent); }
.wg-end { margin-bottom: .5rem; }
.wg-restart { background: var(--brand); color: #fff; border: 0; margin-top: .5rem; }

@media (min-width: 700px) {
  h1 { font-size: 2rem; }
  .hero h1 { font-size: 2.6rem; }
}

/* inline link-styled button (e.g. "view as parent" on the admin student row) */
.linkish { background: none; border: 0; padding: 0; font: inherit; color: var(--brand);
  cursor: pointer; text-decoration: underline; }
.linkish:hover { color: var(--brand-dark, #004669); }

/* action tiles inside the cohort sec-grid (Register / Reports) — same layout as
   the count tiles, with a → marker where the count would be */
.sec-panel.sec-go { text-decoration: none; }
.sp-go { color: var(--accent, #00a8e0); }

/* student roster as mobile-friendly panels (cohort views: teacher/admin/instructor) */
.student-list { display: flex; flex-direction: column; gap: .5rem; }
.student-panel { padding: .7rem .9rem; }
.student-panel .sp-row { display: flex; gap: .75rem; align-items: flex-start; flex-wrap: wrap; }
.student-panel .sp-main { flex: 1 1 14rem; min-width: 0; }
.student-panel .sp-name { text-decoration: none; }
.student-panel .sp-meta { margin: .15rem 0 0; }
.student-panel .sp-pills { display: flex; flex-wrap: wrap; gap: .3rem; margin: .3rem 0 0; }
.student-panel .sp-prog { margin-top: .45rem; max-width: 22rem; }
.student-panel .sp-side { display: flex; align-items: center; gap: .5rem; margin-left: auto; flex-wrap: wrap; justify-content: flex-end; }
.student-panel .sp-actions { display: flex; gap: .3rem; }
.student-panel .sp-edit { margin-top: .6rem; }
@media (max-width: 40rem) {
  .student-panel .sp-side { margin-left: 0; width: 100%; justify-content: space-between; }
}

/* route-planner header: compact toolbar + slim status notes */
.rc-toolbar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin: .25rem 0 .25rem; }
.rc-toolbar .rc-submit { margin: 0 0 0 auto; }
.rc-note { padding: .5rem .85rem; border-radius: 10px; margin: 0 0 1rem;
  font-size: .95rem; border: 1px solid var(--line); background: var(--paper); }
.rc-note-warn { border-color: var(--warn, #c47d00); background: #fff8ec; }
.rc-note-info { border-color: var(--brand); background: var(--brand-light); }
.rc-note-ok   { border-color: #1a7f37; background: #eaf6ee; }
.rc-settings { padding: .6rem .9rem; }
.rc-settings > summary { margin: 0; }
@media (max-width: 40rem) { .rc-toolbar .rc-submit { margin-left: 0; width: 100%; } .rc-toolbar .rc-submit .btn { width: 100%; } }

/* assessor-report rosters as mobile-friendly panels */
.report-list { display: flex; flex-direction: column; gap: .5rem; }
.report-panel { padding: .6rem .9rem; display: flex; gap: .5rem .9rem; align-items: center; flex-wrap: wrap; }
.report-panel .rp-main { flex: 1 1 12rem; min-width: 0; display: flex; align-items: center; gap: .55rem; margin: 0; }
.report-panel .rp-name { display: flex; flex-direction: column; min-width: 0; }
.report-panel .rp-tags { display: flex; flex-wrap: wrap; gap: .3rem .7rem; align-items: center; font-size: .92rem; }
.report-panel .rp-act { margin-left: auto; }
@media (max-width: 40rem) {
  .report-panel .rp-main { flex-basis: 100%; }
  .report-panel .rp-act { margin-left: 0; }
}

/* content-studio module lists as mobile-friendly panels */
.content-list { display: flex; flex-direction: column; gap: .5rem; }
.content-panel { padding: .6rem .9rem; display: flex; gap: .5rem .9rem; align-items: center; flex-wrap: wrap; }
.content-panel .cp-main { flex: 1 1 14rem; min-width: 0; display: flex; align-items: center; gap: .6rem; }
.content-panel .cp-ico { font-size: 1.4rem; flex: 0 0 auto; line-height: 1; }
.content-panel .cp-name { display: flex; flex-direction: column; min-width: 0; }
.content-panel .cp-meta { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.content-panel .cp-levels .teacher-cohorts { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin: 0; }
.content-panel .cp-act { display: flex; align-items: center; gap: .3rem; margin-left: auto; }

/* drag-to-reorder (content studio: modules / steps / blocks / questions) */
.cp-grip {
  cursor: grab; touch-action: none; user-select: none;
  color: var(--ink-soft); font-size: 1.1rem; line-height: 1; padding: 0 .2rem; flex: 0 0 auto;
}
.cp-grip:active { cursor: grabbing; }
.block-editor-head .be-title { display: flex; align-items: center; gap: .4rem; }
[data-reorder] [data-id].reordering { opacity: .55; outline: 2px dashed var(--accent); }
[data-reorder].reorder-saved { transition: background .2s; }
[data-reorder].reorder-saved [data-id] { animation: reorder-flash .9s ease; }
@keyframes reorder-flash { 0% { background: var(--brand-light); } 100% { background: transparent; } }
@media (max-width: 40rem) {
  .content-panel .cp-main { flex-basis: 100%; }
  .content-panel .cp-act { margin-left: 0; }
}

/* page header with an action on the right (e.g. Edit cohort) */
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; }

/* demo-door banner (owner sees live guest count; guests see they're in a demo) */
.demo-bar {
  background: var(--accent); color: #04303f;
  display: flex; align-items: center; justify-content: center; gap: 1rem;
  flex-wrap: wrap; padding: .45rem 1rem; font-size: .9rem; font-weight: 800;
  position: sticky; top: 0; z-index: 61;
}
.demo-bar form { margin: 0; }
.demo-bar button {
  font-family: inherit; font-weight: 800; font-size: .82rem; cursor: pointer;
  background: var(--brand-deep); color: #fff; border: 0; border-radius: 999px; padding: .3rem .9rem;
}

/* ============================================================
   Knowledge base / guides
   ============================================================ */
.kb-grouphead { margin: 1.4rem 0 .6rem; font-size: 1.05rem; color: var(--ink-soft); }
.kb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr)); gap: .8rem; }
.kb-tile {
  display: flex; gap: .7rem; align-items: flex-start; text-decoration: none; color: inherit;
  background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: .9rem 1rem; border: 2px solid transparent; transition: transform .08s, border-color .12s;
}
.kb-tile:hover { border-color: var(--accent); transform: translateY(-2px); }
.kb-tile-ico { font-size: 1.6rem; line-height: 1.1; }
.kb-tile-body { display: flex; flex-direction: column; gap: .15rem; min-width: 0; }
.kb-tile-body strong { font-size: 1.02rem; }
.kb-tile-sum { font-size: .88rem; color: var(--ink-soft); }

/* article body: readable measure, phone screenshots in a soft frame */
.kb-article { max-width: 42rem; }
.kb-article p, .kb-article ul, .kb-article ol { line-height: 1.6; }
.kb-article h2 { margin: 1.4rem 0 .5rem; }
.kb-article .lead { font-size: 1.08rem; }
.kb-fig {
  margin: 1rem 0; display: flex; flex-direction: column; align-items: center; gap: .4rem;
}
.kb-shot {
  width: 100%; max-width: 16rem; height: auto; display: block;
  border-radius: 1.4rem; box-shadow: var(--shadow); border: 1px solid var(--line, #e3e8ee); background: #fff;
}
.kb-fig figcaption { font-size: .85rem; color: var(--ink-soft); text-align: center; }
.kb-note {
  background: var(--brand-light); border-left: 4px solid var(--accent);
  border-radius: 8px; padding: .7rem .9rem; margin: 1rem 0; font-size: .95rem;
}
/* let captioned shots sit two-up on wider screens */
@media (min-width: 34rem) {
  .kb-article .kb-fig + .kb-fig { margin-top: -.2rem; }
}
.kb-nextlink {
  display: flex; flex-direction: column; gap: .1rem; text-decoration: none; color: inherit;
  background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: .8rem 1rem; margin-top: 1.4rem; max-width: 42rem; border: 2px solid transparent;
}
.kb-nextlink:hover { border-color: var(--accent); }
.kb-nextlink strong { color: var(--brand); }

/* admin CMS for guides */
.kb-tools { display: flex; flex-wrap: wrap; gap: .4rem; margin: .3rem 0 .5rem; }
.kb-body { width: 100%; font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: .9rem; line-height: 1.5; }
.kb-upload { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: .6rem; }
#kb-preview { border: 1px dashed var(--line, #dde1e7); border-radius: var(--radius); padding: .8rem 1rem; min-height: 3rem; }
.kb-shots { display: grid; grid-template-columns: repeat(auto-fill, minmax(7rem, 1fr)); gap: .6rem; margin-top: .6rem; }
.kb-shot-pick {
  display: flex; flex-direction: column; gap: .25rem; align-items: center; cursor: pointer;
  background: var(--paper); border: 2px solid var(--line, #e3e8ee); border-radius: 10px; padding: .4rem; font: inherit;
}
.kb-shot-pick:hover { border-color: var(--accent); }
.kb-shot-pick img { width: 100%; height: 5.5rem; object-fit: contain; border-radius: 6px; background: #fff; }
.kb-shot-pick span { font-size: .72rem; color: var(--ink-soft); word-break: break-all; text-align: center; }

/* danger zone — owner-only permanent deletion */
.danger-card { border: 2px solid var(--danger); }
.danger-card h2 { color: var(--danger); }
.del-list { margin: .4rem 0 .8rem; padding-left: 1.2rem; }
.del-list li { margin: .25rem 0; }
.danger-zone {
  margin-top: 1.4rem; border: 1px dashed var(--danger); border-radius: var(--radius);
  padding: .8rem 1rem; background: var(--danger-bg);
}
.danger-zone h3 { margin: 0 0 .3rem; color: var(--danger); font-size: 1rem; }
.danger-zone .hint { color: #7a2730; }
