/* Look Mania — design tokens (Obsidian & Ivory) */
@font-face {
  font-family: "Hanken Grotesk";
  src: url("fonts/hanken-grotesk.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #0f0f11;
  --card: #1b1b1f;
  --input: #242429;
  --hairline-8: rgba(255, 255, 255, 0.08);
  --hairline-16: rgba(255, 255, 255, 0.16);
  --hairline-40: rgba(255, 255, 255, 0.4);
  --text: #f4f4f2;
  --text-2: #9a9a98;
  --text-3: #6e6e6c;
  --accent: #eae3d4;
  --accent-soft: rgba(234, 227, 212, 0.12);
  --ink: #16150f;
  --danger: #ffb4ab;

  --r-card: 12px;
  --r-input: 8px;

  --pad: 24px;
  --tabbar-h: 76px;

  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --t-fast: 160ms;
  --t-med: 220ms;
}

* { box-sizing: border-box; }

/* iOS Safari tints button text with the system accent (blue) by default. Inherit the page
   colour instead — component styles (.btn-primary, .seg, .ic-btn…) set their own where needed. */
button { color: inherit; }

html { height: 100%; }

body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Hanken Grotesk", system-ui, sans-serif;
  font-weight: 400;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

/* ── App shell ─────────────────────────────────── */

#app {
  max-width: 430px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.view {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: var(--pad);
  padding-bottom: calc(var(--tabbar-h) + 24px);
  animation: view-in var(--t-med) var(--ease-out);
}

@keyframes view-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .view { animation: none; }
  * { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

h1, h2, h3 {
  font-weight: 500;
  margin: 0;
  text-wrap: balance;
}

h1 { font-size: 24px; line-height: 1.2; }
h2 { font-size: 20px; line-height: 1.4; }

.t-sec { color: var(--text-2); }
.t-sm  { font-size: 14px; }
.t-xs  { font-size: 12px; color: var(--text-2); }

/* ── Buttons ───────────────────────────────────── */

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 52px;
  padding: 14px 20px;
  border-radius: var(--r-card);
  font: inherit;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: opacity var(--t-fast) var(--ease-out), transform var(--t-fast) var(--ease-out);
}

.btn:active { transform: scale(0.985); }

.btn:focus-visible,
.chip:focus-visible,
.tab:focus-visible,
input:focus-visible,
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.btn-primary {
  background: var(--accent);
  color: var(--ink);
  border: none;
}

.btn-primary:disabled { opacity: 0.45; cursor: default; }

.btn-outline {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--hairline-16);
}

.btn-small {
  width: auto;
  min-height: 40px;
  padding: 8px 16px;
  font-size: 14px;
}

.btn-ghost {
  background: none;
  border: none;
  color: var(--text);
  font: inherit;
  cursor: pointer;
  padding: 8px;
  margin: -8px;
  display: inline-flex;
  align-items: center;
}

/* ── Inputs ────────────────────────────────────── */

label { display: block; font-size: 14px; color: var(--text-2); margin-bottom: 8px; }

input[type="text"], input[type="email"], input[type="tel"], input[type="number"], textarea {
  width: 100%;
  background: var(--input);
  border: 1px solid var(--hairline-16);
  border-radius: var(--r-input);
  color: var(--text);
  font: inherit;
  padding: 14px 16px;
  min-height: 52px;
  transition: border-color var(--t-fast) var(--ease-out);
  -webkit-appearance: none;
  appearance: none;
}

textarea { min-height: 64px; resize: vertical; line-height: 1.4; }

input::placeholder, textarea::placeholder { color: var(--text-2); }

input:focus, textarea:focus { border-color: var(--hairline-40); outline: none; }

.field { margin-bottom: 16px; }

/* ── Cards & lists ─────────────────────────────── */

.card {
  background: var(--card);
  border: 1px solid var(--hairline-8);
  border-radius: var(--r-card);
  padding: 20px;
}

.list { border-top: 1px solid var(--hairline-8); }

.list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 0;
  border-bottom: 1px solid var(--hairline-8);
}

/* ── Chips (days, time slots) ──────────────────── */

.chip {
  background: transparent;
  border: 1px solid var(--hairline-16);
  border-radius: 9999px;
  color: var(--text-2);
  font: inherit;
  font-size: 15px;
  padding: 12px 20px;
  min-height: 48px;
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--t-fast) var(--ease-out), color var(--t-fast) var(--ease-out), border-color var(--t-fast) var(--ease-out);
}

.chip[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--ink);
  font-weight: 500;
}

.day-strip {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  scrollbar-width: none;
  margin: 0 calc(-1 * var(--pad));
  padding: 4px var(--pad);
}

.day-strip::-webkit-scrollbar { display: none; }

/* Time slots: pill grid, selected = soft beige fill + beige border (per brief S3) */
.slot-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.slot {
  background: transparent;
  border: 1px solid var(--hairline-16);
  border-radius: 9999px;
  color: var(--text);
  font: inherit;
  font-size: 16px;
  padding: 14px;
  min-height: 52px;
  cursor: pointer;
  text-align: center;
  font-variant-numeric: tabular-nums;
  transition: background var(--t-fast) var(--ease-out), border-color var(--t-fast) var(--ease-out);
}

.slot[aria-pressed="true"] {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--text);
}

.slot:disabled {
  color: var(--text-3);
  text-decoration: line-through;
  border-color: var(--hairline-8);
  cursor: default;
}

.slot-group { margin-top: 28px; }
.slot-group:first-of-type { margin-top: 20px; }
.slot-group h3 { font-size: 14px; color: var(--text-2); font-weight: 500; margin-bottom: 14px; }

/* Skeletons (loading) */
.skel {
  border-radius: 9999px;
  min-height: 52px;
  background: var(--card);
  border: 1px solid var(--hairline-8);
  animation: skel 1.1s ease-in-out infinite alternate;
}

@keyframes skel { from { opacity: 0.45; } to { opacity: 0.9; } }

/* ── Sticky confirm bar ────────────────────────── */

.confirm-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: var(--tabbar-h);
  padding: 12px var(--pad) 16px;
  background: var(--bg);
  border-top: 1px solid var(--hairline-8);
  max-width: 430px;
  margin: 0 auto;
  transform: translateY(120%);
  transition: transform var(--t-med) var(--ease-out);
}

.confirm-bar.show { transform: none; }

/* ── Bottom tab bar ────────────────────────────── */

.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--tabbar-h);
  max-width: 430px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  background: var(--bg);
  border-top: 1px solid var(--hairline-8);
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 10;
}

.tab {
  background: none;
  border: none;
  color: var(--text-2);
  font: inherit;
  font-size: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  cursor: pointer;
}

.tab svg { width: 22px; height: 22px; }

/* Active tab: bold white label + a small accent dot (matches the Stitch design — no pill). */
.tab { position: relative; padding-bottom: 6px; }
.tab[aria-current="page"] { color: var(--text); font-weight: 600; }
.tab[aria-current="page"] .tab-pill { background: transparent; color: var(--text); }
.tab[aria-current="page"]::after {
  content: "";
  position: absolute;
  bottom: 2px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
}

.tab-pill { display: flex; padding: 6px 18px; }

/* ── Screen-specific ───────────────────────────── */

/* S1 login */
.login { justify-content: center; gap: 0; }

.logo-wrap { display: flex; flex-direction: column; align-items: center; margin-bottom: 48px; }

.logo-ring {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  border: 1.5px solid var(--hairline-16);
  background: var(--card);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
}

.divider {
  display: flex;
  align-items: center;
  gap: 16px;
  color: var(--text-3);
  font-size: 14px;
  margin: 24px 0;
}

.divider::before, .divider::after {
  content: "";
  flex: 1;
  border-top: 1px solid var(--hairline-8);
}

.login-footer {
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--hairline-8);
  text-align: center;
}

.login-footer a { color: var(--text-2); text-decoration: none; font-size: 13px; }

/* S2 home */
.home-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 28px;
}

/* Waitlist: barber proposals (freed slot) + queued days */
.wl-proposal { border-color: var(--accent); margin-bottom: 12px; }
.wl-proposal:last-of-type { margin-bottom: 4px; }
.wl-label { font-size: 13px; color: var(--text-2); display: flex; align-items: center; gap: 8px; margin: 0; }
.wl-label svg { color: var(--accent); }
.wl-prop-date { margin: 6px 0 0; font-size: 18px; font-weight: 500; text-transform: capitalize; }
.wl-actions { display: flex; gap: 10px; margin-top: 16px; }
.wl-actions .btn { flex: 1; }
.wl-day { flex: 1; min-width: 0; background: transparent; border: none; color: inherit; font: inherit; text-align: left; cursor: pointer; padding: 0; display: flex; flex-direction: column; gap: 2px; -webkit-tap-highlight-color: transparent; }
.wl-day:active { opacity: .7; }
.wl-day-date { text-transform: capitalize; }

.next-appt { margin-bottom: 20px; }
.next-appt .label { font-size: 13px; color: var(--text-2); display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.next-appt .actions { display: flex; gap: 12px; margin-top: 18px; }

.section-title { font-size: 16px; font-weight: 500; margin: 32px 0 4px; }

.atmosfera {
  margin-top: 32px;
  background: var(--card);
  border: 1px solid var(--hairline-8);
  border-radius: var(--r-card);
  padding: 28px 20px;
}

/* S3 header */
.screen-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
}

.month-label { font-size: 14px; color: var(--text-2); margin: 4px 0 14px; }

.detail-card {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  margin-top: 32px;
}

.notice {
  margin-top: 16px;
  font-size: 14px;
  color: var(--text-2);
  border: 1px solid var(--hairline-8);
  border-radius: var(--r-card);
  padding: 14px 16px;
}

.notice.error { color: var(--danger); border-color: rgba(255, 180, 171, 0.3); }

/* Success screen */
.success { justify-content: center; text-align: center; align-items: center; }
.success .logo-ring { margin-bottom: 28px; }
.success dl { margin: 24px 0 0; text-align: left; width: 100%; }
.success .card { width: 100%; }
.success dt { font-size: 13px; color: var(--text-2); }
.success dd { margin: 2px 0 14px; font-weight: 500; }
.success dd:last-child { margin-bottom: 0; }

/* Service rows */
.svc-price { color: var(--text-2); font-variant-numeric: tabular-nums; white-space: nowrap; }

icon-spacer { display: inline-block; width: 22px; }

/* ── Look Mania additions (v0.5) ───────────────── */


/* Service rows as full-width buttons */
.svc-list { border-top: none; }
.svc-row {
  width: 100%; background: var(--card); border: 1px solid var(--hairline-8);
  border-radius: var(--r-card); color: var(--text); font: inherit; text-align: left;
  padding: 18px 18px; margin-bottom: 12px; cursor: pointer;
  display: flex; align-items: center; justify-content: space-between;
  transition: border-color var(--t-fast) var(--ease-out), background var(--t-fast) var(--ease-out);
}
.svc-row:last-child { margin-bottom: 0; }
.svc-row:active { transform: scale(.99); }
.svc-row:hover { border-color: var(--hairline-16); }

/* Service row: medallion + name + forward chevron */
.svc-medallion { flex: 0 0 auto; width: 44px; height: 44px; border-radius: 9999px; background: var(--accent-soft); color: var(--accent); display: inline-flex; align-items: center; justify-content: center; }
.svc-medallion.sm { width: 30px; height: 30px; }
.svc-body { flex: 1; min-width: 0; margin: 0 14px; display: flex; flex-direction: column; gap: 3px; }
.svc-name { font-weight: 600; font-size: 16px; line-height: 1.2; }
.svc-desc { font-size: 13px; color: var(--text-2); line-height: 1.35; }
.svc-end { flex: 0 0 auto; display: flex; align-items: center; gap: 10px; }
.svc-dur { font-size: 12px; font-weight: 500; color: var(--text-2); background: var(--accent-soft); border-radius: 9999px; padding: 3px 10px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.chev-fwd { color: var(--text-3); display: inline-flex; flex: 0 0 auto; }
@media (hover: hover) {
  .svc-row:hover { transform: translateY(-1px); box-shadow: 0 8px 20px -16px rgba(0,0,0,.5); }
  .svc-row:hover .chev-fwd { color: var(--text-2); }
}

/* Compact "selected service" chip (data/ora step) */
.svc-chip { display: inline-flex; align-items: center; gap: 8px; background: var(--card); border: 1px solid var(--hairline-8); border-radius: 9999px; padding: 6px 16px 6px 6px; font-size: 14px; font-weight: 500; margin-bottom: 16px; }

/* Step progress (segments) — replaces the plain "PASSAGGIO n DI 3" text */
.step-progress { display: flex; align-items: center; gap: 12px; margin: -8px 0 18px; }
.step-segs { display: flex; gap: 6px; }
.step-seg { width: 24px; height: 4px; border-radius: 9999px; background: var(--hairline-16); transition: background var(--t-med) var(--ease-out); }
.step-seg.done { background: var(--accent-soft); }
.step-seg.now { background: var(--accent); }
.step-label { font-size: 12px; color: var(--text-2); }

/* Grouped settings label (Profilo) */
.row-group-label { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-2); margin: 22px 2px 8px; }
.row-group-label:first-of-type { margin-top: 8px; }

/* Unified empty state */
.empty-state { text-align: center; padding: 44px 20px 24px; display: flex; flex-direction: column; align-items: center; }
.empty-ic { width: 64px; height: 64px; border-radius: 9999px; background: var(--accent-soft); color: var(--accent); display: inline-flex; align-items: center; justify-content: center; margin-bottom: 16px; }
.empty-title { font-size: 18px; margin: 0; }
.empty-sub { color: var(--text-2); font-size: 14px; margin: 6px 0 0; max-width: 32ch; }

/* Success check: pop + draw-in (disabled under reduced-motion at top of file) */
@keyframes ring-pop { from { transform: scale(.72); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes check-draw { to { stroke-dashoffset: 0; } }
.animate-check { animation: ring-pop var(--t-med) var(--ease-out) both; }
.animate-check svg { stroke-dasharray: 42; stroke-dashoffset: 42; animation: check-draw 460ms var(--ease-out) 140ms forwards; }

/* Pills */
.pill-soft { background: var(--accent-soft); color: var(--accent); border-radius: 9999px; padding: 3px 10px; font-size: 12px; font-weight: 500; }
.pill-done { display: inline-flex; align-items: center; gap: 5px; color: var(--text-2); font-size: 12px; white-space: nowrap; }
.pill-done svg { color: var(--accent); }

/* Summary card */
.summary { margin: 0; }
.summary dt { font-size: 13px; color: var(--text-2); }
.summary dd { margin: 2px 0 14px; font-weight: 500; }
.summary dd:last-child { margin-bottom: 0; }

.logo-ring.ok { border-color: var(--accent); color: var(--accent); }

/* Profile */
.profile-id { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 8px 0 28px; }
.avatar {
  width: 72px; height: 72px; border-radius: 50%; background: var(--accent); color: var(--ink);
  display: flex; align-items: center; justify-content: center; font-size: 24px; font-weight: 600;
}
.row-list { display: flex; flex-direction: column; gap: 10px; }
.row-btn {
  width: 100%; background: var(--card); border: 1px solid var(--hairline-8); border-radius: var(--r-card);
  color: var(--text); font: inherit; font-size: 15px; padding: 16px 18px; cursor: pointer;
  display: flex; align-items: center; justify-content: space-between;
}
.row-btn > span:first-child { display: flex; align-items: center; gap: 12px; }
.row-btn svg { color: var(--text-2); }
.row-btn.danger { color: var(--danger); }
.row-btn.danger svg { color: var(--danger); }
.row-btn[aria-disabled="true"] { opacity: .6; cursor: default; }

/* ── Barber dashboard ──────────────────────────── */
.barber-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.segbar { display: flex; gap: 8px; background: var(--card); border: 1px solid var(--hairline-8); border-radius: 9999px; padding: 4px; margin-bottom: 18px; }
.seg { flex: 1; background: transparent; border: none; color: var(--text-2); font: inherit; font-size: 14px; font-weight: 500; padding: 10px; border-radius: 9999px; cursor: pointer; }
.seg.active { background: var(--accent); color: var(--ink); }

.date-nav { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.date-nav-label { font-size: 15px; font-weight: 500; text-transform: capitalize; }
.flip svg { transform: scaleX(-1); }

.stat-strip { display: flex; gap: 10px; margin-bottom: 18px; }
.stat-tile { background: var(--card); border: 1px solid var(--hairline-8); border-radius: var(--r-card); padding: 14px 18px; display: flex; flex-direction: column; }
.stat-tile strong { font-size: 22px; font-weight: 600; }
/* Oggi: 2×2 grid of stat cards (no horizontal scroll). */
.stat-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 18px; }
/* Settimana / Coda summary cards: equal width, content centred. */
.stat-strip .stat-tile { flex: 1; align-items: center; text-align: center; }

.agenda-list { display: flex; flex-direction: column; gap: 10px; }
.agenda-row { display: flex; align-items: center; gap: 14px; background: var(--card); border: 1px solid var(--hairline-8); border-radius: var(--r-card); padding: 14px 16px; }
.agenda-time { font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; min-width: 48px; }
.agenda-main { flex: 1; min-width: 0; }
.agenda-actions { display: flex; gap: 6px; }
.ic-btn { width: 38px; height: 38px; border-radius: 9999px; background: transparent; border: 1px solid var(--hairline-16); color: var(--text-2); display: flex; align-items: center; justify-content: center; cursor: pointer; }
.ic-btn:active { transform: scale(.94); }
.ic-btn.danger { color: var(--danger); border-color: rgba(255,180,171,.3); }

/* ── Modal ─────────────────────────────────────── */
.modal-wrap { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; justify-content: center; background: rgba(0,0,0,.55); animation: fade var(--t-fast) var(--ease-out); }
.modal-box { width: 100%; max-width: 430px; background: var(--bg); border-top-left-radius: 20px; border-top-right-radius: 20px; border: 1px solid var(--hairline-8); padding: 24px; max-height: 90dvh; overflow-y: auto; animation: sheet var(--t-med) var(--ease-out); }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes sheet { from { transform: translateY(30px); } to { transform: none; } }
/* Native form controls (date/time pickers, checkboxes) must follow the app theme, else the
   date text renders black-on-dark and is invisible. Set the scheme at the root so it inherits. */
:root { color-scheme: dark; }
:root[data-theme="light"] { color-scheme: light; }
input[type="date"], input[type="time"] { width: 100%; background: var(--input); border: 1px solid var(--hairline-16); border-radius: var(--r-input); color: var(--text); font: inherit; padding: 14px 16px; min-height: 52px; color-scheme: dark; }
input[type="password"] { width: 100%; background: var(--input); border: 1px solid var(--hairline-16); border-radius: var(--r-input); color: var(--text); font: inherit; padding: 14px 16px; min-height: 52px; }
input[type="password"]:focus { border-color: var(--hairline-40); outline: none; }

/* The [hidden] attribute must beat .tabbar's display:grid */
.tabbar[hidden] { display: none !important; }
html, body { overflow-x: hidden; }
/* No zoom anywhere (pinch + double-tap) but scroll still works: pan-x pan-y blocks
   pinch/double-tap where the viewport meta is ignored (iOS Safari). */
html, body { touch-action: pan-x pan-y; -ms-touch-action: pan-x pan-y; }

/* Barber: appuntamento in corso + vista settimana */
.pill-live { display: inline-block; background: var(--accent); color: var(--ink); border-radius: 9999px; padding: 1px 8px; font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; vertical-align: middle; margin-left: 4px; }
.agenda-row.live { border-color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); }
.stat-strip { flex-wrap: wrap; }
.stat-tile { flex: 1; min-width: 0; }

.week-list { display: flex; flex-direction: column; gap: 12px; }
.week-day { background: var(--card); border: 1px solid var(--hairline-8); border-radius: var(--r-card); padding: 14px 16px; }
.week-day-head { display: flex; align-items: center; justify-content: space-between; font-weight: 500; }
.week-row { display: flex; gap: 12px; align-items: baseline; padding: 8px 0 0; }
.week-row .agenda-time { font-size: 14px; min-width: 44px; }
.week-row-main { color: var(--text-2); font-size: 14px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Notifiche ─────────────────────────────────── */
.nx-bell { position: relative; }
.nx-bell-dot {
  position: absolute; top: -2px; right: -2px; min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 9999px; background: var(--accent); color: var(--ink);
  font-size: 10px; font-weight: 700; line-height: 16px; text-align: center;
}
.notif-list { display: flex; flex-direction: column; gap: 10px; }
.notif-row {
  display: flex; align-items: flex-start; gap: 12px;
  background: var(--card); border: 1px solid var(--hairline-8); border-radius: var(--r-card); padding: 14px 16px;
}
/* Swipe-to-delete: a trash button sits behind the row; left-swipe slides the row to reveal it. */
.notif-swipe { position: relative; overflow: hidden; border-radius: var(--r-card); }
.notif-swipe .notif-row { position: relative; will-change: transform; touch-action: pan-y; }
.notif-del {
  position: absolute; top: 0; right: 0; bottom: 0; width: 84px; border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255, 180, 171, 0.16); color: var(--danger);
  border-radius: var(--r-card);
}
:root[data-theme="light"] .notif-del { background: rgba(180, 35, 29, 0.10); }
.notif-ic {
  flex: none; width: 34px; height: 34px; border-radius: 9999px; background: var(--accent-soft);
  display: flex; align-items: center; justify-content: center; color: var(--accent);
}
:root[data-theme="light"] .notif-ic { color: var(--ink); }
.notif-ic.danger { color: var(--danger); background: rgba(255, 180, 171, 0.14); }
:root[data-theme="light"] .notif-ic.danger { color: var(--danger); background: rgba(180, 35, 29, 0.10); }
.notif-main { flex: 1; min-width: 0; }
.notif-time { flex: none; color: var(--text-2); white-space: nowrap; padding-top: 2px; font-size: 12px; }

/* 4-tab segmented (barbiere) */
.segbar-4 .seg { font-size: 12px; padding: 9px 2px; white-space: nowrap; letter-spacing: -0.01em; }

/* Waitlist box (giorno pieno) */
.waitlist-box { margin-top: 20px; }
.waitlist-box p:first-child { display: flex; align-items: center; gap: 8px; }
.waitlist-box svg { color: var(--accent); }

/* ── Barber: bottom nav + FAB + analisi + coda ──── */
.view.barber { padding-bottom: calc(var(--tabbar-h) + 92px); }
.barber-nav { display: grid; } /* inherits .tabbar (fixed, 3 cols) */
.agenda-title { font-size: 18px; margin: 4px 0 12px; }

.fab {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 16px); z-index: 11;
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--accent); color: var(--ink); border: none; border-radius: 9999px;
  padding: 14px 24px; font: inherit; font-weight: 600; font-size: 15px; cursor: pointer;
  box-shadow: 0 8px 24px rgba(0,0,0,.45);
}
.fab:active { transform: translateX(-50%) scale(.97); }
.fab svg { color: var(--ink); }

.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 4px; }
.stat-grid .stat-tile { align-items: flex-start; padding: 16px 18px; }
.stat-grid .stat-tile strong { font-size: 26px; }

.coda-row { display: flex; align-items: center; gap: 12px; padding: 12px 0 0; }
.coda-row .agenda-main { flex: 1; min-width: 0; }

select {
  width: 100%; background: var(--input); border: 1px solid var(--hairline-16);
  border-radius: var(--r-input); color: var(--text); font: inherit; padding: 14px 16px;
  min-height: 52px; -webkit-appearance: none; appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-2) 50%), linear-gradient(135deg, var(--text-2) 50%, transparent 50%);
  background-position: right 18px center, right 13px center; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat;
}

/* ── Barber dashboard: allineamento mockup (v0.7) ── */
.barber .stat-strip { overflow-x: auto; scrollbar-width: none; flex-wrap: nowrap; margin: 0 calc(-1 * var(--pad)); padding: 0 var(--pad) 4px; gap: 12px; }
.barber .stat-strip::-webkit-scrollbar { display: none; }
.barber .stat-strip .stat-tile { min-width: 168px; flex: 0 0 auto; align-items: flex-start; padding: 18px 20px; }
.stat-cat { font-size: 11px; letter-spacing: .09em; text-transform: uppercase; color: var(--text-3); margin-bottom: 10px; }
.stat-val { margin: 0; font-size: 17px; font-weight: 600; line-height: 1.15; }
.stat-val strong { font-size: 27px; font-weight: 700; }

.agenda-head { display: flex; align-items: center; justify-content: space-between; margin: 22px 0 12px; }
.agenda-head .agenda-title { margin: 0; font-size: 21px; }
.agenda-datenav { display: flex; align-items: center; gap: 4px; color: var(--text-2); }
.agenda-date { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; min-width: 46px; text-align: center; }
.agenda-datenav .btn-ghost { padding: 6px; margin: 0; }

.agenda-list { gap: 12px; }
.agenda-row { padding: 16px; gap: 16px; }
.agenda-time { font-size: 20px; min-width: 54px; }

.fab { left: var(--pad); right: var(--pad); transform: none; width: auto; justify-content: center; }
.fab:active { transform: scale(.99); }

/* ── Account barbiere: servizi + orari ─────────────── */
.chev { display: inline-flex; transform: scaleX(-1); color: var(--text-3); }
.svc-admin-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--card); border: 1px solid var(--hairline-8); border-radius: var(--r-card); padding: 14px 16px; }

.orari-day { border-bottom: 1px solid var(--hairline-8); padding: 14px 0; }
.orari-day:last-of-type { border-bottom: none; }
.orari-check { display: flex; align-items: center; gap: 10px; margin: 0; font-size: 15px; font-weight: 500; color: var(--text); cursor: pointer; }
.orari-check input { width: 20px; height: 20px; accent-color: var(--accent); }
.orari-ranges { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; padding-left: 30px; }
.orari-range { display: flex; align-items: center; gap: 8px; }
.orari-range > span:first-child { min-width: 78px; }
.orari-range input[type="time"] { min-height: 44px; padding: 8px 10px; flex: 1; }

/* barber booking flow: no bottom nav → confirm bar sits at the bottom */
body.barber-booking .confirm-bar { bottom: 0; }

/* Powered by Nexuma */
.powered-by { display: block; margin-top: 10px; font-size: 12px; color: var(--text-3); text-decoration: none; }
.powered-by strong { color: var(--text-2); font-weight: 600; }

/* Brand logo (login) */
.brand-logo { width: 210px; max-width: 64%; height: auto; display: block; }

/* ══ LIGHT THEME (night-shift off) — Ivory & Espresso ══════════════ */
:root[data-theme="light"] {
  --bg:      #faf7f0;
  --card:    #ffffff;
  --input:   #f1ece2;
  --hairline-8:  rgba(24, 20, 14, 0.08);
  --hairline-16: rgba(24, 20, 14, 0.14);
  --hairline-40: rgba(24, 20, 14, 0.34);
  --text:    #1c1a15;
  --text-2:  #6b665c;
  --text-3:  #9a958a;
  --accent:  #23201b;
  --accent-soft: rgba(35, 32, 27, 0.07);
  --ink:     #f7f2e8;
  --danger:  #b4231d;
}

/* Logo swap (cream <-> dark) — pure CSS, re-render safe */
.brand-logo--ink { display: none; }
:root[data-theme="light"] .brand-logo--cream { display: none; }
:root[data-theme="light"] .brand-logo--ink   { display: block; }

/* Global night-shift toggle (top-right, inside the 430px column) */
.theme-toggle {
  position: fixed;
  top: calc(12px + env(safe-area-inset-top));
  right: max(12px, calc((100vw - 430px) / 2 + 12px));
  z-index: 40;
  width: 40px; height: 40px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--card); border: 1px solid var(--hairline-16);
  color: var(--text-2); cursor: pointer;
  transition: background var(--t-fast) var(--ease-out), color var(--t-fast) var(--ease-out);
}
.theme-toggle:active { transform: scale(0.94); }
.theme-toggle .ic-sun { display: none; }
:root[data-theme="light"] .theme-toggle .ic-moon { display: none; }
:root[data-theme="light"] .theme-toggle .ic-sun  { display: inline-flex; }

/* Inline toggle: sits in the header/brandbar next to the bell (not fixed to the screen). */
.theme-toggle.inline { position: static; top: auto; right: auto; z-index: auto; flex: 0 0 auto; }
/* Injected fallback toggle for screens without a brandbar — top-right of the scrolling view. */
.head-actions.floaty { position: absolute; top: var(--pad); right: var(--pad); z-index: 5; }

/* Brand bar (logo + actions) at the top of the main app screens */
.brandbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 18px; }
.head-actions { display: flex; align-items: center; gap: 8px; }
.head-logo { display: inline-flex; align-items: center; }
.head-logo img { height: 40px; width: auto; max-width: 60vw; vertical-align: middle; }

/* Brand logo in the Profile footer (in place of the "Look Mania" text, above Powered by) */
.footer-brand .head-logo { justify-content: center; }
.footer-brand .head-logo img { height: 30px; }

/* Reserve the top-right corner on plain headers so the injected toggle never overlaps a control */
.screen-head { padding-right: 44px; }

:root[data-theme="light"] .card,
:root[data-theme="light"] .svc-row,
:root[data-theme="light"] .agenda-row,
:root[data-theme="light"] .stat-tile,
:root[data-theme="light"] .notif-row,
:root[data-theme="light"] .week-day {
  box-shadow: 0 1px 2px rgba(24, 20, 14, 0.05);
}
:root[data-theme="light"] .fab { box-shadow: 0 8px 20px rgba(24, 20, 14, 0.18); }
:root[data-theme="light"] .modal-box { box-shadow: 0 -8px 30px rgba(24, 20, 14, 0.12); }

:root[data-theme="light"] input[type="date"],
:root[data-theme="light"] input[type="time"] { color-scheme: light; }

:root[data-theme="light"] .notice.error { border-color: rgba(180, 35, 29, 0.28); }
:root[data-theme="light"] .ic-btn.danger { border-color: rgba(180, 35, 29, 0.30); }

/* ── Month calendar (booking + reschedule) ─────── */
.cal { margin: 4px 0 8px; }
.cal-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.cal-title { font-size: 16px; font-weight: 600; text-transform: capitalize; }
.cal-nav .flip { transform: scaleX(-1); }
.cal-nav .btn-ghost:disabled { opacity: .28; cursor: default; }
.cal-wd { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-bottom: 8px; }
.cal-wd span { text-align: center; font-size: 12px; font-weight: 500; color: var(--text-3); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-cell {
  aspect-ratio: 1 / 1;
  display: flex; align-items: center; justify-content: center;
  background: transparent; border: 1px solid var(--hairline-16); border-radius: 9999px;
  color: var(--text); font: inherit; font-size: 15px; font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: background var(--t-fast) var(--ease-out), border-color var(--t-fast) var(--ease-out), color var(--t-fast) var(--ease-out);
}
.cal-blank { border: 0; background: transparent; cursor: default; pointer-events: none; }
.cal-today { border-color: var(--hairline-40); font-weight: 600; }
.cal-cell[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--ink); font-weight: 600; }
.cal-cell:disabled { color: var(--text-3); border-color: var(--hairline-8); cursor: default; opacity: .5; }
.cal-closed:disabled { text-decoration: line-through; }

/* Chiusure (giorni di chiusura) */
.closure-list { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.closure-chip { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; background: var(--card); border: 1px solid var(--hairline-16); border-radius: 14px; text-transform: capitalize; }
.closure-add { display: flex; gap: 10px; align-items: stretch; margin-top: 16px; }
.closure-add input[type="date"] { flex: 1 1 auto; min-width: 0; background: var(--input); border: 1px solid var(--hairline-16); border-radius: 12px; color: var(--text); font: inherit; padding: 12px 14px; min-height: 48px; }
.closure-add .btn { flex: 0 0 auto; width: auto; margin: 0; }

/* Clienti: righe cliccabili (scheda modificabile) */
.cust-row { align-items: center; }
.cust-tap { flex: 1; min-width: 0; background: transparent; border: none; color: inherit; font: inherit; text-align: left; cursor: pointer; padding: 0; display: flex; flex-direction: column; gap: 2px; -webkit-tap-highlight-color: transparent; }
.cust-tap:active { opacity: .7; }
.cust-name { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.cust-badge { display: inline-block; vertical-align: middle; margin-left: 6px; font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--accent); background: var(--accent-soft); border-radius: 9999px; padding: 2px 8px; }
.cust-sub { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cust-count { white-space: nowrap; margin-left: 12px; }
.cust-row .ic-btn { flex: 0 0 auto; margin-left: 8px; width: 34px; height: 34px; }

/* Notification gate (installed PWA) */
.notif-gate .gate-ic { display: inline-flex; align-items: center; justify-content: center; width: 68px; height: 68px; border-radius: 9999px; background: var(--accent-soft); color: var(--accent); }

/* GDPR / legal */
.link-inline { background: none; border: none; padding: 0; color: var(--accent, var(--text)); font: inherit; text-decoration: underline; cursor: pointer; }
.login-footer .link-inline { color: var(--text-2); font-size: 13px; display: inline; }
.remember-check { display: flex; align-items: center; gap: 10px; margin: 2px 0 18px; font-size: 14px; color: var(--text-2); cursor: pointer; }
.remember-check input[type="checkbox"] { flex: 0 0 auto; width: 18px; height: 18px; accent-color: var(--accent, var(--text)); }
.consent-check { display: flex; gap: 10px; align-items: flex-start; margin: 4px 0 20px; font-size: 13px; line-height: 1.45; color: var(--text-2); cursor: pointer; }
.consent-check input[type="checkbox"] { flex: 0 0 auto; width: 20px; height: 20px; margin-top: 1px; accent-color: var(--accent, var(--text)); }
.consent-check .link-inline { color: var(--accent, var(--text)); }
.danger-btn { background: #c0392b; border-color: #c0392b; color: #fff; }
.danger-btn:active { background: #a5301f; }
.legal .legal-body { padding: 4px 2px 40px; }
.legal-body h2 { font-size: 15px; margin: 22px 0 6px; }
.legal-body p, .legal-body li { font-size: 14px; line-height: 1.55; color: var(--text-2); }
.legal-body ul { margin: 6px 0 6px; padding-left: 20px; }
.legal-body li { margin: 3px 0; }
.legal-body strong { color: var(--text); font-weight: 600; }

/* ══════════════════════════════════════════════════════════════════
   Batch 5 — clienti search, analisi cards, coda, chiusure range,
   day-detail, plus a layer of design polish (background, hover, motion)
   ══════════════════════════════════════════════════════════════════ */

/* Barber booking — customer picker (button rows: reset UA appearance to a dark card) */
.pick-list { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.cust-pick {
  -webkit-appearance: none; appearance: none;
  width: 100%; text-align: left; font: inherit; color: var(--text); cursor: pointer;
  background: var(--card); border: 1px solid var(--hairline-8); border-radius: var(--r-card);
  padding: 14px 16px; border-bottom: 1px solid var(--hairline-8);
  display: flex; align-items: center; gap: 10px;
  transition: border-color var(--t-fast) var(--ease-out), background var(--t-fast) var(--ease-out), transform var(--t-fast) var(--ease-out);
}
.cust-pick:active { transform: scale(.99); }
.cust-pick .cust-name { color: var(--text); }
.cust-pick-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.cust-pick-check { flex: 0 0 auto; color: var(--accent); display: flex; align-items: center; }
.cust-pick.picked { border-color: var(--accent); background: var(--accent-soft); }

/* Clienti: search + "Nuovo" toolbar */
.cust-toolbar { display: flex; gap: 10px; align-items: center; margin: 4px 0 14px; }
.search-field { flex: 1; display: flex; align-items: center; gap: 8px; background: var(--input); border: 1px solid var(--hairline-8); border-radius: 9999px; padding: 0 14px; min-height: 44px; transition: border-color var(--t-fast) var(--ease-out); }
.search-field:focus-within { border-color: var(--hairline-40); }
.search-field svg { color: var(--text-2); flex: 0 0 auto; }
.search-field input { flex: 1; min-width: 0; background: transparent; border: none; outline: none; color: var(--text); font: inherit; padding: 8px 0; }
.search-field input::placeholder { color: var(--text-3); }
.cust-add { flex: 0 0 auto; width: auto; margin: 0; white-space: nowrap; gap: 4px; }

/* Analisi — richer card grid */
.an-section { font-size: 13px; color: var(--text-2); text-transform: uppercase; letter-spacing: .06em; margin: 22px 0 10px; font-weight: 600; }
.an-section:first-of-type { margin-top: 8px; }
.an-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.an-card { position: relative; background: var(--card); border: 1px solid var(--hairline-8); border-radius: var(--r-card); padding: 16px; display: flex; flex-direction: column; gap: 2px; overflow: hidden; transition: transform var(--t-fast) var(--ease-out), border-color var(--t-fast) var(--ease-out); }
.an-card::after { content: ""; position: absolute; inset: 0 0 auto auto; width: 60px; height: 60px; background: radial-gradient(circle at top right, var(--accent-soft), transparent 70%); pointer-events: none; }
.an-cat { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); }
.an-val { font-size: 30px; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.an-label { font-size: 13px; color: var(--text-2); }

/* Oggi — tappable stat tiles (buttons: reset UA appearance so iOS doesn't tint text blue) */
.stat-tile.tappable { -webkit-appearance: none; appearance: none; color: var(--text); font: inherit; cursor: pointer; text-align: left; -webkit-tap-highlight-color: transparent; transition: transform var(--t-fast) var(--ease-out), border-color var(--t-fast) var(--ease-out); }
.stat-tile.tappable .stat-cat { color: var(--text-3); }
.stat-tile.tappable:active { transform: scale(.97); }
.stat-hint { display: inline-flex; align-items: center; gap: 4px; margin-top: 6px; font-size: 11px; color: var(--text-3); }
.stat-hint svg { color: var(--text-3); }

/* Accent icon-button (e.g. "avvisa" in coda) */
.ic-btn-accent { color: var(--accent); border-color: var(--hairline-16); }
:root[data-theme="light"] .ic-btn-accent { color: var(--accent); }
/* tel: links are <a> → override the UA blue link color (a:link beats the .ic-btn class). */
a.ic-btn, a.ic-btn:link, a.ic-btn:visited { color: var(--text-2); text-decoration: none; }
a.ic-btn:active { color: var(--text); }

/* Static (non-interactive) slot chips — day detail free slots */
.slot-static { display: inline-flex; align-items: center; justify-content: center; padding: 8px 0; border-radius: var(--r-input); background: var(--accent-soft); border: 1px solid var(--hairline-8); color: var(--text); font-size: 14px; font-variant-numeric: tabular-nums; }

/* Chiusure — date range */
.closure-range { margin-top: 18px; }
.closure-range-fields { display: flex; gap: 10px; }
.closure-range-field { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.closure-range-field span { color: var(--text-2); }
.closure-range-field input[type="date"] { background: var(--input); border: 1px solid var(--hairline-16); border-radius: 12px; color: var(--text); font: inherit; padding: 12px 14px; min-height: 48px; width: 100%; color-scheme: dark; }
:root[data-theme="light"] .closure-range-field input[type="date"] { color-scheme: light; }

/* ── Motion & hover polish ─────────────────────────────────────────
   Press feedback everywhere; gentle lift on hover-capable devices only.
   All of this is disabled under prefers-reduced-motion (see top of file). */
.btn { transition: transform var(--t-fast) var(--ease-out), background var(--t-fast) var(--ease-out), border-color var(--t-fast) var(--ease-out), box-shadow var(--t-fast) var(--ease-out); }
.btn:active { transform: translateY(1px) scale(.99); }
.row-btn, .list-row, .stat-tile, .an-card, .week-day, .closure-chip { transition: transform var(--t-fast) var(--ease-out), border-color var(--t-fast) var(--ease-out), box-shadow var(--t-fast) var(--ease-out); }

@media (hover: hover) {
  .btn-primary:hover { box-shadow: 0 6px 20px -8px var(--accent-soft); }
  .an-card:hover, .stat-tile.tappable:hover { transform: translateY(-2px); border-color: var(--hairline-16); box-shadow: 0 10px 24px -16px rgba(0,0,0,.5); }
  .row-btn:hover, .list-row:hover { border-color: var(--hairline-16); }
  .ic-btn:hover { border-color: var(--hairline-40); color: var(--text); }
  .ic-btn.danger:hover { color: var(--danger); }
  .cust-tap:hover .cust-name { color: var(--text); }
}

/* Modal-box gets a hairline-lifted feel */
.modal-box { box-shadow: 0 -12px 40px -12px rgba(0,0,0,.55); }

/* Subtle entrance for the analisi cards — additive (ends fully visible),
   so a headless snapshot mid-flight still shows content. */
@keyframes card-rise { from { opacity: .5; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.an-card { animation: card-rise var(--t-med) var(--ease-out) both; }
.an-grid .an-card:nth-child(2) { animation-delay: 40ms; }
.an-grid .an-card:nth-child(3) { animation-delay: 80ms; }
.an-grid .an-card:nth-child(4) { animation-delay: 120ms; }
