/* ===== Gestionale Brezza Apartments ===== */
@font-face { font-family: 'Inter'; font-style: normal; font-display: swap; font-weight: 100 900; src: url('/fonts/inter-latin-wght-normal.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Inter'; font-style: normal; font-display: swap; font-weight: 100 900; src: url('/fonts/inter-latin-ext-wght-normal.woff2') format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

:root {
  --blue: #265e6f; --blue-2: #2f7183; --blue-3: #4f8a9b; --blue-soft: #e5eff1; --blue-ink: #1b4350;
  --orange: #cfba82; --orange-dark: #866a2c; --orange-soft: #f5efdf;
  --bg: #f6f6f4; --panel: #fff; --text: #1c2b30; --muted: #5d6b70; --line: #e2e6e6; --line-2: #eef1f1;
  --red: #c62828; --red-soft: #fdeded; --green: #1e7b34; --green-soft: #e6f4ea; --amber-soft: #fff7e6;
  --radius: 14px; --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(20,48,56,.04), 0 4px 16px rgba(20,48,56,.05);
  --side-w: 248px;
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  color: var(--text); background: var(--bg);
  font-feature-settings: 'cv11', 'ss01';
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-size: 15px; line-height: 1.5; background: var(--bg); }
a { color: var(--blue-2); text-underline-offset: 2px; }
h1 { font-size: 1.55rem; line-height: 1.2; margin: 0 0 .3rem; color: var(--blue-ink); letter-spacing: -.015em; font-weight: 700; }
h2 { font-size: 1.08rem; margin: 0 0 .8rem; color: var(--blue-ink); font-weight: 650; }
h3 { font-size: .98rem; margin: 0 0 .5rem; font-weight: 650; color: var(--blue-ink); }
.muted { color: var(--muted); }
small, .small { font-size: .84rem; }
.lucide-icon { vertical-align: -3px; flex: none; }
.env-banner { background: var(--orange); color: #2b2410; text-align: center; font-weight: 700; padding: 5px 10px; font-size: .82rem; position: relative; z-index: 60; }

/* ----- Struttura: menu laterale + area principale ----- */
.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--side-w); background: linear-gradient(180deg, #1f4f5d 0%, #265e6f 60%, #2b6a7c 100%); color: #e3eef0; display: flex; flex-direction: column; z-index: 50; }
body.with-shell .env-banner { margin-left: var(--side-w); }
.side-brand { display: block; padding: 18px 18px 10px; }
.side-brand img { width: 100%; max-width: 196px; display: block; }
.side-nav { flex: 1; overflow-y: auto; padding: 6px 10px 12px; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.2) transparent; }
.side-group { font-size: .7rem; text-transform: uppercase; letter-spacing: .09em; color: rgba(227,238,240,.6); margin: 16px 10px 6px; font-weight: 600; }
.side-link { display: flex; align-items: center; gap: 11px; color: #e3eef0; text-decoration: none; padding: 9px 12px; border-radius: 10px; font-size: .93rem; font-weight: 500; margin: 1px 0; position: relative; }
.side-link:hover { background: rgba(255,255,255,.07); color: #fff; }
.side-link.active { background: rgba(255,255,255,.12); color: #fff; font-weight: 600; }
.side-link.active::before { content: ''; position: absolute; left: -10px; top: 8px; bottom: 8px; width: 4px; border-radius: 0 4px 4px 0; background: var(--orange); }
.side-link .lucide-icon { opacity: .9; }
.side-user { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-top: 1px solid rgba(255,255,255,.1); margin: 0; }
.side-user .avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--orange); color: #2b2410; font-weight: 700; display: flex; align-items: center; justify-content: center; font-size: .8rem; flex: none; }
.side-user .who { flex: 1; min-width: 0; display: grid; line-height: 1.2; }
.side-user .who strong { color: #fff; font-size: .86rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user .who small { color: rgba(227,238,240,.7); font-size: .74rem; }
.side-user button { background: transparent; border: 1px solid rgba(255,255,255,.22); color: #fff; padding: 7px; border-radius: 9px; }
.side-user button:hover { background: rgba(255,255,255,.1); }
.side-backdrop { display: none; }

.appbar { position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: 10px; padding: 8px 28px 0; background: rgba(246,246,244,.9); backdrop-filter: blur(8px); border-bottom: 1px solid transparent; }
body.with-shell .appbar, body.with-shell .page { margin-left: var(--side-w); }
.appbar-menu, .appbar-brand { display: none; }
.appbar-spacer { flex: 1; }
.page { max-width: 1320px; padding: 8px 28px 60px; margin-right: auto; }
body:not(.with-shell) .page { margin: 0 auto; }

/* Pulsante "+ Nuovo" */
.quick-add { position: relative; }
.quick-add > summary { list-style: none; box-shadow: 0 4px 14px rgba(134,106,44,.25); }
.quick-add > summary::-webkit-details-marker { display: none; }
.quick-menu { position: absolute; right: 0; top: calc(100% + 8px); background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 18px 44px rgba(20,48,56,.18); padding: 6px; width: 300px; z-index: 70; }
.quick-menu a { display: flex; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 10px; text-decoration: none; color: var(--text); }
.quick-menu a:hover { background: var(--blue-soft); }
.quick-menu a > .lucide-icon { width: 34px; height: 34px; padding: 8px; border-radius: 10px; background: var(--blue-soft); color: var(--blue); }
.quick-menu span { display: grid; line-height: 1.25; }
.quick-menu small { color: var(--muted); }

/* Barra in basso (telefono) */
.bottombar { display: none; }

/* ----- Pannelli, griglie, titoli ----- */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; box-shadow: var(--shadow); margin-bottom: 18px; }
.panel.narrow { max-width: 680px; margin-left: auto; margin-right: auto; }
.panel > h2:first-child { display: flex; align-items: center; gap: 8px; justify-content: space-between; flex-wrap: wrap; }
.panel-title { display: flex !important; align-items: center; gap: 10px; }
.panel-title > .lucide-icon { color: var(--orange-dark); }
.panel-title .grow { flex: 1; }
.panel-sub { color: var(--muted); font-size: .86rem; margin: -6px 0 14px; }
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin: 0 0 20px; }
.page-head h1 { display: flex; align-items: center; gap: 12px; }
.page-head p { margin: 0; }
.title-icon { width: 44px; height: 44px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; background: #fff; color: var(--blue); box-shadow: var(--shadow); border: 1px solid var(--line); flex: none; }
.title-icon .lucide-icon { width: 24px; height: 24px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.breadcrumb { font-size: .84rem; margin-bottom: 4px; }
.breadcrumb a { text-decoration: none; color: var(--muted); }
.breadcrumb a:hover { color: var(--blue); }

/* ----- Schede numeriche ----- */
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.stat.with-icon { display: flex; gap: 14px; align-items: flex-start; }
a.stat:hover { border-color: #cfd6e6; }
.stat .stat-body { flex: 1; min-width: 0; }
.stat .label { color: var(--muted); font-size: .76rem; text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.stat .value { font-size: 1.6rem; line-height: 1.2; font-weight: 700; color: var(--blue-ink); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat .sub { color: var(--muted); font-size: .84rem; }
.stat .spark { position: absolute; right: 14px; bottom: 12px; }
.stat.alert-stat { border-color: #f3c4c4; }
.stat.alert-stat .value { color: var(--red); }
.stat-icon { width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center; flex: none; background: var(--blue-soft); color: var(--blue); }
.stat-icon .lucide-icon { width: 23px; height: 23px; }
.stat-icon.orange { background: var(--orange-soft); color: var(--orange-dark); }
.stat-icon.red { background: var(--red-soft); color: var(--red); }
.stat-icon.green { background: var(--green-soft); color: var(--green); }

/* ----- Pulsanti ----- */
button, .button { display: inline-flex; align-items: center; gap: 7px; justify-content: center; background: var(--blue); color: #fff; border: 1px solid var(--blue); border-radius: 10px; padding: 9px 15px; font: inherit; font-weight: 600; font-size: .92rem; cursor: pointer; text-decoration: none; line-height: 1.2; min-height: 40px; transition: background .12s, border-color .12s, box-shadow .12s; }
button:hover, .button:hover { background: var(--blue-2); }
button:focus-visible, .button:focus-visible { outline: 3px solid rgba(207,186,130,.7); outline-offset: 1px; }
.button.orange, button.orange { background: var(--orange); border-color: var(--orange); color: #2b2410; }
.button.orange:hover, button.orange:hover { background: #dccb9b; }
.button.ghost, button.ghost { background: #fff; color: var(--blue); border-color: var(--line); }
.button.ghost:hover, button.ghost:hover { background: var(--blue-soft); border-color: #cfd6e6; }
.button.danger, button.danger { background: #fff; color: var(--red); border-color: #f2c0c0; }
.button.danger:hover, button.danger:hover { background: var(--red-soft); }
.button.small, button.small { padding: 5px 10px; font-size: .84rem; min-height: 32px; border-radius: 8px; }
button:disabled { opacity: .55; cursor: not-allowed; }
.inline-form { display: inline; margin: 0; }

.big-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.big-action { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; min-height: 140px; border-radius: 18px; font-size: 1.15rem; font-weight: 700; text-decoration: none; color: #fff; background: var(--blue); box-shadow: var(--shadow); }
.big-action.orange { background: var(--orange); color: #2b2410; }
.big-action .lucide-icon { width: 46px; height: 46px; }

/* ----- Moduli ----- */
form.stack, .form-stack { display: grid; gap: 14px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px 16px; align-items: start; }
.form-grid .wide { grid-column: 1 / -1; }
label { display: grid; gap: 5px; font-size: .86rem; font-weight: 600; color: #3f4760; align-content: start; }
label.check { display: flex; align-items: center; gap: 9px; font-weight: 500; color: var(--text); }
input, select, textarea { font: inherit; font-size: .95rem; color: var(--text); background: #fff; border: 1px solid #cdd3e0; border-radius: 10px; padding: 9px 11px; width: 100%; min-height: 42px; transition: border-color .12s, box-shadow .12s; }
input::placeholder, textarea::placeholder { color: #9aa1b5; }
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; min-height: 0; accent-color: var(--blue); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--orange); box-shadow: 0 0 0 3px rgba(207,186,130,.35); }
input:disabled, select:disabled, textarea:disabled { background: #f4f6fa; color: var(--muted); }
textarea { min-height: 80px; resize: vertical; }
.hint { font-weight: 400; color: var(--muted); font-size: .8rem; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; align-items: center; margin-top: 6px; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px; margin: 0; display: grid; gap: 10px; }
legend { font-weight: 650; color: var(--blue-ink); padding: 0 6px; }
.filters { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 14px; }
.filters label { min-width: 160px; }

/* ----- Tabelle ----- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--line-2); text-align: left; vertical-align: middle; }
th { color: var(--muted); font-weight: 600; font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; background: #f8f9fc; white-space: nowrap; }
thead th:first-child { border-top-left-radius: 8px; } thead th:last-child { border-top-right-radius: 8px; }
td.num, th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
tbody tr:hover td { background: #fafbfd; }
tr.row-alert td { background: #fff5f5; }
tr.row-warn td { background: #fffaf0; }
tr.total td { font-weight: 700; background: #f7f8fb; }
.empty { color: var(--muted); padding: 22px; text-align: center; }

/* ----- Etichette, avvisi, messaggi ----- */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: .76rem; font-weight: 600; background: var(--blue-soft); color: var(--blue); white-space: nowrap; }
.badge.red { background: var(--red-soft); color: var(--red); }
.badge.green { background: var(--green-soft); color: var(--green); }
.badge.orange { background: var(--orange-soft); color: var(--orange-dark); }
.badge.grey { background: #eef0f4; color: var(--muted); }
.flash { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 12px; margin: 6px 0 16px; font-weight: 600; border: 1px solid transparent; }
.flash-ok { background: var(--green-soft); color: var(--green); border-color: #c8e6cf; }
.flash-error { background: var(--red-soft); color: var(--red); border-color: #f3c4c4; }
.flash-warn { background: var(--amber-soft); color: #7a5000; border-color: #f4dfb0; }
.flash .button { margin-left: auto; }
.alert { background: var(--red-soft); color: var(--red); padding: 10px 12px; border-radius: 10px; }
.alert-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.alert-item { display: flex; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 12px; background: #fffaf0; border: 1px solid #f4e2bc; text-decoration: none; color: inherit; }
.alert-item:hover { border-color: #e9c98a; }
.alert-item.critical { background: #fff6f6; border-color: #f4cccc; }
.alert-item.critical:hover { border-color: #e8a5a5; }
.alert-item > .lucide-icon { width: 36px; height: 36px; padding: 8px; border-radius: 10px; background: var(--orange-soft); color: var(--orange-dark); flex: none; }
.alert-item.critical > .lucide-icon { background: #fde0e0; color: var(--red); }
.alert-item .what { font-weight: 650; }
.alert-item .meta { font-size: .78rem; color: var(--muted); }

/* ----- Schede a linguette, dettagli ----- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { padding: 10px 14px; text-decoration: none; color: var(--muted); border-bottom: 3px solid transparent; white-space: nowrap; font-weight: 600; font-size: .92rem; display: inline-flex; gap: 6px; align-items: center; }
.tabs a:hover { color: var(--blue); }
.tabs a.active { color: var(--blue-ink); border-bottom-color: var(--orange); }
.pills { display: flex; gap: 6px; flex-wrap: wrap; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 7px 13px; border-radius: 999px; background: #fff; border: 1px solid var(--line); color: var(--text); text-decoration: none; font-weight: 600; font-size: .88rem; }
.pill:hover { border-color: #cfd6e6; background: #fafbfd; }
.pill.active { background: var(--blue); border-color: var(--blue); color: #fff; }
.day-strip { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.day-chip { display: grid; justify-items: center; gap: 2px; padding: 8px 4px; border-radius: 12px; border: 1px solid var(--line); background: #fff; text-decoration: none; color: var(--text); }
.day-chip small { color: var(--muted); text-transform: uppercase; font-size: .68rem; letter-spacing: .05em; }
.day-chip strong { font-size: 1.05rem; }
.day-chip .dot { width: 7px; height: 7px; border-radius: 50%; background: #d5dae6; }
.day-chip.done .dot { background: var(--green); }
.day-chip.active { border-color: var(--blue); box-shadow: inset 0 0 0 1px var(--blue); background: var(--blue-soft); }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 7px 18px; margin: 0; }
.kv dt { color: var(--muted); font-size: .88rem; }
.kv dd { margin: 0; font-weight: 600; }
.photo { width: 124px; height: 124px; object-fit: cover; border-radius: 14px; border: 1px solid var(--line); background: #eef0f5; }
.photo.placeholder { display: flex; align-items: center; justify-content: center; }
.photo.placeholder .lucide-icon { width: 56px; height: 56px; color: #9aa3b8; }
.head-card { display: flex; gap: 18px; align-items: flex-start; flex-wrap: wrap; }
.head-card .info { flex: 1; min-width: 240px; }
details.drawer { border: 1px dashed #cdd3e0; border-radius: var(--radius-sm); padding: 10px 14px; margin-bottom: 14px; background: #fbfcfe; }
details.drawer > summary { cursor: pointer; font-weight: 650; color: var(--blue); list-style: none; display: flex; align-items: center; gap: 8px; }
details.drawer > summary::-webkit-details-marker { display: none; }
details.drawer[open] > summary { margin-bottom: 12px; }
details > summary.button { list-style: none; } details > summary.button::-webkit-details-marker { display: none; }
.files { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.files li { display: flex; gap: 10px; align-items: center; justify-content: space-between; border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; background: #fff; }
.timeline { list-style: none; margin: 0; padding: 0; font-size: .9rem; }
.timeline li { padding: 8px 0; border-bottom: 1px dashed var(--line); }
.kind-chip { width: 38px; height: 38px; border-radius: 10px; background: var(--blue-soft); color: var(--blue); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.kind-chip .lucide-icon { width: 22px; height: 22px; }
.name-cell { display: flex; align-items: center; gap: 10px; }

/* ----- Configurazione guidata ----- */
.checklist { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.checklist li { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.checklist li .state { width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex: none; background: var(--orange-soft); color: var(--orange-dark); }
.checklist li.ok .state { background: var(--green-soft); color: var(--green); }
.checklist li.opt .state { background: #eef0f4; color: var(--muted); }
.checklist li .txt { flex: 1; min-width: 0; }
.checklist li .txt small { display: block; color: var(--muted); }
.progress { height: 10px; border-radius: 999px; background: #e9edf5; overflow: hidden; }
.progress > span { display: block; height: 100%; background: linear-gradient(90deg, var(--orange), #e3d4a8); border-radius: 999px; }

/* ----- Calendario ----- */
.cal-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.calendar { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.calendar .dow { background: #f8f9fc; font-size: .72rem; text-transform: uppercase; color: var(--muted); padding: 7px; text-align: center; font-weight: 600; border-bottom: 1px solid var(--line); }
.calendar .day { min-height: 108px; border-right: 1px solid var(--line-2); border-bottom: 1px solid var(--line-2); padding: 5px; background: #fff; overflow: hidden; }
.calendar .day.other { background: #f9fafc; color: #a8afc2; }
.calendar .day.today { box-shadow: inset 0 0 0 2px var(--orange); }
.calendar .num { font-size: .8rem; font-weight: 700; }
.cal-item { display: block; font-size: .74rem; padding: 2px 6px; border-radius: 6px; margin-top: 3px; text-decoration: none; color: var(--blue); background: var(--blue-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-item.gara { background: var(--orange-soft); color: var(--orange-dark); }
.cal-item.person { background: #efe9fb; color: #5e35b1; }
.cal-item.vehicle { background: #e2f3f1; color: #00695c; }
.cal-item.expired { background: var(--red-soft); color: var(--red); }
.cal-item.done { text-decoration: line-through; opacity: .6; }
.cal-list { display: none; }
.legend { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }

/* ----- Grafici ----- */
.chart-wrap { position: relative; }
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart .tick { font-size: 11px; fill: #666; font-family: inherit; }
.chart .tick.strong { fill: #191919; font-weight: 700; }
.chart .hit { cursor: pointer; outline: none; }
.chart .hit:hover, .chart .hit:focus { fill: rgba(38,94,111,.06); }
.chart-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: .82rem; color: #444; margin-bottom: 8px; }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend .key { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.barlist { display: grid; gap: 8px; }
.barlist-row { display: grid; grid-template-columns: 82px 1fr auto; align-items: center; gap: 10px; font-size: .88rem; border-radius: 6px; outline: none; }
.barlist-row:hover, .barlist-row:focus { background: #f6f8fc; }
.barlist-label { font-weight: 600; font-variant-numeric: tabular-nums; }
.barlist-bar { display: block; height: 12px; border-radius: 0 4px 4px 0; }
.barlist-value { font-variant-numeric: tabular-nums; color: #191919; font-weight: 600; min-width: 70px; text-align: right; }
#chart-tip { position: fixed; z-index: 100; pointer-events: none; background: #fff; border: 1px solid rgba(11,11,11,.1); box-shadow: 0 8px 24px rgba(0,0,0,.14); border-radius: 10px; padding: 8px 10px; font-size: .82rem; min-width: 140px; max-width: 280px; }
#chart-tip .tip-title { color: #666; font-size: .76rem; margin-bottom: 4px; }
#chart-tip .tip-row { display: flex; align-items: center; gap: 8px; }
#chart-tip .tip-row b { color: #191919; font-variant-numeric: tabular-nums; }
#chart-tip .tip-row span { color: #666; }
#chart-tip .tip-key { width: 12px; height: 3px; border-radius: 2px; flex: none; }

/* ----- Accesso ----- */
.auth .page { max-width: none; padding: 0; }
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; background: radial-gradient(1200px 600px at 20% 0%, #357a8d 0%, transparent 60%), linear-gradient(160deg, #1b4350 0%, #265e6f 60%, #2f7183 100%); }
.login-card { width: 100%; max-width: 420px; background: #fff; border-radius: 20px; padding: 32px; box-shadow: 0 24px 60px rgba(0,0,0,.28); }
.login-card img { width: 100%; max-width: 300px; height: auto; margin-bottom: 14px; }
.login-card h1 { font-size: 1.3rem; }
.auth-password-field { position: relative; display: block; }
.auth-password-toggle { position: absolute; right: 4px; top: 4px; bottom: 4px; padding: 0 9px; min-height: 0; background: transparent; color: var(--muted); border: 0; }
.auth-password-toggle:hover { background: var(--blue-soft); }

/* ----- App sul telefono ----- */
.pwa-install-banner { position: fixed; left: 12px; right: 12px; bottom: 84px; z-index: 55; display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 14px; background: #fff; border: 1px solid var(--line); box-shadow: 0 10px 28px rgba(0,0,0,.16); max-width: 520px; margin: 0 auto; }
.pwa-install-banner[hidden] { display: none; }
.pwa-install-copy { flex: 1; display: grid; font-size: .85rem; }
.pwa-install-dismiss { background: transparent; color: var(--muted); border: 0; padding: 4px; min-height: 0; }

/* ----- Schermi medi ----- */
@media (max-width: 1180px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
/* ----- Tablet e telefono: menu a scomparsa + barra in basso ----- */
@media (max-width: 980px) {
  :root { --side-w: 280px; }
  .sidebar { transform: translateX(-100%); transition: transform .2s ease; box-shadow: 0 0 40px rgba(0,0,0,.3); }
  body.menu-open .sidebar { transform: none; }
  body.menu-open .side-backdrop { display: block; position: fixed; inset: 0; background: rgba(10,30,36,.45); z-index: 45; }
  body.with-shell .appbar, body.with-shell .page, body.with-shell .env-banner { margin-left: 0; }
  .appbar { background: var(--blue); padding: 8px 12px; padding-top: max(8px, env(safe-area-inset-top)); }
  .appbar-menu { display: inline-flex; background: transparent; border: 0; color: #fff; padding: 6px; min-height: 0; }
  .appbar-brand { display: block; flex: none; } .appbar-brand img { height: 32px; width: auto; display: block; }
  .quick-add > summary span { display: none; }
  .quick-add > summary { padding: 8px 11px; }
  .page { padding: 14px 14px 110px; }
  .bottombar { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; position: fixed; left: 0; right: 0; bottom: 0; z-index: 45; background: #fff; border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); box-shadow: 0 -6px 20px rgba(20,48,56,.06); }
  .bottombar a, .bottombar button { display: grid; justify-items: center; gap: 2px; padding: 5px 2px; color: var(--muted); text-decoration: none; font-size: .7rem; font-weight: 600; background: transparent; border: 0; min-height: 0; border-radius: 10px; }
  .bottombar a.active { color: var(--blue); }
  .bottombar a.active .lucide-icon { color: var(--orange-dark); }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .grid-4 { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat { padding: 12px; } .stat.with-icon { gap: 10px; } .stat-icon { width: 36px; height: 36px; } .stat .value { font-size: 1.25rem; }
  .stat .spark { display: none; }
  h1 { font-size: 1.3rem; } .title-icon { width: 38px; height: 38px; }
  .panel { padding: 14px; }
  .kv { grid-template-columns: 1fr; gap: 2px; } .kv dd { margin-bottom: 8px; }
  .hide-mobile { display: none; }
  .calendar { display: none; } .cal-list { display: block; }
  .barlist-row { grid-template-columns: 70px 1fr auto; }
  .page-head .actions { width: 100%; } .page-head .actions .button { flex: 1; }
  .day-chip { padding: 6px 2px; } .day-chip strong { font-size: .95rem; }
}
@media print {
  .sidebar, .appbar, .bottombar, .no-print, .pwa-install-banner { display: none !important; }
  body.with-shell .page { margin: 0; padding: 0; }
  .panel { box-shadow: none; }
}
details.drawer-panel > summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 10px; font-weight: 650; color: var(--blue-ink); font-size: 1.08rem; }
details.drawer-panel > summary::-webkit-details-marker { display: none; }
details.drawer-panel[open] > summary { margin-bottom: 12px; }
details.drawer-panel[open] > summary .lucide-chevron-down { transform: rotate(180deg); }
.nowrap { white-space: nowrap; }
.steps { margin: 0; padding-left: 20px; display: grid; gap: 10px; }
.steps li { line-height: 1.45; }


/* ===== Brezza: parti specifiche ===== */
.light { font-weight: 500; font-size: .8em; }
.grow { flex: 1; min-width: 0; }
h3.mini { font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 14px 0 6px; font-weight: 650; }
h3.mini:first-of-type { margin-top: 0; }
.text-red { color: var(--red); }
.login-logo { display: block; width: 170px !important; margin: 0 auto 6px; }
.side-brand img { max-width: 170px; margin: 4px auto 6px; }

/* Righe ospite (pagina Oggi) */
.guest-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; text-decoration: none; color: var(--text); margin-bottom: 8px; background: #fff; }
.guest-row:hover { border-color: #c9d6d9; background: #fafcfc; }
.guest-row .grow { display: grid; line-height: 1.3; }
.guest-row small { color: var(--muted); }
.guest-row > .lucide-icon { color: var(--muted); }
.apt-chip { min-width: 86px; text-align: center; padding: 6px 8px; border-radius: 9px; background: var(--blue-soft); color: var(--blue-ink); font-weight: 650; font-size: .84rem; }
.apt-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.apt-tile { display: grid; gap: 1px; padding: 9px 10px; border-radius: 11px; border: 1px dashed #c9d3d5; text-decoration: none; color: var(--muted); font-size: .8rem; line-height: 1.25; background: #fafbfb; }
.apt-tile strong { color: var(--text); font-size: .88rem; }
.apt-tile.busy { border: 1px solid transparent; background: var(--blue); color: #d9e9ec; }
.apt-tile.busy strong { color: #fff; }
.apt-tile small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.alert-item .grow { display: grid; }
a.what { color: inherit; text-decoration: none; }

/* Calendario prenotazioni */
.planner-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--line); border-radius: 12px; }
.planner { --apt-w: 118px; --day-w: 38px; min-width: calc(var(--apt-w) + var(--days) * var(--day-w)); }
.pl-row { display: grid; grid-template-columns: var(--apt-w) repeat(var(--days), minmax(var(--day-w), 1fr)); grid-auto-rows: 46px; position: relative; border-bottom: 1px solid var(--line-2); }
.pl-row > * { grid-row: 1; }
.pl-head { grid-auto-rows: 44px; background: #f8faf9; }
.pl-foot { grid-auto-rows: 28px; background: #f8faf9; border-bottom: 0; }
.pl-apt { position: sticky; left: 0; z-index: 3; background: #fff; display: grid; align-content: center; padding: 0 10px; border-right: 1px solid var(--line); line-height: 1.2; }
.pl-head .pl-apt, .pl-foot .pl-apt { background: #f8faf9; }
.pl-apt small { color: var(--muted); font-size: .72rem; }
.pl-day { display: grid; justify-items: center; align-content: center; line-height: 1.1; font-size: .78rem; border-left: 1px solid var(--line-2); }
.pl-day small { color: var(--muted); font-size: .64rem; text-transform: uppercase; }
.pl-day.we { background: #f1f4f3; }
.pl-day.is-today { background: var(--orange-soft); box-shadow: inset 0 -3px 0 var(--orange); }
.pl-foot .pl-day small { font-size: .74rem; color: var(--green); font-weight: 650; text-transform: none; }
.pl-foot .pl-day.full small { color: var(--red); }
.pl-cell { border-left: 1px solid var(--line-2); }
.pl-cell.we { background: #f7f9f8; }
.pl-cell.is-today { background: #fbf7ec; }
.pl-cell:hover { background: var(--blue-soft); }
.pl-bar { z-index: 2; margin: 7px 2px; border-radius: 8px; background: var(--blue); color: #fff; text-decoration: none; font-size: .78rem; font-weight: 600; display: flex; align-items: center; gap: 6px; padding: 0 8px; overflow: hidden; white-space: nowrap; box-shadow: 0 1px 3px rgba(20,48,56,.18); }
.pl-bar span { overflow: hidden; text-overflow: ellipsis; }
.pl-bar.direct { background: #8c6d2f; }
.pl-bar:hover { filter: brightness(1.12); }
.pl-bar.cut-left { border-top-left-radius: 0; border-bottom-left-radius: 0; margin-left: 0; }
.pl-bar.cut-right { border-top-right-radius: 0; border-bottom-right-radius: 0; margin-right: 0; }
.pl-bar .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--orange); flex: none; box-shadow: 0 0 0 2px rgba(255,255,255,.6); }
.key-sq { display: inline-block; width: 12px; height: 12px; border-radius: 3px; background: var(--blue); }
.key-sq.direct { background: #8c6d2f; }
.key-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--orange); }
.legend .badge { gap: 6px; }

/* Elenco prenotazioni */
.filters .grow-2 { flex: 2; min-width: 220px; }
.booking-table td.badges { white-space: nowrap; }
.booking-table td.badges .badge { margin-right: 3px; }
.click-row { cursor: pointer; }
.row-link { color: inherit; text-decoration: none; }
.row-link::after { content: ''; position: absolute; inset: 0; }
.booking-table tr { position: relative; }

/* Scheda prenotazione */
.booking-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 18px; align-items: start; }
.booking-side { position: sticky; top: 64px; display: grid; gap: 0; }
.field-static { display: grid; gap: 5px; font-size: .86rem; }
.field-static .lbl { font-weight: 600; color: #3f4f54; }
.field-static strong { min-height: 42px; display: flex; align-items: center; font-size: 1rem; color: var(--blue-ink); }
.form-grid .wide-2 { grid-column: span 2; }
input.needs, select.needs { background: #fff8e1; border-color: #e6cf8a; }
.sticky-actions { position: sticky; bottom: 0; z-index: 5; background: linear-gradient(180deg, rgba(246,246,244,0), var(--bg) 35%); padding: 18px 0 12px; margin-top: -6px; }
.big-number { font-size: 1.7rem; font-weight: 700; color: var(--blue-ink); letter-spacing: -.02em; }
.panel-title .button.small, .panel-title button.small { font-size: .78rem; font-weight: 600; }
.files li a { text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.files li { flex-wrap: wrap; }

/* Caricamento */
.dropzone { display: grid; justify-items: center; gap: 6px; padding: 30px 16px; border: 2px dashed #b9cbd0; border-radius: 16px; background: #fafcfc; cursor: pointer; text-align: center; color: var(--blue-ink); font-weight: 500; }
.dropzone.small { padding: 18px 14px; }
.dropzone:hover, .dropzone.drag { border-color: var(--blue); background: var(--blue-soft); }
.dropzone.has-files { border-style: solid; border-color: var(--blue); }
.dropzone input[type=file] { max-width: 320px; min-height: 0; border: 0; padding: 6px 0; background: transparent; }
.dropzone > .lucide-icon { color: var(--blue); }
.result-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.result-list li { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); }
.result-list li.ok { background: var(--green-soft); border-color: #c8e6cf; } .result-list li.ok > .lucide-icon { color: var(--green); }
.result-list li.warn { background: var(--amber-soft); border-color: #f0dfb3; } .result-list li.warn > .lucide-icon { color: var(--orange-dark); }
.result-list li.ko { background: var(--red-soft); border-color: #f3c4c4; } .result-list li.ko > .lucide-icon { color: var(--red); }

/* Dashboard */
.month-table th, .month-table td { padding: 8px 8px; font-size: .86rem; }
.month-table td:first-child { white-space: nowrap; }

/* Scadenze */
.cal-item.scadenza { background: var(--orange-soft); color: var(--orange-dark); }
.cal-item.manutenzione { background: #e2f0ee; color: #1f6b5f; }
.cal-item.pagamento { background: #ece8f7; color: #4f3c8f; }
.calendar .num a { color: inherit; text-decoration: none; }

@media (max-width: 1180px) {
  .booking-layout { grid-template-columns: 1fr; }
  .booking-side { position: static; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 0 18px; }
}
@media (max-width: 980px) {
  .appbar-brand img { height: 26px; }
}
@media (max-width: 640px) {
  .apt-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .planner { --apt-w: 84px; --day-w: 34px; }
  .pl-apt small { display: none; }
  .form-grid .wide-2 { grid-column: auto; }
  .booking-table thead { display: none; }
  .booking-table, .booking-table tbody { display: block; }
  .booking-table tr { display: grid; grid-template-columns: auto auto 1fr; gap: 2px 6px; padding: 10px 2px; border-bottom: 1px solid var(--line); }
  .booking-table td { border: 0; padding: 0; }
  .booking-table td:nth-child(1) { grid-column: 1 / 3; grid-row: 1; }
  .booking-table td:nth-child(6) { grid-column: 3; grid-row: 1; font-weight: 650; }
  .booking-table td:nth-child(2) { grid-column: 1; grid-row: 2; color: var(--muted); }
  .booking-table td:nth-child(2)::after { content: ' →'; }
  .booking-table td:nth-child(3) { grid-column: 2; grid-row: 2; color: var(--muted); }
  .booking-table td:nth-child(4) { display: none; }
  .booking-table td:nth-child(5) { grid-column: 1 / -1; grid-row: 3; }
  .booking-table td.badges { grid-column: 1 / -1; grid-row: 4; }
  .booking-table td.badges { white-space: normal; }
  .guest-row .apt-chip { min-width: 70px; }
  .filters label { min-width: 0; flex: 1 1 140px; }
  .panel-title { flex-wrap: wrap; }
}
a.stat { text-decoration: none; color: inherit; display: flex; }
a.stat .label { text-decoration: none; }
.side-user .who small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.empty.small { padding: 10px; text-align: left; }

@media (max-width: 1180px) { .grid-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 640px) { .grid-5 { grid-template-columns: 1fr 1fr; gap: 10px; } .grid-5 > .stat.highlight { grid-column: 1 / -1; } }
.stat.highlight { background: var(--blue); border-color: var(--blue); }
.stat.highlight .label, .stat.highlight .sub { color: #cfe3e7; }
.stat.highlight .value { color: #fff; }

.month-picker { border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px 12px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px 10px; margin: 0; }
.month-picker legend { font-weight: 600; font-size: .86rem; color: #3f4f54; padding: 0 6px; }
.month-picker .wide { grid-column: 1 / -1; }
@media (max-width: 640px) { .month-picker { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.user-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.user-list li { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; flex-wrap: wrap; }
.user-list li.off { opacity: .6; }
.user-list .grow { display: grid; line-height: 1.3; min-width: 160px; }
.user-list small { color: var(--muted); }
.user-list .avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--orange-soft); color: var(--orange-dark); font-weight: 700; font-size: .8rem; flex: none; }
code.pw { font-size: 1rem; background: #fff; padding: 2px 8px; border-radius: 6px; border: 1px solid var(--line); user-select: all; }

/* ===== Revisione allineamenti ===== */
.empty.small { padding: 6px 0; }
.filters input, .filters select { height: 42px; }
.filters button, .filters .button { height: 42px; }
.booking-layout.single { grid-template-columns: minmax(0, 1fr); max-width: 980px; }
.static-box { min-height: 42px; display: flex; align-items: center; padding: 0 12px; border: 1px dashed var(--line); border-radius: 10px; background: #fafbfb; font-weight: 650; }
.form-grid > label.check { align-self: end; min-height: 42px; display: flex; align-items: center; gap: 8px; }
.form-grid > label.check input { margin: 0; }
.form-grid > label > .hint { margin-top: -1px; }
.panel-title .grow { flex: 1 1 200px; }
.dropzone input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.dropzone { position: relative; }
.dropzone [data-files] { color: var(--muted); }
.dropzone.has-files [data-files] { color: var(--blue-ink); font-weight: 600; }
.form-actions .grow { flex: 1; }
.apt-table input { width: 100%; min-width: 0; }
.apt-table th:nth-child(1) { width: 38%; } .apt-table th:nth-child(2) { width: 30%; }
.apt-table td:nth-child(3), .apt-table th:nth-child(3) { text-align: center; }
.tax-table td, .tax-table th { white-space: nowrap; }
@media (max-width: 640px) {
  .apt-table th:nth-child(4), .apt-table td:nth-child(4) { display: none; }
  .apt-table th:nth-child(1) { width: 50%; } .apt-table th:nth-child(2) { width: 35%; }
  .apt-table td, .apt-table th { padding-left: 4px; padding-right: 4px; }
  .form-actions .grow { display: none; }
}
.code-input { font-size: 1.5rem !important; letter-spacing: .3em; text-align: center; font-variant-numeric: tabular-nums; }
.qr-box { display: block; width: fit-content; margin: 10px 0 6px; padding: 8px; background: #fff; border: 1px solid var(--line); border-radius: 12px; }
.qr-box svg { display: block; width: 200px; height: 200px; }
.login-card.wide-card { max-width: 520px; }
.login-card .steps { padding-left: 20px; }
.login-card .steps li { margin-bottom: 10px; }

.totp-status { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; border: 1px solid #f0dfb3; background: var(--amber-soft); color: var(--text); text-decoration: none; margin-bottom: 14px; }
.totp-status.on { border-color: #c8e6cf; background: var(--green-soft); }
.totp-status .grow { display: grid; line-height: 1.3; }
.totp-status small { color: var(--muted); }

.devices { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: -6px 0 14px; }
.devices form { margin-left: auto; }
