/* The Quiet Chair — styles. Mobile first. */

/* ---------- Themes ---------- */
/* Each theme: --accent (light-mode accent, ≥4.5:1 on white), --accent-d (dark-mode accent),
   --g1/--g2 (light gradient), --soft (tinted surface). */
:root, [data-theme="blush"]   { --accent:#A3506A; --accent-d:#EBA7B8; --g1:#FCF1F0; --g2:#F6E3DC; --soft:#F8E1E5; }
[data-theme="champagne"]      { --accent:#856536; --accent-d:#E3C690; --g1:#FCF7EE; --g2:#F3E8D4; --soft:#F1E6CF; }
[data-theme="sage"]           { --accent:#4A6650; --accent-d:#AACAB0; --g1:#F3F6F0; --g2:#E4ECE1; --soft:#DFE8DB; }
[data-theme="lavender"]       { --accent:#665597; --accent-d:#C3B6EC; --g1:#F6F3FB; --g2:#EAE4F5; --soft:#E5DEF3; }
[data-theme="plum"]           { --accent:#76375E; --accent-d:#E2A6C9; --g1:#F9F0F4; --g2:#EFDFE8; --soft:#EDD6E3; }
[data-theme="ivory"]          { --accent:#2A2A31; --accent-d:#EFE8D8; --g1:#FCFAF5; --g2:#F2EEE3; --soft:#ECE7DB; }
[data-theme="emerald"]        { --accent:#1C6852; --accent-d:#8AD3B9; --g1:#F0F7F3; --g2:#DFEFE7; --soft:#D6ECE2; }
[data-theme="terracotta"]     { --accent:#9A4A31; --accent-d:#EDAA92; --g1:#FCF2EC; --g2:#F4E2D7; --soft:#F2DACE; }
[data-theme="espresso"]       { --accent:#664636; --accent-d:#DCBCA7; --g1:#F8F3EE; --g2:#EDE3DA; --soft:#E8DACF; }

:root {
  --font-serif: 'Cormorant Garamond', 'Cormorant', 'Times New Roman', Georgia, serif;
  --font-sans: 'DM Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --radius: 22px; --radius-md: 16px; --radius-sm: 12px;
  --tap: 48px;
  --sidebar: 260px;
  color-scheme: light;
  --bg: #FFFCFB; --surface: #FFFFFF; --ink: #2A2126; --muted: #6B5D65;
  --line: color-mix(in srgb, var(--accent) 12%, #ECE4E4);
  --a: var(--accent); --a-ink: #FFFFFF;
  --a-soft: var(--soft);
  --surface-2: color-mix(in srgb, var(--soft) 40%, #FFFFFF);
  --grad: linear-gradient(165deg, var(--g1) 0%, var(--g2) 100%);
  --hero: linear-gradient(140deg, color-mix(in srgb, var(--soft) 90%, #fff), color-mix(in srgb, var(--g2) 80%, #fff));
  --shadow: 0 1px 2px rgba(70, 40, 50, .05), 0 10px 30px -12px rgba(70, 40, 50, .14);
  --shadow-lg: 0 24px 60px -20px rgba(50, 25, 35, .35);
  --danger: #A23838; --danger-soft: #FBE4E2;
  --warn: #855400; --warn-soft: #FBEFD6;
  --ok: #2B6646; --ok-soft: #DFF1E6;
  --focus: 0 0 0 3px var(--bg), 0 0 0 5px var(--a);
}
:root[data-mode="dark"] {
  color-scheme: dark;
  --bg: #161317; --surface: #201C22; --ink: #F5EEF1; --muted: #BBAFB6;
  --line: #3A333E;
  --a: var(--accent-d); --a-ink: #1B1519;
  --a-soft: color-mix(in srgb, var(--accent-d) 16%, #201C22);
  --surface-2: #29242C;
  --grad: linear-gradient(165deg, color-mix(in srgb, var(--accent-d) 9%, #161317) 0%, #161317 70%);
  --hero: linear-gradient(140deg, color-mix(in srgb, var(--accent-d) 20%, #201C22), #241F27);
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 30px -12px rgba(0, 0, 0, .6);
  --danger: #F2A1A1; --danger-soft: #3D2224;
  --warn: #EBC27E; --warn-soft: #3A2E1B;
  --ok: #92D6B0; --ok-soft: #1E3328;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font-sans); font-size: 16px; line-height: 1.5; color: var(--ink);
  background: var(--bg); min-height: 100vh; min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}
body::before { content: ""; position: fixed; inset: 0; z-index: -1; background: var(--grad); pointer-events: none; }
h1, h2, h3 { font-family: var(--font-serif); font-weight: 600; line-height: 1.1; margin: 0; letter-spacing: .005em; }
h1 { font-size: clamp(2rem, 6vw, 2.75rem); }
h2 { font-size: 1.55rem; }
h3 { font-size: 1.25rem; }
p { margin: 0; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus { outline: none; }
:focus-visible { box-shadow: var(--focus); border-radius: 10px; }
[hidden] { display: none !important; }
.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; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 100; background: var(--a); color: var(--a-ink); padding: 12px 18px; border-radius: 12px; text-decoration: none; font-weight: 600; }
.skip:focus { top: 12px; }
svg.i { width: 22px; height: 22px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
svg.i.sm { width: 18px; height: 18px; }
.muted { color: var(--muted); }
.serif { font-family: var(--font-serif); }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }

/* ---------- App shell ---------- */
.app { display: flex; min-height: 100vh; min-height: 100dvh; }
.sidebar { display: none; }
.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 25;
  display: flex; align-items: center; gap: 10px;
  padding: calc(env(safe-area-inset-top) + 10px) max(16px, env(safe-area-inset-right)) 10px max(16px, env(safe-area-inset-left));
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(14px); backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 60%, transparent);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; min-width: 0; }
.brand-mark { width: 36px; height: 36px; border-radius: 12px; background: var(--a); color: var(--a-ink); display: grid; place-items: center; font-family: var(--font-serif); font-size: 1.35rem; font-weight: 600; flex: none; }
.brand-name { font-family: var(--font-serif); font-size: 1.3rem; font-weight: 600; white-space: nowrap; }
.brand-tag { font-size: .78rem; color: var(--muted); }
.topbar .spacer { flex: 1; }

.icon-btn {
  min-width: var(--tap); height: var(--tap); border-radius: 14px; border: 1px solid var(--line);
  background: var(--surface); display: inline-grid; place-items: center; color: var(--ink);
}
.icon-btn:hover { background: var(--surface-2); }

/* search */
.search { position: relative; flex: 1; max-width: 560px; display: none; }
.search.open { display: block; position: absolute; left: 12px; right: 12px; top: calc(env(safe-area-inset-top) + 8px); max-width: none; z-index: 5; }
.search input {
  width: 100%; height: 50px; border-radius: 16px; border: 1px solid var(--line); background: var(--surface);
  padding: 0 44px 0 46px; font-size: 1rem; box-shadow: var(--shadow);
}
.search input::placeholder { color: var(--muted); }
.search input:focus-visible { box-shadow: var(--focus); }
.search .s-icon { position: absolute; left: 14px; top: 14px; color: var(--muted); pointer-events: none; }
.search .s-close { position: absolute; right: 4px; top: 4px; height: 42px; min-width: 42px; border: 0; background: transparent; border-radius: 12px; color: var(--muted); }
.results {
  position: absolute; left: 0; right: 0; top: 56px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 18px; box-shadow: var(--shadow-lg); padding: 8px; max-height: 60vh; overflow: auto; list-style: none; margin: 0;
}
.results[hidden] { display: none; }
.results .grp { font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: 10px 12px 4px; }
.results [role="option"] { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; min-height: 52px; cursor: pointer; }
.results [role="option"][aria-selected="true"], .results [role="option"]:hover { background: var(--a-soft); }
.results .empty { padding: 16px 12px; color: var(--muted); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap); padding: 0 18px; border-radius: 14px; border: 1px solid var(--line);
  background: var(--surface); font-weight: 500; text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--a); color: var(--a-ink); border-color: transparent; font-weight: 600; }
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--a-soft); }
.btn.sm { min-height: 40px; padding: 0 14px; border-radius: 12px; font-size: .92rem; }
.btn.block { width: 100%; }
.btn-new { display: none; }

main#main { flex: 1; width: 100%; max-width: 1280px; margin: 0 auto; padding: 18px max(16px, env(safe-area-inset-right)) calc(150px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); }
main#main:focus { box-shadow: none; }

/* bottom tab bar */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar a, .tabbar button {
  min-height: 64px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font-size: .75rem; font-weight: 500; text-decoration: none; color: var(--muted); background: none; border: 0;
}
.tabbar [aria-current="page"] { color: var(--a); }
.tabbar [aria-current="page"] svg { stroke-width: 2.1; }
.fab {
  position: fixed; right: max(16px, env(safe-area-inset-right)); bottom: calc(78px + env(safe-area-inset-bottom)); z-index: 31;
  height: 58px; padding: 0 22px 0 18px; border-radius: 29px; border: 0; background: var(--a); color: var(--a-ink);
  font-weight: 600; display: inline-flex; align-items: center; gap: 8px; box-shadow: var(--shadow-lg);
}

/* sidebar (desktop) */
@media (min-width: 960px) {
  .sidebar {
    display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; height: 100dvh; width: var(--sidebar); flex: none;
    padding: 22px 16px; border-right: 1px solid var(--line); background: color-mix(in srgb, var(--surface) 70%, transparent); overflow-y: auto;
  }
  .sidebar .brand { padding: 4px 8px 22px; }
  .nav-group { margin-bottom: 18px; }
  .nav-group h2 { font-family: var(--font-sans); font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); padding: 0 12px 6px; }
  .nav-group a {
    display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 12px; border-radius: 12px;
    text-decoration: none; color: var(--ink); font-weight: 500;
  }
  .nav-group a:hover { background: var(--a-soft); }
  .nav-group a[aria-current="page"] { background: var(--a); color: var(--a-ink); }
  .nav-group a .lock { margin-left: auto; opacity: .6; }
  .sidebar-foot { margin-top: auto; padding: 14px 12px 4px; font-size: .82rem; color: var(--muted); }
  .tabbar, .fab, .topbar .brand, .search-toggle { display: none !important; }
  .search { display: block; }
  .btn-new { display: inline-flex; }
  .topbar { padding: 14px 28px; }
  main#main { padding: 26px 28px 60px; }
}

/* ---------- Cards & primitives ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.card.pad-lg { padding: 22px; }
.card h2 { font-size: 1.4rem; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.eyebrow { font-size: .74rem; font-weight: 600; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.big { font-family: var(--font-serif); font-size: 2.3rem; font-weight: 600; line-height: 1; }
.say { color: var(--muted); font-size: .93rem; margin-top: 6px; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: .78rem; font-weight: 600; background: var(--a-soft); color: var(--ink); white-space: nowrap; }
.pill.danger { background: var(--danger-soft); color: var(--danger); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.quiet { background: var(--surface-2); color: var(--muted); }
.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; display: inline-block; }
.stack { display: grid; gap: 16px; }
.section-gap { margin-top: 22px; }

/* ---------- Today ---------- */
.greet { display: flex; flex-direction: column; gap: 8px; margin: 4px 0 18px; }
.greet .date { font-size: .82rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.greet .summary { font-size: 1.06rem; color: var(--muted); max-width: 60ch; }

.quick { display: flex; gap: 10px; overflow-x: auto; padding: 2px 2px 8px; margin: 0 -16px 14px; padding-left: 16px; padding-right: 16px; scroll-snap-type: x proximity; scrollbar-width: none; }
.quick::-webkit-scrollbar { display: none; }
.quick button {
  flex: none; scroll-snap-align: start; display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between; gap: 10px;
  width: 128px; min-height: 92px; padding: 14px; border-radius: 18px; border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow);
  text-align: left; font-weight: 500; font-size: .92rem; line-height: 1.25;
}
.quick button .qi { width: 36px; height: 36px; border-radius: 12px; background: var(--a-soft); color: var(--a); display: grid; place-items: center; }
.quick button:hover { border-color: color-mix(in srgb, var(--a) 40%, var(--line)); }
@media (min-width: 760px) { .quick { display: grid; grid-template-columns: repeat(6, 1fr); overflow: visible; margin: 0 0 18px; padding: 0; } .quick button { width: auto; } }

.hero-grid { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .hero-grid { grid-template-columns: 1fr 1fr; } .hero-grid .next { grid-column: 1 / -1; } }
@media (min-width: 900px) { .hero-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1500px) { .hero-grid { grid-template-columns: 1.6fr 1fr 1fr 1fr; } .hero-grid .next { grid-column: auto; } }
.next { background: var(--hero); border-color: color-mix(in srgb, var(--a) 18%, var(--line)); position: relative; overflow: hidden; }
.next .who { display: flex; align-items: center; gap: 14px; margin: 12px 0 10px; }
.avatar { width: 52px; height: 52px; border-radius: 50%; background: var(--a); color: var(--a-ink); display: grid; place-items: center; font-family: var(--font-serif); font-size: 1.3rem; font-weight: 600; flex: none; }
.avatar.sm { width: 40px; height: 40px; font-size: 1.05rem; }
.next .name { font-family: var(--font-serif); font-size: 1.75rem; font-weight: 600; line-height: 1.05; }
.next .when { color: var(--muted); font-size: .95rem; }
.next .formula { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 14px; background: color-mix(in srgb, var(--surface) 72%, transparent); font-size: .92rem; margin-top: 10px; }
.next .flags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.next .actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }

.ring-card { display: flex; flex-direction: column; justify-content: space-between; gap: 10px; }
.ring-wrap { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.feed li[hidden] { display: none; }
.more-btn { margin-top: 10px; }
.ring { width: 92px; height: 92px; flex: none; position: relative; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring .track { stroke: var(--a-soft); }
.ring .val { stroke: var(--a); transition: stroke-dashoffset .8s ease; }
.ring .label { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--font-serif); font-weight: 600; font-size: 1.35rem; }

.kpis { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 760px) { .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1180px) { .kpis { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.kpi { padding: 16px; border-radius: 18px; display: flex; flex-direction: column; gap: 6px; min-height: 132px; text-align: left; text-decoration: none; }
button.kpi, a.kpi { cursor: pointer; font: inherit; color: inherit; }
.kpi:hover { border-color: color-mix(in srgb, var(--a) 35%, var(--line)); }
.kpi .eyebrow { font-size: .68rem; }
.kpi .big { font-size: 1.9rem; overflow-wrap: anywhere; }
.kpi .say { font-size: .86rem; margin-top: auto; }

.two-col { display: grid; gap: 16px; }
@media (min-width: 1040px) { .two-col { grid-template-columns: 1.35fr 1fr; align-items: start; } }

.sched { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.sched li > button {
  width: 100%; display: grid; grid-template-columns: 76px 1fr auto; gap: 12px; align-items: center; text-align: left;
  padding: 12px 12px 12px 14px; border-radius: 16px; border: 1px solid var(--line); background: var(--surface); min-height: 72px; position: relative;
}
.sched li > button::before { content: ""; position: absolute; left: 0; top: 12px; bottom: 12px; width: 4px; border-radius: 4px; background: var(--cat, var(--a)); }
.sched li > button:hover { background: var(--surface-2); }
.sched .t { font-weight: 600; font-size: .95rem; line-height: 1.2; }
.sched .t small { display: block; color: var(--muted); font-weight: 400; font-size: .8rem; }
.sched .c { min-width: 0; }
.sched .c strong { display: flex; align-items: center; gap: 6px; font-weight: 600; }
.sched .c span { display: block; color: var(--muted); font-size: .88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sched li.done > button { background: var(--surface-2); }
.sched li.done > button .c strong, .sched li.done > button .t { color: var(--muted); }
.sched li.block > div { display: grid; grid-template-columns: 76px 1fr; gap: 12px; padding: 10px 14px; border-radius: 16px; border: 1px dashed var(--line); color: var(--muted); font-size: .9rem; }
.st { font-size: .74rem; }
.st.done { background: var(--ok-soft); color: var(--ok); }
.st.in-chair { background: var(--a); color: var(--a-ink); }
.st.checkout { background: var(--warn-soft); color: var(--warn); }
.st.no-show, .st.cancelled { background: var(--surface-2); color: var(--muted); }

.feed { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.feed button, .feed a {
  width: 100%; display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 16px; min-height: 64px;
  border: 1px solid var(--line); background: var(--surface); text-align: left; text-decoration: none; color: inherit;
}
.feed button:hover, .feed a:hover { background: var(--surface-2); }
.feed .fi { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; flex: none; background: var(--a-soft); color: var(--a); }
.feed .fi.danger { background: var(--danger-soft); color: var(--danger); }
.feed .fi.warn { background: var(--warn-soft); color: var(--warn); }
.feed .ft { flex: 1; min-width: 0; font-size: .94rem; }
.feed .ft small { display: block; color: var(--muted); font-size: .82rem; }
.feed .chev { color: var(--muted); }

.charts { display: grid; gap: 16px; }
@media (min-width: 820px) { .charts { grid-template-columns: 1fr 1fr; } }
.chart-box { position: relative; height: 220px; }
.takeaway { margin-top: 12px; font-size: .93rem; color: var(--muted); }
.takeaway strong { color: var(--ink); font-weight: 600; }

.empty-state { text-align: center; padding: 26px 16px; color: var(--muted); }
.empty-state .serif { font-size: 1.4rem; color: var(--ink); display: block; margin-bottom: 4px; }

/* ---------- Placeholder / locked ---------- */
.room { max-width: 640px; margin: 8vh auto 0; text-align: center; }
.room .badge { width: 72px; height: 72px; border-radius: 24px; margin: 0 auto 18px; background: var(--a-soft); color: var(--a); display: grid; place-items: center; }
.room .badge svg { width: 32px; height: 32px; }
.room p { color: var(--muted); margin: 10px auto 20px; max-width: 46ch; }
.banner { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: 18px; background: var(--hero); border: 1px solid color-mix(in srgb, var(--a) 22%, var(--line)); margin-bottom: 16px; flex-wrap: wrap; }
.banner p { flex: 1; min-width: 220px; font-size: .94rem; }

/* ---------- Sheets ---------- */
.scrim { position: fixed; inset: 0; z-index: 60; background: rgba(25, 15, 20, .42); display: flex; align-items: flex-end; justify-content: center; animation: fade .18s ease; }
.sheet {
  width: 100%; max-height: 92vh; max-height: 92dvh; display: flex; flex-direction: column; background: var(--surface); color: var(--ink);
  border-radius: 26px 26px 0 0; box-shadow: var(--shadow-lg); animation: rise .24s cubic-bezier(.2, .8, .2, 1);
  padding-bottom: env(safe-area-inset-bottom);
}
.sheet-head { display: flex; align-items: center; gap: 12px; padding: 18px 18px 10px 22px; }
.sheet-head h2 { flex: 1; font-size: 1.6rem; }
.sheet-head .grab { position: absolute; }
.sheet-body { padding: 4px 22px 18px; overflow-y: auto; }
.sheet-foot { display: flex; flex-wrap: wrap; gap: 10px; padding: 12px 22px 18px; border-top: 1px solid var(--line); }
.sheet-foot .btn { flex: 1 1 auto; }
.sheet-foot .btn.primary { flex-basis: 40%; }
@media (min-width: 720px) {
  .scrim { align-items: center; padding: 24px; }
  .sheet { max-width: 560px; border-radius: 26px; max-height: 88vh; max-height: 88dvh; }
  .sheet.wide { max-width: 720px; }
}
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(24px); opacity: .4; } }

/* forms */
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field > label, .field > .lbl { font-weight: 600; font-size: .9rem; }
.field .hint { font-size: .83rem; color: var(--muted); }
.input, select.input, textarea.input {
  width: 100%; min-height: 50px; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface-2); font-size: 1rem;
}
textarea.input { min-height: 88px; resize: vertical; }
.input:focus-visible { box-shadow: var(--focus); background: var(--surface); }
.row2 { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.chip span { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-size: .92rem; font-weight: 500; }
.chip input:checked + span { background: var(--a); color: var(--a-ink); border-color: transparent; }
.chip input:focus-visible + span { box-shadow: var(--focus); }
.note { padding: 12px 14px; border-radius: 14px; background: var(--surface-2); font-size: .92rem; margin-bottom: 14px; display: flex; gap: 10px; align-items: flex-start; }
.note.danger { background: var(--danger-soft); color: var(--danger); }
.note.warn { background: var(--warn-soft); color: var(--warn); }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px; border-radius: 16px; background: var(--surface-2); border: 1px solid var(--line); }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg span { display: grid; place-items: center; min-height: 44px; border-radius: 12px; font-weight: 500; font-size: .92rem; text-align: center; padding: 0 6px; }
.seg input:checked + span { background: var(--surface); box-shadow: var(--shadow); color: var(--a); font-weight: 600; }
.seg input:focus-visible + span { box-shadow: var(--focus); }
.swatches { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
@media (min-width: 520px) { .swatches { grid-template-columns: repeat(5, 1fr); } }
.swatch { position: relative; }
.swatch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.swatch span { display: flex; flex-direction: column; gap: 8px; align-items: center; padding: 10px 6px; border-radius: 16px; border: 1px solid var(--line); font-size: .8rem; font-weight: 500; text-align: center; }
.swatch i { width: 40px; height: 40px; border-radius: 50%; display: block; box-shadow: inset 0 0 0 1px rgba(0,0,0,.06); }
.swatch input:checked + span { border-color: var(--a); box-shadow: 0 0 0 2px var(--a) inset; }
.swatch input:focus-visible + span { box-shadow: var(--focus); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: .93rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.tip-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.total-line { display: flex; justify-content: space-between; align-items: baseline; padding: 6px 0; }
.total-line.grand { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 12px; font-weight: 600; }
.total-line.grand span:last-child { font-family: var(--font-serif); font-size: 1.7rem; }

/* toast */
.toast {
  position: fixed; left: 50%; bottom: calc(150px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(10px);
  z-index: 80; background: var(--ink); color: var(--bg); padding: 14px 18px; border-radius: 16px; box-shadow: var(--shadow-lg);
  max-width: min(92vw, 460px); font-size: .94rem; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.has-action.show { pointer-events: auto; display: flex; align-items: center; gap: 14px; }
.toast-act { border: 0; background: transparent; color: var(--bg); font-weight: 700; text-decoration: underline; min-height: 40px; padding: 0 6px; }
@media (min-width: 960px) { .toast { bottom: 28px; } }

/* print */
#print-area { display: none; }
@media print {
  html, body { background: #fff; color: #000; min-height: 0 !important; height: auto !important; }
  .app, .scrim, .toast, .tabbar, .fab, #sheet-root, .skip-link, .topbar { display: none !important; }
  #print-area { display: block; font-family: var(--font-sans); padding: 24px; }
  #print-area h1 { font-size: 26px; margin-bottom: 4px; }
  #print-area table { width: 100%; border-collapse: collapse; margin-top: 16px; font-size: 13px; }
  #print-area th, #print-area td { border-bottom: 1px solid #ccc; padding: 8px 6px; text-align: left; vertical-align: top; }
  #print-area td:first-child { white-space: nowrap; }
}

/* ---------- Calendar ---------- */
svg.i.flip { transform: rotate(180deg); }
.cal-head { display: flex; flex-wrap: wrap; gap: 14px 20px; align-items: flex-end; justify-content: space-between; margin-bottom: 12px; }
.cal-title h1 { font-size: clamp(1.8rem, 5vw, 2.4rem); }
.cal-tools { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.cal-nav { display: flex; gap: 6px; align-items: center; }
.cal-nav .btn { min-height: var(--tap); }
.cal-views { min-width: 280px; }
.cal-views span { min-height: 40px; }
.cal-acts { display: flex; gap: 8px; }
@media (max-width: 759px) { .cal-tools { width: 100%; } .cal-views { flex: 1 1 100%; min-width: 0; order: 3; } .cal-acts { flex: none; } .cal-nav { flex: 1; } .cal-nav .btn { flex: 1; } }
.legend { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: .8rem; color: var(--muted); }
.legend li { display: inline-flex; align-items: center; gap: 6px; }
.dot.hatch { background: repeating-linear-gradient(135deg, var(--muted) 0 2px, transparent 2px 4px); border: 1px solid var(--muted); }
.dot.blocked { background: var(--surface-2); border: 1px dashed var(--muted); }
.cal-body { padding: 0; overflow: hidden; }
.cal-body.list, .cal-body.month { padding: 14px; }
.cal-hint { margin-top: 10px; font-size: .84rem; color: var(--muted); }

.tl { --gut: 56px; position: relative; }
@media (max-width: 759px) { .tl { --gut: 46px; } }
.tl-head { display: grid; border-bottom: 1px solid var(--line); background: var(--surface); }
.tl-day { border: 0; background: none; padding: 10px 4px 8px; display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 64px; border-left: 1px solid var(--line); min-width: 0; }
.tl.day .tl-day { flex-direction: row; justify-content: flex-start; gap: 10px; padding-left: 14px; }
.tl-day .dow { font-size: .74rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.tl-day .dnum { font-family: var(--font-serif); font-size: 1.45rem; font-weight: 600; width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; }
.tl-day.is-today .dnum { background: var(--a); color: var(--a-ink); }
.tl-day .away { font-size: .7rem; font-weight: 600; background: var(--a-soft); color: var(--ink); border-radius: 999px; padding: 2px 8px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-day .away.none { visibility: hidden; }
.tl-day .closed-tag { font-size: .7rem; color: var(--muted); }
.tl-day:hover { background: var(--surface-2); }
.tl-grid { display: grid; position: relative; }
.tl-gutter { position: relative; }
.tl-gutter span { position: absolute; right: 8px; transform: translateY(-50%); font-size: .72rem; color: var(--muted); white-space: nowrap; }
.tl-col { position: relative; border-left: 1px solid var(--line); cursor: copy;
  background-image: repeating-linear-gradient(to bottom, var(--line) 0 1px, transparent 1px 66px); }
.tl-col.is-today { background-color: color-mix(in srgb, var(--a-soft) 35%, transparent); }
.shade { position: absolute; left: 0; right: 0; background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--muted) 9%, transparent) 0 6px, transparent 6px 12px); pointer-events: none; }
.now { position: absolute; left: -1px; right: 0; height: 2px; background: var(--danger); z-index: 4; pointer-events: none; }
.now::before { content: ""; position: absolute; left: -5px; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--danger); }

.ev { position: absolute; z-index: 2; border: 0; padding: 0; text-align: left; border-radius: 10px; overflow: hidden; cursor: pointer;
  background: var(--surface); box-shadow: 0 1px 2px rgba(0,0,0,.08); color: var(--ink); touch-action: manipulation; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.ev.movable { cursor: grab; }
.ev .sgs { position: absolute; inset: 0; display: flex; flex-direction: column; }
.ev .sg { display: block; flex: none; position: relative; }
.ev .sg-active, .ev .sg-finish { background: color-mix(in srgb, var(--cat) 22%, var(--surface)); }
.ev .sg-finish { background: color-mix(in srgb, var(--cat) 15%, var(--surface)); }
.ev .sg-processing { background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--cat) 16%, var(--surface)) 0 6px, var(--surface) 6px 12px); }
.ev .sg em::before { content: attr(data-t); }
.ev .sg em { position: absolute; bottom: 4px; left: 10px; font-style: normal; font-size: .68rem; font-weight: 600; color: var(--muted); background: var(--surface); padding: 1px 6px; border-radius: 6px; }
.ev::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--cat); z-index: 1; }
.ev .ev-t { position: absolute; top: 0; left: 0; right: 0; z-index: 1; display: block; padding: 5px 6px 4px 10px; font-size: .8rem; line-height: 1.25; }
.ev .ev-t strong { display: flex; align-items: center; gap: 4px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev .ev-t > span { display: block; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev .alg { color: var(--danger); display: inline-flex; }
.ev .alg svg { width: 14px; height: 14px; }
.tl.week .ev .ev-t { font-size: .74rem; padding-left: 8px; }
.ev.st-done .sg-active, .ev.st-done .sg-finish, .ev.st-done .sg-processing { filter: saturate(.45); }
.ev.st-done .ev-t strong, .ev.st-done .ev-t span { color: var(--muted); }
.ev.st-in-chair { box-shadow: 0 0 0 2px var(--a); }
.ev.st-no-show .ev-t strong { text-decoration: line-through; }
.ev.st-no-show .sgs { filter: grayscale(1); opacity: .5; }
.ev.st-no-show .ev-t strong { text-decoration: line-through; color: var(--muted); }
.ev.st-no-show .ev-t span { color: var(--muted); }
.ev:focus-visible { box-shadow: var(--focus); z-index: 5; }
.ev.lifted { opacity: .3; }
.ev.ghost { z-index: 20; opacity: .95; box-shadow: var(--shadow-lg); pointer-events: none; outline: 2px solid var(--a); }
.ev.ghost.clash { outline-color: var(--danger); }
.ghost-time { position: absolute; right: 6px; top: 4px; z-index: 2; font-size: .72rem; font-weight: 700; background: var(--ink); color: var(--bg); padding: 2px 7px; border-radius: 8px; }
.blk { position: absolute; left: 2px; right: 3px; z-index: 1; border: 1px dashed color-mix(in srgb, var(--muted) 60%, transparent); border-radius: 10px; text-align: left; padding: 4px 8px; font-size: .76rem; color: var(--muted);
  background: repeating-linear-gradient(135deg, var(--surface-2) 0 6px, var(--surface) 6px 12px); overflow: hidden; display: flex; flex-direction: column; }
.blk[style*="height:22px"] span, .blk[style*="height:16.5px"] span { display: none; }
.blk strong { color: var(--ink); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fill-win { position: absolute; right: 6px; width: min(260px, 46%); z-index: 3; border: 1.5px dashed var(--a); background: color-mix(in srgb, var(--surface) 88%, transparent); color: var(--a);
  border-radius: 10px; display: flex; align-items: center; gap: 6px; padding: 0 10px; font-size: .8rem; font-weight: 600; text-align: left; }
.fill-win:hover { background: var(--a-soft); }

.mo { display: grid; gap: 4px; }
.mo-row { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.mo-dows span { text-align: center; font-size: .74rem; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: 4px 0; }
.mo-cell { width: 100%; min-height: 104px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); padding: 6px; display: flex; flex-direction: column; gap: 3px; align-items: stretch; text-align: left; overflow: hidden; }
.mo-cell:hover { background: var(--surface-2); }
.mo-cell.out { opacity: .45; }
.mo-cell.closed { background: var(--surface-2); }
.mo-cell.away { background: var(--a-soft); }
.mo-n { font-weight: 600; font-size: .9rem; width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; }
.mo-cell.is-today .mo-n { background: var(--a); color: var(--a-ink); }
.mo-chip { font-size: .72rem; padding: 2px 6px; border-radius: 6px; background: color-mix(in srgb, var(--cat) 20%, var(--surface)); border-left: 3px solid var(--cat); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mo-more, .mo-away { font-size: .7rem; color: var(--muted); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mo-dots { display: flex; gap: 3px; flex-wrap: wrap; align-items: center; margin-top: auto; }
.mo-dots i { width: 7px; height: 7px; border-radius: 50%; }
.mo-dots b { font-size: .7rem; color: var(--muted); }
@media (max-width: 759px) { .mo-cell { min-height: 62px; padding: 4px; border-radius: 10px; } .mo-row { gap: 3px; } .mo { gap: 3px; } .cal-body.month { padding: 8px; } }

.ag-day + .ag-day { margin-top: 18px; }
.ag-h { font-family: var(--font-sans); font-size: .8rem; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 8px; }
.ag-h button { border: 0; background: none; padding: 6px 0; min-height: 36px; font: inherit; color: inherit; letter-spacing: inherit; text-transform: inherit; }
.ag-h button:hover { color: var(--a); }
.sched li > button { cursor: pointer; }

.segbar { display: flex; height: 14px; border-radius: 8px; overflow: hidden; margin: 12px 0 8px; gap: 2px; }
.segbar .sg-active, .segbar .sg-finish { background: var(--cat); }
.segbar .sg-finish { opacity: .65; }
.segbar .sg-processing { background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--cat) 45%, transparent) 0 4px, transparent 4px 8px); border: 1px solid color-mix(in srgb, var(--cat) 45%, transparent); border-radius: 4px; }
.resched { border: 1px solid var(--line); border-radius: 14px; padding: 0 14px; margin-bottom: 12px; }
.resched summary { display: flex; align-items: center; gap: 8px; min-height: 50px; cursor: pointer; font-weight: 600; list-style: none; }
.resched summary::-webkit-details-marker { display: none; }
.resched[open] { padding-bottom: 14px; }
.note.ok, .note .ok { color: var(--ok); }
.fill-win span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Shared room styles ---------- */
.page-head { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: flex-end; justify-content: space-between; margin: 4px 0 18px; }
.page-head h1 { font-size: clamp(2rem, 5vw, 2.6rem); }
.page-head .lead { font-size: 1.02rem; max-width: 62ch; }
.page-head .lead strong { color: var(--ink); }
.page-acts { display: flex; flex-wrap: wrap; gap: 8px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: stretch; margin-bottom: 12px; }
.grow { flex: 1; min-width: 0; }
.kpis.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 900px) { .kpis.four { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.kpi.static { cursor: default; min-height: 110px; }
.kpi.static:hover { border-color: var(--line); }
.delta { font-size: .78rem; font-weight: 700; margin-left: 4px; white-space: nowrap; }
.delta.up { color: var(--ok); } .delta.down { color: var(--danger); } .delta.flat { color: var(--muted); }
.tabs { display: flex; overflow-x: auto; scrollbar-width: none; max-width: 100%; }
.tabs::-webkit-scrollbar { display: none; }
.tabs label { flex: 1 0 auto; }
.tabs span { padding: 0 14px; white-space: nowrap; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 4px; }
.chips.scroll::-webkit-scrollbar { display: none; }
.chips.tight { gap: 4px; margin-top: 4px; }
.chip-btn { flex: none; min-height: 44px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-weight: 500; font-size: .92rem; }
.chip-btn.on { background: var(--a); color: var(--a-ink); border-color: transparent; }
.chip-btn:hover:not(.on) { background: var(--surface-2); }
.linkish { border: 0; background: none; padding: 0; color: inherit; text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--a) 50%, transparent); text-underline-offset: 3px; cursor: pointer; font: inherit; text-align: left; }
.linkish:hover { color: var(--a); }
.row3 { display: grid; gap: 12px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 520px) { .row3 { grid-template-columns: 1fr 1fr; } .row2.keep { grid-template-columns: 1fr 1fr; } }
.row-add { display: flex; gap: 8px; align-items: stretch; flex-wrap: wrap; }
.row-add .input { flex: 1; min-width: 120px; }
.row-acts { display: inline-flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.stack-sm { display: grid; gap: 8px; }
.input.sm { min-height: 42px; padding: 8px 10px; width: 92px; flex: none; }
.input.inline { display: inline-block; width: 76px; min-height: 36px; padding: 4px 8px; margin: 0 4px; }
.input.money { text-align: right; width: 110px; }
.input.color { padding: 4px; height: 50px; }
.input.mono, textarea.mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .85rem; }
.check { display: flex; gap: 10px; align-items: flex-start; min-height: 40px; padding: 6px 0; cursor: pointer; font-size: .95rem; }
.check input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--a); flex: none; }
.check.big { padding: 10px 0; border-bottom: 1px solid var(--line); }
.radio-card { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; cursor: pointer; background: var(--surface); }
.radio-card input { margin-top: 4px; accent-color: var(--a); width: 18px; height: 18px; }
.radio-card small { display: block; color: var(--muted); font-size: .84rem; }
.radio-card:has(input:checked) { border-color: var(--a); box-shadow: 0 0 0 1px var(--a) inset; }
.radio-card.disabled { opacity: .5; }
.plain-list { list-style: none; margin: 0; padding: 0; }
.plain-list > li { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.plain-list > li:last-child { border-bottom: 0; }
.plain-list > li > span:first-child { flex: 1; min-width: 160px; }
.file-btn { position: relative; cursor: pointer; }
.thumb { width: 44px; height: 44px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); }
.thumb.sm { width: 36px; height: 36px; }
.send-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.bubble { background: var(--a-soft); border-radius: 18px 18px 18px 6px; padding: 14px 16px; font-size: .96rem; line-height: 1.55; }
.note.ok-note { background: var(--ok-soft); color: var(--ok); }
.btn-note { width: 100%; border: 0; text-align: left; cursor: pointer; }
.danger-zone { text-align: right; }
.link-card { text-decoration: none; display: block; }
.link-card:hover { border-color: color-mix(in srgb, var(--a) 40%, var(--line)); }
code { font-family: ui-monospace, Menlo, monospace; font-size: .85em; background: var(--surface-2); padding: 1px 5px; border-radius: 6px; }
.hbars { display: grid; gap: 10px; }
.hbar { display: grid; grid-template-columns: minmax(90px, 34%) 1fr auto; gap: 10px; align-items: center; font-size: .9rem; }
.hbar-l { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-t { height: 12px; background: var(--surface-2); border-radius: 6px; overflow: hidden; }
.hbar-t i { display: block; height: 100%; background: color-mix(in srgb, var(--a) 55%, var(--surface)); border-radius: 6px; }
.hbar-t i.in { background: var(--a); } .hbar-t i.take { background: var(--ok); } .hbar-t i.tax { background: var(--warn); }
.hbar-v { font-weight: 600; min-width: 64px; text-align: right; }

/* rebook */
.rb-list, .cl-list, .svc-list, .inv-list, .pay-list, .formula-list { list-style: none; margin: 0; padding: 0; }
.rb-row { display: grid; grid-template-columns: 1fr auto; gap: 10px 14px; padding: 14px 0; border-bottom: 1px solid var(--line); align-items: center; }
.rb-row:last-child { border-bottom: 0; }
.rb-who { display: flex; gap: 12px; align-items: center; min-width: 0; }
.rb-who > div { min-width: 0; }
.rb-who span.muted, .rb-who .hint { display: block; font-size: .86rem; }
.rb-meta { display: grid; justify-items: end; gap: 4px; }
.rb-val { font-family: var(--font-serif); font-size: 1.3rem; font-weight: 600; }
.rb-acts { grid-column: 1 / -1; display: flex; gap: 8px; flex-wrap: wrap; }
@media (min-width: 900px) { .rb-row { grid-template-columns: 1fr auto auto; } .rb-acts { grid-column: auto; } }
.pill.rb-overdue { background: var(--danger-soft); color: var(--danger); }
.pill.rb-due { background: var(--a); color: var(--a-ink); }
.pill.rb-slipping { background: var(--warn-soft); color: var(--warn); }
.pill.rb-coming { background: var(--surface-2); color: var(--muted); }

/* clients */
.cl-list li > button { width: 100%; display: flex; gap: 12px; align-items: center; padding: 12px 6px; border: 0; border-bottom: 1px solid var(--line); background: none; text-align: left; min-height: 68px; }
.cl-list li:last-child > button { border-bottom: 0; }
.cl-list li > button:hover { background: var(--surface-2); border-radius: 12px; }
.cl-main { flex: 1; min-width: 0; }
.cl-main strong { display: flex; gap: 6px; align-items: center; }
.cl-main .muted { display: block; font-size: .86rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cl-tags { display: none; gap: 4px; }
@media (min-width: 700px) { .cl-tags { display: flex; } }
.crumb { margin-bottom: 8px; }
.crumb .btn { padding-left: 6px; }
.cl-head { display: grid; grid-template-columns: auto 1fr; gap: 16px; align-items: center; background: var(--hero); }
.cl-head h1 { font-size: clamp(1.8rem, 5vw, 2.4rem); }
.cl-acts { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; }
@media (min-width: 900px) { .cl-head { grid-template-columns: auto 1fr auto; } .cl-acts { grid-column: auto; justify-content: flex-end; } }
.avatar.lg { width: 72px; height: 72px; font-size: 1.8rem; }
.kv.lg { gap: 10px 18px; }
.formula-list { display: grid; gap: 12px; }
.formula-lines { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-family: var(--font-serif); font-size: 1.35rem; font-weight: 600; margin: 6px 0; }
.formula-lines em { font-family: var(--font-sans); font-style: normal; font-size: .85rem; color: var(--muted); font-weight: 500; }
.formula-lines b { color: var(--muted); font-weight: 400; }
.photo-grid { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.photo { border: 1px solid var(--line); border-radius: 16px; overflow: hidden; background: var(--surface); }
.photo img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; display: block; background: var(--surface-2); }
.photo-meta { padding: 10px; display: grid; gap: 4px; font-size: .84rem; }
.photo-meta .check { min-height: 32px; padding: 2px 0; font-size: .84rem; }
.sig { width: 100%; height: 160px; border: 1.5px dashed var(--line); border-radius: 14px; background: #fff; touch-action: none; display: block; }
.sig-img { max-width: 100%; border: 1px solid var(--line); border-radius: 12px; background: #fff; margin-top: 10px; }
.prod-use { display: grid; gap: 6px; margin-top: 6px; max-height: 260px; overflow-y: auto; }
.prod-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: .9rem; }

/* payments */
.co-lines { border: 1px solid var(--line); border-radius: 14px; padding: 6px 14px; margin-bottom: 12px; }
.co-lines .total-line { align-items: center; }
.co-total { background: var(--surface-2); border-radius: 14px; padding: 8px 14px; margin: 12px 0; }
.tip-row.five { grid-template-columns: repeat(5, 1fr); }
.tip-row .chip span { width: 100%; justify-content: center; padding: 0 6px; }
.pay-list li { display: grid; grid-template-columns: 64px 1fr auto; gap: 6px 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.pay-list li:last-child { border-bottom: 0; }
.pay-list .row-acts { grid-column: 2 / -1; justify-content: flex-start; }
.pay-list .thumb { grid-row: span 1; }
@media (min-width: 900px) { .pay-list li { grid-template-columns: 70px 1fr auto auto auto; } .pay-list .row-acts { grid-column: auto; } }
.pay-date { font-weight: 600; font-size: .9rem; line-height: 1.2; }
.pay-date small { display: block; color: var(--muted); font-weight: 400; }
.pay-main { min-width: 0; }
.pay-main .muted { display: block; font-size: .85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pay-amt { font-weight: 700; text-align: right; }
.pay-amt small { display: block; font-weight: 400; color: var(--muted); font-size: .78rem; }
.pay-amt.neg { color: var(--danger); }
.receipt { border: 1px dashed var(--line); border-radius: 16px; padding: 16px; }

/* services */
.svc-list li > button { width: 100%; display: flex; gap: 12px; align-items: center; padding: 12px 4px; border: 0; border-bottom: 1px solid var(--line); background: none; text-align: left; min-height: 64px; }
.svc-list li:last-child > button { border-bottom: 0; }
.svc-list li > button:hover { background: var(--surface-2); border-radius: 12px; }
.svc-main { flex: 1; min-width: 0; display: grid; gap: 2px; }
.svc-main .muted { font-size: .86rem; }
.svc-price { font-family: var(--font-serif); font-size: 1.35rem; font-weight: 600; white-space: nowrap; }
.svc-price small { font-family: var(--font-sans); font-size: .75rem; color: var(--muted); font-weight: 500; }
.menu-preview { text-align: center; padding: 6px 4px; }
.menu-preview h2 { font-size: 2rem; margin: 4px 0 8px; }
.menu-cat { text-align: left; margin-top: 18px; }
.menu-cat h2 { font-size: 1.2rem; text-transform: uppercase; letter-spacing: .12em; font-family: var(--font-sans); font-weight: 600; color: var(--a); margin-bottom: 6px; }
.menu-row { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px dotted var(--line); }

/* chair */
.hours { list-style: none; margin: 10px 0 0; padding: 0; }
.hours li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.hrs { display: inline-flex; gap: 6px; align-items: center; }
.hrs .input.sm { width: 118px; }
.month-nav { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.month-nav h2 { font-size: 1.5rem; min-width: 12ch; text-align: center; }
.icon-btn[disabled] { opacity: .4; cursor: default; }

/* inventory */
.inv-list li { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.inv-list li:last-child { border-bottom: 0; }
.inv-main { flex: 1; min-width: 0; display: grid; gap: 2px; border: 0; background: none; text-align: left; padding: 4px; border-radius: 10px; }
.inv-main:hover { background: var(--surface-2); }
.inv-main .muted { font-size: .85rem; }
.stepper { display: inline-flex; align-items: center; gap: 4px; }
.stepper output { min-width: 40px; text-align: center; font-weight: 700; font-size: 1.05rem; }
.icon-btn.sm { min-width: 44px; height: 44px; border-radius: 12px; font-size: 1.2rem; font-weight: 600; }

/* loyalty & marketing */
.board { list-style: none; margin: 0; padding: 0; }
.board li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.board li:last-child { border-bottom: 0; }
.rank { width: 28px; font-family: var(--font-serif); font-size: 1.3rem; font-weight: 600; color: var(--muted); text-align: center; }
.board li:nth-child(-n+3) .rank { color: var(--a); }
.pts { font-weight: 700; min-width: 64px; text-align: right; }
.tier-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.tier { background: var(--hero); }
.tier.add { display: grid; place-items: center; gap: 8px; border-style: dashed; background: transparent; color: var(--muted); min-height: 160px; cursor: pointer; font: inherit; }
.aftercare { border-top: 4px solid var(--cat); }
.row-field { grid-template-columns: 1fr auto; align-items: center; display: grid; }
.heat-wrap { overflow-x: auto; }
.heat { border-collapse: separate; border-spacing: 3px; width: 100%; font-size: .72rem; }
.heat th { color: var(--muted); font-weight: 600; padding: 2px; }
.heat td { height: 26px; border-radius: 6px; background: var(--surface-2); min-width: 18px; }

/* studio & guide */
.brand-row { display: flex; gap: 16px; align-items: center; margin-bottom: 16px; }
.logo-prev { width: 72px; height: 72px; object-fit: contain; border-radius: 18px; border: 1px solid var(--line); background: #fff; }
.brand-mark.big { width: 72px; height: 72px; font-size: 2.2rem; border-radius: 22px; }
.brand-logo { width: 36px; height: 36px; border-radius: 12px; object-fit: contain; background: #fff; }
.tag-pill { gap: 4px; padding-right: 4px; }
.tag-pill .x { border: 0; background: none; color: inherit; font-size: 1rem; width: 24px; height: 24px; border-radius: 50%; cursor: pointer; }
.tag-pill .x:hover { background: var(--surface); }
.checklist { list-style: none; margin: 10px 0 0; padding: 0; }
.checklist li { display: flex; gap: 12px; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--line); }
.checklist li:last-child { border-bottom: 0; }
.checklist li.done strong { text-decoration: line-through; text-decoration-color: var(--muted); color: var(--muted); }
.checklist .check { flex: 1; }
.howto { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.howto .card { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.howto .fi { width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center; background: var(--a-soft); color: var(--a); }
.howto .say { flex: 1; }
.charts > *, .two-col > *, .hero-grid > * { min-width: 0; }
.heat-wrap { max-width: 100%; overflow-x: auto; }
.heat { table-layout: fixed; }
.heat td { min-width: 0; }
.heat thead th { overflow: hidden; white-space: nowrap; font-size: .62rem; }
.heat th[scope="row"] { width: 34px; text-align: left; }
@media (max-width: 600px) { .heat { border-spacing: 2px; } .heat thead th:nth-child(odd):not(:first-child) { color: transparent; } }

h1[tabindex="-1"]:focus, h1[tabindex="-1"]:focus-visible { box-shadow: none; outline: none; }
.chart-empty { min-height: 220px; display: grid; place-content: center; }
.plain-list.compact > li { flex-wrap: nowrap; padding: 8px 0; }
.plain-list.compact > li > span:first-child { flex: none; min-width: 64px; }
.plain-list.compact > li > span.muted { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- round two ---------- */
.pick-scroll { max-height: 300px; overflow-y: auto; border: 1px solid var(--line); border-radius: 16px; padding: 4px 12px 12px; background: var(--surface-2); }
.pick-scroll.short { max-height: 220px; }
.pick-cat { display: flex; align-items: center; gap: 8px; font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 10px 0 6px; }
.svc-pick .chip span small { color: inherit; opacity: .75; font-weight: 400; margin-left: 2px; }
.bowl { border: 1px solid var(--line); border-radius: 16px; padding: 12px; margin-bottom: 12px; background: var(--surface-2); display: grid; gap: 8px; }
.bowl-head { display: flex; gap: 8px; align-items: center; }
.bowl-name { font-weight: 600; max-width: 200px; }
.bowl-meta { flex: 1; font-size: .82rem; color: var(--muted); text-align: right; }
.bowl-line { display: flex; gap: 8px; align-items: center; }
.bowl-line .input:first-child { flex: 1; min-width: 0; }
.bowl-line.dev { margin-top: 4px; }
.bowl-view + .bowl-view { margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line); }
.bowl-view .eyebrow:empty { display: none; }
.formula.goal { background: color-mix(in srgb, var(--a-soft) 70%, transparent); }
.inspo-row { display: flex; gap: 8px; margin-top: 10px; }
.inspo-row img { width: 72px; height: 90px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); }
.plain-list li.sent { opacity: .5; }
.plain-list li.sent strong::after { content: " · sent"; font-weight: 400; color: var(--ok); }
.steps { margin: 0 0 6px; padding-left: 20px; display: grid; gap: 6px; font-size: .94rem; }
.page-prev { width: 100%; height: 70vh; border: 1px solid var(--line); border-radius: 16px; background: #fff; }
.cal-acts { flex-wrap: wrap; }
@media (max-width: 759px) { .cal-acts { flex: 1 1 100%; } }
.coming-h { font-size: 1.15rem; margin: 18px 0 8px; }
.sched .day-label { font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 6px 0 -2px 4px; }

/* No sideways scrolling anywhere: quick actions, tabs and filter chips wrap instead */
.quick { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; overflow: visible; margin: 0 0 16px; padding: 0; }
.quick button { width: auto; min-height: 84px; padding: 12px; font-size: .86rem; gap: 8px; }
.quick button .qi { width: 32px; height: 32px; border-radius: 10px; }
@media (min-width: 760px) { .quick { grid-template-columns: repeat(6, minmax(0, 1fr)); } .quick button { min-height: 92px; padding: 14px; font-size: .92rem; } }
.tabs { flex-wrap: wrap; overflow: visible; }
.tabs label { flex: 1 1 auto; }
.chips.scroll { flex-wrap: wrap; overflow: visible; padding-bottom: 0; }
.plain-list > li > span.avatar, .plain-list > li > span.avatar:first-child { flex: none; min-width: 0; }
.plain-list > li > .grow { flex: 1; min-width: 0; }

/* ===== round three ===== */
/* client picker */
.cpick { position: relative; }
.cp-search { position: relative; }
.cp-list { position: absolute; left: 0; right: 0; top: calc(var(--tap) + 4px); z-index: 5; list-style: none; margin: 0; padding: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md); box-shadow: var(--shadow-lg); max-height: 280px; overflow-y: auto; }
.cp-list li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; min-height: var(--tap); padding: 10px 12px; border-radius: var(--radius-sm); cursor: pointer; }
.cp-list li .muted { font-size: .85rem; margin-left: auto; }
.cp-list li:hover, .cp-list li.on { background: var(--surface-2); }
.cp-list li.cp-add { color: var(--a); font-weight: 600; align-items: center; }
.cp-acts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.cp-chosen { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 8px 10px 8px 12px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface-2); }
.cp-chosen > span:nth-child(2) { flex: 1; min-width: 0; }
.cp-chosen .avatar.sm, .cp-chosen .avatar { width: 38px; height: 38px; font-size: .95rem; flex: none; }
.card-soft { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-md); padding: 14px; }
.cp-new .field:last-of-type, .cp-paste textarea { margin-bottom: 0; }
.ns-flag { background: var(--warn-soft); border-radius: var(--radius-md); padding: 10px 14px; margin-bottom: 12px; }
.ns-flag .field { margin: 8px 0 0; }
#na-repwrap { padding: 4px 0 0; }

/* calendar color key folds away */
.legend-wrap { margin: 0 0 12px; }
.legend-wrap > summary { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); cursor: pointer; font-size: .88rem; font-weight: 600; color: var(--muted); list-style: none; }
.legend-wrap > summary::-webkit-details-marker { display: none; }
.legend-wrap[open] > summary { margin-bottom: 10px; color: var(--ink); }
.legend-wrap .legend { margin-bottom: 0; }

/* header action pairs */
.head-acts { display: inline-flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

/* close-out */
.co-day { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: -4px 0 8px; font-weight: 600; }
.co-day [data-prev] svg { transform: rotate(180deg); }
.co-big { text-align: center; padding: 6px 0 10px; }
.co-big .num { font-size: 2.8rem; line-height: 1; margin: 4px 0 6px; }
.co-split { display: grid; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); gap: 10px; margin: 6px 0 14px; }
.co-split > div { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-md); padding: 12px 14px; }
.co-split .serif { font-size: 1.6rem; margin: 2px 0 0; }
.co-split .hint { margin: 2px 0 0; font-size: .78rem; }
.co-list { list-style: none; margin: 0 0 14px; padding: 0; }
.co-list li { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 10px 2px; border-bottom: 1px solid var(--line); }
.co-list li small { display: block; color: var(--muted); font-size: .8rem; }
.co-h { font-size: 1rem; margin: 16px 0 8px; font-family: var(--font-sans); }

/* price helper */
.input-affix { display: flex; align-items: center; gap: 8px; }
.input-affix .input { flex: 1; }
.input-affix > span { color: var(--muted); font-weight: 600; }
.pi-list { list-style: none; margin: 0; padding: 0; max-height: 300px; overflow-y: auto; border: 1px solid var(--line); border-radius: var(--radius-md); }
.pi-list li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 4px 12px; border-bottom: 1px solid var(--line); }
.pi-list li:last-child { border-bottom: 0; }
.pi-list .check { margin: 0; flex: 1; min-width: 0; }
.pi-price { font-size: .9rem; white-space: nowrap; color: var(--muted); }
.pi-price strong { color: var(--ink); }

/* storage meter */
.storage-box { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.meter { height: 10px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); overflow: hidden; }
.meter > span { display: block; height: 100%; background: var(--a); border-radius: inherit; }
.meter.warn > span { background: var(--warn); }

/* retail history */
.retail-hist { list-style: none; margin: 0; padding: 0; }
.retail-hist li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.retail-hist li:last-child { border-bottom: 0; }
.retail-hist small { display: block; color: var(--muted); font-size: .82rem; }

/* More menu: tiles, not a wall of text */
.more-quick { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 8px; }
.more-quick .btn { min-width: 0; padding: 0 10px; white-space: normal; line-height: 1.2; text-align: center; }
.more-g { margin: 14px 0 8px; }
.more-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.more-tile { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 84px; padding: 10px 6px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); color: var(--ink); text-decoration: none; font: inherit; font-size: .88rem; font-weight: 600; text-align: center; cursor: pointer; }
.more-tile .fi { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; background: var(--a-soft); color: var(--a); }
.more-tile:hover { border-color: var(--a); }

/* the floating button tucks away while you scroll down */
.fab { transition: transform .22s ease, opacity .22s ease; }
.fab.tucked { transform: translateY(140%); opacity: 0; pointer-events: none; }
@media (prefers-reduced-motion: reduce) { .fab { transition: none; } }

/* ===== older iPhones (before iOS 16.2) can't mix colors: plain backups ===== */
@supports not (color: color-mix(in srgb, red 50%, blue)) {
  :root { --line: #EADFE1; --surface-2: #FDF6F7; --hero: linear-gradient(140deg, var(--soft), var(--g2)); }
  :root[data-mode="dark"] { --a-soft: #2E2631; --grad: linear-gradient(165deg, #1C171D 0%, #161317 70%); --hero: linear-gradient(140deg, #2B2430, #241F27); }
  .topbar, .tabbar, .sidebar { background: var(--surface); }
  .quick button:hover, .kpi:hover, .link-card:hover { border-color: var(--a); }
  .next, .banner { border-color: var(--line); }
  .next .formula, .fill-win { background: var(--surface); }
  .tl-col.is-today { background-color: var(--surface-2); }
  .shade { background: repeating-linear-gradient(135deg, rgba(120, 100, 110, .09) 0 6px, transparent 6px 12px); }
  .ev .sg-active, .ev .sg-finish { background: var(--surface); box-shadow: inset 4px 0 0 var(--cat); }
  .ev .sg-processing { background: repeating-linear-gradient(135deg, rgba(120, 100, 110, .14) 0 6px, var(--surface) 6px 12px); box-shadow: inset 4px 0 0 var(--cat); }
  .blk { border-color: var(--muted); }
  .mo-chip { background: var(--surface-2); }
  .segbar .sg-processing { background: repeating-linear-gradient(135deg, rgba(120, 100, 110, .35) 0 4px, transparent 4px 8px); }
  .linkish { text-decoration-color: var(--a); }
  .hbar-t i { background: var(--a); opacity: .6; }
  .formula.goal { background: var(--a-soft); }
}

/* restore comparison */
.cmp { width: 100%; border-collapse: collapse; font-size: .92rem; }
.cmp th, .cmp td { padding: 9px 6px; border-bottom: 1px solid var(--line); text-align: right; }
.cmp th[scope=row], .cmp thead th:first-child { text-align: left; font-weight: 600; }
.cmp thead th { font-size: .78rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
