/* ProntoAgenda — pannello staff */
:root {
  --bg: #f7f3f0;
  --surface: #ffffff;
  --surface-2: #f4eeea;
  --surface-3: #ece4de;
  --text: #2a211d;
  --muted: #6c6059;
  --border: #e7ddd6;
  --grid-line: #f2ece7;
  --accent: #9a4a67;
  --accent-strong: #7c3651;
  --accent-soft: #f7e9ef;
  --accent-text: #ffffff;
  --gold: #a87a35;
  --gold-soft: #f8efe0;
  --danger: #b3261e;
  --danger-soft: #fbeae8;
  --success: #24683a;
  --success-soft: #e5f3e8;
  --warn: #8a5a00;
  --warn-soft: #fdf1d8;
  --info-soft: #eef1f6;
  --banner-bg: #fff3c4;
  --banner-text: #4a3a00;
  --focus: #1f5fbf;
  --off-a: #f3eeea;
  --off-b: #ebe4df;
  --shadow-sm: 0 1px 2px rgb(60 36 28 / 6%);
  --shadow: 0 1px 2px rgb(60 36 28 / 5%), 0 6px 20px -6px rgb(60 36 28 / 12%);
  --shadow-lg: 0 2px 6px rgb(60 36 28 / 6%), 0 24px 60px -18px rgb(60 36 28 / 30%);
  --radius: 16px;
  --radius-sm: 10px;
  --row-h: 20px;
  /* Colori dei servizi: tonalità --h per appuntamento */
  --svc-bg-s: 72%;
  --svc-bg-l: 95%;
  --svc-bar-s: 48%;
  --svc-bar-l: 52%;
  --svc-ink-s: 52%;
  --svc-ink-l: 27%;
  --font: system-ui, -apple-system, "Segoe UI Variable Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141110;
    --surface: #1d1917;
    --surface-2: #26201d;
    --surface-3: #302825;
    --text: #f3ece8;
    --muted: #b8aaa2;
    --border: #3a312d;
    --grid-line: #2a2320;
    --accent: #e7a1bc;
    --accent-strong: #f3bdd0;
    --accent-soft: #3b2430;
    --accent-text: #2a1019;
    --gold: #e0b56e;
    --gold-soft: #3a2e1b;
    --danger: #ff8a80;
    --danger-soft: #3d1f1d;
    --success: #8fd6a3;
    --success-soft: #1b3123;
    --warn: #f3c56b;
    --warn-soft: #3a2f14;
    --info-soft: #252a31;
    --banner-bg: #463a0b;
    --banner-text: #fff1bd;
    --focus: #8ab4ff;
    --off-a: #1a1614;
    --off-b: #221c1a;
    --shadow-sm: 0 1px 2px rgb(0 0 0 / 30%);
    --shadow: 0 1px 2px rgb(0 0 0 / 30%), 0 8px 24px -8px rgb(0 0 0 / 50%);
    --shadow-lg: 0 2px 6px rgb(0 0 0 / 35%), 0 24px 60px -18px rgb(0 0 0 / 70%);
    --svc-bg-s: 26%;
    --svc-bg-l: 21%;
    --svc-bar-s: 58%;
    --svc-bar-l: 66%;
    --svc-ink-s: 70%;
    --svc-ink-l: 84%;
    color-scheme: dark;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.45;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

[hidden] {
  display: none !important;
}

h1, h2, h3, h4 {
  margin: 0;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.eyebrow {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.display {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.7rem, 1.2rem + 1.6vw, 2.4rem);
  letter-spacing: -0.015em;
  line-height: 1.1;
}
.display-sm { font-size: clamp(1.45rem, 1.1rem + 1vw, 1.9rem); }

.ico {
  display: inline-flex;
  width: 1.1em;
  height: 1.1em;
  flex: none;
}
.ico svg { width: 100%; height: 100%; }

/* ---------- Banner demo ---------- */
.demo-banner {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--banner-bg);
  color: var(--banner-text);
  padding: 8px 16px;
  font-size: 0.86rem;
  text-align: center;
  border-bottom: 1px solid rgb(0 0 0 / 8%);
}
.demo-banner strong {
  letter-spacing: 0.08em;
}

/* ---------- Bottoni ---------- */
.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.18s var(--ease), border-color 0.18s var(--ease), box-shadow 0.18s var(--ease), transform 0.18s var(--ease);
  white-space: nowrap;
}
.btn:hover:not(:disabled) { background: var(--surface-2); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
  box-shadow: 0 1px 2px rgb(124 54 81 / 25%), 0 6px 16px -8px rgb(124 54 81 / 60%);
}
.btn-primary:hover:not(:disabled) { background: var(--accent-strong); border-color: var(--accent-strong); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-icon { min-width: 40px; padding: 8px; font-size: 1.3rem; line-height: 1; }
.btn-block { width: 100%; }
.btn-lg { min-height: 48px; font-size: 1rem; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { filter: brightness(0.92); background: var(--danger); }
.btn-danger-ghost { color: var(--danger); border-color: var(--danger); background: transparent; }
.btn-danger-ghost:hover:not(:disabled) { background: var(--danger-soft); }
@media (prefers-color-scheme: dark) {
  .btn-danger { color: #2a0c0a; }
  .btn-primary { box-shadow: none; }
}
.btn-live, #btn-new { gap: 5px; }
.btn-live {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
  color: var(--accent-strong);
  background: var(--accent-soft);
}
.btn-live:hover:not(:disabled) { background: color-mix(in srgb, var(--accent-soft) 70%, var(--accent) 12%); }
.btn-live[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #e5484d;
  box-shadow: 0 0 0 0 rgb(229 72 77 / 60%);
  animation: live 1.8s infinite;
}
@keyframes live {
  0% { box-shadow: 0 0 0 0 rgb(229 72 77 / 55%); }
  70% { box-shadow: 0 0 0 7px rgb(229 72 77 / 0%); }
  100% { box-shadow: 0 0 0 0 rgb(229 72 77 / 0%); }
}

/* ---------- Accesso ---------- */
.login {
  display: grid;
  place-items: center;
  padding: 40px 16px;
  min-height: calc(100vh - 60px);
  background:
    radial-gradient(1200px 500px at 15% -10%, var(--accent-soft), transparent 60%),
    radial-gradient(900px 500px at 110% 110%, var(--gold-soft), transparent 60%);
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.login-card {
  width: 100%;
  max-width: 420px;
  padding: 32px 28px;
  display: grid;
  gap: 16px;
  box-shadow: var(--shadow-lg);
}
.login-card > p { margin: 0; }
.login-mark {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, #b9627f, #7c3651);
}
.brand {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.brand span { color: var(--accent); }
.brand { display: inline-flex; align-items: flex-start; gap: 0.08em; }
.brand-star { width: 0.5em; height: 0.5em; margin-top: 0.05em; fill: var(--gold); flex: none; }
.login-star { width: 26px; height: 26px; fill: currentColor; }
.brand-sm { font-size: 1.15rem; }
.brand-xs { font-size: 0.75rem; font-weight: 700; letter-spacing: 0; }

/* ---------- Campi ---------- */
.field {
  display: grid;
  gap: 6px;
  min-width: 0;
}
.field > span {
  font-size: 0.875rem;
  font-weight: 600;
}
.field em { font-style: normal; font-weight: 400; }
input, select {
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  min-height: 44px;
  padding: 8px 12px;
  width: 100%;
  min-width: 0;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:hover, select:hover { border-color: color-mix(in srgb, var(--border) 60%, var(--muted)); }
input:focus-visible, select:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 0;
  border-color: var(--focus);
}
.row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

/* ---------- Avvisi ---------- */
.alert {
  margin: 0;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.925rem;
  background: var(--info-soft);
}
.alert-error { background: var(--danger-soft); color: var(--danger); }
.alert-success { background: var(--success-soft); color: var(--success); font-weight: 550; }
.alert-info { background: var(--info-soft); color: var(--muted); }

/* ---------- Barra superiore ---------- */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px 16px;
  padding: 12px 28px;
  background: var(--surface);
  flex-wrap: wrap;
}
.topbar-left, .topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.topbar-right { gap: 8px; }
.tenant-mark {
  flex: none;
  width: 42px;
  height: 42px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, #c27390, #7c3651);
  box-shadow: 0 6px 16px -8px rgb(124 54 81 / 70%);
}
.tenant { display: grid; min-width: 0; }
.tenant-name {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tenant-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.78rem;
}
.tenant-label {
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tenant-label:empty { display: none; }
.pill-demo {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--banner-text);
  background: var(--banner-bg);
  border-radius: 999px;
  padding: 1px 8px;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 18px 28px 0;
  flex-wrap: wrap;
}
.nav-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.date-input { width: auto; min-height: 40px; }
.updated-at {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.seg {
  display: inline-flex;
  background: var(--surface-2);
  border-radius: 999px;
  padding: 3px;
  border: 1px solid var(--border);
}
.seg-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 600;
  font-size: 0.92rem;
  padding: 6px 16px;
  min-height: 34px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.18s var(--ease), color 0.18s var(--ease);
}
.seg-btn:hover { color: var(--text); }
.seg-btn[aria-pressed="true"] {
  background: var(--surface);
  color: var(--accent-strong);
  box-shadow: 0 1px 3px rgb(0 0 0 / 12%);
}

.period-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px 16px;
  flex-wrap: wrap;
  padding: 16px 28px 10px;
}
.period-title {
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 600;
}
.drag-hint { margin: 0; }
#agenda-status { margin: 0 28px 10px; }

.agenda {
  padding: 0 28px 48px;
}
.closed-note {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--muted);
  font-weight: 550;
}
.closed-note-sm { font-size: 0.9rem; }

/* ---------- Avatar ---------- */
.avatar {
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: hsl(var(--h) var(--svc-ink-s) var(--svc-ink-l));
  background: hsl(var(--h) var(--svc-bg-s) calc(var(--svc-bg-l) - 6%));
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px hsl(var(--h) var(--svc-bar-s) var(--svc-bar-l) / 45%);
}
.avatar-sm { width: 28px; height: 28px; font-size: 0.7rem; }
.avatar-xs { width: 22px; height: 22px; font-size: 0.6rem; box-shadow: none; }

/* ---------- Vista giorno: griglia ---------- */
.day-grid {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: clip;
}
.grid-head {
  position: sticky;
  top: var(--banner-h, 40px);
  z-index: 6;
  display: grid;
  grid-template-columns: 56px repeat(var(--cols), minmax(0, 1fr));
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(8px);
}
.grid-op {
  padding: 10px 12px;
  font-weight: 650;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  border-left: 1px solid var(--border);
}
.grid-op-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.grid-op.is-off .grid-op-name { color: var(--muted); }
.grid-op-count, .chip-count {
  font-size: 0.72rem;
  font-weight: 700;
  background: var(--accent-soft);
  color: var(--accent-strong);
  border-radius: 999px;
  padding: 1px 8px;
  margin-left: auto;
}
.grid-op-closed {
  margin-left: auto;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 1px 8px;
}
.grid-scroll { position: relative; }
.grid-body {
  position: relative;
  display: grid;
  grid-template-columns: 56px repeat(var(--cols), minmax(0, 1fr));
  height: calc(var(--rows) * var(--row-h));
  background-image: repeating-linear-gradient(
    to bottom,
    var(--border) 0 1px,
    transparent 1px calc(var(--row-h) * 4)
  ),
  repeating-linear-gradient(
    to bottom,
    var(--grid-line) 0 1px,
    transparent 1px calc(var(--row-h) * 2)
  );
}
.grid-times { position: relative; }
.grid-time {
  position: absolute;
  top: calc(var(--r) * var(--row-h));
  right: 10px;
  transform: translateY(-1px);
  font-size: 0.72rem;
  font-weight: 550;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  padding-top: 3px;
}
.grid-col {
  position: relative;
  border-left: 1px solid var(--border);
  min-width: 0;
  transition: background 0.15s;
}
.grid-col.is-drop-target { background: color-mix(in srgb, var(--accent-soft) 55%, transparent); }

/* Ore non lavorative e assenze */
.off {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(var(--top) * var(--row-h));
  height: calc(var(--span) * var(--row-h));
  background: repeating-linear-gradient(135deg, var(--off-a) 0 7px, var(--off-b) 7px 14px);
  opacity: 0.85;
  pointer-events: none;
}
.off > span {
  position: sticky;
  top: 8px;
  display: block;
  text-align: center;
  padding-top: 10px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.off-closed > span { padding-top: 40px; font-size: 0.85rem; }
.off-timeoff {
  background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--gold-soft) 80%, transparent) 0 7px, transparent 7px 14px);
  border-top: 1px dashed color-mix(in srgb, var(--gold) 50%, transparent);
  border-bottom: 1px dashed color-mix(in srgb, var(--gold) 50%, transparent);
  opacity: 1;
}
.off-timeoff > span { color: var(--gold); text-transform: none; letter-spacing: 0; }

.appt {
  --c-bg: hsl(var(--h, 330) var(--svc-bg-s) var(--svc-bg-l));
  --c-bar: hsl(var(--h, 330) var(--svc-bar-s) var(--svc-bar-l));
  --c-ink: hsl(var(--h, 330) var(--svc-ink-s) var(--svc-ink-l));
  position: absolute;
  left: 4px;
  right: 4px;
  top: calc(var(--top) * var(--row-h) + 1px);
  height: calc(var(--span) * var(--row-h) - 2px);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 1px;
  padding: 5px 8px 4px 10px;
  text-align: left;
  background: var(--c-bg);
  border: 1px solid hsl(var(--h, 330) var(--svc-bar-s) var(--svc-bar-l) / 22%);
  border-left: 4px solid var(--c-bar);
  border-radius: 9px;
  color: var(--text);
  font: inherit;
  font-size: 0.8rem;
  line-height: 1.25;
  overflow: hidden;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.18s var(--ease), transform 0.18s var(--ease), top 0.12s var(--ease);
}
.appt:hover { box-shadow: 0 4px 14px -4px hsl(var(--h, 330) 40% 30% / 30%); transform: translateY(-1px); }
.appt.is-dragging {
  z-index: 20;
  cursor: grabbing;
  transform: scale(1.02);
  box-shadow: var(--shadow-lg);
  transition: none;
  opacity: 0.95;
}
.appt.is-saving { opacity: 0.7; }
.appt.is-saving::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--c-bar), transparent);
  animation: saving 1s linear infinite;
}
@keyframes saving {
  from { transform: translateX(-100%); }
  to { transform: translateX(100%); }
}
.is-drag-active .appt:not(.is-dragging) { pointer-events: none; }
.appt-short { flex-direction: row; flex-wrap: wrap; align-items: center; column-gap: 8px; padding-top: 2px; padding-bottom: 2px; }
.appt-short .appt-svc { display: none; }
.appt-mid { padding-top: 3px; padding-bottom: 2px; gap: 0; line-height: 1.2; }
.appt-time {
  display: flex;
  align-items: center;
  gap: 5px;
  font-weight: 700;
  font-size: 0.74rem;
  font-variant-numeric: tabular-nums;
  color: var(--c-ink);
  min-width: 0;
}
.appt-time-txt { white-space: nowrap; }
.appt-time .badge-ch { margin-left: auto; }
.appt-short .appt-time .badge-ch { margin-left: 0; }
.appt-cust {
  font-weight: 650;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}
.appt-svc {
  color: color-mix(in srgb, var(--c-ink, var(--muted)) 70%, var(--muted));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.appt-ok {
  display: inline-grid;
  place-items: center;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--success);
  color: var(--surface);
  flex: none;
}
.appt-ok .ico { width: 11px; height: 11px; }
.appt-ok svg { stroke-width: 3; }

/* Appuntamento appena creato / spostato */
.appt-flash { animation: flash-in 0.6s var(--ease) both, flash-ring 1.4s 0.5s ease-out 3; z-index: 4; }
@keyframes flash-in {
  from { opacity: 0; transform: scale(0.85); }
  to { opacity: 1; transform: scale(1); }
}
@keyframes flash-ring {
  0% { box-shadow: 0 0 0 0 hsl(var(--h, 330) 70% 55% / 60%); }
  100% { box-shadow: 0 0 0 14px hsl(var(--h, 330) 70% 55% / 0%); }
}

.now-line {
  position: absolute;
  left: 50px;
  right: 0;
  top: calc(var(--top) * var(--row-h));
  height: 2px;
  background: #e5484d;
  pointer-events: none;
  z-index: 5;
}
.now-line::before {
  content: "";
  position: absolute;
  left: 0;
  top: -4px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #e5484d;
}
.now-label {
  position: absolute;
  left: -48px;
  top: -9px;
  font-size: 0.68rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #fff;
  background: #e5484d;
  border-radius: 999px;
  padding: 1px 6px;
}

/* Badge */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  padding: 1px 7px;
  border-radius: 999px;
  border: 1px solid currentColor;
  color: var(--muted);
  background: var(--surface);
  line-height: 1.45;
  white-space: nowrap;
}
.badge .ico { width: 12px; height: 12px; }
.badge-ch { text-transform: none; letter-spacing: 0; font-size: 0.72rem; border-color: color-mix(in srgb, currentColor 35%, transparent); }
.badge-compact { padding: 2px; border-radius: 50%; background: color-mix(in srgb, var(--surface) 80%, transparent); }
.badge-compact .ico { width: 11px; height: 11px; }
.badge-panel { color: var(--accent-strong); }
.badge-whatsapp { color: var(--success); }
.badge-phone { color: var(--focus); }
.badge-simulated { color: var(--warn); }
.badge-sim { color: var(--banner-text); background: var(--banner-bg); }

/* ---------- Vista giorno: mobile ---------- */
.day-mobile { display: none; }
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.chip {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 4px 12px 4px 6px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.chip.is-off { color: var(--muted); }
.chip .chip-count { margin-left: 0; }
.chip[aria-selected="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
}
.chip[aria-selected="true"] .chip-count { background: rgb(255 255 255 / 25%); color: inherit; }

.appt-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}
.appt-row {
  --c-bar: hsl(var(--h, 330) var(--svc-bar-s) var(--svc-bar-l));
  --c-ink: hsl(var(--h, 330) var(--svc-ink-s) var(--svc-ink-l));
  appearance: none;
  width: 100%;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--c-bar);
  border-radius: 12px;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: background 0.15s;
}
.appt-row:hover { background: var(--surface-2); }
.appt-row-time {
  display: grid;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--c-ink);
}
.appt-row-time small { font-weight: 500; color: var(--muted); }
.appt-row-main { display: grid; min-width: 0; }
.appt-row .appt-svc { color: var(--muted); }

.empty {
  margin: 0;
  padding: 28px 16px;
  text-align: center;
  color: var(--muted);
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}
.empty-sm { padding: 14px; font-size: 0.9rem; }

/* ---------- Vista settimana ---------- */
.week { display: grid; gap: 12px; }
.week-day {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  box-shadow: var(--shadow-sm);
}
.week-day.is-today { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), var(--shadow); }
.week-day.is-closed { background: repeating-linear-gradient(135deg, var(--off-a) 0 7px, var(--surface) 7px 14px); }
.week-day-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.week-day .empty { border: 0; background: transparent; text-align: left; padding: 0; }
.week-groups {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px 16px;
}
.week-group h4 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 8px;
}
.linklike {
  appearance: none;
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  font-weight: 650;
  font-size: 1.05rem;
  color: var(--text);
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: var(--border);
  text-underline-offset: 4px;
}
.linklike:hover { text-decoration-color: var(--accent); }

/* ---------- Dialoghi ---------- */
.dialog {
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--surface);
  color: var(--text);
  width: min(620px, calc(100vw - 24px));
  max-height: calc(100dvh - 24px);
  box-shadow: var(--shadow-lg);
}
.dialog[open] { animation: dlg-in 0.22s var(--ease); }
@keyframes dlg-in {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to { opacity: 1; transform: none; }
}
.dialog-sm { width: min(440px, calc(100vw - 24px)); }
.dialog::backdrop { background: rgb(30 20 20 / 45%); backdrop-filter: blur(2px); }
.dialog-body {
  padding: 22px 26px 26px;
  display: grid;
  gap: 16px;
}
.dialog-body > p { margin: 0; }
.dialog-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.dialog-head h2, .dialog-sm h2 { font-family: var(--font-display); font-size: 1.35rem; font-weight: 600; }
.dialog-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}
.dialog-foot-sticky {
  position: sticky;
  bottom: 0;
  margin: 0 -26px -26px;
  padding: 12px 26px 24px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  z-index: 2;
}

.step {
  border: 0;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 12px;
  min-width: 0;
}
.step:disabled { opacity: 0.55; }
.step legend {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 650;
  padding: 0;
  margin-bottom: 10px;
}
.step-n {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 0.8rem;
  font-weight: 700;
}
.service-info { margin: -4px 0 0; min-height: 1.2em; }

.slots { min-height: 40px; }
.slots > p { margin: 0; }
.slot-groups { display: grid; gap: 12px; }
.slots > p.slot-found { margin: 0 0 10px; font-size: 0.92rem; }
.slot-daynav { display: flex; justify-content: space-between; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.slot-group h4 {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 6px;
}
.slot-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.slot-cell { display: contents; }
.slot-cell-multi {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 4px 6px 4px 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
}
.slot-cell-time {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  margin-right: 2px;
}
.slot {
  appearance: none;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 72px;
  min-height: 40px;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.slot small { font-weight: 400; font-size: 0.72rem; color: var(--muted); }
.slot:hover { border-color: var(--accent); }
.slot[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
}
.slot[aria-pressed="true"] small { color: inherit; }

.summary {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  border: 1px solid var(--accent);
}

.detail-list {
  margin: 0;
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 10px 18px;
}
.detail-list dt { color: var(--muted); font-size: 0.9rem; }
.detail-list dd { margin: 0; font-weight: 550; overflow-wrap: anywhere; }
.svc-inline, .op-inline { display: inline-flex; align-items: center; gap: 8px; }
.svc-dot { width: 10px; height: 10px; border-radius: 50%; background: hsl(var(--h) var(--svc-bar-s) var(--svc-bar-l)); flex: none; }

.move-panel {
  display: grid;
  gap: 12px;
  border-top: 1px solid var(--border);
  padding-top: 16px;
}
.move-panel h3 { font-size: 1rem; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--text);
  color: var(--bg);
  padding: 12px 20px 12px 14px;
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
  max-width: calc(100vw - 32px);
  width: max-content;
}
.toast-in { animation: toast-in 0.35s var(--ease); }
@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, 12px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}
.toast-text { display: grid; gap: 1px; min-width: 0; }
.toast-text strong { font-weight: 650; }
.toast-sub { font-size: 0.86rem; opacity: 0.8; }
.toast-ico {
  flex: none;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--bg) 18%, transparent);
}
.toast-accent .toast-ico { background: var(--accent); color: var(--accent-text); }
.toast-error .toast-ico { background: var(--danger); color: #fff; }

/* ---------- Ruolo, filtro cancellati ---------- */
.role-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0 8px;
  white-space: nowrap;
}
.toolbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  font-size: 0.9rem;
  font-weight: 550;
  cursor: pointer;
  user-select: none;
}
.toggle input {
  appearance: none;
  flex: none;
  width: 36px;
  min-width: 0;
  height: 20px;
  min-height: 0;
  margin: 0;
  padding: 0;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  position: relative;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.toggle input::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform 0.15s;
}
.toggle input:checked { background: var(--accent); border-color: var(--accent); }
.toggle input:checked::after { transform: translateX(16px); background: var(--accent-text); }
.toggle input:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

/* Appuntamenti cancellati */
.appt-cancelled {
  z-index: 0;
  background: color-mix(in srgb, var(--surface) 70%, transparent);
  border: 1px dashed var(--muted);
  border-left: 4px solid var(--border);
  color: var(--muted);
  opacity: 0.8;
  box-shadow: none;
}
.appt-cancelled .appt-time { color: var(--muted); }
.appt-cancelled .appt-cust { text-decoration: line-through; }
.appt:not(.appt-cancelled) { z-index: 1; }
.appt.appt-flash { z-index: 4; }
/* Cancellato sovrapposto a un prenotato: striscia stretta a destra, il prenotato si restringe. */
.appt-strip {
  left: auto;
  width: calc(26% - 6px);
  padding: 3px 4px;
  border-left-width: 1px;
}
.appt-strip .appt-time .badge, .appt-strip .appt-svc { display: none; }
.appt-squeezed { right: 26%; }

.appt-row-cancelled {
  background: transparent;
  border-style: dashed;
  border-left: 4px solid var(--border);
  color: var(--muted);
  box-shadow: none;
}
.appt-row-cancelled .appt-row-time { color: var(--muted); }
.appt-row-cancelled .appt-cust { text-decoration: line-through; }
.appt-row.appt-flash { animation: flash-ring 1.4s ease-out 3; }
.badge-cancelled { color: var(--danger); }
.badge-booked { color: var(--success); }

/* Telefono */
.tel-link { color: var(--accent-strong); font-variant-numeric: tabular-nums; }
.phone-masked {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
}
.phone-value { font-variant-numeric: tabular-nums; }
.btn-sm { min-height: 32px; padding: 4px 12px; font-size: 0.85rem; }
.btn-icon.btn-sm { min-width: 32px; padding: 4px; font-size: 1.1rem; }
.phone-note { font-weight: 400; font-size: 0.78rem; }
.phone-error { color: var(--danger); font-weight: 400; flex-basis: 100%; }
#detail-actions .detail-history { margin-right: auto; }

/* Storico cliente */
.history { display: grid; gap: 10px; border-top: 1px solid var(--border); padding-top: 16px; }
.history h3 { font-size: 1rem; }
.history-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.history-item {
  display: grid;
  grid-template-columns: minmax(0, 11em) minmax(0, 1fr);
  gap: 4px 14px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: 12px;
}
.history-when { display: grid; font-weight: 650; font-variant-numeric: tabular-nums; }
.history-when small { font-weight: 500; color: var(--muted); }
.history-main { display: grid; gap: 4px; min-width: 0; }
.history-svc { overflow-wrap: anywhere; }
.history-badges { display: flex; flex-wrap: wrap; gap: 6px; }
.history-item.is-cancelled { border-style: dashed; border-left: 4px solid var(--border); color: var(--muted); }
.history-item.is-cancelled .history-when, .history-item.is-cancelled .history-svc { text-decoration: line-through; }

/* ---------- Sezioni e stato canali ---------- */
.subbar {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px 16px;
  padding: 0 28px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 6px 16px -14px rgb(60 36 28 / 40%);
  flex-wrap: wrap;
}
.tabs {
  display: flex;
  gap: 2px;
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 46px;
  padding: 8px 14px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s;
}
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { color: var(--accent-strong); border-bottom-color: var(--accent); }
.tab-count {
  font-size: 0.72rem;
  font-weight: 700;
  background: var(--danger);
  color: #fff;
  border-radius: 999px;
  padding: 0 7px;
  line-height: 1.5;
}
.channel-strip {
  list-style: none;
  margin: 0;
  padding: 6px 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  font-size: 0.8rem;
}
.ch-item { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.ch-name { font-weight: 650; }
.ch-state { color: var(--muted); }
.ch-state::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 5px;
  background: var(--border);
  vertical-align: 1px;
}
.ch-state.is-on { color: var(--success); font-weight: 600; }
.ch-state.is-on::before { background: var(--success); }
.ch-state.is-off { color: var(--muted); }
/* Configurato ma non verificato con una prova reale: tono di attenzione, non "verde". */
.ch-state.is-cfg { color: var(--warn); font-weight: 600; }
.ch-state.is-cfg::before { background: var(--warn); }
.ch-state.is-off::before { background: transparent; border: 1.5px solid var(--muted); }

.page { padding: 24px 28px 48px; }
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  display: grid;
  gap: 14px;
  align-content: start;
  min-width: 0;
  box-shadow: var(--shadow);
}
.panel h2 { font-size: 1.05rem; font-weight: 650; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }

/* ---------- Oggi (riepilogo) ---------- */
.hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px 24px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.hero-text { display: grid; gap: 6px; min-width: 0; }
.hero-text p { margin: 0; }
.hero-actions { display: flex; align-items: center; gap: 6px; }
.ribbon {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  margin: 0 0 16px;
  padding: 10px 16px;
  border-radius: 12px;
  background: var(--banner-bg);
  color: var(--banner-text);
  font-size: 0.9rem;
  border: 1px dashed color-mix(in srgb, var(--banner-text) 35%, transparent);
}
.ribbon strong { letter-spacing: 0.08em; text-transform: uppercase; font-size: 0.78rem; }
#dash-status { margin-bottom: 16px; }
.kpis {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}
.kpis[aria-busy="true"] { opacity: 0.6; transition: opacity 0.2s; }
.kpi {
  position: relative;
  display: grid;
  align-content: start;
  gap: 4px;
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  min-width: 0;
  overflow: hidden;
  animation: rise 0.4s var(--ease) both;
}
.kpi:nth-child(2) { animation-delay: 0.04s; }
.kpi:nth-child(3) { animation-delay: 0.08s; }
.kpi:nth-child(4) { animation-delay: 0.12s; }
.kpi:nth-child(5) { animation-delay: 0.16s; }
.kpi:nth-child(6) { animation-delay: 0.2s; }
@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
.kpi-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.kpi-ico {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 11px;
  background: var(--surface-2);
  color: var(--muted);
  flex: none;
}
.kpi-label { font-size: 0.92rem; font-weight: 600; color: var(--muted); letter-spacing: 0; }
.kpi-value {
  margin: 0;
  font-size: clamp(1.9rem, 1.4rem + 1.2vw, 2.5rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.kpi-sub { margin: 0; font-size: 0.86rem; color: var(--muted); }
.kpi-action { justify-self: start; margin-top: 8px; }
.kpi-accent {
  background: linear-gradient(150deg, color-mix(in srgb, var(--accent-soft) 85%, var(--surface)) 0%, var(--surface) 75%);
  border-color: color-mix(in srgb, var(--accent) 30%, var(--border));
}
.kpi-accent .kpi-ico { background: var(--accent); color: var(--accent-text); }
.kpi-accent .kpi-value { color: var(--accent-strong); }
.kpi-warn .kpi-ico { background: var(--warn-soft); color: var(--warn); }
.kpi-warn .kpi-value { color: var(--warn); }

.dash-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
  gap: 16px;
}
.mix-bar {
  display: flex;
  height: 14px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--surface-2);
  gap: 2px;
}
.mix-seg { width: var(--w); min-width: 6px; transition: width 0.6s var(--ease); }
.mix-legend { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 8px; }
.mix-legend li { display: grid; grid-template-columns: auto 1fr auto 3.2em; align-items: center; gap: 10px; font-size: 0.92rem; }
.mix-legend li.is-zero { color: var(--muted); }
.mix-dot { width: 10px; height: 10px; border-radius: 3px; }
.mix-n { font-weight: 700; font-variant-numeric: tabular-nums; }
.mix-p { color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.mix-whatsapp { background: #25a35a; }
.mix-phone { background: #3b7ddd; }
.mix-simulated { background: #d4a43a; }
.mix-panel { background: var(--accent); }

.up-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.up-row {
  appearance: none;
  width: 100%;
  display: grid;
  grid-template-columns: 4.4em minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.up-row:hover { border-color: var(--border); background: var(--surface); }
.up-when { display: grid; font-variant-numeric: tabular-nums; }
.up-when strong { font-size: 1.05rem; }
.up-when small { color: var(--muted); font-size: 0.75rem; }
.up-main { display: grid; min-width: 0; }
.up-cust { font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.up-svc { color: var(--muted); font-size: 0.88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash-usage { margin: 16px 2px 0; }

/* ---------- Demo dal vivo ---------- */
.demo-page { padding-top: 20px; }
.demo-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 14px 24px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.demo-intro { display: grid; gap: 4px; max-width: 46ch; }
.demo-intro p { margin: 0; }
.demo-scenarios { display: flex; flex-wrap: wrap; gap: 10px; }
.scenario {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px 8px 8px;
  min-height: 52px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform 0.18s var(--ease), box-shadow 0.18s var(--ease), border-color 0.18s;
}
.scenario:hover:not(:disabled) { transform: translateY(-2px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); }
.scenario[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), var(--shadow); }
.scenario:disabled { opacity: 0.55; cursor: progress; }
.scenario-txt { display: grid; line-height: 1.2; }
.scenario-txt strong { font-size: 0.93rem; }
.scenario-txt small { font-size: 0.74rem; color: var(--muted); }
.scenario-ico {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 12px;
  color: #fff;
  flex: none;
}
.scenario-ico .ico { width: 20px; height: 20px; }
.sc-wa { background: linear-gradient(135deg, #2bc46a, #128c4b); }
.sc-ph { background: linear-gradient(135deg, #5b8ff0, #2c5fc4); }
.sc-mv { background: linear-gradient(135deg, #c27390, #7c3651); }
.sc-ai { background: linear-gradient(135deg, #e0b56e, #a87a35); }

.demo-stage {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 28px;
  align-items: start;
  --stage-h: clamp(440px, calc(100dvh - 282px), 700px);
}
.phone-col { display: grid; gap: 10px; justify-items: center; }
.demo-label {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 340px;
  margin: 0;
  padding: 7px 12px;
  border-radius: 12px;
  font-size: 0.78rem;
  font-weight: 650;
  line-height: 1.3;
  background: var(--banner-bg);
  color: var(--banner-text);
  border: 1px dashed color-mix(in srgb, var(--banner-text) 40%, transparent);
}
.demo-label .ico { width: 16px; height: 16px; }
.demo-skip { position: absolute; z-index: 5; left: 50%; bottom: 96px; translate: -50% 0; box-shadow: var(--shadow); opacity: 0.92; }

.phone {
  position: relative;
  width: 330px;
  height: calc(var(--stage-h) - 52px);
  padding: 11px;
  border-radius: 48px;
  background: linear-gradient(160deg, #2d2a2b, #121011);
  box-shadow:
    0 0 0 1px #4a4546 inset,
    0 0 0 3px #1b1819,
    0 30px 60px -20px rgb(60 30 40 / 55%),
    0 12px 24px -12px rgb(0 0 0 / 40%);
  color: #111b21;
}
.phone-bar {
  position: absolute;
  z-index: 3;
  top: 11px;
  left: 11px;
  right: 11px;
  height: 40px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 26px;
  font-size: 0.8rem;
  font-weight: 650;
  color: #fff;
  pointer-events: none;
}
.phone[data-mode="idle"] .phone-bar, .phone[data-mode^="call"] .phone-bar { color: #fff; }
.phone-island {
  position: absolute;
  left: 50%;
  top: 9px;
  width: 92px;
  height: 24px;
  transform: translateX(-50%);
  border-radius: 999px;
  background: #000;
}
.phone-sig { display: inline-flex; align-items: flex-end; gap: 2px; height: 11px; }
.phone-sig i { width: 3px; background: currentColor; border-radius: 1px; }
.phone-sig i:nth-child(1) { height: 4px; }
.phone-sig i:nth-child(2) { height: 6px; }
.phone-sig i:nth-child(3) { height: 8px; }
.phone-sig i:nth-child(4) { height: 11px; }
.phone-screen {
  position: relative;
  height: 100%;
  border-radius: 38px;
  overflow: hidden;
  background: #f0ebe4;
  display: flex;
  flex-direction: column;
}

/* Schermata di blocco */
.lock {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 70px 16px 24px;
  color: #fff;
  background:
    radial-gradient(120% 80% at 20% 10%, #d891ab 0%, transparent 55%),
    radial-gradient(120% 90% at 90% 90%, #e2b98a 0%, transparent 55%),
    linear-gradient(170deg, #6d3550, #3a2235);
  text-align: center;
}
.lock p { margin: 0; }
.lock-time { font-size: 4rem; font-weight: 300; letter-spacing: -0.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.lock-date { margin-top: 6px !important; font-weight: 550; opacity: 0.9; }
.lock-card {
  margin-top: auto;
  display: flex;
  gap: 10px;
  align-items: center;
  text-align: left;
  padding: 12px;
  width: 100%;
  border-radius: 18px;
  background: rgb(255 255 255 / 22%);
  backdrop-filter: blur(10px);
  font-size: 0.85rem;
}
.lock-card > span:last-child { display: grid; gap: 2px; }
.lock-card small { opacity: 0.9; }
.lock-card-ico {
  flex: none;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  background: #fff;
  color: #7c3651;
  font-weight: 700;
}

/* WhatsApp */
.wa { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.wa-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 46px 12px 10px;
  background: #0b7d5f;
  color: #fff;
}
.wa-back .ico, .wa-tools .ico { width: 20px; height: 20px; }
.wa-tools { margin-left: auto; display: inline-flex; gap: 14px; }
.wa-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #f1c7d6, #c27390);
  color: #5a2139;
  font-weight: 700;
  font-size: 0.85rem;
  flex: none;
}
.wa-who { display: grid; min-width: 0; line-height: 1.2; }
.wa-who strong { font-size: 0.95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wa-status { font-size: 0.75rem; opacity: 0.85; }
.wa-status.is-typing { font-style: italic; opacity: 1; }
.wa-chat {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 10px 16px;
  background-color: #efe7dd;
  background-image: radial-gradient(rgb(120 90 60 / 9%) 1px, transparent 1px);
  background-size: 14px 14px;
  scrollbar-width: thin;
}
.wa-pill {
  align-self: center;
  margin: 2px 0;
  padding: 4px 10px;
  border-radius: 8px;
  background: #fff;
  color: #54656f;
  font-size: 0.72rem;
  text-align: center;
  box-shadow: 0 1px 1px rgb(0 0 0 / 8%);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 92%;
}
.wa-pill .ico { width: 13px; height: 13px; }
.wa-note { background: #fff3c4; color: #4a3a00; font-weight: 600; }
.wa-sys { animation: pop 0.3s var(--ease); }
.wa-sys-ok { background: #d9f2e3; color: #0b5b3c; font-weight: 600; }
.wa-sys-warn { background: #fde8e6; color: #8a1c14; font-weight: 600; }
.wa-msg {
  position: relative;
  max-width: 82%;
  padding: 6px 9px 4px;
  border-radius: 10px;
  font-size: 0.86rem;
  line-height: 1.35;
  box-shadow: 0 1px 1px rgb(0 0 0 / 10%);
  display: grid;
  gap: 2px;
  overflow-wrap: anywhere;
  animation: pop 0.28s var(--ease);
  color: #111b21;
}
@keyframes pop {
  from { opacity: 0; transform: translateY(6px) scale(0.97); }
  to { opacity: 1; transform: none; }
}
.wa-in { align-self: flex-start; background: #fff; border-top-left-radius: 3px; }
.wa-out { align-self: flex-end; background: #d9fdd3; border-top-right-radius: 3px; }
.wa-ai { display: inline-flex; align-items: center; gap: 4px; font-size: 0.68rem; font-weight: 700; color: #a8456b; }
.wa-ai .ico { width: 11px; height: 11px; }
.wa-meta { justify-self: end; display: inline-flex; align-items: center; gap: 3px; font-size: 0.66rem; color: #667781; font-variant-numeric: tabular-nums; }
.wa-ticks { display: inline-flex; color: #53bdeb; }
.wa-ticks .ico { width: 12px; height: 12px; }
.wa-ticks .ico + .ico { margin-left: -7px; }
.wa-typing { padding: 10px 14px; }
.dots { display: inline-flex; gap: 4px; }
.dots i { width: 7px; height: 7px; border-radius: 50%; background: #8696a0; animation: dot 1.2s infinite ease-in-out; }
.dots i:nth-child(2) { animation-delay: 0.15s; }
.dots i:nth-child(3) { animation-delay: 0.3s; }
@keyframes dot {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30% { transform: translateY(-4px); opacity: 1; }
}
.wa-composer {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 8px 18px;
  background: #efe7dd;
  margin: 0;
}
.wa-emoji {
  display: grid;
  place-items: center;
  color: #54656f;
}
.wa-emoji .ico { width: 20px; height: 20px; }
.wa-input {
  flex: 1;
  min-width: 0;
  min-height: 38px;
  padding: 8px 14px;
  border-radius: 999px;
  background: #fff;
  border: 0;
  font-size: 0.88rem;
  color: #111b21;
  display: flex;
  align-items: center;
  overflow: hidden;
  white-space: nowrap;
}
input.wa-input:focus-visible { outline: 2px solid #0b7d5f; }
.wa-placeholder { color: #8696a0; }
.wa-typed { overflow: hidden; text-overflow: ellipsis; direction: ltr; }
.caret { width: 2px; height: 1.1em; background: #0b7d5f; margin-left: 1px; animation: caret 0.9s steps(1) infinite; flex: none; }
@keyframes caret { 50% { opacity: 0; } }
.wa-send {
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 0;
  display: grid;
  place-items: center;
  background: #0b7d5f;
  color: #fff;
  cursor: pointer;
}
.wa-send:disabled { cursor: default; }
.wa-send .ico { width: 18px; height: 18px; }

/* Chiamata */
.call {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 46px 14px 16px;
  color: #fff;
  background:
    radial-gradient(120% 60% at 50% 0%, rgb(216 145 171 / 45%), transparent 60%),
    linear-gradient(175deg, #2c2033, #1a1420 70%);
}
.call p { margin: 0; }
.call-top { display: flex; justify-content: space-between; align-items: center; font-size: 0.8rem; font-variant-numeric: tabular-nums; }
.call-state { display: inline-flex; align-items: center; gap: 6px; font-weight: 650; padding: 3px 10px; border-radius: 999px; background: rgb(46 204 113 / 18%); color: #8ff0b4; }
.call-dot { width: 8px; height: 8px; border-radius: 50%; background: #2ecc71; animation: call-pulse 1.4s infinite; }
.call-dot.is-off { background: #e5484d; animation: none; }
.phone[data-mode="call-ended"] .call-state { background: rgb(229 72 77 / 18%); color: #ffb3b5; }
@keyframes call-pulse {
  0% { box-shadow: 0 0 0 0 rgb(46 204 113 / 70%); }
  70% { box-shadow: 0 0 0 8px rgb(46 204 113 / 0%); }
  100% { box-shadow: 0 0 0 0 rgb(46 204 113 / 0%); }
}
.call-timer { opacity: 0.8; }
.call-id { display: grid; justify-items: center; gap: 2px; text-align: center; margin-top: 4px; }
.call-id strong { font-size: 1.1rem; font-weight: 600; }
.call-id small { opacity: 0.75; font-size: 0.78rem; }
.call-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  margin-bottom: 4px;
  font-size: 1.05rem;
  font-weight: 700;
  color: #5a2139;
  background: linear-gradient(135deg, #f1c7d6, #c27390);
  animation: ring 2s infinite;
}
.phone[data-mode="call-ended"] .call-avatar { animation: none; filter: grayscale(0.4); }
@keyframes ring {
  0% { box-shadow: 0 0 0 0 rgb(241 199 214 / 45%), 0 0 0 0 rgb(241 199 214 / 25%); }
  100% { box-shadow: 0 0 0 14px rgb(241 199 214 / 0%), 0 0 0 28px rgb(241 199 214 / 0%); }
}
.call-note {
  display: flex;
  align-items: center;
  gap: 6px;
  align-self: center;
  max-width: 100%;
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 0.68rem;
  font-weight: 650;
  background: #fff3c4;
  color: #4a3a00;
}
.call-note .ico { width: 12px; height: 12px; }
.call-speaking { min-height: 1.3em; display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 0.78rem; opacity: 0.85; }
.wave { display: inline-flex; align-items: center; gap: 2px; height: 14px; }
.wave i { width: 3px; height: 100%; border-radius: 2px; background: #f1c7d6; animation: wave 0.9s infinite ease-in-out; }
.wave i:nth-child(2) { animation-delay: 0.1s; }
.wave i:nth-child(3) { animation-delay: 0.2s; }
.wave i:nth-child(4) { animation-delay: 0.3s; }
@keyframes wave {
  0%, 100% { transform: scaleY(0.3); }
  50% { transform: scaleY(1); }
}
.call-lines {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-right: 2px;
  scrollbar-width: thin;
}
.call-line {
  display: grid;
  gap: 2px;
  padding: 8px 10px;
  border-radius: 12px;
  font-size: 0.84rem;
  line-height: 1.35;
  background: rgb(255 255 255 / 9%);
  animation: pop 0.28s var(--ease);
}
.call-ai { background: rgb(216 145 171 / 20%); }
.call-who { font-size: 0.66rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; opacity: 0.75; }
.call-sys { display: flex; align-items: center; gap: 6px; align-self: center; text-align: center; font-size: 0.72rem; padding: 4px 10px; border-radius: 8px; background: rgb(255 255 255 / 10%); animation: pop 0.28s var(--ease); }
.call-sys .ico { width: 12px; height: 12px; flex: none; }
.call-sys-ok { background: rgb(46 204 113 / 20%); color: #b8f5cf; }
.call-sys-warn { background: rgb(229 72 77 / 22%); color: #ffd0d1; }
.call-keys { display: flex; justify-content: space-around; padding-top: 4px; }
.call-keys span { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: rgb(255 255 255 / 14%); }
.call-keys .ico { width: 20px; height: 20px; }
.call-keys .call-end { background: #e5484d; }
.call-keys .call-end .ico { transform: rotate(135deg); }

/* Agenda accanto al telefono */
.demo-agenda {
  min-width: 0;
  height: var(--stage-h);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.demo-agenda-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 14px 18px 12px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.demo-agenda-head h3 { font-family: var(--font-display); font-size: 1.25rem; font-weight: 600; }
.demo-result {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 12px 14px 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--success-soft);
  border: 1px solid color-mix(in srgb, var(--success) 30%, transparent);
  animation: rise 0.4s var(--ease);
}
.demo-result-bar { width: 4px; align-self: stretch; border-radius: 4px; background: hsl(var(--h) var(--svc-bar-s) var(--svc-bar-l)); }
.demo-result-main { display: grid; min-width: 0; flex: 1; }
.demo-result-main strong { color: var(--success); }
.demo-agenda-body { flex: 1; min-height: 0; padding: 12px 14px 14px; display: flex; flex-direction: column; }
.demo-agenda-body .day-grid {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  box-shadow: none;
  border-radius: 12px;
}
.day-grid.is-compact { --row-h: 15px; }
.day-grid.is-compact .grid-head { position: static; }
.day-grid.is-compact .grid-scroll { flex: 1; min-height: 0; overflow-y: auto; scrollbar-width: thin; }
.day-grid.is-compact .appt { font-size: 0.76rem; }
.demo-stage.is-playing .demo-agenda { box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 35%, transparent), var(--shadow); }

/* ---------- Conversazioni ---------- */
.conv-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}
.conv-side { display: grid; gap: 20px; min-width: 0; }
.sim {
  padding: 18px;
  display: grid;
  gap: 12px;
  border: 2px dashed var(--banner-text);
  background: var(--banner-bg);
  color: var(--banner-text);
  min-width: 0;
}
.sim-title { font-size: 1.05rem; letter-spacing: 0.02em; }
.sim-note { margin: 0; color: inherit; opacity: 0.85; }
.sim-form { display: grid; gap: 12px; }
.sim .field > span { color: var(--banner-text); }
textarea {
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  width: 100%;
  min-width: 0;
  resize: vertical;
}
textarea:focus-visible { outline: 3px solid var(--focus); outline-offset: 0; border-color: var(--focus); }
.sim-foot { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.sim-chat { background: var(--surface); color: var(--text); min-height: 120px; }
.sim-empty { margin: auto; text-align: center; }

.thread {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 55dvh;
  overflow-y: auto;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
}
.thread > p { margin: 0; }
.bubble {
  display: grid;
  gap: 2px;
  max-width: 85%;
  padding: 8px 12px;
  border-radius: 14px;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}
.bubble-in { align-self: flex-start; background: var(--surface); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.bubble-out { align-self: flex-end; background: var(--accent-soft); border: 1px solid var(--accent-soft); border-bottom-right-radius: 4px; }
.bubble-system { background: var(--info-soft); border-color: var(--border); }
.bubble-staff { background: var(--success-soft); border-color: var(--success-soft); }
.bubble-who { font-size: 0.72rem; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; }
.bubble-meta { font-size: 0.72rem; color: var(--muted); justify-self: end; }

.req-list, .conv-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.req-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px 12px;
  flex-wrap: wrap;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--danger);
  border-radius: 12px;
}
.req-main { display: grid; gap: 2px; min-width: 0; flex: 1 1 200px; overflow-wrap: anywhere; }
.req-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.conv-row {
  appearance: none;
  width: 100%;
  display: grid;
  gap: 4px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s;
}
.conv-row:hover { background: var(--surface-2); }
.conv-row.needs-human { border-left: 4px solid var(--danger); }
.conv-row-top { display: flex; align-items: center; gap: 8px; min-width: 0; }
.conv-phone { font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-time { margin-left: auto; white-space: nowrap; }
.conv-last { color: var(--muted); font-size: 0.9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }

/* ---------- Messaggi dell'appuntamento ---------- */
.cust-confirm { margin: 0; }
.conf-yes { color: var(--success); }
#detail-msgs > p { margin: 0; }
.msg-st { text-transform: none; letter-spacing: 0; font-size: 0.75rem; }
.msg-item { border-left-color: var(--focus); }
.msg-item.is-muted { border-left-color: var(--border); color: var(--muted); }
.msg-st-simulated { color: var(--banner-text); background: var(--banner-bg); }
.msg-st-sent, .msg-st-delivered, .msg-st-read { color: var(--success); }
.msg-st-failed { color: var(--danger); }
.msg-st-pending, .msg-st-sending { color: var(--focus); }

/* ---------- Promemoria ---------- */
.rem-panel { max-width: 760px; }
.rem-panel > p { margin: 0; }
.rem-list dd { font-weight: 550; }
.rem-contract {
  padding: 10px 14px;
  border: 1px dashed var(--border);
  border-radius: 12px;
  font-size: 0.925rem;
}

/* Messaggi nei dialoghi visibili sopra la barra fissa dei pulsanti */
.dialog .alert { scroll-margin-bottom: 96px; }

/* ---------- Schermi medi ---------- */
@media (max-width: 1099px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1023px) {
  .demo-stage { grid-template-columns: minmax(0, 1fr); --stage-h: auto; }
  .phone { height: 600px; }
  .demo-agenda { height: 620px; }
}
@media (max-width: 899px) {
  .conv-layout { grid-template-columns: minmax(0, 1fr); }
  .dash-grid { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- Schermi stretti ---------- */
@media (max-width: 699px) {
  .topbar { padding: 10px 16px; }
  .tenant-name { font-size: 1.15rem; }
  .tenant-mark { width: 36px; height: 36px; font-size: 1.15rem; border-radius: 11px; }
  .topbar-right { width: 100%; justify-content: space-between; }
  .topbar-right #btn-new { flex: 1; }
  .lbl-long { display: none; }
  .topbar-right .btn { padding: 8px 12px; }
  .up-row .badge-ch { padding: 2px; border-radius: 50%; font-size: 0; gap: 0; }
  .btn-live { padding: 8px 12px; }
  .toolbar { padding: 12px 16px 0; }
  .nav-group { flex: 1 1 100%; }
  .date-input { flex: 1; }
  .seg { width: 100%; }
  .seg-btn { flex: 1; padding: 6px 10px; }
  .period-row { padding: 14px 16px 6px; }
  .period-title { font-size: 1.2rem; }
  .drag-hint { display: none; }
  #agenda-status { margin: 0 16px 8px; }
  .agenda { padding: 0 16px 32px; }
  .day-grid { display: none; }
  .demo-agenda-body .day-grid { display: flex; }
  .day-mobile { display: block; }
  .dialog-body { padding: 16px; }
  .dialog-foot-sticky { margin: 0 -16px -16px; padding: 12px 16px 16px; }
  .dialog-foot .btn { flex: 1; }
  .demo-banner { font-size: 0.78rem; padding: 7px 12px; }
  .toolbar-right { flex: 1 1 100%; }
  .toolbar-right .seg { flex: 1; }
  .history-item { grid-template-columns: minmax(0, 1fr); }
  #detail-actions .detail-history { flex-basis: 100%; margin-right: 0; }
  .subbar { padding: 0 8px; }
  .tabs { width: 100%; }
  .tab { padding: 8px 10px; font-size: 0.9rem; }
  .channel-strip { width: 100%; justify-content: center; padding: 6px 8px 8px; gap: 4px 12px; font-size: 0.76rem; }
  .page { padding: 16px 16px 32px; }
  .hero { margin-bottom: 14px; }
  .hero-actions { width: 100%; }
  .hero-actions .seg { flex: 1; }
  .kpis { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
  .kpi { padding: 14px; }
  .kpi-head { flex-direction: column; align-items: flex-start; gap: 8px; }
  .kpi-label { font-size: 0.84rem; }
  .kpi-sub { font-size: 0.78rem; }
  .up-row { grid-template-columns: 3.8em minmax(0, 1fr) auto; }
  .up-row .avatar { display: none; }
  .sim-foot .btn { flex: 1; }
  .rem-list { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .rem-list dd { margin-bottom: 8px; }
  .bubble { max-width: 92%; }
  .demo-scenarios { width: 100%; }
  .scenario { flex: 1 1 100%; }
  .phone { width: min(330px, 100%); height: 560px; }
  .demo-agenda { height: 560px; }
  .demo-result .avatar { display: none; }
  .demo-agenda .grid-op { padding: 8px 6px; gap: 6px; font-size: 0.85rem; }
  .demo-agenda .grid-op .avatar { display: none; }
  .demo-agenda .grid-body, .demo-agenda .grid-head { grid-template-columns: 44px repeat(var(--cols), minmax(0, 1fr)); }
  .demo-agenda .appt { left: 2px; right: 2px; padding: 3px 4px 3px 6px; }
  .demo-agenda .appt .badge-ch { display: none; }
  .now-line { left: 40px; }
  .now-label { display: none; }
  .toast { bottom: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; }
}

@media (max-height: 820px) and (min-width: 1024px) {
  .call-id small { display: none; }
  .call-avatar { display: none; }
  .call { gap: 8px; }
  .call-id strong { font-size: 1rem; }
  .demo-head { margin-bottom: 12px; }
  .demo-page { padding-top: 16px; }
}

/* Colonna "Altri": appuntamenti di operatori non più attivi */
.grid-op-other .grid-op-name { color: var(--muted); font-style: italic; }
.grid-col-other { background: color-mix(in srgb, var(--surface-2) 55%, transparent); }

/* ---------- Richieste da gestire ---------- */
.btn-req { gap: 6px; color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, var(--border)); }
.btn-req .tab-count { line-height: 1.6; }
.btn-req.is-overdue { background: var(--danger-soft); }
.req-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--danger); }
.req-board { margin-bottom: 20px; }
.req-board-head { display: flex; justify-content: space-between; align-items: center; gap: 10px 16px; flex-wrap: wrap; }
.req-board-title { display: grid; gap: 2px; }
.req-board-title p { margin: 0; }
.req-board-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.seg-count {
  display: inline-block;
  min-width: 1.5em;
  margin-left: 4px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.5;
  text-align: center;
}
.req-alerts-row { display: flex; align-items: center; gap: 4px 12px; flex-wrap: wrap; margin-top: -6px; }
.req-alerts-row p { margin: 0; }
.req-alerts-btn { gap: 6px; padding-left: 8px; color: var(--muted); }
.req-alerts-btn .ico { width: 16px; height: 16px; }
.req-alerts-btn[aria-pressed="true"] { color: var(--success); }
.req-board-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 12px;
  align-items: start;
}
.req-board-list > .req-empty, .req-board-list > .muted { grid-column: 1 / -1; }
.req-card {
  display: grid;
  gap: 10px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--danger);
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
  min-width: 0;
}
.req-card.req-in_progress { border-left-color: var(--focus); }
.req-card.req-done { border-left-color: var(--border); background: var(--surface-2); }
.req-card.is-overdue { border-color: color-mix(in srgb, var(--danger) 45%, var(--border)); border-left-color: var(--danger); background: color-mix(in srgb, var(--danger-soft) 55%, var(--surface)); }
.req-card.req-flash { animation: flash-in 0.6s var(--ease) both, flash-ring 1.4s 0.5s ease-out 3; }
.req-card > p { margin: 0; }
.req-card-top { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.req-ago { margin-left: auto; white-space: nowrap; }
.req-kind { text-transform: none; letter-spacing: 0; font-size: 0.75rem; color: var(--danger); }
.req-kind-provider_error { color: var(--warn); }
.req-kind-modify_by_phone { color: var(--focus); }
.req-st { text-transform: none; letter-spacing: 0; font-size: 0.75rem; }
.req-st-in_progress { color: var(--focus); }
.req-st-done { color: var(--success); }
.req-summary { font-weight: 550; overflow-wrap: anywhere; white-space: pre-line; }
.req-who { display: flex; align-items: center; gap: 6px 12px; flex-wrap: wrap; font-size: 0.92rem; }
.req-cust { font-weight: 650; }
.req-who .tel-link { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; }
.req-who .tel-link .ico { width: 15px; height: 15px; }
.req-callback { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 0.9rem; color: var(--focus); }
.req-callback .ico { width: 16px; height: 16px; }
.req-callback.is-overdue { color: var(--danger); }
.req-late { color: var(--danger); background: var(--surface); }
.req-outcome { display: grid; gap: 2px; font-size: 0.92rem; overflow-wrap: anywhere; }
.req-foot { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px 10px; flex-wrap: wrap; }
.req-assign-field { display: flex; align-items: center; gap: 8px; }
.req-assign-field > span { white-space: nowrap; }
.req-assign { min-height: 34px; padding: 4px 10px; font-size: 0.88rem; width: auto; flex: 1; max-width: 240px; }
.req-card .req-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; align-items: center; }
.req-card .req-open-conv { margin-right: auto; padding-left: 0; color: var(--accent-strong); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: color-mix(in srgb, currentColor 35%, transparent); }
.req-card .req-actions .btn { gap: 5px; }
.req-card .req-actions .ico { width: 15px; height: 15px; }
.req-form { display: grid; gap: 8px; padding: 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); }
.req-form-note { margin: 0; }
.req-form-foot { display: flex; justify-content: flex-end; gap: 6px; flex-wrap: wrap; }
.req-form-foot .btn { gap: 5px; }
.req-form-foot .ico { width: 15px; height: 15px; }
.req-err { font-size: 0.88rem; }

/* ---------- Scheda cliente ---------- */
.cust-form { display: grid; gap: 14px; border-top: 1px solid var(--border); padding-top: 16px; }
.cust-form > p { margin: 0; }
.cust-count { justify-self: end; font-size: 0.78rem; }
.cust-count:empty { display: none; }
.check { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; font-weight: 550; }
.check input { width: 18px; height: 18px; min-height: 0; margin: 2px 0 0; padding: 0; flex: none; accent-color: var(--accent); }
.check span { display: grid; gap: 1px; }
.check small { font-weight: 400; font-size: 0.8rem; }

/* ---------- Suggerimenti clienti (nuovo appuntamento) ---------- */
.cust-search-note { margin: 0; }
.suggest {
  list-style: none;
  margin: -4px 0 0;
  padding: 4px;
  display: grid;
  gap: 2px;
  max-height: 260px;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
}
.suggest-item { display: grid; gap: 1px; padding: 8px 10px; border-radius: 9px; cursor: pointer; }
.suggest-item:hover, .suggest-item[aria-selected="true"] { background: var(--accent-soft); }
.suggest-name { font-weight: 650; }
.suggest-empty { padding: 8px 10px; }
.picked { display: grid; gap: 6px; padding: 10px 12px; border-radius: 12px; background: var(--success-soft); }
.picked p { margin: 0; }
.picked-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.picked-title { display: inline-flex; align-items: center; gap: 6px; color: var(--success); }
.picked-title strong { color: var(--text); }
.picked-title .ico { width: 16px; height: 16px; }
.picked-hint { display: flex; align-items: center; gap: 6px 8px; flex-wrap: wrap; font-size: 0.9rem; font-weight: 600; }
.picked-hint.is-warn { color: var(--warn); }
.picked-notes { overflow-wrap: anywhere; white-space: pre-line; }
input[readonly] { background: var(--surface-2); }

/* ---------- Trascinamento verso operatori non abilitati ---------- */
.grid-col.is-drop-denied { background: repeating-linear-gradient(135deg, transparent 0 8px, color-mix(in srgb, var(--danger-soft) 70%, transparent) 8px 16px); }
.grid-col.is-drop-hover-denied { box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--danger) 55%, transparent); }
.appt.is-denied { opacity: 0.6; cursor: not-allowed; }

/* ---------- Chi fa cosa ---------- */
.rem-panel + .skills-panel { margin-top: 20px; }
.skills-panel { max-width: 760px; }
.skills-panel > p { margin: 0; }
.skills-wrap { overflow-x: auto; }
.skills { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.skills th, .skills td { padding: 8px 10px; border-bottom: 1px solid var(--border); text-align: center; white-space: nowrap; }
.skills thead th { font-size: 0.82rem; font-weight: 650; color: var(--muted); }
.skills tbody th { text-align: left; font-weight: 550; white-space: normal; }
.skills thead th:first-child { text-align: left; }
.skills-op { display: inline-flex; align-items: center; gap: 6px; }
.skills td.is-yes { color: var(--success); }
.skills td.is-yes .ico { width: 18px; height: 18px; }
.skills td.is-no { color: var(--muted); }

@media (max-width: 699px) {
  .req-board-tools, .req-board-tools .seg { width: 100%; }
  .req-board-tools .seg-btn { flex: 1; padding: 6px 8px; }
  .req-board-list { grid-template-columns: minmax(0, 1fr); }
  .req-assign { max-width: none; }
  .req-card .req-actions { width: 100%; }
  .req-card .req-actions .btn { flex: 1; }
  .btn-req { padding: 8px 10px; }
  .skills-op .avatar { display: none; }
}

/* ---------- Conversazione come chat ---------- */
.dialog-chat { width: min(1000px, calc(100vw - 24px)); }
.dialog-chat .dialog-body { gap: 12px; }
.chat-state-row { display: flex; align-items: center; gap: 10px 12px; flex-wrap: wrap; }
.chat-state {
  flex: 1 1 320px;
  margin: 0;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
}
.chat-state .ico { width: 20px; height: 20px; margin-top: 1px; }
.chat-state > span { display: grid; gap: 1px; }
.chat-state small { color: var(--muted); font-size: 0.82rem; }
.chat-state.is-ai { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 25%, var(--border)); }
.chat-state.is-ai .ico, .chat-state.is-ai strong { color: var(--accent-strong); }
.chat-state.is-staff { background: var(--success-soft); border-color: color-mix(in srgb, var(--success) 30%, var(--border)); }
.chat-state.is-staff .ico, .chat-state.is-staff strong { color: var(--success); }
.chat-state-row .btn .ico { width: 16px; height: 16px; }
.chat-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 270px;
  gap: 14px;
  align-items: start;
  min-height: 0;
}
.chat-main { display: grid; gap: 10px; min-width: 0; }
.chat-thread { max-height: min(48dvh, 520px); min-height: 220px; }
.chat-day {
  align-self: center;
  margin: 4px 0;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
}
.bubble-who { display: inline-flex; align-items: center; gap: 4px; }
.bubble-who .ico { width: 12px; height: 12px; }
.bubble-out.bubble-staff {
  background: var(--success-soft);
  border-color: color-mix(in srgb, var(--success) 35%, transparent);
  border-right: 3px solid var(--success);
}
.bubble-staff .bubble-who { color: var(--success); }
.bubble-ai .bubble-who { color: var(--accent-strong); }
.bubble.is-failed { border-color: var(--danger); }
.bubble.is-failed .bubble-meta { color: var(--danger); }
.chat-composer {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}
.chat-composer textarea { min-height: 72px; }
.chat-composer textarea:disabled { background: var(--surface-2); cursor: not-allowed; }
.chat-closed { margin: 0; font-size: 0.88rem; }
.chat-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.chat-foot .btn .ico { width: 16px; height: 16px; }
.chat-quick { display: flex; gap: 6px; flex-wrap: wrap; }
.chat-chip {
  appearance: none;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 4px 11px;
  min-height: 30px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--border));
  background: var(--accent-soft);
  color: var(--accent-strong);
  cursor: pointer;
}
.chat-chip:hover:not(:disabled) { border-color: var(--accent); }
.chat-chip:disabled { opacity: 0.5; cursor: not-allowed; }
.chat-side {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
  min-width: 0;
}
.chat-side > summary {
  padding: 10px 14px;
  font-weight: 650;
  font-size: 0.92rem;
  cursor: pointer;
  list-style-position: inside;
}
.chat-cust { display: grid; gap: 10px; padding: 0 14px 14px; }
.chat-cust > p { margin: 0; }
.chat-cust-name { display: flex; align-items: center; gap: 8px; font-weight: 650; overflow-wrap: anywhere; }
.chat-cust-name .ico { width: 18px; height: 18px; color: var(--muted); }
.chat-cust-list { margin: 0; display: grid; gap: 2px; font-size: 0.88rem; }
.chat-cust-list dt { color: var(--muted); font-size: 0.78rem; font-weight: 600; margin-top: 6px; }
.chat-cust-list dd { margin: 0; overflow-wrap: anywhere; }
.chat-cust-notes { white-space: pre-line; }
.chat-cust-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.chat-cust-actions .ico { width: 15px; height: 15px; }
.badge-window { text-transform: none; letter-spacing: 0; font-size: 0.72rem; }
.badge-window.is-open { color: var(--success); }
.badge-window.is-closed { color: var(--muted); }
.badge-staff { color: var(--success); text-transform: none; letter-spacing: 0; }
.conv-row.is-staff { border-right: 3px solid var(--success); }
.conv-who { display: grid; min-width: 0; line-height: 1.25; }
.conv-name { font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-phone-sub { font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-row .history-badges { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------- Lista d'attesa ---------- */
.wait-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 14px 24px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.wait-head .demo-intro { max-width: 60ch; }
.wait-note { margin: -6px 0 0; }
.wait-opps { margin-bottom: 20px; border-color: color-mix(in srgb, var(--accent) 30%, var(--border)); }
.wait-opps:focus { outline: none; }
.wait-opps.is-flash { animation: flash-ring 1.4s ease-out 2; }
.wait-panel > p, .wait-opps > p { margin: 0; }
.wait-list-head { flex-wrap: wrap; }
.opp-list, .wait-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.wait-list { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); align-items: start; }
.wait-list > .empty, .opp-list > .empty { grid-column: 1 / -1; }
.opp-card {
  display: grid;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: 14px;
  background: var(--surface);
}
.opp-head { display: flex; align-items: flex-start; gap: 10px; }
.opp-ico {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-strong);
  flex: none;
}
.opp-ico .ico { width: 16px; height: 16px; }
.opp-main { display: grid; gap: 1px; min-width: 0; overflow-wrap: anywhere; }
.opp-slots { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.opp-slot { display: inline-grid; justify-items: center; gap: 0; min-width: 0; padding-inline: 12px; }
.opp-more { padding: 0 4px; }
.wait-card {
  display: grid;
  gap: 8px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--gold);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  min-width: 0;
}
.wait-card.wait-booked { border-left-color: var(--success); }
.wait-card.wait-cancelled, .wait-card.wait-expired { border-left-color: var(--border); background: var(--surface-2); color: var(--muted); }
.wait-card > p { margin: 0; }
.wait-card-top { display: flex; align-items: center; gap: 6px 10px; flex-wrap: wrap; }
.wait-cust { font-size: 1rem; }
.wait-phone { margin-left: auto; font-variant-numeric: tabular-nums; }
.wait-svc { font-size: 0.92rem; }
.wait-when { display: flex; align-items: center; gap: 6px; font-size: 0.9rem; font-weight: 550; }
.wait-when .ico { width: 15px; height: 15px; color: var(--muted); }
.wait-notes { overflow-wrap: anywhere; white-space: pre-line; color: var(--muted); }
.wait-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.wait-st { text-transform: none; letter-spacing: 0; font-size: 0.75rem; }
.wait-st-booked { color: var(--success); }
.tab-count-ok { background: var(--accent); color: var(--accent-text); }
.req-kind-waitlist_match { color: var(--accent-strong); }
.req-kind-new_lead { color: var(--accent-strong); }
.slot-wait {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  flex-wrap: wrap;
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px dashed var(--border);
  border-radius: 12px;
}
.slot-wait .btn .ico { width: 15px; height: 15px; }
.slot-wait-link { display: block; margin-top: 4px; font-size: 0.86rem; font-weight: 600; }
#wait-tw { flex-wrap: wrap; }

/* ---------- Riepilogo per il titolare ---------- */
.owner-card { margin-top: 20px; max-width: 760px; }
.owner-card-rem { margin: 0 0 20px; }
.owner-card > p { margin: 0; }
.owner-head { flex-wrap: wrap; }
.owner-date-field { display: inline-flex; align-items: center; gap: 8px; }
.owner-date { min-height: 34px; padding: 4px 10px; }
.owner-chat { flex: none; border-radius: 12px; padding: 12px; max-height: 360px; }
.owner-bubble { max-width: min(92%, 460px); white-space: pre-wrap; }
.owner-stats { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.owner-stat {
  display: grid;
  gap: 0;
  padding: 6px 12px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  min-width: 92px;
}
.owner-stat strong { font-size: 1.1rem; font-variant-numeric: tabular-nums; }
.owner-stat span { font-size: 0.76rem; color: var(--muted); }
.owner-stat.is-warn strong { color: var(--warn); }
.owner-stat.is-ok strong { color: var(--success); }
.owner-status { display: flex; align-items: center; gap: 6px; font-size: 0.9rem; }
.owner-status .ico { width: 16px; height: 16px; color: var(--muted); }
.owner-notes { display: grid; gap: 8px; }
.owner-notes:empty { display: none; }
.owner-notes .alert { margin: 0; font-size: 0.88rem; }
.owner-foot { display: flex; align-items: center; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.owner-result { display: inline-flex; align-items: center; gap: 6px; margin-right: auto; }
.owner-send .ico { width: 17px; height: 17px; }

@media (max-width: 899px) {
  .chat-layout { grid-template-columns: minmax(0, 1fr); }
  .chat-side { order: -1; }
  .chat-thread { max-height: 44dvh; min-height: 160px; }
}
@media (max-width: 699px) {
  .chat-state-row .btn { flex: 1 1 100%; }
  .chat-foot .btn { flex: 1; }
  .wait-head .btn { flex: 1 1 100%; }
  .wait-list { grid-template-columns: minmax(0, 1fr); }
  .wait-list-head .seg { width: 100%; }
  .owner-head .owner-date-field { width: 100%; }
  .owner-date { flex: 1; }
  .owner-stat { flex: 1 1 calc(50% - 8px); min-width: 0; }
  .owner-foot .btn { flex: 1 1 100%; }
}

/* ---------- Note dell'appuntamento ---------- */
#ask-text { white-space: pre-line; }
.appt-note {
  display: inline-grid;
  place-items: center;
  width: 15px;
  height: 15px;
  border-radius: 4px;
  background: var(--gold-soft);
  color: var(--gold);
  flex: none;
}
.appt-note .ico { width: 11px; height: 11px; }
.appt-note svg { stroke-width: 2.4; }
.appt-row .appt-cust { display: inline-flex; align-items: center; gap: 6px; }
.appt-notes { display: grid; gap: 8px; border-top: 1px solid var(--border); padding-top: 14px; }
.appt-notes-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.appt-notes-head h3 { font-size: 1rem; }
.appt-notes-text { margin: 0; white-space: pre-line; overflow-wrap: anywhere; }
.appt-notes-text:empty { display: none; }
.appt-notes-text.is-empty { color: var(--muted); font-size: 0.92rem; }
.appt-notes-form { display: grid; gap: 8px; }
.appt-notes-foot { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.appt-notes-foot small { margin-right: auto; }
.cust-notes-fixed {
  display: grid;
  gap: 2px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--gold-soft);
  border-left: 3px solid var(--gold);
}
.cust-notes-label { display: inline-flex; align-items: center; gap: 6px; font-size: 0.78rem; font-weight: 700; color: var(--gold); text-transform: uppercase; letter-spacing: 0.04em; }
.cust-notes-label .ico { width: 14px; height: 14px; }
.cust-notes-body { white-space: pre-line; overflow-wrap: anywhere; font-size: 0.92rem; }

/* ---------- Impostazioni ---------- */
#sec-set > .panel, #sec-set > .ribbon, #sec-set > .alert { max-width: 1000px; }
.set-hint { margin: 0; }
.set-subtitle { font-size: 0.98rem; margin-top: 6px; }
.set-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.set-list > .empty { grid-column: 1 / -1; }
.set-card {
  display: grid;
  gap: 8px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  min-width: 0;
}
.set-card.is-off { background: var(--surface-2); }
.set-card.is-off .set-card-title { color: var(--muted); }
.set-card > p { margin: 0; }
.set-card-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.set-card-title { font-size: 1.05rem; margin-right: auto; overflow-wrap: anywhere; }
.set-line { display: flex; align-items: flex-start; gap: 8px; font-size: 0.9rem; overflow-wrap: anywhere; }
.set-line .ico { width: 16px; height: 16px; margin-top: 2px; color: var(--muted); }
.set-card-foot { display: flex; justify-content: flex-end; }
.set-switch { position: relative; display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 0.86rem; font-weight: 600; min-height: 36px; }
.set-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.set-switch-track {
  position: relative;
  width: 44px;
  height: 26px;
  border-radius: 999px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  transition: background 0.15s;
  flex: none;
}
.set-switch-track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s var(--ease);
}
.set-switch input:checked + .set-switch-track { background: var(--success); border-color: var(--success); }
.set-switch input:checked + .set-switch-track::after { transform: translateX(18px); }
.set-switch input:focus-visible + .set-switch-track { outline: 3px solid var(--focus); outline-offset: 2px; }
.set-switch input:disabled + .set-switch-track { opacity: 0.55; }
.set-switch:has(input:disabled) { cursor: default; }
.set-checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 6px; }
.set-check {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  cursor: pointer;
  font-weight: 550;
}
.set-check:has(input:checked) { border-color: color-mix(in srgb, var(--accent) 50%, var(--border)); background: var(--accent-soft); }
.set-check input { width: 20px; height: 20px; min-height: 0; margin: 0; padding: 0; flex: none; accent-color: var(--accent); }
.set-check.is-off { color: var(--muted); }
.hours { display: grid; gap: 8px; }
.hours-day { display: grid; gap: 8px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.hours-day.is-closed { background: var(--surface-2); }
.hours-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.hours-name { font-size: 0.95rem; }
.hours-closed { min-height: 36px; padding: 4px 10px; }
.hours-ints { display: flex; flex-wrap: wrap; gap: 8px; }
.hours-int { display: inline-flex; align-items: center; gap: 6px; }
.hours-int input[type="time"] { width: auto; min-height: 44px; }
.hours-tools { display: flex; gap: 4px 8px; flex-wrap: wrap; }
.set-table-wrap { overflow-x: auto; }
.set-table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.set-table th, .set-table td { padding: 10px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
.set-table thead th { font-size: 0.8rem; color: var(--muted); font-weight: 650; }
.set-table tbody th { font-weight: 600; }
.set-table tr.is-off th, .set-table tr.is-off td { color: var(--muted); }
.set-table td small { display: block; }
.set-td-actions { text-align: right; white-space: nowrap; }
.off-form { display: grid; gap: 12px; padding: 14px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface-2); }
.off-form > p { margin: 0; }
.off-foot { display: flex; justify-content: flex-end; }
.off-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.off-item {
  display: flex;
  align-items: center;
  gap: 6px 14px;
  flex-wrap: wrap;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--gold);
  border-radius: 12px;
  background: var(--surface);
}
.off-who { display: inline-flex; align-items: center; gap: 8px; min-width: 9em; }
.off-who .ico { width: 18px; height: 18px; color: var(--gold); }
.off-when { font-weight: 550; }
.off-reason { flex: 1 1 auto; }
.off-item .btn { margin-left: auto; }

@media (max-width: 699px) {
  .set-tabs { width: 100%; }
  .set-tabs .seg-btn { flex: 1; padding: 8px 6px; font-size: 0.86rem; }
  #sec-set .panel-head { flex-wrap: wrap; }
  #sec-set .panel-head .btn { flex: 1 1 100%; }
  .set-list { grid-template-columns: minmax(0, 1fr); }
  .set-checks { grid-template-columns: minmax(0, 1fr); }
  .off-foot .btn { flex: 1; }
  .off-item .btn { flex: 1 1 100%; margin-left: 0; }
  /* Listino: la tabella diventa una pila di schede */
  .set-table thead { display: none; }
  .set-table, .set-table tbody, .set-table tr, .set-table th, .set-table td { display: block; width: 100%; }
  .set-table tr { padding: 10px 12px; margin-bottom: 10px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
  .set-table th, .set-table td { border: 0; padding: 4px 0; }
  .set-table td[data-label]::before { content: attr(data-label); display: block; font-size: 0.74rem; font-weight: 650; color: var(--muted); }
  .set-table tbody th { font-size: 1rem; }
  .set-td-actions { text-align: left; }
  .set-td-actions .btn { width: 100%; }
  .hours-int { width: 100%; }
  .hours-int input[type="time"] { flex: 1; min-width: 0; }
}

/* ---------- Licenza sospesa (Console Assistella) ---------- */
.licence-banner {
  background: var(--danger-soft);
  color: var(--danger);
  border-bottom: 1px solid var(--danger);
  padding: 10px 16px;
  font-weight: 600;
  text-align: center;
  font-size: 0.92rem;
}

/* ---------- Impostazioni: importazione dal vecchio gestionale ---------- */
.imp-step { display: grid; gap: 12px; padding: 14px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface-2); }
.imp-step .seg { justify-self: start; }
.imp-step input[type="file"] { padding: 10px 12px; background: var(--surface); }
.imp-map-table td select { width: 100%; min-width: 180px; }
.imp-map-table th small, .imp-values th small { display: block; font-weight: 400; }
.imp-sample { color: var(--muted); max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.imp-rem { align-items: flex-start; padding: 10px 12px; }
.imp-rem input { margin-top: 2px; }
.imp-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.imp-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.imp-kpi { display: grid; gap: 2px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.imp-kpi-value { font-size: 1.6rem; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.1; }
.imp-kpi-label { font-size: 0.86rem; font-weight: 600; color: var(--muted); }
.imp-kpi-ok .imp-kpi-value { color: var(--success); }
.imp-kpi-warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 30%, var(--border)); }
.imp-kpi-warn .imp-kpi-value { color: var(--warn); }
.imp-values td select { width: 100%; min-width: 200px; }
.imp-rows-wrap { max-height: 420px; overflow: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; }
.imp-rows td:first-child { font-variant-numeric: tabular-nums; color: var(--muted); }
.imp-label { overflow-wrap: anywhere; min-width: 160px; }
.imp-st { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 0.75rem; font-weight: 700; white-space: nowrap; background: var(--surface-3); color: var(--muted); }
.imp-st-ok { background: var(--success-soft); color: var(--success); }
.imp-st-warning { background: var(--warn-soft); color: var(--warn); }
.imp-st-error { background: var(--danger-soft); color: var(--danger); }
.imp-batches { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.imp-batches > .empty { grid-column: 1 / -1; }
.imp-file { font-weight: 600; overflow-wrap: anywhere; }
.imp-tab-short { display: none; }
@media (max-width: 640px) {
  .imp-tab-long { display: none; }
  .imp-tab-short { display: inline; }
  .imp-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .imp-step { padding: 12px; }
  .imp-map-table td select, .imp-values td select { min-width: 140px; }
  .imp-sample { max-width: 120px; }
}
