/* MF Fatture — stile ispirato agli screenshot di riferimento (docs/screenshots/) */

:root {
    --blu: #1a91da;
    --blu-scuro: #1478b8;
    --blu-chiaro: #e8f4fc;
    --verde: #27ae60;
    --verde-scuro: #1f9e54;
    --rosso: #e74c3c;
    --arancio: #f39c12;
    --testo: #2c3e50;
    --testo-muted: #8492a6;
    --bordo: #e4e9f0;
    --sfondo: #f5f7fa;
    --bianco: #ffffff;
    --radius: 8px;
    --ombra: 0 1px 3px rgba(44, 62, 80, 0.08);
    --header-h: 56px;
    --sidebar-w: 220px;
}

* { box-sizing: border-box; }

/* L'attributo hidden vince sempre sui display impostati dalle classi. */
[hidden] { display: none !important; }

html, body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    color: var(--testo);
    background: var(--sfondo);
}

a { color: var(--blu); text-decoration: none; }
a:hover { text-decoration: underline; }

h1 { font-size: 22px; font-weight: 600; margin: 0; }
h2 { font-size: 16px; font-weight: 600; margin: 0 0 14px; }
h3 { font-size: 13px; font-weight: 600; margin: 0 0 8px; color: var(--testo-muted); text-transform: uppercase; letter-spacing: 0.03em; }

.muted { color: var(--testo-muted); }

/* ---------- Header ---------- */

.topbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--header-h);
    background: var(--bianco);
    border-bottom: 1px solid var(--bordo);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    z-index: 100;
}

.topbar-left, .topbar-right { display: flex; align-items: center; gap: 10px; }

.brand { display: flex; align-items: center; gap: 8px; }
.brand:hover { text-decoration: none; }
.brand-mark {
    display: inline-flex; align-items: center; justify-content: center;
    width: 32px; height: 32px;
    background: var(--blu); color: #fff;
    font-weight: 700; font-size: 14px;
    border-radius: 7px;
}
.brand-logo { height: 30px; width: auto; display: block; }
.brand-name { font-weight: 600; font-size: 16px; color: var(--testo); }

.iconbtn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 34px; height: 34px;
    border: none; background: transparent;
    border-radius: 7px; cursor: pointer;
    color: var(--testo-muted);
    position: relative;
    padding: 0;
}
.iconbtn:hover { background: var(--sfondo); color: var(--testo); }
.iconbtn.active { background: var(--blu-chiaro); color: var(--blu); }
.iconbtn:disabled { opacity: .35; cursor: default; }
.iconbtn:disabled:hover { background: transparent; color: var(--testo-muted); }
.iconbtn svg { width: 20px; height: 20px; }

.badge-dot {
    position: absolute; top: 2px; right: 2px;
    min-width: 16px; height: 16px;
    background: var(--rosso); color: #fff;
    font-size: 10px; font-weight: 700;
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    padding: 0 4px;
}

.anno-select {
    border: 1px solid var(--bordo);
    border-radius: 7px;
    padding: 6px 8px;
    font-size: 13px; font-weight: 600;
    color: var(--blu);
    background: var(--bianco);
    cursor: pointer;
}

.hamburger {
    display: none;
    align-items: center; justify-content: center;
    width: 42px; height: 42px;
    border: none; background: transparent;
    border-radius: 8px;
    color: var(--testo);
    cursor: pointer;
    padding: 0;
}
.hamburger:hover { background: var(--sfondo); }
.hamburger svg { width: 26px; height: 26px; }

.inline-form { display: inline; margin: 0; }

/* Dropdown notifiche */
.dropdown { position: relative; }
.dropdown-menu {
    position: absolute; right: 0; top: calc(100% + 6px);
    width: 320px; max-height: 380px; overflow-y: auto;
    background: var(--bianco);
    border: 1px solid var(--bordo);
    border-radius: var(--radius);
    box-shadow: 0 6px 24px rgba(44, 62, 80, 0.14);
    z-index: 200;
}
.dropdown-head {
    display: flex; justify-content: space-between; align-items: center;
    padding: 10px 14px;
    border-bottom: 1px solid var(--bordo);
}
.dropdown-empty { padding: 18px 14px; color: var(--testo-muted); margin: 0; text-align: center; }
.dropdown-item {
    display: flex; flex-direction: column; gap: 2px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--bordo);
    color: var(--testo);
}
.dropdown-item:hover { background: var(--sfondo); text-decoration: none; }
.dropdown-item.unread { background: var(--blu-chiaro); }
.dropdown-item small { color: var(--testo-muted); }

.linklike {
    border: none; background: none; padding: 0;
    color: var(--blu); cursor: pointer; font-size: inherit;
    text-align: left;
}
.linklike:hover { text-decoration: underline; }

/* ---------- Shell ---------- */

.shell { display: flex; padding-top: var(--header-h); min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w);
    background: var(--bianco);
    border-right: 1px solid var(--bordo);
    padding: 12px 0;
    position: fixed;
    top: var(--header-h); bottom: 0; left: 0;
    overflow-y: auto;
    z-index: 90;
}
.sidebar ul { list-style: none; margin: 0; padding: 0; }
.sidebar li.sep { height: 1px; background: var(--bordo); margin: 10px 16px; }
.sidebar a {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 18px;
    color: var(--testo);
    font-weight: 500;
    border-left: 3px solid transparent;
}
.sidebar a:hover { background: var(--sfondo); text-decoration: none; }
.sidebar a.active {
    color: var(--blu);
    background: var(--blu-chiaro);
    border-left-color: var(--blu);
}
.sidebar a svg { width: 18px; height: 18px; flex-shrink: 0; color: var(--testo-muted); }
.sidebar a.active svg { color: var(--blu); }

.sidebar-overlay {
    position: fixed; inset: var(--header-h) 0 0 0;
    background: rgba(44, 62, 80, 0.4);
    z-index: 85;
}

.content {
    flex: 1;
    margin-left: var(--sidebar-w);
    padding: 22px 26px 60px;
    min-width: 0;
}

.page-head { margin-bottom: 16px; display: flex; align-items: center; justify-content: space-between; }

/* ---------- Card / tabelle ---------- */

.card {
    background: var(--bianco);
    border: 1px solid var(--bordo);
    border-radius: var(--radius);
    box-shadow: var(--ombra);
    padding: 18px 20px;
    margin-bottom: 18px;
}

/* Scorrevoli se serve, ma senza barre visibili (macOS le mostra sempre). */
.table-card { padding: 0; overflow-x: auto; scrollbar-width: none; }
.table-card::-webkit-scrollbar { display: none; }
.table-card-cespiti { overflow: visible; }
.table-card-cespiti .table { min-width: 980px; }

.table { width: 100%; border-collapse: collapse; }
.table th {
    text-align: left;
    font-size: 12px; font-weight: 600;
    color: var(--testo-muted);
    text-transform: none;
    padding: 12px 14px;
    border-bottom: 1px solid var(--bordo);
    background: #fafbfc;
    white-space: nowrap;
}
.table td {
    padding: 13px 14px;
    border-bottom: 1px solid var(--bordo);
    vertical-align: middle;
}
.table tbody tr:hover { background: #fafcfe; }
.table tbody tr[data-href] { cursor: pointer; }
.table tbody tr[data-href]:hover { background: var(--blu-chiaro); }
.table tbody tr:last-child td { border-bottom: none; }
.table-compact td, .table-compact th { padding: 8px 12px; }

.col-check { width: 36px; }
.col-actions { text-align: right; white-space: nowrap; width: 1%; }
.empty-row { text-align: center; color: var(--testo-muted); padding: 36px 14px !important; }

.table-foot {
    display: flex; justify-content: space-between; align-items: center;
    padding: 12px 14px;
    color: var(--testo-muted);
    border-top: 1px solid var(--bordo);
    background: #fafbfc;
    border-radius: 0 0 var(--radius) var(--radius);
}

/* Badge / pillole */
.pill {
    display: inline-block;
    padding: 2px 8px;
    font-size: 11px; font-weight: 600;
    border-radius: 10px;
    margin-left: 6px;
    white-space: nowrap;
}
.pill-blue { background: var(--blu); color: #fff; }
.pill-green { background: var(--verde); color: #fff; }
.pill-grey { background: var(--bordo); color: var(--testo-muted); }
.pill-yellow { background: #fff4df; color: #a66a00; }

/* ---------- Tabs ---------- */

.tabs {
    display: flex; gap: 4px;
    border-bottom: 2px solid var(--bordo);
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.tab {
    padding: 9px 16px;
    font-weight: 600;
    color: var(--testo-muted);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
}
.tab:hover { color: var(--testo); text-decoration: none; }
.tab.active { color: var(--blu); border-bottom-color: var(--blu); }

/* ---------- Toolbar ---------- */

.toolbar {
    display: flex; gap: 10px; align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.searchbox {
    flex: 1; min-width: 220px;
    display: flex; align-items: center; gap: 8px;
    background: var(--bianco);
    border: 1px solid var(--bordo);
    border-radius: var(--radius);
    padding: 0 12px;
    height: 38px;
}
.searchbox svg { width: 16px; height: 16px; color: var(--testo-muted); flex-shrink: 0; }
.searchbox input {
    flex: 1; border: none; outline: none;
    font-size: 14px; background: transparent;
    height: 100%;
}
.search-clear { color: var(--testo-muted); font-size: 18px; line-height: 1; }
.search-clear:hover { color: var(--testo); text-decoration: none; }

.cespiti-filters {
    margin: 0;
    flex: 1 1 520px;
}
.filter-select {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: 38px;
    padding: 0 10px;
    border: 1px solid var(--bordo);
    border-radius: var(--radius);
    background: var(--bianco);
    color: var(--testo-muted);
    font-size: 12px;
    font-weight: 600;
}
.filter-select select {
    border: none;
    background: transparent;
    padding: 0;
    height: auto;
    color: var(--testo);
    font-weight: 700;
    min-width: 72px;
}

/* ---------- Bottoni ---------- */

.btn {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 0 14px; height: 38px;
    background: var(--bianco);
    border: 1px solid var(--bordo);
    border-radius: var(--radius);
    font-size: 13px; font-weight: 600;
    color: var(--testo);
    cursor: pointer;
}
.btn:hover { background: var(--sfondo); text-decoration: none; }
.btn svg { width: 16px; height: 16px; }

.btn-primary { background: var(--blu); border-color: var(--blu); color: #fff; }
.btn-primary:hover { background: var(--blu-scuro); }
.btn-success { background: var(--verde); border-color: var(--verde); color: #fff; }
.btn-success:hover { background: var(--verde-scuro); }
.btn-danger-outline { color: var(--rosso); border-color: var(--rosso); background: var(--bianco); }
.btn-danger-outline:hover { background: #fdf1ef; }
.btn-danger-outline:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12px; }
.btn-block { width: 100%; justify-content: center; }

/* ---------- Form ---------- */

.form-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px 16px;
}
.form-grid label, .form-inline-row label {
    display: flex; flex-direction: column; gap: 5px;
    font-size: 12px; font-weight: 600;
    color: var(--testo-muted);
}
.span2 { grid-column: span 2; }
.span3 { grid-column: span 3; }
.subgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.dossier-parametri-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 24px; }
.dossier-parametri-grid h3 { margin: .4rem 0 .3rem; font-size: .95rem; }
@media (max-width: 720px) { .dossier-parametri-grid { grid-template-columns: 1fr; } }

input[type="text"], input[type="email"], input[type="password"], input[type="search"],
input[type="number"], input[type="date"], input[type="file"], select, textarea {
    font-family: inherit;
    font-size: 14px;
    color: var(--testo);
    border: 1px solid var(--bordo);
    border-radius: 7px;
    padding: 8px 10px;
    background: var(--bianco);
    width: 100%;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--blu);
    box-shadow: 0 0 0 3px rgba(26, 145, 218, 0.15);
}
/* Niente frecce spinner sui campi numerici: si digita direttamente. */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
.uppercase { text-transform: uppercase; }
textarea { resize: vertical; }

.checkline { flex-direction: row !important; align-items: center; gap: 8px !important; font-size: 13px !important; }
.checkline input { width: auto; }

.form-actions { margin-top: 16px; display: flex; justify-content: flex-end; gap: 10px; }
.ta-center { text-align: center; }
.input-mini { width: 70px; text-align: center; padding: 4px 6px; }
.cespite-icon { display: inline-flex; vertical-align: -3px; margin-right: 5px; color: var(--arancio, #d98a00); }
.cespite-icon svg { width: 16px; height: 16px; }
.cat-amm-table { margin-top: 16px; }
.cat-amm-table td, .cat-amm-table th { vertical-align: middle; }
.cat-guide-cell { min-width: 260px; max-width: 440px; }
.cat-fiscal-label { margin-top: 3px; font-size: 12px; color: var(--testo-muted); }
.cat-vademecum { margin-top: 6px; font-size: 12px; color: var(--testo); }
.cat-vademecum summary { cursor: pointer; color: var(--accento); font-weight: 600; }
.cat-vademecum p { margin: 5px 0 0; line-height: 1.35; color: var(--testo-muted); }
.form-inline-row { display: flex; gap: 14px; align-items: flex-end; margin-top: 14px; flex-wrap: wrap; }
.form-inline-row label { min-width: 140px; }

.form-errors {
    background: #fdf1ef;
    border: 1px solid var(--rosso);
    color: var(--rosso);
    border-radius: 7px;
    padding: 10px 12px;
    margin-bottom: 14px;
}
.form-errors ul { margin: 0; padding-left: 18px; }

/* ---------- Flash ---------- */

.flash {
    padding: 11px 14px;
    border-radius: var(--radius);
    margin-bottom: 14px;
    font-weight: 500;
}
.flash-success { background: #e9f9f0; color: var(--verde-scuro); border: 1px solid #b8ecd0; }
.flash-error { background: #fdf1ef; color: var(--rosso); border: 1px solid #f5c6bf; }

/* ---------- Modali ---------- */

.modal-backdrop {
    position: fixed; inset: 0;
    background: rgba(44, 62, 80, 0.45);
    display: flex; align-items: flex-start; justify-content: center;
    padding: 40px 16px;
    z-index: 300;
    overflow-y: auto;
}
.modal {
    background: var(--bianco);
    border-radius: 10px;
    width: 100%; max-width: 760px;
    box-shadow: 0 12px 40px rgba(44, 62, 80, 0.25);
}
.modal-head {
    display: flex; align-items: center; gap: 18px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--bordo);
}
.modal-head h2 { margin: 0; flex-shrink: 0; }
.modal-tabs { display: flex; gap: 2px; flex: 1; }
.modal-tab {
    border: none; background: none;
    padding: 8px 12px;
    font-size: 13px; font-weight: 600;
    color: var(--testo-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
}
.modal-tab.active { color: var(--blu); border-bottom-color: var(--blu); }
.modal-close {
    border: none; background: none;
    font-size: 22px; color: var(--testo-muted);
    cursor: pointer; line-height: 1;
    padding: 4px 8px;
}
.modal-close:hover { color: var(--testo); }
.modal-body { padding: 20px; max-height: 60vh; overflow-y: auto; }
.modal-foot {
    display: flex; justify-content: flex-end; gap: 10px;
    padding: 14px 20px;
    border-top: 1px solid var(--bordo);
    background: #fafbfc;
    border-radius: 0 0 10px 10px;
}

/* Import */
.import-mapping { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; margin: 14px 0; }
.import-mapping .map-row { display: flex; flex-direction: column; gap: 4px; }
.import-mapping .map-row strong { font-size: 12px; }
.import-mapping .map-row small { color: var(--testo-muted); font-style: italic; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.import-tipo { display: flex; flex-direction: column; gap: 5px; font-size: 12px; font-weight: 600; color: var(--testo-muted); max-width: 220px; }
.import-errors-list { color: var(--rosso); font-size: 13px; }

/* ---------- Impostazioni ---------- */

.settings-pane { animation: fadein 0.15s ease; }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }

.loghi-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.logo-box {
    border: 1px dashed var(--bordo);
    border-radius: var(--radius);
    padding: 16px;
    display: flex; flex-direction: column; gap: 10px; align-items: flex-start;
}
.logo-preview { max-height: 80px; max-width: 100%; border-radius: 6px; border: 1px solid var(--bordo); padding: 4px; }
.logo-upload { display: flex; gap: 8px; align-items: center; width: 100%; }
.logo-upload input[type="file"] { flex: 1; }

/* ---------- Login ---------- */

.login-page {
    display: flex; align-items: center; justify-content: center;
    min-height: 100vh;
    background: var(--sfondo);
}
.login-card {
    background: var(--bianco);
    border: 1px solid var(--bordo);
    border-radius: 12px;
    box-shadow: 0 6px 30px rgba(44, 62, 80, 0.10);
    padding: 36px;
    width: 100%; max-width: 380px;
}
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.login-brand .brand-mark { width: 42px; height: 42px; font-size: 18px; }
.login-logo { height: 40px; width: auto; display: block; }
.login-brand h1 { font-size: 20px; }
.login-card label {
    display: block;
    font-size: 12px; font-weight: 600;
    color: var(--testo-muted);
    margin: 14px 0 5px;
}
.login-card .btn { margin-top: 22px; height: 42px; }

/* ---------- Stub ---------- */

.stub-card { text-align: center; padding: 60px 20px; color: var(--testo-muted); }
.stub-icon { width: 48px; height: 48px; color: var(--bordo); margin-bottom: 8px; }
.stub-card h2 { color: var(--testo); }

/* ---------- Barra dei mesi (liste documenti) ---------- */

.mesi-bar {
    display: flex; align-items: stretch; gap: 2px;
    background: var(--bianco);
    border: 1px solid var(--bordo);
    border-radius: var(--radius);
    padding: 6px;
    margin-bottom: 16px;
    overflow-x: auto;
    scrollbar-width: none;
}
.mesi-bar::-webkit-scrollbar { display: none; }
.mese-nav {
    display: flex; align-items: center;
    padding: 0 10px;
    font-size: 12px; font-weight: 600;
    color: var(--testo-muted);
    white-space: nowrap;
}
.mese-nav:hover { color: var(--blu); text-decoration: none; }
.mese-cell {
    position: relative;
    flex: 1; min-width: 64px;
    border: none; background: transparent;
    border-radius: 6px;
    padding: 6px 4px 4px;
    cursor: pointer;
    display: flex; flex-direction: column; gap: 1px;
    font-family: inherit;
    overflow: hidden;
    text-align: center;
}
.mese-cell:hover { background: var(--sfondo); }
.mese-cell.selected { background: var(--blu-chiaro); box-shadow: inset 0 0 0 1px var(--blu); }
.mese-cell.current .mese-nome { color: var(--blu); }
.mese-histo {
    position: absolute; left: 0; right: 0; bottom: 0;
    background: rgba(26, 145, 218, 0.12);
    z-index: 0;
}
.mese-nome { font-size: 12px; font-weight: 700; color: var(--testo); z-index: 1; }
.mese-count { font-size: 10px; color: var(--testo-muted); z-index: 1; }
.mese-tot { font-size: 11px; font-weight: 600; color: var(--blu); z-index: 1; white-space: nowrap; }
.mese-tutto { align-self: center; margin-left: 6px; white-space: nowrap; }

/* ---------- Liste documenti ---------- */

.stato {
    display: inline-block;
    padding: 3px 9px;
    font-size: 11px; font-weight: 700;
    border-radius: 10px;
    white-space: nowrap;
}
.stato-grey { background: #eef1f5; color: var(--testo-muted); }
.stato-orange { background: #fdf3e3; color: var(--arancio); }
.stato-blue { background: var(--blu-chiaro); color: var(--blu); }
.stato-green { background: #e9f9f0; color: var(--verde-scuro); }
.stato-red { background: #fdf1ef; color: var(--rosso); }
.stato-yellow { background: #fcf8e3; color: #9a7d0a; }

.saldata { color: var(--verde-scuro); font-weight: 600; white-space: nowrap; }
.scadenza-rossa { color: var(--rosso); font-weight: 700; }
.scadenza-arancio { color: var(--arancio); font-weight: 700; }
.riga-annullata td { color: var(--testo-muted); text-decoration: line-through; }
.riga-annullata td.col-actions { text-decoration: none; }
.riga-totale td { border-top: 2px solid var(--bordo); background: var(--sfondo); }
.num-doc { color: var(--blu); font-weight: 600; }
.col-importo { text-align: right; white-space: nowrap; }
.col-oggetto { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.foot-totali { display: flex; align-items: center; gap: 8px; color: var(--testo); }
.ta-right { text-align: right; }
.head-actions { display: flex; align-items: center; gap: .5rem; }
.flash-info { background: #eaf2fb; color: #1c4f8a; border: 1px solid #c5dbf2; padding: .6rem .8rem; border-radius: 8px; margin: .6rem 0; }

/* ---------- Storia modifiche ---------- */

.storia-filtri { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.storia-filtri select {
    border: 1px solid var(--bordo);
    border-radius: 7px;
    padding: 7px 9px;
    background: #fff;
    color: var(--testo);
}
.storia-page-head { align-items: flex-start; }
.storia-page-head p { margin: 5px 0 0; font-size: 15px; }
.storia-list { display: grid; gap: 10px; }
.storia-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    background: var(--bianco);
    border: 1px solid var(--bordo);
    border-radius: var(--radius);
    box-shadow: var(--ombra);
    padding: 16px 20px;
}
.storia-row-main {
    min-width: 0;
    display: grid;
    gap: 5px;
}
.storia-row-main strong {
    font-size: 16px;
    line-height: 1.25;
}
.storia-row-main span {
    color: var(--testo-muted);
    font-weight: 600;
}
.storia-row-side {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 18px;
    flex-wrap: wrap;
    color: var(--testo-muted);
    font-weight: 600;
    white-space: nowrap;
}
.storia-current { color: #6f8f3e; }
.storia-muted { color: var(--testo-muted); }
.storia-undo {
    color: #6f8f3e;
    font-weight: 700;
    font-size: 14px;
    padding: 0;
}

.domestiche-summary { display: flex; gap: 12px; flex-wrap: wrap; margin: 12px 0 16px; }
.domestiche-summary div { min-width: 180px; border: 1px solid var(--bordo); border-radius: 8px; padding: 10px 12px; background: #fff; }
.domestiche-summary span { display: block; font-size: 12px; color: var(--testo-muted); margin-bottom: 4px; }
.domestiche-summary strong { font-size: 18px; }
.domestiche-categorie { display: grid; gap: 14px; }
.domestiche-cat { margin: 0; }
.domestiche-cat-head { display: flex; justify-content: space-between; gap: 14px; align-items: flex-start; margin-bottom: 12px; }
.domestiche-cat-head h2 { margin: 0 0 4px; }
.domestiche-cat-head p { margin: 0 0 3px; color: var(--testo); font-size: 13px; }
.domestiche-cat-head small { color: var(--testo-muted); }
.domestiche-cat-totali { text-align: right; white-space: nowrap; }
.domestiche-cat-totali span { display: block; font-size: 12px; color: var(--testo-muted); margin-bottom: 4px; }
.domestiche-cat-totali strong { font-size: 17px; }
.domestiche-cat-table { margin-top: 0; }
.domestiche-table input { width: 100%; box-sizing: border-box; padding: .3rem .4rem; border: 1px solid var(--bordo); border-radius: 6px; font: inherit; }
.domestiche-table .col-pct { width: 130px; }
.domestiche-table .td-pct { width: 56px; display: inline-block; }
.pct-quick { display: inline-flex; gap: 2px; margin-left: 4px; vertical-align: middle; }
.pct-quick button { border: 1px solid var(--bordo); background: var(--sfondo); border-radius: 4px; padding: 1px 5px; font-size: .72rem; cursor: pointer; color: var(--testo-muted); }
.pct-quick button:hover { background: var(--bordo); }
.table-foot-row td { border-top: 2px solid var(--bordo); padding-top: .5rem; }
.col-allegato { width: 140px; white-space: nowrap; }
.col-allegato .td-file { width: 112px; font-size: .7rem; }
.allegato-stato { font-size: .74rem; margin-right: 3px; display: inline-block; max-width: 130px; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; }
.foot-scomposizione { white-space: nowrap; }
.importo-storno { color: var(--rosso); font-weight: 600; white-space: nowrap; }

@media (max-width: 860px) {
    .domestiche-cat-head { display: block; }
    .domestiche-cat-totali { text-align: left; margin-top: 8px; }
    .storia-page-head { display: block; }
    .storia-filtri { margin-top: 12px; }
    .storia-row { display: block; }
    .storia-row-side { justify-content: flex-start; margin-top: 12px; white-space: normal; }
}

.actions-menu { display: flex; align-items: center; justify-content: flex-end; gap: 2px; }
.dropdown-actions .dropdown-menu { width: 220px; max-height: none; position: fixed; top: auto; left: auto; right: auto; z-index: 250; }
.dropdown-actions .dropdown-item {
    display: block; width: 100%;
    border: none; background: none;
    text-align: left; cursor: pointer;
    font-size: 13px; font-family: inherit;
    padding: 9px 14px;
}
.dropdown-actions .inline-form { display: block; }
.item-danger { color: var(--rosso); }

.modal-sm { max-width: 460px; }
.form-grid-2 { grid-template-columns: 1fr 1fr; }
.form-grid-2 .span2 { grid-column: span 2; }

/* ---------- Editor documento ---------- */

.editor-grid, .editor-top { max-width: 1180px; margin-left: auto; margin-right: auto; }

.editor-top {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 14px;
    margin-bottom: 20px;
}
.editor-back { justify-self: start; }
.editor-tipo { text-align: center; }
.editor-tipo-label { display: block; font-size: 12px; color: var(--testo-muted); margin-bottom: 4px; }
.editor-tipo-box {
    display: inline-flex; align-items: center; gap: 12px;
    border: 1px solid var(--bordo); border-radius: 8px;
    background: var(--bianco);
    padding: 8px 16px;
    font-size: 16px; font-weight: 700; color: var(--testo);
    box-shadow: var(--ombra);
}
.editor-elettronica { font-size: 12px; font-weight: 500; color: var(--testo-muted); display: inline-flex; align-items: center; gap: 5px; padding-left: 12px; border-left: 1px solid var(--bordo); }
.editor-numero { justify-self: end; font-size: 17px; font-weight: 700; color: var(--testo); }
.editor-numero-anno { color: var(--testo-muted); }

.editor-grid { display: flex; gap: 18px; align-items: flex-start; }
.editor-main { flex: 1; min-width: 0; }
.editor-aside { width: 280px; flex-shrink: 0; position: sticky; top: calc(var(--header-h) + 16px); }

/* Titoli di sezione centrati (come negli screenshot di riferimento). */
.editor-main > .card > h2,
.editor-cols > .card > h2,
.riepilogo-card > h2 { text-align: center; }

.editor-cols { display: grid; grid-template-columns: 0.85fr 1.15fr; gap: 18px; align-items: start; }
.editor-cols-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
.card-hint { font-size: 12px; color: var(--testo-muted); text-align: center; margin: -4px 0 10px; }
#card-fe .form-grid-2 { grid-template-columns: 1fr 1fr 1fr; }

.riepilogo-card { text-align: center; }
.riepilogo-card .btn { margin-top: 10px; }
.riepilogo-riga {
    display: flex; justify-content: space-between; align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--bordo);
    font-size: 14px;
    text-align: left;
}
.riepilogo-riga span { color: var(--testo-muted); }
.riepilogo-riga strong { color: var(--blu); }
.riepilogo-totale { border-bottom: none; font-size: 16px; margin-top: 4px; }
.riepilogo-totale span { color: var(--testo); font-weight: 600; }
.riepilogo-totale strong { font-size: 22px; }

/* Riga prodotto: card con campi etichettati (screenshot Nuova fattura). */
.riga-prodotto {
    display: flex; gap: 10px;
    border: 1px solid var(--bordo);
    border-radius: 10px;
    padding: 14px;
    margin-bottom: 14px;
    background: #fafbfc;
}
.riga-prodotto.dragging { opacity: 0.5; }
.riga-grip { cursor: grab; color: var(--testo-muted); font-size: 18px; line-height: 1; padding-top: 22px; user-select: none; }
.riga-fields { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.rf { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.rf > span { font-size: 12px; font-weight: 600; color: var(--testo-muted); }
.riga-top { display: grid; grid-template-columns: 90px 1fr 90px 100px 120px; gap: 10px; }
.riga-mid { display: grid; grid-template-columns: 1fr 360px; gap: 12px; align-items: start; }
.riga-mid textarea { resize: vertical; min-height: 78px; }
.riga-calc { display: grid; grid-template-columns: 1fr 1.2fr 1fr; gap: 10px; align-items: start; }
.riga-bot .rf-categoria { max-width: 280px; }
.f-importo {
    display: flex; align-items: center; justify-content: flex-end;
    min-height: 38px; padding: 8px 10px;
    border: 1px solid var(--bordo); border-radius: 7px; background: var(--sfondo);
    font-weight: 700; color: var(--blu); white-space: nowrap;
}
.input-warning { border-color: var(--arancio) !important; box-shadow: 0 0 0 3px rgba(243, 156, 18, 0.15) !important; }

.righe-buttons { display: flex; flex-direction: column; align-items: center; gap: 12px; margin-top: 8px; }
.righe-buttons-sec { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.btn-aggiungi { min-width: 220px; justify-content: center; }

.note-toolbar { display: flex; gap: 4px; margin-bottom: 6px; }
.note-toolbar button {
    width: 32px; height: 30px;
    border: 1px solid var(--bordo); border-radius: 6px;
    background: var(--bianco); cursor: pointer;
    font-size: 13px;
}
.note-toolbar button:hover { background: var(--sfondo); }
.note-editor {
    min-height: 90px;
    border: 1px solid var(--bordo);
    border-radius: 7px;
    padding: 10px;
    font-size: 14px;
    background: var(--bianco);
}
.note-editor:focus { outline: none; border-color: var(--blu); box-shadow: 0 0 0 3px rgba(26, 145, 218, 0.15); }

.scadenza-riga { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.scadenza-riga input[type="date"] { width: 150px; }
.scadenza-riga input[type="number"] { width: 120px; }
.saldata-row input { background: var(--sfondo); }

.autocomplete { position: relative; margin-bottom: 10px; }
.autocomplete-list {
    position: absolute; left: 0; right: 0; top: calc(100% + 4px);
    background: var(--bianco);
    border: 1px solid var(--bordo);
    border-radius: var(--radius);
    box-shadow: 0 6px 24px rgba(44, 62, 80, 0.14);
    z-index: 50;
    overflow: hidden;
}
.autocomplete-item {
    display: block; width: 100%;
    border: none; background: none;
    text-align: left; cursor: pointer;
    padding: 9px 12px;
    font-family: inherit; font-size: 13px;
    border-bottom: 1px solid var(--bordo);
}
.autocomplete-item:hover { background: var(--blu-chiaro); }
.autocomplete-item small { color: var(--testo-muted); margin-left: 6px; }

/* ---------- Vista documento ---------- */

.show-grid { display: grid; grid-template-columns: 1fr 320px; gap: 18px; align-items: start; }
.pdf-card { padding: 0; overflow: hidden; display: block; }
/* Anteprima = PDF reale in iframe (vettoriale, nitido e leggero): niente
   conversione a PNG. height su aspect-ratio A4 (210×297). */
.pdf-frame { width: 100%; aspect-ratio: 210 / 297; height: auto; min-height: 600px; border: none; display: block; background: #fff; }
.pdf-open { display: block; text-align: center; padding: .6rem; font-size: .85rem; border-top: 1px solid var(--bordo); }
.dettagli { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0; font-size: 13px; }
.dettagli dt { color: var(--testo-muted); }
.dettagli dd { margin: 0; }
.scadenze-list { list-style: none; margin: 0; padding: 0; }
.scadenze-list li {
    display: flex; gap: 10px; align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--bordo);
    font-size: 13px;
}
.scadenze-list li:last-child { border-bottom: none; }

/* ---------- Spese e Da registrare (Fase 3) ---------- */

.sidebar-badge {
    margin-left: auto;
    min-width: 18px; height: 18px;
    background: var(--rosso); color: #fff;
    font-size: 11px; font-weight: 700;
    border-radius: 9px;
    display: inline-flex; align-items: center; justify-content: center;
    padding: 0 5px;
}

.pills-bar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; align-items: center; }
.pill-filter {
    padding: 6px 14px;
    border-radius: 16px;
    background: var(--bianco);
    border: 1px solid var(--bordo);
    font-size: 12px; font-weight: 600;
    color: var(--testo);
}
.pill-filter:hover { text-decoration: none; background: var(--sfondo); }
.pill-filter.active { background: var(--blu); border-color: var(--blu); color: #fff; }
.pills-sep { width: 1px; height: 22px; background: var(--bordo); margin: 0 4px; }
.pills-bar-centri { margin-top: -8px; }

.spese-grid { display: grid; grid-template-columns: 1fr 260px; gap: 18px; align-items: start; }
.categorie-aside { position: sticky; top: calc(var(--header-h) + 16px); }
.categorie-list { list-style: none; margin: 0; padding: 0; }
.categorie-list a {
    display: flex; justify-content: space-between; align-items: center; gap: 8px;
    padding: 8px 6px;
    border-bottom: 1px solid var(--bordo);
    color: var(--testo); font-size: 13px;
    border-radius: 4px;
}
.categorie-list a:hover { background: var(--sfondo); text-decoration: none; }
.categorie-list a.active { background: var(--blu-chiaro); color: var(--blu); }
.categorie-list li:last-child a { border-bottom: none; }

.spesa-editor-grid { display: grid; grid-template-columns: 340px 1fr; gap: 18px; align-items: start; }
.dropzone-panel { position: sticky; top: calc(var(--header-h) + 16px); }
.dropzone {
    border: 2px dashed var(--bordo);
    border-radius: var(--radius);
    padding: 40px 16px;
    text-align: center;
    color: var(--testo-muted);
    transition: border-color 0.15s ease, background 0.15s ease;
}
.dropzone.dragging { border-color: var(--blu); background: var(--blu-chiaro); }
.dropzone svg { width: 36px; height: 36px; color: var(--blu); margin-bottom: 6px; }

.spesa-tabs { margin-bottom: 14px; }
.spesa-tabs .tab { border: none; background: none; cursor: pointer; font-family: inherit; font-size: 13px; }
.tipo-spesa-select { width: auto; font-weight: 700; color: var(--blu); }

.select-quick { display: flex; gap: 6px; }
.select-quick select { flex: 1; }

.form-grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px 16px; }
.form-grid-4 label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; font-weight: 600; color: var(--testo-muted); }

.avviso-articoli {
    background: #fdf3e3;
    border: 1px solid var(--arancio);
    color: #9a6a08;
    border-radius: 7px;
    padding: 10px 12px;
    margin-bottom: 14px;
    font-size: 13px;
}
.calcolo-lordo {
    text-align: center;
    color: var(--testo-muted);
    font-size: 11px; letter-spacing: 0.05em;
    margin: 18px 0 0;
}
.calcolo-lordo strong { display: block; font-size: 24px; color: var(--testo); margin-top: 4px; }

.spesa-footer {
    display: flex; justify-content: flex-end; align-items: center; gap: 12px;
    padding: 14px 0;
}
.riga-spesa .grow { flex: 1; }
.riga-spesa input[type="number"] { width: 110px; }
.riga-pagamento select { width: 140px; }
.riga-pagamento input[type="number"] { width: 120px; }

.verifica-fiscale dd { margin-bottom: 8px; }

@media print {
    .topbar, .sidebar, .toolbar, .mesi-bar, .pills-bar, .iconbtn, .btn { display: none !important; }
    .content { margin-left: 0; padding: 0; }
    .show-grid { grid-template-columns: 1fr; }
}

/* ---------- Responsive ---------- */

@media (max-width: 1100px) {
    .spese-grid, .spesa-editor-grid { grid-template-columns: 1fr; }
    .categorie-aside, .dropzone-panel { position: static; }
    .form-grid-4 { grid-template-columns: 1fr 1fr; }
    .editor-cols, .editor-cols-2 { grid-template-columns: 1fr; }
    .editor-cols .card:first-child { grid-column: span 1; }
    .riga-row1 { grid-template-columns: 1fr 58px 92px 110px 90px 34px; }
    .f-codice, .f-um, .f-sconto { display: none; }
    .show-grid { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
    .hamburger { display: inline-flex; }
    .brand-name { display: none; }
    .sidebar { transform: translateX(-100%); transition: transform 0.2s ease; }
    .sidebar.open { transform: translateX(0); }
    .content { margin-left: 0; padding: 16px 14px 50px; }
    .form-grid { grid-template-columns: 1fr; }
    .span2, .span3 { grid-column: span 1; }
    .form-grid-2 { grid-template-columns: 1fr 1fr; }
    .loghi-grid { grid-template-columns: 1fr; }
    .import-mapping { grid-template-columns: 1fr; }
    .toolbar { align-items: stretch; }
    .toolbar .btn { justify-content: center; }
    .editor-grid { flex-direction: column; }
    .editor-aside { width: 100%; position: static; }
}

/* ========== Fase 4: PEC / SDI ========== */

/* Banner modalità collaudo (spec 14.4): sempre ben visibile sotto l'header. */
.collaudo-banner {
    position: sticky;
    top: var(--header-h);
    z-index: 90;
    background: #fdf3e3;
    color: #9a6a00;
    border-bottom: 1px solid #f0ddb8;
    padding: 8px 20px;
    font-size: 13px;
    font-weight: 600;
    text-align: center;
}
.collaudo-banner a { color: var(--blu-scuro); font-weight: 600; margin-left: 6px; }

.sdi-timeline { list-style: none; margin: 0; padding: 0; }
.sdi-timeline li { padding: 10px 0 10px 18px; border-left: 2px solid var(--bordo); position: relative; }
.sdi-timeline li::before {
    content: '';
    position: absolute;
    left: -5px;
    top: 16px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--blu);
}
.sdi-timeline li small { margin-left: 8px; }
.sdi-dettaglio { margin: 6px 0 0; font-size: 13px; color: var(--testo); }

.pa-steps { margin: 0 0 14px; padding-left: 20px; font-size: 13px; }
.pa-steps li { margin-bottom: 6px; }

.pec-test-actions { justify-content: flex-start; border-top: 1px solid var(--bordo); padding-top: 14px; }

.log-title { font-size: 13px; color: var(--testo-muted); margin: 18px 0 6px; }
.collaudo-log { list-style: none; margin: 0; padding: 0; font-size: 13px; color: var(--testo-muted); }
.collaudo-log li { padding: 3px 0; }

/* ========== Fase 5: Situazione, calendario fiscale, ammortamenti ========== */

.scadenze-box { margin-bottom: 16px; }
.scadenze-head {
    display: flex; align-items: center; justify-content: space-between;
    padding-bottom: 12px; margin-bottom: 14px;
    border-bottom: 1px solid var(--bordo);
}
.scadenze-head-left { display: inline-flex; align-items: center; gap: 10px; font-size: 15px; color: var(--blu); }
.scadenze-head-left strong { color: var(--blu); }
.scadenze-head-note {
    font-size: 11px; font-weight: 600; color: var(--testo-muted);
    background: var(--grigio-chiaro, #f0f0f0); padding: 2px 8px; border-radius: 10px;
    text-transform: uppercase; letter-spacing: .03em;
}
.scadenze-count {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 24px; height: 24px; padding: 0 8px;
    border-radius: 12px; background: var(--blu); color: #fff;
    font-size: 13px; font-weight: 700;
}
.scadenze-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; align-items: start; }
.scad-col { min-width: 0; }

.scad-col-head {
    display: flex; align-items: baseline; justify-content: space-between; gap: 8px;
    padding-bottom: 6px; margin-bottom: 6px;
    border-bottom: 1px solid var(--bordo);
}
.scad-col-title { font-size: 12px; font-weight: 600; color: var(--testo-muted); text-transform: uppercase; letter-spacing: .04em; }
.scad-col-tot { font-size: 12px; font-weight: 700; color: var(--blu); white-space: nowrap; }

.scad-empty { color: var(--testo-muted); font-size: 12px; padding: 6px 2px; }

/* Card scadenza: pila pill colorate (data | importo | conferma) + titolo/controparte */
.scad-cardx {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 7px 2px;
    border-bottom: 1px solid var(--bordo);
}
.scad-cardx:last-child { border-bottom: none; }
.scad-cardx-pills { display: flex; flex-direction: column; gap: 2px; width: 88px; flex-shrink: 0; }
.scad-cardx-pills form { margin: 0; }
.scad-badge-data, .scad-badge-importo, .scad-badge-conferma {
    display: block; width: 100%; text-align: center;
    font-size: 10.5px; font-weight: 600; color: #fff;
    padding: 2px 5px; border-radius: 4px; white-space: nowrap;
    box-sizing: border-box; line-height: 1.4;
}
.scad-badge-data.urg-scaduta { background: var(--rosso); }
.scad-badge-data.urg-vicina  { background: var(--arancio); }
.scad-badge-data.urg-futura  { background: var(--verde); }
.scad-badge-importo { background: #2d8fe0; }
.scad-badge-conferma {
    border: none; cursor: pointer; font: inherit; font-weight: 600; font-size: 10.5px;
    background: var(--verde); transition: filter .12s;
}
.scad-badge-conferma:hover { filter: brightness(0.92); }
.scad-cardx-body { flex: 1; min-width: 0; padding-top: 1px; }
.scad-cardx-titolo {
    display: block; font-size: 13.5px; font-weight: 700; color: var(--testo);
    text-decoration: none; line-height: 1.25;
}
.scad-cardx-titolo:hover { color: var(--blu); }
.scad-cardx-sub { font-size: 12px; color: var(--testo-muted); margin-top: 2px; }

.card-title-blu { color: var(--blu); display: flex; align-items: center; gap: 8px; }

.indicatori-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    border-top: 1px solid var(--bordo);
    border-left: 1px solid var(--bordo);
}
.indicatore {
    display: flex;
    gap: 14px;
    align-items: center;
    padding: 18px 16px;
    border-right: 1px solid var(--bordo);
    border-bottom: 1px solid var(--bordo);
}
.indicatore-icona {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: var(--blu-chiaro);
    color: var(--blu);
}
.indicatore-icona svg { width: 22px; height: 22px; }
.icona-costi, .icona-debiti { background: #fdecea; color: var(--rosso); }
.icona-utile, .icona-netto, .icona-contributi, .icona-crediti { background: #e8f8ef; color: var(--verde); }
.icona-pressione { background: #fdf3e3; color: var(--arancio); }
.indicatore-corpo { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.indicatore-label { font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--testo); }
.indicatore-valore { font-size: 26px; font-weight: 700; color: var(--testo); }
.indicatore-sotto { font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--testo-muted); }
.indicatore-barra { display: block; width: 140px; height: 4px; background: var(--bordo); border-radius: 2px; overflow: hidden; }
.indicatore-barra span { display: block; height: 100%; background: var(--blu); }

.grafici-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grafico-box { position: relative; height: 300px; }

.fiscale-grid { display: grid; grid-template-columns: 1fr 320px; gap: 16px; align-items: start; }
.form-grid-1 { display: grid; grid-template-columns: 1fr; gap: 12px; }
.sovrascrivi-form { display: inline-flex; gap: 6px; align-items: center; }
.input-importo { width: 90px; padding: 5px 8px; border: 1px solid var(--bordo); border-radius: 6px; font-size: 13px; text-align: right; }

.piano-details { display: inline-block; position: relative; }
.piano-details summary { list-style: none; cursor: pointer; }
.piano-details summary::-webkit-details-marker { display: none; }
.piano-pop {
    position: absolute;
    right: 0;
    z-index: 60;
    background: var(--bianco);
    border: 1px solid var(--bordo);
    border-radius: var(--radius);
    box-shadow: 0 8px 24px rgba(44, 62, 80, 0.15);
    padding: 8px;
    min-width: 170px;
}

.backup-table { margin-top: 16px; }
.ripristino-check { display: inline-flex !important; margin-right: 6px; white-space: nowrap; }

.dismetti-pop { min-width: 260px; text-align: left; }
.dismetti-pop label { display: block; font-size: 12px; color: var(--testo-muted); margin-bottom: 7px; }
.dismetti-pop select, .dismetti-pop input { width: 100%; margin-top: 2px; }
.dismetti-pop button { margin-top: 4px; width: 100%; }
.pill-red { background: #fdecea; color: #c0392b; }
.pill-amber { background: #fef3e0; color: #b7791f; }

.notice {
    margin-top: 10px;
    padding: 10px 12px;
    border: 1px solid var(--bordo);
    border-radius: var(--radius);
    background: #f8fafc;
}
.notice p { margin: 6px 0 0; }
.fiscal-case {
    border-color: #f5d58a;
    background: #fff9eb;
}

@media (max-width: 1100px) {
    .grafici-grid { grid-template-columns: 1fr; }
    .fiscale-grid { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
    .scadenze-cols { grid-template-columns: 1fr; gap: 14px; }
}
@media (max-width: 700px) {
    .indicatori-grid { grid-template-columns: 1fr; }
}

/* Trattamento fiscale (Step 1): deducibilità costo + detraibilità IVA */
.fiscale-box {
    margin-top: 1rem;
    padding: 0.75rem 1rem 1rem;
    border: 1px solid var(--bordo);
    border-radius: 8px;
}
.fiscale-box legend {
    padding: 0 0.4rem;
    font-weight: 600;
    font-size: 0.95rem;
}
.fiscale-box .small { font-size: 0.82rem; margin: 0 0 0.75rem; }
.fiscale-box > label { display: block; margin-top: 0.75rem; }
.fiscale-box .check-inline {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin-top: 0.75rem;
    font-weight: 500;
}
.fiscale-box .check-inline input { width: auto; margin: 0; }
.login-ricordami {
    display: flex; align-items: center; gap: 0.5rem;
    margin: 0.85rem 0 0.25rem; font-size: 0.86rem; color: var(--testo-muted, #6b7280);
    font-weight: 500; cursor: pointer;
}
.login-ricordami input { width: auto; margin: 0; }

/* Controlli fiscali (Step 3): cruscotto anomalie */
.controlli-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1rem;
}
.controllo-card { border-left: 4px solid var(--bordo); }
.controllo-card.controllo-warn { border-left-color: #e0564f; }
.controllo-card.controllo-ok { border-left-color: #34a853; }
.controllo-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.controllo-head h2 { margin: 0; font-size: 1.02rem; }
.controllo-list { list-style: none; padding: 0; margin: .6rem 0 .4rem; }
.controllo-list li {
    display: flex; flex-direction: column;
    padding: .4rem 0; border-top: 1px solid var(--bordo);
}
.controllo-meta { font-size: .8rem; color: var(--muted, #6b7280); }
.controllo-tags { display: flex; flex-wrap: wrap; gap: .35rem; margin: .35rem 0 .2rem; }
.controllo-tags .pill { text-transform: capitalize; }
.controllo-motivo { font-size: .8rem; color: #b7791f; margin-top: .15rem; }
.controllo-azione {
    font-size: .82rem; color: var(--testo); margin: .5rem 0 0;
    padding-top: .5rem; border-top: 1px dashed var(--bordo);
}
@media (max-width: 700px) {
    .controlli-grid { grid-template-columns: 1fr; }
}
