@layer componenti {
/* App shell on phones (SVIL-507, conoscouno/mobile-first/design.md §2b-2d): bottom tab bar, compact header, press states, home contrast (icon tiles, chat demo). Loaded last on both sites. Transforms only (CLS 0). */

/* ---- tab bar ---- */
.tb{position:fixed;left:0;right:0;bottom:0;z-index:45;display:grid;grid-auto-flow:column;grid-auto-columns:1fr;
  min-height:calc(var(--tb-h) + env(safe-area-inset-bottom,0px));padding:0 env(safe-area-inset-right,0px) env(safe-area-inset-bottom,0px) env(safe-area-inset-left,0px);
  background:var(--sup);border-top:1px solid var(--linea-f);transition:transform var(--d-3,220ms) var(--c-std,ease),visibility 0s}
@supports ((-webkit-backdrop-filter:blur(1px)) or (backdrop-filter:blur(1px))){
  .tb{background:color-mix(in srgb,var(--sup) 96%,transparent);-webkit-backdrop-filter:blur(20px);backdrop-filter:blur(20px)}}
.tb a{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:var(--sp-1);min-width:0;min-height:var(--tb-h);padding:var(--sp-1) 0;
  text-decoration:none;color:var(--t2);font-size:.8125rem;line-height:1.15;font-weight:var(--fw-semibold);letter-spacing:.01em;
  -webkit-tap-highlight-color:transparent;touch-action:manipulation}
.tb a span{max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding:0 var(--sp-half)}
.tb i{display:grid;place-items:center;width:56px;height:30px;border-radius:var(--r-pill);transition:background var(--d-2,160ms),transform 120ms var(--c-std,ease)}
.tb i .ico{width:22px;height:22px}
/* current tab, the only one (SVIL-507 r2): indicator pill, filled icon, ink label at 700; the others are t2 outlines */
.tb a[aria-current]{color:var(--ink);font-weight:var(--fw-bold,700)}
.tb a[aria-current] i{background:color-mix(in srgb,var(--ink) 16%,var(--sup))}
.tb a[aria-current] .ico{stroke-width:2.25;fill:currentColor;fill-opacity:.28}
.tb a:active i{transform:scale(.92)}
/* the central action: a filled ink circle (navy in light, white in dark), never yellow (the page owns the one yellow) and
   never shaped like the current-tab pill; its label sits on the same baseline as the others (the circle overflows the
   30 px icon row by 3 px on each side). In the request flow it is the current place: bold label (no ring: it touched the label). */
.tb a.tb-az{color:var(--ink)}
.tb a.tb-az i{width:34px;height:34px;margin:-2px 0;border-radius:50%;background:var(--ink);color:var(--sup);box-shadow:0 1px 3px color-mix(in srgb,#000 22%,transparent)}
html[data-tema="scuro"] .tb a.tb-az i{background:color-mix(in srgb,var(--ink) 84%,var(--sup))}
.tb a.tb-az .ico{width:20px;height:20px;stroke-width:2.6;fill:none}
.tb a.tb-az[aria-current]{font-weight:var(--fw-bold,700)}
.tb a:focus-visible{outline:2px solid var(--fuoco);outline-offset:-4px;border-radius:var(--r-md);box-shadow:inset 0 0 0 6px var(--sup)}
/* the page reserves the bar from the first paint (no layout shift); focus never lands under it */
body:has(>.tb){padding-bottom:calc(var(--tb-h) + env(safe-area-inset-bottom,0px))}
html:has(body>.tb){scroll-padding-bottom:calc(var(--tb-h) + env(safe-area-inset-bottom,0px) + 8px)}
/* other fixed bottom bars (composer, sticky save, dock): app-shell.js measures them into --fondo; every scroll container
   ends that far above the bottom, never less than its first-paint padding (no shift) */
html[style*="--fondo"]{scroll-padding-bottom:calc(var(--fondo) + var(--sp-2))}
html[style*="--fondo"] :is(.pagina,.conv,.prf,main:has(~ .dock),main:has(~ .conv-scrivi),main:has(.conv-scrivi)>:last-child){padding-bottom:max(calc(var(--fondo) + var(--sp-6)),calc(var(--sp-24) + var(--sp-4)))}
/* keyboard open: the bar steps aside (one bottom bar at a time); hidden = out of the focus order too */
html.kb .tb{transform:translateY(calc(100% + 2px));visibility:hidden;transition:transform var(--d-3,220ms) var(--c-std,ease),visibility 0s linear var(--d-3,220ms)}
/* short landscape: icons only (labels stay for screen readers), header never slides */
@media (max-height:480px) and (orientation:landscape){.tb a span{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)}}
@media (min-width:1024px){.tb{display:none}body:has(>.tb){padding-bottom:0}}

/* ---- compact header on phones: 56 px, always visible (SVIL-509: iOS navigation bars never hide; see css/ios.css) ---- */
@media (max-width:1023.98px){
  :root .top{height:var(--header-h)}
  /* «Accedi» lives in the tab bar on phones */
  body:has(>.tb) .top>.tasto-s.bordo{display:none}
  /* home hero: the photo ends above the tab bar, so «Parla con l'assistente» is visible at first sight */
  html body:has(>.tb) .hf.hf-home{--hf-h:max(520px,calc(100svh - var(--hf-av) - var(--tb-h) - env(safe-area-inset-bottom,0px)))}
}
@media (prefers-reduced-motion:reduce){.tb,.top,.tb i{transition:none!important}}

/* ---- touch: press feedback everywhere, hover only where a pointer hovers ---- */
html{background:var(--sup);-webkit-tap-highlight-color:transparent}
:is(.tess,.ss-r,.mc-l a,.reqc,.req-pro,.pillola,.tg,.btn,.tasto-s,.menu-m a,.acc-nav a,.hx-lnk):active{transform:scale(.98);transition:transform 80ms}
.menu-m,.acc-p{overscroll-behavior:contain}

/* ---- tap targets ≥ 44 on phones (audit D3) ---- */
@media (max-width:1023.98px){
  :is(.pg-azioni,.hx-azioni,.barra-w) .barra .invia{width:44px;height:44px}
  .acc-pag :is(.acc-b,button){min-height:44px;height:auto}
  .mp-chip{min-height:44px}
  .c4-rivedi{height:44px}
  .tasto-s.tema{min-width:44px;width:44px}
  main :is(li,article,section)>a:not([class]){min-height:44px}
}

/* ---- one yellow per view (design.md §3): next to a yellow send arrow the voice button's mic is ink, not yellow ---- */
.hx-azioni:has(.invia) .parla:not(.hf .parla) .mic{background:var(--ink);color:var(--sup)}

/* ---- home contrast (design.md §2b): icon tiles are raised objects, the chat demo is the brightest object of its section ---- */
.tess .q,html[data-tema="scuro"] .tess .q{background:linear-gradient(180deg,#F3F6FA,#E8EDF3);border:1px solid #DCE3EB;box-shadow:inset 0 1px 0 rgba(255,255,255,.9),0 2px 6px rgba(15,22,33,.06)}
html[data-tema="scuro"] .tess .q{background:linear-gradient(180deg,#1C2D49,#13213A);border:1px solid var(--linea-f);box-shadow:inset 0 1px 0 rgba(255,255,255,.07),0 8px 20px rgba(0,0,0,.45)}
.c4-schermo{border:1.5px solid #B9C3CF;box-shadow:0 2px 6px rgba(15,22,33,.06),0 30px 70px rgba(15,22,33,.2)}
html[data-tema="scuro"] .c4-schermo{background:#101D33;border-color:#2E4062;box-shadow:0 0 0 6px rgba(255,255,255,.025),0 30px 80px rgba(0,0,0,.7)}
.c4-b,.c4-off{background:#F2F5F9;border:1px solid #E1E6ED}
html[data-tema="scuro"] :is(.c4-b,.c4-off){background:#16243C;border-color:#24365A}
.c4-fr.ai{background:#FFFFFF;border-color:#D3DAE3}
html[data-tema="scuro"] .c4-fr.ai{background:#1D2E4B;border-color:#2E4062}
.c4-fr.tu{background:var(--su-giallo);color:#FFFFFF}
html[data-tema="scuro"] .c4-fr.tu{background:#E6EBF2;color:#070F1E}
html[data-tema="scuro"] .c4-fr.tu .c4-chi{color:#4E5866}
.c4-av{background:#FFFFFF;border:1px solid #D3DAE3}
html[data-tema="scuro"] .c4-av{background:#243656;border:0}
.c4-tasti span{background:#FFFFFF;border-color:#C9D0D9}
html[data-tema="scuro"] .c4-tasti span{background:#1D2E4B;border-color:#3A4E72}
html[data-tema="scuro"] .c4-binario{background:#24365A}
/* SVIL-507: tocchi ≥ 44 anche per il titolo-link delle card «I clienti che ti hanno scelto» (/pro) */
.psc-t a{display:inline-flex;align-items:center;min-height:44px}
/* /inizia: un solo giallo primario (la freccia Invia); il microfono di «Parla con l'assistente» resta neutro */
.voce-box .parla .mic,html[data-tema="scuro"] .voce-box .parla .mic{background:var(--ink);color:var(--sup)}
/* SVIL-507: Invia 44 concentrico nelle barre di ricerca: margine destro = margine sopra/sotto (annidati.js) */
.pg-azioni .barra,html[data-tema="scuro"] .pg-azioni .barra{padding-right:calc((var(--btn-lg,56px) - 46px) / 2)}
html body .hx-azioni-f .barra,html[data-tema="scuro"] body .hx-azioni-f .barra{padding-right:calc((60px - 46px) / 2)}
html body .hx-azioni-f .barra .invia,html[data-tema="scuro"] body .hx-azioni-f .barra .invia{width:44px;height:44px;flex:none}
/* SVIL-507 goldfish r2: barra in basso opaca (il testo sotto le etichette si intravedeva) */
html body .tb,html[data-tema="scuro"] body .tb{background:var(--sup);-webkit-backdrop-filter:none;backdrop-filter:none}
/* riepilogo: il giallo è solo «Conferma e invia»; la freccia della nota resta neutra */
.nota-agg .barra .invia,html[data-tema="scuro"] .nota-agg .barra .invia{background:var(--sup-2);color:var(--ink);box-shadow:inset 0 0 0 1px var(--linea-f)}
/* demo della home: le offerte non scelte restano leggibili (≥ 4,5:1); lo stato «non scelto» lo dice il contorno della scelta */
html body .c4-demo[data-fase="4"] .c4-off:not(.scelta){opacity:.78}

/* ================= SVIL-507 r2 (conoscouno/mobile-first/goldfish_review_report.md) ================= */
/* summary: «Conferma e invia» in a sticky bottom action bar (safe-area aware); the note is in the page flow.
   The bar steps aside while the keyboard is open (the note has its own send arrow). */
.az-fissa{position:fixed;left:0;right:0;bottom:0;z-index:30;background:var(--sup);border-top:1px solid var(--linea-f);
  padding:var(--sp-3) max(var(--gutter),env(safe-area-inset-right,0px)) calc(var(--sp-3) + env(safe-area-inset-bottom,0px)) max(var(--gutter),env(safe-area-inset-left,0px));
  transition:transform var(--d-3,220ms) var(--c-std,ease),visibility 0s}
.az-fissa form{max-width:640px;margin:0 auto}
.az-fissa .tg{display:flex;width:100%;min-height:52px;justify-content:center}
.nota-agg{margin-top:var(--sp-6)}
.nota-agg .campo-et{display:block;margin:0 0 var(--sp-2);font-size:var(--t-small);font-weight:var(--fw-semibold);color:var(--ink)}
/* summary rows on phones: label above, value and «Cambia» below (no three-line labels in a 76 px column) */
@media (max-width:479.98px){
  .conv .foglio .rr{display:grid;grid-template-columns:1fr auto;column-gap:var(--sp-3);row-gap:var(--sp-half);align-items:center}
  .conv .foglio .rr .k{width:auto;grid-column:1/-1;padding-top:0}
}
/* trade page and price guide on phones: the request field (the page's yellow action) comes first in the panel,
   right under the photo; the explanatory paragraph follows. The photo stage is shorter so both fit the first screen. */
@media (max-width:1023.98px){
  .ms-pannello{display:flex;flex-direction:column}
  .ms-pannello>.pg-azioni{order:-1;margin:0 0 var(--sp-5)}
  html body .pg-testa.hf.hf-inner.ms-eroe{--hf-h:clamp(440px,54svh,540px)}
}
/* /richiesta (new request): popular jobs as one-tap starts under the voice button */
.lav-pop{margin-top:var(--sp-8)}
.lav-pop h2{font-size:var(--t-small);line-height:var(--lh-small);font-weight:var(--fw-semibold);color:var(--t2);margin:0 0 var(--sp-3)}
.lav-pop ul{display:flex;flex-wrap:wrap;gap:var(--sp-2);margin:0;padding:0;list-style:none}
.lav-pop .pillola{min-height:44px;height:auto;padding:var(--sp-2) var(--sp-4);border:1px solid var(--linea-f);border-radius:var(--r-pill);background:var(--sup-2);color:var(--ink);font-weight:var(--fw-medium);text-decoration:none}
/* /pro «Oggi»: the action first; the yellow button spans the column on phones */
.pro-ora .pro-elenco{margin-top:var(--sp-3)}
.pro-ora .pro-ora-az{margin-top:var(--sp-4)}
@media (max-width:1023.98px){.pro-ora .pro-ora-az{display:flex;width:100%;min-height:52px;justify-content:center}}
.pro-oggi .pro-conti{margin-top:var(--s6,var(--sp-8))}

/* ---- action bars (founder, SVIL-507 r2): every page keeps the tab bar on phones; a page's own primary action
   («Conferma e invia», «Salva», «Invia l'offerta», the conversation composer) is a sticky bar stacked ABOVE it, both
   safe-area aware; app-shell.js pads the content by the bar height (--fondo), the body already reserves the tab bar.
   Keyboard open: the tab bar steps aside and the action bar rides on the keyboard (--kb from visualViewport). ---- */
@media (max-width:1023.98px){
  body:has(>.tb) :is(.az-fissa,.conv-scrivi,.prf-bar,.dock,.giu){bottom:var(--tb-tot);padding-bottom:var(--sp-3)}
  body:has(>.tb) .mod-off .azioni{position:fixed;z-index:30;left:0;right:0;bottom:var(--tb-tot);margin:0;
    padding:var(--sp-3) max(var(--gutter),env(safe-area-inset-right,0px)) var(--sp-3) max(var(--gutter),env(safe-area-inset-left,0px));
    background:var(--sup);border-top:1px solid var(--linea-f);transition:transform var(--d-3,220ms) var(--c-std,ease)}
  body:has(>.tb) .mod-off .azioni .tg.pieno{flex:1;min-height:52px}
  html[style*="--fondo"] body:has(>.tb) main#contenuto{padding-bottom:calc(var(--fondo) + var(--sp-4))}
  html.kb body:has(>.tb) :is(.az-fissa,.conv-scrivi,.prf-bar,.dock,.giu,.mod-off .azioni){bottom:0;transform:translateY(calc(var(--kb,0px) * -1))}
  /* an entry animation that ends on a transform makes its box the containing block of position:fixed: the action bars
     would scroll with the page. Pages with an action bar enter without it on phones. */
  body:has(>.tb) :is(.pagina,.conv,.prf,.pro-pg):has(.mod-off,.az-fissa,.prf-bar,.conv-scrivi){animation:none!important;transform:none!important}
  /* the call's written summary: «Conferma e invia» is the sticky action above the tab bar */
  body:has(>.tb) .ch-fine:not([hidden]) .ch-invia{position:fixed;z-index:30;left:var(--gutter);right:var(--gutter);width:auto;bottom:calc(var(--tb-tot) + var(--sp-3));
    box-shadow:0 0 0 100vmax var(--sup);clip-path:inset(calc(var(--sp-3) * -1) -100vmax -100vmax -100vmax)}
  html.kb body:has(>.tb) .ch-fine:not([hidden]) .ch-invia{bottom:calc(var(--kb,0px) + var(--sp-3))}
  body:has(>.tb) .ch:has(.ch-fine:not([hidden])){padding-bottom:calc(56px + var(--sp-8))}
  body:has(>.tb) .ch-ver,body:has(>.tb) .ch{animation:none!important;transform:none!important}
  /* the voice call: the panel fills the space between the compact header and the tab bar */
  body:has(>.tb) .ch-pan{top:56px;bottom:var(--tb-tot);height:auto;padding-top:0;padding-bottom:0;z-index:40}
  html.ch-pieno body:has(>.tb) .top{transform:none;visibility:visible}
}

/* ---- goldfish r4 fixes ---- */
/* the web footer is a website leftover in the app's flow pages on phones (Principale.razor wraps it in .piede-via) */
@media (max-width:1023.98px){.piede-via{display:none}}
/* pro profile save bar: opaque; state line above a full-width button; neutral button until something changed (JS sets
   data-pp-pronta, so without JS the button stays the yellow primary) */
@media (max-width:1023.98px){
  .prf-bar{background:var(--sup);-webkit-backdrop-filter:none;backdrop-filter:none;border-top-color:var(--linea-f)}
  .prf-bar-in{flex-wrap:wrap;gap:var(--sp-2)}
  .prf-bar .prf-stato{flex-basis:100%;justify-content:center}
  .prf-bar .tg.pieno{flex:1;width:100%;height:52px}
}
html body .prf-bar[data-pp-pronta]:not(.prf-sporco) .tg.pieno,html[data-tema="scuro"] body .prf-bar[data-pp-pronta]:not(.prf-sporco) .tg.pieno{background:var(--sup-2);color:var(--ink);box-shadow:inset 0 0 0 1px var(--linea-f)}
/* summary: «Cambia» is a 44 px target; the note's button says what it does */
.conv .foglio .rr form button{min-height:44px;min-width:44px;padding:0 var(--sp-2);margin:calc(var(--sp-2) * -1) calc(var(--sp-2) * -1) calc(var(--sp-2) * -1) 0}
.nota-agg .barra .invia.testo{width:auto;padding:0 var(--sp-4);border-radius:var(--r-pill);font-weight:var(--fw-semibold);font-size:var(--t-small)}
/* offer form: «Da/A» only for a «da … a …» price */
.mod-off:not(:has(#tipo option[value="intervallo"]:checked)) .riga2:has(#min){display:none}
/* /pro «Oggi»: the card and the yellow button were two targets for one action; the button stays */
.pro-ora .pro-elenco .rc-dx{display:none}
/* popular jobs heading readable in the sun */
.lav-pop h2{color:var(--ink)}
/* /richiesta: «Parla con l'assistente» is the secondary way in, as on the showcase (outlined, never heavier than the yellow arrow) */
.voce-box .parla,html[data-tema="scuro"] .voce-box .parla{background:var(--sup);color:var(--ink);box-shadow:inset 0 0 0 1.5px var(--linea-f)}
.voce-box .parla b,html[data-tema="scuro"] .voce-box .parla b{color:var(--ink)}
.voce-box .parla small,html[data-tema="scuro"] .voce-box .parla small{color:var(--t2)}
.voce-box .parla>span:last-child{display:grid;gap:2px;align-content:center;text-align:left}
.voce-box .parla .mic{background:var(--sup-2);color:var(--ink)}

/* ---- SVIL-507 r3 ---------------------------------------------------------------------------------------------------
   One yellow per view: the yellow is only the primary action. Identity (avatar, mode pill), status chips («prova», the
   reply deadline, «dedotto») and the estimate bar are ink/neutral, with the same meaning in both themes. */
html body .acc-av,html[data-tema="scuro"] body .acc-av{background:var(--sup-3);color:var(--ink);box-shadow:inset 0 0 0 1px var(--linea-f)}
html body .acc-modo[data-modo="pro"],html[data-tema="scuro"] body .acc-modo[data-modo="pro"]{background:transparent;color:var(--ink);box-shadow:inset 0 0 0 1px var(--linea-f)}
html body :is(.stato-p.prova,.opp .stato-p.prova,.conv .dedotto),html[data-tema="scuro"] body :is(.stato-p.prova,.opp .stato-p.prova,.conv .dedotto){background:transparent;color:var(--t2);box-shadow:inset 0 0 0 1px var(--linea-f)}
html body .stato-p.pc-giallo,html[data-tema="scuro"] body .opp .stato-p.pc-giallo:not(.prova){background:var(--sup-3);color:var(--ink);font-weight:600}
html body :is(.fb-fascia,.legenda i.fascia),html[data-tema="scuro"] body :is(.fb-fascia,.legenda i.fascia){background:var(--ink)}
/* one header on phones: logo, theme, account. The showcase hamburger duplicated the tab bar (its links are in the footer) */
@media (max-width:1023.98px){body:has(>.tb) .top .menu-t{display:none}}
/* offer form: three groups, the optional details folded (progressive disclosure), € inside the price field */
.mod-off .off-g{display:grid;gap:var(--sp-4);margin:0;padding:var(--sp-4);border:1px solid var(--linea);border-radius:var(--r-l,16px);min-width:0}
.mod-off .off-g>legend{padding:0 var(--sp-2);margin-left:calc(var(--sp-2) * -1);font-size:var(--t-body);font-weight:700;color:var(--ink)}
.mod-off .off-altro>summary{display:flex;align-items:center;gap:var(--sp-2);min-height:44px;margin:calc(var(--sp-2) * -1) 0;cursor:pointer;font-weight:700;color:var(--ink);list-style:none}
.mod-off .off-altro>summary::-webkit-details-marker{display:none}
.mod-off .off-altro>summary::after{content:"";margin-left:auto;width:9px;height:9px;border:solid currentColor;border-width:0 2px 2px 0;transform:rotate(45deg);translate:0 -3px}
.mod-off .off-altro[open]>summary::after{transform:rotate(-135deg);translate:0 2px}
.mod-off .off-altro>summary .pic{font-weight:500;color:var(--t2)}
.mod-off .off-altro:not([open]){gap:0}
.mod-off .euro{position:relative;display:block}
.mod-off .euro>input{width:100%;padding-right:40px}
.mod-off .euro>span{position:absolute;right:14px;top:50%;translate:0 -50%;font-weight:600;color:var(--t2);pointer-events:none}
.mod-off textarea{resize:none}
.dett .foglio>summary{min-height:44px;display:flex;flex-wrap:wrap;align-items:baseline;column-gap:var(--sp-2)}
.dett .foglio>summary .pic{margin:0}
/* chosen customer: the phone on its own row in full, «Chiama» 44 px, outlined (the page's yellow is elsewhere) */
.psc-tel-r{display:flex;align-items:center;gap:var(--sp-3);margin-top:var(--s3);padding:var(--sp-3) 0;border-block:1px solid color-mix(in srgb,var(--ink) 12%,transparent)}
.psc-tel-n{display:grid;min-width:0;flex:1}
.psc-tel-k{font-size:var(--t-small);color:var(--t2);font-weight:500}
.psc-tel-n b{font-size:var(--t-title);line-height:1.3;font-variant-numeric:tabular-nums;white-space:nowrap;letter-spacing:.01em}
.psc-tel-n .pic{display:block;margin:0;font-size:var(--t-small)}
html body .psc .psc-tel{display:inline-flex;align-items:center;justify-content:center;gap:var(--sp-2);flex:none;min-height:44px;min-width:44px;margin:0;padding:0 var(--sp-4);border-radius:var(--r-pill);background:var(--ink);color:var(--sup)!important;font-weight:700;text-decoration:none}
html body .psc .psc-tel[aria-disabled="true"]{cursor:not-allowed;background:transparent;color:var(--t2)!important;box-shadow:inset 0 0 0 1.5px var(--linea-f)}
/* status cards keep the navy surfaces of the theme: the «chosen» state is a green edge, not a green card */
html body .psc,html[data-tema="scuro"] body .psc{background:var(--sup-2);box-shadow:inset 4px 0 0 var(--ok),inset 0 0 0 1px var(--linea)}

}
