/* ── Variables ───────────────────────────────────────────── */
:root {
  --bg:       #0f1220;
  --card:     #1a1f36;
  --muted:    #8a92b2;
  --text:     #eef1fb;
  --accent:   #6c8cff;
  --accent-2: #46d39a;
  --danger:   #ff6b6b;
  --border:   #2a3157;
  --radius:   14px;
  --input-bg: #0e1226;
  --surface-2: #2a3157;
  --surface-2-hover: #354070;
  --body-bg: linear-gradient(180deg, #0c0f1c, #11152a);
  --header-bg: rgba(20, 24, 46, 0.7);
  --toolbar-bg: linear-gradient(180deg, #0c0f1c 70%, transparent);
  --row-divider: rgba(255, 255, 255, 0.3);
  --nav-hover: rgba(108, 140, 255, 0.1);
  --nav-active-bg: rgba(108, 140, 255, 0.15);
  --select-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%238a92b2' d='M0 0l6 8 6-8z'/%3E%3C/svg%3E");
  --btn-bg: var(--accent);
  --btn-fg: #ffffff;
  --btn-border: transparent;
  --btn-hover-bg: var(--accent);
  --focus-ring: var(--accent);
  --slot-sel-bg: var(--accent);
  --slot-sel-fg: #ffffff;
  --appt-svc-bg: rgba(255, 255, 255, 0.04);
  --appt-svc-border: rgba(255, 255, 255, 0.06);
  --appt-head-bg: rgba(255, 255, 255, 0.06);
  --appt-head-border: rgba(255, 255, 255, 0.08);
}

html[data-theme="light"] {
  color-scheme: light;
  /* Radix Slate scale + Stripe-style canvas (#f6f9fc) */
  --bg: #f6f9fc;
  --card: #ffffff;
  --muted: #60646c;
  --text: #1c2024;
  --accent: #1c2024;
  --accent-2: #218358;
  --danger: #e5484d;
  --border: #e5edf5;
  --input-bg: #ffffff;
  --surface-2: #f0f0f3;
  --surface-2-hover: #e8e8ec;
  --body-bg: #f6f9fc;
  --header-bg: rgba(255, 255, 255, 0.88);
  --toolbar-bg: linear-gradient(180deg, #f6f9fc 70%, transparent);
  --row-divider: #e8e8ec;
  --nav-hover: #f0f0f3;
  --nav-active-bg: #f0f0f3;
  --select-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2360646c' d='M0 0l6 8 6-8z'/%3E%3C/svg%3E");
  --btn-bg: #1c2024;
  --btn-fg: #ffffff;
  --btn-border: #1c2024;
  --btn-hover-bg: #343839;
  --focus-ring: #8b8d98;
  --slot-sel-bg: #1c2024;
  --slot-sel-fg: #ffffff;
  --appt-svc-bg: #f4f7fb;
  --appt-svc-border: #e5edf5;
  --appt-head-bg: #eef2f7;
  --appt-head-border: #e5edf5;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08);
}
html[data-theme="light"] body {
  -webkit-font-smoothing: antialiased;
}
html[data-theme="light"] .card {
  box-shadow: var(--shadow-sm);
}
html[data-theme="light"] nav a {
  color: var(--muted);
}
html[data-theme="light"] nav a:hover {
  color: var(--text);
}
html[data-theme="light"] .admin-nav-btn.active {
  color: var(--text);
  border-color: var(--border);
  background: var(--nav-active-bg);
}
html[data-theme="light"] .toggle-add-btn.open {
  color: var(--text);
  border-color: var(--border);
  background: var(--nav-active-bg);
}
html[data-theme="light"] .slot {
  background: var(--card);
  box-shadow: var(--shadow-sm);
}
html[data-theme="light"] .slot:hover {
  border-color: var(--focus-ring);
  background: var(--surface-2);
}
html[data-theme="light"] .slot.sel {
  box-shadow: none;
}
html[data-theme="light"] button.secondary {
  background: var(--card);
  border-color: var(--border);
}
html[data-theme="light"] button.secondary:hover,
html[data-theme="light"] button.secondary:active {
  background: var(--surface-2);
}
html[data-theme="light"] .msg.err {
  background: #feebec;
  color: #ce2c31;
}
html[data-theme="light"] .msg.ok {
  background: #e6f6eb;
  color: #218358;
}
html[data-theme="light"] .tag:not(.ok):not(.warn) {
  background: var(--surface-2);
  color: var(--text);
}
html[data-theme="light"] .tag.ok {
  background: #e6f6eb;
  color: #218358;
}
html[data-theme="light"] .tag.warn {
  background: #feebec;
  color: #ce2c31;
}
html[data-theme="light"] .time-popover {
  box-shadow: var(--shadow-md);
}
html[data-theme="light"] .time-popover .time-ok-btn {
  background: #e6f6eb;
  border-color: #8eceaa;
  color: #218358;
}
html[data-theme="light"] .time-popover .time-ok-btn:hover {
  background: #d6f1df;
  color: #218358;
}
html[data-theme="light"] .wh-range .wh-del {
  background: #feebec;
}
html[data-theme="light"] .wh-add {
  background: var(--card);
}
html[data-theme="light"] .wh-day-name:hover {
  color: var(--text);
}
html[data-theme="light"] .pill-links a:hover {
  border-color: var(--border);
  background: var(--surface-2);
}
html[data-theme="light"] dialog.dlg::backdrop {
  background: rgba(0, 0, 0, 0.35);
}
html[data-theme="light"] .admin-sidebar-backdrop {
  background: rgba(0, 0, 0, 0.2);
}
html[data-theme="light"] .toast {
  box-shadow: var(--shadow-md);
}
html[data-theme="light"] .toast.toast-ok {
  background: #e6f6eb;
  color: #218358;
}

/* ── Reset ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--body-bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.5;
}

/* ── Header ──────────────────────────────────────────────── */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--header-bg);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 10;
  gap: 8px;
}
header h1  { font-size: 17px; margin: 0; white-space: nowrap; }
header .sub { color: var(--muted); font-size: 12px; }
nav { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
nav a {
  color: var(--accent);
  text-decoration: none;
  font-size: 13px;
  padding: 6px 10px;
  border-radius: 8px;
  white-space: nowrap;
}
nav a:hover { background: var(--nav-hover); }
html[data-theme="light"] nav a:hover { color: var(--text); }

/* ── Layout ──────────────────────────────────────────────── */
.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 16px;
}
.grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

/* ── Cards ───────────────────────────────────────────────── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
}
.card h2 { margin: 0 0 14px; font-size: 16px; }
.settings-sub { margin: 18px 0 6px; font-size: 14px; font-weight: 600; color: var(--text); }
.settings-save-card button { margin-top: 0; }

/* ── Forms ───────────────────────────────────────────────── */
label { display: block; font-size: 13px; color: var(--muted); margin: 10px 0 4px; }
input, select, textarea {
  width: 100%;
  padding: 11px 12px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background-color: var(--input-bg);
  color: var(--text);
  font-size: 15px;
  min-height: 44px;
  appearance: none;
  -webkit-appearance: none;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--focus-ring);
  outline-offset: 1px;
}
input[type="checkbox"],
input[type="radio"] {
  width: auto;
  min-height: 0;
  appearance: auto;
  -webkit-appearance: checkbox;
  accent-color: var(--accent);
  cursor: pointer;
}
input[type="radio"] {
  -webkit-appearance: radio;
}
select {
  background-image: var(--select-arrow);
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}
input.price-input,
input[data-price] {
  width: 96px;
  min-width: 96px;
  max-width: 120px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* ── Buttons ─────────────────────────────────────────────── */
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--btn-bg);
  color: var(--btn-fg);
  border: 1px solid var(--btn-border);
  border-radius: 9px;
  padding: 11px 18px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 10px;
  min-height: 44px;
  touch-action: manipulation;
  white-space: nowrap;
}
button:active { filter: brightness(.9); }
button:hover  { filter: brightness(1.08); }
html[data-theme="light"] button:hover,
html[data-theme="light"] button:active {
  filter: none;
  background: var(--btn-hover-bg);
}
button.secondary { background: var(--surface-2); color: var(--text); }
button.danger    { background: var(--danger); color: #fff; }
html[data-theme="light"] button.danger:hover,
html[data-theme="light"] button.danger:active {
  filter: none;
  background: #dc3e42;
}
button.ghost     { background: transparent; border: 1px solid var(--border); color: var(--text); }
button.ghost.danger { color: var(--danger); border-color: var(--danger); }
button:focus { outline: none; }
button:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}
button:focus:not(:focus-visible) {
  outline: none;
}

/* ── Row (form field groups) ─────────────────────────────── */
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.row > div { flex: 1; min-width: 140px; }

/* ── Admin section nav ─────────────────────────────────────── */
.admin-toolbar {
  display: none;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  position: sticky;
  top: 52px;
  z-index: 9;
  padding: 6px 0;
  background: var(--toolbar-bg);
}
.admin-menu-btn {
  margin: 0;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  font-size: 24px;
  line-height: 1;
  letter-spacing: 0.08em;
  border-radius: 10px;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
  flex-shrink: 0;
}
.admin-toolbar-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}
.admin-sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 100;
}
.admin-sidebar {
  position: relative;
  margin-bottom: 16px;
}
.admin-sidebar-head {
  display: none;
}
.admin-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  position: sticky;
  top: 52px;
  z-index: 9;
}
.admin-nav-btn {
  margin: 0;
  padding: 8px 12px;
  min-height: 36px;
  font-size: 13px;
  border-radius: 9px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--muted);
  white-space: nowrap;
}
.admin-nav-btn:hover {
  color: var(--text);
  border-color: var(--border);
  background: var(--nav-hover);
}
.admin-nav-btn.active {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--nav-active-bg);
}
.admin-page { margin-bottom: 8px; }
body.admin-sidebar-open { overflow: hidden; }

/* ── form-stack: full-width stacked sections inside a card ── */
.form-stack { display: flex; flex-direction: column; gap: 4px; }
.form-stack > button { margin-top: 8px; align-self: flex-start; }

/* ── Card header (title + action icon) ───────────────────── */
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  gap: 8px;
}
.card-header h2 { margin: 0; }
.toggle-add-btn {
  font-size: 20px;
  line-height: 1;
  padding: 2px 8px;
  min-height: 32px;
  border-radius: 8px;
  flex-shrink: 0;
}
.toggle-add-btn.open { background: var(--nav-active-bg); color: var(--accent); border-color: var(--accent); }

/* ── Collapsible add-form ─────────────────────────────────── */
.collapsible { margin-bottom: 14px; }
.collapsible.hide { display: none !important; }

/* ── Utility ─────────────────────────────────────────────── */
.muted  { color: var(--muted); font-size: 13px; }
.hide   { display: none !important; }
.tag {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 12px;
  background: var(--surface-2);
  color: var(--text);
  white-space: nowrap;
}
.tag.ok   { background: rgba(70,211,154,.2); color: var(--accent-2); }
.tag.warn { background: rgba(255,107,107,.2); color: var(--danger); }

/* ── Tables ──────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -4px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 400px; }
th, td {
  text-align: left;
  padding: 9px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; white-space: nowrap; }
.hide { display: none !important; }
.tag-btn { cursor: pointer; user-select: none; }
.tag-btn:hover { filter: brightness(1.15); }
td button { margin-top: 0; padding: 6px 10px; min-height: 36px; font-size: 13px; }
td.btn-group { white-space: nowrap; display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
td.btn-group .icon-btn { padding: 6px 8px; min-height: 36px; min-width: 36px; color: var(--text); }
td.btn-group .icon-btn svg { display: block; }

.card-focus {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
  transition: outline-color 0.3s;
}

/* ── Slots (booking picker) ──────────────────────────────── */
#slots { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
#bookCard #slots.client-slots-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
#bookCard .slot.client-slot-row {
  margin: 0;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
  font-weight: 500;
}
#bookCard .slot.client-slot-row:hover {
  background: var(--surface-2);
  border-color: var(--border);
  filter: none;
}
html[data-theme="light"] #bookCard .slot.client-slot-row:hover,
html[data-theme="light"] #bookCard .slot.client-slot-row:active {
  filter: none;
  background: var(--surface-2);
  color: var(--text);
}
#bookCard .slot.client-slot-row.sel,
html[data-theme="light"] #bookCard .slot.client-slot-row.sel,
html[data-theme="light"] #bookCard .slot.client-slot-row.sel:hover,
html[data-theme="light"] #bookCard .slot.client-slot-row.sel:active {
  background: var(--slot-sel-bg);
  color: var(--slot-sel-fg);
  border-color: var(--slot-sel-bg);
  filter: none;
}
.slot {
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  cursor: pointer;
  background: var(--input-bg);
  color: var(--text);
  font-size: 14px;
  min-height: 44px;
  display: flex;
  align-items: center;
  touch-action: manipulation;
}
.slot:hover { border-color: var(--accent); }
.slot.sel   { background: var(--slot-sel-bg); color: var(--slot-sel-fg); border-color: var(--slot-sel-bg); }

/* ── Messages ────────────────────────────────────────────── */
.msg { padding: 10px 12px; border-radius: 9px; margin: 10px 0; font-size: 14px; display: none; }
.msg.show { display: block; }
.msg.err  { background: rgba(255,107,107,.15); color: var(--danger); }
.msg.ok   { background: rgba(70,211,154,.15);  color: var(--accent-2); }

/* ── Nav pill links (index) ──────────────────────────────── */
.pill-links a {
  display: block;
  padding: 14px 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin: 10px 0;
  text-decoration: none;
  color: var(--text);
}
.pill-links a:hover { border-color: var(--accent); }

/* ── Working hours editor ────────────────────────────────── */
.wh-copy-row { margin: 8px 0 12px; align-items: flex-end; }
.wh-copy-row .wh-copy-action { padding-bottom: 2px; }
.wh-copy-row .wh-copy-action button { margin-top: 0; white-space: nowrap; }
#whEditor {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-top: 8px;
}
.weekday-row {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin: 0;
  padding: 14px 0 16px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--row-divider);
}
.weekday-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}
.weekday-row > span {
  width: 74px;
  flex-shrink: 0;
  color: var(--muted);
  font-size: 13px;
  padding-top: 12px;
  font-weight: 600;
}
.wh-day-name { cursor: pointer; user-select: none; }
.wh-day-name:hover { color: var(--accent); }
.time-wrap {
  display: inline-flex;
  align-items: stretch;
  flex-shrink: 0;
}
.time-wrap input[data-time] {
  width: 74px;
  min-width: 74px;
  min-height: 40px;
  font-size: 14px;
  padding: 8px;
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  border-right: 0;
}
.time-pick-btn {
  min-width: 40px;
  min-height: 40px;
  margin: 0;
  padding: 0 8px;
  border-radius: 0 9px 9px 0;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-left: 0;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.time-pick-btn:hover { background: var(--surface-2-hover); color: var(--text); }
.date-wrap {
  display: inline-flex;
  align-items: stretch;
  flex-shrink: 0;
}
.date-wrap input[data-date] {
  width: 110px;
  min-width: 110px;
  min-height: 40px;
  font-size: 14px;
  padding: 8px;
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  border-right: 0;
}
.date-pick-hidden {
  position: absolute;
  width: 0;
  height: 0;
  opacity: 0;
  pointer-events: none;
}
.date-pick-btn {
  min-width: 40px;
  min-height: 40px;
  margin: 0;
  padding: 0 8px;
  border-radius: 0 9px 9px 0;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-left: 0;
  color: var(--text);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.date-pick-btn:hover { background: var(--surface-2-hover); color: var(--text); }
.off-add-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.time-popover {
  position: absolute;
  z-index: 1000;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  gap: 6px;
  align-items: center;
  box-shadow: 0 8px 24px rgba(0,0,0,.45);
}
.time-popover select {
  width: auto;
  min-width: 72px;
  min-height: 40px;
  padding: 6px 10px;
  font-size: 15px;
}
.time-popover .time-ok-btn {
  min-width: 40px;
  min-height: 40px;
  margin: 0;
  padding: 0 10px;
  border-radius: 9px;
  background: rgba(70, 211, 154, 0.2);
  border: 1px solid var(--accent-2);
  color: var(--accent-2);
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
  flex-shrink: 0;
}
.time-popover .time-ok-btn:hover {
  background: rgba(70, 211, 154, 0.35);
  color: #fff;
}
.wh-ranges  { display: flex; flex-direction: column; gap: 6px; flex: 1; }
.wh-ranges.wh-repo {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-height: 40px;
}
.wh-repo-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.wh-range   { display: flex; gap: 6px; align-items: center; }
.wh-range .wh-del {
  padding: 6px 10px; min-height: 40px; min-width: 40px; margin-top: 0;
  background: rgba(255,107,107,.15); border-color: var(--danger); color: var(--danger);
  font-size: 16px; line-height: 1;
}
.wh-add {
  margin-top: 0; padding: 7px 12px; min-height: 36px; font-size: 13px;
  background: var(--surface-2); border: 1px solid var(--btn-border); color: var(--text);
  white-space: nowrap;
}
.wh-range .wh-add { margin-left: 2px; }
.off-del {
  padding: 6px 10px; min-height: 36px; min-width: 36px; margin: 0;
  background: rgba(255,107,107,.15); border-color: var(--danger); color: var(--danger);
  font-size: 16px; line-height: 1;
}

/* ── Service drag reorder ─────────────────────────────────── */
.svc-drag-head { width: 36px; }
.svc-drag-cell { width: 36px; text-align: center; vertical-align: middle; }
.svc-drag-handle {
  display: inline-block;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
  cursor: grab;
  user-select: none;
  padding: 4px;
}
tr[data-svc-id].svc-dragging { opacity: 0.45; }
tr[data-svc-id].svc-drag-over td { box-shadow: inset 0 2px 0 var(--accent); }
tr[data-emp-email].svc-dragging { opacity: 0.45; }
tr[data-emp-email].svc-drag-over td { box-shadow: inset 0 2px 0 var(--accent); }

/* ── Mobile overrides (≤ 600px) ──────────────────────────── */
@media (max-width: 600px) {
  /* Layout */
  .container { padding: 8px; }
  .card { padding: 14px 12px; margin-bottom: 10px; border-radius: 12px; }
  .card h2 { font-size: 15px; margin-bottom: 12px; }
  .grid { grid-template-columns: 1fr; }

  /* Header */
  header { flex-wrap: wrap; padding: 10px 12px; gap: 6px; }
  header h1 { font-size: 14px; }
  nav a { font-size: 12px; padding: 5px 8px; }

  .admin-toolbar {
    display: flex;
    top: 48px;
  }
  .admin-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(280px, 86vw);
    margin: 0;
    z-index: 101;
    background: var(--card);
    border-right: 1px solid var(--border);
    transform: translateX(-105%);
    transition: transform 0.22s ease;
    display: flex;
    flex-direction: column;
    box-shadow: 8px 0 32px rgba(0, 0, 0, 0.35);
  }
  .admin-sidebar.open {
    transform: translateX(0);
  }
  .admin-sidebar-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 12px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
  }
  .admin-sidebar-head strong {
    font-size: 15px;
    color: var(--text);
  }
  .admin-nav {
    position: static;
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: stretch;
    gap: 4px;
    margin: 0;
    padding: 10px;
    border: none;
    border-radius: 0;
    background: transparent;
    overflow-y: auto;
    flex: 1;
  }
  .admin-nav-btn {
    width: 100%;
    text-align: left;
    justify-content: flex-start;
    white-space: normal;
  }

  /* Form rows: stack cleanly with spacing */
  .row { flex-direction: column; gap: 6px; }
  .row > div { min-width: 0; width: 100%; flex: none; }

  /* Buttons inside form-stack or row > div: full width */
  .form-stack > button,
  .card > button,
  #authPanel button { width: 100%; align-self: stretch; }
  .row > div > button { width: 100%; }

  /* Working hours: compact inputs */
  .weekday-row > span { width: 54px; font-size: 12px; }
  .time-wrap input[data-time] { width: 64px; min-width: 64px; font-size: 13px; padding: 6px; }
  .time-pick-btn { min-width: 36px; min-height: 40px; padding: 0 6px; }
  .date-wrap input[data-date] { width: 96px; min-width: 96px; font-size: 13px; padding: 6px; }
  .date-pick-btn { min-width: 36px; min-height: 40px; padding: 0 6px; }
  .wh-range .wh-add { flex: 1; min-width: 0; }

  /* Tables: smaller text, tighter padding */
  table { font-size: 13px; min-width: 0; }
  th, td { padding: 8px 6px; }

  /* Employees table: hide email column on mobile */
  .emp-table .col-email { display: none; }

  /* Appointments: cards on mobile, table on desktop */
  .client-appt-table-wrap { display: none; }
  .client-appt-cards { display: flex; }

  /* Modal: full-screen-ish on mobile */
  dialog.dlg { width: 96vw; padding: 18px 16px; border-radius: 16px; }

  /* Select: keep readable */
  select { font-size: 14px; }
}

/* ── Tablet (601–900px) ───────────────────────────────────── */
@media (min-width: 601px) and (max-width: 900px) {
  .container { padding: 14px; }
  .row > div { min-width: 150px; }
  .form-stack > button { align-self: flex-start; }
}

/* ── Toast notifications ──────────────────────────────────── */
#toast-wrap {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}
.toast {
  padding: 10px 22px;
  border-radius: 24px;
  font-size: 14px;
  font-weight: 500;
  opacity: 0;
  transform: translateY(-12px);
  transition: opacity 0.22s ease, transform 0.22s ease;
  pointer-events: auto;
  max-width: 90vw;
  text-align: center;
  box-shadow: 0 4px 20px rgba(0,0,0,.4);
}
.toast.toast-ok  { background: var(--accent-2); color: #071f14; }
.toast.toast-err { background: var(--danger);   color: #fff; }
.toast.toast-in  { opacity: 1; transform: translateY(0); }

/* ── Confirm dialog ───────────────────────────────────────── */
dialog.confirm-dlg { text-align: center; }
.confirm-msg { font-size: 16px; margin: 0 0 20px; line-height: 1.5; }

/* ── Avatar thumbnail ─────────────────────────────────────── */
.avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--border);
  display: block;
}
.avatar-placeholder {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; color: var(--muted);
  flex-shrink: 0;
}

/* ── Modal dialog ─────────────────────────────────────────── */
dialog.dlg {
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  max-width: 480px;
  width: 92vw;
}
dialog.dlg::backdrop { background: rgba(0,0,0,.6); }
dialog.dlg h3 { margin: 0; font-size: 17px; }
.dlg-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; gap: 8px; }
.icon-btn { padding: 4px 8px; min-height: unset; font-size: 16px; }
.dlg-avatar { margin: 12px 0; }
.dlg-avatar label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.dlg-avatar input[type=file] { width: 100%; }

/* Modal action row: equal-width buttons filling the full width */
.dlg-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}
.dlg-actions button {
  flex: 1;          /* each button takes equal share */
  min-width: 0;
  margin: 0;
}

/* ── Client booking flow ─────────────────────────────────── */
.client-auth-wrap {
  max-width: 420px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
#pinInput {
  letter-spacing: 0.25em;
  font-size: 20px;
  text-align: center;
  max-width: 180px;
}
.client-step-label { margin: 0 0 10px; font-size: 13px; color: var(--muted); }
.client-staff-carousel {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  touch-action: pan-y;
}
.client-staff-slide {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 16px 8px;
  min-height: 180px;
  justify-content: center;
  user-select: none;
}
.client-staff-slide .avatar,
.client-staff-slide .avatar-placeholder {
  width: 96px;
  height: 96px;
  font-size: 36px;
}
.client-staff-name {
  font-size: 18px;
  font-weight: 600;
  text-align: center;
}
.client-staff-nav,
.client-cal-nav {
  min-width: 44px;
  min-height: 44px;
  margin: 0;
  padding: 0;
  font-size: 22px;
  line-height: 1;
  -webkit-tap-highlight-color: transparent;
}
.client-staff-nav:hover,
.client-cal-nav:hover {
  filter: none;
  background: transparent;
}
html[data-theme="light"] .client-staff-nav:hover,
html[data-theme="light"] .client-cal-nav:hover {
  background: transparent;
}
.client-staff-nav:active,
.client-cal-nav:active {
  filter: none;
  background: var(--surface-2);
}
html[data-theme="light"] .client-staff-nav:active,
html[data-theme="light"] .client-cal-nav:active {
  background: var(--btn-hover-bg);
}
.client-staff-nav:focus:not(:focus-visible),
.client-cal-nav:focus:not(:focus-visible) {
  background: transparent;
  outline: none;
  filter: none;
}
.client-staff-chosen {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
}
.client-staff-chosen button { margin: 0; }

.client-svc-list {
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 10px;
}
.client-svc-head,
.client-svc-row {
  display: grid;
  grid-template-columns: 1fr 72px 72px;
  gap: 8px;
  align-items: center;
  padding: 10px 12px;
}
.client-svc-head {
  background: var(--surface-2);
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.client-svc-head span:nth-child(2),
.client-svc-head span:nth-child(3),
.client-svc-dur,
.client-svc-price {
  text-align: right;
}
.client-svc-row {
  margin: 0;
  width: 100%;
  border: none;
  border-top: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
  text-align: left;
  -webkit-tap-highlight-color: transparent;
}
.client-svc-row:hover { background: var(--surface-2); }
.client-svc-row.sel {
  background: var(--slot-sel-bg);
  color: var(--slot-sel-fg);
}
.client-svc-row.sel:focus:not(:focus-visible) {
  outline: none;
  filter: none;
}
.client-svc-row.sel .client-svc-dur,
.client-svc-row.sel .client-svc-price { color: inherit; opacity: 0.9; }
.client-svc-name { font-weight: 500; }
.client-svc-dur,
.client-svc-price {
  font-size: 13px;
  color: var(--muted);
}
.client-svc-total {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 12px;
}
.client-cal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}
.client-cal-head span {
  font-weight: 600;
  font-size: 15px;
}
.client-cal-weekdays,
.client-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.client-cal-weekdays {
  margin-bottom: 6px;
  text-align: center;
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
}
.client-cal-day {
  margin: 0;
  min-height: 42px;
  padding: 0;
  border-radius: 8px;
  font-size: 14px;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
}
.client-cal-day:focus,
.client-cal-day:focus:not(:focus-visible) {
  outline: none;
  box-shadow: none;
}
.client-cal-day:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 1px;
}
.client-cal-day:hover:not(.disabled):not(.sel) {
  background: var(--surface-2);
}
.client-cal-day.sel {
  background: var(--slot-sel-bg);
  color: var(--slot-sel-fg);
  border-color: var(--slot-sel-bg);
}
.client-cal-day.today {
  font-weight: 700;
  color: var(--accent);
}
.client-cal-day.today.sel {
  color: var(--slot-sel-fg);
}
.client-cal-day.disabled,
.client-cal-day.empty {
  opacity: 0.35;
  cursor: not-allowed;
  background: transparent;
  border-color: transparent;
}
.client-cal-day.disabled:focus,
.client-cal-day.disabled:focus-visible {
  outline: none;
  box-shadow: none;
}
.client-cal-day.empty { visibility: hidden; }

.client-slots-list {
  gap: 8px;
  margin-top: 10px;
}
.client-slot-row {
  width: auto;
  margin: 0;
  justify-content: center;
  min-height: 48px;
  font-size: 15px;
  font-weight: 500;
  -webkit-tap-highlight-color: transparent;
}
.client-slot-row:focus,
.client-slot-row:focus:not(:focus-visible) {
  outline: none;
  box-shadow: none;
}
.client-slot-row:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}
.client-slot-row.sel:focus:not(:focus-visible) {
  filter: none;
}

.client-book-footer {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.client-book-footer label {
  margin: 0;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
}
.client-book-footer input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 0;
  flex-shrink: 0;
}
.client-book-footer button {
  width: 100%;
  margin: 0;
}
.client-book-footer button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* ── Client appointment cards ─────────────────────────────── */
.client-appt-cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.client-appt-table-wrap {
  display: none;
}
@media (min-width: 901px) {
  .client-appt-cards { display: none; }
  .client-appt-table-wrap { display: block; }
}
.client-appt-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0;
  background: var(--card);
  overflow: hidden;
}
html[data-theme="light"] .client-appt-card {
  box-shadow: var(--shadow-sm);
}
.client-appt-card-head {
  padding: 12px 14px;
  margin-bottom: 0;
  background: #2b304a;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  color: #ffffff;
}
html[data-theme="light"] .client-appt-card-head {
  background: #343839;
  border-bottom-color: rgba(255, 255, 255, 0.1);
}
.client-appt-card-head .client-appt-date-row {
  color: #ffffff;
}
.client-appt-card-head .client-appt-datetime .client-appt-time-part {
  color: rgba(255, 255, 255, 0.78);
}
.client-appt-card-head .client-appt-del,
.client-appt-card-head button.client-appt-del.ghost {
  color: #ffffff;
  border-color: transparent;
}
.client-appt-card-head .client-appt-del:hover,
.client-appt-card-head button.client-appt-del.ghost:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.12);
}
.client-appt-when {
  width: 100%;
}
.client-appt-date-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.35;
}
.client-appt-datetime {
  min-width: 0;
  flex: 1;
}
.client-appt-datetime .client-appt-time-part {
  color: var(--muted);
  font-weight: 500;
}
.client-appt-del {
  flex: none;
  min-width: 32px;
  min-height: 32px;
  padding: 6px;
  color: var(--text);
}
.client-appt-del svg {
  display: block;
}
.client-appt-prof-row {
  padding: 10px 14px 0;
}
.client-appt-prof {
  margin: 0;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.35;
}
.client-appt-prof-label {
  color: var(--muted);
  font-weight: 500;
}
.client-appt-card-meta {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0 14px 14px;
}
.client-appt-svc-block {
  margin: 12px 14px;
  padding: 12px;
  border-radius: 10px;
  background: var(--appt-svc-bg);
  border: 1px solid var(--appt-svc-border);
}
.client-appt-total-line {
  margin: 10px 0 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.client-appt-total-line span {
  color: var(--muted);
  font-weight: 500;
  margin-right: 6px;
}
.client-appt-card-meta > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 14px;
}
.client-appt-card-meta dt {
  margin: 0;
  color: var(--muted);
  font-weight: 500;
}
.client-appt-card-meta dd {
  margin: 0;
  text-align: right;
  color: var(--text);
  font-weight: 500;
}
.client-appt-svc-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.client-appt-svc-item {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  font-size: 14px;
  line-height: 1.35;
}
.client-appt-svc-tick {
  flex: none;
  color: var(--accent-2);
  font-weight: 700;
}
.client-appt-empty {
  margin: 0;
  padding: 8px 0;
}
.client-appt-notify-toggle {
  display: inline-flex;
  gap: 6px;
}
.client-appt-notify-opt {
  min-height: 32px;
  padding: 4px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.client-appt-notify-opt:hover {
  border-color: var(--accent);
  color: var(--text);
}
.client-appt-notify-opt.sel[data-notify="1"] {
  background: rgba(70, 211, 154, 0.18);
  border-color: var(--accent-2);
  color: var(--accent-2);
}
html[data-theme="light"] .client-appt-notify-opt.sel[data-notify="1"] {
  background: rgba(33, 131, 88, 0.12);
}
.client-appt-notify-opt.sel[data-notify="0"] {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--border);
  color: var(--text);
}
html[data-theme="light"] .client-appt-notify-opt.sel[data-notify="0"] {
  background: var(--surface-2);
}
