/* =====================================================================
   Gestionale Prenotazioni — Design system "Clinico & pulito"
   I colori brand (--brand, --brand-dark, --accent) sono iniettati
   inline dal layout a partire dalle Impostazioni.
   ===================================================================== */

:root{
  --brand: #0E7C7B;
  --brand-dark: #0A5D5C;
  --accent: #2563EB;

  --bg: #f5f8fa;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e6eaef;
  --border-strong: #cbd5e1;
  --text: #0f172a;
  --muted: #64748b;
  --muted-2: #94a3b8;

  --success: #15803d; --success-bg:#ecfdf5; --success-bd:#a7f3d0;
  --danger:  #b91c1c; --danger-bg:#fef2f2;  --danger-bd:#fecaca;
  --warning: #b45309; --warning-bg:#fffbeb; --warning-bd:#fde68a;
  --info:    #155e75; --info-bg:#ecfeff;    --info-bd:#a5f3fc;

  --r-sm: 8px; --r: 12px; --r-lg: 16px; --r-xl: 22px; --r-full: 999px;
  --shadow-sm: 0 1px 2px rgba(15,23,42,.06), 0 1px 1px rgba(15,23,42,.04);
  --shadow: 0 4px 14px rgba(15,23,42,.07);
  --shadow-lg: 0 18px 48px rgba(15,23,42,.12);
  --ring: 0 0 0 3px color-mix(in srgb, var(--brand) 28%, transparent);

  --container: 1140px;
  --header-h: 68px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

*,*::before,*::after{ box-sizing:border-box; }
html{ -webkit-text-size-adjust:100%; }
body{
  margin:0; font-family:var(--font); color:var(--text);
  background:var(--bg); line-height:1.6; font-size:16px;
  -webkit-font-smoothing:antialiased; text-rendering:optimizeLegibility;
}
h1,h2,h3,h4{ line-height:1.2; margin:0 0 .5em; font-weight:700; letter-spacing:-.01em; }
h1{ font-size:clamp(1.9rem,4vw,2.7rem); }
h2{ font-size:clamp(1.4rem,2.6vw,1.9rem); }
h3{ font-size:1.18rem; }
p{ margin:0 0 1rem; }
a{ color:var(--brand); text-decoration:none; }
a:hover{ text-decoration:underline; }
img{ max-width:100%; display:block; }
small{ font-size:.85em; }
hr{ border:none; border-top:1px solid var(--border); margin:1.5rem 0; }

.container{ width:100%; max-width:var(--container); margin-inline:auto; padding-inline:20px; }
.muted{ color:var(--muted); }
.text-center{ text-align:center; }
.mt-0{margin-top:0}.mt-1{margin-top:.5rem}.mt-2{margin-top:1rem}.mt-3{margin-top:1.5rem}.mt-4{margin-top:2rem}
.mb-0{margin-bottom:0}.stack > * + *{ margin-top:1rem; }

/* ---------- Header / nav ---------- */
.site-header{
  position:sticky; top:0; z-index:50; background:rgba(255,255,255,.86);
  backdrop-filter:saturate(180%) blur(10px); border-bottom:1px solid var(--border);
}
.site-header .nav{ display:flex; align-items:center; gap:16px; height:var(--header-h); }
.brand{ display:flex; align-items:center; gap:10px; font-weight:700; color:var(--text); font-size:1.08rem; }
.brand:hover{ text-decoration:none; }
.brand img{ height:38px; width:auto; }
.brand-mark{
  width:38px; height:38px; border-radius:10px; flex:0 0 auto;
  background:linear-gradient(135deg,var(--brand),var(--brand-dark));
  display:grid; place-items:center; color:#fff; font-weight:800;
}
.nav-spacer{ flex:1; }
.nav-links{ display:flex; align-items:center; gap:8px; }
.nav-links a{ color:var(--text); padding:8px 12px; border-radius:var(--r-sm); font-weight:500; font-size:.96rem; }
.nav-links a:hover{ background:var(--surface-2); text-decoration:none; }
.nav-toggle{ display:none; background:none; border:1px solid var(--border); border-radius:var(--r-sm); width:42px; height:40px; cursor:pointer; }
.nav-toggle span,.nav-toggle span::before,.nav-toggle span::after{
  content:""; display:block; width:18px; height:2px; background:var(--text); margin:0 auto; position:relative; transition:.2s;
}
.nav-toggle span::before{ position:absolute; top:-6px; } .nav-toggle span::after{ position:absolute; top:6px; }

/* ---------- Buttons ---------- */
.btn{
  display:inline-flex; align-items:center; justify-content:center; gap:8px;
  font-family:inherit; font-size:.97rem; font-weight:600; line-height:1;
  padding:12px 20px; border-radius:var(--r-sm); border:1px solid transparent;
  cursor:pointer; transition:transform .04s ease, background .15s, box-shadow .15s, border-color .15s;
  text-decoration:none; white-space:nowrap;
}
.btn:hover{ text-decoration:none; }
.btn:active{ transform:translateY(1px); }
.btn:focus-visible{ outline:none; box-shadow:var(--ring); }
.btn-primary{ background:var(--brand); color:#fff; }
.btn-primary:hover{ background:var(--brand-dark); color:#fff; }
.btn-accent{ background:var(--accent); color:#fff; }
.btn-outline{ background:#fff; color:var(--text); border-color:var(--border-strong); }
.btn-outline:hover{ border-color:var(--brand); color:var(--brand); }
.btn-ghost{ background:transparent; color:var(--text); }
.btn-ghost:hover{ background:var(--surface-2); }
.btn-danger{ background:var(--danger); color:#fff; }
.btn-success{ background:var(--success); color:#fff; }
.btn-sm{ padding:8px 14px; font-size:.88rem; }
.btn-lg{ padding:15px 28px; font-size:1.05rem; }
.btn-block{ width:100%; }
.btn[disabled]{ opacity:.55; cursor:not-allowed; }

/* ---------- Cards ---------- */
.card{ background:var(--surface); border:1px solid var(--border); border-radius:var(--r-lg); box-shadow:var(--shadow-sm); }
.card-pad{ padding:24px; }
.card-header{ padding:18px 24px; border-bottom:1px solid var(--border); display:flex; align-items:center; gap:12px; }
.card-header h2,.card-header h3{ margin:0; }
.card-body{ padding:24px; }

/* ---------- Badges & chips ---------- */
.badge{ display:inline-flex; align-items:center; gap:5px; font-size:.78rem; font-weight:600; padding:4px 10px; border-radius:var(--r-full); line-height:1.4; }
.badge-soft{ background:color-mix(in srgb,var(--brand) 12%, #fff); color:var(--brand-dark); }
.badge-gray{ background:#f1f5f9; color:#475569; }
.badge-success{ background:var(--success-bg); color:var(--success); }
.badge-danger{ background:var(--danger-bg); color:var(--danger); }
.badge-warning{ background:var(--warning-bg); color:var(--warning); }
.badge-info{ background:var(--info-bg); color:var(--info); }

/* ---------- Alerts / flash ---------- */
.flash-stack{ margin-top:18px; }
.flash-stack:empty{ display:none; }
.alert{ border:1px solid var(--border); border-radius:var(--r); padding:13px 16px; margin-bottom:12px; font-size:.95rem; }
.alert-success{ background:var(--success-bg); border-color:var(--success-bd); color:var(--success); }
.alert-error{ background:var(--danger-bg); border-color:var(--danger-bd); color:var(--danger); }
.alert-warning{ background:var(--warning-bg); border-color:var(--warning-bd); color:var(--warning); }
.alert-info{ background:var(--info-bg); border-color:var(--info-bd); color:var(--info); }

/* ---------- Forms ---------- */
.field{ margin-bottom:16px; }
.field > label{ display:block; font-weight:600; font-size:.9rem; margin-bottom:6px; color:#334155; }
.field .hint{ font-size:.82rem; color:var(--muted); margin-top:5px; }
.field .error{ font-size:.82rem; color:var(--danger); margin-top:5px; }
.input,.select,.textarea{
  width:100%; font-family:inherit; font-size:1rem; color:var(--text);
  background:#fff; border:1px solid var(--border-strong); border-radius:var(--r-sm);
  padding:11px 13px; transition:border-color .15s, box-shadow .15s;
}
.input:focus,.select:focus,.textarea:focus{ outline:none; border-color:var(--brand); box-shadow:var(--ring); }
.input::placeholder,.textarea::placeholder{ color:var(--muted-2); }
.textarea{ min-height:110px; resize:vertical; }
.input[aria-invalid="true"]{ border-color:var(--danger); }
.form-row{ display:grid; gap:16px; grid-template-columns:1fr 1fr; }
.checkbox{ display:flex; align-items:flex-start; gap:10px; font-size:.93rem; }
.checkbox input{ margin-top:3px; width:18px; height:18px; accent-color:var(--brand); }

/* ---------- Tables ---------- */
.table{ width:100%; border-collapse:collapse; font-size:.94rem; }
.table th,.table td{ text-align:left; padding:12px 14px; border-bottom:1px solid var(--border); }
.table th{ color:var(--muted); font-weight:600; font-size:.8rem; text-transform:uppercase; letter-spacing:.03em; }
.table tbody tr:hover{ background:var(--surface-2); }

/* ---------- Hero (home) ---------- */
.hero{ position:relative; padding:64px 0 48px; overflow:hidden; }
.hero::before{
  content:""; position:absolute; inset:0; z-index:-1;
  background:
    radial-gradient(900px 380px at 85% -10%, color-mix(in srgb,var(--brand) 16%, transparent), transparent 70%),
    radial-gradient(700px 320px at 0% 110%, color-mix(in srgb,var(--accent) 12%, transparent), transparent 70%);
}
.hero-grid{ display:grid; grid-template-columns:1.15fr .85fr; gap:40px; align-items:center; }
.hero .eyebrow{ display:inline-block; font-weight:600; color:var(--brand-dark); background:color-mix(in srgb,var(--brand) 12%, #fff); padding:6px 14px; border-radius:var(--r-full); font-size:.85rem; margin-bottom:18px; }
.hero p.lead{ font-size:1.12rem; color:#475569; max-width:48ch; }
.hero-actions{ display:flex; gap:12px; flex-wrap:wrap; margin-top:26px; }
.hero-card{ background:var(--surface); border:1px solid var(--border); border-radius:var(--r-xl); box-shadow:var(--shadow-lg); padding:26px; }
.hero-photo{ width:84px; height:84px; border-radius:var(--r-full); object-fit:cover; border:3px solid #fff; box-shadow:var(--shadow); }
.info-list{ list-style:none; padding:0; margin:14px 0 0; }
.info-list li{ display:flex; gap:10px; padding:9px 0; border-top:1px solid var(--border); color:#475569; font-size:.95rem; }

/* ---------- Section ---------- */
.section{ padding:56px 0; }
.section-head{ text-align:center; max-width:640px; margin:0 auto 36px; }
.section-head p{ color:var(--muted); }

/* ---------- Service cards ---------- */
.services-grid{ display:grid; grid-template-columns:repeat(auto-fill,minmax(280px,1fr)); gap:22px; }
.service-card{ --svc:var(--brand); background:var(--surface); border:1px solid var(--border); border-radius:var(--r-lg); overflow:hidden; box-shadow:var(--shadow-sm); display:flex; flex-direction:column; transition:transform .15s, box-shadow .15s; }
.service-card:hover{ transform:translateY(-3px); box-shadow:var(--shadow); }
.service-card__top{ height:6px; background:var(--svc); }
.service-card__body{ padding:22px; display:flex; flex-direction:column; gap:10px; flex:1; }
.service-card h3{ margin:2px 0; }
.service-meta{ display:flex; justify-content:space-between; align-items:center; color:#475569; font-weight:600; font-size:.95rem; margin:6px 0 12px; }
.service-card .btn{ margin-top:auto; }

/* ---------- Steps (how it works / booking) ---------- */
.steps{ display:grid; grid-template-columns:repeat(auto-fit,minmax(220px,1fr)); gap:22px; }
.step{ text-align:center; padding:8px; }
.step .num{ width:48px; height:48px; border-radius:var(--r-full); margin:0 auto 14px; display:grid; place-items:center; font-weight:800; color:#fff; background:linear-gradient(135deg,var(--brand),var(--brand-dark)); }

/* progress stepper (wizard / prenotazione) */
.stepper{ display:flex; align-items:center; gap:6px; margin:0 0 28px; flex-wrap:wrap; }
.stepper .dot{ display:flex; align-items:center; gap:8px; color:var(--muted); font-size:.9rem; font-weight:600; }
.stepper .dot i{ width:26px; height:26px; border-radius:var(--r-full); display:grid; place-items:center; background:#fff; border:2px solid var(--border-strong); font-style:normal; font-size:.85rem; }
.stepper .dot.active{ color:var(--brand-dark); } .stepper .dot.active i{ background:var(--brand); border-color:var(--brand); color:#fff; }
.stepper .dot.done i{ background:var(--brand); border-color:var(--brand); color:#fff; }
.stepper .sep{ flex:1; height:2px; background:var(--border); min-width:18px; }

/* ---------- Footer ---------- */
.site-footer{ background:#0f172a; color:#cbd5e1; margin-top:64px; padding:48px 0 28px; font-size:.94rem; }
.site-footer a{ color:#e2e8f0; } .site-footer a:hover{ color:#fff; }
.footer-grid{ display:grid; grid-template-columns:1.4fr 1fr 1fr; gap:30px; }
.footer-grid h4{ color:#fff; font-size:.95rem; text-transform:uppercase; letter-spacing:.04em; }
.footer-bottom{ border-top:1px solid #1e293b; margin-top:30px; padding-top:18px; display:flex; justify-content:space-between; gap:14px; flex-wrap:wrap; color:#94a3b8; font-size:.86rem; }

/* ---------- Empty state ---------- */
.empty{ text-align:center; padding:48px 20px; color:var(--muted); }
.empty .icon{ font-size:2.4rem; margin-bottom:10px; }

/* ---------- Error pages ---------- */
.error-page{ min-height:60vh; display:grid; place-items:center; text-align:center; padding:40px 20px; }
.error-page .code{ font-size:5rem; font-weight:800; color:var(--brand); line-height:1; }

/* ---------- Responsive ---------- */
@media (max-width: 860px){
  .hero-grid{ grid-template-columns:1fr; } .hero-card{ order:-1; }
  .footer-grid{ grid-template-columns:1fr 1fr; }
  .form-row{ grid-template-columns:1fr; }
  .nav-toggle{ display:block; }
  .nav-links{
    position:absolute; top:var(--header-h); left:0; right:0; flex-direction:column; align-items:stretch;
    background:#fff; border-bottom:1px solid var(--border); padding:12px 16px; gap:4px; display:none; box-shadow:var(--shadow);
  }
  .nav-links.open{ display:flex; }
  .nav-links .btn{ margin-top:6px; }
}
@media (max-width: 560px){
  .footer-grid{ grid-template-columns:1fr; }
  .card-body,.card-pad{ padding:18px; }
}

/* ---------- Prenotazione: calendario & slot ---------- */
.booking-grid{ display:grid; grid-template-columns:300px 1fr; gap:24px; align-items:start; }
.booking-summary{ position:sticky; top:84px; }
.cal-head{ display:flex; align-items:center; justify-content:space-between; margin-bottom:14px; }
.cal-nav{ width:38px; height:38px; border:1px solid var(--border-strong); background:#fff; border-radius:var(--r-sm); font-size:1.2rem; cursor:pointer; line-height:1; }
.cal-nav[disabled]{ opacity:.35; cursor:not-allowed; }
.cal-grid{ display:grid; grid-template-columns:repeat(7,1fr); gap:6px; }
.cal-dow{ text-align:center; font-size:.72rem; font-weight:700; color:var(--muted); text-transform:uppercase; padding-bottom:4px; }
.cal-day{ aspect-ratio:1/1; border:1px solid var(--border); border-radius:var(--r-sm); background:#fff; font-weight:600; color:var(--text); cursor:pointer; font-size:.95rem; font-family:inherit; }
.cal-day.empty{ border:none; background:transparent; cursor:default; }
.cal-day[disabled]{ color:var(--muted-2); background:var(--surface-2); cursor:not-allowed; border-color:transparent; }
.cal-day.available:hover{ border-color:var(--brand); color:var(--brand); }
.cal-day.selected{ background:var(--brand); color:#fff; border-color:var(--brand); }
.cal-loading{ grid-column:1/-1; text-align:center; color:var(--muted); padding:20px; }
.slots-group{ margin-bottom:16px; }
.slots-group h4{ font-size:.8rem; color:var(--muted); text-transform:uppercase; letter-spacing:.03em; margin:0 0 10px; }
.slot-btns{ display:flex; flex-wrap:wrap; gap:8px; }
.slot{ padding:9px 14px; border:1px solid var(--border-strong); border-radius:var(--r-sm); background:#fff; font-weight:600; cursor:pointer; font-size:.92rem; font-family:inherit; }
.slot:hover{ border-color:var(--brand); color:var(--brand); }
.slot.selected{ background:var(--brand); color:#fff; border-color:var(--brand); }
.chosen-box{ background:color-mix(in srgb,var(--brand) 8%, #fff); border:1px solid color-mix(in srgb,var(--brand) 25%, #fff); border-radius:var(--r); padding:13px 16px; font-size:1.02rem; }
.cal-links{ display:flex; gap:10px; flex-wrap:wrap; }
@media (max-width:760px){ .booking-grid{ grid-template-columns:1fr; } .booking-summary{ position:static; } }

/* ---------- Chat ---------- */
.chat{ display:flex; flex-direction:column; gap:10px; max-height:56vh; overflow-y:auto; padding:6px 4px; }
.chat .msg{ max-width:78%; padding:10px 14px; border-radius:14px; font-size:.95rem; line-height:1.45; word-wrap:break-word; }
.chat .msg.them{ align-self:flex-start; background:#fff; border:1px solid var(--border); border-bottom-left-radius:4px; }
.chat .msg.me{ align-self:flex-end; background:var(--brand); color:#fff; border-bottom-right-radius:4px; }
.chat .msg .meta{ font-size:.68rem; opacity:.75; margin-top:4px; }

/* ---------- Tabelle scrollabili su mobile (no overflow del layout) ---------- */
.table-scroll{ overflow-x:auto; -webkit-overflow-scrolling:touch; max-width:100%; }
@media (max-width: 820px){
  .data-table, .table{ white-space:nowrap; }
  input[type="time"], input[type="date"]{ max-width:100%; }
  .toolbar{ gap:8px; }
  body{ overflow-x:hidden; }
}
