/* crm.css — CRM Magikenergy. Token presi dal sito magikenergy.it (struttura §8). Si parte dal telefono.
   Tre misure: telefono (< 768 px) · tablet (768–1023 px) · computer (≥ 1024 px: elenco a tutta pagina e tutta altezza). */
@font-face { font-family: "Sora"; src: url("/font/sora-var.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Manrope"; src: url("/font/manrope-var.woff2") format("woff2"); font-weight: 200 800; font-display: swap; }

:root {
  --forest-200: #A7C9B0; --forest-700: #0F3320; --forest-800: #0B2818; --forest-900: #071B10; --forest-950: #04120A;
  --leaf-50: #EEF7E9; --leaf-300: #90CC6C; --leaf-600: #3E8531; --leaf-700: #316827;
  --sun-50: #FDF1E7; --sun-100: #FBDDC4; --sun-400: #EE8138; --sun-500: #E9711E; --sun-600: #CE5C12; --sun-700: #A9470F;
  --cream-50: #FDFCF9; --cream-100: #F7F4EC; --cream-200: #EFEADD; --white: #FFFFFF; --red-600: #B3261E;

  --c-bg: var(--cream-50); --c-bg-alt: var(--cream-100); --c-surface: var(--white);
  --c-text: var(--forest-800); --c-text-soft: rgba(11, 40, 24, .68); --c-brand: var(--forest-700);
  --c-accent: var(--sun-500); --c-accent-hover: var(--sun-600); --c-accent-soft: var(--sun-50);
  --c-positive: var(--leaf-600); --c-positive-soft: var(--leaf-50);
  --c-border: var(--forest-200); --c-border-soft: rgba(15, 51, 32, .12); --c-focus: var(--sun-400); --c-error: var(--red-600);
  --c-row-recent: #FFF8F1; --c-ring: 0 0 0 3px rgba(238, 129, 56, .35);

  --font-heading: "Sora", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-body: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  --r-xs: .5rem; --r-sm: .75rem; --r-md: 1rem; --r-lg: 1.5rem; --r-pill: 9999px;
  --sh-sm: 0 1px 2px 0 rgba(0, 0, 0, .05);
  --sh-md: 0 4px 6px -1px rgba(0, 0, 0, .1), 0 2px 4px -2px rgba(0, 0, 0, .1);
  --sh-xl: 0 20px 25px -5px rgba(0, 0, 0, .1), 0 8px 10px -6px rgba(0, 0, 0, .1);
  --sh-sun: 0 10px 30px -8px rgba(233, 113, 30, .6);
  --tap: 48px; --dur: 200ms; --ease: cubic-bezier(.4, 0, .2, 1);
  --top-h: 60px; --bottom-h: 64px; --drawer-w: clamp(400px, 34vw, 540px);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--c-bg); color: var(--c-text); font: 400 1rem/1.5 var(--font-body); min-height: 100vh; }
h1, h2, h3 { font-family: var(--font-heading); letter-spacing: -.02em; line-height: 1.2; margin: 0; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--c-brand); }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--c-focus); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.grow { flex: 1; }
.pad { padding: 1.25rem; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- Pulsanti ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; min-height: var(--tap); padding: .6rem 1.1rem; border-radius: var(--r-pill); border: 1.5px solid transparent; font-weight: 700; font-size: .95rem; cursor: pointer; text-decoration: none; transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease); white-space: nowrap; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-sun { background: var(--c-accent); color: var(--forest-950); box-shadow: var(--sh-sun); }
.btn-sun:hover:not(:disabled) { background: var(--c-accent-hover); }
.btn-forest { background: var(--c-brand); color: var(--white); }
.btn-forest:hover:not(:disabled) { background: var(--forest-900); }
.btn-line { background: var(--c-surface); border-color: var(--c-border); color: var(--c-brand); }
.btn-line:hover:not(:disabled) { border-color: var(--c-brand); background: var(--cream-50); }
.btn-line.is-danger { color: var(--c-error); }
.btn-line.is-danger:hover:not(:disabled) { border-color: var(--c-error); }
.btn-wa { background: #1FA855; color: var(--white); }
.btn-wa:hover:not(:disabled) { background: #178a45; }
.btn-wa.is-off { background: var(--cream-100); color: var(--c-text-soft); border-color: var(--c-border-soft); }
.btn-danger { background: var(--red-600); color: var(--white); }
.btn-sm { min-height: 40px; padding: .35rem .85rem; font-size: .875rem; }
.btn-block { width: 100%; }
.link { display: inline-flex; align-items: center; gap: .25rem; background: none; border: 0; padding: 0; color: var(--c-brand); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; font-weight: 700; min-height: 32px; }
.icon { width: 1.25em; height: 1.25em; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.close { width: 44px; height: 44px; border: 0; border-radius: 50%; background: var(--c-bg-alt); cursor: pointer; display: grid; place-items: center; flex: none; color: var(--c-text); }
.close:hover { background: var(--cream-200); }

/* ---------- Campi ---------- */
.field { display: grid; gap: .35rem; min-width: 0; }
.field label, .label { font-weight: 700; font-size: .875rem; }
.input, .select, .textarea { width: 100%; min-height: var(--tap); padding: .65rem .9rem; border: 1.5px solid var(--c-border); border-radius: var(--r-sm); background: var(--c-surface); font-size: 1rem; }
.select { appearance: none; padding-right: 2.4rem; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230F3320' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right .8rem center; background-size: 1.1rem; text-overflow: ellipsis; }
.textarea { min-height: 96px; resize: vertical; line-height: 1.45; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--c-brand); box-shadow: var(--c-ring); }
.error { color: var(--c-error); font-size: .875rem; font-weight: 600; }
.hint { color: var(--c-text-soft); font-size: .8rem; }
.switches { display: grid; gap: .25rem; }
.switch { display: flex; align-items: center; gap: .65rem; min-height: 44px; font-weight: 600; cursor: pointer; }
.switch input { width: 22px; height: 22px; accent-color: var(--c-brand); flex: none; margin: 0; }
.grid2 { display: grid; grid-template-columns: minmax(0, 1fr); gap: .65rem; }
@media (min-width: 420px) { .grid2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---------- Accesso ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem 1rem; background: radial-gradient(120% 60% at 50% 0%, var(--leaf-50), var(--c-bg) 60%); }
.login-card { width: 100%; max-width: 400px; background: var(--c-surface); border-radius: var(--r-lg); box-shadow: var(--sh-xl); padding: 2rem 1.5rem; display: grid; gap: 1.1rem; }
.login-card img { display: block; margin: 0 auto; width: 140px; height: auto; }
.login-card h1 { text-align: center; font-size: 1.5rem; color: var(--c-brand); }
.notice { padding: .75rem 1rem; border-radius: var(--r-sm); background: var(--c-accent-soft); color: var(--sun-700); font-weight: 600; font-size: .9rem; }
.notice.is-error { background: #FBE9E7; color: var(--c-error); }

/* ======================================================================
   TESTATA (telefono: una sola riga verde con logo, ricerca, filtri, menu)
   ====================================================================== */
.appbar { position: sticky; top: 0; z-index: 50; }
.topbar { position: relative; display: flex; align-items: center; gap: .5rem; height: var(--top-h); padding: 0 .75rem; background: var(--forest-800); color: var(--white); }
.brand { display: flex; align-items: center; gap: .6rem; color: var(--white); text-decoration: none; font-family: var(--font-heading); font-weight: 700; flex: none; letter-spacing: -.01em; }
.brand img { width: 40px; height: auto; background: var(--white); border-radius: 10px; padding: 3px; display: block; }
.brand span { display: none; }
.nav { display: none; }
.slot-top { flex: 1; min-width: 0; display: flex; }
.search { position: relative; flex: 1; min-width: 0; display: flex; }
.search > .icon { position: absolute; left: .85rem; top: 50%; transform: translateY(-50%); color: var(--c-text-soft); pointer-events: none; }
.search input { width: 100%; height: 42px; border-radius: var(--r-pill); border: 1.5px solid transparent; padding: 0 2.4rem 0 2.5rem; background: var(--white); font-size: 1rem; }
.search input::-webkit-search-cancel-button { display: none; }
.search input:focus { outline: none; border-color: var(--sun-400); box-shadow: var(--c-ring); }
.search .clear { position: absolute; right: .25rem; top: 50%; transform: translateY(-50%); width: 36px; height: 36px; border: 0; background: none; border-radius: 50%; cursor: pointer; color: var(--c-text-soft); display: grid; place-items: center; }
.search .clear:hover { background: var(--c-bg-alt); }
.kbd { display: none; }
.top-btn { flex: none; width: 44px; height: 44px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .12); color: var(--white); display: grid; place-items: center; cursor: pointer; position: relative; }
.top-btn:hover { background: rgba(255, 255, 255, .22); }
.top-btn .badge { position: absolute; top: 0; right: 0; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 10px; background: var(--sun-500); color: var(--forest-950); font-size: .72rem; font-weight: 800; line-height: 19px; text-align: center; }
.top-right { display: flex; align-items: center; gap: .4rem; flex: none; }
.updated, #btn-refresh, .who-chip { display: none; }
.who-chip { align-items: center; gap: .4rem; height: 40px; max-width: 180px; padding: 0 .85rem 0 .7rem; border-radius: var(--r-pill); border: 1px solid rgba(255, 255, 255, .25); background: transparent; color: var(--white); font-weight: 700; font-size: .875rem; cursor: pointer; }
.who-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who-chip:hover { background: rgba(255, 255, 255, .1); }
.updated { font-size: .78rem; color: rgba(255, 255, 255, .7); white-space: nowrap; margin-right: .25rem; }

.menu { position: absolute; right: .75rem; top: calc(var(--top-h) - 4px); z-index: 60; min-width: 260px; background: var(--c-surface); color: var(--c-text); border-radius: var(--r-md); box-shadow: var(--sh-xl); padding: .5rem; display: grid; }
.menu .who { padding: .6rem .75rem; font-size: .85rem; color: var(--c-text-soft); border-bottom: 1px solid var(--c-border-soft); margin-bottom: .25rem; }
.menu .who strong { color: var(--c-text); display: block; font-size: 1rem; }
.menu button { text-align: left; background: none; border: 0; padding: .7rem .75rem; min-height: var(--tap); border-radius: var(--r-sm); cursor: pointer; font-weight: 600; }
.menu button:hover { background: var(--c-bg-alt); }

.strip, .toolbar { display: none; }

.bottombar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; height: calc(var(--bottom-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); background: var(--c-surface); border-top: 1px solid var(--c-border-soft); display: grid; grid-template-columns: repeat(3, 1fr); }
.bottombar a { display: grid; place-items: center; align-content: center; gap: 2px; text-decoration: none; color: var(--c-text-soft); font-size: .78rem; font-weight: 700; }
.bottombar a[aria-current="page"] { color: var(--c-brand); }
.bottombar a[aria-current="page"] .icon { color: var(--c-accent); }
.bottombar .icon { width: 24px; height: 24px; }

/* ======================================================================
   CONTENUTO (telefono)
   ====================================================================== */
main { display: block; padding: .9rem .75rem calc(var(--bottom-h) + 2rem + env(safe-area-inset-bottom)); }
main:focus { outline: none; }
.page-head, .list-head { display: flex; align-items: center; justify-content: space-between; gap: .6rem; flex-wrap: wrap; margin-bottom: .75rem; }
.page-head h1, .list-head h1 { font-size: 1.4rem; color: var(--c-brand); }
.page-head h2, .list-head h2 { font-size: 1.1rem; color: var(--c-brand); }
.list-head .sort-select { width: auto; min-height: 40px; padding-top: .3rem; padding-bottom: .3rem; font-size: .9rem; font-weight: 600; }
.muted { color: var(--c-text-soft); font-size: .875rem; }
.offline { background: #FFF4D6; color: #6B4E00; padding: .6rem 1rem; border-radius: var(--r-sm); font-weight: 600; font-size: .9rem; margin-bottom: .75rem; }
section.block { margin-top: 1.5rem; }
.empty { text-align: center; padding: 2rem 1rem; color: var(--c-text-soft); background: var(--c-surface); border: 1px dashed var(--c-border); border-radius: var(--r-md); display: grid; gap: .5rem; justify-items: center; }
.more { margin: 1rem 0 0; text-align: center; }
.group-title { margin: 1.5rem 0 .6rem; font-size: 1rem; color: var(--c-text-soft); }

/* Numeri (telefono: griglia compatta) */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: .5rem; }
.kpi { text-align: left; border: 1px solid var(--c-border-soft); background: var(--c-surface); border-radius: var(--r-sm); padding: .6rem .7rem; cursor: pointer; box-shadow: var(--sh-sm); display: flex; flex-direction: column; gap: .1rem; min-height: 72px; }
.kpi .n { font-family: var(--font-heading); font-size: 1.45rem; font-weight: 700; line-height: 1.1; color: var(--c-brand); }
.kpi .l { font-weight: 700; font-size: .8rem; line-height: 1.25; }
.kpi .s { font-size: .7rem; color: var(--c-text-soft); line-height: 1.25; }
.kpi.is-hot { background: var(--c-accent-soft); border-color: var(--sun-100); }
/* «Lead da contattare» per primo e su tutta la riga: è il numero su cui si lavora */
.kpi.kpi-tc { grid-column: 1 / -1; order: -1; flex-direction: row; align-items: baseline; flex-wrap: wrap; column-gap: .5rem; min-height: 0; }
.kpi.kpi-tc .n { font-size: 1.6rem; }
.kpi.kpi-tc .l { font-size: .95rem; }
.kpi.kpi-tc .s { flex-basis: 100%; }
.kpi.is-hot .n { color: var(--sun-600); }

/* Da contattare adesso */
.waiting { display: grid; gap: .45rem; }
.waiting button { display: flex; justify-content: space-between; align-items: center; gap: .75rem; width: 100%; text-align: left; background: var(--c-surface); border: 1px solid var(--c-border-soft); border-left: 4px solid var(--c-accent); border-radius: var(--r-sm); padding: .6rem .85rem; cursor: pointer; min-height: 56px; }
.waiting button:hover { background: var(--cream-50); border-color: var(--c-border); border-left-color: var(--c-accent); }
.waiting .w-main { display: grid; min-width: 0; }
.waiting .who { font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.waiting .w-of { font-size: .82rem; color: var(--c-text-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.waiting .when { display: inline-flex; align-items: center; gap: .3rem; font-size: .8rem; color: var(--sun-700); font-weight: 800; white-space: nowrap; }
.waiting .when .icon { width: 1rem; height: 1rem; }

/* Risultati */
details.results { margin-top: 1.5rem; background: var(--c-surface); border: 1px solid var(--c-border-soft); border-radius: var(--r-md); }
details.results > summary { cursor: pointer; padding: 1rem; font-family: var(--font-heading); font-weight: 700; color: var(--c-brand); min-height: var(--tap); list-style: none; display: flex; justify-content: space-between; align-items: center; }
details.results > summary::-webkit-details-marker { display: none; }
details.results > summary::after { content: "+"; font-size: 1.4rem; line-height: 1; }
details.results[open] > summary::after { content: "–"; }
.results-body { padding: 0 1rem 1rem; display: grid; gap: .75rem; }
.results-ctrl { display: flex; flex-wrap: wrap; gap: .5rem 1rem; justify-content: space-between; }
.chips { display: flex; gap: .4rem; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: .35rem; border: 1.5px solid var(--c-border); background: var(--c-surface); border-radius: var(--r-pill); padding: .3rem .8rem; font-weight: 700; font-size: .85rem; cursor: pointer; min-height: 38px; }
.chip[aria-pressed="true"] { background: var(--c-brand); border-color: var(--c-brand); color: var(--white); }
.chips-active { margin-bottom: .75rem; }
.chips-active .chip { background: var(--leaf-50); border-color: var(--forest-700); color: var(--c-brand); }
.chip .x { font-size: 1.1rem; line-height: 1; }
.seg { gap: 0; background: var(--c-bg-alt); border-radius: var(--r-pill); padding: 3px; flex-wrap: nowrap; overflow-x: auto; }
.seg .chip { border: 0; background: none; min-height: 34px; white-space: nowrap; }
.seg .chip[aria-pressed="true"] { background: var(--c-surface); color: var(--c-brand); box-shadow: var(--sh-md); }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.perf { width: 100%; border-collapse: collapse; font-size: .875rem; min-width: 560px; }
table.perf th, table.perf td { padding: .55rem .6rem; text-align: right; border-bottom: 1px solid var(--c-border-soft); font-variant-numeric: tabular-nums; }
table.perf th:first-child, table.perf td:first-child { text-align: left; }
table.perf th { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--c-text-soft); white-space: nowrap; }
table.perf .sort { background: none; border: 0; padding: 0; font: inherit; color: inherit; letter-spacing: inherit; text-transform: inherit; cursor: pointer; display: inline-flex; gap: .25rem; min-height: 32px; align-items: center; }
table.perf .sort.is-on { color: var(--c-brand); }
table.perf .arrow { color: var(--c-accent); }
table.perf td.k { position: relative; font-weight: 700; }
table.perf td.k .k-t { position: relative; z-index: 1; }
table.perf td.k { min-width: 200px; }
table.perf td.k .k-t { display: block; }
table.perf td.k .bar { display: block; height: 4px; margin-top: .3rem; background: var(--leaf-300); border-radius: 2px; }
.avg { display: flex; align-items: center; gap: .3rem; }
.avg .icon { width: 1rem; height: 1rem; }

/* ---------- Schede dei lead (telefono e tablet) ---------- */
.cards { display: grid; grid-template-columns: minmax(0, 1fr); gap: .6rem; }
.lc { position: relative; background: var(--c-surface); border: 1px solid var(--c-border-soft); border-radius: var(--r-md); padding: .8rem .85rem .85rem; box-shadow: var(--sh-sm); display: grid; grid-template-columns: minmax(0, 1fr); gap: .3rem; cursor: pointer; min-width: 0; }
.lc:hover { border-color: var(--c-border); }
.lc.is-recent { background: linear-gradient(180deg, var(--c-row-recent), var(--c-surface) 70%); border-color: var(--sun-100); box-shadow: inset 4px 0 0 var(--c-accent), var(--sh-sm); }
.lc.is-open { border-color: var(--forest-700); box-shadow: inset 4px 0 0 var(--forest-700), var(--sh-md); }
.lc.is-flash { animation: flash 2.4s var(--ease); }
@keyframes flash { 0%, 30% { background: var(--sun-100); } 100% { background: var(--c-surface); } }
.lc .l1 { display: flex; justify-content: space-between; align-items: flex-start; gap: .5rem; }
.lc .nm { font-family: var(--font-body); letter-spacing: 0; font-weight: 800; font-size: 1.08rem; display: flex; align-items: center; gap: .45rem; min-width: 0; }
.lc .nm .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lc .when { display: flex; align-items: center; gap: .3rem; font-size: .84rem; color: var(--c-text-soft); flex-wrap: wrap; }
.lc .when .icon { width: .95rem; height: .95rem; }
.lc .when .age { color: var(--sun-700); font-weight: 800; }
.lc .offer { font-size: .92rem; min-width: 0; line-height: 1.35; }
.lc .offer .of { font-weight: 700; }
.lc .offer .cr { font-size: .8rem; color: var(--c-text-soft); white-space: nowrap; }
.lc .offer .cr::before { content: " · "; }
.lc .mail { font-size: .84rem; color: var(--c-text-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lc .act { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .5rem; margin-top: .35rem; }
.lc .act .call { justify-content: flex-start; font-size: 1.02rem; font-weight: 800; padding-inline: 1rem; font-variant-numeric: tabular-nums; }
.lc .act .wa { padding-inline: 1rem; }
.lc .row-actions { margin-top: .35rem; }

.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c-accent); flex: none; box-shadow: 0 0 0 3px var(--sun-100); display: inline-block; }
.tags { display: flex; flex-wrap: wrap; gap: .3rem; }
.tag { display: inline-flex; align-items: center; gap: .25rem; border-radius: var(--r-pill); padding: .1rem .5rem; font-size: .7rem; font-weight: 800; line-height: 1.5; white-space: nowrap; background: var(--c-bg-alt); color: var(--c-text); border: 0; letter-spacing: .01em; }
.tag.request { background: var(--forest-700); color: var(--white); }
.tag.suspect { background: #E6E6E3; color: #4A4A45; }
.tag.fit { background: var(--c-positive-soft); color: var(--leaf-700); box-shadow: inset 0 0 0 1px rgba(62, 133, 49, .25); }
.tag.archived { background: #ECEAE3; color: #4A5C50; }
.status { display: inline-flex; align-items: center; gap: .3rem; border-radius: var(--r-pill); padding: .2rem .6rem; font-size: .76rem; font-weight: 800; white-space: nowrap; flex: none; }
.status .icon { width: .9rem; height: .9rem; }
.row-actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }

/* ======================================================================
   SCHEDA DEL LEAD (telefono: tutto schermo, azioni fisse in basso)
   ====================================================================== */
.drawer-bg { position: fixed; inset: 0; background: rgba(4, 18, 10, .45); z-index: 70; }
.drawer { position: fixed; inset: 0; z-index: 80; background: var(--c-bg); overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column; }
.drawer-head { position: sticky; top: 0; z-index: 3; background: var(--c-surface); border-bottom: 1px solid var(--c-border-soft); padding: .7rem .75rem .7rem 1rem; }
.drawer-top { display: flex; align-items: flex-start; gap: .75rem; }
.drawer-top .ttl { flex: 1; min-width: 0; }
.drawer-top h2 { font-size: 1.3rem; overflow-wrap: anywhere; color: var(--c-text); }
.drawer-top h2:focus { outline: none; }
.drawer-top .sub { display: flex; align-items: center; gap: .3rem; margin-top: .2rem; font-size: .82rem; color: var(--c-text-soft); }
.drawer-top .sub .icon { width: .95rem; height: .95rem; }
.drawer-body { padding: .9rem .75rem 1.25rem; display: grid; gap: .8rem; align-content: start; flex: 1; }
.drawer-summary { background: var(--c-surface); border: 1px solid var(--c-border-soft); border-radius: var(--r-md); padding: .9rem 1rem; display: grid; gap: .6rem; }
.contact-row { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; }
.phone-link { display: inline-flex; align-items: center; gap: .5rem; font-size: 1.25rem; font-weight: 800; color: var(--c-brand); text-decoration: none; font-variant-numeric: tabular-nums; min-height: 44px; }
.phone-link:hover { text-decoration: underline; }
.phone-link .icon { color: var(--leaf-600); }
.mail-link { display: flex; align-items: center; gap: .5rem; color: var(--c-text); text-decoration: none; font-weight: 600; font-size: .92rem; min-width: 0; min-height: 32px; }
.mail-link span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-link .icon { color: var(--c-text-soft); }
.mail-link:hover span { text-decoration: underline; }
.offer-line { display: flex; flex-wrap: wrap; gap: .25rem .6rem; align-items: baseline; font-size: .9rem; }
.offer-line .of { font-weight: 800; }
.offer-line .cr { color: var(--c-text-soft); font-size: .82rem; }
.status-field { display: grid; gap: .3rem; }
.status-field label { font-size: .75rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--c-text-soft); }
.status-select { font-weight: 800; border-color: transparent; }
.drawer-actions { position: sticky; bottom: 0; z-index: 3; margin-top: auto; background: var(--c-surface); border-top: 1px solid var(--c-border-soft); padding: .6rem .75rem calc(.6rem + env(safe-area-inset-bottom)); display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr); gap: .5rem; box-shadow: 0 -8px 20px -14px rgba(0, 0, 0, .25); }
.drawer-actions.has-status { grid-template-columns: minmax(0, 1fr) minmax(0, 1.55fr) minmax(0, .95fr); }
.drawer-actions .btn { width: 100%; min-width: 0; min-height: 52px; padding-inline: .5rem; font-size: .84rem; white-space: normal; text-align: center; line-height: 1.15; }
.st-btn .sw, .status-opt .sw { width: 14px; height: 14px; border-radius: 50%; flex: none; border: 2px solid; }
.panel { background: var(--c-surface); border: 1px solid var(--c-border-soft); border-radius: var(--r-md); padding: .9rem 1rem; display: grid; gap: .7rem; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.panel h3 { font-size: .95rem; color: var(--c-brand); }
.panel h2 { font-size: 1.05rem; color: var(--c-brand); }
dl.kv { display: grid; grid-template-columns: minmax(110px, 38%) minmax(0, 1fr); gap: .4rem .75rem; margin: 0; font-size: .9rem; }
dl.kv dt { color: var(--c-text-soft); font-weight: 600; }
dl.kv dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.qa { display: grid; gap: .55rem; margin: 0; padding: 0; list-style: none; counter-reset: q; }
.qa li { display: grid; grid-template-columns: 1.6rem minmax(0, 1fr); column-gap: .4rem; counter-increment: q; }
.qa li::before { content: counter(q); grid-row: span 3; width: 1.35rem; height: 1.35rem; border-radius: 50%; background: var(--c-bg-alt); color: var(--c-brand); font-size: .72rem; font-weight: 800; display: grid; place-items: center; margin-top: .1rem; }
.qa .q { font-size: .82rem; color: var(--c-text-soft); }
.qa .a { font-weight: 700; }
.qa .changed { font-size: .75rem; color: var(--sun-700); font-weight: 600; }
.warn { padding: .6rem .8rem; border-radius: var(--r-sm); background: var(--c-accent-soft); color: var(--sun-700); font-weight: 600; font-size: .88rem; }
.warn button { margin-left: .35rem; }
.status-now { margin: 0 0 .5rem; }
.history { list-style: none; margin: 0; padding: 0; display: grid; gap: .35rem; font-size: .84rem; color: var(--c-text-soft); }
.history li { padding-left: .8rem; border-left: 2px solid var(--c-border-soft); }
.notes { display: grid; gap: .6rem; }
.note { background: var(--c-bg-alt); border-radius: var(--r-sm); padding: .7rem .8rem; display: grid; gap: .35rem; }
.note .text { white-space: pre-wrap; overflow-wrap: anywhere; }
.note .by { font-size: .78rem; color: var(--c-text-soft); display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.note .old { font-size: .82rem; color: var(--c-text-soft); border-left: 3px solid var(--c-border); padding-left: .6rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.req { border: 1px solid var(--c-border-soft); border-radius: var(--r-sm); padding: .75rem; display: grid; gap: .5rem; }
.req.is-new { border-color: var(--forest-700); }
.req .diff { background: var(--sun-100); border-radius: 4px; padding: 0 .25rem; }
.edit-grid { display: grid; gap: .6rem; }

/* ---------- Finestre, pannelli dal basso, avvisi ---------- */
.dialog-bg { position: fixed; inset: 0; z-index: 100; background: rgba(4, 18, 10, .55); display: grid; place-items: end center; padding: 0; }
.dialog { width: 100%; max-width: 520px; background: var(--c-surface); border-radius: var(--r-lg) var(--r-lg) 0 0; padding: 1.25rem 1rem calc(1.25rem + env(safe-area-inset-bottom)); display: grid; gap: .85rem; max-height: 92vh; overflow-y: auto; overscroll-behavior: contain; animation: rise .22s var(--ease); }
@keyframes rise { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.dialog.is-sheet { padding-top: .6rem; }
.dialog.is-sheet::before { content: ""; justify-self: center; width: 40px; height: 4px; border-radius: 2px; background: var(--c-border); }
.dialog h2 { font-size: 1.25rem; color: var(--c-brand); }
.dialog .actions { display: grid; gap: .5rem; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.sheet-fields { display: grid; gap: .75rem; }
.sheet-count { font-weight: 700; color: var(--c-text-soft); font-size: .9rem; }
.sheet-actions { position: sticky; bottom: calc(-1.25rem - env(safe-area-inset-bottom)); background: var(--c-surface); display: grid; grid-template-columns: 1fr 1.4fr; gap: .5rem; padding: .5rem 0 0; }
.status-list { display: grid; gap: .45rem; }
.status-opt { display: flex; align-items: center; gap: .75rem; width: 100%; min-height: 58px; padding: .55rem .85rem; border: 1.5px solid var(--c-border-soft); border-radius: var(--r-sm); background: var(--c-surface); text-align: left; cursor: pointer; }
.status-opt:hover { border-color: var(--c-border); }
.status-opt .t { display: grid; flex: 1; min-width: 0; }
.status-opt .t b { font-weight: 800; }
.status-opt .t span { font-size: .8rem; color: var(--c-text-soft); }
.status-opt.is-current { border-color: var(--forest-700); background: var(--leaf-50); }
.status-opt .icon { color: var(--leaf-600); }
.who-list { display: grid; gap: .5rem; }
.toast-wrap { position: fixed; left: 0; right: 0; bottom: calc(var(--bottom-h) + 12px + env(safe-area-inset-bottom)); z-index: 110; display: grid; justify-items: center; gap: .5rem; padding: 0 1rem; pointer-events: none; }
.toast { pointer-events: auto; background: var(--forest-900); color: var(--white); border-radius: var(--r-md); padding: .75rem 1rem; box-shadow: var(--sh-xl); display: flex; align-items: center; gap: .9rem; max-width: 560px; width: 100%; font-weight: 600; font-size: .92rem; animation: rise .2s var(--ease); }
.toast .t { flex: 1; }
.toast .link { color: var(--leaf-300); }
.toast.is-error { background: var(--red-600); }
.toast.is-error .link { color: var(--white); }
body.has-drawer .toast-wrap { bottom: calc(84px + env(safe-area-inset-bottom)); }

@media (max-width: 359px) {
  .brand { display: none; }
  /* schermi da 320 px: WhatsApp su tutta la riga, sotto Chiama e Stato */
  .drawer-actions.has-status { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .drawer-actions.has-status .btn-wa { grid-column: 1 / -1; order: -1; }
  .lc .act .wa { padding-inline: .9rem; }
  .lc .act .wa .lbl { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}

/* ======================================================================
   TABLET E COMPUTER (≥ 768 px): app a tutta altezza, niente barra in basso
   ====================================================================== */
@media (min-width: 768px) {
  html, body { height: 100%; }
  body.app { display: flex; flex-direction: column; height: 100vh; height: 100dvh; min-height: 0; overflow: hidden; }
  .appbar { position: relative; flex: none; }
  .topbar { padding: 0 1rem; gap: 1rem; --top-h: 56px; height: 56px; }
  .brand span { display: inline; }
  .nav { display: flex; gap: .15rem; }
  .nav a { color: rgba(255, 255, 255, .78); text-decoration: none; font-weight: 700; font-size: .92rem; padding: .45rem .9rem; border-radius: var(--r-pill); min-height: 38px; display: inline-flex; align-items: center; }
  .nav a:hover { color: var(--white); background: rgba(255, 255, 255, .08); }
  .nav a[aria-current="page"] { background: rgba(255, 255, 255, .16); color: var(--white); }
  .slot-top { flex: 1; }
  .filters-btn { display: none; }
  #btn-refresh { display: grid; }
  .top-right { margin-left: auto; }
  .menu { top: 52px; }
  .bottombar { display: none; }

  /* Striscia sottile dei numeri */
  .strip { display: flex; align-items: stretch; background: var(--cream-100); border-bottom: 1px solid var(--c-border-soft); padding: 0 .5rem; overflow-x: auto; scrollbar-width: none; min-height: 42px; }
  .strip::-webkit-scrollbar { display: none; }
  .stat { position: relative; display: inline-flex; align-items: baseline; gap: .45rem; border: 0; background: none; padding: .5rem .8rem; cursor: pointer; white-space: nowrap; color: var(--c-text); font-size: .82rem; font-weight: 700; flex: none; }
  .stat + .stat::before { content: ""; position: absolute; left: 0; top: 11px; bottom: 11px; width: 1px; background: var(--c-border-soft); }
  .stat b { font: 700 1.1rem/1 var(--font-heading); color: var(--c-brand); font-variant-numeric: tabular-nums; }
  .stat:hover { background: rgba(15, 51, 32, .05); }
  .stat.is-hot { color: var(--sun-700); }
  .stat.is-hot b { color: var(--sun-600); }
  .stat.is-on { background: var(--c-surface); box-shadow: inset 0 -3px 0 var(--c-accent); }
  .strip .legend { display: none; margin-left: auto; align-items: center; gap: 1rem; padding: 0 .75rem; font-size: .74rem; color: var(--c-text-soft); white-space: nowrap; }
  .strip .lg { display: inline-flex; align-items: center; gap: .35rem; }
  .strip .lg .bar { width: 4px; height: 16px; border-radius: 2px; background: var(--c-accent); }
  .strip .lg .dot { width: 8px; height: 8px; box-shadow: none; }

  /* Barra unica: ricerca + filtri + conteggio */
  .toolbar { display: flex; align-items: center; gap: .6rem; background: var(--c-surface); border-bottom: 1px solid var(--c-border-soft); padding: .55rem 1rem; min-height: 58px; position: relative; z-index: 20; }
  .slot-bar { flex: 0 1 380px; min-width: 190px; display: flex; }
  .slot-bar .search input { height: 42px; background: var(--cream-100); border-color: var(--cream-100); font-size: .95rem; }
  .slot-bar .search input:hover { border-color: var(--c-border-soft); }
  .slot-bar .search input:focus { background: var(--c-surface); border-color: var(--c-brand); }
  .slot-bar .kbd { display: grid; place-items: center; position: absolute; right: .6rem; top: 50%; transform: translateY(-50%); width: 22px; height: 22px; border-radius: 6px; border: 1px solid var(--c-border); color: var(--c-text-soft); font: 700 .75rem/1 var(--font-body); pointer-events: none; background: var(--c-surface); }
  .slot-bar .search input:focus ~ .kbd, .slot-bar .search input:not(:placeholder-shown) ~ .kbd { display: none; }
  .filterbar { flex: 1 1 auto; min-width: min-content; display: flex; align-items: center; gap: .5rem; }
  .fsel { position: relative; display: inline-flex; align-items: center; gap: .3rem; height: 42px; border: 1.5px solid var(--c-border-soft); border-radius: var(--r-pill); background: var(--c-surface); padding: 0 0 0 .9rem; font-size: .875rem; cursor: pointer; min-width: 0; flex: 0 0 auto; }
  .fsel:hover { border-color: var(--c-border); }
  .fsel .cap { color: var(--c-text-soft); font-weight: 600; white-space: nowrap; }
  .fsel select { appearance: none; field-sizing: content; border: 0; background: none; font-weight: 800; height: 100%; padding: 0 2rem 0 .1rem; cursor: pointer; min-width: 3.5rem; max-width: 190px; text-overflow: ellipsis; color: var(--c-text); }
  .fsel select:focus { outline: none; }
  .fsel:focus-within { border-color: var(--c-brand); box-shadow: var(--c-ring); }
  .fsel > .icon { position: absolute; right: .7rem; width: 1rem; height: 1rem; pointer-events: none; color: var(--c-text-soft); }
  .fsel.is-on { border-color: var(--forest-700); background: var(--leaf-50); }
  .fbtn { display: inline-flex; align-items: center; gap: .4rem; height: 42px; padding: 0 .9rem; border: 1.5px solid var(--c-border-soft); border-radius: var(--r-pill); background: var(--c-surface); font-weight: 700; font-size: .875rem; cursor: pointer; white-space: nowrap; color: var(--c-text); }
  .fbtn .icon { width: 1rem; height: 1rem; color: var(--c-text-soft); }
  .fbtn:hover { border-color: var(--c-border); }
  .fbtn.is-on { border-color: var(--forest-700); background: var(--leaf-50); }
  .fbtn[aria-expanded="true"] { border-color: var(--c-brand); }
  .more-wrap { position: relative; flex: none; }
  .pop { position: absolute; top: calc(100% + 8px); left: 0; z-index: 40; width: 330px; background: var(--c-surface); border-radius: var(--r-md); box-shadow: var(--sh-xl); border: 1px solid var(--c-border-soft); padding: 1rem; display: grid; gap: .75rem; animation: rise .15s var(--ease); }
  .pop .select { min-height: 44px; }
  .bar-link { font-size: .875rem; white-space: nowrap; flex: none; }
  .bar-count { margin-left: auto; white-space: nowrap; font-weight: 700; color: var(--c-text-soft); font-size: .875rem; padding-left: .5rem; }
  .bar-title { font-size: 1.05rem; color: var(--c-brand); white-space: nowrap; }
  .bar-note { font-size: .875rem; color: var(--c-text-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

  /* Spazio di lavoro: elenco (scorre da solo) + scheda del lead */
  .work { flex: 1; min-height: 0; display: flex; position: relative; }
  main { flex: 1; min-width: 0; overflow: auto; overscroll-behavior: contain; padding: 1.25rem 1.25rem 2.5rem; scroll-padding-top: 44px; }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
  .list-head .sort-select { min-height: 42px; }

  /* Scheda del lead sul tablet: pannello da destra sopra l'elenco */
  .drawer { left: auto; width: min(520px, 92vw); box-shadow: var(--sh-xl); }
  .drawer-body { padding: 1rem 1rem 1.25rem; }
  .drawer-actions { padding: .7rem 1rem; }
  .drawer-actions .btn { min-height: 48px; font-size: .9rem; }
  .dialog-bg { place-items: center; padding: 1rem; }
  .dialog { border-radius: var(--r-lg); padding: 1.5rem; }
  .dialog.is-sheet { padding-top: 1.25rem; }
  .dialog.is-sheet::before { display: none; }
  .sheet-actions { bottom: -1.5rem; padding-bottom: .25rem; }
  .toast-wrap { left: 1.25rem; right: auto; bottom: 1.25rem; width: min(480px, calc(100vw - 2.5rem)); justify-items: start; padding: 0; }
  body.has-drawer .toast-wrap { bottom: 1.25rem; }
}

/* Tablet: i 7 numeri vanno a capo invece di scorrere fuori dallo schermo */
@media (min-width: 768px) and (max-width: 1023.98px) {
  .strip { flex-wrap: wrap; padding: .15rem .5rem; }
  .stat { padding: .4rem .6rem; }
  .stat + .stat::before { display: none; }
}

/* ======================================================================
   COMPUTER (≥ 1024 px): tabella a tutta pagina, scheda del lead affiancata
   ====================================================================== */
@media (min-width: 1024px) {
  .nav a[data-view="lead"] { order: -1; }
  .who-chip { display: inline-flex; }
  .toolbar { padding-left: 1.25rem; }

  main { container: list / inline-size; }
  body[data-view="lead"] main, body[data-view="archivio"] main, body[data-view="search"] main { padding: 0; background: var(--c-surface); }
  body[data-view="dashboard"] main { padding: 1.25rem 1.5rem 2.5rem; }

  /* La scheda del lead non copre l'elenco: gli sta accanto */
  #drawer-root { display: flex; flex: none; }
  .drawer-bg { display: none; }
  .drawer { position: relative; inset: auto; z-index: 5; width: var(--drawer-w); height: 100%; border-left: 1px solid var(--c-border-soft); box-shadow: -12px 0 28px -20px rgba(4, 18, 10, .35); animation: slide .18s var(--ease); }
  @keyframes slide { from { transform: translateX(16px); opacity: .4; } to { transform: none; opacity: 1; } }
  .drawer-head { padding: .85rem 1rem .85rem 1.25rem; }
  .drawer-body { padding: 1rem 1.25rem 1.25rem; }
  .drawer-actions { padding: .7rem 1.25rem; }
  .toast-wrap { left: 1.5rem; bottom: 1.5rem; }

  /* Tabella dei lead */
  .grid-wrap { min-width: 0; }
  table.grid { width: 100%; border-collapse: separate; border-spacing: 0; table-layout: fixed; font-size: .875rem; }
  .grid th { position: sticky; top: 0; z-index: 2; height: 40px; padding: 0 .75rem; background: var(--cream-100); border-bottom: 1px solid var(--c-border-soft); text-align: left; font-size: .7rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--c-text-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .grid th .sort { display: inline-flex; align-items: center; gap: .3rem; height: 40px; max-width: 100%; padding: 0; border: 0; background: none; font: inherit; color: inherit; letter-spacing: inherit; text-transform: inherit; cursor: pointer; }
  .grid th .sort span:first-child { overflow: hidden; text-overflow: ellipsis; }
  .grid th .sort:hover, .grid th .sort.is-on { color: var(--c-brand); }
  .grid th .arrow { font-size: .85rem; opacity: .35; letter-spacing: 0; }
  .grid th .sort.is-on .arrow { opacity: 1; color: var(--c-accent); }
  .grid td { height: 46px; padding: 0 .75rem; border-bottom: 1px solid var(--c-border-soft); background: var(--c-surface); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; }
  .grid tr > :first-child { padding-left: 1.25rem; }
  .grid tr > :last-child { padding-right: 1.25rem; }
  .grid tbody tr { cursor: pointer; scroll-margin-top: 44px; }
  .grid tbody tr:hover td { background: var(--cream-100); }
  .grid tbody tr:focus-visible { outline: 3px solid var(--c-focus); outline-offset: -3px; }
  .grid tr.is-recent td { background: var(--c-row-recent); }
  .grid tr.is-recent td:first-child { box-shadow: inset 4px 0 0 var(--c-accent); }
  .grid tr.is-recent:hover td { background: var(--sun-50); }
  .grid tr.is-open td, .grid tr.is-open:hover td { background: var(--leaf-50); }
  .grid tr.is-open td:first-child { box-shadow: inset 4px 0 0 var(--forest-700); }
  .grid tr.is-flash td { animation: flash 2.4s var(--ease); }
  /* Nome prima di tutto; le etichette che non ci stanno vanno a capo in una riga nascosta: mai tagliate a metà */
  .grid .nm { display: flex; flex-wrap: wrap; align-items: center; align-content: flex-start; column-gap: .4rem; row-gap: 12px; height: 22px; overflow: hidden; min-width: 0; }
  .grid .nm .t { font-weight: 800; line-height: 22px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 0 1 auto; max-width: calc(100% - 1rem); }
  .grid .nm .dot { width: 9px; height: 9px; }
  .grid .nm .tag { flex: none; }
  .grid .num { font-variant-numeric: tabular-nums; }
  .grid .c-ph { font-weight: 600; }
  .grid .c-em { color: var(--c-text-soft); }
  .grid .c-ca .age { margin-left: .45rem; color: var(--sun-700); font-weight: 800; font-size: .75rem; }
  .grid .c-st .status { max-width: 100%; overflow: hidden; text-overflow: ellipsis; font-size: .72rem; display: inline-block; vertical-align: middle; }
  .grid .c-st .status .icon { vertical-align: -2px; margin-right: .2rem; }
  .grid .row-actions.is-compact { flex-wrap: nowrap; gap: .4rem; }
  .grid .row-actions.is-compact .btn { min-height: 32px; padding: .2rem .7rem; font-size: .8rem; }
  .grid .row-actions.is-compact .btn .icon { width: 1rem; height: 1rem; }
  .grid .row-actions.is-compact .link { font-size: .82rem; min-height: 28px; }
  /* larghezze: le colonne libere (email, offerta) si dividono lo spazio che resta */
  .grid th.c-name { width: 19%; }
  .grid th.c-ph { width: 128px; }
  .grid th.c-pv { width: 8%; min-width: 96px; }
  .grid th.c-ca { width: 150px; }
  .grid th.c-cr { width: 9%; }
  .grid th.c-st { width: 186px; }
  .grid th.c-aa { width: 150px; }
  .grid th.c-act { width: 392px; }
  /* Archivio: lo stato è sempre «Archiviato» (c'è già il titolo della sezione): al suo posto le azioni */
  .grid.is-archive .c-st { display: none; }
  .grid.is-archive th.c-ca { width: 150px; }
  .grid.is-archive th.c-name { width: 18%; }
  .grid .row-actions.is-compact .btn { font-size: .78rem; padding-inline: .6rem; }
  .grid-wrap .more { padding: 1rem 1.25rem 2rem; text-align: left; }
  .search-head { padding: 1rem 1.25rem .25rem; margin: 0; }
  .search-head h1 { font-size: 1.15rem; }
  body[data-view="search"] .group-title { margin: 0; padding: 1.5rem 1.25rem .6rem; border-top: 1px solid var(--c-border-soft); }
  body[data-view="lead"] .offline, body[data-view="archivio"] .offline, body[data-view="search"] .offline { margin: .75rem 1.25rem; }

  /* Dashboard sul computer: da contattare a sinistra, risultati a destra */
  .dash { display: grid; grid-template-columns: minmax(300px, 380px) minmax(0, 1fr); gap: 1.25rem; align-items: start; }
  .dash-side { display: grid; gap: 1.25rem; }
  .dash .block { margin: 0; }
  .waiting-block { background: var(--c-surface); border: 1px solid var(--c-border-soft); border-radius: var(--r-md); padding: .9rem 1rem 1rem; }
  .waiting-block .page-head { margin-bottom: .6rem; }
  .dash-cta { justify-items: start; }
  .dash-main { display: grid; gap: .75rem; }
  .results-panel { padding: 1rem 1.25rem 1.25rem; }
  .results-panel .results-body { padding: 0; }
  .results-panel table.perf { min-width: 0; }
  .results-panel table.perf th { white-space: normal; vertical-align: bottom; }
}

/* Colonne che si nascondono quando lo spazio dell'elenco si stringe (scheda aperta o schermo piccolo) */
@container list (min-width: 1180px) {
  .grid th.c-ca { width: 208px; }
}
@container list (max-width: 1179px) {
  .grid .c-ca .age { display: none; }
}
@container list (max-width: 1499px) {
  .grid.is-archive .c-cr { display: none; }
}
@container list (max-width: 1319px) {
  .grid.is-archive .c-em { display: none; }
}
/* 1024–1100 px senza scheda aperta: tutte le 8 colonne, più strette */
@container list (min-width: 1001px) and (max-width: 1099px) {
  .grid { font-size: .82rem; }
  .grid td, .grid th { padding-left: .5rem; padding-right: .5rem; }
  .grid th.c-name { width: 22%; }
  .grid th.c-ph { width: 116px; }
  .grid th.c-ca { width: 146px; }
  .grid th.c-st { width: 146px; }
}
@container list (max-width: 1000px) {
  .grid .c-cr, .grid .c-em { display: none; }
  .grid th.c-name { width: 26%; }
  .grid th.c-pv { width: 104px; }
  .grid th.c-ca { width: 150px; }
  .grid th.c-st { width: 160px; }
  .grid th.c-act { width: 300px; }
  .grid .row-actions.is-compact .link { display: none; }
}
@container list (max-width: 900px) {
  .grid .c-pv, .grid .c-aa { display: none; }
}
@container list (max-width: 760px) {
  .grid .c-of { display: none; }
}

@media (min-width: 1360px) {
  .strip .legend { display: flex; }
  .updated { display: inline; }
}
/* Risposte a più scelte nel pannello «Risposte del quiz» (27/09: «Cosa vuoi installare?») */
.checks-multi { display: grid; grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr)); gap: .1rem .8rem; }
.checks-multi .check { display: flex; align-items: center; gap: .55rem; min-height: 40px; font-weight: 600; cursor: pointer; }
.checks-multi .check input { width: 20px; height: 20px; margin: 0; flex: none; accent-color: var(--c-brand); }
