/* ==========================================================================
   SalonPro — design system
   Register: product UI. One family (Schibsted Grotesk); Fraunces only on
   hub/auth surfaces via .display-face.
   ========================================================================== */

/* ---------- tokens ---------- */
:root {
  /* surfaces & ink */
  --bg: oklch(1 0 0);
  --surface: oklch(0.972 0.004 258);
  --surface-2: oklch(0.955 0.006 258);
  --ink: oklch(0.21 0.022 258);
  --muted: oklch(0.44 0.02 258);
  --faint: oklch(0.56 0.016 258);
  --line: oklch(0.9 0.008 258);
  --line-soft: oklch(0.935 0.006 258);

  /* brand */
  --primary: oklch(0.5 0.16 258);
  --primary-strong: oklch(0.42 0.15 258);
  --primary-soft: oklch(0.955 0.022 258);
  --primary-soft-2: oklch(0.92 0.045 258);
  --accent: oklch(0.7 0.12 55);
  --accent-ink: oklch(0.5 0.13 50);
  --accent-soft: oklch(0.955 0.035 70);

  /* sidebar (dark indigo layer) */
  --sidebar: oklch(0.235 0.035 262);
  --sidebar-2: oklch(0.28 0.04 262);
  --sidebar-line: oklch(0.34 0.04 262);
  --sidebar-ink: oklch(0.93 0.01 262);
  --sidebar-muted: oklch(0.72 0.03 262);

  /* semantic */
  --success: oklch(0.52 0.13 155);
  --success-soft: oklch(0.955 0.035 155);
  --warning: oklch(0.51 0.11 75);
  --warning-soft: oklch(0.955 0.045 85);
  --danger: oklch(0.5 0.17 25);
  --danger-soft: oklch(0.955 0.025 25);
  --neutral-soft: oklch(0.955 0.004 258);

  /* charts (validated categorical order: teal, cobalt, amber, rose) */
  --ch-1: #1baf7a;
  --ch-2: #3f5fc4;
  --ch-3: #d98324;
  --ch-4: #c73667;
  --ch-grid: oklch(0.93 0.005 258);
  --ch-axis: oklch(0.56 0.016 258);

  /* type */
  --font-ui: "Schibsted Grotesk", system-ui, -apple-system, sans-serif;
  --font-display: "Fraunces", Georgia, serif;
  --fs-11: 0.6875rem;
  --fs-12: 0.75rem;
  --fs-13: 0.8125rem;
  --fs-14: 0.875rem;
  --fs-15: 0.9375rem;
  --fs-16: 1rem;
  --fs-18: 1.125rem;
  --fs-20: 1.25rem;
  --fs-24: 1.5rem;
  --fs-28: 1.75rem;
  --fs-34: 2.125rem;

  /* shape & depth */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 20px;
  --shadow-sm: 0 1px 2px oklch(0.21 0.02 258 / 0.06);
  --shadow-md: 0 2px 6px oklch(0.21 0.02 258 / 0.07), 0 10px 24px oklch(0.21 0.02 258 / 0.06);
  --shadow-lg: 0 6px 16px oklch(0.21 0.02 258 / 0.1), 0 24px 48px oklch(0.21 0.02 258 / 0.12);

  /* z scale */
  --z-dropdown: 30;
  --z-sticky: 40;
  --z-drawer: 50;
  --z-modal: 70;
  --z-toast: 80;
  --z-tooltip: 90;

  /* motion */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --t-fast: 150ms;
  --t-med: 220ms;

  --sidebar-w: 248px;
}

/* ---------- reset & base ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-ui);
  font-size: var(--fs-14);
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
img, svg { display: block; max-width: 100%; }
input, button, textarea, select { font: inherit; color: inherit; }
h1, h2, h3, h4 { line-height: 1.25; text-wrap: balance; font-weight: 600; }
p { text-wrap: pretty; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 2px; }
::placeholder { color: var(--faint); opacity: 1; }
dialog { border: none; padding: 0; background: transparent; color: inherit; max-width: none; max-height: none; }

.skip-link {
  position: absolute; left: 8px; top: -48px;
  background: var(--ink); color: #fff; padding: 8px 14px;
  border-radius: var(--r-sm); z-index: var(--z-tooltip); transition: top var(--t-fast) var(--ease-out);
}
.skip-link:focus { top: 8px; }

.num, .table td.num, .kpi-value { font-variant-numeric: tabular-nums; }

/* ---------- app shell ---------- */
.app-body { background: var(--bg); }
.app-layout { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--sidebar);
  color: var(--sidebar-ink);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
  overflow-y: auto;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 18px 14px;
}
.brand-mark {
  width: 32px; height: 32px; border-radius: 9px;
  background: linear-gradient(140deg, oklch(0.58 0.16 258), oklch(0.46 0.16 262));
  display: grid; place-items: center; color: #fff; flex-shrink: 0;
}
.brand-mark svg { width: 17px; height: 17px; }
.brand-name { font-size: var(--fs-16); font-weight: 700; letter-spacing: -0.01em; color: #fff; }
.brand-name span { color: var(--accent); }
.sidebar-role {
  font-size: var(--fs-11); color: var(--sidebar-muted);
  padding: 0 18px 10px; letter-spacing: 0.02em;
}

.branch-switch {
  margin: 2px 14px 14px;
  display: flex; align-items: center; gap: 9px;
  width: calc(100% - 28px);
  background: var(--sidebar-2);
  border: 1px solid var(--sidebar-line);
  border-radius: var(--r-md);
  padding: 8px 10px;
  color: var(--sidebar-ink);
  cursor: pointer; text-align: left;
  transition: background var(--t-fast) var(--ease-out);
}
.branch-switch:hover { background: oklch(0.31 0.04 262); }
.branch-switch svg { width: 15px; height: 15px; color: var(--sidebar-muted); flex-shrink: 0; }
.branch-switch .chev { margin-left: auto; }
.branch-switch b { display: block; font-size: var(--fs-13); font-weight: 600; line-height: 1.2; }
.branch-switch small { font-size: var(--fs-11); color: var(--sidebar-muted); }

.side-nav { padding: 0 10px; display: flex; flex-direction: column; gap: 2px; }
.side-nav a {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 10px; border-radius: var(--r-md);
  color: var(--sidebar-muted); font-size: var(--fs-14); font-weight: 500;
  transition: background var(--t-fast) var(--ease-out), color var(--t-fast) var(--ease-out);
}
.side-nav a:hover { background: var(--sidebar-2); color: var(--sidebar-ink); text-decoration: none; }
.side-nav a[aria-current="page"] { background: var(--primary); color: #fff; }
.side-nav a svg { width: 17px; height: 17px; flex-shrink: 0; }
.side-nav .nav-badge {
  margin-left: auto; font-size: var(--fs-11); font-weight: 600;
  background: var(--accent); color: oklch(0.2 0.05 55);
  border-radius: 999px; padding: 1px 7px;
}
.side-sep {
  border: 0; border-top: 1px solid var(--sidebar-line);
  margin: 12px 18px;
}
.sidebar-foot { margin-top: auto; padding: 12px 14px 16px; }
.role-jump { margin-bottom: 12px; }
.role-jump p { font-size: var(--fs-11); color: var(--sidebar-muted); margin-bottom: 6px; padding-left: 4px; }
.role-jump-links { display: flex; flex-wrap: wrap; gap: 5px; }
.role-jump-links a {
  font-size: var(--fs-11); font-weight: 600; color: var(--sidebar-ink);
  background: var(--sidebar-2); border: 1px solid var(--sidebar-line);
  padding: 3px 9px; border-radius: 999px;
  transition: background var(--t-fast) var(--ease-out);
}
.role-jump-links a:hover { background: oklch(0.33 0.04 262); text-decoration: none; }
.role-jump-links a.is-here { border-color: var(--accent); color: var(--accent); }
.side-user {
  display: flex; align-items: center; gap: 10px;
  padding: 10px; border-radius: var(--r-md);
  background: var(--sidebar-2); border: 1px solid var(--sidebar-line);
}
.side-user b { display: block; font-size: var(--fs-13); color: #fff; line-height: 1.25; }
.side-user small { font-size: var(--fs-11); color: var(--sidebar-muted); }
.side-user a { margin-left: auto; color: var(--sidebar-muted); display: grid; place-items: center; padding: 6px; border-radius: var(--r-sm); }
.side-user a:hover { color: #fff; background: oklch(0.33 0.04 262); }
.side-user a svg { width: 15px; height: 15px; }

.sidebar-scrim {
  display: none; position: fixed; inset: 0;
  background: oklch(0.21 0.02 258 / 0.45);
  z-index: calc(var(--z-drawer) - 1);
}

.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 28px;
  border-bottom: 1px solid var(--line-soft);
  background: var(--bg);
  position: sticky; top: 0; z-index: var(--z-sticky);
}
.menu-btn { display: none; }
.page-title { font-size: var(--fs-18); font-weight: 700; letter-spacing: -0.01em; }
.page-sub { font-size: var(--fs-12); color: var(--muted); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.topbar-date { font-size: var(--fs-13); color: var(--muted); white-space: nowrap; }

.global-search { position: relative; }
.global-search svg {
  width: 15px; height: 15px; position: absolute; left: 11px; top: 50%;
  translate: 0 -50%; color: var(--faint); pointer-events: none;
}
.global-search input {
  width: 230px; padding: 8px 12px 8px 34px;
  border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--surface); font-size: var(--fs-13);
  transition: border-color var(--t-fast) var(--ease-out), background var(--t-fast) var(--ease-out);
}
.global-search input:focus { background: var(--bg); border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px var(--primary-soft-2); }

.page {
  padding: 24px 28px 48px;
  width: 100%; max-width: 1240px; margin: 0 auto;
  display: flex; flex-direction: column; gap: 20px;
}
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head h2 { font-size: var(--fs-20); font-weight: 700; letter-spacing: -0.01em; }
.page-head .sub { color: var(--muted); font-size: var(--fs-13); margin-top: 2px; }
.page-head-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 8px 14px; border-radius: var(--r-md);
  border: 1px solid transparent;
  font-size: var(--fs-13); font-weight: 600; line-height: 1.3;
  cursor: pointer; white-space: nowrap; text-decoration: none;
  transition: background var(--t-fast) var(--ease-out), border-color var(--t-fast) var(--ease-out), color var(--t-fast) var(--ease-out), box-shadow var(--t-fast) var(--ease-out);
}
.btn:hover { text-decoration: none; }
.btn svg { width: 15px; height: 15px; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-strong); }
.btn-ghost { background: var(--bg); border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { background: var(--surface); border-color: oklch(0.82 0.012 258); }
.btn-subtle { background: var(--primary-soft); color: var(--primary-strong); }
.btn-subtle:hover { background: var(--primary-soft-2); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: oklch(0.44 0.16 25); }
.btn-sm { padding: 5px 10px; font-size: var(--fs-12); border-radius: var(--r-sm); }
.btn-lg { padding: 11px 20px; font-size: var(--fs-14); border-radius: var(--r-md); }
.btn-block { width: 100%; }

.icon-btn {
  display: inline-grid; place-items: center;
  width: 34px; height: 34px; border-radius: var(--r-md);
  border: 1px solid var(--line); background: var(--bg); color: var(--muted);
  cursor: pointer;
  transition: background var(--t-fast) var(--ease-out), color var(--t-fast) var(--ease-out);
  position: relative;
}
.icon-btn:hover { background: var(--surface); color: var(--ink); }
.icon-btn svg { width: 16px; height: 16px; }
.icon-btn.borderless { border: none; }
.icon-btn .dot {
  position: absolute; top: 7px; right: 8px; width: 7px; height: 7px;
  border-radius: 50%; background: var(--accent); border: 1.5px solid var(--bg);
}

/* ---------- cards / panels ---------- */
.panel {
  background: var(--bg);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  flex-wrap: wrap;
  padding: 14px 18px; border-bottom: 1px solid var(--line-soft);
}
.panel-head h3 { font-size: var(--fs-14); font-weight: 600; }
.panel-head .hint { font-size: var(--fs-12); color: var(--muted); font-weight: 400; margin-top: 1px; }
.panel-body { padding: 18px; }
.panel-body.flush { padding: 0; }
.panel-foot { padding: 12px 18px; border-top: 1px solid var(--line-soft); display: flex; justify-content: flex-end; gap: 8px; }

/* ---------- KPI strip ---------- */
.kpi-row {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
}
.kpi {
  background: var(--bg); border: 1px solid var(--line-soft);
  border-radius: var(--r-lg); padding: 15px 17px 13px;
  box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; gap: 3px; min-width: 0;
}
.kpi-label { font-size: var(--fs-12); color: var(--muted); }
.kpi-value { font-size: var(--fs-24); font-weight: 700; letter-spacing: -0.01em; line-height: 1.15; font-variant-numeric: normal; }
.kpi-delta { font-size: var(--fs-12); font-weight: 600; display: inline-flex; align-items: center; gap: 3px; }
.kpi-delta.up { color: var(--success); }
.kpi-delta.down { color: var(--danger); }
.kpi-delta span { color: var(--faint); font-weight: 400; }
.kpi-delta svg { width: 12px; height: 12px; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: var(--fs-13); }
.table th {
  text-align: left; font-weight: 600; font-size: var(--fs-12);
  color: var(--muted); background: var(--surface);
  padding: 9px 14px; border-bottom: 1px solid var(--line-soft);
  white-space: nowrap;
}
.table td { padding: 11px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.table tbody tr { transition: background var(--t-fast) var(--ease-out); }
.table tbody tr:hover { background: var(--surface); }
.table tbody tr:last-child td { border-bottom: none; }
.table td.num, .table th.num { text-align: right; }
.table .cell-main { font-weight: 600; color: var(--ink); }
.table .cell-sub { font-size: var(--fs-12); color: var(--muted); margin-top: 1px; }
.table a.cell-main:hover { color: var(--primary); }
tr.row-link { cursor: pointer; }

.table-tools {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 13px 16px; border-bottom: 1px solid var(--line-soft);
}
.table-tools .spacer { flex: 1; }
.search-box { position: relative; }
.search-box svg { width: 14px; height: 14px; position: absolute; left: 10px; top: 50%; translate: 0 -50%; color: var(--faint); pointer-events: none; }
.search-box input {
  padding: 7px 12px 7px 31px; border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--bg); font-size: var(--fs-13); width: 220px;
}
.search-box input:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px var(--primary-soft-2); }

/* ---------- chips / badges ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: var(--fs-12); font-weight: 600; line-height: 1;
  padding: 4px 9px; border-radius: 999px; white-space: nowrap;
}
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip.no-dot::before { display: none; }
.chip-pending { background: var(--warning-soft); color: var(--warning); }
.chip-confirmed { background: var(--primary-soft); color: var(--primary-strong); }
.chip-completed { background: var(--success-soft); color: var(--success); }
.chip-cancelled { background: var(--neutral-soft); color: var(--muted); }
.chip-noshow { background: var(--danger-soft); color: var(--danger); }
.chip-paid { background: var(--success-soft); color: var(--success); }
.chip-unpaid { background: var(--warning-soft); color: var(--warning); }
.chip-refunded { background: var(--neutral-soft); color: var(--muted); }
.chip-active { background: var(--success-soft); color: var(--success); }
.chip-trial { background: var(--accent-soft); color: var(--accent-ink); }
.chip-suspended { background: var(--danger-soft); color: var(--danger); }
.chip-expired { background: var(--neutral-soft); color: var(--muted); }

.tag {
  display: inline-flex; align-items: center;
  font-size: var(--fs-11); font-weight: 600;
  background: var(--surface-2); color: var(--muted);
  border-radius: 999px; padding: 3px 9px; white-space: nowrap;
}

/* ---------- avatars ---------- */
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  display: inline-grid; place-items: center; flex-shrink: 0;
  font-size: var(--fs-12); font-weight: 700; color: #fff;
  background: var(--primary); user-select: none;
}
.avatar.lg { width: 44px; height: 44px; font-size: var(--fs-14); }
.avatar.xl { width: 60px; height: 60px; font-size: var(--fs-18); }
.avatar.a2 { background: oklch(0.55 0.12 155); }
.avatar.a3 { background: oklch(0.55 0.13 50); }
.avatar.a4 { background: oklch(0.5 0.14 330); }
.avatar.a5 { background: oklch(0.5 0.12 200); }
.avatar.a6 { background: oklch(0.45 0.1 290); }
.avatar-cell { display: flex; align-items: center; gap: 10px; min-width: 0; }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: var(--fs-13); font-weight: 600; }
.field .help { font-size: var(--fs-12); color: var(--muted); }
.field .error-msg { font-size: var(--fs-12); color: var(--danger); font-weight: 500; display: none; }
.field.has-error .error-msg { display: block; }
.field.has-error .input { border-color: var(--danger); }
.input, select.input, textarea.input {
  padding: 9px 12px; border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--bg); font-size: var(--fs-14); width: 100%;
  transition: border-color var(--t-fast) var(--ease-out), box-shadow var(--t-fast) var(--ease-out);
}
.input:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px var(--primary-soft-2); }
select.input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%235b6478' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
  padding-right: 32px; cursor: pointer;
}
textarea.input { resize: vertical; min-height: 80px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.form-row { display: flex; gap: 14px; }
.form-row > * { flex: 1; }

.check { display: flex; align-items: center; gap: 8px; font-size: var(--fs-13); cursor: pointer; }
.check input { width: 15px; height: 15px; accent-color: var(--primary); cursor: pointer; }

.switch { position: relative; display: inline-flex; width: 36px; height: 21px; flex-shrink: 0; cursor: pointer; }
.switch input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.switch .track {
  width: 100%; border-radius: 999px; background: oklch(0.84 0.01 258);
  transition: background var(--t-fast) var(--ease-out);
}
.switch .track::after {
  content: ""; position: absolute; top: 2.5px; left: 2.5px;
  width: 16px; height: 16px; border-radius: 50%; background: #fff;
  box-shadow: var(--shadow-sm);
  transition: translate var(--t-fast) var(--ease-out);
}
.switch input:checked + .track { background: var(--primary); }
.switch input:checked + .track::after { translate: 15px 0; }
.switch input:focus-visible + .track { outline: 2px solid var(--primary); outline-offset: 2px; }

.seg {
  display: inline-flex; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: 3px; gap: 2px;
}
.seg button {
  border: none; background: transparent; padding: 5px 12px;
  border-radius: 7px; font-size: var(--fs-12); font-weight: 600; color: var(--muted);
  cursor: pointer; transition: background var(--t-fast) var(--ease-out), color var(--t-fast) var(--ease-out);
}
.seg button:hover { color: var(--ink); }
.seg button[aria-pressed="true"] { background: var(--bg); color: var(--ink); box-shadow: var(--shadow-sm); }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line-soft); overflow-x: auto; }
.tabs [role="tab"] {
  border: none; background: none; cursor: pointer;
  padding: 9px 14px; font-size: var(--fs-13); font-weight: 600; color: var(--muted);
  border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
  transition: color var(--t-fast) var(--ease-out), border-color var(--t-fast) var(--ease-out);
}
.tabs [role="tab"]:hover { color: var(--ink); }
.tabs [role="tab"][aria-selected="true"] { color: var(--primary); border-bottom-color: var(--primary); }
[role="tabpanel"][hidden] { display: none; }

/* ---------- modal ---------- */
dialog.modal { margin: auto; }
dialog.modal::backdrop { background: oklch(0.21 0.02 258 / 0.45); }
.modal-card {
  width: min(560px, calc(100vw - 32px));
  background: var(--bg); border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  max-height: calc(100vh - 64px);
  display: flex; flex-direction: column;
}
.modal-card.wide { width: min(720px, calc(100vw - 32px)); }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 18px 22px 0; }
.modal-head h3 { font-size: var(--fs-16); font-weight: 700; }
.modal-head p { font-size: var(--fs-13); color: var(--muted); margin-top: 2px; }
.modal-body { padding: 16px 22px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 22px 20px; border-top: 1px solid var(--line-soft); }
@media (prefers-reduced-motion: no-preference) {
  dialog.modal[open] .modal-card { animation: modal-in var(--t-med) var(--ease-out); }
  @keyframes modal-in { from { opacity: 0; translate: 0 10px; } }
}

/* ---------- drawer (detail panel) ---------- */
dialog.drawer { margin: 0 0 0 auto; height: 100vh; height: 100dvh; }
dialog.drawer::backdrop { background: oklch(0.21 0.02 258 / 0.4); }
.drawer-card {
  width: min(420px, 92vw); height: 100%;
  background: var(--bg); box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column;
}
.drawer-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 18px 20px; border-bottom: 1px solid var(--line-soft); }
.drawer-head h3 { font-size: var(--fs-15); font-weight: 700; }
.drawer-body { padding: 18px 20px; overflow-y: auto; flex: 1; }
.drawer-foot { padding: 14px 20px; border-top: 1px solid var(--line-soft); display: flex; gap: 8px; }
@media (prefers-reduced-motion: no-preference) {
  dialog.drawer[open] .drawer-card { animation: drawer-in var(--t-med) var(--ease-out); }
  @keyframes drawer-in { from { translate: 40px 0; opacity: 0.4; } }
}

.def-list { display: grid; grid-template-columns: 120px 1fr; gap: 8px 14px; font-size: var(--fs-13); }
.def-list dt { color: var(--muted); }
.def-list dd { font-weight: 500; }

/* ---------- toast ---------- */
.toast-region {
  position: fixed; bottom: 20px; left: 50%; translate: -50% 0;
  z-index: var(--z-toast);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 9px;
  background: var(--ink); color: #fff;
  font-size: var(--fs-13); font-weight: 500;
  padding: 10px 16px; border-radius: 999px;
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
}
.toast svg { width: 15px; height: 15px; color: oklch(0.78 0.13 155); flex-shrink: 0; }
.toast.warn svg { color: var(--accent); }
@media (prefers-reduced-motion: no-preference) {
  .toast { animation: toast-in var(--t-med) var(--ease-out); }
  .toast.leaving { animation: toast-out var(--t-med) var(--ease-out) forwards; }
  @keyframes toast-in { from { opacity: 0; translate: 0 12px; } }
  @keyframes toast-out { to { opacity: 0; translate: 0 8px; } }
}
@media (prefers-reduced-motion: reduce) {
  .toast.leaving { opacity: 0; }
}

/* ---------- empty state ---------- */
.empty {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  text-align: center; padding: 44px 24px; color: var(--muted);
}
.empty svg { width: 34px; height: 34px; color: var(--faint); }
.empty b { color: var(--ink); font-size: var(--fs-14); }
.empty p { font-size: var(--fs-13); max-width: 34ch; }

/* ---------- calendar ---------- */
.cal-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.cal-toolbar .range { font-size: var(--fs-14); font-weight: 700; }
.cal-grid-wrap { overflow-x: auto; }
.cal-grid {
  display: grid;
  grid-template-columns: 56px repeat(var(--cal-cols, 6), minmax(118px, 1fr));
  min-width: 780px;
  font-size: var(--fs-12);
}
.cal-grid .cal-corner, .cal-grid .cal-colhead {
  position: sticky; top: 0; background: var(--surface); z-index: 2;
  border-bottom: 1px solid var(--line-soft);
}
.cal-colhead { padding: 9px 10px; text-align: left; }
.cal-colhead b { display: block; font-size: var(--fs-13); }
.cal-colhead small { color: var(--muted); }
.cal-colhead.today b { color: var(--primary); }
.cal-colhead.today small { color: var(--primary); }
.cal-time {
  grid-column: 1; padding: 4px 8px 0 0; text-align: right;
  color: var(--faint); font-size: var(--fs-11);
  border-top: 1px solid var(--line-soft);
}
.cal-cell {
  border-top: 1px solid var(--line-soft);
  border-left: 1px solid var(--line-soft);
  min-height: 52px; padding: 3px; position: relative;
  display: flex; flex-direction: column; gap: 3px;
}
.cal-cell.is-today { background: oklch(0.985 0.008 258); }
.appt-chip {
  border: none; text-align: left; width: 100%; cursor: pointer;
  border-radius: 7px; padding: 5px 8px;
  font-size: var(--fs-11); line-height: 1.3; font-weight: 500;
  display: block; color: var(--ink);
  transition: filter var(--t-fast) var(--ease-out), box-shadow var(--t-fast) var(--ease-out);
}
.appt-chip:hover { filter: brightness(0.965); box-shadow: var(--shadow-sm); }
.appt-chip b { display: block; font-weight: 700; }
.appt-chip small { color: inherit; opacity: 0.75; }
.appt-chip.st-pending { background: var(--warning-soft); }
.appt-chip.st-confirmed { background: var(--primary-soft); }
.appt-chip.st-completed { background: var(--success-soft); }
.appt-chip.st-cancelled { background: var(--neutral-soft); color: var(--muted); text-decoration: line-through; }
.appt-chip.st-noshow { background: var(--danger-soft); }

/* ---------- stepper (booking flow) ---------- */
.stepper { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.stepper .step { display: flex; align-items: center; gap: 8px; font-size: var(--fs-13); font-weight: 600; color: var(--faint); }
.stepper .step .n {
  width: 24px; height: 24px; border-radius: 50%;
  display: grid; place-items: center;
  border: 1.5px solid var(--line); font-size: var(--fs-12);
  background: var(--bg);
}
.stepper .step.active { color: var(--ink); }
.stepper .step.active .n { background: var(--primary); border-color: var(--primary); color: #fff; }
.stepper .step.done { color: var(--muted); }
.stepper .step.done .n { background: var(--success-soft); border-color: transparent; color: var(--success); }
.stepper .bar { flex: 1; min-width: 18px; height: 1.5px; background: var(--line); }

/* ---------- charts ---------- */
.chart-box { position: relative; }
.chart-box svg { width: 100%; height: auto; display: block; }
.chart-tip {
  position: fixed; z-index: var(--z-tooltip);
  background: var(--ink); color: #fff;
  font-size: var(--fs-12); line-height: 1.45;
  padding: 7px 11px; border-radius: var(--r-sm);
  pointer-events: none; opacity: 0;
  transition: opacity var(--t-fast) var(--ease-out);
  white-space: nowrap; box-shadow: var(--shadow-md);
}
.chart-tip.show { opacity: 1; }
.chart-tip b { display: block; font-weight: 700; }
.chart-tip small { opacity: 0.75; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: var(--fs-12); color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 9px; height: 9px; border-radius: 3px; flex-shrink: 0; }
.legend b { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }

.meter { height: 6px; border-radius: 999px; background: var(--primary-soft); overflow: hidden; min-width: 70px; }
.meter i { display: block; height: 100%; border-radius: 999px; background: var(--primary); }

/* ---------- public (customer) shell ---------- */
.public-body { background: var(--surface); min-height: 100vh; }
.public-top {
  background: var(--bg); border-bottom: 1px solid var(--line-soft);
  position: sticky; top: 0; z-index: var(--z-sticky);
}
.public-top-inner {
  max-width: 1080px; margin: 0 auto; padding: 12px 20px;
  display: flex; align-items: center; gap: 12px;
}
.public-top-inner nav { margin-left: auto; display: flex; align-items: center; gap: 18px; font-size: var(--fs-13); font-weight: 600; }
.public-top-inner nav a { color: var(--muted); }
.public-top-inner nav a:hover { color: var(--ink); text-decoration: none; }
.public-top-inner nav a.active { color: var(--primary); }
.public-main { max-width: 1080px; margin: 0 auto; padding: 28px 20px 64px; }

/* choice cards (booking flow) */
.choice-list { display: grid; gap: 10px; }
.choice {
  display: flex; align-items: center; gap: 13px; text-align: left; width: 100%;
  background: var(--bg); border: 1.5px solid var(--line);
  border-radius: var(--r-lg); padding: 13px 15px; cursor: pointer;
  transition: border-color var(--t-fast) var(--ease-out), box-shadow var(--t-fast) var(--ease-out);
}
.choice:hover { border-color: oklch(0.72 0.06 258); }
.choice[aria-pressed="true"] { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft-2); }
.choice .grow { flex: 1; min-width: 0; }
.choice b { display: block; font-size: var(--fs-14); }
.choice small { color: var(--muted); font-size: var(--fs-12); }
.choice .price { font-weight: 700; font-size: var(--fs-14); font-variant-numeric: tabular-nums; }

.slot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(86px, 1fr)); gap: 8px; }
.slot {
  border: 1.5px solid var(--line); background: var(--bg);
  border-radius: var(--r-md); padding: 8px 4px;
  font-size: var(--fs-13); font-weight: 600; text-align: center; cursor: pointer;
  transition: border-color var(--t-fast) var(--ease-out), background var(--t-fast) var(--ease-out);
  font-variant-numeric: tabular-nums;
}
.slot:hover { border-color: oklch(0.72 0.06 258); }
.slot[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); color: #fff; }
.slot:disabled { opacity: 0.4; cursor: not-allowed; text-decoration: line-through; }

/* ---------- auth & hub (brand register) ---------- */
.display-face { font-family: var(--font-display); font-weight: 500; letter-spacing: -0.015em; }

.auth-body {
  min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  background: var(--bg);
}
.auth-side {
  background: var(--sidebar); color: var(--sidebar-ink);
  padding: 44px 48px; display: flex; flex-direction: column;
  position: relative; overflow: hidden;
}
.auth-side::after {
  content: ""; position: absolute; right: -160px; bottom: -160px;
  width: 460px; height: 460px; border-radius: 50%;
  background: radial-gradient(circle, oklch(0.5 0.16 258 / 0.5), transparent 68%);
  pointer-events: none;
}
.auth-side h2 {
  font-family: var(--font-display); font-weight: 500;
  font-size: clamp(1.8rem, 3.2vw, 2.6rem); line-height: 1.15;
  letter-spacing: -0.02em; color: #fff; max-width: 17ch; margin-top: auto;
}
.auth-side h2 em { font-style: italic; color: var(--accent); }
.auth-side .foot { margin-top: 22px; font-size: var(--fs-13); color: var(--sidebar-muted); max-width: 44ch; }
.auth-form-col { display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 40px 24px; }
.auth-card { width: min(390px, 100%); display: flex; flex-direction: column; gap: 18px; }
.auth-card h1 { font-size: var(--fs-24); font-weight: 700; letter-spacing: -0.015em; }
.auth-card .lead { color: var(--muted); font-size: var(--fs-14); margin-top: 4px; }

/* ---------- misc ---------- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.grid-main-side { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
.grid-2 > *, .grid-3 > *, .grid-main-side > * { min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.hstack { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.mt-auto { margin-top: auto; }
.text-muted { color: var(--muted); }
.text-sm { font-size: var(--fs-12); }
.w-full { width: 100%; }

.timeline { display: flex; flex-direction: column; }
.tl-item { display: flex; gap: 13px; position: relative; padding-bottom: 18px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-item::before {
  content: ""; position: absolute; left: 5px; top: 16px; bottom: 2px;
  width: 1.5px; background: var(--line);
}
.tl-item:last-child::before { display: none; }
.tl-dot {
  width: 11px; height: 11px; border-radius: 50%; flex-shrink: 0;
  background: var(--primary-soft-2); border: 2.5px solid var(--primary);
  margin-top: 4px; position: relative; z-index: 1;
}
.tl-item .body b { font-size: var(--fs-13); display: block; }
.tl-item .body small { color: var(--muted); font-size: var(--fs-12); }

/* ---------- responsive ---------- */
@media (max-width: 1080px) {
  .grid-main-side { grid-template-columns: 1fr; }
}
@media (max-width: 1024px) {
  .sidebar {
    position: fixed; left: 0; top: 0; z-index: var(--z-drawer);
    translate: -100% 0; transition: translate var(--t-med) var(--ease-out);
    box-shadow: none;
  }
  .sidebar.open { translate: 0 0; box-shadow: var(--shadow-lg); }
  .sidebar-scrim.show { display: block; }
  .menu-btn { display: inline-grid; }
  .global-search input { width: 170px; }
  .auth-body { grid-template-columns: 1fr; }
  .auth-side { min-height: 200px; padding: 28px 28px; }
  .auth-side h2 { font-size: 1.6rem; }
}
@media (prefers-reduced-motion: reduce) {
  .sidebar { transition: none; }
}
@media (max-width: 720px) {
  .topbar { padding: 12px 16px; gap: 10px; }
  .page-title { font-size: var(--fs-15); }
  .page-sub { display: none; }
  .topbar .btn svg { display: none; }
  .topbar .btn { padding: 7px 11px; font-size: var(--fs-12); }
  .page { padding: 18px 16px 40px; }
  .grid-2, .grid-3, .form-grid { grid-template-columns: 1fr; }
  .form-row { flex-direction: column; }
  .topbar-date, .global-search { display: none; }
  .page-head { align-items: flex-start; flex-direction: column; }
  .def-list { grid-template-columns: 100px 1fr; }
}
