/* ══════════════════════════════════════════════════════════
   AgroNutikas — Founder + Senior Developer Operating Environment
   Admin/Ops dark surface · welded hairline instrumentation
   Built on colors_and_type.css tokens. Inter (UI) + DM Mono (data).
   ══════════════════════════════════════════════════════════ */

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 13px;
  line-height: 1.45;
  color: #CFD4CF;
  background: #06080A;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}
button { font-family: inherit; cursor: pointer; }
table { border-collapse: collapse; width: 100%; }
a { color: inherit; }

:root {
  --bg-0: #06080A;
  --bg-1: #0C100E;
  --bg-2: #131815;
  --bg-3: #1A211C;
  --line: rgba(207,212,207,0.09);
  --line-strong: rgba(207,212,207,0.20);
  --tick: rgba(207,212,207,0.35);
  --ink-hi: #F5F7F4;
  --ink: #CFD4CF;
  --ink-lo: rgba(207,212,207,0.58);
  --ink-muted: rgba(207,212,207,0.38);
  --signal: #8FBE75;
  --signal-hi: #B4D69E;
  --warn: #E0B43A;
  --warn-hi: #F0CF6A;
  --danger: #D2655A;
  --danger-hi: #E89289;
  --info: #7DAFD6;
  --info-hi: #A6CDE8;
  --draft: #C0875A;
  --ui:   'Inter', system-ui, sans-serif;
  --mono: 'DM Mono', ui-monospace, monospace;

  /* priority tones */
  --p0: #D2655A;
  --p1: #E0B43A;
  --p2: #7DAFD6;
  --p3: rgba(207,212,207,0.40);
}

/* ─── App layout ─── */
.app {
  display: grid;
  grid-template-columns: 232px minmax(0,1fr);
  min-height: 100vh;
}
.app.drawer-open { grid-template-columns: 232px minmax(0,1fr) 380px; }
.app-main { display: flex; flex-direction: column; min-width: 0; background: var(--bg-0); }
.app-body { flex: 1; min-width: 0; }

/* ═══ SIDEBAR ═══ */
.sb {
  background: #04060A;
  border-right: 1px solid var(--line-strong);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; overflow: hidden;
}
.sb-brand {
  display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 8px;
  padding: 12px 12px 11px;
  border-bottom: 1px solid var(--line-strong);
}
.sb-brand img { height: 17px; width: auto; }
.sb-brand-chev { color: var(--ink-muted); width: 18px; height: 18px; border: 1px solid var(--line-strong);
  display: inline-flex; align-items: center; justify-content: center; }
.sb-brand-chev svg { width: 10px; height: 10px; }
.sb-sub {
  font-family: var(--mono); font-weight: 500; font-size: 8.5px;
  color: var(--ink-muted); letter-spacing: 0.2em; text-transform: uppercase;
  padding: 7px 12px; border-bottom: 1px solid var(--line-strong);
  display: flex; justify-content: space-between; align-items: center;
}
.sb-sub b { color: var(--signal-hi); font-weight: 600; letter-spacing: 0.1em; }

.sb-scroll { flex: 1; overflow-y: auto; overflow-x: hidden; }
.sb-scroll::-webkit-scrollbar { width: 7px; }
.sb-scroll::-webkit-scrollbar-thumb { background: rgba(207,212,207,0.12); }
.sb-scroll::-webkit-scrollbar-track { background: transparent; }

.sb-group { border-bottom: 1px solid var(--line); }
.sb-group-h {
  width: 100%; text-align: left;
  padding: 8px 12px 7px;
  display: grid; grid-template-columns: 16px 1fr auto; align-items: center; gap: 9px;
  background: transparent; border: 0;
  font-family: var(--ui); font-weight: 700; font-size: 9.5px;
  letter-spacing: 0.18em; color: var(--ink-lo); text-transform: uppercase;
}
.sb-group-h:hover { color: var(--ink-hi); }
.sb-group-h .gnum { font-family: var(--mono); font-weight: 500; font-size: 9px; color: var(--ink-muted); letter-spacing: 0.06em; }
.sb-group-h .gidx { font-family: var(--mono); font-weight: 600; font-size: 9px; color: var(--ink-muted); }
.sb-group.is-active-grp .sb-group-h { color: var(--ink-hi); }
.sb-group.is-active-grp .gidx { color: var(--signal); }

.sb-items { display: flex; flex-direction: column; padding-bottom: 4px; }
.sb-item {
  display: grid; grid-template-columns: 16px 1fr auto; align-items: center; gap: 9px;
  padding: 5px 12px 5px 13px;
  border: 0; background: transparent;
  color: var(--ink-lo); font-size: 12px; font-weight: 500; font-family: var(--ui);
  text-align: left; min-height: 27px;
  border-left: 2px solid transparent;
}
.sb-item .dotmark { width: 4px; height: 4px; background: var(--ink-muted); justify-self: center; }
.sb-item:hover { background: rgba(207,212,207,0.03); color: var(--ink-hi); }
.sb-item:hover .dotmark { background: var(--ink-lo); }
.sb-item.is-active {
  background: rgba(143,190,117,0.10); color: var(--ink-hi); font-weight: 600;
  border-left-color: var(--signal);
}
.sb-item.is-active .dotmark { background: var(--signal); }
.sb-badge {
  font-family: var(--mono); font-weight: 700; font-size: 9px;
  color: #04060A; background: var(--warn); padding: 0 4px;
  letter-spacing: 0.04em; min-width: 16px; text-align: center;
}
.sb-badge.b-danger { background: var(--danger); color: #fff; }
.sb-count { font-family: var(--mono); font-weight: 500; font-size: 9.5px; color: var(--ink-muted); letter-spacing: 0.04em; }

.sb-foot {
  border-top: 1px solid var(--line-strong); padding: 8px 12px;
  display: flex; flex-direction: column; gap: 7px; background: #04060A;
}
.sb-user { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px; }
.sb-avatar { width: 26px; height: 26px; background: var(--signal); color: #04060A;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-weight: 700; font-size: 10px; }
.sb-user-name { font-size: 12px; font-weight: 700; color: var(--ink-hi); line-height: 1.2; }
.sb-user-meta { font-family: var(--mono); font-weight: 500; font-size: 8.5px; color: var(--ink-muted);
  letter-spacing: 0.1em; text-transform: uppercase; margin-top: 1px; }
.sb-roles { display: grid; grid-template-columns: repeat(5,1fr); border: 1px solid var(--line-strong); }
.sb-role { padding: 4px 0; border: 0; border-right: 1px solid var(--line-strong); background: transparent;
  color: var(--ink-muted); font-family: var(--mono); font-weight: 600; font-size: 8.5px;
  letter-spacing: 0.04em; text-transform: uppercase; text-align: center; }
.sb-role:last-child { border-right: 0; }
.sb-role:hover { color: var(--ink-hi); }
.sb-role.is-on { background: var(--signal); color: #04060A; }

.pulse-dot { width: 6px; height: 6px; background: var(--signal);
  box-shadow: 0 0 0 0 rgba(143,190,117,0.5); animation: pulse 2.4s infinite; }
@keyframes pulse { 0%{box-shadow:0 0 0 0 rgba(143,190,117,0.5);} 70%{box-shadow:0 0 0 6px rgba(143,190,117,0);} 100%{box-shadow:0 0 0 0 rgba(143,190,117,0);} }
@media (prefers-reduced-motion: reduce){ .pulse-dot{animation:none;} }

/* ═══ TOPBAR ═══ */
.tb {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 14px;
  padding: 8px 14px; border-bottom: 1px solid var(--line-strong);
  background: #04060A; position: sticky; top: 0; z-index: 30;
}
.tb-title-block { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.tb-crumb { font-family: var(--mono); font-weight: 500; font-size: 9px; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--ink-muted); display: flex; align-items: center; gap: 5px; }
.tb-crumb b { color: var(--ink-hi); font-weight: 600; }
.tb-crumb .sep { opacity: 0.4; }
.tb-title { font-weight: 700; font-size: 15px; color: var(--ink-hi); letter-spacing: -0.015em; }
.tb-search {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 9px;
  max-width: 460px; width: 100%; justify-self: center;
  padding: 6px 11px; background: var(--bg-1); border: 1px solid var(--line-strong);
  color: var(--ink-muted);
}
.tb-search:hover { border-color: var(--ink-lo); }
.tb-search svg { width: 13px; height: 13px; }
.tb-search span { font-family: var(--mono); font-size: 11px; letter-spacing: 0.04em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-search .k { border: 1px solid var(--line-strong); padding: 0 5px; font-size: 9px; font-weight: 600; letter-spacing: 0.08em; }
.tb-right { display: flex; align-items: center; gap: 8px; }
.tb-stat {
  display: flex; flex-direction: column; gap: 1px; padding: 0 10px;
  border-left: 1px solid var(--line-strong);
}
.tb-stat-k { font-family: var(--mono); font-weight: 500; font-size: 8px; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--ink-muted); }
.tb-stat-v { font-family: var(--mono); font-weight: 600; font-size: 10.5px; color: var(--ink-hi); letter-spacing: 0.04em;
  display: flex; align-items: center; gap: 5px; }
.tb-stat-v.ok { color: var(--signal-hi); }
.tb-stat-v.warn { color: var(--warn-hi); }
.tb-stat-v.danger { color: var(--danger-hi); }

.icon-btn { position: relative; width: 28px; height: 28px; background: var(--bg-1);
  border: 1px solid var(--line-strong); color: var(--ink);
  display: inline-flex; align-items: center; justify-content: center; }
.icon-btn:hover { color: var(--ink-hi); border-color: var(--ink-lo); }
.icon-btn svg { width: 14px; height: 14px; }
.icon-btn .nb { position: absolute; top: -5px; right: -5px; background: var(--danger); color: #fff;
  font-family: var(--mono); font-weight: 700; font-size: 8px; padding: 0 3px; min-width: 13px; text-align: center; }

/* ═══ Page scaffolding ═══ */
.page { padding: 0; }
.page-intro {
  display: grid; grid-template-columns: 1fr auto; gap: 14px; align-items: end;
  padding: 16px 18px 14px; border-bottom: 1px solid var(--line-strong);
}
.page-intro h1 { margin: 0; font-size: 19px; font-weight: 700; color: var(--ink-hi); letter-spacing: -0.02em; }
.page-intro .lede { margin: 5px 0 0; font-size: 12.5px; color: var(--ink-lo); max-width: 62ch; line-height: 1.55; }
.page-intro .ov { font-family: var(--mono); font-weight: 600; font-size: 9px; letter-spacing: 0.22em;
  text-transform: uppercase; color: var(--ink-muted); display: block; margin-bottom: 6px; }
.page-actions { display: flex; gap: 6px; align-items: center; }

.sec { border-bottom: 1px solid var(--line-strong); }
.sec-h {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 9px 18px; background: var(--bg-1); border-bottom: 1px solid var(--line-strong);
}
.sec-h .ttl { display: flex; align-items: baseline; gap: 9px; }
.sec-h .ov { font-family: var(--mono); font-weight: 600; font-size: 9px; letter-spacing: 0.22em;
  text-transform: uppercase; color: var(--ink-muted); }
.sec-h h2 { margin: 0; font-size: 13.5px; font-weight: 700; color: var(--ink-hi); letter-spacing: -0.01em; }
.sec-h .meta { font-family: var(--mono); font-weight: 500; font-size: 10px; color: var(--ink-muted); letter-spacing: 0.06em; }
.sec-body { padding: 14px 18px; }
.sec-body.flush { padding: 0; }

/* ═══ Buttons ═══ */
.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px;
  border: 1px solid var(--line-strong); background: var(--bg-1); color: var(--ink);
  font-family: var(--ui); font-weight: 700; font-size: 11px; letter-spacing: 0.06em;
  text-transform: uppercase; min-height: 28px; transition: border-color .14s, color .14s, transform .08s;
}
.btn:hover { color: var(--ink-hi); border-color: var(--ink-lo); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn svg { width: 13px; height: 13px; }
.btn-primary { background: var(--signal); color: #04060A; border-color: var(--signal); }
.btn-primary:hover { background: var(--signal-hi); border-color: var(--signal-hi); }
.btn-danger { background: transparent; color: var(--danger-hi); border-color: var(--danger); }
.btn-sm { padding: 3px 8px; font-size: 9.5px; min-height: 22px; }
.btn-ghost { background: transparent; }

/* ═══ Status chips (colour + icon + word) ═══ */
.chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 1px 6px 1px 5px;
  font-family: var(--mono); font-weight: 700; font-size: 9px; letter-spacing: 0.10em;
  text-transform: uppercase; border: 1px solid; white-space: nowrap; line-height: 1.7;
}
.chip svg { width: 10px; height: 10px; }
.chip .gl { width: 5px; height: 5px; flex-shrink: 0; }
.chip-ok    { color: var(--signal-hi); border-color: var(--signal); background: rgba(143,190,117,0.10); }
.chip-ok .gl{ background: var(--signal); }
.chip-warn  { color: var(--warn-hi); border-color: var(--warn); background: rgba(224,180,58,0.10); }
.chip-warn .gl{ background: var(--warn); }
.chip-danger{ color: var(--danger-hi); border-color: var(--danger); background: rgba(210,101,90,0.12); }
.chip-danger .gl{ background: var(--danger); }
.chip-info  { color: var(--info-hi); border-color: var(--info); background: rgba(125,175,214,0.10); }
.chip-info .gl{ background: var(--info); }
.chip-draft { color: var(--draft); border-color: rgba(192,135,90,0.5); background: rgba(192,135,90,0.08); }
.chip-draft .gl{ background: var(--draft); }
.chip-mute  { color: var(--ink-lo); border-color: var(--line-strong); background: transparent; }
.chip-mute .gl{ background: var(--ink-muted); }

/* priority tag */
.ptag { font-family: var(--mono); font-weight: 700; font-size: 10px; letter-spacing: 0.06em;
  padding: 1px 6px; border: 1px solid; min-width: 26px; text-align: center; display: inline-block; }
.ptag.p0 { color: #fff; background: var(--p0); border-color: var(--p0); }
.ptag.p1 { color: #04060A; background: var(--p1); border-color: var(--p1); }
.ptag.p2 { color: var(--info-hi); background: rgba(125,175,214,0.14); border-color: var(--info); }
.ptag.p3 { color: var(--ink-lo); background: transparent; border-color: var(--line-strong); }

/* ═══ Stat strip ═══ */
.stats { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; border-bottom: 1px solid var(--line-strong); }
.stats.cols-8 { grid-template-columns: repeat(8,1fr); grid-auto-flow: row; }
@media (max-width:1300px){ .stats.cols-8 { grid-template-columns: repeat(4,1fr); } }
.stat { padding: 11px 13px 10px; border-right: 1px solid var(--line-strong); position: relative; background: var(--bg-1); }
.stat:last-child { border-right: 0; }
.stats.cols-8 .stat:nth-child(4n){ border-right: 0; }
@media (max-width:1300px){ .stats.cols-8 .stat:nth-child(4n){ border-right:0;} .stats.cols-8 .stat:nth-child(n+5){ border-top:1px solid var(--line-strong);} }
.stat-k { font-family: var(--mono); font-weight: 600; font-size: 8.5px; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--ink-muted); display: flex; justify-content: space-between; }
.stat-v { font-weight: 700; font-size: 23px; line-height: 1.05; color: var(--ink-hi); letter-spacing: -0.025em; margin-top: 4px; }
.stat-v .u { font-family: var(--mono); font-size: 10px; font-weight: 600; color: var(--ink-muted); margin-left: 3px; letter-spacing: 0.04em; }
.stat-sub { font-family: var(--mono); font-weight: 500; font-size: 9.5px; color: var(--ink-lo); margin-top: 3px; letter-spacing: 0.03em;
  display: flex; align-items: center; gap: 5px; }
.stat.t-ok .stat-v { color: var(--signal-hi); }
.stat.t-warn .stat-v { color: var(--warn-hi); }
.stat.t-danger .stat-v { color: var(--danger-hi); }
.stat.t-glow { box-shadow: inset 3px 0 0 var(--signal); }
.delta-up { color: var(--signal-hi); } .delta-dn { color: var(--danger-hi); }

/* ═══ Grid helpers ═══ */
.grid2 { display: grid; grid-template-columns: 1.4fr 1fr; }
.grid2 > * { border-right: 1px solid var(--line-strong); }
.grid2 > *:last-child { border-right: 0; }
@media (max-width:1100px){ .grid2 { grid-template-columns: 1fr; } .grid2 > * { border-right:0; border-bottom:1px solid var(--line-strong);} }
.grid3 { display: grid; grid-template-columns: repeat(3,1fr); }
.grid3 > * { border-right: 1px solid var(--line-strong); }
.grid3 > *:last-child { border-right: 0; }
@media (max-width:1100px){ .grid3 { grid-template-columns: 1fr; } .grid3 > * { border-right:0; border-bottom:1px solid var(--line-strong);} }

/* ═══ Decision / operational item rows ═══ */
.decisions { display: flex; flex-direction: column; }
.drow {
  display: grid; grid-template-columns: 34px 1fr auto; gap: 12px; align-items: start;
  padding: 11px 18px; border-bottom: 1px solid var(--line); text-align: left;
  width: 100%; background: transparent; border-left: 2px solid transparent; color: inherit;
}
.drow:hover { background: rgba(207,212,207,0.022); }
.drow.sel { background: rgba(143,190,117,0.06); border-left-color: var(--signal); }
.drow:last-child { border-bottom: 0; }
.drow-rank { font-family: var(--mono); font-weight: 700; font-size: 16px; color: var(--ink-muted); letter-spacing: -0.02em; line-height: 1; padding-top: 2px; }
.drow.sel .drow-rank { color: var(--signal); }
.drow-main { min-width: 0; }
.drow-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.drow-title { font-size: 13px; font-weight: 600; color: var(--ink-hi); letter-spacing: -0.005em; }
.drow-src { font-family: var(--mono); font-weight: 500; font-size: 9.5px; color: var(--ink-muted); letter-spacing: 0.06em; }
.drow-why { font-size: 11.5px; color: var(--ink-lo); line-height: 1.5; margin: 2px 0 6px; }
.drow-meta { display: flex; flex-wrap: wrap; gap: 7px 14px; font-family: var(--mono); font-size: 9.5px; color: var(--ink-muted); letter-spacing: 0.04em; }
.drow-meta b { color: var(--ink); font-weight: 600; }
.drow-right { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.drow-next { font-family: var(--mono); font-weight: 600; font-size: 9.5px; color: var(--signal-hi); letter-spacing: 0.04em;
  display: flex; align-items: center; gap: 5px; }
.drow-next svg { width: 11px; height: 11px; }

/* ═══ Generic table ═══ */
.t { width: 100%; }
.t thead th { text-align: left; font-family: var(--mono); font-weight: 600; font-size: 8.5px;
  letter-spacing: 0.18em; text-transform: uppercase; color: var(--ink-muted);
  padding: 8px 12px; border-bottom: 1px solid var(--line-strong); background: var(--bg-1); position: sticky; top: 0; white-space: nowrap; }
.t tbody td { padding: 8px 12px; border-bottom: 1px solid var(--line); font-size: 12px; color: var(--ink); vertical-align: middle; }
.t tbody tr { cursor: pointer; }
.t tbody tr:hover { background: rgba(207,212,207,0.025); }
.t tbody tr.sel { background: rgba(143,190,117,0.06); box-shadow: inset 2px 0 0 var(--signal); }
.t b { color: var(--ink-hi); font-weight: 600; }
.t .mono { font-family: var(--mono); font-size: 11px; letter-spacing: 0.04em; color: var(--ink-lo); }
.t .num { text-align: right; font-family: var(--mono); font-weight: 600; letter-spacing: 0.03em; }
.t .name { display: flex; flex-direction: column; gap: 1px; }
.t .name small { font-family: var(--mono); font-size: 9.5px; color: var(--ink-muted); letter-spacing: 0.04em; }

/* ═══ Toolbar / filters ═══ */
.toolbar { display: flex; align-items: stretch; border-bottom: 1px solid var(--line-strong); background: var(--bg-1); flex-wrap: wrap; }
.toolbar .search { flex: 1; min-width: 200px; display: flex; align-items: center; gap: 8px; padding: 7px 11px; border-right: 1px solid var(--line-strong); color: var(--ink-muted); }
.toolbar .search svg { width: 13px; height: 13px; }
.toolbar .search input { flex: 1; background: transparent; border: 0; outline: 0; color: var(--ink-hi); font-size: 12px; font-family: var(--ui); }
.toolbar .search input::placeholder { color: var(--ink-muted); font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.04em; }
.fbtn { padding: 7px 12px; background: transparent; border: 0; border-right: 1px solid var(--line-strong);
  color: var(--ink-lo); font-family: var(--mono); font-weight: 600; font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; white-space: nowrap; }
.fbtn:hover { color: var(--ink-hi); background: rgba(207,212,207,0.02); }
.fbtn.is-on { background: var(--signal); color: #04060A; }
.fbtn .c { font-size: 9px; margin-left: 5px; color: var(--ink-muted); }
.fbtn.is-on .c { color: #04060A; opacity: 0.7; }

/* ═══ Score breakdown ═══ */
.score { display: flex; flex-direction: column; gap: 6px; }
.score-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; }
.score-bar { height: 14px; background: var(--bg-2); border: 1px solid var(--line); position: relative; }
.score-fill { position: absolute; left: 0; top: 0; bottom: 0; background: var(--signal); opacity: 0.85; }
.score-fill.hot { background: var(--danger); }
.score-fill.warm { background: var(--warn); }
.score-label { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 9.5px; color: var(--ink-lo); letter-spacing: 0.04em; margin-bottom: 2px; }
.score-label b { color: var(--ink-hi); font-weight: 600; }
.score-pts { font-family: var(--mono); font-weight: 700; font-size: 11px; color: var(--ink-hi); min-width: 34px; text-align: right; }

/* ═══ Right drawer ═══ */
.drawer {
  background: var(--bg-1); border-left: 1px solid var(--line-strong);
  position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column;
}
.drawer::-webkit-scrollbar { width: 8px; }
.drawer::-webkit-scrollbar-thumb { background: rgba(207,212,207,0.12); }
.dh { padding: 12px 14px; border-bottom: 1px solid var(--line-strong); position: sticky; top: 0; background: var(--bg-1); z-index: 2; }
.dh-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.dh-src { font-family: var(--mono); font-weight: 600; font-size: 9px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-muted); display: flex; align-items: center; gap: 6px; }
.dh-close { width: 22px; height: 22px; border: 1px solid var(--line-strong); background: transparent; color: var(--ink-lo); display: inline-flex; align-items: center; justify-content: center; }
.dh-close:hover { color: var(--ink-hi); border-color: var(--ink-lo); }
.dh-close svg { width: 12px; height: 12px; }
.dh-title { font-size: 14.5px; font-weight: 700; color: var(--ink-hi); letter-spacing: -0.01em; line-height: 1.3; }
.dh-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }

.dsec { padding: 12px 14px; border-bottom: 1px solid var(--line); }
.dsec-h { font-family: var(--mono); font-weight: 600; font-size: 8.5px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--ink-muted); margin-bottom: 9px; display: flex; align-items: center; justify-content: space-between; }
.kv { display: grid; grid-template-columns: 96px 1fr; gap: 5px 10px; font-size: 11.5px; }
.kv dt { font-family: var(--mono); font-size: 9.5px; color: var(--ink-muted); letter-spacing: 0.04em; text-transform: uppercase; padding-top: 1px; }
.kv dd { margin: 0; color: var(--ink); }
.kv dd b { color: var(--ink-hi); font-weight: 600; }
.evidence { display: flex; flex-direction: column; gap: 7px; }
.ev { display: grid; grid-template-columns: auto 1fr; gap: 8px; padding: 8px 9px; background: var(--bg-2); border: 1px solid var(--line); }
.ev-ico { width: 22px; height: 22px; border: 1px solid var(--line-strong); display: inline-flex; align-items: center; justify-content: center; color: var(--ink-lo); }
.ev-ico svg { width: 12px; height: 12px; }
.ev-t { font-size: 11.5px; color: var(--ink-hi); font-weight: 600; }
.ev-d { font-family: var(--mono); font-size: 9.5px; color: var(--ink-muted); letter-spacing: 0.03em; margin-top: 2px; display: flex; gap: 8px; flex-wrap: wrap; }
.ev-d a { color: var(--info-hi); text-decoration: none; border-bottom: 1px solid rgba(125,175,214,0.4); }
.suggest { background: var(--bg-2); border: 1px solid var(--line); border-left: 2px solid var(--signal); padding: 9px 11px; }
.suggest .lbl { font-family: var(--mono); font-weight: 600; font-size: 8.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--signal-hi); margin-bottom: 5px; }
.suggest p { margin: 0; font-size: 11.5px; color: var(--ink); line-height: 1.5; }
.drawer-actions { margin-top: auto; padding: 11px 14px; border-top: 1px solid var(--line-strong); position: sticky; bottom: 0; background: var(--bg-1); display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.drawer-actions .btn { width: 100%; justify-content: center; }
.drawer-actions .wide { grid-column: 1/-1; }

/* audit trail */
.trail { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; }
.trail li { display: grid; grid-template-columns: 12px 1fr; gap: 9px; padding: 5px 0; position: relative; }
.trail li::before { content:''; position: absolute; left: 5px; top: 14px; bottom: -5px; width: 1px; background: var(--line-strong); }
.trail li:last-child::before { display: none; }
.trail .tdot { width: 7px; height: 7px; border: 1px solid var(--signal); background: var(--bg-1); margin-top: 4px; }
.trail .tx { font-size: 11px; color: var(--ink); }
.trail .tm { font-family: var(--mono); font-size: 9px; color: var(--ink-muted); letter-spacing: 0.04em; margin-top: 1px; }

/* ═══ Event stream feed ═══ */
.feed { list-style: none; padding: 0; margin: 0; }
.feed li { display: grid; grid-template-columns: auto auto 1fr auto; align-items: center; gap: 10px;
  padding: 7px 18px; border-bottom: 1px solid var(--line); font-size: 12px; color: var(--ink); }
.feed li:last-child { border-bottom: 0; }
.feed .fid { font-family: var(--mono); font-weight: 500; font-size: 9px; color: var(--ink-muted); letter-spacing: 0.04em; }
.feed .fdot { width: 6px; height: 6px; }
.feed .ftime { font-family: var(--mono); font-size: 9.5px; color: var(--ink-muted); letter-spacing: 0.04em; }
.feed b { color: var(--ink-hi); font-weight: 600; }

/* ═══ Card (boxed) ═══ */
.box { background: var(--bg-1); border: 1px solid var(--line-strong); padding: 12px 13px; }
.box-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.box-h .ov { font-family: var(--mono); font-weight: 600; font-size: 8.5px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--ink-muted); }
.box-h h3 { margin: 2px 0 0; font-size: 13px; font-weight: 700; color: var(--ink-hi); letter-spacing: -0.01em; }
.cardgrid { display: grid; gap: 12px; padding: 14px 18px; }
.cardgrid.c2 { grid-template-columns: 1fr 1fr; }
.cardgrid.c3 { grid-template-columns: repeat(3,1fr); }
.cardgrid.c4 { grid-template-columns: repeat(4,1fr); }
@media (max-width:1100px){ .cardgrid.c3,.cardgrid.c4{ grid-template-columns: 1fr 1fr; } }

/* mini list */
.mlist { display: flex; flex-direction: column; }
.mlist li, .mlist .mrow { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center;
  padding: 8px 0; border-top: 1px solid var(--line); list-style: none; }
.mlist > :first-child { border-top: 0; }
.mlist .mt { font-size: 12px; color: var(--ink-hi); font-weight: 600; }
.mlist .md { font-family: var(--mono); font-size: 9.5px; color: var(--ink-muted); letter-spacing: 0.04em; margin-top: 1px; }
.mlist .mdot { width: 6px; height: 6px; }

/* data freshness stamp */
.fresh { display: inline-flex; align-items: center; gap: 6px; font-family: var(--mono); font-weight: 500; font-size: 9px;
  letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-muted); }
.fresh .fd { width: 5px; height: 5px; }
.fresh.live .fd { background: var(--signal); } .fresh.live { color: var(--signal-hi); }
.fresh.stale .fd { background: var(--warn); } .fresh.stale { color: var(--warn-hi); }
.fresh.missing .fd { background: var(--danger); } .fresh.missing { color: var(--danger-hi); }
.fresh.manual .fd { background: var(--info); } .fresh.manual { color: var(--info-hi); }

/* sparkline / bars */
.bars { display: flex; align-items: flex-end; gap: 2px; height: 38px; }
.bars i { flex: 1; background: var(--signal); opacity: 0.5; min-height: 2px; }
.bars i.hot { background: var(--danger); opacity: 0.8; }
.bars i.last { opacity: 0.95; }

/* progress */
.prog { height: 6px; background: var(--bg-2); border: 1px solid var(--line); position: relative; }
.prog i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--signal); }
.prog i.warm { background: var(--warn); }
.prog i.hot { background: var(--danger); }

/* ═══ Command palette ═══ */
.cmdk-scrim { position: fixed; inset: 0; background: rgba(4,6,10,0.72); z-index: 1000; display: flex; align-items: flex-start; justify-content: center; padding-top: 11vh; backdrop-filter: blur(2px); }
.cmdk { width: min(640px, 92vw); background: var(--bg-1); border: 1px solid var(--line-strong); box-shadow: 0 24px 80px rgba(0,0,0,0.6); }
.cmdk-in { display: grid; grid-template-columns: auto 1fr auto; gap: 11px; align-items: center; padding: 13px 15px; border-bottom: 1px solid var(--line-strong); }
.cmdk-in svg { width: 16px; height: 16px; color: var(--ink-muted); }
.cmdk-in input { flex: 1; width: 100%; background: transparent; border: 0; outline: 0; color: var(--ink-hi); font-size: 15px; font-family: var(--ui); }
.cmdk-in input::placeholder { color: var(--ink-muted); }
.cmdk-in .esc { font-family: var(--mono); font-size: 9px; color: var(--ink-muted); border: 1px solid var(--line-strong); padding: 2px 6px; letter-spacing: 0.08em; }
.cmdk-list { max-height: 52vh; overflow-y: auto; }
.cmdk-grp { font-family: var(--mono); font-weight: 600; font-size: 8.5px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--ink-muted); padding: 9px 15px 5px; }
.cmdk-item { display: grid; grid-template-columns: 26px 1fr auto; gap: 11px; align-items: center; width: 100%; text-align: left;
  padding: 8px 15px; background: transparent; border: 0; color: var(--ink); border-left: 2px solid transparent; }
.cmdk-item:hover, .cmdk-item.cur { background: rgba(143,190,117,0.08); border-left-color: var(--signal); color: var(--ink-hi); }
.cmdk-ico { width: 26px; height: 26px; border: 1px solid var(--line-strong); display: inline-flex; align-items: center; justify-content: center; color: var(--ink-lo); }
.cmdk-ico svg { width: 13px; height: 13px; }
.cmdk-t { font-size: 12.5px; font-weight: 600; color: var(--ink-hi); }
.cmdk-d { font-family: var(--mono); font-size: 9.5px; color: var(--ink-muted); letter-spacing: 0.04em; margin-top: 1px; }
.cmdk-kind { font-family: var(--mono); font-weight: 600; font-size: 8.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-muted); border: 1px solid var(--line-strong); padding: 1px 6px; }

/* ═══ Tabs ═══ */
.tabs { display: flex; border-bottom: 1px solid var(--line-strong); background: var(--bg-0); overflow-x: auto; }
.tab { padding: 9px 14px; background: transparent; border: 0; border-right: 1px solid var(--line); color: var(--ink-lo);
  font-family: var(--ui); font-weight: 600; font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; white-space: nowrap; position: relative; }
.tab:hover { color: var(--ink-hi); }
.tab.is-active { color: var(--ink-hi); background: var(--bg-1); }
.tab.is-active::after { content:''; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--signal); }
.tab .c { font-family: var(--mono); font-size: 9px; margin-left: 6px; color: var(--ink-muted); }

/* placeholder image slot */
.imgslot { background: var(--bg-2); border: 1px solid var(--line); position: relative; overflow: hidden;
  background-image: repeating-linear-gradient(45deg, transparent 0 9px, rgba(207,212,207,0.03) 9px 10px);
  display: flex; align-items: center; justify-content: center; }
.imgslot span { font-family: var(--mono); font-size: 9.5px; color: var(--ink-muted); letter-spacing: 0.1em; text-transform: uppercase; }

/* markdown reader */
.md-body { font-size: 13px; line-height: 1.7; color: var(--ink); max-width: 70ch; }
.md-body h1 { font-size: 20px; color: var(--ink-hi); font-weight: 700; letter-spacing: -0.02em; margin: 0 0 12px; }
.md-body h2 { font-size: 15px; color: var(--ink-hi); font-weight: 700; margin: 22px 0 8px; padding-top: 14px; border-top: 1px solid var(--line); }
.md-body h3 { font-size: 13px; color: var(--signal-hi); font-weight: 700; margin: 16px 0 6px; letter-spacing: 0.02em; }
.md-body p { margin: 0 0 11px; color: var(--ink-lo); }
.md-body ul { margin: 0 0 12px; padding-left: 18px; color: var(--ink-lo); }
.md-body li { margin-bottom: 4px; }
.md-body strong { color: var(--ink-hi); font-weight: 600; }
.md-body code { font-family: var(--mono); font-size: 11px; background: var(--bg-2); padding: 1px 5px; border: 1px solid var(--line); color: var(--signal-hi); }
.md-body .mdmark { background: rgba(224,180,58,0.14); border-bottom: 1px solid var(--warn); cursor: pointer; }

/* readiness ring */
.ring-wrap { display: flex; align-items: center; gap: 16px; }
.ring { position: relative; width: 96px; height: 96px; flex-shrink: 0; }
.ring b { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ring .rv { font-weight: 700; font-size: 24px; color: var(--ink-hi); letter-spacing: -0.02em; line-height: 1; }
.ring .rl { font-family: var(--mono); font-size: 8.5px; color: var(--ink-muted); letter-spacing: 0.14em; text-transform: uppercase; margin-top: 2px; }

/* misc */
.muted { color: var(--ink-muted); }
.mono { font-family: var(--mono); }
.hl { color: var(--ink-hi); }
.sig { color: var(--signal-hi); }
.row-flex { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.divider { height: 1px; background: var(--line); margin: 10px 0; }
.nowrap { white-space: nowrap; }

/* empty / loading / error states */
.state { padding: 34px 18px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 9px; }
.state-ico { width: 44px; height: 44px; border: 1px solid var(--line-strong); display: inline-flex; align-items: center; justify-content: center; color: var(--ink-muted); }
.state-ico svg { width: 22px; height: 22px; }
.state h4 { margin: 0; font-size: 13px; color: var(--ink-hi); font-weight: 600; }
.state p { margin: 0; font-size: 11.5px; color: var(--ink-muted); max-width: 42ch; }
.skel { background: linear-gradient(90deg, var(--bg-2) 25%, rgba(207,212,207,0.06) 50%, var(--bg-2) 75%); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; height: 12px; }
@keyframes shimmer { 0%{background-position:200% 0;} 100%{background-position:-200% 0;} }
@media (prefers-reduced-motion: reduce){ .skel{ animation: none; } }

/* mobile founder mode toggle (hidden helper) */
@media (max-width: 820px) {
  .app, .app.drawer-open { grid-template-columns: 1fr; }
  .sb { display: none; }
  .drawer { position: fixed; inset: 0; z-index: 900; width: 100%; }
  .hide-mobile { display: none !important; }
  .tb {
    grid-template-columns: minmax(0,1fr) auto auto;
    gap: 8px;
    padding: 8px 10px;
  }
  .tb-title-block { min-width: 0; }
  .tb-crumb { font-size: 8px; letter-spacing: 0.08em; min-width: 0; }
  .tb-title { font-size: 14px; }
  .tb-search {
    width: 132px;
    min-width: 0;
    justify-self: end;
    padding: 6px 8px;
  }
  .tb-search span:not(.k) { display: none; }
  .tb-search .k { font-size: 8px; padding: 0 4px; }
  .tb-right .sb-roles { display: none; }
  .page-intro {
    grid-template-columns: 1fr;
    align-items: start;
    padding: 16px 18px 12px;
  }
  .page-intro h1 { font-size: 20px; max-width: 14ch; }
  .page-intro .lede { max-width: 30ch; }
  .page-actions {
    width: 100%;
    flex-wrap: wrap;
    justify-content: flex-start;
  }
  .page-actions .btn { flex: 1 1 150px; justify-content: center; }
  .stats.cols-8 { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .stats.cols-8 .stat {
    border-right: 1px solid var(--line-strong);
    border-top: 1px solid var(--line-strong);
  }
  .stats.cols-8 .stat:nth-child(1),
  .stats.cols-8 .stat:nth-child(2) { border-top: 0; }
  .stats.cols-8 .stat:nth-child(2n) { border-right: 0; }
  .stat { min-width: 0; }
  .stat-v { font-size: 21px; }
  .sec-h {
    flex-wrap: wrap;
    align-items: flex-start;
    padding: 9px 14px;
  }
  .sec-h .ttl {
    min-width: 0;
    flex-wrap: wrap;
    gap: 5px 8px;
  }
  .sec-h .meta { flex-basis: 100%; }
  .drow {
    grid-template-columns: 26px minmax(0,1fr);
    gap: 8px;
    padding: 12px 14px;
  }
  .drow-rank { font-size: 14px; }
  .drow-title { font-size: 12.5px; }
  .drow-right {
    grid-column: 2;
    align-items: flex-start;
    min-width: 0;
  }
  .drow-next {
    white-space: normal;
    line-height: 1.35;
    align-items: flex-start;
  }
  .drow-meta { gap: 5px 10px; }
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .cardgrid.c2,
  .cardgrid.c3,
  .cardgrid.c4 { grid-template-columns: 1fr; }
  .toolbar .search { flex-basis: 100%; border-right: 0; }
  .fbtn { flex: 1 1 auto; }
}
.scroll-x { overflow-x: auto; }

/* ═══ Icon wrapper sizing (all SVGs render inside .ic) — placed last so it wins ═══ */
.ic { display: inline-flex; align-items: center; justify-content: center; width: 14px; height: 14px; flex-shrink: 0; }
.ic svg { width: 100%; height: 100%; display: block; }
.ic.flip svg { transform: rotate(180deg); }
.sb-group-h .ic { width: 15px; height: 15px; }
.btn .ic { width: 13px; height: 13px; }
.btn-sm .ic { width: 11px; height: 11px; }
.chip .ic { width: 11px; height: 11px; }
.tb-search .ic, .cmdk-in .ic { width: 15px; height: 15px; }
.tb-crumb .ic { width: 11px; height: 11px; }
.drow-next .ic { width: 11px; height: 11px; }
.icon-btn .ic { width: 14px; height: 14px; }
.state-ico .ic { width: 22px; height: 22px; }
.ev-ico .ic, .cmdk-ico .ic, .dh-close .ic { width: 12px; height: 12px; }
.dh-src .ic { width: 12px; height: 12px; }
.mlist .ic { width: 12px; height: 12px; }
.sb-brand-chev .ic { width: 10px; height: 10px; }

/* Runtime diagnostics stamp */
.runtime-stamp {
  position: fixed;
  right: 12px;
  bottom: 12px;
  z-index: 1090;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  max-width: calc(100vw - 24px);
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid rgba(125,175,214,0.55);
  border-radius: 999px;
  background: rgba(17,42,51,0.88);
  color: var(--info-hi);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  box-shadow: 0 8px 24px rgba(0,0,0,0.45);
  backdrop-filter: blur(8px);
}
.runtime-stamp:hover {
  border-color: var(--info-hi);
  color: #C8E3F4;
}
.runtime-scrim {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(4,6,10,0.72);
  backdrop-filter: blur(3px);
}
.runtime-panel {
  width: min(760px, 100%);
  max-height: 82vh;
  overflow: auto;
  padding: 18px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--bg-1);
  box-shadow: 0 24px 80px rgba(0,0,0,0.62);
}
.runtime-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.runtime-panel h2 {
  margin: 0;
  color: var(--ink-hi);
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.01em;
}
.runtime-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}
.runtime-action {
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: transparent;
  color: var(--ink-hi);
  font-weight: 800;
}
.runtime-action:hover {
  border-color: var(--ink-lo);
}
.runtime-action-primary {
  border-color: rgba(125,175,214,0.55);
  background: rgba(17,42,51,0.88);
  color: var(--info-hi);
}
.runtime-pre {
  margin: 16px 0 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.55;
}

@media (max-width: 820px) {
  .runtime-stamp {
    right: 8px;
    bottom: 8px;
    min-height: 30px;
    padding: 0 10px;
    font-size: 10px;
  }
  .runtime-panel {
    max-height: 88vh;
    padding: 14px;
  }
  .runtime-panel-head {
    align-items: flex-start;
    flex-direction: column;
  }
  .runtime-actions {
    width: 100%;
    justify-content: flex-start;
  }
}
