/* ── Design tokens ──────────────────────────────────── */
:root {
  --navy:        #0d2d52;
  --navy-shade:  #091e38;
  --navy-rim:    #1a3d66;
  --navy-muted:  #8faec8;
  --blue:        #1d4ed8;
  --blue-hover:  #1e40af;
  --blue-light:  #dbeafe;
  --blue-faint:  #eff6ff;
  --body-bg:     #f1f5f9;
  --surface:     #ffffff;
  --border:      #e2e8f0;
  --border-mid:  #cbd5e1;
  --text:        #0f172a;
  --text-mid:    #334155;
  --muted:       #64748b;
  --warn:        #b45309;
  --warn-bg:     #fef3c7;
  --danger:      #b91c1c;
  --danger-bg:   #fee2e2;
  --good:        #047857;
  --good-bg:     #d1fae5;
  --radius:      0.375rem;
  --radius-lg:   0.5rem;
  --shadow:      0 1px 3px rgba(0,0,0,.07), 0 1px 2px rgba(0,0,0,.04);
}

/* ── Reset + base ───────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
  background: var(--body-bg);
  min-height: 100vh;
}
h1 { font-size: 1.4rem; font-weight: 700; margin: 0 0 1rem; letter-spacing: -0.02em; color: var(--text); }
h2 { font-size: 1rem; font-weight: 600; margin: 0 0 0.75rem; color: var(--text); }
p  { margin: 0 0 0.75rem; }
a  { color: var(--blue); }
.muted { color: var(--muted); font-size: 0.875rem; }

/* ── App shell ──────────────────────────────────────── */
body.app-shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  align-items: stretch;
}
body.plain { display: block; }

/* ── Sidebar ────────────────────────────────────────── */
.sidebar {
  background: var(--navy);
  color: #e8eef5;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 1.25rem 0.75rem 1rem;
  border-right: 1px solid var(--navy);
}
.sidebar .brand {
  color: #ffffff;
  text-decoration: none;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
  padding: 0 0.5rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  margin-bottom: 0.75rem;
  display: block;
}
.sidenav {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  flex: 1;
}
.sidenav .nav-item {
  display: block;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  color: #b8cfe3;
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: background 0.12s, color 0.12s;
}
.sidenav .nav-item:hover { background: rgba(255, 255, 255, 0.08); color: #ffffff; }
.sidenav .nav-item.active {
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
}
.sidefoot {
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  padding-top: 0.875rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.8rem;
}
.sidefoot .who { font-weight: 600; color: #ffffff; word-break: break-word; font-size: 0.875rem; }
.sidefoot .role {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--navy-muted);
}
.sidefoot .signout { margin: 0.5rem 0 0; }
.sidefoot .signout button {
  width: 100%;
  font: inherit;
  font-size: 0.8rem;
  background: transparent;
  color: #b8cfe3;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius);
  padding: 0.4rem 0.75rem;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.sidefoot .signout button:hover { background: rgba(255, 255, 255, 0.08); color: #ffffff; }

/* ── Content area ───────────────────────────────────── */
.content {
  padding: 2rem 2.25rem;
  min-width: 0;
}
body.app-shell .content { max-width: 1280px; }
body.plain .content { max-width: 1280px; margin: 0 auto; }

/* ── Mobile topbar + drawer chrome (hidden on desktop) ── */
.topbar { display: none; }
.nav-backdrop { display: none; }

/* ── Responsive ─────────────────────────────────────── */
@media (max-width: 800px) {
  body.app-shell {
    display: block;
    grid-template-columns: none;
  }
  .topbar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    position: sticky;
    top: 0;
    z-index: 30;
    background: var(--navy);
    color: #ffffff;
    padding: 0.55rem 0.9rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  }
  .topbar .brand {
    color: #ffffff;
    text-decoration: none;
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: -0.02em;
  }
  .nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius);
    width: 36px;
    height: 36px;
    padding: 0;
    cursor: pointer;
  }
  .nav-toggle:hover { background: rgba(255, 255, 255, 0.08); }
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 260px;
    max-width: 80vw;
    height: 100vh;
    z-index: 50;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    box-shadow: 0 0 24px rgba(0, 0, 0, 0.25);
  }
  body.nav-open .sidebar { transform: translateX(0); }
  .nav-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    z-index: 40;
  }
  .nav-backdrop[hidden] { display: none; }
  .content { padding: 1.25rem 1rem; }
}

/* Desktop-only: no topbar, no toggle visible */
@media (min-width: 801px) {
  .nav-toggle { display: none; }
}

/* ── Card ───────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}
.card.login {
  max-width: 380px;
  margin: 4rem auto;
}
.login-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}
.login-logo {
  width: 72px;
  height: auto;
  display: block;
}
.login-system {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  text-align: center;
  letter-spacing: -0.01em;
}
/* Password field with a show/hide eye button overlaid on the right. */
.pw-field { position: relative; display: flex; }
.pw-field input {
  width: 100%;
  padding-right: 2.6rem;
}
.pw-toggle {
  position: absolute;
  top: 0;
  right: 0;
  height: 100%;
  width: 2.6rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.pw-toggle:hover { color: var(--text-mid); }
.pw-toggle:focus-visible {
  outline: none;
  color: var(--blue);
}
.pw-toggle svg { width: 1.15rem; height: 1.15rem; }
.pw-toggle .eye-off { display: none; }
.pw-toggle[aria-pressed="true"] .eye { display: none; }
.pw-toggle[aria-pressed="true"] .eye-off { display: block; }

/* ── Filter bar (inline form on list pages) ─────────── */
.filter-bar {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 1rem;
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
}
.filter-bar label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin: 0;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.filter-bar select,
.filter-bar input {
  margin: 0;
}
.filter-bar button[type="submit"] {
  margin: 0;
  padding: 0.5rem 1rem;
  align-self: flex-end;
}

/* ── Forms ──────────────────────────────────────────── */
form { display: flex; flex-direction: column; gap: 0.5rem; }
label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-mid);
  margin-top: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
input[type="email"],
input[type="password"],
input[type="text"],
input[type="number"],
textarea {
  font: inherit;
  font-size: 0.9rem;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border-mid);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.12s, box-shadow 0.12s;
}
input:focus, textarea:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(29,78,216,.12);
}
select {
  font: inherit;
  font-size: 0.9rem;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border-mid);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.12s;
}
select:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(29,78,216,.12);
}
button[type="submit"] {
  margin-top: 1rem;
  padding: 0.6rem 1.25rem;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  background: var(--blue);
  color: #fff;
  border: 0;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.12s;
  letter-spacing: 0.01em;
}
button[type="submit"]:hover { background: var(--blue-hover); }

/* ── Form helpers ───────────────────────────────────── */
.label-text {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-mid);
  margin-top: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.label-hint {
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  color: var(--muted);
}
.field-hint {
  font-size: 0.8rem;
  color: var(--muted);
  margin: 0.35rem 0 0;
}
.field-hint.micro {
  font-size: 0.72rem;
  margin-top: 0.2rem;
}
.field-warn {
  font-size: 0.8rem;
  color: var(--warn);
  font-weight: 600;
  margin: 0.3rem 0 0;
}

/* Two-column expected-count form: trainee, trainer, save button */
.input-grid {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 0.6rem;
  align-items: end;
}
.input-grid > div { display: flex; flex-direction: column; }
.input-grid input[type="number"] {
  width: 100%;
}
.sub-label {
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 0.25rem;
}

/* ── Chip multi-select ──────────────────────────────── */
.chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--blue-faint);
}
.chip {
  position: relative;
  cursor: pointer;
  user-select: none;
}
.chip > input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  margin: 0;
  cursor: pointer;
}
.chip-body {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 0.85rem 0.45rem 0.65rem;
  border: 1px solid var(--border-mid);
  border-radius: 999px;
  background: var(--surface);
  font-size: 0.875rem;
  color: var(--text-mid);
  transition: border-color 0.12s, background 0.12s, color 0.12s, box-shadow 0.12s;
}
.chip:hover .chip-body {
  border-color: var(--blue);
  color: var(--text);
}
.chip > input:focus-visible + .chip-body {
  outline: none;
  box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.18);
  border-color: var(--blue);
}
.chip-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1rem;
  height: 1rem;
  border: 1.5px solid var(--border-mid);
  border-radius: 50%;
  background: var(--surface);
  transition: border-color 0.12s, background 0.12s;
}
.chip-mark::after {
  content: "";
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: transparent;
  transition: background 0.12s;
}
.chip > input:checked + .chip-body {
  background: var(--blue);
  border-color: var(--blue);
  color: #ffffff;
  font-weight: 600;
}
.chip > input:checked + .chip-body .chip-mark {
  border-color: #ffffff;
  background: transparent;
}
.chip > input:checked + .chip-body .chip-mark::after {
  background: #ffffff;
}

/* ── Stacked form: each question on its own block ───── */
/* Used on the weekly-report submit page so every question reads as a
   standalone item rather than running together vertically. Each
   .form-row gets a subtle separator above it (except the first inside
   a fieldset). */
.stacked-form fieldset {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem 1.1rem 1.1rem;
  margin: 0 0 1rem;
  background: var(--surface);
}
.stacked-form legend {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0 0.4rem;
}
.stacked-form .form-row {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.85rem 0;
  border-top: 1px solid var(--border);
}
.stacked-form .form-row:first-of-type { border-top: 0; padding-top: 0.25rem; }
.stacked-form .form-row > label,
.stacked-form .form-row > .label-text {
  margin-top: 0;
}

/* ── Yes/No radio pills ─────────────────────────────── */
.radio-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.radio-pill {
  position: relative;
  cursor: pointer;
  user-select: none;
}
.radio-pill > input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  margin: 0;
  cursor: pointer;
}
.radio-pill-body {
  display: inline-block;
  min-width: 4.5rem;
  text-align: center;
  padding: 0.5rem 1.1rem;
  border: 1px solid var(--border-mid);
  border-radius: 999px;
  background: var(--surface);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-mid);
  transition: border-color 0.12s, background 0.12s, color 0.12s, box-shadow 0.12s;
}
.radio-pill:hover .radio-pill-body {
  border-color: var(--blue);
  color: var(--text);
}
.radio-pill > input:focus-visible + .radio-pill-body {
  outline: none;
  box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.18);
  border-color: var(--blue);
}
.radio-pill > input:checked + .radio-pill-body {
  background: var(--blue);
  border-color: var(--blue);
  color: #ffffff;
}

/* ── Yes/No badge on detail view ────────────────────── */
.yesno {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  font-size: 0.8rem;
  font-weight: 700;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.yesno-yes {
  background: #dcfce7;
  color: #166534;
}
.yesno-no {
  background: var(--danger-bg);
  color: #7f1d1d;
}

/* ── Flash banner ───────────────────────────────────── */
.flash-success {
  background: #dcfce7;
  color: #166534;
  border: 1px solid #86efac;
  border-radius: var(--radius);
  padding: 0.55rem 0.9rem;
  font-size: 0.875rem;
  margin: 0 0 1rem;
}

/* ── Errors ─────────────────────────────────────────── */
.err {
  background: var(--danger-bg);
  color: #7f1d1d;
  border: 1px solid #fca5a5;
  border-radius: var(--radius);
  padding: 0.6rem 0.9rem;
  font-size: 0.875rem;
  margin: 0 0 1rem;
}
.field-err {
  color: var(--danger);
  font-size: 0.8rem;
  margin: 0.2rem 0 0;
}
.req { color: var(--danger); }
.opt {
  color: var(--muted);
  font-weight: normal;
  font-size: 0.8rem;
}
.hint {
  color: var(--muted);
  font-size: 0.8rem;
  margin: 0.2rem 0 0;
}
.row-errors { margin-bottom: 1rem; }
.row-errors h2 { margin: 0 0 0.6rem; }
.row-errors h3 { margin: 0 0 0.3rem; }
.error-groups { list-style: none; margin: 0.5rem 0; padding: 0; }
.error-groups li { padding: 0.4rem 0; border-bottom: 1px solid var(--border); }
.error-groups li:last-child { border-bottom: 0; }
.error-groups summary { cursor: pointer; }
.error-groups summary code { background: var(--blue-faint); padding: 0 0.3rem; border-radius: 3px; }
.error-rows { margin: 0.3rem 0 0 1.2rem; color: var(--muted); font-size: 0.85rem; }
.error-download { margin-top: 0.6rem; display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }

/* ── Column-mapping page ────────────────────────────── */
.map-table th, .map-table td { vertical-align: middle; }
.map-table .sample { color: var(--text-mid); }
.map-table code { background: var(--blue-faint); padding: 0 0.3rem; border-radius: 3px; }
.map-form .hint { margin-top: 0.6rem; }

/* ── Page header ────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  gap: 1rem;
}
.page-header h1 { margin: 0; }
.actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* ── Breadcrumbs ────────────────────────────────────── */
.crumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
  font-size: 0.8rem;
  color: var(--muted);
  margin: 0 0 1rem;
}
.crumbs a { color: var(--blue); text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }
.crumbs .sep { color: var(--border-mid); user-select: none; }
.crumbs .here { color: var(--text-mid); font-weight: 600; }

/* ── Buttons ────────────────────────────────────────── */
.button {
  display: inline-block;
  padding: 0.45rem 1rem;
  border-radius: var(--radius);
  background: var(--blue);
  color: #fff;
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.12s;
  letter-spacing: 0.01em;
}
.button:hover { background: var(--blue-hover); }
.button.secondary {
  background: var(--surface);
  color: var(--blue);
  border-color: var(--blue);
}
.button.secondary:hover { background: var(--blue-faint); }

/* ── Data tables ────────────────────────────────────── */
table.data {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  font-size: 0.875rem;
  box-shadow: var(--shadow);
}
table.data th, table.data td {
  text-align: left;
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--border);
}
table.data th {
  background: #f8fafc;
  font-weight: 700;
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
table.data tbody tr:hover { background: var(--blue-faint); }
table.data tr:last-child td { border-bottom: 0; }
table.data a { color: var(--blue); text-decoration: none; font-weight: 500; }
table.data a:hover { text-decoration: underline; }

/* ── Clickable rows (reports list) ─────────────────── */
table.data tr.row-link { cursor: pointer; }
table.data tr.row-link:hover .row-view { color: var(--blue); }
table.data tr.row-link:hover .row-chevron { transform: translateX(2px); }
.row-view {
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
  color: var(--muted);
  font-weight: 600;
}
.row-chevron {
  font-size: 1.15em;
  line-height: 1;
  transition: transform 0.12s ease;
}
td.row-actions .row-edit { margin-right: 0.9rem; }

/* ── Row action menu (kebab) ───────────────────────── */
table.data td.row-actions { width: 1%; white-space: nowrap; text-align: right; }
table.data td.prewrap {
  white-space: pre-wrap;
  max-width: 22rem;
  line-height: 1.45;
  color: var(--text-mid);
}
table.data.reports-action td.prewrap { vertical-align: top; }
.users-list table.data { overflow: visible; }
.row-menu { position: relative; display: inline-block; }
.row-menu-toggle {
  appearance: none;
  width: 2rem;
  height: 2rem;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.row-menu-toggle:hover {
  background: var(--blue-faint);
  color: var(--blue);
  border-color: var(--border);
}
.row-menu-toggle:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}
.row-menu.is-open .row-menu-toggle {
  background: var(--blue-faint);
  color: var(--blue);
  border-color: var(--border);
}
.row-menu-panel {
  position: absolute;
  top: calc(100% + 0.25rem);
  right: 0;
  min-width: 11rem;
  padding: 0.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
  display: none;
  z-index: 30;
}
.row-menu.is-open .row-menu-panel { display: block; }
.row-menu-panel form { margin: 0; }
.row-menu-panel a,
.row-menu-panel button {
  display: block;
  width: 100%;
  padding: 0.45rem 0.7rem;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  text-align: left;
  color: var(--text);
  background: transparent;
  border: 0;
  border-radius: calc(var(--radius) - 1px);
  cursor: pointer;
  text-decoration: none;
}
.row-menu-panel a:hover,
.row-menu-panel button:hover {
  background: var(--blue-faint);
  color: var(--blue);
  text-decoration: none;
}
.row-menu-panel button.danger { color: var(--danger); }
.row-menu-panel button.danger:hover { background: var(--danger-bg); color: var(--danger); }

/* ── Misc ───────────────────────────────────────────── */
.empty { padding: 2rem 1rem; text-align: center; color: var(--muted); font-size: 0.9rem; }
code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: #f1f5f9;
  padding: 0.1rem 0.35rem;
  border-radius: 0.25rem;
  font-size: 0.85em;
  color: var(--text-mid);
}

/* ── Dashboard layout ───────────────────────────────── */
.dashboard .actions { flex-wrap: wrap; }
.dash-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}
.dash-header h1 { margin: 0 0 0.2rem; }
.dash-window { margin-bottom: 1.25rem; font-size: 0.8rem; color: var(--muted); }

.rollup { margin-top: 2rem; }
.rollup h2 { font-size: 1rem; margin: 0 0 0.5rem; }
.rollup > .muted { margin-bottom: 0.75rem; }

.dash-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}
@media (max-width: 800px) { .dash-cols { grid-template-columns: 1fr; } }

/* ── Rollup table ───────────────────────────────────── */
.rollup-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  font-size: 0.875rem;
  box-shadow: var(--shadow);
}
.rollup-table th, .rollup-table td {
  text-align: left;
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--border);
}
.rollup-table th {
  background: #f8fafc;
  font-weight: 700;
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.rollup-table tr:last-child td { border-bottom: 0; }

/* ── KPI strip ──────────────────────────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin: 0 0 1.5rem;
}
.kpi-tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem 0.75rem;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-height: 120px;
  border-top: 3px solid var(--blue);
}
.kpi-label {
  margin: 0;
  font-size: 0.7rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
}
.kpi-value {
  margin: 0.25rem 0 0;
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.kpi-sub {
  margin: 0;
  font-size: 0.775rem;
  color: var(--muted);
}
.kpi-tile .spark { margin-top: auto; padding-top: 0.5rem; }
.kpi-tile.warn   { border-top-color: var(--warn); }
.kpi-tile.warn   .kpi-value { color: var(--warn); }
.kpi-tile.danger { border-top-color: var(--danger); }
.kpi-tile.danger .kpi-value { color: var(--danger); }

/* ── Sparklines ─────────────────────────────────────── */
.spark {
  display: block;
  width: 100%;
  height: 30px;
  overflow: visible;
}
.spark .spark-line { fill: none; stroke: var(--blue); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.spark .spark-area { fill: rgba(29,78,216,.09); stroke: none; }
.spark.empty line  { stroke: var(--border-mid); stroke-width: 1; }
.kpi-tile.warn   .spark .spark-line { stroke: var(--warn); }
.kpi-tile.warn   .spark .spark-area { fill: rgba(180,83,9,.09); }
.kpi-tile.danger .spark .spark-line { stroke: var(--danger); }
.kpi-tile.danger .spark .spark-area { fill: rgba(185,28,28,.09); }

/* ── Attention panel ────────────────────────────────── */
.attention {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow);
}
.attention h2 { font-size: 0.9rem; margin: 0 0 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.attention-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.75rem; }
.attention-item {
  border-left: 3px solid var(--border-mid);
  padding: 0.35rem 0 0.35rem 0.875rem;
}
.attention-item.warn   { border-left-color: var(--warn); }
.attention-item.danger { border-left-color: var(--danger); }
.att-heading { margin: 0; font-weight: 600; font-size: 0.9rem; color: var(--text); }
.att-sub { margin: 0.1rem 0 0; font-size: 0.78rem; color: var(--muted); }
.att-names { margin: 0.25rem 0 0; font-size: 0.83rem; color: var(--text-mid); }

/* ── Trainees by district (national dashboard ranking) ─── */
.trainees-by-dist {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow);
}
.tbd-head h2 { font-size: 1rem; margin: 0 0 0.15rem; font-weight: 700; color: var(--text); }
.tbd-head .muted { margin: 0 0 0.9rem; font-size: 0.8rem; }
.tbd-table-wrap { overflow-x: auto; }
.tbd-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.tbd-table thead th {
  text-align: left;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  padding: 0.4rem 0.6rem;
  border-bottom: 1px solid var(--border);
}
.tbd-table th.num, .tbd-table td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.tbd-table tbody td {
  padding: 0.4rem 0.6rem;
  border-bottom: 1px solid var(--border);
}
.tbd-table tbody tr:last-child td { border-bottom: none; }
.tbd-rank { color: var(--muted); width: 2.5rem; }
.tbd-name a {
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
}
.tbd-name a:hover { color: var(--blue); text-decoration: underline; }
.tbd-share { width: 40%; min-width: 9rem; }
.tbd-bar {
  position: relative;
  height: 1.1rem;
  background: var(--bg, #f5f5f4);
  border-radius: 999px;
  overflow: hidden;
}
.tbd-bar-fill {
  position: absolute;
  inset: 0 auto 0 0;
  background: linear-gradient(90deg, #93c5fd, var(--blue));
  border-radius: 999px;
}
.tbd-bar-label {
  position: relative;
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.1rem;
  text-align: right;
  padding-right: 0.5rem;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

/* ── Service-provider insight (best & worst meal vendors) ─ */
.sp-insight {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow);
}
.sp-head h2 { font-size: 1rem; margin: 0 0 0.15rem; font-weight: 700; color: var(--text); }
.sp-head .muted { margin: 0 0 1rem; font-size: 0.8rem; }
.sp-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}
@media (max-width: 720px) { .sp-cols { grid-template-columns: 1fr; gap: 1rem; } }
.sp-col h3 {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin: 0 0 0.6rem;
}
.sp-best  h3 { color: #047857; }
.sp-worst h3 { color: #b45309; }
.sp-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.55rem; counter-reset: sp; }
.sp-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: baseline;
  gap: 0.6rem;
  padding: 0.4rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-alt, #fafaf9);
}
.sp-row::before {
  counter-increment: sp;
  content: counter(sp);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
  min-width: 1ch;
  text-align: right;
}
.sp-best  .sp-row { border-left: 3px solid #10b981; }
.sp-worst .sp-row { border-left: 3px solid var(--warn); }
.sp-name {
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  font-size: 0.9rem;
}
.sp-name:hover { color: var(--blue); text-decoration: underline; }
.sp-pct {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text);
  justify-self: end;
}
.sp-best  .sp-pct { color: #047857; }
.sp-worst .sp-pct { color: #b45309; }
.sp-meta {
  grid-column: 2 / 4;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  font-size: 0.75rem;
  color: var(--text-mid);
  font-variant-numeric: tabular-nums;
}
.sp-chip {
  background: var(--bg, #f5f5f4);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.05rem 0.5rem;
  font-weight: 600;
}
.sp-reports { color: var(--muted); }

/* ── Issue badges (used in district table flags column) ─── */
.issue-badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.issue-badge.warn   { background: var(--warn-bg); color: #92400e; }
.issue-badge.danger { background: var(--danger-bg); color: #991b1b; }

/* ── Dashboard filter strip ─────────────────────────── */
.dash-filter {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.75rem;
  margin: 0 0 1rem;
  padding: 0.65rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow-x: auto;
}
.dash-filter label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
  white-space: nowrap;
  flex-shrink: 0;
}
.dash-filter .ff-label {
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.dash-filter input[type="search"],
.dash-filter select {
  font: inherit;
  font-size: 0.875rem;
  padding: 0.38rem 0.6rem;
  border: 1px solid var(--border-mid);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
}
.dash-filter input[type="search"]:focus,
.dash-filter select:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(29,78,216,.1);
}
.dash-filter input[type="search"] { width: 180px; }
.dash-filter select { max-width: 160px; }
.dash-filter .ff-search select { max-width: 220px; }
.dash-filter .button {
  padding: 0.38rem 0.875rem;
  font-size: 0.83rem;
  flex-shrink: 0;
}
.filter-summary { margin: 0 0 0.75rem; color: var(--muted); font-size: 0.83rem; }

/* ── Reporting rate bar ─────────────────────────────── */
.reporting-bar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0.875rem 1.25rem 1rem;
  margin: 0 0 1.25rem;
  box-shadow: var(--shadow);
}
.rb-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}
.rb-label {
  font-size: 0.7rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
}
.rb-value { font-size: 1rem; font-weight: 700; color: var(--text); }
.rb-track {
  position: relative;
  height: 8px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
}
.rb-fill {
  height: 100%;
  background: var(--blue);
  border-radius: 999px;
  transition: width 0.3s ease;
}
.rb-fill.warn   { background: var(--warn); }
.rb-fill.danger { background: var(--danger); }

/* ── Focal chart ────────────────────────────────────── */
.focal-chart {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem 1rem;
  margin: 0 0 1.5rem;
  box-shadow: var(--shadow);
}
.focal-chart header { margin-bottom: 0.5rem; }
.focal-chart h2 { font-size: 1rem; margin: 0 0 0.15rem; font-weight: 700; color: var(--text); }
.focal-chart header .muted { margin: 0; font-size: 0.8rem; }
.focal-chart .fc-svg {
  display: block;
  width: 100%;
  height: 200px;
  overflow: visible;
}
.focal-chart .fc-grid    { stroke: var(--border); stroke-width: 1; vector-effect: non-scaling-stroke; }
.focal-chart .fc-axis-y  { font-size: 10px; fill: var(--muted); font-variant-numeric: tabular-nums; }
.focal-chart .fc-axis-x  { font-size: 10px; fill: var(--muted); }
.focal-chart .fc-line    { fill: none; stroke: var(--blue); stroke-width: 2; vector-effect: non-scaling-stroke; }
.focal-chart .fc-area    { fill: rgba(29,78,216,.10); stroke: none; }
.focal-chart .fc-dot     { fill: var(--blue); stroke: var(--surface); stroke-width: 1.5; }
.focal-chart.empty .empty { margin: 1rem 0 0.25rem; font-size: 0.9rem; }

/* ── District table ─────────────────────────────────── */
.districts { margin-top: 1.75rem; }
.districts-head { margin-bottom: 1rem; }
.districts-head h2 { font-size: 1rem; margin: 0 0 0.2rem; }
.districts-head .muted { font-size: 0.83rem; }
.district-table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.district-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
.district-table thead th {
  text-align: left;
  font-weight: 700;
  color: var(--muted);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: #f8fafc;
  padding: 0.6rem 0.875rem;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.district-table th.num, .district-table td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.district-table tbody td {
  padding: 0.55rem 0.875rem;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}
.district-table tbody tr:last-child td { border-bottom: none; }
.district-table tbody tr.risk    td { background: #fffbf5; }
.district-table tbody tr.silent  td { background: #fef2f2; }
.district-table .dt-name a {
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
}
.district-table .dt-name a:hover { color: var(--blue); text-decoration: underline; }
.district-table .dt-coverage { min-width: 140px; }
.district-table .dt-flags { white-space: nowrap; }
.district-table .dt-flags .issue-badge { margin-right: 0.25rem; }
.district-table .dt-last { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.district-table .status {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  line-height: 1.5;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  display: inline-block;
}
.district-table .status.ok     { background: var(--blue-light); color: var(--blue); }
.district-table .status.miss   { background: var(--warn-bg); color: #92400e; }
.district-table .status.danger { background: var(--danger-bg); color: #991b1b; }

/* Coverage micro-bar (also reused inside the table) */
.tile-coverage {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
}
.tc-track {
  flex: 1;
  height: 5px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
}
.tc-fill {
  height: 100%;
  background: var(--blue);
  border-radius: 999px;
}
.district-table tbody tr.risk   .tc-fill { background: var(--warn); }
.district-table tbody tr.silent .tc-fill { background: var(--danger); }
.tc-label {
  font-size: 0.72rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  min-width: 2.4rem;
  text-align: right;
}

/* ── Show-more toggle ───────────────────────────────── */
.show-more-toggle { position: absolute; left: -9999px; }
.dt-rows-tail { display: none; }
.show-more-toggle:checked ~ .district-table-wrap .dt-rows-tail { display: table-row-group; }
.show-more-label {
  display: inline-block;
  margin-top: 0.75rem;
  padding: 0.45rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--blue);
  color: var(--blue);
  background: var(--surface);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  transition: background 0.12s;
}
.show-more-label:hover { background: var(--blue-faint); }
.show-more-label .show-more-close { display: none; }
.show-more-toggle:checked ~ .show-more-label .show-more-open  { display: none; }
.show-more-toggle:checked ~ .show-more-label .show-more-close { display: inline; }

/* ── Pagination ─────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1.25rem;
  font-size: 0.875rem;
}
.page-link {
  padding: 0.38rem 0.875rem;
  border: 1px solid var(--border-mid);
  border-radius: var(--radius);
  color: var(--blue);
  text-decoration: none;
  background: var(--surface);
  font-weight: 500;
  transition: background 0.12s, border-color 0.12s;
}
.page-link:hover { background: var(--blue-faint); border-color: var(--blue); }
.page-link.disabled {
  color: var(--border-mid);
  border-color: var(--border);
  pointer-events: none;
  cursor: default;
  background: #f8fafc;
}
.page-info { color: var(--muted); }

/* ── Report detail ──────────────────────────────────── */
.report-detail { max-width: 760px; }
.detail-kpis {
  display: flex;
  gap: 2rem;
  margin: 1.25rem 0 1.75rem;
  padding: 1.25rem 1.5rem;
  background: var(--blue-faint);
  border: 1px solid var(--blue-light);
  border-radius: var(--radius-lg);
}
.detail-kpi dt { font-size: 0.72rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 0.25rem; }
.detail-kpi dd { font-size: 1.5rem; font-weight: 700; color: var(--text); margin: 0; letter-spacing: -0.02em; }
.detail-fields { display: flex; flex-direction: column; gap: 1rem; }
.detail-field {
  padding: 1.25rem 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.detail-field h2 {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin: 0 0 0.6rem;
}
.detail-field p { margin: 0; white-space: pre-wrap; line-height: 1.6; color: var(--text-mid); }

/* ── District tile as link ──────────────────────────── */
a.district-tile {
  text-decoration: none;
  cursor: pointer;
  transition: box-shadow 0.14s, border-color 0.14s, transform 0.1s;
}
a.district-tile:hover {
  border-color: var(--blue);
  box-shadow: 0 4px 10px rgba(29,78,216,.12);
  transform: translateY(-1px);
}
a.district-tile.risk:hover { border-color: #f97316; }

/* ── District profile page ──────────────────────────── */
.district-profile { max-width: 960px; }
.breadcrumb-back { margin: 0 0 0.25rem; font-size: 0.875rem; }
.breadcrumb-back a { color: var(--muted); text-decoration: none; }
.breadcrumb-back a:hover { color: var(--blue); }

.profile-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin-top: 1.5rem;
}
.profile-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow);
}
.profile-card h2 {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin: 0 0 0.875rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.profile-stats { grid-column: 1 / -1; }

.count-badge {
  background: var(--blue-faint);
  color: var(--blue);
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: 999px;
  padding: 0.05rem 0.55rem;
  letter-spacing: 0;
  text-transform: none;
}

.stat-strip {
  display: flex;
  gap: 2rem;
  flex-wrap: wrap;
}
.stat-item {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 8rem;
}
.stat-value {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text);
  line-height: 1.1;
}
.stat-label {
  font-size: 0.775rem;
  color: var(--muted);
}
.stat-item .spark { width: 8rem; margin-top: 0.25rem; }

.personnel-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.personnel-name { font-weight: 600; color: var(--text); }
.personnel-email { font-size: 0.875rem; }
.personnel-meta { font-size: 0.8rem; }

.profile-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
.profile-table th {
  text-align: left;
  font-weight: 700;
  color: var(--muted);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0 0.75rem 0.5rem 0;
  border-bottom: 1px solid var(--border);
}
.profile-table td {
  padding: 0.5rem 0.75rem 0.5rem 0;
  border-bottom: 1px solid #f8fafc;
  vertical-align: middle;
}
.profile-table tbody tr:last-child td { border-bottom: none; }

.badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.badge.ok   { background: var(--blue-light); color: var(--blue); }
.badge.warn { background: var(--warn-bg); color: #92400e; }
.badge.practicum { background: #ede9fe; color: #6d28d9; }

/* Class / Practicum report mode: show only the active mode's groups.
   Inactive-mode inputs are also disabled in JS so they don't post or
   trip HTML5 validation while hidden. */
[data-mode="class"] [data-mode-practicum],
[data-mode="practicum"] [data-mode-class] { display: none; }

.mode-toggle-card .mode-toggle { margin-top: 0.4rem; }

.profile-more { margin-top: 0.875rem; font-size: 0.875rem; }

/* ── Training-week submission grid ──────────────────── */
.week-grid {
  grid-column: 1 / -1;
}
.week-grid-summary {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0 0 0.75rem;
}
.week-grid-summary strong { color: var(--text); }
.week-cells {
  display: grid;
  grid-template-columns: repeat(9, minmax(0, 1fr));
  gap: 0.4rem;
}
.week-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1 / 1;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--muted);
  text-decoration: none;
  position: relative;
  transition: transform 0.05s ease;
}
.week-cell:hover { transform: translateY(-1px); }
.week-cell.submitted {
  background: var(--blue-light);
  border-color: var(--blue-faint);
  color: var(--blue);
}
.week-cell.current {
  border-color: var(--blue);
  border-width: 2px;
  color: var(--blue);
  background: var(--surface);
}
.week-cell.pending {
  background: var(--warn-bg);
  border-color: var(--warn-bg);
  color: #92400e;
}
.week-cell.future {
  background: transparent;
  color: #cbd5e1;
}
.week-legend {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 0.75rem;
}
.week-legend .swatch {
  display: inline-block;
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 0.2rem;
  margin-right: 0.35rem;
  vertical-align: middle;
  border: 1px solid var(--border);
}
.week-legend .swatch.submitted { background: var(--blue-light); border-color: var(--blue-faint); }
.week-legend .swatch.current   { border: 2px solid var(--blue); background: var(--surface); }
.week-legend .swatch.pending   { background: var(--warn-bg); border-color: var(--warn-bg); }
.week-legend .swatch.future    { background: transparent; }

@media (max-width: 720px) {
  .profile-grid { grid-template-columns: 1fr; }
  .profile-stats { grid-column: auto; }
  .week-cells { grid-template-columns: repeat(7, minmax(0, 1fr)); }
}

/* ── Page tabs ──────────────────────────────────────── */
.page-tabs {
  display: flex;
  gap: 0.25rem;
  border-bottom: 1px solid var(--border);
  margin: 0 0 1.25rem;
}
.page-tabs a {
  display: inline-block;
  padding: 0.55rem 0.9rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.page-tabs a:hover { color: var(--text); }
.page-tabs a.active {
  color: var(--blue);
  border-bottom-color: var(--blue);
}

/* ── Trainees insights card ─────────────────────────── */
.insights-age {
  max-width: 28rem;
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
}
.insights-age h2 {
  font-size: 0.72rem;
  margin: 0 0 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  font-weight: 700;
}
.insights-age table.data {
  box-shadow: none;
  font-size: 0.85rem;
}
.insights-age table.data th,
.insights-age table.data td {
  padding: 0.45rem 0.85rem;
}
table.data th.num,
table.data td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* ── Activity table extras ──────────────────────────── */
.cell-time { white-space: nowrap; }
.cell-time .when { display: block; font-size: 0.85rem; color: var(--text); }
.cell-time .ago  { display: block; font-size: 0.72rem; color: var(--muted); }
.cell-num { text-align: right; font-variant-numeric: tabular-nums; }
.dot-live {
  display: inline-block;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 999px;
  background: var(--blue);
  margin-right: 0.4rem;
  vertical-align: middle;
}

/* ── Trainees import review ─────────────────────────── */
.banner {
  padding: 0.75rem 1rem;
  border-radius: 6px;
  margin: 1rem 0;
  line-height: 1.4;
}
.banner.warn {
  background: var(--warn-bg);
  color: var(--warn);
  border: 1px solid var(--warn);
}
table.data tr.warn-row { background: var(--warn-bg); }
table.data tr.warn-row:hover { background: var(--warn-bg); }
.warn-text { color: var(--warn); }
.review-actions {
  margin-top: 1.25rem;
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

/* ─────────────────────────────────────────────────────
   Weekly-report form v2
   Two-column layout with stepped cards + progress rail.
   ───────────────────────────────────────────────────── */

.report-form-v2 .page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.report-form-v2 .page-sub { margin: 0.25rem 0 0; max-width: 36rem; }

.report-form-v2 .form-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 1.5rem;
  align-items: start;
}
@media (max-width: 900px) {
  .report-form-v2 .form-grid { grid-template-columns: minmax(0, 1fr); }
  .report-form-v2 .form-rail { order: -1; position: static !important; }
}

.report-form-v2 .form-main {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-width: 0;
}

/* ── Step cards ─────────────────────────────────────── */
.step-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: border-color 0.18s, box-shadow 0.18s;
  scroll-margin-top: 1rem;
}
.step-card:hover { border-color: var(--border-mid); }
.step-card.step-done { border-color: #86efac; }
.step-card.step-done .step-num {
  background: #16a34a;
  box-shadow: 0 0 0 4px #dcfce7;
}

.step-head {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #fafbfc 0%, #ffffff 100%);
}
.step-num {
  flex: 0 0 auto;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--navy);
  color: #ffffff;
  font-weight: 700;
  font-size: 0.9rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.18s, box-shadow 0.18s;
}
.step-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}
.step-sub {
  margin: 0.1rem 0 0;
  font-size: 0.82rem;
  color: var(--muted);
}
.step-body { padding: 1rem 1.25rem 1.25rem; }
.step-body .form-row { padding: 0.6rem 0; border-top: 1px solid var(--border); }
.step-body .form-row:first-child { border-top: 0; padding-top: 0; }

/* ── Number grid (3 inputs side-by-side on desktop) ─── */
.number-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.85rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.4rem;
}
.number-grid .form-row {
  padding: 0;
  border: 0;
}
@media (max-width: 640px) {
  .number-grid { grid-template-columns: 1fr; }
}

/* ── Inline week-check pill ─────────────────────────── */
.check-week {
  margin: 0.5rem 0 0;
  font-size: 0.82rem;
  padding: 0.4rem 0.65rem;
  border-radius: var(--radius);
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  animation: checkFadeIn 0.18s ease-out;
}
.check-week::before {
  content: "";
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.7;
}
.check-checking  { background: #f1f5f9; color: var(--muted); border-color: var(--border); }
.check-free      { background: #dcfce7; color: #166534; border-color: #86efac; }
.check-self      { background: var(--blue-faint); color: var(--blue-hover); border-color: var(--blue-light); }
.check-draft     { background: var(--warn-bg); color: var(--warn); border-color: #fcd34d; }
.check-submitted,
.check-invalid,
.check-error     { background: var(--danger-bg); color: #7f1d1d; border-color: #fca5a5; }

@keyframes checkFadeIn {
  from { opacity: 0; transform: translateY(-2px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Char counters under textareas ──────────────────── */
.char-counter {
  margin: 0.25rem 0 0;
  font-size: 0.72rem;
  color: var(--muted);
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.char-counter.over { color: var(--danger); font-weight: 600; }

/* ── Sticky action bar at form bottom ───────────────── */
.action-bar {
  position: sticky;
  bottom: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  transition: box-shadow 0.18s, border-color 0.18s;
  z-index: 5;
}
.action-bar.floating {
  box-shadow: 0 -4px 18px rgba(15, 23, 42, 0.08), 0 1px 2px rgba(0,0,0,.04);
  border-color: var(--border-mid);
}
.action-bar-status {
  font-size: 0.8rem;
  color: var(--muted);
  transition: color 0.18s;
}
.action-bar-status.saved { color: #16a34a; font-weight: 600; }
.action-bar-buttons {
  display: flex;
  gap: 0.5rem;
}
.action-bar button {
  margin: 0;
  padding: 0.55rem 1rem;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: var(--radius);
  cursor: pointer;
  border: 0;
  transition: background 0.12s, transform 0.06s;
}
.action-bar button:active { transform: translateY(1px); }
.action-bar .button.secondary {
  background: var(--surface);
  color: var(--text-mid);
  border: 1px solid var(--border-mid);
}
.action-bar .button.secondary:hover { background: var(--body-bg); }
.action-bar .primary {
  background: var(--blue);
  color: #ffffff;
}
.action-bar .primary:hover { background: var(--blue-hover); }
@media (max-width: 600px) {
  .action-bar { flex-direction: column; align-items: stretch; }
  .action-bar-buttons { justify-content: stretch; }
  .action-bar-buttons button { flex: 1; }
}

/* ── Progress rail (right column) ───────────────────── */
.form-rail {
  position: sticky;
  top: 1rem;
}
.rail-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 1.1rem 1.1rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.rail-progress-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.45rem;
}
.rail-progress-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.rail-progress-pct {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.rail-bar {
  height: 6px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
}
.rail-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--blue) 0%, #3b82f6 100%);
  border-radius: 999px;
  transition: width 0.28s cubic-bezier(.4,0,.2,1);
}
.rail-progress-sub {
  margin: 0.4rem 0 0;
  font-size: 0.75rem;
  color: var(--muted);
}

.rail-steps {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  border-top: 1px solid var(--border);
  padding-top: 0.85rem;
}
.rail-step {
  display: grid;
  grid-template-columns: 1.4rem 1fr auto;
  align-items: center;
  gap: 0.55rem;
  padding: 0.45rem 0.5rem;
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text-mid);
  font-size: 0.85rem;
  transition: background 0.12s, color 0.12s;
}
.rail-step:hover { background: var(--blue-faint); color: var(--text); }
.rail-step-num {
  width: 1.4rem;
  height: 1.4rem;
  border-radius: 50%;
  background: var(--border);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.18s, color 0.18s;
}
.rail-step-check {
  font-size: 0.85rem;
  color: #16a34a;
  font-weight: 700;
  opacity: 0;
  transform: scale(0.7);
  transition: opacity 0.18s, transform 0.18s;
}
.rail-step.done .rail-step-num {
  background: #16a34a;
  color: #ffffff;
}
.rail-step.done .rail-step-check { opacity: 1; transform: scale(1); }
.rail-step.done .rail-step-text { color: var(--text); font-weight: 600; }

.rail-tip {
  border-top: 1px solid var(--border);
  padding-top: 0.85rem;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.5;
}
.rail-tip strong { color: var(--text-mid); }

/* ─────────────────────────────────────────────────────
   Monthly assessment form v2
   Period bar + roster table + sticky summary rail.
   ───────────────────────────────────────────────────── */

.assess-v2 .page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.assess-v2 .page-sub { margin: 0.25rem 0 0; max-width: 40rem; }

/* ── Period picker bar ──────────────────────────────── */
.period-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 0.85rem 1.1rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}
.period-bar-main {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}
.period-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-right: 0.25rem;
}
.period-bar .period-select,
.period-bar .period-year {
  margin: 0;
  font-size: 0.9rem;
  padding: 0.45rem 0.7rem;
  border-radius: var(--radius);
  border: 1px solid var(--border-mid);
}
.period-bar .period-year { width: 5.5rem; }
.period-bar .period-go {
  margin: 0;
  padding: 0.5rem 1rem;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  background: var(--blue);
  color: #fff;
  border: 0;
  border-radius: var(--radius);
  cursor: pointer;
}
.period-bar .period-go:hover { background: var(--blue-hover); }
.period-quick {
  display: flex;
  gap: 0.4rem;
}
.quick-chip {
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-mid);
  background: var(--blue-faint);
  border: 1px solid var(--blue-light);
  border-radius: 999px;
  padding: 0.32rem 0.75rem;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.quick-chip:hover {
  background: var(--blue-light);
  border-color: var(--blue);
  color: var(--blue-hover);
}

/* ── Empty state ────────────────────────────────────── */
.empty-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  text-align: center;
  box-shadow: var(--shadow);
}
.empty-card .primary {
  display: inline-block;
  margin-top: 0.5rem;
  padding: 0.6rem 1.25rem;
  background: var(--blue);
  color: #fff;
  text-decoration: none;
  border-radius: var(--radius);
  font-weight: 600;
}

/* ── Grid layout ────────────────────────────────────── */
.assess-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 1.5rem;
  align-items: start;
}
@media (max-width: 960px) {
  .assess-grid { grid-template-columns: minmax(0, 1fr); }
  .assess-rail { order: -1; position: static !important; }
}
.assess-main {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

/* ── Toolbar (filters + search) ─────────────────────── */
.assess-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #fafbfc 0%, #ffffff 100%);
  flex-wrap: wrap;
}
.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}
.filter-chip {
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-mid);
  border-radius: 999px;
  padding: 0.35rem 0.85rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.filter-chip:hover { background: var(--blue-faint); border-color: var(--blue-light); }
.filter-chip.active {
  background: var(--navy);
  border-color: var(--navy);
  color: #ffffff;
}
.filter-chip .chip-count {
  font-size: 0.72rem;
  font-weight: 700;
  background: rgba(0,0,0,0.08);
  padding: 0.05rem 0.45rem;
  border-radius: 999px;
  min-width: 1.25rem;
  text-align: center;
}
.filter-chip.active .chip-count {
  background: rgba(255,255,255,0.18);
}
.search-wrap { flex: 0 0 auto; }
.trainee-search {
  margin: 0;
  font-size: 0.85rem;
  padding: 0.4rem 0.7rem;
  width: 14rem;
  max-width: 100%;
  border: 1px solid var(--border-mid);
  border-radius: var(--radius);
}

/* ── Roster table ───────────────────────────────────── */
.assess-roster {
  overflow-x: auto;
}
.assess-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
.assess-table thead th {
  text-align: left;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  background: #fafbfc;
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 1;
}
.assess-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 0.12s;
}
.assess-table tbody tr:last-child { border-bottom: 0; }
.assess-table tbody tr:hover { background: #fafbfc; }
.assess-table .col-name   { width: 32%; }
.assess-table .col-score  { width: 11rem; }
.assess-table .col-notes  { width: auto; }
.assess-table .col-status { width: 9rem; }
.assess-table td {
  padding: 0.65rem 1rem;
  vertical-align: middle;
}
.trainee-name {
  font-weight: 600;
  color: var(--text);
}

/* Score input + band swatch */
.score-input {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}
.score-input input[type="number"] {
  width: 5.5rem;
  margin: 0;
  text-align: center;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.score-input input.invalid {
  border-color: var(--danger);
  background: var(--danger-bg);
}
.score-band {
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 50%;
  background: var(--border);
  transition: background 0.18s, transform 0.18s;
}
.score-band.band-low  { background: #ef4444; transform: scale(1.15); }
.score-band.band-mid  { background: #f59e0b; transform: scale(1.15); }
.score-band.band-high { background: #16a34a; transform: scale(1.15); }

/* Notes input + counter */
.col-notes input[type="text"] {
  width: 100%;
  margin: 0;
}
.notes-counter {
  margin: 0.2rem 0 0;
  font-size: 0.7rem;
  color: var(--muted);
  text-align: right;
  font-variant-numeric: tabular-nums;
  min-height: 0.85rem;
}
.notes-counter.over { color: var(--danger); font-weight: 600; }

/* Row state tints */
.assess-table tr.row-changed { background: #fff7ed; }
.assess-table tr.row-changed:hover { background: #ffedd5; }

/* Status badges */
.badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
}
.badge-empty   { background: var(--border); color: var(--muted); }
.badge-saved   { background: #dcfce7; color: #166534; }
.badge-new     { background: var(--blue-light); color: var(--blue-hover); }
.badge-changed { background: #fed7aa; color: #9a3412; }
.badge-error   { background: var(--danger-bg); color: #7f1d1d; }

.empty-filter {
  padding: 1.5rem 1rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.875rem;
}

/* ── Mobile: cards instead of table ─────────────────── */
@media (max-width: 720px) {
  .assess-table thead { display: none; }
  .assess-table, .assess-table tbody, .assess-table tr, .assess-table td { display: block; width: 100%; }
  .assess-table tr {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border);
  }
  .assess-table td { padding: 0.3rem 0; }
  .assess-table td.col-name { font-size: 1rem; font-weight: 700; }
  .score-input input[type="number"] { width: 100%; }
}

/* ── Right rail: live stats ─────────────────────────── */
.assess-rail {
  position: sticky;
  top: 1rem;
}
.assess-rail .rail-card {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}
.stat-block + .stat-block { border-top: 1px solid var(--border); padding-top: 1rem; }
.stat-head {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.3rem;
}
.stat-row {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
}
.stat-big {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.stat-of { font-size: 0.85rem; color: var(--muted); }

.band-legend {
  display: flex;
  gap: 0.35rem;
  margin-top: 0.5rem;
}
.band-pill {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  color: #fff;
}
.band-pill.band-low  { background: #ef4444; }
.band-pill.band-mid  { background: #f59e0b; }
.band-pill.band-high { background: #16a34a; }

.dist-bars { display: flex; flex-direction: column; gap: 0.4rem; margin-top: 0.4rem; }
.dist-row {
  display: grid;
  grid-template-columns: 2.6rem 1fr 1.5rem;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.78rem;
}
.dist-lbl {
  font-weight: 700;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #fff;
  padding: 0.1rem 0.4rem;
  border-radius: var(--radius);
  text-align: center;
}
.dist-lbl.band-low  { background: #ef4444; }
.dist-lbl.band-mid  { background: #f59e0b; }
.dist-lbl.band-high { background: #16a34a; }
.dist-bar {
  position: relative;
  height: 6px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
}
.dist-bar > span {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0%;
  background: currentColor;
  border-radius: 999px;
  transition: width 0.28s cubic-bezier(.4,0,.2,1);
}
.dist-row:nth-child(1) .dist-bar > span { background: #ef4444; }
.dist-row:nth-child(2) .dist-bar > span { background: #f59e0b; }
.dist-row:nth-child(3) .dist-bar > span { background: #16a34a; }
.dist-num {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--text);
  text-align: right;
}

/* ─────────────────────────────────────────────────────
   National dashboard v2
   Hero + segmented filter + main/rail grid.
   ───────────────────────────────────────────────────── */

.dash-v2 { display: flex; flex-direction: column; gap: 1.25rem; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.hero-h1 {
  margin: 0;
  color: #ffffff;
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* ── Hero ───────────────────────────────────────────── */
.dash-hero {
  background:
    radial-gradient(circle at top right, rgba(29,78,216,0.12) 0%, transparent 55%),
    linear-gradient(135deg, #0d2d52 0%, #1a3d66 100%);
  color: #ffffff;
  border-radius: var(--radius-lg);
  padding: 1.5rem 1.75rem 1.75rem;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}
.hero-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
}
.hero-head h1 { margin: 0; color: #ffffff; font-size: 1.6rem; }
.hero-eyebrow {
  margin: 0 0 0.15rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255, 255, 255, 0.55);
}
.hero-sub {
  margin: 0.35rem 0 0;
  color: rgba(255, 255, 255, 0.7) !important;
  font-size: 0.83rem;
}
.who-chip {
  display: inline-block;
  font-size: 0.72rem;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.85);
  font-weight: 500;
  max-width: 18rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.85rem;
}
.hero-stat {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-lg);
  padding: 0.9rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  backdrop-filter: blur(2px);
  transition: background 0.18s, border-color 0.18s;
}
.hero-stat:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.22);
}
.hero-stat-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.6);
}
.hero-stat-value {
  font-size: 1.85rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.05;
  color: #ffffff;
  font-variant-numeric: tabular-nums;
}
.hero-stat-tot {
  font-size: 1rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.55);
}
.hero-stat-sub {
  font-size: 0.74rem;
  color: rgba(255, 255, 255, 0.6);
}
.hero-stat-warn .hero-stat-value { color: #fbbf24; }
.hero-bar {
  background: rgba(255, 255, 255, 0.18);
  margin-top: 0.3rem;
}
.hero-bar .rail-bar-fill {
  background: linear-gradient(90deg, #34d399 0%, #10b981 100%);
}
.hero-bar .rail-bar-fill.warn   { background: linear-gradient(90deg, #fbbf24 0%, #f59e0b 100%); }
.hero-bar .rail-bar-fill.danger { background: linear-gradient(90deg, #f87171 0%, #ef4444 100%); }

/* ── Filter bar (single row: dropdowns + apply/clear) ── */
.dash-filter {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.9rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0.85rem 1.1rem;
  box-shadow: var(--shadow);
}
.filter-field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  min-width: 0;
  flex: 1 1 12rem;
}
.filter-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.filter-select {
  margin: 0;
  padding: 0.5rem 0.7rem;
  font-size: 0.88rem;
  width: 100%;
  border: 1px solid var(--border-mid);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
}
.filter-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
  padding-bottom: 1px; /* nudge to baseline-align with selects */
}
.filter-apply,
.filter-clear { font-size: 0.85rem; padding: 0.5rem 1.1rem; }

@media (max-width: 720px) {
  .filter-field { flex: 1 1 100%; }
  .filter-actions { margin-left: 0; width: 100%; justify-content: flex-end; }
}

/* ── Two-column grid: main + rail ───────────────────── */
.dash-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  gap: 1.5rem;
  align-items: start;
}
@media (max-width: 1100px) {
  .dash-grid { grid-template-columns: minmax(0, 1fr); }
  .dash-rail { display: none; }
}
.dash-main { display: flex; flex-direction: column; gap: 1.25rem; min-width: 0; }

/* Per-section card */
.dash-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 1.25rem 1.5rem;
  scroll-margin-top: 1rem;
}
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 0.9rem;
}
.section-head h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.005em;
}
.section-sub {
  font-size: 0.75rem;
  color: var(--muted);
}
.section-count {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  background: var(--warn-bg);
  color: var(--warn);
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-variant-numeric: tabular-nums;
}

/* KPI tile polish */
.dash-section .kpi-tile {
  transition: transform 0.18s, box-shadow 0.18s, border-color 0.18s;
}
.dash-section .kpi-tile:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(0,0,0,.04);
  border-color: var(--border-mid);
}

/* ── District table polish ──────────────────────────── */
.dt-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.75rem;
}
.dt-search {
  margin: 0;
  flex: 0 1 22rem;
  font-size: 0.85rem;
  padding: 0.42rem 0.7rem;
  border: 1px solid var(--border-mid);
  border-radius: var(--radius);
}
.dt-count {
  font-size: 0.78rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.district-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f8fafc;
}
.dash-section .district-table tbody tr {
  transition: background 0.1s;
}
.dash-section .district-table tbody tr:hover { background: #fafbfc; }
.dash-section .district-table tbody tr.risk   { background: #fffbeb; }
.dash-section .district-table tbody tr.silent { background: #fef2f2; }

/* Score-band cell colors (national table) */
.score-cell { font-weight: 700; font-variant-numeric: tabular-nums; }
.score-cell.band-low  { color: #dc2626; }
.score-cell.band-mid  { color: #d97706; }
.score-cell.band-high { color: #16a34a; }

/* ── Sticky right rail ──────────────────────────────── */
.dash-rail {
  position: sticky;
  top: 1rem;
}
.dash-rail .rail-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 1rem;
}
.rail-card-label {
  margin: 0 0 0.6rem;
  font-size: 0.66rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.rail-nav { display: flex; flex-direction: column; gap: 0.1rem; }
.rail-nav-item {
  display: grid;
  grid-template-columns: 0.6rem 1fr auto;
  align-items: center;
  gap: 0.55rem;
  padding: 0.45rem 0.55rem;
  border-radius: var(--radius);
  color: var(--text-mid);
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 500;
  transition: background 0.12s, color 0.12s;
}
.rail-nav-item:hover { background: var(--blue-faint); color: var(--text); }
.rail-nav-item.active {
  background: var(--blue-faint);
  color: var(--blue-hover);
  font-weight: 700;
}
.rail-nav-item.active .rail-nav-dot { background: var(--blue); transform: scale(1.4); }
.rail-nav-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--border-mid);
  transition: background 0.18s, transform 0.18s;
}
.rail-nav-dot.warn { background: var(--warn); }
.rail-nav-count {
  font-size: 0.7rem;
  font-weight: 700;
  background: var(--border);
  color: var(--text-mid);
  padding: 0.06rem 0.45rem;
  border-radius: 999px;
  font-variant-numeric: tabular-nums;
}
.rail-nav-item.active .rail-nav-count {
  background: var(--blue);
  color: #ffffff;
}

/* Smaller spacing tweak: hero stat label color on warn variant */
.hero-stat-warn .hero-stat-label { color: rgba(251, 191, 36, 0.85); }

/* ─────────────────────────────────────────────────────
   Lead trainer dashboard v2
   Hero + section cards + two-column lower row.
   ───────────────────────────────────────────────────── */

.lead-hero .hero-cta {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.5rem;
  min-width: 14rem;
}
.hero-cta-primary {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding: 0.85rem 1.25rem;
  background: #ffffff;
  color: var(--navy);
  text-decoration: none;
  border-radius: var(--radius-lg);
  font-weight: 700;
  letter-spacing: -0.01em;
  box-shadow: 0 2px 8px rgba(0,0,0,0.18), 0 0 0 1px rgba(255,255,255,0.2);
  transition: transform 0.12s, box-shadow 0.18s, background 0.18s;
  position: relative;
  overflow: hidden;
}
.hero-cta-primary::after {
  content: "→";
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.2rem;
  font-weight: 600;
  transition: transform 0.18s;
}
.hero-cta-primary:hover {
  background: #fafafa;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(0,0,0,0.22), 0 0 0 1px rgba(255,255,255,0.25);
}
.hero-cta-primary:hover::after { transform: translateY(-50%) translateX(3px); }
.cta-label { font-size: 0.95rem; }
.cta-sub {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.hero-cta-secondary {
  display: inline-block;
  padding: 0.55rem 1rem;
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
  text-align: center;
  transition: background 0.14s, border-color 0.14s;
}
.hero-cta-secondary:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.32);
}

.phase-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: 0.75rem;
  flex-wrap: wrap;
}
.phase-chip {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.25);
}
.phase-chip.phase-field {
  background: rgba(52, 211, 153, 0.22);
  border-color: rgba(52, 211, 153, 0.55);
  color: #d1fae5;
}
.phase-chip.phase-classroom {
  background: rgba(96, 165, 250, 0.22);
  border-color: rgba(96, 165, 250, 0.55);
  color: #dbeafe;
}
.phase-meta {
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.65);
  font-weight: 500;
}

.hero-stat-ok    { color: #6ee7b7; }
.hero-stat-todo  { color: #fbbf24; }

/* ── Main column ────────────────────────────────────── */
.lead-main { display: flex; flex-direction: column; gap: 1.25rem; }
.lead-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}
@media (max-width: 800px) {
  .lead-cols { grid-template-columns: 1fr; }
}

/* ── Trainers list (avatar + name) ──────────────────── */
.trainers-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}
.trainer-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 0.5rem;
  border-radius: var(--radius);
  transition: background 0.12s;
}
.trainer-row:hover { background: var(--blue-faint); }
.trainer-avatar {
  flex: 0 0 auto;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--navy);
  color: #ffffff;
  font-weight: 700;
  font-size: 0.85rem;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.trainer-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.trainer-name {
  font-weight: 600;
  color: var(--text);
  font-size: 0.9rem;
}
.trainer-email {
  font-size: 0.78rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Recent reports list ────────────────────────────── */
.recent-reports {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.recent-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 0.85rem;
  align-items: center;
  padding: 0.65rem 0.5rem;
  border-radius: var(--radius);
  transition: background 0.12s;
}
.recent-row:hover { background: var(--blue-faint); }
.recent-row + .recent-row { border-top: 1px solid var(--border); }
.recent-period {
  font-weight: 600;
  color: var(--text);
  font-size: 0.9rem;
}
.recent-stat {
  font-size: 0.78rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.recent-num {
  font-weight: 700;
  color: var(--text);
  font-size: 0.95rem;
  margin-right: 0.2rem;
}
.recent-footer {
  margin: 0.75rem 0 0;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
}

/* Hero head: wrap CTA below on narrow screens */
@media (max-width: 720px) {
  .lead-hero .hero-cta {
    width: 100%;
    flex-direction: row;
    flex-wrap: wrap;
  }
  .hero-cta-primary { flex: 1 1 100%; }
  .hero-cta-secondary { flex: 1; min-width: 0; }
}

/* ── Trainees list: search, status badges, collapsible stats, mobile cards ── */
.trainees-list .page-header .page-sub { margin: 0.2rem 0 0; }

.trainee-search {
  position: relative;
  margin-bottom: 1rem;
}
.trainee-search-icon {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}
.trainee-search input[type="search"] {
  width: 100%;
  margin: 0;
  padding: 0.7rem 0.9rem 0.7rem 2.6rem;
  font-size: 1rem;
  border: 1px solid var(--border-mid);
  border-radius: var(--radius);
  background: var(--surface);
}
.trainee-search input[type="search"]:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-faint);
}
.trainee-search-count {
  margin: 0.4rem 0 0;
  font-size: 0.8rem;
  color: var(--muted);
}

/* Status badge — green active, grey withdrawn, blue graduated */
.status-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: capitalize;
  letter-spacing: 0.02em;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  white-space: nowrap;
}
.status-active    { background: #dcfce7; color: #166534; }
.status-withdrawn { background: var(--border); color: var(--text-mid); }
.status-graduated { background: var(--blue-light); color: var(--blue-hover); }

/* Collapsible gender/age summary — keeps the list at the top of the page */
.insights-panel {
  margin-bottom: 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
}
.insights-panel > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 1.1rem;
  font-weight: 600;
  color: var(--text);
}
.insights-panel > summary::-webkit-details-marker { display: none; }
.insights-panel > summary::after {
  content: "▾";
  color: var(--muted);
  transition: transform 0.15s ease;
}
.insights-panel[open] > summary::after { transform: rotate(180deg); }
.insights-summary-hint { font-size: 0.75rem; font-weight: 500; color: var(--muted); }
.insights-panel[open] > summary { border-bottom: 1px solid var(--border); }
.insights-body { padding: 1.1rem; }
.insights-body .kpi-grid { margin-bottom: 1rem; }
.insights-body .insights-age { margin: 0; }

/* Mobile: reflow the wide trainee table into stacked cards */
@media (max-width: 720px) {
  .trainees-table thead { display: none; }
  .trainees-table,
  .trainees-table tbody,
  .trainees-table tr,
  .trainees-table td { display: block; width: 100%; }
  .trainees-table tr {
    padding: 0.85rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 0.75rem;
    position: relative;
  }
  .trainees-table tr:hover { background: var(--surface); }
  .trainees-table td {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.25rem 0;
    border: 0;
    text-align: right;
  }
  .trainees-table td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--muted);
    text-align: left;
  }
  .trainees-table td.col-name {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 0.35rem;
    padding-right: 2.5rem; /* clear the action menu */
  }
  .trainees-table td.col-name::before { content: none; }
  .trainees-table td.row-actions {
    position: absolute;
    top: 0.6rem;
    right: 0.6rem;
    width: auto;
    padding: 0;
  }
  .trainees-table td.row-actions::before { content: none; }
}

/* ── Add trainees: dual-action buttons + numbered import steps ── */
.add-one-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 0.5rem;
}
.add-one-actions button { margin: 0; }

.import-steps {
  list-style: none;
  margin: 0 0 1.25rem;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.import-steps > li {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}
.import-steps > li > div { flex: 1; }
.import-steps > li strong { display: block; }
.import-steps > li .hint { margin: 0.15rem 0 0.5rem; }
.import-step-num {
  flex: 0 0 auto;
  width: 1.65rem;
  height: 1.65rem;
  border-radius: 999px;
  background: var(--blue);
  color: #fff;
  font-weight: 700;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.import-columns { margin-top: 0.35rem; }
.import-columns > summary {
  cursor: pointer;
  font-size: 0.8rem;
  color: var(--blue);
}
.import-columns ul {
  margin: 0.5rem 0 0;
  padding-left: 1.1rem;
  font-size: 0.8rem;
  color: var(--text-mid);
}
.import-columns li { margin-bottom: 0.25rem; }

/* ════════════════════════════════════════════════════════════════════
   National dashboard — plain-language layer for the non-technical viewer
   Summary band, narrative insight cards, definitions, friendlier UI.
   Scoped to .dash-v2 so nothing else on the site shifts.
   ════════════════════════════════════════════════════════════════════ */

/* Slightly larger, calmer reading size for the national page. */
.dash-v2 { font-size: 1.02rem; }
.dash-v2 .section-desc {
  margin: -0.35rem 0 0.85rem;
  color: var(--text-mid);
  font-size: 0.95rem;
  max-width: 70ch;
}

/* ── Summary band ──────────────────────────────────────── */
.dash-summary {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 5px solid var(--blue);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 1.25rem 1.5rem 1.4rem;
  margin-bottom: 1.25rem;
}
.dash-summary .ds-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.dash-summary .ds-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.dash-summary .ds-asof {
  font-size: 0.85rem;
  color: var(--muted);
  white-space: nowrap;
}
.dash-summary .ds-lead {
  margin: 0.6rem 0 0;
  font-size: 1.3rem;
  line-height: 1.5;
  font-weight: 500;
  color: var(--text);
  max-width: 60ch;
}

/* At-a-glance chips */
.ds-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}
.ds-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.8rem;
  border-radius: 999px;
  font-size: 0.95rem;
  font-weight: 600;
  background: var(--blue-faint);
  color: var(--text-mid);
  border: 1px solid var(--border);
}
.ds-chip::before {
  content: "";
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 999px;
  background: var(--border-mid);
}
.ds-chip.good   { background: var(--good-bg);   color: #065f46; border-color: #a7f3d0; }
.ds-chip.good::before   { background: var(--good); }
.ds-chip.warn   { background: var(--warn-bg);   color: #92400e; border-color: #fde68a; }
.ds-chip.warn::before   { background: var(--warn); }
.ds-chip.danger { background: var(--danger-bg); color: #991b1b; border-color: #fecaca; }
.ds-chip.danger::before { background: var(--danger); }

/* Narrative insight cards */
.ds-insights {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 0.85rem;
  margin-top: 1.25rem;
}
.ds-insight {
  display: flex;
  gap: 0.85rem;
  padding: 1rem 1.1rem;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-left: 4px solid var(--border-mid);
  border-radius: var(--radius);
}
.ds-insight.good   { border-left-color: var(--good); }
.ds-insight.warn   { border-left-color: var(--warn); }
.ds-insight.danger { border-left-color: var(--danger); }
.ds-ic {
  flex: 0 0 auto;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--blue-light);
  color: var(--blue);
}
.ds-insight.good   .ds-ic { background: var(--good-bg);   color: var(--good); }
.ds-insight.warn   .ds-ic { background: var(--warn-bg);   color: var(--warn); }
.ds-insight.danger .ds-ic { background: var(--danger-bg); color: var(--danger); }
.ds-ic svg { width: 1.3rem; height: 1.3rem; }
.ds-itext { min-width: 0; }
.ds-ititle {
  margin: 0 0 0.25rem;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}
.ds-ibody {
  margin: 0;
  font-size: 1.02rem;
  line-height: 1.5;
  color: var(--text);
}

/* ── Plain-language definitions ("What do these words mean?") ── */
.dash-legend {
  margin-top: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #f8fafc;
}
.dash-legend > summary {
  cursor: pointer;
  padding: 0.7rem 1rem;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--blue);
  list-style: none;
}
.dash-legend > summary::-webkit-details-marker { display: none; }
.dash-legend > summary::before {
  content: "▸ ";
  color: var(--muted);
}
.dash-legend[open] > summary::before { content: "▾ "; }
.legend-list {
  margin: 0;
  padding: 0.25rem 1rem 1rem;
  display: grid;
  grid-template-columns: minmax(8rem, max-content) 1fr;
  gap: 0.55rem 1rem;
  align-items: start;
}
.legend-list dt { font-weight: 600; color: var(--text-mid); }
.legend-list dd { margin: 0; color: var(--text-mid); font-size: 0.95rem; }

/* "No issues" dash in the attention column */
.dt-ok-dash { color: var(--muted); }

/* ── Sticky filter strip (always reachable while scrolling) ── */
.dash-v2 .dash-filter {
  position: sticky;
  top: 0;
  z-index: 25;
  transition: box-shadow 0.15s, border-color 0.15s;
}
/* Pinned cue: lift it off the page with a stronger shadow. */
.dash-v2 .dash-filter.stuck {
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.12);
  border-color: var(--border-mid);
}
@media (max-width: 800px) {
  /* Sit just below the mobile topbar so it never hides the filter. */
  .dash-v2 .dash-filter { top: 3.4rem; }
}

/* ── Friendlier filter strip ───────────────────────────── */
.dash-v2 .filter-label { font-size: 0.8rem; }
.dash-v2 .filter-select {
  font-size: 1rem;
  padding: 0.5rem 0.6rem;
  min-height: 2.6rem;
  max-width: none;
}
.dash-v2 .button { min-height: 2.6rem; }

/* ── Back-to-top button ────────────────────────────────── */
.back-to-top {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 40;
  background: var(--navy);
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.65rem 1rem;
  border-radius: 999px;
  box-shadow: 0 4px 14px rgba(0,0,0,.18);
  opacity: 0;
  transform: translateY(0.5rem);
  pointer-events: none;
  transition: opacity 0.18s, transform 0.18s;
}
.back-to-top.show { opacity: 1; transform: translateY(0); pointer-events: auto; }
.back-to-top:hover { background: var(--navy-shade); }

@media (max-width: 720px) {
  .dash-summary .ds-lead { font-size: 1.15rem; }
  .legend-list { grid-template-columns: 1fr; gap: 0.15rem 0; }
  .legend-list dd { margin-bottom: 0.5rem; }
}
