/* ==========================================================================================
   Gestione Cantieri — foglio di stile
   Bianco come superficie, blu come inchiostro. I colori, i caratteri e gli arrotondamenti
   arrivano dalle variabili CSS generate in Personalizzazione → Aspetto (vedi Theme.php);
   i valori qui sotto sono quelli predefiniti, ricavati dal logo.
   ========================================================================================== */

@font-face { font-family: "Fira Sans"; src: url("../fonts/FiraSans-400.woff") format("woff"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Fira Sans"; src: url("../fonts/FiraSans-500.woff") format("woff"); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: "Fira Sans"; src: url("../fonts/FiraSans-700.woff") format("woff"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Anton"; src: url("../fonts/Anton.woff") format("woff"); font-weight: 400; font-style: normal; font-display: swap; }

:root {
    --blue: #0083a8;
    --blue-d: #006e8d;
    --blue-dd: #004660;
    --blue-t1: #edf6f9;
    --blue-t2: #d6ebf2;
    --blue-t3: #9bcfdf;
    --on-blue: #ffffff;
    --cyan: #00b3e5;
    --cyan-t: #dbf4fb;
    --ink: #001c2d;
    --ink-2: #425562;
    --ink-3: #6f808b;
    --line: #d6e2e8;
    --line-2: #e8eff3;
    --line-s: #adc2cd;
    --bg: #f3f7f9;
    --r: 10px;
    --font: "Fira Sans", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --display: "Anton", Impact, "Haettenschweiler", "Arial Narrow Bold", sans-serif;
    --display-case: uppercase;
    --display-track: .014em;
    --display-weight: 400;

    --r-sm: calc(var(--r) * .7);
    --r-lg: calc(var(--r) * 1.5);
    --ok: #1b7f55;
    --ok-bg: #e2f3ea;
    --warn: #9a5f00;
    --warn-bg: #fcefd3;
    --bad: #b93229;
    --bad-bg: #fbe8e6;
    --shadow-pop: 0 20px 48px -14px rgba(0, 52, 74, .34), 0 2px 8px rgba(0, 40, 60, .08);
}

/* ------------------------------------------------------------------------------------------
   Base
   ------------------------------------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
    margin: 0;
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.5;
    color: var(--ink);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
    overflow-wrap: break-word;
}
h1, h2, h3, p, dl, dd, figure, fieldset { margin: 0; }
fieldset { border: 0; padding: 0; min-width: 0; }
strong { font-weight: 500; }
b { font-weight: 700; }
img { max-width: 100%; }
a { color: var(--blue-d); }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
::selection { background: var(--blue-t2); }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: 12px; top: -60px; z-index: 300; background: var(--ink); color: #fff; padding: 10px 14px; border-radius: var(--r-sm); }
.skip-link:focus { top: 12px; }
.muted { color: var(--ink-3); }
.nowrap { white-space: nowrap; }
.link { color: var(--blue-d); font-weight: 500; text-decoration: none; background: none; border: 0; padding: 0; cursor: pointer; font-size: inherit; }
.link:hover { text-decoration: underline; }
.link.is-danger { color: var(--bad); }
.lead { max-width: 76ch; color: var(--ink-2); margin-bottom: 18px; }
.note { font-size: 13.5px; color: var(--ink-3); max-width: 72ch; }

.ic { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; }
.ic-sm { width: 15px; height: 15px; stroke-width: 2; }
.ic-xl { width: 44px; height: 44px; stroke-width: 1.4; }

/* ------------------------------------------------------------------------------------------
   Struttura: menu laterale, colonna principale, barre del telefono
   ------------------------------------------------------------------------------------------ */
.app { display: flex; min-height: 100vh; min-height: 100dvh; }
.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }
main { flex: 1; width: 100%; max-width: 1360px; margin: 0 auto; padding: 30px 36px 64px; }
main:focus { outline: none; }

.side {
    width: 256px; flex: none; background: #fff; border-right: 1px solid var(--line);
    display: flex; flex-direction: column;
    position: sticky; top: 0; height: 100vh; height: 100dvh; overflow-y: auto;
}
/* Il logo è sempre su fondo bianco. */
.brand { background: #fff; padding: 22px 20px 4px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.brand a { display: block; }
.brand img { display: block; width: 190px; height: auto; }
.side .side-close { display: none; }
.side-app { margin: 4px 20px 16px; font-size: 13px; color: var(--ink-3); }
.side-ver { margin-left: 4px; font-variant-numeric: tabular-nums; }

.nav { flex: 1; display: flex; flex-direction: column; gap: 2px; padding: 4px 12px 12px; }
.nav-link {
    position: relative; display: flex; align-items: center; gap: 12px; padding: 10px 12px;
    border-radius: var(--r-sm); color: var(--ink-2); font-weight: 500; text-decoration: none;
}
.nav-link .ic { color: var(--blue); }
.nav-link:hover { background: var(--blue-t1); color: var(--ink); }
.nav-link.is-active { background: var(--blue-t1); color: var(--blue-dd); }
.nav-link.is-active::before { content: ""; position: absolute; left: -12px; top: 7px; bottom: 7px; width: 4px; border-radius: 0 4px 4px 0; background: var(--blue); }
.nav-group { margin: 18px 12px 6px; font-size: 12.5px; color: var(--ink-3); }

.side-user { border-top: 1px solid var(--line); padding: 12px; }
.side-user-card { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: var(--r-sm); text-decoration: none; color: inherit; }
.side-user-card:hover { background: var(--blue-t1); }
.side-user-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.side-user-text strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user-text small { color: var(--ink-3); font-size: 12.5px; }
.side-user-links { display: flex; gap: 4px; margin-top: 4px; }
.side-user-links form { margin: 0; flex: 1; display: flex; }
.side-user-links a, .side-user-links button {
    flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 6px; border: 0; background: none;
    border-radius: var(--r-sm); font-size: 12.5px; color: var(--ink-2); text-decoration: none; cursor: pointer; white-space: nowrap;
}
.side-user-links a:hover, .side-user-links button:hover { background: var(--blue-t1); color: var(--ink); }
.side-user-links .ic { width: 16px; height: 16px; }

.top, .tabbar, .side-backdrop { display: none; }

@media (max-width: 1023px) {
    main { padding: 18px 16px calc(92px + env(safe-area-inset-bottom)); }
    .side {
        position: fixed; inset: 0 auto 0 0; z-index: 90; width: min(86vw, 320px); height: 100%;
        transform: translateX(-104%); visibility: hidden; box-shadow: var(--shadow-pop);
        transition: transform .22s ease, visibility 0s linear .22s;
        padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom);
    }
    body.side-open .side { transform: none; visibility: visible; transition: transform .22s ease, visibility 0s; }
    body.side-open { overflow: hidden; }
    .side .side-close { display: inline-grid; }
    .side-backdrop { display: block; position: fixed; inset: 0; z-index: 80; background: rgba(0, 28, 45, .5); opacity: 0; pointer-events: none; transition: opacity .2s; }
    body.side-open .side-backdrop { opacity: 1; pointer-events: auto; }

    .top {
        display: flex; align-items: center; justify-content: space-between; gap: 12px;
        position: sticky; top: 0; z-index: 40; background: #fff; border-bottom: 1px solid var(--line);
        padding: calc(8px + env(safe-area-inset-top)) calc(16px + env(safe-area-inset-right)) 8px calc(16px + env(safe-area-inset-left));
    }
    .top-logo { display: block; line-height: 0; }
    .top-logo img { height: 30px; width: auto; }
    .top-user { line-height: 0; text-decoration: none; }

    .tabbar {
        display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; background: #fff; border-top: 1px solid var(--line);
        padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
    }
    .tabbar-item {
        flex: 1; min-width: 0; min-height: 56px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
        padding: 7px 4px 6px; border: 0; background: none; color: var(--ink-3); font-size: 11.5px; font-weight: 500; text-decoration: none; cursor: pointer;
    }
    .tabbar-item span { max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .tabbar-item .ic { width: 23px; height: 23px; }
    .tabbar-item.is-active { color: var(--blue-d); }
}

/* ------------------------------------------------------------------------------------------
   Testata di pagina
   ------------------------------------------------------------------------------------------ */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px 20px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head-text { min-width: 0; }
.page-title, .cartello-name, .cartello-total-pct, .sign-name, .auth-title, .auth-headline, .ledger-cell strong, .error-code {
    font-family: var(--display); font-weight: var(--display-weight); text-transform: var(--display-case); letter-spacing: var(--display-track);
}
.page-title { font-size: clamp(27px, 3.3vw, 38px); line-height: 1.08; text-wrap: balance; }
.page-sub { color: var(--ink-3); margin-top: 4px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.crumbs { display: flex; align-items: center; gap: 4px; font-size: 13.5px; margin-bottom: 8px; color: var(--ink-3); }
.crumbs a { color: var(--ink-2); text-decoration: none; font-weight: 500; }
.crumbs a:hover { color: var(--blue-d); }
.crumbs .ic { width: 14px; height: 14px; }
.hello { margin: -12px 0 20px; font-size: 16px; color: var(--ink-2); }
.hello span { color: var(--ink-3); margin-left: 12px; display: inline-block; }

/* ------------------------------------------------------------------------------------------
   Pulsanti
   ------------------------------------------------------------------------------------------ */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 8px 16px;
    border: 1px solid var(--line-s); border-radius: var(--r-sm); background: #fff; color: var(--ink);
    font: inherit; font-weight: 500; line-height: 1.2; text-decoration: none; white-space: nowrap; cursor: pointer;
    transition: background-color .12s, border-color .12s, color .12s;
}
.btn .ic { width: 18px; height: 18px; }
.btn:hover { border-color: var(--blue); color: var(--blue-dd); }
.btn-primary { background: var(--blue); border-color: var(--blue); color: var(--on-blue); }
.btn-primary:hover { background: var(--blue-d); border-color: var(--blue-d); color: var(--on-blue); }
.btn-primary.is-danger, .btn-primary.is-danger:hover { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn-danger { color: var(--bad); }
.btn-danger:hover { border-color: var(--bad); background: var(--bad-bg); color: var(--bad); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--blue-d); }
.btn-ghost:hover { background: var(--blue-t1); border-color: transparent; }
.btn-sm { min-height: 34px; padding: 5px 11px; font-size: 13.5px; gap: 6px; }
.btn-sm .ic { width: 16px; height: 16px; }
.btn-lg { min-height: 50px; font-size: 16px; }
.btn-block { width: 100%; }
.btn-square { padding-left: 0; padding-right: 0; width: 40px; }
.btn-sm.btn-square { width: 34px; }
.btn-plate { background: rgba(255, 255, 255, .14); border-color: rgba(255, 255, 255, .55); color: inherit; }
.btn-plate:hover { background: #fff; border-color: #fff; color: var(--ink); }
.btn:disabled, .btn.is-disabled, .btn.is-busy { opacity: .55; pointer-events: none; }
.btn-icon { width: 38px; height: 38px; flex: none; display: inline-grid; place-items: center; border: 0; border-radius: 50%; background: transparent; color: var(--ink-2); cursor: pointer; }
.btn-icon:hover { background: var(--blue-t1); color: var(--ink); }
@media (pointer: coarse) {
    .btn { min-height: 44px; }
    .btn-sm { min-height: 38px; }
    .btn-square { width: 44px; }
    .btn-sm.btn-square { width: 38px; }
    .btn-icon { width: 44px; height: 44px; }
}

/* ------------------------------------------------------------------------------------------
   Moduli
   ------------------------------------------------------------------------------------------ */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-label { font-size: 13.5px; font-weight: 500; color: var(--ink-2); }
.field-label output { color: var(--blue-dd); font-weight: 700; margin-left: 6px; font-variant-numeric: tabular-nums; }
.field-hint { font-size: 13px; color: var(--ink-3); }
.field-error { font-size: 13px; font-weight: 500; color: var(--bad); }
.field.has-error .input { border-color: var(--bad); }
.req { color: var(--bad); }

/* 16px sui dispositivi touch: iOS non ingrandisce la pagina quando si tocca un campo. */
.input {
    width: 100%; min-height: 42px; padding: 9px 12px; border: 1px solid var(--line-s); border-radius: var(--r-sm);
    background: #fff; color: var(--ink); font: inherit; font-size: 16px; line-height: 1.3; -webkit-appearance: none; appearance: none;
}
@media (min-width: 1024px) and (pointer: fine) { .input, .search input { font-size: 15px; } }
.input::placeholder { color: var(--ink-3); opacity: .8; }
.input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-t2); }
.input:disabled { background: var(--bg); color: var(--ink-3); }
select.input {
    padding-right: 36px; background-repeat: no-repeat; background-position: right 11px center;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236f808b' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}
textarea.input { min-height: 84px; line-height: 1.45; resize: vertical; }
textarea.code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13.5px; }
input[type="date"].input { min-width: 0; text-align: left; }
input[type="date"]::-webkit-date-and-time-value { text-align: left; }
input[type="range"] { width: 100%; height: 30px; accent-color: var(--blue); margin: 0; }
.input-auto { width: auto; min-width: 160px; max-width: 100%; }
.input-grow { flex: 1 1 220px; width: auto; }
/* Codici (CIG, CUP): sempre in maiuscolo, cifre e lettere ben distinte. */
.input-code { text-transform: uppercase; letter-spacing: .04em; font-variant-numeric: tabular-nums; }
.input-code::placeholder { text-transform: none; letter-spacing: 0; }
.input-xl { min-height: 60px; font-size: 28px; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.input-unit { display: flex; align-items: center; gap: 12px; }
.input-unit > span { min-width: 2.4em; font-weight: 500; color: var(--ink-2); }

/* Unità scritta dentro il campo, a destra del numero (€, %). */
.affix { position: relative; display: block; min-width: 0; }
.affix .input { padding-right: 34px; text-align: right; font-variant-numeric: tabular-nums; }
.affix-unit { position: absolute; top: 50%; right: 13px; transform: translateY(-50%); min-width: 12px; text-align: center; font-weight: 500; color: var(--ink-3); pointer-events: none; }
.field-short .affix { max-width: 132px; }

.form-stack { display: flex; flex-direction: column; gap: 16px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.form-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.span-2 { grid-column: 1 / -1; }
@media (max-width: 599px) { .form-grid, .form-grid-3 { grid-template-columns: minmax(0, 1fr); } }
.form-wide { max-width: 880px; }
.narrow { max-width: 540px; }
.form-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.form-error { padding: 10px 12px; border-radius: var(--r-sm); background: var(--bad-bg); color: var(--bad); font-size: 14px; font-weight: 500; }
.logout-row { margin-top: 14px; }
.profile-id { display: flex; align-items: center; gap: 12px; }
.profile-id > div { display: flex; flex-direction: column; }

.switch { position: relative; display: flex; align-items: flex-start; gap: 12px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 44px; height: 26px; margin: 0; cursor: pointer; }
.switch-ui { flex: none; position: relative; width: 44px; height: 26px; border-radius: 99px; background: var(--line-s); transition: background-color .15s; }
.switch-ui::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 28, 45, .3); transition: transform .15s; }
.switch input:checked + .switch-ui { background: var(--blue); }
.switch input:checked + .switch-ui::after { transform: translateX(18px); }
.switch input:focus-visible + .switch-ui { outline: 3px solid var(--blue); outline-offset: 2px; }
.switch-text { display: flex; flex-direction: column; padding-top: 2px; font-weight: 500; }
.switch-text small { font-size: 13px; font-weight: 400; color: var(--ink-3); }

.segmented { display: inline-flex; max-width: 100%; padding: 3px; gap: 2px; background: var(--blue-t1); border-radius: var(--r-sm); }
.segmented label { position: relative; flex: 1; }
.segmented input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; margin: 0; cursor: pointer; }
.segmented span { display: block; padding: 8px 16px; border-radius: calc(var(--r-sm) - 2px); text-align: center; white-space: nowrap; font-weight: 500; color: var(--ink-2); }
.segmented input:checked + span { background: #fff; color: var(--blue-dd); box-shadow: 0 1px 2px rgba(0, 28, 45, .16); }
.segmented input:focus-visible + span { outline: 3px solid var(--blue); outline-offset: 1px; }
.segmented input:disabled + span { opacity: .5; }
.segmented-sm span { padding: 6px 12px; font-size: 13.5px; }

.color-input { display: flex; align-items: center; gap: 8px; }
.color-input input[type="color"] { flex: none; width: 46px; height: 42px; padding: 3px; border: 1px solid var(--line-s); border-radius: var(--r-sm); background: #fff; cursor: pointer; }
.color-input .input { max-width: 132px; font-variant-numeric: tabular-nums; }
.swatch-row { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 6px; }
.swatch { position: relative; width: 32px; height: 32px; }
.swatch input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; margin: 0; cursor: pointer; }
.swatch span { display: block; width: 100%; height: 100%; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 1px var(--line-s); }
.swatch.is-none span { background: repeating-linear-gradient(135deg, #fff 0 5px, var(--line) 5px 7px); }
.swatch input:checked + span { box-shadow: 0 0 0 2.5px var(--ink); }
.swatch input:focus-visible + span { outline: 3px solid var(--blue); outline-offset: 3px; }

.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); gap: 8px; }
.check { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-sm); cursor: pointer; }
.check input { flex: none; width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--blue); }
.check > span { display: flex; flex-direction: column; min-width: 0; }
.check small { font-size: 12.5px; color: var(--ink-3); }
.check:has(input:checked) { border-color: var(--blue); background: var(--blue-t1); }
.check-list { display: flex; flex-direction: column; gap: 1px; max-height: 230px; overflow-y: auto; padding: 4px 0; }
.check-list label { display: flex; align-items: center; gap: 10px; padding: 8px 6px; border-radius: var(--r-sm); cursor: pointer; }
.check-list label:hover { background: var(--blue-t1); }
.check-list input { flex: none; width: 18px; height: 18px; margin: 0; accent-color: var(--blue); }
.check-list small { color: var(--ink-3); margin-left: auto; white-space: nowrap; font-size: 12.5px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { position: relative; }
.chip input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; margin: 0; cursor: pointer; }
.chip > span { display: inline-flex; align-items: center; gap: 8px; padding: 4px 13px 4px 4px; border: 1px solid var(--line-s); border-radius: 99px; font-weight: 500; }
.chip input:checked + span { border-color: var(--blue); background: var(--blue-t1); color: var(--blue-dd); }
.chip input:focus-visible + span { outline: 3px solid var(--blue); outline-offset: 2px; }
.chip input:disabled + span { opacity: .6; }
.check-chip { position: relative; display: inline-flex; }
.check-chip input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; margin: 0; cursor: pointer; }
.check-chip span { display: inline-flex; align-items: center; min-height: 40px; padding: 6px 14px; border: 1px solid var(--line-s); border-radius: 99px; background: #fff; font-weight: 500; white-space: nowrap; }
.check-chip input:checked + span { border-color: var(--blue); background: var(--blue-t1); color: var(--blue-dd); }
.check-chip input:focus-visible + span { outline: 3px solid var(--blue); outline-offset: 2px; }

.fold > summary { display: flex; align-items: center; gap: 8px; padding: 8px 0; font-weight: 500; cursor: pointer; list-style: none; }
.fold > summary::-webkit-details-marker { display: none; }
.fold > summary .ic { width: 16px; height: 16px; color: var(--ink-3); transition: transform .15s; }
.fold[open] > summary .ic { transform: rotate(90deg); }
.fold-count { margin-left: auto; font-size: 13px; font-weight: 500; color: var(--blue-d); }
.quick-pct { display: flex; gap: 6px; flex-wrap: wrap; }
.quick-pct .btn { flex: 1; }

/* ------------------------------------------------------------------------------------------
   Barra degli strumenti, ricerca, schede
   ------------------------------------------------------------------------------------------ */
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar-space { flex: 1; }
.toolbar-count { font-size: 13.5px; }
.toolbar .form-error { flex-basis: 100%; }
.toolbar-sticky { position: sticky; top: 0; z-index: 20; background: var(--bg); padding: 10px 0; margin-top: -10px; }
.search { position: relative; display: block; flex: 1 1 260px; max-width: 440px; }
.search .ic { position: absolute; left: 13px; top: 50%; width: 18px; height: 18px; transform: translateY(-50%); color: var(--ink-3); pointer-events: none; }
.search input {
    width: 100%; min-height: 42px; padding: 9px 14px 9px 40px; border: 1px solid var(--line-s); border-radius: 99px;
    background: #fff; color: var(--ink); font: inherit; font-size: 16px; -webkit-appearance: none; appearance: none;
}
.search input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-t2); }
.filter-empty { padding: 28px 16px; text-align: center; color: var(--ink-3); }

.tabs { display: flex; gap: 2px; margin: 20px 0; border-bottom: 2px solid var(--line); overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.tabs::-webkit-scrollbar { display: none; }
.tab { flex: none; padding: 11px 16px; margin-bottom: -2px; border-bottom: 2px solid transparent; color: var(--ink-2); font-weight: 500; text-decoration: none; white-space: nowrap; }
.tab:hover { color: var(--ink); }
.tab.is-active { color: var(--blue-dd); border-bottom-color: var(--blue); }

/* ------------------------------------------------------------------------------------------
   Riquadri, elenchi, tabelle
   ------------------------------------------------------------------------------------------ */
.panel { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 18px 20px; min-width: 0; }
.panel-flush { padding: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.panel-head h2 { font-size: 16.5px; font-weight: 700; line-height: 1.3; }
.panel-head .link { font-size: 13.5px; white-space: nowrap; }
.panel-empty { color: var(--ink-3); padding: 6px 0 4px; }
.panel-more { margin-top: 8px; font-size: 13px; color: var(--ink-3); }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 350px), 1fr)); gap: 16px; align-items: start; }
.cols-3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); }
.site-desc { max-width: 80ch; color: var(--ink-2); margin-bottom: 18px; }
.panel + .cols, .cols + .panel { margin-top: 16px; }
.plain-list { display: flex; flex-direction: column; gap: 6px; margin: 0; padding-left: 20px; }

.ledger { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1px; margin-bottom: 16px; background: var(--line); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.ledger-cell { display: flex; flex-direction: column; gap: 4px; padding: 14px 20px 13px; background: #fff; color: inherit; text-decoration: none; }
.ledger-cell strong { font-size: 36px; line-height: 1; color: var(--blue-dd); }
.ledger-cell span { font-size: 13.5px; color: var(--ink-2); }
a.ledger-cell:hover { background: var(--blue-t1); }
.ledger-cell.is-bad strong { color: var(--bad); }
.ledger-cell.is-warn strong { color: var(--warn); }

.rows { list-style: none; margin: 0; padding: 0; }
.rows > li { border-top: 1px solid var(--line-2); }
.rows > li:first-child { border-top: 0; }
.row-link, .row-static { display: flex; align-items: center; gap: 12px; padding: 10px 0; min-width: 0; color: inherit; text-decoration: none; }
.panel-flush .row-link, .panel-flush .row-static { padding-left: 18px; padding-right: 18px; }
.rows-lg .row-static { padding-top: 13px; padding-bottom: 13px; }
.row-link:hover .row-main strong { color: var(--blue-d); }
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.row-main strong { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.row-main .muted { font-size: 13px; }
.row-side { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; font-size: 13px; text-align: right; }
.row-pct { display: flex; align-items: center; gap: 8px; }
.row-pct .bar { width: 60px; }
.row-pct b { min-width: 36px; text-align: right; font-variant-numeric: tabular-nums; }
.row-tools { flex: none; display: flex; align-items: center; gap: 6px; }

.table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.table th { padding: 12px 16px; text-align: left; font-size: 13px; font-weight: 500; color: var(--ink-3); white-space: nowrap; border-bottom: 2px solid var(--blue); }
.table td { padding: 11px 16px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.cell-main strong, .cell-main .muted { display: block; }
.cell-main .muted, .cell-sub { font-size: 12.5px; }
.cell-sub { display: block; }
.cell-person { white-space: nowrap; }
.cell-person .cell-main { display: inline-block; vertical-align: middle; margin-left: 10px; white-space: normal; }
.cell-person .avatar { vertical-align: middle; }
.cell-actions { text-align: right; white-space: nowrap; }
.cell-wide { min-width: 220px; }
tr.is-off td > *, .prod.is-off { opacity: .62; }
.pos { color: var(--ok); }
/* Se una voce lunghissima allarga comunque la tabella, scorre dentro il suo riquadro: la pagina non deborda mai. */
.table-box { overflow-x: auto; -webkit-overflow-scrolling: touch; }
/* Le tabelle diventano schede quando al riquadro mancano gli 830 px che servono alle colonne: fino a 861 px di
   schermo (menu a scomparsa, 16 px di margine per lato) e tra 1024 e 1157 px (menu fisso da 256 px, 36 px di margine). */
@media (max-width: 861px), (min-width: 1024px) and (max-width: 1157px) {
    .table-stack thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
    .table-stack, .table-stack tbody, .table-stack tr, .table-stack td { display: block; width: 100%; }
    .table-stack tr { padding: 12px 16px; border-bottom: 1px solid var(--line); }
    .table-stack tbody tr:last-child { border-bottom: 0; }
    /* Etichetta a sinistra, valore tutto insieme a destra (numero e unità, nome e codice restano uniti). */
    .table-stack td { display: flow-root; padding: 3px 0; border: 0; text-align: right; }
    .table-stack td::before { content: attr(data-label); float: left; margin-right: 16px; font-size: 13px; line-height: 21.75px; color: var(--ink-3); text-align: left; }
    .table-stack td:not([data-label])::before { content: none; }
    .table-stack td.cell-person { display: flex; justify-content: flex-start; align-items: center; text-align: left; padding-bottom: 6px; }
    .table-stack td.cell-person::before { content: none; }
    .table-stack td.cell-actions { display: flex; justify-content: flex-end; padding-top: 8px; }
    .table-stack td.cell-actions:empty { display: none; }
    .table-stack .cell-wide { min-width: 0; }
}
@media (max-width: 759px) { .hide-sm { display: none; } }
.pager { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 16px; }
.pager-info { font-size: 13.5px; color: var(--ink-3); }

/* ------------------------------------------------------------------------------------------
   Piccoli componenti
   ------------------------------------------------------------------------------------------ */
.badge {
    --c: var(--blue);
    display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px 2px 8px; border-radius: 99px;
    background: var(--blue-t1); color: var(--ink); font-size: 12.5px; font-weight: 500; line-height: 1.55; white-space: nowrap; vertical-align: middle;
}
.badge i { flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--c); }
@supports (color: color-mix(in srgb, red 50%, blue)) {
    .badge { background: color-mix(in srgb, var(--c) 13%, #fff); color: color-mix(in srgb, var(--c) 58%, #001c2d); }
}
.badge-sm { padding: 0 8px 0 6px; font-size: 11.5px; }
.badge-plate, .badge.badge-plate { background: #fff; color: var(--ink); }

.avatar { --c: var(--blue); flex: none; display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--c); color: #fff; font-size: 12.5px; font-weight: 700; letter-spacing: .02em; line-height: 1; }
.avatar-lg { width: 44px; height: 44px; font-size: 15px; }

.bar { display: inline-block; flex: none; width: 120px; max-width: 100%; height: 8px; border-radius: 99px; background: var(--blue-t2); overflow: hidden; vertical-align: middle; }
.bar i { display: block; height: 100%; border-radius: 99px; background: var(--cyan); }

.qty { white-space: nowrap; }
.qty b { font-variant-numeric: tabular-nums; }
.qty.is-zero b { color: var(--ink-3); }
.qty.is-full b { color: var(--ok); }

.thumb { flex: none; display: grid; place-items: center; width: 56px; height: 56px; border: 1px solid var(--line-2); border-radius: var(--r-sm); background: #fff; overflow: hidden; }
.thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.thumb.is-empty { border-color: transparent; background: var(--blue-t1); color: var(--blue-t3); }
.thumb.is-empty .ic { width: 42%; height: 42%; max-width: 46px; max-height: 46px; stroke-width: 1.4; }
.thumb-sm { width: 40px; height: 40px; }
.thumb-fill { width: 100%; height: auto; aspect-ratio: 4 / 3; border: 0; border-bottom: 1px solid var(--line-2); border-radius: 0; }

.empty { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 48px 20px; text-align: center; background: #fff; border: 1.5px dashed var(--line-s); border-radius: var(--r); }
.empty .ic-xl { color: var(--blue-t3); }
.empty h3 { margin-top: 6px; font-size: 18px; }
.empty p { max-width: 50ch; color: var(--ink-3); }
.empty .btn { margin-top: 12px; }

.alert { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 16px; padding: 11px 14px; border-radius: var(--r-sm); font-weight: 500; }
.alert-bad { background: var(--bad-bg); color: var(--bad); }
.alert-ok { background: var(--ok-bg); color: var(--ok); }
.alert-info { background: var(--blue-t1); color: var(--blue-dd); }

.state { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; font-weight: 500; white-space: nowrap; }
.state-ok { color: var(--ok); }
.state-warn { color: var(--warn); }
.state-bad { color: var(--bad); }

.kv > div { display: grid; grid-template-columns: 124px minmax(0, 1fr); gap: 10px; padding: 8px 0; border-top: 1px solid var(--line-2); }
.kv > div:first-child { border-top: 0; }
.kv dt { font-size: 13.5px; color: var(--ink-3); }
.kv-wide > div { grid-template-columns: minmax(130px, 1fr) minmax(0, 1.1fr); }
.kv .state { white-space: normal; }

.menu { position: relative; }
.menu > summary { list-style: none; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-pop { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; display: flex; flex-direction: column; min-width: 240px; padding: 6px; background: #fff; color: var(--ink); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-pop); }
.menu-pop button, .menu-pop a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 0; border-radius: var(--r-sm); background: none; color: var(--ink); font: inherit; text-align: left; text-decoration: none; white-space: nowrap; cursor: pointer; }
.menu-pop button:hover, .menu-pop a:hover { background: var(--blue-t1); }
.menu-pop .is-danger { color: var(--bad); }
.menu-pop .is-danger:hover { background: var(--bad-bg); }

.toasts { position: fixed; left: 50%; bottom: calc(76px + env(safe-area-inset-bottom)); z-index: 200; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 8px; width: max-content; max-width: calc(100vw - 32px); pointer-events: none; }
@media (min-width: 1024px) { .toasts { bottom: 28px; } }
.toast { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: var(--r); background: var(--ink); color: #fff; font-weight: 500; box-shadow: var(--shadow-pop); pointer-events: auto; animation: rise .2s ease-out; }
.toast.is-error { background: var(--bad); }
.toast.is-leaving { opacity: 0; transition: opacity .25s; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }

/* ------------------------------------------------------------------------------------------
   Finestre di dialogo (su telefono salgono dal basso)
   ------------------------------------------------------------------------------------------ */
dialog.dlg {
    width: min(560px, calc(100vw - 32px)); max-width: none; max-height: min(88vh, 860px); max-height: min(88dvh, 860px);
    padding: 0; border: 0; border-radius: var(--r-lg); background: #fff; color: var(--ink); box-shadow: var(--shadow-pop); overflow: hidden;
}
dialog.dlg[open] { display: flex; flex-direction: column; animation: rise .18s ease-out; }
dialog.dlg::backdrop { background: rgba(0, 28, 45, .52); }
dialog.dlg-wide { width: min(780px, calc(100vw - 32px)); }
dialog.dlg-confirm { width: min(430px, calc(100vw - 32px)); }
.dlg-box { flex: 1; min-height: 0; display: flex; flex-direction: column; margin: 0; }
.dlg-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 18px 14px 10px 22px; }
.dlg-title { font-size: 19px; font-weight: 700; line-height: 1.25; padding-top: 6px; }
.dlg-sub { margin-top: 2px; font-size: 14px; color: var(--ink-3); }
.dlg-body { flex: 1; min-height: 0; padding: 6px 22px 20px; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.dlg-confirm .dlg-body { padding-top: 22px; }
.dlg-confirm .dlg-title { padding-top: 0; margin-bottom: 8px; }
.dlg-confirm p { color: var(--ink-2); }
.dlg-foot { display: flex; align-items: center; justify-content: flex-end; gap: 10px; flex-wrap: wrap; padding: 12px 22px; border-top: 1px solid var(--line-2); }
.dlg-section { margin: 20px 0 8px; font-size: 15px; font-weight: 700; }
@media (max-width: 639px) {
    dialog.dlg:not(.dlg-confirm) { width: 100%; max-height: 94vh; max-height: 94dvh; margin: auto 0 0; border-radius: var(--r-lg) var(--r-lg) 0 0; }
    .dlg-head { padding-left: 18px; }
    .dlg-body { padding-left: 18px; padding-right: 18px; }
    .dlg-foot { padding: 12px 18px calc(12px + env(safe-area-inset-bottom)); }
    .dlg-foot .btn:not(.btn-danger) { flex: 1; }
}
dialog.dlg-lightbox { width: 100vw; height: 100vh; height: 100dvh; max-height: none; margin: 0; border-radius: 0; background: rgba(0, 18, 30, .95); }
.lightbox { position: relative; flex: 1; min-height: 0; display: grid; place-items: center; padding: 12px; }
.lightbox img { max-width: 100%; max-height: calc(100vh - 24px); max-height: calc(100dvh - 24px); object-fit: contain; border-radius: 4px; background: #fff; }
.lightbox .btn-icon { position: absolute; z-index: 2; background: rgba(255, 255, 255, .92); color: var(--ink); }
.lightbox-close { top: calc(12px + env(safe-area-inset-top)); right: 12px; }
.lightbox-prev { left: 12px; top: 50%; transform: translateY(-50%); }
.lightbox-next { right: 12px; top: 50%; transform: translateY(-50%); }

/* ------------------------------------------------------------------------------------------
   Cartello di cantiere: testata della scheda e schede dell'elenco
   ------------------------------------------------------------------------------------------ */
.cartello { --c: var(--blue); --on-c: var(--on-blue); background: #fff; border: 1px solid var(--line); border-radius: var(--r); }
.cartello[style*="--c"], .sign[style*="--c"] { --on-c: #fff; }
.cartello-head {
    display: flex; align-items: flex-end; justify-content: space-between; gap: 14px 20px; flex-wrap: wrap;
    padding: 18px 22px 20px; background: var(--c); color: var(--on-c); border-radius: calc(var(--r) - 1px) calc(var(--r) - 1px) 0 0;
}
.cartello-id { min-width: 0; flex: 1 1 320px; }
.cartello-code { margin-bottom: 6px; font-size: 13.5px; font-weight: 500; letter-spacing: .06em; opacity: .92; font-variant-numeric: tabular-nums; }
.cartello-name { font-size: clamp(27px, 3.7vw, 44px); line-height: 1.05; text-wrap: balance; }
.cartello-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
/* Le caselle si dispongono su più righe e l'ultima riga si allarga a tutta la larghezza: nessun riquadro vuoto. */
.cartello-grid { display: flex; flex-wrap: wrap; overflow: hidden; border-radius: 0 0 calc(var(--r) - 1px) calc(var(--r) - 1px); }
.cartello-grid > div { flex: 1 1 172px; min-width: 0; margin: 0 -1px -1px 0; padding: 12px 22px 14px; border-right: 1px solid var(--line-2); border-bottom: 1px solid var(--line-2); }
.cartello-grid dt { margin-bottom: 2px; font-size: 12.5px; color: var(--ink-3); }
.cartello-grid dd { font-weight: 500; }
.cartello-ref { font-variant-numeric: tabular-nums; letter-spacing: .02em; overflow-wrap: anywhere; }
/* Percentuale totale del cantiere, in evidenza sotto la fascia: è la media delle percentuali delle attività. */
.cartello-total { display: flex; align-items: center; gap: 12px 20px; padding: 14px 22px 16px; border-bottom: 1px solid var(--line-2); }
.cartello-total-pct { flex: none; font-size: clamp(40px, 5.2vw, 56px); line-height: .9; color: var(--blue-dd); font-variant-numeric: tabular-nums; }
.cartello-total-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.cartello-total-label { display: flex; align-items: baseline; justify-content: space-between; gap: 2px 16px; flex-wrap: wrap; margin: 0; font-weight: 500; }
.cartello-total-label span + span { font-size: 13.5px; font-weight: 400; color: var(--ink-3); }
.bar-total { display: block; width: 100%; height: 12px; }
.cartello-total.is-done .cartello-total-pct { color: var(--ok); }
.cartello-total.is-done .bar i { background: var(--ok); }
.tel { display: inline-flex; align-items: center; gap: 4px; margin-left: 8px; color: var(--blue-d); font-weight: 500; text-decoration: none; white-space: nowrap; }
.tel .ic { width: 15px; height: 15px; }
td .tel { margin-left: 0; }
@media (max-width: 639px) {
    .cartello-head { padding: 16px 16px 18px; }
    .cartello-total { padding: 12px 16px 14px; }
    .cartello-grid > div { flex-basis: 50%; padding: 10px 16px 12px; }
    .cartello-tools .btn-plate span { display: none; }
    .cartello-tools .btn-plate { width: 44px; padding: 0; }
}
/* Su telefono, nelle sezioni operative (magazzino, Gantt...) il cartello si riduce alla sola fascia. */
@media (max-width: 759px) {
    .cartello.is-compact .cartello-grid { display: none; }
    .cartello.is-compact .cartello-head { padding-top: 12px; padding-bottom: 14px; border-radius: calc(var(--r) - 1px); }
    .cartello.is-compact.has-total .cartello-head { border-radius: calc(var(--r) - 1px) calc(var(--r) - 1px) 0 0; }
    .cartello.is-compact .cartello-total { padding: 10px 16px 12px; border-bottom: 0; }
    .cartello.is-compact .cartello-total-pct { font-size: 34px; }
    .cartello.is-compact .cartello-name { font-size: 23px; }
    .cartello.is-compact .cartello-code { margin-bottom: 3px; }
    .cartello.is-compact + .tabs { margin-top: 10px; margin-bottom: 14px; }
}

.site-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 310px), 1fr)); gap: 16px; }
.sign { --c: var(--blue); --on-c: var(--on-blue); display: flex; flex-direction: column; background: #fff; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; color: inherit; text-decoration: none; transition: border-color .15s; }
a.sign:hover { border-color: var(--c); }
.sign-band { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 16px; background: var(--c); color: var(--on-c); }
.sign-code { font-size: 13px; font-weight: 500; letter-spacing: .06em; font-variant-numeric: tabular-nums; }
.sign-name { margin: 14px 16px 12px; font-size: 22px; line-height: 1.14; text-wrap: balance; }
.sign-rows { margin: 0 16px; border-top: 1px solid var(--line-2); }
.sign-rows > div { display: grid; grid-template-columns: 104px minmax(0, 1fr); gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line-2); font-size: 13.5px; }
.sign-rows dt { color: var(--ink-3); }
.sign-foot { display: flex; align-items: center; gap: 8px 10px; flex-wrap: wrap; margin-top: auto; padding: 12px 16px 14px; font-size: 13px; }
.sign-foot .bar { flex: 1; min-width: 70px; width: auto; }
.sign-foot b { font-variant-numeric: tabular-nums; }
.sign-pct { font-size: 16px; }
.sign.is-done .sign-pct { color: var(--ok); }
.sign.is-done .sign-foot .bar i { background: var(--ok); }

/* ------------------------------------------------------------------------------------------
   Planning della panoramica
   ------------------------------------------------------------------------------------------ */
/* Le due colonne hanno la stessa altezza: la riga del nome può avere due o tre righe (nome, codice, committente)
   e le linee dei mesi e di oggi la attraversano tutta. */
.plan-scale, .plan-row { display: grid; grid-template-columns: minmax(130px, 250px) minmax(0, 1fr); gap: 16px; align-items: stretch; }
.plan-row { padding: 9px 0; border-top: 1px solid var(--line-2); color: inherit; text-decoration: none; }
.plan-row:hover .plan-name strong { color: var(--blue-d); }
.plan-name { min-width: 0; display: flex; flex-direction: column; justify-content: center; }
.plan-name strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.plan-name span { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-3); }
.plan-name .plan-client { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink-2); }
.plan-track { position: relative; min-height: 26px; }
.plan-scale .plan-track { min-height: 24px; }
.plan-month { position: absolute; top: 2px; padding-left: 5px; font-size: 12px; color: var(--ink-3); white-space: nowrap; border-left: 1px solid var(--line); }
.plan-tick { position: absolute; top: -9px; bottom: -9px; width: 1px; background: var(--line-2); }
.plan-today { position: absolute; top: -9px; bottom: -9px; z-index: 2; width: 2px; margin-left: -1px; background: var(--ink); }
.plan-today-label { position: absolute; top: 1px; z-index: 3; transform: translateX(-50%); padding: 1px 8px; border-radius: 99px; background: var(--ink); color: #fff; font-size: 11.5px; font-weight: 700; }
.plan-bar { --c: var(--blue); position: absolute; top: 50%; margin-top: -9px; z-index: 1; height: 18px; border-radius: 5px; background: var(--blue-t2); }
.plan-bar i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 5px; background: var(--c); }
.plan-bar b { position: absolute; left: calc(100% + 6px); top: 50%; transform: translateY(-50%); font-size: 12px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
@supports (color: color-mix(in srgb, red 50%, blue)) { .plan-bar { background: color-mix(in srgb, var(--c) 24%, #fff); } }
@media (max-width: 599px) {
    .plan-scale, .plan-row { grid-template-columns: minmax(0, 1fr); gap: 5px; }
    .plan-scale .plan-name { display: none; }
    .plan-track { margin-right: 34px; }
    /* Nome, codice e committente stanno sopra la barra: le linee non devono salire fino al testo. */
    .plan-row .plan-tick, .plan-row .plan-today { top: -3px; }
}

/* ------------------------------------------------------------------------------------------
   Magazzino e prodotti
   ------------------------------------------------------------------------------------------ */
.stock-list { background: #fff; border: 1px solid var(--line); border-radius: var(--r); }
.stock-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 8px 18px; padding: 10px 16px; border-top: 1px solid var(--line-2); }
.stock-row:first-child { border-top: 0; }
.stock-main { display: flex; align-items: center; gap: 14px; min-width: 0; margin: -4px; padding: 4px; border: 0; border-radius: var(--r-sm); background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.stock-main:hover strong { color: var(--blue-d); }
.stock-text { display: flex; flex-direction: column; min-width: 0; }
.stock-text .muted { font-size: 13px; }
.stock-loc { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; color: var(--ink-3); }
.stock-qty { display: flex; flex-direction: column; align-items: flex-end; min-width: 96px; text-align: right; }
.stock-qty .qty b { font-size: 21px; }
.stock-qty small { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; color: var(--ink-3); }
.stock-actions { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
@media (max-width: 759px) {
    .stock-row { grid-template-columns: minmax(0, 1fr) auto; padding: 12px 14px; }
    .stock-actions { grid-column: 1 / -1; justify-content: flex-start; }
    .stock-actions > .btn { flex: 1; }
}

.mov-ic { flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--blue-t1); color: var(--blue-d); }
.mov-ic .ic { width: 17px; height: 17px; }
.mov-ic.mov-in, .mov-ic.mov-transfer_in { background: var(--ok-bg); color: var(--ok); }
.mov-ic.mov-adjust { background: var(--warn-bg); color: var(--warn); }
.mov-tag { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; white-space: nowrap; }
.mov-tag.mov-in, .mov-tag.mov-transfer_in { color: var(--ok); }
.mov-tag.mov-adjust { color: var(--warn); }
.move-now { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 10px 14px; border-radius: var(--r-sm); background: var(--blue-t1); color: var(--blue-dd); }
.move-now b { font-size: 18px; font-variant-numeric: tabular-nums; }
.field-hint.is-bad { color: var(--bad); font-weight: 500; }

/* Materiale dell'attività del Gantt: per ogni prodotto la quantità da installare e quella installata. */
.mat-list { --mat-col: 150px; border: 1px solid var(--line); border-radius: var(--r-sm); background: #fff; }
.mat-head, .mat-row { display: grid; grid-template-columns: minmax(0, 1fr) var(--mat-col) var(--mat-col) 38px; align-items: center; gap: 4px 12px; padding: 8px 6px 8px 12px; }
.mat-list.no-inst .mat-head, .mat-list.no-inst .mat-row { grid-template-columns: minmax(0, 1fr) var(--mat-col) 38px; }
.mat-list.no-inst [data-col="inst"] { display: none; }
.mat-head { padding-top: 7px; padding-bottom: 6px; border-bottom: 1px solid var(--line); font-size: 12.5px; font-weight: 500; color: var(--ink-3); }
.mat-row { border-top: 1px solid var(--line-2); }
.mat-row:first-child { border-top: 0; }
.mat-name { display: flex; flex-direction: column; min-width: 0; }
.mat-name strong { font-weight: 500; overflow-wrap: anywhere; }
.mat-name small { font-size: 12.5px; color: var(--ink-3); overflow-wrap: anywhere; }
.mat-cell { min-width: 0; }
.mat-cap { display: none; margin-bottom: 3px; font-size: 12.5px; color: var(--ink-3); }
.mat-qty { display: flex; align-items: center; gap: 8px; }
.mat-qty .input { flex: none; width: 96px; text-align: right; font-weight: 500; font-variant-numeric: tabular-nums; }
.mat-qty > span { min-width: 0; color: var(--ink-2); overflow-wrap: anywhere; }
/* Quantità che non si può cambiare: stessa posizione del numero dentro il campo. */
.mat-fixed { flex: none; width: 96px; padding-right: 13px; text-align: right; font-weight: 500; font-variant-numeric: tabular-nums; }
.mat-fixed.is-zero { color: var(--ink-3); font-weight: 400; }
.mat-x { justify-self: end; }
.mat-row .field-error { grid-column: 1 / -1; margin: 0 6px 2px 0; text-align: right; }
.mat-search .search { flex: none; max-width: none; }
.mat-search .pick-list { margin-top: 6px; max-height: 236px; }
button.pick { width: 100%; border: 0; border-top: 1px solid var(--line-2); background: #fff; color: inherit; font: inherit; text-align: left; }
button.pick:first-child { border-top: 0; }
button.pick:hover, button.pick:focus-visible { background: var(--blue-t1); }
button.pick strong { font-weight: 500; }
.prog-manual, .prog-auto { display: flex; flex-direction: column; gap: 6px; }
.bar-wide { display: block; width: 100%; height: 10px; }
@media (max-width: 559px) {
    /* Telefono: il nome occupa la prima riga, sotto le due quantità con la loro etichetta. */
    .mat-head { display: none; }
    .mat-row, .mat-list.no-inst .mat-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 38px; gap: 6px 12px; padding-top: 10px; padding-bottom: 10px; }
    .mat-name { grid-row: 1; grid-column: 1 / 3; }
    .mat-x { grid-row: 1; grid-column: 3; align-self: start; }
    .mat-cap { display: block; }
    .mat-cell { align-self: start; }
    .mat-qty { min-height: 42px; }
    .mat-qty .input { flex: 1 1 0; width: auto; min-width: 0; }
    .mat-fixed { flex: 0 1 auto; width: auto; padding-right: 0; text-align: left; font-size: 17px; }
    .mat-row .field-error { text-align: left; }
}
}

.pick-list { display: flex; flex-direction: column; max-height: 264px; margin-top: 10px; border: 1px solid var(--line); border-radius: var(--r-sm); overflow-y: auto; }
.pick { display: flex; align-items: center; gap: 12px; padding: 8px 12px; border-top: 1px solid var(--line-2); cursor: pointer; }
.pick:first-child { border-top: 0; }
.pick input { flex: none; width: 18px; height: 18px; margin: 0; accent-color: var(--blue); }
.pick > span:last-child { display: flex; flex-direction: column; min-width: 0; }
.pick small { font-size: 12.5px; color: var(--ink-3); }
.pick:has(input:checked) { background: var(--blue-t1); }
.pick-empty { padding: 18px 14px; text-align: center; color: var(--ink-3); }

.item-layout { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
@media (max-width: 639px) { .item-layout { grid-template-columns: minmax(0, 1fr); } }
.item-main { display: grid; place-items: center; width: 100%; aspect-ratio: 4 / 3; padding: 0; border: 1px solid var(--line-2); border-radius: var(--r-sm); background: #fff; overflow: hidden; cursor: zoom-in; }
.item-main img { width: 100%; height: 100%; object-fit: contain; }
.item-main.is-empty { background: var(--blue-t1); color: var(--blue-t3); cursor: default; }
.item-thumbs { display: flex; gap: 6px; margin-top: 8px; overflow-x: auto; }
.item-thumbs button { flex: none; width: 56px; height: 56px; padding: 0; border: 2px solid transparent; border-radius: var(--r-sm); background: none; overflow: hidden; cursor: pointer; }
.item-thumbs button.is-active { border-color: var(--blue); }
.item-thumbs img { display: block; width: 100%; height: 100%; object-fit: cover; }
.item-qty { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.item-qty .qty b { font-size: 30px; line-height: 1.1; }
.item-desc { margin-top: 10px; color: var(--ink-2); white-space: pre-line; }
.item-history .row-static { padding: 8px 0; }

.prod-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 214px), 1fr)); gap: 14px; }
@media (max-width: 519px) { .prod-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } }
.prod { display: flex; flex-direction: column; background: #fff; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; color: inherit; text-decoration: none; transition: border-color .15s; }
.prod:hover { border-color: var(--blue); }
.prod-body { flex: 1; display: flex; flex-direction: column; gap: 2px; padding: 10px 12px 12px; }
.prod-body strong { line-height: 1.3; }
.prod-body .muted { font-size: 13px; }
.prod-foot { display: flex; align-items: baseline; flex-wrap: wrap; gap: 2px 8px; margin-top: auto; padding-top: 8px; font-size: 13px; }

.prod-price { margin-top: 4px; font-size: 13px; color: var(--ink-3); }
.prod-price b { font-size: 15px; color: var(--ink); font-variant-numeric: tabular-nums; }

/* Prezzi del prodotto: un listino in miniatura. Le righe seguono il calcolo dall'alto in basso
   (listino, sconto, netto, IVA, totale); i puntini accompagnano l'occhio dall'etichetta al valore
   e le unità dei valori calcolati cadono in colonna con quelle dei campi. */
.calc { --calc-w: 150px; display: flex; flex-direction: column; gap: 2px; }
.calc-title { margin: 0 0 6px; font-size: 15px; font-weight: 700; line-height: 1.3; }
.calc .field, .calc-row { display: grid; grid-template-columns: minmax(0, 1fr) var(--calc-w); align-items: center; gap: 4px 0; padding: 4px 12px; border-radius: var(--r-sm); }
.calc .field-label, .calc-label { display: flex; align-items: baseline; min-width: 0; font-size: 15px; font-weight: 400; color: var(--ink); }
.calc .field-label::after, .calc-label::after { content: ""; flex: 1; min-width: 14px; margin: 0 10px 0 8px; border-bottom: 2px dotted var(--line-s); }
.calc .field-error, .calc .field-hint { grid-column: 1 / -1; text-align: right; }
.calc-num { display: block; padding: 9px 34px 9px 12px; border: 1px solid transparent; text-align: right; line-height: 1.3; font-variant-numeric: tabular-nums; white-space: nowrap; }
.calc-row.is-total { background: var(--blue-t1); }
.calc-row.is-total .calc-label { font-weight: 500; color: var(--blue-dd); }
.calc-row.is-total .calc-label::after { border-bottom-color: var(--blue-t3); }
.calc-row.is-total .calc-num { font-size: 17px; font-weight: 700; color: var(--blue-dd); }
.calc-row.is-total .affix-unit { color: var(--blue-dd); }
/* Sola lettura (scheda del prodotto): la colonna dei valori si stringe sul numero e i puntini arrivano fin lì. */
.calc-read { margin: 0 -12px; }
.calc-read .calc-row { grid-template-columns: minmax(0, 1fr) auto; padding-top: 0; padding-bottom: 0; }
.calc-read .calc-row.is-total { margin: 4px 0; }
.calc-read .calc-num { padding-left: 0; }
@media (max-width: 599px) {
    .calc { --calc-w: 132px; }
    .calc .field, .calc-row { padding-left: 10px; padding-right: 10px; }
    .calc .field-label::after, .calc-label::after { min-width: 8px; margin: 0 6px; }
    .calc-read { margin: 0 -10px; }
}

.product-layout { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 899px) { .product-layout { grid-template-columns: minmax(0, 1fr); } }
.product-side { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
@media (max-width: 519px) { .gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.gallery .panel-empty { grid-column: 1 / -1; }
.gallery-item { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--r-sm); background: #fff; overflow: hidden; }
.gallery-item.is-primary { border-color: var(--blue); box-shadow: 0 0 0 1px var(--blue); }
.gallery-item a { display: block; aspect-ratio: 1; }
.gallery-item img { display: block; width: 100%; height: 100%; object-fit: cover; }
.gallery-item figcaption { display: flex; align-items: center; justify-content: space-between; gap: 6px; min-height: 48px; padding: 6px; border-top: 1px solid var(--line-2); }
.gallery-item figcaption .btn-sm:first-child { min-width: 0; overflow: hidden; }
.gallery-cover { display: inline-flex; align-items: center; gap: 5px; padding-left: 4px; font-size: 12.5px; font-weight: 500; color: var(--blue-d); }

.uploader { display: flex; flex-wrap: wrap; gap: 10px; }
.uploader-list { display: contents; }
.uploader-add { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; width: 104px; min-height: 104px; padding: 8px; border: 1.5px dashed var(--blue-t3); border-radius: var(--r-sm); background: var(--blue-t1); color: var(--blue-d); font-size: 13px; font-weight: 500; text-align: center; cursor: pointer; }
.uploader-add:hover { border-color: var(--blue); }
.uploader-add:focus-within { outline: 3px solid var(--blue); outline-offset: 2px; }
.uploader-add .ic { width: 26px; height: 26px; }
.uploader-item { position: relative; width: 104px; height: 104px; border: 1px solid var(--line); border-radius: var(--r-sm); overflow: hidden; }
.uploader-item img { display: block; width: 100%; height: 100%; object-fit: cover; }
.uploader-item button { position: absolute; top: 4px; right: 4px; display: grid; place-items: center; width: 28px; height: 28px; padding: 0; border: 0; border-radius: 50%; background: rgba(0, 28, 45, .72); color: #fff; cursor: pointer; }
.uploader-item button .ic { width: 15px; height: 15px; }
.uploader-item.is-busy img { opacity: .45; }
.uploader-item.is-busy::after { content: ""; position: absolute; left: 50%; top: 50%; width: 26px; height: 26px; margin: -13px 0 0 -13px; border: 3px solid var(--blue-t2); border-top-color: var(--blue); border-radius: 50%; animation: spin .7s linear infinite; }
.uploader-item.is-done::after { content: ""; position: absolute; inset: auto 6px 6px auto; width: 12px; height: 12px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 2px #fff; }
.uploader-item.is-error { outline: 2px solid var(--bad); outline-offset: -2px; }
.uploader-item.is-error img { opacity: .4; }
.uploader-tile { display: contents; }
.uploader-tile .uploader-add, .uploader-tile .uploader-item { width: auto; height: auto; min-height: 0; aspect-ratio: 1 / 1.25; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------------------------------------
   Gantt
   ------------------------------------------------------------------------------------------ */
.gantt { --row: 40px; --name-w: 300px; --dw: 16px; }
.gantt-tools { margin-bottom: 12px; }
.gantt-scroll { position: relative; max-height: min(74vh, 780px); max-height: min(74dvh, 780px); background: #fff; border: 1px solid var(--line); border-radius: var(--r); overflow: auto; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; }
.gantt-scroll:focus-visible { outline-offset: 0; }
.g-inner { position: relative; }
.g-head { position: sticky; top: 0; z-index: 6; display: flex; background: #fff; border-bottom: 2px solid var(--blue); }
.g-corner { position: sticky; left: 0; z-index: 7; flex: none; display: flex; align-items: flex-end; width: var(--name-w); padding: 8px 14px; background: #fff; border-right: 1px solid var(--line); font-size: 13px; font-weight: 500; color: var(--ink-3); }
.g-scale { position: relative; flex: none; height: 48px; }
.g-month { position: absolute; top: 0; height: 24px; border-left: 1px solid var(--line); font-size: 12.5px; font-weight: 500; line-height: 1.4; white-space: nowrap; }
/* L'etichetta del mese resta visibile mentre si scorre il diagramma. */
.g-month span { position: sticky; left: var(--name-w); display: inline-block; padding: 4px 8px 0; }
.g-month span::first-letter { text-transform: uppercase; }
.g-unit { position: absolute; top: 24px; height: 24px; border-left: 1px solid var(--line-2); font-size: 11.5px; line-height: 24px; color: var(--ink-3); text-align: center; white-space: nowrap; overflow: hidden; font-variant-numeric: tabular-nums; }
.g-unit.is-off { background: var(--bg); }
.g-unit.is-today { background: var(--ink); color: #fff; font-weight: 700; border-left-color: var(--ink); }
.g-body { position: relative; }
.g-grid { position: absolute; top: 0; bottom: 0; left: var(--name-w); right: 0; pointer-events: none; }
/* Il bordo di riga sta sulle celle, così la colonna dei nomi copre del tutto ciò che le scorre sotto. */
.g-row { position: relative; display: flex; height: var(--row); }
.g-name { position: sticky; left: 0; z-index: 4; flex: none; display: flex; align-items: center; gap: 8px; width: var(--name-w); min-width: 0; padding: 0 12px 0 14px; border: 0; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line-2); background: #fff; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.g-row:hover .g-name { background: var(--blue-t1); }
.g-name.is-child { padding-left: 38px; }
.g-name-text { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.g-row.is-phase .g-name-text { font-weight: 700; }
.g-row.is-phase .g-name, .g-row.is-phase { background: var(--bg); }
.g-toggle { flex: none; display: grid; place-items: center; width: 24px; height: 24px; margin-left: -6px; border-radius: 50%; color: var(--ink-3); }
.g-toggle .ic { width: 16px; height: 16px; transition: transform .15s; }
.g-row:not(.is-collapsed) .g-toggle .ic { transform: rotate(90deg); }
.g-kind { flex: none; color: var(--ink-3); }
.g-mat { flex: none; display: inline-flex; color: var(--blue); }
.g-avatars { flex: none; display: flex; padding-left: 6px; }
.g-avatars .avatar { width: 24px; height: 24px; margin-left: -6px; border: 2px solid #fff; font-size: 9.5px; box-sizing: content-box; }
.g-pct { flex: none; min-width: 34px; font-size: 12px; color: var(--ink-3); text-align: right; font-variant-numeric: tabular-nums; }
.g-row.is-late .g-pct { color: var(--bad); font-weight: 700; }
.g-track { position: relative; flex: none; border-bottom: 1px solid var(--line-2); }
.g-bar { --c: var(--blue); position: absolute; top: calc((var(--row) - 24px) / 2); height: 24px; min-width: 6px; border-radius: 6px; background: var(--blue-t2); cursor: pointer; }
@supports (color: color-mix(in srgb, red 50%, blue)) { .g-bar { background: color-mix(in srgb, var(--c) 26%, #fff); } }
.g-bar-fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 6px; background: var(--c); pointer-events: none; }
.g-bar.is-late { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--bad); }
.g-bar.is-moving { opacity: .82; box-shadow: var(--shadow-pop); cursor: grabbing; z-index: 5; }
.g-bar.is-draggable { cursor: grab; }
.g-handle { position: absolute; top: 0; bottom: 0; width: 10px; cursor: ew-resize; }
.g-handle.is-l { left: -3px; }
.g-handle.is-r { right: -3px; }
.g-phase { position: absolute; top: calc((var(--row) - 12px) / 2); height: 12px; background: var(--ink); clip-path: polygon(0 0, 100% 0, 100% 100%, calc(100% - 7px) 50%, 7px 50%, 0 100%); cursor: pointer; }
.g-phase-fill { position: absolute; left: 0; top: 0; height: 50%; background: var(--cyan); }
.g-mile { --c: var(--ink); position: absolute; top: calc((var(--row) - 20px) / 2); width: 20px; height: 20px; border-radius: 4px; background: #fff; border: 3px solid var(--c); transform: rotate(45deg); cursor: pointer; }
.g-mile.is-done { background: var(--c); }
.g-mile.is-late { border-color: var(--bad); }
.g-mile-label { position: absolute; top: 50%; transform: translateY(-50%); font-size: 12.5px; color: var(--ink-2); white-space: nowrap; pointer-events: none; }
.g-today { position: absolute; top: 0; bottom: 0; z-index: 3; width: 2px; margin-left: -1px; background: var(--ink); pointer-events: none; }
.g-links { position: absolute; top: 0; left: var(--name-w); z-index: 2; pointer-events: none; overflow: visible; }
.g-links path { fill: none; stroke: var(--ink-3); stroke-width: 1.5; }
.g-links path.is-bad { stroke: var(--bad); }
.g-links .g-arrow { fill: var(--ink-3); stroke: none; }
.g-links .g-arrow.is-bad { fill: var(--bad); }
.gantt-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 12px; font-size: 12.5px; color: var(--ink-3); }
.gantt-legend span { display: inline-flex; align-items: center; gap: 6px; }
.gantt-legend .ic { color: var(--blue); }
.lg { display: inline-block; width: 22px; height: 10px; border-radius: 3px; }
.lg-bar { background: var(--blue-t2); }
.lg-done { background: var(--blue); }
.lg-late { background: var(--blue-t2); box-shadow: 0 0 0 2px var(--bad); }
.lg-mile { width: 10px; height: 10px; border-radius: 2px; border: 2px solid var(--ink); transform: rotate(45deg); }
.lg-today { width: 2px; height: 14px; border-radius: 0; background: var(--ink); }
@media (max-width: 759px) {
    .gantt { --name-w: 136px; --row: 44px; }
    .g-avatars, .g-pct, .g-mat, .g-mile-label, .gantt-legend .lg-mat { display: none; }
    .g-name { padding-left: 10px; padding-right: 8px; font-size: 13px; line-height: 1.2; }
    .g-name-text { white-space: normal; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; }
    .g-name.is-child { padding-left: 20px; }
    .g-corner { padding-left: 10px; }
    .gantt-tools .toolbar-space { flex-basis: 100%; height: 0; }
    .gantt-tools .btn-primary { flex: 1; }
}

/* ------------------------------------------------------------------------------------------
   Ruoli e permessi
   ------------------------------------------------------------------------------------------ */
.role-pills { display: none; gap: 8px; margin-bottom: 12px; overflow-x: auto; scrollbar-width: none; }
.pill { flex: none; padding: 8px 15px; border: 1px solid var(--line-s); border-radius: 99px; background: #fff; font-weight: 500; white-space: nowrap; cursor: pointer; }
.pill.is-active { background: var(--blue); border-color: var(--blue); color: var(--on-blue); }
.matrix-wrap { max-height: calc(100vh - 250px); max-height: calc(100dvh - 250px); min-height: 320px; overflow: auto; -webkit-overflow-scrolling: touch; }
.matrix { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14.5px; }
.matrix th, .matrix td { padding: 7px 14px; border-bottom: 1px solid var(--line-2); text-align: center; }
.matrix thead th { position: sticky; top: 0; z-index: 3; min-width: 156px; padding-top: 12px; padding-bottom: 10px; background: #fff; border-bottom: 2px solid var(--blue); vertical-align: bottom; font-weight: 400; }
.matrix th:first-child { position: sticky; left: 0; z-index: 2; min-width: 250px; background: #fff; text-align: left; font-weight: 400; border-right: 1px solid var(--line-2); }
.matrix thead th:first-child { z-index: 4; color: var(--ink-3); font-size: 13px; font-weight: 500; }
.matrix-role-name { display: block; font-size: 15px; font-weight: 700; }
.matrix-role-meta { display: flex; align-items: center; justify-content: center; gap: 4px; font-size: 12.5px; color: var(--ink-3); }
.matrix-role-tools { display: flex; justify-content: center; gap: 12px; margin-top: 2px; font-size: 12.5px; }
.matrix-group th, .matrix-group td, .matrix .matrix-group th:first-child { background: var(--blue-t1); font-size: 13.5px; }
.matrix .matrix-group th:first-child { font-weight: 700; color: var(--blue-dd); }
.matrix-group .link { font-size: 12.5px; font-weight: 400; }
.tick { position: relative; display: inline-grid; place-items: center; width: 32px; height: 32px; }
.tick input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; margin: 0; cursor: pointer; }
.tick span { display: grid; place-items: center; width: 24px; height: 24px; border: 1.5px solid var(--line-s); border-radius: 7px; background: #fff; color: transparent; }
.tick span .ic { width: 16px; height: 16px; stroke-width: 2.8; }
.tick input:checked + span { background: var(--blue); border-color: var(--blue); color: var(--on-blue); }
.tick input:disabled { cursor: default; }
.tick input:disabled + span { opacity: .45; }
.tick input:focus-visible + span { outline: 3px solid var(--blue); outline-offset: 2px; }
@media (max-width: 759px) {
    .role-pills { display: flex; }
    .matrix-wrap { max-height: none; overflow: visible; }
    .matrix [data-role].is-hidden { display: none; }
    .matrix th:first-child { min-width: 0; position: static; }
    .matrix thead th { position: static; min-width: 0; }
    .matrix th, .matrix td { padding-left: 12px; padding-right: 12px; }
}
.save-bar { position: sticky; bottom: 0; z-index: 20; display: flex; align-items: center; justify-content: flex-end; gap: 14px; flex-wrap: wrap; margin-top: 12px; padding: 12px 0; background: linear-gradient(to top, var(--bg) 72%, transparent); }
.form-actions-bar { padding-top: 4px; }
@media (max-width: 1023px) { .save-bar { bottom: calc(56px + env(safe-area-inset-bottom)); } }

.perm-row { display: flex; align-items: center; justify-content: space-between; gap: 8px 14px; flex-wrap: wrap; padding: 9px 0; border-top: 1px solid var(--line-2); }
.perm-name { flex: 1 1 220px; display: flex; flex-direction: column; min-width: 0; }
.perm-name small { font-size: 12.5px; color: var(--ink-3); }
.perm-row.is-granted .perm-name small { color: var(--ok); }
.tri { display: inline-flex; padding: 3px; gap: 2px; border-radius: 99px; background: var(--blue-t1); }
.tri label { position: relative; }
.tri input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; margin: 0; cursor: pointer; }
.tri span { display: block; padding: 5px 12px; border-radius: 99px; font-size: 13px; font-weight: 500; color: var(--ink-2); white-space: nowrap; }
.tri input:checked + span { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(0, 28, 45, .16); }
.tri .tri-allow input:checked + span { background: var(--ok); color: #fff; }
.tri .tri-deny input:checked + span { background: var(--bad); color: #fff; }
.tri input:focus-visible + span { outline: 3px solid var(--blue); outline-offset: 1px; }

/* ------------------------------------------------------------------------------------------
   Personalizzazione
   ------------------------------------------------------------------------------------------ */
.settings-layout { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(280px, 1fr); gap: 16px; align-items: start; }
.settings-side { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
@media (max-width: 979px) { .settings-layout { grid-template-columns: minmax(0, 1fr); } }
@media (min-width: 980px) { .settings-side { position: sticky; top: 16px; } }
.logo-card { display: flex; align-items: center; gap: 14px; padding-top: 14px; border-top: 1px solid var(--line-2); }
/* I loghi sempre su fondo bianco, anche nell'anteprima. */
.logo-plate { flex: none; display: grid; place-items: center; width: 132px; height: 76px; padding: 10px; border: 1px solid var(--line); border-radius: var(--r-sm); background: #fff; }
.logo-plate img { display: block; width: auto; height: auto; max-width: 100%; max-height: 54px; object-fit: contain; }
.logo-card-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.logo-card-body .muted { font-size: 13px; }
.logo-card-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.logo-card-actions form { margin: 0; }
.preview-row { display: flex; gap: 8px; flex-wrap: wrap; }

.text-section > summary { margin-bottom: 0; cursor: pointer; list-style: none; }
.text-section > summary::-webkit-details-marker { display: none; }
.text-section[open] > summary { margin-bottom: 6px; }
.text-section + .text-section { margin-top: 12px; }
.text-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: 6px 18px; align-items: start; padding: 10px 0; border-top: 1px solid var(--line-2); }
.text-default { padding-top: 9px; color: var(--ink-2); }
.text-default small { display: block; margin-top: 2px; font-size: 12px; color: var(--ink-3); }
.text-edit { display: flex; align-items: flex-start; gap: 6px; }
.text-edit textarea.input { min-height: 64px; }
.text-row.is-changed .input { border-color: var(--blue); background: var(--blue-t1); }
@media (max-width: 719px) { .text-row { grid-template-columns: minmax(0, 1fr); } .text-default { padding-top: 0; } }

/* ------------------------------------------------------------------------------------------
   Accesso, installazione, errori
   ------------------------------------------------------------------------------------------ */
body.auth { background: #fff; }
.auth-wrap { display: grid; grid-template-columns: minmax(0, 500px) minmax(0, 1fr); min-height: 100vh; min-height: 100dvh; }
.auth-panel { display: flex; flex-direction: column; justify-content: center; gap: 22px; padding: clamp(28px, 6vw, 68px); padding-top: calc(clamp(28px, 6vw, 68px) + env(safe-area-inset-top)); background: #fff; }
.auth-logo { display: block; width: min(290px, 80%); height: auto; margin-bottom: 8px; }
.auth-form { display: flex; flex-direction: column; gap: 16px; }
.auth-title { font-size: 38px; line-height: 1; }
.auth-sub { margin-top: -8px; color: var(--ink-3); }
.auth-foot { font-size: 12.5px; color: var(--ink-3); }
.auth-panel .alert { margin-bottom: 0; }
.auth-art {
    position: relative; display: flex; flex-direction: column; justify-content: center; gap: 44px; padding: clamp(28px, 6vw, 84px); overflow: hidden;
    color: var(--on-blue); background-color: var(--blue);
    background-image:
        linear-gradient(rgba(255, 255, 255, .11) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .11) 1px, transparent 1px),
        linear-gradient(rgba(255, 255, 255, .05) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .05) 1px, transparent 1px);
    background-size: 120px 120px, 120px 120px, 24px 24px, 24px 24px;
}
.auth-headline { max-width: 13ch; font-size: clamp(36px, 4.6vw, 66px); line-height: 1.03; text-wrap: balance; }
.auth-lead { max-width: 40ch; margin-top: 16px; font-size: 17px; opacity: .94; }
.auth-drawing { display: block; width: 100%; max-width: 640px; height: auto; }
@media (max-width: 899px) {
    .auth-wrap { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
    .auth-art { order: -1; padding: 18px 24px; padding-top: calc(18px + env(safe-area-inset-top)); background-size: 96px 96px, 96px 96px, 24px 24px, 24px 24px; }
    .auth-art-text { display: none; }
    .auth-drawing { width: auto; height: 84px; margin: 0 auto; }
    .auth-panel { justify-content: flex-start; padding-top: 30px; }
}
.error-page { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; min-height: 100vh; min-height: 100dvh; padding: 24px; text-align: center; }
.error-code { font-size: 104px; line-height: 1; color: var(--blue-t3); }
.error-text { max-width: 50ch; margin-bottom: 10px; color: var(--ink-2); }

.install { max-width: 720px; margin: 0 auto; padding: clamp(20px, 5vw, 56px) 20px 64px; }
.install-logo { display: block; width: min(300px, 80%); height: auto; margin-bottom: 26px; }
.install h1 { margin-bottom: 6px; }
.install .panel { margin-top: 18px; }
.steps { display: flex; gap: 8px; flex-wrap: wrap; margin: 18px 0 4px; padding: 0; list-style: none; counter-reset: step; }
.steps li { counter-increment: step; display: flex; align-items: center; gap: 8px; padding: 6px 14px 6px 6px; border-radius: 99px; background: var(--blue-t1); color: var(--ink-2); font-size: 13.5px; font-weight: 500; }
.steps li::before { content: counter(step); display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: #fff; color: var(--blue-dd); font-weight: 700; }
.steps li.is-active { background: var(--blue); color: var(--on-blue); }
.steps li.is-done::before { background: var(--ok); color: #fff; }
.codebox { padding: 12px 14px; border-radius: var(--r-sm); background: var(--ink); color: #e6f4f9; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }

/* ------------------------------------------------------------------------------------------
   Preferenze di movimento e stampa
   ------------------------------------------------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
@media print {
    body { background: #fff; }
    .side, .top, .tabbar, .toolbar, .page-actions, .tabs, .toasts, .save-bar, .cartello-tools, .stock-actions { display: none !important; }
    main { max-width: none; padding: 0; }
    .gantt-scroll { max-height: none; overflow: visible; }
    .panel, .cartello, .stock-list { break-inside: avoid; }
}

/* ------------------------------------------------------------------------------------------
   Appalto: cifre in evidenza, elenco prezzi, stati di avanzamento
   ------------------------------------------------------------------------------------------ */
.figures { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 215px), 1fr)); gap: 1px; margin-bottom: 16px; border: 1px solid var(--line); border-radius: var(--r); background: var(--line); overflow: hidden; }
.figure { display: flex; flex-direction: column; gap: 4px; min-width: 0; padding: 16px 18px 15px; background: #fff; border-top: 3px solid transparent; }
.figure.is-ready { border-top-color: var(--ok); }
.figure-label { font-size: 13px; color: var(--ink-3); }
.figure-value { font-size: clamp(21px, 2.3vw, 26px); line-height: 1.15; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--ink); overflow-wrap: anywhere; }
.figure-value .muted { font-size: 17px; font-weight: 400; }
.figure-sub { font-size: 12.5px; line-height: 1.4; color: var(--ink-3); }
.figure.is-ready .figure-sub { color: var(--ok); font-weight: 500; }
.figure-bar { display: flex; align-items: center; gap: 10px; margin-top: 3px; }
.figure-bar .bar { flex: 1; height: 8px; }
.figure-bar b { font-size: 13.5px; font-variant-numeric: tabular-nums; }

.panel-head .panel-tools { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.panel-head h2 .count { margin-left: 6px; font-size: 13px; font-weight: 500; color: var(--blue-d); }
.panel-flush > .panel-head { flex-wrap: wrap; margin-bottom: 0; padding: 14px 18px; }
.panel-flush > .panel-empty { margin: 0; padding: 4px 18px 18px; }
.panel-flush > .alert-inset { margin: 0 18px 14px; }
.panel + .panel, .cols + .cols, .figures + .alert + .cols { margin-top: 16px; }
.doc-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 1px 9px 1px 7px; border: 1px solid var(--line-s); border-radius: 99px; font-size: 12px; line-height: 1.6; color: var(--ink-2); white-space: nowrap; }
.tag .ic { width: 12px; height: 12px; }
.cell-actions .menu { display: inline-block; vertical-align: middle; }

.done { display: flex; align-items: center; gap: 10px; min-width: 150px; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.done .bar { flex: none; width: 56px; }
.done small { display: block; font-size: 12px; color: var(--ink-3); }
.done.is-over .bar i { background: var(--warn); }
.done.is-over small { color: var(--warn); }
.move-btns { display: inline-flex; gap: 4px; margin-right: 4px; vertical-align: middle; }
.move-btns .btn[disabled] { opacity: .35; }
tr.is-moved td { animation: moved 0.9s ease-out; }
@keyframes moved { from { background: var(--blue-t1); } to { background: transparent; } }
@media (prefers-reduced-motion: reduce) { tr.is-moved td { animation: none; } }

.sum-list { margin: 0; padding: 12px 18px 16px; border-top: 1px solid var(--line); }
.sum-list > div { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 5px 0; font-size: 14.5px; }
.sum-list dt { color: var(--ink-2); }
.sum-list dd { margin: 0; white-space: nowrap; font-variant-numeric: tabular-nums; }
.sum-list .is-total { margin-top: 4px; padding-top: 9px; border-top: 1px solid var(--line); font-weight: 600; }
.sum-list .is-total dt { color: var(--ink); }
.sum-list .is-warn { color: var(--warn); }
.sum-list .is-warn dt { color: inherit; }
.sum-list-side { padding: 0; border-top: 0; }

.sal-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: start; margin-bottom: 16px; }
.sal-side { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: 16px; align-items: start; }
.sal-side .panel + .panel { margin-top: 0; }
@media (min-width: 1680px) { .sal-layout { grid-template-columns: minmax(0, 1fr) 360px; } .sal-side { grid-template-columns: minmax(0, 1fr); } }
.qty-edit { display: inline-flex; flex-direction: column; align-items: flex-end; gap: 3px; max-width: 100%; }
.qty-edit .input { width: 118px; text-align: right; font-variant-numeric: tabular-nums; }
.qty-edit small, .over-note { display: block; max-width: 190px; font-size: 12px; line-height: 1.35; color: var(--ink-3); white-space: normal; text-align: right; }
.sal-lines tr.is-over td:nth-child(6) b, .over-note { color: var(--warn); }
.save-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; margin-top: 16px; }
.save-actions h2 { margin: 0 0 4px; font-size: 16px; }
.save-actions p { margin: 0; max-width: 62ch; }
.save-actions-buttons { display: flex; flex-wrap: wrap; gap: 10px; }
.page-sub .badge { margin-left: 8px; vertical-align: 1px; }
@media (max-width: 559px) {
    .panel-head .panel-tools { justify-content: flex-start; width: 100%; }
    .save-actions-buttons, .save-actions-buttons .btn { width: 100%; }
    /* Nelle schede il campo della quantità va sotto la sua etichetta e prende tutta la larghezza. */
    .table-stack td.cell-edit { display: flex; flex-direction: column; text-align: left; }
    .table-stack td.cell-edit::before { float: none; margin: 0 0 5px; }
    .qty-edit { width: 100%; align-items: stretch; }
    .qty-edit .input { width: 100%; }
    .qty-edit small { max-width: none; text-align: left; }
}
/* L'elenco prezzi ha sette colonne: tra 862 e 1260 px le stringe invece di far scorrere il riquadro. */
@media (max-width: 1260px) {
    .price-list th { white-space: normal; }
    .price-list .cell-wide { min-width: 180px; }
    .price-list .done { min-width: 112px; gap: 8px; }
    .price-list .done .bar { width: 40px; }
    .price-list .move-btns { gap: 2px; }
}

/* ------------------------------------------------------------------------------------------
   Macro-categorie e funzioni proprie
   ------------------------------------------------------------------------------------------ */
.section-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; margin: 26px 0 12px; }
.section-head h2 { font-size: 19px; font-weight: 700; }
.section-head p { margin: 2px 0 0; font-size: 13.5px; max-width: 70ch; }
.row-open { color: inherit; text-decoration: none; }
.row-open:hover strong .badge { text-decoration: underline; }
li.is-off .row-main { opacity: .62; }
.fn-list { display: grid; gap: 16px; }
.fn-list > .panel + .panel { margin-top: 0; }
.fn-title { min-width: 0; flex: 1 1 260px; }
.fn-title h2 { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.fn-title p { margin: 3px 0 0; font-size: 13.5px; }
.fn-items { border-top: 1px solid var(--line); }
.fn-n, .step-n { flex: none; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--blue-t1); color: var(--blue-dd); font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums; }

.iter-total { display: flex; align-items: center; gap: 18px; margin-bottom: 16px; }
.iter-pct { font-family: var(--display); font-weight: var(--display-weight); font-size: 40px; line-height: 1; letter-spacing: var(--display-track); color: var(--blue-dd); font-variant-numeric: tabular-nums; }
.iter-total.is-done .iter-pct { color: var(--ok); }
.iter-body { flex: 1; min-width: 0; }
.iter-body p { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 16px; margin: 0 0 8px; font-weight: 600; }
.iter-body p span + span { font-weight: 400; font-size: 13.5px; color: var(--ink-3); }
.iter-total.is-done .bar i { background: var(--ok); }
.steps-list { counter-reset: none; }
.step { display: flex; align-items: flex-start; gap: 14px; padding: 14px 18px; }
.step-n .ic { width: 15px; height: 15px; }
.step.is-done .step-n { background: var(--ok-bg); color: var(--ok); }
.step.is-doing .step-n { background: var(--warn-bg); color: var(--warn); }
.step.is-na .step-main > strong { color: var(--ink-3); text-decoration: line-through; }
.step-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.step-main .muted { font-size: 13px; }
.step-notes { margin: 6px 0 0; padding: 8px 12px; border-left: 3px solid var(--line-s); background: var(--bg); border-radius: 0 var(--r-sm) var(--r-sm) 0; font-size: 14px; overflow-wrap: anywhere; }
.step-side { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; max-width: 46%; text-align: right; }
.step-tools { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.file-list { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 4px; }
.file-list li { display: flex; align-items: center; gap: 10px; min-width: 0; font-size: 14px; }
.file-link { display: inline-flex; align-items: center; gap: 6px; min-width: 0; font-weight: 500; color: var(--blue-d); }
.file-link span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-list .muted { flex: none; font-size: 12.5px; }
.file-list .btn-icon { flex: none; width: 30px; height: 30px; }
/* Righe con i pulsanti + e −: sui telefoni il testo occupa tutta la riga e i comandi vanno sotto. */
@media (max-width: 599px) {
    .row-wrap { flex-wrap: wrap; }
    .row-wrap > .row-main { flex-basis: calc(100% - 40px); }
    .row-wrap > .row-open { flex-basis: 100%; }
    .row-wrap > .row-tools { margin-left: auto; }
}
.segmented-wrap { flex-wrap: wrap; }
.segmented-wrap label { flex: 1 1 auto; }
.narrow-form { max-width: 720px; }
.iters .row-pct { flex: none; display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.iters .row-pct .bar { width: 90px; }
.iters { margin-bottom: 16px; }
@media (max-width: 699px) {
    .step { flex-wrap: wrap; }
    .step-main { flex-basis: calc(100% - 40px); }
    .step-side { max-width: none; width: 100%; padding-left: 40px; flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: space-between; text-align: left; }
    .iter-total { gap: 12px; }
    .iter-pct { font-size: 32px; }
    .iters .row-pct .bar { width: 56px; }
}

/* ------------------------------------------------------------------------------------------
   Tocco: bersagli comodi per il dito e testo dei campi che non fa ingrandire la pagina su iPhone
   ------------------------------------------------------------------------------------------ */
.menu-pop { max-width: calc(100vw - 16px); }
.menu-pop button, .menu-pop a { white-space: normal; }
@media (pointer: coarse) {
    .switch { min-height: 40px; align-items: center; }
    .switch-text { padding-top: 0; }
    .segmented-sm span { padding-top: 9px; padding-bottom: 9px; }
    button.link, a.link.is-action { display: inline-block; padding: 9px 6px; margin: -9px -6px; }
    .file-list .btn-icon { width: 38px; height: 38px; }
    .text-section > summary, .fold > summary { min-height: 40px; }
    .pill { padding-top: 9px; padding-bottom: 9px; }
    .side-user-links a, .side-user-links button { min-height: 40px; }
}
@media (max-width: 480px), (pointer: coarse) {
    textarea.input, .input-code, select.input, input.input { font-size: 16px; }
}
/* Schermi molto stretti: i pulsanti della testata vanno a capo anche dentro il testo, le coppie etichetta-valore si impilano. */
@media (max-width: 480px) {
    .page-actions { flex-wrap: wrap; }
    .page-actions .btn { white-space: normal; text-align: left; height: auto; padding-top: 9px; padding-bottom: 9px; max-width: 100%; }
}
@media (max-width: 380px) {
    .kv > div, .kv-wide > div { grid-template-columns: minmax(0, 1fr); gap: 2px; }
    .kv dd .badge { white-space: normal; }
}

/* ------------------------------------------------------------------------------------------
   DPIA: documento generato dal modello, modulo con i dati dell'ente, siti di ripresa
   ------------------------------------------------------------------------------------------ */
.dpia-doc { display: flex; align-items: center; justify-content: space-between; gap: 16px 24px; flex-wrap: wrap; margin-bottom: 16px; border-left: 4px solid var(--blue); }
.dpia-doc-text { flex: 1 1 320px; min-width: 0; }
.dpia-doc-text h2 { margin: 0 0 4px; font-size: 16.5px; }
.dpia-doc-text p { margin: 0; max-width: 70ch; }
.dpia-doc-text .note { margin-top: 4px; }
.dpia-doc-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.dpia-form > fieldset { margin: 0; }
.dpia-form fieldset[disabled] .input { background: var(--bg, #f6f8fa); color: var(--ink-2); }
.dpia-save { display: flex; justify-content: flex-end; }
.dpia-image-now { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.dpia-image-now img { display: block; max-width: 100%; height: auto; padding: 6px; border: 1px solid var(--line); border-radius: var(--r-sm); background: #fff; }
.dpia-image-stemma img { max-height: 96px; width: auto; }
.dpia-image-cartello img { max-height: 220px; width: auto; }
.check-inline { display: inline-flex; align-items: center; gap: 9px; min-height: 36px; cursor: pointer; }
.check-inline input { flex: none; width: 18px; height: 18px; margin: 0; accent-color: var(--blue); }
.site-rows { display: flex; flex-direction: column; gap: 10px; }
.site-rows:empty { display: none; }
/* Ogni sito è una scheda che va a capo da sola: su telefono i campi si impilano, su schermo largo stanno in riga. */
.site-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-sm); background: #fff; }
.site-n { flex: 0 0 26px; align-self: flex-end; padding-bottom: 10px; font-weight: 700; color: var(--ink-3); text-align: center; font-variant-numeric: tabular-nums; }
.mini { display: flex; flex-direction: column; gap: 4px; min-width: 0; font-size: 12.5px; color: var(--ink-3); }
.site-id { flex: 0 1 104px; }
.site-name { flex: 1 1 240px; }
.site-count { flex: 0 1 74px; }
.site-count .input { text-align: center; }
.site-keep { flex: 0 1 136px; }
.site-tools { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.site-tools .move-btns { margin-right: 0; }
.site-flags { flex: 0 0 100%; display: flex; flex-wrap: wrap; gap: 6px; }
.site-flags .check-chip span { min-height: 36px; padding: 4px 12px; font-size: 13.5px; font-weight: 400; }
@media (max-width: 559px) {
    .dpia-doc-actions, .dpia-doc-actions .btn, .dpia-save .btn { width: 100%; }
    .site-id { flex: 1 1 84px; }
    .site-name { flex: 1 1 100%; order: 1; }
    .site-count, .site-keep, .site-tools, .site-flags { order: 2; }
    .site-count { flex: 1 1 60px; }
    .site-keep { flex: 1 1 130px; }
}
