/* ─── DESIGN SYSTEM & VARIABLES ─────────────────────────────────────────────── */
:root {
  --primary-color: #2c5f8a;
  --primary-hover: #245070;
  --bg-body: #f4f7fb;
  --bg-card: #ffffff;
  --text-main: #1f2937;
  --text-muted: #6b7280;
  --border-color: #e5e7eb;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --radius-md: 10px;
  --radius-lg: 14px;
}

/* ─── RESET & BASE ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-body);
  color: var(--text-main);
  display: flex;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a { color: var(--primary-color); text-decoration: none; transition: color 0.15s; }
a:hover { text-decoration: none; color: var(--primary-hover); }

/* ─── UTILITY CLASSES ──────────────────────────────────────────────────────── */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.w-full { width: 100%; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.text-sm { font-size: 0.875rem; }
.text-muted { color: var(--text-muted); }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.lucide { stroke-width: 2; width: 18px; height: 18px; }
.lucide-sm { width: 14px; height: 14px; }
.lucide-lg { width: 22px; height: 22px; }


/* ─── SIDEBAR ──────────────────────────────────────────────────────────────── */
.sidebar {
  width: 220px;
  min-width: 220px;
  background: #1a2e45;
  color: white;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform .25s;
}
.sidebar-logo {
  padding: 1.25rem 1.25rem 1rem;
  display: flex;
  align-items: center;
  gap: .6rem;
  border-bottom: 1px solid rgba(255,255,255,.1);
}
.logo-icon { font-size: 1.5rem; }
.logo-text { font-size: 1.05rem; font-weight: 700; color: #e2e8f0; }
.nav-links { list-style: none; flex: 1; padding: .75rem 0; }
.nav-links li a {
  display: flex; align-items: center; gap: .75rem;
  padding: .7rem 1.25rem;
  color: #a0aec0;
  font-size: .95rem;
  font-weight: 500;
  transition: all .2s ease;
  border-radius: 0 8px 8px 0;
  margin-right: .75rem;
}
.nav-links li a:hover { background: rgba(255,255,255,.07); color: white; text-decoration: none; }
.nav-links li a.active { background: rgba(74,155,142,.28); color: #a7f3e4; font-weight: 700; border-left: 4px solid #4a9b8e; }
.nav-icon { display: flex; align-items: center; justify-content: center; width: 20px; }
.sidebar-footer { padding: 1rem 1.25rem; border-top: 1px solid rgba(255,255,255,.1); }
.btn-backup {
  display: block; text-align: center;
  background: rgba(255,255,255,.08); color: #a0aec0;
  padding: .5rem; border-radius: 8px; font-size: .82rem;
  transition: background .15s;
}
.btn-backup:hover { background: rgba(255,255,255,.15); color: white; text-decoration: none; }
.sidebar-brand {
  display: block; text-align: center; margin-top: .5rem;
  font-size: .72rem; color: rgba(255,255,255,.35); letter-spacing: .04em;
  transition: color .15s;
}
.sidebar-brand:hover { color: rgba(255,255,255,.7); text-decoration: none; }
/* ─── MOBILE TOPBAR (visibile solo ≤768px) ─────────────────────────────────── */
.mobile-topbar {
  display: none; position: fixed; top: 0; left: 0; right: 0; z-index: 200;
  align-items: center; gap: .5rem;
  height: calc(3.25rem + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) .5rem 0;
  background: #1a2e45; color: #fff;
  box-shadow: 0 2px 10px rgba(0,0,0,.18);
}
.topbar-title {
  flex: 1; font-size: 1rem; font-weight: 700; color: #e2e8f0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.menu-toggle, .topbar-action {
  display: flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; flex-shrink: 0;
  background: none; color: #e2e8f0; border: none; border-radius: 10px;
  cursor: pointer; transition: background .15s;
}
.menu-toggle:active, .topbar-action:active { background: rgba(255,255,255,.12); }
.menu-toggle .lucide, .topbar-action .lucide { width: 24px; height: 24px; }
.sidebar-backdrop {
  display: none; position: fixed; inset: 0; z-index: 99;
  background: rgba(15,23,42,.5);
  opacity: 0; transition: opacity .25s;
}
.sidebar-backdrop.show { display: block; opacity: 1; }
body.sidebar-open { overflow: hidden; }

/* ─── MAIN CONTENT ─────────────────────────────────────────────────────────── */
.main-content {
  margin-left: 220px;
  flex: 1;
  padding: 1.5rem 1.75rem 5rem;
  max-width: 100%;
  overflow-x: hidden;
}

.page-title {
  font-size: 1.6rem;
  font-weight: 700;
  margin: 0 0 1.25rem;
  color: var(--text-main);
  letter-spacing: -.01em;
}

/* Box collassabile "Prossimi Check-in" nella dashboard (details/summary). */
details.card > summary { list-style: none; }
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary .chevron { transition: transform .2s ease; }
details.card[open] > summary .chevron { transform: rotate(180deg); }
@media (prefers-reduced-motion: reduce) {
  details.card > summary .chevron { transition: none; }
}

/* ─── PAGE HEADER ──────────────────────────────────────────────────────────── */
.page-header {
  display: flex; align-items: center; gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}
.page-header h1 { font-size: 1.5rem; font-weight: 700; flex: 1; }
.header-actions { display: flex; gap: .5rem; }

/* ─── BUTTONS ──────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .55rem 1.1rem; border-radius: 8px; font-size: .88rem;
  font-weight: 600; border: none; cursor: pointer; transition: all .15s;
  text-decoration: none; white-space: nowrap;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn-primary { background: #2c5f8a; color: white; }
.btn-primary:hover { background: #245070; }
.btn-outline { background: white; color: #2c5f8a; border: 1.5px solid #2c5f8a; }
.btn-outline:hover { background: #ebf4ff; }
.btn-danger { background: #fff5f5; color: #c53030; border: 1.5px solid #feb2b2; }
.btn-danger:hover { background: #fed7d7; }
.btn-sm { padding: .35rem .75rem; font-size: .82rem; }
.btn-xs { padding: .2rem .5rem; font-size: .78rem; }
.btn-lg { padding: .75rem 1.5rem; font-size: 1rem; }
.w-full { width: 100%; justify-content: center; }

/* ─── CARDS ────────────────────────────────────────────────────────────────── */
.card {
  background: white; border-radius: 12px;
  box-shadow: 0 1px 8px rgba(0,0,0,.07);
  overflow: hidden;
}
.card-header {
  padding: .85rem 1.25rem; font-weight: 600; font-size: .95rem;
  background: #f7fafc; border-bottom: 1px solid #e2e8f0;
  display: flex; align-items: center; gap: .5rem;
}
.card-body { padding: 1.25rem; }
.card-footer { padding: .75rem 1.25rem; background: #f7fafc; border-top: 1px solid #e2e8f0; }
.mb-3 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 1.5rem; }
.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 1.5rem; }
.p-0 { padding: 0; }
.overflow-x { overflow-x: auto; }
.d-flex-between { justify-content: space-between; }
.d-block { display: block; }
.text-muted { color: #718096; font-size: .88rem; }
.text-right { text-align: right; }

/* ─── WIDGETS ──────────────────────────────────────────────────────────────── */
.widgets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.widget {
  background: white; border-radius: 10px;
  box-shadow: 0 1px 8px rgba(0,0,0,.07);
  padding: .7rem 1rem;
  display: flex; align-items: center; gap: 1rem;
  border-left: 4px solid transparent;
}
.widget-green { border-left-color: #38a169; }
.widget-blue  { border-left-color: #3182ce; }
.widget-orange{ border-left-color: #dd6b20; }
.widget-red   { border-left-color: #e53e3e; }
/* Utile (verde chiaro) / Perdita (rosso chiaro): badge per casa in dashboard */
.widget-utile   { background: #f0fff4; border-left-color: #38a169; }
.widget-utile   .widget-value { color: #276749; }
.widget-perdita { background: #fff5f5; border-left-color: #e53e3e; }
.widget-perdita .widget-value { color: #c53030; }
.widget-icon  { font-size: 1.4rem; }
.widget-label { font-size: .72rem; color: #718096; text-transform: uppercase; letter-spacing: .04em; }
.widget-value { font-size: 1.15rem; font-weight: 700; color: #2d3748; }
/* Badge annuali: stessa lingua dei mensili, icona calendario + hint li
   distinguono. Il totale generale è la cifra headline della dashboard:
   card scura, valore colorato secondo il segno. */
.widget-annuale .widget-icon { color: #718096; }
.widget-totale {
  background: linear-gradient(135deg, #2d3748, #1a202c);
  border-left-color: #2b6cb0;
}
.widget-totale .widget-icon  { color: #63b3ed; }
.widget-totale .widget-label { color: #a0aec0; }
.widget-totale .widget-hint  { color: #718096; }
.widget-totale .widget-value.tot-pos { color: #9ae6b4; }
.widget-totale .widget-value.tot-neg { color: #feb2b2; }

/* ─── TABLES ───────────────────────────────────────────────────────────────── */
.table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.table th {
  padding: .65rem .9rem; text-align: left;
  background: #f7fafc; border-bottom: 2px solid #e2e8f0;
  font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: #4a5568;
  white-space: nowrap;
}
.table td { padding: .65rem .9rem; border-bottom: 1px solid #edf2f7; vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: #f7fafc; }
.table-footer-row td { background: #edf2f7; font-weight: 600; border-top: 2px solid #e2e8f0; }
.table-sm th, .table-sm td { padding: .45rem .75rem; }
.prima-nota-table td, .prima-nota-table th { font-size: .82rem; }
/* Vince su `.table th { text-align:left }`: header allineato come i valori. */
.table th.text-right, .table td.text-right { text-align: right; }
.table th.text-center, .table td.text-center { text-align: center; }

/* ─── CALENDAR ─────────────────────────────────────────────────────────────── */
.calendar-nav { justify-content: space-between; align-items: center; }
.calendar-title { font-size: 1.05rem; font-weight: 700; }
.calendar-table { width: 100%; border-collapse: collapse; font-size: .82rem;
  table-layout: fixed; }   /* fixed: le colonne giorno riempiono la larghezza */
.calendar-table td { border: 1px solid #e2e8f0; vertical-align: middle; padding: 0; }

/* ── Layout invertito: camere nelle righe, giorni nelle colonne ── */
/* Colonna sinistra (nomi camera) sticky così resta visibile scrollando */
.calendar-flip th.cal-corner,
.calendar-flip td.cal-room-label {
  position: sticky; left: 0; z-index: 2;
  min-width: 128px; width: 128px; max-width: 128px;
  background: #fff; text-align: left;
  padding: .15rem .45rem; border-right: 2px solid #cbd5e0;
}
.calendar-flip tbody tr:hover td.cal-room-label { background: #f7fafc; }
.cal-room-label-inner { display: flex; align-items: center; gap: .5rem; }
.calendar-flip thead th.cal-corner {
  position: sticky; left: 0; z-index: 3;
  min-width: 128px; width: 128px; max-width: 128px;
  background: #f7fafc; font-size: .66rem; font-weight: 600; color: #718096;
  text-transform: uppercase; letter-spacing: .04em;
  text-align: left; padding: .3rem .45rem; border-right: 2px solid #cbd5e0;
}
.cal-room-info { display: flex; flex-direction: row; align-items: baseline; gap: .3rem; line-height: 1.15; min-width: 0; }
.cal-room-name { font-weight: 700; color: #2d3748; font-size: .74rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-room-house { display: none; }   /* ridondante col pallino casa: riga più bassa */

/* Mark casa: badge circolare colorato (riusa house-A / house-B), codice corto */
.house-pill {
  display: inline-flex; align-items: center; justify-content: center;
  width: 17px; height: 17px; min-width: 17px; border-radius: 50%;
  font-size: .6rem; font-weight: 700; flex-shrink: 0;
}

/* Le due metà del mese (1-15 / 16-31) sono lo stesso planning piegato su due
   righe. Le stacca una linea sottile centrata nel respiro, così l'occhio
   non legge la seconda metà come continuazione delle righe della prima. */
.cal-half + .cal-half {
  margin-top: 2.5rem;
  border-top: 1px solid #e2e8f0;
  padding-top: 2.5rem;
}

/* Intestazione giorni (colonne) */
.calendar-flip th.cal-day {
  width: auto; padding: .18rem .1rem;
  text-align: center; font-size: .68rem; color: #4a5568;
  background: #f7fafc; border-bottom: 2px solid #e2e8f0;
}
.calendar-flip th.cal-day .cal-day-num { font-weight: 700; color: #2d3748; }
.calendar-flip th.cal-day.weekend { background: #fff7ed; }
.calendar-flip th.cal-day.today {
  background: #2b6cb0; color: #fff; border-radius: 7px 7px 0 0;
}
.calendar-flip th.cal-day.today .cal-day-num,
.calendar-flip th.cal-day.today .cal-day-name { color: #fff; }

/* Celle giorno: sottili come un planning cartaceo (richiesta clienti) */
.cal-cell { height: 26px; text-align: center; transition: background .1s;
  background: #fbfdff; }   /* sfondo neutro: il colore sta nella pillola interna */
/* Colonna "oggi": sfondo azzurro + righe blu laterali per tutta l'altezza */
.cal-cell.today-col { background: #ebf3fb;
  box-shadow: inset 1px 0 0 #2b6cb0, inset -1px 0 0 #2b6cb0; }

/* La cella libera resta neutra; le celle con prenotazione NON colorano più lo
   sfondo: il colore-stato vive nella pillola .cal-pill (look a barra moderna). */
.cal-libera { background: #fbfdff; }

.cal-link { display: flex; align-items: stretch; justify-content: stretch;
  width: 100%; height: 100%; padding: 2px; text-decoration: none; }

/* Pillola prenotazione: barra sottile, colore = stato */
.cal-pill {
  display: flex; align-items: center; justify-content: center;
  width: 100%; height: 100%; border-radius: 4px; padding: 0 .35rem;
  box-shadow: 0 1px 1px rgba(0,0,0,.10); overflow: hidden;
  transition: filter .12s;
}
.cal-link:hover .cal-pill { filter: brightness(1.08); }
.cal-arrivo   .cal-pill { background: #38a169; }   /* 🟢 in arrivo (futuro) */
.cal-corso    .cal-pill { background: #ecc94b; }   /* 🟡 in corso / da chiudere */
.cal-avvenuta .cal-pill { background: #e53e3e; }   /* 🔴 avvenuta + contabilità chiusa */
.cal-bloccato .cal-pill { background: #718096; color: #fff; cursor: pointer; }  /* ⬛ blocco manuale owner */
.cal-bloccato .cal-pill:hover { filter: brightness(1.08); }
/* Cella libera FUTURA: cliccabile per bloccare la camera (hover a tratteggio). */
.cal-blockable { cursor: pointer; transition: background .12s, box-shadow .12s; }
.cal-blockable:hover { background: #eef2f7; box-shadow: inset 0 0 0 1.5px #a0aec0; }

/* Nome: SEMPRE una riga, font uniforme, ellipsis. Mai parole spezzate. */
.cal-name { font-size: .66rem; font-weight: 600; color: #fff; line-height: 1;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.cal-corso .cal-name { color: #44391b; }   /* giallo chiaro -> testo scuro leggibile */

.legend { display: flex; gap: 1.5rem; flex-wrap: wrap; }
.legend-item { display: flex; align-items: center; gap: .4rem; font-size: .82rem; }
.legend-dot { width: 16px; height: 16px; border-radius: 4px; display: inline-block; }
.legend-dot.cal-libera   { background: #fbfdff; border: 1px solid #cbd5e0; }
.legend-dot.cal-arrivo   { background: #38a169; border: 1px solid #2f855a; }
.legend-dot.cal-corso    { background: #ecc94b; border: 1px solid #d69e2e; }
.legend-dot.cal-avvenuta { background: #e53e3e; border: 1px solid #c53030; }
.legend-dot.cal-bloccato { background: #718096; border: 1px solid #4a5568; }

/* ─── WEEKEND STYLING ──────────────────────────────────────────────────────── */
.cal-day.weekend {
  background: #f0f9ff;
  border-bottom-color: #b3deff;
}
.cal-day.weekend .cal-day-name {
  color: #d97706;
  font-weight: 600;
}
.weekend-empty {
  background: #f8fcff !important;
}
.cal-cell.has-weekend {
  border-right-width: 2px;
  border-right-color: #d97706;
}

/* Nomi dei giorni negli header (compatti: due righe strette) */
.cal-day-num {
  display: block;
  font-weight: 700;
  font-size: .74rem;
  margin-bottom: 0;
  line-height: 1.15;
}
.cal-day-name {
  display: block;
  font-size: .58rem;
  color: #718096;
  font-weight: 500;
  line-height: 1.1;
}

/* ─── BADGES ───────────────────────────────────────────────────────────────── */
.badge {
  display: inline-block; padding: .25rem .6rem; border-radius: 20px;
  font-size: .75rem; font-weight: 600;
}
.badge-green  { background: #c6f6d5; color: #276749; }
.badge-yellow { background: #fefcbf; color: #744210; }
.badge-blue   { background: #bee3f8; color: #2a69ac; }
.badge-red    { background: #fed7d7; color: #9b2c2c; }

/* ─── DATE BADGES (check-in verde / check-out rosso) ───────────────────────── */
.date-badge {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .3rem .7rem; border-radius: 8px;
  font-size: 1.05rem; font-weight: 700; line-height: 1;
  border: 1.5px solid transparent;
}
.date-badge .lucide-sm { width: 16px; height: 16px; }
.date-badge-in  { background: #d7f5df; color: #1c7a3e; border-color: #7ed09a; }
.date-badge-out { background: #fde0e0; color: #b02a2a; border-color: #f0a3a3; }

/* ─── FILTER TABS ──────────────────────────────────────────────────────────── */
.filter-tabs, .tab-group { display: flex; gap: .5rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.tab {
  padding: .4rem .9rem; border-radius: 20px; font-size: .85rem; font-weight: 500;
  background: white; color: #4a5568; border: 1.5px solid #e2e8f0;
  cursor: pointer; transition: all .15s; text-decoration: none;
}
.tab:hover { border-color: #2c5f8a; color: #2c5f8a; text-decoration: none; }
.tab.active { background: #2c5f8a; color: white; border-color: #2c5f8a; }
.filter-label { align-self: center; font-size: .8rem; font-weight: 600; color: #718096; margin-right: .25rem; }
.filter-row { display: flex; gap: 1.25rem; align-items: flex-end; flex-wrap: wrap; margin-bottom: 1.25rem; }
.date-range-filter { display: flex; gap: 1rem; align-items: flex-end; flex-wrap: wrap; margin-bottom: 1.5rem;
  background: #fff; padding: 1rem 1.25rem; border-radius: 10px; border: 1px solid #e2e8f0; }
.date-range-filter .form-group { display: flex; flex-direction: column; gap: .35rem; margin: 0; }
.date-range-filter label { font-size: .78rem; font-weight: 600; color: #4a5568; text-transform: uppercase; letter-spacing: .04em; }
.date-range-filter input[type=date] { min-width: 160px; }

/* Toggle casa: badge cliccabili che si colorano quando attivi */
.house-toggle { display: inline-flex; gap: .4rem; }
.house-opt { cursor: pointer; padding: .55rem 1.1rem; border-radius: 8px;
  border: 1.5px solid #e2e8f0; background: #fff; color: #4a5568;
  font-size: .88rem; font-weight: 600; user-select: none; transition: all .15s; white-space: nowrap; }
.house-opt input { display: none; }
.house-opt:hover { border-color: #cbd5e0; }
.house-opt.active { background: #4a5568; border-color: #4a5568; color: #fff; }  /* "Tutte" */
.house-opt.active.house-opt-A { background: #2c5f8a; border-color: #2c5f8a; color: #fff; }
.house-opt.active.house-opt-B { background: #2f855a; border-color: #2f855a; color: #fff; }

/* Prima Nota: margine + costi casa affiancati (collassa su mobile) */
.pn-summary-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 1rem; align-items: start; }
@media (max-width: 760px) { .pn-summary-grid { grid-template-columns: 1fr; } }

/* ─── PULIZIE: badge addetti + calendario ──────────────────────────────────── */
.staff-badge { background: #ebf8ff; color: #2c5282; border: 1px solid #bee3f8;
  padding: .45rem .9rem; border-radius: 20px; font-size: .85rem; font-weight: 600; }
.clean-legend { display: flex; gap: 1.25rem; flex-wrap: wrap; margin-bottom: 1rem; }
.clean-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(46px, 1fr)); gap: .35rem; }
.clean-day { border: 1px solid #e2e8f0; border-radius: 8px; padding: .3rem .2rem; text-align: center;
  min-height: 56px; background: #fff; display: flex; flex-direction: column; align-items: center; }
.clean-day.holiday { background: #fff5f5; border-color: #fed7d7; }
.clean-day.has-clean { box-shadow: inset 0 -3px 0 rgba(0,0,0,.04); }
.cd-num { font-weight: 700; font-size: .85rem; color: #2d3748; }
.cd-wd { font-size: .6rem; color: #a0aec0; text-transform: uppercase; }
.cd-dots { display: flex; gap: 2px; flex-wrap: wrap; justify-content: center; margin-top: .2rem; }
.cd-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.filter-group { display: flex; flex-direction: column; gap: .35rem; }
.filter-group label { font-size: .8rem; font-weight: 600; color: #4a5568; text-transform: uppercase; letter-spacing: .04em; }

/* ─── FORMS ────────────────────────────────────────────────────────────────── */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; }
.form-group { display: flex; flex-direction: column; gap: .35rem; }
.form-group label { font-size: .83rem; font-weight: 600; color: #4a5568; }
.form-control, input[type=text], input[type=number], input[type=date],
input[type=email], input[type=tel], select, textarea {
  padding: .6rem .85rem; border: 1.5px solid #e2e8f0; border-radius: 8px;
  font-size: .9rem; font-family: inherit; transition: border-color .15s;
  background: white; color: #2d3748; width: 100%;
}
.form-control:focus, input:focus, select:focus, textarea:focus {
  outline: none; border-color: #2c5f8a;
  box-shadow: 0 0 0 3px rgba(44,95,138,.1);
}
.form-control-sm { padding: .4rem .7rem; font-size: .85rem; border: 1.5px solid #e2e8f0; border-radius: 7px; }
.form-actions { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; padding: 1rem 0; }
.highlight-field input { background: #f0fff4; border-color: #9ae6b4; font-weight: 700; }
.parsed-field { background: #ebf8ff !important; border-color: #63b3ed !important; }
.hint { font-size: .75rem; color: #718096; font-weight: 400; }
.optional-tag { font-size: .78rem; color: #718096; font-weight: 400; }
.step-badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 50%;
  background: #2c5f8a; color: white; font-size: .78rem; font-weight: 700; flex-shrink: 0;
}

/* ─── PDF UPLOAD ───────────────────────────────────────────────────────────── */
.pdf-upload-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1rem; }
@media (max-width: 768px) { .pdf-upload-grid { grid-template-columns: 1fr; } }
.upload-zone {
  border: 2px dashed #cbd5e0; border-radius: 10px; padding: 2rem;
  text-align: center; cursor: pointer; transition: all .2s; background: #f7fafc;
}
.upload-zone:hover, .upload-zone.drag-over { border-color: #2c5f8a; background: #ebf4ff; }
.upload-icon { font-size: 2.5rem; margin-bottom: .5rem; }
.parse-status { display: flex; align-items: center; gap: .75rem; padding: .75rem; color: #4a5568; }
.parse-result { padding: .75rem 1rem; border-radius: 8px; margin-top: .75rem; font-size: .88rem; }
.parse-success { background: #c6f6d5; color: #276749; }
.parse-error { background: #fed7d7; color: #9b2c2c; }
.spinner {
  width: 20px; height: 20px; border: 2px solid #e2e8f0;
  border-top-color: #2c5f8a; border-radius: 50%;
  animation: spin .6s linear infinite; flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── FINANCIAL ────────────────────────────────────────────────────────────── */
.financial-preview, .financial-breakdown {
  background: #f7fafc; border-radius: 10px; padding: 1rem; margin-top: 1rem;
}
.fin-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: .35rem 0; font-size: .9rem;
}
.fin-divider { border-top: 1px solid #e2e8f0; margin-top: .25rem; padding-top: .6rem; }
.fin-subtotal strong, .fin-total strong { font-size: 1.05rem; }
.fin-total { border-top: 2px solid #e2e8f0; margin-top: .25rem; padding-top: .6rem; font-weight: 700; }
.fin-total-banner {
  display: flex; justify-content: space-between; align-items: center;
  padding: 1rem 1.25rem; font-size: 1rem; font-weight: 600;
}
.amount-positive { color: #276749; }
.amount-negative { color: #9b2c2c; }

/* ─── ROOM SELECTOR ────────────────────────────────────────────────────────── */
.rooms-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.house-label {
  font-size: .78rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; padding: .35rem .7rem; border-radius: 6px;
  display: inline-block; margin-bottom: .6rem;
}
.house-A, .house-label.house-A { background: #bee3f8; color: #2a69ac; }
.house-B, .house-label.house-B { background: #c6f6d5; color: #276749; }
.house-tag { font-size: .72rem; font-weight: 600; padding: .15rem .45rem; border-radius: 4px; }
.room-option {
  display: flex; align-items: center; gap: .75rem;
  padding: .7rem .9rem; border: 1.5px solid #e2e8f0; border-radius: 8px;
  cursor: pointer; margin-bottom: .5rem; transition: all .15s;
}
.room-option:hover { border-color: #2c5f8a; background: #ebf4ff; }
.room-option input[type=radio],
.room-option input[type=checkbox] { cursor: pointer; width: 16px; height: 16px; }
.room-opt-name { flex: 1; font-weight: 500; font-size: .9rem; }
.room-avail { font-size: .78rem; white-space: nowrap; }
.avail-ok { color: #276749; }
.avail-no { color: #9b2c2c; }
.room-selected { border-color: #2c5f8a; background: #ebf8ff; }
.room-unavailable { opacity: .55; }
/* Multi-camera: input ospiti per camera selezionata */
.room-guests, .camera-guests-wrap { display: inline-flex; align-items: center; gap: .25rem; font-size: .8rem; }
.room-guests input, .camera-guests-wrap input { padding: .2rem .3rem; border: 1px solid #cbd5e0; border-radius: 6px; }

/* ─── BOOKING TABLE ─────────────────────────────────────────────────────────── */
.bookings-table-wrap { background: white; border-radius: 14px; box-shadow: 0 1px 8px rgba(0,0,0,.07); overflow: hidden; }
.bookings-table { width: 100%; border-collapse: collapse; }
.bookings-table thead tr { background: #1a2e45; }
.bookings-table thead th {
  padding: .7rem 1rem; text-align: left; font-size: .75rem; font-weight: 600;
  color: #a0c4e8; text-transform: uppercase; letter-spacing: .06em; white-space: nowrap;
}
.bookings-table tbody tr {
  border-bottom: 1px solid #f0f4f8; transition: background .12s; cursor: pointer;
}
.bookings-table tbody tr:last-child { border-bottom: none; }
.bookings-table tbody tr:hover { background: #f0f7ff; }
.bookings-table td { padding: .75rem 1rem; vertical-align: middle; font-size: .88rem; }

/* status left border stripe */
.booking-row-confermata { border-left: 4px solid #4a9b8e; }
.booking-row-in_corso   { border-left: 4px solid #f6ad55; }
.booking-row-conclusa   { border-left: 4px solid #a0aec0; }
.booking-row-cancellata { border-left: 4px solid #fc8181; }

.guest-name { font-weight: 700; font-size: .95rem; color: #1a2e45; }
.guest-nat  { font-size: .75rem; color: #718096; }
/* Pallino nota: indica una prenotazione con note/richieste particolari */
.note-dot { display: inline-flex; align-items: center; justify-content: center;
  margin-left: .35rem; font-size: .72rem; line-height: 1; cursor: help;
  background: #fef3c7; border: 1px solid #f6c453; border-radius: 999px;
  width: 18px; height: 18px; vertical-align: middle; }

.bk-source-badge {
  display: inline-block; padding: .15rem .5rem; border-radius: 20px;
  font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
}
.bk-source-booking  { background: #ebf8ff; color: #2b6cb0; }
.bk-source-airbnb   { background: #fff5f5; color: #c53030; }
.bk-source-manual   { background: #f0fff4; color: #276749; }
.bk-source-vrbo     { background: #faf5ff; color: #6b46c1; }

.amount-col { font-weight: 700; color: #2d7d5f; font-size: .95rem; }
.nights-col { color: #4a5568; }

.doc-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: .3rem; }
.doc-ok   { background: #48bb78; }
.doc-miss { background: #f6ad55; }

.action-cell { white-space: nowrap; text-align: right; }
.btn-details { padding: .3rem .75rem; border-radius: 6px; font-size: .8rem; font-weight: 600;
  background: #ebf4ff; color: #2c5f8a; border: 1px solid #bee3f8; text-decoration: none; transition: background .12s; }
.btn-details:hover { background: #bee3f8; color: #1a365d; text-decoration: none; }
.btn-del { padding: .3rem .6rem; border-radius: 6px; font-size: .8rem; background: #fff5f5;
  color: #c53030; border: 1px solid #fed7d7; cursor: pointer; transition: background .12s; }
.btn-del:hover { background: #fed7d7; }

/* legacy — keep for detail page */
.info-label { font-size: .72rem; color: #718096; text-transform: uppercase; letter-spacing: .04em; display: block; }
.nationality { margin-left: .5rem; font-size: .78rem; color: #718096; }
.booking-card-actions { display: flex; gap: .5rem; justify-content: flex-end; padding-top: .75rem; border-top: 1px solid #edf2f7; }

/* ─── DETAIL PAGE ──────────────────────────────────────────────────────────── */
.detail-grid { display: grid; grid-template-columns: 1fr 340px; gap: 1.5rem; align-items: start; }
.info-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.info-item { padding: .25rem 0; }
.notes-box { background: #fffbeb; border: 1px solid #f6e05e; border-radius: 8px; padding: .75rem 1rem; font-size: .88rem; }
.questura-notice { background: #fff5f5; border: 1px solid #fc8181; border-radius: 8px; padding: .75rem 1rem; font-size: .82rem; color: #742a2a; }
.checkin-link-box { }
.cat-badge { display: inline-block; padding: .2rem .5rem; border-radius: 5px; font-size: .75rem; font-weight: 600; }
.cat-lavanderia { background: #bee3f8; color: #2a69ac; }
.cat-pulizie { background: #fefcbf; color: #744210; }
.cat-altro { background: #e9d8fd; color: #553c9a; }

/* ─── OPS TABS (lavanderia / extra / spese nella scheda prenotazione) ────── */
.ops-tabs { display: flex; border-bottom: 2px solid #e2e8f0; }
.ops-tab {
  flex: 1; padding: .65rem .5rem; background: none; border: none; border-bottom: 3px solid transparent;
  font-size: .88rem; font-weight: 600; color: #718096; cursor: pointer; transition: color .15s, border-color .15s;
  margin-bottom: -2px;
}
.ops-tab:hover { color: #2c5f8a; }
.ops-tab.active { color: #2c5f8a; border-bottom-color: #2c5f8a; }
.ops-tab-panel { padding: 1rem 1.25rem; }
.doc-images { display: flex; gap: .5rem; flex-wrap: wrap; }
.status-select {
  padding: .3rem .5rem; border-radius: 6px; font-size: .8rem; font-weight: 500;
  border: 1.5px solid #e2e8f0; cursor: pointer; background: white;
}
.status-select.status-da_lavare { background: #fff5f5; border-color: #fc8181; color: #9b2c2c; }
.status-select.status-in_lavanderia { background: #fffbeb; border-color: #f6e05e; color: #744210; }
.status-select.status-pulito { background: #f0fff4; border-color: #9ae6b4; color: #276749; }

/* ─── LAUNDRY ──────────────────────────────────────────────────────────────── */
.item-type-badge { font-weight: 500; text-transform: capitalize; }
.laundry-row.status-row-da_lavare td:first-child { border-left: 3px solid #fc8181; }
.laundry-row.status-row-in_lavanderia td:first-child { border-left: 3px solid #f6e05e; }
.laundry-row.status-row-pulito td:first-child { border-left: 3px solid #9ae6b4; }

/* ─── SETTINGS ─────────────────────────────────────────────────────────────── */
.rooms-settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1.25rem; }
.room-setting-card { background: #f7fafc; border-radius: 10px; padding: 1rem; border: 1px solid #e2e8f0; }
.room-setting-header { margin-bottom: .75rem; }

/* ─── MISC ─────────────────────────────────────────────────────────────────── */
.empty-state { text-align: center; padding: 3rem 1rem; color: #718096; }
.empty-icon { font-size: 3.5rem; margin-bottom: 1rem; }
.empty-state p { margin-bottom: 1.25rem; font-size: .95rem; }

/* ─── QUESTURA PANEL ───────────────────────────────────────────────────────── */
.questura-panel { }
.questura-status { display: flex; align-items: center; gap: .6rem; margin-bottom: 1rem; }
.status-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.status-dot.non_inviato { background: #e2e8f0; }
.status-dot.test_ok { background: #f6e05e; }
.status-dot.inviato { background: #38a169; }
.status-dot.errore { background: #e53e3e; }
.questura-actions { display: flex; gap: .6rem; flex-wrap: wrap; }
.schedina-preview { font-family: monospace; font-size: .72rem; background: #1a202c; color: #81e6d9;
  padding: .75rem 1rem; border-radius: 8px; overflow-x: auto; white-space: nowrap; margin-top: .75rem; }
.invio-log { font-size: .82rem; }
.invio-log-row { display: flex; gap: .5rem; align-items: flex-start; padding: .4rem 0;
  border-bottom: 1px solid #edf2f7; }
.invio-log-row:last-child { border: none; }
.invio-time { color: #718096; white-space: nowrap; min-width: 140px; }
.invio-type { }
.invio-result { margin-left: auto; }
.info-notice { background: #fffbeb; border: 1px solid #f6e05e; border-radius: 8px;
  padding: .65rem 1rem; font-size: .83rem; color: #744210; }
.ml-2 { margin-left: .5rem; }
.mt-3 { margin-top: 1rem; }

/* ─── TOAST (Alfred) ─────────────────────────────────────────────────────── */
.toast {
  /* In ALTO a destra: non collide col chatbot Alfred (fisso in basso a destra)
     né col suo pannello aperto. */
  position: fixed; right: 1.25rem; top: 1.25rem; z-index: 1300;
  display: none; align-items: center; gap: .7rem;
  max-width: 360px; padding: .8rem 1rem; border-radius: 12px;
  background: #2d3748; color: #fff; font-size: .9rem; line-height: 1.3;
  box-shadow: 0 10px 30px rgba(0,0,0,.25);
  transform: translateY(-12px); opacity: 0; transition: transform .25s, opacity .25s;
}
.toast.show { display: flex; transform: translateY(0); opacity: 1; }
.toast::before {
  content: ''; flex: 0 0 34px; width: 34px; height: 34px; border-radius: 50%;
  background-image: url('../img/alfred.jpg'); background-size: cover; background-position: top center;
  box-shadow: 0 0 0 2px rgba(255,255,255,.6);
}
.toast.success { background: #276749; }
.toast.error   { background: #9b2c2c; }
.toast.warning { background: #975a16; }

/* ─── Banner anticipo duplicato ──────────────────────────────────────────── */
.dup-warning {
  display: none; margin: 0 0 1rem; padding: .75rem 1rem; border-radius: 10px;
  background: #fffaf0; border: 1px solid #f6ad55; color: #7b341e; font-size: .9rem;
}
.dup-warning a { color: #9c4221; font-weight: 600; }

/* ─── MOBILE NAV (bottom bar) ──────────────────────────────────────────────── */
.mobile-nav {
  display: none; position: fixed; bottom: 0; left: 0; right: 0;
  background: #1a2e45; z-index: 150;
  justify-content: space-around;
  padding: .25rem 0 calc(.25rem + env(safe-area-inset-bottom));
  box-shadow: 0 -2px 10px rgba(0,0,0,.18);
}
.mobile-nav a {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: .15rem; flex: 1; min-height: 52px;
  color: #a0aec0; font-size: .62rem; font-weight: 500;
  text-decoration: none; padding: .3rem .25rem;
  transition: color .15s; border-radius: 10px;
}
.mobile-nav a span { display: flex; }
.mobile-nav a .lucide { width: 22px; height: 22px; }
.mobile-nav a.active { color: #81e6d9; }
.mobile-nav a:active { color: #fff; }

/* ─── RESPONSIVE ───────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .detail-grid { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  /* Shell: topbar fisso sopra, bottom nav sotto, sidebar = drawer con backdrop */
  .mobile-topbar { display: flex; }
  .sidebar {
    transform: translateX(-100%); z-index: 300;
    width: min(300px, 84vw); min-width: 0;
    padding-top: env(safe-area-inset-top);
    box-shadow: none;
    overflow-y: auto; -webkit-overflow-scrolling: touch;
  }
  .sidebar.open { transform: none; box-shadow: 4px 0 24px rgba(0,0,0,.35); }
  .sidebar-backdrop { z-index: 250; }
  .nav-links li a { padding: .85rem 1.25rem; font-size: 1rem; }
  .main-content {
    margin-left: 0;
    padding: .9rem .9rem calc(4.75rem + env(safe-area-inset-bottom));
    padding-top: calc(4rem + env(safe-area-inset-top));
  }
  .mobile-nav { display: flex; }

  /* Header pagina: titolo compatto, azioni a tutta riga sotto */
  .page-header { gap: .6rem; margin-bottom: 1rem; }
  .page-header h1 { font-size: 1.25rem; flex-basis: 100%; }
  .page-header .header-actions, .page-header .flex { flex-wrap: wrap; }

  /* Touch target: bottoni e controlli ≥44px, input ≥16px (no zoom iOS) */
  .btn { min-height: 44px; padding: .6rem 1.1rem; }
  .btn-sm { min-height: 40px; }
  .btn-xs { min-height: 36px; }
  .form-control, input[type=text], input[type=number], input[type=date],
  input[type=email], input[type=tel], input[type=password], select, textarea {
    font-size: 16px; min-height: 44px;
  }
  .tab { padding: .55rem 1rem; }
  .house-opt { padding: .65rem 1.1rem; }
  .status-select { min-height: 40px; }
  .btn-details, .btn-del { padding: .5rem .8rem; }

  /* Filtri: riga scorrevole orizzontale, niente wrap.
     I badge mese invece restano a capo: tutti i 12 mesi visibili senza scroll. */
  .filter-tabs, .tab-group, .house-toggle {
    flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch;
    scrollbar-width: none; padding-bottom: .25rem;
    margin-left: -.9rem; margin-right: -.9rem;
    padding-left: .9rem; padding-right: .9rem;
  }
  .filter-tabs::-webkit-scrollbar, .tab-group::-webkit-scrollbar,
  .house-toggle::-webkit-scrollbar { display: none; }
  .tab, .house-opt { flex-shrink: 0; }
  .date-range-filter { padding: .75rem .9rem; gap: .75rem; }
  .date-range-filter .form-group { flex: 1 1 140px; }
  .date-range-filter input[type=date] { min-width: 0; }
  .filter-row { gap: .75rem; }

  /* Tabelle: scroll orizzontale dentro la card, mai sfondare la pagina.
     Le tabelle stanno dentro .card / .card-body: il contenitore scorre,
     la tabella larga mantiene la sua larghezza naturale. */
  .overflow-x, .bookings-table-wrap, .card, .card-body { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .table th, .table td { padding: .6rem .7rem; }
  .data-table { min-width: 560px; }   /* celle che vanno a capo: senza minimo si schiacciano illeggibili */
  .tbl { min-width: 480px; }

  /* Griglie che collassano */
  .rooms-grid { grid-template-columns: 1fr; }
  .widgets-grid { grid-template-columns: 1fr 1fr; gap: .6rem; }
  .widget { padding: .85rem .9rem; gap: .7rem; }
  .widget-value { font-size: 1.1rem; }
  .info-grid-2 { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .rooms-settings-grid { grid-template-columns: 1fr; }
  .form-actions .btn { flex: 1 1 auto; justify-content: center; }

  /* Calendario dashboard: colonna camere più stretta, celle più alte per il tap.
     table-layout auto + min-width sui giorni: la tabella scorre in orizzontale
     invece di schiacciare le colonne una sull'altra. */
  .calendar-table { table-layout: auto; }
  .calendar-flip th.cal-corner, .calendar-flip td.cal-room-label {
    min-width: 100px; width: 100px; max-width: 100px; padding: .2rem .35rem;
  }
  .calendar-flip th.cal-day { min-width: 30px; }
  .cal-cell { height: 32px; min-width: 30px; }   /* più alta del desktop: serve al tap */
  .calendar-table th { font-size: .64rem; }
  .house-pill { width: 17px; height: 17px; min-width: 17px; font-size: .58rem; }

  /* Modali: quasi fullscreen, scroll interno */
  .modal-overlay { padding: 0; align-items: stretch; }
  .modal-box {
    max-width: none; border-radius: 0; min-height: 100%;
    display: flex; flex-direction: column;
    padding-top: env(safe-area-inset-top);
  }
  .modal-body { flex: 1; overflow-y: auto; padding-bottom: calc(1.25rem + env(safe-area-inset-bottom)); }
  .modal-close { width: 44px; height: 44px; }

  /* Toast: sotto la topbar, largo quanto lo schermo */
  .toast {
    left: .75rem; right: .75rem; max-width: none;
    top: calc(3.75rem + env(safe-area-inset-top));
  }

  /* Ops tabs (scheda prenotazione): scorrevoli */
  .ops-tabs { overflow-x: auto; scrollbar-width: none; }
  .ops-tabs::-webkit-scrollbar { display: none; }
  .ops-tab { white-space: nowrap; flex: 0 0 auto; padding: .75rem .9rem; }

  /* Upload zone più compatta */
  .upload-zone { padding: 1.25rem .9rem; }
}

/* ─── BOOKINGS TABLE → CARD (mobile) ───────────────────────────────────────── */
@media (max-width: 640px) {
  .widgets-grid { grid-template-columns: 1fr 1fr; }
  .bookings-table-wrap { overflow-x: visible; background: none; box-shadow: none; border-radius: 0; }
  .bookings-table, .bookings-table tbody { display: block; }
  .bookings-table thead { display: none; }
  .bookings-table tbody tr {
    display: block; position: relative;
    padding: .8rem .9rem;
    margin-bottom: .6rem;
    background: #fff; border-radius: 12px;
    box-shadow: 0 1px 6px rgba(0,0,0,.08);
    border-bottom: none;
  }
  /* Le celle diventano coppie etichetta+valore affiancate */
  .bookings-table td {
    display: inline-block; vertical-align: top;
    padding: .2rem .9rem .2rem 0; border: none; font-size: .85rem;
  }
  .bookings-table td::before {
    content: attr(data-label); display: block;
    font-size: .62rem; color: #a0aec0; text-transform: uppercase; letter-spacing: .05em;
  }
  .bookings-table td:not([data-label])::before,
  .bookings-table td[data-label=""]::before { content: none; }
  /* Ospite: riga intera in alto (spazio a dx per lo stato) */
  .bookings-table td.bk-cell-guest { display: block; padding-right: 7rem; }
  /* Stato in alto a destra, cestino in basso a destra */
  .bookings-table td.bk-cell-status { position: absolute; top: .7rem; right: .9rem; padding: 0; }
  .bookings-table td.bk-cell-status::before { content: none; }
  .bookings-table td.bk-cell-actions { position: absolute; bottom: .5rem; right: .5rem; padding: 0; }
}
@media (max-width: 420px) {
  .widgets-grid { grid-template-columns: 1fr; }
}

/* ─── LOGIN / WELCOME ──────────────────────────────────────────────────────── */
.login-page {
  min-height: 100vh; margin: 0; display: flex; align-items: center; justify-content: center;
  background:
    linear-gradient(135deg, rgba(44,83,100,.72) 0%, rgba(32,58,67,.72) 50%, rgba(15,32,39,.78) 100%),
    url('../img/alfred-welcome.jpg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
  padding: 1.5rem;
}
.login-card {
  width: 100%; max-width: 400px; border-radius: 16px;
  background: rgba(255,255,255,.82);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,.5);
  box-shadow: 0 20px 60px rgba(0,0,0,.35); padding: 2.5rem 2rem 1.75rem;
}
.login-brand { text-align: center; margin-bottom: 1.5rem; }
.login-logo { font-size: 2.6rem; display: block; }
.login-brand h1 { margin: .4rem 0 .25rem; font-size: 1.5rem; color: #1a202c; }
.login-tagline { margin: 0; color: #718096; font-size: .85rem; }
.login-form { display: flex; flex-direction: column; gap: .35rem; }
.login-form label { font-size: .8rem; font-weight: 600; color: #4a5568; margin-top: .6rem; }
.login-form input {
  padding: .7rem .85rem; border: 1px solid #cbd5e0; border-radius: 8px; font-size: .95rem;
  transition: border-color .15s, box-shadow .15s;
}
.login-form input:focus {
  outline: none; border-color: #3182ce; box-shadow: 0 0 0 3px rgba(49,130,206,.15);
}
.login-submit { margin-top: 1.25rem; width: 100%; justify-content: center; }
.login-error {
  background: #fed7d7; border: 1px solid #fc8181; color: #9b2c2c;
  padding: .6rem .8rem; border-radius: 8px; font-size: .85rem; margin-bottom: 1rem; text-align: center;
}
.login-footer { text-align: center; margin-top: 1.5rem; }
.login-footer a { color: #a0aec0; font-size: .78rem; text-decoration: none; }
.login-footer a:hover { color: #718096; }

/* utente + logout nella sidebar */
.sidebar-user { color: #cbd5e0; font-size: .78rem; padding: .4rem .25rem; word-break: break-all; }
.btn-logout {
  display: block; text-align: center; margin-top: .4rem; padding: .45rem;
  background: rgba(255,255,255,.08); color: #e2e8f0; border-radius: 8px;
  text-decoration: none; font-size: .82rem; transition: background .15s;
}
.btn-logout:hover { background: rgba(255,255,255,.16); }

/* ─── DETAIL PAGES (clienti, etc) ──────────────────────────────────────────── */
.detail-container { max-width: 1200px; }
.detail-container h1 { margin-bottom: 1.5rem; font-size: 1.75rem; }
.detail-container h2 { margin-bottom: 1rem; font-size: 1.2rem; color: #2d3748; }
.card { background: white; border-radius: 12px; padding: 1.5rem; margin-bottom: 1.5rem; box-shadow: 0 1px 3px rgba(0,0,0,.1); }

/* tabella dati */
.data-table { width: 100%; border-collapse: collapse; }
.data-table thead { background: #f7fafc; }
.data-table th {
  padding: .75rem; text-align: left; font-weight: 600; font-size: .85rem;
  color: #4a5568; border-bottom: 2px solid #e2e8f0;
}
.data-table td { padding: .75rem; border-bottom: 1px solid #e2e8f0; }
.data-table tbody tr:hover { background: #f7fafc; }

/* form grid */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-grid div { display: flex; flex-direction: column; }
.form-grid label { margin-bottom: .35rem; font-size: .85rem; font-weight: 600; color: #4a5568; }
.form-grid input, .form-grid select {
  padding: .55rem .75rem; border: 1px solid #cbd5e0; border-radius: 8px; font-size: .9rem;
  transition: border-color .15s, box-shadow .15s;
}
.form-grid input:focus, .form-grid select:focus {
  outline: none; border-color: #2c5f8a; box-shadow: 0 0 0 3px rgba(44,95,138,.15);
}

/* ─── PRINT ─────────────────────────────────────────────────────────────────── */
.btn-print { display:inline-flex; align-items:center; gap:.4rem; padding:.45rem .9rem;
  background:#f7fafc; border:1px solid #cbd5e0; border-radius:8px; font-size:.85rem;
  color:#4a5568; cursor:pointer; text-decoration:none; transition:background .15s; }
.btn-print:hover { background:#edf2f7; text-decoration:none; color:#2d3748; }

@media print {
  .sidebar, .mobile-nav, .menu-toggle, .toast,
  .btn-print, .btn-export-excel,
  .date-range-filter, .filter-tabs, .filter-bar,
  .page-header .btn, .page-header .header-actions,
  .calendar-nav .btn,
  .no-print { display: none !important; }

  body { background: white; display: block; }
  .main-content { margin-left: 0 !important; padding: 1rem !important; }

  .card { box-shadow: none; border: 1px solid #e2e8f0; break-inside: avoid; }
  .widget { box-shadow: none; border: 1px solid #e2e8f0; }
  table { border-collapse: collapse; }
  td, th { border: 1px solid #e2e8f0 !important; }
  a { color: inherit; text-decoration: none; }

  .page-header { display: flex !important; justify-content: space-between; margin-bottom: 1rem; }
  .page-header h1 { font-size: 1.3rem; }

  /* show print-only title with date */
  .print-header { display: block !important; }

  /* Dashboard: calendario largo → landscape.
     table-layout:fixed + width:100% forza il browser a distribuire le colonne
     dentro la pagina (mese INTERO sempre visibile, niente troncamento).
     Servono selettori specifici come gli originali (.calendar-flip th...) per
     vincere width/max-width fissi, altrimenti restano 34px e la tabella sfora. */
  .overflow-x { overflow: visible !important; }
  .calendar-table { font-size: .58rem; width: 100% !important; table-layout: fixed; }
  .calendar-flip th.cal-corner,
  .calendar-flip td.cal-room-label {
    min-width: 0 !important; width: 64px !important; max-width: 64px !important;
    font-size: .62rem !important;
  }
  .calendar-flip th.cal-day,
  .calendar-flip th.cal-day.today,
  .calendar-table .cal-cell {
    min-width: 0 !important; width: auto !important; padding: 1px !important;
  }
  .cal-day-num { font-size: .6rem; }
  .cal-day-name { font-size: .48rem; }
  .cal-name { font-size: .5rem; }
  .house-pill { width: 14px !important; height: 14px !important; min-width: 14px !important; font-size: .5rem !important; }

  /* widgets in riga unica */
  .widgets-grid { display: grid !important; grid-template-columns: repeat(5,1fr) !important; gap: .5rem !important; margin-bottom: .75rem !important; }
  .widget { padding: .6rem !important; }
  .widget-value { font-size: 1.1rem !important; }
  /* La card scura del totale perde lo sfondo in stampa: i valori chiari
     diventerebbero illeggibili su bianco, si torna ai colori dei mensili. */
  .widget-totale { background: white !important; }
  .widget-totale .widget-value.tot-pos { color: #276749 !important; }
  .widget-totale .widget-value.tot-neg { color: #c53030 !important; }
}

@page {
  size: A4 landscape;
  margin: 1cm;
}

/* ===== Alfred — matrice tessere prenotazione ===== */
.alfred-banner { background:#fff8e1; border-left:4px solid #f6c90e; color:#7a6300;
  padding:.7rem 1rem; border-radius:8px; margin-bottom:1rem; font-size:.92rem; }
.alfred-grid { display:grid; grid-template-columns:repeat(3,1fr); gap:1rem; margin-bottom:1rem; }
.alfred-col-title { font-weight:700; text-align:center; padding-bottom:.3rem; margin-bottom:.6rem;
  border-bottom:2px solid #cbd5e0; font-size:.85rem; text-transform:uppercase; letter-spacing:.03em; }
.alfred-tile { border-radius:8px; padding:.6rem .7rem; margin-bottom:.6rem; border:1px solid #e2e8f0;
  background:#fff; cursor:pointer; transition:box-shadow .15s; }
.alfred-tile:hover { box-shadow:0 2px 8px rgba(0,0,0,.1); }
.alfred-tile summary { list-style:none; display:flex; justify-content:space-between; align-items:center; gap:.4rem; }
.alfred-tile summary::-webkit-details-marker { display:none; }
.alfred-tile .tile-name { font-weight:600; font-size:.86rem; }
.alfred-tile .tile-badge { font-size:.72rem; padding:.15rem .5rem; border-radius:10px; white-space:nowrap; }
/* Fatto: bordo verde spessorato + sfondo verde tenue + flag ✓, così un passo
   completato è inequivocabile e non serve riaprirlo per controllare. */
.tile-fatto   { border:1.5px solid #22863a; border-left:5px solid #22863a; background:#f0fff4; }
.tile-fatto .tile-badge   { background:#c6f6d5; color:#22543d; }
.tile-fatto .tile-name::after { content:' ✓'; color:#22863a; font-weight:800; }
/* Evidenziazione del passo APPENA completato (dopo il reload): pulse verde. */
@keyframes justDonePulse {
  0%   { box-shadow:0 0 0 0 rgba(34,134,58,.55); }
  70%  { box-shadow:0 0 0 12px rgba(34,134,58,0); }
  100% { box-shadow:0 0 0 0 rgba(34,134,58,0); }
}
.tile-just-done { animation: justDonePulse 1.3s ease-out 2; border-color:#22863a; }
.tile-urgente { border-left:4px solid #c53030; } .tile-urgente .tile-badge { background:#fed7d7; color:#c53030; }
.tile-corso   { border-left:4px solid #d69e2e; } .tile-corso .tile-badge   { background:#fefcbf; color:#975a16; }
.tile-attesa  { border-left:4px solid #cbd5e0; } .tile-attesa .tile-badge  { background:#e2e8f0; color:#4a5568; }
.tile-locked  { opacity:.6; }
.alfred-tile .tile-body { margin-top:.6rem; padding-top:.6rem; border-top:1px dashed #e2e8f0; }
.alfred-margine { text-align:right; padding:.7rem 1rem; background:#f0fff4; border-radius:8px; margin-bottom:1rem; font-size:1rem; }
@media (max-width:760px){ .alfred-grid { grid-template-columns:1fr; } }

/* ===== Badge mesi (filtro rapido pagina prenotazioni) ===== */
.month-badges { display:flex; flex-wrap:wrap; gap:.4rem; margin-bottom:1rem; align-items:stretch; }
.month-badge { display:flex; flex-direction:column; align-items:center; justify-content:center;
  padding:.3rem .7rem; min-width:48px; border-radius:14px; font-weight:600;
  background:#edf2f7; color:#4a5568; text-decoration:none; border:1px solid transparent; transition:all .15s; }
.month-badge .mb-name { font-size:.82rem; line-height:1.1; }
.month-badge .mb-count { font-size:.68rem; font-weight:700; opacity:.7; margin-top:.1rem; }
.month-badge:hover { background:#e2e8f0; }
.month-badge.active { background:#2c5f8a; color:#fff; border-color:#2c5f8a; }
.month-badge.active .mb-count { opacity:.95; }
.month-year { font-weight:700; color:#2c5f8a; font-size:.9rem; margin-right:.5rem; align-self:center; }

/* ===== Badge riepilogo pulizie (compatti) ===== */
.pay-badge { display:inline-flex; align-items:center; gap:.3rem; padding:.35rem .7rem;
  border-radius:14px; font-size:.82rem; background:#edf2f7; color:#2d3748; }
.pay-badge-tot { background:#2c5f8a; color:#fff; font-weight:700; }
.pay-badge-staff { background:#f0fff4; color:#22543d; border:1px solid #c6f6d5; }

/* ===== Pulizie: calendario (sx) + riepilogo economico (dx) affiancati ===== */
.clean-split { display:flex; gap:1rem; align-items:flex-start; }
.clean-split-cal { flex:1 1 58%; min-width:0; margin:0; }
.clean-split-pay { flex:1 1 42%; min-width:0; margin:0; }
/* Calendario più compatto nella metà sinistra: celle minori, max 7 colonne. */
.clean-split-cal .clean-grid {
  grid-template-columns: repeat(7, 1fr); gap:.3rem;
}
.clean-split-cal .clean-day { min-height:48px; padding:.25rem .15rem; }
.clean-split-cal .cd-num { font-size:.78rem; }

/* Riepilogo economico: lista pulita, importi allineati a destra. */
.pay-total { display:flex; align-items:baseline; gap:.5rem; flex-wrap:wrap;
  padding:.6rem .8rem; background:#2c5f8a; color:#fff; border-radius:10px; margin-bottom:1rem; }
.pay-total strong { font-size:1.35rem; margin-left:auto; }
.pay-total-sub { font-size:.75rem; opacity:.85; width:100%; }
.pay-section-title { font-size:.72rem; font-weight:700; text-transform:uppercase;
  letter-spacing:.05em; color:#718096; margin:.9rem 0 .4rem; }
.pay-list { list-style:none; margin:0; padding:0; display:flex; flex-direction:column; gap:.3rem; }
.pay-row { display:flex; align-items:center; gap:.5rem; padding:.45rem .6rem;
  border-radius:8px; background:#f7fafc; font-size:.88rem; }
.pay-row-staff { background:#f0fff4; }
.pay-row-name { display:flex; align-items:center; gap:.4rem; font-weight:600; color:#2d3748; }
.pay-row-meta { font-size:.74rem; color:#a0aec0; }
.pay-row-amount { margin-left:auto; font-weight:700; color:#22543d; white-space:nowrap; }
.pay-row:not(.pay-row-staff) .pay-row-amount { color:#2d3748; }
.pay-empty { font-size:.85rem; color:#a0aec0; margin:.2rem 0; }

@media (max-width: 860px) {
  .clean-split { flex-direction:column; }
  .clean-split-cal, .clean-split-pay { flex:1 1 100%; width:100%; }
  .clean-split-cal .clean-grid { grid-template-columns:repeat(auto-fill, minmax(46px,1fr)); }
}

/* ===== Righe spesa a debito in Prima Nota (costi casa + cedolare STR) ===== */
.prima-nota-spesa-row td { background:#fff5f5; color:#742a2a; font-size:.88rem; }
.prima-nota-spesa-row td em { font-style:italic; color:#9b2c2c; }

/* ===== Modale riutilizzabile (overlay + box) ===== */
.modal-overlay {
  position:fixed; inset:0; z-index:1000;
  display:none; align-items:flex-start; justify-content:center;
  background:rgba(26,32,44,.55);
  backdrop-filter:blur(3px); -webkit-backdrop-filter:blur(3px);
  padding:5vh 1rem; overflow-y:auto;
}
.modal-overlay.open { display:flex; }
.modal-box {
  background:#fff; border-radius:14px; width:100%; max-width:640px;
  box-shadow:0 20px 50px rgba(0,0,0,.3);
  animation:modalIn .18s ease-out;
}
@keyframes modalIn { from { opacity:0; transform:translateY(-12px); } to { opacity:1; transform:translateY(0); } }
.modal-head {
  display:flex; align-items:center; justify-content:space-between;
  padding:1rem 1.25rem; border-bottom:1px solid #e2e8f0;
}
.modal-head h2 { margin:0; font-size:1.15rem; }
.modal-body { padding:1.25rem; }
.modal-close {
  background:none; border:none; font-size:1.5rem; line-height:1; cursor:pointer;
  color:#718096; padding:.2rem .5rem; border-radius:8px;
}
.modal-close:hover { background:#edf2f7; color:#2d3748; }
body.modal-open { overflow:hidden; }

/* ===== Prenotazione cancellata (riga lista) ===== */
.booking-row-cancelled td { opacity:.55; }
.booking-row-cancelled .guest-name { text-decoration:line-through; }

/* ─── PAGINA CEDOLARE SECCA (STR tax) ───────────────────────────────────────
   Grafico a barre mensile: due serie affiancate (per prenotazione = nuovo
   formato payout, aggregata = vecchio). Altezze in % dal template. */
.str-chart {
  display: flex; align-items: flex-end; gap: .5rem;
  height: 160px; padding-top: .5rem;
}
.str-chart-col {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  height: 100%; min-width: 0;
}
.str-chart-bars {
  flex: 1; width: 100%; display: flex; align-items: flex-end;
  justify-content: center; gap: 2px;
}
.str-bar {
  width: 45%; max-width: 22px; min-height: 2px;
  border-radius: 3px 3px 0 0;
  transition: opacity .12s;
}
.str-bar:hover { opacity: .75; }
.str-bar-nuova   { background: #4299e1; }   /* per prenotazione */
.str-bar-vecchia { background: #a0aec0; }   /* aggregata per casa */
.str-chart-val { font-size: .7rem; font-weight: 700; color: #4a5568; margin-top: .25rem; }
.str-chart-lbl { font-size: .68rem; color: #718096; text-transform: uppercase; }

/* Riga di spiegazione sotto il valore del widget: dice cosa distingue le due
   voci senza costringere a cercare la legenda. */
.widget-hint {
  font-size: .7rem; color: #a0aec0; line-height: 1.25; margin-top: .15rem;
}

/* Intestazione di sezione dentro la card casa: separa le due modalita'. */
.str-section-head {
  padding: .6rem .9rem; background: #f7fafc;
  border-bottom: 1px solid #e2e8f0;
  font-size: .8rem; font-weight: 600; color: #4a5568;
  display: flex; align-items: center; gap: .4rem; flex-wrap: wrap;
}
.str-section-head .text-muted { font-weight: 400; }

/* ─── ARCHIVIO INVII QUESTURA ───────────────────────────────────────────────
   Un <details> per invio: intestazione con esito, corpo con le schedine
   decodificate (il tracciato grezzo e' 168/174 char a posizioni fisse) e il
   link alla ricevuta PDF archiviata. */
.invio-card {
  border: 1px solid #e2e8f0; border-radius: 8px;
  margin-bottom: .6rem; background: #fff;
}
.invio-card > summary {
  cursor: pointer; padding: .55rem .75rem;
  display: flex; align-items: center; gap: .5rem; flex-wrap: wrap;
  font-size: .82rem;
}
.invio-card > summary::-webkit-details-marker { display: none; }
.invio-card > summary::before {
  content: '\25B8'; color: #a0aec0; transition: transform .12s;
}
.invio-card[open] > summary::before { transform: rotate(90deg); }
.invio-card > summary:hover { background: #f7fafc; }
.invio-body {
  padding: .25rem .75rem .75rem; border-top: 1px solid #edf2f7;
  font-size: .82rem;
}

/* Una schedina = un ospite. Codici a 9 cifre in monospace: si confrontano
   a colpo d'occhio con quelli del portale. */
.schedina-card {
  border: 1px solid #edf2f7; border-radius: 6px;
  padding: .5rem .65rem; margin-top: .4rem; background: #f7fafc;
}
.schedina-nome {
  font-weight: 600; font-size: .84rem; margin-bottom: .35rem;
  display: flex; align-items: center; gap: .5rem; flex-wrap: wrap;
}
.schedina-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: .15rem .9rem; font-size: .78rem;
}
.schedina-grid > div { font-variant-numeric: tabular-nums; }
.schedina-errori { margin: .25rem 0 0 1rem; font-size: .78rem; color: #9b2c2c; }
.schedina-errori li { margin-bottom: .15rem; }
