/* Foglio Cassa — area riservata (palette e font del sito dassicura.it: navy #293F64, Poppins).
   Layout: barra superiore + menu laterale (a scomparsa su mobile) + contenuto a pannelli.
   Neutri grigio-azzurri come il sito, un solo accento navy, cifre tabellari. */
:root {
	color-scheme: light;
	--bg: #f7f9fb;
	--surface: #ffffff;
	--ink: #212121;
	--muted: #66707d;
	--line: #d9dee6;
	--line-soft: #edf0f4;
	--accent: #293f64;
	--accent-ink: #ffffff;
	--accent-soft: #eaf1f9;
	--ok: #2e7d32;
	--warn: #9a4510;
	--warn-soft: #fbefe5;
	--err: #b3261e;
	--err-soft: #fbe9e7;
	--ok-soft: #edf6ee;
	--st-aperto: #8a5a00;
	--st-aperto-bg: #fdf3dc;
	--st-confermato: #293f64;
	--st-confermato-bg: #eaf1f9;
	--st-chiuso: #3d4448;
	--st-chiuso-bg: #e6e8e9;
	--font: "Poppins", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
	--radius: 4px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body.fca { background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 14px; line-height: 1.45; }
.fca a { color: var(--accent); }
.fca a:hover { text-decoration: none; }
.fca :focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.screen-reader { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- Barra superiore e menu ---------- */
.fca-top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 16px; padding: 0 16px; height: 52px; background: var(--accent); color: var(--accent-ink); }
.fca-brand { font-weight: 700; letter-spacing: .02em; font-size: 16px; color: inherit !important; text-decoration: none; }
.fca-user { margin-left: auto; display: flex; gap: 16px; align-items: center; font-size: 13px; min-width: 0; }
.fca-user span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; opacity: .9; }
.fca-user a { color: var(--accent-ink) !important; font-weight: 600; }
.fca-menu-toggle { display: none; background: transparent; color: inherit; border: 1px solid rgba(255,255,255,.5); border-radius: var(--radius); padding: 4px 10px; font: inherit; cursor: pointer; }

.fca-shell { display: grid; grid-template-columns: 220px minmax(0, 1fr); min-height: calc(100vh - 52px); }
.fca-nav { background: var(--surface); border-right: 1px solid var(--line); padding: 16px 0; }
.fca-nav-group { margin-bottom: 8px; }
.fca-nav-top { display: block; padding: 8px 16px; font-weight: 600; color: var(--ink) !important; text-decoration: none; }
.fca-nav-group.is-open .fca-nav-top { color: var(--accent) !important; }
.fca-nav ul { list-style: none; margin: 0; padding: 0; }
.fca-nav li a { display: block; padding: 6px 16px 6px 28px; color: var(--muted) !important; text-decoration: none; border-left: 3px solid transparent; }
.fca-nav li a:hover { color: var(--ink) !important; background: var(--line-soft); }
.fca-nav li a[aria-current="page"] { color: var(--accent) !important; border-left-color: var(--accent); background: var(--accent-soft); font-weight: 600; }

.fca-main { padding: 20px 24px 48px; min-width: 0; }
.fca-title { font-size: 22px; margin: 0 0 16px; font-weight: 650; text-wrap: balance; }
/* Aiuto della pagina */
.fca-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.fca-title-row .fca-title { flex: 1 1 auto; }
.fca-help-btn { flex: 0 0 auto; padding: 5px 12px; font-size: 13px; }
.fca-help-btn span { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-size: 12px; font-weight: 700; }
.fca-help-dialog { width: min(760px, calc(100vw - 32px)); overflow-x: hidden; }
.fca-help-dl dt, .fca-help-dl dd { min-width: 0; overflow-wrap: anywhere; }
.fca-help-body { padding: 4px 22px 22px; line-height: 1.55; }
.fca-help-intro { font-size: 15px; margin: 12px 0; }
.fca-help-sec { margin-top: 18px; }
.fca-help-sec h3 { font-size: 14px; text-transform: uppercase; letter-spacing: .04em; color: var(--accent); margin: 0 0 8px; padding-bottom: 4px; border-bottom: 1px solid var(--line); }
.fca-help-dl { display: grid; grid-template-columns: minmax(140px, 32%) 1fr; gap: 6px 16px; margin: 0; }
.fca-help-dl dt { font-weight: 600; color: var(--ink); }
.fca-help-dl dd { margin: 0; color: #3d4650; }
.fca-help-tips ul { margin: 0; padding-left: 18px; display: grid; gap: 4px; }
.fca-help-inline { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 10px; font-size: 13.5px; }
.fca-help-inline summary { cursor: pointer; font-weight: 600; color: var(--accent); }
.fca-help-inline .fca-help-body { padding: 4px 0 0; }
.fca-help-inline .fca-help-dl { grid-template-columns: 1fr; gap: 2px; }
.fca-help-inline .fca-help-dl dd { margin-bottom: 6px; }
@media (max-width: 640px) { .fca-help-dl { grid-template-columns: 1fr; gap: 2px; } .fca-help-dl dd { margin-bottom: 8px; } }
@media print { .fca-help-btn, .fca-help-dialog { display: none !important; } }
.fca h2 { font-size: 16px; margin: 0 0 12px; font-weight: 650; }
.fca h3 { font-size: 14px; margin: 16px 0 8px; }

@media (max-width: 860px) {
	.fca-menu-toggle { display: inline-block; }
	.fca-shell { grid-template-columns: minmax(0, 1fr); }
	.fca-nav { display: none; border-right: 0; border-bottom: 1px solid var(--line); }
	.fca-nav.is-open { display: block; }
	.fca-main { padding: 16px 16px 40px; }
	.fca-user span { display: none; }
}

/* ---------- Pannelli, messaggi ---------- */
.fca-panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; min-width: 0; }
.fca-panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.fca-panel-head h2 { margin: 0; }
.fca-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.fca-cols > .fca-panel { margin-bottom: 0; }
.fca-cols + * { margin-top: 16px; }
@media (max-width: 1100px) { .fca-cols { grid-template-columns: minmax(0, 1fr); } }

.fca-flash { padding: 10px 14px; border-radius: var(--radius); margin-bottom: 12px; border: 1px solid; }
.fca-flash-ok { background: var(--ok-soft); border-color: #c3e0c5; color: #1b5e20; }
.fca-flash-error { background: var(--err-soft); border-color: #f0bdb8; color: #7d1a14; }
.fca-flash-warn { background: var(--warn-soft); border-color: #f0cfb3; color: #6b2f08; }
.fca-empty { padding: 24px; text-align: center; color: var(--muted); background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); }
.fca-hint { color: var(--muted); font-size: 12.5px; margin: 6px 0 0; }
.fca-muted { color: var(--muted); }
.fca-ok { color: var(--ok); font-weight: 600; }
.fca-warn { color: var(--warn); font-weight: 600; }
.fca-note { margin-top: 12px; padding: 10px 12px; border-left: 3px solid var(--warn); background: var(--warn-soft); }
.fca-note strong { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--warn); }
.fca-callout { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.fca-callout p { margin: 2px 0 0; color: var(--muted); }

/* ---------- Pulsanti ---------- */
.fca-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 7px 14px; border: 1px solid var(--line); background: var(--surface); color: var(--ink) !important; border-radius: var(--radius); font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; white-space: nowrap; }
.fca-btn:hover { border-color: var(--accent); }
.fca-btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink) !important; }
.fca-btn-primary:hover { background: #3e537c; border-color: #3e537c; }
.fca-btn-danger { color: var(--err) !important; border-color: #e6b3ae; }
.fca-link-btn { background: none; border: 0; padding: 0; font: inherit; color: var(--err); cursor: pointer; text-decoration: underline; }
.fca-toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }

/* ---------- Form ---------- */
.fca input[type=text], .fca input[type=email], .fca input[type=password], .fca input[type=date], .fca input[type=number], .fca select, .fca textarea {
	font: inherit; color: var(--ink); background: var(--surface); border: 1px solid #c3c4c7; border-radius: var(--radius); padding: 6px 8px; min-width: 0; max-width: 100%;
}
.fca textarea { width: 100%; }
.fca input.num, .fca .num input { text-align: right; font-variant-numeric: tabular-nums; }
.fca label { font-weight: 600; font-size: 12.5px; color: var(--muted); }
.fca-check { display: inline-flex; gap: 6px; align-items: center; font-weight: 500 !important; color: var(--ink) !important; font-size: 13.5px !important; }
.fca-form { display: grid; gap: 6px; max-width: 520px; }
.fca-form label { margin-top: 6px; }
.fca-form .fca-btn { margin-top: 10px; justify-self: start; }
.fca-inline-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 8px 0 0; }
.fca-inline-form input[type=text] { flex: 1 1 160px; }
.fca-grid-form { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px 12px; align-items: start; }
.fca-field { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.fca-field input, .fca-field select { width: 100%; }
.fca-field input[type=checkbox], .fca-field input[type=radio] { width: auto; }
.fca-field-l { grid-column: span 2; }
.fca-field-check { justify-content: flex-end; padding-bottom: 6px; }
.fca-field.has-error input, .fca-field.has-error select { border-color: var(--err); background: var(--err-soft); }
.fca-field-error { color: var(--err); font-size: 12px; }
.fca-field.is-disabled { opacity: .45; }
.fca-form-actions { grid-column: 1 / -1; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 4px; }
.fca-fieldset { grid-column: 1 / -1; border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px 12px; }
.fca-fieldset legend { font-weight: 650; padding: 0 4px; }
.fca-fieldset .fca-hint { grid-column: 1 / -1; }
.fca-filters { display: flex; flex-wrap: wrap; gap: 10px 12px; align-items: flex-end; margin-bottom: 16px; }
.fca-filters .fca-form-actions { grid-column: auto; margin: 0; }
.fca-filters label { display: flex; flex-direction: column; gap: 3px; }
@media (max-width: 560px) { .fca-field-l { grid-column: auto; } }

/* ---------- Tabelle ---------- */
.fca-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.fca-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.fca-table th, .fca-table td { padding: 6px 8px; border-bottom: 1px solid var(--line-soft); text-align: left; vertical-align: top; }
.fca-table thead th { font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); border-bottom: 1px solid var(--line); background: #f7f9fb; white-space: nowrap; }
.fca-table tfoot td { font-weight: 650; border-top: 1px solid var(--line); background: #f7f9fb; }
.fca-table .num { text-align: right; white-space: nowrap; }
.fca-table .actions { white-space: nowrap; display: flex; gap: 10px; align-items: baseline; }
.fca-table .actions form { display: inline; }
.fca-table .nowrap { white-space: nowrap; }
.fca-table tr.is-sospeso td { color: var(--muted); background: repeating-linear-gradient(135deg, transparent 0 5px, #f0f2f5 5px 10px); }
.fca-table tr.is-editing td { background: var(--accent-soft); }
.fca-table tr.is-zero td { color: #9aa5aa; }
.fca-table tr.is-test td { background: #fffbea; }
.fca-compact th, .fca-compact td { padding: 4px 8px; }
.fca-righe td { font-size: 13px; }
.fca-filter-row th { background: var(--surface) !important; text-transform: none; letter-spacing: 0; padding: 4px; }
.fca-filter-row input, .fca-filter-row select { width: 100%; min-width: 70px; padding: 3px 4px; font-size: 12.5px; }
.fca-filter-row input[type=date] { min-width: 120px; display: block; margin-bottom: 2px; }
.fca-tagli input { width: 5em; }
.fca-tagli caption { text-align: left; font-weight: 650; padding-bottom: 6px; }
.fca-diff { margin: 0; padding-left: 16px; font-size: 12.5px; }
.fca-log td { font-size: 13px; }
.fca-pager { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 12px; }
.fca-pager a, .fca-pager span { padding: 4px 10px; border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; background: var(--surface); }
.fca-pager .cur { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

/* ---------- Stato, etichette ---------- */
.fca-pill { display: inline-block; padding: 1px 9px; border-radius: 999px; font-size: 12px; font-weight: 650; letter-spacing: .02em; white-space: nowrap; }
.fca-pill-aperto { color: var(--st-aperto); background: var(--st-aperto-bg); }
.fca-pill-confermato { color: var(--st-confermato); background: var(--st-confermato-bg); }
.fca-pill-chiuso { color: var(--st-chiuso); background: var(--st-chiuso-bg); }
.fca-pill-nessuno { color: var(--muted); background: transparent; border: 1px dashed var(--line); }
.fca-tag { display: inline-block; font-size: 11px; padding: 0 6px; border-radius: 3px; background: var(--line-soft); color: var(--muted); font-weight: 600; white-space: nowrap; }
.fca-tag-warn { background: var(--warn-soft); color: var(--warn); }

/* ---------- Foglio ---------- */
.fca-foglio-head { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; align-items: flex-start; margin-bottom: 16px; }
.fca-foglio-meta { display: grid; gap: 4px; }
.fca-foglio-sub { color: var(--muted); font-weight: 600; }
.fca-foglio-date { font-size: 18px; font-weight: 650; }
.fca-foglio-meta .fca-pill { justify-self: start; }
.fca-meta-list { margin: 4px 0 0; padding: 0; list-style: none; color: var(--muted); font-size: 12.5px; }
.fca-foglio-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.fca-foglio-actions form { margin: 0; }
.fca-unlock summary { cursor: pointer; font-weight: 650; color: var(--accent); }
.fca-riep { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.fca-riep th, .fca-riep td { padding: 6px 8px; border-bottom: 1px solid var(--line-soft); text-align: left; }
.fca-riep thead th { font-size: 12px; text-transform: uppercase; color: var(--muted); border-bottom: 1px solid var(--line); }
.fca-riep .num { text-align: right; white-space: nowrap; width: 120px; }
.fca-riep small { color: var(--muted); }
.fca-riep tr.tot td { font-weight: 650; border-top: 1px solid var(--ink); background: #f7f9fb; }
.fca-riep tr.key td { font-weight: 700; font-size: 15px; border-top: 1px solid var(--ink); border-bottom: 1px solid var(--ink); }
.fca-files { list-style: none; padding: 0; margin: 0 0 8px; display: grid; gap: 6px; }
.fca-files li { display: flex; gap: 10px; flex-wrap: wrap; align-items: baseline; }
.fca-files form { display: inline; }
.fca-cassa-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; align-items: start; }
.fca-cassa-grid .fca-field { margin-bottom: 10px; max-width: 320px; }
.fca-cassa-grid .fca-field textarea { max-width: none; }
.fca-cassa-grid [data-nota-wrap] { max-width: none; }
.fca-live { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 4px 0 12px; }
.fca-live div { background: #f7f9fb; border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 10px; }
.fca-live span { display: block; font-size: 12px; color: var(--muted); }
.fca-live strong { font-size: 16px; font-variant-numeric: tabular-nums; }
@media (max-width: 760px) { .fca-cassa-grid { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Foglio: zone distinte ---------- */
.fca-zone { border-radius: 6px; padding: 16px; margin-bottom: 24px; min-width: 0; }
.fca-zone-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin: -16px -16px 16px; padding: 12px 16px; border-radius: 6px 6px 0 0; }
.fca-zone-head h2 { margin: 0; font-size: 17px; }
.fca-zone-sub { font-size: 12.5px; opacity: .85; }
/* Zona righe: "foglio" bianco con fascia d'intestazione scura. */
.fca-zone-righe { background: var(--surface); border: 2px solid var(--accent); box-shadow: 0 2px 8px rgba(41, 63, 100, .12); }
.fca-zone-righe .fca-zone-head { background: var(--accent); color: var(--accent-ink); }
.fca-zone-righe .fca-zone-head .fca-btn-primary { background: var(--accent-ink); color: var(--accent) !important; border-color: var(--accent-ink); }
/* Zona riepilogo: fondo colorato, pannelli bianchi al suo interno. */
.fca-zone-riep { background: #f0f6fc; border: 1px solid #d6e2ef; }
.fca-zone-riep .fca-zone-head { background: #3e537c; color: #ffffff; border-bottom: 1px solid #3e537c; }
.fca-zone-riep .fca-panel { margin-bottom: 16px; }
.fca-zone-riep .fca-cols { margin-bottom: 16px; }
.fca-zone-riep .fca-cols .fca-panel { margin-bottom: 0; }
.fca-zone .fca-panel h3 { margin: 0 0 10px; font-size: 15px; }
.fca-panel-cassa { border-left: 4px solid var(--accent); }
.fca-intro { margin: 0 0 4px; }
.fca-intro-list { margin: 0 0 6px; padding-left: 20px; display: grid; gap: 2px; }
.fca-cassa-grid { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: flex-end; margin: 12px 0; }
.fca-cassa-grid .fca-field { width: 240px; max-width: 100%; }
.fca-live { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 760px) { .fca-live { grid-template-columns: minmax(0, 1fr); } }

/* Icone azione nella prima colonna */
.fca-col-actions { width: 1%; white-space: nowrap; }
.fca-col-actions form { display: inline; }
.fca-icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; padding: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--accent) !important; cursor: pointer; vertical-align: middle; text-decoration: none; font: inherit; }
.fca-icon-btn:hover { border-color: var(--accent); background: var(--accent-soft); }
.fca-icon-danger { color: var(--err) !important; }
.fca-icon-danger:hover { border-color: var(--err); background: var(--err-soft); }

/* Popup */
.fca-dialog { width: min(920px, calc(100vw - 32px)); max-height: calc(100vh - 32px); border: 0; border-radius: 8px; padding: 0; box-shadow: 0 20px 60px rgba(0, 0, 0, .3); color: var(--ink); background: var(--surface); }
.fca-dialog::backdrop { background: rgba(33, 33, 33, .55); }
.fca-dialog form { padding: 0 20px 20px; }
.fca-dialog-head { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; margin: 0 -20px 4px; padding: 14px 20px; background: var(--accent); color: var(--accent-ink); position: sticky; top: 0; z-index: 1; }
.fca-dialog-head h2 { margin: 0; color: inherit; }
.fca-dialog-head .fca-icon-btn { background: transparent; color: var(--accent-ink) !important; border-color: rgba(255,255,255,.5); }
.fca-dialog-error { grid-column: 1 / -1; margin: 0; }
.fca-dialog-actions { justify-content: flex-end; border-top: 1px solid var(--line); padding-top: 12px; margin-top: 8px; }

/* ---------- Note spese ---------- */
.fca-pill-ns-bozza { color: var(--st-aperto); background: var(--st-aperto-bg); }
.fca-pill-ns-inviata { color: var(--st-confermato); background: var(--st-confermato-bg); }
.fca-pill-ns-approvata { color: var(--ok); background: var(--ok-soft); }
.fca-pill-ns-rifiutata { color: var(--err); background: var(--err-soft); }
.fca-dialog-s { width: min(680px, calc(100vw - 32px)); }
.fca-decide { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); }
.fca-files li form { display: inline; }
details > summary { cursor: pointer; }
details > summary h2 { display: inline; margin: 0; }

/* ---------- Pagina iniziale (menu funzioni) ---------- */
.fca-no-nav .fca-shell { grid-template-columns: minmax(0, 1fr); }
.fca-no-nav .fca-main { max-width: 1000px; width: 100%; margin: 0 auto; padding-top: 32px; }
.fca-top-app { font-size: 14px; padding-left: 14px; margin-left: -2px; border-left: 1px solid rgba(255,255,255,.35); opacity: .95; }
.fca-nav-home { display: block; margin: 0 12px 12px; padding: 6px 4px 12px; border-bottom: 1px solid var(--line); color: var(--muted) !important; text-decoration: none; font-size: 13px; }
.fca-nav-home:hover { color: var(--accent) !important; }
.fca-home-hello { margin: -6px 0 20px; color: var(--muted); font-size: 15px; }
.fca-home-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; max-width: 900px; }
.fca-home-tile { position: relative; display: flex; flex-direction: column; gap: 8px; min-height: 160px; padding: 22px; background: var(--surface); border: 1px solid var(--line); border-top: 4px solid var(--accent); border-radius: 6px; text-decoration: none; color: var(--ink) !important; box-shadow: 0 2px 6px rgba(41, 63, 100, .06); transition: box-shadow .15s, transform .15s; }
a.fca-home-tile:hover { box-shadow: 0 6px 18px rgba(41, 63, 100, .16); transform: translateY(-2px); }
.fca-home-label { font-size: 18px; font-weight: 600; color: var(--accent); }
.fca-home-desc { color: var(--muted); font-size: 13.5px; }
.fca-home-go { margin-top: auto; font-weight: 600; color: var(--accent); }
.fca-home-tile.is-disabled { border-top-color: var(--line); background: #fafbfc; cursor: default; }
.fca-home-tile.is-disabled .fca-home-label { color: var(--muted); }
.fca-home-tag { align-self: flex-start; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: var(--line-soft); padding: 2px 8px; border-radius: 999px; }
.fca-nav-group.is-disabled .fca-nav-top { color: var(--muted) !important; font-weight: 500; }
.fca-nav-top[aria-current="page"] { color: var(--accent) !important; }

/* ---------- Cruscotto ---------- */
.fca-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.fca-stats div { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; }
.fca-stats span { display: block; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.fca-stats strong { font-size: 22px; font-variant-numeric: tabular-nums; }
.fca-tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 12px; border-bottom: 1px solid var(--line); }
.fca-tabs a { padding: 8px 12px; text-decoration: none; color: var(--muted) !important; border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 600; }
.fca-tabs a[aria-current="page"] { color: var(--accent) !important; border-bottom-color: var(--accent); }

/* ---------- Login ---------- */
.fca-public { min-height: 100vh; display: grid; place-items: center; padding-inline: 16px; padding-block: 32px; }
.fca-login { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 28px; border-top: 4px solid var(--accent); }
.fca-login h1 { font-size: 20px; margin: 12px 0 16px; }
.fca-login-brand { display: grid; gap: 2px; }
.fca-login-brand .fca-brand { color: var(--accent) !important; font-size: 18px; }
.fca-login-site { color: var(--muted); font-size: 12.5px; }
.fca-login .fca-form { max-width: none; }
.fca-login .fca-form input[type=text], .fca-login .fca-form input[type=password] { padding: 9px 10px; }
.fca-login .fca-btn { width: 100%; padding: 10px; }
.fca-login-links { margin: 16px 0 0; font-size: 13px; }
.fca-login-back { margin: 6px 0 0; font-size: 12.5px; }
.fca-pw-rules { list-style: none; margin: 4px 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 2px 12px; font-size: 12.5px; color: var(--muted); }
.fca-pw-rules li::before { content: "○ "; }
.fca-pw-rules li.ok { color: var(--ok); }
.fca-pw-rules li.ok::before { content: "● "; }

/* ---------- Scadenziario ---------- */
:root {
	--due: #3e537c;          /* effettivo da pagare */
	--due-soft: #dfe7f2;
	--prev: #7b8aa3;         /* previsto (stima) */
	--prev-soft: #f3f5f9;
	--late: var(--err);
}
.fca-btn-s { padding: 4px 10px; font-size: 13px; }
.fca-btn svg { flex: none; }
.fca-btn-pay { border-color: var(--accent); color: var(--accent) !important; }
.fca-icon-doc { color: var(--due) !important; }
.fca-icon-pay { color: var(--ok) !important; }
.fca-icon-pay:hover { border-color: var(--ok); background: var(--ok-soft); }
.fca-col-actions .fca-icon-btn + .fca-icon-btn, .fca-col-actions a + .fca-icon-btn { margin-left: 3px; }

/* Etichette di natura e stato */
.fca-pill-prevista { color: #4f5d75; background: var(--surface); border: 1px dashed #8d9ab0; font-style: italic; }
.fca-pill-effettiva { color: var(--accent); background: var(--accent-soft); border: 1px solid #c9d7ea; }
.fca-pill-st-pagata { color: var(--ok); background: var(--ok-soft); }
.fca-pill-st-scaduta { color: #fff; background: var(--late); }
.fca-pill-st-oggi { color: var(--warn); background: var(--warn-soft); border: 1px solid #f0cfb3; }
.fca-pill-st-da_pagare { color: var(--st-aperto); background: var(--st-aperto-bg); }
.fca-tag-late { background: var(--err-soft); color: var(--err); }
.fca-late { color: var(--late); font-weight: 600; }

/* Importi */
.fca-amt { font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }
.fca-amt-prev { color: var(--prev); font-style: italic; font-weight: 500; }
.fca-scost { display: block; font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.fca-scost.is-up, [data-scost-out].is-up, .fca-scost-big.is-up { color: var(--warn); }
.fca-scost.is-down, [data-scost-out].is-down, .fca-scost-big.is-down { color: var(--ok); }
.fca-scost-big { font-weight: 700; }
.fca-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; margin: 0 0 10px; font-size: 12.5px; color: var(--muted); }
.fca-legend-icons svg { vertical-align: -3px; margin-left: 10px; color: var(--accent); }
.fca-empty-s { margin: 4px 0; color: var(--muted); }

/* Totali in una fila (cruscotto, report, elenco) */
.fca-stats-sum { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.fca-stats-sum > * { display: grid; gap: 1px; text-decoration: none; color: var(--ink) !important; border-left: 4px solid var(--accent) !important; }
.fca-stats-sum strong { font-size: 20px; color: var(--accent); white-space: nowrap; }
.fca-stats-sum small { font-size: 12px; color: var(--muted); }
.fca-stats-sum a:hover { background: var(--accent-soft); }
.fca-stats-sum .is-ok { border-left-color: var(--ok) !important; }
.fca-stats-sum .is-ok strong { color: var(--ok); }
.fca-stats-sum .is-late { border-left-color: var(--late) !important; background: #fffafa; }
.fca-stats-sum .is-late strong { color: var(--late); }
.fca-stats-sum .is-prev { border-left-color: #b7c1d1 !important; }
.fca-stats-sum .is-prev strong { color: var(--prev); }

/* Tabella delle scadenze (stile Excel: Previsto ed Effettivo in colonne separate) */
.fca-stab td { vertical-align: middle; }
.fca-stab td small { display: block; color: var(--muted); font-size: 11.5px; line-height: 1.3; }
.fca-stab .num { width: 1%; white-space: nowrap; padding-left: 14px; }
.fca-stab-desc { min-width: 240px; }
.fca-stab td:nth-last-child(2) small, .fca-stab .fca-pill { white-space: nowrap; }
.fca-stab-desc a { font-weight: 600; color: var(--ink) !important; text-decoration: none; }
.fca-stab-desc a:hover { color: var(--accent) !important; text-decoration: underline; }
.fca-stab td.num small.is-up { color: var(--warn); }
.fca-stab td.num small.is-down { color: var(--ok); }
.fca-stab tr.is-prevista .fca-stab-desc a { font-weight: 500; }
.fca-stab tr.is-pagata td { color: #7a838d; }
.fca-stab tr.is-pagata .fca-stab-desc a { color: #5f6973 !important; font-weight: 500; }
.fca-stab tr.is-scaduta td:first-child { box-shadow: inset 3px 0 0 var(--late); }
.fca-stab-act { width: 1%; white-space: nowrap; text-align: right; }
.fca-stab-act .fca-icon-btn { width: 26px; height: 26px; }
.fca-stab-act .fca-icon-btn + .fca-icon-btn { margin-left: 3px; }
.fca-stab-date { width: 1%; white-space: nowrap; font-weight: 600; color: var(--accent); font-variant-numeric: tabular-nums; }
.fca-stab tbody tr:first-child td { border-top: 1px solid var(--line); }
.fca-stab-sub td { background: #e9eef5; font-weight: 700; color: var(--accent); border-bottom: 2px solid #c9d4e3; }
.fca-stab-sub td span { font-weight: 500; color: var(--muted); font-size: 12.5px; }
.fca-stab-sub td:first-child { text-align: right; }
.fca-stab tfoot td { background: var(--accent); color: var(--accent-ink); font-weight: 700; }
.fca-stab tfoot td span { font-weight: 500; opacity: .85; }
.fca-stab tfoot td:first-child { text-align: right; }
.fca-pivot tr.is-current td { background: var(--accent-soft); font-weight: 600; }
.fca-pivot-month td { background: #f3f6fa; font-weight: 650; border-top: 1px solid var(--line); }
.fca-pivot td:first-child a { text-decoration: none; }
.fca-wk-n { display: inline-block; min-width: 26px; padding: 0 5px; margin-right: 4px; border-radius: 3px; background: var(--line-soft); color: var(--muted); font-size: 12px; text-align: center; font-weight: 600; }
.fca-late { color: var(--late); font-weight: 600; }

/* Report settimanale: intestazione sobria */
.fca-week-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px 16px; flex-wrap: wrap; margin-bottom: 14px; }
.fca-week-kicker { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.fca .fca-week-bar h2 { font-size: 22px; margin: 0; color: var(--accent); font-weight: 700; }
.fca-week-nav { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.fca-week-nav .is-current { background: var(--accent-soft); border-color: var(--accent); }
.fca-week-go { margin: 0; }
.fca-arretrato { margin: 0 0 14px; padding: 8px 12px; border-left: 4px solid var(--late); background: var(--err-soft); border-radius: var(--radius); color: #7d1a14; }
.fca-arretrato a { margin-left: 8px; color: #7d1a14; font-weight: 600; }
details.fca-panel > summary h2 { font-size: 15px; }
details.fca-panel[open] > summary { margin-bottom: 12px; }
.fca-print-foot { display: none; }

/* Scheda della scadenza */
.fca-scad-pills { display: flex; gap: 6px; flex-wrap: wrap; }
.fca-scad-pills .fca-pill { font-size: 13px; padding: 2px 12px; }
.fca-card-amount.is-prevista { border-top: 4px dashed #b7c1d1; }
.fca-card-amount.is-effettiva { border-top: 4px solid var(--accent); }
.fca-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; counter-reset: st; }
.fca-steps li { position: relative; padding: 0 0 16px 38px; display: grid; gap: 2px; }
.fca-steps li::before { counter-increment: st; content: counter(st); position: absolute; left: 0; top: 0; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 700; background: var(--line-soft); color: var(--muted); border: 2px solid var(--line); }
.fca-steps li::after { content: ""; position: absolute; left: 13px; top: 28px; bottom: 2px; width: 2px; background: var(--line); }
.fca-steps li:last-child::after { display: none; }
.fca-steps li.is-done::before { content: "✓"; background: var(--accent); color: #fff; border-color: var(--accent); }
.fca-steps li.is-late::before { background: var(--late); color: #fff; border-color: var(--late); }
.fca-steps li.is-todo strong { color: var(--muted); }
.fca-steps li > span { color: var(--muted); font-size: 13px; }
.fca-steps details { margin-top: 6px; }
.fca-dl { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 16px; margin: 0; }
.fca-dl dt { color: var(--muted); font-size: 12.5px; font-weight: 600; }
.fca-dl dd { margin: 0; }

/* Popup dello scadenziario */
.fca-natura { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.fca-natura[hidden] { display: none; }
.fca-radio-card { display: flex !important; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: 6px; cursor: pointer; color: var(--ink) !important; font-size: 13.5px !important; }
.fca-radio-card:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.fca-radio-card input { margin-top: 3px; }
.fca-radio-card span { display: grid; gap: 2px; }
.fca-radio-card small { color: var(--muted); font-weight: 400; }
.fca-dlg-intro { margin: 4px 0 0; }
.fca-compare { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.fca-compare > div { display: grid; gap: 4px; align-content: start; padding: 10px 12px; border: 1px solid var(--line); border-radius: 6px; background: #f7f9fb; }
.fca-compare span, .fca-compare label { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; }
.fca-compare strong { font-size: 18px; font-variant-numeric: tabular-nums; }
.fca-compare .fca-compare-eff { background: var(--surface); border: 2px solid var(--accent); }
.fca-compare .fca-compare-eff input { font-size: 17px; font-weight: 700; width: 100%; }
.fca-compare .has-error input { border-color: var(--err); background: var(--err-soft); }
@media (max-width: 560px) { .fca-compare { grid-template-columns: minmax(0, 1fr); } }
.fca-pay-box { display: grid; gap: 2px; padding: 12px 14px; border-radius: 6px; background: var(--accent-soft); border: 1px solid #c9d7ea; }
.fca-pay-box strong { font-size: 24px; color: var(--accent); font-variant-numeric: tabular-nums; }
.fca-pay-box small { color: var(--muted); }
[hidden] { display: none !important; }

/* Stampa dei report */
@media print {
	@page { size: A4; margin: 12mm; }
	body.fca { background: #fff; font-size: 11.5px; }
	.fca-top, .fca-nav, .fca-no-print, .fca-col-actions, .fca-flash, dialog, .fca-toolbar, .fca-tabs { display: none !important; }
	.fca-shell { display: block; }
	.fca-main { padding: 0; }
	.fca-title { font-size: 16px; margin-bottom: 8px; }
	.fca-week-bar h2 { font-size: 18px; }
	tr, .fca-stats-sum > * { break-inside: avoid; }
	.fca-stats-sum { grid-template-columns: repeat(4, 1fr); }
	.fca-pill, .fca-stab-sub td, .fca-stab tfoot td, .fca-pivot-month td { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
	.fca-print-foot { display: block; margin-top: 12px; font-size: 10px; color: var(--muted); }
	a { color: inherit !important; text-decoration: none !important; }
}

@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }

/* Scadenziario: pagina Excel */
.fca-steps-plain { margin: 0 0 8px; padding-left: 20px; display: grid; gap: 12px; }
.fca-steps-plain p { margin: 6px 0 0; }

/* ---------- Visita guidata ---------- */
.fca-tour-link { background: transparent; border: 1px solid rgba(255,255,255,.5); color: var(--accent-ink); font: inherit; font-weight: 600; font-size: 13px; padding: 3px 10px; border-radius: var(--radius); cursor: pointer; }
.fca-tour-link:hover { background: rgba(255,255,255,.12); }
.fca-tour-shade { position: fixed; inset: 0; z-index: 1000; background: transparent; }
.fca-tour-shade.is-dark { background: rgba(20, 30, 50, .55); }
.fca-tour-spot { position: fixed; z-index: 1001; border-radius: 6px; box-shadow: 0 0 0 3px #fff, 0 0 0 9999px rgba(20, 30, 50, .55); pointer-events: none; transition: left .2s, top .2s, width .2s, height .2s; }
.fca-tour-pop { position: fixed; z-index: 1002; width: min(380px, calc(100vw - 32px)); background: var(--surface); color: var(--ink); border-radius: 8px; box-shadow: 0 16px 48px rgba(0,0,0,.3); padding: 16px 18px 14px; border-top: 4px solid var(--accent); }
.fca-tour-pop.is-center { left: 50% !important; top: 50% !important; transform: translate(-50%, -50%); width: min(460px, calc(100vw - 32px)); }
.fca-tour-pop.is-docked { left: 16px !important; right: 16px; bottom: 16px; top: auto !important; width: auto; max-width: 560px; margin: 0 auto; }
.fca-tour-count { font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.fca-tour-pop h2 { margin: 0 0 6px; font-size: 17px; color: var(--accent); }
.fca-tour-text { margin: 0 0 14px; line-height: 1.55; }
.fca-tour-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.fca-tour-nav { display: flex; gap: 8px; margin-left: auto; }
.fca-tour-skip { background: none; border: 0; padding: 4px 0; color: var(--muted); font: inherit; font-size: 13px; text-decoration: underline; cursor: pointer; }
.fca-tour-skip:hover { color: var(--ink); }
.fca-help-foot { margin: 0 22px 20px; padding-top: 12px; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; color: var(--muted); }
@media (prefers-reduced-motion: reduce) { .fca-tour-spot { transition: none; } }
@media print { .fca-tour-shade, .fca-tour-spot, .fca-tour-pop, .fca-tour-link { display: none !important; } }
/* Barra in alto su telefoni stretti: il nome della funzione è già nel menu, si nasconde per far posto a Guida ed Esci. */
@media (max-width: 480px) { .fca-top { gap: 10px; padding: 0 12px; } .fca-top-app { display: none; } .fca-user { gap: 10px; } }

/* Badge del menu (comunicazioni da leggere) */
.fca-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--err); color: #fff !important; font-size: 12px; font-weight: 700; line-height: 1; vertical-align: 1px; }
