/* Gestionale Lisa Tech – stile ripreso dal sito Lisa Tech */
:root {
  --red: #e2231a;
  --red-dark: #b3140d;
  --red-soft: #fde9e8;
  --ink: #16181b;
  --ink-2: #41464d;
  --ink-3: #5b6169;
  --muted: #8a9099;
  --line: #e3e5e8;
  --line-2: #c9cdd2;
  --bg: #f3f4f5;
  --card: #ffffff;
  --in-bg: #eef3ff;
  --in-line: #9db4e8;
  --in-ink: #1d4ed8;
  --chg-bg: #fff8d6;
  --chg-line: #c78a00;
  --chg-ink: #5c4a00;
  --hyp-bg: #fff3b0;
  --ok: #15803d;
  --ok-bg: #dcfce7;
  --radius: 20px;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { font-family: 'Archivo', system-ui, -apple-system, 'Segoe UI', sans-serif; color: var(--ink); background: var(--bg); font-size: 15px; line-height: 1.45; }
a { color: var(--red); text-decoration: none; }
a:hover { color: var(--ink); text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; letter-spacing: -0.01em; }

/* Struttura */
.shell { display: flex; flex-wrap: wrap; min-height: 100vh; }
.side { flex: 1 1 250px; max-width: 100%; background: var(--ink); color: #fff; padding: 20px 14px 24px; display: flex; flex-direction: column; gap: 18px; }
.content { flex: 999 1 640px; min-width: 0; display: flex; flex-direction: column; }
@media (min-width: 900px) { .side { flex: 0 0 280px; position: sticky; top: 0; height: 100vh; overflow-y: auto; } }

.brand { display: flex; align-items: center; gap: 12px; color: #fff; text-decoration: none; padding: 0 8px; min-height: 44px; }
.brand:hover { color: #fff; text-decoration: none; }
.brand b { display: block; font-size: 21px; font-weight: 800; }
.brand small { display: block; font-size: 13px; font-weight: 600; color: #9aa0a8; }
.cta { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; border-radius: 999px; background: var(--red); color: #fff; font-weight: 800; text-decoration: none; }
.cta:hover { background: var(--red-dark); color: #fff; text-decoration: none; }
.nav { display: flex; flex-direction: column; gap: 3px; }
.nav-item { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 12px; border-radius: 12px; font-size: 16px; font-weight: 700; color: #c9cdd2; text-decoration: none; }
.nav-item svg { flex: 0 0 20px; }
a.nav-item:hover { color: #fff; text-decoration: none; background: #23262a; }
.nav-item.on { color: #fff; }
.nav-sub { display: flex; flex-direction: column; gap: 2px; padding-left: 32px; }
.nav-sub a { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 40px; padding: 0 12px; border-radius: 10px; font-size: 15px; font-weight: 600; color: #9aa0a8; text-decoration: none; }
.nav-sub a:hover { color: #fff; background: #23262a; text-decoration: none; }
.nav-sub a.on, a.nav-item.on { background: #2a2d31; color: #fff; font-weight: 800; }
.soon { font-size: 11px; font-weight: 800; color: #9aa0a8; border: 1px solid #41464d; border-radius: 999px; padding: 1px 7px; }
.side-foot { margin-top: auto; padding: 0 12px; font-size: 13px; color: #8a9099; }

.topbar { background: #fff; border-bottom: 1px solid var(--line); }
.topbar-in, .band-in, .main { max-width: 1280px; margin: 0 auto; padding-left: 24px; padding-right: 24px; }
.topbar-in { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; padding-top: 14px; padding-bottom: 14px; }
.crumb small { display: block; font-size: 13px; font-weight: 700; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.06em; }
.crumb b { display: block; font-size: 20px; font-weight: 800; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

.band { background-color: var(--ink); background-image: repeating-linear-gradient(0deg, rgba(255,255,255,.045) 0, rgba(255,255,255,.045) 1px, transparent 1px, transparent 9px); color: #fff; }
.band-in { padding-top: 26px; padding-bottom: 28px; display: flex; flex-direction: column; gap: 18px; }
.band .kicker { font-size: 14px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: #ff8a84; }
.band h1 { font-size: clamp(28px, 3.6vw, 42px); line-height: 1.08; font-weight: 800; }
.band p { margin: 0; color: #d5d8dc; font-size: 16px; max-width: 760px; }
.band-row { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.kpi { background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.14); border-radius: 18px; padding: 14px 16px; display: flex; flex-direction: column; gap: 3px; }
.kpi span { font-size: 13px; color: #c9cdd2; }
.kpi b { font-size: 26px; font-weight: 800; }
.kpi.red { background: var(--red); border-color: var(--red); }
.kpi.red span { color: #ffe1df; }

.main { padding-top: 24px; padding-bottom: 56px; display: flex; flex-direction: column; gap: 22px; width: 100%; }

/* Elementi */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 24px; display: flex; flex-direction: column; gap: 14px; }
.card-head { display: flex; align-items: center; gap: 14px; }
.card-head .num { flex: 0 0 42px; width: 42px; height: 42px; border-radius: 50%; background: var(--red); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 800; }
.card-head h2 { font-size: 21px; font-weight: 800; }
.card-head p { margin: 2px 0 0; font-size: 14px; color: var(--ink-3); }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 22px; align-items: start; }

.btn { min-height: 44px; padding: 0 20px; border-radius: 999px; border: 1.5px solid var(--ink); background: #fff; color: var(--ink); font-weight: 700; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; white-space: nowrap; }
.btn:hover { text-decoration: none; background: var(--bg); color: var(--ink); }
.btn.primary { background: var(--red); border-color: var(--red); color: #fff; }
.btn.primary:hover { background: var(--red-dark); border-color: var(--red-dark); }
.btn.dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.ghost { border-color: var(--line-2); }
.btn.small { min-height: 36px; padding: 0 14px; font-size: 13px; }
.btn:disabled { background: var(--line); border-color: var(--line); color: var(--ink-3); cursor: not-allowed; }
.seg { display: inline-flex; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.18); border-radius: 999px; padding: 5px; gap: 4px; }
.seg a, .seg button { min-height: 42px; padding: 0 18px; border-radius: 999px; border: 0; background: transparent; color: #fff; font-weight: 700; cursor: pointer; display: inline-flex; align-items: center; text-decoration: none; }
.seg .on { background: #fff; color: var(--ink); }

.tbl-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; padding: 10px; font-size: 12px; font-weight: 700; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.03em; vertical-align: bottom; }
th .f { display: block; max-width: 170px; white-space: normal; margin-top: 3px; text-transform: none; letter-spacing: 0; font-weight: 500; font-family: ui-monospace, Menlo, monospace; color: var(--ink-2); }
td { padding: 8px 10px; border-top: 1px solid var(--line); vertical-align: middle; }
td.r, th.r { text-align: right; }
tr.total td { background: var(--bg); font-weight: 800; }
tr.dark td { background: var(--ink); color: #fff; font-weight: 800; }
.note { font-size: 13px; color: var(--ink-3); line-height: 1.4; }
.out { display: inline-block; min-width: 72px; padding: 8px 10px; border-radius: 8px; background: var(--bg); font-weight: 800; text-align: right; }
.out.strong { background: var(--ink); color: #fff; }

.in { min-height: 40px; padding: 0 10px; border-radius: 10px; border: 1.5px solid var(--in-line); background: var(--in-bg); color: var(--in-ink); font-weight: 700; width: 100%; }
.in.num { text-align: right; width: 110px; }
.in.wide { width: 100%; min-width: 160px; }
.in:focus { outline: 2px solid var(--in-ink); outline-offset: 1px; }
.in.chg { border: 2px solid var(--chg-line); background: var(--chg-bg); color: var(--chg-ink); }
select.in { padding-right: 6px; }

.kv { display: grid; grid-template-columns: minmax(160px, 1.1fr) minmax(170px, auto) minmax(160px, 1.6fr); gap: 8px 22px; align-items: center; padding: 11px 0; border-top: 1px solid var(--line); }
.kv .lab { font-weight: 700; }
.kv .val { display: flex; align-items: center; gap: 8px; }
.kv .unit { font-size: 14px; color: var(--ink-3); white-space: nowrap; }
.kv.calc { background: #f8f9fa; }
.formula { align-self: flex-start; font-family: ui-monospace, Menlo, monospace; font-size: 13px; background: #f6f7f8; border: 1px solid var(--line); border-radius: 6px; padding: 3px 8px; }
@media (max-width: 760px) { .kv { grid-template-columns: 1fr; } }

.pill { display: inline-block; font-size: 12px; font-weight: 800; border-radius: 999px; padding: 4px 10px; white-space: nowrap; background: var(--bg); color: var(--ink-2); }
.pill.hyp { background: var(--hyp-bg); color: var(--chg-ink); }
.pill.ok { background: var(--ok-bg); color: #14532d; }
.pill.red { background: var(--red-soft); color: #8f1610; }
.pill.dark { background: var(--ink); color: #fff; }
.toggle { min-width: 56px; min-height: 36px; border-radius: 999px; font-size: 13px; font-weight: 800; cursor: pointer; border: 1.5px solid var(--line-2); background: #fff; color: var(--ink-3); }
.toggle.on { border-color: var(--ink); background: var(--ink); color: #fff; }
.toggle.chg { outline: 3px solid var(--chg-line); }

.banner { border-radius: 16px; padding: 14px 18px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; font-size: 14px; }
.banner.warn { background: var(--hyp-bg); border: 1.5px solid #e0c200; color: #3d3100; }
.banner.info { background: var(--in-bg); border: 1px solid var(--in-line); color: #1d3f8f; }
.banner.err { background: var(--red-soft); border: 1px solid #f3a19c; color: #8f1610; }
.banner b { display: block; font-size: 15px; }

.legend { display: flex; flex-wrap: wrap; gap: 10px 22px; align-items: center; font-size: 14px; color: var(--ink-2); background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 12px 18px; }
.legend span { display: inline-flex; align-items: center; gap: 8px; }

.modal-back { position: fixed; inset: 0; background: rgba(22,24,27,.55); display: flex; align-items: flex-start; justify-content: center; padding: 8vh 16px 16px; z-index: 50; overflow-y: auto; }
.modal { width: 100%; max-width: 780px; background: #fff; border-radius: 20px; padding: 26px; display: flex; flex-direction: column; gap: 16px; box-shadow: 0 24px 60px rgba(0,0,0,.3); }
.modal h2 { font-size: 24px; }
.field { display: flex; flex-direction: column; gap: 6px; font-weight: 700; font-size: 14px; }
.field .in { color: var(--ink); background: #fff; border-color: var(--line-2); font-weight: 500; }

.bar { display: flex; height: 18px; border-radius: 999px; overflow: hidden; background: var(--bg); }
.bar span { display: block; height: 100%; }
.muted { color: var(--ink-3); }
.empty { padding: 26px; text-align: center; color: var(--ink-3); }
.toast { position: fixed; right: 20px; bottom: 20px; background: var(--ink); color: #fff; padding: 14px 18px; border-radius: 14px; font-weight: 700; z-index: 60; box-shadow: 0 10px 30px rgba(0,0,0,.25); }
.spin { padding: 60px; text-align: center; color: var(--ink-3); }

td .in.wide { min-width: 170px; }
.grid2 .kv { grid-template-columns: minmax(150px, 1fr) auto; }
.grid2 .kv .note { grid-column: 1 / -1; margin-top: -4px; }
