/* ── Design tokens — editorial-monocle (adattato da OpenDesign) ── */
:root {
  --bg:      oklch(97% 0.012 80);   /* crema caldo */
  --surface: oklch(99% 0.005 80);
  --surface-2: oklch(96% 0.014 80);
  --fg:      oklch(22% 0.02 60);
  --muted:   oklch(48% 0.015 60);
  --border:  oklch(89% 0.012 80);
  --accent:  oklch(52% 0.14 30);     /* terracotta scuro per salone */
  --accent-2: oklch(62% 0.13 350);   /* rosa/melanzana per dettagli */
  --good:    oklch(58% 0.13 145);
  --bad:     oklch(55% 0.18 25);
  --font-display: 'Iowan Old Style', 'Charter', Georgia, serif;
  --font-body: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --radius: 14px;
  --shadow: 0 2px 14px oklch(20% 0.02 60 / 0.06);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font-body);
  color: var(--fg);
  background: var(--bg);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ── Topbar ── */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 36px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap; gap: 16px;
}
.brand { display: flex; align-items: center; gap: 14px; }
.brand-mark {
  width: 44px; height: 44px; border-radius: 12px;
  background: var(--fg); color: var(--bg);
  display: grid; place-items: center;
  font-family: var(--font-display); font-size: 20px; letter-spacing: 0.02em;
}
.brand-text h1 { font-family: var(--font-display); font-size: 24px; font-weight: 400; letter-spacing: -0.01em; }
.tagline { font-size: 12px; color: var(--muted); letter-spacing: 0.08em; text-transform: uppercase; }

.tabs { display: flex; gap: 4px; }
.tab {
  background: transparent; border: none; cursor: pointer;
  font-family: var(--font-body); font-size: 14px;
  color: var(--muted); padding: 10px 16px; border-radius: 10px;
  transition: all 0.18s;
}
.tab:hover { color: var(--fg); background: var(--surface-2); }
.tab.active { color: var(--fg); background: var(--surface-2); font-weight: 600; }

/* ── Layout ── */
main { padding: 32px 36px 64px; max-width: 1280px; margin: 0 auto; }
.view-title {
  font-family: var(--font-display); font-size: 34px; font-weight: 400;
  letter-spacing: -0.01em; margin-bottom: 4px;
}
.view-kicker {
  font-size: 12px; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 24px;
}

/* ── Card / griglia ── */
.grid { display: grid; gap: 20px; }
.cards-4 { grid-template-columns: repeat(4, 1fr); }
.cards-3 { grid-template-columns: repeat(3, 1fr); }
.cards-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 980px) { .cards-4 { grid-template-columns: repeat(2, 1fr); } .cards-3, .cards-2 { grid-template-columns: 1fr; } }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow);
}
.card .label { font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); margin-bottom: 12px; }
.card .value { font-family: var(--font-display); font-size: 32px; font-weight: 400; letter-spacing: -0.01em; }
.card .sub { font-size: 13px; color: var(--muted); margin-top: 6px; }
.card.accent { border-left: 3px solid var(--accent); }
.card.good { border-left: 3px solid var(--good); }
.card.bad { border-left: 3px solid var(--bad); }

.section-title {
  font-family: var(--font-display); font-size: 22px; font-weight: 400; margin: 8px 0 14px;
}

/* ── Tabelle ── */
.table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead th {
  text-align: left; padding: 12px 16px;
  font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted);
  background: var(--surface-2); border-bottom: 1px solid var(--border);
}
tbody td { padding: 12px 16px; border-bottom: 1px solid var(--border); }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--surface-2); }
.mono { font-variant-numeric: tabular-nums; }

/* ── Form ── */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.input, select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px;
  font-family: var(--font-body); font-size: 14px; color: var(--fg); background: var(--surface);
}
.input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); }
textarea { min-height: 70px; resize: vertical; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.row-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
@media (max-width: 600px) { .row, .row-3 { grid-template-columns: 1fr; } }

/* ── Bottoni ── */
.btn {
  font-family: var(--font-body); font-size: 14px; cursor: pointer;
  padding: 10px 18px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); color: var(--fg); transition: all 0.18s;
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.btn.primary:hover { background: var(--accent); border-color: var(--accent); }
.btn.danger { color: var(--bad); }
.btn.danger:hover { background: var(--bad); color: var(--surface); border-color: var(--bad); }
.btn.sm { padding: 6px 12px; font-size: 13px; }
.btn-row { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }
.toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; gap: 12px; flex-wrap: wrap; }

/* ── Badge / stato ── */
.badge { font-size: 11px; padding: 3px 10px; border-radius: 999px; letter-spacing: 0.04em; display: inline-block; }
.badge.prenotato { background: var(--surface-2); color: var(--muted); }
.badge.completato { background: oklch(95% 0.06 145); color: oklch(40% 0.13 145); }
.badge.annullato { background: oklch(95% 0.04 25); color: var(--bad); }
.badge.entrata { background: oklch(95% 0.06 145); color: oklch(40% 0.13 145); }
.badge.uscita { background: oklch(95% 0.05 25); color: var(--bad); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 8px; vertical-align: middle; }
.dot.prenotato { background: var(--muted); }
.dot.completato { background: var(--good); }
.dot.annullato { background: var(--bad); }

/* ── Calendario ── */
.cal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.cal-head h2 { font-family: var(--font-display); font-size: 22px; font-weight: 400; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.cal-dow { font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); text-align: center; padding: 6px 0; }
.cal-day {
  min-height: 96px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 8px; cursor: pointer; transition: border-color 0.15s;
}
.cal-day:hover { border-color: var(--accent); }
.cal-day.empty { background: transparent; border: none; cursor: default; }
.cal-day.today { border-color: var(--accent); border-width: 2px; }
.cal-day .num { font-family: var(--font-display); font-size: 16px; margin-bottom: 4px; }
.cal-evt {
  font-size: 11px; background: var(--surface-2); border-left: 2px solid var(--accent);
  border-radius: 4px; padding: 3px 6px; margin-bottom: 3px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
.cal-evt.completato { border-left-color: var(--good); }

/* ── Cliente dettaglio ── */
.back-link { color: var(--muted); cursor: pointer; margin-bottom: 16px; display: inline-block; font-size: 13px; }
.back-link:hover { color: var(--fg); }
.cliente-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 24px; flex-wrap: wrap; gap: 14px; }
.cliente-head h2 { font-family: var(--font-display); font-size: 30px; font-weight: 400; }
.info-list dt { font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.info-list dd { margin-bottom: 10px; }

/* ── Modale ── */
.modal-overlay {
  position: fixed; inset: 0; background: oklch(20% 0.02 60 / 0.45);
  display: grid; place-items: center; z-index: 50; padding: 20px;
}
.modal-overlay.hidden { display: none; }
.modal {
  background: var(--surface); border-radius: var(--radius); box-shadow: 0 20px 60px oklch(20% 0.02 60 / 0.2);
  width: 100%; max-width: 560px; max-height: 88vh; overflow-y: auto; padding: 26px;
}
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.modal-head h2 { font-family: var(--font-display); font-size: 24px; font-weight: 400; }
.modal-close { background: none; border: none; font-size: 26px; cursor: pointer; color: var(--muted); line-height: 1; }
.modal-close:hover { color: var(--fg); }

/* ── Flash ── */
.flash {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--fg); color: var(--bg); padding: 12px 22px; border-radius: 10px;
  box-shadow: var(--shadow); z-index: 60; font-size: 14px;
}
.flash.hidden { display: none; }
.empty { text-align: center; color: var(--muted); padding: 40px; }
.clickable { cursor: pointer; }
.list-item { padding: 14px 16px; border-bottom: 1px solid var(--border); cursor: pointer; }
.list-item:hover { background: var(--surface-2); }
.list-item .li-title { font-family: var(--font-display); font-size: 18px; }
.list-item .li-sub { font-size: 13px; color: var(--muted); margin-top: 2px; }
.muted { color: var(--muted); }
.right { text-align: right; }
.neg { color: var(--bad); }
.pos { color: oklch(40% 0.13 145); }
hr.thin { border: none; border-top: 1px solid var(--border); margin: 22px 0; }