/* COMPONENTS — the composite visual rules that have no single home in styles.css or the page stylesheets: gradient
   header bands on cards, striped table rows, sticky summaries, the drawer background, the Unusual-items review
   layout and the contingency-advice rows. Loaded after the page stylesheets on index, start and owner. Simple
   per-selector values (tokens, colours, sizes, borders) live in the base rule of styles.css / start.css / owner.css /
   pages/*.css — change them there. Status colours are untouched (red / amber / blue / green chips stay paired with
   labels). */
/* ---------- Derived tokens: --page2 for the overview tab (the other tabs set theirs in styles.css / owner.css) ---------- */
body[data-tab=overview],body:not([data-tab]){--page2:#c04cf0}
/* ---------- Page header: the gradient band (app.js shell, owner/core.js) ---------- */
.pagehead::after{
  content:'';
  position:absolute;
  inset:0;
  background:radial-gradient(600px 260px at 85% 120%,rgba(255,255,255,.22),transparent 70%);
  pointer-events:none;
}
.pagehead>*{position:relative;z-index:1}
.pagehead .eyebrow{color:rgba(255,255,255,.82);font-size:12px;letter-spacing:.16em}
.pagehead .lede{color:rgba(255,255,255,.9)}
.ph-sub b,.ph-sub strong{color:#fff}
/* ---------- Headings inside cards (shared) ---------- */
.card h2{font-size:22px;font-weight:800;color:var(--navy);line-height:1.25}
.card h3{font-size:17px;font-weight:800;color:var(--navy)}
/* ---------- Boxes: cards, notices, KPI tiles with tinted header bands (shared) ---------- */
.card::before{
  content:'';
  position:absolute;
  left:0;
  right:0;
  top:0;
  height:4px;
  border-radius:var(--radius-lg) var(--radius-lg) 0 0;
  background:linear-gradient(90deg,var(--g1),var(--g2));
}
.card.notice.amber::before{background:linear-gradient(90deg,var(--amber-dot),#f6c177)}
.card.notice.green::before{background:linear-gradient(90deg,var(--green),#7fdcb0)}
.shortfall::before,.card.shortfall::before{background:linear-gradient(90deg,var(--red),#ff8a5b)}
.card:not(.notice):not(.plan-notice):not(.slim):not(.shortfall)>h2:first-child,
.card:not(.notice):not(.plan-notice):not(.slim):not(.shortfall)>.spread:first-child,
.card>.brief-top:first-child{
  margin:calc(-1 * var(--space-6)) calc(-1 * var(--space-6)) var(--space-4);
  padding:var(--space-4) var(--space-6);
  background:linear-gradient(90deg,color-mix(in srgb,var(--g1) 11%,var(--white)),color-mix(in srgb,var(--g2) 9%,var(--white)));
  border-bottom:1px solid var(--line);
  border-radius:var(--radius-lg) var(--radius-lg) 0 0;
  padding-top:calc(var(--space-4) + 4px);
}
.card.tight>h2:first-child,.card.tight>.spread:first-child{
  margin:calc(-1 * var(--space-4)) calc(-1 * var(--space-5)) var(--space-3);
  padding:calc(var(--space-3) + 4px) var(--space-5) var(--space-3);
}
.card>h2:first-child{margin-bottom:var(--space-4)}
.card>.spread:first-child .sub,.card>.spread:first-child h2{margin-bottom:0}
.card>.spread:first-child .sub{margin-top:4px}
.card>.spread:first-child+.sub{margin-top:0}
.kpi-row .kpi-label{color:var(--ink)}
/* ---------- Tables: heads, totals, tiers (App table builders) ---------- */
.tbl-wrap table,.card table{border-collapse:separate;border-spacing:0}
td+td,th+th{border-left:1px solid color-mix(in srgb,var(--row) 70%,transparent)}
tbody tr.cathead td,tbody tr.cathead:nth-child(even) td{
  border-top:2px solid var(--line);
  border-bottom:1.5px solid var(--line);
  background:linear-gradient(90deg,color-mix(in srgb,var(--g1) 24%,var(--white)),color-mix(in srgb,var(--g2) 18%,var(--white)));
}
tr.cathead td+td{border-left:0}
tr:last-child td{border-bottom:0}
/* each line item is a soft band of colour that runs left to right, alternating in two tints, so the eye can track a row */
tbody tr td{
  background:linear-gradient(90deg,
      color-mix(in srgb,var(--g1) 11%,var(--white)) 0%,
      color-mix(in srgb,var(--g1) 5%,var(--white)) 45%,
      color-mix(in srgb,var(--g2) 4%,var(--white)) 100%);
}
tbody tr:nth-child(even) td{
  background:linear-gradient(90deg,
      color-mix(in srgb,var(--g2) 12%,var(--white)) 0%,
      color-mix(in srgb,var(--g2) 5%,var(--white)) 45%,
      color-mix(in srgb,var(--g1) 3%,var(--white)) 100%);
}
tbody tr:hover td{background:color-mix(in srgb,var(--g1) 16%,var(--white))}
/* the line title: bold and a step larger than the figures */
td button.lnk,.ptable td button.lnk,table.cust td b:first-child,.ld-card-top>b{
  font-weight:800;
  font-size:15.5px;
  color:var(--navy);
  letter-spacing:-.01em;
}
td .why{margin-top:3px}
tr.cathead:nth-child(even) td,.ptable tr.cathead:nth-child(even) td{background:var(--tint-2)}
.nl-card,.fam-card{border:2px solid var(--line)}
.ld-card>h3,.ld-card h2{border-bottom:1px solid var(--row);padding-bottom:8px;margin-bottom:10px}
/* ---------- Flags, chips, buttons (shared) ---------- */
.flag.green{
  border-color:color-mix(in srgb,var(--green) 40%,var(--white));
  border-left-color:var(--green);
  background:color-mix(in srgb,var(--green-bg) 55%,var(--white));
}
.wiz-nav .btn.primary{
  background:linear-gradient(118deg,var(--g1),var(--g2));
  border-color:transparent;
  color:#fff;
  box-shadow:0 6px 16px -8px color-mix(in srgb,var(--g1) 70%,transparent);
}
.btn-sm:hover,.btn:not(.primary):not(.danger):hover{background:var(--tint);color:var(--ink);border-color:var(--accent)}
input,select,textarea{background:var(--white)}
.fld select{background:var(--white);border-color:var(--line);border-radius:10px}
.fld input:focus,.fld select:focus,.search:focus{
  outline:2px solid color-mix(in srgb,var(--g1) 55%,#fff);
  outline-offset:0;
  border-color:var(--g1);
}
/* ---------- Drawer (pages/linedetail.js) ---------- */
.ld-panel{background:var(--bg)}
/* ---------- Welcome page (start.html, start.css) ---------- */
.s-hero .btn.primary{background:linear-gradient(118deg,#6a5cf5,#c04cf0);border-color:transparent;color:#fff}
.s-hero-card::before{content:none}
/* ---------- Shortfall card in the rose-coral family (overview, trim, funding pages) ---------- */
.card.shortfall{
  border:2px solid transparent;
  background:linear-gradient(var(--white),var(--white)) padding-box,linear-gradient(118deg,var(--red),var(--red-2)) border-box;
  box-shadow:0 10px 30px -14px rgba(212,42,90,.35);
}
.shortfall::before{content:none}
.shortfall .btn.primary{background:linear-gradient(118deg,var(--red),var(--red-2));box-shadow:0 6px 16px -8px rgba(200,38,77,.6)}
/* ---------- Definition lists: drawer facts, settings summaries — a rule under every pair (pages/linedetail.js, admin) ---------- */
dl.ld-facts dt:last-of-type,dl.ld-facts dd:last-of-type{border-bottom:0}
.ld-grid .card>h3:first-child{padding-bottom:8px;border-bottom:1px solid var(--row);margin-bottom:8px}
.ld-grid .card .sub{margin-top:0}
/* ---------- Trim sandbox: the impact box (gap to close · trial trims · still to find) stays put while levers scroll ---------- */
.zone-play .whatif{
  position:sticky;
  top:calc(var(--subtabs-h,56px) + 8px);
  z-index:5;
  background:color-mix(in srgb,var(--surface) 94%,var(--g1));
  backdrop-filter:blur(10px);
  -webkit-backdrop-filter:blur(10px);
  transition:box-shadow .2s;
}
.zone-play .whatif.is-stuck{box-shadow:0 10px 28px -10px rgba(12,28,56,.35),0 2px 6px rgba(12,28,56,.10)}
/* ---------- Sticky summaries: keep what you steer by in view (app.js sticky headers, desktop) ---------- */
.stick{
  position:sticky;
  top:var(--stick-top);
  z-index:5;
  background:color-mix(in srgb,var(--surface) 94%,var(--g1));
  backdrop-filter:blur(10px);
  -webkit-backdrop-filter:blur(10px);
  transition:box-shadow .2s;
}
.stick.is-stuck{box-shadow:0 10px 28px -10px rgba(12,28,56,.35),0 2px 6px rgba(12,28,56,.10)}
.sheet-sum.stick{padding:10px 12px;margin:var(--space-4) -12px 0;border-radius:var(--radius-lg);border:1.5px solid transparent}
.sheet-sum.stick.is-stuck{border-color:var(--line)}
.st-act.stick,.plan-stick{border-radius:var(--radius-lg);padding:10px 12px;margin:0 -12px var(--space-3);border:1.5px solid transparent}
.st-act.stick.is-stuck,.plan-stick.is-stuck{border-color:var(--line)}
.plan-stick{display:grid;grid-template-columns:repeat(4,minmax(120px,1fr)) 2fr;gap:var(--space-4);align-items:center}
.plan-stick .ps-k{font-size:11px;font-weight:900;letter-spacing:.12em;text-transform:uppercase;color:var(--c-plan)}
.plan-stick b{display:block;font-size:24px;font-weight:900;line-height:1.1;font-variant-numeric:tabular-nums}
.plan-stick em{font-style:normal;font-size:12.5px;color:var(--muted)}
.plan-stick .ps-bar{height:10px;border-radius:6px;background:color-mix(in srgb,var(--line) 60%,#fff);overflow:hidden}
.plan-stick .ps-bar i{display:block;height:100%;background:linear-gradient(90deg,var(--c-plan),#2f9e6a);border-radius:6px}
.ld-head.stick{
  top:0;
  margin:calc(-1 * var(--space-6)) calc(-1 * var(--space-8)) var(--space-3);
  padding:var(--space-5) var(--space-8) var(--space-3);
  background:color-mix(in srgb,var(--bg) 92%,var(--g1));
}
/* ---------- Sticky table headers: clip keeps the rounded corners without creating a scroll box (App table builders) ---------- */
.tbl-wrap:not(.tall){overflow:clip}
.tbl-wrap.scrolls{overflow:auto hidden}
.tbl-wrap.scrolls thead th,.tbl-wrap:not(.tall).scrolls thead th{position:static;box-shadow:none}
.tbl-wrap:not(.tall) thead th{position:sticky;top:var(--stick-top);z-index:3;box-shadow:0 2px 0 var(--line)}
.tbl-wrap.tall thead th{position:sticky;top:0;z-index:3}
/* ---------- Unusual items, statement by statement (pages/review.js) ---------- */
.rv-month{
  margin-top:var(--space-5);
  border:1.5px solid var(--line);
  border-radius:var(--radius-lg);
  background:linear-gradient(160deg,var(--white),color-mix(in srgb,#7c58bb 5%,var(--surface)));
  padding:var(--space-4) var(--space-5);
}
.rv-month.quiet{padding-bottom:var(--space-4)}
.rv-month.quiet .rv-head h3{color:var(--muted)}
.rv-month>summary{list-style:none;cursor:pointer}
.rv-month>summary::-webkit-details-marker{display:none}
.rv-month>summary:focus-visible{outline:2px solid #7c58bb;outline-offset:4px;border-radius:8px}
.rv-head{display:flex;justify-content:space-between;align-items:flex-start;gap:var(--space-4)}
.rv-head h3{font-size:20px;font-weight:900;margin:4px 0 0;letter-spacing:-.01em}
.rv-month[open]>summary{border-bottom:2px solid var(--line);padding-bottom:var(--space-3);margin-bottom:var(--space-3)}
.rv-month .anom{margin-top:var(--space-4)}
.rv-just{border-color:#7c58bb;box-shadow:0 12px 32px -14px rgba(124,88,187,.45)}
.rv-just h2{font-size:26px}
.an-py{margin-top:var(--space-6)}
.an-py .an-count{margin-top:var(--space-3);display:inline-grid}
/* ---------- Line-level contingency advice (plan › Unusual) ---------- */
.ca-card{margin-top:var(--space-6)}
.ca-row{
  display:grid;
  grid-template-columns:auto 1fr auto;
  gap:var(--space-4);
  align-items:center;
  padding:var(--space-3) var(--space-4);
  border:1.5px solid var(--line);
  border-radius:var(--radius);
  margin-top:var(--space-3);
  background:linear-gradient(90deg,color-mix(in srgb,var(--g1) 6%,var(--white)),var(--white));
}
.ca-row.on{
  border-color:color-mix(in srgb,var(--amber) 60%,var(--line));
  background:linear-gradient(90deg,color-mix(in srgb,var(--amber) 10%,var(--white)),var(--white));
}
.ca-main b{font-size:16px;font-weight:800}
.ca-amt{text-align:right}
.ca-amt b{display:block;font-size:24px;font-weight:900;font-variant-numeric:tabular-nums}
.ca-amt span{font-size:12px;color:var(--muted)}
/* ---------- Guided walk through waiting items (pages/review.js) ---------- */
.rv-walk{padding-top:var(--space-5)}
.rv-prog{display:grid;grid-template-columns:1fr 220px;gap:var(--space-5);align-items:center}
.rv-prog h2{font-size:24px;margin:4px 0 0}
.rv-bar{height:12px;border-radius:8px;background:color-mix(in srgb,#7c58bb 14%,#fff);overflow:hidden}
.rv-bar i{display:block;height:100%;background:linear-gradient(90deg,#7c58bb,#3b8aa8);border-radius:8px}
.rv-chal{
  margin:var(--space-4) 0;
  padding:var(--space-4) var(--space-5);
  border:1.5px solid color-mix(in srgb,#7c58bb 45%,var(--line));
  border-radius:var(--radius-lg);
  background:linear-gradient(135deg,color-mix(in srgb,#7c58bb 9%,#fff),#fff);
}
.rv-chal p{margin:6px 0 8px;font-size:15.5px;font-weight:600;color:var(--ink)}
.rv-why{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:8px;margin-top:var(--space-3)}
.rv-chip{
  display:flex;
  flex-direction:column;
  align-items:flex-start;
  gap:2px;
  text-align:left;
  font:inherit;
  font-size:13px;
  font-weight:700;
  line-height:1.25;
  padding:10px 12px;
  border:1.5px solid var(--line);
  border-radius:12px;
  background:#fff;
  color:var(--ink);
  cursor:pointer;
  transition:border-color .15s,transform .1s,box-shadow .15s;
}
.rv-chip small{font-size:11px;font-weight:800;color:#7c58bb;letter-spacing:.04em}
.rv-chip:hover{border-color:#7c58bb;box-shadow:0 6px 16px -8px rgba(124,88,187,.5);transform:translateY(-1px)}
.rv-chip:focus-visible{outline:2px solid #7c58bb;outline-offset:2px}
.rv-nav{display:flex;align-items:center;gap:var(--space-4);margin-top:var(--space-4);flex-wrap:wrap}
.rv-all{font-size:20px;font-weight:900;margin:var(--space-7) 0 0;color:var(--navy)}
