/* Путь пациента — стили (docs/design.md). Гамма клиники: белый, светло-серый, графит #313131;
   мягкие скругления 10–12 px, тени почти без контраста, один спокойный акцент — серо-зелёный «шалфей». */
:root {
  --bg: #f6f6f5;          /* фон страницы — тёплый светло-серый */
  --card: #ffffff;
  --fg: #313131;          /* графит клиники */
  --fg-soft: #4a4a4a;
  --muted: #f1f1f0;       /* заливки, наведение */
  --muted-fg: #7a7a7a;
  --border: #e6e6e4;
  --border-strong: #d6d6d3;
  --primary: #313131;     /* главная кнопка — графит, как «Записаться» на сайте клиники */
  --primary-fg: #ffffff;
  --accent: #6f9a8c;      /* шалфей: активный пункт меню, фокус, «хорошо» */
  --accent-soft: #e9f1ee;
  --ok: #4f8a6d;
  --ok-soft: #e8f2ec;
  --warn: #b07a2a;
  --warn-soft: #f8f0e2;
  --err: #b5503f;
  --err-soft: #f8e9e6;
  --info: #5f7f9c;
  --info-soft: #eaf0f5;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(49, 49, 49, .04), 0 4px 16px rgba(49, 49, 49, .04);
  --font: "Manrope", "Segoe UI", Arial, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }  /* скрытое не показывать, даже если у блока свой display */
html, body { margin: 0; }
body { font-family: var(--font); font-size: 14px; color: var(--fg); background: var(--bg); line-height: 1.5; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
b, strong { font-weight: 600; }

/* ---------- Каркас ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 256px; flex: 0 0 256px; background: var(--card); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; overflow-x: hidden;
  scrollbar-width: thin;
}
.sidebar > * { flex-shrink: 0; }
.brand-row { display: flex; align-items: center; gap: 4px; padding: 18px 12px 14px 18px; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; min-width: 0; flex: 1; }
.brand-icon { width: 36px; height: 36px; flex: none; }
.brand-text { display: grid; line-height: 1.2; min-width: 0; }
.brand-text b { font-size: 15px; font-weight: 700; letter-spacing: -.01em; }
.brand-word { display: block; height: 19px; width: auto; margin-bottom: 2px; }
.brand-text small { font-size: 11px; color: var(--muted-fg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-collapse { border: 0; background: none; color: var(--muted-fg); width: 28px; height: 28px; border-radius: var(--radius-sm); cursor: pointer; display: grid; place-items: center; }
.nav-collapse:hover { background: var(--muted); color: var(--fg); }
.nav-label { padding: 18px 22px 6px; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted-fg); }
.nav { list-style: none; margin: 0; padding: 0 10px; }
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 9px 12px; margin-bottom: 2px; border-radius: var(--radius-sm);
  text-decoration: none; font-size: 14px; font-weight: 500; color: var(--fg-soft);
}
.nav-item .icon { color: var(--muted-fg); flex: none; }
a.nav-item:hover { background: var(--muted); color: var(--fg); }
.nav-item.is-active { background: var(--accent-soft); color: var(--fg); font-weight: 600; }
.nav-item.is-active .icon { color: var(--accent); }
.nav-item.is-disabled { color: #a9a9a6; cursor: default; }
.nav-item.is-disabled .icon { color: #c4c4c0; }
.nav-item em { margin-left: auto; font-style: normal; white-space: nowrap; font-size: 11px; color: #a9a9a6; }
.sidebar-user { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-top: 1px solid var(--border); }
.avatar { width: 34px; height: 34px; flex: none; display: grid; place-items: center; background: var(--muted); color: var(--fg); font-weight: 600; font-size: 12px; border-radius: 50%; }
.user-text { display: grid; min-width: 0; line-height: 1.25; }
.user-text b { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-text small { font-size: 11px; color: var(--muted-fg); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user form { margin-left: auto; }

/* Свёрнутое меню — только значки */
.nav-mini .sidebar { width: 68px; flex-basis: 68px; }
.nav-mini .brand-text, .nav-mini .nav-item span, .nav-mini .nav-item em, .nav-mini .nav-label, .nav-mini .user-text, .nav-mini .sidebar-user form { display: none; }
.nav-mini .brand-row { flex-direction: column; padding: 14px 8px; }
.nav-mini .nav-collapse svg { transform: rotate(180deg); }
.nav-mini .nav-item { justify-content: center; padding: 10px; }
.nav-mini .sidebar-user { justify-content: center; padding: 12px 8px; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 14px 28px; background: var(--card); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; }
.topbar-title h1 { margin: 0; font-size: 20px; font-weight: 600; letter-spacing: -.01em; }
.topbar-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.topbar-back { order: -1; }
.icon-btn.menu-toggle { display: none; }
.content { padding: 28px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; align-content: start; }
.content > * { min-width: 0; }
.page-foot { padding-top: 4px; }

/* ---------- Кнопки ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 18px;
  border: 1px solid var(--border-strong); background: var(--card); color: var(--fg); border-radius: 999px;
  font-size: 14px; font-weight: 500; cursor: pointer; text-decoration: none; white-space: nowrap; transition: background .15s, border-color .15s;
}
.btn:hover { background: var(--muted); border-color: #c9c9c5; }
.btn--primary { background: var(--primary); border-color: var(--primary); color: var(--primary-fg); }
.btn--primary:hover { background: #474747; border-color: #474747; }
.btn--danger { color: var(--err); border-color: #e6c3bc; }
.btn--danger:hover { background: var(--err-soft); }
.btn--block { width: 100%; }
.btn--sm { padding: 6px 12px; font-size: 13px; }
.btn--back::before { content: "←"; }
.icon-btn {
  width: 34px; height: 34px; display: inline-grid; place-items: center; border: 1px solid var(--border);
  background: var(--card); border-radius: 50%; cursor: pointer; color: var(--fg-soft); text-decoration: none;
}
.icon-btn:hover { background: var(--muted); color: var(--fg); }
.icon-btn--ghost { border-color: transparent; background: transparent; }
.icon-btn--danger:hover { color: var(--err); background: var(--err-soft); }
.btn:focus-visible, .icon-btn:focus-visible, .nav-item:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, .nav-collapse:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}

/* ---------- Заголовки страниц ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.eyebrow { color: var(--muted-fg); font-size: 12px; font-weight: 500; letter-spacing: .02em; }
.page-heading { margin: 4px 0 0; font-size: 26px; font-weight: 600; letter-spacing: -.02em; text-wrap: balance; }
.page-note { margin: 0; color: var(--muted-fg); font-size: 13px; max-width: 60ch; }

/* ---------- Сводки ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.kpi { background: var(--card); padding: 18px 20px; border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--border); }
.kpi-title { font-size: 13px; color: var(--muted-fg); }
.kpi-value { margin: 8px 0 2px; font-size: 28px; font-weight: 600; font-variant-numeric: tabular-nums; }
.kpi-value--empty { color: #c4c4c0; }
.kpi-hint { font-size: 12px; color: var(--muted-fg); }

/* ---------- Панели ---------- */
.panel { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.panel-head, .panel-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--border); font-weight: 600; }
.panel-title h3 { margin: 0; font-size: 15px; font-weight: 600; }
.pad { padding: 20px; }
.empty { padding: 48px 24px; text-align: center; display: grid; justify-items: center; gap: 6px; }
.empty-icon { width: 52px; height: 52px; border-radius: 50%; background: var(--muted); display: grid; place-items: center; color: var(--muted-fg); margin-bottom: 6px; }
.empty-icon .icon { width: 22px; height: 22px; }
.empty-title { margin: 0; font-size: 16px; font-weight: 600; }
.empty-text { margin: 0; color: var(--muted-fg); max-width: 52ch; }

/* ---------- Таблицы ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 11px 20px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
.table th { font-size: 12px; font-weight: 600; color: var(--muted-fg); background: #fafaf9; white-space: nowrap; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: #fbfbfa; }
.table .center { text-align: center; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; align-items: center; white-space: nowrap; }
.row-actions form { margin: 0; }
.nowrap { white-space: nowrap; }
.sub { font-size: 12px; color: var(--muted-fg); }
.details-cell { max-width: 420px; color: var(--fg-soft); }
.matrix td:first-child { min-width: 260px; }
.cell-check input { width: 18px; height: 18px; accent-color: var(--fg); }
.changes td { padding: 4px 12px 4px 0; border: 0; }
.old { color: var(--muted-fg); }

/* История: лента */
.timeline { list-style: none; margin: 0; padding: 8px 20px; }
.timeline-item { padding: 14px 0 14px 20px; border-left: 2px solid var(--border); position: relative; }
.timeline-item::before { content: ""; position: absolute; left: -6px; top: 20px; width: 10px; height: 10px; border-radius: 50%; background: var(--card); border: 2px solid var(--accent); }
.timeline-head { display: flex; gap: 12px; flex-wrap: wrap; align-items: baseline; }

/* ---------- Значки ---------- */
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 500; background: var(--muted); color: var(--fg-soft); margin: 0 4px 4px 0; white-space: nowrap; }
.badge--ok { background: var(--ok-soft); color: var(--ok); }
.badge--err { background: var(--err-soft); color: var(--err); }
.badge--warn { background: var(--warn-soft); color: var(--warn); }
.badge--info { background: var(--info-soft); color: var(--info); }
.badge--draft { background: var(--muted); color: var(--muted-fg); }
.muted { color: var(--muted-fg); }
.small { font-size: 12px; }
.hint { font-size: 12px; color: var(--muted-fg); margin: 0; }

/* ---------- Сообщения ---------- */
.messages { display: grid; gap: 8px; }
.message { padding: 12px 16px; border-radius: var(--radius-sm); background: var(--info-soft); color: var(--fg); font-size: 14px; }
.message--success { background: var(--ok-soft); }
.message--error { background: var(--err-soft); }
.message--warning { background: var(--warn-soft); }
.form-error { padding: 12px 16px; border-radius: var(--radius-sm); background: var(--err-soft); color: var(--err); margin-bottom: 14px; }
.view-as-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 28px; background: var(--warn-soft); font-size: 13px; flex-wrap: wrap; }
.view-as-bar form { margin: 0; }

/* ---------- Формы ---------- */
.form { display: grid; gap: 14px; }
.form-stack { display: grid; gap: 20px; }
.form-panel { padding: 22px; display: grid; gap: 18px; overflow: visible; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px 20px; align-items: start; }
.field { display: grid; gap: 6px; min-width: 0; }
.field-label { font-size: 13px; font-weight: 500; color: var(--fg-soft); }
.req { color: var(--err); font-style: normal; }
.field input:not([type=checkbox]):not([type=radio]), .field select, .field textarea,
.filter input, .filter select {
  width: 100%; padding: 10px 14px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--card);
  transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .field select:focus, .field textarea:focus, .filter input:focus, .filter select:focus {
  outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
.field textarea { min-height: 90px; resize: vertical; }
.has-error input, .has-error select, .has-error textarea { border-color: var(--err); }
.field-error { font-size: 12px; color: var(--err); }
.fieldset { border: 0; padding: 0; margin: 0; display: grid; gap: 10px; }
.fieldset legend { font-weight: 600; margin-bottom: 4px; padding: 0; }
.checks { display: flex; flex-wrap: wrap; gap: 10px 24px; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--fg); margin: 0; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }

/* Фильтры над списками */
.filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.filter { display: grid; gap: 4px; min-width: 150px; }
.filter--grow { flex: 1; min-width: 220px; }
.filter-label { font-size: 12px; color: var(--muted-fg); }
.pager { display: flex; gap: 12px; align-items: center; justify-content: center; padding: 14px; border-top: 1px solid var(--border); }

/* ---------- Роли ---------- */
.role-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; }
.role-card { padding: 20px; display: grid; gap: 12px; align-content: start; grid-template-columns: minmax(0, 1fr); }
.role-card .badge { white-space: normal; }
.role-card-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.role-card h3 { margin: 0; font-size: 16px; font-weight: 600; }
.role-desc { margin: 0; color: var(--fg-soft); }
.role-block { display: grid; gap: 6px; }
.role-block-title { font-size: 12px; color: var(--muted-fg); }

/* ---------- Вход ---------- */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: var(--bg); }
.login-card { width: min(400px, 100%); background: var(--card); padding: 36px 32px 28px; border-radius: 20px; box-shadow: var(--shadow); border: 1px solid var(--border); display: grid; gap: 18px; }
.login-brand { display: flex; align-items: center; gap: 14px; }
.login-brand div { display: grid; line-height: 1.25; }
.login-brand b { font-size: 17px; font-weight: 700; }
.login-brand small { font-size: 12px; color: var(--muted-fg); }
.login-card h1 { margin: 6px 0 0; font-size: 22px; font-weight: 600; }
.login-card .btn { margin-top: 4px; padding: 12px 18px; }
.login-note { margin: 0; font-size: 12px; color: var(--muted-fg); text-align: center; }

/* ---------- Таблица-карточки на телефоне ---------- */
@media (max-width: 860px) {
  .sidebar { position: fixed; left: 0; top: 0; z-index: 40; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow); }
  .nav-open .sidebar { transform: none; }
  .icon-btn.menu-toggle { display: inline-grid; }
  .topbar { padding: 12px 16px; flex-wrap: wrap; }
  .topbar-title { flex: 1; min-width: 0; }
  .topbar-title h1 { font-size: 18px; }
  .topbar-actions { margin-left: 0; width: 100%; }
  .topbar-actions:empty { display: none; }
  .content { padding: 18px 16px; }
  .view-as-bar { padding: 10px 16px; }
  .table--cards thead { display: none; }
  .table--cards tr { display: grid; padding: 12px 16px; border-bottom: 1px solid var(--border); }
  .table--cards td { border: 0; padding: 3px 0; }
  .table--cards td[data-label]::before { content: attr(data-label); display: block; font-size: 11px; color: var(--muted-fg); }
  .table--cards .row-actions { justify-content: flex-start; padding-top: 8px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---------- Пациенты ---------- */
.st { display: inline-block; padding: 3px 11px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.st--lg { font-size: 14px; padding: 5px 14px; }
.st--violet { background: #efebf6; color: #6c5a92; }
.st--err { background: var(--err-soft); color: var(--err); }
.st--warn { background: var(--warn-soft); color: var(--warn); }
.st--info { background: var(--info-soft); color: var(--info); }
.st--ok { background: var(--ok-soft); color: var(--ok); }
.st--grey { background: var(--muted); color: var(--muted-fg); }
.sig { display: inline-flex; align-items: center; gap: 7px; font-weight: 600; font-size: 13px; }
.sig::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: none; }
.sig--err { color: var(--err); } .sig--warn { color: var(--warn); } .sig--ok { color: var(--ok); }
.sig--info { color: var(--info); } .sig--violet { color: #6c5a92; }
.kpi--err .kpi-value { color: var(--err); } .kpi--warn .kpi-value { color: var(--warn); }
.kpi--ok .kpi-value { color: var(--ok); } .kpi--info .kpi-value { color: var(--info); } .kpi--violet .kpi-value { color: #6c5a92; }
.is-late { color: var(--err); font-weight: 600; }
.table--click tbody tr[data-href] { cursor: pointer; }
.table--click a { text-decoration: none; }
tr.is-off td { color: var(--muted-fg); }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.patient-head { padding: 20px 22px; display: grid; gap: 14px; overflow: visible; }
.patient-head-main { display: grid; gap: 12px; }
.meta { display: flex; flex-wrap: wrap; gap: 6px 22px; color: var(--muted-fg); font-size: 13px; }
.meta b { color: var(--fg); }
.patient-state { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 22px; }
.section-title { margin: 0; font-size: 15px; font-weight: 600; }
.notes { display: grid; gap: 16px; }
.note-text { margin: 4px 0 0; white-space: normal; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; margin: 0; }
.facts dt { color: var(--muted-fg); font-size: 13px; }
.facts dd { margin: 0; }
.delete-row { display: flex; justify-content: flex-end; }
@media (max-width: 1000px) { .grid-2 { grid-template-columns: minmax(0, 1fr); } }
/* Поиск в выпадающих списках (static/js/select-search.js): обычный список скрыт, вместо него — строка поиска */
.select-search { position: relative; min-width: 0; }
.select-search-native { position: absolute !important; left: 0; bottom: 0; width: 1px !important; height: 1px; opacity: 0; pointer-events: none; }
.select-search-input {
  width: 100%; padding-right: 32px !important; text-overflow: ellipsis;
  background: var(--card) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24'%3E%3Cpath fill='%23888' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E") no-repeat right 12px center !important;
}
.filter .select-search-input { min-width: 180px; }
.search-results { position: absolute; z-index: 1000; margin: 0; padding: 6px 0; list-style: none; overflow-y: auto; max-height: 320px;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: 0 8px 28px rgba(49, 49, 49, .12); }
.search-option { padding: 8px 14px; cursor: pointer; }
.search-option.is-active, .search-option:hover { background: var(--accent-soft); }
.search-option.is-selected { font-weight: 600; }
.search-empty { padding: 10px 14px; color: var(--muted-fg); font-size: 13px; }
/* Выбор нескольких: выбранные — плашками, рядом строка поиска (фильтр статусов в списке пациентов) */
.multi-pick { position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: 4px; min-height: 42px; padding: 4px 8px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--card); cursor: text; }
.multi-pick:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.multi-chips { display: contents; }
.chip { display: inline-flex; align-items: center; gap: 2px; padding: 2px 4px 2px 10px; border-radius: 999px; background: var(--accent-soft);
  font-size: 13px; white-space: nowrap; }
.chip-x { border: 0; background: none; cursor: pointer; font-size: 15px; line-height: 1; padding: 0 4px; color: var(--muted-fg); }
.chip-x:hover { color: var(--fg, inherit); }
.filter .multi-pick input.multi-input { flex: 1; min-width: 120px; width: auto; border: 0; padding: 6px 4px; box-shadow: none; background: transparent; }
.filter--multi { flex: 1 1 280px; max-width: 520px; }
/* ---------- ДПД и снимки ---------- */
.dpd { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.dpd--ok { background: var(--ok-soft); color: var(--ok); }
.dpd--late { background: var(--warn-soft); color: var(--warn); }
.dpd--plus { background: var(--info-soft); color: var(--info); }
.dpd--miss { background: var(--err-soft); color: var(--err); }
.dpd--na { background: var(--muted); color: var(--muted-fg); }
.dpd-chips { display: inline-flex; gap: 3px; flex-wrap: wrap; }
.dpd-chip { font-size: 10px; font-weight: 600; padding: 2px 5px; border-radius: 5px; }
.dpd-table td { vertical-align: middle; }
.dpd-table input[type=date], .dpd-table select, .dpd-reason { padding: 7px 10px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--card); max-width: 100%; }
.dpd-table select { max-width: 180px; }
.dpd-reason { margin-top: 6px; width: 100%; min-width: 120px; font-size: 13px; }
.pad-x { padding: 0 20px 16px; }
.form-actions.pad-x { padding-top: 14px; align-items: center; }
.form-actions .hint { margin-right: auto; }
.drop-section { border-top: 1px solid var(--border); }
.drop-section > summary { padding: 14px 20px; cursor: pointer; color: var(--fg-soft); font-weight: 500; }
.drop-section > summary:hover { color: var(--fg); }
.shot-form { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; border-top: 1px solid var(--border); }
.shot-form .field { min-width: 150px; flex: 1; }
.ok-text { color: var(--ok); } .warn-text { color: var(--warn); } .err-text { color: var(--err); }
tr.is-picked td { background: var(--accent-soft) !important; }
.copy-source { position: absolute; left: -9999px; width: 1px; height: 1px; }
.dpd-wide { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; }
/* ---------- Планы лечения ---------- */
.plan { padding: 16px 20px; border-bottom: 1px solid var(--border); display: grid; gap: 12px; }
.plan:last-child { border-bottom: 0; }
.plan--actual { background: linear-gradient(90deg, var(--accent-soft), transparent 40%); }
.plan:not(.plan--actual) { opacity: .8; }
.plan-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.plan-actions { margin-left: auto; display: flex; gap: 6px; }
.stages { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.stages li { padding: 8px 10px; border-radius: var(--radius-sm); background: var(--muted); display: grid; gap: 2px; font-size: 12px; color: var(--muted-fg); }
.stages li b { font-size: 13px; color: var(--muted-fg); font-weight: 500; }
.stages li.is-done { background: var(--ok-soft); color: var(--ok); }
.stages li.is-done b { color: var(--fg); }
.money-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.money-row div { display: grid; gap: 2px; }
.money-row span { font-size: 12px; color: var(--muted-fg); }
.money-row b { font-variant-numeric: tabular-nums; font-weight: 600; }
.progress { height: 6px; border-radius: 3px; background: var(--muted); overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--ok); border-radius: 3px; }
.plan-note { margin: 0; }
.plan form { margin: 0; }
@media (max-width: 640px) { .stages { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* Загрузка из iDent */
.card-input { width: 96px; padding: 7px 10px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--card); font-variant-numeric: tabular-nums; }
.card-input.is-attention { background: var(--warn-soft); border-color: #e2c99a; }
tr.row-attention td { background: #fffdf8; }
.hint-list { margin: 0; padding-left: 18px; color: var(--muted-fg); font-size: 13px; display: grid; gap: 4px; }
/* ---------- Отчёты ---------- */
.barcell { display: flex; align-items: center; gap: 10px; min-width: 160px; }
.barcell i { display: block; height: 8px; border-radius: 4px; background: var(--accent); opacity: .7; min-width: 2px; max-width: 220px; flex: 0 0 auto; }
.barcell span { font-variant-numeric: tabular-nums; white-space: nowrap; }
.grid-2--even { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
@media (max-width: 1000px) { .grid-2--even { grid-template-columns: minmax(0, 1fr); } }
a.kpi--link { text-decoration: none; color: inherit; transition: border-color .15s; }
a.kpi--link:hover { border-color: var(--border-strong); }
a.kpi--link.is-picked { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
/* ---------- Компактные строки (01.10, просьба Ирины «сделай строки уже») ---------- */
.table th, .table td { padding: 7px 14px; line-height: 1.35; vertical-align: middle; }
.table th { padding-top: 9px; padding-bottom: 9px; }
.name-cell { white-space: nowrap; max-width: 360px; overflow: hidden; text-overflow: ellipsis; }
.name-cell a { text-decoration: none; }
.name-cell a:hover b { text-decoration: underline; text-decoration-color: var(--border-strong); }
.card-no { margin-left: 8px; font-size: 12px; color: var(--muted-fg); font-variant-numeric: tabular-nums; }
.clip { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; }
.details-cell.clip { max-width: 320px; }
.st { padding: 2px 9px; font-size: 11.5px; }
.sig { white-space: nowrap; font-size: 12.5px; }
.table .sub { line-height: 1.25; }
.kpi { padding: 14px 18px; }
.kpi-value { margin: 4px 0 0; font-size: 24px; }
@media (max-width: 860px) {
  .name-cell, .clip, .details-cell.clip { white-space: normal; max-width: none; }
  .sig { white-space: normal; }
}.name-cell { max-width: 300px; }
.clip { max-width: 170px; }
.details-cell.clip { max-width: 220px; }
.table .nowrap, .table td.num { white-space: nowrap; }.name-cell { max-width: none; overflow: visible; }
.name-cell b { display: inline-block; max-width: 250px; overflow: hidden; text-overflow: ellipsis; vertical-align: bottom; }
@media (min-width: 861px) and (max-width: 1500px) { .wide-only { display: none; } }
@media (max-width: 860px) { .name-cell b { max-width: none; display: inline; } }.table th, .table td { padding-left: 10px; padding-right: 10px; }
.table th:first-child, .table td:first-child { padding-left: 18px; }
.table th:last-child, .table td:last-child { padding-right: 18px; }
.name-cell b { max-width: 230px; }
.clip { max-width: 150px; }
@media (min-width: 861px) and (max-width: 1400px) { .wide-md { display: none; } }
/* Листание страниц (partials/pager.html) */
.pager { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; justify-content: center; padding: 12px 14px; border-top: 1px solid var(--border); }
.pager .btn.is-off { opacity: .4; pointer-events: none; }
.pager-pages { display: inline-flex; gap: 4px; align-items: center; margin: 0 6px; }
.pager-num { min-width: 32px; height: 32px; padding: 0 8px; display: inline-grid; place-items: center; border-radius: 999px; text-decoration: none; font-size: 13px; color: var(--fg-soft); font-variant-numeric: tabular-nums; }
.pager-num:hover { background: var(--muted); }
.pager-num.is-current { background: var(--fg); color: var(--card); font-weight: 600; }
.pager-gap { color: var(--muted-fg); padding: 0 2px; }
.pager-info { width: 100%; text-align: center; }
.notice { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin: 0; padding: 10px 20px; background: var(--warn-soft); font-size: 13px; }
/* ---------- Дашборды ---------- */
.funnel { display: grid; gap: 8px; }
.funnel-row { display: grid; grid-template-columns: minmax(150px, 190px) 1fr auto 64px; gap: 10px; align-items: center; font-size: 13px; }
.funnel-track, .hbar-track { height: 14px; background: var(--muted); border-radius: 7px; overflow: hidden; display: block; }
.funnel-track i, .hbar-track i { display: block; height: 100%; background: var(--accent); border-radius: 7px; min-width: 3px; }
.funnel-n { white-space: nowrap; font-variant-numeric: tabular-nums; }
.funnel-step { color: var(--muted-fg); font-size: 12px; text-align: right; white-space: nowrap; }
.hbars { display: grid; gap: 10px; }
.hbar { display: grid; grid-template-columns: minmax(130px, 180px) 1fr auto 64px; gap: 10px; align-items: center; font-size: 13px; }
.hbar-val { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.hbar-n { text-align: right; white-space: nowrap; }
.hbar--warn .hbar-track i { background: var(--warn); opacity: .75; }
.hbar--err .hbar-track i { background: var(--err); opacity: .65; }
.hbar-details > summary { list-style: none; cursor: pointer; }
.hbar-details > summary::-webkit-details-marker { display: none; }
.hbar-details[open] > summary .hbar-title { font-weight: 600; }
.mini-list { list-style: none; margin: 6px 0 4px; padding: 0; display: grid; gap: 4px; font-size: 13px; }
.mini-list a { text-decoration: none; font-weight: 500; }
.heat-table td.num { font-variant-numeric: tabular-nums; }
.heat-table td { border-left: 1px solid #fff; }
.total-row td { font-weight: 600; border-bottom: 2px solid var(--border-strong); }
.speed-row { display: grid; grid-template-columns: 60px 1fr; gap: 10px; align-items: center; }
.speed-bars { display: grid; grid-template-columns: 1fr 96px; gap: 4px 10px; align-items: center; }
.hbar-track--alt i { background: var(--info); opacity: .7; }
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.ch-grid { stroke: var(--border); stroke-width: 1; }
.ch-axis { fill: var(--muted-fg); font-size: 11px; font-family: var(--font); }
.ch-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 8px; font-size: 12px; color: var(--fg-soft); }
.ch-key { display: inline-flex; align-items: center; gap: 6px; }
.ch-key i { width: 14px; height: 3px; border-radius: 2px; display: inline-block; }
.pad .kpis, .kpis.pad { margin: 0; }
@media (max-width: 640px) { .funnel-row, .hbar { grid-template-columns: 1fr auto; } .funnel-track, .hbar-track { grid-column: 1 / -1; } }.barcell { display: grid; grid-template-columns: minmax(60px, 140px) auto; gap: 10px; align-items: center; min-width: 0; }
.bc-track { display: block; height: 8px; border-radius: 4px; background: var(--muted); overflow: hidden; }
.bc-track i { display: block; height: 100%; max-width: none; background: var(--accent); opacity: .75; border-radius: 4px; }
.ch-axis { font-size: 10px; }
/* Дашборд куратора */
.queue-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 4px 0; border-bottom: 1px dashed var(--border); }
.queue-row:last-child { border-bottom: 0; }
.queue-row b { font-variant-numeric: tabular-nums; font-size: 16px; }
.day-bars { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 3px; align-items: end; height: 170px; }
.day-bar { display: grid; grid-template-rows: 1fr auto; align-items: end; height: 100%; text-align: center; }
.day-bar i { display: block; background: var(--accent); opacity: .75; border-radius: 3px 3px 0 0; min-height: 2px; }
.day-bar span { font-size: 9px; color: var(--muted-fg); padding-top: 3px; }.mini-list.pad { padding: 16px 20px; margin: 0; }
.table--narrow .name-cell b { max-width: 170px; }.seg { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--border-strong); border-radius: 999px; overflow: hidden; background: var(--card); justify-self: start; }
.seg-btn { padding: 7px 16px; font-size: 13px; text-decoration: none; color: var(--fg-soft); border-left: 1px solid var(--border); }
.seg-btn:first-child { border-left: 0; }
.seg-btn:hover { background: var(--muted); }
.seg-btn.is-active { background: var(--fg); color: var(--card); font-weight: 600; }
/* ---------- Компактный интерфейс (03.10, правило Ирины: как можно меньше прокрутки на странице) ---------- */
body { font-size: 13.5px; line-height: 1.4; }
.sidebar { width: 216px; flex-basis: 216px; }
.brand-row { padding: 10px 8px 8px 14px; }
.brand-icon { width: 28px; height: 28px; }
.nav-label { padding: 10px 16px 4px; }
.nav { padding: 0 8px; }
.nav-item { padding: 6px 10px; gap: 10px; font-size: 13.5px; margin-bottom: 1px; }
.sidebar-user { padding: 8px 12px; }
.avatar { width: 28px; height: 28px; }
.topbar { padding: 7px 18px; min-height: 46px; }
.topbar-title h1 { font-size: 17px; }
.topbar-actions { gap: 6px; }
.content { padding: 12px 18px 16px; gap: 12px; }
.btn { padding: 5px 13px; font-size: 13px; gap: 6px; }
.btn--sm { padding: 3px 10px; font-size: 12.5px; }
.icon-btn { width: 30px; height: 30px; }
.page-head { gap: 4px 16px; align-items: baseline; }
.page-heading { margin: 0; font-size: 17px; }
.eyebrow { font-size: 11.5px; }
.page-note { font-size: 12px; max-width: 90ch; line-height: 1.35; }
.kpis { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.kpi { padding: 8px 12px; border-radius: 10px; }
.kpi-title { font-size: 12px; line-height: 1.25; }
.kpi-value { margin: 2px 0 0; font-size: 20px; line-height: 1.2; }
.kpi-hint { font-size: 11px; line-height: 1.25; }
.panel { border-radius: 10px; }
.panel-head, .panel-title { padding: 7px 14px; gap: 10px; min-height: 38px; }
.panel-title h3, .section-title { font-size: 14px; }
.pad { padding: 10px 14px; }
.table th, .table td { padding: 4px 10px; }
.table th { padding-top: 6px; padding-bottom: 6px; font-size: 11.5px; }
.table th:first-child, .table td:first-child { padding-left: 14px; }
.table th:last-child, .table td:last-child { padding-right: 14px; }
.empty { padding: 20px 16px; }
.message { padding: 7px 12px; font-size: 13px; }
.messages { gap: 4px; }
.form { gap: 8px; }
.form-stack { gap: 12px; }
.form-panel { padding: 12px 14px; gap: 10px; }
.form-grid { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 8px 12px; }
.field { gap: 3px; }
.field-label { font-size: 12px; }
.field input:not([type=checkbox]):not([type=radio]), .field select, .field textarea,
.filter input, .filter select { padding: 6px 10px; }
.field textarea { min-height: 56px; }
.select-search-input { padding-right: 28px !important; }
.filters { gap: 8px; }
.filter { min-width: 130px; gap: 2px; }
.filter-label { font-size: 11.5px; }
.multi-pick { min-height: 34px; padding: 2px 6px; }
.filter .multi-pick input.multi-input { padding: 4px; }
.chip { font-size: 12px; padding: 1px 3px 1px 8px; }
.grid-2 { gap: 12px; }
.patient-head { padding: 10px 14px; gap: 8px; }
.patient-head-main { gap: 6px; }
.meta { gap: 2px 16px; font-size: 12.5px; }
.patient-state { gap: 6px 16px; }
.st--lg { font-size: 12.5px; padding: 3px 11px; }
.notes { gap: 8px; }
.facts { gap: 3px 12px; }
.timeline { padding: 4px 14px; max-height: 300px; overflow-y: auto; scrollbar-width: thin; }
.timeline-item { padding: 6px 0 6px 16px; }
.timeline-item::before { top: 11px; }
.plan { padding: 8px 14px; gap: 6px; }
.stages li { padding: 4px 8px; }
.money-row { gap: 6px; }
.pad-x { padding: 0 14px 10px; }
.form-actions.pad-x { padding-top: 8px; }
.drop-section > summary { padding: 7px 14px; }
.dpd-wide { gap: 12px; }
.dpd-table input[type=date], .dpd-table select, .dpd-reason { padding: 4px 8px; }
.notice { padding: 6px 14px; }
.pager { padding: 6px 12px; gap: 4px; }
.pager-num { min-width: 28px; height: 28px; }
.funnel { gap: 4px; }
.hbars { gap: 5px; }
.day-bars { height: 120px; }
.queue-row { padding: 2px 0; }
.mini-list.pad { padding: 8px 14px; }
.seg-btn { padding: 4px 12px; font-size: 12.5px; }
.drill-banner { padding: 6px 12px; }
.role-cards { gap: 10px; }
.role-card { padding: 12px 14px; gap: 8px; }
.view-as-bar { padding: 6px 18px; }
.login-card { padding: 26px 26px 20px; gap: 12px; }
/* заголовок раздела и подпись (месяц, дата) — одной строкой */
.page-head > div:first-child { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 10px; }
.page-head .eyebrow { order: 2; }
/* период и переключатели — в одну строку */
.toolbar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px 16px; }
/* форма в одну строку: поля + кнопка в конце */
.form-row { display: grid; grid-template-columns: minmax(150px, 1.1fr) minmax(130px, .9fr) minmax(160px, 1.6fr) auto; gap: 8px 10px; align-items: end; }
@media (max-width: 860px) { .form-row { grid-template-columns: minmax(0, 1fr); } }
/* «Сегодня»: все сигналы в один ряд на экране 1280 */
.kpis { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
/* фильтры списка — в одну строку */
.filter { min-width: 0; }
.filter .select-search { width: 140px; }
.filter .select-search-input { min-width: 0; }
.filter select { width: auto; max-width: 150px; }
@media (min-width: 861px) {
  .page-head { flex-wrap: nowrap; align-items: center; }
  .page-head > div:first-child { flex: 0 1 auto; }
  .page-note { flex: 1 1 360px; max-width: 75ch; margin-left: auto; }
}
.filter--grow { flex: 0 1 140px; min-width: 120px; }
.filter--multi { flex: 1 1 200px; max-width: 320px; }
.filter--multi .multi-pick { width: 100%; }
.form-row .field-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* План: этапы с файлами, участники, деньги (05.10) */
.form-grid--4 { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.money-sum { padding: 7px 0; font-weight: 600; }
.stages { grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); }
.stages li { position: relative; }
.stage-files { position: absolute; top: 3px; right: 6px; display: inline-flex; gap: 2px; font-size: 12px; }
.stage-files a { text-decoration: none; }
.plan-members { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; }
.plan-members form { margin: 0; }
.member { border: 1px solid var(--border-strong); background: var(--card); border-radius: 999px; padding: 1px 9px; font-size: 12px;
  cursor: pointer; color: var(--fg-soft); font-weight: 600; }
.member.is-checked { background: var(--ok-soft); border-color: #bcd9c9; color: var(--ok); }
.form-row--members { grid-template-columns: minmax(240px, 1fr) minmax(0, 1.4fr); }
.file-chip { display: inline-flex; align-items: center; gap: 2px; margin: 0 6px 2px 0; padding: 1px 4px 1px 8px; border-radius: 999px;
  background: var(--muted); font-size: 12px; }
.file-chip a { text-decoration: none; }
.file-chip form { margin: 0; display: inline; }
.attach-form { display: flex; gap: 6px; align-items: center; margin: 0; }
.attach-form input[type=url] { flex: 1; min-width: 160px; padding: 4px 8px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); }
.attach-form input[type=file] { max-width: 200px; font-size: 12px; }
/* Контроль: визиты и задачи в карточке пациента (05.10) */
.ctl { padding: 6px 14px; border-bottom: 1px solid var(--border); }
.ctl--late { background: #fffaf8; }
.ctl-line { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.ctl-title { flex: 1; min-width: 160px; }
.ctl-kind { font-size: 11px; font-weight: 600; padding: 1px 8px; border-radius: 999px; background: var(--info-soft); color: var(--info); }
.ctl-kind--visit { background: #efebf6; color: #6c5a92; }
.ctl-form { padding: 8px 0 4px; display: grid; gap: 6px; }
.ctl-fields { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: flex-end; }
.ctl-fields > .field, .ctl-fields > span > .field { min-width: 120px; }
.ctl-fields .ctl-note { flex: 1 1 220px; }
.ctl-fields .ctl-note .field { width: 100%; }
.ctl-next-title { font-size: 12px; font-weight: 600; color: var(--fg-soft); padding-top: 2px; }
.ctl-add { position: relative; }
.ctl-add > summary { list-style: none; }
.ctl-add > summary::-webkit-details-marker { display: none; }
.ctl-pop { padding: 8px 14px 10px; border-bottom: 1px solid var(--border); background: #fbfbfa; }
.ctl-history > summary { padding: 7px 14px; cursor: pointer; color: var(--fg-soft); font-size: 13px; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; align-items: start; }
/* Визиты — лента как переписка (05.10, Ирина) */
.ctl-wrap { display: grid; gap: 12px; }
.chat { display: grid; gap: 6px; padding: 8px 14px; max-height: 340px; overflow-y: auto; scrollbar-width: thin; }
.msg { max-width: 92%; justify-self: start; background: var(--muted); border-radius: 12px 12px 12px 4px; padding: 5px 10px; font-size: 13px; }
.msg--open { justify-self: stretch; max-width: none; background: #efebf6; border-radius: 12px; }
.msg--late { background: var(--err-soft); }
.msg--task { background: var(--info-soft); }
.msg--open.msg--task { background: #e6f1e7; }  /* задачи людей — зелёные (05.10, Ирина) */
.msg--open.msg--task.msg--auto { background: #e4edf5; }  /* автозадачи программы — синие */
.msg-meta form.inline { display: inline; margin: 0; }
.chat { max-height: 420px; }
.ctl-pop-title { align-self: center; font-size: 13px; }
.msg-head { display: flex; flex-wrap: wrap; gap: 2px 6px; align-items: baseline; }
.msg-meta { margin-left: auto; font-size: 11px; color: var(--muted-fg); white-space: nowrap; }
.msg-result { display: flex; flex-wrap: wrap; gap: 2px 6px; align-items: baseline; margin-top: 2px; font-weight: 600; }
.msg-result--came { color: var(--ok); } .msg-result--moved { color: var(--warn); }
.msg-result--no_show, .msg-result--cancelled { color: var(--err); }
.msg-actions { display: inline-flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.msg-actions .btn--sm { padding: 2px 9px; font-size: 12px; }
.msg-form { background: var(--card); border-radius: 8px; padding: 6px 8px; margin-top: 6px; }
.form-actions .hint { margin-right: auto; }
/* Карточка пациента (05.10): правая колонка шире — ДПД, снимки и гигиена рядом с планами */
.grid-2--card { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); }
@media (max-width: 1000px) { .grid-2--card { grid-template-columns: minmax(0, 1fr); } }
.doctors-line { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 13px; padding: 8px 14px; }
.dpd-compact th, .dpd-compact td { padding: 3px 6px !important; }
.dpd-compact th:first-child, .dpd-compact td:first-child { padding-left: 14px !important; }
.dpd-compact input[type=date] { padding: 3px 6px; font-size: 12.5px; max-width: 132px; }
.dpd-compact select { padding: 3px 4px; font-size: 12.5px; max-width: 76px; }
.dpd-compact input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--fg); }
.dpd-compact .dpd { font-size: 11px; padding: 1px 7px; }
.dpd-reason-row td { padding-top: 0 !important; border-bottom: 1px solid var(--border); }
.dpd-reason-row .dpd-reason { margin: 0; padding: 3px 8px; }
.drop-section > form.ctl-fields { padding: 4px 14px 10px; }
/* Планы — компактнее: этап в одну строку */
.plan { padding: 6px 14px; gap: 4px; }
.stages { gap: 4px; }
.stages li { display: flex; align-items: baseline; justify-content: space-between; gap: 4px; padding: 3px 8px; font-size: 11.5px; }
.stages li b { font-size: 12px; }
.money-row span { font-size: 11px; }
.progress { height: 4px; }
.members-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 8px 12px; }
.member-slot { display: grid; gap: 2px; }
.stage-table td { vertical-align: middle; }
.stage-table input[type=date] { padding: 4px 8px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); }
.plan-hist { padding: 4px 14px; font-size: 12.5px; color: var(--muted-fg); display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.plan-hist form.inline, form.inline { display: inline; margin: 0; }
.msg--empty { justify-self: stretch; max-width: none; background: transparent; border: 1px dashed var(--border-strong); border-radius: 12px;
  display: flex; align-items: center; gap: 8px; padding: 4px 10px; }
.msg--empty .btn--sm { padding: 1px 9px; font-size: 12px; margin-left: auto; }
.msg-tools { display: inline-flex; gap: 0; margin-left: 4px; }
.msg-tools .icon-btn { width: 24px; height: 24px; }
.msg-tools .icon-btn svg { width: 13px; height: 13px; }
.ctl-all { border-top: 1px solid var(--border); }
.ctl-all-title { padding: 6px 14px 2px; font-weight: 600; font-size: 13px; }
.ctl-table td { font-size: 12.5px; }
.ctl-table td.clip { max-width: 160px; }
.ctl-table .row-actions { width: 60px; }
.ctl-table tr.is-open td { background: #f7f5fb; }
.ctl-table tr.is-deleted td { color: var(--muted-fg); text-decoration: line-through; text-decoration-color: #c9c9c5; }
.ctl-table tr.is-deleted td .small { text-decoration: none; }
.ctl-edit-row td { padding: 0 14px !important; border-bottom: 0 !important; }
.form-row--3 { grid-template-columns: minmax(160px, 1fr) minmax(160px, 1.6fr) auto; }
/* кнопки в строках таблиц — мельче, чтобы строка не росла */
.table .row-actions { gap: 4px; }
.table .row-actions .btn--sm { padding: 2px 9px; font-size: 12px; }
.table .row-actions .icon-btn { width: 26px; height: 26px; }
.table .row-actions .icon-btn svg { width: 14px; height: 14px; }
.kpi-title { font-size: 11.5px; }
/* ---------- Печать и PDF (кнопка «PDF» = печать браузера → «Сохранить как PDF») ---------- */
.print-only { display: none; }
@page { size: A4 landscape; margin: 10mm; }
@media print {
  html, body { background: #fff !important; font-size: 11px; }
  .sidebar, .topbar-actions, .topbar-back, .menu-toggle, .filters, .seg, .pager, .no-print, .view-as-bar, .page-foot,
  .messages, .btn, .icon-btn, .drop-section, form .form-actions, .row-actions, .nav-collapse { display: none !important; }
  .print-only { display: block; }
  .shell { display: block; }
  .main { display: block; }
  .topbar { position: static; border: 0; padding: 0 0 6px; }
  .topbar-title h1 { font-size: 18px; }
  .content { padding: 0; gap: 10px; display: block; }
  .content > * { margin-bottom: 10px; }
  .panel, .kpi { box-shadow: none !important; border-color: #ccc; break-inside: avoid; }
  .kpis { grid-template-columns: repeat(5, 1fr); gap: 6px; }
  .kpi { padding: 8px 10px; }
  .kpi-value { font-size: 18px; }
  .grid-2, .grid-2--even, .dpd-wide { display: block; }
  .grid-2 > *, .grid-2--even > * { margin-bottom: 10px; }
  .table th, .table td { padding: 3px 6px; }
  .table--cards thead { display: table-header-group !important; }
  .table--cards tr { display: table-row !important; }
  .table--cards td { display: table-cell !important; }
  .table--cards td[data-label]::before { content: none !important; }
  .wide-only, .wide-md { display: table-cell !important; }
  .name-cell b, .clip, .details-cell.clip { max-width: none !important; white-space: normal !important; overflow: visible; }
  a { color: inherit !important; text-decoration: none !important; }
  details.hbar-details > ul { display: none; }
  .table-wrap { overflow: visible; }
  tr { break-inside: avoid; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}/* Ссылки-переходы на дашбордах */
a.row-link { text-decoration: none; color: inherit; border-radius: var(--radius-sm); }
a.row-link:hover { background: var(--muted); }
.funnel-row.row-link, .hbar.row-link { padding: 3px 6px; margin: 0 -6px; }
a.queue-row { text-decoration: none; color: inherit; }
a.queue-row:hover { background: var(--muted); }
.cell-link { color: inherit; text-decoration: none; display: block; }
.cell-link:hover { text-decoration: underline; text-decoration-color: var(--border-strong); }
.hbar-sub { display: block; font-size: 10.5px; font-weight: 400; color: var(--muted-fg); }
.drill-banner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 16px; padding: 12px 18px; border-radius: var(--radius); background: var(--accent-soft); }
/* Группы сотрудников в справочнике (05.10) */
.seg--sm { margin: 2px 0 6px; flex-wrap: wrap; gap: 4px; border: 0; border-radius: 0; background: none; overflow: visible; }
.seg--sm .seg-btn { padding: 2px 9px; font-size: 12px; border: 1px solid var(--border); border-radius: 999px; }

/* Вид визита в ленте (05.10) */
.ctl-vtype { font-weight: 600; color: #6c5a92; }

/* Снимки галочками (05.10) */
.shot-picks { display: flex; gap: 12px; align-items: center; min-height: 32px; }

/* Снимки и гигиена — раскрывающиеся строки (05.10) */
.sched { font-size: 13px; }
.sched-head, .sched-row > summary { display: grid; grid-template-columns: minmax(0, 1.4fr) 100px 150px; gap: 8px; padding: 6px 14px; align-items: center; }
.sched-head { font-size: 11.5px; color: var(--muted-fg); border-bottom: 1px solid var(--border); }
.sched-row { border-bottom: 1px solid var(--border); }
.sched-row > summary { cursor: pointer; list-style: none; }
.sched-row > summary::-webkit-details-marker { display: none; }
.sched-row > summary > span:first-child::before { content: "▸ "; color: var(--muted-fg); }
.sched-row[open] > summary > span:first-child::before { content: "▾ "; }
.sched-row > summary:hover { background: var(--muted); }
.sched-body { padding: 4px 14px 10px 26px; display: grid; gap: 6px; background: var(--muted); }
.sched-hist { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; font-size: 12.5px; }
.sched-hist .sh::before { content: "● "; font-size: 9px; vertical-align: 1px; }
.sh--ok::before { color: var(--ok, #4a8a5c); } .sh--miss::before { color: var(--err, #b5483f); } .sh--open::before { color: var(--warn, #b98a2e); } .sh--na::before { color: var(--muted-fg); }
.sched-hist form.inline { display: inline; }
.num-input { width: 70px; }.sched-body .ctl-fields { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: flex-end; }
.sched-body .field { margin: 0; }
.sched-body input[type=date] { width: 138px; }
.sched-body select { width: 84px; }
.sched-body .num-input, .sched-body input[name=hygiene_months] { width: 72px; }
.sched-body .field-hint, .sched-body .help { display: none; }
.sched-body label.field .hint { display: none; }

.sched-body select { width: auto; min-width: 84px; }

.grid-1 { display: grid; gap: 12px; }

/* Долг пациента — при записи и при «Пришёл» (05.10, Ирина) */
.debt-note { flex: 1 1 100%; background: var(--err-soft); color: var(--err, #b5483f); border-radius: 8px; padding: 6px 10px; font-size: 12.5px; }
/* Этапы лечения и стоимость (план из iDent) */
.plan-phases { margin: 6px 0; font-size: 13px; }
.plan-phases > summary { cursor: pointer; color: var(--fg-soft); }
.phase-row > summary { display: grid; grid-template-columns: minmax(0, 1fr) 110px 150px; gap: 8px; padding: 4px 0; cursor: pointer; list-style: none; border-bottom: 1px solid var(--border); }
.phase-row > summary::-webkit-details-marker { display: none; }
.phase-row > summary .num { text-align: right; }
.phase-services td { padding: 2px 6px; }
/* Оплачено меньше стоимости: долг или сделано меньше (06.10) */
.shortfall { flex: 1 1 100%; display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: center; background: var(--warn-soft, #fbf3e4); border-radius: 8px; padding: 4px 10px; }
.shortfall .field-label { margin: 0; }

/* «Сегодня · Завтра · Период» (06.10) */
.day-switch { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: flex-end; margin: 0 0 10px; }
.day-switch .filter { display: flex; gap: 6px; align-items: center; }
.group-row td { background: var(--muted); font-size: 12.5px; padding: 4px 10px; }

/* 06.10: итоги одной строкой вместо крупных плиток; быстрые действия в строке списка; «?» у пояснения страницы */
.stats-line { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 10px; }
.stat { display: inline-flex; align-items: baseline; gap: 5px; padding: 3px 10px; border: 1px solid var(--border); border-radius: 999px;
  background: var(--card); font-size: 12.5px; color: var(--fg-soft); text-decoration: none; white-space: nowrap; }
.stat b { font-size: 14px; color: var(--fg); }
a.stat:hover { border-color: var(--border-strong); background: var(--muted); }
.stat--err b { color: var(--err); } .stat--warn b { color: var(--warn); } .stat--ok b { color: var(--ok); }
.stat--info b { color: var(--info); } .stat--violet b { color: #6c5a92; }
.btn--xs { padding: 1px 6px; font-size: 12px; min-height: 0; line-height: 1.6; border-radius: 6px; }
.quick-cell { white-space: nowrap; width: 1%; padding-left: 4px !important; padding-right: 6px !important; }
.quick { display: inline-flex; gap: 3px; align-items: center; }
.quick form { margin: 0; }
.quick-row td { background: var(--accent-soft); padding: 6px 10px; }
.quick-form { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.quick-form select, .quick-form input { height: 28px; padding: 2px 6px; font-size: 12.5px; width: auto; min-width: 0; }
.quick-form .quick-note { flex: 1 1 180px; }
.help-btn { display: inline-grid; place-items: center; width: 18px; height: 18px; margin-left: 6px; border-radius: 50%; border: 1px solid var(--border-strong);
  background: var(--card); color: var(--muted-fg); font-size: 11px; font-weight: 700; cursor: pointer; vertical-align: middle; padding: 0; }
.help-btn:hover, .help-btn[aria-expanded="true"] { color: var(--fg); border-color: var(--fg-soft); }
.page-note.is-tucked { display: none; }
.page-head .page-note:not(.is-tucked) { flex-basis: 100%; }
/* 06.10: шапка карточки — ключевые даты ссылками и переходы по разделам */
.patient-state a { color: inherit; text-decoration: none; }
.patient-state a:hover { text-decoration: underline; }
.patient-state a.err-text { color: var(--err); }
.card-jump { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--border); font-size: 12.5px; }
.card-jump a { color: var(--fg-soft); text-decoration: none; }
.card-jump a:hover { color: var(--fg); text-decoration: underline; }
section[id], .ctl-all[id] { scroll-margin-top: 64px; }
/* 06.10: меню группами, «Настройки» свёрнуты; поиск пациента в шапке */
.nav-fold > summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 6px; }
.nav-fold > summary::-webkit-details-marker { display: none; }
.nav-fold > summary::after { content: "▸"; font-size: 10px; transition: transform .15s; }
.nav-fold[open] > summary::after { transform: rotate(90deg); }
.nav-mini .nav-fold > summary { display: block; height: 8px; padding: 0; }
.nav-mini .nav-fold > summary::after { content: ""; }
.top-search { margin-left: auto; }
.top-search input { width: 240px; height: 30px; padding: 3px 12px; font-size: 13px; border-radius: 999px; border: 1px solid var(--border); background: var(--muted); }
.top-search input:focus { background: var(--card); border-color: var(--border-strong); }
.top-search + .topbar-actions { margin-left: 8px; }
@media (max-width: 860px) { .top-search input { width: 150px; } }
.dash-tabs { margin: 0 0 10px; }
.mini-bar { height: 8px; border-radius: 4px; background: var(--muted); overflow: hidden; }
.mini-bar span { display: block; height: 100%; background: var(--accent, #7f9a86); border-radius: 4px; }
.total-row td { border-top: 1px solid var(--border-strong); background: var(--muted); }
.name-cell--narrow b { max-width: 185px; }
.table td.clip { white-space: nowrap; }
.quick-form select { max-width: 150px; }
.quick-form select[name=doctor] { max-width: 80px; }
.quick-form select[name=step] { max-width: 110px; }
.quick-form input[type=date] { width: 130px; }
.quick-form input[type=time] { width: 92px; }
.quick-form .quick-note { flex: 1 1 140px; min-width: 120px; }
/* 06.10: плановые даты этапов лечения */
.phase-dates { margin-left: 8px; font-size: 12px; color: var(--muted-fg); white-space: nowrap; }
.phase-dates.is-late { color: var(--err); }
.phase-plan { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; padding: 4px 0 6px; }
.phase-dates-form { display: inline-flex; flex-wrap: wrap; gap: 4px; align-items: center; margin: 0; }
.phase-dates-form input[type=date] { height: 26px; padding: 1px 6px; font-size: 12px; width: 128px; }
/* 06.10: отчёт «Планирование лечения» */
.plan-bars { position: relative; display: flex; height: 10px; border-radius: 4px; background: var(--muted); overflow: hidden; }
.plan-bars .pb-firm { background: var(--accent, #7f9a86); }
.plan-bars .pb-maybe { background: color-mix(in srgb, var(--accent, #7f9a86) 40%, transparent); }
.plan-bars .pb-fact { position: absolute; left: 0; bottom: 0; height: 3px; background: var(--fg); }
tr.is-past td { color: var(--muted-fg); }
tr.is-now td { background: var(--accent-soft); }
.legend-line { display: flex; gap: 6px 10px; align-items: center; flex-wrap: wrap; padding-bottom: 8px; }
.lg { display: inline-block; width: 14px; height: 8px; border-radius: 2px; }
.lg-firm { background: var(--accent, #7f9a86); } .lg-maybe { background: color-mix(in srgb, var(--accent, #7f9a86) 40%, transparent); } .lg-fact { background: var(--fg); height: 3px; }
/* 06.10: в окне визита / задачи — задача и визит в своих рамках, чтобы не перепутать */
.ctl-box { display: grid; gap: 6px; margin-top: 8px; padding: 8px 10px 10px; border: 1px solid; border-radius: 10px; }
.ctl-box--task { border-color: #b7d3bc; background: #f1f8f2; }
.ctl-box--visit { border-color: #cdc3e2; background: #f6f3fb; }
.ctl-box-head { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: baseline; font-size: 12.5px; }
.ctl-box-head .hint { font-size: 11.5px; }
.ctl-box .ctl-fields { padding: 0; }
.ctl-box-head .ctl-kind--task { background: #e3efe4; color: #3d7a4b; }
.status-note { grid-column: 1 / -1; margin: 0; }
/* 06.10: этапы лечения в окне плана */
.phase-edit input[type=text], .phase-edit input[type=date] { height: 30px; padding: 2px 8px; font-size: 13px; width: 100%; min-width: 0; }
.phase-edit input[name=ph_amount] { width: 96px; text-align: right; }
.phase-edit input[type=date] { width: 124px; padding: 2px 4px; }
.phase-edit td, .phase-edit th { vertical-align: top; padding: 4px 6px; font-size: 13px; }
.phase-edit .phase-new td { background: var(--muted); }
/* 07.10, Ирина: название этапа и «из iDent · услуг N» целиком, суммы и пояснение срока — уже */
.phase-edit input[name=ph_name] { min-width: 250px; }
.phase-edit .sub { white-space: nowrap; font-size: 12px; }
.phase-edit td.clip { max-width: 190px !important; }
/* 09.10, Ирина: таблица шире экрана — полоса прокрутки и сверху, под шапкой страницы (rows.js) */
.scroll-top { overflow-x: auto; overflow-y: hidden; position: sticky; z-index: 5; background: var(--card); border-bottom: 1px solid var(--border); }
.scroll-top > div { height: 1px; }
.panel:has(> .scroll-top) { overflow: clip; }
@media print { .scroll-top { display: none !important; } }
/* 09.10, Ирина: «Гигиена» — в один экран */
.hyg-table th { line-height: 1.25; vertical-align: bottom; }
.hyg-table .details-cell.clip { max-width: 200px; }
/* 09.10, Ирина: несколько действующих планов — метка у суммы (partials/plan_sum.html) */
.plan-n { display: inline-block; padding: 0 6px; border-radius: 999px; background: var(--accent-soft); color: #3f6b5d; font-size: 11.5px; font-weight: 700; line-height: 18px; vertical-align: 1px; }

/* Модуль «Зарплата» (09.10): решения по строке в одну строку, раскрываются по кнопке */
.row-more > summary { list-style: none; cursor: pointer; }
.row-more > summary::-webkit-details-marker { display: none; }
.row-more[open] { position: relative; }
.inline-form { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; margin: 4px 0 0; }
.inline-form select, .inline-form input { font: inherit; font-size: 12.5px; padding: 3px 6px; border: 1px solid var(--border, #ddd); border-radius: 6px; }
.inline-search input { font: inherit; font-size: 13px; padding: 4px 8px; border: 1px solid var(--border, #ddd); border-radius: 6px; }
.table--compact td, .table--compact th { padding-top: 4px; padding-bottom: 4px; }
.row-error td { background: var(--err-soft, #fdecea); }

.sel-bar { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; padding: 6px 12px; border-bottom: 1px solid var(--border, #eee); }
.sel-bar .sel-sep { color: var(--muted-fg); font-size: 12px; }
.sel-bar input[type=text] { font: inherit; font-size: 12.5px; padding: 3px 6px; border: 1px solid var(--border, #ddd); border-radius: 6px; }

.kpi--link { text-decoration: none; color: inherit; cursor: pointer; }
.kpi--link:hover { box-shadow: 0 0 0 2px var(--warn-soft, #fbe7c6); }

.group-row td { background: var(--muted, #f3f3f1); padding-top: 6px; padding-bottom: 6px; }
.subtotal-row td { font-weight: 600; border-top: 1px solid var(--border, #ddd); font-size: 13px; }

/* ---------- График и табель (10.10): сетка «сотрудники × дни», помещается в 1280 ---------- */
.tgrid { table-layout: fixed; width: 100%; }
.tgrid th, .tgrid td { padding: 2px 0 !important; text-align: center; font-size: 11.5px; line-height: 1.25; }
.tgrid .tg-name { text-align: left; padding-left: 10px !important; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tgrid td.tg-name { font-size: 12.5px; padding-right: 18px !important; position: relative; }
.tgrid .tg-day { width: 24px; font-weight: 600; }
.tgrid .tg-day small { display: block; font-weight: 400; font-size: 10px; color: var(--muted-fg); }
.tgrid th.num, .tgrid td.num { width: 40px; text-align: right; padding-right: 8px !important; }
.tgrid th:last-child, .tgrid td:last-child { width: 56px; }
.tgrid .group-row td { text-align: left; padding-left: 10px !important; }
.tgrid td.num { color: var(--fg); }
.tgrid .we { background: #f7f7f5; }
.tgrid th.today { color: var(--accent); }
.tgrid td.tc { border-left: 1px solid var(--border); cursor: pointer; user-select: none; height: 24px; }
[data-schedule] .tgrid td.tc:hover, [data-tabel] .tgrid td.tc:hover { outline: 2px solid var(--accent); outline-offset: -2px; }
.tc.ok { background: var(--accent-soft); }
.tc.pending { color: var(--muted-fg); background: repeating-linear-gradient(135deg, transparent 0 4px, #efefec 4px 5px); }
.tc.changed { background: var(--warn-soft); color: var(--warn); font-weight: 600; }
.tc.extra { background: var(--info-soft); color: var(--info); font-weight: 600; }
.tc.rejected { color: var(--err); background: var(--err-soft); }
.tc.saving { opacity: .5; }
[data-schedule] .tc.ok, [data-schedule] .tc.changed, [data-schedule] .tc.extra { font-weight: 400; }
.tg-row-btn { position: absolute; right: 2px; top: 50%; transform: translateY(-50%); border: 0; background: none; color: var(--muted-fg); cursor: pointer; padding: 0 4px; font-size: 13px; }
.tg-row-btn:hover { color: var(--fg); }
.tg-tools { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between; padding: 8px 12px; }
.tg-brushes { display: flex; flex-wrap: wrap; gap: 4px; }
.tg-brush { display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--border); border-radius: 999px; padding: 1px 10px 1px 4px; font-size: 12px; cursor: pointer; background: var(--card); }
.tg-brush input { position: absolute; opacity: 0; pointer-events: none; }
.tg-brush b { min-width: 20px; text-align: center; }
.tg-brush:has(input:checked) { background: var(--accent-soft); border-color: var(--accent); }
.tg-add { position: relative; }
.tg-add summary { list-style: none; }
.tg-add summary::-webkit-details-marker { display: none; }
.tg-add[open] form { position: absolute; right: 0; top: calc(100% + 4px); z-index: 20; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow); padding: 8px; white-space: nowrap; }
.tg-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: center; }
.tg-legend i { font-style: normal; display: inline-block; min-width: 22px; text-align: center; border-radius: 4px; padding: 0 3px; }
.tg-dialog { border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; width: min(560px, 94vw); }
.tg-dialog::backdrop { background: rgba(49, 49, 49, .25); }
.tg-dialog h3 { margin: 0 0 4px; font-size: 16px; }
.tg-dialog .form-grid { grid-template-columns: 1fr 1fr; }
.tg-dialog .field--wide { grid-column: 1 / -1; }
.tg-type-row { padding: 4px 14px; gap: 8px; }
.warn-text { color: var(--warn); }
@media print { .tgrid td.tc { height: auto; } .tg-row-btn { display: none; } }
.tg-dialog .form-actions { margin-top: 14px; display: flex; justify-content: flex-end; gap: 8px; }
.tg-dialog .hint { margin: 0 0 8px; }

/* 10.10: в «Графике» — план; факт без графика (iDent) бледно */
[data-schedule] .tc.planned { background: var(--accent-soft); }
[data-schedule] .tc.fact-only { color: #b9b9b5; }
.tgrid td.tc.out { background: repeating-linear-gradient(135deg, #f1f1f0 0 3px, #e4e4e1 3px 4px); cursor: not-allowed; }

/* 10.10 (Ирина): шапка с днями закреплена под верхней панелью при прокрутке графика и табеля */
[data-schedule], [data-tabel], [data-schedule] .table-wrap, [data-tabel] .table-wrap { overflow: visible; }
.tgrid thead th { position: sticky; top: var(--topbar-h, 47px); z-index: 5; background: #fafaf9; box-shadow: 0 1px 0 var(--border); }
.tgrid thead th.we { background: #f1f1ee; }
.tgrid thead th:first-child { border-top-left-radius: 10px; }
.tgrid thead th:last-child { border-top-right-radius: 10px; }
@media print { .tgrid thead th { position: static; } }
.row-actions .tg-add[open] form { position: static; box-shadow: none; border: 0; padding: 0; display: inline-flex; }
.row-actions .tg-add[open] { display: inline-flex; align-items: center; gap: 6px; }

/* 10.10 (Ирина): смена из iDent подсвечена всегда — синяя полоска снизу; без графика — ещё и маленькая синяя буква */
[data-schedule] .tc.ident { box-shadow: inset 0 -3px 0 #8fb0cc; }
[data-schedule] .tc.fact-only { color: var(--info); font-size: 10px; }
.tg-legend .ident-mark { display: inline-block; width: 18px; height: 14px; box-shadow: inset 0 -3px 0 #8fb0cc; background: var(--card); border: 1px solid var(--border); border-radius: 3px; vertical-align: middle; }
.tgrid td.tc.out { color: var(--muted-fg); font-weight: 600; }

/* 10.10: дни вне штата (до приёма, после увольнения) — заметно серые, не нажимаются */
.tgrid td.tc.out, .tgrid td.tc.out.we { background: repeating-linear-gradient(135deg, #e6e6e2 0 4px, #d4d4cf 4px 6px); cursor: not-allowed; }
.tg-legend .tc.out { background: repeating-linear-gradient(135deg, #e6e6e2 0 4px, #d4d4cf 4px 6px); }
.row-actions .tg-add[open] form { flex-wrap: nowrap; gap: 6px; }

/* 10.10: сортировка по заголовку колонки */
.table th.sortable { cursor: pointer; user-select: none; }
.table th.sortable:hover { color: var(--fg); }
.table th.sort-asc::after { content: " ▲"; font-size: 9px; color: var(--accent); }
.table th.sort-desc::after { content: " ▼"; font-size: 9px; color: var(--accent); }
@media print { .table th.sort-asc::after, .table th.sort-desc::after { content: ""; } }
.sort-link { color: inherit; text-decoration: none; white-space: nowrap; }
.sort-link:hover { color: var(--fg); text-decoration: underline; }

/* 10.10: фильтры над таблицами */
.tfilter { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; padding: 6px 12px; border-bottom: 1px solid var(--border); }
.tfilter input[type=search] { width: 200px; padding: 3px 8px; font-size: 13px; }
.tfilter select { max-width: 190px; padding: 3px 6px; font-size: 13px; }
.tfilter-total th, .tfilter-total td { color: var(--accent); }/* 12.10: свёрнутая группа строк таблицы (уволенные с незакрытым остатком в расчёте зарплаты) */
tr.is-collapsed { display: none; }
.link-btn { background: none; border: 0; padding: 0; font: inherit; color: inherit; cursor: pointer; text-align: left; }
.link-btn:hover b { text-decoration: underline; }
/* 12.10: действия в карточке справочника — внизу, отдельно */
.card-actions { margin-top: 12px; }
.card-action { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.card-action:last-child { border-bottom: 0; }
.card-action--col { flex-direction: column; align-items: flex-start; }
.btn--danger-soft { color: var(--err); border-color: var(--err-soft, #f0d6d1); }
.btn--danger-soft:hover { background: var(--err-soft, #f8e9e6); }
/* 12.10: строка справочника открывает карточку */
tr[data-href] { cursor: pointer; }
.row-go { width: 1%; color: var(--muted-fg); text-align: right; padding-right: 12px !important; }
tr[data-href]:hover .row-go { color: var(--fg); }
