/* ============================================================
   Makeup Studio — design tokens
   Light and dark are chosen per surface, not inverted. --accent is for fills
   (buttons, selection); --accent-ink is for text and links, so both pass contrast.
   Appointment-type colors (--kind-*) are a validated categorical set.
   ============================================================ */
:root {
  color-scheme: light;
  --font: "Segoe UI Variable Text", "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --font-display: "Segoe UI Variable Display", "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --page: #f6f3f2;
  --surface: #ffffff;
  --surface-2: #f3eff0;
  --surface-3: #ebe5e7;
  --ink: #1b1618;
  --ink-2: #5a5255;
  --muted: #8b8286;
  --grid: #ece7e8;
  --border: rgba(27, 22, 24, 0.08);
  --border-strong: rgba(27, 22, 24, 0.16);
  --accent: #b8336a;
  --accent-hover: #a62d5f;
  --accent-ink: #b8336a;
  --accent-wash: rgba(184, 51, 106, 0.1);
  --accent-wash-2: rgba(184, 51, 106, 0.18);
  --on-accent: #ffffff;
  --series-1: #b8336a;
  --series-track: #f1d9e3;
  --kind-makeup: #b8336a;
  --kind-consult: #2a78d6;
  --kind-lesson: #0f9d8a;
  --kind-other: #7b57d1;
  --good: #0ca30c;
  --good-ink: #0b7a0b;
  --warning: #e3a008;
  --warning-ink: #8a5f00;
  --serious: #e0693f;
  --serious-ink: #a8431f;
  --critical: #d03b3b;
  --critical-ink: #b42b2b;
  --tooltip-bg: #1b1618;
  --tooltip-ink: #ffffff;
  --shadow-sm: 0 1px 2px rgba(27, 22, 24, 0.05), 0 1px 1px rgba(27, 22, 24, 0.03);
  --shadow-md: 0 6px 16px rgba(27, 22, 24, 0.08), 0 2px 4px rgba(27, 22, 24, 0.05);
  --shadow-lg: 0 24px 64px rgba(27, 22, 24, 0.22), 0 4px 12px rgba(27, 22, 24, 0.08);
  --radius-lg: 18px;
  --radius: 14px;
  --radius-sm: 10px;
  --radius-xs: 7px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --fast: 140ms;
  --med: 220ms;
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --page: #121012;
    --surface: #1c191b;
    --surface-2: #262224;
    --surface-3: #312b2e;
    --ink: #f6f2f3;
    --ink-2: #c9c0c4;
    --muted: #8f868a;
    --grid: #2d282b;
    --border: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.18);
    --accent: #cf3d78;
    --accent-hover: #da4f87;
    --accent-ink: #f08ab5;
    --accent-wash: rgba(207, 61, 120, 0.18);
    --accent-wash-2: rgba(207, 61, 120, 0.3);
    --series-1: #e8769f;
    --series-track: #3a2530;
    --kind-makeup: #cf3d78;
    --kind-consult: #3d85e0;
    --kind-lesson: #1aa38f;
    --kind-other: #8d6fe0;
    --good: #2fc02f;
    --good-ink: #5ad65a;
    --warning: #f0b429;
    --warning-ink: #f5c95c;
    --serious: #f07f55;
    --serious-ink: #f59a78;
    --critical: #e05252;
    --critical-ink: #f07a7a;
    --tooltip-bg: #f6f2f3;
    --tooltip-ink: #121012;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
    --shadow-md: 0 8px 20px rgba(0, 0, 0, 0.45), 0 2px 4px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 24px 64px rgba(0, 0, 0, 0.6), 0 4px 12px rgba(0, 0, 0, 0.4);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #121012;
  --surface: #1c191b;
  --surface-2: #262224;
  --surface-3: #312b2e;
  --ink: #f6f2f3;
  --ink-2: #c9c0c4;
  --muted: #8f868a;
  --grid: #2d282b;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.18);
  --accent: #cf3d78;
  --accent-hover: #da4f87;
  --accent-ink: #f08ab5;
  --accent-wash: rgba(207, 61, 120, 0.18);
  --accent-wash-2: rgba(207, 61, 120, 0.3);
  --series-1: #e8769f;
  --series-track: #3a2530;
  --kind-makeup: #cf3d78;
  --kind-consult: #3d85e0;
  --kind-lesson: #1aa38f;
  --kind-other: #8d6fe0;
  --good: #2fc02f;
  --good-ink: #5ad65a;
  --warning: #f0b429;
  --warning-ink: #f5c95c;
  --serious: #f07f55;
  --serious-ink: #f59a78;
  --critical: #e05252;
  --critical-ink: #f07a7a;
  --tooltip-bg: #f6f2f3;
  --tooltip-ink: #121012;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 8px 20px rgba(0, 0, 0, 0.45), 0 2px 4px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 24px 64px rgba(0, 0, 0, 0.6), 0 4px 12px rgba(0, 0, 0, 0.4);
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
html, body, #root { height: 100%; }
body {
  margin: 0;
  font: 14.5px/1.5 var(--font);
  color: var(--ink);
  background: var(--page);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, p { margin: 0; }
h1 { font: 650 28px/1.15 var(--font-display); letter-spacing: -0.02em; }
h2 { font: 620 16px/1.3 var(--font-display); letter-spacing: -0.01em; }
h3 { font: 600 15px/1.3 var(--font-display); }
a { color: var(--accent-ink); }
button { font-family: inherit; }
kbd { font: 11px/1 var(--font); background: var(--surface-2); border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 5px; padding: 3px 5px; color: var(--ink-2); }
code { font: 12.5px ui-monospace, Consolas, "Cascadia Mono", monospace; background: var(--surface-2); padding: 1px 5px; border-radius: 5px; }
::selection { background: var(--accent-wash-2); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.mono { font-family: ui-monospace, Consolas, "Cascadia Mono", monospace; font-size: 12.5px; word-break: break-all; }
.num { font-variant-numeric: tabular-nums; }
.danger-text { color: var(--critical-ink); }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.gap-sm { gap: 6px; }
.spread { justify-content: space-between; }
.mt { margin-top: 12px; }
.mb { margin-bottom: 12px; }
.grow { flex: 1; min-width: 0; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- app shell ---------- */
.app { display: grid; grid-template-columns: 256px minmax(0, 1fr); height: 100%; }
.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 6px;
  padding: 18px 14px 14px;
  min-height: 0;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 2px 6px 14px; min-width: 0; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 12px; flex: none;
  display: grid; place-items: center; color: #fff; font: 700 14px/1 var(--font-display);
  background: linear-gradient(135deg, #d8558a, var(--accent) 60%, #8e2552);
  box-shadow: 0 2px 6px rgba(184, 51, 106, 0.35);
}
.brand-text { min-width: 0; display: flex; flex-direction: column; line-height: 1.2; }
.brand-name { font: 650 15px/1.2 var(--font-display); letter-spacing: -0.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand-sub { font-size: 11.5px; color: var(--muted); }
.new-wrap { position: relative; }
.btn-new { width: 100%; justify-content: center; height: 40px; font-size: 14.5px; }
.btn-new .chev { margin-left: auto; opacity: 0.8; }
.search-trigger {
  display: flex; align-items: center; gap: 9px; width: 100%; height: 38px; padding: 0 10px 0 12px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2);
  color: var(--muted); font: inherit; font-size: 13.5px; cursor: pointer; text-align: left; margin-top: 2px;
}
.search-trigger:hover { border-color: var(--border-strong); color: var(--ink-2); }
.search-trigger .icon { width: 16px; height: 16px; flex: none; }
.search-trigger span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-trigger kbd { flex: none; }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; margin-top: 10px; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  width: 100%; height: 40px; padding: 0 12px;
  border: 0; background: transparent; color: var(--ink-2);
  border-radius: var(--radius-sm); font: inherit; font-weight: 500; cursor: pointer; text-align: left;
  transition: background var(--fast) var(--ease), color var(--fast) var(--ease);
}
.nav-item:hover { background: var(--surface-2); color: var(--ink); }
.nav-item.active { background: var(--accent-wash); color: var(--accent-ink); font-weight: 600; }
.nav-item .icon { width: 19px; height: 19px; flex: none; }
.nav-item .nav-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-badge { background: var(--critical); color: #fff; font-size: 11px; font-weight: 650; border-radius: 999px; padding: 1px 7px; min-width: 20px; text-align: center; line-height: 1.5; }
.nav-badge.soft { background: var(--accent-wash-2); color: var(--accent-ink); }
.sidebar-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 4px 0; color: var(--muted); font-size: 12px; }
.sidebar-foot .status { display: inline-flex; align-items: center; gap: 6px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-foot .status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--good); flex: none; }
.sidebar-foot .status.busy::before { background: var(--warning); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: 0.3; } }
.main { overflow: auto; min-width: 0; scroll-behavior: smooth; }
.page { max-width: 1240px; margin: 0 auto; padding: 32px 40px 72px; display: flex; flex-direction: column; gap: 20px; animation: fade var(--med) var(--ease); }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head p { margin-top: 4px; color: var(--muted); }
.head-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.loading { display: grid; place-items: center; height: 100%; color: var(--muted); text-align: center; padding: 24px; }
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); background: none; border: 0; padding: 0; font: inherit; cursor: pointer; width: fit-content; }
.back:hover { color: var(--ink); }
.back .icon { width: 16px; height: 16px; }

/* dropdown menu */
.menu {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 30;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg);
  padding: 6px; display: flex; flex-direction: column; gap: 2px; min-width: 280px;
  animation: pop var(--fast) var(--ease);
}
.menu-item > span > span:first-child { white-space: nowrap; font-weight: 550; }
.menu.right { left: auto; right: 0; }
.menu-item {
  display: flex; align-items: center; gap: 11px; width: 100%; padding: 9px 10px; border: 0; background: transparent;
  color: var(--ink); font: inherit; cursor: pointer; text-align: left; border-radius: var(--radius-xs);
}
.menu-item:hover, .menu-item:focus-visible { background: var(--surface-2); outline: none; }
.menu-item .icon { width: 18px; height: 18px; color: var(--accent-ink); flex: none; }
.menu-item .menu-hint { display: block; font-size: 12px; color: var(--muted); }
.menu-item.danger { color: var(--critical-ink); }
.menu-item.danger .icon { color: var(--critical-ink); }

/* ---------- cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 22px; box-shadow: var(--shadow-sm); }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.card-head .row { gap: 6px; }
.table-card { padding: 6px 8px 8px; overflow-x: auto; }
.table td.where { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-chevron { margin-left: 10px; opacity: 0.6; }
.table tr.clickable:hover .row-chevron { opacity: 1; color: var(--accent-ink); }
.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.stat {
  position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm);
  padding: 16px 18px; text-align: left; font: inherit; color: inherit;
  display: flex; flex-direction: column; gap: 4px; min-width: 0;
  transition: transform var(--fast) var(--ease), box-shadow var(--fast) var(--ease), border-color var(--fast) var(--ease);
}
.stat.clickable { cursor: pointer; }
.stat.clickable:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.stat-label { font-size: 13px; color: var(--ink-2); font-weight: 500; }
.stat-value { font: 650 28px/1.15 var(--font-display); letter-spacing: -0.02em; }
.stat-sub { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stat-icon { position: absolute; top: 14px; right: 14px; width: 34px; height: 34px; border-radius: 10px; background: var(--accent-wash); color: var(--accent-ink); display: grid; place-items: center; }
.stat-icon .icon { width: 18px; height: 18px; }
.stat-warning .stat-icon { background: rgba(227, 160, 8, 0.16); color: var(--warning-ink); }
.stat-critical .stat-icon { background: rgba(208, 59, 59, 0.14); color: var(--critical-ink); }
.stat-good .stat-icon { background: rgba(12, 163, 12, 0.14); color: var(--good-ink); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.grid-2-wide { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 16px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
@media (max-width: 1000px) { .grid-2, .grid-2-wide { grid-template-columns: 1fr; } }

/* hero (overview) */
.hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.hero h1 { font-size: 32px; }
.hero .date { color: var(--muted); margin-top: 4px; font-size: 15px; }
.today-card { background: linear-gradient(135deg, var(--accent-wash), transparent 60%), var(--surface); }
.today-row { display: grid; grid-template-columns: 72px 1fr auto; gap: 14px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--grid); }
.today-row:last-child { border-bottom: 0; }
.today-time { font: 600 15px/1.2 var(--font-display); font-variant-numeric: tabular-nums; color: var(--accent-ink); }
.checklist { display: flex; flex-direction: column; gap: 4px; }
.check-item { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: var(--radius-sm); border: 0; background: transparent; color: var(--ink); font: inherit; cursor: pointer; text-align: left; width: 100%; }
.check-item:hover { background: var(--surface-2); }
.check-item .circle { width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--border-strong); display: grid; place-items: center; flex: none; color: #fff; }
.check-item.done .circle { background: var(--good); border-color: var(--good); }
.check-item.done span:not(.circle) { color: var(--muted); text-decoration: line-through; }
.check-item .circle .icon { width: 14px; height: 14px; }
.progress { height: 6px; background: var(--surface-3); border-radius: 3px; overflow: hidden; }
.progress > div { height: 100%; background: var(--accent); border-radius: 3px; transition: width var(--med) var(--ease); }

/* ---------- lists and tables ---------- */
.list { display: flex; flex-direction: column; }
.list-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 11px 0; border-bottom: 1px solid var(--grid); }
.list-row:last-child { border-bottom: 0; }
.list-row > div:first-child { min-width: 0; flex: 1; }
.list-row.clickable { cursor: pointer; margin: 0 -10px; padding-left: 10px; padding-right: 10px; border-radius: var(--radius-sm); transition: background var(--fast) var(--ease); }
.list-row.clickable:hover { background: var(--surface-2); }
.row-right { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: none; }
.list-group + .list-group { margin-top: 12px; }
.list-group-title { font-size: 11.5px; font-weight: 650; color: var(--muted); padding: 4px 0 4px; text-transform: uppercase; letter-spacing: 0.07em; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 11.5px; font-weight: 650; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--grid); white-space: nowrap; text-transform: uppercase; letter-spacing: 0.06em; }
.table td { padding: 12px; border-bottom: 1px solid var(--grid); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table .num, .table th.num { text-align: right; white-space: nowrap; }
.table tr.clickable { cursor: pointer; }
.table tr.clickable:hover td { background: var(--surface-2); }
.table tr.clickable td:first-child { border-top-left-radius: 8px; border-bottom-left-radius: 8px; }
.table tr.clickable td:last-child { border-top-right-radius: 8px; border-bottom-right-radius: 8px; }
.cell-title { font-weight: 550; }
.cell-sub { font-size: 12.5px; color: var(--muted); }
.row-muted td { opacity: 0.55; }
.actions { text-align: right; white-space: nowrap; }
.actions .btn + .btn { margin-left: 6px; }
.ext { display: inline-flex; vertical-align: middle; margin-left: 4px; color: var(--muted); }
.ext:hover { color: var(--accent-ink); }
.ext .icon { width: 14px; height: 14px; }
button.ext { background: none; border: 0; padding: 0; cursor: pointer; font: inherit; }

/* ---------- controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  font: inherit; font-weight: 550; height: 36px; padding: 0 14px;
  border-radius: var(--radius-sm); border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--ink); cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background var(--fast) var(--ease), transform var(--fast) var(--ease), box-shadow var(--fast) var(--ease), border-color var(--fast) var(--ease);
}
.btn .icon { width: 16px; height: 16px; }
.btn:hover { background: var(--surface-2); }
.btn:active { transform: scale(0.98); }
.btn:disabled, .btn.disabled { opacity: 0.5; cursor: default; pointer-events: none; }
.btn-primary { background: linear-gradient(180deg, var(--accent-hover), var(--accent)); border-color: transparent; color: var(--on-accent); box-shadow: 0 1px 2px rgba(184, 51, 106, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.12); }
.btn-primary:hover { background: var(--accent-hover); box-shadow: 0 3px 10px rgba(184, 51, 106, 0.35); }
.btn-danger { background: var(--critical); border-color: transparent; color: #fff; }
.btn-danger:hover { background: var(--critical); filter: brightness(1.08); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-sm { height: 30px; padding: 0 11px; font-size: 13px; border-radius: 8px; }
.btn-sm .icon { width: 14px; height: 14px; }
.btn.danger { color: var(--critical-ink); }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.btn-icon { border: 0; background: transparent; font-size: 20px; line-height: 1; cursor: pointer; color: var(--muted); width: 32px; height: 32px; border-radius: 8px; display: inline-grid; place-items: center; transition: background var(--fast) var(--ease), color var(--fast) var(--ease); }
.btn-icon:hover { background: var(--surface-2); color: var(--ink); }
.btn-icon .icon { width: 17px; height: 17px; }
.link { background: none; border: 0; padding: 0; color: var(--accent-ink); cursor: pointer; font: inherit; font-weight: 500; text-decoration: none; }
.link:hover { text-decoration: underline; }
.badge { display: inline-block; font-size: 11px; font-weight: 550; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--border); }
.badge-accent { background: var(--accent-wash); color: var(--accent-ink); border-color: transparent; }
.badges { display: flex; gap: 6px; margin-top: 4px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 550; padding: 3px 10px 3px 8px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); white-space: nowrap; }
.chip-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); flex: none; }
.chip-good { background: rgba(12, 163, 12, 0.12); color: var(--good-ink); }
.chip-good .chip-dot { background: var(--good); }
.chip-warning { background: rgba(227, 160, 8, 0.16); color: var(--warning-ink); }
.chip-warning .chip-dot { background: var(--warning); }
.chip-serious { background: rgba(224, 105, 63, 0.14); color: var(--serious-ink); }
.chip-serious .chip-dot { background: var(--serious); }
.chip-critical { background: rgba(208, 59, 59, 0.12); color: var(--critical-ink); }
.chip-critical .chip-dot { background: var(--critical); }
.chip-accent { background: var(--accent-wash); color: var(--accent-ink); }
.chip-accent .chip-dot { background: var(--accent); }
.chip-makeup .chip-dot { background: var(--kind-makeup); }
.chip-consult .chip-dot { background: var(--kind-consult); }
.chip-lesson .chip-dot { background: var(--kind-lesson); }
.chip-other .chip-dot { background: var(--kind-other); }
.seg { display: inline-flex; background: var(--surface-2); border-radius: var(--radius-sm); padding: 3px; gap: 2px; }
.seg-item { font: inherit; font-weight: 500; border: 0; background: transparent; color: var(--ink-2); padding: 6px 14px; cursor: pointer; border-radius: 8px; transition: background var(--fast) var(--ease), color var(--fast) var(--ease); }
.seg-item:hover { color: var(--ink); }
.seg-item.active { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: var(--shadow-sm); }
input, select, textarea {
  font: inherit; color: var(--ink); background: var(--surface-2);
  border: 1px solid transparent; border-radius: var(--radius-sm);
  height: 38px; padding: 0 12px; width: 100%;
  transition: background var(--fast) var(--ease), border-color var(--fast) var(--ease), box-shadow var(--fast) var(--ease);
}
input::placeholder, textarea::placeholder { color: var(--muted); }
textarea { height: auto; padding: 9px 12px; resize: vertical; line-height: 1.45; }
input:hover, select:hover, textarea:hover { border-color: var(--border-strong); }
input:focus, select:focus, textarea:focus { outline: none; background: var(--surface); border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-wash); }
input:disabled { opacity: 0.6; }
input[type="checkbox"] { accent-color: var(--accent); }
.check { display: flex; align-items: center; gap: 9px; min-height: 38px; cursor: pointer; }
.check input { height: 17px; width: 17px; margin: 0; }
.input-row { display: flex; gap: 8px; align-items: center; }
.input-row > :first-child { flex: 1; }
.search { position: relative; }
.search .icon { position: absolute; left: 12px; top: 11px; width: 16px; height: 16px; color: var(--muted); pointer-events: none; }
.search input { padding-left: 36px; }
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.toolbar .search { flex: 1 1 240px; max-width: 380px; }
.toolbar select { width: auto; }
.toolbar .count { margin-left: auto; color: var(--muted); font-size: 13px; }
.filter-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.filter-chip { font: inherit; font-size: 13px; font-weight: 500; border: 1px solid var(--border-strong); background: var(--surface); color: var(--ink-2); border-radius: 999px; padding: 5px 13px; cursor: pointer; transition: background var(--fast) var(--ease), color var(--fast) var(--ease), border-color var(--fast) var(--ease); }
.filter-chip:hover { background: var(--surface-2); color: var(--ink); }
.filter-chip.active { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }

/* ---------- forms and modals ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(20, 15, 17, 0.45); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 24px; animation: fadein var(--fast) var(--ease); }
@keyframes fadein { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(0.985); } }
.modal { background: var(--surface); border-radius: var(--radius-lg); width: 600px; max-width: 100%; max-height: 100%; display: flex; flex-direction: column; box-shadow: var(--shadow-lg); border: 1px solid var(--border); animation: pop var(--med) var(--ease); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 22px 10px; gap: 12px; }
.modal-head h2 { font-size: 18px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.modal-body { padding: 6px 22px 18px; overflow: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 22px; border-top: 1px solid var(--grid); flex-wrap: wrap; }
.modal-foot .spacer { flex: 1; }
.modal.confirm { width: 440px; }
.modal.confirm .modal-body { padding: 24px 24px 18px; }
.modal.confirm h2 { font-size: 18px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.form-grid-3 { grid-template-columns: 1fr 1fr 1fr; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.span-2, .field.span-2 { grid-column: span 2; }
.span-3, .field.span-3 { grid-column: 1 / -1; }
.field-label { font-size: 12.5px; color: var(--ink-2); font-weight: 550; }
.field-hint { font-size: 12px; color: var(--muted); line-height: 1.4; }
.form-section { grid-column: 1 / -1; font-size: 11.5px; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: 0.07em; margin-top: 8px; padding-top: 14px; border-top: 1px solid var(--grid); }
.notice { background: var(--accent-wash); border-radius: var(--radius-sm); padding: 11px 14px; font-size: 13.5px; }
.notice.error { background: rgba(208, 59, 59, 0.12); color: var(--critical-ink); }
.notice.warn { background: rgba(227, 160, 8, 0.16); }
.notice.ok { background: rgba(12, 163, 12, 0.12); }
.kv { display: grid; grid-template-columns: 120px 1fr; gap: 8px 14px; font-size: 13.5px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.kv.compact { grid-template-columns: 100px 1fr; }
.empty { text-align: center; padding: 40px 20px; color: var(--ink-2); }
.empty h3 { margin-bottom: 6px; color: var(--ink); font-size: 17px; }
.empty p { max-width: 460px; margin: 0 auto; }
.empty .btn { margin-top: 16px; }
.empty .row { justify-content: center; margin-top: 16px; }
.empty .row .btn { margin-top: 0; }
.welcome-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 24px; }
.welcome-item { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.welcome-item p { flex: 1; }
.welcome-item .step { width: 30px; height: 30px; border-radius: 10px; background: var(--accent-wash); color: var(--accent-ink); display: grid; place-items: center; }
.welcome-item .step .icon { width: 16px; height: 16px; }
.settings .card { max-width: 880px; }
pre.preview { background: var(--surface-2); border-radius: var(--radius-sm); padding: 14px 16px; font: 13px/1.55 var(--font); white-space: pre-wrap; overflow-wrap: anywhere; max-height: 320px; overflow: auto; margin: 0; }
.detected { display: flex; flex-wrap: wrap; gap: 6px; }
.detected .chip { background: var(--accent-wash); color: var(--ink); }
.detected .chip b { font-weight: 600; color: var(--accent-ink); }
.raw-text { font-size: 12.5px; color: var(--ink-2); background: var(--surface-2); border-radius: var(--radius-sm); padding: 10px 12px; white-space: pre-wrap; max-height: 160px; overflow: auto; }
details.fold summary { cursor: pointer; color: var(--muted); font-size: 12.5px; }
.picker { position: relative; }
.picker-menu { position: absolute; left: 0; right: 0; top: 100%; z-index: 5; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); margin-top: 6px; max-height: 240px; overflow: auto; padding: 4px; animation: pop var(--fast) var(--ease); }
.picker-item { display: flex; justify-content: space-between; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; background: transparent; color: var(--ink); font: inherit; cursor: pointer; text-align: left; border-radius: var(--radius-xs); }
.picker-item:hover, .picker-item.active { background: var(--surface-2); }
.picker-item .cell-sub { white-space: nowrap; }
.selected-client { display: flex; align-items: center; gap: 10px; height: 44px; padding: 0 6px 0 6px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--accent-wash); }
.selected-client span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 550; }

/* ---------- avatars and product imagery ---------- */
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--accent-wash); color: var(--accent-ink); display: inline-grid; place-items: center; font: 650 12.5px/1 var(--font-display); flex: none; letter-spacing: 0.02em; }
.avatar.lg { width: 64px; height: 64px; font-size: 22px; background: linear-gradient(135deg, var(--accent-wash-2), var(--accent-wash)); }
.thumb { width: 46px; height: 46px; border-radius: 10px; object-fit: cover; background: var(--surface-2); flex: none; display: grid; place-items: center; font-size: 11px; font-weight: 650; color: #fff; overflow: hidden; }
.thumb.sm { width: 32px; height: 32px; border-radius: 8px; font-size: 10px; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ---------- product catalog ---------- */
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(208px, 1fr)); gap: 16px; }
.product-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden;
  display: flex; flex-direction: column; position: relative; box-shadow: var(--shadow-sm);
  transition: transform var(--med) var(--ease), box-shadow var(--med) var(--ease), border-color var(--med) var(--ease);
}
.product-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.product-card.inactive { opacity: 0.55; }
.product-img { aspect-ratio: 1 / 1; background: var(--surface-2); display: grid; place-items: center; position: relative; overflow: hidden; }
.product-img img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform var(--med) var(--ease); }
.product-card:hover .product-img img { transform: scale(1.04); }
.product-img .ph { width: 100%; height: 100%; display: grid; place-items: center; font: 700 30px/1 var(--font-display); color: #fff; letter-spacing: 0.02em; }
.product-body { padding: 12px 14px 10px; display: flex; flex-direction: column; gap: 3px; flex: 1; }
.product-brand { font-size: 11px; font-weight: 650; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.product-name { font-weight: 550; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.product-meta { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: auto; padding-top: 8px; font-size: 13px; color: var(--ink-2); }
.product-meta .price { font-weight: 600; color: var(--ink); }
.product-actions { display: flex; gap: 6px; padding: 0 14px 14px; }
.product-actions .btn { flex: 1; }
.product-edit { position: absolute; top: 10px; right: 10px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; width: 30px; height: 30px; display: grid; place-items: center; color: var(--ink-2); cursor: pointer; opacity: 0; transition: opacity var(--fast) var(--ease); box-shadow: var(--shadow-sm); }
.product-card:hover .product-edit, .product-edit:focus-visible { opacity: 1; }
.product-edit .icon { width: 15px; height: 15px; }
.product-added { position: absolute; top: 10px; left: 10px; background: var(--good); color: #fff; font-size: 11px; font-weight: 650; border-radius: 999px; padding: 3px 9px 3px 7px; display: inline-flex; align-items: center; gap: 4px; box-shadow: var(--shadow-sm); }
.product-added .icon { width: 12px; height: 12px; }
.consult-bar {
  position: sticky; bottom: 18px; z-index: 20; margin: 8px auto 0; width: fit-content; max-width: 100%;
  display: flex; align-items: center; gap: 14px; padding: 10px 12px 10px 14px;
  background: var(--tooltip-bg); color: var(--tooltip-ink); border-radius: 999px; box-shadow: var(--shadow-lg);
  animation: pop var(--med) var(--ease);
}
.consult-bar .avatar { background: rgba(255, 255, 255, 0.18); color: inherit; }
:root[data-theme="dark"] .consult-bar .avatar, :root:not([data-theme="light"]) .consult-bar .avatar { background: rgba(0, 0, 0, 0.1); }
.consult-bar .text { font-size: 14px; }
.consult-bar .text strong { font-weight: 650; }
.consult-bar .text .muted { opacity: 0.7; color: inherit; }
.consult-bar .btn { background: var(--tooltip-ink); color: var(--tooltip-bg); border-color: transparent; height: 34px; }
.consult-bar .btn-ghost { background: transparent; color: inherit; border-color: rgba(128, 128, 128, 0.4); }

/* ---------- recommendation rows ---------- */
.rec-row { display: grid; grid-template-columns: 46px 1fr auto; gap: 14px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--grid); }
.rec-row:last-child { border-bottom: 0; }
.rec-row .cell-sub { overflow-wrap: anywhere; }
.rec-actions { display: flex; gap: 2px; opacity: 0.55; transition: opacity var(--fast) var(--ease); }
.rec-row:hover .rec-actions { opacity: 1; }
.rec-shade { display: inline-block; background: var(--accent-wash); color: var(--accent-ink); font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 999px; margin-left: 6px; vertical-align: middle; }

/* ---------- calendar ---------- */
.cal-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
@media (max-width: 1000px) { .cal-layout { grid-template-columns: 1fr; } }
.cal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.cal-head h2 { font-size: 19px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; container-type: inline-size; }
@container (max-width: 620px) { .cal-ev .ev-time { display: none; } }
.cal-dow { font-size: 11.5px; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; text-align: center; padding: 4px 0 8px; }
.cal-cell { min-height: 100px; border: 1px solid transparent; border-radius: 12px; padding: 7px; background: var(--surface-2); text-align: left; font: inherit; color: inherit; cursor: pointer; display: flex; flex-direction: column; gap: 3px; min-width: 0; transition: background var(--fast) var(--ease), border-color var(--fast) var(--ease); }
.cal-cell:hover { background: var(--surface-3); }
.cal-cell.other { background: transparent; color: var(--muted); }
.cal-cell.other:hover { background: var(--surface-2); }
.cal-cell.today .cal-day { background: var(--accent); color: var(--on-accent); }
.cal-cell.selected { border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 3px var(--accent-wash); }
.cal-day { font-size: 12.5px; font-weight: 650; width: 24px; height: 24px; border-radius: 50%; display: inline-grid; place-items: center; margin-bottom: 2px; }
.cal-ev { font-size: 11.5px; font-weight: 500; line-height: 1.35; padding: 2px 7px; border-radius: 6px; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border-left: 3px solid var(--kind-other); background: color-mix(in oklab, var(--kind-other) 14%, transparent); }
.cal-ev.makeup { border-left-color: var(--kind-makeup); background: color-mix(in oklab, var(--kind-makeup) 14%, transparent); }
.cal-ev.consult { border-left-color: var(--kind-consult); background: color-mix(in oklab, var(--kind-consult) 14%, transparent); }
.cal-ev.lesson { border-left-color: var(--kind-lesson); background: color-mix(in oklab, var(--kind-lesson) 14%, transparent); }
.cal-ev.done, .cal-ev.cancelled { opacity: 0.5; text-decoration: line-through; }
.cal-more { font-size: 11px; color: var(--muted); padding-left: 7px; }
.cal-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); margin-top: 12px; }
.cal-legend span::before { content: ""; display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 6px; background: var(--kind-other); vertical-align: middle; }
.cal-legend .makeup::before { background: var(--kind-makeup); }
.cal-legend .consult::before { background: var(--kind-consult); }
.cal-legend .lesson::before { background: var(--kind-lesson); }
.day-panel .list-row { align-items: flex-start; }
.time-col { width: 68px; flex: none; font-variant-numeric: tabular-nums; color: var(--accent-ink); font-weight: 600; font-size: 13.5px; padding-top: 1px; }

/* ---------- client header ---------- */
.client-head { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.client-head h1 { margin-bottom: 2px; }
.contact-line { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13.5px; color: var(--ink-2); }
.contact-line a { color: inherit; text-decoration: none; display: inline-flex; align-items: center; gap: 5px; }
.contact-line a:hover { color: var(--accent-ink); }
.contact-line .icon { width: 14px; height: 14px; color: var(--muted); }
.profile-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }

/* ---------- payments ---------- */
.pay-list { display: flex; flex-direction: column; }
.pay-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--grid); font-size: 13.5px; }
.pay-row:last-child { border-bottom: 0; }
.money-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.money-summary .stat { padding: 12px 14px; box-shadow: none; background: var(--surface-2); border-color: transparent; }
.money-summary .stat-value { font-size: 20px; }
.money-summary .stat-warning { background: rgba(227, 160, 8, 0.12); }

/* ---------- services editor ---------- */
.svc-table td, .svc-table th { padding: 5px 4px; }
.svc-table input, .svc-table select { height: 34px; }

/* ---------- bar list (single series) ---------- */
.bar-list { display: flex; flex-direction: column; gap: 10px; }
.bar-row { display: grid; grid-template-columns: minmax(48px, 70px) 1fr 96px; align-items: center; gap: 12px; font-size: 13.5px; position: relative; padding: 2px 0; border-radius: 6px; }
.bar-row:hover { background: var(--surface-2); }
.bar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); padding-left: 4px; }
.bar-track { height: 16px; background: var(--series-track); border-radius: 0 4px 4px 0; }
.bar-fill { height: 16px; background: var(--series-1); border-radius: 0 4px 4px 0; min-width: 2px; transition: width var(--med) var(--ease); }
.bar-fill.zero { min-width: 0; }
.bar-value { text-align: right; font-variant-numeric: tabular-nums; color: var(--ink-2); padding-right: 4px; }
.bar-row.current .bar-label { color: var(--ink); font-weight: 600; }
.tooltip { position: absolute; pointer-events: none; z-index: 5; background: var(--tooltip-bg); color: var(--tooltip-ink); font-size: 12px; padding: 5px 9px; border-radius: 7px; white-space: nowrap; transform: translate(-50%, -100%); box-shadow: var(--shadow-md); }

/* ---------- command palette ---------- */
.palette-backdrop { align-items: flex-start; padding-top: 12vh; }
.palette { width: 660px; max-width: 100%; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); overflow: hidden; animation: pop var(--med) var(--ease); display: flex; flex-direction: column; max-height: 70vh; }
.palette-input { display: flex; align-items: center; gap: 12px; padding: 6px 16px; border-bottom: 1px solid var(--grid); }
.palette-input .icon { width: 20px; height: 20px; color: var(--muted); flex: none; }
.palette-input input { height: 52px; background: transparent; border: 0; box-shadow: none; padding: 0; font-size: 16px; }
.palette-input input:focus { background: transparent; border: 0; box-shadow: none; }
.palette-list { overflow: auto; padding: 8px; }
.palette-group { font-size: 11px; font-weight: 650; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); padding: 10px 10px 6px; }
.palette-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 8px 10px; border: 0; background: transparent; color: var(--ink); font: inherit; cursor: pointer; text-align: left; border-radius: var(--radius-sm); }
.palette-item.active { background: var(--accent-wash); }
.palette-icon { width: 34px; height: 34px; border-radius: 10px; background: var(--surface-2); color: var(--accent-ink); display: grid; place-items: center; flex: none; }
.palette-icon .icon { width: 17px; height: 17px; }
.palette-main { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.palette-main > span:first-child { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette-hint { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette-go { color: var(--muted); opacity: 0; }
.palette-item.active .palette-go { opacity: 1; }
.palette-go .icon { width: 16px; height: 16px; }
.palette-empty { padding: 28px; text-align: center; color: var(--muted); }
.palette-foot { display: flex; gap: 18px; padding: 10px 16px; border-top: 1px solid var(--grid); font-size: 12px; color: var(--muted); }
.palette-foot kbd { margin-right: 3px; }

/* ---------- printable sheet ---------- */
.sheet-wrap { max-width: 760px; margin: 0 auto; padding: 28px 32px 56px; }
.sheet { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 40px 44px; box-shadow: var(--shadow-sm); }
.sheet-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; border-bottom: 2px solid var(--accent); padding-bottom: 16px; margin-bottom: 20px; }
.sheet-head h1 { font-size: 24px; }
.sheet-intro, .sheet-outro { white-space: pre-line; color: var(--ink-2); }
.sheet h3 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin: 22px 0 8px; }
.sheet-item { display: grid; grid-template-columns: 56px 1fr; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--grid); }
.sheet-item.no-img { grid-template-columns: 1fr; }
.sheet-item a { word-break: break-all; font-size: 12.5px; }
.sheet-tools { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 14px; }
@media print {
  .sheet-tools, .sidebar, .toasts, .consult-bar { display: none !important; }
  .sheet-wrap { padding: 0; max-width: none; }
  .sheet { border: 0; padding: 0; box-shadow: none; }
  body { background: #fff; color: #000; }
  .app { display: block; }
  .main { overflow: visible; }
}

/* ---------- toasts ---------- */
.toasts { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 8px; z-index: 100; pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 14px; background: var(--tooltip-bg); color: var(--tooltip-ink); padding: 11px 16px; border-radius: 999px; font-size: 13.5px; font-weight: 500; box-shadow: var(--shadow-lg); max-width: min(560px, calc(100vw - 32px)); animation: toastin var(--med) var(--ease); }
@keyframes toastin { from { opacity: 0; transform: translateY(12px); } }
.toast.error { background: var(--critical); color: #fff; }
.toast-action { font: inherit; font-weight: 650; background: transparent; border: 0; color: inherit; cursor: pointer; padding: 4px 8px; margin: -4px -6px -4px 0; border-radius: 999px; text-decoration: underline; text-underline-offset: 2px; }
.toast-action:hover { background: rgba(128, 128, 128, 0.2); }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .app { grid-template-columns: 76px minmax(0, 1fr); }
  .sidebar { padding: 16px 10px 12px; align-items: stretch; }
  .brand { justify-content: center; padding: 2px 0 12px; }
  .brand-text, .nav-label, .nav-badge.soft, .search-trigger span, .search-trigger kbd, .btn-new .label, .btn-new .chev, .sidebar-foot .status { display: none; }
  .btn-new { padding: 0; }
  .search-trigger { justify-content: center; padding: 0; }
  .nav-item { justify-content: center; padding: 0; position: relative; }
  .nav-item .nav-badge { position: absolute; top: 4px; right: 8px; }
  .menu { left: 0; right: auto; }
  .sidebar-foot { justify-content: center; }
  .page { padding: 28px 28px 72px; }
}
@media (max-width: 720px) {
  .app { grid-template-columns: 1fr; grid-template-rows: 1fr auto; }
  .sidebar { order: 2; flex-direction: row; align-items: center; justify-content: space-around; padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); border-right: 0; border-top: 1px solid var(--border); gap: 0; }
  .brand, .new-wrap, .search-trigger, .sidebar-foot { display: none; }
  .sidebar nav { flex-direction: row; margin: 0; width: 100%; justify-content: space-around; }
  .nav-item { flex-direction: column; gap: 3px; height: 52px; font-size: 10.5px; font-weight: 500; padding: 4px 6px; }
  .nav-label { display: block !important; }
  .nav-item .icon { width: 20px; height: 20px; }
  .nav-item .nav-badge { top: 2px; right: 4px; }
  .main { order: 1; }
  .page { padding: 20px 16px 24px; }
  .hero h1 { font-size: 26px; }
  .form-grid, .form-grid-3 { grid-template-columns: 1fr; }
  .span-2, .field.span-2, .form-section { grid-column: span 1; }
  .cal-cell { min-height: 60px; }
  .cal-ev, .cal-more { display: none; }
  .money-summary { grid-template-columns: 1fr; }
  .sheet { padding: 20px; }
  .modal-backdrop { padding: 12px; align-items: flex-end; }
  .modal { max-height: 92vh; }
  .fab { position: fixed; right: 18px; bottom: 76px; z-index: 25; width: 56px; height: 56px; border-radius: 18px; display: grid; place-items: center; box-shadow: var(--shadow-lg); }
  .fab .icon { width: 24px; height: 24px; }
}
@media (min-width: 721px) { .fab { display: none; } }

@media (max-width: 1000px) and (min-width: 861px) { .hide-md { display: none !important; } }

/* tables become cards on narrow screens */
@media (max-width: 860px) {
  .table.responsive thead { display: none; }
  .table.responsive, .table.responsive tbody, .table.responsive tr, .table.responsive td { display: block; }
  .table.responsive tr { padding: 10px 6px; border-bottom: 1px solid var(--grid); }
  .table.responsive tr:last-child { border-bottom: 0; }
  .table.responsive td { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 4px 6px; border: 0; text-align: left !important; }
  .table.responsive td::before { content: attr(data-label); color: var(--muted); font-size: 12px; flex: none; }
  .table.responsive td:not([data-label])::before { content: none; }
  .table.responsive td.actions { justify-content: flex-end; }
}

/* ---------- texts page ---------- */
.status-strip { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13.5px; padding: 10px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); flex: none; }
.status-dot.ok { background: var(--good); box-shadow: 0 0 0 3px rgba(12, 163, 12, 0.15); }
.status-dot.warn { background: var(--warning); box-shadow: 0 0 0 3px rgba(227, 160, 8, 0.18); }
.text-list { display: flex; flex-direction: column; gap: 12px; }
.text-card { display: flex; flex-direction: column; gap: 10px; padding: 16px 18px; transition: box-shadow var(--med) var(--ease), border-color var(--med) var(--ease); }
.text-card.highlight { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-wash); }
.text-card.muted-card { opacity: 0.6; }
.text-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.avatar.you { background: var(--surface-2); color: var(--ink-2); }
.avatar.you .icon { width: 16px; height: 16px; }
.text-body { margin: 0; padding: 10px 14px; background: var(--surface-2); border-radius: 4px 14px 14px 14px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; line-height: 1.5; max-width: 680px; }
.text-summary { display: flex; align-items: flex-start; gap: 8px; font-size: 13.5px; color: var(--ink); }
.text-summary .icon { width: 16px; height: 16px; color: var(--accent-ink); flex: none; margin-top: 2px; }
.text-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.text-actions .spacer { flex: 1; }
.replies { display: flex; flex-direction: column; gap: 6px; }
.replies .preview { max-height: 200px; }
.try-result { border-top: 1px solid var(--grid); padding-top: 14px; }

/* ---------- settings: texts and Google ---------- */
.setup-steps { margin: 4px 0 0; padding-left: 0; list-style: none; counter-reset: step; display: flex; flex-direction: column; gap: 14px; }
.setup-steps > li { counter-increment: step; position: relative; padding-left: 40px; display: flex; flex-direction: column; gap: 8px; }
.setup-steps > li::before { content: counter(step); position: absolute; left: 0; top: -2px; width: 26px; height: 26px; border-radius: 50%; background: var(--accent-wash); color: var(--accent-ink); font-weight: 650; font-size: 13px; display: grid; place-items: center; }
.setup-steps .mono { color: var(--muted); }
.choice-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.choice { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); cursor: pointer; transition: background var(--fast) var(--ease), border-color var(--fast) var(--ease); }
.choice:hover { background: var(--surface-2); }
.choice.selected { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.choice input { margin: 3px 0 0; width: 16px; height: 16px; flex: none; accent-color: var(--accent); }
.choice .badge { margin-left: 4px; vertical-align: 1px; }
@media (max-width: 640px) { .choice-grid { grid-template-columns: 1fr; } }
.toggle-list { display: flex; flex-direction: column; }
.toggle-row { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--grid); cursor: pointer; }
.toggle-row:last-child { border-bottom: 0; }
input.switch { appearance: none; -webkit-appearance: none; width: 38px; height: 22px; border-radius: 999px; background: var(--surface-3); border: 0; padding: 0; position: relative; cursor: pointer; flex: none; transition: background var(--fast) var(--ease); }
input.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform var(--fast) var(--ease); }
input.switch:checked { background: var(--accent); }
input.switch:checked::after { transform: translateX(16px); }
input.switch:focus { box-shadow: 0 0 0 3px var(--accent-wash); }

/* ---------- sign-in (server version) ---------- */
.login-wrap { min-height: 100%; display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(circle at 20% 10%, var(--accent-wash), transparent 45%), var(--page); }
.login-card { width: 380px; max-width: 100%; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); padding: 28px; display: flex; flex-direction: column; gap: 14px; animation: pop var(--med) var(--ease); }
.login-card h1 { font-size: 24px; }
.login-brand { display: flex; align-items: center; gap: 10px; font: 650 15px/1.2 var(--font-display); color: var(--ink-2); }
.login-btn { height: 42px; margin-top: 4px; }
