/* ════════════════════════════════════════════════════════════════════════
   Veriax Console — Home / "Mission Control"
   Evolves the existing dark system (styles.css). Adds:
   • A full LIGHT theme (the base app has none yet) so Home works in both.
   • NEW tokens, all in-family: an accent→accent-2 gradient (no rainbow),
     an accent glow, a dot/line grid, top-light on cards, a green --live.
   • Direction scopes: [data-dir="a"] (sobrio evoluto) · [data-dir="b"] (cockpit).
   ════════════════════════════════════════════════════════════════════════ */

:root {
  /* ── NEW tokens (dark) ───────────────────────────────────────────────── */
  --live:            #2fb37a;                      /* green = live / healthy */
  --live-soft:       rgba(47, 179, 122, 0.16);
  --live-ring:       rgba(47, 179, 122, 0.40);

  --grad-accent:     linear-gradient(135deg, #6a91ff 0%, #3a63e0 100%);
  --grad-accent-soft:linear-gradient(135deg, rgba(106,145,255,.20), rgba(58,99,224,.06));
  --grad-text:       linear-gradient(100deg, #8aa6ff 0%, #4e7cff 60%);

  --glow-accent:     0 0 0 1px var(--accent-ring), 0 10px 40px -8px rgba(78,124,255,.45);
  --glow-live:       0 0 0 3px var(--live-ring);
  --card-toplight:   linear-gradient(180deg, rgba(255,255,255,.035), rgba(255,255,255,0) 42%);

  --grid-dot:        rgba(120,140,210,.10);
  --grid-line:       rgba(120,140,210,.045);

  --ring-track:      #20212c;
  --spark-grid:      rgba(255,255,255,.04);

  --pos:             var(--success);
  --neg:             var(--danger);

  /* number rendering */
  font-variant-numeric: tabular-nums;
}

/* ── LIGHT THEME ──────────────────────────────────────────────────────────
   A sober, blue-tinted light palette mirroring the dark token scale.
   Scoped to pages that load home.css (won't touch the rest of the app). */
html[data-theme="light"] {
  --bg-app:        #eef0f5;
  --bg-sidebar:    #e8eaf1;
  --bg-content:    #ffffff;
  --bg-card:       #ffffff;
  --bg-card-hover: #f5f6fb;
  --bg-elev:       #ffffff;
  --bg-overlay:    rgba(20, 24, 40, 0.34);

  --border-faint:  #e6e8f0;
  --border:        #dcdfea;
  --border-strong: #c5c9d8;
  --border-focus:  #4e7cff;

  --text:          #1d2030;
  --text-strong:   #0c0e18;
  --text-muted:    #5d6276;
  --text-faint:    #9499ac;
  --text-link:     #3a63e0;

  --accent:        #3f6dff;
  --accent-2:      #2f55cc;
  --accent-soft:   rgba(63, 109, 255, 0.12);
  --accent-ring:   rgba(63, 109, 255, 0.30);

  --folder:        #5b78c4;
  --folder-soft:   rgba(91, 120, 196, 0.13);

  --success:       #18935f;
  --warn:          #b9821f;
  --danger:        #d2453f;

  --shadow-sm: 0 1px 2px rgba(16,22,48,.06);
  --shadow:    0 8px 28px rgba(16,22,48,.10);
  --shadow-lg: 0 28px 64px rgba(16,22,48,.16);

  /* light overrides for the NEW tokens */
  --live:            #18935f;
  --live-soft:       rgba(24, 147, 95, 0.12);
  --live-ring:       rgba(24, 147, 95, 0.32);

  --grad-accent:     linear-gradient(135deg, #5b85ff 0%, #2f55cc 100%);
  --grad-accent-soft:linear-gradient(135deg, rgba(91,133,255,.16), rgba(47,85,204,.05));
  --grad-text:       linear-gradient(100deg, #3f6dff 0%, #2f55cc 70%);

  --glow-accent:     0 0 0 1px var(--accent-ring), 0 12px 36px -10px rgba(63,109,255,.38);
  --glow-live:       0 0 0 3px var(--live-ring);
  --card-toplight:   linear-gradient(180deg, rgba(20,30,80,.020), rgba(0,0,0,0) 46%);

  --grid-dot:        rgba(40,60,140,.07);
  --grid-line:       rgba(40,60,140,.035);

  --ring-track:      #e6e8f1;
  --spark-grid:      rgba(20,30,80,.05);
}

/* ════════════════════════════════════════════════════════════════════════
   Page scaffold
   ════════════════════════════════════════════════════════════════════════ */

.home-main { position: relative; }

/* background grid layer, fixed to the scroll container */
.home-bg {
  position: absolute; inset: 0;
  pointer-events: none; z-index: 0;
}
.home-bg::before {
  content: ""; position: absolute; inset: 0;
  background-image: radial-gradient(var(--grid-dot) 1px, transparent 1.4px);
  background-size: 24px 24px;
  background-position: -1px -1px;
}
/* B adds faint ruled lines + a soft accent glow bleeding from the top */
[data-dir="b"] .home-bg::after {
  content: ""; position: absolute; inset: 0;
  background:
    linear-gradient(var(--grid-line) 1px, transparent 1px) 0 0 / 100% 96px,
    radial-gradient(900px 380px at 24% -8%, rgba(78,124,255,.14), transparent 70%);
}

.home-inner {
  position: relative; z-index: 1;
  max-width: 1640px;
  padding: 22px 30px 64px;
}

/* ── Topbar ─────────────────────────────────────────────────────────────── */
.home-topbar {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 20px; margin-bottom: 22px;
}
.home-eyebrow {
  display: flex; align-items: center; gap: 9px;
  font-family: var(--mono); font-size: 11.5px; letter-spacing: .06em;
  text-transform: uppercase; color: var(--text-faint);
  margin-bottom: 8px;
}
.home-eyebrow .sep { opacity: .5; }
.home-title {
  font-size: 27px; font-weight: 560; letter-spacing: -.015em;
  color: var(--text-strong); margin: 0;
  display: flex; align-items: center; gap: 14px;
}
[data-dir="b"] .home-title { font-size: 30px; }
.home-sub { color: var(--text-muted); font-size: 14px; margin: 6px 0 0; }

.home-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

/* live system pill */
.sys-pill {
  display: inline-flex; align-items: center; gap: 9px;
  height: 30px; padding: 0 12px 0 11px;
  border-radius: 999px;
  background: var(--live-soft);
  border: 1px solid color-mix(in oklab, var(--live) 32%, transparent);
  color: var(--live);
  font-size: 12.5px; font-weight: 560;
  white-space: nowrap;
}
.live-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--live);
  box-shadow: 0 0 0 0 var(--live-ring);
  position: relative; flex-shrink: 0;
}
.live-dot.beat { animation: livePulse 2.4s ease-out infinite; }
@keyframes livePulse {
  0%   { box-shadow: 0 0 0 0 var(--live-ring); }
  70%  { box-shadow: 0 0 0 7px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

/* segmented range control (no native select — project rule) */
.seg {
  display: inline-flex; align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border-faint);
  border-radius: 9px; padding: 3px; gap: 2px;
}
.seg button {
  background: transparent; border: 0; cursor: pointer;
  padding: 6px 11px; border-radius: 6px;
  color: var(--text-muted); font-size: 12.5px; font-weight: 540;
  font-variant-numeric: tabular-nums;
}
.seg button:hover { color: var(--text); }
.seg button.on {
  background: var(--bg-elev); color: var(--text);
  box-shadow: 0 1px 2px rgba(0,0,0,.18);
}
[data-theme="light"] .seg button.on { box-shadow: var(--shadow-sm); }

/* primary CTA gets the in-family gradient + glow in B; flat accent in A */
.btn.cta {
  height: 36px; padding: 0 16px; font-weight: 560;
  background: var(--accent); color: #fff; border-color: var(--accent);
}
.btn.cta:hover { background: #6a91ff; border-color: #6a91ff; }
[data-dir="b"] .btn.cta {
  background-image: var(--grad-accent);
  border-color: transparent;
  box-shadow: var(--glow-accent);
}
[data-dir="b"] .btn.cta:hover { filter: brightness(1.06); }

/* small ghost link used for the A↔B direction switch */
.dir-switch {
  display: inline-flex; align-items: center; gap: 7px;
  height: 30px; padding: 0 11px; border-radius: 8px;
  border: 1px dashed var(--border-strong);
  color: var(--text-muted); font-size: 12.5px; font-weight: 520;
  font-family: var(--mono); letter-spacing: .02em;
}
.dir-switch:hover { color: var(--text); border-color: var(--accent); }
.dir-switch b { color: var(--accent); font-weight: 600; }

/* ════════════════════════════════════════════════════════════════════════
   Generic panel + section heads
   ════════════════════════════════════════════════════════════════════════ */
.panel {
  position: relative; overflow: hidden;
  background: var(--card-toplight), var(--bg-card);
  border: 1px solid var(--border-faint);
  border-radius: var(--r-lg);
}
.panel-head {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 15px;
  border-bottom: 1px solid var(--border-faint);
}
.panel-head .ph-ico {
  width: 26px; height: 26px; border-radius: 7px;
  display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent);
  flex-shrink: 0;
}
.panel-title { font-size: 13.5px; font-weight: 560; color: var(--text-strong); }
.panel-sub   { font-size: 12px; color: var(--text-faint); margin-top: 1px; }
.panel-head .grow { flex: 1; }
.panel-body { padding: 14px 15px; }

/* keep sidebar + eyebrow on one line in the Home context */
.app[data-dir] .side-item { white-space: nowrap; }
.app[data-dir] .side-item > svg { flex: 0 0 auto; }
.app[data-dir] .side-item > span { flex: 0 0 auto; white-space: nowrap; }
.home-eyebrow { white-space: nowrap; }

.sec-label {
  font-family: var(--mono); font-size: 11px; letter-spacing: .07em;
  text-transform: uppercase; color: var(--text-faint);
  display: flex; align-items: center; gap: 8px; margin: 0 0 12px;
}
.sec-label .ln { flex: 1; height: 1px; background: var(--border-faint); }

.mono { font-family: var(--mono); }
.tnum { font-variant-numeric: tabular-nums; }

/* ════════════════════════════════════════════════════════════════════════
   KPI tiles
   ════════════════════════════════════════════════════════════════════════ */
.kpi-row {
  display: grid; gap: 13px; margin-bottom: 18px;
  grid-template-columns: repeat(5, 1fr);
}
@media (max-width: 1320px) { .kpi-row { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 880px)  { .kpi-row { grid-template-columns: repeat(2, 1fr); } }

.kpi {
  position: relative; overflow: hidden;
  background: var(--card-toplight), var(--bg-card);
  border: 1px solid var(--border-faint);
  border-radius: var(--r-lg);
  padding: 14px 15px 0;
  display: flex; flex-direction: column;
  min-height: 116px;
  transition: border-color .16s, transform .16s, box-shadow .16s;
}
.kpi:hover { border-color: var(--border); transform: translateY(-1px); }
[data-dir="b"] .kpi:hover { box-shadow: var(--glow-accent); border-color: transparent; }

.kpi-top { display: flex; align-items: center; gap: 8px; }
.kpi-ico {
  width: 24px; height: 24px; border-radius: 7px;
  display: grid; place-items: center; flex-shrink: 0;
  background: var(--accent-soft); color: var(--accent);
}
.kpi-label {
  font-size: 12px; color: var(--text-muted); font-weight: 520;
  letter-spacing: .01em;
}
.kpi-valrow { display: flex; align-items: baseline; gap: 9px; margin-top: 9px; }
.kpi-value {
  font-size: 27px; font-weight: 580; letter-spacing: -.02em;
  color: var(--text-strong); line-height: 1; font-variant-numeric: tabular-nums;
}
.kpi-value .unit { font-size: 14px; font-weight: 500; color: var(--text-muted); margin-left: 2px; letter-spacing: 0; }
[data-dir="b"] .kpi.hero .kpi-value {
  background: var(--grad-text); -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}
.kpi-delta {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 12px; font-weight: 560; font-variant-numeric: tabular-nums;
}
.kpi-delta.pos { color: var(--pos); }
.kpi-delta.neg { color: var(--neg); }
.kpi-delta .arr { font-size: 10px; }
.kpi-foot {
  font-size: 11px; color: var(--text-faint); margin-top: 3px;
  font-family: var(--mono);
}
.kpi-spark { margin-top: auto; margin-left: -15px; margin-right: -15px; }
.kpi-spark svg { display: block; width: 100%; height: 38px; }

/* ════════════════════════════════════════════════════════════════════════
   Main two-column layout
   ════════════════════════════════════════════════════════════════════════ */
.home-grid {
  display: grid; gap: 16px;
  grid-template-columns: minmax(0, 1.62fr) minmax(320px, 1fr);
  align-items: start;
}
@media (max-width: 1180px) { .home-grid { grid-template-columns: 1fr; } }
.home-col { display: flex; flex-direction: column; gap: 16px; }

/* Corpo home a due colonne uguali — ogni sezione occupa metà larghezza */
.hd-cols {
  display: grid; gap: 16px;
  grid-template-columns: 1fr 1fr;
  align-items: start;
}
@media (max-width: 1100px) { .hd-cols { grid-template-columns: 1fr; } }

/* ════════════════════════════════════════════════════════════════════════
   Live activity feed
   ════════════════════════════════════════════════════════════════════════ */
.feed { display: flex; flex-direction: column; }
.feed-scroll { max-height: 540px; overflow-y: auto; }
.feed-row {
  display: grid; grid-template-columns: 30px 1fr auto;
  gap: 11px; align-items: start;
  padding: 11px 15px;
  border-bottom: 1px solid var(--border-faint);
  position: relative;
}
.feed-row:last-child { border-bottom: 0; }
.feed-row.fresh { animation: feedIn .42s cubic-bezier(.2,.8,.25,1); }
.feed-row.fresh::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 2px;
  background: var(--accent); animation: edgeFade 1.6s ease forwards;
}
@keyframes feedIn {
  from { opacity: 0; transform: translateY(-9px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes edgeFade { from { opacity: 1; } to { opacity: 0; } }

.feed-av {
  width: 30px; height: 30px; border-radius: 8px;
  display: grid; place-items: center; flex-shrink: 0;
  color: #fff; font-size: 11px; font-weight: 600;
  position: relative;
}
.feed-av svg { opacity: .95; }
.feed-mid { min-width: 0; }
.feed-line1 { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.feed-agent { font-size: 13px; font-weight: 560; color: var(--text-strong); }
.feed-verb  { font-size: 13px; color: var(--text-muted); }
.feed-line2 { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 5px; }

.tool-chip {
  display: inline-flex; align-items: center; gap: 5px;
  height: 21px; padding: 0 8px; border-radius: 6px;
  background: var(--bg-elev); border: 1px solid var(--border-faint);
  font-family: var(--mono); font-size: 11px; color: var(--text-muted);
  white-space: nowrap;
}
.tool-chip svg { color: var(--text-faint); }
.tool-chip.run { color: var(--accent); border-color: color-mix(in oklab, var(--accent) 35%, transparent); }
.tool-chip .ms { color: var(--text-faint); }

.feed-right { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; flex-shrink: 0; }
.feed-status {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px; font-weight: 540; font-family: var(--mono);
}
.feed-status .d { width: 7px; height: 7px; border-radius: 50%; }
.st-ok   { color: var(--live); }      .st-ok .d   { background: var(--live); }
.st-run  { color: var(--accent); }    .st-run .d  { background: var(--accent); animation: blink 1s steps(2,end) infinite; }
.st-warn { color: var(--warn); }      .st-warn .d { background: var(--warn); }
.st-err  { color: var(--danger); }    .st-err .d  { background: var(--danger); }
@keyframes blink { 50% { opacity: .3; } }
.feed-time { font-family: var(--mono); font-size: 11px; color: var(--text-faint); }

/* tool-call timeline (B feed) */
.tcline { display: flex; align-items: center; gap: 0; margin-top: 7px; }
.tcline .seg2 {
  height: 5px; border-radius: 3px; flex-shrink: 0;
  background: var(--accent); opacity: .85;
}
.tcline .gap { width: 3px; }
.tcline .seg2.tool { background: var(--folder); }
.tcline .seg2.think { background: var(--border-strong); }

.feed-foot {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 15px; border-top: 1px solid var(--border-faint);
  font-size: 12px; color: var(--text-faint);
}
.feed-foot .pausebtn {
  display: inline-flex; align-items: center; gap: 6px;
  background: transparent; border: 0; cursor: pointer;
  color: var(--text-muted); font-size: 12px; font-weight: 520;
  padding: 4px 8px; border-radius: 6px;
}
.feed-foot .pausebtn:hover { background: var(--bg-elev); color: var(--text); }

/* ════════════════════════════════════════════════════════════════════════
   Status: health bars (A) + rings (B)
   ════════════════════════════════════════════════════════════════════════ */
.health-list { display: flex; flex-direction: column; gap: 13px; }
.health-row { display: grid; grid-template-columns: 22px 1fr auto; gap: 10px; align-items: center; }
.health-ico { color: var(--text-muted); display: grid; place-items: center; }
.health-name { font-size: 12.5px; color: var(--text); }
.health-meta { font-family: var(--mono); font-size: 11px; color: var(--text-faint); margin-top: 2px; }
.health-bar { grid-column: 2 / 4; height: 5px; border-radius: 3px; background: var(--ring-track); overflow: hidden; margin-top: 7px; }
.health-bar > i { display: block; height: 100%; border-radius: 3px; background: var(--live); transition: width 1s cubic-bezier(.2,.8,.2,1); }
.health-bar > i.warn { background: var(--warn); }
.health-bar > i.err  { background: var(--danger); }
.health-pct { font-family: var(--mono); font-size: 12px; color: var(--text-muted); font-variant-numeric: tabular-nums; }

/* big concentric ring (B hero) */
.ringwrap { position: relative; display: grid; place-items: center; }
.ringwrap .ring-center {
  position: absolute; inset: 0; display: grid; place-items: center; text-align: center;
}
.ring-big-val { font-size: 34px; font-weight: 600; letter-spacing: -.02em; color: var(--text-strong); line-height: 1; }
.ring-big-lbl { font-family: var(--mono); font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-faint); margin-top: 5px; }
.ring-seg { stroke-dashoffset: var(--off, 0); }
@media (prefers-reduced-motion: no-preference) {
  .ring-seg { animation: ringSweep 1.1s cubic-bezier(.2,.8,.2,1) both; }
}
@keyframes ringSweep { from { stroke-dashoffset: var(--c); } to { stroke-dashoffset: var(--off); } }
/* capture escape hatch: freeze entrance animations at their resting state */
html[data-still] .ring-seg, html[data-still] .spark-draw { animation: none !important; }
html[data-still] .spark-draw { stroke-dashoffset: 0 !important; }

/* small subsystem ring chips (B) */
.ring-chips { display: grid; grid-template-columns: repeat(2, 1fr); gap: 11px; }
.ring-chip {
  display: flex; align-items: center; gap: 11px;
  padding: 11px 12px; border-radius: 10px;
  background: var(--bg-elev); border: 1px solid var(--border-faint);
}
.ring-chip .rc-txt { min-width: 0; }
.ring-chip .rc-name { font-size: 12.5px; color: var(--text); font-weight: 520; }
.ring-chip .rc-meta { font-family: var(--mono); font-size: 11px; color: var(--text-faint); margin-top: 2px; }

/* ════════════════════════════════════════════════════════════════════════
   Hourly heat strip (B)
   ════════════════════════════════════════════════════════════════════════ */
.heat { display: flex; gap: 3px; align-items: flex-end; }
.heat-cell {
  flex: 1; border-radius: 3px; min-width: 0;
  background: var(--accent); cursor: default;
  transition: opacity .15s, transform .15s;
}
.heat-cell:hover { transform: scaleY(1.06); }
.heat-axis { display: flex; justify-content: space-between; margin-top: 7px; font-family: var(--mono); font-size: 10px; color: var(--text-faint); }

/* ════════════════════════════════════════════════════════════════════════
   Quick actions
   ════════════════════════════════════════════════════════════════════════ */
.qa-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 9px; }
.qa {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 12px; border-radius: 10px;
  background: var(--bg-elev); border: 1px solid var(--border-faint);
  cursor: pointer; text-align: left;
  transition: border-color .14s, background .14s, transform .14s;
}
.qa:hover { border-color: var(--accent); background: var(--bg-card-hover); transform: translateY(-1px); }
.qa-ico {
  width: 30px; height: 30px; border-radius: 8px; flex-shrink: 0;
  display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent);
}
[data-dir="b"] .qa:hover .qa-ico { background-image: var(--grad-accent); color: #fff; }
.qa-name { font-size: 12.5px; font-weight: 540; color: var(--text); }
.qa-sub  { font-size: 11px; color: var(--text-faint); margin-top: 1px; }

/* ════════════════════════════════════════════════════════════════════════
   Recent threads
   ════════════════════════════════════════════════════════════════════════ */
.thread { display: flex; align-items: center; gap: 11px; padding: 10px 4px; border-bottom: 1px solid var(--border-faint); cursor: pointer; }
.thread:last-child { border-bottom: 0; }
.thread:hover .th-title { color: var(--accent); }
.th-av { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; color: #fff; font-size: 10px; font-weight: 600; flex-shrink: 0; }
.th-mid { min-width: 0; flex: 1; }
.th-title { font-size: 12.5px; font-weight: 540; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: color .14s; }
.th-snip { font-size: 11.5px; color: var(--text-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.th-right { text-align: right; flex-shrink: 0; }
.th-time { font-family: var(--mono); font-size: 10.5px; color: var(--text-faint); }
.th-count { display: inline-flex; align-items: center; gap: 4px; font-family: var(--mono); font-size: 10.5px; color: var(--text-muted); margin-top: 3px; }

/* ════════════════════════════════════════════════════════════════════════
   Annotation callouts ("cosa rende wow")
   ════════════════════════════════════════════════════════════════════════ */
.note-bar {
  display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: center;
  margin: 22px 0 0; padding: 13px 15px;
  border: 1px dashed var(--border); border-radius: var(--r-lg);
  background: color-mix(in oklab, var(--bg-card) 70%, transparent);
}
.note-bar .nb-tag {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .05em;
  text-transform: uppercase; color: var(--accent);
  border: 1px solid var(--accent-ring); border-radius: 5px; padding: 2px 7px;
}
.note-bar .nb-txt { font-size: 12px; color: var(--text-muted); }
.note-bar .nb-txt b { color: var(--text); font-weight: 560; }
.note-bar .nb-sep { width: 1px; height: 13px; background: var(--border); }

/* ════════════════════════════════════════════════════════════════════════
   Spark svg helpers
   ════════════════════════════════════════════════════════════════════════ */
/* ════════════════════════════════════════════════════════════════════════
   Mission-control hero band (B)
   ════════════════════════════════════════════════════════════════════════ */
.hero-band { margin-bottom: 16px; }
.hero-body {
  display: grid; grid-template-columns: auto 1fr; gap: 26px; align-items: center;
  padding: 20px 22px;
}
@media (max-width: 900px) { .hero-body { grid-template-columns: 1fr; justify-items: center; } }
.hero-right { display: flex; flex-direction: column; gap: 16px; min-width: 0; width: 100%; }
.hero-readouts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
@media (max-width: 760px) { .hero-readouts { grid-template-columns: repeat(2, 1fr); } }
.readout { position: relative; padding-left: 13px; min-width: 0; }
.readout::before {
  content: ""; position: absolute; left: 0; top: 3px; bottom: 3px; width: 3px;
  border-radius: 2px; background: var(--accent);
}
.readout.live::before { background: var(--live); }
.readout-lbl { font-family: var(--mono); font-size: 10.5px; letter-spacing: .05em; text-transform: uppercase; color: var(--text-faint); white-space: nowrap; }
.readout-val { font-size: 23px; font-weight: 600; letter-spacing: -.02em; color: var(--text-strong); line-height: 1.1; margin-top: 4px; display: flex; align-items: baseline; gap: 6px; }
.readout-val .sm { font-size: 12px; font-weight: 500; color: var(--text-muted); }
.readout-spark { height: 26px; margin-top: 4px; }
.readout-spark svg { width: 100%; height: 100%; display: block; }

.hero-heat .heat-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.hero-heat .heat-head .hh-l { font-family: var(--mono); font-size: 11px; color: var(--text-muted); letter-spacing: .03em; }
.hero-heat .heat { height: 46px; }

/* spark svg helpers */
.spark-line { fill: none; stroke: var(--accent); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.spark-line.pos { stroke: var(--live); }
.spark-line.neg { stroke: var(--danger); }
.spark-draw { stroke-dasharray: var(--len); stroke-dashoffset: var(--len); animation: drawSpark 1.1s ease forwards; }
@keyframes drawSpark { to { stroke-dashoffset: 0; } }
.spark-area { stroke: none; }
.spark-dot  { fill: var(--accent); }

/* ── Reduced motion: kill loops + entrances, show end-state ──────────────── */
@media (prefers-reduced-motion: reduce) {
  .live-dot.beat { animation: none; }
  .feed-row.fresh { animation: none; }
  .feed-row.fresh::before { display: none; }
  .st-run .d { animation: none; }
  .spark-draw { animation: none; stroke-dashoffset: 0; }
  .kpi:hover { transform: none; }
  .qa:hover { transform: none; }
}

/* ════════════════════════════════════════════════════════════════════════
   HOME "DEFINITIVA" — dashboard integrata su dati reali (prefisso .hd-)
   Solo token var(--…): coerente dark+light senza nuovi colori hardcoded.
   ════════════════════════════════════════════════════════════════════════ */
.hd-page { padding-bottom: 60px; }
/* Logo "Console": quadrato fisso, fuori dalla regola del thumb a tutta altezza. */
.ae-head-l > .ae-head-thumb.hd-conthumb { align-self: center; width: 48px; height: 48px; min-height: 0; border-radius: 12px; }
.ae-head-l > .ae-head-thumb.hd-conthumb > svg { width: 22px; height: 22px; }
/* HERO — card accent (colpo d'occhio), coerente con i token del console. */
.hd-herobar { padding: 22px 26px; margin-bottom: 16px; border: 1px solid var(--border-faint); border-radius: var(--r-lg, 12px); background: linear-gradient(180deg, color-mix(in oklab, var(--accent) 8%, var(--bg-card)), var(--bg-card)); box-shadow: var(--shadow-sm); }
.hd-hero { display: grid; grid-template-columns: auto 1fr; gap: 28px; align-items: center; }
.hd-hero .ringwrap { flex-shrink: 0; }
.hr-big { font-size: 26px; font-weight: 700; letter-spacing: -.02em; color: var(--text-strong); line-height: 1; }
.hr-lbl { font-size: 10px; color: var(--text-muted); margin-top: 3px; text-transform: uppercase; letter-spacing: .1em; }
/* colonna anello + legenda dei 3 segmenti (l'anello "dice" cosa rappresenta) */
.hd-ringcol { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.hd-ringleg { display: flex; flex-direction: column; gap: 5px; width: 100%; font-size: 11.5px; color: var(--text-muted); }
.hd-ringleg span { display: flex; align-items: center; gap: 6px; }
.hd-ringleg i { width: 8px; height: 8px; border-radius: 2px; flex-shrink: 0; }
.hd-ringleg b { color: var(--text-strong); margin-left: auto; font-variant-numeric: tabular-nums; }
.hd-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px 18px; }
@media (max-width: 1100px) { .hd-stats { grid-template-columns: repeat(2, 1fr); } }
.hd-stat { display: flex; flex-direction: column; gap: 5px; }
.hd-stat-top { display: flex; align-items: center; gap: 8px; color: var(--text-muted); font-size: 12.5px; font-weight: 500; }
.hd-stat-ico { width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); flex-shrink: 0; }
.hd-stat-val { font-size: 27px; font-weight: 700; letter-spacing: -.02em; color: var(--text-strong); line-height: 1.05; }
.hd-stat-val .u { font-size: 14px; font-weight: 600; color: var(--text-muted); margin-left: 3px; }
.hd-stat-foot { font-size: 11.5px; color: var(--text-faint); }
.hd-hero-spark { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border-faint); }
.hd-spark-cap { display: flex; align-items: center; gap: 7px; font-size: 11.5px; color: var(--text-faint); margin-bottom: 6px; }
.hd-hero-spark svg { width: 100%; height: 40px; }

/* Panoramica per tipo — 6 card per riga, compatte. */
.hd-typegrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.hd-tc { display: flex; flex-direction: column; gap: 8px; padding: 11px 12px; border: 1px solid var(--border-faint); border-radius: 10px; background: var(--bg-card); cursor: pointer; transition: border-color .14s, background .14s, transform .12s, box-shadow .14s; text-align: left; font: inherit; }
.hd-tc:hover { border-color: var(--border-strong); background: var(--bg-card-hover); transform: translateY(-2px); box-shadow: var(--shadow); }
.hd-tc-top { display: flex; align-items: center; gap: 8px; }
.hd-tc-ico { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; flex-shrink: 0; color: #fff; }
.hd-tc-ico svg { width: 15px; height: 15px; }
.hd-tc-name { font-size: 12px; font-weight: 600; color: var(--text-strong); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hd-tc-fav { display: inline-flex; align-items: center; gap: 2px; font-size: 10.5px; color: var(--warn); flex-shrink: 0; }
/* conteggio in alto a destra, accanto al nome */
.hd-tc-count { font-size: 21px; font-weight: 700; letter-spacing: -.02em; color: var(--text-strong); line-height: 1; flex-shrink: 0; margin-left: auto; font-variant-numeric: tabular-nums; }
.hd-tc-bot { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; }
.hd-tc-meta { font-size: 10.5px; color: var(--text-faint); white-space: nowrap; }
.hd-bar { height: 5px; border-radius: 3px; background: var(--bg-app); overflow: hidden; }
.hd-bar > i { display: block; height: 100%; border-radius: 3px; transition: width .9s cubic-bezier(.2,.8,.2,1); }

.hd-rec { display: flex; align-items: center; gap: 11px; padding: 9px 2px; border-bottom: 1px solid var(--border-faint); width: 100%; background: none; border-left: 0; border-right: 0; border-top: 0; cursor: pointer; text-align: left; font: inherit; }
.hd-rec:last-child { border-bottom: 0; }
.hd-rec:hover { background: var(--bg-card-hover); border-radius: 8px; }
.hd-rec-ico { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; flex-shrink: 0; color: #fff; }
.hd-rec-mid { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.hd-rec-name, .hd-rec-sub { display: block; }
.hd-rec-name { font-size: 13px; font-weight: 500; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hd-rec-sub { font-size: 11.5px; color: var(--text-faint); }
.hd-rec-right { display: flex; align-items: center; gap: 9px; flex-shrink: 0; }
.hd-rec-time { font-size: 11.5px; color: var(--text-muted); white-space: nowrap; }

.hd-vis { display: flex; height: 13px; border-radius: 7px; overflow: hidden; margin: 8px 0 12px; }
.hd-vis > i { height: 100%; transition: width .9s cubic-bezier(.2,.8,.2,1); }
.hd-vis-legend { display: flex; flex-wrap: wrap; gap: 12px; }
.hd-leg { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-muted); }
.hd-leg b { color: var(--text); font-weight: 600; }
.hd-dot { width: 9px; height: 9px; border-radius: 3px; flex-shrink: 0; }
.hd-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.hd-tag { display: inline-flex; align-items: center; gap: 5px; height: 25px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--border); background: var(--bg-app); font-size: 11.5px; color: var(--text-muted); }
.hd-tag b { color: var(--text); font-weight: 600; }
.hd-team { display: flex; align-items: center; gap: 10px; padding: 7px 2px; }
.hd-team-mid { flex: 1; min-width: 0; }
.hd-team-name { font-size: 12.5px; font-weight: 500; color: var(--text); }
.hd-team-sub { font-size: 11px; color: var(--text-faint); }
.hd-team-badge { font-size: 11px; color: var(--text-muted); padding: 2px 8px; border-radius: 6px; background: var(--bg-app); border: 1px solid var(--border-faint); }

/* zona "Lab / Anteprima" (home azzardata) */
.hd-lab-head { display: flex; align-items: center; gap: 10px; margin: 26px 0 14px; }
.hd-lab-head h2 { font-size: 16px; font-weight: 600; color: var(--text-strong); margin: 0; letter-spacing: -.01em; }
.hd-lab-head .ln { flex: 1; height: 1px; background: var(--border); }
.hd-soon { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px; border-radius: 999px; font-size: 10.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--warn); background: color-mix(in oklab, var(--warn) 14%, transparent); border: 1px solid color-mix(in oklab, var(--warn) 30%, transparent); }
.hd-soon .d { width: 6px; height: 6px; border-radius: 50%; background: var(--warn); }

/* Attività schedulate — riga con nome/frequenza + prossima esecuzione + stato. */
.hd-sched-row { gap: 11px; }
.hd-sched-next { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--text-muted); white-space: nowrap; font-family: var(--mono); flex-shrink: 0; }
.hd-st { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px; border-radius: 999px; font-size: 11px; font-weight: 500; border: 1px solid var(--border-faint); flex-shrink: 0; }
.hd-st .d { width: 6px; height: 6px; border-radius: 50%; }
.hd-st.on { color: var(--success); } .hd-st.on .d { background: var(--success); }
.hd-st.off { color: var(--text-muted); } .hd-st.off .d { background: var(--text-faint); }
/* 6 azioni rapide per riga */
.hd-qa6 { grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)) !important; }
