/* Regole condivise, caricate per ultime dalla build su tutte le pagine. */
main, main > *, .card, .form-grid > *, .manager-layout > *, .footer-row > *, .table-wrap, .cmp-wrap { min-width: 0; }
img { max-width: 100%; height: auto; }
.table-wrap:not([data-responsive-comparison]), .cmp-wrap:not([data-responsive-comparison]) { max-width: 100%; overflow-x: auto; overscroll-behavior-x: contain; }
.table-scroll-hint { margin: 10px 0 0; font-size: 13px; line-height: 1.4; color: #4b5563; }
.aci-table { min-width: 520px; }
.table.totals, table.totals { min-width: 0; width: 100%; max-width: 420px; table-layout: auto; }
.invoice-box, .footer-company, .content-item, .account-menu { overflow-wrap: anywhere; }
.form-grid input:not([type="checkbox"]):not([type="radio"]), .form-grid select, .form-grid textarea { min-width: 0; max-width: 100%; }
/* Gli importi restano interi: la tabella scorre, i numeri non vengono troncati. */
.table.month-summary { min-width: 680px; table-layout: auto; }
.month-summary th, .month-summary td { overflow: visible; text-overflow: clip; }
.month-summary tbody th { background: transparent; color: var(--ink, #141414); font-size: 16px; text-transform: capitalize; font-weight: 700; }
.month-summary .total-row th { background: var(--cyan, #61b2c8); color: #fff; text-transform: uppercase; font-size: 21px; }
.table.month-summary .total-row td { white-space: nowrap; }
body > header { grid-template-columns: auto minmax(0, 1fr) auto; }
body > header > nav { min-width: 0; }
/* Stessa soglia del controller nav-active.js, senza intervalli con entrambi i menu nascosti. */
@media (max-width: 1200px) {
  body > header { position: relative; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px; border-radius: 24px; }
  body > header .nav-toggle { display: inline-flex; justify-self: end; }
  body > header > nav { position: absolute; top: calc(100% + 10px); left: 0; right: 0; display: none; flex-direction: column; align-items: stretch; gap: 4px; padding: 12px; background: #fff; border: 1px solid #dfe3ea; border-radius: 20px; box-shadow: 0 24px 60px rgba(15,23,42,.18); z-index: 90; max-height: calc(100dvh - 110px); overflow-y: auto; }
  body > header.nav-open > nav { display: flex; }
  body > header > nav > a, body > header > nav > button { padding: 12px 14px; border-radius: 12px; font-size: 16px; text-align: left; color: #1d1d1f; }
  body > header > nav .header-actions, body > header > nav .actions { display: flex; flex-direction: column; align-items: stretch; gap: 8px; margin: 6px 0 0; padding-top: 10px; border-top: 1px solid #dfe3ea; }
  body > header > nav .header-actions > *, body > header > nav .actions > * { max-width: 100%; }
  body > header > nav .auth-status, body > header > nav .btn, body > header > nav .ghost { width: 100%; justify-content: center; white-space: normal; min-height: 42px; }
  body > header > nav .account-menu { position: static; width: 100%; max-height: none; margin-top: 8px; box-shadow: none; }
}
@media (max-width: 600px) {
  body > header { padding-left: 14px; padding-right: 14px; }
  .invoice.card { padding: 18px; }
  .invoice h2 { font-size: 24px; }
  .table.month-summary th, .table.month-summary td { padding: 10px 12px; }
  .table.month-summary td.money, .table.month-summary td.km, .table.month-summary td.perc, .table.month-summary .total-row th, .table.month-summary .total-row td { font-size: 16px; }
}
@media print {
  .table-scroll-hint { display: none; }
  .table-wrap, .cmp-wrap { overflow: visible; }
  .table.month-summary { min-width: 0; }
}

/* ===== Footer a colonne (HTML riscritto dalla build su ogni pagina). Qui in layout.css
   perché caricato per ultimo su TUTTE le pagine, comprese quelle con CSS critico inline. ===== */
/* Footer come area grigia identificabile, con aria sopra/sotto ed interna. */
.site-footer { display: block; margin: clamp(56px,6vw,80px) clamp(18px,5vw,70px) 32px; padding: clamp(34px,4vw,52px) clamp(22px,3vw,46px); background: #e9edf2; border: 1px solid var(--line,#dfe3ea); border-radius: 30px; }
.footer-cols { display: grid; grid-template-columns: 1.1fr 1.3fr 1.15fr .65fr; gap: 30px; align-items: start; }
.footer-col { display: flex; flex-direction: column; gap: 9px; min-width: 0; }
.footer-col > strong { font-size: 15px; color: var(--ink,#141414); font-weight: 850; }
.footer-col p { font-size: 12.5px; line-height: 1.5; margin: 0; color: var(--muted,#6b7280); }
.footer-col--company p:first-of-type { color: var(--ink,#141414); font-weight: 750; }
.footer-col--brand .brand { margin: 0 0 4px; }
.footer-col--brand .brand-mark { width: 46px; height: 46px; }
.footer-actions { display: flex; flex-direction: row; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 2px; }
.footer-actions .ghost, .footer-actions .telegram-btn { min-height: 36px; padding: 0 15px; font-size: 13px; font-weight: 750; }
.footer-col--legal a { color: var(--blue,#0071e3); font-weight: 800; font-size: 13px; }
.ai-image-notice { margin: 24px 0 0; padding-top: 16px; border-top: 1px solid var(--line,#dfe3ea); font-size: 13px; line-height: 1.5; color: var(--muted,#6b7280); text-align: center; }
.ai-image-notice a { color: var(--blue,#0071e3); font-weight: 800; }
@media (max-width: 900px) { .footer-cols { grid-template-columns: 1fr 1fr; gap: 24px; } }
@media (max-width: 560px) { .footer-cols { grid-template-columns: 1fr; gap: 20px; } }

/* Sottogruppi del menu admin */
.account-menu-sub { padding: 8px 10px 4px; margin-top: 8px; border-top: 1px solid var(--line,#dfe3ea); color: var(--muted,#6b7280); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.account-menu-title + .account-menu-sub { margin-top: 2px; border-top: 0; }

/* Flag di completamento accanto ai titoli delle card del profilo */
/* -webkit-text-fill-color:currentColor annulla l'effetto testo-trasparente ereditato dagli h2 (titoli a gradiente), altrimenti il testo del badge resta invisibile. */
.acct-flag { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 800; padding: 4px 11px; border-radius: 999px; vertical-align: middle; margin-left: 10px; letter-spacing: .01em; line-height: 1.2; -webkit-text-fill-color: currentColor; }
.acct-flag.todo { background: #fdecec; color: #c0271e; border: 1px solid #f4c4c0; }
.acct-flag.done { background: #e8f7f0; color: #067a51; border: 1px solid #b6e6cf; }
.profile-grid .full-row { grid-column: 1 / -1; }

/* Header identico su tutte le pagine: saluto utente (non-admin) come testo semplice non
   cliccabile, a sinistra dei bottoni "Il tuo cruscotto" ed "Esci". */
.greeting-plain { background: transparent; border: 0; padding: 0 6px; margin: 0; color: var(--ink,#141414); font-weight: 400; font-size: 16px; white-space: nowrap; cursor: default; pointer-events: none; -webkit-text-fill-color: currentColor; }
#accountMenuWrap { order: -1; }
#headerLogout { order: 1; }

/* Griglia "cruscotto" delle 6 card (usata sul cruscotto e in home per gli utenti loggati) */
/* In home la sezione è un pannello blu con titolo + descrizione e le card bianche dentro. */
.dash-on-home { max-width: 1120px; margin: 40px auto; padding: clamp(26px,4vw,44px); background: linear-gradient(135deg,#0b3a78,#0a54cf); border-radius: 32px; box-shadow: 0 24px 70px rgba(15,23,42,.18); }
.dash-panel-eyebrow { color: rgba(255,255,255,.72); }
.dash-panel-title { color: #fff; -webkit-text-fill-color: #fff; background: none; font-size: clamp(24px,3vw,34px); margin: 4px 0 8px; }
.dash-panel-lead { color: rgba(255,255,255,.85); font-size: 16px; line-height: 1.5; max-width: 780px; margin: 0; }
.dash-on-home .dash-grid { margin-top: 22px; }
.dash-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 18px; margin-top: 8px; }
.dash-grid .dash-card { margin-top: 0; }
.dash-grid .dash-card { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 14px; text-decoration: none; color: inherit; transition: transform .15s, box-shadow .15s; }
.dash-grid .dash-card:hover { transform: translateY(-2px); box-shadow: 0 18px 44px rgba(15,23,42,.12); }
.dash-grid .dash-card .eyebrow { margin: 0 0 6px; }
.dash-grid .dash-card h2 { margin: 0 0 6px; font-size: 22px; }
.dash-grid .dash-card p { margin: 0; color: var(--muted,#6b7280); font-size: 15px; line-height: 1.4; }
.dash-grid .dash-arrow { font-size: 30px; color: var(--blue,#0071e3); font-weight: 900; line-height: 1; -webkit-text-fill-color: currentColor; }
.dash-flag { display: inline-flex; align-items: center; gap: 6px; margin-top: 12px; font-size: 12.5px; font-weight: 800; padding: 5px 11px; border-radius: 999px; letter-spacing: .01em; line-height: 1.2; -webkit-text-fill-color: currentColor; }
.dash-flag.todo { background: #fdecec; color: #c0271e; border: 1px solid #f4c4c0; }
.dash-flag.done { background: #e8f7f0; color: #067a51; border: 1px solid #b6e6cf; }
.dash-card.todo { border-left: 4px solid #c0271e; }
@media (max-width: 760px) { .dash-grid { grid-template-columns: 1fr; } }
/* Ordine card nella seconda griglia del profilo: abbonamento|documenti, carte|modifiche, eliminazione a tutta larghezza */
#abbonamento { order: 1; } #documenti-iscrizione { order: 2; } #carta-pagamento { order: 3; } #modifiche-da-recuperare { order: 4; } #eliminazione-account { order: 5; }
