/* ============================================================================
   Rangers Workbench — Portal design system
   "MADDS": a light, condensed, high-density review console for
   authoring micro-credentials for Indigenous ranger programs.

   Design language grounded in land/sea survey work — not Indigenous motifs
   (which would be inappropriate to appropriate), but the *reviewer's* toolkit:
   a cartographic ledger. Map-legend micro-labels, monospace instrument
   readouts, contour hairlines, and a survey "transect" spine that walks the
   four authoring stations. Palette is eucalypt green (go), ochre (attention),
   clay (reject) on cool survey paper.

   LIGHT ONLY. Base 13px. System fonts. No CDN.
   ========================================================================== */

:root {
  /* paper + ink */
  --paper:      #f4f6f2;
  --surface:    #ffffff;
  --surface-2:  #fafbf8;
  --ink:        #1b211e;
  --ink-2:      #56605a;
  --ink-3:      #868f88;
  --line:       #e2e7e0;
  --line-2:     #edf0ea;

  /* semantic hues */
  --eucalypt:      #2e6b52;   /* primary / go / pass */
  --eucalypt-deep: #22503d;
  --eucalypt-tint: #e6efe9;
  --eucalypt-line: #bcd6c6;

  --slate:       #2f5e8c;     /* running / info */
  --slate-tint:  #e5edf5;
  --slate-line:  #bcd0e4;

  --ochre:       #935f10;     /* attention / warn */
  --ochre-accent:#b4791e;
  --ochre-tint:  #f6ecd6;
  --ochre-line:  #e6cf9e;

  --clay:        #9d3a2e;     /* reject / fail */
  --clay-tint:   #f5e3df;
  --clay-line:   #e3bcb3;

  --muted:       #7b837d;     /* locked */
  --muted-tint:  #eceeE9;
  --muted-line:  #dde1da;

  /* type */
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "SFMono-Regular", Menlo, "Cascadia Code", "Roboto Mono", Consolas, monospace;

  /* metrics */
  --r:      6px;    /* card radius */
  --r-sm:   4px;
  --r-pill: 999px;
  --shadow: 0 1px 2px rgba(27,33,30,.05), 0 1px 0 rgba(27,33,30,.02);
  --shadow-lift: 0 2px 8px rgba(27,33,30,.08);
  --wrap: 1100px;
}

/* ---- reset ------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--paper);
  /* faint graticule — survey ledger grid, barely there */
  background-image:
    linear-gradient(rgba(46,107,82,.028) 1px, transparent 1px),
    linear-gradient(90deg, rgba(46,107,82,.028) 1px, transparent 1px);
  background-size: 44px 44px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, h4, p, figure { margin: 0; }
a { color: var(--eucalypt); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; }
:focus-visible { outline: 2px solid var(--eucalypt); outline-offset: 2px; border-radius: var(--r-sm); }

/* ---- layout ------------------------------------------------------------ */
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 22px 22px 72px; }
.stack { display: flex; flex-direction: column; }
.gap-4 { gap: 4px; } .gap-8 { gap: 8px; } .gap-12 { gap: 12px; }
.gap-16 { gap: 16px; } .gap-20 { gap: 20px; } .gap-24 { gap: 24px; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.spacer { flex: 1; }

/* ---- topbar ------------------------------------------------------------ */
.topbar {
  position: sticky; top: 0; z-index: 40;
  background: rgba(255,255,255,.9);
  backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--line);
}
.topbar__inner {
  max-width: var(--wrap); margin: 0 auto;
  display: flex; align-items: center; gap: 14px; flex-wrap: nowrap;
  padding: 9px 22px; min-height: 48px;
}
.brand { display: inline-flex; align-items: center; gap: 9px; color: var(--ink); font-weight: 650; flex: none; }
.brand__tag { flex: none; }
.brand:hover { text-decoration: none; }
.brand__mark {
  width: 22px; height: 22px; flex: none; display: block;
}
.brand__name { font-size: 13px; letter-spacing: .01em; }
.brand__tag {
  font-family: var(--mono); font-size: 9.5px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--ink-3); border-left: 1px solid var(--line); padding-left: 9px; margin-left: 1px;
}
.crumbs {
  display: flex; align-items: center; gap: 6px; flex-wrap: nowrap;
  font-size: 12px; color: var(--ink-2); min-width: 0; overflow: hidden;
  white-space: nowrap;
}
.crumbs a { color: var(--ink-2); }
.crumbs a:hover { color: var(--eucalypt); }
.crumbs__sep { color: var(--ink-3); flex: none; }
.crumbs__here { color: var(--ink); font-weight: 550; overflow: hidden; text-overflow: ellipsis; }
.topbar__user { display: inline-flex; align-items: center; gap: 9px; flex: none; }
.topbar__link { font-size: 13px; color: var(--ink-2); text-decoration: none; }
.topbar__link:hover { color: var(--eucalypt); }
.topbar__email { font-family: var(--mono); font-size: 11.5px; color: var(--ink-2); }

/* ---- micro-label (map legend) ----------------------------------------- */
.mlabel {
  font-family: var(--mono); font-size: 10px; font-weight: 500;
  letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3);
}
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.num { font-variant-numeric: tabular-nums; }

/* ---- page header ------------------------------------------------------- */
.pagehead { margin-bottom: 18px; }
.pagehead__title { font-size: 21px; font-weight: 680; letter-spacing: -.012em; line-height: 1.15; }
.pagehead__sub { color: var(--ink-2); margin-top: 4px; font-size: 13px; max-width: 62ch; }
.section-title {
  font-size: 12px; font-weight: 640; text-transform: uppercase; letter-spacing: .09em;
  color: var(--ink-2); display: flex; align-items: center; gap: 8px; margin: 0 0 10px;
}
.section-title::before {
  content: ""; width: 12px; height: 1px; background: var(--eucalypt); flex: none;
}

/* ---- cards ------------------------------------------------------------- */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); box-shadow: var(--shadow);
}
.card--pad { padding: 16px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); }
.panel__head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 11px 15px; border-bottom: 1px solid var(--line-2); background: var(--surface-2);
  border-radius: var(--r) var(--r) 0 0;
}
.panel__body { padding: 15px; }
.hr { height: 1px; background: var(--line-2); border: 0; margin: 0; }

/* ---- pills (state) ----------------------------------------------------- */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--mono); font-size: 10.5px; font-weight: 600;
  letter-spacing: .06em; text-transform: uppercase;
  padding: 3px 9px 3px 8px; border-radius: var(--r-pill);
  border: 1px solid transparent; white-space: nowrap; line-height: 1;
}
.pill__dot { width: 6px; height: 6px; border-radius: 50%; flex: none; background: currentColor; }
.pill--locked    { color: var(--muted);   background: var(--muted-tint);   border-color: var(--muted-line); }
.pill--ready     { color: var(--eucalypt);background: var(--eucalypt-tint); border-color: var(--eucalypt-line); }
.pill--running   { color: var(--slate);   background: var(--slate-tint);   border-color: var(--slate-line); }
.pill--attention { color: var(--ochre);   background: var(--ochre-tint);   border-color: var(--ochre-line); }
.pill--done      { color: #fff;           background: var(--eucalypt);     border-color: var(--eucalypt-deep); }
.pill--done .pill__dot { background: rgba(255,255,255,.9); }

@media (prefers-reduced-motion: no-preference) {
  .pill--running .pill__dot { animation: pulse 1.4s ease-in-out infinite; }
  .node--running .node__dot { animation: pulse 1.4s ease-in-out infinite; }
}
@keyframes pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(47,94,140,.45); }
  50%      { opacity: .55; box-shadow: 0 0 0 4px rgba(47,94,140,0); }
}

/* ---- badges (data facts) ---------------------------------------------- */
.badgerow { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 550; line-height: 1;
  padding: 3px 7px; border-radius: var(--r-sm);
  background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2);
}
.badge b { font-weight: 650; color: var(--ink); font-variant-numeric: tabular-nums; }
.badge__k { font-family: var(--mono); font-size: 9.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.badge--good { background: var(--eucalypt-tint); border-color: var(--eucalypt-line); color: var(--eucalypt-deep); }
.badge--good b { color: var(--eucalypt-deep); }
.badge--info { background: var(--slate-tint); border-color: var(--slate-line); color: var(--slate); }
.badge--warn { background: var(--ochre-tint); border-color: var(--ochre-line); color: var(--ochre); }
.badge--bad  { background: var(--clay-tint); border-color: var(--clay-line); color: var(--clay); }
.badge--bad b { color: var(--clay); }

/* ---- ticks ------------------------------------------------------------- */
.tick { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-2); }
.tick__mk {
  width: 15px; height: 15px; flex: none; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 800; line-height: 1;
}
.tick--yes .tick__mk { background: var(--eucalypt-tint); color: var(--eucalypt); border: 1px solid var(--eucalypt-line); }
.tick--no  .tick__mk { background: var(--clay-tint); color: var(--clay); border: 1px solid var(--clay-line); }
.tick--na  .tick__mk { background: var(--muted-tint); color: var(--ink-3); border: 1px solid var(--muted-line); }
.ticklist { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.ticklist .tick { min-width: 0; }

/* inline yes/no glyph */
.yn { font-family: var(--mono); font-weight: 800; font-size: 12px; }
.yn--yes { color: var(--eucalypt); }
.yn--no  { color: var(--clay); }

/* ---- relevance chips (per-LO dots) ------------------------------------ */
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 10.5px; font-weight: 550; padding: 2px 7px 2px 6px;
  border-radius: var(--r-pill); border: 1px solid var(--line); background: var(--surface-2); color: var(--ink-2);
  white-space: nowrap;
}
.chip__id { font-family: var(--mono); font-size: 10px; color: var(--ink-3); }
.chip__dot { width: 7px; height: 7px; border-radius: 50%; flex: none; background: var(--muted-line); }
.chip--none .chip__dot { background: #cfd4cd; }
.chip--low  .chip__dot { background: #cbb26a; }
.chip--med  .chip__dot { background: #6fa07f; }
.chip--high .chip__dot { background: var(--eucalypt); }
.chip--high { border-color: var(--eucalypt-line); background: var(--eucalypt-tint); color: var(--eucalypt-deep); }

/* generic tag chip */
.tag {
  display: inline-flex; align-items: center; font-size: 10.5px; color: var(--ink-2);
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-sm);
  padding: 2px 7px; font-family: var(--mono); letter-spacing: .02em;
}

/* ---- buttons ----------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  font-size: 12.5px; font-weight: 600; line-height: 1;
  padding: 8px 14px; border-radius: var(--r-sm); cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  transition: background .12s ease, border-color .12s ease, transform .04s ease;
  text-decoration: none; white-space: nowrap;
}
.btn:hover { border-color: var(--ink-3); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--eucalypt); border-color: var(--eucalypt-deep); color: #fff; }
.btn--primary:hover { background: var(--eucalypt-deep); border-color: var(--eucalypt-deep); }
.btn--ghost { background: transparent; }
.btn--sm { padding: 5px 10px; font-size: 11.5px; }
.btn--block { width: 100%; }
.btn__ic { font-size: 13px; line-height: 1; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.linkish {
  background: none; border: 0; padding: 0; cursor: pointer;
  color: var(--eucalypt); font-size: 12px; font-weight: 600;
}
.linkish:hover { text-decoration: underline; }

/* ---- forms ------------------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: 5px; }
.field__label { font-family: var(--mono); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-2); }
.input, .textarea, .select {
  font-family: var(--sans); font-size: 13px; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm);
  padding: 8px 10px; width: 100%;
}
.input:focus, .textarea:focus, .select:focus { outline: 2px solid var(--eucalypt); outline-offset: -1px; border-color: var(--eucalypt); }
.input[readonly], .input--ro { background: var(--surface-2); color: var(--ink-2); }
.input--sm { width: auto; font-size: 11px; padding: 3px 7px; line-height: 1; }
/* Task 6: text-input variant of `.input--sm` for the sources register card's
   inline "Edit details" row (`_register_item.html`) -- `.input--sm` alone
   leaves text inputs at the browser's unset-`size` default width, which
   isn't a compact row. Attribution is the longest field and takes the
   remaining row space via its own inline `flex:1`; the rest get a fixed
   compact width here. */
.input--sm-text { width: 120px; }
.sel { display: inline-flex; align-items: center; gap: 5px; }
.src__url { font-family: var(--mono); font-size: 10.5px; color: var(--ink-3); word-break: break-all; margin-top: 3px; }
.src__cite { margin-top: 8px; font-size: 11px; color: var(--ink-2); }
.textarea { resize: vertical; min-height: 120px; line-height: 1.55; font-family: var(--mono); font-size: 12.5px; }
.field__hint { font-size: 11px; color: var(--ink-3); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }

/* ---- catalogue: domain cards ------------------------------------------ */
.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.domain-card {
  display: flex; flex-direction: column; gap: 10px; padding: 16px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  box-shadow: var(--shadow); transition: border-color .12s, box-shadow .12s, transform .08s;
}
.domain-card:hover { border-color: var(--eucalypt-line); box-shadow: var(--shadow-lift); transform: translateY(-1px); text-decoration: none; }
.domain-card__name { font-size: 15px; font-weight: 650; color: var(--ink); letter-spacing: -.005em; }
.domain-card__desc { font-size: 12.5px; color: var(--ink-2); line-height: 1.5; flex: 1; }
.domain-card__foot { display: flex; align-items: center; justify-content: space-between; padding-top: 4px; }
.countpill {
  display: inline-flex; align-items: baseline; gap: 5px;
  font-family: var(--mono); font-size: 11px; color: var(--ink-2);
}
.countpill b { font-size: 15px; color: var(--eucalypt); font-weight: 700; }

.domain-card--add {
  align-items: center; justify-content: center; gap: 6px;
  border: 1px dashed var(--line-2); background: transparent; cursor: pointer;
  color: var(--ink-2); font-family: inherit; min-height: 128px;
}
.domain-card--add:hover { border-color: var(--eucalypt-line); color: var(--eucalypt-deep); background: var(--eucalypt-tint); box-shadow: none; transform: none; }
.domain-card--add__plus { font-size: 24px; line-height: 1; color: var(--eucalypt); }
.domain-card--add__label { font-size: 12.5px; font-weight: 600; }

/* ---- modal (native <dialog>) ------------------------------------------ */
dialog.modal {
  border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-lift);
  padding: 18px; width: min(440px, calc(100vw - 32px)); background: var(--surface); color: var(--ink);
}
dialog.modal::backdrop { background: rgba(20, 24, 21, .38); }
.modal__head { display: flex; align-items: center; justify-content: space-between; }

/* ---- credential rows (domain page) ------------------------------------ */
.credlist { display: flex; flex-direction: column; }
.credrow {
  display: grid; grid-template-columns: 1fr auto; gap: 6px 14px; align-items: center;
  padding: 13px 15px; border-bottom: 1px solid var(--line-2); text-decoration: none; color: inherit;
}
.credrow:last-child { border-bottom: 0; }
.credrow:hover { background: var(--surface-2); text-decoration: none; }
.credrow__main { min-width: 0; }
.credrow__title { font-size: 14px; font-weight: 620; color: var(--ink); }
.credrow__meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 5px; }
.credrow__desc { color: var(--ink-2); font-size: 12px; margin-top: 4px; overflow: hidden; text-overflow: ellipsis; }
.credrow__right { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; }
.credrow__phase { font-size: 11.5px; color: var(--ink-2); }
.credrow__when { font-family: var(--mono); font-size: 10.5px; color: var(--ink-3); }

/* AQF band chip cluster */
.aqf { display: inline-flex; align-items: center; gap: 0; border: 1px solid var(--line); border-radius: var(--r-sm); overflow: hidden; }
.aqf__band { font-family: var(--mono); font-size: 10.5px; font-weight: 650; padding: 2px 7px; background: var(--eucalypt-tint); color: var(--eucalypt-deep); }
.aqf__range { font-family: var(--mono); font-size: 10.5px; padding: 2px 7px; color: var(--ink-2); background: var(--surface); border-left: 1px solid var(--line); }

/* ---- collapsible create form ------------------------------------------ */
details.disclose > summary { list-style: none; cursor: pointer; }
details.disclose > summary::-webkit-details-marker { display: none; }
.disclose__row { display: inline-flex; align-items: center; gap: 8px; }
details[open] .disclose__chevron { transform: rotate(90deg); }
.disclose__chevron { transition: transform .12s ease; color: var(--ink-3); font-size: 11px; }

/* ======================================================================
   CREDENTIAL HERO — the survey transect + four station cards
   ====================================================================== */
.hero {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  box-shadow: var(--shadow); padding: 18px 20px; margin-bottom: 18px;
  position: relative; overflow: hidden;
}
.hero::after {
  /* faint contour lines top-right, cartographic flavour */
  content: ""; position: absolute; top: -40%; right: -6%; width: 260px; height: 260px;
  background:
    radial-gradient(circle, transparent 38%, rgba(46,107,82,.05) 39%, transparent 40%),
    radial-gradient(circle, transparent 52%, rgba(46,107,82,.045) 53%, transparent 54%),
    radial-gradient(circle, transparent 66%, rgba(46,107,82,.04) 67%, transparent 68%),
    radial-gradient(circle, transparent 80%, rgba(46,107,82,.035) 81%, transparent 82%);
  pointer-events: none;
}
.hero__title { font-size: 22px; font-weight: 700; letter-spacing: -.015em; line-height: 1.15; }
.hero__desc { color: var(--ink-2); margin-top: 8px; max-width: 68ch; font-size: 13px; }
.hero__meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 12px; }

/* transect + grid live inside #phase-grid so htmx swaps both */
.phase-grid { display: block; }

.transect { position: relative; margin: 4px 2px 18px; padding-top: 6px; }
/* line + fill span node-1 centre (--inset) → last node centre (100% - --inset);
   --inset and --n are set inline per-run from phases|length (50/N and N —
   see _phase_grid.html), defaulting to the 4-station values (12.5%/4) so
   this still renders sanely if a caller forgets to set them. Fill width is
   (done-1)*(100/N)% so it stops exactly on the last completed node. */
.transect__line { position: absolute; left: var(--inset, 12.5%); right: var(--inset, 12.5%); top: 18px; height: 2px; background: var(--line); border-radius: 2px; }
.transect__fill { position: absolute; left: var(--inset, 12.5%); top: 18px; height: 2px; background: var(--eucalypt); border-radius: 2px; width: var(--fill, 0%); transition: width .5s ease; }
.transect__stations { position: relative; display: grid; grid-template-columns: repeat(var(--n, 4), 1fr); }
.station { display: flex; flex-direction: column; align-items: center; gap: 7px; text-align: center; }
.node {
  width: 26px; height: 26px; border-radius: 50%; background: var(--surface);
  border: 2px solid var(--line); display: flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-size: 10px; font-weight: 700; color: var(--ink-3); z-index: 1;
}
.node__dot { display: none; }
.node--locked    { border-color: var(--muted-line); color: var(--ink-3); }
.node--ready     { border-color: var(--eucalypt); color: var(--eucalypt); box-shadow: 0 0 0 3px var(--eucalypt-tint); }
.node--running   { border-color: var(--slate); color: var(--slate); box-shadow: 0 0 0 3px var(--slate-tint); }
.node--attention { border-color: var(--ochre-accent); color: var(--ochre); box-shadow: 0 0 0 3px var(--ochre-tint); }
.node--done      { border-color: var(--eucalypt-deep); background: var(--eucalypt); color: #fff; }
.station__name { font-family: var(--mono); font-size: 9.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2); max-width: 12ch; }

.stations-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.pcard {
  display: flex; flex-direction: column; gap: 11px; padding: 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  box-shadow: var(--shadow); position: relative; overflow: hidden;
  transition: border-color .12s, box-shadow .12s;
}
.pcard::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--line); }
.pcard--ready::before     { background: var(--eucalypt); }
.pcard--running::before   { background: var(--slate); }
.pcard--attention::before { background: var(--ochre-accent); }
.pcard--done::before      { background: var(--eucalypt-deep); }
.pcard--locked            { opacity: .82; }
.pcard:hover { box-shadow: var(--shadow-lift); }
.pcard__top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.pcard__idx { font-family: var(--mono); font-size: 10px; color: var(--ink-3); letter-spacing: .1em; }
.pcard__title { font-size: 13.5px; font-weight: 640; color: var(--ink); line-height: 1.25; margin-top: 2px; }
.pcard__metrics { display: flex; flex-direction: column; gap: 5px; margin-top: 1px; }
.pmetric { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; font-size: 12px; }
.pmetric__k { font-family: var(--mono); font-size: 9.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.pmetric__v { font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; text-align: right; }
.pcard__foot { margin-top: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pcard__link { font-size: 11.5px; font-weight: 600; color: var(--eucalypt); }
.halt-chip {
  display: inline-flex; align-items: center; gap: 5px; font-family: var(--mono);
  font-size: 10px; font-weight: 600; padding: 3px 7px; border-radius: var(--r-sm);
  background: var(--clay-tint); border: 1px solid var(--clay-line); color: var(--clay); letter-spacing: .04em;
}

/* run status strip */
.runstrip {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  font-family: var(--mono); font-size: 11px; color: var(--ink-2);
  padding: 8px 13px; background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--r-sm); margin-bottom: 16px;
}
.runstrip__k { color: var(--ink-3); letter-spacing: .06em; text-transform: uppercase; font-size: 9.5px; }

/* ---- run picker + branch-from-gateway (BRANCH-FEATURE-SPEC.md §3/§5) --- */
.run-picker {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-bottom: 14px;
}
.run-picker__form { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.run-picker__label {
  font-family: var(--mono); font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3);
}
.run-picker__select { min-width: 280px; max-width: 100%; }

.readonly-banner {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 14px; margin-bottom: 16px; border-radius: var(--r-sm);
  background: var(--ochre-tint); border: 1px solid var(--ochre-line); color: var(--ochre);
  font-size: 12.5px;
}
.readonly-banner__icon { flex: none; }
.readonly-banner__text { flex: 1 1 auto; min-width: 0; }
.readonly-banner__actions { display: flex; gap: 8px; flex-wrap: wrap; }
.branch-form { margin: 0; }
.branch-form__btn { border-color: var(--ochre-accent); color: var(--ochre); }
.branch-form__btn:hover { background: var(--ochre-tint); border-color: var(--ochre-accent); }
.branch-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }

/* ---- GATE2 accept/reject decide UI (sources.html) ---------------------- */
.gate2-decide-bar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 10px 13px; margin-bottom: 14px; background: var(--surface-2);
  border: 1px solid var(--line); border-radius: var(--r-sm);
}
.src__toggle {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600;
  color: var(--ink-2); white-space: nowrap;
}
.src__toggle--muted { font-weight: 500; color: var(--ink-3); }
.src__decide {
  display: flex; flex-direction: column; gap: 6px; margin-top: 10px;
  padding-top: 10px; border-top: 1px dashed var(--line-2);
}

/* ---- mode banners / empty states -------------------------------------- */
.empty {
  display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center;
  padding: 42px 24px; background: var(--surface); border: 1px dashed var(--line);
  border-radius: var(--r);
}
.empty--pad { max-width: 520px; margin: 0 auto; }
.empty__icon {
  width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: var(--eucalypt-tint); color: var(--eucalypt); font-size: 18px; border: 1px solid var(--eucalypt-line);
}
.empty__icon--lock { background: var(--muted-tint); color: var(--ink-3); border-color: var(--muted-line); }
.empty__title { font-size: 15px; font-weight: 640; }
.empty__body { color: var(--ink-2); max-width: 46ch; font-size: 12.5px; }

.progress-panel {
  display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center;
  padding: 40px 24px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
}
.spinner {
  width: 26px; height: 26px; border-radius: 50%;
  border: 2.5px solid var(--slate-tint); border-top-color: var(--slate);
}
@media (prefers-reduced-motion: no-preference) { .spinner { animation: spin .8s linear infinite; } }
@keyframes spin { to { transform: rotate(360deg); } }
.spinner--sm { width: 15px; height: 15px; border-width: 2px; }
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { display: inline-flex; }
.src__uploading { align-items: center; gap: 6px; font-size: 12px; color: var(--ink-2); }
.cursor-tag {
  font-family: var(--mono); font-size: 11px; color: var(--slate);
  background: var(--slate-tint); border: 1px solid var(--slate-line); border-radius: var(--r-sm); padding: 4px 9px;
}

/* ======================================================================
   OUTCOMES — per-LO review cards
   ====================================================================== */
.lo-card { padding: 15px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); box-shadow: var(--shadow); }
.lo-card + .lo-card { margin-top: 12px; }
.lo-card__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.lo-id { font-family: var(--mono); font-size: 11px; font-weight: 700; color: #fff; background: var(--eucalypt); padding: 2px 8px; border-radius: var(--r-sm); letter-spacing: .04em; }
.lo-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.lo-texts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
.lo-text { display: flex; flex-direction: column; gap: 5px; }
.lo-text__label { font-family: var(--mono); font-size: 9.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); }
.lo-text__body { font-size: 12.5px; line-height: 1.5; }
.lo-text--orig .lo-text__body { color: var(--ink-2); }
.lo-text--refined { background: var(--eucalypt-tint); border: 1px solid var(--eucalypt-line); border-radius: var(--r-sm); padding: 9px 11px; }
.lo-text--refined .lo-text__body { color: var(--eucalypt-deep); font-weight: 500; }
.lo-evalbar { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line-2); }
.callout {
  margin-top: 12px; padding: 11px 13px; background: var(--surface-2);
  border-left: 3px solid var(--slate); border-radius: 0 var(--r-sm) var(--r-sm) 0;
}
.callout__label { font-family: var(--mono); font-size: 9.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--slate); margin-bottom: 4px; }
.callout__text { font-size: 12.5px; color: var(--ink); line-height: 1.5; }
.callout__reason { font-size: 11.5px; color: var(--ink-2); margin-top: 6px; line-height: 1.5; }
.callout--warn { border-left-color: var(--ochre-accent); }
.callout--warn .callout__label { color: var(--ochre); }

/* ======================================================================
   SOURCES — summary strip + source rows
   ====================================================================== */
.summary-strip { display: flex; flex-wrap: wrap; gap: 0; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; background: var(--surface); box-shadow: var(--shadow); margin-bottom: 16px; }
.stat { display: flex; flex-direction: column; gap: 3px; padding: 12px 18px; border-right: 1px solid var(--line-2); flex: 1; min-width: 120px; }
.stat:last-child { border-right: 0; }
.stat__k { font-family: var(--mono); font-size: 9.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.stat__v { font-size: 19px; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.stat__v--good { color: var(--eucalypt); }
.stat__v--bad { color: var(--clay); }

.src { padding: 13px 15px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); box-shadow: var(--shadow); }
.src + .src { margin-top: 10px; }
.src--rejected { background: var(--surface-2); border-style: dashed; }
.src--excluded { opacity: .55; }
.src__top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.src__title { font-size: 13.5px; font-weight: 620; line-height: 1.3; }
.src__title a { color: var(--ink); }
.src__title a:hover { color: var(--eucalypt); }
.src__accept { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.src__accept--yes { color: var(--eucalypt); }
.src__accept--no { color: var(--clay); }
.src__sub { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.src__badges { margin-top: 10px; }
.src__lo { margin-top: 10px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.src__topics { margin-top: 9px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.src__reason { margin-top: 9px; font-size: 11.5px; color: var(--clay); background: var(--clay-tint); border: 1px solid var(--clay-line); border-radius: var(--r-sm); padding: 6px 9px; }
.topic-chip { display: inline-flex; align-items: baseline; gap: 5px; font-size: 10.5px; color: var(--ink-2); background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 2px 7px; }
.topic-chip b { font-family: var(--mono); color: var(--ink); font-weight: 600; }

/* ---- knowledge_mapper topic_registry panel (sources.html) ------------- */
.topics-panel { display: flex; flex-direction: column; gap: 4px; }
.topic-row { padding: 7px 0; border-bottom: 1px solid var(--line-2); }
.topic-row:last-child { border-bottom: 0; }
.topic-row__title { font-size: 12.5px; color: var(--ink); font-weight: 560; }

/* ======================================================================
   ASSESSMENT — overview + task cards + rubric
   ====================================================================== */
.ov-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin-bottom: 8px; }
.mtable { width: 100%; border-collapse: collapse; font-size: 12px; }
.mtable th { text-align: left; font-family: var(--mono); font-size: 9.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); font-weight: 600; padding: 7px 9px; border-bottom: 1px solid var(--line); }
.mtable td { padding: 8px 9px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.mtable tr:last-child td { border-bottom: 0; }
.mtable .mono { font-size: 11px; }

.lo-cov-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--line-2); }
.lo-cov-row:last-child { border-bottom: 0; }
.lo-cov-row__id { font-family: var(--mono); font-size: 11px; color: var(--ink); min-width: 56px; }
.lo-cov-row__in { font-size: 11px; color: var(--ink-2); display: flex; gap: 5px; flex-wrap: wrap; }

.task { border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); box-shadow: var(--shadow); overflow: hidden; }
.task + .task { margin-top: 12px; }
.task__head { padding: 13px 15px; border-bottom: 1px solid var(--line-2); background: var(--surface-2); }
.task__title { font-size: 14px; font-weight: 640; }
.task__meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 7px; }
.task__body { padding: 14px 15px; }
.task__desc { font-size: 12.5px; color: var(--ink); line-height: 1.55; }
.task__assessed { margin-top: 10px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

.rubric { margin-top: 12px; }
.crit { border: 1px solid var(--line); border-radius: var(--r-sm); overflow: hidden; }
.crit + .crit { margin-top: 8px; }
.crit > summary { list-style: none; cursor: pointer; padding: 9px 12px; display: flex; align-items: center; justify-content: space-between; gap: 10px; background: var(--surface-2); }
.crit > summary::-webkit-details-marker { display: none; }
.crit__name { font-size: 12.5px; font-weight: 600; }
.crit__mapped { font-family: var(--mono); font-size: 10px; color: var(--ink-3); }
details[open] > summary .disclose__chevron { transform: rotate(90deg); }
.levels { width: 100%; border-collapse: collapse; font-size: 11.5px; table-layout: fixed; }
.levels th { font-family: var(--mono); font-size: 10px; font-weight: 700; letter-spacing: .04em; padding: 6px 8px; text-align: left; border-bottom: 1px solid var(--line); border-right: 1px solid var(--line-2); }
.levels td { padding: 8px; vertical-align: top; border-right: 1px solid var(--line-2); border-bottom: 1px solid var(--line-2); color: var(--ink-2); line-height: 1.45; }
.levels th:last-child, .levels td:last-child { border-right: 0; }
.levels th.lv-NN { color: var(--clay); background: var(--clay-tint); }
.levels th.lv-PA { color: var(--ochre); background: var(--ochre-tint); }
.levels th.lv-CR { color: var(--ink); background: var(--surface-2); }
.levels th.lv-DI { color: var(--slate); background: var(--slate-tint); }
.levels th.lv-HD { color: var(--eucalypt-deep); background: var(--eucalypt-tint); }

/* ======================================================================
   OUTLINE — module accordion
   ====================================================================== */
.mod { border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); box-shadow: var(--shadow); overflow: hidden; }
.mod + .mod { margin-top: 10px; }
.mod > summary { list-style: none; cursor: pointer; padding: 13px 15px; display: flex; align-items: center; gap: 12px; }
.mod > summary::-webkit-details-marker { display: none; }
.mod__idx { font-family: var(--mono); font-size: 11px; font-weight: 700; color: var(--eucalypt); }
.mod__title { font-size: 14px; font-weight: 640; flex: 1; min-width: 0; }
.mod__dur { font-family: var(--mono); font-size: 11px; color: var(--ink-2); }
.mod__body { padding: 0 15px 15px; border-top: 1px solid var(--line-2); }
.topic { padding: 10px 0; border-bottom: 1px solid var(--line-2); }
.topic:last-child { border-bottom: 0; }
.topic__title { font-size: 12.5px; font-weight: 600; display: flex; align-items: baseline; gap: 8px; }
.topic__dur { font-family: var(--mono); font-size: 10px; color: var(--ink-3); }
.subtopics { margin: 6px 0 0; padding-left: 16px; }
.subtopics li { font-size: 12px; color: var(--ink-2); line-height: 1.6; }
.mod__outcomes { margin-top: 10px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

.bigstat { display: inline-flex; flex-direction: column; gap: 2px; padding: 10px 16px; background: var(--eucalypt-tint); border: 1px solid var(--eucalypt-line); border-radius: var(--r); }
.bigstat__v { font-size: 22px; font-weight: 750; color: var(--eucalypt-deep); font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.bigstat__k { font-family: var(--mono); font-size: 9.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--eucalypt); }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; font-size: 12px; }
.kv dt { font-family: var(--mono); font-size: 10px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); align-self: center; }
.kv dd { margin: 0; color: var(--ink); }

/* ======================================================================
   LOGIN
   ====================================================================== */
.login-shell {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px;
}
.login-card { width: 100%; max-width: 360px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-lift); padding: 26px 26px 24px; }
.login-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.login-brand__name { font-size: 16px; font-weight: 700; }
.login-tag { font-family: var(--mono); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 20px; }
.login-form { display: flex; flex-direction: column; gap: 14px; margin-top: 4px; }
.login-err {
  display: none; font-size: 12px; color: var(--clay); background: var(--clay-tint);
  border: 1px solid var(--clay-line); border-radius: var(--r-sm); padding: 8px 10px;
}
.login-err.show { display: block; }
.login-foot { margin-top: 18px; font-size: 11px; color: var(--ink-3); text-align: center; }

/* ---- misc -------------------------------------------------------------- */
.empty-line { color: var(--ink-3); }
.text-muted { color: var(--ink-2); }
.text-dim { color: var(--ink-3); }
.mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.mb-12 { margin-bottom: 12px; } .mb-16 { margin-bottom: 16px; }

/* ---- sources station (D5, Epic 2 Task 7e) ------------------------------ */
.sources-station { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
.sources-station__left, .sources-station__right { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.sources-station__right-top, .sources-station__right-bottom { min-width: 0; }
.sources-station__quick-actions { display: flex; flex-direction: column; gap: 10px; }
.src--build > summary { list-style: none; }
.src--build > summary::-webkit-details-marker { display: none; }
.exclude-disclosure summary { list-style: none; cursor: pointer; }
.exclude-disclosure summary::-webkit-details-marker { display: none; }
@media (max-width: 900px) {
  .sources-station { grid-template-columns: 1fr; }
}

/* ---- responsive -------------------------------------------------------- */
@media (max-width: 860px) {
  .stations-cards { grid-template-columns: repeat(2, 1fr); }
  /* the connecting spine only reads across a single row — drop it when the
     stations wrap, the numbered cards below still carry the sequence. */
  .transect { display: none; }
  .lo-texts { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .crumbs, .brand__tag { display: none; }
}
@media (max-width: 560px) {
  .wrap { padding: 16px 14px 60px; }
  .stations-cards { grid-template-columns: 1fr; }
  .summary-strip { flex-direction: column; }
  .stat { border-right: 0; border-bottom: 1px solid var(--line-2); }
  .levels { font-size: 10.5px; }
  .topbar__email { display: none; }
}
