/* ============================================================
   Walker HQ — vitals board for a five-business empire.
   Light only, by design. Porcelain surface, ink text, jade signal.
   Type: Young Serif (display) · Instrument Sans (UI) · Spline Sans Mono (readouts)
   ============================================================ */

:root {
  --paper:   #F2F4F3;
  --card:    #FCFDFC;
  --card-2:  #F7F9F8;
  --ink:     #17211B;
  --ink-2:   #4E5D56;
  --ink-3:   #82918A;
  --line:    #DFE5E2;
  --line-2:  #ECF0EE;

  --signal:  #0B7A5C;   /* jade — good, active, links */
  --signal-soft: #E2EFEA;
  --warn:    #A36A00;
  --warn-soft: #F5ECDA;
  --crit:    #BF3B2B;
  --crit-soft: #F7E5E2;

  --serif: 'Young Serif', 'Iowan Old Style', Georgia, serif;
  --sans:  'Instrument Sans', -apple-system, 'Segoe UI', sans-serif;
  --mono:  'Spline Sans Mono', ui-monospace, 'SF Mono', monospace;

  --r: 14px;
  --shadow: 0 1px 2px rgba(23,33,27,.05), 0 6px 24px -12px rgba(23,33,27,.12);
  --pad: clamp(14px, 3vw, 24px);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(64px + env(safe-area-inset-bottom));
}
@media (min-width: 900px) { body { padding-bottom: 40px; } }

a { color: var(--signal); text-decoration: none; }
button { font: inherit; cursor: pointer; }
.mono { font-family: var(--mono); }
:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; border-radius: 4px; }

/* ---------- masthead ---------- */
.masthead {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--paper) 88%, white);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.masthead-row {
  display: flex; align-items: center; gap: 16px;
  padding: 10px var(--pad) 8px;
  max-width: 1180px; margin: 0 auto;
}
.wordmark {
  font-family: var(--serif); font-size: 22px; color: var(--ink);
  letter-spacing: .01em; display: flex; align-items: baseline; gap: 6px;
}
.wordmark-hq {
  font-family: var(--mono); font-size: 11px; font-weight: 600; letter-spacing: .18em;
  color: #fff; background: var(--signal); border-radius: 5px; padding: 2px 6px 1px;
  transform: translateY(-2px);
}
.topnav { display: none; gap: 4px; margin-left: 8px; }
@media (min-width: 900px) {
  .topnav { display: flex; }
  .topnav a {
    color: var(--ink-2); padding: 6px 12px; border-radius: 999px; font-weight: 500; font-size: 15px;
  }
  .topnav a.active { background: var(--ink); color: var(--paper); }
  .topnav a:not(.active):hover { background: var(--line-2); }
}
.masthead-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.today { font-size: 12px; color: var(--ink-3); letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; display: none; }
@media (min-width: 700px) { .today { display: inline; } }
.biz-jump {
  font: 500 13px var(--sans); color: var(--ink);
  background: var(--card); border: 1px solid var(--line); border-radius: 999px;
  padding: 6px 10px; max-width: 130px;
}
.tv-link {
  font-size: 11px; font-weight: 600; letter-spacing: .14em; color: var(--ink-2);
  border: 1px solid var(--line); border-radius: 6px; padding: 4px 7px;
}
.tv-link:hover { border-color: var(--signal); color: var(--signal); }

/* the signature: empire heartbeat strip */
.pulseline { height: 34px; overflow: hidden; }
.pulseline svg { display: block; width: 100%; height: 100%; }
.pulseline .trace { fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
@media (prefers-reduced-motion: no-preference) {
  .pulseline .trace.animate {
    stroke-dasharray: 1400;
    stroke-dashoffset: 1400;
    animation: draw 2.4s ease-out forwards;
  }
}
@keyframes draw { to { stroke-dashoffset: 0; } }

/* ---------- layout ---------- */
.view { max-width: 1180px; margin: 0 auto; padding: var(--pad); }
.view:focus { outline: none; }
.grid { display: grid; gap: 14px; }
@media (min-width: 700px)  { .grid.cols-2 { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1000px) { .grid.cols-3 { grid-template-columns: 1fr 1fr 1fr; } }

.section-label {
  font-family: var(--mono); font-size: 11px; font-weight: 600; letter-spacing: .18em;
  text-transform: uppercase; color: var(--ink-3);
  margin: 26px 0 10px; display: flex; align-items: center; gap: 10px;
}
.section-label::after { content: ''; height: 1px; background: var(--line); flex: 1; }
.view > .section-label:first-child { margin-top: 4px; }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r);
  box-shadow: var(--shadow); padding: 16px;
}
.card.pad-0 { padding: 0; overflow: hidden; }

/* ---------- freedom meter ---------- */
.freedom { padding: 18px 16px; }
.freedom-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.freedom-title { font-family: var(--serif); font-size: 19px; }
.freedom-figure { font-family: var(--mono); font-size: 13px; color: var(--ink-2); }
.freedom-figure strong { color: var(--ink); font-size: 15px; }
.shift-track { display: flex; gap: 6px; margin: 14px 0 8px; }
.shift-seg {
  flex: 1; height: 26px; border-radius: 7px; background: var(--line-2);
  position: relative; overflow: hidden; border: 1px solid var(--line);
}
.shift-seg .fill {
  position: absolute; inset: 0; width: 0; background: var(--signal);
  border-radius: 6px; transition: width .9s cubic-bezier(.2,.7,.2,1);
}
.shift-seg .fill.partial { background: linear-gradient(90deg, var(--signal), color-mix(in srgb, var(--signal) 55%, var(--paper))); }
.shift-caption { font-size: 13.5px; color: var(--ink-2); }
.shift-caption b { color: var(--ink); }

/* ---------- stat tiles ---------- */
.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 700px) { .tiles { grid-template-columns: repeat(4, 1fr); } }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.tile .k { font-size: 12px; color: var(--ink-3); letter-spacing: .04em; }
.tile .v { font-family: var(--mono); font-size: clamp(20px, 4.5vw, 26px); font-weight: 600; margin-top: 2px; font-variant-numeric: tabular-nums; }
.tile .d { font-size: 12px; margin-top: 2px; color: var(--ink-3); }
.tile .d.up { color: var(--signal); }
.tile .d.down { color: var(--crit); }

/* ---------- triage / alerts ---------- */
.triage { display: flex; flex-direction: column; }
.triage-row {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 12px 16px; border-top: 1px solid var(--line-2);
}
.triage-row:first-child { border-top: 0; }
.sev { width: 10px; height: 10px; border-radius: 999px; margin-top: 6px; flex: none; }
.sev.critical { background: var(--crit); box-shadow: 0 0 0 4px var(--crit-soft); }
.sev.warn     { background: var(--warn); box-shadow: 0 0 0 4px var(--warn-soft); }
.sev.info     { background: var(--signal); box-shadow: 0 0 0 4px var(--signal-soft); }
.triage-msg { flex: 1; font-size: 14.5px; }
.triage-meta { font-family: var(--mono); font-size: 11.5px; color: var(--ink-3); margin-top: 2px; }
.triage-done {
  border: 1px solid var(--line); background: var(--card); color: var(--ink-2);
  border-radius: 8px; padding: 4px 10px; font-size: 12.5px;
}
.triage-done:hover { border-color: var(--signal); color: var(--signal); }
.allclear { padding: 22px 16px; text-align: center; color: var(--ink-2); font-size: 14.5px; }
.allclear .mono { display: block; color: var(--signal); font-size: 12px; letter-spacing: .16em; margin-bottom: 4px; }

/* ---------- business chart cards ---------- */
.chart-card {
  position: relative; display: block; color: inherit;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r);
  box-shadow: var(--shadow); padding: 14px 16px 12px 20px; overflow: hidden;
}
.chart-card::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 5px;
  background: var(--accent, var(--ink-3));
}
.chart-card:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.cc-head { display: flex; align-items: center; gap: 10px; }
.cc-name { font-family: var(--serif); font-size: 18px; }
.cc-domain { font-family: var(--mono); font-size: 11px; color: var(--ink-3); display: none; }
@media (min-width: 480px) { .cc-domain { display: inline; } }
.chip {
  font-family: var(--mono); font-size: 10px; font-weight: 600; letter-spacing: .12em;
  text-transform: uppercase; border-radius: 5px; padding: 2px 7px; margin-left: auto;
}
.chip.active   { color: var(--signal); background: var(--signal-soft); }
.chip.building { color: var(--warn); background: var(--warn-soft); }
.chip.paused   { color: var(--ink-3); background: var(--line-2); }
.cc-spark { margin: 8px 0 4px; }
.cc-vitals { display: grid; grid-template-columns: repeat(2, 1fr); gap: 2px 14px; border-top: 1px solid var(--line-2); margin-top: 6px; }
@media (min-width: 480px) {
  .cc-vitals { display: flex; gap: 0; }
  .cc-vital + .cc-vital { border-left: 1px solid var(--line-2); padding-left: 10px; }
}
.cc-vital { flex: 1; padding: 8px 4px 0; min-width: 0; }
.cc-vital .k { font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); white-space: nowrap; }
.cc-vital .v { font-family: var(--mono); font-size: 15.5px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cc-vital .v .unit { font-size: 11px; color: var(--ink-3); font-weight: 400; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 99px; margin-right: 5px; }
.dot.up { background: var(--signal); } .dot.down { background: var(--crit); } .dot.na { background: var(--ink-3); }
.cc-building {
  margin: 10px 0 6px; padding: 12px; border: 1px dashed var(--line);
  border-radius: 10px; font-size: 13.5px; color: var(--ink-2); background: var(--card-2);
}

/* ---------- charts ---------- */
.fig { margin: 0; }
.fig-title { font-size: 14px; font-weight: 600; margin-bottom: 2px; }
.fig-sub { font-size: 12px; color: var(--ink-3); margin-bottom: 8px; }
.fig svg { display: block; width: 100%; height: auto; }
svg .axis text { font: 10.5px var(--mono); fill: var(--ink-3); }
svg .grid-line { stroke: var(--line-2); }
.card svg { display: block; max-width: 100%; }

/* horizontal comparison bars (HTML) */
.hbar-row { display: grid; grid-template-columns: minmax(110px, 165px) 1fr auto; gap: 12px; align-items: center; padding: 7px 0; }
.hbar-name { font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-track { height: 14px; border-radius: 5px; background: var(--line-2); overflow: hidden; }
.hbar-track i { display: block; height: 100%; border-radius: 5px; transition: width .7s ease; }
.hbar-val { font-size: 12.5px; font-weight: 600; color: var(--ink-2); min-width: 48px; text-align: right; }
.legend { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 8px; }
.legend span { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-2); }
.legend i { width: 10px; height: 10px; border-radius: 3px; }

.hq-tip {
  position: fixed; z-index: 90; pointer-events: none;
  background: var(--ink); color: var(--paper);
  font: 12px var(--mono); padding: 6px 9px; border-radius: 7px;
  box-shadow: var(--shadow); max-width: 260px;
  opacity: 0; transition: opacity .12s;
}
.hq-tip.show { opacity: 1; }
.hq-tip .t-label { color: #B9C6C0; }

/* ---------- tables ---------- */
.tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th {
  text-align: left; font: 600 10.5px var(--mono); letter-spacing: .12em; text-transform: uppercase;
  color: var(--ink-3); padding: 8px 10px; border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.tbl td { padding: 9px 10px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl td.num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; font-family: var(--mono); }
.move { font-family: var(--mono); font-size: 12px; font-weight: 600; white-space: nowrap; }
.move.up { color: var(--signal); } .move.down { color: var(--crit); } .move.flat { color: var(--ink-3); }
.pos-badge {
  display: inline-block; min-width: 30px; text-align: center;
  font-family: var(--mono); font-weight: 600; font-size: 13px;
  border-radius: 6px; padding: 2px 6px; background: var(--line-2);
}
.pos-badge.top3  { background: var(--signal); color: #fff; }
.pos-badge.top10 { background: var(--signal-soft); color: var(--signal); }
.kw-biz { font-family: var(--mono); font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase; }

/* ---------- drilldown ---------- */
.biz-hero { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 4px; }
.biz-hero h1 { font-family: var(--serif); font-size: clamp(26px, 6vw, 36px); font-weight: 400; margin: 0; }
.biz-hero .domain { font-family: var(--mono); font-size: 12.5px; }
.back { font-size: 13.5px; color: var(--ink-2); display: inline-flex; gap: 6px; align-items: center; margin-bottom: 10px; }
.goal-bar { height: 8px; border-radius: 99px; background: var(--line-2); overflow: hidden; margin-top: 6px; }
.goal-bar .fill { height: 100%; border-radius: 99px; background: var(--accent, var(--signal)); transition: width .8s ease; }

.srcgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.srcpill {
  display: flex; align-items: center; gap: 8px; font-size: 12.5px;
  border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; background: var(--card);
}
.srcpill .mono { font-size: 10px; color: var(--ink-3); }

/* ---------- money ---------- */
.money-hero { text-align: center; padding: 26px 16px 22px; }
.money-hero .big {
  font-family: var(--mono); font-weight: 600; font-size: clamp(40px, 11vw, 64px);
  letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1;
}
.money-hero .cap { color: var(--ink-2); font-size: 14px; margin-top: 6px; }
.fab {
  position: fixed; right: 18px; bottom: calc(76px + env(safe-area-inset-bottom)); z-index: 50;
  background: var(--ink); color: var(--paper); border: 0; border-radius: 999px;
  padding: 12px 18px; font-weight: 600; font-size: 14.5px; box-shadow: 0 8px 24px -6px rgba(23,33,27,.4);
}
@media (min-width: 900px) { .fab { bottom: 28px; } }
.fab:active { transform: scale(.97); }

/* ---------- quick-entry sheet ---------- */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 80; background: rgba(23,33,27,.35);
  display: flex; align-items: flex-end; justify-content: center;
}
@media (min-width: 700px) { .sheet-backdrop { align-items: center; } }
.sheet {
  background: var(--card); border-radius: 18px 18px 0 0; width: 100%; max-width: 460px;
  padding: 20px 20px calc(20px + env(safe-area-inset-bottom));
}
@media (min-width: 700px) { .sheet { border-radius: 18px; } }
.sheet h2 { font-family: var(--serif); font-weight: 400; font-size: 20px; margin: 0 0 14px; }
.sheet label { display: block; font-size: 12.5px; color: var(--ink-2); margin: 12px 0 4px; }
.sheet input, .sheet select {
  width: 100%; font: 16px var(--sans); padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--card-2); color: var(--ink);
}
.sheet-actions { display: flex; gap: 10px; margin-top: 18px; }
.btn { border-radius: 10px; padding: 11px 16px; font-weight: 600; border: 1px solid var(--line); background: var(--card); color: var(--ink); flex: 1; }
.btn.primary { background: var(--signal); border-color: var(--signal); color: #fff; }

/* ---------- signals ---------- */
.runlog td:first-child { font-family: var(--mono); font-size: 12px; }
.status-word { font-family: var(--mono); font-size: 11.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.status-word.ok { color: var(--signal); }
.status-word.skipped { color: var(--ink-3); }
.status-word.error { color: var(--crit); }
.status-word.running { color: var(--warn); }

/* ---------- tabbar (mobile) ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  display: flex; background: color-mix(in srgb, var(--card) 92%, white);
  border-top: 1px solid var(--line); backdrop-filter: blur(10px);
  padding-bottom: env(safe-area-inset-bottom);
}
@media (min-width: 900px) { .tabbar { display: none; } }
.tabbar a {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 8px 0 6px; color: var(--ink-3); font-size: 10.5px; font-weight: 600;
  letter-spacing: .04em;
}
.tabbar a.active { color: var(--signal); }
.tabbar svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; transform: translateX(-50%) translateY(20px);
  bottom: calc(84px + env(safe-area-inset-bottom)); z-index: 95;
  background: var(--ink); color: var(--paper); border-radius: 10px; padding: 10px 16px;
  font-size: 14px; opacity: 0; pointer-events: none; transition: all .25s;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- demo ribbon ---------- */
.demo-ribbon {
  background: var(--warn-soft); color: var(--warn);
  font: 600 12px var(--mono); letter-spacing: .08em; text-align: center;
  padding: 6px 12px; border-radius: 9px; margin-bottom: 14px;
}
.demo-ribbon a { color: inherit; text-decoration: underline; }

/* ---------- TV / kiosk mode ---------- */
body.tv { padding: 0; background: var(--paper); overflow: hidden; }
body.tv .masthead .topnav, body.tv .tabbar, body.tv .fab, body.tv .biz-jump { display: none !important; }
.tv-stage { height: calc(100vh - 78px); overflow: hidden; padding: 3vh 4vw; }
.tv-stage .view { max-width: 1500px; }
.tv-stage .tile .v { font-size: clamp(34px, 4.2vw, 58px); }
.tv-stage .cc-name { font-size: clamp(20px, 2.2vw, 30px); }
.tv-stage .money-hero .big { font-size: clamp(70px, 12vw, 150px); }
.tv-dots { position: fixed; bottom: 14px; left: 0; right: 0; display: flex; justify-content: center; gap: 8px; }
.tv-dots i { width: 8px; height: 8px; border-radius: 99px; background: var(--line); }
.tv-dots i.on { background: var(--signal); }

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

/* print = paper briefing */
@media print {
  .masthead, .tabbar, .fab, .toast { display: none; }
  .card, .chart-card, .tile { box-shadow: none; }
}
