/* ==================================================================
   DMC Suite — Foglio di stile (basato sul framework CPANEL Tuscany Cloud)
   Colore brand da --brand (blu Tuscany Cloud). Desktop + mobile.
   ================================================================== */

:root{
    --brand: #16638d;
    --brand-2: #1f7fb0;
    --bg: #eef1f5;
    --panel: #ffffff;
    --ink: #1f2937;
    --muted: #6b7280;
    --line: #e5e7eb;
    --ok: #059669;
    --warn: #d97706;
    --danger: #dc2626;
    --topbar-h: 60px;
    --sidenav-w: 265px;
}

*{ box-sizing:border-box; font-family:'Segoe UI','Helvetica Neue',Arial,sans-serif; }
html,body{ margin:0; padding:0; }
body.app-body{ background:var(--bg); color:var(--ink); }
a{ text-decoration:none; color:inherit; }

/* ---------- LOGIN ---------- */
.login-body{
    background:linear-gradient(135deg,var(--brand),#0f2942);
    min-height:100vh; display:flex; align-items:center; justify-content:center;
    margin:0; padding:20px;
}
.login-card{
    background:#fff; width:100%; max-width:380px; border-radius:14px;
    padding:34px 30px; box-shadow:0 20px 50px rgba(0,0,0,.3);
}
.login-logo{ text-align:center; font-size:22px; font-weight:800; color:var(--brand); margin-bottom:24px; }
.login-logo i{ display:block; font-size:40px; margin-bottom:8px; }
.fld{ display:flex; align-items:center; border:1px solid var(--line); border-radius:9px; margin-bottom:14px; padding:0 12px; position:relative; }
.fld span{ color:var(--muted); width:22px; }
.fld input{ border:none; outline:none; padding:13px 8px; width:100%; font-size:15px; background:transparent; }
.toggle-eye{ color:var(--muted); cursor:pointer; padding:6px; }
.remember{ display:flex; align-items:center; gap:8px; font-size:13px; color:var(--muted); margin-bottom:18px; }
.btn-login{ width:100%; background:var(--brand); color:#fff; border:none; padding:13px; border-radius:9px; font-size:16px; font-weight:600; cursor:pointer; transition:.15s; }
.btn-login:hover{ background:var(--brand-2); }
.login-error{ background:#fee2e2; color:#991b1b; border-left:4px solid var(--danger); padding:10px 12px; border-radius:6px; font-size:13px; margin-bottom:16px; }
.login-recover{ text-align:center; margin-top:16px; font-size:13px; }
.login-recover a{ color:var(--brand-2); }
.login-footer{ position:fixed; bottom:12px; width:100%; text-align:center; color:rgba(255,255,255,.7); font-size:12px; }

/* ---------- TOPBAR ---------- */
.topbar{
    position:fixed; top:0; left:0; width:100%; height:var(--topbar-h); z-index:1000;
    background:linear-gradient(120deg,var(--brand),var(--brand-2));
    display:flex; align-items:center; justify-content:space-between; padding:0 18px; color:#fff;
}
.topbar-logo{ display:flex; align-items:center; gap:10px; font-size:18px; font-weight:700; color:#fff; }
.topbar-logo i{ font-size:24px; }
.topbar-right{ display:flex; align-items:center; gap:14px; }
.topbar-user{ font-size:14px; } .topbar-user small{ opacity:.85; }
.topbar-btn{ color:#fff; background:rgba(255,255,255,.15); width:38px; height:38px; border-radius:8px; display:inline-flex; align-items:center; justify-content:center; transition:.15s; }
.topbar-btn:hover{ background:#fff; color:var(--brand); }

/* ---------- SIDENAV ---------- */
.sidenav{
    position:fixed; top:var(--topbar-h); left:0; width:var(--sidenav-w); height:calc(100% - var(--topbar-h));
    background:#f9fafb; border-right:1px solid var(--line); padding:18px 0; overflow-y:auto; box-shadow:5px 0 10px -8px #afafaf;
}
.menu-group-label{ padding:12px 20px 4px; font-size:12px; font-weight:700; color:var(--muted); text-transform:uppercase; letter-spacing:.5px; border-top:1px solid var(--line); margin-top:8px; }
.menu-group-label:first-of-type{ border-top:none; margin-top:0; }
.menu-item{ display:flex; align-items:center; gap:12px; padding:9px 20px; font-size:14px; color:var(--ink); transition:.15s; }
.menu-item i{ width:22px; text-align:center; color:var(--muted); font-size:16px; }
.menu-item:hover{ background:#eceef1; }
.menu-item.active{ background:#fff; font-weight:700; box-shadow:inset 4px 0 0 var(--brand); }
.menu-item.active i,.menu-item.active span{ color:var(--brand); }

/* ---------- CONTENT ---------- */
.content{ margin-left:var(--sidenav-w); padding:calc(var(--topbar-h) + 20px) 26px 60px; }
.page-title{ font-size:22px; font-weight:800; margin:0 0 18px; display:flex; align-items:center; gap:10px; }
.page-title i{ color:var(--brand); }

/* ---------- CARDS ---------- */
.cards{ display:grid; grid-template-columns:repeat(auto-fit,minmax(180px,1fr)); gap:16px; margin-bottom:26px; }
.card{ background:var(--panel); border:1px solid var(--line); border-radius:12px; padding:20px; text-align:center; transition:.15s; }
.card:hover{ transform:translateY(-3px); box-shadow:0 8px 20px rgba(0,0,0,.08); }
.card i{ font-size:26px; color:var(--brand); }
.card-num{ font-size:30px; font-weight:800; margin:6px 0 2px; }
.card-lbl{ font-size:13px; color:var(--muted); }
.card-alert .card-num,.card-alert i{ color:var(--danger); }

/* ---------- PANEL / AGENDA LIST ---------- */
.panel{ background:var(--panel); border:1px solid var(--line); border-radius:12px; padding:20px; }
.panel h2{ font-size:16px; margin:0 0 14px; display:flex; align-items:center; gap:8px; }
.panel h2 i{ color:var(--brand); }
.muted{ color:var(--muted); }
.agenda-list{ list-style:none; margin:0; padding:0; }
.agenda-row{ display:flex; align-items:center; gap:14px; padding:11px 0; border-bottom:1px solid var(--line); }
.agenda-row:last-child{ border-bottom:none; }
.agenda-date{ font-weight:700; color:var(--brand); min-width:88px; }
.agenda-title{ flex:1; }
.agenda-badge{ font-size:11px; text-transform:uppercase; background:#eef2ff; color:var(--brand); padding:3px 8px; border-radius:20px; }
.agenda-row.tipo-scadenza .agenda-badge{ background:#fee2e2; color:var(--danger); }

/* ---------- BOTTONI ---------- */
.btn-primary{ background:var(--brand); color:#fff; padding:9px 16px; border-radius:8px; font-weight:600; display:inline-flex; align-items:center; gap:7px; border:none; cursor:pointer; }
.btn-primary:hover{ background:var(--brand-2); }

/* ---------- CALENDARIO ---------- */
.cal-header{ display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:12px; }
.cal-toolbar{ display:flex; align-items:center; gap:12px; flex-wrap:wrap; margin:12px 0; }
.cal-nav{ background:#374151; color:#fff; border:none; padding:8px 14px; border-radius:6px; cursor:pointer; }
.cal-nav:hover{ background:#4b5563; }
.cal-today{ background:var(--brand); color:#fff; border:none; padding:8px 14px; border-radius:6px; cursor:pointer; font-weight:600; }
.cal-range{ font-size:16px; font-weight:700; min-width:250px; text-align:center; }
.cal-switches{ margin-left:auto; display:flex; gap:16px; flex-wrap:wrap; font-size:13px; color:var(--muted); }
.cal-switches label{ display:flex; align-items:center; gap:6px; cursor:pointer; }
.cal-legend{ display:flex; gap:18px; flex-wrap:wrap; font-size:12px; color:var(--muted); margin-bottom:14px; }
.cal-legend .dot{ width:12px; height:12px; border-radius:3px; display:inline-block; margin-right:5px; vertical-align:middle; }
.dot.p-alta{ background:#fee2e2; border-left:3px solid var(--danger); }
.dot.p-media{ background:#fef3c7; border-left:3px solid var(--warn); }
.dot.p-bassa{ background:#e0f2fe; border-left:3px solid var(--brand-2); }
.dot.sc-dafare{ background:#fee2e2; border-left:3px solid var(--danger); }
.dot.sc-fatta{ background:#d1fae5; border-left:3px solid var(--ok); }

/* vista settimanale */
.cal-week{ display:flex; border:1px solid #d1d5db; border-radius:10px; overflow:hidden; min-height:520px; }
.cal-day{ flex:1; min-width:0; border-right:1px solid var(--line); display:flex; flex-direction:column; }
.cal-day:last-child{ border-right:none; }
.cal-day-h{ background:#f3f4f6; padding:12px 8px; text-align:center; border-bottom:2px solid var(--line); }
.cal-day-h.oggi{ background:#eef2ff; border-bottom-color:var(--brand); }
.cd-nome{ font-size:11px; font-weight:700; color:var(--muted); text-transform:uppercase; }
.cd-num{ font-size:22px; font-weight:800; }
.cal-day-h.oggi .cd-num{ color:var(--brand); }
.cd-mese{ font-size:11px; color:#9ca3af; }
.cal-day-b{ flex:1; padding:7px; overflow-y:auto; }

/* vista mensile */
.cal-month{ border:1px solid #d1d5db; border-radius:10px; overflow:hidden; }
.cm-hrow,.cm-row{ display:grid; grid-template-columns:repeat(7,1fr); }
.cm-hrow{ background:#f3f4f6; border-bottom:2px solid var(--line); }
.cm-hd{ padding:9px; text-align:center; font-size:11px; font-weight:700; color:var(--muted); text-transform:uppercase; border-right:1px solid var(--line); }
.cm-hd:last-child{ border-right:none; }
.cm-row{ border-bottom:1px solid var(--line); }
.cm-cell{ border-right:1px solid var(--line); padding:6px; min-height:112px; overflow:hidden; }
.cm-cell:last-child{ border-right:none; }
.cm-cell.fuori{ background:#f9fafb; }
.cm-cell.oggi{ background:#eef2ff; }
.cm-num{ font-size:14px; font-weight:700; margin-bottom:4px; }
.cm-cell.fuori .cm-num{ color:#d1d5db; }
.cm-cell.oggi .cm-num{ color:var(--brand); }

/* chip */
.chip{ border-radius:5px; padding:6px 8px; margin-bottom:5px; font-size:11px; line-height:1.35; cursor:pointer; transition:.15s; }
.chip:hover{ transform:translateX(2px); }
.chip .chip-t{ font-weight:700; }
.chip .chip-s{ color:#374151; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.chip .chip-o{ font-size:10px; color:var(--muted); }
.chip .bdg{ font-size:9px; background:var(--brand); color:#fff; border-radius:3px; padding:1px 4px; }
.chip.p-alta{ background:#fee2e2; border-left:3px solid var(--danger); }
.chip.p-media{ background:#fef3c7; border-left:3px solid var(--warn); }
.chip.p-bassa{ background:#e0f2fe; border-left:3px solid var(--brand-2); }
.chip.sc-dafare{ background:#fee2e2; border-left:3px solid var(--danger); }
.chip.sc-fatta{ background:#d1fae5; border-left:3px solid var(--ok); }

/* ---------- PAGINAZIONE ---------- */
.pgr{ display:flex; align-items:center; gap:14px; flex-wrap:wrap; margin:14px 0 4px; font-size:13px; color:var(--muted); }
.pgr-mid{ display:flex; align-items:center; gap:8px; }
.pgr-count{ font-weight:600; }
.pgr-info{ min-width:120px; text-align:center; }
.pgr-nav{ display:inline-flex; width:32px; height:32px; align-items:center; justify-content:center; border:1px solid var(--line); border-radius:8px; color:var(--brand); background:#fff; }
.pgr-nav:hover{ background:#eef2f7; }
.pgr-nav.dis{ color:#cbd5e1; border-color:var(--line); pointer-events:none; }
.pgr-perwrap{ margin-left:auto; display:flex; align-items:center; gap:6px; flex-wrap:wrap; }
.pgr-lbl{ margin-right:2px; }
.pgr-per{ display:inline-flex; padding:5px 10px; border:1px solid var(--line); border-radius:8px; color:var(--ink); background:#fff; font-weight:600; }
.pgr-per:hover{ background:#eef2f7; }
.pgr-per.on{ background:var(--brand); color:#fff; border-color:var(--brand); }
@media(max-width:700px){ .pgr-perwrap{ margin-left:0; } }

/* ---------- FOOTER ---------- */
.app-footer{ position:fixed; bottom:0; left:0; width:100%; height:26px; background:#111827; color:#fff; display:flex; align-items:center; justify-content:space-between; padding:0 16px; font-size:11px; z-index:900; }

/* ---------- MENU MOBILE (hamburger / drawer) ---------- */
/* Pulsante hamburger: nascosto su desktop, mostrato su mobile via media query */
.nav-toggle{
    display:none; background:rgba(255,255,255,.15); color:#fff; border:none;
    width:40px; height:40px; border-radius:8px; font-size:18px; cursor:pointer;
    align-items:center; justify-content:center; flex:0 0 auto;
}
.nav-toggle:hover{ background:#fff; color:var(--brand); }
/* Velo scuro dietro al drawer (solo mobile) */
.nav-backdrop{ display:none; position:fixed; inset:var(--topbar-h) 0 0 0; background:rgba(0,0,0,.42); z-index:1100; }
.nav-backdrop.show{ display:block; }
/* Blocchi presenti solo nel menu mobile (nascosti su desktop) */
.only-mobile{ display:none; }
/* transizione della sidenav per l'apertura fluida su mobile */
.sidenav{ transition:transform .22s ease; }

/* Extra del drawer mobile (intestazione utente / azienda / ricerca) */
.nav-mobile-head{ padding:14px 18px 16px; border-bottom:1px solid var(--line); background:#f3f4f6; }
.nav-mobile-head .nmh-user{ font-weight:700; font-size:15px; display:flex; align-items:center; gap:8px; }
.nav-mobile-head .nmh-user i{ color:var(--brand); }
.nav-mobile-azienda{ margin-top:10px; display:flex; align-items:center; gap:8px; background:#fff; border:1px solid var(--line); border-radius:8px; padding:6px 10px; }
.nav-mobile-azienda i{ color:var(--brand); }
.nav-mobile-azienda select{ border:none; outline:none; background:transparent; font-size:14px; font-weight:600; color:var(--ink); width:100%; }
.nav-mobile-search{ margin-top:10px; display:flex; gap:6px; }
.nav-mobile-search input{ flex:1; padding:8px 10px; border:1px solid var(--line); border-radius:8px; font-size:14px; background:#fff; }
.nav-mobile-search button{ background:var(--brand); color:#fff; border:none; border-radius:8px; padding:0 12px; cursor:pointer; }
.menu-item .menu-badge{ margin-left:auto; min-width:18px; height:18px; padding:0 5px; border-radius:10px; background:var(--danger); color:#fff; font-size:10px; font-weight:700; line-height:18px; text-align:center; }
.menu-item.active .menu-badge{ color:#fff; } /* il numero resta leggibile sulla voce attiva */

/* ---------- RESPONSIVE ---------- */
@media (max-width:900px){
    /* Topbar: mostra hamburger + logo, sposta le azioni nel drawer */
    .nav-toggle{ display:inline-flex; }
    .topbar{ padding:0 12px; gap:10px; }
    .topbar-right{ display:none; }
    .topbar-search{ display:none; }
    .topbar-logo{ font-size:16px; }
    .topbar-logo i{ font-size:20px; }

    /* Sidenav come drawer a scomparsa sopra il contenuto */
    .sidenav{ transform:translateX(-100%); z-index:1200; width:284px; max-width:86vw; box-shadow:6px 0 26px rgba(0,0,0,.28); }
    .sidenav.open{ transform:translateX(0); }
    .only-mobile{ display:block; }

    /* Contenuto a tutta larghezza, padding ridotto, niente overflow a destra */
    .content{ margin-left:0; padding:calc(var(--topbar-h) + 14px) 12px 74px; }
    .page-title{ font-size:19px; }

    /* Header di pagina (titolo + pulsante) va a capo invece di tagliarsi */
    .cal-header{ align-items:flex-start; }
    .cal-header .btn-primary{ margin-top:2px; }

    /* Le tabelle non vengono più tagliate: scorrono in orizzontale */
    .content table{ display:block; width:100%; max-width:100%; overflow-x:auto; -webkit-overflow-scrolling:touch; }
    .content table thead, .content table tbody, .content table tr{ }
    .content table td, .content table th{ white-space:nowrap; }

    /* Tessere dashboard a 2 colonne */
    .cards{ grid-template-columns:repeat(2,1fr); gap:12px; margin-bottom:18px; }
    .card{ padding:16px; }
    .card i{ font-size:22px; }
    .card-num{ font-size:24px; }

    /* Calendario: viste larghe scrollabili orizzontalmente */
    .cal-week{ overflow-x:auto; -webkit-overflow-scrolling:touch; }
    .cal-week > .cal-day{ min-width:128px; }
    .cal-month{ overflow-x:auto; -webkit-overflow-scrolling:touch; }
    .cal-month .cm-hrow, .cal-month .cm-row{ min-width:660px; }
    .cal-switches{ margin-left:0; }

    /* Footer non deve coprire i pulsanti in fondo alle liste */
    .app-footer{ font-size:10px; padding:0 10px; }
}

@media (max-width:430px){
    .cards{ grid-template-columns:1fr; }
    .topbar-logo span{ max-width:150px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
}

/* ==================================================================
   COMPONENTI DMC SUITE
   ================================================================== */
.topbar-logo .tl-sub{ font-weight:400; opacity:.85; font-size:12px; }
.page-head{ display:flex; align-items:flex-start; justify-content:space-between; gap:14px; flex-wrap:wrap; margin-bottom:14px; }
.page-head .page-title{ margin:0; }
.page-sub{ color:var(--muted); font-size:13px; margin-top:4px; display:flex; gap:10px; flex-wrap:wrap; align-items:center; }
.page-actions{ display:flex; gap:8px; flex-wrap:wrap; align-items:center; }

/* bottoni */
.btn{ display:inline-flex; align-items:center; gap:7px; padding:8px 14px; border-radius:8px; border:1px solid var(--line); background:#fff; color:var(--ink); font-size:13.5px; font-weight:600; cursor:pointer; line-height:1.2; white-space:nowrap; }
.btn:hover{ background:#f3f4f6; }
.btn-sm{ padding:5px 10px; font-size:12.5px; border-radius:7px; }
.btn-xs{ padding:3px 8px; font-size:11.5px; border-radius:6px; }
.btn-brand,.btn-primary{ background:var(--brand); color:#fff; border-color:var(--brand); }
.btn-brand:hover,.btn-primary:hover{ background:var(--brand-2); color:#fff; }
.btn-ok{ background:var(--ok); color:#fff; border-color:var(--ok); } .btn-ok:hover{ background:#047857; }
.btn-danger{ background:#fff; color:var(--danger); border-color:#fecaca; } .btn-danger:hover{ background:#fee2e2; }
.btn-dark{ background:#374151; color:#fff; border-color:#374151; } .btn-dark:hover{ background:#4b5563; }
.btn-ghost{ background:transparent; border-color:transparent; } .btn-ghost:hover{ background:#eef2f7; }
.btn[disabled]{ opacity:.5; pointer-events:none; }
.inline-form{ display:inline; margin:0; }
.ico{ display:inline-flex; width:30px; height:30px; align-items:center; justify-content:center; border-radius:7px; color:var(--muted); background:transparent; border:none; cursor:pointer; font-size:14px; }
.ico:hover{ background:#eef2f7; color:var(--brand); } .ico-danger:hover{ background:#fee2e2; color:var(--danger); }

/* messaggi */
.flash{ padding:11px 14px; border-radius:9px; margin-bottom:12px; font-size:14px; border-left:4px solid; }
.flash-ok{ background:#ecfdf5; color:#065f46; border-color:var(--ok); }
.flash-errore{ background:#fef2f2; color:#991b1b; border-color:var(--danger); }
.flash-warn{ background:#fffbeb; color:#92400e; border-color:var(--warn); }
.flash-info{ background:#eff6ff; color:#1e40af; border-color:#3b82f6; }
.alert{ padding:10px 13px; border-radius:9px; font-size:13px; margin:8px 0; display:flex; gap:9px; align-items:flex-start; }
.alert-warn{ background:#fffbeb; color:#92400e; border:1px solid #fde68a; }
.alert-danger{ background:#fef2f2; color:#991b1b; border:1px solid #fecaca; }
.alert-info{ background:#eff6ff; color:#1e40af; border:1px solid #bfdbfe; }
.alert-ok{ background:#ecfdf5; color:#065f46; border:1px solid #a7f3d0; }

/* tabelle */
.tbl{ width:100%; border-collapse:collapse; }
.tbl th{ text-align:left; font-size:11.5px; text-transform:uppercase; letter-spacing:.3px; color:var(--muted); background:#f9fafb; padding:10px 12px; border-bottom:2px solid var(--line); white-space:nowrap; }
.tbl td{ padding:10px 12px; border-bottom:1px solid var(--line); font-size:13.5px; vertical-align:middle; }
.tbl tr:last-child td{ border-bottom:none; }
.tbl tbody tr:hover td{ background:#f9fafb; }
.tbl .r, .tbl th.r{ text-align:right; } .tbl .c{ text-align:center; }
.tbl tfoot td{ font-weight:700; background:#f9fafb; border-top:2px solid var(--line); }
.tbl-compact td,.tbl-compact th{ padding:7px 9px; font-size:12.5px; }
.tbl tr.off td{ opacity:.45; text-decoration:line-through; }
.tbl tr.row-link{ cursor:pointer; }
.th-sort{ color:inherit; text-decoration:none; white-space:nowrap; }
.table-wrap{ overflow-x:auto; }
.panel.p0{ padding:0; overflow:hidden; }
.stato-bar{ border-left:4px solid transparent; }

/* badge */
.badge{ display:inline-block; font-size:11px; font-weight:700; padding:3px 9px; border-radius:20px; border:1px solid transparent; white-space:nowrap; }
.b-grey{ background:#f3f4f6; color:#4b5563; } .b-ok{ background:#dcfce7; color:#166534; } .b-warn{ background:#fef3c7; color:#92400e; }
.b-danger{ background:#fee2e2; color:#991b1b; } .b-info{ background:#e0f2fe; color:#075985; } .b-brand{ background:#e0eef6; color:var(--brand); }
.b-purple{ background:#f3e8ff; color:#6b21a8; }

/* form */
.frm{ display:grid; grid-template-columns:repeat(12,1fr); gap:12px 14px; }
.frm .s1{grid-column:span 1;} .frm .s2{grid-column:span 2;} .frm .s3{grid-column:span 3;} .frm .s4{grid-column:span 4;} .frm .s5{grid-column:span 5;}
.frm .s6{grid-column:span 6;} .frm .s7{grid-column:span 7;} .frm .s8{grid-column:span 8;} .frm .s9{grid-column:span 9;} .frm .s10{grid-column:span 10;} .frm .s11{grid-column:span 11;} .frm .s12{grid-column:span 12;}
.fg{ display:flex; flex-direction:column; gap:5px; min-width:0; }
.fg label{ font-size:12px; font-weight:700; color:#4b5563; }
.fg .help,.help{ font-size:11.5px; color:var(--muted); }
input[type=text],input[type=email],input[type=password],input[type=number],input[type=date],input[type=datetime-local],input[type=time],input[type=tel],input[type=url],input[type=search],select,textarea{
    width:100%; padding:8px 10px; border:1px solid #d1d5db; border-radius:8px; font-size:14px; background:#fff; color:var(--ink); outline:none; }
input:focus,select:focus,textarea:focus{ border-color:var(--brand-2); box-shadow:0 0 0 3px rgba(31,127,176,.15); }
input[readonly]{ background:#f9fafb; color:#4b5563; }
textarea{ min-height:84px; resize:vertical; font-family:inherit; }
select[multiple]{ min-height:110px; }
.chk{ display:inline-flex; align-items:center; gap:7px; font-size:13.5px; cursor:pointer; }
.chk input{ width:16px; height:16px; }
.form-actions{ display:flex; gap:10px; justify-content:flex-end; margin-top:16px; flex-wrap:wrap; }
.input-group{ display:flex; } .input-group > *:not(:last-child){ border-top-right-radius:0; border-bottom-right-radius:0; } .input-group > *:not(:first-child){ border-top-left-radius:0; border-bottom-left-radius:0; margin-left:-1px; }
.input-addon{ display:inline-flex; align-items:center; padding:0 10px; background:#f3f4f6; border:1px solid #d1d5db; border-radius:8px; font-size:13px; color:var(--muted); }
.num{ text-align:right; font-variant-numeric:tabular-nums; }

/* filtri */
.filters{ display:flex; gap:8px; flex-wrap:wrap; align-items:center; margin:0 0 14px; }
.filters input,.filters select{ width:auto; min-width:150px; padding:8px 10px; }
.filters .grow{ flex:1; min-width:200px; }
.toggle-chips{ display:flex; gap:6px; flex-wrap:wrap; }
.tchip{ display:inline-flex; align-items:center; gap:6px; padding:6px 11px; border-radius:20px; border:1px solid var(--line); background:#fff; font-size:12.5px; font-weight:600; color:#4b5563; cursor:pointer; }
.tchip.on{ background:var(--brand); border-color:var(--brand); color:#fff; }
.tchip .dot{ width:9px; height:9px; border-radius:50%; display:inline-block; }

/* sezioni/pannelli */
.panel{ margin-bottom:16px; }
.panel h2 .h2-actions{ margin-left:auto; display:flex; gap:6px; }
.panel h2 .btn i{ color:inherit; } /* icone dei pulsanti nel titolo: colore del pulsante */
.panel h2{ flex-wrap:wrap; }
.panel h3{ font-size:14px; margin:14px 0 8px; color:#374151; }
.grid2{ display:grid; grid-template-columns:1fr 1fr; gap:16px; }
.grid2 > *,.grid3 > *{ min-width:0; } /* le tabelle larghe scorrono dentro il pannello invece di allargare la pagina */
.grid3{ display:grid; grid-template-columns:repeat(3,1fr); gap:16px; }
.grid-side{ display:grid; grid-template-columns:minmax(0,1fr) 340px; gap:16px; align-items:start; }
.muted{ color:var(--muted); } .small{ font-size:12px; } .strong{ font-weight:700; }
.t-ok{ color:var(--ok); } .t-danger{ color:var(--danger); } .t-warn{ color:var(--warn); } .t-brand{ color:var(--brand); }
.dl{ display:grid; grid-template-columns:auto 1fr; gap:6px 14px; font-size:13.5px; } .dl dt{ color:var(--muted); } .dl dd{ margin:0; font-weight:600; min-width:0; overflow-wrap:anywhere; }
hr.sep{ border:none; border-top:1px solid var(--line); margin:14px 0; }
.empty{ text-align:center; color:var(--muted); padding:30px 10px; font-size:14px; } .empty i{ font-size:30px; opacity:.4; display:block; margin-bottom:8px; }

/* KPI */
.kpis{ display:grid; grid-template-columns:repeat(auto-fit,minmax(190px,1fr)); gap:12px; margin-bottom:16px; }
.kpi{ background:#fff; border:1px solid var(--line); border-radius:12px; padding:14px 16px; display:flex; gap:12px; align-items:center; transition:.15s; }
a.kpi:hover{ box-shadow:0 6px 16px rgba(0,0,0,.07); transform:translateY(-2px); }
.kpi-ic{ width:40px; height:40px; border-radius:10px; background:#e0eef6; color:var(--brand); display:flex; align-items:center; justify-content:center; font-size:17px; flex:0 0 auto; }
.kpi-lbl{ font-size:11.5px; color:var(--muted); text-transform:uppercase; font-weight:700; letter-spacing:.3px; }
.kpi-val{ font-size:21px; font-weight:800; font-variant-numeric:tabular-nums; }
.kpi-sub{ font-size:12px; color:var(--muted); }
.kpi.ok .kpi-ic{ background:#dcfce7; color:var(--ok); } .kpi.warn .kpi-ic{ background:#fef3c7; color:var(--warn); } .kpi.danger .kpi-ic{ background:#fee2e2; color:var(--danger); }
.kpi.danger .kpi-val{ color:var(--danger); }

/* tabs */
.tabs{ display:flex; gap:2px; border-bottom:2px solid var(--line); margin-bottom:16px; overflow-x:auto; }
.tab{ padding:10px 15px; font-size:13.5px; font-weight:700; color:var(--muted); border-bottom:3px solid transparent; margin-bottom:-2px; white-space:nowrap; cursor:pointer; background:none; border-top:none; border-left:none; border-right:none; }
.tab:hover{ color:var(--ink); } .tab.on{ color:var(--brand); border-bottom-color:var(--brand); }
.tab .cnt{ background:#eef2f7; color:#4b5563; border-radius:10px; padding:1px 7px; font-size:11px; margin-left:4px; }
.tab-pane{ display:none; } .tab-pane.on{ display:block; }

/* modal */
.modal-bg{ position:fixed; inset:0; background:rgba(17,24,39,.5); z-index:2000; display:none; align-items:flex-start; justify-content:center; padding:40px 14px; overflow-y:auto; }
.modal-bg.show{ display:flex; }
.modal{ background:#fff; border-radius:14px; width:100%; max-width:760px; box-shadow:0 20px 60px rgba(0,0,0,.3); }
.modal.lg{ max-width:1040px; } .modal.sm{ max-width:480px; }
.modal-h{ padding:15px 20px; border-bottom:1px solid var(--line); display:flex; align-items:center; gap:10px; font-weight:800; font-size:16px; }
.modal-h .x{ margin-left:auto; }
.modal-b{ padding:18px 20px; }
.modal-f{ padding:12px 20px; border-top:1px solid var(--line); display:flex; justify-content:flex-end; gap:8px; }

/* barra economica della pratica */
.econ{ display:grid; grid-template-columns:repeat(auto-fit,minmax(130px,1fr)); gap:1px; background:var(--line); border:1px solid var(--line); border-radius:12px; overflow:hidden; margin-bottom:16px; }
.econ > div{ background:#fff; padding:11px 13px; }
.econ .lbl{ font-size:10.5px; text-transform:uppercase; font-weight:700; color:var(--muted); letter-spacing:.3px; display:flex; gap:5px; align-items:center; }
.econ .val{ font-size:17px; font-weight:800; font-variant-numeric:tabular-nums; margin-top:2px; }
.econ .sub{ font-size:11px; color:var(--muted); }
.econ .hl{ background:#f0f7fb; }
.sticky-econ{ position:sticky; top:calc(var(--topbar-h) + 6px); z-index:50; }

/* righe servizi */
.svc{ border:1px solid var(--line); border-radius:11px; margin-bottom:10px; background:#fff; }
.svc.off{ opacity:.55; }
.svc-h{ display:flex; gap:12px; align-items:center; padding:11px 13px; flex-wrap:wrap; }
.svc-ic{ width:36px; height:36px; border-radius:9px; background:#e0eef6; color:var(--brand); display:flex; align-items:center; justify-content:center; flex:0 0 auto; }
.svc-t{ flex:1; min-width:220px; }
.svc-t .n{ font-weight:700; font-size:14.5px; } .svc-t .m{ font-size:12px; color:var(--muted); display:flex; gap:10px; flex-wrap:wrap; margin-top:2px; }
.svc-n{ text-align:right; min-width:90px; } .svc-n .l{ font-size:10.5px; text-transform:uppercase; color:var(--muted); font-weight:700; } .svc-n .v{ font-weight:800; font-variant-numeric:tabular-nums; }
.svc-forn{ border-top:1px dashed var(--line); padding:8px 13px 10px 61px; font-size:12.5px; }
.svc-forn .fr{ display:flex; gap:10px; align-items:center; padding:4px 0; flex-wrap:wrap; }
.svc-warn{ color:var(--danger); font-weight:700; }

/* checkerboard per prenotazioni non confermate dai fornitori */
.chk-pattern{ background-image:repeating-linear-gradient(45deg, rgba(255,255,255,.55) 0 6px, transparent 6px 12px); }

/* autocomplete */
.ac-wrap{ position:relative; }
.ac-list{ position:absolute; left:0; right:0; top:100%; background:#fff; border:1px solid var(--line); border-radius:9px; box-shadow:0 10px 26px rgba(0,0,0,.12); z-index:3000; max-height:280px; overflow-y:auto; display:none; }
.ac-list.show{ display:block; }
.ac-item{ padding:8px 11px; cursor:pointer; font-size:13.5px; border-bottom:1px solid #f3f4f6; }
.ac-item:hover,.ac-item.act{ background:#eef6fb; }
.ac-item small{ color:var(--muted); display:block; }

/* timeline/elenco compatti */
.list-plain{ list-style:none; margin:0; padding:0; }
.list-plain li{ padding:8px 0; border-bottom:1px solid var(--line); display:flex; gap:10px; align-items:flex-start; }
.list-plain li:last-child{ border-bottom:none; }

/* calendario: chip prenotazioni */
.chip.pr-ok{ background:#dcfce7; border-left:3px solid var(--ok); }
.chip.pr-wip{ background:#fef3c7; border-left:3px solid var(--warn); }
.chip.ev{ background:#e0e7ff; border-left:3px solid #4f46e5; }
.chip.dl{ background:#fee2e2; border-left:3px solid var(--danger); }
.chip.dl-done{ background:#f3f4f6; border-left:3px solid #9ca3af; color:#6b7280; }
.chip.inc{ background:#e0f2fe; border-left:3px solid var(--brand-2); }
.chip.forn{ background:#ffedd5; border-left:3px solid #ea580c; }
.chip.new{ background:#f3e8ff; border-left:3px solid #9333ea; }
.cal-day-b .sec{ font-size:10px; font-weight:800; color:var(--muted); text-transform:uppercase; margin:8px 0 4px; letter-spacing:.3px; }

/* login */
.login-tc{ text-align:center; margin-top:22px; padding-top:16px; border-top:1px solid var(--line); }
.login-tc img{ height:16px; opacity:.9; }
.login-tc div{ font-size:11px; color:var(--muted); margin-bottom:6px; }

/* responsive aggiuntivo */
@media (max-width:1100px){ .grid-side{ grid-template-columns:1fr; } }
@media (max-width:900px){
    .frm{ grid-template-columns:repeat(6,1fr); }
    .frm .s1,.frm .s2,.frm .s3{ grid-column:span 3; } .frm .s4,.frm .s5,.frm .s6,.frm .s7,.frm .s8,.frm .s9,.frm .s10,.frm .s11,.frm .s12{ grid-column:span 6; }
    .grid2,.grid3{ grid-template-columns:1fr; }
    .svc-forn{ padding-left:13px; }
    .sticky-econ{ position:static; }
    .modal-bg{ padding:10px 6px; }
}
@media print{
    .topbar,.sidenav,.app-footer,.page-actions,.no-print{ display:none !important; }
    .content{ margin:0; padding:0; }
}

/* toast */
.toast{ position:fixed; right:18px; bottom:40px; background:#065f46; color:#fff; padding:11px 16px; border-radius:9px; font-size:14px; box-shadow:0 10px 30px rgba(0,0,0,.25); z-index:5000; opacity:0; transform:translateY(10px); transition:.25s; max-width:420px; }
.toast.show{ opacity:1; transform:none; }
.toast-errore{ background:#991b1b; } .toast-info{ background:#1e40af; }
.saved{ box-shadow:0 0 0 3px rgba(5,150,105,.35) !important; border-color:var(--ok) !important; }
.rte{ border:1px solid #d1d5db; border-radius:8px; background:#fff; }
.rte-bar{ display:flex; gap:2px; padding:5px; border-bottom:1px solid var(--line); background:#f9fafb; border-radius:8px 8px 0 0; }
.rte-bar button{ border:none; background:transparent; width:30px; height:28px; border-radius:6px; cursor:pointer; color:#4b5563; }
.rte-bar button:hover{ background:#e5e7eb; }
.rte-ed{ padding:10px 12px; outline:none; font-size:14px; line-height:1.55; overflow-y:auto; max-height:420px; }
.rte-ed:focus{ box-shadow:inset 0 0 0 2px rgba(31,127,176,.2); }
.chipsel{ display:flex; flex-wrap:wrap; gap:6px; padding:6px; border:1px solid #d1d5db; border-radius:8px; background:#fff; min-height:42px; }
.chipsel-i{ border:1px solid var(--line); background:#f9fafb; color:#4b5563; border-radius:16px; padding:4px 10px; font-size:12.5px; cursor:pointer; }
.chipsel-i:hover{ border-color:var(--brand-2); }
.chipsel-i.on{ background:var(--brand); border-color:var(--brand); color:#fff; }
.chipsel-i:disabled{ cursor:default; opacity:.8; }

/* dropdown */
.dropdown{ position:relative; display:inline-block; }
.dropdown-menu{ display:none; position:absolute; top:calc(100% + 4px); left:0; background:#fff; border:1px solid var(--line); border-radius:10px; box-shadow:0 12px 30px rgba(0,0,0,.14); min-width:240px; z-index:1500; padding:6px; }
.dropdown-menu.right{ left:auto; right:0; }
.dropdown.open .dropdown-menu{ display:block; }
.dropdown-menu a{ display:flex; gap:9px; align-items:center; padding:8px 10px; border-radius:7px; font-size:13.5px; color:var(--ink); }
.dropdown-menu a:hover{ background:#f3f4f6; }
.dropdown-menu a i{ width:16px; color:var(--muted); }
/* passi del flusso */
.passi{ display:flex; flex-wrap:wrap; gap:6px; margin:-4px 0 14px; }
.passo{ font-size:11.5px; padding:4px 9px; border-radius:20px; background:#f3f4f6; color:#6b7280; font-weight:600; }
.passo.ok{ background:#dcfce7; color:#166534; }
/* tabella servizi della pratica */
.svc-num{ display:grid; grid-template-columns:repeat(5, minmax(78px,auto)); gap:4px 14px; align-items:end; }
.svc-num .l{ font-size:10px; text-transform:uppercase; color:var(--muted); font-weight:700; text-align:right; }
.svc-num .v{ font-weight:800; text-align:right; font-variant-numeric:tabular-nums; font-size:13.5px; }
.inp-money{ width:110px; text-align:right; padding:5px 8px; font-weight:700; }
.inp-sm{ padding:4px 7px; font-size:12.5px; }
.svc-forn .fr input,.svc-forn .fr select{ padding:4px 7px; font-size:12.5px; }
.svc-date{ min-width:84px; text-align:center; border-right:1px solid var(--line); padding-right:12px; }
.svc-date .d{ font-weight:800; font-size:15px; } .svc-date .m{ font-size:11px; color:var(--muted); text-transform:uppercase; }
.forn-row{ display:grid; grid-template-columns:minmax(180px,2fr) 110px 110px 150px 170px auto; gap:8px; align-items:center; padding:5px 0; border-bottom:1px dotted #eef2f7; }
.forn-row:last-child{ border-bottom:none; }
@media (max-width:1100px){ .forn-row{ grid-template-columns:1fr 1fr; } .svc-num{ grid-template-columns:repeat(3,auto); } }
input.inp-money{ width:110px; } input.inp-sm{ padding:4px 7px; font-size:12.5px; }
.forn-row input.num{ width:100%; }
