/* =========================================================
   PM Agri · Matteo Pericolo Intermediario Assicurativo
   Design system – White Rabbix
   ========================================================= */
:root {
  --blu: #27388a; --blu-2: #33479f; --blu-scuro: #1b2766; --blu-50: #eef1fa; --blu-100: #dfe4f5;
  --verde: #2b7c36; --verde-2: #33923f; --verde-50: #eaf5ec; --verde-100: #d3ebd7;
  --rosso: #c0262d; --rosso-50: #fdeeee; --ambra: #b7791f; --ambra-50: #fdf5e6; --ciano: #0e7490; --ciano-50: #e7f6fa;
  --testo: #1c2333; --testo-2: #4a5468; --testo-3: #7a8396; --bordo: #e3e7f0; --bordo-2: #d4dae6;
  --sfondo: #f4f6fb; --card: #ffffff; --hover: #f7f9fd;
  --r: 14px; --r-sm: 10px; --r-xs: 7px;
  --ombra: 0 1px 2px rgba(20, 31, 74, .05), 0 4px 16px rgba(20, 31, 74, .05);
  --ombra-2: 0 10px 40px rgba(20, 31, 74, .16);
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sidebar: 252px; --top: 64px;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font); color: var(--testo); background: var(--sfondo); font-size: 14.5px; line-height: 1.45; -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; }
a { color: var(--blu); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; letter-spacing: -.01em; }
h1 { font-size: 24px; font-weight: 750; }
h2 { font-size: 18px; font-weight: 700; }
h3 { font-size: 15px; font-weight: 700; }
p { margin: 0 0 8px; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: var(--blu-100); }
.num { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); font-size: .92em; }
.muted { color: var(--testo-3); }
.small { font-size: 12.5px; }
.xs { font-size: 11.5px; }
.bold { font-weight: 700; }
.right { text-align: right; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hidden { display: none !important; }
.row { display: flex; gap: 12px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.row.top { align-items: flex-start; }
.row.between { justify-content: space-between; }
.col { display: flex; flex-direction: column; gap: 12px; }
.grow { flex: 1; min-width: 0; }
.gap-s { gap: 6px; } .gap-l { gap: 20px; }
.mt { margin-top: 16px; } .mt-s { margin-top: 8px; } .mb { margin-bottom: 16px; } .mb-s { margin-bottom: 8px; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.span2 { grid-column: span 2; } .span3 { grid-column: span 3; } .spanall { grid-column: 1 / -1; }
@media (max-width: 1100px) { .g4, .g5 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 680px) { .g2, .g3, .g4, .g5 { grid-template-columns: minmax(0, 1fr); } .span2, .span3 { grid-column: auto; } .grid.kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } .kpi .v { font-size: 19px; } }

/* ---------- layout ---------- */
.app { min-height: 100%; display: flex; }
.sidebar { width: var(--sidebar); background: #fff; border-right: 1px solid var(--bordo); position: fixed; inset: 0 auto 0 0; display: flex; flex-direction: column; z-index: 30; }
.sidebar .brand { padding: 18px 20px 12px; display: block; }
.sidebar .brand img { width: 150px; display: block; }
.sidebar .brand .sub { font-size: 10.5px; letter-spacing: 1.6px; color: var(--testo-3); text-transform: uppercase; margin-top: 6px; }
.nav { padding: 8px 12px; overflow-y: auto; flex: 1; }
.nav .grp { font-size: 10.5px; font-weight: 700; letter-spacing: 1.2px; color: var(--testo-3); text-transform: uppercase; padding: 14px 10px 6px; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 10px; color: var(--testo-2); font-weight: 560; position: relative; margin: 1px 0; }
.nav a:hover { background: var(--hover); text-decoration: none; color: var(--testo); }
.nav a.on { background: var(--blu-50); color: var(--blu); }
.nav a.on::before { content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 4px; border-radius: 0 4px 4px 0; background: var(--verde); }
.nav a .ico { width: 19px; height: 19px; flex: none; }
.nav a .pill { margin-left: auto; }
.nav .cta { margin: 6px 0 10px; }
.side-foot { padding: 12px 16px; border-top: 1px solid var(--bordo); }
.main { flex: 1; margin-left: var(--sidebar); min-width: 0; display: flex; flex-direction: column; }
.topbar { height: var(--top); display: flex; align-items: center; gap: 12px; padding: 0 28px; position: sticky; top: 0; z-index: 20; background: rgba(244, 246, 251, .86); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid transparent; }
.topbar.scrolled { border-bottom-color: var(--bordo); }
.topbar .titolo { font-weight: 700; font-size: 16px; }
.content { padding: 8px 28px 48px; width: 100%; max-width: 1480px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 10px 0 20px; flex-wrap: wrap; }
.page-head .sub { color: var(--testo-3); margin-top: 4px; }
.ico { width: 18px; height: 18px; flex: none; }
.mobile-only { display: none !important; }
.tabbar { display: none; }
@media (max-width: 960px) {
  .sidebar { transform: translateX(-100%); transition: transform .25s ease; box-shadow: var(--ombra-2); }
  .sidebar.open { transform: none; }
  .main { margin-left: 0; }
  .topbar { padding: 0 14px; }
  .content { padding: 4px 14px 110px; }
  .mobile-only { display: initial !important; }
  .btn.mobile-only { display: inline-flex !important; }
  .desktop-only { display: none !important; }
  .tabbar { display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 40; background: rgba(255, 255, 255, .96); backdrop-filter: blur(12px); border-top: 1px solid var(--bordo); padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); }
  .tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 10.5px; font-weight: 600; color: var(--testo-3); padding: 4px 0; border-radius: 10px; }
  .tabbar a.on { color: var(--blu); }
  .tabbar a:hover { text-decoration: none; }
  .tabbar a .ico { width: 23px; height: 23px; }
  .tabbar a.plus .ico { width: 46px; height: 46px; padding: 11px; background: linear-gradient(135deg, var(--verde), #3a9b46); color: #fff; border-radius: 16px; margin-top: -20px; box-shadow: 0 6px 18px rgba(43, 124, 54, .35); }
  .page-head h1 { font-size: 21px; }
}
.scrim { position: fixed; inset: 0; background: rgba(15, 23, 51, .35); z-index: 25; }

/* ---------- card ---------- */
.card { background: var(--card); border: 1px solid var(--bordo); border-radius: var(--r); box-shadow: var(--ombra); }
.card.pad { padding: 20px; }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--bordo); }
.card-h h3 { display: flex; align-items: center; gap: 9px; }
.card-b { padding: 18px 20px; }
.card-f { padding: 14px 20px; border-top: 1px solid var(--bordo); background: #fbfcfe; border-radius: 0 0 var(--r) var(--r); }
.step-n { width: 26px; height: 26px; border-radius: 8px; background: var(--blu); color: #fff; display: inline-grid; place-items: center; font-size: 13px; font-weight: 750; flex: none; }
.step-n.ok { background: var(--verde); }
.section-title { font-size: 11.5px; letter-spacing: 1.1px; text-transform: uppercase; color: var(--testo-3); font-weight: 700; margin: 4px 0 10px; }

/* ---------- bottoni ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--bordo-2); background: #fff; font-weight: 620; cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s, box-shadow .15s, transform .05s; color: var(--testo); }
.btn:hover { background: var(--hover); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn .ico { width: 18px; height: 18px; }
.btn.primary { background: var(--blu); border-color: var(--blu); color: #fff; box-shadow: 0 2px 8px rgba(39, 56, 138, .25); }
.btn.primary:hover { background: var(--blu-2); }
.btn.success { background: var(--verde); border-color: var(--verde); color: #fff; box-shadow: 0 2px 8px rgba(43, 124, 54, .25); }
.btn.success:hover { background: var(--verde-2); }
.btn.danger { color: var(--rosso); border-color: #f1c6c8; }
.btn.danger:hover { background: var(--rosso-50); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: rgba(39, 56, 138, .06); }
.btn.sm { height: 32px; padding: 0 11px; font-size: 13px; border-radius: 8px; }
.btn.lg { height: 50px; padding: 0 22px; font-size: 16px; border-radius: 12px; }
.btn.block { width: 100%; }
.btn.icon { width: 40px; padding: 0; }
.btn.icon.sm { width: 32px; }
.btn.wa { background: #1faa53; border-color: #1faa53; color: #fff; }
.btn.wa:hover { background: #1c9a4b; }

/* ---------- form ---------- */
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > label, .lbl { font-size: 12.5px; font-weight: 620; color: var(--testo-2); }
.field .hint { font-size: 11.5px; color: var(--testo-3); }
.field .err { font-size: 12px; color: var(--rosso); }
.req::after { content: " *"; color: var(--rosso); }
.input, .select, textarea.input { height: 42px; width: 100%; border: 1px solid var(--bordo-2); background: #fff; border-radius: 10px; padding: 0 12px; outline: none; transition: border-color .15s, box-shadow .15s; }
textarea.input { height: auto; min-height: 84px; padding: 10px 12px; resize: vertical; }
.input:focus, .select:focus { border-color: var(--blu); box-shadow: 0 0 0 4px rgba(39, 56, 138, .12); }
.input.bad { border-color: var(--rosso); box-shadow: 0 0 0 3px rgba(192, 38, 45, .1); }
.input.sm, .select.sm { height: 34px; border-radius: 8px; font-size: 13.5px; }
.input.num { text-align: right; font-variant-numeric: tabular-nums; }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%237a8396' stroke-width='1.7' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }
.input-wrap { position: relative; }
.input-wrap .ico { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; color: var(--testo-3); pointer-events: none; }
.input-wrap .input { padding-left: 38px; }
.check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; user-select: none; }
.check input { width: 19px; height: 19px; accent-color: var(--verde); margin: 1px 0 0; flex: none; }
.seg { display: inline-flex; background: #eef1f7; border-radius: 11px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; height: 34px; padding: 0 14px; border-radius: 8px; font-weight: 620; color: var(--testo-2); cursor: pointer; }
.seg button.on { background: #fff; color: var(--blu); box-shadow: 0 1px 4px rgba(20, 31, 74, .12); }
.seg.lg button { height: 40px; padding: 0 18px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 8px; border: 1.5px solid var(--bordo-2); background: #fff; border-radius: 999px; padding: 8px 14px; font-weight: 620; cursor: pointer; transition: all .15s; color: var(--testo-2); }
.chip .ico { width: 16px; height: 16px; }
.chip.on { border-color: var(--verde); background: var(--verde-50); color: var(--verde); }
.chip.lock { cursor: default; }
.chip small { font-weight: 500; opacity: .8; }

/* combobox */
.combo { position: relative; }
.combo-list { position: absolute; z-index: 50; left: 0; right: 0; top: calc(100% + 4px); background: #fff; border: 1px solid var(--bordo); border-radius: 12px; box-shadow: var(--ombra-2); max-height: 320px; overflow-y: auto; padding: 5px; }
.combo-item { padding: 9px 11px; border-radius: 8px; cursor: pointer; display: flex; gap: 10px; align-items: center; justify-content: space-between; }
.combo-item:hover, .combo-item.act { background: var(--blu-50); }
.combo-item .t { font-weight: 600; }
.combo-item .s { font-size: 12px; color: var(--testo-3); }
.combo-empty { padding: 12px; color: var(--testo-3); font-size: 13px; }

/* ---------- badge ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; height: 23px; padding: 0 9px; border-radius: 999px; font-size: 11.5px; font-weight: 700; background: #eef0f4; color: var(--testo-2); white-space: nowrap; }
.badge .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.ok { background: var(--verde-50); color: var(--verde); }
.badge.blu { background: var(--blu-50); color: var(--blu); }
.badge.info { background: var(--ciano-50); color: var(--ciano); }
.badge.attesa { background: var(--ambra-50); color: var(--ambra); }
.badge.errore { background: var(--rosso-50); color: var(--rosso); }
.badge.neutro { background: #eef0f4; color: var(--testo-2); }
.pill { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--rosso); color: #fff; font-size: 11px; font-weight: 700; display: inline-grid; place-items: center; }
.pill.verde { background: var(--verde); }

/* ---------- KPI ---------- */
.kpi { padding: 16px 18px; display: flex; flex-direction: column; gap: 6px; position: relative; overflow: hidden; }
.kpi .l { font-size: 12.5px; color: var(--testo-3); font-weight: 600; display: flex; align-items: center; gap: 7px; }
.kpi .l .ico { width: 16px; height: 16px; }
.kpi .v { font-size: 24px; font-weight: 760; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi .d { font-size: 12px; color: var(--testo-3); }
.kpi.accent { background: linear-gradient(135deg, var(--blu) 0%, #2f4aa8 100%); color: #fff; border: 0; }
.kpi.accent .l, .kpi.accent .d { color: rgba(255, 255, 255, .8); }
.kpi.verde { background: linear-gradient(135deg, var(--verde) 0%, #3a9b46 100%); color: #fff; border: 0; }
.kpi.verde .l, .kpi.verde .d { color: rgba(255, 255, 255, .85); }
.kpi .spark { position: absolute; right: 12px; bottom: 10px; opacity: .9; }

/* ---------- tabelle ---------- */
.tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 11.5px; font-weight: 700; color: var(--testo-3); text-transform: uppercase; letter-spacing: .6px; padding: 10px 12px; border-bottom: 1px solid var(--bordo); background: #fafbfd; white-space: nowrap; position: sticky; top: 0; z-index: 1; }
.tbl td { padding: 11px 12px; border-bottom: 1px solid #eef1f6; vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr.click { cursor: pointer; }
.tbl tbody tr.click:hover td { background: var(--hover); }
.tbl .r { text-align: right; font-variant-numeric: tabular-nums; }
.tbl .c { text-align: center; }
.tbl tfoot td { font-weight: 750; background: #fafbfd; border-top: 1px solid var(--bordo); }
.tbl.compact td { padding: 7px 10px; }
.tbl.compact th { padding: 8px 10px; }

/* specchietto tassi */
.mirror td, .mirror th { text-align: center; }
.mirror td:first-child, .mirror th:first-child { text-align: left; }
.mirror .best { background: var(--verde-50) !important; color: var(--verde); font-weight: 800; border-radius: 6px; }
.mirror tr.sel td { background: var(--blu-50); }
.mirror tr.sel td:first-child { box-shadow: inset 4px 0 0 var(--blu); }
.mirror .na { color: #c0c6d2; }
.mirror tbody tr { cursor: pointer; }
.mirror tbody tr:hover td { background: var(--hover); }
.mirror .tot { font-weight: 760; font-size: 15px; }

/* partite */
.partita { border: 1px solid var(--bordo); border-radius: 12px; padding: 14px; background: #fff; position: relative; }
.partita.bad { border-color: #f0b4b7; background: #fffafa; }
.partita .n { position: absolute; top: -11px; left: 12px; background: var(--blu); color: #fff; font-size: 11.5px; font-weight: 750; border-radius: 999px; padding: 2px 10px; }
.partita .grid { gap: 10px; }
.partita .valore { font-weight: 780; font-size: 16px; font-variant-numeric: tabular-nums; }
.sv-bar { height: 7px; background: #eef1f7; border-radius: 99px; overflow: hidden; margin-top: 6px; }
.sv-bar > div { height: 100%; background: var(--verde); border-radius: 99px; transition: width .25s; }
.sv-bar.over > div { background: var(--rosso); }

/* riepilogo */
.summary { position: sticky; top: calc(var(--top) + 8px); }
.summary .big { font-size: 30px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.summary .line { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; font-size: 13.5px; }
.summary .line span:last-child { font-weight: 650; font-variant-numeric: tabular-nums; }
.summary .sep { height: 1px; background: var(--bordo); margin: 6px 0; }
.carico { background: var(--verde-50); border: 1px solid var(--verde-100); border-radius: 12px; padding: 12px 14px; margin-top: 10px; }
.carico .v { font-size: 22px; font-weight: 800; color: var(--verde); font-variant-numeric: tabular-nums; }
.bottom-bar { display: none; }
@media (max-width: 1180px) {
  .prev-layout { grid-template-columns: minmax(0, 1fr) !important; }
  .summary { position: static; }
}
@media (max-width: 960px) {
  .bottom-bar { display: flex; position: fixed; left: 0; right: 0; bottom: calc(62px + env(safe-area-inset-bottom)); z-index: 35; background: #fff; border-top: 1px solid var(--bordo); padding: 10px 14px; gap: 10px; align-items: center; box-shadow: 0 -6px 20px rgba(20, 31, 74, .08); }
}

/* alert */
.alert { display: flex; gap: 10px; padding: 11px 14px; border-radius: 11px; font-size: 13.5px; align-items: flex-start; border: 1px solid transparent; }
.alert .ico { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.alert.errore { background: var(--rosso-50); color: #8f1d22; border-color: #f6cfd1; }
.alert.avviso { background: var(--ambra-50); color: #7a4f10; border-color: #f2dfb5; }
.alert.info { background: var(--blu-50); color: var(--blu-scuro); border-color: var(--blu-100); }
.alert.ok { background: var(--verde-50); color: #1f5c28; border-color: var(--verde-100); }

/* modal + toast */
.modal-bg { position: fixed; inset: 0; z-index: 80; background: rgba(15, 23, 51, .45); display: grid; place-items: center; padding: 16px; animation: fade .15s; }
.modal { background: #fff; border-radius: 18px; width: min(620px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; box-shadow: var(--ombra-2); animation: pop .18s ease; }
.modal.wide { width: min(980px, 100%); }
.modal-h { padding: 18px 22px; border-bottom: 1px solid var(--bordo); display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.modal-b { padding: 20px 22px; overflow-y: auto; }
.modal-f { padding: 14px 22px; border-top: 1px solid var(--bordo); display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
@media (max-width: 680px) { .modal-bg { place-items: end stretch; padding: 0; } .modal { border-radius: 18px 18px 0 0; max-height: 92vh; width: 100%; } }
.toasts { position: fixed; z-index: 100; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--testo); color: #fff; padding: 12px 16px; border-radius: 12px; box-shadow: var(--ombra-2); display: flex; gap: 10px; align-items: center; max-width: 380px; animation: pop .2s ease; font-weight: 550; }
.toast.ok { background: #1f6b2a; } .toast.err { background: #a2242a; }
@media (max-width: 960px) { .toasts { left: 12px; right: 12px; bottom: calc(80px + env(safe-area-inset-bottom)); } .toast { max-width: none; } }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }

/* varie */
.empty { text-align: center; padding: 40px 20px; color: var(--testo-3); }
.empty .ico { width: 42px; height: 42px; color: #c5ccda; margin-bottom: 8px; }
.skeleton { background: linear-gradient(90deg, #eef1f6 25%, #f6f8fb 37%, #eef1f6 63%); background-size: 400% 100%; animation: sk 1.3s ease infinite; border-radius: 8px; }
@keyframes sk { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
.spinner { width: 18px; height: 18px; border: 2.5px solid rgba(255, 255, 255, .4); border-top-color: currentColor; border-radius: 50%; animation: spin .7s linear infinite; }
.spinner.dark { border-color: var(--blu-100); border-top-color: var(--blu); }
@keyframes spin { to { transform: rotate(360deg); } }
.divider { height: 1px; background: var(--bordo); margin: 14px 0; }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 6px 14px; font-size: 13.5px; }
.kv dt { color: var(--testo-3); }
.kv dd { margin: 0; font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 680px) { .kv { grid-template-columns: 1fr; } .kv dt { margin-top: 6px; } }
.avatar { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; color: #fff; font-weight: 750; font-size: 13px; flex: none; }
.progress { height: 8px; background: #eef1f7; border-radius: 99px; overflow: hidden; }
.progress > div { height: 100%; border-radius: 99px; background: var(--verde); }
.progress.warn > div { background: var(--ambra); }
.timeline { display: flex; gap: 0; overflow-x: auto; padding: 4px 0; }
.timeline .st { flex: 1; min-width: 110px; position: relative; text-align: center; font-size: 12px; color: var(--testo-3); padding-top: 26px; }
.timeline .st::before { content: ""; position: absolute; top: 9px; left: -50%; right: 50%; height: 3px; background: var(--bordo); }
.timeline .st:first-child::before { display: none; }
.timeline .st .pt { position: absolute; top: 2px; left: 50%; transform: translateX(-50%); width: 17px; height: 17px; border-radius: 50%; background: #fff; border: 3px solid var(--bordo-2); z-index: 1; }
.timeline .st.done { color: var(--testo); font-weight: 650; }
.timeline .st.done .pt { background: var(--verde); border-color: var(--verde); }
.timeline .st.done::before { background: var(--verde); }
.timeline .st.now .pt { border-color: var(--blu); box-shadow: 0 0 0 4px var(--blu-100); }
.sigpad { width: 100%; height: 240px; border: 2px dashed var(--bordo-2); border-radius: 14px; background: #fff linear-gradient(transparent calc(100% - 52px), var(--bordo) calc(100% - 52px), var(--bordo) calc(100% - 51px), transparent calc(100% - 51px)); touch-action: none; cursor: crosshair; display: block; }
.sigpad.big { height: 300px; }
.otp { display: flex; gap: 8px; justify-content: center; }
.otp input { width: 48px; height: 58px; text-align: center; font-size: 26px; font-weight: 750; border: 1.5px solid var(--bordo-2); border-radius: 12px; outline: none; }
.otp input:focus { border-color: var(--blu); box-shadow: 0 0 0 4px rgba(39, 56, 138, .12); }
.netbar { position: fixed; top: 0; left: 0; right: 0; z-index: 90; background: var(--ambra); color: #fff; text-align: center; font-size: 12.5px; font-weight: 650; padding: 5px; }
.countdown { font-variant-numeric: tabular-nums; font-weight: 800; }
.hero { background: linear-gradient(120deg, var(--blu) 0%, #2f47a3 55%, #2b7c36 140%); color: #fff; border-radius: 18px; padding: 22px 24px; position: relative; overflow: hidden; }
.hero::after { content: ""; position: absolute; right: -40px; top: -40px; width: 220px; height: 220px; border-radius: 50%; background: rgba(255, 255, 255, .07); }
.hero h1 { font-size: 22px; }
.hero .muted { color: rgba(255, 255, 255, .78); }
.qa { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; padding: 16px; border-radius: 14px; border: 1px solid var(--bordo); background: #fff; cursor: pointer; transition: all .15s; color: var(--testo); }
.qa:hover { border-color: var(--blu-100); box-shadow: var(--ombra); text-decoration: none; transform: translateY(-1px); }
.qa .ico { width: 38px; height: 38px; padding: 9px; border-radius: 11px; background: var(--blu-50); color: var(--blu); }
.qa.verde .ico { background: var(--verde-50); color: var(--verde); }
.qa.ambra .ico { background: var(--ambra-50); color: var(--ambra); }
.qa .t { font-weight: 700; }
.qa .s { font-size: 12.5px; color: var(--testo-3); }
.list-item { display: flex; gap: 12px; align-items: center; padding: 12px 16px; border-bottom: 1px solid #eef1f6; cursor: pointer; }
.list-item:hover { background: var(--hover); }
.list-item:last-child { border-bottom: 0; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.filters .field { min-width: 150px; }
.chart-box { position: relative; height: 260px; }
.chart-box.tall { height: 320px; }
.chart-box.short { height: 200px; }
.legend-dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.login { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; }
.login .art { background: linear-gradient(150deg, var(--blu-scuro) 0%, var(--blu) 55%, #2a6e37 120%); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.login .art .feat { display: flex; gap: 12px; align-items: flex-start; margin: 14px 0; max-width: 420px; }
.login .art .feat .ico { width: 34px; height: 34px; padding: 7px; background: rgba(255, 255, 255, .12); border-radius: 10px; flex: none; }
.login .form { display: grid; place-items: center; padding: 32px; background: #fff; }
.login .form > div { width: min(400px, 100%); }
@media (max-width: 900px) { .login { grid-template-columns: 1fr; } .login .art { display: none; } }
.doc-thumb { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 10px; border: 1px solid var(--bordo); background: #f2f4f8; display: grid; place-items: center; color: var(--testo-3); }
.heat { position: relative; }
.print-only { display: none; }
@media print { .sidebar, .topbar, .tabbar, .bottom-bar, .no-print { display: none !important; } .main { margin: 0; } .content { padding: 0; } .card { box-shadow: none; } .print-only { display: block; } }

/* =========================================================
   RESPONSIVE – telefono e tablet
   ========================================================= */
.grid > * { min-width: 0; }
.layout-side { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
.layout-side.narrow { grid-template-columns: minmax(0, 1fr) 320px; }
.layout-trend { display: grid; gap: 16px; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.page-head .row { flex-wrap: wrap; }
.card-h { flex-wrap: wrap; row-gap: 8px; }
.card-h h3 { min-width: 0; }
.seg { max-width: 100%; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.seg::-webkit-scrollbar { display: none; }
.seg button { white-space: nowrap; flex: none; }
.tabs-scroll { display: flex; gap: 6px; flex-wrap: wrap; }
.vista-toggle { display: inline-flex; gap: 2px; background: #eef1f7; border-radius: 9px; padding: 2px; }
.vista-toggle button { border: 0; background: transparent; width: 32px; height: 28px; border-radius: 7px; display: grid; place-items: center; color: var(--testo-3); cursor: pointer; }
.vista-toggle button.on { background: #fff; color: var(--blu); box-shadow: 0 1px 3px rgba(20, 31, 74, .12); }
.vista-toggle .ico { width: 16px; height: 16px; }
.filters-toggle { display: none; }
.cliente-info { display: grid; gap: 12px; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) auto; align-items: start; }

@media (max-width: 1100px) {
  .layout-side, .layout-side.narrow, .layout-trend, .prev-layout { grid-template-columns: minmax(0, 1fr) !important; }
  .layout-side.aside-first > aside { order: -1; }
  .summary { position: static; }
  .cliente-info { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .cliente-info > :last-child { grid-column: 1 / -1; }
}
/* tipo di polizza: due tasti colorati ben riconoscibili */
.tipologia { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tipologia button { --c: var(--verde); --c50: var(--verde-50); height: 42px; border-radius: 10px; border: 2px solid var(--c); background: var(--c50); color: var(--c);
  font: inherit; font-weight: 750; font-size: 14.5px; letter-spacing: .2px; display: flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer; transition: background .15s, color .15s, box-shadow .15s; }
.tipologia button.nonagev { --c: #c2410c; --c50: #fff1e8; }
.tipologia button.on { background: var(--c); color: #fff; box-shadow: 0 3px 10px color-mix(in srgb, var(--c) 35%, transparent); }
.tipologia button:not(.on):hover { filter: brightness(.97); }
.tipologia .pallino { width: 15px; height: 15px; border-radius: 50%; border: 2px solid currentColor; opacity: .75; }
textarea.input.autogrow { min-height: 42px; resize: none; overflow: hidden; line-height: 1.4; padding-top: 10px; padding-bottom: 8px; }

/* bacheca */
.bacheca .card-h h3 .pill { margin-left: 4px; }
.bacheca-msg { border: 1px solid var(--bordo); border-left: 4px solid var(--blu); border-radius: 12px; padding: 12px 14px; background: #fff; }
.bacheca-msg.importante { border-left-color: var(--ambra); background: #fffcf5; }
.bacheca-msg.urgente { border-left-color: var(--rosso); background: #fff8f8; }
.bacheca-msg.nuovo { box-shadow: 0 0 0 2px var(--blu-100); }
.bacheca-msg.scaduto { opacity: .6; }
.bacheca-msg h4 { margin: 0; font-size: 15.5px; line-height: 1.3; }
.bacheca-testo { white-space: pre-wrap; word-break: break-word; margin-top: 6px; color: var(--testo-2); }
.bacheca-clip { max-height: 7.5em; overflow: hidden; -webkit-mask-image: linear-gradient(#000 60%, transparent); mask-image: linear-gradient(#000 60%, transparent); }
.bacheca-dest { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 4px 12px; max-height: 220px; overflow: auto; padding: 4px 2px; }
.tipo-msg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.tipo-msg button { --c: var(--blu); height: 38px; border-radius: 9px; border: 1.5px solid var(--bordo-2); background: #fff; color: var(--testo-2); font: inherit; font-weight: 650; display: flex; align-items: center; justify-content: center; gap: 6px; cursor: pointer; }
.tipo-msg button.importante { --c: var(--ambra); } .tipo-msg button.urgente { --c: var(--rosso); }
.tipo-msg button.on { border-color: var(--c); background: var(--c); color: #fff; }

/* configurazione guidata SMS */
.sms-stato { border-left: 5px solid var(--bordo-2); }
.sms-stato.ok { border-left-color: var(--verde); } .sms-stato.attesa { border-left-color: var(--ambra); }
.sms-icona { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--blu-50); color: var(--blu); flex: none; }
.sms-stato.ok .sms-icona { background: var(--verde-50); color: var(--verde); }
.sms-credito { text-align: right; }
.sms-passo-h { width: 100%; display: flex; align-items: center; gap: 12px; padding: 14px 16px; background: none; border: 0; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.sms-n { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--blu-50); color: var(--blu); font-weight: 750; flex: none; }
.sms-passo.fatto .sms-n { background: var(--verde); color: #fff; }
.sms-passo .card-b { border-top: 1px solid var(--bordo); }
.sms-lista { margin: 0; padding-left: 20px; display: grid; gap: 6px; }
.sms-lista li { line-height: 1.45; }

/* suggerisci una modifica */
.sugg-btn { border-color: #f1d58a; background: #fff8e1; color: #8a5a00; }
.sugg-btn:hover { background: #fff1c4; }
.sugg-item { border: 1px solid var(--bordo); border-radius: 10px; padding: 10px 12px; }
@media (max-width: 680px) {
  .sugg-btn { width: 38px; height: 38px; min-height: 38px !important; padding: 0 !important; justify-content: center; }
  .sugg-btn span { display: none; }
  .tipo-msg { grid-template-columns: 1fr; }
  .tipologia button { font-size: 14px; }
}

/* tablet: colonne meno importanti nascoste, stato dentro la prima cella */
.solo-mt { display: none !important; }
@media (max-width: 1100px) { .solo-mt { display: inline-flex !important; } }
@media (min-width: 681px) and (max-width: 1100px) {
  .hide-t { display: none !important; }
  .tbl td.small, .tbl td .xs { word-break: normal; }
}

@media (max-width: 960px) {
  .page-head { margin: 6px 0 14px; align-items: flex-start; }
  .page-head > div:first-child { min-width: 0; flex: 1 1 260px; }
  .tabs-scroll { flex-wrap: nowrap; overflow-x: auto; margin: 0 -14px 14px; padding: 2px 14px 6px; scrollbar-width: none; }
  .tabs-scroll::-webkit-scrollbar { display: none; }
  .tabs-scroll .btn { flex: none; }
  .chips.scroll-m { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 4px; }
  .chips.scroll-m .chip { flex: none; }
}

@media (max-width: 680px) {
  body { font-size: 14px; }
  h1 { font-size: 20px; }
  .content { padding: 4px 12px 120px; }
  .card-h { padding: 13px 14px; }
  .card-b { padding: 14px; }
  .card.pad { padding: 14px; }
  .card-f { padding: 12px 14px; }
  .page-head .btn { height: 38px; padding: 0 12px; font-size: 13.5px; }
  .page-head > .row, .page-head > div:last-child.row { width: 100%; }
  .btn { white-space: normal; text-align: center; line-height: 1.2; max-width: 100%; }
  .btn:not(.icon) { height: auto; min-height: 40px; padding-top: 7px; padding-bottom: 7px; }
  .btn.sm:not(.icon) { min-height: 32px; padding-top: 5px; padding-bottom: 5px; }
  .btn.lg:not(.icon) { min-height: 48px; }
  .kv { gap: 2px 10px; }
  .kv dd { margin-bottom: 6px; }
  .hide-m { display: none !important; }
  .tabs-scroll { margin: 0 -12px 14px; padding: 2px 12px 6px; }
  .alert { flex-wrap: wrap; }
  .alert > .grow { flex: 1 1 220px; min-width: 0; }
  .filters .field.grow .seg { width: 100%; }
  .filters .field.grow .seg button { flex: 1 1 auto; padding-left: 8px; padding-right: 8px; }
  .timeline .st { min-width: 0 !important; font-size: 10.5px !important; padding-left: 2px; padding-right: 2px; line-height: 1.25; }
  .tbl.compact th, .tbl.compact td { padding-left: 6px; padding-right: 6px; }
  .tbl.compact th:first-child, .tbl.compact td:first-child { padding-left: 8px; }
  .tbl.compact th:last-child, .tbl.compact td:last-child { padding-right: 8px; }
  .row.stack-m { flex-direction: column; align-items: stretch; }
  .row.stack-m > * { width: 100%; }
  /* filtri compatti: ricerca a tutta larghezza, il resto su due colonne */
  .filters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .filters .field { min-width: 0 !important; }
  .filters .field.grow, .filters .field.spanall { grid-column: 1 / -1; }
  .filters .input, .filters .select { width: 100% !important; }
  .filters .seg { width: 100%; }
  .filters-toggle { display: flex; }
  .filters.chiusi { display: none; }
  /* tabelle → schede */
  .tbl-wrap:has(> table.cards) { overflow: visible; max-height: none !important; }
  table.tbl.cards td.full-m { text-align: left; }
  table.tbl.cards td.full-m::before { float: none; display: block; margin-bottom: 4px; }
  table.tbl.cards td.full-m .progress { width: 100%; display: block; }
  table.tbl.cards, table.tbl.cards tbody, table.tbl.cards tfoot, table.tbl.cards tr, table.tbl.cards td { display: block; width: auto; }
  table.tbl.cards thead { display: none; }
  table.tbl.cards tbody tr, table.tbl.cards tfoot tr { border: 1px solid var(--bordo); border-radius: 12px; margin: 10px 12px; padding: 10px 12px; background: #fff; box-shadow: 0 1px 2px rgba(20, 31, 74, .04); }
  table.tbl.cards tfoot tr { background: #fafbfd; }
  table.tbl.cards td { border: 0; padding: 4px 0 !important; text-align: right; overflow: hidden; min-height: 22px; }
  table.tbl.cards td::before { content: attr(data-label); float: left; margin-right: 12px; color: var(--testo-3); font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; line-height: 20px; text-align: left; }
  table.tbl.cards td[data-label=""]::before, table.tbl.cards td:first-child::before { display: none; }
  table.tbl.cards td:first-child { text-align: left; font-size: 15px; padding-bottom: 8px !important; margin-bottom: 4px; border-bottom: 1px solid #eef1f6; }
  table.tbl.cards td:empty { display: none; }
  table.tbl.cards td .row { justify-content: flex-end; }
  table.tbl.cards td:first-child .row { justify-content: flex-start; }
  table.tbl.cards tfoot td:first-child { font-size: 13px; }
  table.tbl.cards tr.click:hover td { background: transparent; }
  table.tbl.cards td .progress { width: 140px; display: inline-block; vertical-align: middle; }
  .card > .tbl-wrap:has(> table.cards) { padding-bottom: 2px; }
  /* specchietto e tabelle numeriche: scorrimento orizzontale fluido */
  .tbl-wrap { margin: 0; }
  .mirror th, .mirror td { padding: 7px 8px; font-size: 13px; }
  .mirror td:first-child, .mirror th:first-child { position: sticky; left: 0; background: #fff; z-index: 2; box-shadow: 1px 0 0 var(--bordo); }
  .mirror tr.sel td:first-child { background: var(--blu-50); }
  /* partite: due campi per riga */
  .partita { padding: 14px 12px 12px; }
  .partita .grid.g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .partita .span2 { grid-column: 1 / -1; }
  .cliente-info { grid-template-columns: minmax(0, 1fr); }
  .seg.blocco { display: grid; grid-template-columns: 1fr; width: 100%; }
  .seg.blocco button { white-space: normal; height: auto; min-height: 42px; }
  .chips .chip { padding: 7px 12px; font-size: 13.5px; }
  .chart-box { height: 230px; }
  .chart-box.tall { height: 260px; }
  .hero { padding: 18px; }
  .hero h1 { font-size: 20px; }
  .hero .btn.lg { min-height: 44px; font-size: 15px; }
  .timeline .st { min-width: 92px; font-size: 11px; }
  .modal-b { padding: 16px; }
  .modal-h { padding: 14px 16px; }
  .modal-f { padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); }
  .modal-f .btn { flex: 1 1 auto; }
  .list-item { padding: 12px 14px; }
  .sigpad.big { height: 260px; }
  .otp input { width: 42px; height: 52px; font-size: 22px; }
  .summary .big { font-size: 26px; }
  .doc-thumb { aspect-ratio: 3 / 2; }
}
@media (max-width: 380px) {
  .grid.kpis { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .kpi { padding: 12px; }
  .kpi .v { font-size: 17px; }
  .otp { gap: 5px; }
  .otp input { width: 38px; }
}
