/* ============ GJ Fadezz Admin — Design Tokens ============ */
:root {
  --bg: oklch(0.16 0.006 250);
  --bg-elev: oklch(0.19 0.006 250);
  --surface: oklch(0.215 0.006 250);
  --surface-2: oklch(0.245 0.006 250);
  --surface-3: oklch(0.28 0.006 250);
  --border: oklch(0.30 0.006 250 / 0.7);
  --border-strong: oklch(0.38 0.008 250);
  --text: oklch(0.97 0.003 250);
  --text-dim: oklch(0.72 0.005 250);
  --text-mute: oklch(0.55 0.005 250);
  --accent: oklch(0.74 0.13 55);
  --accent-fg: oklch(0.16 0.04 55);
  --accent-soft: oklch(0.74 0.13 55 / 0.14);
  --success: oklch(0.78 0.14 155);
  --success-soft: oklch(0.78 0.14 155 / 0.16);
  --warning: oklch(0.82 0.14 85);
  --warning-soft: oklch(0.82 0.14 85 / 0.16);
  --danger: oklch(0.68 0.18 25);
  --danger-soft: oklch(0.68 0.18 25 / 0.18);
  --info: oklch(0.76 0.10 235);
  --info-soft: oklch(0.76 0.10 235 / 0.16);
  --radius: 10px;
  --radius-sm: 7px;
  --radius-lg: 14px;
  --row-h: 44px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.3);
  --shadow: 0 6px 24px rgba(0,0,0,.35), 0 1px 2px rgba(0,0,0,.35);
  --shadow-lg: 0 20px 60px rgba(0,0,0,.55);
  --pad: 20px;
  --gap: 14px;
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body.admin-body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "ss01", "cv11";
  letter-spacing: -0.005em;
  min-height: 100vh;
}
.admin-body button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
.admin-body input, .admin-body select, .admin-body textarea { font-family: inherit; color: inherit; }
.mono { font-family: var(--font-mono); font-feature-settings: "zero", "ss01"; }

/* ============ App shell ============ */
.admin-app {
  display: grid;
  grid-template-columns: 232px 1fr;
  min-height: 100vh;
}

/* ============ Sidebar ============ */
.admin-sidebar {
  background: var(--bg);
  border-right: 1px solid var(--border);
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 8px 16px;
}
.brand-mark {
  width: 30px; height: 30px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), oklch(0.6 0.14 35));
  display: grid; place-items: center;
  color: var(--accent-fg);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: -0.02em;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.2);
  flex-shrink: 0;
}
.brand-name { font-weight: 600; font-size: 14px; letter-spacing: -0.01em; }
.brand-sub { font-size: 11px; color: var(--text-mute); margin-top: 1px; }

.shop-picker {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  margin-bottom: 12px;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.shop-picker:hover { border-color: var(--border-strong); }
.shop-avatar { width: 22px; height: 22px; border-radius: 5px; background: var(--surface-3); display: grid; place-items: center; font-size: 11px; font-weight: 600; }
.shop-name { font-size: 13px; flex: 1; font-weight: 500; }

.nav-section-label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-mute);
  padding: 14px 10px 6px;
  font-weight: 500;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  width: 100%;
  text-align: left;
  transition: background .12s, color .12s;
  position: relative;
}
.nav-item:hover { background: var(--surface); color: var(--text); }
.nav-item.active { background: var(--surface-2); color: var(--text); }
.nav-item .nav-icon { width: 16px; height: 16px; opacity: .85; flex-shrink: 0; display: flex; align-items: center; }
.nav-item.active .nav-icon { color: var(--accent); opacity: 1; }
.nav-item .badge {
  margin-left: auto;
  background: var(--surface-3);
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 999px;
  font-weight: 500;
  color: var(--text);
}
.nav-item.active .badge { background: var(--accent-soft); color: var(--accent); }
.nav-item .kbd {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-mute);
  padding: 1px 5px;
  border: 1px solid var(--border);
  border-radius: 4px;
}
.nav-spacer { flex: 1; }

.user-card {
  display: flex; align-items: center; gap: 10px;
  padding: 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background .12s;
}
.user-card:hover { background: var(--surface); }
.avatar {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, oklch(0.6 0.14 280), oklch(0.6 0.14 200));
  display: grid; place-items: center;
  color: white; font-weight: 600; font-size: 11px;
  flex-shrink: 0;
}
.user-name { font-size: 12.5px; font-weight: 500; line-height: 1.2; }
.user-role { font-size: 11px; color: var(--text-mute); }

.return-to-site {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--text-mute);
  font-size: 13px;
  font-weight: 500;
  transition: background .12s, color .12s;
}
.return-to-site:hover { background: var(--surface); color: var(--text); }
.return-to-site:hover svg { color: var(--text); }

/* ============ Main ============ */
.admin-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.topbar {
  height: 56px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 10;
}
.crumbs { font-size: 13px; color: var(--text-mute); display: flex; align-items: center; gap: 8px; }
.crumbs .sep { opacity: 0.4; }
.crumbs .here { color: var(--text); font-weight: 500; }
.topbar-spacer { flex: 1; }
.topbar-search {
  display: flex; align-items: center; gap: 8px;
  width: 280px;
  padding: 6px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-size: 13px;
  cursor: pointer;
  transition: border-color .15s;
}
.topbar-search:hover { border-color: var(--border-strong); }
.topbar-search .kbd { margin-left: auto; font-family: var(--font-mono); font-size: 10.5px; color: var(--text-mute); padding: 1px 5px; border: 1px solid var(--border); border-radius: 4px; }

.icon-btn {
  width: 32px; height: 32px;
  border-radius: var(--radius-sm);
  display: grid; place-items: center;
  color: var(--text-dim);
  border: 1px solid transparent;
  transition: background .12s, color .12s, border-color .12s;
  position: relative;
}
.icon-btn:hover { background: var(--surface); color: var(--text); }
.icon-btn .dot {
  position: absolute;
  top: 7px; right: 7px;
  width: 7px; height: 7px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 0 2px var(--bg);
}

/* Demo state segmented control */
.seg {
  display: inline-flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 2px;
}
.seg button {
  padding: 5px 10px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-dim);
  border-radius: 5px;
  transition: background .12s, color .12s;
}
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--surface-3); color: var(--text); }

/* ============ Page content ============ */
.admin-page {
  padding: 28px 28px 80px;
  max-width: 1320px;
  width: 100%;
  margin: 0 auto;
}
.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}
.page-title { font-size: 22px; font-weight: 600; letter-spacing: -0.02em; margin: 0; }
.page-sub { color: var(--text-mute); font-size: 13.5px; margin-top: 4px; }
.page-actions { display: flex; gap: 8px; align-items: center; }
.page-view { display: none; }
.page-view.active { display: block; }

/* ============ Buttons ============ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  transition: background .12s, border-color .12s, transform .08s, color .12s;
  white-space: nowrap;
  user-select: none;
}
.btn:hover { background: var(--surface-2); border-color: var(--border-strong); }
.btn:active { transform: translateY(0.5px); }
.btn-primary {
  background: var(--accent);
  color: var(--accent-fg);
  border-color: transparent;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.18), 0 1px 0 rgba(0,0,0,.2);
}
.btn-primary:hover { filter: brightness(1.08); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-dim); }
.btn-ghost:hover { background: var(--surface); color: var(--text); }
.btn.btn-danger {
  background: oklch(0.68 0.18 25 / 0.22);
  color: oklch(0.78 0.18 25);
  border-color: oklch(0.68 0.18 25 / 0.55);
  font-weight: 600;
}
.btn.btn-danger:hover {
  background: oklch(0.68 0.18 25 / 0.34);
  border-color: oklch(0.68 0.18 25 / 0.75);
}
.btn.btn-success {
  background: oklch(0.78 0.14 155 / 0.22);
  color: oklch(0.86 0.14 155);
  border-color: oklch(0.78 0.14 155 / 0.55);
  font-weight: 600;
}
.btn.btn-success:hover {
  background: oklch(0.78 0.14 155 / 0.34);
  border-color: oklch(0.78 0.14 155 / 0.75);
}
.btn-sm { padding: 4px 9px; font-size: 12px; }
.btn svg { width: 14px; height: 14px; }

/* ============ Cards ============ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--pad);
}
.card-flush { padding: 0; overflow: hidden; }
.card-h {
  display: flex; align-items: center; gap: 8px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.card-h h3 { margin: 0; font-size: 13.5px; font-weight: 600; letter-spacing: -0.005em; }
.card-h .sub { color: var(--text-mute); font-size: 12px; margin-left: auto; }

/* ============ KPI cards ============ */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--gap);
  margin-bottom: var(--gap);
}
.kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  position: relative;
  overflow: hidden;
}
.kpi-label { color: var(--text-mute); font-size: 12px; font-weight: 500; display: flex; align-items: center; gap: 6px; }
.kpi-value { font-size: 28px; font-weight: 600; letter-spacing: -0.02em; margin-top: 6px; font-family: var(--font-mono); font-feature-settings: "tnum"; }
.kpi-foot { display: flex; align-items: center; gap: 6px; margin-top: 8px; font-size: 12px; color: var(--text-mute); }
.delta { display: inline-flex; align-items: center; gap: 3px; padding: 1px 6px; border-radius: 999px; font-weight: 500; font-family: var(--font-mono); font-size: 11px; }
.delta.up { background: var(--success-soft); color: var(--success); }
.delta.down { background: var(--danger-soft); color: var(--danger); }
.spark { position: absolute; right: 12px; bottom: 12px; opacity: 0.9; }

/* ============ Status pills ============ */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 500;
  white-space: nowrap;
}
.pill::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 3px oklch(from currentColor l c h / 0.18);
}
.pill-confirmed { background: var(--success-soft); color: var(--success); }
.pill-pending   { background: var(--warning-soft); color: var(--warning); }
.pill-canceled  { background: var(--danger-soft); color: var(--danger); }
.pill-completed { background: var(--info-soft); color: var(--info); }
.pill-no-show   { background: var(--surface-2); color: var(--text-mute); }

/* ============ Today: layout ============ */
.today-grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: var(--gap);
}
.today-side { display: grid; align-content: start; gap: var(--gap); }

/* ============ Timeline ============ */
.timeline { padding: 0; }
.timeline-row {
  display: grid;
  grid-template-columns: 60px 1fr;
  border-bottom: 1px solid var(--border);
  min-height: 56px;
}
.timeline-row:last-child { border-bottom: none; }
.timeline-time {
  padding: 10px 12px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-mute);
  border-right: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
}
.timeline-content { padding: 8px; display: flex; flex-direction: column; gap: 6px; }

.appt {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  cursor: pointer;
  transition: background .12s, border-color .12s;
}
.appt:hover { background: var(--surface-3); }
.appt.status-confirmed { border-left-color: var(--success); }
.appt.status-pending { border-left-color: var(--warning); }
.appt.status-completed { border-left-color: var(--info); }
.appt.status-canceled { border-left-color: var(--danger); opacity: 0.65; }
.appt .who { font-weight: 500; font-size: 13px; }
.appt .what { color: var(--text-mute); font-size: 12px; }
.appt .when { margin-left: auto; font-family: var(--font-mono); font-size: 12px; color: var(--text-dim); }
.appt-empty {
  padding: 10px; color: var(--text-mute); font-size: 12px; font-style: italic;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  text-align: center;
}

@keyframes pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.6; transform: scale(1.4); } }
.pulse-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
  animation: pulse 1.6s ease-in-out infinite;
}

/* ============ Toolbar ============ */
.toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: var(--gap);
  align-items: center;
  flex-wrap: wrap;
}
.flex-1 { flex: 1; }

/* ============ Table ============ */
.table-wrap { overflow-x: auto; }
.tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.tbl th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-mute);
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-weight: 500;
  background: var(--surface);
  position: sticky;
  top: 56px;
}
.tbl td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.tbl tr { transition: background .1s; }
.tbl tr.row { cursor: pointer; display: table-row; }
.tbl tr.row:hover td { background: var(--surface-2); }

.tbl-appts { width: 100%; min-width: 760px; table-layout: fixed; }
.tbl-appts col.col-when    { width: 11%; }
.tbl-appts col.col-client  { width: 28%; }
.tbl-appts col.col-svc     { width: 19%; }
.tbl-appts col.col-barber  { width: 10%; }
.tbl-appts col.col-status  { width: 12%; }
.tbl-appts col.col-actions { width: 20%; }
.tbl-appts th:last-child, .tbl-appts td:last-child { text-align: right; }

.who-cell { display: flex; align-items: center; gap: 10px; min-width: 0; }
.who-cell .who-text { min-width: 0; flex: 1; overflow: hidden; }
.who-name { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who-meta { color: var(--text-mute); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.when-cell { display: flex; flex-direction: column; gap: 2px; line-height: 1.3; }
.when-day { font-size: 12.5px; font-weight: 500; }
.when-time { font-size: 11.5px; color: var(--text-mute); }
.svc-name { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.svc-meta { font-size: 11.5px; color: var(--text-mute); font-family: var(--font-mono); margin-top: 2px; }
.cell-barber { font-size: 13px; color: var(--text-dim); }
.row-actions { display: flex; gap: 4px; justify-content: flex-end; align-items: center; flex-wrap: nowrap; }

/* ============ Schedule grid ============ */
.schedule-frame { padding: 0; overflow: hidden; }
.schedule-grid {
  display: grid;
  grid-template-columns: 64px repeat(7, 1fr);
  border-top: 1px solid var(--border);
}
.sg-cell { border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); position: relative; min-height: 26px; }
.sg-cell:last-child { border-right: none; }
.sg-head {
  padding: 10px 12px;
  background: var(--surface);
  font-size: 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
}
.sg-head .day-name { font-weight: 600; color: var(--text); }
.sg-head .day-num { font-family: var(--font-mono); color: var(--text-mute); font-size: 11px; }
.sg-head.today { background: var(--accent-soft); }
.sg-head.today .day-name { color: var(--accent); }
.sg-time {
  padding: 4px 8px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-mute);
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  text-align: right;
  background: var(--bg-elev);
}
.sg-block {
  position: absolute;
  left: 4px; right: 4px;
  border-radius: 6px;
  padding: 4px 6px;
  font-size: 11.5px;
  line-height: 1.25;
  cursor: pointer;
  border: 1px solid;
  overflow: hidden;
  transition: filter .12s;
}
.sg-block:hover { filter: brightness(1.15); }
.sg-block .block-name { font-weight: 500; }
.sg-block .block-time { opacity: 0.75; font-size: 10.5px; font-family: var(--font-mono); }
.sg-block.booked { background: var(--info-soft); border-color: oklch(from var(--info) l c h / 0.3); color: oklch(from var(--info) calc(l + 0.1) c h); }
.sg-block.confirmed { background: var(--success-soft); border-color: oklch(from var(--success) l c h / 0.3); color: oklch(from var(--success) calc(l + 0.05) c h); }
.sg-block.break { background: var(--surface-3); border-color: var(--border-strong); color: var(--text-mute); }
.sg-block.blocked { background: oklch(from var(--text-mute) l c h / 0.1); border: 1px dashed var(--border-strong); color: var(--text-mute); background-image: repeating-linear-gradient(45deg, transparent, transparent 6px, var(--surface-3) 6px, var(--surface-3) 8px); }
.sg-block.conflict { box-shadow: 0 0 0 1.5px var(--danger), 0 0 12px oklch(from var(--danger) l c h / 0.4); }
.sg-row-barber {
  border-bottom: 1px solid var(--border-strong);
  padding: 8px 10px;
  background: var(--bg-elev);
  display: flex; align-items: center; gap: 8px;
  font-size: 12px;
  font-weight: 500;
}

/* ============ Analytics charts ============ */
.chart-row {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: var(--gap);
  margin-bottom: var(--gap);
}
.bars {
  display: flex;
  align-items: flex-end;
  height: 180px;
  gap: 8px;
  padding: 12px 4px 0;
}
.bar {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.bar .b {
  width: 100%;
  background: var(--accent-soft);
  border-radius: 4px 4px 0 0;
  min-height: 4px;
  transition: background .15s;
}
.bar:hover .b { background: var(--accent); }
.bar.peak .b { background: var(--accent); }
.bar .lbl { font-size: 10.5px; color: var(--text-mute); font-family: var(--font-mono); }

.svc-row { display: grid; grid-template-columns: 1fr auto auto; gap: 14px; padding: 10px 0; border-bottom: 1px solid var(--border); align-items: center; }
.svc-row:last-child { border-bottom: none; }
.svc-row .nm { font-size: 13px; font-weight: 500; }
.svc-row .vol { font-family: var(--font-mono); font-size: 12px; color: var(--text-mute); }
.svc-row .meter { width: 140px; height: 6px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.svc-row .meter > div { height: 100%; background: var(--accent); }

.lineviz { position: relative; height: 200px; padding: 14px 6px 28px; }
.lineviz svg { width: 100%; height: 100%; overflow: visible; }
.lineviz .grid-line { stroke: var(--border); stroke-width: 1; stroke-dasharray: 2 4; opacity: 0.4; }
.lineviz path.area { fill: oklch(from var(--accent) l c h / 0.14); }
.lineviz path.line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.lineviz path.line-prev { fill: none; stroke: var(--text-mute); stroke-width: 1.25; stroke-dasharray: 3 3; }
.lineviz .axis-label { font-family: var(--font-mono); font-size: 10px; fill: var(--text-mute); }

.heat-grid {
  display: grid;
  grid-template-columns: 40px repeat(12, minmax(0, 1fr));
  gap: 2px;
  font-size: 10px;
}
.heat-cell {
  aspect-ratio: 1.4;
  border-radius: 3px;
  display: grid; place-items: center;
  font-family: var(--font-mono);
  cursor: default;
  transition: outline .12s;
}
.heat-cell:hover { outline: 1.5px solid var(--accent); }
.heat-cell.label { background: transparent; color: var(--text-mute); justify-content: flex-end; padding-right: 6px; }
.heat-cell.col-label { background: transparent; color: var(--text-mute); }

/* Cohort grid */
.cohort-grid {
  display: grid;
  grid-template-columns: 60px 50px repeat(5, 1fr);
  gap: 4px;
  font-size: 11.5px;
}

/* Fake data banner */
.fake-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: linear-gradient(90deg, var(--warning-soft), transparent 70%), var(--surface);
  border: 1px solid oklch(from var(--warning) l c h / 0.5);
  border-radius: var(--radius);
  margin-bottom: var(--gap);
}
.fake-banner .fb-ic {
  width: 28px; height: 28px;
  border-radius: 8px;
  background: var(--warning-soft);
  color: var(--warning);
  display: grid; place-items: center;
  flex-shrink: 0;
}
.fake-banner .fb-t { font-size: 13px; font-weight: 600; }
.fake-banner .fb-d { font-size: 12px; color: var(--text-mute); margin-top: 1px; }

/* Toggle switch */
.counts-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-dim);
  cursor: pointer;
  user-select: none;
  padding: 4px 0;
}
.counts-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.counts-toggle .sw {
  width: 28px; height: 16px;
  background: var(--surface-3);
  border-radius: 999px;
  position: relative;
  transition: background .15s;
}
.counts-toggle .sw::after {
  content: "";
  position: absolute;
  top: 2px; left: 2px;
  width: 12px; height: 12px;
  background: var(--text);
  border-radius: 50%;
  transition: transform .15s;
}
.counts-toggle input:checked + .sw { background: var(--accent); }
.counts-toggle input:checked + .sw::after { transform: translateX(12px); background: var(--accent-fg); }

/* ============ Availability ============ */
.avail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: var(--gap);
  margin-top: var(--gap);
  align-items: start;
}
.month-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.month-dow {
  background: var(--surface);
  color: var(--text-mute);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}
.month-cell {
  background: var(--surface);
  border: none;
  text-align: left;
  padding: 10px 10px 8px;
  min-height: 92px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  cursor: pointer;
  position: relative;
  transition: background .12s;
  font-family: inherit;
  color: var(--text);
}
.month-cell:hover { background: var(--surface-2); }
.month-cell.empty { background: var(--bg); cursor: default; }
.month-cell.empty:hover { background: var(--bg); }
.month-cell.past { opacity: 0.55; }
.month-cell.selected {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
  background: var(--surface-2);
  z-index: 2;
}
.month-cell.is-today .num {
  background: var(--accent);
  color: var(--accent-fg);
  border-radius: 6px;
  padding: 1px 7px;
  font-weight: 600;
}
.month-cell .num-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font-mono);
}
.month-cell .today-pip {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  font-family: var(--font-sans);
  font-weight: 600;
}
.month-cell .cell-meta {
  font-size: 11px;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 4px;
}
.month-cell .cell-bar {
  margin-top: auto;
  height: 3px;
  border-radius: 2px;
  background: var(--surface-3);
  overflow: hidden;
}
.month-cell .cell-bar > span {
  display: block;
  height: 100%;
  background: var(--success);
}
.month-cell.fully .cell-bar > span { background: var(--warning); }
.month-cell.closed {
  background: repeating-linear-gradient(135deg, var(--surface), var(--surface) 6px, var(--bg-elev) 6px, var(--bg-elev) 12px);
}
.month-cell.closed .num { color: var(--text-mute); }

.slot-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  max-height: 280px;
  overflow-y: auto;
  padding-right: 2px;
}
.slot-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  font-size: 12px;
  color: var(--text);
}
.slot-chip.taken {
  background: var(--surface-2);
  color: var(--text-mute);
  text-decoration: line-through;
}
.slot-chip .x {
  margin-left: auto;
  border: none;
  background: transparent;
  color: var(--text-mute);
  cursor: pointer;
  width: 18px; height: 18px;
  border-radius: 4px;
  display: grid; place-items: center;
}
.slot-chip .x:hover { background: var(--danger-soft); color: var(--danger); }

/* Legend helper */
.color-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }

/* ============ Fast Day Editor ============ */
.fast-day-editor { display: grid; gap: 14px; }

.fde-section-label {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 10.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .08em;
  color: var(--text-mute);
  margin-bottom: 6px;
}

/* Quick-shift presets — 2x2 grid of tappable cards */
.shift-presets { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.admin-body .shift-card {
  text-align: left;
  padding: 10px 12px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 10px;
  cursor: pointer;
  color: var(--text);
  transition: border-color .12s, background .12s, transform .04s;
}
.admin-body .shift-card:hover { background: var(--surface-3, var(--surface)); border-color: var(--border-strong, var(--accent)); }
.admin-body .shift-card:active { transform: translateY(0.5px); }
.admin-body .shift-card .shift-title { font-size: 13px; font-weight: 600; margin-bottom: 2px; line-height: 1.2; }
.admin-body .shift-card .shift-range { font-size: 11px; color: var(--text-mute); font-family: var(--font-mono); }

/* Time steppers — Open / Close */
.time-steppers {
  display: grid;
  grid-template-columns: 1fr 18px 1fr;
  align-items: end;
  gap: 6px;
}
.time-stepper { display: grid; gap: 6px; min-width: 0; }
.ts-label {
  font-size: 10.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .08em;
  color: var(--text-mute);
}
.ts-control {
  display: grid; grid-template-columns: 28px 1fr 28px;
  align-items: center;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  height: 40px;
  overflow: hidden;
  min-width: 0;
}
.ts-control:focus-within { border-color: var(--accent); }
.ts-control button {
  height: 100%;
  background: transparent; border: none;
  color: var(--text-mute);
  cursor: pointer;
  display: grid; place-items: center;
  padding: 0;
}
.ts-control button:hover { color: var(--accent); background: var(--accent-soft); }
.ts-time {
  text-align: center;
  font-family: var(--font-mono);
  font-size: 14px; font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text); letter-spacing: -0.005em;
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  padding: 0 6px;
  user-select: none;
  white-space: nowrap;
}
.ts-arrow { color: var(--text-mute); display: grid; place-items: center; padding-bottom: 9px; }

/* Interval + Apply */
.interval-row { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.interval-label {
  font-size: 11.5px;
  text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-mute);
}
.interval-seg {
  display: inline-flex;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 2px;
}
.interval-seg button {
  padding: 5px 8px;
  background: transparent; border: none;
  color: var(--text-mute);
  font-size: 11.5px; font-family: var(--font-mono);
  cursor: pointer; border-radius: 6px;
}
.interval-seg button.on {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 0 rgba(0,0,0,.2);
}
.admin-body .btn-apply {
  margin-left: auto;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  background: var(--accent); color: var(--accent-fg);
  border: 1px solid transparent; border-radius: 8px;
  font-weight: 600; font-size: 12.5px;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.18), 0 1px 0 rgba(0,0,0,0.2);
  transition: background .12s, filter .12s, opacity .15s;
}
.admin-body .btn-apply:hover:not(:disabled) { background: oklch(from var(--accent) calc(l + 0.04) c h); }
.admin-body .btn-apply:disabled { opacity: 0.4; cursor: not-allowed; }

/* Day-at-a-glance timeline */
.day-timeline {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  background: var(--surface-2);
}
.dt-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; gap: 8px; flex-wrap: wrap; }
.dt-count { font-family: var(--font-mono); font-size: 11.5px; color: var(--text-mute); }
.dt-track {
  position: relative;
  height: 52px;
  background: var(--surface);
  border-radius: 6px;
  border: 1px solid var(--border);
  overflow: hidden;
}
.dt-band {
  position: absolute; top: 0; bottom: 0;
  background: var(--accent-soft);
  border-left: 1px dashed oklch(0.74 0.13 55 / 0.5);
  border-right: 1px dashed oklch(0.74 0.13 55 / 0.5);
}
.dt-tick {
  position: absolute; top: 6px; bottom: 6px;
  width: 10px; margin-left: -5px;
  border-radius: 2px;
}
.dt-tick.open {
  background: var(--accent);
  cursor: pointer;
}
.dt-tick.open:hover { filter: brightness(1.1); outline: 2px solid var(--accent-soft); }
.dt-tick.booked {
  cursor: not-allowed;
  background-image: repeating-linear-gradient(
    45deg,
    var(--info) 0, var(--info) 3px,
    oklch(0.5 0.06 235) 3px, oklch(0.5 0.06 235) 6px
  );
}
.dt-hours { position: relative; height: 14px; margin-top: 4px; }
.dt-hour-label {
  position: absolute;
  transform: translateX(-50%);
  font-size: 10px; color: var(--text-mute);
  font-family: var(--font-mono);
}
.dt-legend {
  display: flex; gap: 12px;
  margin-top: 8px;
  font-size: 11px; color: var(--text-mute);
  align-items: center;
  flex-wrap: wrap;
}
.dt-legend .dot {
  display: inline-block; width: 10px; height: 10px;
  border-radius: 2px; vertical-align: -1px; margin-right: 6px;
}
.dt-legend .dot.open { background: var(--accent); }
.dt-legend .dot.booked {
  background-image: repeating-linear-gradient(
    45deg,
    var(--info) 0, var(--info) 2px,
    oklch(0.5 0.06 235) 2px, oklch(0.5 0.06 235) 4px
  );
}

/* Footer */
.fde-footer { display: flex; gap: 8px; }
.fde-footer > .btn:first-child { flex: 1; }

/* ============ Mobile tabs ============ */
.mobile-tabs {
  display: none;
  position: sticky;
  bottom: 0;
  background: var(--bg);
  border-top: 1px solid var(--border);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  z-index: 50;
}
.mobile-tabs button {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 6px 4px;
  color: var(--text-mute);
  font-size: 10.5px;
  border-radius: 8px;
}
.mobile-tabs button.active { color: var(--accent); }
.mobile-tabs button svg { width: 18px; height: 18px; }

/* ============ Misc ============ */
hr.divider { border: none; border-top: 1px solid var(--border); margin: 16px 0; }
.muted { color: var(--text-mute); }
.dim { color: var(--text-dim); }
.row { display: flex; align-items: center; gap: 8px; }

/* ============ Login overlay (kept from existing) ============ */
#adminLoginOverlay {
  position: fixed; inset: 0;
  background: var(--bg);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}
#adminLoginOverlay .login-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 360px;
  text-align: center;
}
#adminLoginOverlay h2 {
  margin: 0 0 0.25rem;
  font-size: 1.25rem;
  color: var(--text);
}
#adminLoginOverlay .login-sub {
  margin: 0 0 1.5rem;
  font-size: 0.875rem;
  color: var(--text-mute);
}
#adminLoginOverlay input[type="password"] {
  width: 100%; box-sizing: border-box;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font-size: 1rem;
  margin-bottom: 0.75rem;
  outline: none;
}
#adminLoginOverlay input[type="password"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
#adminLoginOverlay .login-btn {
  width: 100%; padding: 0.75rem;
  border: none; border-radius: var(--radius-sm);
  background: var(--accent);
  color: var(--accent-fg);
  font-weight: 500;
  font-size: 1rem;
  cursor: pointer;
}
#adminLoginOverlay .login-error {
  display: none;
  margin: 0.75rem 0 0;
  color: var(--danger);
  font-size: 0.875rem;
}

/* ============ Mobile app-bar (hidden on desktop) ============ */
.m-appbar { display: none; }
.m-fab { display: none; }
/* Hide the Services-in-Settings nav chip on desktop (mobile @media re-shows it). */
.settings-nav-services-mobile { display: none; }
/* Desktop: show the full KPI label, hide the mobile short variant. */
.kpi-label-short { display: none; }

/* ============ Responsive: tablet ============ */
@media (max-width: 1100px) {
  .today-grid { grid-template-columns: 1fr; }
  .chart-row { grid-template-columns: 1fr; }
  .avail-layout { grid-template-columns: 1fr; }
}

/* ============ MOBILE (< 820px) — full redesign per canvas ============ */
@media (max-width: 820px) {
  /* App shell */
  .admin-app { grid-template-columns: 1fr; }
  .admin-sidebar { display: none; }
  .topbar { display: none; }
  .mobile-tabs { display: grid; }
  html, body { overflow-x: hidden; }
  .admin-app { max-width: 100vw; min-width: 0; }
  .admin-main { padding-bottom: 0; max-width: 100vw; min-width: 0; }
  .admin-page { padding: 0 0 132px; max-width: 100vw; min-width: 0; overflow-x: hidden; }
  .page-view { min-width: 0; }

  /* ----- Mobile app bar ----- */
  .m-appbar {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    padding: max(14px, env(safe-area-inset-top)) 16px 12px;
    background: var(--bg);
    position: sticky;
    top: 0;
    z-index: 30;
  }
  .m-appbar .title-block { flex: 1; min-width: 0; }
  .m-appbar .eyebrow {
    font-size: 11px; color: var(--text-mute); font-weight: 500;
    letter-spacing: 0.06em; text-transform: uppercase;
    min-height: 14px;
  }
  .m-appbar .title {
    font-size: 22px; font-weight: 700; letter-spacing: -0.02em;
    margin-top: 2px; line-height: 1.15;
  }
  .m-appbar-actions { display: flex; gap: 8px; }
  .m-appbar .iconbtn {
    width: 36px; height: 36px;
    border-radius: 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    display: grid; place-items: center;
    color: var(--text);
    position: relative;
    flex-shrink: 0;
  }
  .m-appbar .iconbtn .dot {
    position: absolute; top: 8px; right: 8px;
    width: 6px; height: 6px; background: var(--accent);
    border-radius: 50%; box-shadow: 0 0 0 2px var(--bg);
  }

  /* ----- Hide desktop page header (replaced by app bar) ----- */
  .page-view .page-header { display: none; }

  /* ----- Bottom tab bar (canvas style) ----- */
  .mobile-tabs {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    z-index: 50;
    background: color-mix(in oklch, var(--bg) 86%, transparent);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    backdrop-filter: blur(20px) saturate(180%);
    border-top: 1px solid var(--border);
    padding: 8px 8px calc(14px + env(safe-area-inset-bottom));
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 2px;
  }
  .mobile-tabs button {
    position: relative;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 3px;
    padding: 6px 4px;
    border-radius: 10px;
    color: var(--text-mute);
    font-size: 10px;
    font-weight: 500;
    background: transparent;
  }
  .mobile-tabs button.active { color: var(--accent); }
  .mobile-tabs button .ic { width: 21px; height: 21px; }
  .mobile-tabs button .badge {
    position: absolute;
    top: 2px;
    right: calc(50% - 16px);
    background: var(--accent);
    color: var(--accent-fg);
    font-size: 9px;
    font-weight: 700;
    font-family: var(--font-mono);
    min-width: 14px;
    height: 14px;
    border-radius: 7px;
    padding: 0 4px;
    display: grid;
    place-items: center;
    border: 1.5px solid var(--bg);
    line-height: 1;
  }
  .mobile-tabs button .badge[hidden] { display: none; }

  /* ----- Floating action button ----- */
  .m-fab {
    display: grid; place-items: center;
    position: fixed;
    right: 16px;
    bottom: calc(86px + env(safe-area-inset-bottom));
    width: 52px; height: 52px;
    border-radius: 16px;
    background: var(--accent);
    color: var(--accent-fg);
    box-shadow:
      0 10px 24px oklch(from var(--accent) l c h / 0.4),
      0 2px 6px rgba(0,0,0,.18),
      inset 0 1px 0 rgba(255,255,255,.22);
    z-index: 40;
    border: none;
    cursor: pointer;
  }
  .m-fab:active { transform: translateY(1px); }

  /* ----- Mobile page padding (after app-bar) ----- */
  .page-view { padding: 0 16px; }
  .page-view > * { margin-left: 0; margin-right: 0; }

  /* Mobile: use the short KPI label variant */
  .kpi-label-full { display: none; }
  .kpi-label-short { display: inline; }

  /* ===== TODAY page ===== */
  /* KPI grid: 2x2 tiles, canvas style */
  #page-today .kpi-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin: 4px 0 0;
  }
  #page-today .kpi {
    padding: 14px 14px 12px;
    border-radius: 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    position: relative;
    overflow: hidden;
  }
  #page-today .kpi .kpi-label,
  #page-today .kpi-label {
    font-size: 11.5px; color: var(--text-mute); font-weight: 500;
  }
  #page-today .kpi .kpi-value,
  #page-today .kpi-value {
    font-size: 22px; font-weight: 600;
    font-family: var(--font-mono);
    margin-top: 6px;
    letter-spacing: -0.02em;
  }
  /* Hide subtext under each KPI on mobile — cleaner per canvas */
  #page-today .kpi .kpi-foot,
  #page-today .kpi-foot { display: none; }
  #page-today .kpi .spark { display: none; }

  /* Today grid → vertical stack */
  #page-today .today-grid { grid-template-columns: 1fr; gap: 14px; margin-top: 18px; }
  #page-today .today-side { display: flex; flex-direction: column; gap: 14px; }

  /* Timeline rows: 62px time column, compact */
  #page-today .timeline { border-radius: 14px; }
  #page-today .timeline-row {
    grid-template-columns: 56px 1fr;
    min-height: 60px;
  }
  #page-today .timeline-time {
    font-size: 11px; padding: 12px 8px 12px 14px;
    border-right: 1px solid var(--border);
  }
  #page-today .timeline-content { padding: 8px; gap: 6px; }

  /* Appointment "chip" → mobile card with status border */
  #page-today .appt {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 10px;
    padding: 9px 10px;
    border-radius: 10px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    align-items: center;
  }
  #page-today .appt.status-confirmed { border-left-color: var(--success); }
  #page-today .appt.status-pending   { border-left-color: var(--warning); }
  #page-today .appt.status-completed { border-left-color: var(--info); }
  #page-today .appt.status-declined,
  #page-today .appt.status-cancelled { border-left-color: var(--danger); opacity: 0.6; }
  #page-today .appt .who { font-weight: 500; font-size: 13.5px; }
  #page-today .appt .what { font-size: 11.5px; color: var(--text-mute); margin-top: 2px; }
  #page-today .appt .when { font-family: var(--font-mono); font-size: 11.5px; color: var(--text-dim); margin-left: auto; }
  #page-today .appt .pill { font-size: 10px; padding: 1px 6px; }

  /* "Next up" / "Today's load" / "Activity" cards keep their content but tighten */
  #page-today .today-side .card { padding: 14px; border-radius: 14px; }

  /* ===== APPOINTMENTS page ===== */
  /* Toolbar → horizontal scrolling chip row */
  #page-appointments .toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 8px 0 4px;
    margin-bottom: 4px;
    background: transparent;
    border: none;
  }
  #page-appointments .toolbar .seg {
    display: flex;
    overflow-x: auto;
    background: transparent;
    border: none;
    padding: 0;
    gap: 6px;
    scrollbar-width: none;
  }
  #page-appointments .toolbar .seg::-webkit-scrollbar { display: none; }
  #page-appointments .toolbar .seg button {
    padding: 7px 14px;
    border-radius: 999px;
    background: var(--surface);
    border: 1px solid var(--border);
    font-size: 12.5px;
    font-weight: 500;
    color: var(--text-dim);
    white-space: nowrap;
    flex-shrink: 0;
  }
  #page-appointments .toolbar .seg button.on {
    background: var(--accent);
    color: var(--accent-fg);
    border-color: var(--accent);
  }
  #page-appointments .toolbar > .flex-1,
  #page-appointments .toolbar #apptFilterBtn,
  #page-appointments .toolbar #apptExportBtn { display: none; }

  /* Table → card list */
  #page-appointments .card-flush.table-wrap {
    background: transparent;
    border: none;
    overflow: visible;
    width: 100%;
    max-width: 100%;
  }
  #page-appointments .tbl-appts {
    display: block;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    table-layout: auto;
    border-collapse: separate;
    border-spacing: 0 8px;
  }
  #page-appointments .tbl-appts thead { display: none; }
  #page-appointments .tbl-appts colgroup { display: none; }
  #page-appointments .tbl-appts tbody { display: block; width: 100%; }
  /* Empty-state row (single <td colspan=5>) styled as a notice card */
  #page-appointments .tbl-appts tbody > tr:not(.row) {
    display: block;
    background: var(--surface);
    border: 1px dashed var(--border);
    border-radius: 14px;
    margin-top: 4px;
  }
  #page-appointments .tbl-appts tbody > tr:not(.row) > td {
    display: block;
    padding: 24px 16px !important;
    text-align: center;
    font-size: 13px;
  }
  #page-appointments .tbl-appts tr.row {
    display: grid;
    grid-template-columns: 64px 1fr auto;
    gap: 10px 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    border-radius: 14px;
    padding: 12px 14px;
    margin-bottom: 0;
    align-items: center;
  }
  #page-appointments .tbl-appts tr.row[data-status="confirmed"] { border-left-color: var(--success); }
  #page-appointments .tbl-appts tr.row[data-status="pending"]   { border-left-color: var(--warning); }
  #page-appointments .tbl-appts tr.row[data-status="completed"] { border-left-color: var(--info); }
  #page-appointments .tbl-appts tr.row[data-status="declined"],
  #page-appointments .tbl-appts tr.row[data-status="cancelled"] { border-left-color: var(--danger); opacity: 0.7; }
  #page-appointments .tbl-appts tr.row td {
    border: none;
    padding: 0;
    background: transparent;
  }
  #page-appointments .tbl-appts tr.row td:nth-child(1) {
    grid-row: 1 / 3;
    text-align: center;
    align-self: center;
  }
  #page-appointments .tbl-appts tr.row td:nth-child(2) { grid-column: 2; grid-row: 1; min-width: 0; }
  #page-appointments .tbl-appts tr.row td:nth-child(3) { grid-column: 2; grid-row: 2; min-width: 0; }
  #page-appointments .tbl-appts tr.row td:nth-child(4) { grid-column: 3; grid-row: 1; justify-self: end; }
  #page-appointments .tbl-appts tr.row td:nth-child(5) { grid-column: 3; grid-row: 2; justify-self: end; }
  #page-appointments .tbl-appts .when-cell {
    flex-direction: column;
    gap: 1px;
  }
  #page-appointments .tbl-appts .when-day {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-mute);
  }
  #page-appointments .tbl-appts .when-time {
    font-size: 16px;
    font-weight: 600;
    letter-spacing: -0.02em;
  }
  #page-appointments .tbl-appts .who-cell {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
  }
  #page-appointments .tbl-appts .who-name {
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  #page-appointments .tbl-appts .who-meta {
    font-size: 11.5px;
    color: var(--text-mute);
  }
  #page-appointments .tbl-appts .svc-name { font-size: 12.5px; color: var(--text-mute); }
  #page-appointments .tbl-appts .svc-meta { font-size: 11px; color: var(--text-mute); font-family: var(--font-mono); }
  #page-appointments .tbl-appts .row-actions {
    display: flex;
    gap: 6px;
  }
  #page-appointments .tbl-appts .row-actions .btn {
    padding: 5px 10px;
    font-size: 11.5px;
  }

  /* ===== AVAILABILITY page ===== */
  #page-availability .toolbar {
    flex-direction: column;
    gap: 10px;
    align-items: stretch;
    padding: 8px 0 4px;
    border: none;
    background: transparent;
  }
  #page-availability .toolbar .row { font-size: 11px; flex-wrap: wrap; }
  #page-availability .toolbar #availTodayBtn { align-self: flex-start; }
  #page-availability .kpi-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px;
  }
  #page-availability .kpi {
    padding: 12px;
    border-radius: 14px;
    background: var(--surface);
    border: 1px solid var(--border);
  }
  #page-availability .kpi-value { font-size: 20px !important; }
  #page-availability .avail-layout { grid-template-columns: 1fr; gap: 14px; }
  #page-availability .month-grid {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }
  #page-availability .month-grid > * { min-width: 0; }
  #page-availability .month-dow {
    padding: 8px 2px;
    font-size: 9.5px;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  #page-availability .month-cell {
    min-height: 56px;
    padding: 5px 4px 4px;
    min-width: 0;
    overflow: hidden;
  }
  #page-availability .month-cell .cell-meta { font-size: 9px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  #page-availability .month-cell .num-row { font-size: 11px; }
  #page-availability .month-cell .cell-bar { height: 3px; }
  #page-availability .slot-list { grid-template-columns: 1fr; }

  /* ===== CLIENTS page ===== */
  #page-clients .toolbar {
    flex-direction: column;
    gap: 10px;
    align-items: stretch;
    padding: 8px 0 4px;
    border: none;
    background: transparent;
  }
  #page-clients .toolbar > .btn:first-child {
    width: 100% !important;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 10px 12px !important;
  }
  #page-clients .toolbar .seg {
    display: flex;
    overflow-x: auto;
    background: transparent;
    border: none;
    padding: 0;
    gap: 6px;
    scrollbar-width: none;
  }
  #page-clients .toolbar .seg::-webkit-scrollbar { display: none; }
  #page-clients .toolbar .seg button {
    padding: 7px 14px;
    border-radius: 999px;
    background: var(--surface);
    border: 1px solid var(--border);
    font-size: 12.5px;
    white-space: nowrap;
    flex-shrink: 0;
  }
  #page-clients .toolbar .seg button.on {
    background: var(--accent);
    color: var(--accent-fg);
    border-color: var(--accent);
  }
  #page-clients .toolbar > .flex-1,
  #page-clients .toolbar #addClientBtn { display: none; }

  /* Clients table → card list */
  #page-clients .card-flush.table-wrap {
    background: transparent;
    border: none;
    overflow: visible;
    width: 100%;
    max-width: 100%;
  }
  #page-clients .tbl {
    display: block;
    width: 100%;
    max-width: 100%;
    border-collapse: separate;
    border-spacing: 0 8px;
  }
  #page-clients .tbl thead { display: none; }
  #page-clients .tbl tbody { display: block; width: 100%; }
  /* Empty-state row */
  #page-clients .tbl tbody > tr:not([class]),
  #page-clients .tbl tbody > tr.tbl-empty {
    display: block;
    background: var(--surface);
    border: 1px dashed var(--border);
    border-radius: 14px;
    margin-top: 4px;
  }
  #page-clients .tbl tbody > tr:not([class]) > td,
  #page-clients .tbl tbody > tr.tbl-empty > td {
    display: block;
    padding: 24px 16px !important;
    text-align: center;
    font-size: 13px;
  }
  #page-clients .tbl tbody tr {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 6px 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 12px 14px;
    align-items: center;
  }
  #page-clients .tbl tbody tr td { display: contents; }
  #page-clients .tbl tbody tr td:nth-child(1) > * { grid-column: 1; }
  #page-clients .tbl tbody tr .who-cell { grid-column: 1; grid-row: 1 / 3; }
  #page-clients .tbl tbody tr .tier-pill,
  #page-clients .tbl tbody tr .pill { grid-column: 2; grid-row: 1; justify-self: end; }
  /* Hide less-essential cells on the cramped card */
  #page-clients .tbl tbody tr td:nth-child(3),
  #page-clients .tbl tbody tr td:nth-child(6) { display: none; }
  #page-clients .tbl tbody tr td:nth-child(4) {
    grid-column: 1; grid-row: 2;
    font-size: 11.5px; color: var(--text-mute);
    padding-left: 38px;
  }
  #page-clients .tbl tbody tr td:nth-child(5) {
    grid-column: 2; grid-row: 2; justify-self: end;
    font-size: 11.5px; color: var(--text-mute);
    font-family: var(--font-mono);
  }
  #page-clients .tbl tbody tr td:last-child {
    grid-column: 1 / 3; grid-row: 3; justify-self: end;
    margin-top: 4px;
  }

  /* ===== ANALYTICS page ===== */
  #page-analytics .kpi-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  #page-analytics .kpi { padding: 14px; border-radius: 14px; }
  #page-analytics .kpi-value { font-size: 22px; }
  #page-analytics .kpi .spark { display: none; }
  #page-analytics .toolbar {
    flex-direction: column;
    gap: 10px;
    align-items: stretch;
    padding: 8px 0 4px;
    border: none;
    background: transparent;
  }
  #page-analytics .toolbar .seg {
    display: flex;
    overflow-x: auto;
    background: transparent;
    border: none;
    padding: 0;
    gap: 6px;
    scrollbar-width: none;
  }
  #page-analytics .toolbar .seg::-webkit-scrollbar { display: none; }
  #page-analytics .toolbar .seg button {
    padding: 7px 14px;
    border-radius: 999px;
    background: var(--surface);
    border: 1px solid var(--border);
    font-size: 12.5px;
    white-space: nowrap;
    flex-shrink: 0;
  }
  #page-analytics .toolbar .seg button.on {
    background: var(--accent);
    color: var(--accent-fg);
    border-color: var(--accent);
  }
  #page-analytics .toolbar > .flex-1,
  #page-analytics .toolbar #exportCsvBtn { display: none; }
  #page-analytics .chart-row {
    grid-template-columns: 1fr;
    gap: 12px;
    margin-bottom: 12px !important;
  }
  #page-analytics .chart-row .card { padding: 14px; border-radius: 14px; }
  #page-analytics .heat-grid { font-size: 10px; }
  #page-analytics .cohort-grid { font-size: 10px; }
  #page-analytics .bars { height: 120px; }

  /* ===== SETTINGS page ===== */
  #page-settings .settings-layout {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  #page-settings .settings-nav {
    display: flex;
    overflow-x: auto;
    gap: 6px;
    padding: 0 0 2px;
    border: none;
    background: transparent;
    scrollbar-width: none;
  }
  #page-settings .settings-nav::-webkit-scrollbar { display: none; }
  #page-settings .settings-nav-item {
    padding: 7px 14px;
    border-radius: 999px;
    background: var(--surface);
    border: 1px solid var(--border);
    font-size: 12.5px;
    white-space: nowrap;
    flex-shrink: 0;
    color: var(--text-dim);
  }
  #page-settings .settings-nav-item.active {
    background: var(--accent);
    color: var(--accent-fg);
    border-color: var(--accent);
  }
  /* On mobile, hide standalone Services page; show Services-in-Settings nav item */
  #page-services { display: none !important; }
  .settings-nav-services-mobile { display: inline-flex; }

  /* ===== Services inside Settings on mobile — neater layout ===== */
  /* Summary stat card: clean 2x2 grid */
  #page-settings .services-summary {
    grid-template-columns: 1fr 1fr;
    gap: 14px 18px;
    padding: 14px 16px;
    border-radius: 12px;
    margin-bottom: 14px;
  }
  #page-settings .services-summary-item .ssi-label { font-size: 10.5px; }
  #page-settings .services-summary-item .ssi-value { font-size: 17px; }
  #page-settings .services-summary-actions {
    grid-column: 1 / -1;
    justify-self: stretch;
    border-top: 1px solid var(--border);
    padding-top: 12px;
    margin-top: 2px;
    gap: 8px;
  }
  #page-settings .services-summary-actions .btn { flex: 1; justify-content: center; }

  /* Service card: hide drag grip (touch reorder isn't supported); single-column stack */
  #page-settings .svc-grip,
  #page-settings .svc-h-grip { display: none; }
  #page-settings .services-header { display: none; }
  #page-settings .svc-card {
    grid-template-areas:
      "name    name"
      "price   duration"
      "visible actions";
    grid-template-columns: 1fr 1fr;
    gap: 4px 8px;
    padding: 12px;
    border-radius: 12px;
  }
  #page-settings .svc-card > .svc-cell-name {
    grid-area: name;
    padding: 0 0 4px;
    gap: 2px;
  }
  #page-settings .svc-card > .svc-cell-price {
    grid-area: price;
    padding: 0;
  }
  #page-settings .svc-card > .svc-cell-duration {
    grid-area: duration;
    padding: 0;
  }
  #page-settings .svc-card > .svc-cell-visible {
    grid-area: visible;
    padding: 6px 0 0;
    justify-self: start;
  }
  #page-settings .svc-card > .svc-cell-actions {
    grid-area: actions;
    padding: 6px 0 0;
    justify-self: end;
  }
  #page-settings .svc-field { width: 100%; }
  #page-settings .admin-body .svc-name { padding: 4px 6px; font-size: 14.5px; }
  #page-settings .admin-body .svc-desc { padding: 2px 6px; font-size: 12.5px; }
  /* Description on mobile is a textarea so it wraps fully */
  #page-settings .admin-body textarea.svc-desc {
    resize: none;
    overflow: hidden;
    line-height: 1.4;
    height: auto;
    min-height: 22px;
    font-family: inherit;
    display: block;
    white-space: pre-wrap;
    word-break: break-word;
    /* Chrome 123+/Safari 17.4+: textarea sizes itself to content */
    field-sizing: content;
  }

  /* Footer hint: full-width, smaller */
  #page-settings .services-foot { gap: 10px; margin-top: 14px; padding-top: 12px; }
  #page-settings .services-foot-hint { font-size: 11.5px; }

  /* ===== Modals → bottom sheets ===== */
  .modal-overlay {
    align-items: flex-end;
    padding: 0;
  }
  .modal-box {
    max-width: 100%;
    width: 100%;
    border-radius: 18px 18px 0 0;
    border-bottom: none;
    max-height: 88vh;
    animation: sheet-in 0.24s cubic-bezier(0.2, 0.85, 0.3, 1);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .modal-box::before {
    content: "";
    display: block;
    width: 36px; height: 4px;
    background: var(--text-mute);
    opacity: 0.45;
    border-radius: 999px;
    margin: 10px auto 0;
  }
  .confirm-box {
    max-width: 100%;
    width: 100%;
    border-radius: 18px 18px 0 0;
    border-bottom: none;
    padding-bottom: calc(22px + env(safe-area-inset-bottom));
    animation: sheet-in 0.24s cubic-bezier(0.2, 0.85, 0.3, 1);
  }
  @keyframes sheet-in {
    from { opacity: 0; transform: translateY(36px); }
    to   { opacity: 1; transform: translateY(0); }
  }
}



/* ============ Toast notifications ============ */
.toasts {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column-reverse;
  gap: 8px;
  pointer-events: none;
  max-width: 420px;
  width: calc(100vw - 48px);
}
.toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--surface-raised);
  border: 1px solid var(--border);
  box-shadow: 0 8px 24px oklch(0 0 0 / 0.35);
  font-size: 13px;
  line-height: 1.45;
  color: var(--text);
  animation: toast-in 0.25s ease-out;
}
.toast.removing {
  animation: toast-out 0.2s ease-in forwards;
}
.toast .ic {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  margin-top: 1px;
}
.toast .body {
  flex: 1;
  min-width: 0;
}
.toast .body strong {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 2px;
}
.toast .body .detail {
  font-size: 11.5px;
  color: var(--text-mute);
  font-family: var(--font-mono);
  word-break: break-all;
}
.toast .close {
  flex-shrink: 0;
  background: none;
  border: none;
  padding: 2px;
  cursor: pointer;
  color: var(--text-mute);
  transition: color 0.15s;
}
.toast .close:hover { color: var(--text); }
.toast.error { border-color: oklch(0.65 0.2 25 / 0.4); }
.toast.error .ic { color: oklch(0.72 0.18 25); }
.toast.success { border-color: oklch(0.65 0.17 145 / 0.4); }
.toast.success .ic { color: oklch(0.72 0.17 145); }
.toast.info { border-color: oklch(0.65 0.14 250 / 0.4); }
.toast.info .ic { color: oklch(0.72 0.14 250); }
.toast.warning { border-color: oklch(0.7 0.16 70 / 0.4); }
.toast.warning .ic { color: oklch(0.78 0.15 70); }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(12px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes toast-out {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to { opacity: 0; transform: translateY(8px) scale(0.96); }
}
@media (max-width: 820px) {
  .toasts { bottom: 90px; right: 12px; left: 12px; width: auto; max-width: none; }
}

/* ============ Modal ============ */
.modal-overlay {
  position: fixed; inset: 0; z-index: 900;
  background: oklch(0 0 0 / 0.65);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  animation: modal-bg-in 0.18s ease;
}
.modal-box {
  background: var(--surface-raised, var(--surface));
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%; max-width: 520px;
  max-height: 90vh; overflow-y: auto;
  animation: modal-in 0.2s ease;
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px 0;
}
.modal-header h2 { margin: 0; font-size: 15px; font-weight: 600; }
.modal-close {
  background: none; border: none; cursor: pointer;
  color: var(--text-mute); padding: 4px; border-radius: var(--radius-sm);
  transition: color 0.15s, background 0.15s;
}
.modal-close:hover { color: var(--text); background: var(--surface-2); }
.modal-body { padding: 16px 20px; }
.modal-footer { padding: 0 20px 18px; display: flex; gap: 8px; justify-content: flex-end; }

/* Confirm dialog */
.confirm-box {
  background: var(--surface-raised, var(--surface));
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 22px 24px; width: 100%; max-width: 380px;
  animation: modal-in 0.2s ease;
}
.confirm-box h3 { margin: 0 0 8px; font-size: 15px; font-weight: 600; }
.confirm-box p  { margin: 0 0 20px; color: var(--text-dim); font-size: 13px; line-height: 1.55; }
.confirm-footer { display: flex; gap: 8px; justify-content: flex-end; }

/* Form elements inside modals */
.form-group { margin-bottom: 14px; }
.form-group:last-child { margin-bottom: 0; }
.form-label {
  display: block; font-size: 11.5px; font-weight: 500;
  color: var(--text-mute); margin-bottom: 5px;
  text-transform: uppercase; letter-spacing: 0.04em;
}
.form-input {
  width: 100%; background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); color: var(--text);
  font-family: var(--font-sans); font-size: 13px;
  padding: 7px 10px; box-sizing: border-box;
  transition: border-color 0.15s;
}
.form-input:focus { outline: none; border-color: var(--accent); }
.form-input::placeholder { color: var(--text-mute); }
.form-select { appearance: none; cursor: pointer; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* Detail view inside modal */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.detail-field { }
.detail-label {
  font-size: 11px; font-weight: 500; color: var(--text-mute);
  text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 3px;
}

/* Command palette results */
.cmd-section {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-mute); padding: 10px 0 5px; font-weight: 500;
}
.cmd-result {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 6px; border-radius: var(--radius-sm);
  cursor: pointer; transition: background 0.1s;
}
.cmd-result:hover { background: var(--surface-2); }

/* Status pills for declined / cancelled */
.pill-declined  { background: var(--danger-soft); color: var(--danger); }
.pill-cancelled { background: var(--surface-2); color: var(--text-mute); }

@keyframes modal-bg-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes modal-in {
  from { opacity: 0; transform: scale(0.96) translateY(8px); }
  to   { opacity: 1; transform: none; }
}
@media (max-width: 600px) {
  .modal-box { max-width: 100%; }
  .form-row { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
}

/* ============ SETTINGS PAGE ============ */
.settings-layout {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 24px;
  align-items: start;
}
.settings-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  position: sticky;
  top: 16px;
}
.settings-nav-item {
  text-align: left;
  background: transparent;
  border: none;
  color: var(--text-mute);
  font: inherit;
  font-size: 13.5px;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 120ms, color 120ms;
}
.settings-nav-item:hover { background: var(--surface-hover, rgba(255,255,255,0.04)); color: var(--text); }
.settings-nav-item.active { background: var(--accent-soft); color: var(--accent); }

.settings-content { display: flex; flex-direction: column; gap: 16px; }
.settings-section { display: none; flex-direction: column; gap: 16px; }
.settings-section.active { display: flex; }

.settings-h {
  margin: 0 0 4px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.form-label {
  display: block;
  font-size: 12px;
  color: var(--text-mute);
  margin-bottom: 6px;
  letter-spacing: 0.01em;
}

.setting-saved {
  display: inline-block;
  margin-top: 6px;
  font-size: 11.5px;
  color: var(--success, #10b981);
  opacity: 0;
  transition: opacity 200ms;
}
.setting-saved.show { opacity: 1; }

.setting-err {
  display: block;
  margin-top: 6px;
  font-size: 11.5px;
  color: var(--danger, #ef4444);
  min-height: 14px;
}

.color-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.color-input {
  width: 44px;
  height: 36px;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
}
.color-input::-webkit-color-swatch-wrapper { padding: 0; }
.color-input::-webkit-color-swatch { border: none; border-radius: 6px; }

.mono { font-family: 'JetBrains Mono', monospace; font-size: 13px; }

.swatch-row { display: flex; gap: 6px; }
.swatch {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.15);
  cursor: pointer;
  padding: 0;
  transition: transform 100ms, box-shadow 100ms;
}
.swatch:hover { transform: scale(1.1); }
.swatch.active { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent); }

.favicon-row {
  display: flex;
  align-items: center;
  gap: 16px;
}
.favicon-preview {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  background: var(--accent);
  color: var(--accent-fg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 22px;
  font-family: sans-serif;
}

.banner-row {
  display: flex;
  align-items: center;
  gap: 16px;
}
.banner-preview {
  width: 220px;
  height: 110px;
  border-radius: 10px;
  border: 1px dashed var(--border);
  background: var(--surface);
  background-size: cover;
  background-position: center;
  display: flex;
  align-items: center;
  justify-content: center;
}
.banner-actions { display: flex; flex-direction: column; gap: 8px; }
.banner-actions .btn { cursor: pointer; }

.btn-ghost {
  background: transparent;
  color: var(--text-mute);
}
.btn-ghost:hover { color: var(--text); }

@media (max-width: 720px) {
  .settings-layout { grid-template-columns: 1fr; }
  .settings-nav {
    flex-direction: row;
    overflow-x: auto;
    position: static;
    padding-bottom: 4px;
  }
  .settings-nav-item { white-space: nowrap; }
  .banner-row { flex-direction: column; align-items: stretch; }
  .banner-preview { width: 100%; }
}

/* ============ SERVICES PAGE ============ */
.services-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, auto)) 1fr;
  gap: 24px;
  align-items: center;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 14px;
}
.services-summary-item { display: flex; flex-direction: column; gap: 2px; }
.services-summary-item .ssi-label {
  color: var(--text-mute);
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 500;
}
.services-summary-item .ssi-value {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.015em;
  font-family: var(--font-mono);
  font-feature-settings: "tnum";
}
.services-summary-item .ssi-aux {
  color: var(--text-mute);
  font-weight: 400;
  font-size: 13px;
  font-family: var(--font-sans);
  margin-left: 4px;
}
.services-summary-actions { display: flex; gap: 8px; justify-self: end; }

.services-header {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) 120px 130px 130px 96px;
  align-items: center;
  padding: 0 14px;
  margin-bottom: 6px;
  color: var(--text-mute);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.services-header > div { padding: 0 8px; }
.svc-h-grip { padding: 0 !important; }
.svc-h-actions { text-align: right; }

.services-list { display: flex; flex-direction: column; gap: 8px; }

.svc-card {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) 120px 130px 130px 96px;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color .12s, background .12s, box-shadow .12s, opacity .12s;
  position: relative;
}
.svc-card:hover { border-color: var(--border-strong); }
.svc-card.is-hidden { background: oklch(from var(--surface) calc(l - 0.02) c h); }
.svc-card.is-hidden .svc-name,
.svc-card.is-hidden .svc-desc { color: var(--text-dim); }
.svc-card.drag-over {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.svc-card.dragging { opacity: 0.5; }

.svc-grip {
  display: grid;
  grid-template-columns: repeat(2, 4px);
  grid-template-rows: repeat(3, 4px);
  gap: 3px;
  place-content: center;
  align-self: stretch;
  cursor: grab;
  color: oklch(from var(--text-mute) l c h / 0.6);
  border-right: 1px solid var(--border);
  user-select: none;
  transition: background .12s, color .12s;
}
.svc-grip:hover { background: var(--surface-2); color: var(--text); }
.svc-grip:active { cursor: grabbing; }
.svc-grip span { width: 3px; height: 3px; border-radius: 50%; background: currentColor; }

.svc-cell { padding: 10px 8px; min-width: 0; }
.svc-cell-name { display: flex; flex-direction: column; gap: 2px; padding: 10px 4px 10px 10px; }
.svc-cell-actions { display: flex; gap: 8px; align-items: center; justify-content: flex-end; padding-right: 12px; }

/* Name + description: inline-edit feel; transparent until hover/focus.
   Use .admin-body prefix to beat the global input reset. */
.admin-body .svc-name, .admin-body .svc-desc {
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  width: 100%;
  color: var(--text);
  outline: none;
}
.admin-body .svc-name {
  font-weight: 500;
  font-size: 14px;
  padding: 5px 8px;
  letter-spacing: -0.005em;
}
.admin-body .svc-desc {
  font-size: 12.5px;
  color: var(--text-dim);
  padding: 4px 8px;
}
.admin-body .svc-name:hover,
.admin-body .svc-desc:hover { border-color: var(--border); background: var(--bg); }
.admin-body .svc-name:focus,
.admin-body .svc-desc:focus {
  background: var(--bg);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* Number fields share a wrapper */
.svc-field {
  display: flex;
  align-items: center;
  gap: 4px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0 10px;
  background: var(--bg);
  transition: border-color .12s, box-shadow .12s;
}
.svc-field:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.admin-body .svc-field .ipt {
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 7px 0;
  width: 100%;
  text-align: right;
  font-feature-settings: "tnum";
  min-width: 0;
  color: var(--text);
  outline: none;
}
.admin-body .svc-field .ipt:focus { outline: none; }
.admin-body .svc-field .ipt::-webkit-outer-spin-button,
.admin-body .svc-field .ipt::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.admin-body .svc-field .ipt[type="number"] { -moz-appearance: textfield; }
.svc-prefix, .svc-suffix { color: var(--text-mute); font-size: 12px; font-family: var(--font-mono); }
.svc-prefix { margin-right: -2px; }

/* Visible toggle */
.svc-visible {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px 5px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg);
  cursor: pointer;
  font-size: 12px;
  color: var(--text-mute);
  user-select: none;
  font-weight: 500;
  transition: border-color .12s, color .12s, background .12s;
  position: relative;
}
.svc-visible:hover { border-color: var(--border-strong); }
.svc-visible.on {
  color: var(--success);
  border-color: oklch(from var(--success) l c h / 0.35);
  background: var(--success-soft);
}
.svc-visible input { position: absolute; opacity: 0; pointer-events: none; }
.svc-switch {
  position: relative;
  width: 26px; height: 14px;
  border-radius: 999px;
  background: var(--surface-3);
  transition: background .15s;
  flex-shrink: 0;
}
.svc-switch i {
  position: absolute; top: 2px; left: 2px;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--text-mute);
  transition: transform .15s, background .15s;
}
.svc-visible.on .svc-switch { background: var(--success); }
.svc-visible.on .svc-switch i { transform: translateX(12px); background: #fff; }
.svc-visible-label { min-width: 36px; }

/* Saved indicator */
.svc-saved {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  font-weight: 500;
  color: var(--success);
  opacity: 0;
  transform: translateY(-2px);
  transition: opacity .2s, transform .2s;
  white-space: nowrap;
  background: var(--success-soft);
  padding: 3px 7px;
  border-radius: 999px;
}
.svc-saved.on { opacity: 1; transform: translateY(0); }

/* Delete button — same specificity trick */
.admin-body .svc-delete { padding: 6px 8px; color: var(--text-mute); }
.admin-body .svc-delete:hover { background: var(--danger-soft); color: var(--danger); }

/* Footer */
.services-foot {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px dashed var(--border);
  flex-wrap: wrap;
}
.services-foot-hint {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-mute);
  max-width: 620px;
}

@media (max-width: 1100px) {
  .services-summary {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px 18px;
  }
  .services-summary-item .ssi-label { white-space: nowrap; font-size: 10.5px; }
  .services-summary-item .ssi-value { font-size: 16px; }
  .services-summary-actions {
    grid-column: 1 / -1;
    justify-self: stretch;
    border-top: 1px solid var(--border);
    padding-top: 12px;
    justify-content: flex-end;
  }
  .services-header { display: none; }
  .svc-card {
    grid-template-areas:
      "grip name name"
      "grip price duration"
      "grip visible actions";
    grid-template-columns: 28px 1fr 1fr;
    padding: 4px 0;
  }
  .svc-grip { grid-area: grip; border-right: 1px solid var(--border); }
  .svc-cell-name { grid-area: name; padding: 10px 12px 4px; }
  .svc-card > .svc-cell-price { grid-area: price; padding: 4px 8px 4px 12px; display: flex; align-items: center; }
  .svc-card > .svc-cell-duration { grid-area: duration; padding: 4px 12px 4px 8px; display: flex; align-items: center; }
  .svc-cell-visible { grid-area: visible; padding: 0 12px 10px; display: flex; align-items: center; }
  .svc-cell-actions { grid-area: actions; justify-content: flex-end; padding: 0 12px 10px; }
  .svc-field { width: 100%; }
}
@media (max-width: 720px) {
  .services-summary { grid-template-columns: repeat(2, 1fr); gap: 14px; }
  .services-summary-actions { grid-column: 1 / -1; justify-self: stretch; }
  .services-summary-actions .btn { flex: 1; justify-content: center; }
  .svc-card {
    grid-template-areas:
      "grip name"
      "grip price"
      "grip duration"
      "grip visible"
      "grip actions";
    grid-template-columns: 28px 1fr;
  }
  .svc-card > .svc-cell-price,
  .svc-card > .svc-cell-duration { padding: 4px 12px; }
  .svc-cell-visible, .svc-cell-actions { padding: 4px 12px 10px; }
}

/* ============ Light theme — color-only override ============ */
[data-theme="light"] {
  --bg: oklch(0.985 0.003 80);
  --bg-elev: oklch(0.975 0.004 80);
  --surface: oklch(1 0 0);
  --surface-2: oklch(0.965 0.004 80);
  --surface-3: oklch(0.93 0.005 80);
  --surface-raised: oklch(1 0 0);
  --surface-hover: oklch(0.95 0.004 80);
  --border: oklch(0.90 0.005 80);
  --border-strong: oklch(0.82 0.007 80);
  --text: oklch(0.22 0.008 80);
  --text-dim: oklch(0.42 0.007 80);
  --text-mute: oklch(0.58 0.006 80);
  --accent: oklch(0.66 0.14 55);
  --accent-fg: oklch(1 0 0);
  --accent-soft: oklch(0.66 0.14 55 / 0.14);
  --success: oklch(0.52 0.14 155);
  --success-soft: oklch(0.52 0.14 155 / 0.12);
  --warning: oklch(0.58 0.14 70);
  --warning-soft: oklch(0.78 0.14 85 / 0.20);
  --danger: oklch(0.55 0.20 25);
  --danger-soft: oklch(0.55 0.20 25 / 0.10);
  --info: oklch(0.52 0.14 235);
  --info-soft: oklch(0.52 0.14 235 / 0.10);
  --shadow-sm: 0 1px 2px rgba(20,20,30,.06);
  --shadow: 0 6px 20px rgba(20,20,30,.07), 0 1px 2px rgba(20,20,30,.05);
  --shadow-lg: 0 24px 60px rgba(20,20,30,.14);
}

/* Element-level tweaks for light mode — token swap alone isn't enough here */
[data-theme="light"] .brand-mark {
  background: linear-gradient(135deg, var(--accent), oklch(0.55 0.15 35));
  color: #fff;
  box-shadow: 0 1px 2px rgba(20,20,30,.12), inset 0 1px 0 rgba(255,255,255,.25);
}
[data-theme="light"] .kpi,
[data-theme="light"] .card { box-shadow: var(--shadow-sm); }
[data-theme="light"] .topbar,
[data-theme="light"] .admin-sidebar,
[data-theme="light"] .mobile-tabs { background: var(--bg-elev); }
[data-theme="light"] .tbl th { background: var(--bg-elev); }
[data-theme="light"] .sg-time { background: var(--bg-elev); color: var(--text-mute); }
[data-theme="light"] .sg-head { background: var(--bg-elev); }
[data-theme="light"] .sg-row-barber { background: var(--bg-elev); }
[data-theme="light"] .modal-overlay { background: oklch(0.3 0.01 250 / 0.35); }
[data-theme="light"] .toast,
[data-theme="light"] .modal-box,
[data-theme="light"] .confirm-box { background: var(--surface); box-shadow: var(--shadow-lg); }
[data-theme="light"] .sg-block.booked    { color: oklch(0.4 0.14 235); }
[data-theme="light"] .sg-block.confirmed { color: oklch(0.4 0.14 155); }
[data-theme="light"] .month-cell.is-today .num { color: #fff; }
[data-theme="light"] .swatch { border: 1px solid rgba(20,20,30,0.15); }
[data-theme="light"] .swatch.active { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent); }
[data-theme="light"] .btn-primary,
[data-theme="light"] .admin-body .btn-apply {
  box-shadow: 0 1px 2px rgba(20,20,30,.10), inset 0 1px 0 rgba(255,255,255,.18);
}
