/* Alice Bookings — design system
   Business = teal, Alice (AI receptionist) = violet. Mobile-first. */

:root {
  /* brand (themeable per client) */
  --brand: #0d9488;
  --brand-strong: #0f766e;
  --brand-tint: #f0fdfa;
  --brand-ink: #134e4a;

  /* Alice */
  --alice: #7c3aed;
  --alice-strong: #6d28d9;
  --alice-tint: #f5f3ff;

  /* status */
  --warn: #b45309;          /* needs your OK */
  --warn-tint: #fffbeb;
  --warn-line: #fde68a;
  --ok: #047857;
  --ok-tint: #ecfdf5;

  /* neutrals */
  --ink: #0f172a;
  --ink-2: #334155;
  --muted: #64748b;
  --faint: #94a3b8;
  --line: #e2e8f0;
  --line-2: #eef2f6;
  --surface: #ffffff;
  --bg: #f6f8fa;
  --bg-2: #eef2f6;

  /* shape */
  --r-sm: 8px; --r: 12px; --r-lg: 16px; --r-xl: 22px;
  --pad: 16px;
  --shadow-1: 0 1px 2px rgba(15,23,42,.06), 0 1px 3px rgba(15,23,42,.05);
  --shadow-2: 0 4px 14px rgba(15,23,42,.08);
  --shadow-3: 0 18px 50px rgba(15,23,42,.18);
  --ease-premium: cubic-bezier(.16, 1, .3, 1);
  --ease-follow: cubic-bezier(.22, 1, .36, 1);

  --tap: 44px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  font-size: 16px;
  line-height: 1.5;
}
button { font: inherit; color: inherit; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4, p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }
svg { display: block; }
.icon { width: 22px; height: 22px; stroke: currentColor; stroke-width: 1.9; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.icon-sm { width: 18px; height: 18px; }
.icon-lg { width: 26px; height: 26px; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.skip-link {
  position: fixed;
  top: calc(env(safe-area-inset-top) + 8px);
  left: 12px;
  z-index: 200;
  transform: translateY(-180%);
  padding: 10px 14px;
  border-radius: var(--r);
  color: #fff;
  background: var(--ink);
  font-weight: 700;
  text-decoration: none;
}
.skip-link:focus { transform: translateY(0); }

/* ------------------------------------------------------------------ shell */
.app { min-height: 100dvh; display: flex; flex-direction: column; }
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.screen {
  flex: 1;
  padding: 16px 16px calc(84px + env(safe-area-inset-bottom));
  max-width: 760px;
  width: 100%;
  margin: 0 auto;
  outline: none;
}
.sidebar { display: none; }

/* ------------------------------------------------------------------ topbar */
.topbar {
  position: sticky; top: 0; z-index: 30;
  background: rgba(255,255,255,.86);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
  padding: calc(env(safe-area-inset-top) + 10px) 16px 10px;
}
.topbar-row { display: flex; align-items: center; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-dot {
  width: 30px; height: 30px; border-radius: 9px; flex: none;
  background: var(--brand); color: #fff;
  display: grid; place-items: center;
}
.brand-name { font-weight: 700; font-size: 17px; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-sub { font-size: 12px; color: var(--muted); }
.spacer { flex: 1; }
.page-title { display: none; font-size: 22px; font-weight: 700; letter-spacing: -.01em; margin-top: 6px; }

.alice-pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 12px 7px 9px; border-radius: 999px;
  background: var(--alice-tint); color: var(--alice-strong);
  border: 1px solid #e9d5ff;
  font-weight: 600; font-size: 13px; min-height: 38px;
}
.alice-pill .av { width: 22px; height: 22px; border-radius: 999px; background: var(--alice); color: #fff; display: grid; place-items: center; }
.alice-pill .count { background: var(--alice); color: #fff; border-radius: 999px; min-width: 20px; height: 20px; padding: 0 6px; display: grid; place-items: center; font-size: 12px; }

/* calendar controls row */
.cal-controls { display: flex; align-items: center; gap: 8px; margin-top: 12px; }
.date-nav { display: flex; align-items: center; gap: 4px; }
.iconbtn {
  width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line);
  background: #fff; color: var(--ink-2); display: grid; place-items: center;
}
.iconbtn:hover { background: var(--bg-2); }
.btn-today { height: 38px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line); background: #fff; font-weight: 600; font-size: 14px; }
.cal-title { font-weight: 700; font-size: 16px; letter-spacing: -.01em; }
.cal-title small { display: block; font-weight: 500; font-size: 12px; color: var(--muted); }

.segmented { display: inline-flex; background: var(--bg-2); border-radius: 10px; padding: 3px; gap: 2px; }
.segmented button { border: 0; background: transparent; border-radius: 8px; padding: 7px 11px; font-size: 13px; font-weight: 600; color: var(--muted); min-height: 34px; }
.segmented button[aria-pressed="true"] { background: #fff; color: var(--ink); box-shadow: var(--shadow-1); }

/* ------------------------------------------------------------------ bottom nav */
.bottomnav {
  position: fixed; left: 0; right: auto; top: calc(100dvh - 60px - env(safe-area-inset-bottom)); bottom: auto; z-index: 120;
  width: 100dvw;
  max-width: 100dvw;
  display: flex; background: rgba(255,255,255,.94);
  backdrop-filter: blur(10px); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
  min-height: calc(60px + env(safe-area-inset-bottom));
  isolation: isolate;
}
.bottomnav button {
  flex: 1; border: 0; background: transparent; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 9px 4px 8px; font-size: 11px; font-weight: 600; min-height: var(--tap);
  position: relative;
}
.bottomnav button[aria-current="page"] { color: var(--brand); }
.bottomnav .nav-badge {
  position: absolute; top: 6px; right: 50%; transform: translateX(16px);
  background: var(--alice); color: #fff; font-size: 10px; font-weight: 700;
  min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px; display: grid; place-items: center;
}

/* ------------------------------------------------------------------ buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: var(--tap); padding: 0 18px; border-radius: 12px; border: 1px solid transparent;
  font-weight: 650; font-size: 15px; background: var(--bg-2); color: var(--ink);
  text-decoration: none; transition: transform .08s ease, background .15s ease;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-strong); }
.btn-alice { background: var(--alice); color: #fff; }
.btn-alice:hover { background: var(--alice-strong); }
.btn-ghost { background: #fff; border-color: var(--line); }
.btn-ghost:hover { background: var(--bg-2); }
.btn-danger { background: #fff; border-color: #fecaca; color: #b91c1c; }
.btn-block { width: 100%; }
.btn-sm { height: 38px; padding: 0 13px; font-size: 14px; border-radius: 10px; }
.btn.disabled { opacity: .58; pointer-events: none; }

/* ------------------------------------------------------------------ chips / badges */
.chip { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 11px; border-radius: 999px; font-size: 13px; font-weight: 600; background: var(--bg-2); color: var(--ink-2); border: 1px solid transparent; }
.chip-alice { background: var(--alice-tint); color: var(--alice-strong); }
.chip-warn { background: var(--warn-tint); color: var(--warn); border-color: var(--warn-line); }
.chip-ok { background: var(--ok-tint); color: var(--ok); }
.chip-brand { background: var(--brand-tint); color: var(--brand-ink); }
.chip.selectable { cursor: pointer; }
.chip.selectable[aria-pressed="true"] { background: var(--brand); color: #fff; }
.dot { width: 8px; height: 8px; border-radius: 999px; background: var(--muted); flex: none; }
.dot-alice { background: var(--alice); } .dot-brand { background: var(--brand); } .dot-warn { background: var(--warn); }

/* ------------------------------------------------------------------ sections / cards */
.section-h { display: flex; align-items: center; gap: 8px; margin: 22px 2px 10px; }
.section-h:first-child { margin-top: 6px; }
.section-h h2 { font-size: 13px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.section-h .count-tag { font-size: 12px; color: var(--faint); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-1); }
.stack > * + * { margin-top: 10px; }

.empty { text-align: center; color: var(--muted); padding: 40px 20px; }
.empty .icon { margin: 0 auto 10px; width: 30px; height: 30px; color: var(--faint); }
.empty p { font-size: 14px; }

/* ------------------------------------------------------------------ agenda (mobile day list) */
.agenda { display: flex; flex-direction: column; gap: 8px; }
.slot { display: flex; gap: 12px; }
.slot-time { width: 58px; flex: none; text-align: right; padding-top: 14px; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.slot-body { flex: 1; min-width: 0; }

.appt {
  border: 1px solid var(--line); border-left: 4px solid var(--brand);
  border-radius: var(--r); background: #fff; padding: 12px 14px; box-shadow: var(--shadow-1);
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; min-height: 60px;
}
.appt:hover { box-shadow: var(--shadow-2); }
.appt .who { font-weight: 650; }
.appt .meta { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.appt .meta .icon-sm { width: 14px; height: 14px; color: var(--faint); }
.appt-lead { border-left-color: var(--alice); background: linear-gradient(0deg, #fff, #fff), var(--alice-tint); }
.appt-lead .src { color: var(--alice-strong); font-weight: 700; }
.booking-card { cursor: default; }
.booking-main {
  flex: 1 1 auto; min-width: 0; border: 0; background: transparent; padding: 0; margin: 0;
  display: flex; align-items: center; gap: 12px; text-align: left; color: inherit;
}
.booking-main:focus-visible, .staff-chip:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 12px; }
.booking-right {
  margin-left: auto; flex: 0 0 auto; min-width: 260px;
  display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap;
}

.staff-tray {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin: 0 0 14px 70px; padding: 10px 12px;
  background: #fff; border: 1px solid var(--line); border-radius: var(--r);
  box-shadow: var(--shadow-1);
}
.staff-tray-label { font-size: 12px; font-weight: 800; color: var(--muted); text-transform: uppercase; }
.staff-tray-hint { margin-left: auto; font-size: 12px; color: var(--faint); font-weight: 600; }
.staff-chip {
  appearance: none; border: 1px solid var(--line); background: #fff; color: var(--ink-2);
  min-height: 32px; max-width: 138px; padding: 3px 9px 3px 3px; border-radius: 999px;
  display: inline-flex; align-items: center; gap: 7px; font-weight: 700; font-size: 13px;
  box-shadow: var(--shadow-1); cursor: grab; user-select: none;
  transition: background .14s var(--ease-premium), border-color .14s var(--ease-premium), box-shadow .14s var(--ease-premium), opacity .12s var(--ease-premium), transform .12s var(--ease-premium);
  touch-action: none;
}
.staff-chip.assigned { border-color: #dbeafe; background: #f8fbff; }
body.is-pointer-dragging,
body.is-pointer-dragging * { cursor: grabbing !important; user-select: none; }
[data-drag-type] {
  touch-action: none;
  -webkit-user-drag: none;
}
.staff-chip.dragging, [data-drag-type].dragging {
  opacity: .44; transform: scale(.985); transform-origin: center;
  transition: opacity .12s var(--ease-premium), transform .12s var(--ease-premium), filter .12s var(--ease-premium);
  filter: saturate(.88);
}
.drag-ghost {
  border-radius: 10px !important; opacity: .92 !important; overflow: hidden !important;
  box-shadow: 0 18px 45px rgba(15,23,42,.22) !important;
}
.pointer-drag-ghost {
  opacity: .97 !important;
  border: 1px solid rgba(255,255,255,.72) !important;
  box-shadow: 0 22px 54px rgba(15,23,42,.24), 0 2px 10px rgba(15,23,42,.12) !important;
  transition: opacity .16s var(--ease-premium), box-shadow .16s var(--ease-premium), filter .16s var(--ease-premium) !important;
  will-change: transform, opacity;
  contain: layout style paint;
  backface-visibility: hidden;
  transform-origin: 0 0;
}
.pointer-drag-ghost.snap-ready {
  opacity: 1 !important;
  filter: saturate(1.06);
  box-shadow: 0 26px 60px rgba(15,23,42,.24), 0 0 0 5px rgba(13,148,136,.13) !important;
}
.pointer-drag-ghost.staff-drag-ghost {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
}
.pointer-drag-ghost.snap-blocked {
  opacity: .88 !important;
  filter: saturate(.9);
  box-shadow: 0 18px 44px rgba(15,23,42,.2), 0 0 0 5px rgba(185,28,28,.12) !important;
}
.staff-chip:active { cursor: grabbing; }
.staff-face {
  width: 26px; height: 26px; border-radius: 999px; flex: none;
  display: grid; place-items: center; color: #fff; background: var(--staff, var(--brand));
  font-size: 11px; font-weight: 800;
}
.staff-face img,
.settings-staff-face img {
  width: 100%; height: 100%; display: block; object-fit: cover; border-radius: inherit;
}
.staff-name { min-width: 0; max-width: 78px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.staff-dropzone {
  min-width: 142px; min-height: 38px; padding: 3px;
  display: flex; align-items: center; justify-content: flex-end; gap: 6px; flex-wrap: wrap;
  border: 1.5px dashed transparent; border-radius: 999px;
  transition: background .14s var(--ease-premium), border-color .14s var(--ease-premium), box-shadow .14s var(--ease-premium);
}
.staff-dropzone,
[data-dropzone="staff"] { position: relative; }
.staff-dropzone.drag-over { border-color: var(--brand); background: var(--brand-tint); box-shadow: inset 0 0 0 1px rgba(13,148,136,.12); }
[data-dropzone="staff"].drag-over {
  outline: 2px solid rgba(13,148,136,.28);
  outline-offset: 2px;
  box-shadow: 0 0 0 5px rgba(13,148,136,.08), var(--shadow-1);
}
[data-dropzone="staff"].drag-over::after {
  content: attr(data-staff-drop-label);
  position: absolute;
  left: 8px; right: 8px; top: 8px; z-index: 6;
  display: block; padding: 4px 8px; border-radius: 999px;
  background: rgba(15,23,42,.88); color: #fff;
  font-size: 11px; font-weight: 850; line-height: 1.1;
  text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  pointer-events: none;
}
.staff-empty { color: var(--faint); font-size: 12px; font-weight: 700; padding: 0 6px; }
.crew-count {
  height: 28px; padding: 0 8px; border-radius: 999px; display: inline-flex; align-items: center;
  background: var(--ok-tint); color: var(--ok); border: 1px solid #bbf7d0;
  font-size: 12px; font-weight: 800; font-variant-numeric: tabular-nums;
}
.crew-count.short { background: var(--warn-tint); color: var(--warn); border-color: var(--warn-line); }
.now-slot { align-items: center; }
.now-time { color: #dc2626; font-weight: 800; padding-top: 0; }
.now-line {
  position: relative; height: 18px; display: flex; align-items: center; color: #dc2626; font-size: 12px; font-weight: 800;
}
.now-line::before {
  content: ""; height: 2px; flex: 1; background: #dc2626; border-radius: 999px;
  box-shadow: 0 0 0 3px rgba(220,38,38,.08);
}
.now-line span {
  order: -1; margin-right: 8px; padding: 2px 7px; border-radius: 999px; background: #dc2626; color: #fff;
}

.free {
  width: 100%; border: 1.5px dashed var(--line); color: var(--muted);
  background: #fff; border-radius: var(--r); padding: 11px 14px; min-height: 52px;
  display: flex; align-items: center; gap: 10px; font-size: 14px; text-align: left;
  position: relative; overflow: hidden;
}
.free:hover { border-color: var(--brand); color: var(--brand-strong); background: var(--brand-tint); }
.free.drag-over, .wg-cell.drag-over {
  border-color: var(--brand); background: var(--brand-tint); box-shadow: inset 0 0 0 2px rgba(13,148,136,.14);
}
.wg-cell.drag-invalid,
.sd-cell.drag-invalid {
  border-color: #fecaca;
  background: #fef2f2;
  box-shadow: inset 0 0 0 2px rgba(185,28,28,.16);
}
.wg-cell.drag-reassign,
.sd-cell.drag-reassign {
  border-color: #bfdbfe;
  background: #eff6ff;
  box-shadow: inset 0 0 0 2px rgba(37,99,235,.14);
}
.wg-cell,
.sd-cell { position: relative; }
[data-dropzone="time"].drag-over,
[data-dropzone="time"].drop-landed {
  z-index: 12;
}
[data-dropzone="time"].drag-over::after,
[data-dropzone="time"].drop-landed::after {
  content: attr(data-snap-label);
  position: absolute;
  left: 8px; right: 8px; top: 50%;
  min-height: 24px; padding: 3px 8px;
  display: flex; align-items: center; justify-content: center;
  transform: translateY(-50%) scale(.98);
  border-radius: 999px;
  background: rgba(15,23,42,.88);
  color: #fff;
  box-shadow: 0 8px 22px rgba(15,23,42,.18);
  font-size: 11px; font-weight: 850; line-height: 1;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  pointer-events: none;
  animation: snapLabelIn .18s var(--ease-premium) forwards;
}
[data-dropzone="time"].drag-invalid::after {
  background: rgba(185,28,28,.94);
  box-shadow: 0 8px 22px rgba(185,28,28,.18);
}
[data-dropzone="time"].drag-reassign::after {
  background: rgba(29,78,216,.92);
  box-shadow: 0 8px 22px rgba(29,78,216,.16);
}
[data-dropzone="time"].drop-landed {
  background: #f8fafc;
  box-shadow: inset 0 0 0 2px rgba(124,58,237,.16), 0 0 0 4px rgba(124,58,237,.06);
  animation: snapLanding .28s var(--ease-premium);
}
[data-dropzone="time"].drop-landed::after {
  background: rgba(88,28,135,.88);
}
.free .plus { margin-left: auto; opacity: .65; display: inline-flex; align-items: center; gap: 4px; font-weight: 600; }

.blocked {
  width: 100%; border-radius: var(--r); padding: 10px 14px; min-height: 46px;
  display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--muted);
  background: repeating-linear-gradient(45deg, #f1f5f9, #f1f5f9 9px, #eaeff5 9px, #eaeff5 18px);
  border: 1px solid var(--line);
}

/* ------------------------------------------------------------------ staff day grid */
.day-subnav {
  display: flex; justify-content: flex-end; margin: 0 0 12px;
}
.staff-focusbar {
  display: flex; align-items: center; gap: 8px; overflow-x: auto; scrollbar-width: none;
  margin: 0 0 14px; padding: 2px 0 4px;
}
.staff-focusbar::-webkit-scrollbar { display: none; }
.staff-focus-chip {
  flex: none; min-height: 36px; border: 1px solid #cbd5e1; background: #fff; color: #0f172a;
  border-radius: 999px; padding: 3px 11px 3px 4px; display: inline-flex; align-items: center; gap: 7px;
  font-size: 13px; font-weight: 800; box-shadow: var(--shadow-1);
}
.staff-focus-chip:first-child {
  padding: 0 14px; border-color: #0f172a; background: #0f172a; color: #fff;
  box-shadow: 0 8px 22px rgba(15,23,42,.16);
}
.staff-focus-chip:first-child[aria-pressed="false"] {
  background: #fff; color: #0f172a; border-color: #0f172a;
}
.staff-focus-chip:first-child[aria-pressed="true"] {
  background: #0f172a; color: #fff; border-color: #0f172a;
}
.staff-focus-chip[aria-pressed="true"] { border-color: #0f172a; background: #0f172a; color: #fff; }
.staffday-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-lg); background: #fff; box-shadow: var(--shadow-1); }
.staffday {
  position: relative; display: grid;
  grid-template-columns: 58px repeat(var(--staffcols, 1), minmax(170px, 1fr));
  min-width: calc(58px + (var(--staffcols, 1) * 170px));
}
.sd-corner { position: sticky; top: 0; left: 0; z-index: 5; background: #fff; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.sd-head {
  position: sticky; top: 0; z-index: 4; min-height: 88px; border: 0; border-right: 1px solid var(--line-2); border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,.96); display: grid; place-items: center; align-content: center; gap: 4px;
  text-align: center; padding: 10px 8px;
}
.sd-head:hover { background: var(--brand-tint); }
.sd-head .staff-face { width: 42px; height: 42px; font-size: 13px; box-shadow: 0 0 0 3px color-mix(in srgb, var(--staff, var(--brand)) 20%, transparent); }
.sd-head strong { font-size: 13px; line-height: 1.1; }
.sd-head span:last-child { font-size: 11px; color: var(--muted); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sd-head.alice .staff-face { background: var(--alice); }
.sd-timecol { position: sticky; left: 0; z-index: 3; background: #fff; border-right: 1px solid var(--line); }
.sd-timecell { height: 36px; border-bottom: 1px solid var(--line-2); text-align: right; padding: 2px 7px 0 0; color: var(--faint); font-size: 11px; font-variant-numeric: tabular-nums; }
.sd-timecell.half { color: #b6c2d1; font-size: 10px; }
.sd-col { position: relative; min-height: var(--dayheight); border-right: 1px solid var(--line-2); }
.sd-col:last-child { border-right: 0; }
.sd-cell { height: 36px; border-bottom: 1px solid var(--line-2); }
.sd-cell.half { border-bottom-color: #f5f7fa; }
.sd-cell:hover { background: var(--brand-tint); }
.sd-cell.drag-over { background: var(--brand-tint); box-shadow: inset 0 0 0 2px rgba(13,148,136,.14); }
.sd-cell.muted { background: #fafafa; }
.drag-slot-preview {
  position: absolute; left: 6px; right: 6px; top: 0; z-index: 17;
  display: flex; align-items: flex-start; justify-content: flex-start;
  padding: 6px 8px; border-radius: 9px;
  border: 1.5px solid rgba(13,148,136,.44);
  background: linear-gradient(180deg, rgba(240,253,250,.96), rgba(204,251,241,.68));
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.7), 0 12px 28px rgba(13,148,136,.14);
  color: var(--brand-ink); pointer-events: none;
  transform: translate3d(0, var(--preview-y, 0px), 0);
  will-change: transform, height;
  animation: placementPreviewIn .14s var(--ease-premium);
}
.wg-col .drag-slot-preview { left: 4px; right: 4px; }
.drag-slot-preview.lead {
  border-color: rgba(124,58,237,.44);
  background: linear-gradient(180deg, rgba(245,243,255,.98), rgba(221,214,254,.74));
  color: var(--alice-strong);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.74), 0 12px 28px rgba(124,58,237,.13);
}
.drag-slot-preview.blocked {
  border-color: rgba(185,28,28,.44);
  background: linear-gradient(180deg, rgba(254,242,242,.98), rgba(254,226,226,.76));
  color: #991b1b;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.74), 0 12px 28px rgba(185,28,28,.12);
}
.drag-slot-preview.reassign {
  border-color: rgba(37,99,235,.42);
  background: linear-gradient(180deg, rgba(239,246,255,.98), rgba(219,234,254,.76));
  color: #1d4ed8;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.74), 0 12px 28px rgba(37,99,235,.12);
}
.drag-slot-preview span {
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  padding: 2px 7px; border-radius: 999px; background: rgba(255,255,255,.78);
  font-size: 11px; font-weight: 850; line-height: 1.25;
  box-shadow: 0 1px 2px rgba(15,23,42,.08);
}
.sd-event {
  position: absolute; left: 6px; right: 6px; border: 0; border-radius: 8px; background: var(--brand); color: #fff;
  display: block; text-align: left; padding: 8px 9px 17px; box-shadow: var(--shadow-1); overflow: hidden;
  transition: height .08s ease-out, box-shadow .12s ease, transform .12s ease;
}
.sd-event:hover { box-shadow: var(--shadow-2); }
.sd-event .sd-time { display: block; font-size: 12px; font-weight: 750; margin-bottom: 4px; }
.sd-event strong { display: block; font-size: 14px; line-height: 1.15; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sd-event .sd-service { display: block; font-size: 12px; line-height: 1.25; opacity: .94; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sd-event .resize-grip { display: block; opacity: .85; }
.sd-event.lead { background: var(--alice-tint); color: var(--alice-strong); border: 1.5px dashed var(--alice); }
.sd-block {
  position: absolute; left: 6px; right: 6px; border-radius: 8px; padding: 6px 8px; font-size: 12px; color: var(--muted);
  background: repeating-linear-gradient(45deg, #f1f5f9, #f1f5f9 9px, #eaeff5 9px, #eaeff5 18px);
  border: 1px solid var(--line); overflow: hidden;
}
.staffday-now {
  position: absolute; left: 58px; right: 0; z-index: 8; height: 2px; background: #dc2626; border-radius: 999px;
  box-shadow: 0 0 0 3px rgba(220,38,38,.08);
}
.staffday-now span {
  position: sticky; left: 62px; display: inline-block; transform: translateY(-10px);
  padding: 1px 6px; border-radius: 999px; background: #dc2626; color: #fff; font-size: 10px; font-weight: 800;
}

/* ------------------------------------------------------------------ week grid (desktop) */
.weekgrid-wrap { overflow-x: auto; position: relative; border-radius: var(--r-lg); }
.weekgrid-wrap.edge-left,
.weekgrid-wrap.edge-right { box-shadow: none; }
.weekgrid {
  display: grid; grid-template-columns: 56px repeat(var(--cols, 7), minmax(120px, 1fr));
  border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; background: #fff;
  min-width: 680px;
  transition: box-shadow .42s cubic-bezier(.16, 1, .3, 1), filter .42s cubic-bezier(.16, 1, .3, 1);
}
.weekgrid-wrap.edge-left .weekgrid {
  box-shadow: inset 24px 0 34px -26px rgba(124,58,237,.36);
}
.weekgrid-wrap.edge-right .weekgrid {
  box-shadow: inset -24px 0 34px -26px rgba(124,58,237,.36);
}
.weekgrid.is-three { grid-template-columns: 56px repeat(var(--cols, 3), minmax(230px, 1fr)); min-width: 760px; }
.wg-head {
  position: sticky; top: 0; background: #fff; z-index: 2; border: 0; border-bottom: 1px solid var(--line);
  padding: 10px 8px; text-align: center; display: grid; place-items: center; gap: 2px;
}
.wg-head:hover { background: var(--bg); }
.wg-head:focus-visible { outline: 3px solid rgba(249,115,22,.28); outline-offset: -3px; }
.wg-head .dow { font-size: 12px; color: var(--muted); font-weight: 600; }
.wg-head .dnum { font-weight: 700; font-size: 16px; margin-top: 2px; }
.wg-head.today .dow { color: #ea580c; }
.wg-head.today .dnum {
  color: #fff; background: #f97316; box-shadow: 0 0 0 4px rgba(249,115,22,.16);
  width: 32px; height: 32px; border-radius: 999px; display: inline-grid; place-items: center;
}
.wg-corner { border-bottom: 1px solid var(--line); }
.wg-timecol { border-right: 1px solid var(--line); }
.wg-time { height: 36px; font-size: 11px; color: var(--faint); text-align: right; padding: 2px 6px 0 0; font-variant-numeric: tabular-nums; }
.wg-time.half { color: #b6c2d1; font-size: 10px; }
.wg-col { position: relative; border-right: 1px solid var(--line-2); }
.wg-col:last-child { border-right: 0; }
.wg-cell { height: 36px; border-bottom: 1px solid var(--line-2); }
.wg-cell.half { border-bottom-color: #f5f7fa; }
.wg-cell:hover { background: var(--brand-tint); cursor: pointer; }
.wg-col.closed { background: repeating-linear-gradient(45deg, #f8fafc, #f8fafc 9px, #f1f5f9 9px, #f1f5f9 18px); }
.wg-event {
  position: absolute; left: 4px; right: 4px; border-radius: 9px; padding: 5px 8px; overflow: hidden;
  min-height: 46px;
  font-size: 12px; line-height: 1.25; box-shadow: var(--shadow-1); border: 1px solid transparent; text-align: left;
}
.wg-event .t { font-weight: 700; }
.wg-service { display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; vertical-align: bottom; }
.wg-event.booking {
  background: var(--brand); color: #fff; padding-right: 72px; padding-bottom: 14px; cursor: grab;
  transition: height .08s ease-out, box-shadow .12s ease, transform .12s ease;
}
.wg-event.booking.density-compact {
  padding: 4px 5px 13px; font-size: 11px; line-height: 1.12;
}
.wg-event.booking.density-compact .booking-status {
  width: 9px; height: 9px; padding: 0; top: 5px; right: 5px;
  color: transparent; background: rgba(255,255,255,.82);
}
.wg-event.booking.density-compact .wg-service {
  display: block; max-height: 13px; font-size: 10px; opacity: .95;
}
.wg-event.booking.density-compact .week-staff { right: 5px; bottom: 4px; gap: 2px; }
.wg-event.booking.density-compact .week-staff-face { width: 14px; height: 14px; font-size: 6px; border-width: 1px; }
.wg-event.booking.density-micro {
  padding: 0; min-height: 30px; border-radius: 7px; box-shadow: none;
  color: transparent;
}
.wg-event.booking.density-micro .t,
.wg-event.booking.density-micro .wg-name,
.wg-event.booking.density-micro .wg-service,
.wg-event.booking.density-micro .booking-status,
.wg-event.booking.density-micro .week-staff {
  display: none;
}
.wg-event.booking.density-micro .resize-grip { left: 3px; right: 3px; height: 100%; bottom: 0; opacity: 0; }
.wg-event.booking.state-booked, .sd-event.state-booked { background: var(--brand); }
.wg-event.booking.state-quoted, .sd-event.state-quoted { background: #d97706; }
.wg-event.booking.state-paid, .sd-event.state-paid { background: #2563eb; }
.wg-event.booking.state-review-ready, .sd-event.state-review-ready { background: #7c3aed; }
.wg-event.booking.state-reviewed, .sd-event.state-reviewed { background: #047857; }
.wg-event.booking.state-workapp, .sd-event.state-workapp { background: #334155; }
.wg-event.booking.state-cancelled, .sd-event.state-cancelled {
  background: #94a3b8; color: #f8fafc; text-decoration: line-through; opacity: .82;
}
.wg-event.booking.group { padding-right: 8px; padding-bottom: 26px; }
.wg-event.booking.drag-over {
  outline: 2px solid rgba(13,148,136,.45); outline-offset: 2px;
  box-shadow: var(--shadow-2), inset 0 0 0 999px rgba(240,253,250,.14);
}
.wg-event.lead { background: var(--alice-tint); color: var(--alice-strong); border: 1.5px dashed var(--alice); }
.wg-event.block { background: rgba(148,163,184,.18); color: var(--muted); }
.booking-status {
  display: inline-flex; align-items: center; width: fit-content; margin-top: 3px;
  border-radius: 999px; padding: 1px 5px; background: rgba(255,255,255,.16);
  color: inherit; font-size: 9px; font-style: normal; font-weight: 800; text-decoration: none;
}
.wg-event .booking-status {
  position: absolute; top: 5px; right: 6px; margin: 0; max-width: 58px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.resize-grip {
  position: absolute; left: 10px; right: 10px; bottom: 0; height: 14px;
  cursor: ns-resize; border-radius: 999px; opacity: .78; touch-action: none;
}
.resize-grip::after {
  content: ""; position: absolute; left: 50%; bottom: 4px; width: 34px; height: 4px;
  transform: translateX(-50%); border-radius: 999px; background: rgba(255,255,255,.72);
}
.resize-grip:hover::after, .resize-grip.dragging::after { background: #fff; width: 44px; }
.is-resizing-booking, .is-resizing-booking * { cursor: ns-resize !important; user-select: none; }
.wg-event.booking.resizing, .sd-event.resizing {
  z-index: 20; box-shadow: var(--shadow-3); transform: translateZ(0);
  outline: 2px solid rgba(255,255,255,.68); outline-offset: 1px;
}
.wg-event.booking.resizing::after, .sd-event.resizing::after {
  content: attr(data-resize-range) " · " attr(data-resize-mins);
  position: absolute; left: 8px; right: 8px; bottom: 15px; z-index: 2;
  display: block; padding: 4px 7px; border-radius: 8px;
  background: rgba(15,23,42,.76); color: #fff; font-size: 11px; font-weight: 850;
  text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.wg-event.booking.resize-invalid::after, .sd-event.resize-invalid::after {
  background: rgba(185,28,28,.9);
}
@keyframes snapLabelIn {
  from { opacity: 0; transform: translateY(-50%) scale(.94); }
  to { opacity: 1; transform: translateY(-50%) scale(1); }
}
@keyframes snapLanding {
  0% { filter: saturate(1); }
  45% { filter: saturate(1.04); }
  100% { filter: saturate(1); }
}
@keyframes placementPreviewIn {
  from { opacity: 0; transform: translate3d(0, calc(var(--preview-y, 0px) + 2px), 0) scale(.985); }
  to { opacity: 1; transform: translate3d(0, var(--preview-y, 0px), 0) scale(1); }
}
.week-legend {
  display: flex; align-items: center; gap: 8px; overflow-x: auto; scrollbar-width: none;
  margin: -4px 0 12px 70px; padding-bottom: 2px;
}
.week-legend::-webkit-scrollbar { display: none; }
.legend-pill {
  flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 26px;
  border: 1px solid var(--line); border-radius: 999px; background: #fff; padding: 2px 9px;
  font-size: 11px; font-weight: 800; color: var(--ink-2);
}
.legend-pill i { width: 9px; height: 9px; border-radius: 999px; display: inline-block; background: var(--brand); }
.legend-pill.state-quoted i { background: #d97706; }
.legend-pill.state-paid i { background: #2563eb; }
.legend-pill.state-review-ready i { background: #7c3aed; }
.legend-pill.state-reviewed i { background: #047857; }
.legend-pill.state-workapp i { background: #334155; }
.legend-pill.state-cancelled i { background: #94a3b8; }
.week-now-line {
  position: absolute; left: 2px; right: 2px; z-index: 4; height: 2px; background: #dc2626; border-radius: 999px;
  box-shadow: 0 0 0 3px rgba(220,38,38,.08);
}
.week-now-line span {
  position: absolute; right: 4px; top: -10px; padding: 1px 6px; border-radius: 999px;
  background: #dc2626; color: #fff; font-size: 10px; font-weight: 800; white-space: nowrap;
}
.week-staff {
  position: absolute; right: 6px; bottom: 6px; max-width: calc(100% - 12px);
  display: flex; gap: 3px; flex-wrap: wrap; align-items: center; justify-content: flex-end;
}
.wg-event.group .week-staff { left: 8px; right: 8px; justify-content: flex-start; }
.week-staff-face {
  width: 18px; height: 18px; border-radius: 999px; display: inline-grid; place-items: center;
  background: color-mix(in srgb, var(--staff, #fff) 70%, transparent); color: #fff;
  border: 1.5px solid color-mix(in srgb, var(--staff, #fff) 70%, #fff);
  backdrop-filter: blur(2px);
  font-size: 8px; font-weight: 800; cursor: grab; box-shadow: 0 1px 2px rgba(15,23,42,.12);
  transition: opacity .12s var(--ease-premium), transform .12s var(--ease-premium), box-shadow .14s var(--ease-premium);
  touch-action: none;
}
.week-staff-face:active { cursor: grabbing; }
.week-staff-face.dragging { opacity: .48; transform: scale(.95); box-shadow: 0 4px 10px rgba(15,23,42,.18); }

/* ------------------------------------------------------------------ month + year */
.month { background: #fff; border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.month-dow { display: grid; grid-template-columns: repeat(7,1fr); border-bottom: 1px solid var(--line); }
.month-dow span { padding: 8px 0; text-align: center; font-size: 12px; font-weight: 600; color: var(--muted); }
.month-grid { display: grid; grid-template-columns: repeat(7,1fr); }
.mcell { min-height: clamp(96px, calc((100dvh - 280px) / 6), 138px); border: 0; border-right: 1px solid var(--line-2); border-bottom: 1px solid var(--line-2); padding: 10px; text-align: left; background: #fff; }
.mcell:nth-child(7n) { border-right: 0; }
.mcell.out { background: var(--bg); color: var(--faint); }
.mcell.today .mnum { background: var(--brand); color: #fff; }
.mnum { font-size: 13px; font-weight: 600; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 999px; }
.mdots { display: flex; gap: 3px; flex-wrap: wrap; margin-top: 6px; }
.mcount { margin-top: 4px; font-size: 11px; color: var(--muted); }

.year { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px,1fr)); gap: 14px; }
.ymini { background:#fff; border:1px solid var(--line); border-radius: var(--r); padding: 10px; text-align: left; }
.ymini h4 { font-size: 13px; margin-bottom: 6px; }
.ymini .yg { display: grid; grid-template-columns: repeat(7,1fr); gap: 2px; }
.ymini .yd { font-size: 9px; text-align: center; color: var(--faint); aspect-ratio: 1; display: grid; place-items: center; border-radius: 4px; }
.ymini .yd.has { background: var(--brand-tint); color: var(--brand-ink); font-weight: 700; }
.ymini .yd.today { background: var(--brand); color: #fff; }

/* ------------------------------------------------------------------ list items (clients / activity) */
.searchbar { display: flex; align-items: center; gap: 10px; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 0 14px; height: 46px; box-shadow: var(--shadow-1); }
.searchbar input { border: 0; outline: none; flex: 1; background: transparent; height: 100%; font-size: 15px; }
.searchbar .icon { color: var(--faint); }

.row {
  width: 100%; text-align: left; display: flex; align-items: center; gap: 12px;
  padding: 13px 14px; background: #fff; border: 1px solid var(--line); border-radius: var(--r);
  box-shadow: var(--shadow-1); min-height: 64px;
}
.row:hover { box-shadow: var(--shadow-2); }
.avatar { width: 42px; height: 42px; border-radius: 999px; flex: none; display: grid; place-items: center; font-weight: 700; color: #fff; background: var(--brand); }
.avatar.alice { background: var(--alice); }
.row .grow { flex: 1; min-width: 0; }
.row .title { font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .subtitle { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .trail { color: var(--faint); display: flex; align-items: center; gap: 8px; flex: none; font-size: 13px; }

.feed-card { padding: 14px; }
.feed-card .head { display: flex; align-items: center; gap: 10px; }
.feed-card .summary { margin-top: 10px; font-size: 14px; color: var(--ink-2); }
.feed-card .draftbox { margin-top: 10px; background: var(--bg); border: 1px dashed var(--line); border-radius: 10px; padding: 10px 12px; font-size: 13px; color: var(--ink-2); }
.feed-card .actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.feed-card .actions .btn { flex: 1; min-width: 120px; }

/* ------------------------------------------------------------------ profile */
.profile-head { display: flex; align-items: center; gap: 14px; padding: 18px; }
.profile-head .avatar { width: 56px; height: 56px; font-size: 20px; }
.profile-head h1 { font-size: 20px; }
.contact-actions { display: flex; gap: 8px; flex-wrap: wrap; padding: 0 18px 18px; }
.profile-form {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px;
}
.profile-field {
  display: grid; grid-template-columns: 18px minmax(0, 1fr); align-items: center; gap: 7px;
  background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 10px 12px;
  min-width: 0; box-shadow: var(--shadow-1);
}
.profile-field .icon-sm { color: var(--faint); }
.profile-field span { grid-column: 2; color: var(--muted); font-size: 12px; font-weight: 700; }
.profile-field input, .profile-field textarea {
  grid-column: 2; width: 100%; min-width: 0; border: 0; outline: 0; background: transparent;
  font-weight: 650; padding: 1px 0 0;
}
.profile-field input:focus, .profile-field textarea:focus { box-shadow: inset 0 -2px 0 var(--brand); }
.profile-field textarea { min-height: 88px; resize: vertical; line-height: 1.45; }
.profile-field-full { grid-column: 1 / -1; align-items: start; }
.kv { display: grid; grid-template-columns: 1fr; gap: 1px; background: var(--line); border-radius: var(--r); overflow: hidden; border: 1px solid var(--line); }
.kv .item { background: #fff; padding: 12px 14px; display: flex; align-items: center; gap: 10px; }
.kv .item .icon { color: var(--faint); }
.kv .item .lbl { font-size: 12px; color: var(--muted); }
.kv .item .val { font-weight: 600; }

.timeline { position: relative; padding-left: 22px; }
.timeline::before { content:""; position: absolute; left: 6px; top: 4px; bottom: 4px; width: 2px; background: var(--line); }
.tl-item { position: relative; padding: 8px 0; }
.tl-item::before { content:""; position: absolute; left: -19px; top: 14px; width: 10px; height: 10px; border-radius: 999px; background: var(--brand); border: 2px solid #fff; }
.tl-item.req::before { background: var(--alice); }
.tl-item .when { font-size: 12px; color: var(--muted); }
.tl-item .what { font-weight: 600; font-size: 14px; }
.booking-link {
  display: block; width: 100%; border: 0; background: transparent; color: inherit;
  text-align: left; border-radius: 10px; padding: 9px 8px;
}
.booking-link:hover { background: var(--brand-tint); }
.booking-link:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 30%, transparent); outline-offset: 2px; }

/* ------------------------------------------------------------------ settings */
.set-group { margin-top: 18px; }
.set-group > .gh { display:flex; align-items:center; gap:10px; padding: 0 4px 8px; }
.set-group > .gh .icon { color: var(--brand); }
.set-group > .gh h3 { font-size: 15px; }
.set-list { background: #fff; border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow-1); }
.set-row { display: flex; align-items: center; gap: 12px; padding: 14px; border-bottom: 1px solid var(--line-2); min-height: 56px; }
.set-row:last-child { border-bottom: 0; }
.set-row .grow { flex: 1; min-width: 0; }
.set-row .lbl { font-weight: 600; }
.set-row .hint { font-size: 13px; color: var(--muted); margin-top: 2px; }
.set-row .val { color: var(--muted); font-weight: 600; }
.set-row input[type="text"], .set-row input[type="time"], .set-row input[type="number"], .set-row select { border:1px solid var(--line); border-radius: 9px; padding: 8px 10px; min-height: 38px; max-width: 160px; }
.set-row .lbl { display: flex; align-items: center; gap: 8px; }
.settings-staff-face {
  width: 28px; height: 28px; border-radius: 999px; display: inline-grid; place-items: center;
  color: #fff; background: var(--staff, var(--brand)); font-size: 11px; font-weight: 800;
}
.photo-upload { position: relative; overflow: hidden; }
.photo-upload input {
  position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none;
}
.inline-fields { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.inline-fields input[type="text"] { width: 120px; }

.staff-picker { display: flex; gap: 8px; flex-wrap: wrap; }
.staff-check {
  display: inline-flex; align-items: center; gap: 7px; min-height: 38px; padding: 4px 10px 4px 5px;
  border: 1px solid var(--line); border-radius: 999px; background: #fff; font-weight: 700; color: var(--ink-2);
}
.staff-check input { width: 16px; height: 16px; accent-color: var(--brand); }
.staff-check:has(input:checked) { border-color: #99f6e4; background: var(--brand-tint); color: var(--brand-ink); }
.field-hint { margin-top: 7px; color: var(--muted); font-size: 12px; font-weight: 650; }
.field-hint.warn { color: var(--warn); }

.toggle { width: 46px; height: 28px; border-radius: 999px; background: var(--bg-2); border: 0; position: relative; flex: none; transition: background .15s; }
.toggle::after { content:""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 999px; background: #fff; box-shadow: var(--shadow-1); transition: left .15s; }
.toggle[aria-pressed="true"] { background: var(--brand); }
.toggle[aria-pressed="true"]::after { left: 21px; }

.days { display: flex; gap: 6px; flex-wrap: wrap; }
.day-pill { width: 40px; height: 40px; border-radius: 999px; border: 1px solid var(--line); background: #fff; font-size: 13px; font-weight: 600; color: var(--muted); }
.day-pill[aria-pressed="true"] { background: var(--brand); color: #fff; border-color: var(--brand); }

.advanced-toggle { margin: 16px 4px 0; }
details.advanced { margin-top: 8px; }
details.advanced > summary { list-style: none; cursor: pointer; color: var(--muted); font-size: 14px; font-weight: 600; padding: 10px 4px; display: flex; align-items: center; gap: 8px; }
details.advanced > summary::-webkit-details-marker { display: none; }
details.advanced[open] > summary .chev { transform: rotate(90deg); }

/* ------------------------------------------------------------------ modal / sheet */
.scrim { position: fixed; inset: 0; background: rgba(15,23,42,.5); z-index: 50; opacity: 0; animation: fade .18s forwards; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 51;
  background: #fff; border-radius: 22px 22px 0 0; box-shadow: var(--shadow-3);
  max-height: 92dvh; display: flex; flex-direction: column;
  transform: translateY(100%); animation: slideup .26s cubic-bezier(.22,1,.36,1) forwards;
  padding-bottom: env(safe-area-inset-bottom);
  will-change: transform;
}
.sheet.sheet-dragging { animation: none; transition: none; }
.sheet-grab {
  width: 56px; height: 5px; border-radius: 999px; background: #cbd5e1;
  margin: 10px auto 4px; cursor: grab; touch-action: none;
}
.sheet-grab:active { cursor: grabbing; }
.sheet-head { display: flex; align-items: center; gap: 12px; padding: 8px 16px 12px; border-bottom: 1px solid var(--line); }
.sheet-head h2 { font-size: 18px; flex: 1; }
.sheet-head[data-sheet-drag] { touch-action: none; }
.sheet-close {
  width: 42px; height: 42px; border-radius: 12px;
  background: #f8fafc; color: var(--ink); border-color: #cbd5e1;
}
.sheet-close:hover { background: #eef2f6; }
.sheet-close .icon { stroke-width: 2.4; }
.sheet-body { padding: 16px; overflow-y: auto; }
.sheet-foot { padding: 12px 16px; border-top: 1px solid var(--line); display: flex; gap: 10px; }
.sheet-foot .btn { flex: 1; }

.notice { display: flex; gap: 10px; padding: 12px 14px; border-radius: 12px; font-size: 14px; align-items: flex-start; }
.notice .icon { flex: none; margin-top: 1px; }
.notice-alice { background: var(--alice-tint); color: var(--alice-strong); }
.notice-warn { background: var(--warn-tint); color: var(--warn); border: 1px solid var(--warn-line); }

.field { margin-bottom: 14px; }
.field > label { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 11px; padding: 12px 13px; min-height: var(--tap); background: #fff;
}
.field textarea { min-height: 92px; resize: vertical; line-height: 1.45; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--brand); outline-offset: 1px; border-color: var(--brand); }
.time-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.seg-toggle { display: inline-flex; background: var(--bg-2); border-radius: 10px; padding: 3px; }
.seg-toggle button { border: 0; background: transparent; border-radius: 8px; padding: 8px 14px; font-weight: 600; font-size: 14px; color: var(--muted); }
.seg-toggle button[aria-pressed="true"] { background: #fff; color: var(--ink); box-shadow: var(--shadow-1); }

.quick-actions {
  display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px;
}
.quick-actions .btn { flex: 1 1 145px; }
.status-preview,
.mini-status {
  display: inline-flex; align-items: center; width: fit-content;
  border-radius: 999px; padding: 3px 8px; color: #fff;
  font-size: 11px; font-weight: 800; line-height: 1.1;
}
.status-preview { margin-top: 8px; }
.mini-status { margin-left: 6px; vertical-align: 1px; }
.status-preview.state-booked, .mini-status.state-booked { background: var(--brand); }
.status-preview.state-quoted, .mini-status.state-quoted { background: #d97706; }
.status-preview.state-paid, .mini-status.state-paid { background: #2563eb; }
.status-preview.state-review-ready, .mini-status.state-review-ready { background: #7c3aed; }
.status-preview.state-reviewed, .mini-status.state-reviewed { background: #047857; }
.status-preview.state-workapp, .mini-status.state-workapp { background: #334155; }
.status-preview.state-cancelled, .mini-status.state-cancelled { background: #94a3b8; text-decoration: line-through; }

/* ------------------------------------------------------------------ toast */
.toast {
  position: fixed; left: 50%; bottom: calc(86px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 999px; z-index: 60;
  font-size: 14px; font-weight: 600; box-shadow: var(--shadow-3); display: flex; align-items: center; gap: 8px;
  animation: pop .2s ease;
}
.toast .icon { color: #5eead4; }
.toast[hidden] { display: none; }

@keyframes fade { to { opacity: 1; } }
@keyframes slideup { to { transform: translateY(0); } }
@keyframes pop { from { transform: translate(-50%, 8px); opacity: 0; } to { transform: translate(-50%,0); opacity: 1; } }

/* ------------------------------------------------------------------ desktop */
@media (min-width: 1024px) {
  .app { flex-direction: row; }
  .bottomnav { display: none; }
  .sidebar {
    display: flex; flex-direction: column; width: 248px; flex: none;
    background: #fff; border-right: 1px solid var(--line); padding: 18px 14px;
    position: sticky; top: 0; height: 100dvh;
  }
  .sidebar .brand { padding: 6px 8px 18px; }
  .sidebar .brand-dot { width: 36px; height: 36px; }
  .sidebar nav { display: flex; flex-direction: column; gap: 4px; }
  .side-link { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 11px; border: 0; background: transparent; color: var(--ink-2); font-weight: 600; font-size: 15px; width: 100%; text-align: left; position: relative; }
  .side-link:hover { background: var(--bg-2); }
  .side-link[aria-current="page"] { background: var(--brand-tint); color: var(--brand-strong); }
  .side-link .nav-badge { margin-left: auto; background: var(--alice); color: #fff; font-size: 11px; font-weight: 700; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 999px; display: grid; place-items: center; position: static; transform: none; }
  .sidebar .side-foot { margin-top: auto; }
  .alice-card { background: var(--alice-tint); border-radius: 14px; padding: 12px; }
  .alice-card .top { display: flex; align-items: center; gap: 9px; color: var(--alice-strong); font-weight: 700; }
  .alice-card .av { width: 26px; height: 26px; border-radius: 999px; background: var(--alice); color:#fff; display:grid; place-items:center; }
  .alice-card p { font-size: 12.5px; color: var(--alice-strong); margin-top: 8px; opacity: .9; }

  .main { min-height: 100dvh; }
  .screen { max-width: 1080px; padding: 22px 28px 40px; }
  .app[data-route="calendar"] .screen { max-width: none; padding: 22px 44px 40px; }
  .topbar { padding: 16px 28px; }
  .topbar .alice-pill { display: none; }      /* Alice lives in sidebar on desktop */
  .topbar .topbar-row { display: none; }      /* brand lives in sidebar on desktop */
  .page-title { display: block; }
  .cal-controls { margin-top: 14px; }
  .free { min-height: 44px; }

  /* two-column screens on desktop */
  .cols { display: grid; grid-template-columns: 1.4fr 1fr; gap: 22px; align-items: start; }
  .agenda { display: none; }                   /* mobile day list hidden; week grid is primary */
  .app[data-calview="day"] .agenda { display: flex; }
  .app[data-calview="day"] .weekgrid-wrap { display: none; }
  .app[data-route="calendar"][data-calview="day"] .screen { max-width: none; }
  .weekgrid { width: 100%; min-width: 980px; grid-template-columns: 58px repeat(var(--cols, 7), minmax(150px, 1fr)); }
  .weekgrid.is-three { min-width: 0; grid-template-columns: 58px repeat(var(--cols, 3), minmax(260px, 1fr)); }
}
@media (max-width: 1023px) {
  .weekgrid-wrap.week-desktop-only { }          /* week grid still available on mobile via scroll */
  .cols { display: block; }
  .cols > * + * { margin-top: 16px; }
  .cal-controls {
    display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center;
  }
  .cal-controls .spacer { display: none; }
  .cal-controls .segmented {
    grid-column: 1 / -1; width: 100%; justify-content: stretch;
  }
  .cal-controls .segmented button { flex: 1; }
  .staff-tray {
    margin-left: 0; overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none;
  }
  .staff-tray::-webkit-scrollbar { display: none; }
  .staff-tray-hint { display: none; }
  .booking-card { align-items: flex-start; flex-wrap: wrap; }
  .booking-main { flex-basis: 100%; }
  .booking-right {
    width: calc(100% - 54px); min-width: 0; margin-left: 54px;
    justify-content: flex-start;
  }
  .staff-dropzone { min-width: 0; max-width: 100%; justify-content: flex-start; border-radius: 14px; }
  .staff-name { max-width: 64px; }
  .profile-form { grid-template-columns: 1fr; }
  .contact-actions .btn { flex: 1 1 96px; }
  .inline-fields { justify-content: flex-start; width: 100%; margin-top: 10px; }
  .inline-fields input[type="text"] { width: 100%; max-width: none; }
  .staff-picker { gap: 6px; }
}

/* tablet week grid scroll affordance kept; large desktop wider columns */
@media (min-width: 1280px) {
  .weekgrid { min-width: 0; }
}

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