@font-face { font-family: 'Hanken Grotesk'; font-style: normal; font-weight: 400 800; font-display: swap; src: url(/fonts/hanken-latin.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Hanken Grotesk'; font-style: normal; font-weight: 400 800; font-display: swap; src: url(/fonts/hanken-latin-ext.woff2) format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
:root {
  --accent: #C8102E; --accent-d: #9E1424; --accent-soft: #fbe9ec;
  --ink: #17191c; --ink-2: #52514e; --ink-3: #8a8883; --line: #e8e4de; --line-2: #f0ece6;
  --bg: #f6f3ef; --card: #ffffff; --side: #1F2328; --side-2: #2a2f35; --side-ink: #c9ccd1;
  --s-good: #0ca30c; --s-warn: #fab219; --s-serious: #ec835a; --s-crit: #d03b3b;
  --p-carcara: #2a78d6; --p-capivara: #eb6834; --p-arara: #1baf7a; --p-quati: #6250d6;
  --r: 14px; --shadow: 0 1px 2px rgba(23,25,28,.04), 0 6px 24px rgba(23,25,28,.06);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 14.5px/1.5 'Hanken Grotesk', system-ui, -apple-system, 'Segoe UI', sans-serif; color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; font-feature-settings: 'tnum' 1; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
.hidden { display: none !important; }

/* ---------- layout ---------- */
.app { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; background: linear-gradient(to right, var(--side) 248px, var(--bg) 248px); }
.side { background: var(--side); color: var(--side-ink); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 22px 20px 18px; color: #fff; text-decoration: none; }
.brand img { width: 34px; height: 34px; }
.brand b { display: block; font-size: 16px; letter-spacing: .02em; font-weight: 700; }
.brand small { display: block; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: #b89b5e; }
.nav { padding: 6px 10px 18px; display: flex; flex-direction: column; gap: 2px; }
.nav .sec { font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: #7d838b; padding: 14px 12px 6px; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 10px; text-decoration: none; color: var(--side-ink); font-weight: 500; }
.nav a svg { width: 18px; height: 18px; flex: none; opacity: .85; }
.nav a:hover { background: var(--side-2); color: #fff; }
.nav a.on { background: rgba(200,16,46,.16); color: #fff; box-shadow: inset 3px 0 0 var(--accent); }
.nav a .cnt { margin-left: auto; background: var(--accent); color: #fff; font-size: 11px; border-radius: 99px; padding: 0 7px; font-weight: 700; }
.side .foot { margin-top: auto; padding: 14px 20px 20px; font-size: 12px; color: #7d838b; border-top: 1px solid #2c3138; }
.side .foot button { background: none; border: 1px solid #3a4048; color: var(--side-ink); border-radius: 8px; padding: 6px 10px; cursor: pointer; margin-top: 8px; width: 100%; }
.main { min-width: 0; }
.top { display: flex; align-items: center; gap: 14px; padding: 16px 32px; background: rgba(246,243,239,.88); backdrop-filter: blur(10px); position: sticky; top: 0; z-index: 20; border-bottom: 1px solid var(--line); }
.top h1 { font-size: 20px; margin: 0; font-weight: 700; letter-spacing: -.01em; }
.top .sub { color: var(--ink-3); font-size: 13px; }
.top .grow { flex: 1; }
.burger { display: none; background: none; border: 0; padding: 6px; cursor: pointer; }
.demo-pill { background: #fff4d6; color: #7a5300; border: 1px solid #f3dc9b; border-radius: 99px; padding: 3px 10px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.real-pill { background: #e7f6e7; color: #0a6b0a; border: 1px solid #bfe3bf; border-radius: 99px; padding: 3px 10px; font-size: 12px; font-weight: 600; }
.search { position: relative; }
.search input { width: 260px; padding: 8px 12px 8px 34px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.search svg { position: absolute; left: 10px; top: 9px; width: 16px; height: 16px; color: var(--ink-3); }
.page { padding: 26px 32px 60px; max-width: 1480px; }

/* ---------- elementi ---------- */
.grid { display: grid; gap: 16px; }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g21 { grid-template-columns: 2fr 1fr; } .g12 { grid-template-columns: 1fr 2fr; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); padding: 18px 20px; min-width: 0; }
.card h2 { font-size: 15px; margin: 0 0 2px; font-weight: 700; }
.card .hint { color: var(--ink-3); font-size: 12.5px; margin: 0 0 12px; }
.card-head { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 10px; }
.card-head > div:first-child { flex: 1; min-width: 0; }
.kpi { padding: 16px 18px; }
.kpi .lab { color: var(--ink-2); font-size: 12.5px; font-weight: 500; display: flex; gap: 6px; align-items: center; }
.kpi .val { font-size: 28px; font-weight: 700; letter-spacing: -.02em; margin-top: 4px; line-height: 1.15; }
.kpi .note { color: var(--ink-3); font-size: 12px; margin-top: 4px; }
.kpi.accent { background: linear-gradient(135deg, #C8102E, #9E1424); color: #fff; border: 0; }
.kpi.accent .lab, .kpi.accent .note { color: rgba(255,255,255,.85); }
.mt { margin-top: 16px; } .mt2 { margin-top: 24px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.muted { color: var(--ink-3); } .small { font-size: 12.5px; }
.btn { border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 8px 14px; cursor: pointer; font-weight: 600; font-size: 13.5px; display: inline-flex; gap: 6px; align-items: center; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: #cfc9c0; }
.btn.pri { background: var(--accent); border-color: var(--accent); color: #fff; } .btn.pri:hover { background: var(--accent-d); }
.btn.danger { color: #a0172c; border-color: #efc5cc; } .btn.danger:hover { background: #fdf1f3; }
.btn.sm { padding: 5px 10px; font-size: 12.5px; border-radius: 8px; }
.btn:disabled { opacity: .5; cursor: default; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.filters select, .filters input, .field input, .field select, .field textarea { border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 8px 11px; min-width: 0; }
.filters input[type=search] { min-width: 220px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 99px; padding: 5px 12px; cursor: pointer; font-size: 13px; font-weight: 500; }
.chip.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.badge { display: inline-flex; align-items: center; gap: 5px; border-radius: 99px; padding: 2px 9px; font-size: 12px; font-weight: 600; background: var(--line-2); color: var(--ink-2); white-space: nowrap; }
.badge .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.b-active { background: #e6f5e6; color: #0b6b0b; } .b-trial { background: #e8f0fb; color: #1d4f91; } .b-free { background: #f1efeb; color: #6b6964; }
.b-suspended { background: #fdecef; color: #a0172c; } .b-cancelled { background: #f3e9e2; color: #8a4a22; } .b-internal { background: #efeafc; color: #4b3aa8; } .b-invited { background: #fff4d6; color: #7a5300; }
.b-paid { background: #e6f5e6; color: #0b6b0b; } .b-open { background: #e8f0fb; color: #1d4f91; } .b-overdue { background: #fdecef; color: #a0172c; } .b-void { background: #f1efeb; color: #6b6964; }
.b-critical { background: #fdecef; color: #a0172c; } .b-warning { background: #fff4d6; color: #7a5300; } .b-info { background: #e8f0fb; color: #1d4f91; } .b-closed { background: #f1efeb; color: #6b6964; }
.prod { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 13px; white-space: nowrap; }
.prod i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }
.flag { font-size: 15px; }

/* tabelle */
.tbl-wrap { overflow-x: auto; margin: 0 -20px; padding: 0 20px; }
table.t { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.t th { text-align: left; font-weight: 600; color: var(--ink-3); font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; cursor: default; user-select: none; }
table.t th.sort { cursor: pointer; } table.t th.sort:hover { color: var(--ink); }
table.t td { padding: 10px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
table.t tr.click { cursor: pointer; } table.t tr.click:hover td { background: #faf8f5; }
table.t .num { text-align: right; white-space: nowrap; }
table.t td.nw { white-space: nowrap; }
table.t td.name b { display: block; font-weight: 600; }
table.t td.name span { color: var(--ink-3); font-size: 12.5px; }
.empty { padding: 30px; text-align: center; color: var(--ink-3); }
.pager { display: flex; justify-content: space-between; align-items: center; padding-top: 12px; color: var(--ink-3); font-size: 12.5px; }

/* grafici */
.chart { width: 100%; position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .axis { fill: var(--ink-3); font-size: 11px; }
.chart .grid-l { stroke: var(--line-2); stroke-width: 1; }
.tip { position: fixed; pointer-events: none; background: #17191c; color: #fff; border-radius: 9px; padding: 8px 10px; font-size: 12.5px; z-index: 100; box-shadow: 0 6px 20px rgba(0,0,0,.2); max-width: 260px; }
.tip b { display: block; margin-bottom: 2px; }
.tip .r { display: flex; gap: 8px; align-items: center; justify-content: space-between; }
.tip .r i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; margin-right: 5px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-2); margin-top: 8px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.hbar { display: grid; grid-template-columns: minmax(90px, 160px) 1fr auto; gap: 10px; align-items: center; padding: 5px 0; font-size: 13px; }
.hbar .bar { height: 10px; background: var(--line-2); border-radius: 5px; overflow: hidden; }
.hbar .bar svg { display: block; width: 100%; height: 10px; }
.hbar .v { font-weight: 600; text-align: right; white-space: nowrap; }
.status-row { display: grid; grid-template-columns: 160px 90px 1fr 120px; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line-2); }
.status-row:last-child { border-bottom: 0; }
.st { display: inline-flex; gap: 6px; align-items: center; font-weight: 600; font-size: 13px; }
.st svg { width: 15px; height: 15px; }
.st.ok { color: #0b7a0b; } .st.ko { color: #b42335; } .st.na { color: var(--ink-3); }
.ticks svg { width: 100%; height: 22px; display: block; }
.map { background: #fbfaf8; border-radius: 12px; border: 1px solid var(--line-2); }
.map path { stroke: #fff; transition: opacity .15s; }
.map path:hover { opacity: .8; stroke: #17191c; stroke-width: .8; }
.scale { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--ink-3); margin-top: 8px; }
.scale .ramp { display: flex; } .scale .ramp i { width: 22px; height: 10px; display: block; }

/* dettaglio cliente */
.dhead { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.avatar { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; font-weight: 800; font-size: 20px; color: #fff; flex: none; }
.dhead h2 { margin: 0; font-size: 22px; }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 6px 14px; font-size: 13.5px; }
.kv dt { color: var(--ink-3); } .kv dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 18px 0 16px; overflow-x: auto; }
.tabs button { background: none; border: 0; padding: 10px 14px; cursor: pointer; font-weight: 600; color: var(--ink-3); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs button.on { color: var(--ink); border-bottom-color: var(--accent); }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 130px 1fr; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line-2); font-size: 13px; }
.timeline li time { color: var(--ink-3); }
.matrix td.yes { color: #0b7a0b; text-align: center; font-weight: 700; } .matrix td.no { color: #cfcac2; text-align: center; }
.matrix th.p { text-align: center; }

/* modali e avvisi */
.modal-bg { position: fixed; inset: 0; background: rgba(23,25,28,.45); display: grid; place-items: center; z-index: 200; padding: 16px; }
.modal { background: #fff; border-radius: 16px; width: min(520px, 100%); max-height: 90vh; overflow: auto; padding: 22px 22px 18px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal.wide { width: min(900px, 100%); }
.modal h3 { margin: 0 0 6px; font-size: 18px; }
.modal p { color: var(--ink-2); margin: 0 0 14px; }
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field textarea { min-height: 110px; resize: vertical; font-weight: 400; }
.field input, .field select { font-weight: 400; color: var(--ink); }
.checks { display: flex; gap: 12px; flex-wrap: wrap; font-weight: 500; }
.checks label { display: inline-flex; gap: 6px; align-items: center; }
.toast { position: fixed; bottom: 20px; right: 20px; background: #17191c; color: #fff; padding: 12px 16px; border-radius: 12px; z-index: 300; box-shadow: 0 10px 30px rgba(0,0,0,.25); max-width: 420px; }
.toast.err { background: #a0172c; }
.secret { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; background: #f6f3ef; border: 1px dashed #d9d2c8; border-radius: 8px; padding: 8px 10px; word-break: break-all; font-size: 13px; }
.alert { border-radius: 12px; padding: 10px 14px; font-size: 13px; margin-bottom: 14px; border: 1px solid; }
.alert.warn { background: #fff8e6; border-color: #f3dc9b; color: #6b4a00; }
.alert.err { background: #fdf1f3; border-color: #efc5cc; color: #8d1427; }
.alert.info { background: #eef4fc; border-color: #cddcf2; color: #1d4f91; }
.list-item { padding: 12px 0; border-bottom: 1px solid var(--line-2); }
.list-item:last-child { border-bottom: 0; }
.list-item .h { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.list-item .h b { font-weight: 600; }
.list-item p { margin: 4px 0 0; color: var(--ink-2); font-size: 13px; }
.skeleton { height: 120px; border-radius: var(--r); background: linear-gradient(90deg, #efebe6, #f6f3ef, #efebe6); background-size: 200% 100%; animation: sk 1.2s infinite; }
@keyframes sk { to { background-position: -200% 0; } }

/* login */
.login { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login .art { background: radial-gradient(1200px 600px at 20% 10%, #3a1219 0%, #1F2328 55%), #1F2328; color: #fff; padding: 56px; display: flex; flex-direction: column; justify-content: space-between; }
.login .art img { width: 64px; }
.login .art h1 { font-size: 40px; line-height: 1.1; margin: 0 0 12px; letter-spacing: -.02em; }
.login .art p { color: #c9ccd1; max-width: 420px; }
.login .form { display: grid; place-items: center; padding: 32px; }
.login form { width: min(380px, 100%); }
.login form h2 { margin: 0 0 4px; font-size: 22px; }
.login form .field input { padding: 11px 13px; font-size: 15px; }
.login .btn.pri { width: 100%; justify-content: center; padding: 11px; font-size: 15px; }
.qr { display: flex; justify-content: center; margin: 10px 0; }
.qr svg { width: 200px; height: 200px; }
.codes { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; font-family: ui-monospace, monospace; }

/* ---------- mobile ---------- */
@media (max-width: 1100px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g21, .g12, .g3 { grid-template-columns: 1fr; } }
@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; background: var(--bg); }
  .side { position: fixed; left: 0; top: 0; bottom: 0; width: 270px; z-index: 150; transform: translateX(-100%); transition: transform .2s; }
  .side.open { transform: none; box-shadow: 0 0 0 100vmax rgba(0,0,0,.4); }
  .burger { display: inline-flex; }
  .top { padding: 12px 16px; gap: 10px; }
  .top h1 { font-size: 17px; }
  .top .sub, .search { display: none; }
  .page { padding: 16px 14px 60px; }
  .g2 { grid-template-columns: 1fr; }
  .kpi .val { font-size: 23px; }
  .login { grid-template-columns: 1fr; } .login .art { padding: 28px; min-height: 0; } .login .art h1 { font-size: 26px; } .login .art .x { display: none; }
  .status-row { grid-template-columns: 1fr auto; } .status-row .ticks, .status-row .err-c { grid-column: 1 / -1; }
  table.t.resp thead { display: none; }
  table.t.resp tr { display: block; border-bottom: 1px solid var(--line); padding: 8px 0; }
  table.t.resp td { display: flex; justify-content: space-between; gap: 10px; border: 0; padding: 4px 2px; text-align: right; }
  table.t.resp td::before { content: attr(data-l); color: var(--ink-3); font-size: 12px; text-align: left; font-weight: 500; }
  table.t.resp td.hm { display: none; }
  .card-head { flex-wrap: wrap; }
  table.t.resp td.name { display: block; text-align: left; } table.t.resp td.name::before { content: none; }
  .kv { grid-template-columns: 1fr; gap: 0 0; } .kv dd { margin-bottom: 8px; }
  .timeline li { grid-template-columns: 1fr; gap: 2px; }
  .hbar { grid-template-columns: 90px 1fr auto; }
}
