/* Domus Scan — same family as Domus Radar (ink, serif figures, Inter UI) with a blue brand for buyers. */
:root {
  --bg: #F3F5F7; --surface: #FFFFFF; --surface-2: #F7F9FA;
  --ink: #152030; --ink-2: #46546A; --ink-3: #5B677C;
  --line: #E0E5EB; --line-2: #D0D7E0;
  --brand: #24405E; --brand-ink: #F2EFE6; --brand-soft: #E3EAF2; --accent: #8F6519;
  --ok: #256B45; --ok-soft: #E3F1E8; --warn: #8A560C; --warn-soft: #FBF0DC; --bad: #B3412F; --bad-soft: #F8E5E1;
  --shadow: 0 1px 2px rgba(21, 32, 48, .05), 0 4px 16px rgba(21, 32, 48, .04);
  --serif: "Source Serif 4", Georgia, serif;
  --sans: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --r: 12px; --page-w: 1240px;
  color-scheme: light;
}
/* theme: manual override */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0F141B; --surface: #161D26; --surface-2: #1B242F; --ink: #E7ECF2; --ink-2: #B1BDCB; --ink-3: #97A3B4;
    --line: #26303C; --line-2: #33404F; --brand: #6E9CCB; --brand-ink: #0F141B; --brand-soft: #1C2A3A; --accent: #D9A441;
    --ok: #5CC08A; --ok-soft: #173326; --warn: #E0A548; --warn-soft: #342A16; --bad: #E2735F; --bad-soft: #3A1F1A;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
    --bg: #0F141B; --surface: #161D26; --surface-2: #1B242F; --ink: #E7ECF2; --ink-2: #B1BDCB; --ink-3: #97A3B4;
    --line: #26303C; --line-2: #33404F; --brand: #6E9CCB; --brand-ink: #0F141B; --brand-soft: #1C2A3A; --accent: #D9A441;
    --ok: #5CC08A; --ok-soft: #173326; --warn: #E0A548; --warn-soft: #342A16; --bad: #E2735F; --bad-soft: #3A1F1A;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3);
    color-scheme: dark;
  }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 14px/1.5 var(--sans); }
a { color: var(--brand); }
h1, h2, h3, p { margin: 0; }
b, strong { font-weight: 600; }
.muted, small { color: var(--ink-3); }
small { font-size: 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.num { font-variant-numeric: tabular-nums; }

/* top bar */
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.topbar-inner { max-width: var(--page-w); margin: 0 auto; padding: 10px 24px; display: flex; align-items: center; gap: 20px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); flex: none; }
.brand-name { font: 600 16px/1 var(--sans); letter-spacing: -.01em; }
.topnav { display: flex; gap: 2px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.topnav a { padding: 7px 11px; border-radius: 8px; color: var(--ink-2); text-decoration: none; font-weight: 500; white-space: nowrap; }
.topnav a:hover { background: var(--surface-2); color: var(--ink); }
.topnav a[aria-current=page] { background: var(--brand-soft); color: var(--brand); }
.topbar-user { display: flex; align-items: center; gap: 10px; flex: none; }
.chip { display: inline-flex; align-items: center; height: 24px; padding: 0 10px; border-radius: 99px; background: var(--surface-2);
  border: 1px solid var(--line); font-size: 12px; color: var(--ink-2); white-space: nowrap; }
.chip-brand { background: var(--brand-soft); border-color: transparent; color: var(--brand); font-weight: 600; }
@media (max-width: 860px) {
  .topbar-inner { flex-wrap: wrap; padding: 10px 16px; gap: 8px 12px; }
  .topnav { order: 3; flex-basis: 100%; }
  .topbar-user { margin-left: auto; }
  .user-mail { display: none; }
}

/* page */
.page { max-width: var(--page-w); margin: 0 auto; padding: 28px 24px 64px; display: flex; flex-direction: column; gap: 20px; }
@media (max-width: 640px) { .page { padding: 20px 16px 48px; } }
.hero { display: flex; flex-direction: column; gap: 8px; max-width: 860px; }
.hero h1 { font: 400 clamp(26px, 3vw, 36px)/1.15 var(--serif); letter-spacing: -.01em; }
.lede { font-size: 15px; color: var(--ink-2); max-width: 75ch; }
.eyebrow { font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow);
  padding: 20px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.card h2 { font: 600 16px/1.3 var(--sans); }
.card-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; flex-wrap: wrap; }
.card-head p { font-size: 13px; color: var(--ink-3); margin-top: 2px; max-width: 70ch; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.g3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; }
.kpi .v { font: 400 26px/1.15 var(--serif); font-variant-numeric: tabular-nums; }
.kpi .l { font-size: 12px; color: var(--ink-3); }

/* controls */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: 8px;
  border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); font: 500 13px/1 var(--sans); cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--surface-2); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn-primary:hover { background: var(--brand); filter: brightness(1.08); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12px; }
.btn:disabled { opacity: .55; cursor: default; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], input[type=date], select {
  height: 36px; padding: 0 10px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--surface); color: var(--ink);
  font: 400 13px var(--sans); min-width: 0; width: 100%; }
input:focus-visible, select:focus-visible, .btn:focus-visible, a:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
input[type=checkbox] { accent-color: var(--brand); width: 16px; height: 16px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 12px; font-weight: 600; color: var(--ink-2); }
.field .hint { font-size: 12px; color: var(--ink-3); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.check { display: flex; gap: 8px; align-items: center; font-size: 13px; }

/* tags & tones */
.tag { display: inline-flex; align-items: center; height: 20px; padding: 0 8px; border-radius: 99px; font-size: 11px; font-weight: 600;
  white-space: nowrap; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); }
.t-ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.t-warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.t-bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.t-neutro { background: var(--brand-soft); color: var(--brand); border-color: transparent; }
.note { padding: 12px 14px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); font-size: 13px; color: var(--ink-2); }
.note-warn { background: var(--warn-soft); border-color: transparent; color: var(--ink); }
.note-ok { background: var(--ok-soft); border-color: transparent; color: var(--ink); }
.note-bad { background: var(--bad-soft); border-color: transparent; color: var(--ink); }
.lock { display: inline-flex; gap: 6px; align-items: center; font-size: 12px; color: var(--ink-3); }

/* bars */
.bars { display: flex; flex-direction: column; gap: 8px; }
.bar-row { display: grid; grid-template-columns: 130px 1fr 70px; gap: 10px; align-items: center; font-size: 13px; }
.bar { height: 10px; border-radius: 99px; background: var(--surface-2); overflow: hidden; border: 1px solid var(--line); }
.bar > span { display: block; height: 100%; background: var(--brand); border-radius: 99px; }
.bar.ok > span { background: var(--ok); } .bar.warn > span { background: var(--warn); } .bar.bad > span { background: var(--bad); }
button.bar-row { all: unset; display: grid; grid-template-columns: 130px 1fr 70px; gap: 10px; align-items: center; font-size: 13px; cursor: pointer; border-radius: 6px; padding: 2px 4px; }
button.bar-row:hover, button.bar-row[aria-pressed=true] { background: var(--brand-soft); }
button.bar-row:focus-visible { outline: 2px solid var(--brand); }

/* tables */
.table-wrap { overflow-x: auto; margin: 0 -20px -20px; border-top: 1px solid var(--line); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-3);
  padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap; }
th button { all: unset; cursor: pointer; }
td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
td.r, th.r { text-align: right; }
tr:last-child td { border-bottom: 0; }
.t-title { font-weight: 500; color: var(--ink); text-decoration: none; }
.t-title:hover { text-decoration: underline; }
.sub { font-size: 12px; color: var(--ink-3); }
.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; padding: 12px 20px; }
.star { all: unset; cursor: pointer; font-size: 16px; color: var(--ink-3); line-height: 1; }
.star[aria-pressed=true] { color: var(--accent); }

/* result blocks */
.big { font: 400 34px/1.1 var(--serif); font-variant-numeric: tabular-nums; }
.range { position: relative; height: 14px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--line); }
.range > span { position: absolute; top: -1px; bottom: -1px; background: var(--brand-soft); border: 1px solid var(--brand); border-radius: 99px; }
.range > i { position: absolute; top: -5px; width: 3px; height: 22px; background: var(--accent); border-radius: 2px; }
dl.kv { display: grid; grid-template-columns: 1fr auto; gap: 6px 16px; margin: 0; font-size: 13px; }
dl.kv dt { color: var(--ink-2); } dl.kv dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
dl.kv .tot { font-weight: 600; border-top: 1px solid var(--line); padding-top: 6px; }

/* documents */
.fase { display: flex; flex-direction: column; gap: 4px; }
.doc { display: grid; grid-template-columns: 22px 1fr; gap: 10px; padding: 12px 0; border-top: 1px solid var(--line); }
.doc:first-of-type { border-top: 0; }
.doc h3 { font: 600 14px/1.35 var(--sans); }
.doc.fatto h3 { color: var(--ink-3); text-decoration: line-through; }
.doc p { font-size: 13px; color: var(--ink-2); }
.progress { height: 8px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--line); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--ok); }

/* plans */
.plan { position: relative; }
.plan.attuale { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand), var(--shadow); }
.plan .prezzo { font: 400 32px/1 var(--serif); }
.plan ul { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; color: var(--ink-2); font-size: 13px; }

/* auth */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.auth .card { width: 100%; max-width: 400px; }

/* search results */
.results { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.results button { all: unset; padding: 10px 12px; cursor: pointer; border-top: 1px solid var(--line); font-size: 13px; }
.results button:first-child { border-top: 0; }
.results button:hover, .results button:focus-visible { background: var(--brand-soft); }
.footer { text-align: center; font-size: 12px; color: var(--ink-3); padding: 24px 16px 40px; }

.badge { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px;
  background: var(--accent); color: #fff; font-size: 11px; font-weight: 600; margin-left: 4px; }

/* ================================================================ login / sign-up (split) */
.auth2 { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); }
.auth2-pitch { background: #1B3249; color: #F2EFE6; padding: 48px clamp(28px, 5vw, 72px); display: flex; flex-direction: column; gap: 28px;
  position: relative; overflow: hidden; }
.auth2-pitch::after { content: ""; position: absolute; right: -180px; bottom: -180px; width: 460px; height: 460px; border-radius: 50%;
  border: 1px solid rgba(217, 164, 65, .25); box-shadow: 0 0 0 60px rgba(217, 164, 65, .05), 0 0 0 130px rgba(217, 164, 65, .03); pointer-events: none; }
.auth2-brand { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; font: 600 18px/1 var(--sans); }
.auth2-copy { display: flex; flex-direction: column; gap: 12px; max-width: 520px; margin-top: auto; }
.auth2-eyebrow { font-size: 12px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: #D9A441; }
.auth2-copy h1 { font: 400 clamp(30px, 3.4vw, 44px)/1.1 var(--serif); letter-spacing: -.015em; }
.auth2-copy p { color: rgba(242, 239, 230, .8); font-size: 16px; }
.auth2-demo { background: #F2EFE6; color: #152030; border-radius: 14px; padding: 16px 18px; display: flex; flex-direction: column; gap: 8px;
  max-width: 440px; box-shadow: 0 20px 50px rgba(0, 0, 0, .25); position: relative; z-index: 1; }
.auth2-demo .d-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.auth2-demo .d-t { font-weight: 600; }
.auth2-demo .d-p { font: 400 20px/1 var(--serif); }
.auth2-demo .d-s { font-size: 12px; color: #46546A; }
.auth2-demo .tag.t-ok { background: #E3F1E8; color: #2E7D52; }
.auth2-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; max-width: 480px; }
.auth2-list li { position: relative; padding-left: 30px; color: rgba(242, 239, 230, .86); }
.auth2-list li::before { content: "✓"; position: absolute; left: 0; top: 1px; display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: rgba(217, 164, 65, .2);
  color: #D9A441; font-size: 12px; font-weight: 700; }
.auth2-list b { color: #F2EFE6; font-weight: 600; }
.auth2-foot { margin-top: auto; font-size: 13px; color: rgba(242, 239, 230, .6); }
.auth2-form-wrap { display: grid; place-items: center; padding: 40px 24px; background: var(--bg); }
.auth2-form { width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: 16px; }
.auth2-form h2 { font: 400 28px/1.15 var(--serif); }
.auth2-form .muted { margin-top: 4px; }
.auth2-tabs { display: grid; grid-template-columns: 1fr 1fr; padding: 4px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); }
.auth2-tabs a { text-align: center; padding: 8px; border-radius: 7px; text-decoration: none; color: var(--ink-2); font-weight: 500; }
.auth2-tabs a[aria-selected=true] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.auth2-form input { height: 42px; font-size: 14px; }
.pw { position: relative; }
.pw input { padding-right: 84px; }
.pw-toggle { position: absolute; right: 6px; top: 6px; height: 30px; padding: 0 10px; border: 0; border-radius: 6px; background: var(--surface-2);
  color: var(--ink-2); font: 500 12px var(--sans); cursor: pointer; }
.pw-toggle:focus-visible { outline: 2px solid var(--brand); }
.btn-lg { height: 44px; font-size: 14px; }
.small-c { font-size: 13px; }
.auth2-other { font-size: 13px; color: var(--ink-3); border-top: 1px solid var(--line); padding-top: 14px; }
@media (max-width: 900px) {
  .auth2 { grid-template-columns: 1fr; }
  .auth2-pitch { padding: 28px 20px 32px; gap: 18px; }
  .auth2-copy { margin-top: 8px; }
  .auth2-copy h1 { font-size: 28px; }
  .auth2-list, .auth2-foot, .auth2-demo .d-row:last-child { display: none; }
  .auth2-pitch::after { display: none; }
  .auth2-form-wrap { padding: 28px 16px 40px; place-items: start center; }
}

td.nw { white-space: nowrap; }


/* ================================================================ phone layout (body.vm) */
.switch-ui { margin-top: 10px; }
.switch-ui a { color: var(--ink-2); }
.m-cards { display: none; }
.tabbar, .sheet { display: none; }
body.vm .topnav, body.vm .user-mail, body.vm .topbar-user form { display: none; }
body.vm .topbar-inner { padding: 10px 16px; flex-wrap: nowrap; }
body.vm .page { padding: 16px 14px 96px; gap: 14px; }
body.vm .hero h1 { font-size: 26px; }
body.vm .lede { font-size: 14px; }
body.vm .card { padding: 16px; }
body.vm .table-wrap { margin: 0 -16px -16px; }
body.vm .kpis { grid-template-columns: 1fr 1fr; gap: 10px; }
body.vm .kpi .v { font-size: 22px; }
body.vm .grid.g2, body.vm .grid.g3 { grid-template-columns: 1fr; }
body.vm .form-grid, body.vm .filters { grid-template-columns: 1fr 1fr; gap: 10px; }
body.vm .bar-row, body.vm button.bar-row { grid-template-columns: 110px 1fr 40px; }
body.vm .desk-only { display: none; }
body.vm .m-cards { display: flex; flex-direction: column; gap: 10px; }
body.vm .footer { padding-bottom: 96px; }
.m-card { display: flex; flex-direction: column; gap: 6px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface);
  text-decoration: none; color: var(--ink); }
.m-card:active { background: var(--surface-2); }
.m-top { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.m-top b { font-weight: 600; font-size: 14px; }
.m-p { font: 400 18px/1 var(--serif); white-space: nowrap; }
.m-tags { display: flex; gap: 6px; flex-wrap: wrap; }
body.vm .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: var(--surface);
  border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
.tabbar a, .tabbar button { all: unset; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 4px 0; font-size: 11px; font-weight: 500;
  color: var(--ink-3); cursor: pointer; position: relative; text-align: center; }
.tabbar svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tabbar [aria-current=page] { color: var(--brand); font-weight: 600; }
.tabbar a:focus-visible, .tabbar button:focus-visible { outline: 2px solid var(--brand); border-radius: 8px; }
.tabbar .badge { position: absolute; top: 0; left: calc(50% + 6px); margin: 0; }
body.vm .sheet:not([hidden]) { display: block; position: fixed; inset: 0; z-index: 30; background: rgba(10, 16, 24, .45); }
.sheet-card { position: absolute; left: 0; right: 0; bottom: 0; background: var(--surface); border-radius: 16px 16px 0 0; padding: 10px 16px calc(20px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; }
.sheet-card a, .sheet-card button { all: unset; padding: 14px 4px; border-bottom: 1px solid var(--line); font-size: 15px; color: var(--ink); cursor: pointer; }
.sheet-card form { display: contents; }
.sheet-card button { color: var(--bad); border-bottom: 0; }

/* ================================================================ admin: customers */
.cl-grid { display: grid; grid-template-columns: minmax(280px, 380px) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 960px) { .cl-grid { grid-template-columns: 1fr; } }
.cl-list { padding: 14px; gap: 10px; position: sticky; top: 72px; max-height: calc(100vh - 90px); overflow: auto; }
.cl-rows { display: flex; flex-direction: column; }
.cl-row { display: flex; align-items: center; gap: 10px; padding: 10px 8px; border-radius: 10px; text-decoration: none; color: var(--ink); min-width: 0; }
.cl-row:hover { background: var(--surface-2); }
.cl-row.on { background: var(--brand-soft); }
.avatar { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--brand); color: var(--brand-ink); font-weight: 600; flex: none; }
.ell { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cl-det { gap: 16px; }
.cl-box { border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.cl-box h3 { font: 600 14px/1.3 var(--sans); }
.cl-ev { display: grid; grid-template-columns: 120px 1fr; gap: 10px; font-size: 13px; padding: 6px 0; border-top: 1px solid var(--line); }
.cl-ev:first-of-type { border-top: 0; }
.cl-toast { position: sticky; bottom: 16px; padding: 12px 14px; border-radius: 10px; background: var(--ink); color: var(--surface); font-size: 13px; }
.pw { font: 600 15px Consolas, monospace; margin-top: 4px; user-select: all; }
body.vm .cl-list { position: static; max-height: 360px; }
body.vm .cl-ev { grid-template-columns: 1fr; gap: 2px; }

/* ================================================================ market: prices by zone */
.seg { display: inline-flex; padding: 3px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); }
.seg button { all: unset; padding: 6px 12px; border-radius: 7px; font-size: 13px; font-weight: 500; color: var(--ink-2); cursor: pointer; }
.seg button[aria-checked=true] { background: var(--surface); color: var(--brand); font-weight: 600; box-shadow: var(--shadow); }
.seg button:focus-visible { outline: 2px solid var(--brand); }
.z-legend { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; color: var(--ink-2); }
.z-legend .z-mark { position: static; display: inline-block; height: 14px; }
.z-list { display: flex; flex-direction: column; }
.z-row { all: unset; box-sizing: border-box; display: grid; grid-template-columns: minmax(220px, 1.1fr) minmax(160px, 1.4fr) 170px; gap: 16px; align-items: center;
  padding: 12px 10px; border-top: 1px solid var(--line); cursor: pointer; border-radius: 8px; }
.z-row:first-child { border-top: 0; }
.z-row:hover { background: var(--surface-2); }
.z-row:focus-visible { outline: 2px solid var(--brand); }
.z-name { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; min-width: 0; }
.z-name .sub { flex-basis: 100%; }
.z-track { position: relative; height: 12px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--line); }
.z-fill { position: absolute; left: 0; top: -1px; bottom: -1px; border-radius: 99px; background: var(--brand); opacity: .85; }
.z-fill.up { background: var(--warn); } .z-fill.down { background: var(--ok); }
.z-mark { position: absolute; top: -5px; width: 3px; height: 22px; border-radius: 2px; background: var(--ink); transform: translateX(-1px); }
.z-val { display: flex; align-items: center; justify-content: flex-end; gap: 8px; font-variant-numeric: tabular-nums; white-space: nowrap; }
@media (max-width: 760px) {
  .z-row { grid-template-columns: 1fr auto; gap: 8px 12px; }
  .z-track { grid-column: 1 / -1; grid-row: 2; }
  .z-val { grid-row: 1; grid-column: 2; flex-direction: column; align-items: flex-end; gap: 4px; }
}
body.vm .z-row { grid-template-columns: 1fr auto; gap: 8px 12px; }
body.vm .z-track { grid-column: 1 / -1; grid-row: 2; }
body.vm .z-val { grid-row: 1; grid-column: 2; flex-direction: column; align-items: flex-end; gap: 4px; }
body.vm .seg { width: 100%; } body.vm .seg button { flex: 1; text-align: center; }

/* ================================================================ legal pages, profile */
.legal { max-width: 820px; display: flex; flex-direction: column; gap: 12px; }
.legal h1 { font: 400 clamp(28px, 3vw, 36px)/1.15 var(--serif); }
.legal h2 { font: 600 17px/1.3 var(--sans); margin-top: 14px; }
.legal p, .legal li { color: var(--ink-2); line-height: 1.6; }
.legal blockquote { margin: 0; padding: 12px 16px; border-left: 3px solid var(--brand); background: var(--brand-soft); border-radius: 0 10px 10px 0; }
.legal-t { width: 100%; border-collapse: collapse; font-size: 13px; }
.legal-t th, .legal-t td { border: 1px solid var(--line); padding: 8px 10px; text-align: left; vertical-align: top; }
.legal-t th { background: var(--surface-2); }
.legal-nav a[aria-current] { font-weight: 600; }
.legal-note { border-top: 1px solid var(--line); padding-top: 12px; }
mark.dacompletare { background: var(--warn-soft); color: var(--warn); padding: 0 4px; border-radius: 4px; }
.legal-links { margin-bottom: 6px; }
.legal-links a, a.user-mail { color: inherit; }

/* ================================================================ review 2026-12-01: touch targets on the phone (>= 36px) */
body.vm .btn-sm { height: 36px; padding: 0 12px; }
body.vm .star { min-width: 36px; min-height: 36px; display: inline-grid; place-items: center; font-size: 20px; }
body.vm .seg button { padding: 9px 12px; }
body.vm .footer a, body.vm .switch-ui a { display: inline-block; padding: 6px 2px; }
body.vm button.bar-row { min-height: 36px; padding: 4px 6px; }
body.vm .chip-brand { height: 32px; padding: 0 12px; }
body.vm .check { min-height: 36px; }

/* accessibility: form controls need a boundary with at least 3:1 contrast (WCAG 1.4.11) */
:root { --ctl-line: #7B8698; }
:root[data-theme="dark"] { --ctl-line: #6A7787; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --ctl-line: #6A7787; } }
input[type=text], input[type=password], input[type=search], input[type=number], input[type=tel], input[type=email], input[type=date], input:not([type]),
select, .select, textarea, .btn-secondary { border-color: var(--ctl-line); }

/* ---------- compare comuni */
.cf-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.cf-chip { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 6px 0 14px; border-radius: 999px; border: 1px solid var(--ctl-line);
  background: var(--surface); color: var(--ink); font: 500 13px var(--sans); cursor: pointer; }
.cf-chip:hover { background: var(--surface-2); }
.cf-chip .cf-x { display: inline-flex; width: 24px; height: 24px; align-items: center; justify-content: center; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); font-size: 16px; }
.cf-table th[scope=row] { text-align: left; font-weight: 400; min-width: 220px; }
.cf-table th[scope=row] .cf-l { display: block; color: var(--ink); font-weight: 500; }
.cf-table th[scope=row] small { display: block; font-size: 12px; }
.cf-table th[scope=col] small { font-weight: 400; }
.cf-table td { white-space: nowrap; font-variant-numeric: tabular-nums; }
.cf-best { color: var(--ok); font-weight: 600; }
.cf-star { color: var(--ok); }
.cf-tot th, .cf-tot td { border-top: 1px solid var(--line-2); }
.cf-sum p { font-size: 15px; line-height: 1.6; color: var(--ink-2); }
.cf-sum b { color: var(--ink); }
.cf-notes { display: flex; flex-direction: column; gap: 8px; }
.cf-src { font-size: 12px; max-width: 900px; }
.cf-table { table-layout: fixed; }
.cf-table th.cf-corner { width: 34%; }
.cf-table th, .cf-table td { padding: 10px 16px; vertical-align: top; }
.cf-table tbody th[scope=row] { text-transform: none; letter-spacing: 0; font-size: 13px; background: none; color: var(--ink-3); }
.cf-table tbody th[scope=row] small { color: var(--ink-3); font-size: 12px; text-transform: none; letter-spacing: 0; }
.cf-table thead th { text-transform: none; letter-spacing: 0; font-size: 13px; color: var(--ink); }
.cf-table td { font-size: 14px; }
@media (max-width: 640px) { .cf-table { table-layout: auto; } .cf-table th[scope=row] { min-width: 160px; } }

/* compare section inside Comuni */
.cf-head { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
.cf-head h2 { font: 400 28px/1.2 var(--serif); }

/* ---------- top menu: a segmented selector on its own row, never overlapping brand and user */
.topbar-inner { flex-wrap: wrap; row-gap: 10px; }
.topbar-user { margin-left: auto; }
.topnav { order: 3; flex: 1 0 100%; display: flex; gap: 4px; padding: 4px; width: max-content; max-width: 100%;
  background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 12px; overflow-x: auto; }
.topbar-inner > .topnav { flex: 0 1 auto; }
.topbar-inner::after { content: ""; order: 2; flex-basis: 100%; height: 0; }   /* forces the menu onto its own row */
body.vm .topbar-inner::after { content: none; }
.topnav a { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 14px; border-radius: 9px;
  color: var(--ink-2); font-weight: 500; font-size: 14px; text-decoration: none; white-space: nowrap; flex: none;
  transition: background-color .15s, color .15s, box-shadow .15s; }
.topnav a:hover { background: var(--surface); color: var(--ink); box-shadow: 0 0 0 1px var(--line-2); }
.topnav a[aria-current=page] { background: var(--brand); color: var(--brand-ink); font-weight: 600; box-shadow: 0 1px 3px rgba(0, 0, 0, .18); }
.topnav a[aria-current=page] .badge { background: var(--brand-ink); color: var(--brand); }
.topnav a:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.topbar-user form .btn { min-height: 36px; padding: 0 14px; border: 1px solid var(--ctl-line); color: var(--ink); }
.topbar-user form .btn:hover { background: var(--surface-2); }
.topbar-user .chip-brand, .topbar-user a.user-mail { text-decoration: none; }
.topbar-user a.user-mail:hover { text-decoration: underline; }

/* single packages */
.pk { display: flex; flex-direction: column; gap: 10px; margin-top: 24px; }
.pk h2 { font-size: 26px; }
.pk-card h3 { margin: 0; font-size: 17px; }
.pk-card .prezzo { font-size: 26px; font-weight: 750; }
.pk-card .select { width: 100%; }

/* OMI zones map */
.mo-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(280px, 1fr); gap: 16px; align-items: start; }
@media (max-width: 900px) { .mo-grid { grid-template-columns: 1fr; } }
.mo-map { height: 560px; border-radius: 6px; border: 1px solid var(--line); z-index: 0; }
@media (max-width: 640px) { .mo-map { height: 380px; } }
.mo-list { display: flex; flex-direction: column; gap: 6px; max-height: 640px; overflow: auto; }
.mo-zone { display: flex; gap: 10px; align-items: flex-start; text-align: left; width: 100%; padding: 10px; border-radius: 6px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); font: inherit; font-size: 13px; cursor: pointer; }
.mo-zone:hover { border-color: var(--ctl-line); }
.mo-zone.is-on { border-color: var(--brand); box-shadow: inset 3px 0 0 var(--brand); }
.mo-zone .sub { display: block; margin-top: 2px; }
.mo-sw { width: 14px; height: 14px; border-radius: 3px; flex: none; margin-top: 2px; }
.mo-b { background: #23539B; } .mo-c { background: #4F86C6; } .mo-d { background: #B26B00; } .mo-e { background: #8A6A3C; } .mo-r { background: #3C7A4E; }
.leaflet-container { font: 13px var(--sans); }

/* top bar, compact: one row (brand · menu · user) when it fits, menu on a second row only on narrower screens */
.topbar-inner { flex-wrap: nowrap; gap: 14px; padding-top: 8px; padding-bottom: 8px; }
.topbar-inner::after { content: none; }
.topbar-inner > .topnav { order: 0; flex: 0 1 auto; min-width: 0; width: auto; padding: 3px; gap: 2px; margin: 0 auto 0 8px; }
.topnav a { min-height: 32px; padding: 0 10px; font-size: 13.5px; }
.topbar-user { margin-left: 0; gap: 8px; }
.topbar-user .dt-btn { width: 34px; height: 34px; min-width: 34px; }
.topbar-user form .btn { min-height: 34px; }
/* two compact rows only when one row really doesn't fit (measured by scan.js: .topbar.tb-2) */
.topbar-inner { max-width: 1440px; }
.topbar.tb-2 .topbar-inner { flex-wrap: wrap; row-gap: 8px; }
.topbar.tb-2 .topbar-inner::after { content: ""; order: 2; flex-basis: 100%; height: 0; }
.topbar.tb-2 .topbar-inner > .topnav { order: 3; margin: 0; max-width: 100%; }
.topbar.tb-2 .topbar-user { margin-left: auto; }
body.vm .topbar-inner::after { content: none; }
/* audit: targets at least 24px */
.bar-row { min-height: 30px; }
input[type=tel], input[type=email], input[type=date] { min-height: 36px; }

/* home: the buying journey */
.in-stato { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.in-stato > div { display: flex; flex-direction: column; gap: 2px; }
.in-stato b { font-size: 20px; font-weight: 750; letter-spacing: -0.02em; }
.passi { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.passo { display: grid; grid-template-columns: 44px 1fr auto; gap: 16px; align-items: center; }
.passo-n { width: 40px; height: 40px; border-radius: 999px; display: grid; place-items: center; font-weight: 750; font-size: 17px;
  border: 2px solid var(--brand); color: var(--brand); }
.passo.is-done .passo-n { background: var(--brand); color: var(--brand-ink); }
.passo h2 { margin: 0 0 2px; font-size: 18px; }
.passo p { margin: 0; color: var(--ink-2); max-width: 70ch; }
.passo .sub { margin-top: 4px; color: var(--ok); font-weight: 600; }
@media (max-width: 640px) { .passo { grid-template-columns: 36px 1fr; } .passo .btn { grid-column: 2; justify-self: start; } .passo-n { width: 34px; height: 34px; } }
.glossario dl, .legenda dl { margin: 0; display: grid; gap: 10px; }
.glossario dl { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px 24px; }
.glossario dt { font-weight: 700; }
.glossario dd, .legenda dd { margin: 2px 0 0; color: var(--ink-2); }
.legenda { border: 1px solid var(--line); border-radius: 6px; padding: 10px 14px; margin-bottom: 12px; background: var(--surface-2); }
.legenda summary { cursor: pointer; font-weight: 650; min-height: 28px; display: flex; align-items: center; }
.legenda dl > div { display: grid; grid-template-columns: 130px 1fr; gap: 10px; align-items: baseline; }
@media (max-width: 640px) { .legenda dl > div { grid-template-columns: 1fr; gap: 2px; } }
.sec-intro { margin: 28px 0 4px; }
.sec-intro h2 { font-size: 24px; margin: 0 0 4px; }
.bar-row { min-height: 32px !important; }
.topbar.tb-2 .topnav { flex-wrap: wrap; overflow: visible; }

/* popups in the portal's style (scan.js: avviso / conferma / chiedi) */
.dlg { border: 1px solid var(--line-2); border-radius: 8px; padding: 0; width: min(440px, calc(100vw - 32px)); background: var(--surface); color: var(--ink);
  box-shadow: 0 24px 60px -20px rgba(0, 0, 0, .45); }
.dlg::backdrop { background: rgba(15, 20, 18, .45); }
.dlg-box { display: flex; flex-direction: column; gap: 12px; padding: 20px; margin: 0; }
.dlg-t { margin: 0; font-size: 18px; }
.dlg-m { margin: 0; color: var(--ink-2); line-height: 1.55; white-space: pre-line; }
.dlg-act { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.dlg-act .btn { min-height: 38px; min-width: 96px; }
.dlg .dlg-danger { background: var(--bad) !important; color: #fff !important; }
@media (prefers-reduced-motion: no-preference) { .dlg[open] { animation: dlg-in 160ms ease-out; } @keyframes dlg-in { from { opacity: 0; transform: translateY(6px); } } }
