@font-face { font-family: "Schibsted Grotesk"; src: url("fonts/schibsted-grotesk-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Schibsted Grotesk"; src: url("fonts/schibsted-grotesk-latin-500-normal.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Schibsted Grotesk"; src: url("fonts/schibsted-grotesk-latin-600-normal.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Schibsted Grotesk"; src: url("fonts/schibsted-grotesk-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-display: swap; }

/* ------------------------------------------------------------------ token */
:root {
  color-scheme: light;
  --page: #f1f3ee;
  --surface: #fcfcfb;
  --surface-2: #f6f7f3;
  --ink: #17201b;
  --ink-2: #4a534e;
  --muted: #747b76;
  --line: #e0e3dc;
  --line-strong: #c4c9c2;
  --accent: #2d5a46;
  --accent-hover: #24493a;
  --accent-ink: #ffffff;
  --accent-soft: #e1eae4;
  --danger: #b3312f;

  /* grafici */
  --c-in: #2a78d6;
  --c-out: #eb6834;
  --c-airbnb: #1baf7a;
  --c-booking: #6250d6;
  --c-privato: #eda100;
  --c-altro: #898781;
  --c-emph-2: #8d948f;
  --c-emph-3: #c3c8c1;
  --c-rest: #dfe2dc;
  --grid: #e5e7e1;
  --axis: #c3c8c1;
  --seq-1: #cde2fb; --seq-2: #9ec5f4; --seq-3: #6da7ec; --seq-4: #3987e5; --seq-5: #256abf; --seq-6: #184f95;
  --ord-1: #86b6ef; --ord-2: #3987e5; --ord-3: #1c5cab; --ord-4: #0d366b;

  --r-lg: 16px;
  --r-md: 10px;
  --r-sm: 7px;
  --font: "Schibsted Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #121513; --surface: #1a1d1b; --surface-2: #202421;
    --ink: #edf0eb; --ink-2: #c0c6bf; --muted: #8b928c;
    --line: #2b302c; --line-strong: #3b413c;
    --accent: #84bfa1; --accent-hover: #9dcfb4; --accent-ink: #0e1a13; --accent-soft: #223329;
    --danger: #ef7d7b;
    --c-in: #3987e5; --c-out: #d95926;
    --c-airbnb: #199e70; --c-booking: #9085e9; --c-privato: #c98500; --c-altro: #898781;
    --c-emph-2: #7e8580; --c-emph-3: #4a504b; --c-rest: #2f3430;
    --grid: #2a2e2b; --axis: #3b413c;
    --seq-1: #184f95; --seq-2: #1c5cab; --seq-3: #256abf; --seq-4: #3987e5; --seq-5: #6da7ec; --seq-6: #9ec5f4;
    --ord-1: #184f95; --ord-2: #256abf; --ord-3: #3987e5; --ord-4: #86b6ef;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #121513; --surface: #1a1d1b; --surface-2: #202421;
  --ink: #edf0eb; --ink-2: #c0c6bf; --muted: #8b928c;
  --line: #2b302c; --line-strong: #3b413c;
  --accent: #84bfa1; --accent-hover: #9dcfb4; --accent-ink: #0e1a13; --accent-soft: #223329;
  --danger: #ef7d7b;
  --c-in: #3987e5; --c-out: #d95926;
  --c-airbnb: #199e70; --c-booking: #9085e9; --c-privato: #c98500; --c-altro: #898781;
  --c-emph-2: #7e8580; --c-emph-3: #4a504b; --c-rest: #2f3430;
  --grid: #2a2e2b; --axis: #3b413c;
  --seq-1: #184f95; --seq-2: #1c5cab; --seq-3: #256abf; --seq-4: #3987e5; --seq-5: #6da7ec; --seq-6: #9ec5f4;
  --ord-1: #184f95; --ord-2: #256abf; --ord-3: #3987e5; --ord-4: #86b6ef;
}

/* ------------------------------------------------------------------ base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font: 400 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
a { color: var(--accent); }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
p { margin: 0; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ------------------------------------------------------------------ buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 40px; padding: 0 16px;
  border: 1px solid transparent; border-radius: var(--r-sm);
  background: var(--surface-2); color: var(--ink);
  font-weight: 500; cursor: pointer; text-decoration: none;
}
.btn:hover { background: var(--line); }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-ghost { background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn-danger-ghost { background: transparent; color: var(--danger); }
.btn-danger-ghost:hover { background: color-mix(in srgb, var(--danger) 10%, transparent); }
.btn-outline { background: transparent; border-color: var(--line-strong); }
.btn-outline:hover { background: var(--surface-2); }
.btn-sm { min-height: 34px; padding: 0 10px; font-size: 14px; }
.btn[disabled] { opacity: .5; cursor: default; }

/* ------------------------------------------------------------------ login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login-box {
  width: min(380px, 100%);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 32px 28px; display: grid; gap: 10px;
}
.login-mark { width: 44px; height: 44px; color: var(--accent); margin-bottom: 6px; }
.login-box h1 { font-size: 28px; }
.login-sub { color: var(--ink-2); margin-bottom: 14px; }
.login-box label { font-weight: 500; font-size: 14px; }
.login-box input { height: 44px; padding: 0 12px; border-radius: var(--r-sm); border: 1px solid var(--line-strong); background: var(--surface); }
.login-box .btn { margin-top: 6px; height: 46px; }

/* ------------------------------------------------------------------ shell */
.shell { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }
.rail {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 28px;
  padding: 24px 16px; border-right: 1px solid var(--line); background: var(--page);
}
.brand { display: flex; gap: 12px; align-items: center; padding: 0 8px; }
.brand svg { width: 34px; height: 34px; color: var(--accent); flex: none; }
.brand strong { display: block; font-size: 19px; line-height: 1.1; }
.brand span { display: block; font-size: 13px; color: var(--muted); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: block; padding: 9px 12px; border-radius: var(--r-sm);
  color: var(--ink-2); text-decoration: none; font-weight: 500;
}
.nav a:hover { background: var(--surface-2); color: var(--ink); }
.nav a[aria-current="page"] { background: var(--accent-soft); color: var(--ink); box-shadow: inset 3px 0 0 var(--accent); }
.rail-actions { display: grid; gap: 8px; }
.rail-actions .btn { width: 100%; }
.fab { display: none !important; }
.rail-foot { margin-top: auto; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }

.view { padding: 32px 40px 120px; max-width: 1180px; width: 100%; outline: none; }
.page-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 16px 24px; margin-bottom: 24px; }
.page-head h1 { font-size: 30px; line-height: 1.15; }
.page-head p { color: var(--ink-2); margin-top: 4px; max-width: 62ch; }

/* ------------------------------------------------------------------ filters */
.filters { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; margin-bottom: 24px; }
.pills { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; }
.pills button {
  min-height: 32px; padding: 0 14px; border: 0; border-radius: 999px;
  background: transparent; color: var(--ink-2); font-weight: 500; cursor: pointer;
}
.pills button:hover { color: var(--ink); }
.pills button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 0 0 1px var(--line-strong); }
.field-inline { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink-2); }
.field-inline select, .field-inline input, .search {
  height: 38px; padding: 0 10px; border-radius: var(--r-sm); border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
}
.search { min-width: 220px; }

/* ------------------------------------------------------------------ hero */
.hero {
  display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 0;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  margin-bottom: 20px; overflow: hidden;
}
.hero-main { padding: 28px 30px 26px; }
.hero-period { color: var(--ink-2); font-weight: 500; }
.hero-num { font-size: clamp(44px, 7vw, 64px); line-height: 1.02; font-weight: 600; letter-spacing: -0.025em; margin: 6px 0 10px; }
.hero-num.neg { color: var(--danger); }
.hero-text { color: var(--ink-2); font-size: 17px; max-width: 46ch; }
.hero-text b { color: var(--ink); font-weight: 600; }
.figs { display: grid; grid-template-columns: 1fr 1fr; border-left: 1px solid var(--line); }
.fig { padding: 20px 22px; border-bottom: 1px solid var(--line); }
.fig:nth-child(odd) { border-right: 1px solid var(--line); }
.fig:nth-last-child(-n+2) { border-bottom: 0; }
.fig-label { font-size: 14px; color: var(--ink-2); }
.fig-value { font-size: 24px; font-weight: 600; letter-spacing: -0.01em; margin-top: 2px; }
.fig-note { font-size: 13px; color: var(--muted); margin-top: 2px; }

/* riga di cifre (pagina spese) */
.figrow { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); margin-bottom: 20px; overflow: hidden; }
.figrow .figs { grid-template-columns: repeat(4, minmax(0, 1fr)); border: 0; }
.figrow .fig { border-bottom: 0; border-right: 1px solid var(--line); }
.figrow .fig:last-child { border-right: 0; }

/* rientro dell'investimento */
.payback { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 22px 26px 20px; margin-bottom: 20px; }
.payback-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 4px 20px; margin-bottom: 14px; }
.payback-head h2 { font-size: 17px; }
.payback-head p { color: var(--ink-2); font-size: 14px; }
.segbar { display: flex; gap: 2px; height: 28px; }
.segbar > div { border-radius: 4px; min-width: 3px; position: relative; display: flex; align-items: center; padding-left: 8px; font-size: 13px; font-weight: 600; color: #fff; white-space: nowrap; overflow: visible; }
.segbar > div.light-label { color: #0b0b0b; }
.segbar > div.rest { color: var(--ink-2); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 12px; font-size: 13px; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; }
.legend i.line { width: 16px; height: 3px; border-radius: 2px; }

/* ------------------------------------------------------------------ panels & charts */
.cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.cols > .panel { margin-bottom: 0; }
.cols + .panel, .panel + .cols { margin-top: 20px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 22px 24px 18px; margin-bottom: 20px; min-width: 0; }
.panel-head { margin-bottom: 14px; }
.panel-head h2 { font-size: 17px; }
.panel-head p { color: var(--ink-2); font-size: 14px; margin-top: 2px; max-width: 70ch; }
.chart { position: relative; height: 300px; }
.chart.short { height: 240px; }
.chart.tall { height: 360px; }
.chart.loading { opacity: .5; }
details.table-view { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 10px; }
details.table-view summary { cursor: pointer; font-size: 14px; color: var(--ink-2); width: fit-content; }
details.table-view summary:hover { color: var(--ink); }
details.table-view .tbl-wrap { margin-top: 10px; max-height: 340px; }
.empty { color: var(--muted); padding: 24px 0; }

/* ------------------------------------------------------------------ tables */
.tbl-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 9px 10px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-weight: 600; color: var(--ink-2); background: var(--surface); position: sticky; top: 0; z-index: 1; }
td.n, th.n { text-align: right; white-space: nowrap; }
td.muted { color: var(--muted); }
td.nowrap { white-space: nowrap; }
tr.total td { font-weight: 600; border-bottom: 0; border-top: 1px solid var(--line-strong); }
tbody tr.click { cursor: pointer; }
tbody tr.click:hover td { background: var(--surface-2); }
.tag { display: inline-block; padding: 1px 8px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); font-size: 12.5px; color: var(--ink-2); white-space: nowrap; }
.swatch { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 7px; vertical-align: 1px; }

/* barre orizzontali in tabella */
.hbar { display: flex; align-items: center; gap: 10px; }
.hbar-track { flex: 1; height: 8px; border-radius: 4px; background: transparent; min-width: 60px; }
.hbar-fill { height: 8px; border-radius: 0 4px 4px 0; background: var(--c-in); }

/* stagionalita' */
.heat { display: grid; grid-template-columns: 52px repeat(12, minmax(0, 1fr)); gap: 3px; font-size: 12.5px; }
.heat .h-lab { color: var(--muted); display: flex; align-items: center; }
.heat .h-col { color: var(--muted); text-align: center; padding-bottom: 2px; }
.heat .cell {
  height: 42px; border-radius: 5px; display: flex; align-items: center; justify-content: center;
  font-weight: 500; cursor: default; border: 0; padding: 0;
}
.heat .cell.void { background: repeating-linear-gradient(135deg, transparent 0 5px, var(--line) 5px 6px); }
.heat .cell:hover, .heat .cell:focus-visible { outline: 2px solid var(--ink); outline-offset: -2px; }
.heat-scale { display: flex; align-items: center; gap: 6px; margin-top: 12px; font-size: 13px; color: var(--ink-2); }
.heat-scale i { width: 26px; height: 10px; border-radius: 3px; display: inline-block; }

/* scadenze */
.deadlines { display: grid; gap: 0; }
.dl { display: grid; grid-template-columns: 116px minmax(0, 1fr) auto; gap: 16px; align-items: start; padding: 14px 0; border-bottom: 1px solid var(--line); }
.dl:last-child { border-bottom: 0; }
.dl-when { font-weight: 600; }
.dl-when small { display: block; font-weight: 400; color: var(--muted); font-size: 13px; }
.dl-what strong { display: block; }
.dl-what span { color: var(--ink-2); font-size: 14px; }
.dl-soon .dl-when { color: var(--accent); }
.links { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.links a { display: block; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-md); text-decoration: none; color: var(--ink); }
.links a:hover { border-color: var(--line-strong); background: var(--surface-2); }
.links a span { display: block; font-size: 13px; color: var(--ink-2); }

/* movimenti mobile */
.mov-list { display: none; }
.mov-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; padding: 12px 2px; border-bottom: 1px solid var(--line); cursor: pointer; }
.mov-item .t { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mov-item .s { font-size: 13px; color: var(--muted); }
.mov-item .a { text-align: right; font-weight: 600; }
.totals { display: flex; flex-wrap: wrap; gap: 6px 22px; font-size: 14px; color: var(--ink-2); margin: -8px 0 14px; }
.totals b { color: var(--ink); font-weight: 600; }
.more { margin-top: 14px; }

/* modifica di tutti i dati */
.view.wide { max-width: none; }
.edit-panel { padding: 0; overflow: hidden; }
.edit-wrap { max-height: calc(100vh - 290px); min-height: 320px; }
.edit-table { table-layout: fixed; min-width: 1040px; }
.edit-table th { padding: 10px 8px; }
.edit-table td { padding: 3px 4px; border-bottom: 1px solid var(--line); }
.edit-table input, .edit-table select {
  width: 100%; height: 34px; padding: 0 7px; border: 1px solid transparent; border-radius: 6px;
  background: transparent; color: var(--ink); font-size: 14px;
}
.edit-table input.r { text-align: right; }
.edit-table input:hover, .edit-table select:hover { border-color: var(--line-strong); }
.edit-table input:focus, .edit-table select:focus { border-color: var(--accent); background: var(--surface); outline: 2px solid color-mix(in srgb, var(--accent) 25%, transparent); outline-offset: 0; }
.edit-table tr.changed td { background: var(--accent-soft); }
.edit-table tr.nuovo td { background: color-mix(in srgb, var(--c-in) 9%, transparent); }
.edit-table tr.deleted td { background: color-mix(in srgb, var(--danger) 8%, transparent); }
.edit-table tr.deleted input, .edit-table tr.deleted select { text-decoration: line-through; color: var(--muted); }
.edit-table tr.err td { background: color-mix(in srgb, var(--danger) 16%, transparent); }
.edit-table td.act { text-align: center; }
.btn-x { width: 30px; height: 30px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); font-size: 18px; line-height: 1; cursor: pointer; }
.btn-x:hover { background: var(--surface-2); color: var(--danger); }
.editbar {
  position: sticky; bottom: 12px; z-index: 12; margin-top: 14px;
  display: flex; align-items: center; gap: 10px; padding: 10px 12px 10px 18px;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-md);
  box-shadow: 0 6px 20px rgba(0, 0, 0, .10); font-weight: 500;
}
.ed-error { margin-bottom: 14px; border-color: var(--danger); color: var(--ink); }

/* dati */
.stack { display: grid; gap: 12px; }
.note { font-size: 14px; color: var(--ink-2); }
.defs { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px 18px; font-size: 14px; margin: 0; }
.defs dt { font-weight: 600; }
.defs dd { margin: 0; color: var(--ink-2); }
.result { padding: 14px 16px; border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--line); font-size: 14px; }
.result ul { margin: 6px 0 0; padding-left: 18px; }
.file-pick { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

/* ------------------------------------------------------------------ dialogs */
.dlg {
  width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 32px);
  padding: 0; border: 1px solid var(--line); border-radius: var(--r-lg);
  background: var(--surface); color: var(--ink);
}
.dlg::backdrop { background: rgba(10, 16, 12, .45); }
.dlg form { padding: 24px; display: grid; gap: 14px; }
.dlg h2 { font-size: 21px; }
.dlg-sub { color: var(--ink-2); font-size: 14px; margin-top: -8px; }
.dlg label { display: grid; gap: 5px; font-size: 14px; font-weight: 500; color: var(--ink-2); }
.dlg input, .dlg select {
  height: 42px; padding: 0 11px; border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  background: var(--surface); color: var(--ink); font-weight: 400; width: 100%;
}
.dlg input:focus, .dlg select:focus { border-color: var(--accent); outline: 2px solid color-mix(in srgb, var(--accent) 25%, transparent); outline-offset: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.dlg-actions { display: flex; gap: 8px; align-items: center; margin-top: 4px; }
.spacer { flex: 1; }
.form-err { color: var(--danger); font-size: 14px; min-height: 0; }
.form-err:empty { display: none; }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--r-sm); overflow: hidden; width: fit-content; }
.seg label { display: block; color: var(--ink-2); }
.seg input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.seg span { display: block; padding: 8px 18px; cursor: pointer; font-weight: 500; }
.seg input:checked + span { background: var(--accent); color: var(--accent-ink); }
.seg input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: -2px; }
.dlg-small { width: min(440px, calc(100vw - 24px)); }
.choice { display: grid; gap: 10px; }
.choice-btn { text-align: left; padding: 14px 16px; border: 1px solid var(--line-strong); border-radius: var(--r-md); background: var(--surface); cursor: pointer; }
.choice-btn:hover { border-color: var(--accent); background: var(--accent-soft); }
.choice-btn strong { display: block; font-size: 16px; }
.choice-btn span { color: var(--ink-2); font-size: 14px; }

/* ------------------------------------------------------------------ fab, toast, tooltip */
.fab {
  position: fixed; right: 24px; bottom: 24px; z-index: 20;
  display: inline-flex; align-items: center; gap: 8px; height: 52px; padding: 0 20px 0 16px;
  border: 0; border-radius: 999px; background: var(--accent); color: var(--accent-ink);
  font-weight: 600; cursor: pointer; box-shadow: 0 6px 18px rgba(20, 40, 30, .22);
}
.fab:hover { background: var(--accent-hover); }
.fab svg { width: 22px; height: 22px; }
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px); z-index: 50;
  padding: 11px 18px; border-radius: 999px; background: var(--ink); color: var(--page);
  font-size: 14px; font-weight: 500; opacity: 0; pointer-events: none; transition: opacity .18s, transform .18s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.tip {
  position: fixed; z-index: 60; pointer-events: none; max-width: 260px;
  padding: 8px 11px; border-radius: 8px; background: var(--surface); border: 1px solid var(--line-strong);
  box-shadow: 0 4px 14px rgba(0, 0, 0, .12); font-size: 13px; color: var(--ink-2);
}
.tip b { display: block; color: var(--ink); font-size: 15px; }

/* ------------------------------------------------------------------ responsive */
@media (min-width: 1700px) {
  .view { max-width: 1480px; }
}
@media (max-width: 1020px) {
  .hero { grid-template-columns: 1fr; }
  .figs { border-left: 0; border-top: 1px solid var(--line); }
  .cols { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .rail {
    position: sticky; top: 0; z-index: 15; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center;
    gap: 10px; padding: 12px 16px 0; border-right: 0; border-bottom: 1px solid var(--line);
  }
  .brand { padding: 0; }
  .brand svg { width: 28px; height: 28px; }
  .brand span { display: none; }
  .rail-foot { margin: 0 0 0 auto; flex-direction: row; }
  .rail-actions { display: none; }
  .fab { display: inline-flex !important; }
  .nav { order: 3; flex-direction: row; width: calc(100% + 32px); margin: 0 -16px; padding: 0 12px; overflow-x: auto; scrollbar-width: none; }
  .nav::-webkit-scrollbar { display: none; }
  .nav a { white-space: nowrap; border-radius: 0; padding: 10px 10px 11px; }
  .nav a[aria-current="page"] { background: transparent; box-shadow: inset 0 -3px 0 var(--accent); }
  .view { padding: 22px 16px 110px; }
  .page-head h1 { font-size: 25px; }
  .hero-main { padding: 22px 20px; }
  .fig { padding: 16px 18px; }
  .fig-value { font-size: 21px; }
  .panel, .payback { padding: 18px 16px 14px; }
  .chart { height: 260px; }
  .chart.tall { height: 300px; }
  .fab { right: 16px; bottom: 16px; }
  .mov-table { display: none; }
  .mov-list { display: block; }
  .search { min-width: 0; flex: 1 1 100%; }
  .dl { grid-template-columns: 1fr; gap: 4px; }
  .heat { grid-template-columns: 40px repeat(12, minmax(0, 1fr)); gap: 2px; font-size: 11px; }
  .heat .cell { height: 34px; font-size: 0; }
}
@media (max-width: 700px) {
  .figrow .figs { grid-template-columns: 1fr 1fr; }
  .figrow .fig:nth-child(2n) { border-right: 0; }
  .figrow .fig:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
}
@media (max-width: 480px) {
  .grid2 { grid-template-columns: 1fr; }
  .figs { grid-template-columns: 1fr 1fr; }
  .rail-foot #theme-btn { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .toast { transition: none; }
}
@media print {
  .rail, .fab, .filters, details.table-view summary { display: none !important; }
  .shell { display: block; }
  .panel, .hero, .payback { break-inside: avoid; }
}

/* ================================================================== gestionale multi-modulo */

/* colori per modulo: Hospitality cipresso (predefinito), Workshop bronzo, Shop prugna */
:root[data-mod="workshop"] { --accent: #86561a; --accent-hover: #6d4513; --accent-ink: #ffffff; --accent-soft: #f3e9dc; }
:root[data-mod="shop"] { --accent: #5b3f8c; --accent-hover: #4a3274; --accent-ink: #ffffff; --accent-soft: #ece6f5; }
@media (prefers-color-scheme: dark) {
  :root[data-mod="workshop"]:not([data-theme="light"]) { --accent: #e0b072; --accent-hover: #ecc591; --accent-ink: #1d1408; --accent-soft: #3b2f20; }
  :root[data-mod="shop"]:not([data-theme="light"]) { --accent: #b9a2e6; --accent-hover: #cdbbef; --accent-ink: #170f27; --accent-soft: #2f2742; }
}
:root[data-mod="workshop"][data-theme="dark"] { --accent: #e0b072; --accent-hover: #ecc591; --accent-ink: #1d1408; --accent-soft: #3b2f20; }
:root[data-mod="shop"][data-theme="dark"] { --accent: #b9a2e6; --accent-hover: #cdbbef; --accent-ink: #170f27; --accent-soft: #2f2742; }
[data-mod="hospitality"] { --mc: #2d5a46; --mc-soft: #e1eae4; }
[data-mod="workshop"] { --mc: #86561a; --mc-soft: #f3e9dc; }
[data-mod="shop"] { --mc: #5b3f8c; --mc-soft: #ece6f5; }

/* accesso */
.login-marks { display: flex; gap: 8px; margin-bottom: 8px; }
.login-marks span { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; color: #fff; }
.login-marks span:nth-child(1) { background: #2d5a46; }
.login-marks span:nth-child(2) { background: #86561a; }
.login-marks span:nth-child(3) { background: #5b3f8c; }
.login-marks svg { width: 24px; height: 24px; }

/* schermata iniziale */
.start { min-height: 100vh; display: flex; flex-direction: column; }
.start-bar { display: flex; align-items: center; gap: 6px; padding: 14px 24px; border-bottom: 1px solid var(--line); }
.start-brand { font-size: 18px; letter-spacing: -0.01em; }
.start-body { width: 100%; max-width: 1180px; margin: 0 auto; padding: 56px 24px 64px; }
.start-body h1 { font-size: clamp(28px, 4vw, 40px); line-height: 1.1; letter-spacing: -0.02em; font-weight: 600; max-width: 22ch; }
.start-sub { color: var(--ink-2); margin: 10px 0 36px; max-width: 62ch; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; }
.tile {
  display: flex; flex-direction: column; align-items: stretch; text-align: left; gap: 6px;
  padding: 0 0 22px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface);
  cursor: pointer; overflow: hidden; color: var(--ink); font: inherit; position: relative;
  transition: border-color .15s, transform .15s;
}
.tile::before { content: ""; height: 8px; background: var(--mc); display: block; margin-bottom: 18px; }
.tile:hover { border-color: var(--mc); transform: translateY(-2px); }
.tile:focus-visible { outline: 3px solid var(--mc); outline-offset: 2px; }
.tile > span { padding: 0 24px; }
.tile-top { display: flex; align-items: center; justify-content: space-between; }
.tile-ico { width: 52px; height: 52px; border-radius: 14px; background: var(--mc); color: #fff; display: grid; place-items: center; }
.tile-ico svg { width: 30px; height: 30px; }
.tile kbd { font: 500 13px var(--font); color: var(--muted); border: 1px solid var(--line-strong); border-radius: 6px; padding: 1px 7px; }
.tile-name { font-size: 30px; font-weight: 600; letter-spacing: -0.02em; margin-top: 12px; }
.tile-ws { color: var(--ink-2); font-weight: 500; min-height: 1.5em; }
.tile-desc { color: var(--ink-2); font-size: 14px; min-height: 3em; }
.tile-figs { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 10px 0 4px; padding-top: 14px !important; border-top: 1px solid var(--line); margin-left: 24px; margin-right: 24px; padding-left: 0 !important; padding-right: 0 !important; }
.tile-fig b { display: block; font-size: 20px; font-weight: 600; }
.tile-fig span { font-size: 13px; color: var(--muted); }
.tile-note { font-size: 13px; color: var(--muted); }
.tile-go { margin-top: 10px; font-weight: 600; color: var(--mc); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .tile-go { filter: brightness(1.7); }
}
:root[data-theme="dark"] .tile-go { filter: brightness(1.7); }
.start-pc { margin-top: 28px; color: var(--ink-2); font-size: 14px; }

/* selettore del modulo */
.modswitch-wrap { position: relative; }
.modswitch {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 6px 8px; border: 1px solid transparent; border-radius: var(--r-md);
  background: transparent; cursor: pointer; text-align: left; color: var(--ink);
}
.modswitch:hover, .modswitch[aria-expanded="true"] { background: var(--surface-2); border-color: var(--line); }
.mod-ico { width: 38px; height: 38px; border-radius: 10px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; flex: none; }
.mod-ico svg { width: 24px; height: 24px; }
.mod-txt { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.mod-txt strong { font-size: 18px; line-height: 1.15; }
.mod-txt span { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chev { width: 18px; height: 18px; color: var(--muted); flex: none; }
.modmenu {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 230px;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-md); padding: 6px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .14);
}
.modmenu-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px; border: 0; border-radius: 8px; background: transparent; cursor: pointer; text-align: left; color: var(--ink); }
.modmenu-item:hover, .modmenu-item:focus-visible { background: var(--surface-2); }
.modmenu-item.on { background: var(--accent-soft); }
.modmenu-item .mod-ico { width: 32px; height: 32px; background: var(--mc); color: #fff; }
.modmenu-item .mod-ico svg { width: 20px; height: 20px; }
.modmenu-item .mod-txt strong { font-size: 15px; }
.modmenu-home { justify-content: center; color: var(--ink-2); font-weight: 500; border-top: 1px solid var(--line); border-radius: 0 0 8px 8px; margin-top: 4px; padding-top: 10px; }

/* pezzi comuni */
.banner { padding: 10px 14px; border-radius: var(--r-md); background: var(--accent-soft); color: var(--ink); font-size: 14px; margin-bottom: 18px; }
.empty-state { text-align: left; padding: 32px; }
.empty-state h2 { font-size: 22px; margin-bottom: 6px; }
.empty-state p { color: var(--ink-2); margin-bottom: 18px; max-width: 60ch; }
.form-inline { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; }
.form-inline label { display: grid; gap: 5px; font-size: 14px; font-weight: 500; color: var(--ink-2); }
.form-inline input { height: 40px; padding: 0 11px; border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: var(--surface); min-width: 200px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink-2); cursor: pointer; }
.dlg .check { display: flex; grid-template-columns: none; font-weight: 400; color: var(--ink); }
.check input { width: 18px; height: 18px; accent-color: var(--accent); margin: 0; }
.dlg .check input { width: 18px; height: 18px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.dlg textarea { padding: 9px 11px; border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: var(--surface); color: var(--ink); font: inherit; resize: vertical; }
.dlg-wide { width: min(1040px, calc(100vw - 24px)); }
.readout { display: grid; gap: 5px; font-size: 14px; color: var(--ink-2); font-weight: 500; }
.readout b { font-size: 22px; color: var(--ink); line-height: 42px; }
.tag-link { background: var(--accent-soft); border-color: transparent; color: var(--ink); margin-left: 6px; }
.tag-warn { background: color-mix(in srgb, #fab219 25%, transparent); border-color: #d99a12; color: var(--ink); font-weight: 600; }
.linklike { border: 0; background: none; padding: 0; color: var(--accent); text-decoration: underline; cursor: pointer; font: inherit; }
td small.sub { display: block; color: var(--muted); font-size: 12px; }
tr.muted-row td { color: var(--muted); }
.h3, .jside h3 { font-size: 15px; margin: 6px 0 2px; }
.dl.click { cursor: pointer; }
.dl.click:hover { background: var(--surface-2); }
.edit-table tr.linked td { color: var(--muted); padding: 10px 8px; font-size: 14px; }
.edit-table td.ro.r { text-align: right; }

/* ---------------------------------------------------------------- Workshop: banco lavori */
.board { display: grid; gap: 14px; overflow-x: auto; padding-bottom: 8px; align-items: start; }
.bcol { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 12px; min-height: 240px; transition: background .12s, border-color .12s; }
.bcol.over { background: var(--accent-soft); border-color: var(--accent); }
.bcol-head { display: grid; grid-template-columns: 1fr auto; gap: 0 8px; padding: 2px 4px 10px; }
.bcol-head h2 { font-size: 15px; }
.bcol-n { font-size: 13px; font-weight: 600; color: var(--ink-2); background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 0 8px; height: 22px; line-height: 20px; }
.bcol-head p { grid-column: 1 / -1; font-size: 13px; color: var(--muted); }
.bcol-list { display: grid; gap: 10px; }
.jcard { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 12px 10px; cursor: grab; position: relative; }
.jcard:hover { border-color: var(--line-strong); }
.jcard:focus-visible { outline: 2px solid var(--accent); }
.jcard.dragging { opacity: .45; }
.jcard.late { box-shadow: inset 3px 0 0 var(--danger); }
.jcard-top { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); }
.jprice { font-weight: 600; color: var(--ink); }
.jcard h3 { font-size: 15px; font-weight: 600; line-height: 1.3; margin: 4px 0 2px; }
.jcli { font-size: 13px; color: var(--ink-2); }
.jdate { font-size: 13px; color: var(--ink-2); margin-top: 6px; }
.jdate.late { color: var(--danger); font-weight: 600; }
.jpay { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 12.5px; color: var(--muted); }
.jpay-bar { flex: 1; height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.jpay-bar i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.jnext { margin-top: 8px; border: 1px solid var(--line); background: transparent; border-radius: 7px; padding: 3px 9px; font-size: 12.5px; color: var(--ink-2); cursor: pointer; }
.jnext:hover { border-color: var(--accent); color: var(--ink); background: var(--accent-soft); }
.bcol-add { border: 1px dashed var(--line-strong); background: transparent; border-radius: 10px; padding: 10px; color: var(--ink-2); cursor: pointer; font-weight: 500; }
.bcol-add:hover { border-color: var(--accent); color: var(--ink); }

/* scheda del lavoro */
.jdetail { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 24px; }
.jside { border-left: 1px solid var(--line); padding-left: 24px; display: grid; gap: 8px; align-content: start; }
.jconti { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; margin: 0 0 8px; padding: 12px 14px; background: var(--surface-2); border-radius: var(--r-md); font-size: 14px; }
.jconti dt { color: var(--ink-2); }
.jconti dd { margin: 0; text-align: right; }
.jconti .tot { font-weight: 700; color: var(--ink); border-top: 1px solid var(--line-strong); padding-top: 4px; }
.jconti dd.neg { color: var(--danger); }
.jhint { font-size: 12.5px; color: var(--muted); margin-top: -4px; }
.jlist { list-style: none; margin: 0; padding: 0; display: grid; }
.jlist li { display: grid; grid-template-columns: minmax(0, 1fr) auto 30px; gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.jlist li.click { grid-template-columns: minmax(0, 1fr) auto; cursor: pointer; }
.jlist li.click:hover { background: var(--surface-2); }
.jl-t small { display: block; color: var(--muted); font-size: 12.5px; }
.jl-v { font-weight: 600; white-space: nowrap; }
.jadd { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin: 6px 0 10px; }
.dlg .jadd input, .dlg .jadd select { height: 34px; width: auto; flex: 1 1 110px; min-width: 0; font-size: 14px; }
.dlg .jadd input.w-s { flex: 0 1 70px; }
.dlg .jadd input.w-m { flex: 0 1 90px; }
.dlg .jadd input[type="date"] { flex: 0 1 140px; }

/* ---------------------------------------------------------------- Shop: cassa */
.pos { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 20px; align-items: start; }
.pos-top { margin-bottom: 12px; }
.pos-search { width: 100%; height: 54px; padding: 0 18px; font-size: 18px; border: 2px solid var(--line-strong); border-radius: 14px; background: var(--surface); color: var(--ink); }
.pos-search:focus { outline: none; border-color: var(--accent); }
.pos-cats { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.pos-cats button { border: 1px solid var(--line-strong); background: var(--surface); border-radius: 999px; padding: 6px 14px; cursor: pointer; font-weight: 500; color: var(--ink-2); }
.pos-cats button.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.pos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.pos-item { display: flex; flex-direction: column; justify-content: space-between; gap: 10px; min-height: 96px; padding: 12px; text-align: left;
  border: 1px solid var(--line); border-radius: 12px; background: var(--surface); cursor: pointer; color: var(--ink); }
.pos-item:hover { border-color: var(--accent); background: var(--accent-soft); }
.pos-item:active { transform: scale(.98); }
.pos-item.out { opacity: .55; }
.pos-name { font-weight: 600; font-size: 14.5px; line-height: 1.25; }
.pos-meta { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; font-size: 13px; color: var(--muted); }
.pos-meta b { font-size: 16px; color: var(--ink); }
.pos-low { color: var(--danger); font-weight: 600; }
.pos-receipt { position: sticky; top: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px; display: grid; gap: 12px; }
.pos-r-head { display: flex; justify-content: space-between; align-items: center; }
.pos-r-head h2 { font-size: 18px; }
.pos-empty { color: var(--muted); font-size: 14px; padding: 24px 0; text-align: center; border: 1px dashed var(--line-strong); border-radius: 12px; }
.pos-lines { list-style: none; margin: 0; padding: 0; max-height: 42vh; overflow: auto; }
.pos-lines li { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.pl-qty { display: inline-flex; align-items: center; gap: 4px; }
.pl-qty button { width: 28px; height: 28px; border-radius: 7px; border: 1px solid var(--line-strong); background: var(--surface); cursor: pointer; font-size: 16px; line-height: 1; color: var(--ink); }
.pl-qty span { min-width: 24px; text-align: center; font-weight: 600; }
.pl-price { font-weight: 600; min-width: 74px; text-align: right; }
.pos-sum { display: grid; gap: 6px; font-size: 14px; }
.pos-sum > div, .pos-sum > label { display: flex; justify-content: space-between; align-items: center; gap: 10px; color: var(--ink-2); }
.pos-sum input { width: 100px; height: 34px; padding: 0 8px; text-align: right; border: 1px solid var(--line-strong); border-radius: 7px; background: var(--surface); color: var(--ink); }
.pos-total { padding-top: 8px; border-top: 1px solid var(--line-strong); color: var(--ink) !important; }
.pos-total b { font-size: 30px; letter-spacing: -0.02em; }
.pos-pay { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.pos-pay button { height: 40px; border-radius: 9px; border: 1px solid var(--line-strong); background: var(--surface); cursor: pointer; font-weight: 600; color: var(--ink-2); }
.pos-pay button.on { background: var(--accent-soft); border-color: var(--accent); color: var(--ink); box-shadow: inset 0 0 0 1px var(--accent); }
.pos-cash { display: grid; grid-template-columns: 1fr 100px; gap: 6px 10px; align-items: center; font-size: 14px; color: var(--ink-2); }
.pos-cash input { height: 36px; padding: 0 8px; text-align: right; border: 1px solid var(--line-strong); border-radius: 7px; background: var(--surface); color: var(--ink); }
.pos-cash b { grid-column: 1 / -1; font-size: 17px; color: var(--ink); }
.pos-cash b.neg { color: var(--danger); }
.pos-close { height: 58px; font-size: 17px; border-radius: 12px; }
.pos-hint { font-size: 12.5px; color: var(--muted); text-align: center; margin-top: -6px; }
.pos-last { font-size: 13px; color: var(--ink-2); border-top: 1px solid var(--line); padding-top: 10px; }

/* vendite per giorno */
.day { padding: 0; overflow: hidden; }
.day-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 16px; padding: 14px 20px; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.day-head h2 { font-size: 16px; text-transform: none; }
.day-head p { color: var(--ink-2); font-size: 13.5px; flex: 1; }
.day-head b { font-size: 17px; }
.day td { padding: 9px 20px; }
.heat-ore .cell { height: 30px; font-size: 11px; }

@media (max-width: 1100px) {
  .pos { grid-template-columns: 1fr; }
  .pos-receipt { position: static; }
  .jdetail { grid-template-columns: 1fr; }
  .jside { border-left: 0; padding-left: 0; border-top: 1px solid var(--line); padding-top: 16px; }
}
@media (max-width: 900px) {
  .tiles { grid-template-columns: 1fr; }
  .start-body { padding-top: 32px; }
}
@media (max-width: 820px) {
  .modswitch-wrap { flex: 1; min-width: 0; }
  .modswitch { padding: 4px; }
  .mod-txt span { display: none; }
  .modmenu { right: auto; width: min(320px, calc(100vw - 32px)); }
  .grid3 { grid-template-columns: 1fr 1fr; }
  .board { grid-auto-flow: column; grid-template-columns: none !important; grid-auto-columns: minmax(250px, 82vw); scroll-snap-type: x mandatory; }
  .bcol { scroll-snap-align: start; }
  .heat-ore .cell { font-size: 0; height: 24px; }
}

/* rifiniture */
.rail { background: color-mix(in srgb, var(--accent-soft) 45%, var(--page)); }
.dl-late .dl-when { color: var(--danger); }
.start-body h1 { max-width: 30ch; }
.tile-ws { display: flex; flex-direction: column; min-height: 2.9em; }
.tile-ws b { font-weight: 600; color: var(--ink); }
.tile-ws span { padding: 0 !important; color: var(--ink-2); font-size: 14px; }
.tile-spark { display: block; margin-top: 6px; }
.tile-spark svg { display: block; width: 100%; height: 46px; overflow: visible; }
.tile-spark small { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
.spark-area { fill: var(--mc); opacity: .10; }
.spark-line { fill: none; stroke: var(--mc); stroke-width: 2; vector-effect: non-scaling-stroke; stroke-linejoin: round; stroke-linecap: round; }
.spark-dot { fill: var(--mc); stroke: var(--surface); stroke-width: 2; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .spark-line, :root:not([data-theme="light"]) .spark-dot { filter: brightness(1.8); }
}
:root[data-theme="dark"] .spark-line, :root[data-theme="dark"] .spark-dot { filter: brightness(1.8); }
.stack { align-content: start; }
.jdetail { align-items: start; }
.dlg label { align-content: start; }
.view { min-width: 0; }
.shell > * { min-width: 0; }
@media (max-width: 820px) { .start-sub { font-size: 14px; } }

.pos-mbar { display: none; }
@media (max-width: 1100px) {
  .pos-mbar {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 25; padding: 10px 10px 10px 16px;
    background: var(--surface); border: 1px solid var(--line-strong); border-radius: 14px; box-shadow: 0 8px 24px rgba(0,0,0,.16);
  }
  .pos-mbar b { font-size: 18px; }
  #app[data-page="cassa"] .fab { display: none !important; }
  .pos { padding-bottom: 70px; }
}
.chev { margin-left: 4px; }

/* ------------------------------------------------------------------ alloggi */
.unitsel label { display: grid; gap: 6px; padding: 0 4px; }
.unitsel span { font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.unitsel select {
  height: 40px; padding: 0 10px; border-radius: var(--r-sm); border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--ink); font: inherit; font-weight: 500; width: 100%;
}
.hbar-v { min-width: 76px; }
@media (max-width: 820px) {
  .unitsel { order: 2; flex: 1 1 100%; }
  .unitsel label { grid-template-columns: auto minmax(0, 1fr); align-items: center; padding: 0 0 8px; }
  .unitsel select { height: 36px; }
}

/* ------------------------------------------------------------------ calendario */
.cal-panel { --cal-label: 150px; --cal-occ: 58px; }
.cal-nav { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.cal-nav .cal-title { font-size: 19px; min-width: 150px; text-align: center; text-transform: capitalize; }
.cal-nav .btn-sm[aria-label] { width: 34px; padding: 0; font-size: 20px; line-height: 1; }
.cal-nav .legend { margin: 0; }
.cal-wrap { overflow-x: auto; margin: 0 -4px; padding: 0 4px 4px; }
.cal { min-width: 760px; display: grid; gap: 6px; }
.cal-row { display: grid; align-items: center; column-gap: 0; position: relative; }
.cal-head { font-size: 12px; color: var(--muted); text-align: center; }
.cal-day { line-height: 1.15; padding: 2px 0; border-radius: 6px; font-weight: 500; color: var(--ink-2); }
.cal-day small { display: block; font-size: 10.5px; color: var(--muted); text-transform: uppercase; }
.cal-day.we { color: var(--muted); }
.cal-day.today { background: var(--accent); color: #fff; }
.cal-day.today small { color: inherit; opacity: .85; }
.cal-label { font-weight: 600; font-size: 14px; padding-right: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; grid-column: 1; grid-row: 1; }
.cal-cell { height: 38px; border-left: 1px solid var(--line); background: var(--surface-2); }
.cal-cell.we { background: color-mix(in srgb, var(--surface-2) 55%, var(--line)); }
.cal-cell.today { background: var(--accent-soft); box-shadow: inset 2px 0 0 var(--accent); }
.cal-occ { text-align: right; font-size: 13px; color: var(--ink-2); }
.cal-row:not(.cal-head) .cal-occ b { font-weight: 600; color: var(--ink); }
/* una barra copre le notti: dal giorno di arrivo al giorno prima della partenza */
.cal-bar {
  position: relative; z-index: 1; height: 28px; margin: 0 2px; min-width: 0;
  border: 0; border-radius: 7px; padding: 0 8px; cursor: pointer; text-align: left;
  font: inherit; font-size: 12.5px; font-weight: 600; color: #fff; overflow: hidden;
  background: var(--c-altro); box-shadow: 0 0 0 2px var(--surface);
}
.cal-bar span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-bar.f-airbnb { background: var(--c-airbnb); }
.cal-bar.f-booking { background: var(--c-booking); }
.cal-bar.cont-l { margin-left: 0; border-top-left-radius: 0; border-bottom-left-radius: 0; }
.cal-bar.cont-r { margin-right: 0; border-top-right-radius: 0; border-bottom-right-radius: 0; }
.cal-bar.blocked {
  color: var(--ink-2);
  background: repeating-linear-gradient(135deg, var(--surface) 0 5px, color-mix(in srgb, var(--c-altro) 35%, var(--surface)) 5px 10px);
  box-shadow: inset 0 0 0 1px var(--line-strong), 0 0 0 2px var(--surface);
}
.cal-bar:hover { filter: brightness(1.06); }
.cal-bar:focus-visible { outline: 3px solid var(--ink); outline-offset: 1px; }
@media (max-width: 820px) {
  .cal-panel { --cal-label: 104px; --cal-occ: 48px; }
}

/* ------------------------------------------------------------------ settori */
.sett-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.sett-card {
  display: grid; gap: 6px; align-content: start; text-align: left; padding: 16px; cursor: pointer;
  border: 1px solid var(--line-strong); border-radius: var(--r-md); background: var(--surface); color: var(--ink); font: inherit;
}
.sett-card:hover { border-color: var(--accent); }
.sett-card.on { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.sett-card strong { font-size: 17px; }
.sett-card > span:last-child { font-size: 13.5px; color: var(--ink-2); line-height: 1.4; }
.sett-ico { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); }
.sett-ico svg { width: 26px; height: 26px; }
.sett-ico-s { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; background: var(--accent); color: var(--accent-ink); margin-right: 8px; vertical-align: -5px; }
.sett-ico-s svg { width: 15px; height: 15px; }
.tile-sett { display: inline-block; margin-left: 10px; padding: 2px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; letter-spacing: 0; vertical-align: 6px; background: var(--tile-soft, var(--surface-2)); color: var(--ink); border: 1px solid var(--line); }

.settore-box { border: 1px solid var(--line); border-radius: var(--r-md); padding: 10px 14px 14px; margin: 0; display: grid; gap: 12px; background: color-mix(in srgb, var(--accent-soft) 45%, transparent); min-width: 0; }
.settore-box legend { font-size: 13px; font-weight: 600; color: var(--ink); padding: 0 6px; }
.richiamo-row { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: end; }
.richiamo-row > label { flex: 1 1 200px; }
.quick { display: flex; gap: 4px; flex-wrap: wrap; padding-bottom: 3px; }
.dlg .check-field { align-self: end; padding-bottom: 10px; }

.jtags { display: flex; flex-wrap: wrap; gap: 4px; margin: 6px 0 2px; }
.jtag { font-size: 11.5px; padding: 1px 7px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2); white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.jtag.urg { background: var(--danger); border-color: var(--danger); color: #fff; font-weight: 600; }
.jtag.warn { background: color-mix(in srgb, #fab219 25%, transparent); border-color: #d99a12; color: var(--ink); font-weight: 600; }
.jcons { display: flex; gap: 10px; align-items: center; justify-content: space-between; padding: 10px 12px; border: 1px dashed var(--line-strong); border-radius: var(--r-md); }
.jcons b { display: block; font-size: 15px; }
.jcons small { display: block; color: var(--muted); font-size: 12.5px; }
.jtools { display: flex; flex-wrap: wrap; gap: 6px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 6px; }
.chip {
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); border-radius: 999px;
  padding: 4px 11px; font: inherit; font-size: 13px; cursor: pointer; text-align: left; line-height: 1.25;
}
.chip:hover { border-color: var(--accent); }
.chip.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.chip small { display: block; font-size: 11.5px; opacity: .8; }
.svc-chips .chip { border-radius: 10px; padding: 6px 11px; }
.lbl { display: block; font-size: 14px; font-weight: 500; color: var(--ink-2); margin-bottom: 4px; }
.scheda-hint { margin: -4px 0 0; padding: 8px 10px; border-radius: var(--r-sm); background: var(--accent-soft); color: var(--ink); }
.scheda-hint:empty { display: none; }
.tag-late { background: var(--danger); border-color: var(--danger); color: #fff; font-weight: 600; }
td .sub { display: block; font-size: 12.5px; color: var(--muted); text-decoration: none; }
td a.sub:hover { text-decoration: underline; }

.figrow-mini { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); margin-bottom: 20px; overflow: hidden; }
.figrow-mini .fig { border-bottom: 0; border-right: 1px solid var(--line); padding: 14px 18px; }
.figrow-mini .fig:last-child { border-right: 0; }
.figrow-mini .fig-value { font-size: 22px; }

/* ------------------------------------------------------------------ agenda appuntamenti */
.ag-tools { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.ag-tools input[type="date"] { height: 40px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: var(--surface); color: var(--ink); font: inherit; }
.ag-week { display: grid; grid-template-columns: 34px repeat(7, minmax(0, 1fr)) 34px; gap: 6px; margin-bottom: 16px; }
.ag-wnav { border: 0; background: none; font-size: 22px; color: var(--ink-2); cursor: pointer; border-radius: var(--r-sm); }
.ag-wnav:hover { background: var(--surface-2); }
.ag-day {
  display: grid; justify-items: center; gap: 0; padding: 7px 4px; border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--surface); color: var(--ink); cursor: pointer; font: inherit;
}
.ag-day small { font-size: 11.5px; text-transform: uppercase; color: var(--muted); }
.ag-day b { font-size: 18px; line-height: 1.2; }
.ag-day span { font-size: 12px; color: var(--ink-2); }
.ag-day.today b { color: var(--accent); }
.ag-day.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.ag-day.on small, .ag-day.on span, .ag-day.on b { color: inherit; }
.ag-panel { padding: 14px 14px 12px; }
.ag-grid { display: grid; gap: 0 8px; overflow-x: auto; }
.ag-colwrap { min-width: 0; }
.ag-head { height: 30px; font-weight: 600; font-size: 14px; display: flex; align-items: center; justify-content: center; border-bottom: 1px solid var(--line-strong); margin-bottom: 0; }
.ag-times { position: relative; }
.ag-time { font-size: 11.5px; color: var(--muted); text-align: right; padding-right: 6px; transform: translateY(-7px); }
.ag-col { position: relative; background: var(--surface-2); border-radius: 0 0 var(--r-sm) var(--r-sm); }
.ag-slot { position: absolute; left: 0; right: 0; border: 0; border-top: 1px dotted var(--line); background: transparent; cursor: pointer; padding: 0; }
.ag-slot.h { border-top: 1px solid var(--line-strong); }
.ag-slot:hover { background: var(--accent-soft); }
.ag-slot:hover::after { content: '+'; position: absolute; left: 8px; top: 0; font-size: 14px; line-height: 18px; color: var(--accent); font-weight: 700; }
.ag-app {
  position: absolute; left: 3px; right: 3px; z-index: 2; overflow: hidden; text-align: left; cursor: pointer; font: inherit;
  padding: 3px 8px; border: 0; border-left: 4px solid var(--accent); border-radius: 6px;
  background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgb(0 0 0 / 0.12), 0 0 0 1px var(--line);
}
.ag-app:hover { box-shadow: 0 2px 6px rgb(0 0 0 / 0.16), 0 0 0 1px var(--accent); }
.ag-app-t { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ag-app-s { display: block; font-size: 12px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ag-app-ok { position: absolute; right: 6px; top: 3px; font-size: 12px; font-weight: 700; color: var(--accent); }
.ag-app.st-fatto { background: var(--accent-soft); border-left-color: var(--accent); }
.ag-app.st-non-venuto { background: transparent; border-left-color: var(--muted); color: var(--muted); box-shadow: 0 0 0 1px var(--line) inset; }
.ag-app.st-non-venuto .ag-app-t { text-decoration: line-through; }
.ag-now { position: absolute; left: -4px; right: 0; height: 2px; background: var(--danger); z-index: 3; pointer-events: none; }
.ag-now::before { content: ''; position: absolute; left: -3px; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--danger); }

/* cassa dei saloni */
.pos-cli { display: grid; gap: 8px; padding: 10px 0 12px; border-bottom: 1px solid var(--line); margin-bottom: 8px; }
.pos-cli label { display: grid; grid-template-columns: 82px minmax(0, 1fr); align-items: center; gap: 8px; font-size: 14px; color: var(--ink-2); }
.pos-cli input, .pos-cli select { height: 36px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: var(--surface); color: var(--ink); font: inherit; min-width: 0; }
.pos-app { margin: 0; padding: 7px 10px; border-radius: var(--r-sm); background: var(--accent-soft); font-size: 13.5px; display: flex; justify-content: space-between; gap: 8px; }
.pos-item.svc { border-left: 4px solid var(--accent); }
.v-cli { display: block; color: var(--ink); font-weight: 600; }

@media (max-width: 820px) {
  .ag-week { grid-template-columns: repeat(7, minmax(0, 1fr)); }
  .ag-wnav { display: none; }
  .ag-day b { font-size: 16px; }
  .ag-day span { font-size: 10.5px; }
  .jcons { flex-wrap: wrap; }
}

/* ------------------------------------------------------------------ stampa di preventivi e rapportini */
.print-area { display: none; }
@media print {
  body.stampa > *:not(#print-area) { display: none !important; }
  body.stampa { background: #fff; color: #000; }
  body.stampa .print-area { display: block; font-size: 11pt; color: #000; padding: 0; }
}
.print-area h1 { font-size: 20pt; margin: 0; }
.print-area h2 { font-size: 15pt; margin: 0; }
.print-area h3 { font-size: 11pt; margin: 14pt 0 4pt; text-transform: uppercase; letter-spacing: .04em; }
.pr-head { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 2px solid #000; padding-bottom: 10pt; margin-bottom: 12pt; }
.pr-head p { margin: 2pt 0 0; }
.pr-doc { text-align: right; }
.pr-kv, .pr-tab { width: 100%; border-collapse: collapse; }
.pr-kv th { text-align: left; width: 32%; font-weight: 600; padding: 3pt 8pt 3pt 0; vertical-align: top; }
.pr-kv td { padding: 3pt 0; }
.pr-tab th, .pr-tab td { border-bottom: 1px solid #999; padding: 4pt 6pt 4pt 0; text-align: left; }
.pr-tab .n { text-align: right; }
.pr-text { white-space: pre-wrap; margin: 0; }
.pr-tot { margin: 16pt 0 0 auto; width: 55%; border-top: 2px solid #000; }
.pr-tot div { display: flex; justify-content: space-between; padding: 4pt 0; border-bottom: 1px solid #bbb; }
.pr-note { margin: 10pt 0 0; font-size: 10pt; }
.pr-firme { display: flex; gap: 40pt; margin-top: 46pt; }
.pr-firme div { flex: 1; border-top: 1px solid #000; padding-top: 4pt; font-size: 10pt; }

/* SmallGest */
.start-brand { display: inline-flex; align-items: center; gap: 10px; }
.sg-logo { width: 28px; height: 28px; flex: none; }
textarea.cmd { width: 100%; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; line-height: 1.45; padding: 10px 12px; border-radius: var(--r-sm); border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--ink); white-space: pre; overflow: auto; resize: vertical; }

/* accesso di un cliente: un solo modulo, niente menu di cambio */
.single .modswitch .chev { display: none; }
.single .modswitch { cursor: default; }

/* collegamento con Airbnb e Booking */
.link-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); align-items: start; }
.link-card { border: 1px solid var(--line); border-radius: var(--r-md); padding: 16px 18px; background: var(--surface); display: grid; gap: 10px; }
.link-card h3 { font-size: 16px; display: flex; align-items: center; gap: 10px; }
.link-n { width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: inline-grid; place-items: center; font-size: 14px; flex: none; }
.link-rows { display: grid; gap: 8px; }
.link-row { display: grid; grid-template-columns: 1fr auto auto auto; gap: 8px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); }
.link-row:first-child { border-top: 0; }
.link-name { display: grid; min-width: 0; }
.link-name small { color: var(--muted); font-size: 12.5px; }
.link-chip { font-size: 12.5px; padding: 2px 8px; border-radius: 999px; border: 1px dashed var(--line-strong); color: var(--muted); white-space: nowrap; }
.link-chip.on { border-style: solid; border-color: transparent; background: var(--accent-soft); color: var(--ink); font-weight: 600; }
.link-steps { margin: 8px 0 0 18px; display: grid; gap: 4px; font-size: 14px; color: var(--ink-2); }
.imp-head { display: flex; gap: 16px; align-items: flex-end; flex-wrap: wrap; }
.imp-head > label { display: grid; gap: 5px; font-size: 14px; font-weight: 500; color: var(--ink-2); }
.imp-figs { display: flex; gap: 8px; flex-wrap: wrap; flex: 1; }
.imp-fig { border: 1px solid var(--line); border-radius: var(--r-sm); padding: 6px 10px; display: grid; min-width: 92px; }
.imp-fig b { font-size: 18px; font-variant-numeric: tabular-nums; }
.imp-fig span { font-size: 12.5px; color: var(--ink-2); }
.imp-fig.hl { border-color: var(--accent); background: var(--accent-soft); }
.imp-avvisi { margin: 0 0 0 18px; font-size: 14px; color: var(--ink-2); }
.imp-cols { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); margin-top: 8px; }
.imp-tab { max-height: 320px; }
@media (max-width: 560px) { .link-row { grid-template-columns: 1fr auto auto; } .link-row .btn { grid-column: 1 / -1; } }
.pr-page { break-after: page; page-break-after: always; }
.pr-page:last-child { break-after: auto; page-break-after: auto; }
.pr-urg { font-weight: 800; border: 2px solid #000; display: inline-block; padding: 1pt 6pt; margin-top: 4pt !important; }
.pr-blank td { height: 20pt; }
.pr-lines div { border-bottom: 1px solid #999; height: 22pt; }
.pr-report { font-size: 9.5pt; }
.pr-report th { border-bottom: 1.5px solid #000; }
@media print { body.stampa .print-area .pr-report tr { break-inside: avoid; } }
.cal-bar.f-manuale { background: var(--c-privato); }
.cal-add { cursor: pointer; }
.cal-add:hover { background: var(--accent-soft); }
.login-prova { margin-top: 6px; display: grid; gap: 6px; padding: 14px 16px; border-radius: var(--r-md); background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent); font-size: 14px; color: var(--ink-2); }
.login-prova strong { color: var(--ink); font-size: 15px; }
.login-prova .btn { justify-self: start; }
.login-prova[hidden] { display: none; }

/* ================================================================== finitura satinata (come il sito smallgest.com)
   Neutri ardesia e alluminio, superfici con un velo di luce, colori dei moduli come metalli satinati,
   titoli in Archivo espanso e leggero. Livello finale: i colori dei moduli restano quelli di sempre. */
@font-face { font-family: "Archivo"; src: url("fonts/archivo-var.woff2") format("woff2"); font-weight: 100 900; font-stretch: 62% 125%; font-display: swap; }
:root {
  --page: #e8eaeb; --surface: #fbfbfa; --surface-2: #f2f3f3; --ink: #1c2226; --ink-2: #4b5459; --muted: #6e777c;
  --line: #dcdfe0; --line-strong: #c2c7c9;
  --ardesia: #1c2226; --ardesia-2: #283035; --champagne: #dccfae;
  --hl: rgb(255 255 255 / .85); --velo: 0 1px 2px rgb(28 34 38 / .05), 0 22px 44px -34px rgb(28 34 38 / .45);
  --display: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --grana: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .07 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --page: #14181b; --surface: #1c2226; --surface-2: #222a2e; --ink: #eceeee; --ink-2: #c3c9cc; --muted: #8f989d; --line: #2d353a; --line-strong: #3c464c; --hl: rgb(255 255 255 / .05); --velo: 0 1px 2px rgb(0 0 0 / .3), 0 22px 44px -30px rgb(0 0 0 / .8); }
}
:root[data-theme="dark"] { --page: #14181b; --surface: #1c2226; --surface-2: #222a2e; --ink: #eceeee; --ink-2: #c3c9cc; --muted: #8f989d; --line: #2d353a; --line-strong: #3c464c; --hl: rgb(255 255 255 / .05); --velo: 0 1px 2px rgb(0 0 0 / .3), 0 22px 44px -30px rgb(0 0 0 / .8); }
[data-mod="hospitality"] { --mc-l: #a7d0bc; } [data-mod="workshop"] { --mc-l: #e6bf8c; } [data-mod="shop"] { --mc-l: #cbb6ec; }

body { background: radial-gradient(1200px 600px at 90% -10%, color-mix(in srgb, var(--surface) 70%, transparent), transparent 60%), var(--page); background-attachment: fixed; }

/* titoli */
.page-head h1, .start-body h1, .login-box h1, .tile-name, .dlg h2, .brand strong, .fig-value, .tile-fig b {
  font-family: var(--display); font-stretch: 112%; letter-spacing: -.01em;
}
.page-head h1 { font-weight: 400; font-size: 32px; }
.start-body h1 { font-weight: 300; font-stretch: 118%; font-size: clamp(30px, 4.4vw, 48px); }
.tile-name { font-weight: 400; font-stretch: 116%; }
.fig-value, .tile-fig b { font-weight: 500; }
.dlg h2 { font-weight: 500; }

/* superfici satinate */
.panel, .figrow, .payback, .dlg, .tile, .login-box {
  background: linear-gradient(180deg, var(--surface), color-mix(in srgb, var(--surface) 55%, var(--surface-2)));
  border: 1px solid var(--line); border-radius: 20px; box-shadow: inset 0 1px 0 var(--hl), var(--velo);
}
.dlg { border-radius: 24px; }
.dlg::backdrop { background: rgb(20 24 27 / .5); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }

/* pulsanti */
.btn { border-radius: 999px; transition: background .2s, box-shadow .2s, transform .2s; }
.btn-primary {
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 78%, #fff) 0%, var(--accent) 55%, color-mix(in srgb, var(--accent) 86%, #000) 100%);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / .3), 0 10px 20px -12px var(--accent);
}
.btn-primary:hover { background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 70%, #fff), var(--accent) 60%, color-mix(in srgb, var(--accent) 80%, #000)); transform: translateY(-1px); }
.btn-outline { background: linear-gradient(180deg, var(--surface), var(--surface-2)); border-color: var(--line-strong); box-shadow: inset 0 1px 0 var(--hl); }

/* menu laterale */
.rail { background: linear-gradient(180deg, color-mix(in srgb, var(--surface) 60%, var(--page)), var(--page)); }
.nav a { border-radius: 10px; }
.nav a[aria-current="page"] { background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 16%, var(--surface)), transparent); box-shadow: inset 3px 0 0 var(--accent); }
.modswitch .mod-ico, #mod-ico { background: linear-gradient(145deg, var(--mc-l, var(--accent)), var(--accent)) !important; box-shadow: inset 0 1px 0 rgb(255 255 255 / .45); }
.fab { background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 78%, #fff), var(--accent) 55%, color-mix(in srgb, var(--accent) 86%, #000)); box-shadow: inset 0 1px 0 rgb(255 255 255 / .3), 0 18px 30px -14px var(--accent); }

/* accesso: ardesia satinata con il riflesso del sito */
.login { position: relative; isolation: isolate; overflow: hidden; background: var(--ardesia); }
.login::before { content: ""; position: absolute; inset: 0; z-index: -2;
  background: var(--grana), radial-gradient(800px 480px at 12% 0%, rgb(167 208 188 / .2), transparent 62%), radial-gradient(700px 520px at 88% 20%, rgb(203 182 236 / .17), transparent 62%),
    radial-gradient(760px 480px at 55% 110%, rgb(230 191 140 / .18), transparent 60%), linear-gradient(180deg, var(--ardesia-2), var(--ardesia)); }
.login::after { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: linear-gradient(112deg, transparent 38%, rgb(255 255 255 / .06) 47%, rgb(255 255 255 / .09) 50%, rgb(255 255 255 / .06) 53%, transparent 62%);
  background-size: 260% 100%; animation: sg-riflesso 16s ease-in-out infinite alternate; }
.login-box { border-radius: 26px; box-shadow: inset 0 1px 0 var(--hl), 0 50px 90px -40px rgb(0 0 0 / .8); animation: sg-entra .9s cubic-bezier(.2, .7, .2, 1) both; }
.login-box h1 { font-weight: 400; font-stretch: 120%; font-size: 30px; }
.login-marks span { border-radius: 12px; box-shadow: inset 0 1px 0 rgb(255 255 255 / .4), 0 8px 16px -10px rgb(0 0 0 / .6); }
.login-marks span:nth-child(1) { background: linear-gradient(145deg, #a7d0bc, #2d5a46); }
.login-marks span:nth-child(2) { background: linear-gradient(145deg, #e6bf8c, #86561a); }
.login-marks span:nth-child(3) { background: linear-gradient(145deg, #cbb6ec, #5b3f8c); }

/* schermata iniziale: barra in ardesia, schede satinate con il filo del colore del modulo */
.start-bar { background: linear-gradient(180deg, var(--ardesia-2), var(--ardesia)); color: #eceeee; border-bottom: 1px solid rgb(255 255 255 / .06); }
.start-bar .btn-ghost { color: rgb(236 238 238 / .72); }
.start-bar .btn-ghost:hover { background: rgb(255 255 255 / .08); color: #fff; }
.start-brand { font-family: var(--display); font-stretch: 120%; font-weight: 500; }
.tile { border-radius: 24px; transition: transform .3s cubic-bezier(.2, .7, .2, 1), box-shadow .3s; }
.tile::before { height: 3px; margin-bottom: 22px; background: linear-gradient(90deg, var(--mc), var(--mc-l, var(--mc)), var(--mc)); }
.tile:hover { transform: translateY(-3px); border-color: var(--line); box-shadow: inset 0 1px 0 var(--hl), 0 30px 50px -30px color-mix(in srgb, var(--mc) 70%, #000); }
.tile-ico { border-radius: 16px; background: linear-gradient(145deg, var(--mc-l, var(--mc)), var(--mc)); box-shadow: inset 0 1px 0 rgb(255 255 255 / .45), 0 12px 22px -12px var(--mc); }
.tile-go { color: var(--mc); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tile-go { color: var(--mc-l); } }
:root[data-theme="dark"] .tile-go { color: var(--mc-l); }

@keyframes sg-riflesso { from { background-position: 100% 0; } to { background-position: 0% 0; } }
@keyframes sg-entra { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .login::after, .login-box { animation: none; } .tile, .btn { transition: none; } }
@media print { body { background: #fff; } .panel, .figrow, .payback { box-shadow: none; background: #fff; } }
.cal-url-row { display: flex; gap: 8px; flex-wrap: wrap; }
.cal-url { flex: 1 1 320px; min-width: 0; height: 42px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--ink); font: 13px ui-monospace, Consolas, monospace; }
.pr-due { display: grid; grid-template-columns: 1fr 1fr; gap: 18pt; }
.pr-tab.pr-esito th { width: 40%; }
.login-reg { margin: 4px 0 0; font-size: 14px; color: var(--ink-2); text-align: center; }
.login-reg a { font-weight: 600; }

/* ================================================================== Casa e famiglia (gestione domestica): blu lago */
:root[data-mod="famiglia"] { --accent: #2f557f; --accent-hover: #244567; --accent-ink: #ffffff; --accent-soft: #e2eaf3; }
@media (prefers-color-scheme: dark) {
  :root[data-mod="famiglia"]:not([data-theme="light"]) { --accent: #93b6dc; --accent-hover: #aec8e6; --accent-ink: #0d1826; --accent-soft: #233244; }
}
:root[data-mod="famiglia"][data-theme="dark"] { --accent: #93b6dc; --accent-hover: #aec8e6; --accent-ink: #0d1826; --accent-soft: #233244; }
[data-mod="famiglia"] { --mc: #2f557f; --mc-soft: #e2eaf3; --mc-l: #a9c6e6; }
.login-marks span:nth-child(4) { background: linear-gradient(145deg, #a9c6e6, #2f557f); }

.dl.fam-dl { grid-template-columns: 116px minmax(0, 1fr) auto auto; align-items: center; }
.dl-done { opacity: .55; }
.dl-done .dl-what strong { text-decoration: line-through; }
.fam-chip { display: inline-flex; align-items: center; gap: 5px; margin-left: 8px; padding: 1px 8px 1px 6px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); font-size: 12px; font-weight: 500; color: var(--ink-2); vertical-align: 2px; }
.fam-chip i, .pill-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.pill-dot { margin-right: 6px; vertical-align: 1px; }
.tag-ok { background: color-mix(in srgb, #2e7d5b 16%, transparent); border-color: transparent; color: var(--ink); }
.tag-festa { background: color-mix(in srgb, #c07a1f 18%, transparent); border-color: transparent; color: var(--ink); }
.tag-salute { background: color-mix(in srgb, #b0486b 14%, transparent); border-color: transparent; }
.tag-scuola, .tag-sport { background: var(--accent-soft); border-color: transparent; }
.pills + .panel, .pills + section { margin-top: 18px; }

.bud { display: grid; gap: 14px; }
.bud-top { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; }
.bud-top span { color: var(--ink-2); font-variant-numeric: tabular-nums; }
.bud-track { position: relative; height: 8px; margin: 6px 0 4px; border-radius: 999px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); overflow: visible; }
.bud-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 60%, #fff)); }
.bud-oggi { position: absolute; top: -4px; width: 2px; height: 16px; margin-left: -1px; border-radius: 2px; background: var(--ink-2); opacity: .55; }
.bud-row small { color: var(--muted); font-size: 12.5px; }
.bud-row.warn .bud-fill { background: linear-gradient(90deg, #d99a12, #f2c14e); }
.bud-row.over .bud-fill { background: linear-gradient(90deg, var(--danger), color-mix(in srgb, var(--danger) 60%, #fff)); }
.bud-row.over small { color: var(--danger); font-weight: 600; }
.bud-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px 16px; }
.bud-grid label > span { display: flex; justify-content: space-between; gap: 6px; }
.bud-grid small { color: var(--muted); font-weight: 400; }

.spesa-add { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1.2fr) auto; gap: 10px; }
.spesa-cols { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; margin-top: 16px; align-items: start; }
.spesa-cols .panel { margin: 0; }
.spesa-rep h3 { margin: 0 0 8px; font-size: 13px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.spesa-list { list-style: none; margin: 0; padding: 0; }
.spesa-item { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.spesa-item:last-child { border-bottom: 0; }
.spesa-item label { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; cursor: pointer; }
.spesa-item input { width: 20px; height: 20px; accent-color: var(--accent); flex: none; }
.spesa-item small { color: var(--muted); }
.spesa-item.preso .spesa-voce { text-decoration: line-through; color: var(--muted); }
.spesa-presi { background: var(--accent-soft); }

.fam-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; margin-bottom: 18px; }
.fam-card { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 20px; text-align: left; border-radius: 22px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; font: inherit; box-shadow: inset 0 1px 0 var(--hl, transparent); transition: transform .25s cubic-bezier(.2, .7, .2, 1), box-shadow .25s; }
.fam-card:hover { transform: translateY(-2px); box-shadow: inset 0 1px 0 var(--hl, transparent), 0 24px 40px -28px color-mix(in srgb, var(--accent) 70%, #000); }
.fam-card strong { font-size: 18px; font-family: var(--display, inherit); font-weight: 500; }
.fam-av { width: 48px; height: 48px; margin-bottom: 8px; border-radius: 16px; display: grid; place-items: center; color: #fff; font-weight: 600; font-size: 20px; box-shadow: inset 0 1px 0 rgb(255 255 255 / .35), 0 10px 18px -10px rgb(0 0 0 / .5); }
.fam-av svg { width: 28px; height: 28px; }
.fam-figs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; margin-top: 10px; width: 100%; font-size: 12.5px; color: var(--muted); }
.fam-figs b { display: block; font-size: 15px; color: var(--ink); font-variant-numeric: tabular-nums; }
.fam-note { margin-top: 8px; color: var(--ink-2); font-size: 13px; }
@media (max-width: 640px) {
  .spesa-add { grid-template-columns: 1fr 1fr; }
  .spesa-add input[name="voce"] { grid-column: 1 / -1; }
  .dl.fam-dl { grid-template-columns: 84px minmax(0, 1fr) auto; }
  .dl.fam-dl .tag:not(.tag-ok) { display: none; }
}

/* dove stanno i dati e piano di backup */
.custodia { display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: 18px; align-items: start; background: linear-gradient(135deg, var(--accent-soft), var(--surface) 70%); }
.custodia h3 { margin: 0 0 6px; font-family: var(--display, inherit); font-weight: 500; font-size: 20px; }
.custodia p { margin: 0 0 6px; color: var(--ink-2); max-width: 72ch; }
.custodia-ico { width: 56px; height: 56px; border-radius: 18px; display: grid; place-items: center; color: #fff; background: linear-gradient(145deg, var(--mc-l, var(--accent)), var(--accent)); box-shadow: inset 0 1px 0 rgb(255 255 255 / .4), 0 12px 22px -12px var(--accent); }
.custodia-ico svg { width: 30px; height: 30px; }
.custodia-ok { color: var(--accent) !important; font-weight: 600; }
.custodia-no { color: var(--ink) !important; font-weight: 600; }
.piano-ok { margin: 0; padding: 10px 14px; border-radius: 14px; background: var(--accent-soft); font-weight: 600; }
.piano-riga { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.piano-ore { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.piano input[name="cartella"] { font-family: ui-monospace, Consolas, monospace; }
.sub-h { margin: 10px 0 0; font-size: 13px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.lista-punti { margin: 0; padding-left: 20px; display: grid; gap: 6px; color: var(--ink-2); }
@media (max-width: 640px) { .piano-riga, .piano-ore { grid-template-columns: 1fr; } .custodia { grid-template-columns: 1fr; } }
/* campi del piano di backup anche fuori dai dialoghi (pagina Dati) */
.spesa-add input, .spesa-add select { width: 100%; min-width: 0; height: 42px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: var(--surface); color: var(--ink); font: inherit; font-size: 15px; }
.spesa-add input:focus, .spesa-add select:focus { border-color: var(--accent); outline: 2px solid color-mix(in srgb, var(--accent) 25%, transparent); outline-offset: 0; }
.spesa-item small { white-space: nowrap; }
.piano label { display: grid; gap: 5px; font-size: 14px; font-weight: 500; color: var(--ink-2); align-content: start; }
.piano input, .piano select { width: 100%; height: 42px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: var(--surface); color: var(--ink); font: inherit; font-size: 15px; }
.piano input:focus, .piano select:focus { border-color: var(--accent); outline: 2px solid color-mix(in srgb, var(--accent) 25%, transparent); outline-offset: 0; }
.bud-row.nob .bud-top span { color: var(--muted); }

/* movimenti: filtri in due righe */
.filters-box { margin-bottom: 24px; }
.filters-box .filters { margin-bottom: 0; }
.filters-2 { margin-top: 12px; padding: 12px 14px; border-radius: 16px; background: var(--surface-2); border: 1px solid var(--line); }
.filters .btn.on { background: var(--accent-soft); color: var(--ink); }
.inp-euro { width: 92px; min-width: 0 !important; }

/* Hospitality: clienti */
.cli-table td strong { display: block; }
.cli-sub { display: block; color: var(--muted); font-size: 12.5px; }
.cli-azioni { display: inline-flex; gap: 8px; flex-wrap: wrap; }
.cli-nomi { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 6px 16px; max-height: 50vh; overflow: auto; padding: 4px 2px; }
.cli-nome { align-items: flex-start; }
.cli-nome span { display: grid; }
.cli-nome small { color: var(--muted); font-size: 12.5px; }
.totals .btn { margin-left: auto; }
.rail-foot .ver { display: block; padding: 6px 12px 0; font-size: 11.5px; color: var(--muted); }
@media (max-width: 820px) { .rail-foot .ver { display: none; } }
/* soggiorni nella scheda cliente */
.sogg-box { padding: 14px 16px; border-radius: 16px; background: var(--surface-2); border: 1px solid var(--line); }
.sogg-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.sogg-head .h3 { margin: 0; }
.sogg-list li.sogg-riga { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 12px; align-items: center; }
.sogg-riga.futuro .jl-t { color: var(--accent); }
.tot-di { color: var(--muted); font-size: 13px; }
