/* =========================================================================
   TRAME — tema della veste classica
   Strato puramente grafico: nessuna modifica a HTML, classi o logica.
   Direzione: moderna e tecnologica, con animazioni ed effetti.
   Palette allineata all'identita originale del progetto (teal / verde acqua).
   ========================================================================= */

/* ---------- Tipografia self-hosted ----------
   Interfaccia: Manrope (gia dichiarato in app.css).
   Dati e numeri: Roboto Mono. */
@font-face { font-family: "Roboto Mono"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/robotomono-400.877722deef76.woff2") format("woff2"); }
@font-face { font-family: "Roboto Mono"; font-style: normal; font-weight: 500; font-display: swap; src: url("../fonts/robotomono-500.877722deef76.woff2") format("woff2"); }
@font-face { font-family: "Roboto Mono"; font-style: normal; font-weight: 700; font-display: swap; src: url("../fonts/robotomono-700.877722deef76.woff2") format("woff2"); }

/* ---------- Token ---------- */
:root {
  --ink: #162c30;
  --muted: #607277;
  --paper: #f4f7f7;
  --white: #ffffff;
  --line: #d9e3e4;
  --forest: #2f7f89;
  --mint: #d8eef0;
  --lime: #eef7f7;
  --rust: #b95137;
  --amber: #f2bd61;
  --planning-accent: #d9f2f4;
  --billing-accent: #f6fbfb;
  --surface-soft: #edf3f3;
  --surface-warm: #f8f5f0;
  --teal-deep: #174d55;
  --teal-dark: #103b42;
  --teal-bright: #3f929c;
  --success: #23714f;
  --warning: #8a5a0a;
  --danger: #a5402d;
  --focus: #d97745;
  --shadow-float: 0 18px 45px rgb(18 57 62 / 16%);
  --shadow-dialog: 0 28px 90px rgb(9 38 42 / 28%);
  --radius-small: 9px;
  --radius-medium: 13px;
  --radius-large: 18px;
  --sidebar: 252px;

  /* Token del tema: identità teal del progetto */
  --brand: #2f7f89;
  --brand-2: #3f929c;
  --brand-3: #5ec2c9;
  --brand-grad: linear-gradient(120deg, #174d55 0%, #2f7f89 50%, #4fb0b8 100%);
  --shell-1: #0b2b30;
  --shell-2: #123f47;
  --provisional: #6f42a6;
  --provisional-tint: #eadff5;
  --glow: 0 0 0 1px rgb(47 127 137 / 25%), 0 10px 30px rgb(63 146 156 / 22%);
  --mono: "Roboto Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
}

body {
  font-family: "Manrope", ui-sans-serif, system-ui, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1100px 520px at 100% -10%, rgb(47 127 137 / 9%), transparent 60%),
    radial-gradient(900px 480px at -10% 0%, rgb(63 146 156 / 8%), transparent 55%),
    var(--paper);
}

h1, h2, h3, h4, .brand span strong { font-family: "Manrope", sans-serif; letter-spacing: -.02em; }
.eyebrow { color: var(--brand); font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }

.due-summary-row strong, .balance-card strong, .invoice-totals strong, .report-table td, .document-page-number, .invoice-lines td, .sdi-state, .document-state, .time, time, .money-in, .money-out, .access-mileage-row strong { font-family: var(--mono); font-feature-settings: "tnum" 1; }

/* Barra gradiente in alto */
body::before {
  background: var(--brand-grad);
  height: 3px;
  box-shadow: 0 0 22px rgb(63 146 156 / 55%);
  z-index: 40;
}

/* ---------- Shell: menu laterale ---------- */
.sidebar {
  background:
    linear-gradient(180deg, rgb(63 146 156 / 16%), transparent 42%),
    linear-gradient(165deg, var(--shell-2), var(--shell-1) 62%);
  border-right: 1px solid rgb(120 190 195 / 15%);
  overflow: hidden;
}
.sidebar::after { background: linear-gradient(180deg, transparent, rgb(94 194 201 / 55%), transparent); width: 1px; }
.brand-logo { filter: drop-shadow(0 2px 10px rgb(63 146 156 / 28%)); }

.sidebar nav a { position: relative; border-radius: 10px; color: #c3dbde; transition: color .18s var(--motion-ease), background .18s var(--motion-ease), transform .18s var(--motion-ease); }
.sidebar nav a::before {
  content: ""; position: absolute; left: 2px; top: 50%; width: 3px; height: 0; border-radius: 3px;
  background: var(--brand-grad); transform: translateY(-50%); transition: height .22s var(--motion-ease);
}
.sidebar nav a:hover { color: #fff; background: rgb(90 180 185 / 13%); transform: translateX(2px); }
.sidebar nav a:hover::before { height: 42%; }
.sidebar nav a.active { color: #fff; background: linear-gradient(90deg, rgb(47 127 137 / 34%), rgb(94 194 201 / 10%)); box-shadow: inset 0 0 0 1px rgb(140 200 205 / 24%); }
.sidebar nav a.active::before { height: 62%; box-shadow: 0 0 12px rgb(94 194 201 / 70%); }

.sidebar-user { border-color: rgb(120 190 195 / 20%); color: #b6d2d5; }

.mobile-header { background: linear-gradient(120deg, var(--shell-2), var(--shell-1)); border-bottom: 1px solid rgb(120 190 195 / 18%); }
.menu-button { background: var(--brand-grad); color: #06272c; font-weight: 700; }

/* ---------- Contenuto ---------- */
.app-main { position: relative; }
.page-head h1 { font-weight: 700; letter-spacing: -.03em; }

/* ---------- Pannelli / card / metriche ---------- */
.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius-medium);
  background: linear-gradient(180deg, #fff, #fbfdfd);
  box-shadow: 0 1px 0 rgb(255 255 255 / 80%) inset, 0 10px 30px rgb(18 57 62 / 7%);
  transition: box-shadow .2s var(--motion-ease), transform .2s var(--motion-ease);
}
.panel-head { border-color: var(--line); }

.person-card {
  border: 1px solid var(--line); border-radius: var(--radius-medium); background: #fff;
  transition: transform .18s var(--motion-ease), box-shadow .18s var(--motion-ease), border-color .18s var(--motion-ease);
}
.person-card:hover { transform: translateY(-2px); border-color: rgb(47 127 137 / 34%); box-shadow: 0 14px 34px rgb(18 57 62 / 11%); }

/* ---------- Tabelle ---------- */
.table-wrap { border-radius: var(--radius-medium); }
table { border-collapse: separate; border-spacing: 0; }
th { background: linear-gradient(180deg, #f0f7f7, #e4efef); color: #4f6b6f; font-weight: 700; letter-spacing: .06em; }
tbody tr { transition: background .15s var(--motion-ease); }
tbody tr:hover { background: rgb(47 127 137 / 7%); }
td { border-color: var(--line); }

/* ---------- Bottoni e form ---------- */
.button {
  border-radius: 10px; font-weight: 650; letter-spacing: .005em;
  transition: transform .16s var(--motion-ease), box-shadow .16s var(--motion-ease), background .16s var(--motion-ease), border-color .16s var(--motion-ease), color .16s var(--motion-ease);
}
.button.primary {
  background: var(--brand-grad);
  color: #fff; border: 0; box-shadow: 0 8px 22px rgb(47 127 137 / 32%);
}
.button.primary:hover:not(:disabled):not(.is-disabled) { transform: translateY(-1px); box-shadow: 0 12px 30px rgb(63 146 156 / 45%); }
.button.ghost { border: 1px solid var(--line); background: #fff; color: var(--ink); }
.button.ghost:hover:not(:disabled):not(.is-disabled) { border-color: rgb(47 127 137 / 45%); color: var(--brand); box-shadow: 0 6px 18px rgb(18 57 62 / 9%); }
.button.danger { background: linear-gradient(120deg, #b95137, #a5402d); color: #fff; }
.button.provisional { background: linear-gradient(120deg, #6f42a6, #5b3488); color: #fff; }
.button:active:not(:disabled) { transform: translateY(0); }

input, select, textarea, .control {
  border: 1px solid var(--line); border-radius: 10px; background: #fff;
  transition: border-color .16s var(--motion-ease), box-shadow .16s var(--motion-ease), background .16s var(--motion-ease);
}
input:hover, select:hover, textarea:hover { border-color: #bed3d5; }
input:focus, select:focus, textarea:focus, .control:focus {
  border-color: var(--brand); box-shadow: 0 0 0 4px rgb(47 127 137 / 15%); outline: none;
}
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible { outline: 3px solid rgb(47 127 137 / 55%); outline-offset: 2px; }
label { color: #3c5458; }
::selection { background: rgb(63 146 156 / 35%); color: #06272c; }

/* ---------- Messaggi ---------- */
.messages { top: 16px; right: 18px; }
.message {
  border: 1px solid rgb(140 200 205 / 32%);
  border-radius: 12px;
  background: linear-gradient(120deg, rgb(18 63 71 / 96%), rgb(11 43 48 / 96%));
  color: #e9f4f5;
  box-shadow: 0 18px 45px rgb(9 38 42 / 34%);
  backdrop-filter: blur(10px);
}
.message.error { background: linear-gradient(120deg, #7f2a1c, #a5402d); border-color: #cd7563; }
.message.warning { background: linear-gradient(120deg, #fff6e2, #ffeccc); color: #6b4905; border-color: #e8c377; }

/* ---------- Dialoghi ---------- */
.quick-dialog { border-radius: 16px; box-shadow: var(--shadow-dialog); border: 1px solid rgb(140 200 205 / 24%); }
.quick-dialog::backdrop { background: rgb(6 28 32 / 55%); backdrop-filter: blur(6px); }
.dialog-head { border-color: var(--line); }
.dialog-head h2 { font-weight: 700; letter-spacing: -.02em; }
.dialog-close { transition: transform .16s var(--motion-ease), color .16s var(--motion-ease); }
.dialog-close:hover { color: var(--danger); transform: rotate(90deg); }

/* ---------- Stato copertura / badge ---------- */
.access-status-badge { font-weight: 700; letter-spacing: .06em; }
.access-status-badge.uncovered { background: linear-gradient(120deg, #f6dcd4, #eec2b6); color: #7c2d18; box-shadow: inset 0 0 0 1px #d79a87; }
.access-status-badge.partial { background: linear-gradient(120deg, #fdefd2, #f7dfa8); color: #6e4905; box-shadow: inset 0 0 0 1px #e0be72; }
.access-status-badge.provisional { background: linear-gradient(120deg, #ece2f7, #ded0f0); color: #4a2a73; box-shadow: inset 0 0 0 1px #bda4dd; }

.month-cell .client-event.coverage-uncovered { background: linear-gradient(160deg, #fff, #f3dcd5); border-left: 3px solid var(--rust); }
.month-cell .client-event.coverage-partial { background: linear-gradient(160deg, #fff, #fdf1d6); border-left: 3px solid var(--amber); }
.client-event, .operator-event, .week-event, .summary-event, .availability-event {
  border-radius: 9px; border: 1px solid var(--line);
  transition: transform .16s var(--motion-ease), box-shadow .16s var(--motion-ease), border-color .16s var(--motion-ease);
}
.client-event:hover, .operator-event:hover, .week-event:hover, .summary-event:hover { transform: translateY(-1px); box-shadow: 0 8px 20px rgb(18 57 62 / 13%); }
.client-event.current-request { outline: 2px solid var(--brand); outline-offset: 2px; box-shadow: 0 0 0 5px rgb(47 127 137 / 15%), 0 0 22px rgb(63 146 156 / 35%); }
.client-event-assign, .client-event-remove, .client-event-reorganize, .operator-event-action button {
  background: linear-gradient(180deg, #fff, #eef6f6); border-top: 1px solid var(--line); color: var(--brand); font-weight: 700;
}

/* Calendario */
.month-corner, .month-person { background: linear-gradient(180deg, #fff, #f2f8f8); }
.month-day { background: linear-gradient(180deg, #edf5f5, #e2eeee); }
.month-cell.weekend, .month-day.weekend { background: #f5f7f2; }
.month-cell { transition: background .15s var(--motion-ease); }
.month-cell:hover { background: rgb(47 127 137 / 7%); }
/* La barra comandi scorre con la pagina: resta fissa solo la riga delle date. */
.calendar-command-bar,
.access-calendar .calendar-command-bar { position: static; top: auto; z-index: auto; background: rgba(255 255 255 / 86%); backdrop-filter: blur(10px); border-color: var(--line); box-shadow: 0 8px 24px rgb(18 57 62 / 8%); }
/* Quadro clienti: barra comandi con la stessa tinta leggerissima della cella col nome cliente. */
.calendar-workspace:not(.operator-calendar-workspace) .calendar-command-bar { background: linear-gradient(180deg, #ffffff, #f2f8f8); }
.view-switch .button.primary { box-shadow: 0 6px 18px rgb(47 127 137 / 32%); }
/* Quadro clienti: la visuale selezionata usa lo stesso pieno del filtro attivo "Solo da coprire". */
.calendar-workspace:not(.operator-calendar-workspace) .calendar-command-bar .view-switch .button.primary { background: var(--brand-grad); color: #fff; }

/* Stati fatturazione */
.sdi-state, .document-state, .email-state { font-weight: 700; border-radius: 999px; }
.document-state.issued, .document-state.paid { background: linear-gradient(120deg, #d6ecdf, #bfe3cf); color: #1c5739; }
.sdi-state.delivered { background: linear-gradient(120deg, #d6ecdf, #bfe3cf); color: #1c5739; }
.sdi-state.rejected { background: linear-gradient(120deg, #f6dcd4, #eec2b6); color: #7c2d18; }

/* Login */
.login-shell { background: radial-gradient(900px 500px at 20% 10%, rgb(47 127 137 / 45%), transparent 60%), radial-gradient(900px 600px at 90% 90%, rgb(23 77 85 / 55%), transparent 55%), linear-gradient(160deg, var(--shell-2), var(--shell-1)); }
.login-card { border-radius: 18px; background: rgba(255 255 255 / 96%); backdrop-filter: blur(10px); box-shadow: 0 30px 80px rgb(6 30 34 / 45%); }
.product-label { color: var(--brand); }

/* ---------- Animazioni ---------- */
@keyframes reveal-up { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes pop-in { from { opacity: 0; transform: translateY(14px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes slide-in-right { from { opacity: 0; transform: translateX(18px); } to { opacity: 1; transform: none; } }
@keyframes glow-pulse { 0%,100% { box-shadow: 0 0 0 0 rgb(185 81 55 / 38%); } 50% { box-shadow: 0 0 0 6px rgb(185 81 55 / 0%); } }
@keyframes prov-stripes { from { background-position: 0 0; } to { background-position: 28px 0; } }
@keyframes sheen { from { transform: translateX(-120%); } to { transform: translateX(220%); } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

@media (prefers-reduced-motion: no-preference) {
  .app-main .page-head { animation: reveal-up .45s var(--motion-ease) both; }
  .app-main .panel { animation: reveal-up .5s var(--motion-ease) both; }
  .app-main .panel:nth-of-type(2) { animation-delay: .06s; }
  .app-main .panel:nth-of-type(3) { animation-delay: .12s; }
  .app-main .calendar-workspace { animation: reveal-up .45s var(--motion-ease) both; }
  .app-main .calendar-command-bar { animation: reveal-up .5s var(--motion-ease) both; animation-delay: .05s; }
  .quick-dialog[open] { animation: pop-in .28s cubic-bezier(.2,.9,.3,1.2) both; }
  .quick-dialog[open]::backdrop { animation: fade-in .22s ease both; }
  .message { animation: slide-in-right .3s var(--motion-ease) both; }
  .access-status-badge.uncovered { animation: glow-pulse 2.4s ease-in-out infinite; }
  .access-status-badge.provisional {
    background-image: repeating-linear-gradient(115deg, rgb(111 66 166 / 16%) 0 14px, transparent 14px 28px);
    background-size: 28px 28px; animation: prov-stripes 1.6s linear infinite;
  }
  .button.primary { position: relative; overflow: hidden; }
  .button.primary::after { content: ""; position: absolute; inset: 0 auto 0 0; width: 40%; background: linear-gradient(90deg, transparent, rgb(255 255 255 / 32%), transparent); transform: translateX(-120%); }
  .button.primary:hover::after { animation: sheen .7s ease; }
}

/* Scrollbar */
* { scrollbar-width: thin; scrollbar-color: #b6cdcf transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: linear-gradient(180deg, #c4d8d9, #a9c4c6); border-radius: 999px; border: 2px solid transparent; background-clip: padding-box; }
*::-webkit-scrollbar-thumb:hover { background: linear-gradient(180deg, #2f7f89, #5ec2c9); background-clip: padding-box; }


.login-intro {
  background:
    linear-gradient(125deg, rgb(6 30 34 / 84%), rgb(47 127 137 / 46%) 55%, rgb(23 77 85 / 50%)),
    url("../img/marchio/accesso.c2149c53635d.jpg") center/cover;
}
.login-intro h1 { font-family: "Manrope", sans-serif; font-weight: 700; letter-spacing: -.045em; }

/* Campi km disattivati finche cliente e operatrici non sono scelti */
.mileage-controls.is-locked { opacity: .5; }

.sidebar-user { min-width: 0; }
.sidebar-user > span { display: block; max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Spazio in fondo: senza, l'ultima voce (Filo) risulta tagliata di un paio di pixel. */
.sidebar nav { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding-bottom: 10px; scroll-padding-bottom: 10px; }

/* ---------- Mobile ---------- */
/* La tendina laterale (anche desktop, quando non e bloccata) deve stare SOPRA
   la riga fissa delle date (z-index 24/25), ma sotto l'intestazione mobile (30).
   La freccia di apertura/chiusura resta sopra la tendina, cosi e sempre cliccabile. */
.sidebar,
.sidebar-autohide-ready.sidebar-open .sidebar,
.sidebar-autohide-ready.sidebar-pinned .sidebar { z-index: 28; }
.sidebar-autohide-ready .sidebar-edge-trigger { z-index: 29; }

@media (max-width: 760px) {
  .sidebar { background: linear-gradient(180deg, var(--shell-2), var(--shell-1)); box-shadow: 18px 0 50px rgb(6 30 34 / 45%); }
  .calendar-command-bar { position: static; }
}

/* ---------- Stampa: nessun effetto ---------- */
@media print {
  body::before, .access-status-badge.uncovered, .access-status-badge.provisional { animation: none !important; box-shadow: none !important; }
  /* Match weekly summary access typography to the screen-only Full HD theme. */
  .week-grid { line-height: 1.5; }
  .week-grid time { font-family: "Manrope", ui-sans-serif, system-ui, sans-serif; }
  /* A4 landscape: fit the entire 1616px desktop calendar proportionally.
     Keep auto width so the zoom expands the logical layout before pagination. */
  .app-main:has(> .week-grid) { zoom: 0.648; line-height: 1.5; }
  .app-main:has(> .week-grid) .calendar-print-head {
    position: static;
    height: auto;
    margin: 0 0 24px;
    border-bottom: 0;
    background: white;
    align-items: flex-start;
    justify-content: flex-start;
    text-align: left;
    gap: 16px;
  }
  .app-main:has(> .week-grid) .calendar-print-head h1 {
    font-family: "Manrope", sans-serif;
    font-size: 30px;
    line-height: 1.2;
    font-weight: 750;
    letter-spacing: -.035em;
    margin: 0;
  }
  .app-main:has(> .week-grid) .calendar-print-head .eyebrow {
    font-size: 11px;
    line-height: 1.4;
    text-transform: none;
    letter-spacing: 0;
    margin-bottom: 6px;
  }
  .app-main:has(> .week-grid) .week-column { padding-top: 0; border-radius: 12px; }
  .app-main:has(> .week-grid) .week-event { align-items: stretch; text-align: left; }
}

/* =========================================================================
   Menu laterale: categorie a tendina (accordion) — 2026-09-26
   Le voci non cambiano; le categorie diventano <details>/<summary>.
   Apertura animata con la stessa "content-reveal" gia' usata dal sito.
   ========================================================================= */
.sidebar nav details.nav-group { margin: 0; }
.sidebar nav details.nav-group > summary.nav-group-toggle {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin: 14px 6px 2px; padding: 6px 6px 6px 10px;
  border: 1px solid transparent; border-radius: 10px;
  color: #9fc3c7; font-size: 11.5px; font-weight: 700; letter-spacing: .01em;
  list-style: none; cursor: pointer;
}
.sidebar nav details.nav-group > summary.nav-group-toggle::-webkit-details-marker { display: none; }
.sidebar nav details.nav-group > summary.nav-group-toggle::marker { content: ""; }
.sidebar nav details.nav-group > summary.nav-group-toggle:hover { color: #dcebed; background: rgb(90 180 185 / 10%); }
.sidebar nav details.nav-group > summary.nav-group-toggle:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.sidebar nav details.nav-group[open] > summary.nav-group-toggle,
.sidebar nav details.nav-group.has-active > summary.nav-group-toggle { color: #d9eef0; }

.nav-group-caret {
  display: inline-grid; place-items: center; flex: 0 0 auto; width: 20px; height: 20px;
  border-radius: 6px; color: inherit; background: rgb(255 255 255 / 6%);
  transition: transform var(--motion-standard) var(--motion-ease),
              background-color var(--motion-fast) var(--motion-ease),
              color var(--motion-fast) var(--motion-ease);
}
.nav-group-caret svg { width: 11px; height: 11px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.sidebar nav details.nav-group > summary.nav-group-toggle:hover .nav-group-caret { background: rgb(255 255 255 / 12%); }
details.nav-group[open] > summary.nav-group-toggle .nav-group-caret { transform: rotate(90deg); }
details.nav-group.has-active > summary.nav-group-toggle .nav-group-caret { background: var(--brand-grad); color: #06272c; box-shadow: 0 0 10px rgb(94 194 201 / 45%); }

.nav-group-panel { position: relative; margin: 2px 0 6px; padding-left: 16px; }
.nav-group-panel::before {
  content: ""; position: absolute; left: 15px; top: 3px; bottom: 3px; width: 1px;
  background: linear-gradient(180deg, rgb(120 190 195 / 30%), rgb(120 190 195 / 5%));
}
.nav-group-panel > a { margin-left: 10px; }


/* Lo stato dei gruppi arriva dal server (cookie): nessuna animazione al
   caricamento, solo quando l'utente apre/chiude una categoria. */
.sidebar nav details.nav-group > .nav-group-panel { animation: none; }
.sidebar nav details.nav-group[data-animate="true"][open] > .nav-group-panel {
  animation: content-reveal var(--motion-standard) var(--motion-ease) both;
}

/* Report: promemoria Exchange in sola lettura. */
.exchange-calendar-status { color: var(--muted); font-size: 13px; margin: 0 0 12px; }
.exchange-calendar-scroll { overflow-x: auto; }
.exchange-calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 5px; min-width: 630px; }
.exchange-calendar-weekday { text-align: center; font: 750 11px Manrope, sans-serif; color: var(--teal-dark); padding: 9px 0; background: var(--mint); border-radius: var(--radius-small); }
.exchange-calendar-day { min-height: 105px; padding: 8px; border: 1px solid var(--line); border-radius: var(--radius-small); background: var(--white); min-width: 0; break-inside: avoid; }
.exchange-calendar-day.is-outside { background: var(--paper); opacity: .55; }
.exchange-calendar-date { display: block; color: var(--teal-dark); font: 750 12px var(--mono); margin-bottom: 7px; }
.exchange-calendar-event { border-left: 3px solid var(--forest); border-radius: 3px; background: var(--mint); padding: 5px 7px; margin-top: 4px; overflow-wrap: anywhere; font-size: 11px; line-height: 1.35; }
.exchange-calendar-event strong, .exchange-calendar-event small { display: block; }
.exchange-calendar-event small { color: var(--muted); margin-top: 2px; }
@media print { .exchange-report-calendar { break-inside: auto; } .exchange-calendar-scroll { overflow: visible; } .exchange-calendar-grid { min-width: 0; gap: 2px; } .exchange-calendar-day { min-height: 75px; padding: 4px; } }


.exchange-calendar-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.exchange-calendar-head .section-title { margin-bottom: 0; flex: 1 1 auto; }
.exchange-calendar-actions { display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: 10px; }
.exchange-calendar-actions .calendar-period-nav { width: auto; }
.exchange-calendar-actions .button { flex: 0 0 auto; }
.exchange-calendar-actions > .button { padding-inline: 10px; font-size: 11px; }
@media (max-width: 700px) {
  .exchange-calendar-head { flex-direction: column; }
  .exchange-calendar-actions { justify-content: flex-start; }
}

/* Bilancio: analisi economica della replica, nello stesso linguaggio di Trame. */
.balance-dashboard { --balance-teal: #226c75; --balance-rust: #b95137; --balance-forecast: #718c92; max-width: 1480px; }
.balance-dashboard .panel { border: 1px solid var(--line); border-radius: 16px; background: var(--white); }
.balance-dashboard .panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.balance-dashboard .panel-head p { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.balance-page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; }
.balance-page-head h1 { margin-bottom: 4px; }
.balance-filters { margin-top: 4px; margin-bottom: 10px; border: 1px solid var(--line); border-radius: 13px; padding: 10px 12px; background: linear-gradient(180deg, #ffffff, #f2f8f8); }
.balance-overview-heading { display: flex; justify-content: space-between; align-items: end; gap: 12px; margin: 0 0 12px; }
.balance-overview-heading h2 { margin: 2px 0 0; font-size: 19px; letter-spacing: -.03em; }
.balance-overview-heading p { margin: 0; color: var(--muted); font-size: 11px; }
.balance-dashboard .balance-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.balance-dashboard .balance-kpis .balance-card { min-height: 145px; border: 1px solid var(--line); border-radius: 14px; padding: 18px; background: var(--white); color: var(--teal-deep); box-shadow: 0 8px 20px rgb(18 57 62 / 4%); }
.balance-dashboard .balance-kpis .balance-card:first-child { border-color: var(--teal-deep); background: linear-gradient(130deg, #174d55, #246b73); color: white; }
.balance-dashboard .balance-kpis .balance-card.expense { color: #874531; }
.balance-dashboard .balance-kpis .balance-card.total { border-color: #9ec6bb; background: #e9f5ef; color: #145e3c; }
.balance-dashboard .balance-kpis .balance-card.total.negative { border-color: #bb5c4a; background: #fff0ea; color: #8a3e2e; }
.balance-dashboard .balance-kpis .balance-card strong { overflow-wrap: anywhere; font: 700 clamp(20px, 2vw, 31px) var(--mono); letter-spacing: -.05em; font-variant-numeric: tabular-nums; }
.balance-dashboard .balance-kpis .balance-card > span { font-size: 12px; font-weight: 700; letter-spacing: 0; }
.balance-dashboard .balance-kpis .balance-card small { font-size: 10px; opacity: .82; }
.balance-main-chart { margin-bottom: 16px; padding: 22px 24px 15px; }
.balance-main-chart .panel-head h2 { font-size: 22px; margin: 3px 0 0; }
.balance-chart-legend { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 15px; padding-top: 6px; color: var(--muted); font-size: 11px; white-space: nowrap; }
.balance-chart-legend span { display: inline-flex; gap: 6px; align-items: center; }
.balance-chart-legend i { width: 9px; height: 9px; border-radius: 2px; }
.balance-chart-legend .sold-key { background: var(--balance-teal); }
.balance-chart-legend .collected-key { background: #84b7ac; }
.balance-chart-scroll { overflow-x: auto; padding: 4px 0 0; }
.balance-chart-grid { display: grid; grid-template-columns: repeat(12, minmax(45px, 1fr)); min-width: 660px; height: 250px; padding-top: 17px; border-bottom: 1px solid #b9ccce; background: repeating-linear-gradient(to top, transparent 0, transparent 48px, #edf2f2 49px, transparent 50px); }
.balance-chart-month { display: flex; min-width: 0; flex-direction: column; align-items: center; gap: 3px; height: 100%; padding: 0 2px 7px; color: var(--muted); text-decoration: none; border-radius: 8px 8px 0 0; }
.balance-chart-month:hover, .balance-chart-month:focus-visible, .balance-chart-month.is-selected { background: #eaf3f3; color: var(--teal-deep); }
.balance-chart-bars { display: flex; align-items: end; justify-content: center; gap: 3px; width: 100%; height: 186px; }
.balance-chart-bars i { width: min(25%, 18px); min-height: 2px; border-radius: 4px 4px 0 0; }
.balance-chart-bars .sold-bar { background: var(--balance-teal); }
.balance-chart-bars .collected-bar { background: #84b7ac; }
.balance-chart-month strong { color: var(--ink); font: 700 11px var(--mono); }
.balance-chart-month small { font-size: 9px; }
.balance-insights-row { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(260px, 1fr); gap: 16px; margin-bottom: 16px; }
.balance-flow-panel, .balance-cost-panel { min-width: 0; padding: 21px 23px; }
.balance-flow-figure { min-height: 194px; margin-top: 13px; overflow: hidden; }
.balance-flow-figure svg { display: block; width: 100%; height: 194px; }
.balance-flow-gridline { fill: none; stroke: #e5eeee; stroke-width: 1; }
.balance-flow-actual { fill: none; stroke-linecap: round; stroke-linejoin: round; stroke-width: 3.5; vector-effect: non-scaling-stroke; }
.balance-flow-actual { stroke: var(--balance-teal); }
.balance-flow-labels { display: flex; justify-content: space-between; color: var(--muted); font: 10px var(--mono); }
.balance-cost-list { display: grid; gap: 14px; margin-top: 21px; }
.balance-cost-item > div:first-child { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 11px; }
.balance-cost-item strong { color: var(--teal-deep); font: 600 11px var(--mono); }
.balance-cost-track { height: 7px; margin-top: 6px; border-radius: 99px; background: #ecf2f2; overflow: hidden; }
.balance-cost-track span { display: block; height: 100%; border-radius: inherit; background: var(--brand); }
.balance-cost-item:nth-child(2) .balance-cost-track span { background: #69a5a9; }
.balance-cost-item:nth-child(3) .balance-cost-track span { background: #9cbfc0; }
.balance-cost-item:nth-child(4) .balance-cost-track span { background: #c38564; }
.balance-cost-item:nth-child(5) .balance-cost-track span { background: #e1b794; }
.balance-detail-panel { padding: 21px 23px; }
.balance-detail-table { width: 100%; border-collapse: collapse; font-size: 11px; }
.balance-detail-table th, .balance-detail-table td { padding: 11px 12px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
.balance-detail-table th:first-child, .balance-detail-table td:nth-child(2) { text-align: left; }
.balance-detail-table thead th { color: var(--muted); font-size: 10px; font-weight: 700; }
.balance-detail-table tbody td:nth-child(n+3) { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.balance-detail-table .balance-monthly-change { color: var(--success); }
.balance-detail-table .balance-monthly-change.negative { color: var(--danger); }
.balance-detail-table .balance-net { color: var(--success); font-weight: 700; }
.balance-detail-table .balance-net.negative { color: var(--danger); }
.balance-note { max-width: 330px; text-align: right; }
.balance-operations { margin: 30px 0 55px; padding-top: 22px; border-top: 1px solid var(--line); }
.balance-operations > .panel-head { margin-bottom: 14px; }
.balance-operations .balance-ledgers .panel { padding: 18px 20px; }
.balance-dashboard :is(a, button, select, input, summary):focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
@media (max-width: 1100px) {
  .balance-dashboard .balance-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .balance-insights-row { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .balance-page-head, .balance-overview-heading, .balance-dashboard .panel-head { align-items: flex-start; flex-direction: column; }
  .balance-dashboard .balance-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .balance-dashboard .balance-kpis .balance-card { min-height: 125px; padding: 13px; }
  .balance-dashboard .balance-kpis .balance-card strong { font-size: clamp(16px, 4vw, 24px); }
  .balance-main-chart, .balance-flow-panel, .balance-cost-panel, .balance-detail-panel { padding: 16px; }
  .balance-note { max-width: none; text-align: left; }
  .balance-filters { width: 100%; }
}
@media (max-width: 430px) {
  .balance-dashboard .balance-kpis { gap: 7px; }
  .balance-dashboard .balance-kpis .balance-card { padding: 11px; }
  .balance-dashboard .balance-kpis .balance-card strong { font-size: 17px; }
}
@media print {
  .balance-filters, .balance-operations form { display: none !important; }
  .balance-chart-scroll { overflow: visible; }
  .balance-chart-grid { min-width: 0; }
  .balance-dashboard .panel, .balance-dashboard .balance-card { break-inside: avoid; box-shadow: none !important; }
}


.balance-flow-scale { margin: 11px 0 -8px; color: var(--muted); font-size: 10px; }

@media (prefers-reduced-motion: reduce) {
}

.sdi-operation-active { overflow: hidden; }
.sdi-progress-overlay {
  position: fixed;
  inset: 0;
  z-index: 4000;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgb(8 32 37 / 72%);
  backdrop-filter: blur(5px);
}
.sdi-progress-overlay[hidden] { display: none !important; }
.sdi-progress-card {
  width: min(440px, 100%);
  padding: 34px 36px;
  border: 1px solid rgb(255 255 255 / 32%);
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 30px 80px rgb(0 20 24 / 38%);
  color: #173f45;
  text-align: center;
}
.sdi-progress-card .eyebrow { display: block; margin: 18px 0 7px; }
.sdi-progress-card h2 { margin: 0; font-size: clamp(23px, 4vw, 31px); }
.sdi-progress-counter { display: block; margin-top: 22px; color: #12636c; font-size: clamp(24px, 5vw, 38px); line-height: 1; }
.sdi-progress-card p { margin: 18px 0 0; color: #527075; }
.sdi-progress-card .sdi-progress-warning { margin-top: 8px; color: #8a4b18; font-weight: 700; }
.sdi-progress-spinner {
  display: block;
  width: 54px;
  height: 54px;
  margin: 0 auto;
  border: 5px solid #d7e6e7;
  border-top-color: #d68a32;
  border-radius: 50%;
  animation: sdi-progress-spin .8s linear infinite;
}
@keyframes sdi-progress-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .sdi-progress-spinner { animation-duration: 1.8s; }
}
@media print {
  .sdi-progress-overlay { display: none !important; }
}


@media (max-width: 760px) {
}

/* Fatturazione: dashboard operativa. */
.billing-home { max-width: 1440px; }
.billing-home-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px 24px; margin-bottom: 23px; }
.billing-home-header h1 { margin-bottom: 0; }
.billing-home-primary-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; }
.billing-home-primary-actions .button { min-height: 40px; }
.billing-home-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); overflow: hidden; margin-bottom: 17px; border: 1px solid #cbdbdd; border-radius: 16px; background: linear-gradient(180deg, #fff, #f8fbfb); box-shadow: 0 10px 26px rgb(18 57 62 / 5%); }
.billing-home-summary-item { display: flex; min-width: 0; min-height: 140px; flex-direction: column; justify-content: center; gap: 5px; padding: 19px clamp(17px, 2vw, 28px); color: var(--teal-deep); text-decoration: none; transition: background .18s var(--motion-ease); }
.billing-home-summary-item + .billing-home-summary-item { border-left: 1px solid #dce8e9; }
.billing-home-summary-item:hover { background: #edf7f7; color: var(--teal-dark); }
.billing-home-summary-item:focus-visible { outline: 3px solid var(--focus); outline-offset: -4px; }
.billing-home-summary-item > span { color: #527075; font-size: 12px; font-weight: 750; }
.billing-home-summary-item > strong { overflow-wrap: anywhere; color: var(--teal-deep); font: 700 clamp(22px, 2.25vw, 33px)/1.25 "Roboto Mono", monospace; letter-spacing: -.055em; font-variant-numeric: tabular-nums; }
.billing-home-summary-item.has-attention > strong { color: #955729; }
.billing-home-summary-item > small { color: var(--muted); font-size: 10px; line-height: 1.45; }
.billing-home-work-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(310px, .9fr); align-items: start; gap: 16px; }
.billing-home-work-grid > .panel { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 16px; padding: 0; background: #fff; box-shadow: 0 8px 22px rgb(18 57 62 / 4%); }
.billing-home-work-grid .billing-home-panel-head { margin: 0; padding: 22px 24px 15px; }
.billing-home-work-grid .billing-home-panel-head h2 { margin-top: 3px; font-size: 21px; }
.billing-home-task { display: grid; grid-template-columns: 42px minmax(0, 1fr) 20px; align-items: center; gap: 12px; min-height: 72px; border-top: 1px solid #e5eded; padding: 12px 24px; color: var(--ink); text-decoration: none; transition: background .18s var(--motion-ease); }
.billing-home-task:hover, .billing-home-setup-list a:hover { background: #f0f7f7; color: var(--teal-dark); }
.billing-home-task:focus-visible, .billing-home-setup-list a:focus-visible { outline: 3px solid var(--focus); outline-offset: -3px; }
.billing-home-task-count { display: grid; width: 42px; height: 42px; place-items: center; border-radius: 11px; background: #eaf3f3; color: var(--teal-deep); font: 700 18px "Roboto Mono", monospace; }
.billing-home-task-count.needs-attention { background: #fff0d9; color: #875014; }
.billing-home-task-copy strong, .billing-home-task-copy small { display: block; }
.billing-home-task-copy strong { color: var(--teal-deep); font-size: 13px; }
.billing-home-task-copy small { margin-top: 3px; color: var(--muted); font-size: 10px; line-height: 1.35; }
.billing-home-arrow { color: var(--brand); font-size: 21px; line-height: 1; }
.billing-home-sdi-detail { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px 14px; margin: 0 24px 20px 78px; border-top: 1px solid #e5eded; padding-top: 14px; }
.billing-home-sdi-detail span { display: flex; align-items: baseline; gap: 7px; color: var(--muted); font-size: 10px; }
.billing-home-sdi-detail b { color: var(--teal-deep); font: 700 13px "Roboto Mono", monospace; }
.billing-home-setup-list { border-top: 1px solid #e5eded; }
.billing-home-setup-list a { display: flex; min-height: 58px; align-items: center; justify-content: space-between; gap: 15px; border-bottom: 1px solid #e5eded; padding: 11px 24px; color: var(--ink); font-size: 12px; font-weight: 690; text-decoration: none; transition: background .18s var(--motion-ease); }
.billing-home-status { flex: 0 0 auto; border-radius: 7px; padding: 5px 8px; background: #e7f4ee; color: #1d6849; font: 700 11px "Roboto Mono", monospace; }
.billing-home-status.needs-attention { background: #fff0d9; color: #875014; }
.billing-home-setup-note { margin: 0; padding: 15px 24px 20px; color: var(--muted); font-size: 10px; line-height: 1.55; }
@media (max-width: 1120px) { .billing-home-work-grid { grid-template-columns: 1fr; } }
@media (max-width: 760px) {
  .billing-home-header { align-items: flex-start; flex-direction: column; margin-bottom: 18px; }
  .billing-home-primary-actions { width: 100%; }
  .billing-home-primary-actions .button { flex: 1 1 auto; }
  .billing-home-summary { grid-template-columns: 1fr; }
  .billing-home-summary-item { min-height: 92px; padding: 12px 18px; }
  .billing-home-summary-item + .billing-home-summary-item { border-top: 1px solid #dce8e9; border-left: 0; }
  .billing-home-summary-item > strong { font-size: clamp(22px, 5vw, 27px); }
  .billing-home-work-grid .billing-home-panel-head { padding: 18px 18px 12px; }
  .billing-home-task, .billing-home-setup-list a { padding-inline: 18px; }
  .billing-home-sdi-detail { margin-inline: 72px 18px; }
  .billing-home-setup-note { padding-inline: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  .billing-home-summary-item, .billing-home-task, .billing-home-setup-list a { transition: none; }
}

/* Pianificazione: azioni quotidiane in primo piano, panorama mensile consultabile. */
.planning-home { max-width: 1440px; }
.planning-home-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px 24px; margin-bottom: 23px; }
.planning-home-header h1 { margin-bottom: 0; }
.planning-home-summary { display: grid; grid-template-columns: 1.1fr 1.1fr .9fr .9fr; overflow: hidden; margin-bottom: 17px; border: 1px solid #cbdbdd; border-radius: 16px; background: linear-gradient(180deg, #fff, #f8fbfb); box-shadow: 0 10px 26px rgb(18 57 62 / 5%); }
.planning-home-stat { display: flex; min-width: 0; min-height: 132px; flex-direction: column; justify-content: center; gap: 4px; padding: 19px clamp(15px, 2vw, 27px); color: var(--teal-deep); text-decoration: none; transition: background .18s var(--motion-ease); }
.planning-home-stat + .planning-home-stat { border-left: 1px solid #dce8e9; }
.planning-home-stat:hover { background: #edf7f7; color: var(--teal-dark); }
.planning-home-stat:focus-visible { outline: 3px solid var(--focus); outline-offset: -4px; }
.planning-home-stat > span { color: #527075; font-size: 12px; font-weight: 750; }
.planning-home-stat > strong { color: var(--teal-deep); font: 700 clamp(25px, 2.4vw, 35px)/1.2 "Roboto Mono", monospace; letter-spacing: -.055em; }
.planning-home-stat > small { color: var(--muted); font-size: 10px; line-height: 1.4; }
.planning-home-stat.is-today { background: linear-gradient(130deg, #174d55, #246b73); }
.planning-home-stat.is-today:hover { background: linear-gradient(130deg, #205f68, #34838d); }
.planning-home-stat.is-today > span, .planning-home-stat.is-today > small { color: #cde5e6; }
.planning-home-stat.is-today > strong { color: white; }
.planning-home-stat.needs-attention { background: #fff8e9; }
.planning-home-stat.needs-attention > strong { color: #875014; }
.planning-home-stat.needs-attention:hover { background: #fff0d9; }
.planning-home > .panel { overflow: hidden; border: 1px solid var(--line); border-radius: 16px; padding: 0; background: white; box-shadow: 0 8px 22px rgb(18 57 62 / 4%); }
.planning-home-section-head { margin: 0; padding: 20px 24px 14px; }
.planning-home-section-head h2 { margin-top: 3px; font-size: 21px; }
.planning-home-section-head p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.planning-home-count { flex: 0 0 auto; border-radius: 9px; padding: 5px 9px; background: #eaf3f3; color: var(--teal-deep); font: 700 11px "Roboto Mono", monospace; }
.planning-home .planning-home-agenda-list { border-top: 1px solid #e3e9e9; padding-inline: 24px; }
.planning-home .planning-home-agenda-list .timeline-row { grid-template-columns: 80px minmax(0, 1fr) auto; gap: 16px; min-height: 71px; padding: 13px 6px; }
.planning-home .planning-home-agenda-list .timeline-row:first-child { border-top: 0; }
.planning-home .planning-home-agenda-list .timeline-row div { min-width: 0; }
.planning-home .planning-home-agenda-list .timeline-row div strong,
.planning-home .planning-home-agenda-list .timeline-row div span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.planning-home .planning-home-agenda-list .empty { border: 0; border-radius: 0; padding: 22px; background: #fff; }
.planning-home-agenda-foot { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 7px 15px; border-top: 1px solid #e3e9e9; padding: 11px 24px; background: #f7fafa; color: var(--muted); font-size: 10px; }
.planning-home-agenda-foot a { color: var(--brand); font-weight: 750; }
@media (max-width: 1050px) {
  .planning-home-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .planning-home-stat:nth-child(3) { border-top: 1px solid #dce8e9; border-left: 0; }
  .planning-home-stat:nth-child(4) { border-top: 1px solid #dce8e9; }
  .planning-home-stat { min-height: 104px; }
}
@media (max-width: 760px) {
  .planning-home-header { align-items: flex-start; flex-direction: column; margin-bottom: 18px; }
  .planning-home-stat { min-height: 95px; padding: 13px 16px; }
  .planning-home-stat > strong { font-size: 26px; }
  .planning-home-section-head { align-items: flex-start; padding: 18px 18px 12px; }
  .planning-home .planning-home-agenda-list { padding-inline: 16px; }
  .planning-home .planning-home-agenda-list .timeline-row { grid-template-columns: 58px minmax(0, 1fr); gap: 4px 12px; padding: 12px 3px; }
  .planning-home .planning-home-agenda-list .timeline-row .status { grid-column: 2; justify-self: start; }
  .planning-home-agenda-foot { padding-inline: 18px; }

}
@media (prefers-reduced-motion: reduce) { .planning-home-stat { transition: none; } }

/* Filo contestuale: una presenza persistente, non una terza area di lavoro. */
.filo-overlay-root { position: relative; z-index: 1200; }
.filo-launcher {
  position: fixed; right: max(20px, env(safe-area-inset-right)); bottom: max(20px, env(safe-area-inset-bottom)); z-index: 3;
  min-width: 52px; height: 52px; display: grid; place-items: center; border: 1px solid rgb(255 255 255 / 38%); border-radius: 50%;
  padding: 0; background: #174d55; color: white; box-shadow: 0 14px 34px rgb(13 50 55 / 30%), 0 3px 9px rgb(13 50 55 / 18%);
  font: inherit; cursor: pointer; transition: transform .16s var(--motion-ease), box-shadow .16s var(--motion-ease), background .16s var(--motion-ease);
}
.filo-launcher:hover { transform: translateY(-2px); background: #20626b; box-shadow: 0 18px 38px rgb(13 50 55 / 34%), 0 4px 10px rgb(13 50 55 / 18%); }
.filo-launcher:focus-visible { outline: 3px solid var(--focus); outline-offset: 4px; }
.filo-launcher-letter { position: relative; z-index: 1; font-size: 18px; font-weight: 800; letter-spacing: -.04em; }
.filo-launcher-thread { position: absolute; width: 30px; height: 30px; border: 2px solid #d8eef0; border-radius: 50%; box-shadow: inset 9px 0 #e3a85b; }
.filo-launcher-label { position: absolute; right: 46px; border: 1px solid #c8dada; border-radius: 999px; padding: 6px 10px; background: rgb(255 255 255 / 96%); color: #174d55; box-shadow: 0 7px 18px rgb(18 57 62 / 12%); font-size: 10px; font-weight: 780; opacity: 0; transform: translateX(5px); pointer-events: none; transition: opacity .15s ease, transform .15s ease; }
.filo-launcher:hover .filo-launcher-label, .filo-launcher:focus-visible .filo-launcher-label { opacity: 1; transform: none; }
.filo-overlay-backdrop { position: fixed; inset: 0; z-index: 1; background: rgb(12 38 42 / 24%); backdrop-filter: blur(2px); opacity: 0; transition: opacity .18s ease; }
.filo-overlay {
  position: fixed; right: max(18px, env(safe-area-inset-right)); bottom: max(18px, env(safe-area-inset-bottom)); z-index: 2;
  width: min(470px, calc(100vw - 36px)); height: min(760px, calc(100dvh - 36px)); overflow: hidden;
  display: grid; grid-template-rows: 62px minmax(0, 1fr); border: 1px solid #94b6ba; border-radius: 22px;
  background: #eef6f5; box-shadow: 0 28px 75px rgb(10 42 47 / 34%); opacity: 0; transform: translateY(16px) scale(.975); transform-origin: bottom right;
  visibility: hidden; transition: opacity .18s ease, transform .18s var(--motion-ease), visibility 0s linear .18s;
}
.filo-overlay-root.is-open .filo-overlay { opacity: 1; transform: none; visibility: visible; transition-delay: 0s; }
.filo-overlay-root.is-open .filo-overlay-backdrop { display: block; opacity: 1; }
.filo-overlay-root.is-open .filo-launcher { opacity: 0; pointer-events: none; transform: scale(.85); }
.filo-overlay-head { display: flex; align-items: center; justify-content: space-between; gap: 15px; border-bottom: 1px solid #356b72; padding: 10px 12px 10px 17px; background: #174d55; color: white; }
.filo-overlay-identity { display: flex; align-items: center; gap: 11px; }
.filo-overlay-identity > span:last-child { display: flex; flex-direction: column; }
.filo-overlay-identity strong { font-size: 16px; line-height: 1.1; }
.filo-overlay-identity small { margin-top: 2px; color: #c7e1e3; font-size: 9px; }
.filo-overlay-mark { width: 25px; height: 25px; border: 2px solid #d8eef0; border-radius: 50%; box-shadow: inset 8px 0 #e3a85b; }
.filo-overlay-close { width: 38px; height: 38px; display: grid; place-items: center; border: 0; border-radius: 50%; background: transparent; color: #d8eaec; font: 300 26px/1 sans-serif; cursor: pointer; }
.filo-overlay-close:hover { background: rgb(255 255 255 / 10%); color: white; }
.filo-overlay-close:focus-visible { outline: 3px solid #e3a85b; outline-offset: 1px; }
.filo-overlay-frame-wrap { position: relative; min-height: 0; background: #edf3f3; }
.filo-overlay-frame { width: 100%; height: 100%; display: block; border: 0; background: #edf3f3; }
.filo-overlay-loading { position: absolute; inset: 0; display: grid; place-items: center; color: #527075; font-size: 11px; }
@media (max-width: 600px) {
  .filo-launcher { right: max(14px, env(safe-area-inset-right)); bottom: max(14px, env(safe-area-inset-bottom)); width: 46px; min-width: 46px; height: 46px; }
  .filo-overlay { inset: max(8px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left)); width: auto; height: auto; border-radius: 17px; }
  .filo-overlay-backdrop { background: rgb(12 38 42 / 52%); }
}
@media (prefers-reduced-motion: reduce) {
  .filo-launcher, .filo-launcher-label, .filo-overlay, .filo-overlay-backdrop { transition: none; }
}

/* Stato dei dati fiscali nella scheda cliente. */
.fiscal-status { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; }
.fiscal-status:hover { text-decoration: underline; }
.fiscal-status-dot { width: 7px; height: 7px; flex: 0 0 7px; border-radius: 50%; }
.fiscal-status.is-complete { color: #2e6d52; }
.fiscal-status.is-complete .fiscal-status-dot { background: #3a9975; }
.fiscal-status.is-incomplete { color: #8a5b10; }
.fiscal-status.is-incomplete .fiscal-status-dot { background: #d29a2c; }
.fiscal-status.is-incomplete small { color: #8a5b10; }

/* Menu unificato: separatore visivo prima di Impostazioni. */
.sidebar nav details.nav-group[data-nav-group="impostazioni"] { margin-top: 12px; padding-top: 11px; border-top: 1px solid rgb(255 255 255 / 10%); }

/* Fatture ricevute (OpenAPI SDI): Bilancio, elenco e quadro operativo. */
.balance-kpi-group-title { margin: 14px 0 8px; color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: .02em; }
.balance-kpi-group-title:first-of-type { margin-top: 4px; }
.balance-dashboard .balance-kpis.is-three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.balance-dashboard .balance-kpis .balance-card.received small a { color: inherit; }
.balance-chart-legend .received-key { background: var(--balance-rust); }
.balance-chart-bars .received-bar { background: var(--balance-rust); }
.supplier-invoice-head { display: flex; align-items: end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.supplier-sync-warning { display: flex; flex-direction: column; gap: 3px; margin: 0 0 14px; padding: 12px 16px; border: 1px solid #d9a94f; border-radius: 12px; background: #fff4d7; color: #68470c; font-size: 13px; }
.supplier-sync-ok { margin: 0 0 12px; color: var(--muted); font-size: 12px; }
.supplier-invoice-filter input[type="search"] { min-width: 220px; }
.supplier-invoice-table td small { display: block; color: var(--muted); font-size: 11px; }
.supplier-invoice-files a { margin-right: 8px; font-weight: 700; }
@media (max-width: 760px) {
  .balance-dashboard .balance-kpis.is-three { grid-template-columns: 1fr; }
  .supplier-invoice-filter input[type="search"] { min-width: 0; width: 100%; }
}
