@font-face {
  font-family: 'Schibsted Grotesk';
  src: url('fonts/schibsted-grotesk.woff') format('woff');
  font-weight: 400 900;
  font-display: swap;
}

:root {
  /* Palette ispirata ad Airbnb: bianco, testo quasi nero, corallo come unico colore d'accento */
  --brand-font: 'Helvetica Neue', Arial, 'Segoe UI', sans-serif;  /* scritta INKASA, come sul sito */
  --brand-mono: 'Courier New', Courier, monospace;
  --ink: #222222;          /* testo principale */
  --ink-2: #3a3a3a;
  --paper: #f7f7f7;        /* sfondo */
  --surface: #ffffff;
  --line: #ebebeb;
  --line-strong: #dddddd;
  --muted: #6a6a6a;
  --faint: #929292;
  --accent: #ff385c;       /* corallo: selezione, pulsanti principali, totali importanti */
  --accent-soft: #fff0f3;
  --danger: #c13515;
  --danger-soft: #fdecea;
  --ok: #008a05;
  --ok-soft: #e6f4e7;
  --warn: #b4580a;
  --warn-soft: #fff4e5;
  /* barra laterale / intestazione */
  --side-bg: #ffffff;
  --side-text: #484848;
  --side-strong: #222222;
  --side-muted: #929292;
  --side-hover: #f7f7f7;
  --side-active: #fff0f3;
  --side-border: #ebebeb;
  --primary: #ff385c;
  --primary-hover: #e31c5f;

  /* fasi lead */
  --st-da_contattare: #2f5fb3;      --st-da_contattare-bg: #eaf1fb;
  --st-da_ricontattare: #b4580a;    --st-da_ricontattare-bg: #fff4e5;
  --st-appuntamento_fissato: #7b3fb0; --st-appuntamento_fissato-bg: #f4ecfb;
  --st-cliente: #008a05;            --st-cliente-bg: #e6f4e7;
  --st-archiviata: #6a6a6a;         --st-archiviata-bg: #f0f0f0;

  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sheet: 0 8px 28px rgba(0, 0, 0, 0.18);
  --font: 'Schibsted Grotesk', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --sidebar: 236px;
  --bottom-nav: 64px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: 'tnum' 0;
}
.num, .money { font-variant-numeric: tabular-nums; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }

/* ------------------------------------------------------------------ layout */
.shell { min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar);
  background: var(--side-bg); color: var(--side-text); border-right: 1px solid var(--side-border);
  display: flex; flex-direction: column; padding: 22px 14px 16px;
  z-index: 20;
}
.wordmark { display: flex; align-items: center; gap: 0.6rem; padding: 0 10px 26px; color: var(--side-strong); text-decoration: none; }
.wordmark .logo-mark { height: 30px; width: auto; display: block; flex: none; }
/* come sul sito inkasa.casa: scritta in grottesco nero, sottotitolo in maiuscoletto monospazio */
.wm-text { display: flex; flex-direction: column; font-family: var(--brand-font); line-height: 1.05; }
.wm-text b { font-weight: 800; font-size: 1.05rem; letter-spacing: -0.01em; text-transform: uppercase; color: var(--ink); }
.wm-text small { font-family: var(--brand-mono); font-weight: 400; font-size: 0.55rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); margin-top: 2px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 8px;
  text-decoration: none; color: var(--side-text); font-weight: 500;
}
.nav a:hover { background: var(--side-hover); color: var(--side-strong); }
.nav a[aria-current='page'] { background: var(--side-active); color: var(--side-strong); box-shadow: inset 3px 0 0 var(--accent); }
.nav svg { width: 19px; height: 19px; flex: none; opacity: 0.9; }
.nav .count { margin-left: auto; font-size: 12px; color: var(--accent); font-variant-numeric: tabular-nums; }
.sidebar-foot { margin-top: auto; padding: 12px 10px 0; border-top: 1px solid var(--side-border); font-size: 13px; }
.sidebar-foot a { color: var(--side-text); text-decoration: none; display: flex; align-items: center; gap: 10px; }
.sidebar-foot small { display: block; color: var(--side-muted); }

.main { margin-left: var(--sidebar); padding: 28px 36px 60px; max-width: calc(1240px + var(--sidebar)); }
.env-banner { background: var(--warn-soft); color: var(--warn); font-size: 13px; font-weight: 600; padding: 6px 12px; border-radius: 8px; margin-bottom: 16px; width: fit-content; }

.topbar { display: none; }
.bottom-nav { display: none; }

@media (max-width: 860px) {
  .sidebar { display: none; }
  .main { margin-left: 0; padding: 14px 16px calc(var(--bottom-nav) + 28px); }
  .topbar {
    display: flex; align-items: center; justify-content: space-between;
    position: sticky; top: 0; z-index: 15; background: var(--side-bg); color: var(--side-strong); border-bottom: 1px solid var(--side-border);
    padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top));
  }
  .topbar .wordmark { padding: 0; }
  .topbar .wordmark .logo-mark { height: 26px; }
  .bottom-nav {
    display: grid; grid-template-columns: repeat(5, 1fr);
    position: fixed; inset: auto 0 0 0; z-index: 15;
    background: var(--surface); border-top: 1px solid var(--line);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .bottom-nav a, .bottom-nav button {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    height: var(--bottom-nav); font-size: 11px; font-weight: 600; color: var(--muted); text-decoration: none;
    background: none; border: 0; cursor: pointer;
  }
  .bottom-nav svg { width: 22px; height: 22px; }
  .bottom-nav [aria-current='page'] { color: var(--ink); }
  .bottom-nav [aria-current='page'] svg { color: var(--accent); }
}

/* ------------------------------------------------------------------ page header */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { font-size: 30px; line-height: 1.1; letter-spacing: -0.02em; margin: 0; font-weight: 750; }
.page-head p { margin: 6px 0 0; color: var(--muted); }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); text-decoration: none; font-size: 14px; margin-bottom: 10px; }
.back:hover { color: var(--ink); }
h2 { font-size: 18px; margin: 0 0 12px; letter-spacing: -0.01em; }
h3 { font-size: 15px; margin: 0 0 8px; }
@media (max-width: 860px) { .page-head h1 { font-size: 25px; } .page-head { margin-bottom: 16px; } }

/* ------------------------------------------------------------------ buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: 8px; border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--ink); font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { border-color: var(--ink); }
.btn svg { width: 18px; height: 18px; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-hover); }
.btn.danger { color: var(--danger); border-color: #e7b9b5; }
.btn.danger:hover { border-color: var(--danger); background: var(--danger-soft); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: #f2f2f2; }
.btn.small { height: 32px; padding: 0 11px; font-size: 13.5px; }
.btn:disabled { opacity: 0.55; cursor: default; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: 50%;
  border: 1px solid var(--line-strong); background: var(--surface); cursor: pointer; color: var(--ink); text-decoration: none; flex: none;
}
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn:hover { border-color: var(--ink); }
.icon-btn.danger { color: var(--danger); border-color: #e7b9b5; }
.icon-btn.danger:hover { background: var(--danger-soft); border-color: var(--danger); }
.fab { display: none; }
@media (max-width: 860px) {
  .page-head .actions .btn.primary.hide-mobile { display: none; }
  .fab {
    display: inline-flex; position: fixed; right: 16px; bottom: calc(var(--bottom-nav) + 16px + env(safe-area-inset-bottom)); z-index: 14;
    width: 54px; height: 54px; border-radius: 50%; border: 0; background: var(--primary); color: #fff;
    align-items: center; justify-content: center; box-shadow: 0 6px 20px rgba(255, 56, 92, 0.35); cursor: pointer;
  }
  .fab svg { width: 24px; height: 24px; }
}

/* ------------------------------------------------------------------ surfaces */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.panel-pad { padding: 18px 20px; }
.stack > * + * { margin-top: 16px; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.grid-2 > * + * { margin-top: 0; }
@media (max-width: 1000px) { .grid-2 { grid-template-columns: 1fr; } }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.section-title h2 { margin: 0; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 13px; }
.empty { padding: 34px 20px; text-align: center; color: var(--muted); }
.empty strong { display: block; color: var(--ink); font-size: 16px; margin-bottom: 4px; }
.empty .btn { margin-top: 14px; }
.error-box { background: var(--danger-soft); color: var(--danger); padding: 10px 14px; border-radius: 8px; font-size: 14px; }
.loading { padding: 30px; color: var(--faint); }

/* ------------------------------------------------------------------ lists */
.rows { list-style: none; margin: 0; padding: 0; }
.row {
  display: grid; align-items: center; gap: 14px; padding: 12px 18px; border-top: 1px solid var(--line);
  text-decoration: none; color: inherit; cursor: pointer; background: none; width: 100%; text-align: left; border-left: 0; border-right: 0; border-bottom: 0;
}
.rows > li:first-child > .row, .rows > .row:first-child { border-top: 0; }
.row:hover { background: #f7f7f7; }
.row .title { font-weight: 600; }
.row .sub { color: var(--muted); font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .right { text-align: right; }
.lead-row { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr) 150px 110px; }
.prop-row { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1.1fr) 70px 80px 90px; }
.owner-row { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr) 90px 120px; }
@media (max-width: 860px) {
  .row { padding: 12px 14px; }
  .lead-row, .prop-row, .owner-row { grid-template-columns: minmax(0, 1fr) auto; }
  .row .hide-sm { display: none; }
}
.list-head { display: grid; gap: 14px; padding: 9px 18px; font-size: 12.5px; color: var(--faint); font-weight: 600; border-bottom: 1px solid var(--line); }
@media (max-width: 860px) { .list-head { display: none; } }

/* ------------------------------------------------------------------ badges */
.badge {
  display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: 999px;
  font-size: 12.5px; font-weight: 600; white-space: nowrap; background: #eef0f3; color: var(--muted);
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.plain::before { display: none; }
.badge.st-da_contattare { color: var(--st-da_contattare); background: var(--st-da_contattare-bg); }
.badge.st-da_ricontattare { color: var(--st-da_ricontattare); background: var(--st-da_ricontattare-bg); }
.badge.st-appuntamento_fissato { color: var(--st-appuntamento_fissato); background: var(--st-appuntamento_fissato-bg); }
.badge.st-cliente { color: var(--st-cliente); background: var(--st-cliente-bg); }
.badge.st-archiviata { color: var(--st-archiviata); background: var(--st-archiviata-bg); }
.badge.attivo, .badge.incassata { color: var(--ok); background: var(--ok-soft); }
.badge.sospeso, .badge.da_incassare { color: var(--warn); background: var(--warn-soft); }

/* ------------------------------------------------------------------ pipeline (filtro lead) */
.pipeline { display: grid; grid-template-columns: repeat(4, 1fr); margin-bottom: 16px; filter: drop-shadow(0 1px 0 var(--line)); }
.stage {
  position: relative; border: 0; background: var(--surface); cursor: pointer; text-align: left;
  padding: 14px 18px 14px 30px; min-height: 76px;
  clip-path: polygon(0 0, calc(100% - 16px) 0, 100% 50%, calc(100% - 16px) 100%, 0 100%, 16px 50%);
  margin-right: -10px;
}
.stage:first-child { clip-path: polygon(0 0, calc(100% - 16px) 0, 100% 50%, calc(100% - 16px) 100%, 0 100%); padding-left: 18px; border-radius: var(--radius) 0 0 var(--radius); }
.stage:last-child { margin-right: 0; }
.stage .n { display: block; font-size: 28px; font-weight: 750; line-height: 1; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.stage .l { display: block; margin-top: 6px; font-size: 13px; color: var(--muted); font-weight: 600; }
.stage:hover { background: #f7f7f7; }
.stage[aria-pressed='true'] { background: var(--ink); color: #fff; }
.stage[aria-pressed='true'] .l { color: rgba(255, 255, 255, 0.75); }
.stage .dot { position: absolute; top: 14px; right: 26px; width: 8px; height: 8px; border-radius: 50%; }
.filters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.search {
  flex: 1; min-width: 200px; max-width: 380px; height: 40px; border: 1px solid var(--line-strong); border-radius: 8px;
  padding: 0 12px 0 36px; background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%235d6a7e' stroke-width='2' viewBox='0 0 24 24'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") no-repeat 11px center;
}
.chip {
  height: 34px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface);
  font-size: 13.5px; font-weight: 600; cursor: pointer; color: var(--muted);
}
.chip[aria-pressed='true'] { background: var(--ink); border-color: var(--ink); color: #fff; }
@media (max-width: 860px) {
  .pipeline { grid-template-columns: repeat(2, 1fr); gap: 6px; filter: none; }
  .stage, .stage:first-child { clip-path: none; margin: 0; padding: 12px 14px; min-height: 0; border-radius: var(--radius); border: 1px solid var(--line); }
  .stage .n { font-size: 22px; }
  .stage .dot { right: 14px; }
  .search { max-width: none; }
}

/* ------------------------------------------------------------------ forms */
.form { display: grid; gap: 14px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 520px) { .form-row { grid-template-columns: 1fr; } }
.field { display: grid; gap: 5px; }
.field > span { font-size: 13px; font-weight: 600; color: var(--muted); }
.field > span em { font-style: normal; font-weight: 400; color: var(--faint); }
.input, .select, .textarea {
  width: 100%; min-height: 42px; border: 1px solid var(--line-strong); border-radius: 8px; padding: 9px 12px; background: var(--surface);
}
.textarea { min-height: 90px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(34, 34, 34, 0.08); }
.input.money { text-align: right; }
.hint { font-size: 12.5px; color: var(--faint); }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 8px; overflow: hidden; background: var(--surface); flex-wrap: wrap; }
.seg button { border: 0; background: none; padding: 8px 12px; font-size: 13.5px; font-weight: 600; cursor: pointer; color: var(--muted); }
.seg button + button { border-left: 1px solid var(--line); }
.seg button[aria-pressed='true'] { background: var(--ink); color: #fff; }
.check { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--ink); }

/* ------------------------------------------------------------------ sheet / dialog */
.overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.4); z-index: 40; animation: fade 0.15s ease-out; }
.sheet {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(520px, 100vw); background: var(--surface); z-index: 41;
  display: flex; flex-direction: column; box-shadow: var(--shadow-sheet); animation: slide 0.2s ease-out;
}
.sheet-head { display: flex; align-items: center; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--line); padding-top: max(16px, env(safe-area-inset-top)); }
.sheet-head h2 { margin: 0; flex: 1; font-size: 19px; }
.sheet-body { padding: 18px 20px 24px; overflow-y: auto; flex: 1; }
.sheet-foot { display: flex; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--line); padding-bottom: max(12px, env(safe-area-inset-bottom)); }
.sheet-foot .spacer { flex: 1; }
.dialog {
  position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(420px, calc(100vw - 32px));
  background: var(--surface); border-radius: 14px; padding: 22px; z-index: 51; box-shadow: var(--shadow-sheet);
}
.dialog h2 { margin-bottom: 8px; }
.dialog p { margin: 0 0 18px; color: var(--muted); }
.dialog .btns { display: flex; justify-content: flex-end; gap: 8px; }
.overlay.top { z-index: 50; }
@keyframes fade { from { opacity: 0; } }
@keyframes slide { from { transform: translateX(30px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .overlay, .sheet { animation: none; } }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 60;
  background: var(--ink); color: #fff; padding: 11px 18px; border-radius: 10px; font-weight: 600; font-size: 14px;
  box-shadow: var(--shadow-sheet); max-width: calc(100vw - 32px);
}
.toast.err { background: var(--danger); }
@media (max-width: 860px) { .toast { bottom: calc(var(--bottom-nav) + 18px); } }

/* ------------------------------------------------------------------ details */
.facts { display: grid; grid-template-columns: 130px 1fr; gap: 9px 14px; margin: 0; font-size: 14.5px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.contact-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.meta { font-size: 12.5px; color: var(--faint); margin-top: 14px; }
.notes { white-space: pre-wrap; overflow-wrap: anywhere; }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
.photo { position: relative; aspect-ratio: 4 / 3; border-radius: 8px; overflow: hidden; background: #eeeeee; }
.photo img { width: 100%; height: 100%; object-fit: cover; display: block; cursor: zoom-in; }
.photo .icon-btn { position: absolute; top: 6px; right: 6px; width: 30px; height: 30px; background: rgba(255,255,255,0.92); }
.lightbox { position: fixed; inset: 0; z-index: 70; background: rgba(0, 0, 0, 0.9); display: flex; align-items: center; justify-content: center; padding: 20px; cursor: zoom-out; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 6px; }

/* ------------------------------------------------------------------ dashboard */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 18px; }
.kpi { padding: 16px 18px; text-decoration: none; display: block; }
.kpi .v { font-size: 26px; font-weight: 750; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.kpi .k { color: var(--muted); font-size: 13.5px; font-weight: 600; }
.kpi.accent .v { color: var(--accent); }
@media (max-width: 860px) { .kpis { grid-template-columns: repeat(2, 1fr); gap: 8px; } .kpi .v { font-size: 22px; } }

/* ------------------------------------------------------------------ agenda */
.cal { width: 100%; border-collapse: collapse; table-layout: fixed; }
.cal th { font-size: 12.5px; color: var(--faint); font-weight: 600; padding: 8px 6px; text-align: left; border-bottom: 1px solid var(--line); }
.cal td { vertical-align: top; height: 112px; border-top: 1px solid var(--line); border-left: 1px solid var(--line); padding: 4px; cursor: pointer; }
.cal td:first-child { border-left: 0; }
.cal td:hover { background: #f7f7f7; }
.cal td.out { background: #fafafa; color: var(--faint); }
.cal .d { font-size: 13px; font-weight: 600; display: inline-flex; width: 26px; height: 26px; align-items: center; justify-content: center; border-radius: 50%; }
.cal td.today .d { background: var(--primary); color: #fff; }
.cal .ev { display: block; font-size: 12px; padding: 2px 6px; margin-top: 2px; border-radius: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; background: var(--accent-soft); color: #c4163f; border: 0; width: 100%; text-align: left; cursor: pointer; }
.cal .ev.task { background: #e8eef8; color: var(--st-da_contattare); }
.cal .ev.done { text-decoration: line-through; opacity: 0.6; }
.cal .more { font-size: 11.5px; color: var(--muted); padding-left: 6px; }
.agenda-day { padding: 12px 18px; border-top: 1px solid var(--line); }
.agenda-day:first-child { border-top: 0; }
.agenda-day h3 { font-size: 13.5px; color: var(--muted); text-transform: capitalize; margin: 0 0 6px; }
.agenda-day.today h3 { color: var(--ink); }
.item { display: flex; align-items: flex-start; gap: 12px; padding: 7px 0; }
.item .when { width: 52px; flex: none; font-variant-numeric: tabular-nums; font-weight: 600; font-size: 14px; }
.item .what { flex: 1; min-width: 0; cursor: pointer; }
.item .what .t { font-weight: 600; }
.item .what .s { color: var(--muted); font-size: 13px; }
.item.done .t { text-decoration: line-through; color: var(--faint); }
.tick { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line-strong); background: var(--surface); flex: none; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; padding: 0; margin-top: 1px; }
.tick:hover { border-color: var(--ok); }
.tick.on { background: var(--ok); border-color: var(--ok); color: #fff; }
.tick svg { width: 14px; height: 14px; }
.overdue { color: var(--danger); }
@media (max-width: 860px) { .cal-wrap { display: none; } }

/* ------------------------------------------------------------------ amministrazione */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs a { padding: 10px 14px; text-decoration: none; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a[aria-current='page'] { color: var(--ink); border-bottom-color: var(--accent); }
.month-nav { display: inline-flex; align-items: center; gap: 4px; }
.month-nav strong { min-width: 150px; text-align: center; font-size: 16px; }
table.data { width: 100%; border-collapse: collapse; font-size: 14.5px; }
table.data th { text-align: left; font-size: 12.5px; color: var(--faint); font-weight: 600; padding: 9px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.data td { padding: 10px 14px; border-top: 1px solid var(--line); vertical-align: middle; }
table.data tr:first-child td { border-top: 0; }
table.data .r { text-align: right; font-variant-numeric: tabular-nums; }
table.data tfoot td { border-top: 2px solid var(--ink); font-weight: 700; }
table.data tr.click { cursor: pointer; }
table.data tr.click:hover td { background: #f7f7f7; }
.table-scroll { overflow-x: auto; }
.money-input { width: 130px; }
.totals { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
@media (max-width: 860px) { .totals { grid-template-columns: repeat(2, 1fr); gap: 8px; } table.data th, table.data td { padding: 9px 10px; } }

/* ------------------------------------------------------------------ login */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.auth-side { background: var(--side-bg); color: var(--side-strong); border-right: 1px solid var(--side-border); padding: 48px; display: flex; flex-direction: column; justify-content: space-between; }
.auth-side { justify-content: center; align-items: center; text-align: center; }
.auth-brand { display: flex; flex-direction: column; align-items: center; }
.auth-logo { width: min(340px, 70%); height: auto; }
.auth-brand .wm-text { align-items: center; margin-top: 22px; }
.auth-brand .wm-text b { font-size: 2.6rem; letter-spacing: -0.01em; }
.auth-brand .wm-text small { font-size: 0.85rem; letter-spacing: 0.18em; margin-top: 6px; }
/* frase in corsivo, come la tagline del sito */
.auth-quote { margin: 44px 0 0; font-family: Georgia, 'Times New Roman', serif; font-style: italic; font-size: 1.45rem; line-height: 1.4; color: var(--ink); }
.auth-quote::before { content: ''; display: block; width: 36px; height: 2px; background: #b8863a; margin: 0 auto 22px; }
.auth-form { display: flex; align-items: center; justify-content: center; padding: 32px 20px; }
.auth-form .box { width: min(380px, 100%); }
.auth-form h1 { font-size: 26px; margin: 0 0 6px; letter-spacing: -0.02em; }
.auth-form .lead-text { color: var(--muted); margin: 0 0 22px; }
.link-btn { background: none; border: 0; padding: 0; color: var(--ink); text-decoration: underline; cursor: pointer; font-size: 14px; }
.ok-box { background: var(--ok-soft); color: var(--ok); padding: 10px 14px; border-radius: 8px; font-size: 14px; }
@media (max-width: 760px) {
  .auth-wrap { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .auth-side { padding: 32px 22px 28px; border-right: 0; border-bottom: 1px solid var(--side-border); }
  .auth-logo { width: 150px; }
  .auth-brand .wm-text { margin-top: 12px; }
  .auth-brand .wm-text b { font-size: 1.7rem; }
  .auth-brand .wm-text small { font-size: 0.7rem; }
  .auth-quote { margin-top: 18px; font-size: 1.05rem; }
  .auth-quote::before { margin-bottom: 14px; }
}

/* ------------------------------------------------------------------ report stampabile */
.report { background: var(--surface); padding: 40px; border: 1px solid var(--line); border-radius: var(--radius); max-width: 860px; }
.report header { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 2px solid var(--ink); padding-bottom: 16px; margin-bottom: 20px; }
.report header .wordmark { padding: 0; color: var(--ink); }
.report h1 { font-size: 22px; margin: 0; }
.report .grand { display: flex; justify-content: flex-end; gap: 30px; margin-top: 18px; font-size: 15px; }
.report .grand strong { font-size: 20px; color: var(--ink); }
@media print {
  .sidebar, .topbar, .bottom-nav, .no-print, .env-banner, .fab { display: none !important; }
  .main { margin: 0; padding: 0; max-width: none; }
  body { background: #fff; }
  .report { border: 0; padding: 0; max-width: none; }
}
.only-mobile { display: none; }
@media (max-width: 860px) { .only-mobile { display: block; } }

/* incassi del mese: su telefono ogni immobile diventa una scheda */
@media (max-width: 860px) {
  table.rev thead { display: none; }
  table.rev tr { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; padding: 12px 14px; border-top: 1px solid var(--line); align-items: center; }
  table.rev tr:first-child { border-top: 0; }
  table.rev td { border: 0; padding: 0; }
  table.rev td.c-name { grid-column: 1 / -1; }
  table.rev td.c-pct { display: none; }
  table.rev td.c-net { text-align: left; }
  table.rev td.c-net .money-input { width: 100%; }
  table.rev td.c-comm { text-align: right; font-weight: 600; }
  table.rev td.c-state { grid-column: 1 / -1; }
}

.topbar-btn { background: transparent; border-color: var(--side-border); color: var(--side-strong); }

/* ------------------------------------------------------------------ assistente */
.nav-assistant {
  display: flex; align-items: center; gap: 12px; margin: 14px 0 10px; padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--side-border); background: var(--accent-soft); color: var(--accent); font-weight: 600; cursor: pointer; text-align: left;
}
.nav-assistant:hover { border-color: var(--accent); }
.nav-assistant svg { width: 19px; height: 19px; }
.topbar .assistant-btn { color: var(--accent); }
.assistant {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(440px, 100vw); z-index: 35; background: var(--surface);
  border-left: 1px solid var(--line); box-shadow: -8px 0 30px rgba(0, 0, 0, 0.08); display: flex; flex-direction: column; overflow: hidden;
  animation: slide 0.18s ease-out;
}
.assistant-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); padding-top: max(14px, env(safe-area-inset-top)); }
.assistant-head > svg { width: 20px; height: 20px; color: var(--accent); }
.assistant-head h2 { margin: 0; flex: 1; font-size: 17px; }
.assistant-body { flex: 1; min-height: 0; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.assistant-intro p { color: var(--muted); margin: 0 0 14px; }
.assistant-suggest { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.assistant-suggest .chip { height: auto; min-height: 34px; padding: 7px 12px; text-align: left; border-radius: 12px; font-weight: 500; color: var(--ink); }
.bubble { max-width: 92%; padding: 10px 13px; border-radius: 14px; font-size: 14.5px; line-height: 1.5; overflow-wrap: anywhere; }
.bubble.from-user { align-self: flex-end; background: var(--ink); color: #fff; border-bottom-right-radius: 4px; white-space: pre-wrap; }
.bubble.from-ai { align-self: flex-start; background: var(--paper); border-bottom-left-radius: 4px; }
.bubble.from-ai p { margin: 0 0 8px; }
.bubble.from-ai p:last-child { margin-bottom: 0; }
.bubble.from-ai ul { margin: 4px 0 8px; padding-left: 18px; }
.bubble.err { background: var(--danger-soft); color: var(--danger); }
.bubble.typing { color: var(--muted); font-style: italic; }
.action-card { margin-top: 10px; padding: 12px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface); }
.action-card.annullato { opacity: 0.6; }
.action-card.creato { border-color: var(--ok); }
.action-btns { display: flex; gap: 8px; margin-top: 10px; }
.assistant-input { display: flex; gap: 8px; padding: 12px 16px 6px; border-top: 1px solid var(--line); align-items: flex-end; }
.assistant-input textarea { flex: 1; resize: none; max-height: 140px; min-height: 42px; border: 1px solid var(--line-strong); border-radius: 10px; padding: 10px 12px; font: inherit; }
.assistant-input textarea:focus { outline: none; border-color: var(--ink); }
.assistant-note { margin: 0; padding: 0 16px max(10px, env(safe-area-inset-bottom)); font-size: 11.5px; color: var(--faint); }
@media (max-width: 860px) { .assistant { width: 100vw; z-index: 45; } }
@media print { .assistant, .nav-assistant { display: none !important; } }

/* ------------------------------------------------------------------ pulizie (soci) */
.clean-row {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 9px 0; background: none; border: 0; border-top: 1px solid var(--line);
  text-align: left; cursor: pointer; color: inherit;
}
.agenda-day .clean-row:first-of-type { border-top: 0; }
.clean-row:hover .t { text-decoration: underline; }
.clean-row .what { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.clean-row .t { font-weight: 600; }
.clean-row .s { color: var(--muted); font-size: 13px; }
.clean-row.compact { padding: 6px 0; }
.clean-row.compact .what { flex-direction: row; align-items: baseline; gap: 4px; }
.clean-meta { display: flex; align-items: center; gap: 10px; }
.clean-meta svg { vertical-align: -2px; }
.clean-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--line-strong); }
.clean-dot.da_fare { background: var(--warn); }
.clean-dot.fatta { background: var(--ok); }
.urgent { color: var(--accent); font-weight: 600; }
.badge.cl-da_fare { color: var(--warn); background: var(--warn-soft); }
.badge.cl-fatta { color: var(--ok); background: var(--ok-soft); }
.badge.cl-annullata { color: var(--muted); background: #f0f0f0; }
.badge.urgent-badge { color: #fff; background: var(--accent); }
.badge.urgent-badge::before { background: #fff; }
.issue { display: flex; gap: 14px; align-items: flex-start; padding: 14px 18px; border-top: 1px solid var(--line); }
.issue:first-child { border-top: 0; }
.issue .t { font-weight: 600; margin-bottom: 2px; }
.issue-photo { width: 72px; height: 72px; object-fit: cover; border-radius: 8px; cursor: zoom-in; flex: none; }
.chips-row { display: flex; flex-wrap: wrap; gap: 6px; }
.person-chip { display: inline-flex; align-items: center; gap: 4px; padding: 4px 6px 4px 12px; border-radius: 999px; background: var(--paper); border: 1px solid var(--line); font-weight: 600; font-size: 14px; }
.person-chip button { border: 0; background: none; cursor: pointer; color: var(--muted); display: inline-flex; padding: 2px; border-radius: 50%; }
.person-chip button:hover { color: var(--danger); background: var(--danger-soft); }
.feeds { display: grid; gap: 6px; }
.feed { display: flex; align-items: center; gap: 10px; }
.feed .icon-btn { width: 32px; height: 32px; }
.team-row { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.team-row:first-of-type { border-top: 0; }
.team-row .t { font-weight: 600; }
.team-row.off { opacity: 0.55; }
.team-ctrl { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.team-ctrl .select { width: 120px; min-height: 36px; padding: 6px 8px; }

/* ------------------------------------------------------------------ app delle signore delle pulizie */
.cleaner { min-height: 100vh; background: var(--paper); }
.cleaner-head {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top)); background: var(--surface); border-bottom: 1px solid var(--line);
}
.cleaner-head .wordmark { padding: 0; color: var(--ink); }
.cleaner-main { max-width: 620px; margin: 0 auto; padding: 18px 16px calc(40px + env(safe-area-inset-bottom)); }
.cleaner-main h1 { font-size: 26px; margin: 0; letter-spacing: -0.02em; }
.cleaner-main section { margin-top: 22px; }
.cleaner-main h2 { font-size: 15px; color: var(--muted); margin: 0 0 10px; }
.clean-card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; margin-bottom: 12px; overflow: hidden; }
.clean-card.urgent-card { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.clean-card.done { opacity: 0.85; }
.clean-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; width: 100%; padding: 14px 16px 6px; background: none; border: 0; text-align: left; cursor: pointer; color: inherit; }
.clean-card-head strong { font-size: 17px; }
.clean-times { display: flex; gap: 18px; padding: 4px 16px 12px; flex-wrap: wrap; }
.clean-times div { display: flex; flex-direction: column; }
.clean-times b { font-size: 18px; font-variant-numeric: tabular-nums; }
.clean-body { padding: 0 16px 6px; display: grid; gap: 10px; }
.clean-note { background: var(--accent-soft); color: #9b1236; border-radius: 10px; padding: 10px 12px; font-size: 14.5px; display: flex; gap: 8px; align-items: flex-start; }
.clean-note svg { flex: none; margin-top: 2px; }
.clean-address { display: flex; gap: 8px; align-items: center; color: var(--ink); font-weight: 600; text-decoration: none; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; }
.clean-info { background: var(--paper); border-radius: 10px; padding: 10px 12px; }
.clean-actions { display: flex; gap: 8px; padding: 12px 16px 14px; border-top: 1px solid var(--line); flex-wrap: wrap; align-items: center; }
.btn.big { height: 48px; padding: 0 22px; font-size: 16px; flex: 1; }

/* Team: nuovi account */
.team-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.team-head h2 { margin: 0; }
.team-row .link-btn { font-size: 13px; color: var(--muted); margin-top: 4px; }
.access-box { display: grid; gap: 10px; background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.access-box > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.access-box b { word-break: break-all; font-size: 16px; }
.access-box .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 20px; letter-spacing: 0.04em; }
