/* ═══════════════════════════════════════════════════════════════════════════
   WikiWe platform stylesheet — "the ledger" skin (default / WikiWe theme)

   Token architecture (B1a): three layers of CSS custom properties.
     1. Primitives  --wk-*     raw palette + ramps; never referenced by a rule
     2. Semantic    --color-*  the only tokens the rules below reference
     3. Skin        overrides a whitelisted subset, scoped to [data-skin] (Tier 2)
   Legacy --c-* aliases are kept so inline template styles keep resolving.
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
  /* ── 1 · Primitives — the ledger palette (never used by a rule directly) ── */
  --wk-paper:         #F6F5F1;
  --wk-surface:       #FFFFFF;
  --wk-ink:           #1E1C19;
  --wk-ink-muted:     #63605A;   /* AA on paper, surface, and rule-gray badges */
  --wk-rule:          #E4E1D9;
  --wk-rule-strong:   #D6D2C7;
  --wk-accent:        #1B6B54;   /* pine green */
  --wk-accent-strong: #124A3A;
  --wk-accent-tint:   #E7F0EC;
  --wk-cover:         #1C2B25;   /* deep green-black "ledger cover" (navbar) */
  --wk-cover-text:    #EDF1EE;
  --wk-cover-text-strong: #FFFFFF;
  --wk-cover-muted:   #9FB1A8;
  --wk-warn:          #B4791F;   /* amber — icon/border only */
  --wk-warn-text:     #8A5A12;   /* amber — text (AA) */
  --wk-warn-tint:     #FBF1DE;
  --wk-error:         #B23A32;   /* muted brick red */
  --wk-error-tint:    #F7E8E6;
  --wk-info:          #33566E;   /* muted slate-blue — neutral/info */
  --wk-info-tint:     #E7EEF2;
  --wk-plum:          #6D3D6B;   /* distinct category (AI / work-in-progress) */
  --wk-plum-tint:     #F1E8F0;

  /* ── 2 · Semantic roles — reference these everywhere ── */
  --color-bg:            var(--wk-paper);
  --color-surface:       var(--wk-surface);
  --color-text:          var(--wk-ink);
  --color-text-muted:    var(--wk-ink-muted);
  --color-border:        var(--wk-rule);
  --color-border-strong: var(--wk-rule-strong);
  --color-accent:        var(--wk-accent);
  --color-accent-strong: var(--wk-accent-strong);
  --color-accent-tint:   var(--wk-accent-tint);
  --color-link:          var(--wk-accent);
  --color-cover:         var(--wk-cover);
  --color-cover-text:    var(--wk-cover-text);
  --color-cover-text-strong: var(--wk-cover-text-strong);
  --color-cover-muted:   var(--wk-cover-muted);
  --color-success:       var(--wk-accent);
  --color-success-tint:  var(--wk-accent-tint);
  --color-warn:          var(--wk-warn);
  --color-warn-text:     var(--wk-warn-text);
  --color-warn-tint:     var(--wk-warn-tint);
  --color-error:         var(--wk-error);
  --color-error-tint:    var(--wk-error-tint);
  --color-info:          var(--wk-info);
  --color-info-tint:     var(--wk-info-tint);
  --color-plum:          var(--wk-plum);
  --color-plum-tint:     var(--wk-plum-tint);

  /* Type */
  --font-display: "Source Serif 4", Georgia, "Times New Roman", serif;
  --font-body:    system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono:    ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  /* Space (4px base) */
  --space-1: .25rem;  --space-2: .5rem;  --space-3: .75rem;  --space-4: 1rem;
  --space-5: 1.5rem;  --space-6: 2rem;   --space-7: 3rem;    --space-8: 4rem;

  /* Radius / shadow / layout */
  --radius:    6px;
  --radius-sm: 4px;
  --shadow-sm: 0 1px 2px rgb(30 28 25 / .06);
  --shadow:    0 1px 3px rgb(30 28 25 / .09);
  --nav-h: 3.25rem;
  --max-w: 960px;

  /* ── Legacy aliases (for inline template styles; do not use in new rules) ── */
  --c-primary:    var(--color-accent);
  --c-success:    var(--color-success);
  --c-error:      var(--color-error);
  --c-warn:       var(--color-warn);
  --c-border:     var(--color-border);
  --c-muted:      var(--color-text-muted);
  --c-link:       var(--color-link);
  --c-bg:         var(--color-bg);
  --c-success-bg: var(--color-success-tint);
}

/* ── 3 · Skin overrides — Tier-2 hub interior only ─────────────────────────
   UI_Brief_and_Lexicon.md §5: a hub skin may set ONLY this whitelisted
   subset of semantic tokens, scoped to [data-skin] so it can never reach
   Tier 0/1 chrome (Marketplace, onboarding, dashboard, settings). Every
   Tier-2 page (hub_detail.templ, project_detail.templ, ticket_detail.templ,
   points_history.templ) wraps its content in a `[data-skin]` element, so
   the whole hub-interior drill-down path stays visually continuous once
   Phase 2.F starts attaching real per-hub overrides.

   No real per-hub skin picker exists yet (that's Phase 2.F) — every hub
   currently renders with no override, inheriting the default WikiWe
   ("the ledger") tokens above unchanged. This block is the mechanism
   Phase 2.F will attach real per-hub values to (e.g. via an inline
   `style="--color-accent: ..."` on the same [data-skin] element), not a
   skin that's actually in use today. */
[data-skin] {
  /* whitelisted override points: --color-accent, --color-accent-strong,
     --color-bg, --color-surface, --font-display, --radius */
}

/* ── Reset ──────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { font-size: 16px; }
body {
  font-family: var(--font-body);
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.55;
}
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -.01em;
  color: var(--color-text);
}
a { color: var(--color-link); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Navbar ─────────────────────────────────────────────────────────────── */
.navbar {
  height: var(--nav-h);
  background: var(--color-cover);
  color: var(--color-cover-text);
  display: flex;
  align-items: center;
  padding: 0 1.25rem;
  gap: 1.5rem;
  position: sticky;
  top: 0;
  z-index: 100;
}
.navbar__brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--color-cover-text);
  letter-spacing: -.01em;
}
.navbar__brand:hover { text-decoration: none; color: var(--color-cover-text-strong); }
.navbar__links { display: flex; gap: 1rem; flex: 1; }
.navbar__links a { color: var(--color-cover-muted); font-size: .9rem; }
.navbar__links a:hover { color: var(--color-cover-text); text-decoration: none; }
.navbar__user {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-left: auto;
}
.navbar__name { color: var(--color-cover-muted); font-size: .875rem; }
.navbar__name:hover { color: var(--color-cover-text); text-decoration: none; }
.navbar__settings {
  color: var(--color-cover-muted);
  font-size: 1rem;
  opacity: .7;
  line-height: 1;
}
.navbar__settings:hover { color: var(--color-cover-text); opacity: 1; text-decoration: none; }

/* ── Content area ───────────────────────────────────────────────────────── */
.content {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 2rem 1.25rem;
}

/* ── Bare body (auth pages) ─────────────────────────────────────────────── */
.body--bare {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  min-height: 100vh;
  padding: 3rem 1rem;
}
.auth-page {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2rem 2.25rem;
  width: 100%;
  max-width: 420px;
  margin-left: auto;
  margin-right: auto;
}
.auth-page h1 { margin-top: 0; font-size: 1.4rem; }

/* ── Tier-1 content pages (About, F.A.Q., etc.) — standard ledger skin ──── */
.content-page {
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
}
.content-page .eyebrow {
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: var(--color-text-muted);
  margin: 0 0 .625rem;
}
.content-page h2 { font-size: 1.7rem; margin: 0 0 1rem; }
.content-page p { font-size: .975rem; line-height: 1.65; margin: 0 0 .875rem; }
.content-actions { margin-top: 1.5rem; display: flex; gap: .75rem; }

/* ── Flash messages ─────────────────────────────────────────────────────── */
.flash {
  padding: .75rem 1.25rem;
  font-size: .9rem;
  border-left: 4px solid;
}
.flash--success { background: var(--color-success-tint); border-color: var(--color-success); color: var(--color-accent-strong); }
.flash--error   { background: var(--color-error-tint);   border-color: var(--color-error);   color: var(--color-error); }
.flash--warn    { background: var(--color-warn-tint);    border-color: var(--color-warn);    color: var(--color-warn-text); }

/* ── Cards ──────────────────────────────────────────────────────────────── */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.25rem;
}
.card h2 { margin-top: 0; font-size: 1.05rem; }
.card--attention { border-left: 3px solid var(--color-warn); }
.card--expired { opacity: .5; pointer-events: none; user-select: none; }
.card--muted { opacity: .75; }

/* ── Alert pop-up (dismissible, e.g. Dashboard "signature requested") ────── */
.alert-popup {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  max-width: 320px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-left: 3px solid var(--color-warn);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem 1.25rem;
  z-index: 300;
}
.alert-popup__close {
  position: absolute;
  top: .5rem;
  right: .6rem;
  background: none;
  border: none;
  font-size: .9rem;
  line-height: 1;
  color: var(--color-text-muted);
  cursor: pointer;
  padding: .2rem;
}
.alert-popup__close:hover { color: var(--color-text); }
.alert-popup__title { margin: 0 1.25rem .5rem 0; font-size: .95rem; }
.alert-popup__list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .5rem; }
.alert-popup__list li { font-size: .875rem; }
@media (max-width: 480px) {
  .alert-popup { left: 1rem; right: 1rem; max-width: none; bottom: 1rem; }
}

/* ── Section toggle (card whose whole body collapses behind its <h2>) ────── */
.section-toggle { cursor: pointer; list-style: none; }
.section-toggle::-webkit-details-marker { display: none; }
.section-toggle::before { content: "▸ "; color: var(--color-text-muted); }
details[open] > .section-toggle::before { content: "▾ "; }
.section-toggle h2 { display: inline; margin: 0; }
.section-toggle:hover h2 { color: var(--color-accent); }
.section-toggle ~ * { margin-top: .75rem; }

/* ── Quote of the Day ───────────────────────────────────────────────────── */
.quote-tile { text-align: center; }
.quote-tile__eyebrow {
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--color-text-muted);
  margin: 0 0 .6rem;
}
.quote-tile__text {
  font-family: var(--font-display);
  font-size: 1.05rem;
  line-height: 1.5;
  margin: 0 0 .4rem;
  max-width: 46ch;
  margin-left: auto;
  margin-right: auto;
}
.quote-tile__cite { font-size: .8rem; color: var(--color-text-muted); margin: 0; }

/* ── TBD tag + Settings list ────────────────────────────────────────────── */
.tbd-tag {
  font-size: .65rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: .15rem .4rem;
  border-radius: 3px;
  background: var(--color-border);
  color: var(--color-text-muted);
  margin-left: .5rem;
  vertical-align: middle;
}
.settings-list { list-style: none; padding: 0; margin: 0; }
.settings-item {
  padding: .75rem 0;
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text-muted);
}
.settings-item:last-child { border-bottom: none; }

/* ── F.A.Q. ─────────────────────────────────────────────────────────────── */
.faq-list { list-style: none; padding: 0; margin: 0; }
.faq-list li { padding: .9rem 0; border-bottom: 1px solid var(--color-border); }
.faq-list li:last-child { border-bottom: none; }
.faq-q { font-weight: 600; margin: 0 0 .3rem; }
.faq-a { color: var(--color-text-muted); font-size: .9rem; margin: 0; }

/* ── Message Board (mockup only — no posting mechanism yet) ────────────── */
.board-list { list-style: none; padding: 0; margin: 0; }
.board-list__item { padding: 1rem 0; border-bottom: 1px solid var(--color-border); }
.board-list__item:last-child { border-bottom: none; }
.board-list__title { font-weight: 600; margin: 0 0 .25rem; }
.board-list__title--pinned::before { content: "📌 "; }
.board-list__meta { font-size: .8rem; color: var(--color-text-muted); margin: 0 0 .4rem; }
.board-list__excerpt { font-size: .9rem; color: var(--color-text-muted); margin: 0; }

/* ── Hub page: Reports / Calendar mockup lists (no backend yet) ─────────── */
.info-list { list-style: none; padding: 0; margin: 0; }
.info-list__item {
  display: flex;
  align-items: baseline;
  gap: .75rem;
  padding: .75rem 0;
  border-bottom: 1px solid var(--color-border);
  font-size: .9rem;
}
.info-list__item:last-child { border-bottom: none; }
.info-list__label { color: var(--color-text-muted); font-size: .8rem; flex-shrink: 0; width: 5.5rem; }
.info-list__title { flex: 1; font-weight: 500; }
.info-list__meta { color: var(--color-text-muted); font-size: .8rem; }
.badge--count { background: var(--color-warn-tint); color: var(--color-warn-text); border: 1px solid var(--color-warn); font-size: .75rem; vertical-align: middle; margin-left: .25rem; }

/* ── Page header ────────────────────────────────────────────────────────── */
.page-header { margin-bottom: 1.5rem; }
.page-header h1 { margin: 0; font-size: 1.6rem; }

/* ── Forms ──────────────────────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: .25rem; margin-bottom: 1rem; }
label { font-size: .85rem; font-weight: 600; color: var(--color-text); }
input[type="text"],
input[type="email"],
input[type="password"] {
  padding: .5rem .75rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: .95rem;
  width: 100%;
  background: var(--color-surface);
}
input:focus { outline: 2px solid var(--color-accent); outline-offset: 1px; border-color: transparent; }

/* ── Buttons ────────────────────────────────────────────────────────────── */
.btn, button[type="submit"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: .5rem 1.1rem;
  border: none;
  border-radius: var(--radius);
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  background: var(--color-accent);
  color: #fff;
  transition: opacity .15s;
}
.btn:hover, button[type="submit"]:hover { opacity: .88; }
.btn:disabled, button[type="submit"]:disabled { opacity: .4; cursor: not-allowed; pointer-events: none; }
.btn.btn--ghost {
  background: transparent;
  border: 1px solid var(--color-border-strong);
  color: var(--color-text);
}
.btn.btn--ghost:hover { background: var(--color-bg); opacity: 1; }
/* dark-header variant (Sign out lives in the navbar cover) */
.navbar .btn--ghost {
  border-color: rgba(255, 255, 255, .28);
  color: var(--color-cover-text);
}
.navbar .btn--ghost:hover { background: rgba(255, 255, 255, .12); }
.btn--sm { padding: .3rem .7rem; font-size: .8rem; }

/* ── Utility ────────────────────────────────────────────────────────────── */
.muted { color: var(--color-text-muted); font-size: .9rem; }
p { margin: .5rem 0; }
.hidden { display: none !important; }
.breadcrumb { font-size: .85rem; color: var(--color-text-muted); display: block; margin-bottom: .25rem; }
.breadcrumb:hover { color: var(--color-accent); text-decoration: none; }

/* ── Page header row ────────────────────────────────────────────────────── */
.page-header__row { display: flex; justify-content: space-between; align-items: flex-start; }
.page-header__actions { display: flex; gap: .5rem; align-items: center; padding-top: .25rem; }

/* ── Phase 2.F hub skin — optional per-hub logo, Tier-2 pages only ─────────── */
.hub-skin-logo { height: 1.75rem; max-width: 10rem; object-fit: contain; display: block; margin-bottom: .25rem; }

/* ── Card header ────────────────────────────────────────────────────────── */
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: .75rem; }
.card-header h2 { margin: 0; }
.form-actions { display: flex; gap: .75rem; margin-top: .75rem; }
.btn--full { width: 100%; }

/* ── Badges ─────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: .15rem .55rem;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 600;
  text-transform: lowercase;
  letter-spacing: .01em;
  background: var(--color-border);
  color: var(--color-text-muted);
}
.badge--active    { background: var(--color-success-tint); color: var(--color-accent-strong); }
.badge--provisioning { background: var(--color-warn-tint); color: var(--color-warn-text); }
.badge--suspended { background: var(--color-error-tint); color: var(--color-error); }
.badge--dissolved { background: var(--color-border); color: var(--color-text-muted); }
.badge--role      { background: var(--color-info-tint); color: var(--color-info); }
.badge--ai        { background: var(--color-plum-tint); color: var(--color-plum); }
.badge--danger    { background: var(--color-error-tint); color: var(--color-error); }

/* Ticket status badges */
.badge--ticket-open      { background: var(--color-info-tint); color: var(--color-info); }
.badge--ticket-claimed   { background: var(--color-warn-tint); color: var(--color-warn-text); }
.badge--ticket-submitted { background: var(--color-warn-tint); color: var(--color-warn-text); border: 1px solid var(--color-warn); }
.badge--ticket-verified  { background: var(--color-success-tint); color: var(--color-accent); }
.badge--ticket-awarded   { background: var(--color-success-tint); color: var(--color-accent-strong); }
.badge--ticket-closed    { background: var(--color-border); color: var(--color-text-muted); }
.badge--ticket-draft               { background: var(--color-border); color: var(--color-text-muted); }
.badge--ticket-disputed            { background: var(--color-error-tint); color: var(--color-error); }
.badge--ticket-work_in_progress    { background: var(--color-plum-tint); color: var(--color-plum); }
.badge--ticket-counteroffer_pending { background: var(--color-warn-tint); color: var(--color-warn-text); border: 1px solid var(--color-warn); }

/* Period status badges */
.badge--period-open      { background: var(--color-info-tint); color: var(--color-info); }
.badge--period-reporting { background: var(--color-warn-tint); color: var(--color-warn-text); }
.badge--period-finalized { background: var(--color-success-tint); color: var(--color-accent); }

/* ── Hub list ────────────────────────────────────────────────────────────── */
.hub-list { list-style: none; padding: 0; margin: 0; }
.hub-list__item {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .6rem 0;
  border-bottom: 1px solid var(--color-border);
}
.hub-list__item:last-child { border-bottom: none; }
.hub-list__name { font-weight: 500; flex: 1; }

/* ── Ticket list ─────────────────────────────────────────────────────────── */
.project-list { list-style: none; padding: 0; margin: 0; }
.project-row {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .6rem 0;
  border-bottom: 1px solid var(--color-border);
}
.project-row:last-child { border-bottom: none; }
.project-row__name { flex: 1; font-weight: 600; text-decoration: none; color: var(--color-link); }
.project-row__name:hover { text-decoration: underline; }
.project-row__meta { font-size: .8rem; }

.ticket-list { list-style: none; padding: 0; margin: 0; }
.ticket-row {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .6rem 0;
  border-bottom: 1px solid var(--color-border);
}
.ticket-row:last-child { border-bottom: none; }
.ticket-row__title { flex: 1; font-weight: 500; }
.ticket-row__meta { font-size: .8rem; }

/* ── Status filter ───────────────────────────────────────────────────────── */
.status-filter { display: flex; gap: .25rem; flex-wrap: wrap; margin-bottom: .75rem; }
.filter-btn {
  position: relative;
  padding: .25rem .6rem;
  border-radius: var(--radius);
  font-size: .8rem;
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
}
.filter-btn:hover { text-decoration: none; border-color: var(--color-accent); color: var(--color-accent); }
.filter-btn--active { background: var(--color-accent); color: #fff; border-color: var(--color-accent); }

.filter-btn[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--color-cover);
  color: var(--color-cover-text);
  font-size: .75rem;
  font-weight: 400;
  white-space: nowrap;
  padding: .3rem .6rem;
  border-radius: 4px;
  pointer-events: none;
  opacity: 0;
  transition: opacity .15s;
  z-index: 200;
}
.filter-btn[data-tooltip]:hover::after { opacity: 1; }

/* ── Ticket detail layout ────────────────────────────────────────────────── */
.ticket-layout { display: grid; grid-template-columns: 1fr 280px; gap: 1.25rem; align-items: start; }
@media (max-width: 680px) { .ticket-layout { grid-template-columns: 1fr; } }
.ticket-body { display: flex; flex-direction: column; gap: 1.25rem; }
.ticket-sidebar { display: flex; flex-direction: column; gap: 1.25rem; }
.ticket-description { white-space: pre-wrap; line-height: 1.6; }

/* ── Detail list ─────────────────────────────────────────────────────────── */
dl.detail-list { display: grid; grid-template-columns: max-content 1fr; gap: .3rem .75rem; }
dl.detail-list dt { font-size: .8rem; font-weight: 600; color: var(--color-text-muted); padding-top: .1rem; }
dl.detail-list dd { margin: 0; font-size: .9rem; }

/* ── Period list ─────────────────────────────────────────────────────────── */
.period-list { list-style: none; padding: 0; margin: 0; }
.period-row { display: flex; align-items: center; gap: .5rem; padding: .4rem 0; border-bottom: 1px solid var(--color-border); }
.period-row:last-child { border-bottom: none; }
.period-row__quarter { font-weight: 600; font-size: .9rem; flex: 1; }

/* ── Refuse submission ───────────────────────────────────────────────────── */
.action-divider { border: none; border-top: 1px solid var(--color-border); margin: 1rem 0 .75rem; }
.refuse-heading { font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--color-error); margin-bottom: .5rem; }
.refuse-form { }
.refuse-fieldset { border: 1px solid var(--color-border); border-radius: var(--radius); padding: .5rem .75rem .75rem; margin-bottom: .75rem; }
.refuse-fieldset legend { font-size: .8rem; font-weight: 600; color: var(--color-text-muted); padding: 0 .25rem; }
.checkbox-label { display: flex; align-items: flex-start; gap: .5rem; font-size: .875rem; padding: .25rem 0; cursor: pointer; }
.checkbox-label input[type=checkbox] { margin-top: .2rem; flex-shrink: 0; }
.field-optional { font-weight: 400; font-size: .8rem; color: var(--color-text-muted); }

/* ── Ticket history ──────────────────────────────────────────────────────── */
.ticket-history h2 { margin-bottom: .75rem; }
.history-list { list-style: none; padding: 0; margin: 0; }
.history-row { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; padding: .35rem 0; border-bottom: 1px solid var(--color-border); font-size: .9rem; }
.history-row:last-child { border-bottom: none; }
.history-row__label { flex: 1; }
.history-row__date { white-space: nowrap; font-size: .8rem; }
.history-row--refused .history-row__label { color: var(--color-error); }
.history-row__note { display: block; font-size: .8rem; color: var(--color-text-muted); white-space: pre-wrap; margin-top: .2rem; }

/* ── Ticket create form ──────────────────────────────────────────────────── */
.ticket-create-form { border-top: 1px solid var(--color-border); padding-top: 1rem; margin-bottom: 1rem; }
textarea { width: 100%; padding: .5rem .75rem; border: 1px solid var(--color-border); border-radius: var(--radius); font-size: .95rem; font-family: inherit; resize: vertical; }
textarea:focus { outline: 2px solid var(--color-accent); outline-offset: 1px; border-color: transparent; }
select { padding: .5rem .75rem; border: 1px solid var(--color-border); border-radius: var(--radius); font-size: .95rem; width: 100%; background: var(--color-surface); }
select:focus { outline: 2px solid var(--color-accent); outline-offset: 1px; border-color: transparent; }

/* ── Offer box (ticket open state) ──────────────────────────────────────── */
.offer-box {
  text-align: center;
  padding: .75rem;
  background: var(--color-success-tint);
  border: 1px solid var(--color-accent);
  border-radius: var(--radius);
  margin-bottom: .75rem;
}
.offer-box__pts { font-family: var(--font-mono); font-size: 1.75rem; font-weight: 700; color: var(--color-accent-strong); line-height: 1.1; font-variant-numeric: tabular-nums; }
.offer-box__unit { font-size: 1rem; font-weight: 600; }
.offer-box__hours { font-size: .85rem; margin-top: .2rem; }

/* ── Counteroffer ─────────────────────────────────────────────────────────── */
.counteroffer-details { margin-top: .25rem; }
.counteroffer-toggle {
  cursor: pointer;
  font-size: .875rem;
  color: var(--color-text-muted);
  padding: .35rem 0;
  list-style: none;
}
.counteroffer-toggle:hover { color: var(--color-accent); }
.counteroffer-toggle::marker, .counteroffer-toggle::-webkit-details-marker { display: none; }
.counteroffer-toggle::before { content: "+ "; }
details[open] .counteroffer-toggle::before { content: "− "; }
.counteroffer-form { padding-top: .75rem; border-top: 1px solid var(--color-border); margin-top: .35rem; }
.cop-note { font-style: italic; font-size: .85rem; }
.cop-review, .cop-status { }

/* ── Acceptance criteria ─────────────────────────────────────────────────── */
.ac-list { margin: 0; padding-left: 1.25rem; }
.ac-item { font-size: .9rem; padding: .2rem 0; line-height: 1.5; }

/* ── Button variants ─────────────────────────────────────────────────────── */
/* Variant selectors carry `.btn` (specificity 0,2,0) so they win over the
   base `button[type="submit"]` rule (0,1,1) on submit buttons like Sign out. */
.btn.btn--secondary {
  background: var(--color-info);
}
.btn.btn--secondary:hover { opacity: .88; }
.btn.btn--warn {
  background: var(--color-warn);
}
.btn.btn--ghost-danger {
  background: transparent;
  border: 1px solid var(--color-error);
  color: var(--color-error);
}
.btn.btn--ghost-danger:hover { background: var(--color-error-tint); opacity: 1; }

/* ── Onboarding ──────────────────────────────────────────────────────────── */
.onboarding-stages {
  display: flex;
  gap: 0;
  margin-bottom: 1.5rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--color-surface);
}
.onboarding-stage {
  flex: 1;
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .75rem 1rem;
  font-size: .875rem;
  color: var(--color-text-muted);
  border-right: 1px solid var(--color-border);
}
.onboarding-stage:last-child { border-right: none; }
.onboarding-stage--active { color: var(--color-accent); font-weight: 600; background: var(--color-accent-tint); }
.onboarding-stage--done   { color: var(--color-success); }
.stage-num {
  width: 1.4rem;
  height: 1.4rem;
  border-radius: 50%;
  background: currentColor;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .7rem;
  font-weight: 700;
  flex-shrink: 0;
}
.onboarding-stage .stage-num { background: var(--color-border); color: var(--color-text-muted); }
.onboarding-stage--active .stage-num { background: var(--color-accent); color: #fff; }
.onboarding-stage--done .stage-num { background: var(--color-success); color: #fff; }
.onboarding-details summary { cursor: pointer; }
.onboarding-details summary:hover { color: var(--color-accent); }
.choice-grid {
  display: grid;
  gap: .875rem;
  max-width: 480px;
  margin: 1.25rem 0;
}
@media (min-width: 480px) { .choice-grid { grid-template-columns: 1fr 1fr; } }
.choice-card {
  text-align: left;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  cursor: pointer;
  font: inherit;
  color: var(--color-text);
}
.choice-card:hover { border-color: var(--color-accent); }
.choice-card__title { font-family: var(--font-display); font-weight: 600; margin: 0 0 .3rem; }
.choice-card__desc { font-size: .85rem; color: var(--color-text-muted); margin: 0; line-height: 1.5; }
.onboarding-choice-panel {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--color-border);
}

/* ── Agreement modal (dialog) ──────────────────────────────────────────── */
dialog.agreement-modal {
  display: none;
  padding: 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: 0 8px 40px rgb(30 28 25 / .18);
  max-width: 42rem;
  width: 90vw;
  max-height: 85vh;
}
dialog.agreement-modal[open] {
  display: flex;
  flex-direction: column;
}
dialog.agreement-modal::backdrop { background: rgb(30 28 25 / .45); }
.agreement-modal__header {
  padding: 1rem 1.25rem .85rem;
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}
.agreement-modal__header h2 { margin: 0; font-size: 1.1rem; }
.agreement-modal__body {
  padding: 1rem 1.25rem;
  overflow-y: auto;
  flex: 1;
  font-size: .9rem;
  line-height: 1.65;
}
.agreement-modal__body h3 { margin: 1rem 0 .35rem; font-size: 1rem; }
.agreement-modal__body ul { padding-left: 1.3rem; margin: .3rem 0; }
.agreement-modal__body li { margin-bottom: .3rem; }
.agreement-modal__summary {
  padding: .75rem 1.25rem;
  background: var(--color-bg);
  border-top: 1px dashed var(--color-border);
  font-size: .875rem;
  line-height: 1.6;
  flex-shrink: 0;
}
.agreement-modal__footer {
  padding: .85rem 1.25rem;
  border-top: 1px solid var(--color-border);
  display: flex;
  gap: .75rem;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  flex-wrap: wrap;
}
.agreement-modal__footer-left { display: flex; gap: .5rem; flex-wrap: wrap; }

/* ── Points history table ───────────────────────────────────────────────── */
.pts-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.pts-table th { text-align: left; padding: .4rem .75rem; border-bottom: 2px solid var(--color-border); font-size: .8rem; color: var(--color-text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.pts-table td { padding: .5rem .75rem; border-bottom: 1px solid var(--color-border); vertical-align: middle; }
.pts-table tfoot td { border-top: 2px solid var(--color-border); border-bottom: none; font-weight: 600; }
.pts-table__num { text-align: right; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.pts-table__total-label { text-align: right; color: var(--color-text-muted); font-size: .85rem; }
.pts-row__quarter { white-space: nowrap; color: var(--color-text-muted); font-size: .85rem; }
.badge--pts-finalized { background: var(--color-success-tint); color: var(--color-accent-strong); }
.badge--pts-proposed  { background: var(--color-warn-tint); color: var(--color-warn-text); }
.badge--pts-feedback  { background: var(--color-info-tint); color: var(--color-info); }
.badge--pts-disputed  { background: var(--color-error-tint); color: var(--color-error); }

/* ── Certification queue ─────────────────────────────────────────────────── */
.agreement-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; }
.agreement-list__item { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding: .75rem 0; border-bottom: 1px solid var(--color-border); }
.agreement-list__item:last-child { border-bottom: none; }
.agreement-list__meta { display: flex; flex-direction: column; gap: .2rem; flex: 1; min-width: 0; }
.agreement-list__actions { display: flex; gap: .5rem; flex-shrink: 0; }
.agreement-modal--sm { max-width: 28rem; }
.cert-queue { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .75rem; }
.cert-queue__item { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding: .6rem 0; border-bottom: 1px solid var(--color-border); }
.cert-queue__item:last-child { border-bottom: none; }
.cert-queue__who { display: flex; flex-direction: column; gap: .2rem; }
.cert-form-expand summary { list-style: none; cursor: pointer; }
.cert-form-expand summary::-webkit-details-marker { display: none; }
.cert-form { display: flex; flex-direction: column; gap: .6rem; margin-top: .75rem; padding: .75rem; background: var(--color-bg); border: 1px solid var(--color-border); border-radius: var(--radius); min-width: 16rem; }
.field-check { display: flex; align-items: flex-start; gap: .5rem; font-size: .9rem; }
.field-check input[type="checkbox"] { margin-top: .15rem; flex-shrink: 0; }

/* ── Attribution seal (Tier-1 invariant + brand signature) ──────────────── */
.attribution {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: var(--space-5) var(--space-4) var(--space-4);
  font-size: .8rem;
  color: var(--color-text-muted);
}
.attribution__seal {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .3rem .7rem;
  border: 1px solid var(--color-border-strong);
  border-radius: 999px;
  background: var(--color-surface);
  font-family: var(--font-display);
  letter-spacing: .02em;
  color: var(--color-accent-strong);
}
.attribution__mark { font-weight: 700; }

/* ── Focus visibility (a11y — keyboard) ─────────────────────────────────── */
a:focus-visible,
button:focus-visible,
.btn:focus-visible,
summary:focus-visible,
.filter-btn:focus-visible,
.navbar__brand:focus-visible,
.navbar__links a:focus-visible,
.navbar__name:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}
/* On the dark cover, use the light token so focus stays visible */
.navbar__brand:focus-visible,
.navbar__links a:focus-visible,
.navbar__name:focus-visible,
.navbar .btn--ghost:focus-visible {
  outline-color: var(--color-cover-text);
}

/* ── Responsive (3.U5) — phone-first floor at 375px ─────────────────────── */
@media (max-width: 640px) {
  .content { padding: 1.25rem 1rem; }
  .body--bare { padding: 2rem 1rem; }
  .navbar { padding: 0 1rem; gap: 1rem; }
  .page-header h1 { font-size: 1.35rem; }
  .page-header__row { flex-direction: column; gap: .5rem; }
  .page-header__actions { padding-top: 0; flex-wrap: wrap; }
  .card { padding: 1rem 1.1rem; }
  .auth-page { padding: 1.5rem 1.25rem; }
  /* onboarding stepper stacks vertically instead of squeezing across */
  .onboarding-stages { flex-direction: column; }
  .onboarding-stage { border-right: none; border-bottom: 1px solid var(--color-border); }
  .onboarding-stage:last-child { border-bottom: none; }
  /* agreement dialog: full-width stacked footer buttons for thumbs */
  .agreement-modal__footer { flex-direction: column; align-items: stretch; }
  .agreement-modal__footer-left { justify-content: stretch; }
  .agreement-modal__footer .btn,
  .agreement-modal__footer button { width: 100%; }
}
@media (max-width: 440px) {
  /* brand already links to the dashboard, so drop the redundant nav link */
  .navbar__links { display: none; }
}
@media (max-width: 520px) {
  /* wide tables scroll inside their card rather than forcing page-wide scroll */
  .card { overflow-x: auto; }
}
