/* =========================================================================
   CCH Design System v2 — Heritage palette · Atkinson Hyperlegible

   Tokens + base + components + minimal layout helpers.
   Hand-rolled CSS — no Tailwind, no build step.

   Source of truth for tokens: the v2 handoff README (Heritage palette).
   Page-specific layout lives inline in the corresponding template.
   ========================================================================= */

/* ---------- 1. TOKENS -------------------------------------------------- */
:root {
  /* Surfaces — warm cream */
  --surface-0:           #F4F0E0;
  --surface-1:           #ECE5CC;
  --surface-2:           #DDD4B6;
  --surface-line:        #C8C2AE;
  --surface-line-strong: #A89F84;
  --surface-paper:       #FFFFFF;

  /* Ink — slate blue (never pure black) */
  --ink-1: #2A3645;
  --ink-2: #46566A;
  --ink-3: #6B7686;
  --ink-4: #8E97A4;

  /* Terracotta ramp */
  --terracotta-50:  #FDF0EA;
  --terracotta-100: #F9DACA;
  --terracotta-200: #F5B89A;
  --terracotta-300: #F38F66;
  --terracotta-400: #F2744B;  /* heritage hue — decorative ≥ 24px only */
  --terracotta-500: #D85B30;  /* default CTA, body-size safe */
  --terracotta-600: #B34620;
  --terracotta-700: #8B3214;  /* AAA — prices, inline links */
  --terracotta-800: #5C2010;
  --terracotta-900: #3D150A;

  --brand:             var(--terracotta-500);
  --brand-hover:       var(--terracotta-600);
  --brand-press:       var(--terracotta-700);
  --brand-deep:        var(--terracotta-700);
  --brand-tint:        var(--terracotta-100);
  --brand-tint-strong: var(--terracotta-200);
  --brand-decorative:  var(--terracotta-400);
  --brand-on:          #FFFFFF;

  /* Sage — verified / premier / success */
  --sage-100: #D8E9DF;
  --sage-300: #8CBDA8;
  --sage-500: #5C9277;
  --sage-700: #355A48;
  --premier:      var(--sage-500);
  --premier-soft: var(--sage-100);
  --premier-deep: var(--sage-700);

  /* Alert — price drops / errors only */
  --alert:      #B3261E;
  --alert-soft: #F4DBD7;  /* tuned for cream surface */
  --alert-deep: #7F1A14;

  /* Info — neutral notice */
  --info:      #2D5BA8;
  --info-soft: #E2E9F4;
  --info-deep: #1A3F7A;

  /* Heritage yellow — callout backgrounds only */
  --yellow:      #F0BA3A;
  --yellow-soft: #FAEBC4;
  --yellow-deep: #8A5A14;

  /* Focus ring — hue-distinct from brand */
  --focus-ring:      #2D5BA8;
  --focus-ring-soft: rgba(45, 91, 168, 0.25);

  /* Type */
  --font-sans: 'Atkinson Hyperlegible', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;

  --fs-xs:   14px;  --lh-xs:   1.45;
  --fs-sm:   16px;  --lh-sm:   1.50;
  --fs-base: 18px;  --lh-base: 1.55;
  --fs-md:   20px;  --lh-md:   1.50;
  --fs-lg:   24px;  --lh-lg:   1.40;
  --fs-xl:   32px;  --lh-xl:   1.20;
  --fs-2xl:  40px;  --lh-2xl:  1.15;
  --fs-3xl:  56px;  --lh-3xl:  1.05;
  --fs-4xl:  80px;  --lh-4xl:  0.98;

  /* Spacing (4px base) */
  --sp-1:  4px;  --sp-2:  8px;  --sp-3:  12px; --sp-4:  16px;
  --sp-5:  20px; --sp-6:  24px; --sp-7:  32px; --sp-8:  40px;
  --sp-9:  48px; --sp-10: 64px; --sp-11: 80px; --sp-12: 120px;

  /* Radii */
  --r-sm:   8px;
  --r-md:   12px;
  --r-lg:   16px;
  --r-xl:   24px;
  --r-pill: 999px;

  /* Shadows — warm brown drops */
  --el-1: 0 1px 2px rgba(50, 40, 20, 0.06);
  --el-2: 0 2px 6px rgba(50, 40, 20, 0.08), 0 1px 2px rgba(50, 40, 20, 0.04);
  --el-3: 0 8px 24px rgba(50, 40, 20, 0.10), 0 2px 6px rgba(50, 40, 20, 0.06);
  --el-4: 0 20px 48px rgba(50, 40, 20, 0.14), 0 4px 12px rgba(50, 40, 20, 0.08);

  /* Touch */
  --hit-min: 48px;
  --hit-tap: 56px;

  /* Motion */
  --ease:     cubic-bezier(0.2, 0, 0, 1);
  --dur-fast: 140ms;
  --dur-base: 220ms;

  /* Layout */
  --sidebar-w: 260px;
  --container: 1280px;
}

/* ---------- 2. BASE / RESET -------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: var(--lh-base);
  color: var(--ink-1);
  background: var(--surface-0);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg { display: block; max-width: 100%; height: auto; }
button { font-family: inherit; }
a { color: var(--brand-deep); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--brand-press); }

:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 3px;
  border-radius: 4px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---------- 3. TYPE CLASSES -------------------------------------------- */
.t-display { font-weight: 700; font-size: var(--fs-4xl); line-height: var(--lh-4xl); letter-spacing: -0.025em; }
.t-h1      { font-weight: 700; font-size: var(--fs-3xl); line-height: var(--lh-3xl); letter-spacing: -0.02em;  }
.t-h2      { font-weight: 700; font-size: var(--fs-2xl); line-height: var(--lh-2xl); letter-spacing: -0.015em; }
.t-h3      { font-weight: 700; font-size: var(--fs-xl);  line-height: var(--lh-xl);  letter-spacing: -0.01em;  }
.t-h4      { font-weight: 700; font-size: var(--fs-lg);  line-height: var(--lh-lg); }
.t-body-lg { font-weight: 400; font-size: var(--fs-md);  line-height: var(--lh-md); }
.t-body    { font-weight: 400; font-size: var(--fs-base); line-height: var(--lh-base); }
.t-body-sm { font-weight: 400; font-size: var(--fs-sm);  line-height: var(--lh-sm); }
.t-caption { font-weight: 400; font-size: var(--fs-sm);  line-height: var(--lh-sm); color: var(--ink-3); }
.t-label {
  font-weight: 700; font-size: var(--fs-sm); line-height: 1.3;
  letter-spacing: 0.06em; color: var(--ink-3); text-transform: uppercase;
}
.t-overline {
  font-weight: 700; font-size: var(--fs-xs); line-height: 1.3;
  letter-spacing: 0.18em; color: var(--brand-deep); text-transform: uppercase;
}
.mono { font-family: var(--font-mono); font-size: 13px; }

.text-ink-1 { color: var(--ink-1); }
.text-ink-2 { color: var(--ink-2); }
.text-ink-3 { color: var(--ink-3); }
.text-brand-deep { color: var(--brand-deep); }
.text-alert-deep { color: var(--alert-deep); }

/* ---------- 4. BUTTONS ------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: var(--sp-2);
  min-height: var(--hit-tap);
  padding: 0 var(--sp-7);
  font-family: inherit; font-size: 17px; font-weight: 700;
  text-decoration: none;
  border-radius: var(--r-md);
  border: 2px solid transparent;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease),
              border-color var(--dur-fast) var(--ease),
              color var(--dur-fast) var(--ease);
}
.btn-primary {
  background: var(--brand); color: var(--brand-on); border-color: var(--brand);
}
.btn-primary:hover  { background: var(--brand-hover); border-color: var(--brand-hover); color: var(--brand-on); }
.btn-primary:active { background: var(--brand-press); border-color: var(--brand-press); }

.btn-secondary {
  background: transparent; color: var(--ink-1); border-color: var(--ink-1);
}
.btn-secondary:hover { background: var(--ink-1); color: var(--surface-0); }

.btn-ghost {
  background: transparent; color: var(--brand-deep); border-color: transparent;
  min-height: auto; padding: var(--sp-2) var(--sp-4);
}
.btn-ghost:hover { background: var(--brand-tint); color: var(--brand-press); }

.btn-sm { min-height: var(--hit-min); padding: 0 var(--sp-5); font-size: var(--fs-sm); }

.btn[disabled], .btn[aria-disabled="true"] {
  background: var(--surface-2); color: var(--ink-4); border-color: var(--surface-2);
  cursor: not-allowed;
}

/* ---------- 5. CHIPS / BADGES ----------------------------------------- */
.chip {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  height: 32px; padding: 0 var(--sp-4);
  font-size: var(--fs-xs); font-weight: 700; line-height: 1;
  border-radius: var(--r-pill);
  background: var(--surface-1); color: var(--ink-1);
  border: 1px solid var(--surface-line);
  white-space: nowrap;
}
.chip-premier { background: var(--premier-soft); color: var(--premier-deep); border-color: transparent; }
.chip-alert   { background: var(--alert-soft);   color: var(--alert-deep);   border-color: transparent; }
.chip-brand   { background: var(--brand-tint);   color: var(--brand-deep);   border-color: transparent; }
.chip-info    { background: var(--info-soft);    color: var(--info-deep);    border-color: transparent; }
.chip-dot::before {
  content: ""; width: 8px; height: 8px; border-radius: 999px;
  background: currentColor; opacity: 0.65;
}

/* ---------- 6. FORM INPUTS -------------------------------------------- */
.field { display: flex; flex-direction: column; gap: var(--sp-2); }
.field-label {
  font-size: var(--fs-sm); font-weight: 700; color: var(--ink-2);
}
.field-help { font-size: var(--fs-sm); color: var(--ink-3); }
.field-error { font-size: var(--fs-sm); color: var(--alert-deep); }
.input, .select, .textarea {
  width: 100%;
  min-height: var(--hit-tap);
  padding: 0 var(--sp-4);
  font: inherit; font-size: var(--fs-base); color: var(--ink-1);
  background: var(--surface-paper);
  border: 2px solid var(--surface-line);
  border-radius: var(--r-md);
  transition: border-color var(--dur-fast) var(--ease);
}
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--brand);
}

/* Password input with reveal toggle. <div class="input-reveal"> wraps an
   .input and a button.input-reveal-btn that toggles type=password/text. */
.input-reveal { position: relative; }
.input-reveal .input { padding-right: 52px; }
.input-reveal-btn {
  position: absolute; top: 0; right: 0;
  height: 100%; width: 44px;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: none; cursor: pointer;
  color: var(--ink-3);
  border-radius: var(--r-md);
}
.input-reveal-btn:hover { color: var(--ink-1); }
.input-reveal-btn .eye-off { display: none; }
.input-reveal[data-shown="1"] .eye-on  { display: none; }
.input-reveal[data-shown="1"] .eye-off { display: inline; }
.field.is-error .input,
.field.is-error .select,
.field.is-error .textarea { border-color: var(--alert); }
.textarea { padding: var(--sp-3) var(--sp-4); min-height: 120px; resize: vertical; line-height: var(--lh-base); }
.select {
  appearance: none;
  padding-right: var(--sp-9);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path d='M1 1l5 5 5-5' stroke='%232A3645' stroke-width='2' fill='none' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right var(--sp-5) center;
}

/* Inline form (hero, final CTA): input + button on one row. */
.form-inline {
  display: flex; gap: var(--sp-3); align-items: stretch;
  max-width: 520px;
}
.form-inline .input { flex: 1; }
@media (max-width: 640px) {
  .form-inline { flex-direction: column; }
  .form-inline .btn { width: 100%; }
}

/* ---------- 7. CARDS -------------------------------------------------- */
.card {
  background: var(--surface-paper);
  border: 1px solid var(--surface-line);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.card-sunken {
  background: var(--surface-1);
  border: 1px solid var(--surface-line);
  border-radius: var(--r-lg);
}
.card-pad { padding: var(--sp-6); }
.card-pad-lg { padding: var(--sp-8); }

/* ---------- 8. PROPERTY CARD ------------------------------------------ */
.property-card {
  display: flex; flex-direction: column;
  background: var(--surface-paper);
  border: 1px solid var(--surface-line);
  border-radius: var(--r-lg);
  box-shadow: var(--el-2);
  overflow: hidden;
  transition: transform var(--dur-fast) var(--ease),
              border-color var(--dur-fast) var(--ease),
              box-shadow var(--dur-fast) var(--ease);
}
.property-card:hover {
  transform: translateY(-3px);
  border-color: var(--ink-3);
  box-shadow: var(--el-3);
}
.property-card-img {
  position: relative;
  aspect-ratio: 4 / 3;
  background: var(--surface-1);
  overflow: hidden;
}
.property-card-img img,
.property-card-img > a {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.property-card-badge {
  position: absolute; top: var(--sp-4); left: var(--sp-4);
}
.property-card-fav {
  position: absolute; top: var(--sp-4); right: var(--sp-4);
}
.property-card-body { padding: var(--sp-7); display: flex; flex-direction: column; gap: var(--sp-4); }
.property-card-body--compact { padding: var(--sp-5); gap: var(--sp-3); }
.property-card-loc-row {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: var(--sp-3);
}
.property-card-loc { color: var(--ink-1); }
.property-card-price { color: var(--brand-deep); white-space: nowrap; }
.property-card-price--drop { color: var(--alert-deep); }
.property-card-price-old {
  color: var(--ink-3); text-decoration: line-through;
  font-size: var(--fs-sm); font-weight: 400;
}
.property-card-meta {
  display: flex; flex-wrap: wrap; gap: var(--sp-2);
}
.property-card-desc {
  color: var(--ink-2);
  display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical;
  overflow: hidden;
}
.property-card .btn { width: 100%; }

/* ---------- 9. KPI TILE ----------------------------------------------- */
.kpi {
  background: var(--surface-paper);
  border: 1px solid var(--surface-line);
  border-radius: var(--r-lg);
  padding: var(--sp-6);
  display: flex; flex-direction: column; gap: var(--sp-2);
}
.kpi-value {
  font-size: var(--fs-2xl); font-weight: 700; letter-spacing: -0.02em;
  color: var(--ink-1); line-height: 1;
}
.kpi-value--muted { color: var(--ink-4); }
.kpi-sub { font-size: var(--fs-xs); color: var(--ink-3); }
.kpi-sub--up   { color: var(--premier-deep); }
.kpi-sub--down { color: var(--alert-deep); }

/* ---------- 10. ACTIVITY ROW ------------------------------------------ */
.activity-row {
  display: grid; grid-template-columns: 56px 1fr auto;
  gap: var(--sp-4); align-items: center;
  padding: var(--sp-4) 0;
  border-bottom: 1px solid var(--surface-line);
}
.activity-row:last-child { border-bottom: none; }
.activity-icon {
  width: 44px; height: 44px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--r-md);
  background: var(--brand-tint); color: var(--brand-deep);
}
.activity-icon--premier { background: var(--premier-soft); color: var(--premier-deep); }
.activity-icon--alert   { background: var(--alert-soft);   color: var(--alert-deep); }
.activity-icon--info    { background: var(--info-soft);    color: var(--info-deep); }
.activity-title { color: var(--ink-1); font-weight: 700; }
.activity-meta  { color: var(--ink-3); font-size: var(--fs-xs); }
.activity-cta {
  color: var(--brand-deep); font-size: var(--fs-xs); font-weight: 700;
  text-decoration: none;
}
.activity-cta:hover { color: var(--brand-press); }

/* Empty state for activity / sections without content. */
.empty-state {
  padding: var(--sp-8) var(--sp-6);
  text-align: center;
  background: var(--surface-1);
  border-radius: var(--r-lg);
  color: var(--ink-3);
}

/* ---------- 11. ISSUE CARD -------------------------------------------- */
.issue-card {
  background: var(--surface-paper);
  border: 1px solid var(--surface-line);
  border-radius: var(--r-lg);
  overflow: hidden;
  display: flex; flex-direction: column;
  transition: transform var(--dur-fast) var(--ease),
              border-color var(--dur-fast) var(--ease);
}
.issue-card:hover { transform: translateY(-3px); border-color: var(--ink-3); }
.issue-card-strip {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px;
  aspect-ratio: 3 / 1;
  background: var(--surface-1);
}
.issue-card-strip > img,
.issue-card-strip > div {
  width: 100%; height: 100%;
  object-fit: cover;
  background: var(--surface-2);
}
.issue-card-body { padding: var(--sp-5); display: flex; flex-direction: column; gap: var(--sp-2); }

/* ---------- 12. APP TOPNAV (auth shell) ------------------------------ */
/* Per CCH Dashboard.html — sticky horizontal nav across the top of the
   page for authenticated users. Replaces the earlier sidebar shell. */
.appnav {
  background: var(--surface-0);
  border-bottom: 1px solid var(--surface-line);
  position: sticky; top: 0; z-index: 50;
}
.appnav-inner {
  max-width: var(--container);
  margin: 0 auto;
  padding: var(--sp-4) var(--sp-7);
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-6);
}
.appnav-left {
  display: flex; align-items: center; gap: var(--sp-9);
  min-width: 0; flex: 1;
}
.appnav-brand {
  display: flex; align-items: center; gap: var(--sp-2);
  text-decoration: none; color: var(--ink-1); font-weight: 700; font-size: 18px;
  flex-shrink: 0;
}
.appnav-links {
  display: flex; align-items: center; gap: var(--sp-6);
  flex-wrap: wrap;
}
.appnav-links a {
  font-size: var(--fs-sm); font-weight: 700; color: var(--ink-2);
  text-decoration: none;
  padding: var(--sp-2) var(--sp-1);
  border-bottom: 2px solid transparent;
  transition: color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
.appnav-links a:hover { color: var(--brand-deep); }
.appnav-links a.is-active {
  color: var(--ink-1);
  border-bottom-color: var(--brand);
}
.appnav-links a[aria-disabled="true"] { color: var(--ink-4); cursor: not-allowed; }
.appnav-links a[aria-disabled="true"]:hover { color: var(--ink-4); }
.appnav-link-count {
  color: var(--brand-deep); font-weight: 700; margin-left: 4px;
}
/* Staff-only links (Admin) — flagged with info-blue so they read as
   "operator context", not part of the regular reader navigation. */
.appnav-links a.is-staff { color: var(--info-deep); }
.appnav-links a.is-staff:hover { color: var(--info); }
.appnav-links a.is-staff.is-active { color: var(--info-deep); border-bottom-color: var(--info); }
.appnav-links a.is-staff::before {
  content: ""; display: inline-block;
  width: 6px; height: 6px; border-radius: 999px;
  background: var(--info); margin-right: 6px; vertical-align: middle;
}

/* Account chip — pill on the right. <details> for dropdown. */
.account-chip {
  position: relative;
  flex-shrink: 0;
}
.account-chip > summary {
  list-style: none; cursor: pointer;
  display: flex; align-items: center; gap: var(--sp-3);
  padding: 4px 14px 4px 4px;
  background: var(--surface-paper);
  border: 1px solid var(--surface-line);
  border-radius: var(--r-pill);
  color: var(--ink-1);
  transition: border-color var(--dur-fast) var(--ease);
}
.account-chip > summary:hover { border-color: var(--ink-3); }
.account-chip > summary::-webkit-details-marker { display: none; }
.account-chip > summary::marker { content: ""; }
.account-meta {
  display: flex; flex-direction: column; line-height: 1.15;
  text-align: left;
}
.account-meta strong { font-size: var(--fs-sm); color: var(--ink-1); }
.account-meta span   { font-size: 12px; color: var(--ink-3); }
.account-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0; min-width: 220px;
  background: var(--surface-paper);
  border: 1px solid var(--surface-line);
  border-radius: var(--r-md);
  box-shadow: var(--el-3);
  padding: var(--sp-2);
  display: flex; flex-direction: column;
  z-index: 60;
}
.account-menu a, .account-menu button {
  display: flex; align-items: center;
  min-height: 40px; padding: 0 var(--sp-3);
  border-radius: var(--r-sm);
  color: var(--ink-2); text-decoration: none;
  font: inherit; font-size: var(--fs-sm); font-weight: 700;
  background: none; border: none; cursor: pointer; text-align: left;
}
.account-menu a:hover, .account-menu button:hover {
  background: var(--surface-1); color: var(--ink-1);
}

.avatar {
  width: 36px; height: 36px; border-radius: var(--r-pill);
  background: var(--brand); color: var(--brand-on);
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; text-transform: uppercase;
  flex-shrink: 0;
}
.avatar--lg { width: 48px; height: 48px; font-size: var(--fs-md); }

/* Narrow screens — collapse nav links into the account dropdown so the
   topnav still fits on one line. Inline nav reappears above 720px. */
@media (max-width: 720px) {
  .appnav-inner { padding: var(--sp-3) var(--sp-4); }
  .appnav-left { gap: var(--sp-4); }
  .appnav-links { display: none; }
  .account-meta { display: none; }
}

/* ---------- Public top nav (unauth pages: landing, signin, signup,
   subscribe, etc.). Same visual treatment as the auth topnav, but with
   different right-side controls (Log in / Subscribe CTA). */
.publicnav {
  background: var(--surface-0);
  border-bottom: 1px solid var(--surface-line);
  position: sticky; top: 0; z-index: 50;
}
.publicnav-inner {
  max-width: var(--container);
  margin: 0 auto;
  padding: var(--sp-4) var(--sp-7);
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-6);
}
.publicnav-left {
  display: flex; align-items: center; gap: var(--sp-9);
  min-width: 0; flex: 1;
}
.publicnav-brand {
  display: flex; align-items: center; gap: var(--sp-2);
  text-decoration: none; color: var(--ink-1); font-weight: 700; font-size: 18px;
  flex-shrink: 0;
}
.publicnav-links {
  display: flex; align-items: center; gap: var(--sp-6);
}
.publicnav-links a {
  font-size: 15px; font-weight: 700; color: var(--ink-2);
  text-decoration: none; padding: 6px 0;
}
.publicnav-links a:hover { color: var(--brand-deep); }
.publicnav-right {
  display: flex; align-items: center; gap: var(--sp-4);
  flex-shrink: 0;
}
.publicnav-right > a:not(.btn) {
  font-size: 14px; font-weight: 700; color: var(--ink-2);
  text-decoration: none;
}
.publicnav-right > a:not(.btn):hover { color: var(--brand-deep); }
@media (max-width: 720px) {
  .publicnav-inner { padding: var(--sp-3) var(--sp-4); }
  .publicnav-left { gap: var(--sp-4); }
  .publicnav-links { display: none; }
}

/* ---------- 13. APP MAIN / CONTAINERS -------------------------------- */
.main { min-width: 0; }
.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: var(--sp-9) var(--sp-7);
}
.container--narrow { max-width: 880px; }
.container--reading { max-width: 720px; }
@media (max-width: 720px) {
  .container { padding: var(--sp-7) var(--sp-5); }
}

/* ---------- 14. LAYOUT UTILITIES ------------------------------------- */
.stack { display: flex; flex-direction: column; }
.stack-2 { gap: var(--sp-2); } .stack-3 { gap: var(--sp-3); } .stack-4 { gap: var(--sp-4); }
.stack-5 { gap: var(--sp-5); } .stack-6 { gap: var(--sp-6); } .stack-7 { gap: var(--sp-7); }
.stack-8 { gap: var(--sp-8); } .stack-9 { gap: var(--sp-9); } .stack-10 { gap: var(--sp-10); }
.stack-11 { gap: var(--sp-11); }

.row { display: flex; align-items: center; }
.row-baseline { display: flex; align-items: baseline; }
.cluster { display: flex; flex-wrap: wrap; gap: var(--sp-3); align-items: center; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4); }
.gap-2 { gap: var(--sp-2); } .gap-3 { gap: var(--sp-3); } .gap-4 { gap: var(--sp-4); }
.gap-5 { gap: var(--sp-5); } .gap-6 { gap: var(--sp-6); } .gap-7 { gap: var(--sp-7); }

.grid { display: grid; gap: var(--sp-6); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 960px) { .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

.divider { border: none; border-top: 1px solid var(--surface-line); margin: 0; }
.divider-strong { border-top-color: var(--surface-line-strong); }

.section { padding: var(--sp-11) 0; }
.section-tight { padding: var(--sp-9) 0; }

.flash {
  margin-bottom: var(--sp-6);
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-md);
  background: var(--premier-soft); color: var(--premier-deep);
  border: 1px solid var(--premier);
}
.flash-error { background: var(--alert-soft); color: var(--alert-deep); border-color: var(--alert); }

/* ---------- 15. RELEASE BANNER (animated pulse) ---------------------- */
.release-banner {
  display: inline-flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-5);
  background: var(--brand-tint); color: var(--brand-deep);
  border-radius: var(--r-pill);
  text-decoration: none; font-weight: 700; font-size: var(--fs-sm);
}
.release-banner-dot {
  width: 10px; height: 10px; border-radius: 999px;
  background: var(--brand);
  animation: cch-pulse 1.8s infinite;
}
@keyframes cch-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(216, 91, 48, 0.55); }
  70%  { box-shadow: 0 0 0 12px rgba(216, 91, 48, 0);  }
  100% { box-shadow: 0 0 0 0 rgba(216, 91, 48, 0);     }
}
@media (prefers-reduced-motion: reduce) {
  .release-banner-dot { animation: none; }
}

/* ---------- 16. FOOTER (4-col dark ink-1) ---------------------------- */
.footer {
  background: var(--ink-1); color: #C8CEDA;
  padding: var(--sp-11) 0 var(--sp-9);
  margin-top: var(--sp-11);
}
.footer-inner {
  max-width: var(--container); margin: 0 auto; padding: 0 var(--sp-7);
  display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: var(--sp-9);
}
@media (max-width: 960px) {
  .footer-inner { grid-template-columns: 1fr 1fr; gap: var(--sp-8); }
}
@media (max-width: 640px) {
  .footer-inner { grid-template-columns: 1fr; }
}
.footer-brand { color: #FFFFFF; font-weight: 700; font-size: 22px; }
.footer-col h4 {
  margin: 0 0 var(--sp-4); font-size: var(--fs-sm);
  text-transform: uppercase; letter-spacing: 0.06em; color: #8E97A4;
}
.footer-col ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: var(--sp-3); }
.footer-col a { color: #C8CEDA; text-decoration: none; }
.footer-col a:hover { color: #FFFFFF; }
.footer-legal {
  max-width: var(--container); margin: var(--sp-9) auto 0; padding: var(--sp-6) var(--sp-7) 0;
  border-top: 1px solid rgba(255,255,255,0.08);
  display: flex; justify-content: space-between; gap: var(--sp-4); flex-wrap: wrap;
  color: #8E97A4; font-size: var(--fs-xs);
}

/* ---------- 17. ADMIN ------------------------------------------------ */
/* Internal tooling. Not in the handoff — kept close to the design system
   for consistency but pragmatic (data-dense tables, simple forms). */
.page-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--sp-4); margin-bottom: var(--sp-7);
}
.page-head h1 { margin: 0; }

.admin-table-wrap {
  background: var(--surface-paper);
  border: 1px solid var(--surface-line);
  border-radius: var(--r-lg);
  overflow-x: auto;
}
.admin-table {
  width: 100%; border-collapse: collapse;
  font-size: var(--fs-sm);
}
.admin-table th {
  text-align: left; padding: var(--sp-3) var(--sp-4);
  background: var(--surface-1);
  color: var(--ink-3); font-weight: 700;
  border-bottom: 1px solid var(--surface-line);
  white-space: nowrap;
}
.admin-table td {
  padding: var(--sp-3) var(--sp-4);
  border-top: 1px solid var(--surface-line);
  color: var(--ink-1);
  vertical-align: middle;
}
.admin-table tbody tr:first-child td { border-top: none; }
.admin-table a { color: var(--brand-deep); font-weight: 700; text-decoration: none; }
.admin-table a:hover { text-decoration: underline; }
.admin-table .num { font-variant-numeric: tabular-nums; }
.admin-table .thumb {
  width: 64px; height: 48px; border-radius: var(--r-sm);
  object-fit: cover; background: var(--surface-1); display: block;
}

.admin-card {
  background: var(--surface-paper);
  border: 1px solid var(--surface-line);
  border-radius: var(--r-lg);
  padding: var(--sp-6);
}

/* Used as compact pill markers next to row content (e.g., link status). */
.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--r-sm);
  font-size: 11px; font-weight: 700;
  background: var(--surface-1); color: var(--ink-2);
  vertical-align: middle;
}
.tag-ok      { background: var(--premier-soft); color: var(--premier-deep); }
.tag-warn    { background: var(--yellow-soft);  color: var(--yellow-deep); }
.tag-alert   { background: var(--alert-soft);   color: var(--alert-deep); }
.tag-info    { background: var(--info-soft);    color: var(--info-deep); }
.tag-neutral { background: var(--surface-2);    color: var(--ink-2); }

/* ---------- 18. UTILITY: visually-hidden ----------------------------- */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
