/* ==========================================================================
   Bimbly dashboard — same system as bimblyai.com ("The book fills itself").
   Ledger paper, pole-blue ink, pole-red stamps. Every control on every page
   comes from the primitives below: .btn, .field/.input, .card, .switch, .badge.
   ========================================================================== */

:root {
  --paper: #FAFBF9;
  --sheet: #FFFFFF;
  --tint: #F0F3F6;
  --rule: #D3DFEB;
  --rule-soft: #E6EDF4;
  --rule-strong: #A9BED5;
  --ink: #2346C8;
  --ink-deep: #1A36A0;
  --ink-soft: #E6ECFF;
  --stamp: #D7372B;
  --stamp-btn: #C42E21;
  --stamp-soft: #FCEAE8;
  --graphite: #2C2D33;
  --graphite-2: #575963;
  --graphite-3: #7A7C86;
  --night: #141B33;
  --green: #1F7A45;
  --green-soft: #E5F4EB;
  --amber: #8A5A00;
  --amber-soft: #FDF1D8;

  --f-display: 'Schibsted Grotesk', 'Helvetica Neue', Arial, sans-serif;
  --f-body: 'Atkinson Hyperlegible Next', 'Atkinson Hyperlegible', system-ui, -apple-system, sans-serif;
  --f-hand: 'Kalam', 'Bradley Hand', 'Segoe Print', cursive;

  --r-sm: 6px;
  --r-md: 10px;
  --control-h: 42px;
  --control-h-sm: 34px;
  --sidebar-w: 248px;
  --pad: 32px;
  --shadow: 0 1px 0 var(--rule-soft), 0 12px 28px -24px rgba(31, 29, 54, 0.35);
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

/* ── Base ─────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--graphite);
  font-family: var(--f-body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { font-family: var(--f-display); color: var(--graphite); margin: 0; letter-spacing: -0.02em; }
p { margin: 0; }
a { color: var(--ink-deep); text-underline-offset: 0.18em; }
a:hover { color: var(--ink); }
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; border-radius: 4px; }
.muted { color: var(--graphite-2); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.stack { display: flex; flex-direction: column; gap: 20px; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.spacer { flex: 1; }

/* ── App layout ───────────────────────────────────────────────────────────── */
.app-layout { min-height: 100vh; }
.main-area { margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; }

.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: 50;
  display: flex; flex-direction: column;
  background: var(--sheet); border-right: 1px solid var(--rule);
}
.sidebar-logo { padding: 22px 22px 18px; }
.sidebar-logo img { height: 32px; width: auto; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 6px 12px; display: flex; flex-direction: column; gap: 2px; }
.nav-group-label {
  font-family: var(--f-display); font-size: 11px; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--graphite-3); padding: 16px 12px 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 12px; width: 100%;
  min-height: 40px; padding: 0 12px; border: 0; border-radius: var(--r-sm);
  background: transparent; color: var(--graphite-2); text-align: left; cursor: pointer;
  font-family: var(--f-display); font-weight: 600; font-size: 14.5px;
  transition: background-color 120ms, color 120ms;
}
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-item:hover { background: var(--tint); color: var(--graphite); }
.nav-item.active { background: var(--ink-soft); color: var(--ink-deep); box-shadow: inset 3px 0 0 var(--ink); }
.nav-count {
  margin-left: auto; min-width: 22px; height: 20px; padding: 0 6px; border-radius: 10px;
  background: var(--stamp); color: #fff; font-size: 12px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
}
.sidebar-footer { padding: 14px 16px 18px; border-top: 1px solid var(--rule); display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
  display: grid; place-items: center; background: var(--ink); color: #fff;
  font-family: var(--f-display); font-weight: 700; font-size: 14px;
}
.sidebar-biz { min-width: 0; flex: 1; }
.sidebar-biz-name { font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-biz-plan { font-size: 12px; color: var(--graphite-3); }

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  min-height: 72px; padding: 16px var(--pad);
  border-bottom: 1px solid var(--rule); background: var(--paper);
  position: sticky; top: 0; z-index: 20;
}
.topbar-title { font-size: 24px; font-weight: 800; letter-spacing: -0.03em; }
.topbar-date { font-size: 14px; color: var(--graphite-2); }
.topbar .topbar-menu { display: none; }

.page-content { padding: 28px var(--pad) 56px; display: flex; flex-direction: column; gap: 24px; max-width: 1240px; width: 100%; }
.page-narrow { max-width: 880px; }
.page-wide { max-width: 1760px; }

/* ── Buttons (one system) ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: var(--control-h); padding: 0 16px; border-radius: var(--r-sm);
  border: 1.5px solid transparent; background: transparent; cursor: pointer;
  font-family: var(--f-display); font-weight: 700; font-size: 14px; letter-spacing: -0.005em;
  text-decoration: none; white-space: nowrap; line-height: 1;
  transition: background-color 120ms, border-color 120ms, color 120ms, transform 120ms var(--ease);
}
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn--primary { background: var(--ink); color: #fff; }
.btn--primary:hover:not(:disabled) { background: var(--ink-deep); color: #fff; }
.btn--secondary { background: var(--sheet); color: var(--graphite); border-color: var(--rule-strong); }
.btn--secondary:hover:not(:disabled) { border-color: var(--ink); color: var(--ink-deep); background: var(--ink-soft); }
.btn--ghost { color: var(--graphite-2); }
.btn--ghost:hover:not(:disabled) { background: var(--tint); color: var(--graphite); }
.btn--danger { background: var(--stamp-btn); color: #fff; }
.btn--danger:hover:not(:disabled) { background: #A92418; color: #fff; }
.btn--danger-outline { background: var(--sheet); color: var(--stamp-btn); border-color: #E8B4AE; }
.btn--danger-outline:hover:not(:disabled) { background: var(--stamp-soft); border-color: var(--stamp-btn); }
.btn--sm { height: var(--control-h-sm); padding: 0 12px; font-size: 13px; }
.btn--icon { width: var(--control-h); padding: 0; }
.btn--icon.btn--sm { width: var(--control-h-sm); }
.btn--block { width: 100%; }
.btn-link {
  background: none; border: 0; padding: 0; cursor: pointer; color: var(--ink-deep);
  font-weight: 700; text-decoration: underline; text-underline-offset: 0.18em;
}
.btn-link:hover { color: var(--ink); }
.btn-link--muted { color: var(--graphite-2); font-weight: 400; }

/* ── Form fields (one system) ─────────────────────────────────────────────── */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 20px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.form-stack { display: flex; flex-direction: column; gap: 18px; max-width: 440px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-label { font-weight: 700; font-size: 14px; color: var(--graphite); }
.field-label .optional { font-weight: 400; color: var(--graphite-3); }
.field-hint { font-size: 13px; color: var(--graphite-2); }
.field-error { font-size: 13px; color: var(--stamp-btn); font-weight: 700; }

.input, .select, .textarea {
  width: 100%; height: var(--control-h); padding: 0 12px;
  background: #fff; color: var(--graphite);
  border: 1.5px solid var(--rule-strong); border-radius: var(--r-sm);
  font-size: 15px; transition: border-color 120ms, box-shadow 120ms;
}
.textarea { height: auto; min-height: 92px; padding: 10px 12px; resize: vertical; line-height: 1.45; }
.select {
  appearance: none; -webkit-appearance: none; padding-right: 36px; cursor: pointer;
  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='%23575963' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
.input::placeholder, .textarea::placeholder { color: #9A9CA6; }
.input:hover, .select:hover, .textarea:hover { border-color: #8EA6C2; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(35, 70, 200, 0.16); }
.input:disabled, .select:disabled { background: var(--tint); color: var(--graphite-3); cursor: not-allowed; }
.input--sm, .select--sm { height: var(--control-h-sm); font-size: 14px; }
.input--short { max-width: 160px; }
.field.half .input { max-width: calc(50% - 10px); }

.input-group { display: flex; align-items: stretch; }
.input-group .input { border-radius: 0 var(--r-sm) var(--r-sm) 0; }
.input-addon {
  display: flex; align-items: center; padding: 0 12px; white-space: nowrap;
  background: var(--tint); color: var(--graphite-2); font-size: 14px;
  border: 1.5px solid var(--rule-strong); border-right: 0; border-radius: var(--r-sm) 0 0 var(--r-sm);
}
.input-group--suffix .input { border-radius: var(--r-sm) 0 0 var(--r-sm); }
.input-group--suffix .input-addon { border: 1.5px solid var(--rule-strong); border-left: 0; border-radius: 0 var(--r-sm) var(--r-sm) 0; }

/* Switch */
.switch-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.switch-row-text { min-width: 0; }
.switch-row-title { font-weight: 700; }
.switch { position: relative; display: inline-flex; flex-shrink: 0; cursor: pointer; }
.switch input { position: absolute; inset: 0; z-index: 1; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch input:disabled { cursor: not-allowed; }
.switch-track {
  width: 42px; height: 24px; border-radius: 12px; background: #C5CCD6;
  position: relative; transition: background-color 150ms;
}
.switch-track::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,0.25); transition: transform 180ms var(--ease);
}
.switch input:checked + .switch-track { background: var(--ink); }
.switch input:checked + .switch-track::after { transform: translateX(18px); }
.switch input:focus-visible + .switch-track { outline: 3px solid var(--ink); outline-offset: 2px; }
.switch input:disabled + .switch-track { opacity: 0.5; }

/* ── Cards ────────────────────────────────────────────────────────────────── */
.card {
  background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--r-md);
  box-shadow: var(--shadow); min-width: 0;
}
.card-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
  padding: 20px 24px 16px; border-bottom: 1px solid var(--rule-soft);
}
.card-title { font-size: 17px; font-weight: 700; letter-spacing: -0.015em; display: flex; align-items: center; gap: 10px; }
.card-desc { margin-top: 4px; font-size: 14px; color: var(--graphite-2); max-width: 62ch; }
.card-body { padding: 20px 24px; }
.card-body--flush { padding: 0; }
.card-foot {
  display: flex; align-items: center; justify-content: flex-end; gap: 12px; flex-wrap: wrap;
  padding: 14px 24px; border-top: 1px solid var(--rule-soft); background: #FBFCFD;
  border-radius: 0 0 var(--r-md) var(--r-md);
}
.card-foot .status { margin-right: auto; }
.card-section + .card-section { border-top: 1px solid var(--rule-soft); }

.status { font-size: 14px; font-weight: 700; display: inline-flex; align-items: center; gap: 6px; }
.status--success { color: var(--green); }
.status--error { color: var(--stamp-btn); }
.status svg { width: 16px; height: 16px; }

/* Notices */
.notice {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 14px; border-radius: var(--r-sm); font-size: 14px; line-height: 1.45;
  background: var(--ink-soft); border: 1px solid #B9C7F5; color: var(--ink-deep);
}
.notice svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }
.notice--error { background: #FCEDEB; border-color: #E8B4AE; color: #8E2A20; }
.notice--success { background: var(--green-soft); border-color: #A9D8BB; color: #1F5E37; }
.notice--warn { background: var(--amber-soft); border-color: #EBCB8B; color: var(--amber); }
.notice a, .notice .btn-link { color: inherit; }

/* Badges */
.badge {
  display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px;
  border-radius: 12px; font-size: 12.5px; font-weight: 700; white-space: nowrap;
  background: var(--tint); color: var(--graphite-2);
}
.badge--blue { background: var(--ink-soft); color: var(--ink-deep); }
.badge--green { background: var(--green-soft); color: var(--green); }
.badge--amber { background: var(--amber-soft); color: var(--amber); }
.badge--red { background: var(--stamp-soft); color: var(--stamp-btn); }
.badge--outline { background: transparent; border: 1px solid var(--rule-strong); }

/* ── Tabs / segmented filters ─────────────────────────────────────────────── */
.tabs {
  display: flex; gap: 4px; border-bottom: 1px solid var(--rule);
  overflow-x: auto; scrollbar-width: none; margin-bottom: -4px;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  position: relative; flex-shrink: 0; height: 44px; padding: 0 14px;
  border: 0; background: none; cursor: pointer; white-space: nowrap;
  font-family: var(--f-display); font-weight: 600; font-size: 14.5px; color: var(--graphite-2);
}
.tab:hover { color: var(--graphite); }
.tab.active { color: var(--ink-deep); }
.tab.active::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 3px; border-radius: 3px 3px 0 0; background: var(--ink); }

.segmented { display: inline-flex; padding: 3px; gap: 2px; background: var(--tint); border: 1px solid var(--rule); border-radius: 8px; }
.segment {
  height: 34px; padding: 0 14px; border: 0; border-radius: 6px; background: transparent; cursor: pointer;
  font-family: var(--f-display); font-weight: 600; font-size: 13.5px; color: var(--graphite-2); white-space: nowrap;
}
.segment:hover { color: var(--graphite); }
.segment.active { background: var(--sheet); color: var(--ink-deep); box-shadow: 0 1px 2px rgba(20, 27, 51, 0.12); }

.toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.search { position: relative; flex: 1; min-width: 200px; max-width: 360px; }
.search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--graphite-3); pointer-events: none; }
.search .input { padding-left: 36px; }

/* ── Stats ────────────────────────────────────────────────────────────────── */
.stats-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.stat-card { padding: 18px 20px; }
.stat-label { font-size: 13.5px; font-weight: 700; color: var(--graphite-2); display: flex; align-items: center; gap: 8px; }
.stat-label svg { width: 16px; height: 16px; color: var(--ink); }
.stat-value { margin-top: 10px; font-family: var(--f-display); font-size: 32px; font-weight: 800; letter-spacing: -0.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.stat-sub { margin-top: 8px; font-size: 13px; color: var(--graphite-2); }
.trend-up { color: var(--green); font-weight: 700; }
.trend-down { color: var(--stamp-btn); font-weight: 700; }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-home { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 16px; align-items: start; }

/* ── Bar chart ────────────────────────────────────────────────────────────── */
.bar-chart { display: flex; flex-direction: column; gap: 12px; }
.bar-row { display: grid; grid-template-columns: 110px 1fr 32px; align-items: center; gap: 12px; }
.bar-label { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { height: 10px; background: var(--tint); border-radius: 5px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 5px; background: var(--ink); min-width: 3px; transition: width 400ms var(--ease); }
.bar-count { font-size: 14px; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }

/* ── The day book (today's appointments) ──────────────────────────────────── */
.daybook { list-style: none; margin: 0; padding: 0; }
.filter-bar { padding: 14px 16px; display: flex; flex-direction: column; gap: 12px; }
.filter-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.filter-row--sub { padding-top: 12px; border-top: 1px solid var(--rule-soft); }
.filter-group { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.filter-end { margin-left: auto; }
.filter-bar .segment svg { width: 15px; height: 15px; margin-right: 6px; flex: none; }
.filter-bar .search { max-width: 420px; }
.menu-btn svg { width: 15px; height: 15px; margin-left: 4px; }
.menu {
  position: fixed; z-index: 1000; min-width: 220px; padding: 6px; background: var(--sheet);
  border: 1px solid var(--rule); border-radius: var(--r-md); box-shadow: 0 12px 32px rgba(20, 27, 51, 0.16);
}
.menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 38px; padding: 8px 12px; border: 0; border-radius: var(--r-sm);
  background: none; color: var(--graphite); font: inherit; font-size: 14.5px; text-align: left; cursor: pointer;
}
.menu-item svg { width: 16px; height: 16px; flex: none; color: var(--graphite-2); }
.menu-item:hover, .menu-item:focus-visible { background: var(--tint); outline: none; }
.menu-item:focus-visible { box-shadow: inset 0 0 0 2px var(--ink); }
.menu-item--danger, .menu-item--danger svg { color: var(--stamp); }
.menu-divider { height: 1px; margin: 6px 4px; background: var(--rule-soft); }
.data-table .col-actions { width: 1%; }
.booking-actions { display: inline-flex; gap: 4px; justify-content: flex-end; flex-wrap: nowrap; }
.team-board { display: grid; grid-template-columns: repeat(auto-fill, minmax(440px, 1fr)); gap: 16px; align-items: start; }
.team-list { list-style: none; margin: 0; padding: 0; }
.team-row {
  display: grid; grid-template-columns: 104px minmax(0, 1fr) auto; align-items: center; gap: 14px;
  padding: 12px 16px 12px 20px; border-bottom: 1px solid var(--rule-soft);
}
.team-row:last-child { border-bottom: 0; }
.team-row-when { display: flex; flex-direction: column; gap: 2px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.team-row-day { font-size: 13px; color: var(--graphite-2); }
.team-row-time { font-family: var(--f-display); font-weight: 700; font-size: 15px; color: var(--graphite); }
.team-row-body { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.team-row-top { display: flex; align-items: center; gap: 8px; min-width: 0; }
.team-row-name { font-weight: 700; color: var(--graphite); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.team-row-top .badge { flex: none; }
.team-row-service { font-size: 14px; color: var(--graphite-2); line-height: 1.35; }
li.team-row.is-cancelled > :not(.team-row-actions) { opacity: 0.55; }
li.team-row.is-cancelled .team-row-name { text-decoration: line-through; }
.status-stack { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.status-by { font-size: 12.5px; color: var(--graphite-2); white-space: nowrap; }
.data-table .col-service { min-width: 180px; max-width: 280px; }
.booking-cards { display: none; list-style: none; margin: 0; padding: 0; }
.booking-card { padding: 14px 16px; border-bottom: 1px solid var(--rule-soft); display: flex; flex-direction: column; gap: 4px; }
.booking-card:last-child { border-bottom: 0; }
.booking-card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.booking-card-when { font-weight: 700; color: var(--graphite); font-variant-numeric: tabular-nums; }
.booking-card-name { font-size: 16px; text-align: left; }
.booking-card-meta { font-size: 14px; color: var(--graphite-2); }
.booking-card-foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.booking-card-actions { margin-left: auto; }
li.booking-card.is-cancelled > :not(.booking-card-foot) { opacity: 0.55; }
.filter-bar .segment { display: inline-flex; align-items: center; }
tr.is-cancelled > td:not(.col-actions), li.daybook-row.is-cancelled > :not(.daybook-aside) { opacity: 0.55; }
.is-cancelled .cell-name, .is-cancelled .daybook-name, .is-cancelled .recent-name { text-decoration: line-through; }
.select--sm { height: var(--control-h-sm); width: auto; min-width: 200px; }
.date-nav { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.input--date { width: auto; min-width: 150px; height: var(--control-h-sm); padding-top: 0; padding-bottom: 0; }
.recent-list .daybook-row { min-height: 56px; }
.recent-when { display: flex; flex-direction: column; justify-content: center; line-height: 1.25; }
.recent-time { font-size: 13px; font-weight: 400; color: var(--graphite-2); }
.recent-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.daybook-row { display: grid; grid-template-columns: 104px 1fr auto; align-items: center; min-height: 60px; border-bottom: 1px solid var(--rule); }
.daybook-row:last-child { border-bottom: 0; }
.daybook-time {
  align-self: stretch; display: flex; align-items: center; padding-left: 24px;
  font-family: var(--f-display); font-weight: 700; font-size: 14px; color: var(--graphite-2);
  font-variant-numeric: tabular-nums; white-space: nowrap; border-right: 1.5px solid color-mix(in srgb, var(--stamp) 45%, transparent);
}
.daybook-body { padding: 10px 16px; min-width: 0; }
.daybook-name { font-family: var(--f-hand); font-size: 19px; line-height: 1.2; color: #3F4049; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.daybook-meta { font-size: 13px; color: var(--graphite-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.daybook-aside { padding-right: 20px; }

/* ── Tables ───────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  padding: 11px 16px; text-align: left; white-space: nowrap;
  font-family: var(--f-display); font-size: 12px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase;
  color: var(--graphite-2); background: #FBFCFD; border-bottom: 1px solid var(--rule);
}
.data-table td { padding: 13px 16px; font-size: 14.5px; vertical-align: middle; border-bottom: 1px solid var(--rule-soft); }
.data-table th:first-child, .data-table td:first-child { padding-left: 24px; }
.data-table th:last-child, .data-table td:last-child { padding-right: 24px; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover td { background: #FAFBFD; }
.data-table tr.is-clickable { cursor: pointer; }
.data-table .col-actions { text-align: right; white-space: nowrap; }
.data-table .col-num { text-align: right; font-variant-numeric: tabular-nums; }
.cell-name { font-weight: 700; color: var(--graphite); }
.cell-sub { font-size: 13px; color: var(--graphite-2); margin-top: 2px; }
.cell-clip { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link-name { background: none; border: 0; padding: 0; cursor: pointer; font-weight: 700; color: var(--ink-deep); text-align: left; }
.link-name:hover { text-decoration: underline; text-underline-offset: 0.18em; }
.table-actions { display: inline-flex; gap: 6px; justify-content: flex-end; }
.table-foot { padding: 12px 24px; font-size: 13px; color: var(--graphite-2); border-top: 1px solid var(--rule-soft); }

/* ── Settings: list rows (services, team, hours) ──────────────────────────── */
.list-rows { display: flex; flex-direction: column; }
.list-row {
  display: grid; align-items: center; gap: 12px; padding: 12px 24px;
  border-bottom: 1px solid var(--rule-soft);
}
.list-row:last-child { border-bottom: 0; }
.list-head {
  padding-top: 10px; padding-bottom: 10px; background: #FBFCFD;
  font-family: var(--f-display); font-size: 12px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--graphite-2);
}
.list-row--add { background: #FBFCFD; border-top: 1px solid var(--rule-soft); }

.svc-grid { grid-template-columns: minmax(0, 1fr) 120px 140px 92px; }
.svc-cats { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.svc-cats .field { margin: 0; }
.svc-staff { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 8px; }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  min-height: var(--control-h-sm); padding: 0 14px; border-radius: 999px; border: 1px solid var(--rule);
  background: var(--sheet); color: var(--graphite); font: inherit; font-size: 14px; cursor: pointer;
}
.chip:hover { border-color: var(--rule-strong); }
.chip:focus-visible { outline: 3px solid var(--ink-soft); outline-offset: 2px; border-color: var(--ink); }
.chip--on { background: var(--ink-soft); border-color: var(--ink); color: var(--ink-deep); font-weight: 700; }
.svc-group { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding-top: 14px; padding-bottom: 8px; background: var(--tint); }
.svc-group-name { font-family: var(--f-display); font-size: 15px; font-weight: 700; color: var(--graphite); }
.svc-group-count { font-size: 13px; color: var(--graphite-2); }
.team-grid { grid-template-columns: minmax(0, 1fr) 180px minmax(0, 1.1fr) 92px; }
.hours-grid-row { grid-template-columns: 130px 64px minmax(0, 1fr); min-height: 62px; }
.hours-times { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.hours-times .input { width: 140px; }
.hours-closed { color: var(--graphite-3); font-style: italic; }
.day-name { font-weight: 700; }
.list-actions { display: flex; justify-content: flex-end; gap: 6px; }
.team-add-name { grid-column: 1 / 3; }
.list-empty { padding: 28px 24px; text-align: center; color: var(--graphite-2); }

/* Booking link box */
.link-box {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 10px 10px 14px; border: 1.5px dashed var(--rule-strong); border-radius: var(--r-sm); background: var(--paper);
}
.link-box-url { flex: 1; min-width: 0; font-family: var(--f-display); font-weight: 600; color: var(--ink-deep); word-break: break-all; }

.logo-row { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.logo-preview {
  width: 160px; height: 96px; border: 1px solid var(--rule); border-radius: var(--r-sm); background: var(--paper);
  display: grid; place-items: center; overflow: hidden; color: var(--graphite-3); font-size: 13px;
}
.logo-preview img { max-width: 100%; max-height: 100%; object-fit: contain; padding: 8px; }
.qr-row { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }
.qr-img { width: 168px; height: 168px; border: 1px solid var(--rule); border-radius: var(--r-sm); background: #fff; padding: 8px; }

/* ── Calendar (week view, blocked time) ───────────────────────────────────── */
.week-label { padding: 12px 24px 0; font-family: var(--f-display); font-weight: 700; color: var(--graphite-2); font-size: 14px; }
.week-scroll { overflow-x: auto; padding: 8px 16px 0 0; }
.week-grid {
  display: grid; grid-template-columns: 60px repeat(7, minmax(92px, 1fr));
  grid-template-rows: auto var(--week-h); min-width: 720px;
}
.week-corner { border-bottom: 1px solid var(--rule); }
.week-dayhead { display: flex; flex-direction: column; align-items: center; padding: 6px 0 8px; border-bottom: 1px solid var(--rule); font-size: 12.5px; color: var(--graphite-2); }
.week-dayhead strong { font-family: var(--f-display); font-size: 18px; color: var(--graphite); width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%; }
.week-dayhead.is-today strong { background: var(--ink); color: #fff; }
.week-times { position: relative; }
.week-time { position: absolute; right: 8px; transform: translateY(-50%); font-size: 11.5px; color: var(--graphite-3); white-space: nowrap; }
.week-time:first-child { transform: none; }
.week-day { position: relative; border-left: 1px solid var(--rule-soft); cursor: copy; }
.week-day:hover { background: #FAFBFD; }
.week-line { position: absolute; left: 0; right: 0; border-top: 1px solid var(--rule-soft); }
.week-off, .week-day.is-closed { background: repeating-linear-gradient(135deg, var(--tint), var(--tint) 6px, #E9EDF2 6px, #E9EDF2 12px); }
.week-off { position: absolute; left: 0; right: 0; }
.week-closed { position: absolute; top: 12px; left: 0; right: 0; text-align: center; font-size: 12.5px; font-weight: 700; color: var(--graphite-3); }
.week-item {
  position: absolute; overflow: hidden; text-align: left; border: 0; border-radius: 5px; padding: 3px 6px;
  font-size: 12px; line-height: 1.25; cursor: default; display: flex; flex-direction: column; z-index: 1;
}
.week-item-title { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.week-item-sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: 0.85; }
.week-item.is-short { flex-direction: row; gap: 4px; align-items: center; padding-top: 1px; padding-bottom: 1px; }
.week-item.is-short .week-item-sub::before { content: '· '; }
.week-item.is-short .week-item-title { flex-shrink: 0; max-width: 100%; }
.week-item.is-short .week-item-sub { min-width: 0; }
.week-item--booking { background: var(--ink-soft); color: var(--ink-deep); box-shadow: inset 3px 0 0 var(--ink); }
.week-item--block { background: var(--stamp-soft); color: #8E2A20; box-shadow: inset 3px 0 0 var(--stamp); cursor: pointer; }
.week-item--block:hover { background: #F8DAD6; }
.week-item--busy { background: #ECEEF2; color: var(--graphite-2); box-shadow: inset 3px 0 0 #9CA3AF; }
.week-legend { display: flex; flex-wrap: wrap; gap: 8px 18px; padding: 14px 24px 18px; font-size: 13px; color: var(--graphite-2); }
.week-legend span { display: inline-flex; align-items: center; gap: 6px; }
.lg { width: 14px; height: 14px; border-radius: 3px; display: inline-block; }
.lg--booking { background: var(--ink-soft); box-shadow: inset 3px 0 0 var(--ink); }
.lg--block { background: var(--stamp-soft); box-shadow: inset 3px 0 0 var(--stamp); }
.lg--busy { background: #ECEEF2; box-shadow: inset 3px 0 0 #9CA3AF; }
.lg--off { background: repeating-linear-gradient(135deg, var(--tint), var(--tint) 3px, #E1E6EC 3px, #E1E6EC 6px); }
.block-row { grid-template-columns: minmax(0, 1fr) auto 70px 92px; }
.day-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.day-chip {
  height: 36px; min-width: 50px; padding: 0 10px; border-radius: 18px; cursor: pointer;
  border: 1.5px solid var(--rule-strong); background: #fff; font-family: var(--f-display); font-weight: 700; font-size: 13.5px; color: var(--graphite-2);
}
.day-chip.active { background: var(--ink); border-color: var(--ink); color: #fff; }
.modal .block-form .segmented { align-self: flex-start; }
.modal { max-height: calc(100vh - 32px); overflow-y: auto; }
.modal:has(.block-form) { max-width: 520px; }

/* ── Client profile ───────────────────────────────────────────────────────── */
.back-link { display: inline-flex; align-items: center; gap: 6px; align-self: flex-start; }
.profile-head { display: flex; align-items: flex-start; gap: 16px; }
.profile-head .avatar { width: 52px; height: 52px; font-size: 20px; }
.profile-name { font-size: 24px; font-weight: 800; letter-spacing: -0.03em; }
.tag-list { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.mini-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.mini-stat { padding: 14px 16px; border: 1px solid var(--rule-soft); border-radius: var(--r-sm); background: var(--paper); }
.mini-stat-label { font-size: 12.5px; font-weight: 700; color: var(--graphite-2); }
.mini-stat-value { margin-top: 4px; font-family: var(--f-display); font-weight: 700; font-size: 18px; }
.note-box { padding: 12px 14px; border-left: 3px solid var(--ink); background: var(--paper); border-radius: 0 var(--r-sm) var(--r-sm) 0; white-space: pre-wrap; }

/* ── Billing ──────────────────────────────────────────────────────────────── */
.plan-price { font-family: var(--f-display); font-weight: 800; font-size: 34px; letter-spacing: -0.03em; line-height: 1; }
.plan-price span { font-size: 15px; font-weight: 600; color: var(--graphite-2); letter-spacing: 0; }
.plan-name { font-size: 20px; font-weight: 800; letter-spacing: -0.02em; }
.check-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.check-list li { display: flex; gap: 10px; align-items: flex-start; }
.check-list svg { width: 18px; height: 18px; color: var(--green); flex-shrink: 0; margin-top: 2px; }
.plans-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; align-items: stretch; }
.plan-card .card-body { height: 100%; display: flex; flex-direction: column; gap: 18px; }
.plan-card .check-list { flex: 1; font-size: 14.5px; }
.plan-card--current { border-color: var(--ink); box-shadow: inset 0 3px 0 var(--ink), var(--shadow); }
.check-list--2col { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 24px; }
.card--upgrade { background: linear-gradient(180deg, var(--ink-soft), var(--sheet) 70%); border-color: #B9C7F5; }
.billing-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: stretch; }
.billing-grid .card { display: flex; flex-direction: column; }
.billing-grid .card-body { flex: 1; display: flex; flex-direction: column; gap: 18px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; font-size: 14px; }
.kv dt { color: var(--graphite-2); }
.kv dd { margin: 0; font-weight: 700; }

/* ── Empty / loading / error ──────────────────────────────────────────────── */
.empty-state { text-align: center; padding: 48px 24px; }
.empty-icon { width: 48px; height: 48px; margin: 0 auto 14px; border-radius: 50%; display: grid; place-items: center; background: var(--ink-soft); color: var(--ink); }
.empty-icon svg { width: 22px; height: 22px; }
.empty-title { font-family: var(--f-display); font-weight: 700; font-size: 17px; }
.empty-sub { margin-top: 4px; color: var(--graphite-2); font-size: 14px; max-width: 46ch; margin-left: auto; margin-right: auto; }
.empty-state .btn { margin-top: 16px; }
.empty-inline { color: var(--graphite-2); font-size: 14px; }

.spinner-wrap { display: flex; justify-content: center; padding: 72px 24px; }
.spinner { width: 32px; height: 32px; border: 3px solid var(--rule); border-top-color: var(--ink); border-radius: 50%; animation: spin 0.75s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-screen { display: grid; place-items: center; min-height: 100vh; }

/* ── Modal ────────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center;
  padding: 16px; background: rgba(20, 27, 51, 0.45); animation: fadeIn 120ms ease;
}
.modal {
  width: 100%; max-width: 440px; background: var(--sheet); border-radius: var(--r-md);
  box-shadow: 0 24px 60px rgba(20, 27, 51, 0.3); animation: rise 180ms var(--ease);
}
.modal-body { padding: 24px 24px 8px; }
.modal-title { font-size: 19px; font-weight: 800; letter-spacing: -0.02em; margin-bottom: 8px; }
.modal-text { color: var(--graphite-2); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; padding: 20px 24px 24px; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ── Toasts ───────────────────────────────────────────────────────────────── */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 1100; display: flex; flex-direction: column; gap: 8px; max-width: calc(100vw - 40px); }
.toast {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: var(--r-sm);
  background: var(--night); color: #fff; font-weight: 700; font-size: 14px;
  box-shadow: 0 12px 30px rgba(20, 27, 51, 0.3); animation: rise 180ms var(--ease);
}
.toast svg { width: 18px; height: 18px; flex-shrink: 0; }
.toast--success svg { color: #7BD69C; }
.toast--error { background: #8E2A20; }

/* ── Onboarding ───────────────────────────────────────────────────────────── */
.onboarding-wrap { display: flex; justify-content: center; padding: 40px 16px 64px; }
.onboarding-card { width: 100%; max-width: 600px; }
.onboarding-card .card-body { padding: 32px; }
.steps { display: flex; align-items: center; gap: 8px; margin-bottom: 28px; }
.step { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; color: var(--graphite-3); }
.step-dot { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--tint); color: var(--graphite-2); font-family: var(--f-display); font-size: 13px; font-weight: 700; }
.step-dot svg { width: 14px; height: 14px; }
.step.active { color: var(--ink-deep); }
.step.active .step-dot { background: var(--ink); color: #fff; box-shadow: 0 0 0 4px var(--ink-soft); }
.step.done .step-dot { background: var(--green); color: #fff; }
.step-line { flex: 1; height: 2px; background: var(--rule); min-width: 12px; }
.step-title { font-size: 26px; font-weight: 800; letter-spacing: -0.03em; }
.step-sub { margin: 8px 0 24px; color: var(--graphite-2); }
.svc-edit-row { display: grid; grid-template-columns: minmax(0, 1fr) 110px 120px var(--control-h); gap: 8px; align-items: center; }
.svc-edit-head { font-size: 13px; font-weight: 700; color: var(--graphite-2); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 6px 0 14px; border-radius: 17px; background: var(--ink-soft); color: var(--ink-deep); font-weight: 700; font-size: 14px; }
.chip--fixed { padding-right: 14px; }
.chip-remove { width: 24px; height: 24px; border: 0; border-radius: 50%; background: transparent; color: var(--ink-deep); cursor: pointer; display: grid; place-items: center; }
.chip-remove:hover { background: rgba(35, 70, 200, 0.12); }
.chip-remove svg { width: 14px; height: 14px; }
.forward-box { padding: 22px; border-radius: var(--r-md); background: var(--night); color: #fff; text-align: center; }
.forward-label { font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; opacity: 0.7; }
.forward-number { margin-top: 6px; font-family: var(--f-display); font-size: 30px; font-weight: 800; letter-spacing: 0.01em; font-variant-numeric: tabular-nums; }
.instructions { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.instructions h3 { font-size: 15px; margin-bottom: 6px; }
.instructions ol { margin: 0; padding-left: 20px; color: var(--graphite-2); font-size: 14px; }
.instructions li + li { margin-top: 4px; }
.step-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--rule-soft); }
.step-actions .btn--ghost { margin-right: auto; }

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .stats-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-home { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .plans-grid { grid-template-columns: 1fr; }
  .team-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .team-grid .team-cal { grid-column: 1 / 2; }
  .team-grid .list-actions { grid-column: 2 / 3; }
  .team-grid.list-head { display: none; }
}
@media (max-width: 768px) {
  :root { --pad: 16px; }
  .main-area { margin-left: 0; }
  .sidebar { transform: translateX(-100%); transition: transform 220ms var(--ease); box-shadow: none; }
  .sidebar.open { transform: none; box-shadow: 0 0 40px rgba(20, 27, 51, 0.25); }
  .sidebar-scrim { position: fixed; inset: 0; z-index: 45; background: rgba(20, 27, 51, 0.4); animation: fadeIn 150ms ease; }
  .field.half .input { max-width: none; }
  .topbar { min-height: 60px; padding: 10px var(--pad); justify-content: flex-start; }
  .topbar .topbar-menu { display: inline-flex; margin-left: -8px; }
  .card-head { flex-direction: column; align-items: stretch; }
  .card-head > .row { align-self: flex-start; }
  .topbar-title { font-size: 20px; }
  .topbar-date { display: none; }
  .page-content { padding-top: 20px; gap: 20px; }
  .form-grid, .grid-2, .billing-grid, .instructions, .plans-grid, .check-list--2col { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: auto; }
  .stat-value { font-size: 26px; }
  .data-table { min-width: 640px; }
  .card-head, .card-body, .card-foot { padding-left: 16px; padding-right: 16px; }
  .list-row { padding-left: 16px; padding-right: 16px; }
  .data-table th:first-child, .data-table td:first-child { padding-left: 16px; }
  .data-table th:last-child, .data-table td:last-child { padding-right: 16px; }
  .svc-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .svc-grid .svc-name { grid-column: 1 / -1; }
  .svc-grid.list-head { display: none; }
  .svc-cats { grid-template-columns: 1fr; }
  .team-grid { grid-template-columns: 1fr; }
  .team-grid .team-cal, .team-grid .list-actions, .team-add-name { grid-column: auto; }
  .list-actions { justify-content: flex-start; }
  .hours-grid-row { grid-template-columns: 1fr auto; row-gap: 8px; }
  .block-row { grid-template-columns: minmax(0, 1fr) auto; row-gap: 8px; }
  .block-row > span:nth-of-type(2):empty { display: none; }
  .week-label, .week-legend { padding-left: 16px; padding-right: 16px; }
  .hours-grid-row .hours-times { grid-column: 1 / -1; }
  .hours-times .input { width: auto; flex: 1; min-width: 0; }
  .mini-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .daybook-row { grid-template-columns: 92px 1fr; }
  .daybook-time { padding-left: 16px; }
  .daybook-aside { display: none; }
  .onboarding-card .card-body { padding: 24px 18px; }
  .svc-edit-row { grid-template-columns: minmax(0, 1fr) 84px var(--control-h); }
  .svc-edit-row .svc-dur { display: none; }
  .step-label { display: none; }
  .bar-row { grid-template-columns: 90px 1fr 28px; }
  .toolbar .segmented { width: 100%; overflow-x: auto; }
  .search { max-width: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; transition-duration: 1ms !important; }
}

/* Team view on phones: keep the booking buttons, on their own line */
@media (max-width: 768px) {
}

@media (max-width: 768px) {
  .filter-group { min-width: 0; width: 100%; }
  .filter-bar .segmented { flex-wrap: wrap; max-width: 100%; }
  .filter-end { margin-left: 0; }
  .filter-bar .search { max-width: none; flex-basis: 100%; }
}

/* Phones: bookings as cards instead of a wide table */
@media (max-width: 768px) {
  .table-wrap--bookings .data-table { display: none; }
  .booking-cards { display: block; }
  .team-board { grid-template-columns: 1fr; }
  .team-row { grid-template-columns: 84px minmax(0, 1fr); padding-left: 16px; }
  .team-row-actions { grid-column: 2; }
}
