/*
 * MHP panels (clinic / backoffice / cabinet) - same visual language as the
 * Django admin skin (core/admin_theme.css), taken from the "Unique UI/UX
 * Design" Figma Make design: Manrope, deep teal-black dark theme with a soft
 * light twin, ONE accent colour per panel, asymmetric corner radii, glowing
 * primary buttons that lift and press.
 *
 * Accent per panel (html[data-panel]): clinic = the clinic's own brand colour
 * (Tenant.brand_color via --tenant-accent), backoffice = indigo, hr = violet,
 * cabinet / guest = teal. Theme: cookie `mht_theme` -> html[data-theme]
 * (system / light / dark), see panel/views.SettingsView.
 *
 * Class names (card, btn, stat-tile, pill, field ...) are shared by every
 * panel template - restyle here, don't fork markup.
 */

:root {
  --font: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-head: var(--font);
  --sidebar-w: 256px;
  --accent: var(--ink);           /* monochrome: accent = ink (black on light, white on dark) */
  --r: 0;                         /* square corners everywhere */
  --r-lg: 0;
  --radius: 0;
  --radius-lg: 0;
}

/* ---- palettes ------------------------------------------------------------ */
:root,
:root[data-theme="dark"] {
  --bg: #0b0b0d; --surface: #1a1a1f; --surface-sunken: #242429; --line: #3a3a42;
  --ink: #f4f4f4; --ink-muted: #a7a7ac; --ink-subtle: #76767c;
  --good: #5ed18c; --good-soft: rgba(94, 209, 140, .12);
  --warn: #e8ad57; --warn-soft: rgba(232, 173, 87, .12);
  --bad: #ff6b7c; --bad-soft: rgba(255, 107, 124, .12);
  --shadow: 0 15px 40px rgba(0, 0, 0, .25);
  --noir-bg: #090909; --noir-surface: #242429; --noir-ink: #f4f4f4; --noir-ink-muted: #a7a7ac; --noir-line: #3a3a42;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #e9e9ea; --surface: #ffffff; --surface-sunken: #ededee; --line: #cfcfd2;
  --ink: #111111; --ink-muted: #5c5c60; --ink-subtle: #86868b;
  --good: #2f9d5f; --good-soft: rgba(47, 157, 95, .12);
  --warn: #b8791c; --warn-soft: rgba(184, 121, 28, .12);
  --bad: #d4455a; --bad-soft: rgba(212, 69, 90, .10);
  --shadow: 0 15px 40px rgba(17, 17, 17, .10);
  --noir-bg: #ffffff; --noir-surface: #ededee; --noir-ink: #111111; --noir-ink-muted: #5c5c60; --noir-line: #cfcfd2;
  color-scheme: light;
}
@media (prefers-color-scheme: light) {
  :root[data-theme="system"] {
    --bg: #e9e9ea; --surface: #ffffff; --surface-sunken: #ededee; --line: #cfcfd2;
    --ink: #111111; --ink-muted: #5c5c60; --ink-subtle: #86868b;
    --good: #2f9d5f; --good-soft: rgba(47, 157, 95, .12);
    --warn: #b8791c; --warn-soft: rgba(184, 121, 28, .12);
    --bad: #d4455a; --bad-soft: rgba(212, 69, 90, .10);
    --shadow: 0 15px 40px rgba(23, 32, 31, .10);
    --noir-bg: #fbfcf9; --noir-surface: #f3f6f2; --noir-ink: #17201f; --noir-ink-muted: #697875; --noir-line: #dce3de;
    color-scheme: light;
  }
}

/* ---- one accent per panel ------------------------------------------------ */
html[data-panel="clinic"]     { --accent: var(--ink); }
html[data-panel="backoffice"] { --accent: var(--ink); }
html[data-panel="hr"]         { --accent: var(--ink); }
html[data-panel="cabinet"], html[data-panel="guest"] { --accent: var(--ink); }
:root {
  --accent-rgb: 120, 120, 120;
  --on-accent: var(--bg);
  --accent-soft: color-mix(in srgb, var(--accent) 12%, var(--surface));
  --accent-ink: var(--accent);
}
/* rgb() form of --accent for glows: derive from the colour itself so tenant colours work */
:root { --glow: color-mix(in srgb, var(--accent) 22%, transparent); --glow-strong: color-mix(in srgb, var(--accent) 34%, transparent); }
:root[data-theme="light"] { --accent-ink: color-mix(in srgb, var(--accent) 52%, #0b1512); }
@media (prefers-color-scheme: light) {
  :root[data-theme="system"] { --accent-ink: color-mix(in srgb, var(--accent) 52%, #0b1512); }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: background .25s, color .25s;
}

.mono { font-family: "IBM Plex Mono", ui-monospace, monospace; }
a { color: var(--accent-ink); text-underline-offset: 3px; }
a:hover { color: var(--ink); }
h1, h2, h3 { font-family: var(--font); letter-spacing: -.03em; }

/* ---- auth screens (login / register / otp) ------------------------------ */
.auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(900px 480px at 15% -10%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 60%),
    radial-gradient(700px 420px at 100% 110%, color-mix(in srgb, var(--accent) 10%, transparent), transparent 60%),
    var(--bg);
}
.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 34px 30px;
  box-shadow: var(--shadow);
}
.auth-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-muted);
  margin-bottom: 20px;
}
.auth-brand::before {
  content: "M";
  width: 34px; height: 34px; display: grid; place-items: center; flex: none;
  border-radius: 0; color: var(--on-accent); background: var(--accent);
  box-shadow: 0 8px 22px var(--glow), inset 0 1px rgba(255, 255, 255, .28);
  font-size: 16px; font-weight: 800;
}
.auth-card h1 { font-size: 26px; line-height: 1.15; margin: 0 0 22px; font-weight: 800; letter-spacing: -.04em; }

/* ---- app shell (sidebar + content) --------------------------------------- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex: none;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  border-right: 1px solid var(--line);
  padding: 18px 12px 0;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.sidebar > * { flex-shrink: 0; }
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 8px;
  color: var(--ink);
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -.02em;
  line-height: 1.15;
}
.sidebar-brand .mhp-logo { box-shadow: 0 8px 22px var(--glow), inset 0 1px rgba(255, 255, 255, .28); }
.sidebar-brand > span { display: flex; flex-direction: column; min-width: 0; }
.sidebar-brand small {
  display: block; margin-top: 2px; color: var(--ink-muted); font-size: 11px; font-weight: 600; letter-spacing: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.sidebar-nav { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.sidebar-group {
  display: flex; align-items: center; gap: 8px;
  padding: 14px 10px 6px;
  color: var(--accent-ink);
  font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
}
.sidebar-group::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, var(--line), transparent); }
.sidebar-group.nav-fold { cursor: pointer; user-select: none; }
.sidebar-group.nav-fold:hover { color: var(--ink); }
.nav-fold-arrow { order: 3; font-size: 10px; transition: transform .15s; }
.sidebar-group.nav-fold[aria-expanded="false"] .nav-fold-arrow { transform: rotate(-90deg); }
.sidebar-nav a {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  height: 38px;
  padding: 0 12px;
  border-radius: 0;
  color: var(--ink-muted);
  font-size: 13.5px;
  font-weight: 600;
  text-decoration: none;
  transition: background .16s, color .16s;
}
.sidebar-nav a.sub { padding-left: 12px; }
.sidebar-nav a:hover { color: var(--ink); background: var(--surface-sunken); }
.sidebar-nav a.active { color: var(--ink); font-weight: 800; background: color-mix(in srgb, var(--accent) 13%, var(--surface-sunken)); }
.sidebar-nav a.active::before { color: var(--accent-ink); }
.sidebar-nav a.active::after { content: ""; position: absolute; right: 12px; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px var(--glow); }

.sidebar-user {
  position: sticky;
  bottom: 0;
  margin: auto -12px 0;
  padding: 14px 16px;
  border-top: 1px solid var(--line);
  background: var(--surface);
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
}
.sidebar-user { display: flex; align-items: center; gap: 10px; }
.sidebar-user-id { flex: 1; min-width: 0; }
.sidebar-user-id .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user .role { color: var(--ink-muted); font-size: 11.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user form { margin: 0; }

.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.content { width: 100%; max-width: 1360px; padding: 26px 40px 64px; outline: 0; }

.page-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 24px; min-height: 64px; flex-wrap: wrap; }
.page-header h1 { font-size: clamp(24px, 2.6vw, 32px); line-height: 1.12; margin: 0; font-weight: 800; letter-spacing: -.045em; }
.page-header p { color: var(--ink-muted); font-size: 14px; margin: 5px 0 0; }
.page-header > div:first-child { position: relative; padding-left: 18px; }
.page-header > div:first-child::before { content: ""; position: absolute; left: 0; top: 4px; bottom: 4px; width: 4px; border-radius: 0; background: var(--accent); box-shadow: 0 0 18px var(--glow); }

/* ---- primitives ------------------------------------------------------------ */

/* One connected strip, divided by hairlines. */
.stat-row {
  display: flex;
  flex-wrap: wrap;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
  margin-bottom: 22px;
}
.stat-tile { flex: 1 1 170px; padding: 20px 24px; border-right: 1px solid var(--line); }
.stat-tile:last-child { border-right: none; }
a.stat-tile { display: block; color: inherit; text-decoration: none; transition: background .16s; }
a.stat-tile:hover { color: inherit; background: color-mix(in srgb, var(--accent) 6%, transparent); }
.stat-tile .value { font-size: 28px; font-weight: 800; letter-spacing: -.04em; line-height: 1.1; font-variant-numeric: tabular-nums; color: var(--ink); }
.stat-tile .label { color: var(--ink-muted); font-size: 12.5px; margin-top: 6px; }

/* Icon-chip stat cards */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; transition: .2s; }
.stat-card:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); }
.stat-card-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.stat-card-label { font-size: 11px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-muted); }
.stat-icon { width: 30px; height: 30px; border-radius: 0; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.stat-icon.tone-accent { background: var(--accent-soft); color: var(--accent-ink); }
.stat-icon.tone-good { background: var(--good-soft); color: var(--good); }
.stat-icon.tone-warn { background: var(--warn-soft); color: var(--warn); }
.stat-icon.tone-bad { background: var(--bad-soft); color: var(--bad); }
.stat-icon.tone-neutral { background: var(--surface-sunken); color: var(--ink-muted); }
.stat-card-value { font-size: 28px; font-weight: 800; letter-spacing: -.04em; line-height: 1; }
.stat-card-sub { font-size: 12px; color: var(--ink-muted); margin-top: 6px; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
  margin-bottom: 22px;
}
.card-header { min-height: 58px; padding: 12px 22px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card-header h2 { font-size: 16px; font-weight: 800; margin: 0; letter-spacing: -.02em; }
.card-body { padding: 22px; }

table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { text-align: left; padding: 14px 22px; border-bottom: 1px solid var(--line); vertical-align: middle; }
thead th { padding-top: 0; padding-bottom: 0; height: 40px; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-subtle); background: var(--surface-sunken); }
td { color: var(--ink-muted); }
td a { font-weight: 700; }
td strong { color: var(--ink); font-weight: 700; }
tbody tr { transition: background .16s; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: color-mix(in srgb, var(--accent) 5%, transparent); }
.table-empty { padding: 32px 20px; text-align: center; color: var(--ink-subtle); font-size: 14px; }
.card > table { display: table; }

.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 700; padding: 4px 11px; border-radius: 0; white-space: nowrap; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.good { background: var(--good-soft); color: var(--good); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.neutral { background: var(--surface-sunken); color: var(--ink-muted); }

/* buttons: secondary by default, the accent fill + glow is the page's one primary action */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 40px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-muted);
  font: 700 13px/1 var(--font);
  padding: 0 18px;
  border-radius: var(--r);
  cursor: pointer;
  text-decoration: none;
  transition: .2s;
}
.btn:hover { color: var(--ink); border-color: var(--ink-subtle); background: var(--surface-sunken); transform: translateY(-1px); }
.btn:active { transform: translateY(1px) scale(.98); }
.btn.primary { border-color: transparent; background: var(--accent); color: var(--on-accent); box-shadow: 0 8px 24px var(--glow), inset 0 1px rgba(255, 255, 255, .25); }
.btn.primary:hover { color: var(--on-accent); background: var(--accent); border-color: transparent; transform: translateY(-1px); box-shadow: 0 10px 26px var(--glow-strong); }
.btn.primary:active { transform: translateY(1px) scale(.98); }
.btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 35%, var(--line)); background: transparent; }
.btn.danger:hover { color: var(--bad); background: var(--bad-soft); border-color: var(--bad); }
.btn { white-space: nowrap; }
.btn.small { height: 32px; padding: 0 13px; font-size: 12px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; transform: none; }

/* ---- forms ------------------------------------------------------------------ */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; align-items: start; }
.field-wide { grid-column: 1 / -1; }
.req { color: var(--bad); }
.field { display: flex; flex-direction: column; gap: 7px; }
.field label { font-size: 12.5px; color: var(--ink-muted); font-weight: 700; }

input[type="text"], input[type="tel"], input[type="email"], input[type="password"], input[type="search"],
input[type="number"], input[type="date"], input[type="time"], input[type="datetime-local"], input[type="url"],
select, textarea, .field input, .field select, .field textarea {
  font: inherit;
  font-size: 14px;
  width: 100%;
  min-width: 0;
  height: 42px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--bg);
  color: var(--ink);
  outline: 0;
  transition: border-color .16s, box-shadow .16s;
}
textarea, .field textarea { height: auto; min-height: 96px; padding: 11px 14px; }
input::placeholder, textarea::placeholder { color: var(--ink-subtle); }
input:focus, select:focus, textarea:focus, .field input:focus, .field select:focus, .field textarea:focus {
  border-color: color-mix(in srgb, var(--accent) 65%, var(--line));
  box-shadow: 0 0 0 3px var(--glow);
}
input[type="radio"], input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent); }

.mini-input {
  font: inherit;
  font-size: 12.5px;
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--bg);
  color: var(--ink);
}

input[type="color"] { width: 54px; height: 40px; padding: 3px; border: 1px solid var(--line); border-radius: 0; background: var(--bg); cursor: pointer; }

/* "+ Добавить X" forms hide behind a button - plain <details>, no JS. */
details.disclosure summary { list-style: none; cursor: pointer; }
details.disclosure summary::-webkit-details-marker { display: none; }
details.disclosure[open] summary { margin-bottom: 16px; }
details.disclosure .card { margin-bottom: 0; }

.priority-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 8px; flex-shrink: 0; }
.priority-dot.good { background: var(--good); }
.priority-dot.warn { background: var(--warn); }
.priority-dot.bad { background: var(--bad); }
.priority-dot.neutral { background: var(--ink-muted); }

.legend { display: flex; align-items: center; gap: 18px; font-size: 12px; color: var(--ink-muted); flex-wrap: wrap; }
.legend-item { display: flex; align-items: center; gap: 6px; }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

.error-text { color: var(--bad); font-size: 13px; margin: 0 0 14px; }
.help-text { color: var(--ink-muted); font-size: 12.5px; margin-top: 4px; }
.note {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink);
  border-radius: var(--r);
  padding: 12px 16px 12px 40px;
  font-size: 13px;
  margin-bottom: 16px;
}
.note::before { content: ""; position: absolute; left: 17px; top: 18px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }

@media (max-width: 860px) {
  .sidebar { position: fixed; z-index: 60; left: 0; top: 0; bottom: 0; width: min(300px, 86vw); height: auto;
    transform: translateX(-102%); transition: transform .24s ease; background: var(--surface); box-shadow: var(--shadow); }
  .nav-open .sidebar { transform: none; }
  .nav-open { overflow: hidden; }
  .sidebar-nav a { height: 44px; }
  .content { padding: 18px 16px 48px; }
  .card { overflow-x: auto; }
  th, td { padding-left: 16px; padding-right: 16px; }
  .page-header { min-height: 0; margin-bottom: 18px; }
  .btn { height: 44px; }
  .btn.small { height: 36px; }
  input[type="text"], input[type="tel"], input[type="email"], input[type="password"], input[type="search"],
  input[type="number"], input[type="date"], input[type="time"], input[type="datetime-local"], input[type="url"],
  select, .field input, .field select { height: 44px; font-size: 16px; } /* 16px: iOS doesn't zoom into the field */
  textarea { font-size: 16px; }
}

/* ---- inbox badge, accent pill, calendar, chart, clinical widgets ---------------------- */
.nav-badge { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; display: inline-grid; place-items: center; border-radius: 0; color: var(--on-accent); background: var(--accent); font-size: 11px; font-weight: 800; }
.sidebar-nav a.active .nav-badge { margin-right: 14px; }
.pill.accent { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent-ink); }
.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 18px; }
.tabs a { display: inline-flex; align-items: center; height: 34px; padding: 0 14px; border: 1px solid var(--line); border-radius: 0; color: var(--ink-muted); font-size: 13px; font-weight: 700; text-decoration: none; }
.tabs a:hover { color: var(--ink); border-color: var(--ink-subtle); }
.tabs a.active { color: var(--on-accent); background: var(--accent); border-color: transparent; }
.chart { width: 100%; max-width: 560px; height: auto; color: var(--ink); }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.cal-grid > div { min-height: 96px; padding: 8px; background: var(--surface); font-size: 12px; }
.cal-grid .cal-head { min-height: 0; padding: 8px; color: var(--ink-subtle); background: var(--surface-sunken); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; text-align: center; }
.cal-grid .cal-today { background: color-mix(in srgb, var(--accent) 8%, var(--surface)); }
.cal-day { font-weight: 800; color: var(--ink); margin-bottom: 4px; }
.cal-item { display: block; margin-top: 3px; padding: 3px 6px; border-radius: 0; font-size: 11.5px; color: var(--ink); background: var(--surface-sunken); border-left: 3px solid var(--ink-subtle); text-decoration: none; }
.cal-item.st-scheduled { border-left-color: var(--ink-muted); }
.cal-item.st-in_progress { border-left-color: var(--accent); }
.cal-item.st-completed { border-left-color: var(--good); }
.cal-item.st-late { border-left-color: var(--warn); }
.cal-item.st-cancelled, .cal-item.st-no_show { border-left-color: var(--bad); opacity: .7; }
.slot-row { display: grid; grid-template-columns: 70px 1fr; gap: 12px; padding: 12px 20px; border-top: 1px solid var(--line); align-items: start; }
.slot-row:first-child { border-top: 0; }
.slot-time { font-weight: 800; font-variant-numeric: tabular-nums; }
.row-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.row-actions form { margin: 0; }
.dental { display: grid; gap: 14px; }
.teeth { display: grid; grid-template-columns: repeat(16, minmax(0, 1fr)); gap: 4px; }
.tooth { display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 10px; color: var(--ink-muted); }
.tooth-btn { width: 100%; max-width: 38px; height: 34px; padding: 0; border: 1px solid var(--line); border-radius: 0; color: var(--ink-subtle); background: var(--bg); font: 800 12px/1 var(--font); cursor: pointer; }
.tooth-btn[data-state="caries"] { color: var(--bad); border-color: var(--bad); background: var(--bad-soft); }
.tooth-btn[data-state="filling"] { color: var(--warn); border-color: var(--warn); background: var(--warn-soft); }
.tooth-btn[data-state="canal"], .tooth-btn[data-state="crown"], .tooth-btn[data-state="implant"] { color: var(--accent-ink); border-color: var(--accent); background: var(--accent-soft); }
.tooth-btn[data-state="missing"] { opacity: .45; }
.tooth-key { width: 12px; height: 12px; border-radius: 0; border: 1px solid var(--line); background: var(--bg); }
.tooth-key.st-caries { background: var(--bad-soft); border-color: var(--bad); }
.tooth-key.st-filling { background: var(--warn-soft); border-color: var(--warn); }
.tooth-key.st-canal, .tooth-key.st-crown, .tooth-key.st-implant { background: var(--accent-soft); border-color: var(--accent); }
.tooth-key.st-missing { opacity: .45; }
.series-table input { height: 34px; padding: 0 8px; font-size: 13px; }
.series-table td { padding: 6px 8px; border: 0; }
.scale-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px 24px; }
.scale-grid .field { flex-direction: row; align-items: center; justify-content: space-between; gap: 12px; }
.scale-grid .field label { flex: 1; }
.scale-grid .field select { width: 72px; flex: none; }
.check-row { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-muted); }
.warn-box { margin-bottom: 14px; padding: 12px 16px; border: 1px solid color-mix(in srgb, var(--warn) 45%, var(--line)); border-radius: var(--r); background: var(--warn-soft); color: var(--ink); font-size: 13px; }
.warn-box ul { margin: 6px 0 0 18px; padding: 0; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 860px) { .split { grid-template-columns: 1fr; } .teeth { grid-template-columns: repeat(8, minmax(0, 1fr)); } .cal-grid > div { min-height: 64px; padding: 4px; } }
.queue-card { display: flex; align-items: center; gap: 16px; padding: 16px 20px; border-top: 1px solid var(--line); }
.queue-card:first-child { border-top: 0; }
.queue-no { width: 46px; height: 46px; display: grid; place-items: center; flex: none; border-radius: 0; color: var(--accent-ink); background: var(--accent-soft); font-size: 18px; font-weight: 800; }
.queue-card .grow { flex: 1; min-width: 0; }
.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px 24px; }
.kv .k { color: var(--ink-subtle); font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.chat { display: flex; flex-direction: column; gap: 8px; max-height: 420px; overflow-y: auto; padding: 4px 2px 12px; }
.bubble { max-width: 76%; padding: 9px 13px; border-radius: 0; background: var(--surface-sunken); font-size: 13.5px; }
.bubble.me { align-self: flex-end; border-radius: 0; background: var(--accent-soft); }
.bubble small { display: block; margin-top: 3px; color: var(--ink-subtle); font-size: 11px; }
.flag-good { color: var(--good); }
.flag-warn { color: var(--warn); }
.flag-bad { color: var(--bad); }

/* ---- staff card (clinic/staff_card.html) ---------------------------------- */
.pc-back { display: inline-block; margin-bottom: 14px; color: var(--ink-muted); font-size: 13px; text-decoration: none; }
.pc-back:hover { color: var(--accent-ink); }
.pc-hero { position: relative; overflow: hidden; display: flex; align-items: center; gap: 22px; flex-wrap: wrap; padding: 28px; margin-bottom: 18px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); }
.pc-hero::after { content: ""; position: absolute; right: -90px; top: -120px; width: 320px; height: 320px; border-radius: 50%;
  border: 1px solid var(--line); pointer-events: none; }
.pc-avatar { position: relative; width: 84px; height: 84px; flex: none; border-radius: 0; display: grid; place-items: center;
  background: var(--surface-sunken); border: 1px solid var(--line); color: var(--accent-ink); font-size: 26px; font-weight: 800; letter-spacing: .02em; }
.pc-dot { position: absolute; right: -4px; bottom: 8px; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--surface); background: var(--ink-subtle); }
.pc-dot-good { background: var(--good); } .pc-dot-warn { background: var(--warn); } .pc-dot-bad { background: var(--bad); }
.pc-id { flex: 1 1 260px; min-width: 0; }
.pc-eyebrow { font-size: 10.5px; font-weight: 800; letter-spacing: .1em; color: var(--accent-ink); text-transform: uppercase; margin-bottom: 4px; }
.pc-id h1 { margin: 0 0 4px; font-size: 28px; font-weight: 700; letter-spacing: -.03em; }
.pc-sub { color: var(--ink-muted); font-size: 13.5px; margin-bottom: 10px; }
.pc-actions { display: flex; gap: 10px; flex-wrap: wrap; position: relative; z-index: 1; }
.pc-actions form { margin: 0; }
.pc-btn-accent { color: var(--accent-ink); border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); background: color-mix(in srgb, var(--accent) 10%, transparent); }
.pc-btn-danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 45%, var(--line)); background: var(--bad-soft); }
.pc-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; align-items: start; }
.pc-main, .pc-side { display: grid; gap: 18px; }
.pc-card { padding: 22px 24px; margin: 0; }
.pc-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding-bottom: 14px; margin-bottom: 16px; border-bottom: 1px solid var(--line); }
.pc-head h2 { margin: 2px 0 0; font-size: 18px; font-weight: 600; letter-spacing: -.02em; }
.pc-headline { display: flex; align-items: center; gap: 12px; }
.pc-kicker { font-size: 10.5px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--accent-ink); }
.pc-num { font-size: 28px; font-weight: 800; color: var(--ink-subtle); opacity: .5; }
.pc-ico { width: 38px; height: 38px; flex: none; border-radius: 0; display: grid; place-items: center; background: var(--surface-sunken); border: 1px solid var(--line); color: var(--accent-ink); }
.pc-link { font-size: 12.5px; color: var(--accent-ink); text-decoration: none; }
.pc-dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 24px; margin: 0; }
.pc-dl dt { font-size: 11.5px; color: var(--ink-subtle); margin-bottom: 4px; }
.pc-dl dd { margin: 0; font-size: 14px; font-weight: 700; overflow-wrap: anywhere; }
.pc-muted { color: var(--ink-muted); font-weight: 500; }
.pc-foot { display: flex; gap: 8px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
.pc-timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.pc-timeline li { display: flex; gap: 12px; align-items: flex-start; }
.pc-timeline i { flex: none; width: 9px; height: 9px; margin-top: 5px; border-radius: 50%; border: 2px solid var(--accent); background: transparent; }
.pc-timeline strong { display: block; font-size: 13.5px; font-weight: 700; }
.pc-timeline span { display: block; font-size: 11.5px; color: var(--ink-subtle); margin-top: 2px; }
.pc-sep { margin: 20px 0 12px; font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-subtle); }
.pc-empty { color: var(--ink-subtle); font-size: 13px; }
.pc-perms, .pc-docs { list-style: none; margin: 0 0 16px; padding: 0; display: grid; gap: 11px; }
.pc-perms li { display: flex; align-items: center; gap: 10px; font-size: 13.5px; }
.pc-perms i { flex: none; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-style: normal; font-size: 12px; font-weight: 800;
  background: var(--good-soft); color: var(--good); }
.pc-perms li.off { color: var(--ink-subtle); text-decoration: line-through; }
.pc-perms li.off i { background: var(--surface-sunken); color: var(--ink-subtle); }
.pc-docs li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding-bottom: 11px; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.pc-docs li:last-child { border-bottom: 0; padding-bottom: 0; }
.pc-docs small { display: block; color: var(--ink-subtle); font-size: 11.5px; margin-top: 2px; }
.pc-docs b { font-size: 10.5px; padding: 3px 8px; border-radius: 0; background: var(--surface-sunken); }
.pc-docs b.bad { color: var(--bad); background: var(--bad-soft); } .pc-docs b.warn { color: var(--warn); background: var(--warn-soft); }
.pc-wide { width: 100%; justify-content: center; text-align: center; }
.staff-link { color: inherit; font-weight: 700; text-decoration: none; border-bottom: 1px dashed var(--ink-subtle); }
.staff-link:hover { color: var(--accent-ink); border-bottom-color: var(--accent); }
@media (max-width: 980px) { .pc-grid { grid-template-columns: 1fr; } }
@media (max-width: 560px) { .pc-dl { grid-template-columns: 1fr; } .pc-hero { padding: 20px; } }

/* ---- shell: top bar, drawer, command palette, toasts (panel/shell.js) ------
 * Patterns from Linear / Stripe Dashboard / Cliniko: a quiet sticky top bar with
 * one search entry point (Ctrl+K) instead of hunting through folded menu groups,
 * the sidebar as a drawer on phones, self-dismissing toasts, visible keyboard focus.
 */
.skip-link { position: fixed; left: 12px; top: -60px; z-index: 100; padding: 10px 16px; border-radius: 0; background: var(--accent); color: var(--on-accent); font-weight: 800; text-decoration: none; }
.skip-link:focus { top: 12px; color: var(--on-accent); }

:where(a, button, summary, [role="button"], [tabindex]):focus-visible,
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sidebar-nav a:focus-visible { outline-offset: -2px; }

.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 12px;
  height: 60px; padding: 0 40px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(10px); backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar .topbar-menu, .topbar .topbar-brand { display: none; }
.topbar-brand { font-weight: 800; font-size: 16px; letter-spacing: -.02em; }
.topbar-actions { display: flex; align-items: center; gap: 6px; margin-left: auto; }

.icon-btn {
  position: relative; flex: none;
  width: 38px; height: 38px; display: inline-grid; place-items: center;
  border: 1px solid transparent; border-radius: 0; background: transparent;
  color: var(--ink-muted); cursor: pointer; text-decoration: none; transition: background .16s, color .16s;
}
.icon-btn:hover { color: var(--ink); background: var(--surface-sunken); border-color: var(--line); }
.icon-btn svg, .cmdk-trigger svg, .cmdk-input svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.dot-badge { position: absolute; top: 3px; right: 2px; min-width: 17px; height: 17px; padding: 0 4px; display: grid; place-items: center; border-radius: 0;
  background: var(--bad); color: #fff; font-size: 10px; font-weight: 800; border: 2px solid var(--bg); box-sizing: content-box; }
[data-theme-toggle] .i-moon { display: none; }
:root[data-theme="light"] [data-theme-toggle] .i-sun { display: none; }
:root[data-theme="light"] [data-theme-toggle] .i-moon { display: block; }
@media (prefers-color-scheme: light) {
  :root[data-theme="system"] [data-theme-toggle] .i-sun { display: none; }
  :root[data-theme="system"] [data-theme-toggle] .i-moon { display: block; }
}

.cmdk-trigger {
  display: flex; align-items: center; gap: 10px;
  width: min(420px, 100%); height: 38px; padding: 0 8px 0 12px;
  border: 1px solid var(--line); border-radius: 0; background: var(--surface);
  color: var(--ink-subtle); font: 600 13px/1 var(--font); cursor: pointer; transition: border-color .16s;
}
.cmdk-trigger:hover { border-color: var(--ink-subtle); color: var(--ink-muted); }
.cmdk-trigger span { flex: 1; text-align: left; }
kbd { display: inline-block; min-width: 20px; padding: 3px 6px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 0;
  background: var(--surface-sunken); color: var(--ink-muted); font: 700 10.5px/1.2 var(--font); text-align: center; }

.avatar { width: 34px; height: 34px; flex: none; display: grid; place-items: center; border-radius: 0;
  background: var(--accent-soft); color: var(--accent-ink); font-size: 14px; font-weight: 800; }

/* command palette */
dialog.cmdk { width: min(600px, calc(100vw - 32px)); max-height: min(560px, calc(100vh - 120px)); margin: 12vh auto auto; padding: 0;
  border: 1px solid var(--line); border-radius: 0; background: var(--surface); color: var(--ink); box-shadow: 0 30px 80px rgba(0, 0, 0, .35); overflow: hidden; }
dialog.cmdk[open] { display: flex; animation: pop .16s ease; }
dialog.cmdk::backdrop { background: rgba(5, 10, 12, .45); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.cmdk-box { display: flex; flex-direction: column; width: 100%; min-height: 0; }
.cmdk-input { display: flex; align-items: center; gap: 10px; padding: 0 16px; border-bottom: 1px solid var(--line); color: var(--ink-subtle); }
.cmdk-input input, .cmdk-input input:focus { flex: 1; height: 56px; padding: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; font-size: 16px; }
.cmdk-list { list-style: none; margin: 0; padding: 8px; overflow-y: auto; min-height: 0; flex: 1; }
.cmdk-item { display: flex; align-items: center; gap: 12px; height: 44px; padding: 0 12px; border-radius: 0; cursor: pointer; color: var(--ink-muted); font-weight: 600; }
.cmdk-item.selected { background: color-mix(in srgb, var(--accent) 13%, var(--surface-sunken)); color: var(--ink); }
.cmdk-ico { width: 17px; height: 17px; flex: none; background: currentColor; -webkit-mask: var(--ico, none) center / contain no-repeat; mask: var(--ico, none) center / contain no-repeat; }
.cmdk-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmdk-group { color: var(--ink-subtle); font-size: 11.5px; font-weight: 700; white-space: nowrap; }
.cmdk-empty { padding: 28px; text-align: center; color: var(--ink-subtle); }
.cmdk-foot { display: flex; gap: 16px; padding: 10px 16px; border-top: 1px solid var(--line); color: var(--ink-subtle); font-size: 11.5px; }
.cmdk-foot kbd { margin-right: 3px; }

/* toasts */
.toast-stack { position: fixed; z-index: 80; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 10px; width: min(400px, calc(100vw - 32px)); }
.toast { display: flex; align-items: flex-start; gap: 12px; padding: 14px 12px 14px 16px; border: 1px solid var(--line); border-radius: 0;
  background: var(--surface); color: var(--ink); box-shadow: var(--shadow); font-size: 13.5px; font-weight: 600; animation: pop .2s ease; transition: opacity .2s, transform .2s; }
.toast.leaving { opacity: 0; transform: translateY(8px); }
.toast-ico { width: 20px; height: 20px; flex: none; margin-top: 1px; border-radius: 50%; background: var(--accent); box-shadow: inset 0 0 0 6px var(--accent-soft); }
.toast.success .toast-ico { background: var(--good); box-shadow: inset 0 0 0 6px var(--good-soft); }
.toast.warning .toast-ico { background: var(--warn); box-shadow: inset 0 0 0 6px var(--warn-soft); }
.toast.error { border-color: color-mix(in srgb, var(--bad) 45%, var(--line)); }
.toast.error .toast-ico { background: var(--bad); box-shadow: inset 0 0 0 6px var(--bad-soft); }
.toast-text { flex: 1; min-width: 0; padding-top: 1px; }
.toast-close { width: 26px; height: 26px; flex: none; margin: -3px 0; border: 0; border-radius: 0; background: transparent; color: var(--ink-subtle); font-size: 18px; line-height: 1; cursor: pointer; }
.toast-close:hover { color: var(--ink); background: var(--surface-sunken); }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(.98); } }

/* loading */
.progress-bar { position: fixed; z-index: 120; left: 0; top: 0; height: 2px; width: 0; background: var(--accent); box-shadow: 0 0 10px var(--accent); opacity: 0; pointer-events: none; }
.progress-bar.on { opacity: 1; width: 85%; transition: width 6s cubic-bezier(.1, .7, .2, 1); }
.btn.is-loading { position: relative; color: transparent !important; pointer-events: none; }
.btn.is-loading::after { content: ""; position: absolute; inset: 0; margin: auto; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid var(--ink-muted); border-right-color: transparent; animation: spin .7s linear infinite; }
.btn.primary.is-loading::after { border-color: var(--on-accent); border-right-color: transparent; }
@keyframes spin { to { transform: rotate(360deg); } }

/* numbers line up in every table */
td, .stat-card-value { font-variant-numeric: tabular-nums; }

/* phones: top bar carries the menu button + brand, search collapses to an icon */
.nav-backdrop { position: fixed; inset: 0; z-index: 55; background: rgba(5, 10, 12, .5); }
@media (max-width: 860px) {
  .topbar { height: 56px; padding: 0 12px; gap: 8px; }
  .topbar .topbar-menu, .topbar .topbar-brand { display: inline-grid; }
  .cmdk-trigger { width: 38px; padding: 0; justify-content: center; margin-left: auto; border-color: transparent; background: transparent; }
  .cmdk-trigger span, .cmdk-trigger kbd { display: none; }
  .topbar-actions { margin-left: 0; }
  .cmdk-foot { display: none; }
  dialog.cmdk { margin-top: 12px; }
  .toast-stack { right: 16px; bottom: 16px; }
}
@media (min-width: 861px) { .nav-backdrop { display: none; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* ---- page-level patterns (phase 2) ------------------------------------------ */

/* breadcrumbs in the top bar: "Клиника › Пациенты" */
.crumbs { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; color: var(--ink-subtle); white-space: nowrap; overflow: hidden; }
.crumbs svg { width: 14px; height: 14px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.crumbs a { color: var(--ink-muted); text-decoration: none; }
.crumbs a:hover { color: var(--ink); }
.crumbs [aria-current] { color: var(--ink); }
.crumbs + .cmdk-trigger { width: min(340px, 40%); }

/* empty states: centred, with a quiet icon, never squeezed into one column */
td.table-empty { padding: 44px 20px; text-align: center; color: var(--ink-muted); font-weight: 600; }
td.table-empty::before {
  content: ""; display: block; width: 44px; height: 44px; margin: 0 auto 12px; border-radius: 0;
  background: var(--surface-sunken) var(--empty-ico) center / 22px no-repeat;
  --empty-ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2378898e' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M22 12h-6l-2 3h-4l-2-3H2'/%3E%3Cpath d='M5.5 5h13l3.5 7v6a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-6z'/%3E%3C/svg%3E");
}
tbody tr:has(> td.table-empty):hover { background: transparent; }

/* pagination */
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: -8px 0 22px; color: var(--ink-muted); font-size: 13px; }
.pager-info { font-variant-numeric: tabular-nums; }
.pager-btns { display: flex; align-items: center; gap: 8px; }
.pager-num { min-width: 52px; text-align: center; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.pager .btn[aria-disabled="true"] { opacity: .45; pointer-events: none; }

/* forms laid out in a row that wrap on narrow screens */
.inline-form { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.inline-form .field { flex: 1 1 200px; margin: 0; }

/* confirm dialog for destructive actions */
dialog.confirm-dlg { width: min(420px, calc(100vw - 32px)); padding: 0; border: 1px solid var(--line); border-radius: 0;
  background: var(--surface); color: var(--ink); box-shadow: 0 30px 80px rgba(0, 0, 0, .35); }
dialog.confirm-dlg[open] { animation: pop .16s ease; }
dialog.confirm-dlg::backdrop { background: rgba(5, 10, 12, .45); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.confirm-body { padding: 26px 24px 20px; } /* padding inside: a click on the dialog box itself = backdrop */
.confirm-ico { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 50%; margin-bottom: 14px; background: var(--bad-soft); color: var(--bad); font-size: 20px; font-weight: 800; }
dialog.confirm-dlg h2 { margin: 0 0 6px; font-size: 18px; font-weight: 800; letter-spacing: -.02em; overflow-wrap: anywhere; }
.confirm-text { margin: 0 0 22px; color: var(--ink-muted); font-size: 13.5px; }
.confirm-btns { display: flex; justify-content: flex-end; gap: 10px; }
.btn.danger-fill { border-color: transparent; background: var(--bad); color: #fff; }
.btn.danger-fill:hover { background: color-mix(in srgb, var(--bad) 88%, #000); color: #fff; border-color: transparent; }

@media (max-width: 860px) {
  .crumbs { display: none; }
  .crumbs + .cmdk-trigger { width: 38px; }
}

/* phones: table rows become cards - first cell is the title, the rest "Подпись · значение" */
@media (max-width: 640px) {
  .card { overflow-x: visible; }
  table.stack, table.stack tbody, table.stack tr, table.stack td { display: block; width: 100%; }
  table.stack thead { display: none; }
  table.stack tr { padding: 14px 16px; border-bottom: 1px solid var(--line); }
  table.stack tbody tr:last-child { border-bottom: 0; }
  table.stack td { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 4px 0; border: 0; text-align: right; }
  table.stack td[data-label]::before { content: attr(data-label); flex: none; max-width: 45%; text-align: left; color: var(--ink-subtle); font: 700 12px/1.4 var(--font); }
  table.stack td:first-child { display: block; padding: 0 0 6px; text-align: left; color: var(--ink); font-size: 14.5px; font-weight: 700; }
  table.stack td:first-child::before { display: none; }
  table.stack td:empty { display: none; }
  table.stack td:not([data-label]) { justify-content: flex-start; text-align: left; }
  table.stack td form, table.stack td .row-actions { margin-top: 6px; }
  table.stack td.table-empty { display: block; text-align: center; padding: 32px 0; color: var(--ink-muted); font-size: 14px; font-weight: 600; }
}


/* ==========================================================================
   MHP design system, layer 2 - "calm clinical".
   Three token layers (primitive -> semantic -> component); the rules below only read the semantic/component tokens, so a
   re-skin means editing this block. Principles: the clinic accent is used for ONE thing per screen (the primary action,
   the current menu item, focus); data is neutral; no glow, no gradients on controls; one corner radius family; sentence
   case instead of tiny shouting capitals; plenty of white space between groups, little inside them.
   ========================================================================== */

/* -- primitive ------------------------------------------------------------- */
:root {
  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px; --space-5: 20px; --space-6: 24px; --space-8: 32px; --space-10: 40px;
  --radius-sm: 8px; --radius-md: 10px; --radius-card: 14px;
  --text-xs: 12px; --text-sm: 13px; --text-base: 14px; --text-lg: 16px; --text-xl: 20px; --text-2xl: 26px;
  --ease: cubic-bezier(.2, .7, .2, 1);
}

/* -- semantic -------------------------------------------------------------- */
:root {
  --text: var(--ink);
  --text-2: var(--ink-muted);
  --text-3: var(--ink-subtle);
  --canvas: var(--bg);
  --panel: var(--surface);
  --panel-2: var(--surface-sunken);
  --border: var(--line);
  --border-strong: color-mix(in srgb, var(--ink) 22%, var(--line));
  --focus: color-mix(in srgb, var(--accent) 70%, transparent);
  --elevation-1: 0 1px 2px rgba(0, 0, 0, .18);
  --elevation-2: 0 8px 28px rgba(0, 0, 0, .22);
}
:root[data-theme="light"] { --elevation-1: 0 1px 2px rgba(23, 32, 31, .08); --elevation-2: 0 8px 28px rgba(23, 32, 31, .10); }
@media (prefers-color-scheme: light) { :root[data-theme="system"] { --elevation-1: 0 1px 2px rgba(23, 32, 31, .08); --elevation-2: 0 8px 28px rgba(23, 32, 31, .10); } }

/* -- component tokens ------------------------------------------------------ */
:root {
  --btn-h: 38px; --btn-h-sm: 30px; --btn-radius: var(--radius-md);
  --input-h: 40px; --input-radius: var(--radius-md);
  --card-radius: var(--radius-card);
  --table-head-h: 38px;
}

/* -- base ------------------------------------------------------------------ */
body { font-size: var(--text-base); letter-spacing: -.003em; }
h1, h2, h3 { letter-spacing: -.02em; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
::selection { background: color-mix(in srgb, var(--accent) 30%, transparent); }
a { color: var(--accent-ink); }
.card a:not(.btn):not(.tab), table a:not(.btn) { color: var(--text); text-decoration-color: var(--border-strong); text-decoration-thickness: 1px; }
.card a:not(.btn):hover, table a:not(.btn):hover { color: var(--accent-ink); text-decoration-color: currentColor; }
td a { font-weight: 600; }

/* -- page header ----------------------------------------------------------- */
.page-header { margin-bottom: var(--space-6); min-height: 0; align-items: flex-end; }
.page-header > div:first-child { padding-left: 0; }
.page-header > div:first-child::before { display: none; }
.page-header h1 { font-size: var(--text-2xl); font-weight: 700; letter-spacing: -.03em; line-height: 1.15; }
.page-header p { color: var(--text-2); font-size: var(--text-base); margin-top: 6px; max-width: 70ch; }

/* -- sidebar --------------------------------------------------------------- */
.sidebar { background: var(--panel); gap: var(--space-4); }
.sidebar-brand::before { box-shadow: none; border-radius: 0; font-weight: 700; }
.auth-brand::before { box-shadow: none; border-radius: 0; }
.sidebar-group { padding: 16px 10px 6px; color: var(--text-3); font-size: 11px; font-weight: 700; letter-spacing: .06em; }
.sidebar-group::after { background: var(--border); opacity: .6; }
.sidebar-group.nav-fold:hover { color: var(--text); }
.sidebar-nav a { height: 36px; border-radius: var(--radius-md); font-size: var(--text-sm); font-weight: 500; color: var(--text-2); }
.sidebar-nav a:hover { background: var(--panel-2); color: var(--text); }
.sidebar-nav a.active { font-weight: 600; color: var(--text); background: color-mix(in srgb, var(--accent) 11%, var(--panel)); box-shadow: inset 2px 0 0 var(--accent); }
.sidebar-nav a.active::after { display: none; }
.sidebar-nav a.active .nav-badge { margin-right: 0; }

/* -- cards, stats ---------------------------------------------------------- */
.card { border-radius: var(--card-radius); box-shadow: var(--elevation-1); }
.card-header { min-height: 54px; padding: 10px var(--space-5); }
.card-header h2 { font-size: 15px; font-weight: 650; letter-spacing: -.01em; }
.card-body { padding: var(--space-5); }
.stat-row { border-radius: var(--card-radius); box-shadow: var(--elevation-1); }
.stat-tile { padding: 18px 22px; }
.stat-tile .value { font-size: 26px; font-weight: 700; letter-spacing: -.03em; }
.stat-tile .label { color: var(--text-2); font-size: var(--text-xs); margin-top: 4px; }
.stat-card { border-radius: var(--card-radius); box-shadow: var(--elevation-1); }
.stat-card:hover { transform: none; border-color: var(--border-strong); }
.stat-card-label { font-size: var(--text-xs); font-weight: 600; letter-spacing: 0; text-transform: none; }
.stat-card-value { font-weight: 700; letter-spacing: -.03em; }
.stat-icon { border-radius: var(--radius-md); }

/* -- tables ---------------------------------------------------------------- */
th, td { padding: 12px var(--space-5); }
thead th { height: var(--table-head-h); font-size: var(--text-xs); font-weight: 600; text-transform: none; letter-spacing: 0; color: var(--text-3); background: transparent; border-bottom: 1px solid var(--border); }
tbody tr:hover { background: color-mix(in srgb, var(--ink) 4%, transparent); }
td { color: var(--text-2); }
td strong, td a { color: var(--text); }
td.mono, .mono { font-variant-numeric: tabular-nums; }
.table-empty { padding: 40px 20px; color: var(--text-3); }

/* -- tags (status pills) --------------------------------------------------- */
.pill { border-radius: 0; font-size: var(--text-xs); font-weight: 600; padding: 3px 9px; gap: 6px; }
.pill::before { width: 6px; height: 6px; }

/* -- buttons: one spec ----------------------------------------------------- */
.btn {
  height: var(--btn-h); padding: 0 var(--space-4); border-radius: var(--btn-radius);
  font: 600 var(--text-sm)/1 var(--font); letter-spacing: 0;
  background: var(--panel); color: var(--text); border: 1px solid var(--border-strong);
  box-shadow: var(--elevation-1);
  transition: background .15s var(--ease), border-color .15s var(--ease), color .15s var(--ease), box-shadow .15s var(--ease), transform .08s var(--ease);
}
.btn:hover { background: var(--panel-2); border-color: color-mix(in srgb, var(--ink) 35%, var(--line)); color: var(--text); transform: none; }
.btn:active { transform: translateY(1px); box-shadow: none; }
.btn.primary { background: var(--accent); color: var(--on-accent); border-color: transparent; box-shadow: var(--elevation-1), inset 0 1px 0 rgba(255, 255, 255, .22); }
.btn.primary:hover { background: color-mix(in srgb, var(--accent) 88%, #fff); color: var(--on-accent); border-color: transparent; transform: none; box-shadow: var(--elevation-1), inset 0 1px 0 rgba(255, 255, 255, .22); }
.btn.primary:active { background: color-mix(in srgb, var(--accent) 88%, #000); }
.btn.danger { background: transparent; color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, var(--border)); box-shadow: none; }
.btn.danger:hover { background: var(--bad-soft); border-color: var(--bad); color: var(--bad); }
.btn.ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--text-2); }
.btn.ghost:hover { background: var(--panel-2); color: var(--text); }
.btn.small { height: var(--btn-h-sm); padding: 0 var(--space-3); font-size: var(--text-xs); border-radius: var(--radius-sm); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .45; box-shadow: none; pointer-events: none; }
.btn.is-loading { position: relative; color: transparent !important; pointer-events: none; }
.btn.is-loading::after { content: ""; position: absolute; width: 14px; height: 14px; border: 2px solid var(--on-accent); border-right-color: transparent; border-radius: 50%; animation: btn-spin .7s linear infinite; }
@keyframes btn-spin { to { transform: rotate(360deg); } }

/* -- forms ----------------------------------------------------------------- */
.field label { font-size: var(--text-xs); font-weight: 600; color: var(--text-2); }
input[type="text"], input[type="tel"], input[type="email"], input[type="password"], input[type="search"],
input[type="number"], input[type="date"], input[type="time"], input[type="datetime-local"], input[type="url"],
select, textarea, .field input, .field select, .field textarea {
  height: var(--input-h); border-radius: var(--input-radius); background: var(--panel-2); border-color: var(--border); font-size: var(--text-base);
}
textarea, .field textarea { height: auto; }
input:hover, select:hover, textarea:hover { border-color: var(--border-strong); }
input:focus, select:focus, textarea:focus, .field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 24%, transparent); background: var(--panel);
}
input[disabled], select[disabled] { opacity: .6; cursor: not-allowed; }
.mini-input { border-radius: var(--radius-sm); }
.tabs a { border-radius: var(--radius-md); font-weight: 600; }
.tabs a.active { background: color-mix(in srgb, var(--accent) 14%, var(--panel)); color: var(--text); border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
.cal-item, .tooth-btn, .tabs a { transition: background .15s var(--ease), border-color .15s var(--ease); }

/* -- notices --------------------------------------------------------------- */
.note { border-radius: var(--radius-md); padding: 11px 16px 11px 38px; background: var(--panel); box-shadow: var(--elevation-1); }
.note::before { left: 16px; top: 17px; width: 7px; height: 7px; background: var(--text-3); }
.warn-box { border-radius: var(--radius-md); }

/* -- auth screens: brand panel + form ------------------------------------- */
.auth-shell { background: var(--canvas); }
.auth-card { border-radius: 0; box-shadow: var(--elevation-2); padding: 36px 32px; }
.auth-card h1 { font-size: 24px; font-weight: 700; letter-spacing: -.03em; }
@media (min-width: 980px) {
  /* two columns, two rows: the headline (row 1, bottom-aligned) and the points (row 2, top-aligned) sit together in the
     vertical middle of the left column; the form card spans both rows on the right */
  .auth-shell { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-rows: 1fr 1fr; gap: 0; padding: 0; min-height: 100vh;
    background: radial-gradient(900px 600px at 0% 0%, color-mix(in srgb, var(--accent) 9%, transparent), transparent 70%), var(--canvas); }
  .auth-shell::before {
    content: "Одна система\A для всей клиники"; white-space: pre-line;
    grid-column: 1; grid-row: 1; align-self: end; padding: 0 clamp(40px, 7vw, 110px) 22px;
    font-size: clamp(34px, 3.4vw, 52px); line-height: 1.1; font-weight: 700; letter-spacing: -.04em; color: var(--text);
  }
  .auth-shell::after {
    content: "✓  Запись, приём и очередь\A ✓  Касса, чеки и отчёты\A ✓  Кадры, смены и зарплаты\A ✓  Пациенты видят данные в Telegram"; white-space: pre-line;
    grid-column: 1; grid-row: 2; align-self: start; padding: 0 clamp(40px, 7vw, 110px);
    color: var(--text-2); font-size: 16px; line-height: 2; font-weight: 500;
  }
  .auth-card { grid-column: 2; grid-row: 1 / span 2; align-self: center; justify-self: center; margin: 32px; border-left: 0; }
}

/* -- motion ---------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }

/* staff card, calmer */
.pc-kicker, .pc-eyebrow { color: var(--text-3); font-size: var(--text-xs); font-weight: 600; letter-spacing: 0; text-transform: none; }
.pc-eyebrow { margin-bottom: 6px; }
.pc-num { display: none; }
.pc-id h1 { font-weight: 700; font-size: 26px; }
.pc-head h2 { font-size: 16px; font-weight: 650; }
.pc-hero, .pc-card { border-radius: var(--card-radius); box-shadow: var(--elevation-1); }
.pc-hero::after { display: none; }
.pc-avatar { border-radius: 0; color: var(--text); font-weight: 700; }
.pc-btn-accent { color: var(--text); background: var(--panel); border-color: var(--border-strong); }
.pc-perms i { font-size: 11px; }
.staff-link { border-bottom-style: solid; border-bottom-color: var(--border-strong); font-weight: 600; }

/* location sharing (panel/_location_share.html) */
.loc-chip { display: inline-flex; align-items: center; gap: 8px; margin: 0 0 14px; padding: 4px 6px 4px 12px; border: 1px solid var(--border); border-radius: 0; background: var(--panel); font-size: var(--text-xs); color: var(--text-2); }
.loc-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--good); }
.loc-chip.off .loc-dot { background: var(--text-3); }
.loc-ask { padding-left: 16px; }
.loc-ask::before { display: none; }
.check-row { display: inline-flex; align-items: center; gap: 8px; font-size: var(--text-sm); color: var(--text); }

/* ---- applicant cabinet: own button colour, landing choices, explainer, join section -------------------------------------- */
html[data-panel="cabinet"] { --accent: var(--user-accent, var(--ink)); }

.choice-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.choice-card { position: relative; display: flex; flex-direction: column; gap: 8px; padding: 22px; border: 1px solid var(--border); border-radius: var(--card-radius); background: var(--panel); color: var(--text); text-decoration: none; box-shadow: var(--elevation-1); transition: border-color .15s var(--ease), transform .12s var(--ease); }
.choice-card:hover { border-color: color-mix(in srgb, var(--accent) 55%, var(--border)); color: var(--text); transform: translateY(-2px); }
.choice-card h2 { margin: 0; font-size: 18px; font-weight: 650; }
.choice-card p { margin: 0; color: var(--text-2); font-size: var(--text-sm); line-height: 1.55; flex: 1; }
.choice-num { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: color-mix(in srgb, var(--accent) 16%, var(--panel-2)); color: var(--accent-ink); font-weight: 800; font-size: 13px; }
.choice-go { color: var(--accent-ink); font-weight: 650; font-size: var(--text-sm); }

.explainer { margin-bottom: 8px; border: 1px solid var(--border); border-radius: var(--card-radius); background: var(--panel); overflow: hidden; box-shadow: var(--elevation-1); }
.ex-stage { position: relative; padding: 36px clamp(22px, 5vw, 56px); min-height: 330px; }
.ex-slide h2 { margin: 6px 0 12px; font-size: clamp(22px, 3.2vw, 32px); letter-spacing: -.03em; line-height: 1.15; }
.ex-slide p, .ex-slide li { color: var(--text-2); font-size: 16px; line-height: 1.6; max-width: 62ch; }
.ex-slide ul, .ex-slide ol { padding-left: 20px; margin: 0; }
.ex-kicker { font-size: var(--text-xs); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent-ink); }
.ex-prices { list-style: none; padding: 0 !important; display: grid; gap: 8px; max-width: 520px; }
.ex-prices li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--panel-2); }
.ex-note { font-size: var(--text-sm) !important; }
.ex-js .ex-slide { position: absolute; inset: 36px clamp(22px, 5vw, 56px) auto; opacity: 0; transform: translateY(10px); pointer-events: none; transition: opacity .45s var(--ease), transform .45s var(--ease); }
.ex-js .ex-slide.on { opacity: 1; transform: none; pointer-events: auto; }
.ex-js .ex-stage { min-height: 380px; }
.ex-controls { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--border); background: var(--panel-2); }
.ex-bar { flex: 1; height: 5px; border-radius: 0; background: var(--border); overflow: hidden; }
.ex-bar i { display: block; height: 100%; width: 0; background: var(--accent); }
.ex-time { font-size: var(--text-xs); color: var(--text-3); font-variant-numeric: tabular-nums; min-width: 78px; text-align: right; }
@media (max-width: 640px) { .ex-js .ex-stage { min-height: 460px; } }

.join-steps { margin: 0 0 16px; padding-left: 20px; color: var(--text-2); line-height: 1.7; font-size: var(--text-sm); }
.join-current { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; padding: 14px 16px; border: 1px solid color-mix(in srgb, var(--accent) 40%, var(--border)); border-radius: var(--radius-md); background: color-mix(in srgb, var(--accent) 7%, var(--panel)); }
.join-label { font-size: var(--text-xs); font-weight: 700; color: var(--accent-ink); }
.join-clinic { font-size: 18px; font-weight: 650; }
.join-history { margin-top: 16px; border-top: 1px solid var(--border); padding-top: 12px; }
.join-history summary { cursor: pointer; color: var(--text-2); font-size: var(--text-sm); }
.join-history ul { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 8px; }
.join-history li { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: var(--text-sm); }

.swatches { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.swatch { width: 34px; height: 34px; border-radius: 50%; border: 2px solid transparent; background: var(--c); cursor: pointer; box-shadow: 0 0 0 1px var(--border); padding: 0; }
.swatch.on { border-color: var(--text); box-shadow: 0 0 0 2px var(--panel), 0 0 0 4px var(--c); }
.swatches input[type="color"] { width: 40px; height: 34px; padding: 2px; border-radius: 0; }

.danger-zone { margin-top: 28px; }
.danger-zone > summary { cursor: pointer; color: var(--text-3); font-size: var(--text-sm); padding: 8px 0; list-style: none; }
.danger-zone > summary::-webkit-details-marker { display: none; }
.danger-zone > summary:hover { color: var(--text-2); }
.danger-zone[open] > summary { margin-bottom: 10px; }
#live-region.live-flash { animation: live-flash 1.1s ease-out; }
@keyframes live-flash { 0% { box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--accent) 55%, transparent); } 100% { box-shadow: inset 0 0 0 2px transparent; } }
@media (prefers-reduced-motion: reduce) { #live-region.live-flash { animation: none; } }
.tg-approve { display: flex; gap: 12px; align-items: flex-start; margin: 0 0 16px; padding: 12px 14px; border-radius: 0; border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--line)); background: color-mix(in srgb, var(--accent) 9%, var(--surface)); }
.tg-approve p { margin: 2px 0 0; font-size: 13px; color: var(--ink-muted); } .tg-approve strong { font-size: 14px; }
.tg-approve-dot { flex: none; width: 12px; height: 12px; margin-top: 5px; border-radius: 50%; background: var(--accent); animation: tg-pulse 1.4s ease-in-out infinite; }
.tg-approve.done .tg-approve-dot { animation: none; }
@keyframes tg-pulse { 0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 55%, transparent); } 50% { box-shadow: 0 0 0 8px transparent; } }
@media (prefers-reduced-motion: reduce) { .tg-approve-dot { animation: none; } }

/* ---- show / hide password ------------------------------------------------- */
.pw-wrap { position: relative; display: block; width: 100%; }
.pw-wrap input { width: 100%; padding-right: 48px; }
.pw-eye { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 38px; height: 38px; display: grid; place-items: center; border: 0; border-radius: 0; background: transparent; color: var(--ink-muted); cursor: pointer; }
.pw-eye:hover { color: var(--ink); background: var(--surface-sunken); }
.pw-eye svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---- sign-in / sign-up: larger, easier to hit ------------------------------- */
.btn.lg { height: 52px; padding: 0 28px; font-size: 16px; border-radius: 0; font-weight: 700; }
.auth-card { max-width: 480px; padding: 40px 38px; }
.auth-card h1 { font-size: 30px; margin-bottom: 20px; }
.auth-card .field label { font-size: 14.5px; font-weight: 600; }
.auth-card input[type="text"], .auth-card input[type="tel"], .auth-card input[type="email"], .auth-card input[type="password"], .auth-card input[type="date"] { height: 52px; font-size: 17px; border-radius: 0; }
.auth-card .help-text { font-size: 14px; }
.auth-card .note, .auth-card .error-text { font-size: 15px; }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin: 0 0 22px; padding: 5px; border-radius: 0; background: var(--surface-sunken); border: 1px solid var(--line); }
.auth-tabs a { display: block; padding: 12px 8px; text-align: center; border-radius: 0; font-size: 16px; font-weight: 700; text-decoration: none; color: var(--ink-muted); }
.auth-tabs a:hover { color: var(--ink); }
.auth-tabs a.on { color: var(--on-accent); background: var(--accent); box-shadow: 0 6px 18px var(--glow); }
@media (max-width: 520px) { .auth-card { padding: 28px 20px; } .auth-card h1 { font-size: 26px; } }

/* ---- sign-in / sign-up layout: the card sits in the middle of the right half, the promo stays put on the left ---------------- */
.auth-forgot { margin-top: 8px; text-align: right; }
.auth-forgot a { font-size: 14.5px; font-weight: 600; }
.auth-card form .btn.primary { height: 52px; font-size: 16px; border-radius: 0; font-weight: 700; }
.auth-card .field { margin-bottom: 16px; }
@media (min-width: 980px) {
  .auth-shell { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 36px 0 36px 50%; box-sizing: border-box; }
  .auth-shell::before, .auth-shell::after { position: fixed; left: 0; width: 50%; box-sizing: border-box; padding: 0 clamp(40px, 5vw, 90px) 0 clamp(90px, 14vw, 260px); align-self: auto; grid-column: auto; grid-row: auto; }
  .auth-shell::before { top: calc(50vh - 150px); font-size: clamp(32px, 3.2vw, 50px); }
  .auth-shell::after { top: calc(50vh + 5px); font-size: 17px; line-height: 2; }
  .auth-card { grid-column: auto; grid-row: auto; margin: 0 auto; justify-self: auto; align-self: auto; width: 100%; }
}
@media (min-width: 980px) and (max-height: 700px) { .auth-shell::before, .auth-shell::after { display: none; } .auth-shell { padding-left: 0; } }

/* our eye is the only one: hide the one Edge / IE draw inside password fields */
input[type="password"]::-ms-reveal, input[type="password"]::-ms-clear { display: none; }
input[type="password"]::-webkit-credentials-auto-fill-button { visibility: hidden; display: none !important; pointer-events: none; }

/* numbered pages: 1 … 4 5 [6] 7 8 … 100 */
.pager-pages { display: inline-flex; align-items: center; gap: 4px; flex-wrap: wrap; justify-content: center; }
.pager-link, .pager-cur, .pager-gap { min-width: 34px; height: 34px; padding: 0 6px; display: inline-grid; place-items: center; border-radius: 0; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.pager-link { color: var(--ink); text-decoration: none; border: 1px solid var(--line); background: var(--surface); } .pager-link:hover { border-color: var(--accent); }
.pager-cur { font-weight: 800; color: var(--on-accent); background: var(--accent); }
.pager-gap { color: var(--ink-muted); }
@media (max-width: 560px) { .pager { justify-content: center; } .pager-info { width: 100%; text-align: center; } .pager-btns { flex-wrap: wrap; justify-content: center; } }

/* onboarding tour (ознакомление) */
.mhp-tour-card { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 10001; width: min(460px, calc(100vw - 32px)); background: var(--surface); color: var(--ink); border: 1px solid var(--ink); box-shadow: 0 20px 50px rgba(0, 0, 0, .35); padding: 20px 22px; }
.mhp-tour-hl { position: relative; z-index: 10002; outline: 3px solid var(--ink); outline-offset: 1px; background: var(--accent-soft); }
.mhp-tour-step { font-size: 12px; color: var(--ink-muted); font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.mhp-tour-title { margin: 8px 0; font-size: 18px; }
.mhp-tour-body { margin: 0; font-size: 14px; line-height: 1.6; color: var(--ink-muted); }
.mhp-tour-actions { display: flex; align-items: center; gap: 8px; margin-top: 20px; }
.mhp-tour-spacer { flex: 1; }

/* right-handed: menu on the right side */
.app-shell.shell-right { flex-direction: row-reverse; }
.app-shell.shell-right .sidebar { border-right: 0; border-left: 1px solid var(--line); }
@media (max-width: 860px) {
  .shell-right .sidebar { left: auto; right: 0; transform: translateX(102%); }
  .nav-open .shell-right .sidebar, .nav-open.shell-right .sidebar { transform: none; }
}

/* --- Инлайновый выбор человека сеткой карточек (pickgrid.js): видно сразу многих --- */
.pickgrid { display: block; }
.pickgrid-search { width: 100%; margin-bottom: 8px; }
.pickgrid-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 6px;
  max-height: 300px; overflow-y: auto; padding: 8px; border: 1px solid var(--line); background: var(--surface-sunken);
}
.pickgrid-card {
  display: flex; flex-direction: column; gap: 2px; text-align: left; cursor: pointer;
  padding: 10px 12px; border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font: inherit; line-height: 1.25; overflow: hidden;
}
.pickgrid-card:hover { border-color: var(--ink); }
.pickgrid-card.is-selected { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.pickgrid-card.is-selected .pickgrid-sub { color: var(--bg); opacity: .75; }
.pickgrid-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pickgrid-sub { font-size: 12px; color: var(--ink-subtle); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pickgrid-empty { padding: 14px; color: var(--ink-subtle); border: 1px solid var(--line); border-top: 0; }
.pickgrid-invalid .pickgrid-grid { outline: 2px solid var(--ink); }
@media (max-width: 560px) { .pickgrid-grid { grid-template-columns: 1fr; max-height: 260px; } }

/* --- Логотип MHP (сердце + крест), _logo_mark.html --- */
.mhp-logo { flex: none; width: 38px; height: 38px; display: grid; place-items: center; background: var(--accent); }
.mhp-logo svg { width: 66%; height: 66%; display: block; }
.mhp-logo svg path { fill: var(--on-accent); }
.mhp-logo .mhp-logo-plus rect { fill: var(--accent); }
.sidebar-brand .mhp-logo { width: 30px; height: 30px; }
