/* Portale segnali · Le Tre Parche · v0.01 — 2026-10-04 */
:root {
  --bg: #F4F3EF; --card: #FFFFFF; --ink: #16181D; --mute: #5A606B; --line: #E2E0DA; --chip: #E4E2DC;
  --pos: #1E4E8C; --posbar: #2F6DB5; --neg: #A8430F; --negbar: #D9733A; --ok: #2E7D4F; --warn: #A87B0F;
  --mono: 'IBM Plex Mono', ui-monospace, monospace; --sans: 'IBM Plex Sans', system-ui, sans-serif;
  --r: 16px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--sans); font-size: 15px; -webkit-text-size-adjust: 100%; }
a { color: var(--pos); }
button, input, select { font: inherit; color: inherit; }
.boot { padding: 40px 20px; color: var(--mute); }
.mono { font-family: var(--mono); }
.pos { color: var(--pos); } .neg { color: var(--neg); } .mute { color: var(--mute); }
.small { font-size: 12px; } .tiny { font-size: 11px; }

/* ── impaginazione: telefono (barra in basso) · schermo largo (colonna a sinistra) ── */
.shell { min-height: 100vh; display: flex; flex-direction: column; }
.side { display: none; }
.main { flex: 1; padding: 0 16px 96px; max-width: 1180px; width: 100%; margin: 0 auto; }
.top { padding: 16px 0 8px; display: flex; flex-direction: column; gap: 2px; }
.brand { font-size: 11px; letter-spacing: .14em; font-weight: 600; color: var(--mute); text-transform: uppercase; }
.top h1 { margin: 0; font-size: 22px; font-weight: 700; display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.top .sub { font-size: 12px; color: var(--mute); }
.bnav { position: fixed; left: 0; right: 0; bottom: 0; background: #fff; border-top: 1px solid var(--line);
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); padding: 6px 4px calc(10px + env(safe-area-inset-bottom)); z-index: 20; }
.bnav a { display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 44px; justify-content: center;
  text-decoration: none; color: var(--mute); font-size: 11px; }
.bnav a.on { color: var(--pos); font-weight: 600; }
.bnav svg, .side svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
@media (min-width: 900px) {
  .shell { flex-direction: row; }
  .side { display: flex; flex-direction: column; gap: 2px; width: 230px; flex: none; padding: 20px 12px; position: sticky; top: 0; height: 100vh; border-right: 1px solid var(--line); background: #FAF9F6; }
  .side .brand { padding: 0 10px 14px; }
  .side a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px; text-decoration: none; color: var(--ink); font-size: 14px; }
  .side a.on { background: var(--chip); font-weight: 600; }
  .side .who { margin-top: auto; font-size: 12px; color: var(--mute); padding: 10px; }
  .bnav { display: none; }
  .main { padding: 8px 28px 40px; }
}

/* ── controlli ── */
.bar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 6px 0 10px; }
.sel { min-height: 40px; border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 6px 10px; max-width: 100%; }
.seg { display: inline-grid; grid-auto-flow: column; gap: 4px; background: var(--chip); border-radius: 12px; padding: 4px; }
.seg button { min-height: 36px; border: 0; border-radius: 9px; padding: 0 12px; background: transparent; font-weight: 600; cursor: pointer; }
.seg button.on { background: var(--ink); color: #fff; }
.btn { min-height: 42px; border: 0; border-radius: 10px; padding: 0 16px; background: var(--ink); color: #fff; font-weight: 600; cursor: pointer; }
.btn.light { background: var(--chip); color: var(--ink); }
.btn:disabled { opacity: .5; cursor: default; }
.chip { display: inline-flex; align-items: center; gap: 6px; background: var(--chip); border-radius: 999px; padding: 4px 10px; font-size: 12px; }
.chip.warn { background: #F5E7C8; }
.chip button { border: 0; background: none; cursor: pointer; padding: 0; font-weight: 700; }
label.f { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--mute); }
label.f input, label.f select { min-height: 40px; border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; background: #fff; color: var(--ink); font-size: 15px; }
.chk { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; min-height: 36px; }

/* ── schede ── */
.grid { display: grid; gap: 10px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 900px) { .g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } .gw { grid-template-columns: 2fr 1fr; } }
.card { background: var(--card); border-radius: var(--r); padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.card h2 { margin: 0; font-size: 13px; font-weight: 600; display: flex; justify-content: space-between; gap: 8px; }
.card h2 span { font-weight: 400; color: var(--mute); }
.kpi .l { font-size: 12px; color: var(--mute); }
.kpi .v { font-family: var(--mono); font-size: 20px; font-weight: 600; }
.hero { flex-direction: row; justify-content: space-between; align-items: flex-end; }
.hero .v { font-size: 30px; }
.note { font-size: 12px; color: var(--mute); }
.empty { padding: 28px 8px; text-align: center; color: var(--mute); }
.err { background: #F8E3D8; color: #6E2A07; border-radius: 12px; padding: 10px 12px; font-size: 14px; }
.okmsg { background: #DDEEDF; color: #1E5233; border-radius: 12px; padding: 10px 12px; font-size: 14px; }
svg.chart { width: 100%; height: 120px; display: block; }

/* mesi */
.months { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(34px, 72px); gap: 6px; overflow-x: auto; justify-content: start; }
.months .m { display: flex; flex-direction: column; align-items: stretch; gap: 3px; font-size: 10px; text-align: center; color: var(--mute); }
.months .b { height: 64px; display: flex; flex-direction: column; justify-content: flex-end; }
.months .b div { border-radius: 4px; min-height: 3px; }

/* elenco trade */
.day { display: flex; justify-content: space-between; font-size: 12px; color: var(--mute); padding: 12px 2px 6px; font-weight: 600; }
.trow { display: grid; grid-template-columns: 58px 1fr auto; gap: 10px; align-items: center; background: #fff; border-radius: 12px; padding: 10px 12px; margin-bottom: 6px; text-decoration: none; color: inherit; min-height: 56px; }
.trow .t { display: flex; flex-direction: column; font-size: 12px; }
.trow .t b { font-family: var(--mono); font-size: 14px; color: var(--ink); }
.side-l { color: var(--pos); font-weight: 600; } .side-s { color: var(--neg); font-weight: 600; }
.trow .p { font-family: var(--mono); font-size: 14px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trow .p span { display: block; font-family: var(--sans); font-size: 11px; color: var(--mute); }
.trow .u { text-align: right; font-family: var(--mono); font-weight: 600; }
.trow .u span { display: block; font-size: 11px; font-weight: 400; color: var(--mute); }

/* tabelle */
.tw { overflow-x: auto; -webkit-overflow-scrolling: touch; background: #fff; border-radius: var(--r); }
table.t { border-collapse: collapse; width: 100%; font-size: 13px; }
table.t th, table.t td { padding: 7px 8px; text-align: right; white-space: nowrap; border-bottom: 1px solid #F0EEE9; }
table.t th { font-size: 11px; color: var(--mute); font-weight: 600; position: sticky; top: 0; background: #fff; cursor: pointer; user-select: none; }
table.t td:first-child, table.t th:first-child { text-align: left; }
table.t td.l, table.t th.l { text-align: left; }
table.t tr.click { cursor: pointer; }
table.t tr.click:hover td { background: #FAF9F6; }
table.t td.num { font-family: var(--mono); }
@media (max-width: 899px) { table.t td.l { max-width: 44vw; overflow: hidden; text-overflow: ellipsis; } }
.badge { display: inline-block; border-radius: 6px; padding: 1px 6px; font-size: 11px; font-weight: 600; }
.badge.ok { background: #DDEEDF; color: #1E5233; } .badge.no { background: #F3E1D6; color: #7A3410; } .badge.mid { background: #EFE6CC; color: #6B5310; }

/* fasce: celle colorate */
.heat td.c { font-family: var(--mono); font-size: 12px; text-align: center; min-width: 44px; }

/* login */
.login { max-width: 380px; margin: 12vh auto 0; padding: 0 16px; display: flex; flex-direction: column; gap: 12px; }
.login h1 { margin: 0; font-size: 24px; }

/* dettaglio */
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: 14px; }
.kv span:nth-child(odd) { color: var(--mute); }
.kv span:nth-child(even) { font-family: var(--mono); text-align: right; }
.exc { position: relative; height: 18px; background: #F0EEE9; border-radius: 9px; margin: 8px 0 2px; }
.exc div { position: absolute; top: 0; bottom: 0; border-radius: 9px; }
.exc i { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--ink); }

/* menu «altro» sul telefono */
.sheet { position: fixed; inset: 0; background: rgba(22,24,29,.35); z-index: 30; display: flex; align-items: flex-end; }
.sheet .in { background: #fff; width: 100%; border-radius: 18px 18px 0 0; padding: 10px 12px calc(16px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; }
.sheet a, .sheet button { min-height: 48px; display: flex; align-items: center; gap: 12px; padding: 0 8px; text-decoration: none; color: var(--ink); border: 0; background: none; font-size: 16px; text-align: left; cursor: pointer; }
