/* Domus Radar — design system. Loaded LAST on every page: one source of truth for type, spacing and components.
   Page stylesheets keep only layout specific to their page; sizes, colors and component looks live here. */

:root {
  /* spacing scale */
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 20px; --sp-6: 24px; --sp-8: 32px;
  /* type scale */
  --fs-2xs: 11px; --fs-xs: 12px; --fs-sm: 13px; --fs-md: 14px; --fs-lg: 16px; --fs-xl: 20px; --fs-2xl: 24px;
  --fs-display: clamp(28px, 3.2vw, 40px);
  /* controls */
  --ctl-h: 36px; --ctl-h-sm: 32px; --ctl-h-lg: 40px; --ctl-fs: 13px; --ctl-fs-sm: 12px; --ctl-r: 8px;
  --tag-h: 20px; --chip-h: 24px;
  --r: 12px; --r-lg: 16px;
  --page-w: 1320px;
  --wa: #1fa855;
}

/* ================================================================ base */
html { -webkit-text-size-adjust: 100%; }
body { font: 400 var(--fs-md)/1.5 var(--sans); }
h1, h2, h3, h4 { margin: 0; }
p { margin: 0; }
small, .meta { font-size: var(--fs-xs); color: var(--ink-3); }
.muted { color: var(--ink-3); }
b, strong { font-weight: 600; }
input[type=checkbox], input[type=radio] { accent-color: var(--brand); }
input[type=range] { accent-color: var(--brand); }

/* ================================================================ page frame */
.page, .page.cx { max-width: var(--page-w); gap: var(--sp-5); }
.topbar-inner { max-width: var(--page-w); min-width: 0; }
.topbar-inner > * { min-width: 0; }
.brand, .topbar-user { flex: none; }
.topnav { min-width: 0; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.topnav::-webkit-scrollbar { display: none; }
.topnav a { flex: none; white-space: nowrap; }
@media (max-width: 760px) {
  .topbar-inner { gap: var(--sp-2); padding-left: var(--sp-4); padding-right: var(--sp-4); }
  .topbar-ctx:empty { display: none; }
  .topnav { flex: 1 1 auto; }
  .topbar-user .avatar { display: none; }
}

/* page header */
.hero, .pr-hero { gap: var(--sp-2); max-width: 860px; }
.hero h1, .pr-hero h1, .m-hero h1 { font: 400 var(--fs-display)/1.1 var(--serif); letter-spacing: -.01em; }
.lede, .pr-hero .lede { font-size: 15px; line-height: 1.55; color: var(--ink-2); max-width: 78ch; }
.eyebrow { font-size: var(--fs-xs); font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }

/* section titles (between cards) */
.ab-sec-head h2, .pr-faq h2, .pr-custom-copy h2, .pr-sec-title, .pr-aud > header h2 { font: 400 var(--fs-2xl)/1.2 var(--serif); letter-spacing: -.005em; }

/* ================================================================ cards */
.card { padding: var(--sp-5); gap: var(--sp-4); border-radius: var(--r); }
.card-table { padding: 0; gap: 0; }
.card-head { gap: var(--sp-3) var(--sp-4); align-items: flex-start; }
.card-head h2 { font: 600 var(--fs-lg)/1.3 var(--sans); }
.card-head p { margin-top: 2px; font-size: var(--fs-sm); line-height: 1.5; max-width: 72ch; }
.card h3, .wl-main h3, .cx-ai h3, .vd-sec h3, .sc-sec h3, .ar-inbox h3, .cx-msg h3 { font: 600 var(--fs-md)/1.35 var(--sans); }
/* numbered step: badge inline with the title, description aligned under the title */
.card-head > div:has(> .ct-step) { display: grid; grid-template-columns: 24px minmax(0, 1fr); column-gap: 10px; align-items: center; }
.card-head > div:has(> .ct-step) > :not(.ct-step) { grid-column: 2; }
.ct-step { width: 24px; height: 24px; margin: 0; font-size: var(--fs-xs); font-weight: 600; line-height: 1; }
@media (max-width: 640px) { .card { padding: var(--sp-4); } .card-table > .card-head { padding: var(--sp-4) var(--sp-4) var(--sp-3); } }

/* KPI tiles: one look for every page */
.kpi, .pipe { padding: var(--sp-4) 18px; border-radius: var(--r); gap: 2px; min-height: 92px; justify-content: flex-start; }
.kpi-value, .pipe-n { font: 400 28px/1.15 var(--serif); font-variant-numeric: tabular-nums; }
.kpi-label, .pipe-l { font-size: var(--fs-xs); font-weight: 500; color: var(--ink-3); line-height: 1.35; }
.kpi-sub { font-size: var(--fs-xs); color: var(--ink-3); }
.kpi-label { order: 0; }

/* ================================================================ buttons */
.btn { height: var(--ctl-h); padding: 0 14px; font: 500 var(--ctl-fs)/1 var(--sans); border-radius: var(--ctl-r); gap: 6px; transition: background-color .12s, border-color .12s, filter .12s; }
.btn[disabled], .btn[aria-disabled=true] { opacity: .45; cursor: default; filter: none; }
.btn-primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--line-2); }
.btn-ghost { background: transparent; color: var(--ink-2); border-color: transparent; }
.btn-wa { background: var(--wa); color: #fff; border-color: var(--wa); }
.btn-danger, .btn.ct-danger { background: var(--surface); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 45%, var(--line-2)); }
.btn-danger:hover, .btn.ct-danger:hover { background: var(--bad-soft); }
/* small: inside rows, toolbars of lists, pagers */
.btn-sm, .ct-row .btn, .pager .btn, .vd-row .btn, .ar-assign .btn, .cx-rec .btn, .giro-skip .btn, .giro-when .btn, .nm-copy .btn {
  height: var(--ctl-h-sm) !important; padding: 0 12px; font-size: var(--ctl-fs-sm) !important; }
/* large: main call to action of a card */
.btn-lg, .btn-block, .plan .btn, .auth-form .btn { height: var(--ctl-h-lg) !important; font-size: var(--fs-md) !important; }
.ct-head-actions .btn { height: var(--ctl-h) !important; font-size: var(--ctl-fs) !important; }

/* ================================================================ form controls */
.select, textarea,
input[type=text], input[type=password], input[type=search], input[type=number], input[type=tel], input[type=email],
input[type=date], input[type=time], input[type=datetime-local], input:not([type]) {
  height: var(--ctl-h); border: 1px solid var(--line-2); border-radius: var(--ctl-r); background: var(--surface); color: var(--ink);
  padding: 0 10px; font: 400 var(--ctl-fs) var(--sans); min-width: 0; }
textarea { height: auto; padding: 8px 10px; line-height: 1.5; resize: vertical; width: 100%; font-size: var(--ctl-fs) !important; border-radius: var(--ctl-r) !important; }
.select:focus, textarea:focus, input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.ct-row .select, .ct-move, .vd-modrow input, .ar-assign .select { height: var(--ctl-h-sm) !important; font-size: var(--ctl-fs-sm) !important; }
.field { gap: 6px; }
.field label, .pr-field label, .pr-label, .ct-use-detail label, .auth-form label { font-size: var(--fs-xs); font-weight: 500; color: var(--ink-2); letter-spacing: 0; }
.toggle { height: var(--ctl-h); font-size: var(--ctl-fs); border-radius: var(--ctl-r); }

/* ================================================================ chips, states, tags */
/* chip = status with dot (24px). tag = small label (20px). */
.chip, .ab-state, .ct-state.ct-tag {
  height: var(--chip-h); padding: 0 10px; border-radius: 999px; font-size: var(--fs-xs); font-weight: 500; line-height: 1;
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.vd-mod, .ct-chan, .flag, .pr-save, .delta {
  display: inline-flex; align-items: center; height: var(--tag-h); padding: 0 8px; border-radius: 999px;
  font-size: var(--fs-2xs); font-weight: 500; line-height: 1; white-space: nowrap; margin: 0; }
.ct-chan { margin-top: 0; }
.ct-chan.is-wa { background: color-mix(in srgb, var(--wa) 16%, transparent); color: var(--wa); }
.m-badge { min-width: 20px; height: 18px; padding: 0 6px; font-size: var(--fs-2xs); font-weight: 600; }

/* ================================================================ tabs: one line, never wrap, scroll sideways when narrow */
.ct-tabs, .mov-tabs, .ar-tabs, .ct-addtabs { display: flex; flex-wrap: nowrap; gap: 6px; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.ct-tabs::-webkit-scrollbar, .mov-tabs::-webkit-scrollbar, .ar-tabs::-webkit-scrollbar, .ct-addtabs::-webkit-scrollbar { display: none; }
.mov-tab { flex: none; height: var(--ctl-h-sm) !important; padding: 0 6px 0 12px; font: 500 var(--ctl-fs) var(--sans) !important; white-space: nowrap; }
.mov-tab:not(:has(.m-badge)) { padding: 0 12px; }
.mov-tab:hover:not([aria-selected=true]) { background: var(--surface-2); color: var(--ink); }
.ct-tabs { padding: 0 var(--sp-5) var(--sp-2); }
.ct-tabhelp { margin: 0; padding: 0 var(--sp-5) var(--sp-3); font-size: var(--fs-sm); color: var(--ink-3); min-height: calc(var(--fs-sm) * 1.5 * 2 + var(--sp-3)); }
@media (max-width: 640px) { .ct-tabs { padding: 0 var(--sp-4) var(--sp-2); } .ct-tabhelp { padding: 0 var(--sp-4) var(--sp-3); } }

/* ================================================================ lists & rows */
.toolbar { gap: var(--sp-3); padding: 0 var(--sp-5) var(--sp-4); }
@media (max-width: 640px) { .toolbar { padding: 0 var(--sp-4) var(--sp-4); } }
/* contact rows: fixed column widths so every row lines up with the others */
.ct-row { grid-template-columns: 28px minmax(0, 1.15fr) 190px minmax(0, 1.35fr) 330px; gap: var(--sp-4); padding: var(--sp-3) var(--sp-5); min-height: 68px; }
.ct-row > :nth-child(5) { justify-content: flex-end; }
.ct-actions { flex-wrap: wrap; gap: 6px; }
.ct-state-wrap, .ct-row > :nth-child(4) { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-width: 0; }
@media (max-width: 1180px) { .ct-row { grid-template-columns: 28px minmax(0, 1fr) 170px minmax(0, 1.2fr) 300px; } }
@media (max-width: 1000px) {
  .ct-row { grid-template-columns: 24px minmax(0, 1fr); grid-template-areas: "c n" ". t" ". s" ". a"; gap: 6px 10px; padding: var(--sp-3) var(--sp-4); }
  .ct-row > :nth-child(5) { justify-content: flex-start; }
}
.ct-empty, .vd-empty, .mov-none, .sc-empty { padding: var(--sp-8) var(--sp-5); text-align: center; color: var(--ink-3); font-size: var(--fs-sm); }

/* ================================================================ card grids that must line up (plans, modules) */
/* subgrid: every card of a row shares the same row tracks, so titles, prices, badges, lists and buttons align */
.pr-grid { grid-auto-rows: auto; row-gap: var(--sp-4); }
.pr-grid > .plan { display: grid; grid-template-rows: subgrid; grid-row: span 6; gap: 0; align-content: start; }
.pr-grid > .plan > * { margin: 0; }
.pr-grid > .plan > :nth-child(n) { align-self: start; }
.pr-grid > .plan > div:first-child { grid-row: 1; padding-bottom: var(--sp-3); }
.pr-grid > .plan > .plan-price { grid-row: 2; padding-bottom: 2px; }
.pr-grid > .plan > .plan-sub { grid-row: 3; padding-bottom: var(--sp-3); }
.pr-grid > .plan > .plan-key { grid-row: 4; margin-bottom: var(--sp-4); }
.pr-grid > .plan > .pr-check { grid-row: 5; padding-bottom: var(--sp-4); }
.pr-grid > .plan > .btn { grid-row: 6; align-self: end; }
/* subscription page module cards: name / state / price / features / action */
.pr-grid > .plan.ab-mod { grid-row: span 5; }
.pr-grid > .ab-mod > .ab-state { grid-row: 2; margin-bottom: var(--sp-3); }
.pr-grid > .ab-mod > .plan-sub { grid-row: 3; }
.pr-grid > .ab-mod > .pr-check { grid-row: 4; }
.pr-grid > .ab-mod > .btn { grid-row: 5; }
.plan-name { font: 600 17px/1.3 var(--sans); letter-spacing: -.005em; }
.plan-for { font-size: var(--fs-sm); line-height: 1.45; }
.plan-sub { font-size: var(--fs-xs); line-height: 1.5; }
.pr-check { font-size: var(--fs-sm); gap: 8px; }

/* ================================================================ page-specific consistency fixes */
.cx-grid { align-items: start; }
.cx-msgs { align-items: stretch; }
.cx-msg { gap: var(--sp-3); }
.cx-msg > .cx-rec { margin-top: auto; }
.ab-plan-name { font: 400 28px/1.15 var(--serif); }
.giro-name { font: 400 26px/1.15 var(--serif); }
.sc-head h2 { font: 400 var(--fs-2xl)/1.2 var(--serif); }
.vd-table td, .vd-table th { padding: 10px 14px; }
.lk-note { border-radius: var(--r); }

/* ================================================================ mobile app (m.*): top bar on two rows, sections bar follows its real height */
.m-top { flex-wrap: wrap; row-gap: 6px; }
.m-top .m-comune { margin-left: auto; max-width: 52vw; }
.m-top .m-piani { order: 10; flex: 1 1 0; height: var(--ctl-h-sm); padding: 0 6px; font-size: var(--ctl-fs); background: var(--surface-2); }
.m-tabs { top: var(--m-top-h, 53px); }
/* long-label buttons may wrap instead of overflowing */
.ar-regen { white-space: normal; height: auto !important; min-height: var(--ctl-h-sm); padding: 6px 8px; text-align: left; line-height: 1.35; }
.ct-actions > .btn { min-width: 124px; }
.ct-actions > .select { width: 150px; max-width: 150px; }
/* tab rows: soft fade on the right edge hints that the row scrolls */
.ct-tabs, .mov-tabs { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent); padding-right: 28px; }
.pr-grid > .plan > .ab-state, .pr-grid > .plan > .chip { justify-self: start; }

/* ================================================================ comuni page */
.cm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: var(--sp-4); }
.cm-slot { gap: var(--sp-3); }
.cm-slot.is-empty { border-style: dashed; background: var(--surface-2); }
.cm-head { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-2); min-height: var(--chip-h); }
.cm-name h2 { font: 400 var(--fs-2xl)/1.2 var(--serif); }
.cm-name p { font-size: var(--fs-sm); margin-top: 2px; }
.cm-dl { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-2) var(--sp-4); margin: 0; }
.cm-dl dt { font-size: var(--fs-xs); color: var(--ink-3); }
.cm-dl dd { margin: 2px 0 0; font-size: var(--fs-sm); font-weight: 500; }
.cm-foot { display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap; margin-top: auto; padding-top: var(--sp-2); border-top: 1px solid var(--line); }
.cm-search { display: flex; flex-direction: column; gap: var(--sp-2); position: relative; }
.cm-search input { width: 100%; }
.cm-search .btn-ghost { align-self: flex-start; }
.cm-res { list-style: none; margin: 0; padding: 4px; border: 1px solid var(--line-2); border-radius: var(--ctl-r); background: var(--surface); max-height: 280px; overflow-y: auto; box-shadow: var(--shadow); }
.cm-res button { appearance: none; width: 100%; display: flex; justify-content: space-between; align-items: baseline; gap: var(--sp-3); border: 0; background: none; color: var(--ink); text-align: left; padding: 8px 10px; border-radius: 6px; font: var(--fs-sm) var(--sans); cursor: pointer; }
.cm-res button:hover, .cm-res button:focus-visible { background: var(--brand-soft); }
.cm-res button span { color: var(--ink-3); font-size: var(--fs-xs); white-space: nowrap; }
.cm-none { padding: 8px 10px; color: var(--ink-3); font-size: var(--fs-sm); }
.cm-msg { margin: 0; padding: 10px 14px; border-radius: 10px; background: var(--ok-soft); color: var(--ok); font-size: var(--fs-sm); }
.cm-msg.is-err { background: var(--bad-soft); color: var(--bad); }
.cm-note { font-size: var(--fs-sm); }
.chip.is-wait::before { background: var(--warn); }
.cm-dlg { border: 1px solid var(--line-2); border-radius: var(--r-lg); background: var(--surface); color: var(--ink); padding: var(--sp-6); max-width: 480px; width: calc(100% - 32px); box-shadow: 0 24px 64px rgba(0,0,0,.35); }
.cm-dlg::backdrop { background: rgba(10, 16, 13, .55); }
.cm-dlg h2 { font: 600 var(--fs-xl)/1.3 var(--sans); margin-bottom: var(--sp-2); }
.cm-dlg p { font-size: var(--fs-md); color: var(--ink-2); line-height: 1.55; }
.cm-dlg-actions { display: flex; justify-content: flex-end; gap: var(--sp-2); margin-top: var(--sp-5); flex-wrap: wrap; }

/* comune tags on contacts + comune picker in import */
.ct-com { display: inline-flex; align-items: center; height: var(--tag-h); padding: 0 8px; border-radius: 999px; font-size: var(--fs-2xs); font-weight: 500; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2); white-space: nowrap; }
.ct-coms { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.ct-pickcom { border: 1px solid var(--line); border-radius: var(--r); padding: var(--sp-3) 14px; margin: 0; display: flex; flex-wrap: wrap; gap: 6px 14px; }
.ct-pickcom legend { font-size: var(--fs-sm); font-weight: 600; padding: 0 4px; }
.ct-pickcom label { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-sm); color: var(--ink-2); cursor: pointer; }
.ct-pickcom .meta { flex-basis: 100%; }

/* ================================================================ plan scans strip (market page) */
.scan-strip { display: flex; flex-wrap: wrap; gap: 0; margin: 0; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); box-shadow: var(--shadow); }
.scan-strip > div { flex: 1 1 150px; padding: 10px 16px; border-left: 1px solid var(--line); min-width: 0; }
.scan-strip > div:first-child { border-left: 0; }
.scan-strip dt { font-size: var(--fs-xs); color: var(--ink-3); font-weight: 500; }
.scan-strip dd { margin: 2px 0 0; font-size: var(--fs-md); font-weight: 600; font-variant-numeric: tabular-nums; }
.scan-strip dd .meta { font-weight: 400; }
.scan-strip .scan-more a { color: var(--accent); }
@media (max-width: 640px) { .scan-strip > div { flex: 1 1 45%; border-left: 0; border-top: 1px solid var(--line); padding: 8px 12px; } .scan-strip > div:nth-child(-n+2) { border-top: 0; } }
.cm-head { flex-wrap: wrap; }
.cm-head .eyebrow { white-space: nowrap; }
/* mobile app: page links on their own row, scrolling sideways */
.m-links { order: 10; flex: 1 0 100%; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.m-links::-webkit-scrollbar { display: none; }
.m-links .m-piani { flex: 1 0 auto; order: 0; padding: 0 12px; }

/* link to the phone layout of the market page: only on narrow screens */
.topnav a.nav-m { display: none; }
@media (max-width: 760px) { .topnav a.nav-m { display: inline-block; color: var(--accent); } }

/* comuni: pause, token wallet, one more comune */
.chip.is-pause::before { background: var(--ink-3); }
.cm-actions { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }
.cm-actions .btn[disabled] { opacity: .5; cursor: not-allowed; }
.cm-slot .cm-foot { margin-top: 0; }
.cm-wallet { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: var(--sp-5); align-items: start; }
.cm-wallet h2 { font: 400 var(--fs-2xl)/1.2 var(--serif); margin: 2px 0 var(--sp-2); }
.cm-token { display: inline-grid; place-items: center; min-width: 1.6em; height: 1.6em; padding: 0 .3em; border-radius: 999px; background: var(--brand); color: var(--brand-ink); font: 600 .9em/1 var(--sans); vertical-align: .05em; }
.cm-wallet p { font-size: var(--fs-sm); line-height: 1.55; max-width: 64ch; }
.cm-wallet-mov { list-style: none; margin: 0; padding: 0; font-size: var(--fs-sm); }
.cm-wallet-mov li { display: flex; justify-content: space-between; gap: var(--sp-3); padding: 6px 0; border-top: 1px solid var(--line); }
.cm-wallet-mov li:first-child { border-top: 0; }
.cm-extra { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: var(--sp-5); align-items: start; }
.cm-extra h2 { font: 400 var(--fs-2xl)/1.2 var(--serif); margin: 2px 0 var(--sp-2); }
.cm-extra p { font-size: var(--fs-sm); line-height: 1.55; }
.cm-extra-box { display: flex; flex-direction: column; gap: var(--sp-3); background: var(--surface-2); border-radius: var(--ctl-r); padding: var(--sp-4); }
.cm-extra-dl { margin: 0; display: flex; flex-direction: column; gap: 6px; font-size: var(--fs-sm); }
.cm-extra-dl div { display: flex; justify-content: space-between; gap: var(--sp-3); }
.cm-extra-dl dt { color: var(--ink-3); } .cm-extra-dl dd { margin: 0; font-weight: 500; text-align: right; }
.cm-extra-dl .is-tot { border-top: 1px solid var(--line); padding-top: 6px; font-size: var(--fs-md); }
.cm-extra-dl .is-tot dd { font-weight: 600; color: var(--ink); }
.cm-extra-wait { margin: 0; }
@media (max-width: 760px) { .cm-wallet, .cm-extra { grid-template-columns: 1fr; } }
.cm-wallet-exp { margin-top: var(--sp-2); }
.cm-packs { grid-column: 1 / -1; border-top: 1px solid var(--line); padding-top: var(--sp-4); display: flex; flex-direction: column; gap: var(--sp-3); }
.cm-packs-head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--sp-3); flex-wrap: wrap; }
.cm-packs-head h3 { font: 600 var(--fs-md)/1.3 var(--sans); }
.cm-packs-head p { margin: 0; }
.cm-pack-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-3); }
.cm-pack { position: relative; display: flex; flex-direction: column; gap: 4px; border: 1px solid var(--line-2); border-radius: var(--ctl-r); padding: var(--sp-3) var(--sp-4); background: var(--surface); }
.cm-pack.is-hl { border: 2px solid var(--brand); }
.cm-pack-tag { position: absolute; top: -10px; left: 12px; background: var(--brand); color: var(--brand-ink); font: 600 10px/1 var(--sans); letter-spacing: .06em; text-transform: uppercase; padding: 4px 8px; border-radius: 999px; }
.cm-pack-n { font: 400 var(--fs-2xl)/1.1 var(--serif); }
.cm-pack-n small { font: 500 var(--fs-sm) var(--sans); color: var(--ink-3); }
.cm-pack-p { font-weight: 600; font-size: var(--fs-md); }
.cm-pack .btn { align-self: flex-start; margin-top: 6px; }
@media (max-width: 760px) { .cm-pack-grid { grid-template-columns: 1fr; } }
.ui-dlg-body p + p { margin-top: var(--sp-2); }

/* ================= phone version (body.vm): same content, less space ================= */
.vm .topbar-inner { flex-wrap: wrap; row-gap: 6px; padding: 8px 12px; }
.vm .topbar-ctx:empty { display: none; }
.vm .topnav { order: 3; flex: 1 0 100%; gap: 6px; padding-bottom: 2px; }
.vm .topnav a { background: var(--surface-2); border-radius: 999px; padding: 6px 12px; font-size: 13px; }
.vm .topnav a[aria-current=page] { background: var(--brand); color: var(--brand-ink); }
.vm .topbar-user { margin-left: auto; }
.vm .topbar-user .avatar { display: none; }
.vm .page { padding: 14px 12px 32px; gap: 12px; }
.vm .hero { gap: 4px; padding: 0; }
.vm .hero h1 { font-size: 26px; }
.vm .lede { font-size: 14px; }
.vm .card { padding: 14px; gap: 12px; border-radius: 12px; }
.vm .card-table > .card-head { padding: 14px 14px 10px; }
.vm .card-head h2 { font-size: 15px; }
.vm .card-head p { font-size: 13px; }
.vm .lk-banner { margin: 8px 12px 0; padding: 10px 12px; font-size: 13px; }
/* clamped descriptions */
.vm .vm-clamp { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.vm .hero .vm-clamp { -webkit-line-clamp: 3; }
.vm .vm-more { appearance: none; border: 0; background: none; padding: 0; margin: 2px 0 0; color: var(--brand); font: 600 12px var(--sans); cursor: pointer; text-align: left; }
.vm .card-head .vm-more { grid-column: 2; }
/* foldable cards */
.vm .vm-fold > .card-head { cursor: pointer; position: relative; padding-right: 26px; -webkit-tap-highlight-color: transparent; }
.vm .vm-chev { position: absolute; right: 2px; top: 4px; width: 18px; height: 18px; border-radius: 50%; background: var(--surface-2); }
.vm .vm-chev::after { content: ""; position: absolute; left: 6px; top: 5px; width: 5px; height: 5px; border-right: 2px solid var(--ink-2); border-bottom: 2px solid var(--ink-2); transform: rotate(45deg); transition: transform .15s; }
.vm .vm-fold:not(.vm-chiusa) .vm-chev::after { transform: rotate(-135deg); top: 7px; }
.vm .vm-chiusa > :not(.card-head) { display: none !important; }
.vm .vm-chiusa { gap: 0; }
.vm .vm-chiusa .card-head p:not(.ct-step), .vm .vm-chiusa .card-head .vm-more { display: none; }
/* contatti: list counters as a compact strip */
.vm .ct-pipe { display: flex; overflow-x: auto; gap: 8px; scrollbar-width: none; margin: 0 -12px; padding: 0 12px 2px; }
.vm .ct-pipe::-webkit-scrollbar { display: none; }
.vm .ct-pipe > .pipe { flex: 0 0 auto; min-width: 112px; padding: 8px 12px; }
.vm .ct-pipe .pipe-n { font-size: 20px; }
.vm .ct-pipe .pipe-l { font-size: 11px; }
.vm .ct-sender { padding: 10px 12px; font-size: 13px; gap: 8px; }
.vm .ct-steps { gap: 12px; }
/* kpi tiles and scan strip a bit tighter */
.vm .kpis { gap: 8px; }
.vm .kpi { padding: 10px 12px; }
.vm .cm-grid { gap: 12px; }
.vm .cm-wallet, .vm .cm-extra { gap: 12px; }
@media (min-width: 761px) { .vm .page { max-width: 640px; } }

/* login: phone / computer choice */
.auth-ui { border: 0; padding: 0; margin: 4px 0 6px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.auth-ui legend { font-size: 12px; font-weight: 500; color: var(--ink-2); margin-bottom: 6px; padding: 0; }
.auth-ui-opt { position: relative; margin: 0 !important; }
.auth-ui-opt input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.auth-ui-opt span { display: flex; align-items: center; justify-content: center; gap: 8px; height: 44px; border: 1px solid var(--line-2); border-radius: var(--ctl-r); background: var(--surface); color: var(--ink-2); font: 500 14px var(--sans); }
.auth-ui-opt svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.auth-ui-opt input:checked + span { border: 2px solid var(--brand); background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.auth-ui-opt input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
/* contatti lists on the phone: same data, about half the height per contact */
.vm .ct-head-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; width: 100%; }
.vm .ct-head-actions .btn { width: 100%; justify-content: center; padding: 0 8px; font-size: 12px; }
.vm .ct-head-actions .btn:first-child { grid-column: 1 / -1; }
.vm .ct-toolbar { gap: 8px; }
.vm .vm-filtri { width: 100%; }
.vm .vm-filtri > summary { cursor: pointer; font: 600 13px var(--sans); color: var(--brand); padding: 4px 0; list-style: none; }
.vm .vm-filtri > summary::-webkit-details-marker { display: none; }
.vm .vm-filtri > summary::before { content: "+ "; }
.vm .vm-filtri[open] > summary::before { content: "− "; }
.vm .vm-filtri-body { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding-top: 6px; align-items: end; }
.vm .vm-filtri-body .field, .vm .vm-filtri-body .select { min-width: 0; width: 100%; }
.vm .vm-filtri-body > * { min-width: 0; }
.vm .ct-row { grid-template-columns: 22px minmax(0, 1fr); grid-template-areas: "c n" ". t" ". s" ". a"; gap: 3px 8px; padding: 10px 12px; min-height: 0; font-size: 13px; }
.vm .ct-row > :nth-child(3), .vm .ct-row > :nth-child(4) { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.vm .ct-row > :nth-child(5) { flex-wrap: nowrap; gap: 6px; margin-top: 4px; }
.vm .ct-row > :nth-child(5) .btn { height: 30px; padding: 0 12px; font-size: 12px; }
.vm .ct-row > :nth-child(5) select { height: 30px !important; font-size: 12px !important; min-width: 0; flex: 1; }
.vm .ct-row .muted, .vm .ct-row .meta { font-size: 11.5px; }

/* ================================================================ review 2026-12-01 */
/* comune selector in the top bar: never truncated */
.topbar-ctx #comune, .topbar-ctx #dm-comune { min-width: 160px; max-width: 260px; text-overflow: ellipsis; }
/* sideways scrollers on the phone: a soft fade on the right edge says "there is more" */
.m-links, .vm .ct-pipe, .vm .topnav { -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent); mask-image: linear-gradient(90deg, #000 85%, transparent); padding-right: 24px; }

/* topbar: when brand + comune + nav + user don't fit on one line, the nav moves to its own row
   (before, the comune box shrank and "Mercato" overlapped the freshness chip) */
@media (min-width: 761px) {
  .topbar-inner { flex-wrap: wrap; row-gap: 6px; }
  .topbar-ctx { flex: 1 1 auto; }
  .topbar-inner > .topnav { order: 3; flex: 1 0 100%; margin: 0 -10px; }
}
.topbar-user .dt-btn { width: 36px; height: 36px; min-width: 36px; }

/* accessibility: form controls need a boundary with at least 3:1 contrast (WCAG 1.4.11) */
:root { --ctl-line: #7D8882; }
:root[data-theme="dark"] { --ctl-line: #66736C; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --ctl-line: #66736C; } }
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); }
.select-quiet { border-color: var(--ctl-line); }
/* accessibility fixes from the light/dark audit */
.btn-wa { background: #137A3E; color: #fff; }                       /* white on WhatsApp green was 3.1:1 */
.ct-chan.is-wa { color: #137A3E; }
:root[data-theme="dark"] .ct-chan.is-wa { color: #4CC27F; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .ct-chan.is-wa { color: #4CC27F; } }
.ct-reply { color: #1769B0; }
:root[data-theme="dark"] .ct-reply { color: #53bdeb; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .ct-reply { color: #53bdeb; } }
.pr-chip, .mov-tab { border-color: var(--ctl-line); }
.pr-faq summary, .ct-setup summary, .ar-more summary, .cx-log summary { min-height: 32px; display: flex; align-items: center; }

/* top menu: segmented selector on its own row (all desktop widths), clear active state */
.topbar-inner > .topnav { flex: 0 1 auto; width: max-content; max-width: 100%; margin: 0; display: flex; gap: 4px; padding: 4px;
  background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 12px; }
.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; 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:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
@media (min-width: 761px) {
  .topbar-inner > .topnav { order: 3; }
  .topbar-inner::after { content: ""; order: 2; flex-basis: 100%; height: 0; }   /* forces the menu onto its own row */
  .topbar-user { margin-left: auto; }
}
.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); }
/* phone header: logo, comune, theme and Esci on one line */
@media (max-width: 480px) {
  .vm .brand-name { display: none; }
  .vm .topbar-ctx select, .vm .topbar-ctx .select { max-width: 150px; }
  .vm .topbar-user { gap: 6px; }
  .vm .topbar-user form .btn { padding: 0 10px; }
}
/* phone Mercato page (mobile.html): same header pattern as the other pages */
.m-top { flex-wrap: wrap; row-gap: 8px; }
.m-top .dt-btn { margin-left: auto; width: 36px; height: 36px; min-width: 36px; }
.m-top .m-out .btn { min-height: 36px; padding: 0 10px; border: 1px solid var(--ctl-line); color: var(--ink); }
.m-top .m-links { order: 3; flex: 1 0 100%; display: flex; gap: 4px; padding: 4px; background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 12px; overflow-x: auto; }
.m-top .m-links a { flex: none; min-height: 36px; border-radius: 9px; padding: 0 12px; color: var(--ink-2); background: none; }
.m-top .m-links a[aria-current=page] { background: var(--brand); color: var(--brand-ink); font-weight: 600; }
@media (max-width: 420px) { .m-brand { display: none; } .m-comune { max-width: 170px; } }

/* top bar, compact: one row (brand · comune · menu · user) when it fits, menu on a second row on narrower screens */
.topbar-inner { flex-wrap: nowrap; gap: 12px; padding-top: 8px; padding-bottom: 8px; }
.topbar-inner::after { content: none !important; }
.topbar-ctx { flex: 0 0 auto; }
.topbar-inner > .topnav { order: 0; flex: 0 1 auto; min-width: 0; padding: 3px; gap: 2px; margin: 0 auto 0 4px; }
.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; }
@media (min-width: 761px) and (max-width: 1440px) {
  .topbar-inner { flex-wrap: wrap; row-gap: 8px; }
  .topbar-inner::after { content: "" !important; order: 2; flex-basis: 100%; height: 0; }
  .topbar-inner > .topnav { order: 3; margin: 0; }
  .topbar-user { margin-left: auto; }
}
.vm .topbar-inner::after { content: none !important; }
/* Mercato: comune and data date live in the page header, not in the top bar */
.hero-ctx { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 4px; }
.hero-pick { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); font-weight: 600; }
.hero-pick .select { width: auto; min-width: 180px; height: 34px; font-weight: 600; color: var(--ink); }
.hero-ctx .eyebrow { margin: 0; }
/* audit: targets at least 24px */
.vm .vm-more { min-height: 28px; padding: 4px 0; }
input[type=range] { min-height: 24px; }
.topbar-ctx:empty { display: none; }
