/* NetMon — sistema visivo
 *
 * Nessuna risorsa esterna: la dashboard deve aprirsi anche a linea giù,
 * quindi font di sistema e niente CDN. I numeri usano cifre tabellari
 * perché non "ballino" mentre si aggiornano.
 */

:root {
  --bg: #0A0D12;
  --surface: #10151C;
  --surface-2: #151B24;
  --surface-3: #1A212C;
  --border: #1E2733;
  --border-strong: #2A3543;
  --text: #E6EBF1;
  --text-2: #A3AFBD;
  --text-3: #7C8999;
  --accent: #4C8DFF;
  --accent-2: #2F6FE0;

  --ok: #34D399;
  --warn: #FBBF24;
  --crit: #FB923C;
  --down: #F87171;
  --info: #60A5FA;

  --s-gateway: #94A3B8;
  --s-hop1: #A78BFA;
  --s-cf: #38BDF8;
  --s-gg: #F472B6;
  --s-tcp: #FDE68A;

  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --radius: 10px;
  --sidebar: 228px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.45;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "tnum" 1;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }

/* ------------------------------------------------------------ struttura */

.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar);
  flex: 0 0 var(--sidebar);
  background: #0C1016;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  padding: 20px 20px 18px;
  font-weight: 700; font-size: 16px; letter-spacing: -0.2px;
}
.brand-mark {
  width: 28px; height: 28px; border-radius: 7px;
  background: linear-gradient(135deg, #1D4ED8, #0EA5E9);
  display: grid; place-items: center;
}
.brand small { display: block; font-weight: 500; font-size: 11px; color: var(--text-3); letter-spacing: 0.2px; }

.nav { padding: 6px 10px; display: flex; flex-direction: column; gap: 2px; }
.nav-label {
  font-size: 11px; font-weight: 600; letter-spacing: 0.8px; text-transform: uppercase;
  color: var(--text-3); padding: 14px 10px 6px;
}
.nav a {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 10px; border-radius: 7px;
  color: var(--text-2); font-weight: 500; font-size: 14px;
  text-decoration: none; position: relative;
}
.nav a svg { width: 18px; height: 18px; flex: 0 0 18px; stroke: currentColor; }
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a.active { background: var(--surface-3); color: var(--text); }
.nav a.active::before {
  content: ""; position: absolute; left: -10px; top: 8px; bottom: 8px;
  width: 3px; border-radius: 0 3px 3px 0; background: var(--accent);
}
.nav .pill {
  margin-left: auto; font-size: 10px; font-weight: 700; letter-spacing: 0.6px;
  padding: 2px 6px; border-radius: 4px; background: rgba(248,113,113,0.14); color: var(--down);
}
.nav .pill.live { background: rgba(52,211,153,0.12); color: var(--ok); }

.sidebar-foot {
  margin-top: auto; padding: 14px 18px 18px; border-top: 1px solid var(--border);
  font-size: 12px; color: var(--text-3); display: flex; flex-direction: column; gap: 6px;
}
.sidebar-foot .row { display: flex; justify-content: space-between; gap: 8px; }
.sidebar-foot .v { color: var(--text-2); font-family: var(--mono); }

.main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 16px 28px; border-bottom: 1px solid var(--border);
  background: rgba(10,13,18,0.85); backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 20;
}
.topbar h1 { margin: 0; font-size: 18px; font-weight: 650; letter-spacing: -0.2px; }
.topbar .sub { color: var(--text-3); font-size: 13px; margin-top: 1px; }
.topbar .spacer { flex: 1; }

.content { padding: 22px 28px 48px; display: flex; flex-direction: column; gap: 16px; max-width: 1680px; width: 100%; }

/* ------------------------------------------------------------ componenti */

.grid { display: grid; gap: 16px; }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-width: 0;
}
.panel-head {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 13px 16px 0;
}
.panel-head h2 { margin: 0; font-size: 14px; font-weight: 600; }
.panel-head .hint { color: var(--text-3); font-size: 12px; }
.panel-head .spacer { flex: 1; }
.panel-body { padding: 12px 16px 16px; }

.legend { display: flex; flex-wrap: wrap; gap: 4px 6px; }
.legend button {
  display: inline-flex; align-items: center; gap: 7px;
  background: none; border: 1px solid transparent; color: var(--text-2);
  font-size: 12px; padding: 3px 8px; border-radius: 6px; cursor: pointer;
}
.legend button:hover { background: var(--surface-2); }
.legend button.off { opacity: 0.38; }
.legend i { width: 14px; height: 3px; border-radius: 2px; display: inline-block; }
.legend i.dash { background: repeating-linear-gradient(90deg, currentColor 0 4px, transparent 4px 7px) !important; }

.seg {
  display: inline-flex; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 8px; padding: 2px;
}
.seg button {
  background: none; border: 0; color: var(--text-2); font-size: 12px; font-weight: 600;
  padding: 5px 11px; border-radius: 6px; cursor: pointer;
}
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--surface-3); color: var(--text); box-shadow: 0 0 0 1px var(--border-strong) inset; }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  height: 34px; padding: 0 14px; border-radius: 8px;
  border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text);
  font-size: 13px; font-weight: 600; cursor: pointer;
}
.btn:hover { background: var(--surface-3); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn svg { width: 16px; height: 16px; stroke: currentColor; }
.btn.primary { background: var(--accent-2); border-color: var(--accent-2); color: #fff; }
.btn.primary:hover { background: var(--accent); }
.btn.big { height: 44px; padding: 0 22px; font-size: 14px; border-radius: 10px; }

.live-badge {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.8px;
  padding: 4px 9px; border-radius: 999px;
  background: rgba(52,211,153,0.10); color: var(--ok); border: 1px solid rgba(52,211,153,0.25);
}
.live-badge .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; animation: pulse 1.6s infinite; }
.live-badge.paused { color: var(--text-3); background: var(--surface-2); border-color: var(--border); }
.live-badge.paused .dot { animation: none; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.25; } }

/* ------------------------------------------------------------ stato */

.hero {
  display: grid; grid-template-columns: minmax(260px, 1.1fr) minmax(0, 3fr); gap: 0;
  overflow: hidden;
}
.hero-state { padding: 20px 22px; border-right: 1px solid var(--border); position: relative; }
.hero-state::before {
  content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--ok);
}
.hero-state.degraded::before { background: var(--warn); }
.hero-state.down::before { background: var(--down); }
.eyebrow { font-size: 11px; font-weight: 600; letter-spacing: 0.9px; text-transform: uppercase; color: var(--text-3); }
.state-line { display: flex; align-items: center; gap: 12px; margin: 10px 0 6px; }
.state-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 5px rgba(52,211,153,0.14); }
.down .state-dot { background: var(--down); box-shadow: 0 0 0 5px rgba(248,113,113,0.16); animation: pulse 1s infinite; }
.degraded .state-dot { background: var(--warn); box-shadow: 0 0 0 5px rgba(251,191,36,0.14); }
.state-text { font-size: 28px; font-weight: 700; letter-spacing: -0.6px; }
.state-sub { color: var(--text-2); font-size: 13px; }

.chain { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.hop { padding: 18px 20px; border-right: 1px solid var(--border); position: relative; min-width: 0; }
.hop:last-child { border-right: 0; }
.hop-name { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; }
.hop-name .sdot { width: 8px; height: 8px; border-radius: 50%; }
.hop-addr { font-family: var(--mono); font-size: 11px; color: var(--text-3); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hop-val { font-family: var(--sans); font-variant-numeric: tabular-nums; font-size: 24px; font-weight: 600; margin-top: 10px; letter-spacing: -0.5px; }
.hop-val small { font-size: 12px; color: var(--text-3); font-weight: 500; margin-left: 3px; }
.hop-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; white-space: nowrap; font-size: 12px; color: var(--text-3); margin-top: 4px; }
.hop-meta b { color: var(--text-2); font-weight: 600; font-family: var(--mono); }
.hop .arrow {
  position: absolute; right: -9px; top: 50%; width: 16px; height: 16px; margin-top: -8px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 50%;
  display: grid; place-items: center; z-index: 2; color: var(--text-3);
}
.hop .arrow svg { width: 10px; height: 10px; stroke: currentColor; }

.kpi { padding: 14px 16px; }
.kpi .label { font-size: 12px; color: var(--text-3); display: flex; align-items: center; gap: 6px; }
.kpi .value { font-family: var(--sans); font-variant-numeric: tabular-nums; font-size: 22px; font-weight: 600; margin-top: 6px; letter-spacing: -0.4px; }
.kpi .value small { font-size: 12px; color: var(--text-3); margin-left: 3px; font-weight: 500; }
.kpi .note { font-size: 12px; color: var(--text-3); margin-top: 3px; }
.kpi .delta-up { color: var(--down); }
.kpi .delta-down { color: var(--ok); }

.c-ok { color: var(--ok); } .c-warn { color: var(--warn); } .c-crit { color: var(--crit); }
.c-down { color: var(--down); } .c-dim { color: var(--text-3); } .c-2 { color: var(--text-2); }

/* ------------------------------------------------------------ grafici */

.chart { position: relative; width: 100%; }
.chart canvas { display: block; width: 100%; }
.chart-tip {
  position: absolute; pointer-events: none; z-index: 5;
  background: rgba(16,21,28,0.96); border: 1px solid var(--border-strong);
  border-radius: 8px; padding: 8px 10px; min-width: 150px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.45);
  font-size: 12px; display: none;
}
.chart-tip .tt { font-family: var(--mono); color: var(--text-2); margin-bottom: 5px; font-size: 11px; }
.chart-tip .tr { display: flex; align-items: center; gap: 8px; justify-content: space-between; padding: 1px 0; }
.chart-tip .tr span:first-child { display: flex; align-items: center; gap: 6px; color: var(--text-2); }
.chart-tip .tr i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
.chart-tip .tr b { font-family: var(--mono); font-weight: 600; }
.chart-tip .tb { margin-top: 5px; padding-top: 5px; border-top: 1px solid var(--border); color: var(--down); font-size: 11px; }

/* ------------------------------------------------------------ tabelle */

table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th {
  text-align: left; font-weight: 600; font-size: 11px; letter-spacing: 0.6px; text-transform: uppercase;
  color: var(--text-3); padding: 9px 12px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl td.num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl tbody tr.click { cursor: pointer; }
.tbl tbody tr.click:hover td { background: var(--surface-2); }
.tbl tbody tr.sel td { background: var(--surface-3); }

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 5px; white-space: nowrap;
}
.badge.red { background: rgba(248,113,113,0.12); color: #FCA5A5; }
.badge.amber { background: rgba(251,191,36,0.12); color: #FCD34D; }
.badge.blue { background: rgba(96,165,250,0.12); color: #93C5FD; }
.badge.gray { background: var(--surface-3); color: var(--text-2); }
.badge.green { background: rgba(52,211,153,0.12); color: #6EE7B7; }

/* ------------------------------------------------------------ live */

.flow-wrap { position: relative; }
.flow-wrap canvas { display: block; width: 100%; }

.console {
  font-family: var(--mono); font-size: 12px; line-height: 1.6;
  background: #080B0F; border-top: 1px solid var(--border);
  height: 300px; overflow: auto; padding: 8px 14px;
  border-radius: 0 0 var(--radius) var(--radius);
}
.console .ln { white-space: pre; color: var(--text-2); }
.console .ln .ts { color: var(--text-3); }
.console .ln.lost { color: var(--down); }
.console .ln .tg { display: inline-block; width: 84px; }

/* ------------------------------------------------------------ heatmap */

.heat { display: grid; grid-template-columns: 64px repeat(24, minmax(0, 1fr)); gap: 3px; align-items: center; }
.heat .hl { font-size: 11px; color: var(--text-3); font-family: var(--mono); }
.heat .hh { font-size: 10px; color: var(--text-3); font-family: var(--mono); text-align: center; }
.heat .cell { height: 22px; border-radius: 3px; background: var(--surface-3); position: relative; }
.heat .cell:hover { outline: 1px solid var(--text-2); }
.heat-legend { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--text-3); margin-top: 12px; }
.heat-legend .sw { display: flex; gap: 2px; }
.heat-legend .sw span { width: 22px; height: 10px; border-radius: 2px; }

/* ------------------------------------------------------------ speedtest */

.st-grid { display: grid; grid-template-columns: minmax(380px, 1fr) minmax(0, 1.25fr); gap: 16px; }
.gauge-wrap { display: flex; flex-direction: column; align-items: center; padding: 18px 16px 22px; }
.gauge-wrap canvas { width: 100%; max-width: 420px; display: block; }
.steps { display: flex; gap: 6px; margin: 4px 0 18px; }
.steps span {
  font-size: 11px; font-weight: 600; letter-spacing: 0.5px; text-transform: uppercase;
  padding: 4px 10px; border-radius: 999px; background: var(--surface-2); color: var(--text-3);
  border: 1px solid var(--border);
}
.steps span.on { color: var(--text); border-color: var(--accent); background: rgba(76,141,255,0.12); }
.steps span.done { color: var(--ok); border-color: rgba(52,211,153,0.3); }

.res { padding: 16px 18px; }
.res .label { font-size: 12px; color: var(--text-3); display: flex; align-items: center; gap: 7px; }
.res .label svg { width: 14px; height: 14px; stroke: currentColor; }
.res .big { font-family: var(--sans); font-variant-numeric: tabular-nums; font-size: 34px; font-weight: 600; letter-spacing: -1px; margin-top: 6px; }
.res .big small { font-size: 14px; color: var(--text-3); margin-left: 4px; font-weight: 500; letter-spacing: 0; }
.res .note { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.grade {
  flex: 0 0 72px;
  font-size: 44px; font-weight: 800; letter-spacing: -1px; line-height: 1;
  width: 72px; height: 72px; border-radius: 14px; display: grid; place-items: center;
}

/* ------------------------------------------------------------ incidenti */

.strip-row { display: grid; grid-template-columns: 150px minmax(0, 1fr) 70px; gap: 12px; align-items: center; margin-bottom: 7px; }
.strip-row .nm { font-size: 12px; color: var(--text-2); font-weight: 600; }
.strip-row canvas { display: block; width: 100%; height: 18px; border-radius: 3px; }
.strip-row .pc { font-family: var(--mono); font-size: 12px; text-align: right; }
pre.report {
  margin: 0; white-space: pre-wrap; font-family: var(--mono); font-size: 12px; line-height: 1.7;
  background: #080B0F; border: 1px solid var(--border); border-radius: 8px; padding: 14px 16px; color: var(--text-2);
}

.empty { padding: 40px 20px; text-align: center; color: var(--text-3); }

.fatal {
  margin: 16px 28px 0; padding: 12px 16px; border-radius: 8px;
  background: rgba(248,113,113,0.1); border: 1px solid rgba(248,113,113,0.35);
  color: #FCA5A5; font-family: var(--mono); font-size: 12px;
}

/* ------------------------------------------------------------ adattivo */

@media (max-width: 1280px) {
  .g-6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .st-grid { grid-template-columns: 1fr; }
}
@media (max-width: 1020px) {
  .hero { grid-template-columns: 1fr; }
  .hero-state { border-right: 0; border-bottom: 1px solid var(--border); }
  .g-main, .g-2, .g-3 { grid-template-columns: 1fr; }
  .chain { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hop:nth-child(2) { border-right: 0; }
  .hop:nth-child(-n+2) { border-bottom: 1px solid var(--border); }
  .hop .arrow { display: none; }
}
@media (max-width: 780px) {
  .shell { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; flex: none; }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .nav-label, .sidebar-foot { display: none; }
  .content { padding: 16px; }
  .topbar { padding: 12px 16px; position: static; }
  .g-4, .g-6 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .heat { grid-template-columns: 52px repeat(24, minmax(0, 1fr)); gap: 2px; }
}

/* ------------------------------------------------------------ host LAN */

.hosts-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 14px; }
.hcard { padding: 14px 16px 12px; display: flex; flex-direction: column; gap: 8px; position: relative; }
.hcard.down { border-color: rgba(248,113,113,0.55); box-shadow: 0 0 0 1px rgba(248,113,113,0.25) inset; }
.hcard.unstable { border-color: rgba(251,191,36,0.45); }
.hcard.paused { opacity: 0.55; }
.hcard-top { display: flex; align-items: flex-start; gap: 10px; }
.hcard-top .sdot { width: 9px; height: 9px; border-radius: 50%; margin-top: 5px; flex: 0 0 9px; }
.hcard-name { font-weight: 600; font-size: 14px; line-height: 1.3; word-break: break-word; }
.hcard-addr { font-family: var(--mono); font-size: 11px; color: var(--text-3); margin-top: 2px; }
.hcard-actions { margin-left: auto; display: flex; gap: 2px; }
.icon-btn {
  width: 30px; height: 30px; border-radius: 7px; border: 1px solid transparent;
  background: none; color: var(--text-3); cursor: pointer; display: grid; place-items: center;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.icon-btn svg { width: 16px; height: 16px; }
.hcard-mid { display: flex; align-items: flex-end; gap: 12px; }
.hcard-rtt { font-size: 24px; font-weight: 600; letter-spacing: -0.4px; font-variant-numeric: tabular-nums; }
.hcard-rtt small { font-size: 12px; color: var(--text-3); font-weight: 500; margin-left: 3px; }
.hcard canvas.spark { flex: 1; height: 34px; min-width: 0; display: block; }
.hcard-meta { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; font-size: 11px; color: var(--text-3); border-top: 1px solid var(--border); padding-top: 8px; }
.hcard-meta b { display: block; font-size: 13px; color: var(--text-2); font-weight: 600; font-variant-numeric: tabular-nums; margin-top: 1px; }
.hcard-line { display: flex; gap: 10px; align-items: baseline; min-width: 0; }
.hcard-state { font-size: 12px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.hcard-inc { margin-left: auto; font-size: 11px; color: var(--warn); white-space: nowrap; }
.hcard-meta b[title] { cursor: help; }

/* ------------------------------------------------------------ dialoghi e moduli */

dialog.modal {
  border: 1px solid var(--border-strong); border-radius: 14px; padding: 0;
  background: var(--surface); color: var(--text); width: min(520px, calc(100vw - 32px));
  box-shadow: 0 24px 64px rgba(0,0,0,0.6);
}
dialog.modal::backdrop { background: rgba(5,7,10,0.7); backdrop-filter: blur(2px); }
.modal-head { padding: 18px 22px 4px; display: flex; align-items: center; }
.modal-head h2 { margin: 0; font-size: 17px; }
.modal-body { padding: 14px 22px; display: flex; flex-direction: column; gap: 14px; }
.modal-foot { padding: 14px 22px 18px; display: flex; gap: 8px; align-items: center; border-top: 1px solid var(--border); }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .field > .lbl { font-size: 12px; font-weight: 600; color: var(--text-2); }
.field .help { font-size: 12px; color: var(--text-3); }
.field .err { font-size: 12px; color: var(--down); min-height: 0; }
.field input[type=text], .field input[type=number], .field select, input.date {
  height: 38px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--border-strong);
  background: var(--bg); color: var(--text); font: inherit; font-size: 14px;
}
.field input:focus, .field select:focus, input.date:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
.field input.invalid { border-color: var(--down); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.check { display: flex; align-items: center; gap: 10px; font-size: 14px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.btn.danger { color: #FCA5A5; border-color: rgba(248,113,113,0.4); background: rgba(248,113,113,0.08); }
.btn.danger:hover { background: rgba(248,113,113,0.16); }
input.date { height: 32px; font-family: var(--mono); font-size: 12px; color-scheme: dark; }

/* ------------------------------------------------------------ report */

.rep-head { padding: 18px 20px; display: flex; gap: 16px; flex-wrap: wrap; align-items: center; }
.rep-head h2 { margin: 0; font-size: 20px; letter-spacing: -0.3px; }
.rep-head .meta { color: var(--text-3); font-size: 13px; margin-top: 4px; }
.bars-h { display: flex; flex-direction: column; gap: 8px; }
.bars-h .r { display: grid; grid-template-columns: 140px minmax(0, 1fr) 44px; gap: 10px; align-items: center; font-size: 13px; }
.bars-h .track { height: 8px; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
.bars-h .fill { height: 100%; border-radius: 4px; }
.print-only { display: none; }

/* ------------------------------------------------------------ stampa */

@media print {
  :root {
    --bg: #fff; --surface: #fff; --surface-2: #F3F5F8; --surface-3: #EEF1F5;
    --border: #D9DEE5; --border-strong: #C5CCD6;
    --text: #111827; --text-2: #374151; --text-3: #5B6573;
  }
  @page { size: A4; margin: 14mm 12mm; }
  /* la pagina è in color-scheme scuro: senza questo i margini del foglio
     escono neri, una cornice d'inchiostro su ogni pagina */
  html { background: #fff; color-scheme: light; }
  body { background: #fff; font-size: 11pt; }
  .sidebar, .topbar, .no-print, .fatal { display: none !important; }
  .shell, .main { display: block; }
  .content { padding: 0; max-width: none; gap: 10px; }
  .panel { break-inside: avoid; border-color: #D9DEE5; }
  .print-only { display: block; }
  .chart-tip { display: none !important; }
  pre.report { background: #F7F8FA; color: #111827; }
  .c-ok { color: #047857; } .c-warn { color: #B45309; } .c-crit { color: #C2410C; } .c-down { color: #B91C1C; }
  .badge.red { background: #FEE2E2; color: #991B1B; }
  a { color: #111827; text-decoration: none; }
}

@media (max-width: 640px) {
  .row2 { grid-template-columns: 1fr; }
  .bars-h .r { grid-template-columns: 100px minmax(0, 1fr) 40px; }
}
