:root {
  color-scheme: light;
  --bg: #f5f4f7;
  --panel: #ffffff;
  --panel-2: #faf9fb;
  --line: #e6e2ea;
  --line-strong: #d6d0dd;
  --text: #221b26;
  --muted: #6e6577;
  --font: "Figtree", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --display: "Fraunces", Georgia, "Times New Roman", serif;
  --primary: #7a2e5c;
  --primary-dark: #5c2045;
  --danger: #b3362d;
  --ok: #2c7a55;
  --warn: #a86400;
  --hover: #f2eff5;
  --ink: #221b26;
  --text-2: #4a4250;
  --faint: #8a8393;
  --warn-ink: #8a5200;
  --info: #0e6b80;
  --primary-ink: var(--primary);
  --radius: 10px;
  --shadow: 0 1px 2px rgba(34,27,38,.06), 0 8px 24px rgba(34,27,38,.08);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.ic { width: 18px; height: 18px; flex: 0 0 auto; vertical-align: -3px; }
.sidebar .ic { width: 17px; height: 17px; }
.bnav-item .ni .ic { width: 19px; height: 19px; }
.drawer-item .ni .ic { width: 18px; height: 18px; }
.brand-logo .ic { width: 20px; height: 20px; }
.occ .ic, .pill .ic { width: 12px; height: 12px; vertical-align: -2px; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.view:not(.hidden) { animation: viewIn .16s ease; }
@keyframes viewIn { from { opacity: .55; transform: translateY(3px); } to { opacity: 1; transform: none; } }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 6px; }
::-webkit-scrollbar-track { background: transparent; }
* { scrollbar-color: var(--line-strong) transparent; }

.hidden { display: none !important; }
.muted { color: var(--muted); }
.hint { font-size: 12px; color: var(--muted); }
a { color: var(--primary-ink); }

/* ---------- Login ---------- */
.login-screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 24px;
  overflow-y: auto;
  background: var(--bg);
}

.nearby { width: 360px; max-width: 92vw; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; box-shadow: 0 16px 40px rgba(34,27,38,.12); }
.nearby-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.nearby-head strong { font-size: 13.5px; }
.nearby-list { display: flex; flex-direction: column; }
.nearby-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 0; border-top: 1px solid var(--line); }
.nearby-item:first-child { border-top: none; }
.nearby-main { min-width: 0; }
.nearby-name { font-size: 13px; font-weight: 700; }
.nearby-you { font-size: 9.5px; font-weight: 700; color: var(--ok); background: rgba(44,122,85,.15); border-radius: 999px; padding: 1px 6px; margin-left: 4px; }
.nearby-addr { font-size: 11.5px; color: var(--muted); margin-top: 1px; }
.nearby-rating { display: flex; align-items: center; gap: 4px; font-size: 11.5px; color: var(--warn); margin-top: 3px; }
.nearby-star { font-size: 12px; }
.nearby-count { color: var(--muted); }
.loc-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.loc-actions .hint { margin: 0; }
.map-frame { width: 100%; height: 220px; border: 1px solid var(--line); border-radius: 12px; display: block; background: var(--panel-2); }
.map-link { display: inline-block; margin-top: 6px; font-size: 12px; color: var(--primary-ink); }
.nearby-side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex: 0 0 auto; }
.nearby-dist { flex: 0 0 auto; font-size: 11.5px; color: var(--primary-ink); font-weight: 600; }
.nearby-invite { font-size: 11px; padding: 5px 9px; white-space: nowrap; }
.platform-tabs { margin-bottom: 14px; }
.pf-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.pf-toolbar .input { max-width: 300px; }
.pf-card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 14px; }
.pf-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.pf-name { font-weight: 700; font-size: 14px; }
.pf-meta { color: var(--muted); font-size: 12px; margin-top: 2px; }
.pf-stats { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 10px; font-size: 11.5px; color: var(--muted); }
.pf-stats b { color: var(--text); }
.pf-actions { display: flex; gap: 6px; }
.nav-badge {
  margin-left: auto; background: #ef4444; color: #fff;
  font-size: 10px; font-weight: 800; min-width: 18px; height: 18px;
  border-radius: 999px; display: inline-flex; align-items: center; justify-content: center;
  padding: 0 5px;
}
.login-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 34px 32px 26px;
  width: 360px;
  box-shadow: 0 20px 50px rgba(34,27,38,.12);
  text-align: center;
}
.login-card .logo { font-size: 34px; }
.login-card h1 { margin: 6px 0 2px; letter-spacing: -0.5px; }
.login-card form { margin-top: 18px; text-align: left; }
.login-card .hint { margin-top: 14px; }

/* ---------- Shell ---------- */
.app-shell { min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  padding: 10px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 20;
}
.brand { font-weight: 800; font-size: 17px; letter-spacing: -0.3px; }
.brand-sub { font-weight: 500; font-size: 13px; color: var(--muted); margin-left: 8px; }
.topbar-right { display: flex; align-items: center; gap: 10px; }

.layout { display: flex; flex: 1; min-height: 0; }

.sidebar {
  width: 212px;
  flex: 0 0 212px;
  background: var(--panel);
  border-right: 1px solid var(--line);
  padding: 14px 10px;
  position: sticky;
  top: 53px;
  height: calc(100vh - 53px);
  overflow-y: auto;
}
.sidebar button {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  margin-bottom: 3px;
  border: none;
  background: none;
  border-radius: 9px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text);
}
.sidebar button:hover { background: var(--hover); }
.sidebar button.active { background: var(--primary); color: #fff; }

.content { flex: 1; padding: 22px 26px 60px; min-width: 0; }

/* ---------- Headings / panels ---------- */
.view-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.view-head h2 { margin: 0; font-size: 21px; letter-spacing: -0.4px; }
.content h3 { margin: 22px 0 10px; font-size: 15px; }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
  min-width: 0;
}
.panel h3 { margin: 0 0 12px; }

.split {
  display: grid;
  grid-template-columns: 1.55fr 1fr;
  gap: 16px;
  align-items: start;
}

/* ---------- Stat cards ---------- */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.stat {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
}
.stat .num { font-size: 26px; font-weight: 800; line-height: 1.1; letter-spacing: -0.5px; }
.stat .lbl { font-size: 12px; color: var(--muted); margin-top: 3px; }
.stat.accent .num { color: var(--primary-ink); }
.stat.ok .num { color: var(--ok); }
.stat.warn .num { color: var(--warn); }
.stat.bad .num { color: var(--danger); }

/* ---------- Buttons / inputs ---------- */
.input {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  font-size: 14px;
  background: var(--panel-2);
  color: var(--text);
  font-family: inherit;
}
.input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 13%, transparent); }
.input::placeholder { color: #6b7c96; }
.input.narrow { width: auto; }
label { font-size: 12.5px; font-weight: 600; display: block; }
label .input, label select { margin-top: 4px; font-weight: 400; }
select option { background: var(--hover); color: var(--text); }

.btn {
  padding: 9px 15px;
  border: 1px solid var(--line);
  background: var(--hover);
  border-radius: 9px;
  cursor: pointer;
  font-size: 13.5px;
  font-family: inherit;
  color: var(--text);
  white-space: nowrap;
}
.btn:hover { background: var(--hover); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-ghost { background: transparent; border: none; color: var(--muted); }
.btn-ghost:hover { background: var(--hover); }
.btn-block { width: 100%; }
.btn-sm { padding: 5px 10px; font-size: 12.5px; }
.btn-danger { color: var(--danger); }
.btn-outline { border-color: var(--primary); color: var(--primary-ink); }
.btn-outline:hover { background: color-mix(in srgb, var(--primary) 10%, transparent); }

/* ---------- Forms ---------- */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  margin: 14px 0;
  box-shadow: var(--shadow);
}
.span-2 { grid-column: span 2; }
.inline-form { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); align-items: end; }

.toolbar { display: flex; gap: 10px; margin-bottom: 12px; align-items: center; }
.toolbar .input { flex: 1; max-width: 340px; }

/* ---------- Tables ---------- */
.table-wrap {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line); font-size: 13.5px; }
th { background: var(--hover); color: var(--muted); font-size: 11.5px; text-transform: none; letter-spacing: 0; }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--hover); }
td .meta { color: var(--muted); font-size: 12px; }

/* ---------- Badges ---------- */
.badge {
  background: color-mix(in srgb, var(--primary) 11%, transparent);
  color: var(--primary-ink);
  border-radius: 999px;
  padding: 4px 11px;
  font-size: 12.5px;
  font-weight: 600;
}
.pill {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--hover);
  color: var(--muted);
  white-space: nowrap;
}
.pill.scheduled { background: color-mix(in srgb, var(--primary) 11%, transparent); color: var(--primary-ink); }
.pill.checked-in { background: rgba(14,107,128,.16); color: var(--info); }
.pill.in-progress { background: rgba(196,128,10,.16); color: var(--warn-ink); }
.pill.completed { background: rgba(44,122,85,.16); color: var(--ok); }
.pill.cancelled { background: rgba(110,101,119,.16); color: var(--text-2); }
.pill.no-show { background: rgba(179,54,45,.16); color: var(--danger); }
.pill.doctor { background: rgba(44,122,85,.16); color: var(--ok); }
.pill.receptionist { background: color-mix(in srgb, var(--primary) 11%, transparent); color: var(--primary-ink); }
.pill.nurse { background: rgba(196,128,10,.16); color: var(--warn-ink); }
.pill.admin { background: rgba(179,54,45,.16); color: var(--danger); }

/* ---------- Tabs ---------- */
.tabs { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 1px solid var(--line); margin: 16px 0; }
.tabs button {
  border: none;
  background: none;
  padding: 9px 14px;
  cursor: pointer;
  font-size: 13.5px;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  font-family: inherit;
}
.tabs button.active { color: var(--primary-ink); border-bottom-color: var(--primary); font-weight: 600; }

/* ---------- Legacy week grid ---------- */
.cal-title { font-weight: 700; margin-bottom: 10px; font-size: 15px; }
.week-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 10px; }
.day-col {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  min-height: 230px;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow);
}
.day-head {
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
}
.day-head .n { color: var(--text); font-size: 14px; }
.day-col.today .day-head { background: color-mix(in srgb, var(--primary) 10%, transparent); color: var(--primary-ink); }
.day-col.today .day-head .n { color: var(--primary-ink); }
.day-body { padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.slot {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 8px;
  font-size: 12px;
  cursor: pointer;
}
.slot:hover { border-color: var(--primary); }
.slot .t { font-weight: 700; font-size: 11.5px; color: var(--primary-ink); }
.slot .p { font-weight: 600; }
.slot .d { color: var(--muted); font-size: 11px; }

/* ---------- Mini lists ---------- */
.mini-list { display: flex; flex-direction: column; gap: 8px; }
.mini-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel-2);
  font-size: 13px;
}
.mini-item .who { font-weight: 600; }
.mini-item .sub { color: var(--muted); font-size: 12px; }

/* ---------- Patient header ---------- */
.patient-hero {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}
.patient-hero h2 { margin: 0 0 4px; }
.patient-hero .contact { color: var(--muted); font-size: 13px; line-height: 1.6; }
.dl { display: grid; grid-template-columns: 190px 1fr; gap: 8px 14px; font-size: 13.5px; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; }

.empty { color: var(--muted); font-style: italic; padding: 16px 4px; }
.big-empty { text-align: center; padding: 30px; color: var(--muted); }

/* ---------- Modal ---------- */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(34,27,38,.42);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 50;
}
.modal-box {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  width: 560px;
  max-width: 100%;
  max-height: 90vh;
  overflow: auto;
  padding: 22px;
  box-shadow: 0 30px 70px rgba(34,27,38,.18);
}
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.modal-head h3 { margin: 0; }
.modal .form-grid { margin: 0; padding: 0; border: none; box-shadow: none; background: transparent; }

/* ---------- Patient record popup ---------- */
#patientModal { z-index: 70; }
#modal { z-index: 80; }
.patient-box { width: 820px; max-width: 96vw; padding: 0; position: relative; }
.pm-close {
  position: absolute; top: 14px; right: 14px; z-index: 3;
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--hover); border: 1px solid var(--line); color: var(--text);
  display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.pm-close:hover { background: var(--hover); }
.pm-id { display: flex; align-items: center; gap: 12px; min-width: 0; }
.pm-id h2 { margin: 0 0 3px; font-size: 19px; }
.pm-actions { padding-right: 44px; }
.client-facts { background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: 2px 14px; }
.cf-row { display: flex; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.cf-row:last-child { border-bottom: none; }
.cf-row span { color: var(--muted); flex: 0 0 80px; }
.cf-row b { font-weight: 600; overflow-wrap: anywhere; }
.appt-list { display: flex; flex-direction: column; gap: 8px; }
.appt-row { display: flex; align-items: center; gap: 10px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.appt-when { flex: 0 0 54px; display: flex; flex-direction: column; }
.appt-when b { font-size: 12px; }
.appt-when span { font-size: 11px; color: var(--muted); }
.appt-info { flex: 1; min-width: 0; }
.appt-svc { font-weight: 700; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appt-meta { font-size: 11.5px; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pm-sec { border-top: 1px solid var(--line); }
.pm-sec:first-child { border-top: none; }
.pm-sec summary {
  display: flex; align-items: center; gap: 8px;
  padding: 13px 0; cursor: pointer; list-style: none;
  font-size: 11.5px; text-transform: none; letter-spacing: 0;
  color: var(--muted); font-weight: 700;
}
.pm-sec summary::-webkit-details-marker { display: none; }
.pm-sec summary::after {
  content: ""; width: 7px; height: 7px; margin-left: auto;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
  transform: rotate(45deg); transition: transform .15s ease;
}
.pm-sec[open] summary::after { transform: rotate(-135deg); }
.pm-sec-body { padding-bottom: 10px; }

@media (max-width: 900px) {
  #clientModal { padding: 0; align-items: stretch; }
  #clientModal .patient-box {
    width: 100%; max-width: 100%; height: 100dvh; max-height: 100dvh;
    border-radius: 0; margin: 0; display: flex; flex-direction: column; overflow: hidden;
  }
  #clientModal .pm-hero-wrap { flex: 0 0 auto; padding: 18px 16px 10px; background: var(--panel); border-bottom: 1px solid var(--line); }
  #clientModal .pm-body { flex: 1; overflow-y: auto; padding: 0 16px 90px; max-height: none; }
  #clientModal .pm-actions { padding-right: 0; }
  #clientModal .pm-hero { flex-direction: column; align-items: flex-start; gap: 10px; }
}
.pm-hero-wrap { padding: 18px 20px 0; }
.pm-hero { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; }
.pm-hero h2 { margin: 0 0 4px; }
.pm-sub { color: var(--muted); font-size: 13px; line-height: 1.55; }
.pm-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.pm-tabs { padding: 0 20px; margin: 12px 0 0; }
.pm-body { padding: 14px 20px 20px; max-height: 66vh; overflow: auto; }
.pm-x { font-size: 16px; }

/* ---------- Patient profile ---------- */
.profile-head { display: flex; gap: 14px; align-items: center; margin-bottom: 6px; }
.avatar {
  width: 56px; height: 56px; border-radius: 50%;
  background: linear-gradient(135deg, #2563eb, #3b82f6);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 18px; flex: 0 0 auto;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 13%, transparent);
}
.profile-id h3 { margin: 0 0 2px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.chip { font-size: 11.5px; font-weight: 600; padding: 2px 9px; border-radius: 999px; background: var(--hover); color: var(--muted); }
.chip.ok { background: rgba(44,122,85,.16); color: var(--ok); }
.chip.warn { background: rgba(196,128,10,.16); color: var(--warn-ink); }
.chip.bad { background: rgba(179,54,45,.16); color: var(--danger); }
.profile-section { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.profile-section:first-of-type { margin-top: 14px; padding-top: 0; border-top: none; }
.profile-section > h4 { margin: 0 0 8px; font-size: 12px; text-transform: none; letter-spacing: 0; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.profile-section > h4::before { content: ""; width: 3px; height: 12px; background: var(--primary); border-radius: 2px; }
.ps-head { cursor: pointer; user-select: none; }
.ps-head .ps-title { flex: 1; }
.ps-head:hover .ps-title { color: var(--primary-ink); }
.ps-chev { transition: transform .15s ease; color: var(--muted); font-size: 12px; }
.profile-section.collapsed .ps-body { display: none; }
.profile-section.collapsed .ps-chev { transform: rotate(-90deg); }

/* Profile info cards */
.p-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.p-card { background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.p-card h5 { margin: 0 0 10px; font-size: 11.5px; text-transform: none; letter-spacing: 0; color: var(--muted); font-weight: 700; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; font-size: 13px; border-bottom: 1px dashed rgba(110,101,119,.14); }
.kv:last-child { border-bottom: none; }
.kv > span { color: var(--muted); flex: 0 0 auto; }
.kv > b { font-weight: 600; text-align: right; word-break: break-word; }
.kv-block { flex-direction: column; gap: 2px; }
.kv-block > b { text-align: left; }
.cond-row { display: flex; gap: 8px; margin: 4px 0 6px; }
.cond-row .input { flex: 1; }
.cond-picker { position: relative; }
.cp-menu {
  position: fixed;
  z-index: 130;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 18px 44px rgba(34,27,38,.18);
  max-height: 240px;
  overflow: auto;
  padding: 4px;
  min-width: 200px;
}
.cp-item { padding: 7px 10px; border-radius: 7px; cursor: pointer; font-size: 13px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cp-item:hover, .cp-item.hl { background: color-mix(in srgb, var(--primary) 11%, transparent); color: var(--primary-ink); }
.cp-empty { padding: 8px 10px; color: var(--muted); font-size: 12.5px; }
.cond-chip { display: inline-flex; align-items: center; gap: 4px; }
.chip-x { border: none; background: transparent; color: inherit; cursor: pointer; font-size: 10px; padding: 0 1px; opacity: .7; }
.chip-x:hover { opacity: 1; }

/* ---------- SOAP note ---------- */
.soap { font-size: 13px; line-height: 1.6; }
.soap div { margin-bottom: 2px; }

/* ---------- Safety alert ---------- */
.alert {
  background: rgba(179,54,45,.14);
  color: var(--danger);
  border: 1px solid rgba(179,54,45,.35);
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 12px;
  font-weight: 600;
  font-size: 13.5px;
}

/* ---------- Connection status ---------- */
.conn { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.conn .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); display: inline-block; }
.conn .dot.on { background: var(--ok); }
.conn .dot.off { background: var(--danger); }

/* ---------- Active consultation dock ---------- */
.consult-dock {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: 340px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 24px 60px rgba(34,27,38,.18);
  overflow: hidden;
  z-index: 60;
}
.consult-dock .dock-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: #221b26;
  color: #fff;
}
.consult-dock .dock-title { font-size: 12.5px; font-weight: 700; }
.consult-dock .dock-body { padding: 14px; max-height: 58vh; overflow: auto; }
.consult-dock .btn-ghost { color: #e9e3ee; }

.consult-bar {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 16px;
  background: #221b26;
  color: #fff;
  border-radius: 999px;
  padding: 9px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  box-shadow: 0 14px 34px rgba(34,27,38,.18);
  z-index: 60;
  cursor: pointer;
}
.consult-bar .btn { background: var(--panel); color: #221b26; border: none; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  top: 64px;
  left: 50%;
  transform: translateX(-50%) translateY(-10px);
  background: #221b26;
  color: #fff;
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 13.5px;
  box-shadow: 0 14px 34px rgba(34,27,38,.18);
  opacity: 0;
  transition: opacity .2s, transform .2s;
  z-index: 90;
  max-width: 90vw;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- Legacy cal-grid ---------- */
.cal-grid {
  display: grid;
  grid-template-columns: 66px repeat(7, minmax(120px, 1fr));
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.cal-grid .cal-head {
  background: var(--hover);
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.cal-grid .cal-head .n { font-size: 15px; color: var(--text); }
.cal-grid .cal-head.today { background: color-mix(in srgb, var(--primary) 10%, transparent); color: var(--primary-ink); }
.cal-grid .cal-head.today .n { color: var(--primary-ink); }
.cal-grid .cal-time {
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
  padding: 6px 8px;
  font-size: 11.5px;
  color: var(--muted);
  text-align: right;
  background: var(--panel);
}
.cal-grid .cal-cell {
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
  min-height: 42px;
  padding: 2px;
}
.cal-grid .cal-slot { height: 100%; min-height: 38px; border-radius: 6px; cursor: pointer; }
.cal-grid .cal-slot:hover { background: color-mix(in srgb, var(--primary) 10%, transparent); box-shadow: inset 0 0 0 1px var(--primary); }
.cal-grid .cal-appt {
  height: 100%;
  border-radius: 6px;
  padding: 3px 6px;
  font-size: 11.5px;
  cursor: pointer;
  background: color-mix(in srgb, var(--primary) 10%, transparent);
  border-left: 3px solid var(--primary);
  overflow: hidden;
}
.cal-grid .cal-appt .meta { color: var(--muted); font-size: 10.5px; }
.cal-grid .cal-appt.checked-in { background: rgba(14,107,128,.14); border-left-color: var(--info); }
.cal-grid .cal-appt.in-progress { background: rgba(196,128,10,.14); border-left-color: var(--warn); }
.cal-grid .cal-appt.completed { background: rgba(44,122,85,.14); border-left-color: var(--ok); }
.cal-grid .cal-appt.no-show { background: var(--hover); border-left-color: var(--faint); }

/* ---------- Week calendar (duration-aware) ---------- */
.cal-week { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); overflow: hidden; }
.cal-dayrow { display: grid; grid-template-columns: 64px repeat(7, 1fr); background: var(--hover); border-bottom: 1px solid var(--line); }
.cal-dayrow .cal-gutter { border-right: 1px solid var(--line); }
.cal-dayhead { padding: 8px 6px; text-align: center; border-right: 1px solid var(--line); }
.cal-dayhead .cd-dow { font-size: 11px; text-transform: none; letter-spacing: 0; color: var(--muted); font-weight: 700; }
.cal-dayhead .cd-num { font-size: 17px; font-weight: 800; }
.cal-dayhead.today { background: color-mix(in srgb, var(--primary) 10%, transparent); }
.cal-dayhead.today .cd-dow, .cal-dayhead.today .cd-num { color: var(--primary-ink); }
.cal-body { display: grid; grid-template-columns: 64px repeat(7, 1fr); }
.cal-body .cal-gutter { position: relative; height: 1080px; border-right: 1px solid var(--line); }
.cal-hourlabel { position: absolute; right: 8px; transform: translateY(-50%); font-size: 11px; color: var(--muted); }
.cal-col {
  position: relative;
  height: 1080px;
  border-right: 1px solid var(--line);
  cursor: crosshair;
  background: var(--panel);
}
.cal-col.today { background-color: color-mix(in srgb, var(--primary) 4%, var(--panel)); }
.cal-col.weekend { background-color: var(--panel-2); }
.cal-col:hover { background-color: var(--hover); }
.cal-line { position: absolute; left: 0; right: 0; height: 1px; background: var(--line); }
.cal-line.half { background: color-mix(in srgb, var(--line) 50%, transparent); }
.cal-event {
  position: absolute;
  border-radius: 6px;
  padding: 2px 5px;
  font-size: 11px;
  line-height: 1.25;
  overflow: hidden;
  cursor: pointer;
  background: color-mix(in srgb, var(--primary) 10%, transparent);
  border-left: 3px solid var(--primary);
  box-shadow: 0 1px 2px rgba(34,27,38,.12);
  z-index: 2;
  white-space: nowrap;
}
.cal-event:hover { filter: brightness(1.12); box-shadow: 0 3px 12px rgba(34,27,38,.12); }
.cal-event .ce-time { font-weight: 800; font-size: 10px; color: var(--primary-ink); }
.cal-event.long .ce-time { display: block; margin: 0 0 1px; }
.cal-event .ce-name { font-weight: 600; }
.cal-event.long .ce-name { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-event .ce-meta { color: var(--muted); font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-event.checked-in { background: rgba(14,107,128,.14); border-left-color: var(--info); }
.cal-event.checked-in .ce-time { color: var(--info); }
.cal-event.in-progress { background: rgba(196,128,10,.14); border-left-color: var(--warn); }
.cal-event.in-progress .ce-time { color: var(--warn-ink); }
.cal-event.completed { background: rgba(44,122,85,.14); border-left-color: var(--ok); }
.cal-event.completed .ce-time { color: var(--ok); }
.cal-event.no-show { background: var(--hover); border-left-color: var(--faint); }
.cal-ghost {
  position: absolute;
  left: 2px; right: 2px;
  border: 1.5px dashed var(--primary);
  background: color-mix(in srgb, var(--primary) 8%, transparent);
  border-radius: 6px;
  display: none;
  pointer-events: none;
  z-index: 1;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--primary-ink);
  padding: 1px 5px;
  overflow: hidden;
}
.cal-ghost.show { display: block; }
.cal-hint { font-size: 12px; color: var(--muted); margin: -4px 0 10px; }
.cal-legend { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 10px; font-size: 12px; color: var(--muted); }
.cal-legend-item { display: inline-flex; align-items: center; gap: 5px; }
.cal-legend-item i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.cal-legend-item.dim { opacity: .35; }
.cal-event .ce-status { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; }
.cal-event .ce-line { display: flex; gap: 4px; align-items: baseline; min-width: 0; }
.cal-event .ce-line .ce-time { flex: 0 0 auto; }
.cal-event .ce-line .ce-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.cal-tip {
  position: fixed;
  z-index: 100;
  background: #221b26;
  color: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 12px;
  line-height: 1.4;
  box-shadow: 0 10px 24px rgba(34,27,38,.18);
  pointer-events: none;
  max-width: 240px;
}
.cal-tip .tip-time { font-weight: 700; }
.cal-tip .tip-dur { color: #f0c9df; font-weight: 600; }
.cal-tip .tip-name { font-weight: 600; }
.cal-tip .tip-meta { color: #d9d1de; font-size: 11.5px; }
.cal-now { position: absolute; left: 0; right: 0; height: 2px; background: var(--danger); z-index: 3; }
.cal-now::before { content: ""; position: absolute; left: -4px; top: -4px; width: 10px; height: 10px; background: var(--danger); border-radius: 50%; }

/* ---------- Visual polish ---------- */
.topbar { background: linear-gradient(180deg, #ffffff, var(--panel-2)); }
.sidebar button { transition: background .12s ease; }
.sidebar button.active { background: linear-gradient(90deg, #2563eb, #3b82f6); box-shadow: 0 6px 14px color-mix(in srgb, var(--primary) 18%, transparent); }
.btn { transition: background .12s ease, border-color .12s ease, box-shadow .12s ease; }
.btn-primary { box-shadow: 0 6px 14px color-mix(in srgb, var(--primary) 14%, transparent); }
.btn-primary:hover { box-shadow: 0 8px 18px color-mix(in srgb, var(--primary) 20%, transparent); }
.stat { position: relative; overflow: hidden; }
.stat::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--line); }
.stat.accent::before { background: var(--primary); }
.stat.ok::before { background: var(--ok); }
.stat.warn::before { background: var(--warn); }
.stat.bad::before { background: var(--danger); }
.panel h3 { letter-spacing: -0.2px; }
th { font-weight: 700; }

/* ---------- Salon booking states ---------- */
.pill.pending { background: rgba(196,128,10,.16); color: var(--warn-ink); }
.pill.confirmed { background: rgba(44,122,85,.16); color: var(--ok); }
.pill.newest { background: color-mix(in srgb, var(--primary) 13%, transparent); color: var(--primary-ink); }
.pill.proposed { background: rgba(192,132,252,.18); color: #d8b4fe; }
.pill.conflict { background: rgba(179,54,45,.16); color: var(--danger); }
.cal-event.conflict { box-shadow: inset 0 0 0 1px rgba(179,54,45,.6); }
.hol-warn { background: rgba(179,54,45,.12); border: 1px solid rgba(179,54,45,.4); color: var(--danger); border-radius: 10px; padding: 9px 12px; font-size: 12.5px; margin-top: 12px; }
.hol-actions { display: flex; flex-direction: column; gap: 6px; }
.req-list { display: flex; flex-direction: column; gap: 8px; }
.req-card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 12px; }
.req-card.new { border-color: color-mix(in srgb, var(--primary) 31%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--primary) 8%, transparent); }
.req-top { display: flex; align-items: flex-start; gap: 10px; }
.req-avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--hover); border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; color: var(--text-2); flex: 0 0 auto; }
.req-id { flex: 1; min-width: 0; }
.req-name { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-weight: 700; font-size: 13.5px; }
.req-sub { color: var(--muted); font-size: 12px; margin-top: 3px; }
.req-ago { color: var(--muted); font-size: 11px; white-space: nowrap; }
.req-meta { display: flex; gap: 6px; flex-wrap: wrap; margin: 10px 0 2px; }
.req-chip { background: var(--hover); border: 1px solid var(--line); border-radius: 999px; padding: 3px 8px; font-size: 11px; color: var(--text-2); }
.req-neighbours { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.req-nb { display: inline-flex; align-items: baseline; gap: 4px; font-size: 11px; color: var(--muted); background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 4px 8px; }
.req-nb em { font-style: normal; color: var(--muted); margin-right: 3px; }
.req-nb b { color: var(--text); font-weight: 600; margin-right: 2px; }
.req-dur { color: var(--muted); }
.req-actions { display: grid; grid-template-columns: 1.2fr 1fr 1fr; gap: 6px; margin-top: 10px; }
.req-actions .btn { width: 100%; padding: 8px 6px; font-size: 12px; }
.req-resched { background: var(--hover); border: 1px solid var(--line); color: var(--text); }

/* Reschedule modal */
.res-current { color: var(--muted); font-size: 12.5px; margin-bottom: 12px; }
.res-label { font-size: 12px; text-transform: none; letter-spacing: 0; color: var(--muted); margin: 4px 0 8px; }
.res-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.res-chip { padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); color: var(--text); font: inherit; font-size: 13px; cursor: pointer; }
.res-chip.sel { background: var(--primary); border-color: var(--primary); color: #fff; }
.res-chip.off { opacity: .4; cursor: not-allowed; text-decoration: line-through; }
.res-slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(74px, 1fr)); gap: 8px; }
.res-slot { padding: 9px 4px; border: 1px solid var(--line); border-radius: 9px; background: var(--hover); color: var(--text); font: inherit; font-size: 13px; cursor: pointer; }
.res-slot:hover { border-color: var(--primary); }
.res-slot.sel { background: var(--primary); border-color: var(--primary); color: #fff; }
.res-slot:disabled { opacity: .3; cursor: not-allowed; text-decoration: line-through; }
@media (max-width: 420px) { .req-actions { grid-template-columns: 1fr 1fr; } .req-actions .req-resched { grid-column: 1 / -1; } }
.cal-event.pending { border-left-style: dashed; }

/* ---------- Mobile bottom nav + drawer ---------- */
#bottomNav, #drawer, #drawerBackdrop { display: none; }

@media (max-width: 900px) {
  .sidebar { display: none !important; }
  .content { padding-bottom: 92px; }

  #bottomNav {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 40;
    display: flex;
    background: var(--panel);
    border-top: 1px solid var(--line);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .bnav-item {
    flex: 1;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    background: none; border: none; color: var(--muted); font: inherit; font-size: 10px;
    padding: 4px 2px; border-radius: 10px; cursor: pointer;
  }
  .bnav-item .ni { font-size: 17px; line-height: 1; }
  .bnav-item em { font-style: normal; }
  .bnav-item.active { color: var(--primary-ink); background: color-mix(in srgb, var(--primary) 8%, transparent); }

  .drawer-backdrop { position: fixed; inset: 0; background: rgba(34,27,38,.12); z-index: 45; display: none; }
  #drawerBackdrop.open { display: block; }

  #drawer {
    position: fixed;
    top: 0; right: 0; bottom: 0;
    width: 270px; max-width: 82vw;
    background: var(--panel);
    border-left: 1px solid var(--line);
    z-index: 50;
    display: flex; flex-direction: column; gap: 4px;
    padding: 14px;
    transform: translateX(100%);
    transition: transform .22s ease;
    overflow-y: auto;
  }
  #drawer.open { transform: translateX(0); }
  .drawer-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
  .drawer-item {
    display: flex; align-items: center; gap: 10px;
    padding: 11px 12px; border: none; background: none; color: var(--text);
    font: inherit; font-size: 14px; border-radius: 10px; text-align: left; cursor: pointer;
  }
  .drawer-item .ni { font-size: 16px; }
  .drawer-item em { font-style: normal; }
  .drawer-item:hover { background: var(--hover); }
  .drawer-item.active { background: var(--primary); color: #fff; }
  .drawer-close {
    margin-top: auto;
    padding: 12px;
    border: 1px solid var(--line);
    background: transparent;
    color: var(--muted);
    border-radius: 10px;
    font: inherit;
    font-size: 13px;
    cursor: pointer;
  }
  .drawer-close:hover { background: var(--hover); color: var(--text); }
}

/* ---------- Analytics ---------- */
.ana-bars { display: flex; align-items: flex-end; gap: 4px; height: 160px; padding-top: 8px; }
.ana-bar-wrap { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; }
.ana-bar { width: 100%; max-width: 32px; background: linear-gradient(180deg, var(--primary), #3b82f6); border-radius: 4px 4px 0 0; min-height: 2px; }
.ana-bar-wrap:hover .ana-bar { background: var(--primary); }
.ana-x { font-size: 9px; color: var(--muted); white-space: nowrap; }
.hbar { display: flex; align-items: center; gap: 8px; margin: 7px 0; font-size: 12px; }
.hbar .lbl { width: 92px; color: var(--muted); flex: 0 0 auto; }
.hbar .track { flex: 1; height: 10px; background: var(--hover); border-radius: 6px; overflow: hidden; }
.hbar .fill { display: block; height: 100%; border-radius: 6px; }
.hbar .val { width: 46px; text-align: right; color: var(--text); flex: 0 0 auto; }
.ana-note { font-size: 12px; color: var(--muted); margin-top: 8px; }
.ana-legend { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-top: 6px; }

/* Feed */
.feed-tabs { display: inline-flex; gap: 4px; background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 4px; }
.view-head .feed-tabs { margin-left: auto; }
.feed-tabs button { border: none; background: none; color: var(--muted); font: inherit; font-size: 12.5px; font-weight: 600; padding: 6px 14px; border-radius: 999px; cursor: pointer; }
.feed-tabs button.active { background: var(--primary); color: #fff; }
.feed-composer { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 12px; margin: 14px 0; }
.feed-composer textarea { width: 100%; resize: vertical; min-height: 58px; }
.feed-actions { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; }
.feed-photo { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); cursor: pointer; }
.feed-photo .ic { width: 16px; height: 16px; }
.feed-list { display: flex; flex-direction: column; gap: 12px; }
.feed-card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 14px; }
.feed-head { display: flex; align-items: center; gap: 10px; }
.feed-avatar { width: 38px; height: 38px; border-radius: 50%; flex: 0 0 auto; background: linear-gradient(135deg, var(--primary-dark, #2563eb), var(--primary, #3b82f6)); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 800; color: #fff; }
.feed-who { flex: 1; min-width: 0; }
.feed-name { font-weight: 700; font-size: 13.5px; }
.feed-role { font-size: 10px; font-weight: 700; color: var(--primary-ink); background: color-mix(in srgb, var(--primary) 10%, transparent); border-radius: 999px; padding: 1px 7px; margin-left: 4px; }
.feed-time { font-size: 11px; color: var(--muted); margin-top: 1px; }
.feed-stars { color: var(--warn); font-size: 14px; letter-spacing: 1px; }
.feed-text { margin-top: 10px; font-size: 13.5px; line-height: 1.55; white-space: pre-wrap; }
.feed-img { width: 100%; max-height: 420px; object-fit: cover; border-radius: 12px; margin-top: 10px; display: block; background: var(--panel-2); }
.feed-media { position: relative; }
.feed-media .feed-img { margin-top: 10px; }
.feed-save {
  position: absolute; right: 10px; bottom: 10px;
  display: inline-flex; align-items: center; gap: 6px;
  background: color-mix(in srgb, var(--panel) 90%, transparent); backdrop-filter: blur(6px);
  border: 1px solid var(--line); color: var(--text);
  border-radius: 999px; padding: 6px 11px; font: inherit; font-size: 11px; cursor: pointer;
}
.feed-save:hover { background: var(--panel); }
.feed-save .ic { width: 13px; height: 13px; }
.feed-note { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; margin: 8px 0 4px; }
.feed-note .ic { width: 14px; height: 14px; }
.feed-img.preview { max-height: 170px; margin-top: 10px; }
.feed-rating { display: flex; gap: 2px; margin-top: 8px; }
.feed-rating .star { font-size: 22px; color: var(--line-strong); background: none; border: none; cursor: pointer; padding: 0 1px; line-height: 1; }
.feed-rating .star.on { color: var(--warn); }
.feed-locked { display: flex; align-items: center; gap: 8px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 16px; margin: 14px 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.feed-locked .ic { flex: 0 0 auto; }
.feed-label { display: block; font-size: 11px; text-transform: none; letter-spacing: 0; color: var(--muted); font-weight: 700; margin-bottom: 5px; }
.feed-using { display: flex; align-items: center; gap: 7px; color: var(--warn); font-size: 12.5px; margin-top: 9px; }
.feed-using .ic { width: 14px; height: 14px; }

/* Client list (mobile cards / desktop table) */
.clients-table td, .clients-table th { white-space: nowrap; }
.client-list { display: flex; flex-direction: column; gap: 8px; }
.client-card {
  display: flex; align-items: center; gap: 12px;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 14px; padding: 12px; cursor: pointer;
}
.client-card:active { background: var(--hover); }
.client-card:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.client-avatar {
  width: 40px; height: 40px; border-radius: 50%; flex: 0 0 auto;
  background: var(--hover); border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: var(--text-2);
}
.client-main { flex: 1; min-width: 0; }
.client-name { font-weight: 700; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.client-contact { color: var(--muted); font-size: 12px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.client-visits { flex: 0 0 auto; text-align: right; font-size: 10px; color: var(--muted); text-transform: none; letter-spacing: 0; }
.client-visits b { display: block; font-size: 16px; color: var(--text); letter-spacing: 0; }
.rated-stars { color: var(--warn); letter-spacing: 2px; }
.occ {
  display: inline-block; padding: 2px 7px; border-radius: 999px;
  background: rgba(196,128,10,.16); color: var(--warn-ink);
  font-size: 10px; font-weight: 700; letter-spacing: .02em;
  border: 1px solid rgba(196,128,10,.35); vertical-align: middle; margin-left: 4px;
}
.cal-event.event { box-shadow: inset 0 0 0 1px rgba(196,128,10,.55); }
.ce-occ .ic { width: 10px; height: 10px; color: var(--warn); }
.req-chip .ic { width: 11px; height: 11px; }
.badge.live { color: var(--ok); border-color: rgba(44,122,85,.4); }
.badge.live::before { content: "●"; margin-right: 5px; animation: livePulse 1.8s ease-in-out infinite; }
#liveBadge:not(.live) { color: var(--danger); border-color: rgba(179,54,45,.4); }
#liveBadge:not(.live)::before { animation: none; }
@keyframes livePulse { 50% { opacity: .25; } }

/* ---------- Mobile day agenda ---------- */
.m-cal { display: flex; flex-direction: column; gap: 10px; }
.m-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.m-day { border: 1px solid var(--line); background: var(--panel); color: var(--text); border-radius: 10px; padding: 6px 0; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 2px; font: inherit; }
.m-day span { font-size: 10px; color: var(--muted); }
.m-day b { font-size: 15px; }
.m-day.today b { color: var(--primary-ink); }
.m-day.sel { background: var(--primary); border-color: var(--primary); color: #fff; }
.m-day.sel span { color: #f1e8ef; }
.m-daylabel { font-size: 12.5px; color: var(--muted); text-transform: none; letter-spacing: 0; }
.m-count { font-style: normal; font-size: 9px; font-weight: 700; color: var(--primary-ink); line-height: 1; }
.m-day.sel .m-count { color: #f1e8ef; }
.m-now { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--warn); margin: -2px 0 8px; }
.m-now .ic { width: 13px; height: 13px; }
.m-list { display: flex; flex-direction: column; gap: 8px; }
.m-appt { display: flex; gap: 10px; align-items: flex-start; background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--primary); border-radius: 12px; padding: 10px 12px; cursor: pointer; }
.m-appt:active { background: var(--hover); }
.m-time { flex: 0 0 54px; display: flex; flex-direction: column; }
.m-time b { font-size: 15px; }
.m-time span { font-size: 10.5px; color: var(--muted); }
.m-info { flex: 1; min-width: 0; }
.m-who { font-weight: 700; }
.m-svc { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-tags { margin-top: 5px; }
.m-actions { flex: 0 0 auto; }

/* ---------- Mobile / responsive ---------- */
@media (max-width: 900px) {
  .layout { flex-direction: column; }
  .sidebar {
    position: static;
    width: 100%;
    flex: 0 0 auto;
    height: auto;
    display: flex;
    gap: 6px;
    overflow-x: auto;
    border-right: none;
    border-bottom: 1px solid var(--line);
    padding: 8px 10px;
    -webkit-overflow-scrolling: touch;
  }
  .sidebar button {
    width: auto;
    flex: 0 0 auto;
    white-space: nowrap;
    padding: 8px 12px;
    margin-bottom: 0;
    font-size: 13px;
  }
  .content { padding: 14px 14px 44px; }
  .brand-sub { display: none; }
  .topbar { padding: 8px 12px; flex-wrap: wrap; gap: 8px; }
  .topbar-right { gap: 6px; }
  .view-head { flex-wrap: wrap; gap: 8px; }
  .view-head h2 { font-size: 18px; }
  .toolbar { flex-wrap: wrap; }
  .toolbar .input { max-width: none; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .split { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr !important; padding: 14px; }
  .form-grid .span-2 { grid-column: auto; }
  .p-grid { grid-template-columns: 1fr; }
  .pm-hero { flex-direction: column; }
  .pm-actions { justify-content: flex-start; }
  .pm-body { max-height: 72vh; }
  .modal-box { width: 100% !important; max-width: 100%; max-height: 94vh; padding: 16px; }
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .table-wrap table { min-width: 520px; }
  #calGrid { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .cal-week { min-width: 720px; }
  .dl { grid-template-columns: 1fr; }
  .dl dt { margin-top: 6px; }
}

@media (max-width: 560px) {
  .content { padding: 12px 10px 40px; }
  .login-card { width: 100%; padding: 24px 18px; }
  .topbar .brand { font-size: 15px; }
  .btn { padding: 9px 12px; }
  .stat .num { font-size: 22px; }
  .slots { grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)) !important; }
  .cal-week { min-width: 660px; }
}

/* ---------- Print ---------- */
.print-area { display: none; }
.rx-print { font-family: Georgia, "Times New Roman", serif; color: #000; background: var(--panel); }
.rx-print h1 { font-size: 20px; margin: 0 0 2px; }
.rx-head { display: flex; justify-content: space-between; align-items: flex-start; }
.rx-title { font-size: 18px; font-weight: 700; letter-spacing: .12em; }
.rx-print hr { border: none; border-top: 1px solid #000; margin: 12px 0; }
.rx-patient { display: flex; justify-content: space-between; font-size: 14px; margin-bottom: 16px; }
.rx-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.rx-table th, .rx-table td { border: 1px solid #000; padding: 8px 10px; text-align: left; background: var(--panel) !important; color: #000 !important; }
.rx-sign { margin-top: 50px; }
.rx-line { width: 240px; border-top: 1px solid #000; margin-bottom: 4px; }

.screen-head h2 { margin: 0 0 2px; font-size: 22px; }
.kv-row { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.kv-row:last-child { border-bottom: none; }
.kv-row span { color: var(--muted); }
.kv-row b { font-weight: 600; text-align: right; }

/* Tattoo status + role pills */
.pill.scheduled { background: rgba(96,165,250,.16); color: var(--primary-ink); }
.pill.completed { background: rgba(44,122,85,.16); color: var(--ok); }
.pill.no-show { background: rgba(179,54,45,.16); color: var(--danger); }
.pill.admin, .pill.artist, .pill.receptionist { background: rgba(110,101,119,.14); color: var(--text-2); }

/* Google sign-in */
.auth-divider { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 10.5px; text-transform: none; letter-spacing: 0; margin: 14px 0 10px; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
#googleBtn { margin-bottom: 4px; }

/* =====================================================================
   Lumière redesign — light, editorial salon theme.
   Fraunces for display (titles, big numbers, salon name), Figtree for UI.
   Brand colour (Settings) drives --primary; structure stays neutral ink.
   ===================================================================== */
body { font-size: 14.5px; line-height: 1.45; background: var(--bg); }
::selection { background: color-mix(in srgb, var(--primary) 22%, transparent); }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
a { color: var(--primary-ink); text-underline-offset: 2px; }
.muted, .hint { color: var(--muted); }
::-webkit-scrollbar-thumb { background: var(--line-strong); border: 2px solid var(--bg); }

/* Display type */
.view-head h2, .login-card h1, .modal-box h2, .pm-hero h2, .profile-hero h2 {
  font-family: var(--display); font-weight: 500; letter-spacing: -0.015em;
  font-variation-settings: "opsz" 72;
}
.view-head { margin-bottom: 22px; align-items: flex-end; }
.view-head h2 { font-size: 32px; line-height: 1.1; }
.view-head > .muted { font-size: 14px; }
.content h3, .panel h3 { font-family: var(--font); font-size: 15px; font-weight: 650; letter-spacing: 0; color: var(--ink); }
.content > .view > h3 { margin-top: 30px; }

/* Top bar */
.topbar {
  background: color-mix(in srgb, var(--panel) 88%, transparent); backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line); padding: 0 24px; height: 60px;
}
.brand { font-family: var(--display); font-weight: 600; font-size: 21px; letter-spacing: -0.01em; color: var(--ink); }
.brand-sub { font-family: var(--font); font-size: 13.5px; font-weight: 500; margin-left: 12px; padding-left: 12px; border-left: 1px solid var(--line); }
.topbar-right { gap: 6px; }
.topbar .badge { font-size: 12.5px; padding: 5px 11px; }
#userBadge { background: var(--hover); color: var(--ink); }
.badge.live { background: rgba(44,122,85,.1); color: var(--ok); }
.topbar .btn-ghost { color: var(--muted); font-weight: 500; padding: 8px 12px; }
.topbar .btn-ghost:hover { color: var(--ink); }

/* Sidebar */
.sidebar { width: 236px; flex-basis: 236px; top: 60px; height: calc(100vh - 60px); padding: 18px 12px; background: var(--panel); }
.sidebar button { padding: 9px 12px; margin-bottom: 2px; border-radius: 8px; font-size: 14.5px; color: var(--text-2); gap: 11px; font-weight: 500; }
.sidebar button .ic { color: var(--faint); }
.sidebar button:hover { background: var(--hover); color: var(--ink); }
.sidebar button.active, .sidebar button.active:hover {
  background: color-mix(in srgb, var(--primary) 9%, var(--panel)); color: var(--ink); font-weight: 650;
  box-shadow: inset 3px 0 0 var(--primary);
}
.sidebar button.active .ic { color: var(--primary-ink); }
.nav-badge { background: var(--primary); }

/* Content width */
.content { padding: 30px 36px 72px; }
.content > .view { max-width: 1240px; margin: 0 auto; }

/* Panels */
.panel, .table-wrap, .form-grid, .stat, .cal-week, .pf-card {
  border-radius: 12px; border-color: var(--line);
  box-shadow: 0 1px 2px rgba(34,27,38,.04);
}
.panel { padding: 20px 22px; }
.panel h3 { margin-bottom: 14px; }
.split { gap: 20px; margin-top: 20px; }
.split + .split { margin-top: 20px; }
.view > .panel + .panel, .view > .panel + .split { margin-top: 20px; }

/* Stats: big serif numerals, quiet cards */
.stats { gap: 14px; margin-bottom: 20px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.stat { padding: 18px 20px 16px; }
.stat::before { width: 0; }
.stat .num { font-family: var(--display); font-weight: 500; font-size: 36px; letter-spacing: -0.02em; line-height: 1; color: var(--ink); font-variation-settings: "opsz" 96; }
.stat .lbl { font-size: 13px; margin-top: 8px; }
.stat.accent .num { color: var(--primary-ink); }
.stat.ok .num { color: var(--ok); }
.stat.warn .num { color: var(--warn); }
.stat.bad .num { color: var(--danger); }

/* Buttons & inputs */
.btn {
  background: var(--panel); border: 1px solid var(--line-strong); border-radius: 8px;
  padding: 9px 16px; font-weight: 600; font-size: 13.5px; color: var(--ink); box-shadow: none;
}
.btn:hover { background: var(--hover); border-color: var(--line-strong); }
.btn-sm { padding: 6px 11px; font-size: 13px; }
.btn-primary, .btn-primary:hover { color: #fff; border-color: transparent; box-shadow: 0 1px 2px rgba(34,27,38,.12); }
.btn-primary { background: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-danger { color: var(--danger); }
.input { background: var(--panel); border: 1px solid var(--line-strong); border-radius: 8px; padding: 10px 12px; font-size: 14.5px; }
.input::placeholder { color: var(--faint); }
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 16%, transparent); }
select.input { appearance: none; -webkit-appearance: none; padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%236e6577' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; }
label { font-size: 13px; font-weight: 600; color: var(--text-2); }
select option { background: var(--panel); }
.form-grid { padding: 24px; gap: 16px 18px; }

/* Tables */
th { background: var(--panel-2); color: var(--muted); font-size: 12.5px; font-weight: 600; text-transform: none; letter-spacing: 0; padding: 11px 16px; }
td { padding: 13px 16px; font-size: 14px; }
tbody tr:hover { background: var(--panel-2); }

/* Pills */
.pill { font-size: 12px; font-weight: 600; padding: 3px 10px; }
.pill.proposed { background: rgba(111,79,176,.12); color: #5b3f97; }

/* Tabs (feed / platform) */
.feed-tabs { background: var(--hover); border: none; padding: 3px; border-radius: 9px; }
.feed-tabs button { border-radius: 7px; font-weight: 600; color: var(--muted); }
.feed-tabs button.active { background: var(--panel); color: var(--ink); box-shadow: 0 1px 2px rgba(34,27,38,.1); }

/* Booking requests: a tidy row on wide screens */
.req-list { gap: 10px; }
.req-card { border-radius: 12px; padding: 14px 16px; }
.req-card.new { border-color: color-mix(in srgb, var(--primary) 35%, var(--line)); box-shadow: inset 3px 0 0 var(--primary); }
.req-avatar { background: color-mix(in srgb, var(--primary) 10%, var(--panel)); color: var(--primary-ink); border: none; font-size: 12px; width: 38px; height: 38px; }
.req-name { font-size: 15px; font-weight: 650; }
.req-sub { font-size: 13px; }
.req-chip { background: var(--panel-2); color: var(--text-2); font-size: 12px; padding: 3px 9px; }
.req-nb { font-size: 12px; background: var(--panel); }
.req-resched { background: var(--panel); border-color: var(--line-strong); }
.req-actions .btn { font-size: 13px; padding: 9px 8px; }
@media (min-width: 1180px) {
  .req-card { display: grid; grid-template-columns: minmax(0, 1fr) 330px; column-gap: 24px; align-items: center; }
  .req-card > *:not(.req-actions) { grid-column: 1; }
  .req-card > .req-actions { grid-column: 2; grid-row: 1 / span 3; margin-top: 0; align-self: center; }
}
#dashRequests { max-height: 640px; overflow-y: auto; margin: 0 -6px; padding: 0 6px; }

/* Mini lists */
.mini-item { border-radius: 10px; }

/* Calendar */
.cal-title { font-family: var(--display); font-weight: 500; font-size: 22px; letter-spacing: -0.01em; margin: 0 0 4px; }
.cal-hint { margin: 0 0 14px; font-size: 13px; }
.cal-dayrow { background: var(--panel); }
.cal-dayhead { padding: 10px 6px 12px; }
.cal-dayhead .cd-dow { text-transform: none; letter-spacing: 0; font-size: 12.5px; font-weight: 500; }
.cal-dayhead .cd-num { font-family: var(--display); font-weight: 500; font-size: 24px; line-height: 1.1; }
.cal-dayhead.today { background: transparent; box-shadow: inset 0 -2px 0 var(--primary); }
.cal-col.today { background-color: color-mix(in srgb, var(--primary) 3%, var(--panel)); }
.cal-hourlabel { font-size: 11.5px; }
.cal-event { background: var(--panel); border: 1px solid var(--line); border-left-width: 3px; border-radius: 6px; box-shadow: 0 1px 2px rgba(34,27,38,.06); padding: 3px 6px; }
.cal-event .ce-name { color: var(--ink); }
.cal-event:hover { filter: none; box-shadow: 0 4px 14px rgba(34,27,38,.12); z-index: 4; }
.cal-event.completed, .cal-event.checked-in, .cal-event.in-progress, .cal-event.no-show { background: var(--panel); }
.cal-event.cancelled { opacity: .55; }
.m-day { border-radius: 10px; }
.m-day span { text-transform: none; letter-spacing: 0; font-size: 11px; }
.m-day b { font-family: var(--display); font-weight: 500; font-size: 18px; }

/* Analytics */
.ana-bar { background: var(--primary); border-radius: 3px 3px 0 0; opacity: .85; }
.ana-bar-wrap:hover .ana-bar { opacity: 1; }
.hbar .track { background: var(--hover); height: 8px; }
.hbar .lbl { font-size: 13px; }

/* Modals */
.modal { background: rgba(34,27,38,.38); backdrop-filter: blur(2px); }
.modal-box { border-radius: 14px; border: 1px solid var(--line); box-shadow: 0 24px 64px rgba(34,27,38,.22); }
.res-label { text-transform: none; letter-spacing: 0; font-weight: 600; color: var(--text-2); font-size: 13px; }
.res-slot { background: var(--panel); border-color: var(--line-strong); }

/* ---------- Login: editorial split screen ---------- */
.login-screen { background: var(--bg); padding: 32px 20px; }
.login-aside { display: none; }
.login-card { box-shadow: 0 1px 2px rgba(34,27,38,.05), 0 20px 48px rgba(34,27,38,.08); border-radius: 16px; padding: 36px 32px 28px; width: 400px; max-width: 100%; text-align: left; }
.login-card .logo { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: color-mix(in srgb, var(--primary) 10%, var(--panel)); color: var(--primary-ink); margin-bottom: 18px; }
.login-card .logo .ic { width: 22px; height: 22px; }
.login-card h1 { font-size: 34px; margin: 0 0 4px; }
.login-card > .muted { margin: 0; }
.login-card form { margin-top: 24px; }
.login-card label { margin-bottom: 6px; }
.login-card .btn-primary { padding: 12px; font-size: 14.5px; margin-top: 18px !important; }
.login-card .hint { text-align: left; font-size: 13px; }
.nearby { width: 400px; border-radius: 16px; box-shadow: none; padding: 16px 18px; }
@media (min-width: 980px) {
  .login-screen {
    display: grid; grid-template-columns: minmax(420px, 1.1fr) minmax(460px, 1fr);
    grid-template-rows: 1fr auto 1fr; padding: 0; gap: 0; align-items: center; justify-items: center;
  }
  .login-aside {
    display: flex; flex-direction: column; justify-content: space-between;
    grid-column: 1; grid-row: 1 / -1; align-self: stretch; justify-self: stretch;
    padding: 56px 64px; color: #f6eef3;
    background: color-mix(in srgb, var(--primary) 78%, #1b1020);
    position: relative; overflow: hidden;
  }
  .login-aside::after {
    content: ""; position: absolute; right: -160px; bottom: -160px; width: 520px; height: 520px; border-radius: 50%;
    border: 1px solid rgba(255,255,255,.14); box-shadow: 0 0 0 60px rgba(255,255,255,.03), 0 0 0 140px rgba(255,255,255,.025);
  }
  .login-aside .la-name { font-family: var(--display); font-weight: 500; font-size: 22px; letter-spacing: -0.01em; }
  .login-aside .la-line { font-family: var(--display); font-weight: 400; font-size: clamp(40px, 4.4vw, 64px); line-height: 1.04; letter-spacing: -0.025em; max-width: 11ch; margin: 0; font-variation-settings: "opsz" 144; }
  .login-aside .la-foot { font-size: 14px; color: rgba(246,238,243,.72); max-width: 38ch; line-height: 1.55; }
  .login-card { grid-column: 2; grid-row: 2; box-shadow: none; border: none; background: transparent; padding: 0; width: 380px; }
  .nearby { grid-column: 2; grid-row: 3; align-self: start; margin-top: 28px; width: 380px; background: var(--panel); }
}

/* ---------- Mobile ---------- */
@media (max-width: 900px) {
  .topbar { height: auto; min-height: 56px; padding: 8px 14px; }
  .brand { font-size: 19px; }
  .content { padding: 18px 16px 100px; }
  .view-head h2 { font-size: 26px; }
  .view-head { margin-bottom: 16px; }
  .stats { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat { padding: 14px 14px 12px; }
  .stat .num { font-size: 28px; }
  .stat .lbl { font-size: 12.5px; margin-top: 6px; }
  .panel { padding: 16px; }
  #bottomNav { background: color-mix(in srgb, var(--panel) 94%, transparent); backdrop-filter: saturate(1.4) blur(12px); padding-top: 6px; }
  .bnav-item { font-size: 11px; font-weight: 500; gap: 3px; }
  .bnav-item.active { color: var(--primary-ink); background: transparent; font-weight: 650; }
  .bnav-item.active .ni { background: color-mix(in srgb, var(--primary) 11%, var(--panel)); border-radius: 999px; padding: 3px 14px; }
  #drawer { border-radius: 16px 0 0 16px; box-shadow: -10px 0 40px rgba(34,27,38,.14); }
  .drawer-item.active { background: color-mix(in srgb, var(--primary) 9%, var(--panel)); color: var(--ink); font-weight: 650; box-shadow: inset 3px 0 0 var(--primary); }
  .drawer-backdrop { background: rgba(34,27,38,.32); }
  #dashRequests { max-height: none; overflow: visible; }
}
@media (max-width: 560px) {
  .content { padding: 16px 12px 100px; }
  .topbar .btn-ghost { padding: 7px 8px; font-size: 13px; }
  .login-card { padding: 28px 22px 22px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* Small labels in sentence case, slightly larger */
.client-visits { font-size: 11.5px; }
.m-daylabel { font-size: 14px; font-weight: 600; color: var(--ink); }
.profile-section > h4, .p-card h5, .feed-label { font-size: 13px; font-weight: 650; color: var(--text-2); }
.client-row, .client-card { border-radius: 12px; }
@media (max-width: 900px) {
  .topbar { flex-wrap: nowrap; }
  .topbar .brand { flex: 1; min-width: 0; }
  #liveBadge { display: none; }
}
input[type="color"].input { display: block; height: 42px; padding: 4px; cursor: pointer; max-width: 120px; margin-top: 6px; }
input[type="color"].input::-webkit-color-swatch-wrapper { padding: 0; }
input[type="color"].input::-webkit-color-swatch { border: none; border-radius: 5px; }

/* =====================================================================
   Salon colour themes. Set on <html data-theme="...">.
   Each theme tints the neutrals and supplies a default brand colour
   (the salon's own Brand colour, if set, still overrides --primary).
   ===================================================================== */
:root { --deep: #1b1020; }
html[data-theme="mulberry"] { --deep: #1b1020; }
html[data-theme="sage"] { --deep: #0e1c13; }
html[data-theme="ocean"] { --deep: #0a1826; }
html[data-theme="rosewood"] { --deep: #2a0e16; }
html[data-theme="honey"] { --deep: #241906; }
html[data-theme="charcoal"] { --deep: #09090b; }
@media (min-width: 980px) { .login-aside { background: color-mix(in srgb, var(--primary) 78%, var(--deep)); } }

/* Theme picker (Settings) */
.theme-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-top: 8px; }
.theme-opt {
  display: flex; flex-direction: column; gap: 10px; padding: 10px; text-align: left;
  border: 1px solid var(--line-strong); border-radius: 12px; background: var(--panel);
  font: inherit; color: var(--ink); cursor: pointer;
}
.theme-opt:hover { border-color: var(--muted); }
.theme-opt.sel { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.theme-swatch { display: flex; height: 44px; border-radius: 8px; overflow: hidden; border: 1px solid rgba(34,27,38,.08); }
.theme-swatch i { display: block; }
.theme-swatch i:nth-child(1) { flex: 2; }
.theme-swatch i:nth-child(2) { flex: 1; }
.theme-swatch i:nth-child(3) { flex: 1; }
.theme-name { font-weight: 650; font-size: 14px; display: flex; align-items: center; justify-content: space-between; }
.theme-name .ic { width: 16px; height: 16px; }
.theme-help { margin-top: 6px; }

/* =====================================================================
   Backgrounds — chosen separately from the colour theme.
   html[data-bg="..."]; dark ones also get data-mode="dark".
   ===================================================================== */
html[data-bg="light"]    { --bg: #f5f4f7; --panel: #ffffff; --panel-2: #faf9fb; --line: #e6e2ea; --line-strong: #d6d0dd; --hover: #f2eff5; }
html[data-bg="blush"]    { --bg: #f6e3e6; --panel: #fdf6f7; --panel-2: #faeef0; --line: #ecd2d7; --line-strong: #dfbcc3; --hover: #f4e4e7; }
html[data-bg="mint"]     { --bg: #dcefe4; --panel: #f4faf6; --panel-2: #eaf5ee; --line: #c8e1d2; --line-strong: #b1d2bf; --hover: #e1efe6; }
html[data-bg="lavender"] { --bg: #e7e2f4; --panel: #f8f6fd; --panel-2: #f0ecf9; --line: #d7cfeb; --line-strong: #c3b8df; --hover: #ebe6f6; }
html[data-bg="sand"]     { --bg: #eee4d3; --panel: #fbf7f0; --panel-2: #f5eee2; --line: #e0d3bb; --line-strong: #d0c0a3; --hover: #f1e8d8; }
html[data-bg="sky"]      { --bg: #dce9f5; --panel: #f5f9fd; --panel-2: #ebf2f9; --line: #c8d9ea; --line-strong: #b2c7dd; --hover: #e3edf7; }
html[data-bg="graphite"] { --bg: #18171b; --panel: #222126; --panel-2: #1d1c21; --line: #33313a; --line-strong: #46434f; --hover: #2b2930; }
html[data-bg="midnight"] { --bg: #0e1525; --panel: #172034; --panel-2: #131b2d; --line: #26324a; --line-strong: #364563; --hover: #1d2840; }
html[data-bg="aubergine"]{ --bg: #1b1120; --panel: #26192c; --panel-2: #211526; --line: #3a2a41; --line-strong: #4d3a55; --hover: #2f2135; }

html[data-mode="dark"] {
  color-scheme: dark;
  --text: #ece8f0; --ink: #f6f3f8; --text-2: #d2cbd9; --muted: #a8a0b1; --faint: #8f8799;
  --ok: #62c795; --warn: #e2a94c; --warn-ink: #ebbd6e; --danger: #f2837a; --info: #61c4d9;
  --primary-ink: color-mix(in srgb, var(--primary) 45%, #fff);
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.3);
}
html[data-mode="dark"] .login-aside { background: color-mix(in srgb, var(--primary) 70%, #000); }
html[data-mode="dark"] .stat.accent .num { color: var(--primary-ink); }
html[data-mode="dark"] .theme-swatch { border-color: rgba(255,255,255,.12); }
html[data-mode="dark"] .theme-opt.sel { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
html[data-mode="dark"] select.input {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23a8a0b1' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
html[data-mode="dark"] input[type="date"].input, html[data-mode="dark"] input[type="time"].input { color-scheme: dark; }
html[data-mode="dark"] ::-webkit-scrollbar-thumb { background: var(--line-strong); }
html[data-mode="dark"] .cal-tip { background: #000; border-color: var(--line-strong); }
html[data-mode="dark"] .pill, html[data-mode="dark"] .badge { filter: brightness(1.25); }
html[data-mode="dark"] .btn-primary { box-shadow: none; }
.bg-swatch { display: flex; align-items: flex-end; justify-content: flex-end; height: 44px; border-radius: 8px; border: 1px solid rgba(34,27,38,.1); padding: 7px; }
.bg-swatch i { display: block; width: 58%; height: 60%; border-radius: 5px; box-shadow: 0 1px 2px rgba(0,0,0,.12); }
html[data-mode="dark"] .bg-swatch { border-color: rgba(255,255,255,.12); }
#bgPicker { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
.google-btn { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 11px; font-size: 14.5px; font-weight: 600; background: var(--panel); border: 1px solid var(--line-strong); color: var(--ink); }
.google-btn:hover { background: var(--hover); }
.google-btn.hidden { display: none !important; }
.login-card .auth-divider { margin: 18px 0 12px; font-size: 12.5px; }
#staffLoginMsg:empty { display: none; }
#staffLoginMsg { margin-top: 10px; }
.staff-email { max-width: 280px; padding: 7px 10px; font-size: 13.5px; }
