/* ─────────────────────────────────────────────────────────────────────────
   med-cabinet · Клиника доктора Романовой
   Лаконичный CSS поверх Onest + Lucide. Light/dark через data-theme.
   ───────────────────────────────────────────────────────────────────────── */

:root {
  /* Палитра */
  --brand:        #BC181C;
  --brand-2:      #EB611A;
  --brand-soft:   rgba(188, 24, 28, 0.08);
  --brand-grad:   linear-gradient(135deg, #BC181C 0%, #EB611A 100%);

  /* Нейтральные тона (light) */
  --bg:           #F7F7F5;
  --bg-card:      #FFFFFF;
  --bg-subtle:    #F2F2EF;
  --bg-hover:     #ECECE8;
  --border:       #E4E4E0;
  --border-strong:#D4D4CF;
  --text:         #18181B;
  --text-muted:   #71717A;
  --text-faint:   #A1A1AA;

  /* Семантические */
  --ok:           #16A34A;
  --ok-soft:      #DCFCE7;
  --warning:      #C2410C;
  --warning-soft: #FFEDD5;
  --danger:       #DC2626;
  --danger-soft:  #FEE2E2;

  /* Радиусы / тени */
  --r-sm:  8px;
  --r-md:  12px;
  --r-lg:  16px;
  --r-xl:  20px;
  --shadow-sm: 0 1px 2px rgba(15,23,42,0.04), 0 1px 3px rgba(15,23,42,0.05);
  --shadow-md: 0 2px 8px rgba(15,23,42,0.06), 0 8px 24px rgba(15,23,42,0.06);
  --shadow-pop: 0 8px 32px rgba(188,24,28,0.18);

  /* Spacings (4-px grid) */
  --s-1:  4px;
  --s-2:  8px;
  --s-3:  12px;
  --s-4:  16px;
  --s-5:  20px;
  --s-6:  24px;
  --s-8:  32px;
  --s-10: 40px;
  /* Алиасы по именам — их используют шаблоны */
  --s-xs:   4px;
  --s-sm:   8px;
  --s-md:   12px;
  --s-base: 16px;
  --s-lg:   24px;
  --s-xl:   32px;

  /* Текст */
  --fs-xs: 12px;
  --fs-sm: 13px;
  --fs-base: 14px;
  --fs-lg: 16px;
  --fs-xl: 20px;
}

[data-theme="dark"] {
  --bg:           #0E0E11;
  --bg-card:      #17171B;
  --bg-subtle:    #1F1F24;
  --bg-hover:     #25252B;
  --border:       #2A2A30;
  --border-strong:#3A3A42;
  --text:         #ECEDEE;
  --text-muted:   #9CA3AF;
  --text-faint:   #6B7280;
  --brand-soft:   rgba(235, 97, 26, 0.14);
  --ok-soft:      rgba(22,163,74,0.18);
  --warning-soft: rgba(194,65,12,0.22);
  --danger-soft:  rgba(220,38,38,0.22);
  --shadow-sm:    0 1px 2px rgba(0,0,0,0.30);
  --shadow-md:    0 2px 8px rgba(0,0,0,0.40), 0 8px 24px rgba(0,0,0,0.40);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: "Onest", -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", sans-serif;
  font-size: var(--fs-base);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
a:hover { color: var(--brand); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, h4 { margin: 0 0 var(--s-3); font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: 24px; }
h2 { font-size: 18px; }
h3 { font-size: 15px; }
.muted { color: var(--text-muted); }

/* Lucide icons: дефолтный размер + цвет */
[data-lucide], svg.lucide {
  width: 18px; height: 18px;
  stroke-width: 2;
  vertical-align: middle;
  flex-shrink: 0;
}

/* ── Header ─────────────────────────────────────────────────────────────── */
.app-header {
  position: sticky; top: 0; z-index: 30;
  display: grid;
  grid-template-columns: minmax(220px, auto) 1fr auto;
  align-items: center;
  gap: var(--s-6);
  padding: var(--s-3) var(--s-6);
  background: color-mix(in srgb, var(--bg-card) 92%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.app-header__brand a {
  display: flex; align-items: center; gap: var(--s-3);
  color: inherit;
}
.app-header__brand a:hover { color: inherit; }
.app-header__brand img {
  width: 40px; height: 40px;
}
.app-header__brand-title  { font-size: var(--fs-base); font-weight: 600; line-height: 1.2; }
.app-header__brand-subtitle { font-size: var(--fs-xs); color: var(--text-muted); }

.app-nav {
  display: flex; gap: var(--s-1); flex-wrap: wrap;
  justify-self: center;
}
.app-nav__link {
  display: inline-flex; align-items: center; gap: var(--s-2);
  padding: 8px 14px;
  border-radius: 999px;
  color: var(--text-muted);
  font-size: var(--fs-sm); font-weight: 500;
  transition: background 0.15s, color 0.15s;
}
.app-nav__link [data-lucide], .app-nav__link svg.lucide { width: 16px; height: 16px; }
.app-nav__link:hover { background: var(--bg-subtle); color: var(--text); }
.app-nav__link.is-active { background: var(--brand-soft); color: var(--brand); }

.app-header__actions { display: flex; gap: var(--s-2); align-items: center; }

.user-chip {
  display: flex; flex-direction: column; line-height: 1.15;
  padding: 6px 12px; border-radius: var(--r-md);
  background: var(--bg-subtle); font-size: var(--fs-sm); max-width: 220px;
}
.user-chip strong { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-chip span { font-size: var(--fs-xs); color: var(--text-muted); }

/* ── Page shell ─────────────────────────────────────────────────────────── */
.page-shell {
  max-width: 1280px;
  margin: 0 auto;
  padding: var(--s-6);
}
@media (max-width: 720px) {
  .app-header {
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    padding: var(--s-3) var(--s-4);
  }
  .app-nav { grid-column: 1 / -1; justify-self: stretch; overflow-x: auto; flex-wrap: nowrap; }
  .app-nav__link { flex-shrink: 0; }
  .page-shell { padding: var(--s-4); }
  .user-chip { display: none; }
}

/* ── Flash ──────────────────────────────────────────────────────────────── */
.flash-stack {
  max-width: 1280px; margin: var(--s-4) auto 0; padding: 0 var(--s-6);
  display: flex; flex-direction: column; gap: var(--s-2);
}
.alert {
  display: flex; align-items: center; gap: var(--s-2);
  padding: var(--s-3) var(--s-4);
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  font-size: var(--fs-sm);
}
.alert-success { background: var(--ok-soft); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 20%, transparent); }
.alert-danger  { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 20%, transparent); }

/* ── Cards / panels ─────────────────────────────────────────────────────── */
.panel, .hero-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--s-5);
  box-shadow: var(--shadow-sm);
}
section + section { margin-top: var(--s-5); }
/* вертикальные стопки панелей (вне flex-грида) */
.page-shell > .panel + .panel { margin-top: var(--s-5); }
.hero-card {
  display: flex; justify-content: space-between; align-items: center; gap: var(--s-6);
  padding: var(--s-6);
  margin-bottom: var(--s-5);
  background: linear-gradient(135deg, var(--bg-card) 0%, color-mix(in srgb, var(--brand) 4%, var(--bg-card)) 100%);
}
.hero-card h1 { margin: 0; }
.hero-card p { margin: var(--s-2) 0 0; color: var(--text-muted); }
.hero-stats { display: flex; gap: var(--s-3); flex-wrap: wrap; }
.hero-stat {
  min-width: 120px;
  padding: var(--s-3) var(--s-4);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  text-align: right;
}
.hero-stat span { display: block; font-size: var(--fs-xs); color: var(--text-muted); margin-bottom: 2px; }
.hero-stat strong { font-size: 22px; font-weight: 600; }
a.hero-stat { transition: border-color 0.15s, transform 0.06s; }
a.hero-stat:hover { border-color: var(--brand); color: inherit; }
a.hero-stat:active { transform: translateY(1px); }

/* Кликабельные алерт-плитки на дашборде */
a.alert-stat { cursor: pointer; transition: transform 0.06s, filter 0.15s; }
a.alert-stat:hover { filter: brightness(0.97); color: inherit; }
a.alert-stat:active { transform: translateY(1px); }
@media (max-width: 720px) {
  .hero-card { flex-direction: column; align-items: stretch; }
  .hero-stats { justify-content: flex-start; }
  .hero-stat { text-align: left; }
}

.section-head {
  display: flex; justify-content: space-between; align-items: center; gap: var(--s-3);
  margin-bottom: var(--s-4);
  flex-wrap: wrap;
}
.section-head h1, .section-head h2 { margin: 0; }

.dashboard-grid {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: var(--s-5);
  margin-bottom: var(--s-5);
}
.dashboard-grid > * { flex: 1 1 340px; min-width: 0; }
.cols-3 > * { flex-basis: 260px; }

/* Карточка аппарата на главной: ровная высота, кнопка прижата к низу */
.device-card { display: flex; flex-direction: column; gap: var(--s-3); }
.device-card__head {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s-3);
  min-height: 30px;
}
.device-card__head h2 { margin: 0; line-height: 30px; }
.device-card__meta { margin: 0; font-size: var(--fs-xs); }
.device-card__footer { margin-top: auto; }
.lamp-stats > div { display: flex; flex-direction: column; gap: 2px; }

/* ── Buttons ────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 16px;
  border: 1px solid transparent;
  border-radius: var(--r-md);
  font-size: var(--fs-sm); font-weight: 500;
  background: var(--bg-subtle); color: var(--text);
  cursor: pointer;
  transition: background 0.15s, transform 0.06s, border-color 0.15s;
  white-space: nowrap;
}
.btn:hover { background: var(--bg-hover); }
.btn:active { transform: translateY(1px); }
.btn [data-lucide], .btn svg.lucide { width: 16px; height: 16px; }

.btn-primary {
  background: var(--brand-grad); color: #fff;
  box-shadow: var(--shadow-pop);
  border-color: transparent;
}
.btn-primary:hover { filter: brightness(1.05); background: var(--brand-grad); color: #fff; }

.btn-secondary { background: var(--bg-card); border-color: var(--border-strong); }
.btn-secondary:hover { background: var(--bg-subtle); }

.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--bg-subtle); color: var(--text); }

.btn-sm  { padding: 6px 12px; font-size: var(--fs-xs); }
.btn-lg  { padding: 12px 20px; font-size: var(--fs-base); }
.btn-block { width: 100%; }

.btn-icon {
  width: 38px; height: 38px;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0;
  border: 1px solid var(--border);
  background: var(--bg-card);
  border-radius: var(--r-md);
  color: var(--text-muted);
}
.btn-icon:hover { background: var(--bg-subtle); color: var(--text); }

/* Theme toggle: показывать одну иконку из двух */
.theme-toggle__icon-light { display: inline-flex; }
.theme-toggle__icon-dark  { display: none; }
[data-theme="dark"] .theme-toggle__icon-light { display: none; }
[data-theme="dark"] .theme-toggle__icon-dark  { display: inline-flex; }

/* ── Forms ──────────────────────────────────────────────────────────────── */
.form-grid {
  display: grid; gap: var(--s-3);
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.form-grid > h3, .form-grid > p, .form-grid > button, .form-grid > .full {
  grid-column: 1 / -1;
}
.form-grid > button { justify-self: start; }
.form-label, .form-group {
  display: flex; flex-direction: column; gap: 6px;
  font-size: var(--fs-sm); font-weight: 500; color: var(--text);
}
.form-control {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  font-size: var(--fs-base);
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.form-control:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}
textarea.form-control { min-height: 80px; resize: vertical; }
select.form-control {
  appearance: none; padding-right: 28px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2'><path d='M6 9l6 6 6-6'/></svg>");
  background-repeat: no-repeat; background-position: right 10px center;
}

@media (max-width: 600px) {
  .form-grid { grid-template-columns: 1fr; }
}

/* Password show/hide */
.password-field { position: relative; }
.password-field .form-control { padding-right: 44px; }
.password-toggle {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 32px; height: 32px; border: none; background: transparent; color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--r-sm);
}
.password-toggle:hover { background: var(--bg-subtle); }

/* TOTP code input — крупный, центрованный */
.totp-input {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 28px; letter-spacing: 0.4em;
  text-align: center;
  padding: 14px 18px;
}

/* ── Tables ─────────────────────────────────────────────────────────────── */
.data-table {
  width: 100%; border-collapse: collapse;
  font-size: var(--fs-sm);
}
.data-table th, .data-table td {
  text-align: left;
  padding: var(--s-3) var(--s-2);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.data-table th {
  color: var(--text-muted);
  font-size: var(--fs-xs); font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.04em;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--bg-subtle); }
.data-table a { color: var(--text); }
.data-table a:hover { color: var(--brand); }

/* ── Badges ─────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.04em;
  background: var(--bg-subtle); color: var(--text-muted);
  white-space: nowrap;
}
.badge.ok       { background: var(--ok-soft); color: var(--ok); }
.badge.warning  { background: var(--warning-soft); color: var(--warning); }
.badge.critical, .badge.error { background: var(--danger-soft); color: var(--danger); }

/* ── Lamp progress ──────────────────────────────────────────────────────── */
.lamp-progress {
  background: var(--bg-subtle);
  border-radius: 999px;
  height: 10px;
  overflow: hidden;
  margin: var(--s-2) 0;
}
.lamp-progress__bar { height: 100%; transition: width 0.4s ease; border-radius: 999px; }
.lamp-progress__bar--ok       { background: linear-gradient(90deg, #16A34A, #22C55E); }
.lamp-progress__bar--warning  { background: linear-gradient(90deg, #C2410C, #EA580C); }
.lamp-progress__bar--critical { background: linear-gradient(90deg, #DC2626, #EF4444); }

.lamp-stats {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s-3);
  margin-top: var(--s-3);
}
.lamp-stats > div { padding: var(--s-3); background: var(--bg-subtle); border-radius: var(--r-md); }
.lamp-stats strong { display: block; font-size: 17px; font-weight: 600; }
.lamp-stats .muted { font-size: var(--fs-xs); }

/* ── Alert blocks ───────────────────────────────────────────────────────── */
.alert-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s-2);
  margin: var(--s-3) 0;
}
.alert-stat {
  padding: var(--s-3); border-radius: var(--r-md);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  text-align: center;
  display: flex; flex-direction: column; gap: 2px;
}
.alert-stat strong { font-size: 22px; font-weight: 600; }
.alert-stat span   { font-size: var(--fs-xs); color: var(--text-muted); }
.alert-stat--critical { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 20%, transparent); }
.alert-stat--warning  { background: var(--warning-soft); color: var(--warning); border-color: color-mix(in srgb, var(--warning) 20%, transparent); }
.alert-stat--critical span,
.alert-stat--warning span { color: inherit; opacity: 0.8; }

.alert-list { list-style: none; padding: 0; margin: var(--s-2) 0 0; }
.alert-list li {
  display: flex; justify-content: space-between; align-items: center;
  gap: var(--s-2);
  padding: var(--s-2) 0;
  border-bottom: 1px solid var(--border);
}
.alert-list li:last-child { border-bottom: none; }
.alert-list a { color: var(--text); font-size: var(--fs-sm); }
.alert-list a:hover { color: var(--brand); }

/* ── Details collapsible ────────────────────────────────────────────────── */
details > summary { list-style: none; cursor: pointer; }
details > summary::-webkit-details-marker { display: none; }
details > summary::before {
  content: "▸"; display: inline-block; margin-right: 6px;
  transition: transform 0.2s; color: var(--text-muted);
}
details[open] > summary::before { transform: rotate(90deg); }
/* навигация и меню пользователя используют собственный chevron / без маркера */
.nav-group > summary::before, .user-menu > summary::before { content: none; }

/* ── Auth pages ─────────────────────────────────────────────────────────── */
.auth-page {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: var(--s-6);
  background:
    radial-gradient(circle at 90% 10%, var(--brand-soft) 0%, transparent 50%),
    radial-gradient(circle at 10% 90%, color-mix(in srgb, var(--brand-2) 8%, transparent) 0%, transparent 50%),
    var(--bg);
}
.auth-card {
  width: 100%; max-width: 420px;
  padding: var(--s-8);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-md);
}
.auth-card__brand {
  display: flex; flex-direction: column; align-items: center; gap: var(--s-3);
  margin-bottom: var(--s-6);
  text-align: center;
}
.auth-card__logo { width: 200px; height: auto; display: block; }
.auth-card__mark {
  width: 56px; height: 56px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--brand-grad); color: #fff;
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-pop);
}
.auth-card__mark [data-lucide], .auth-card__mark svg.lucide { width: 26px; height: 26px; }
.auth-card__title    { margin: 0; font-size: 22px; }
.auth-card__subtitle { margin: 0; color: var(--text-muted); font-size: var(--fs-sm); }
.auth-form { display: flex; flex-direction: column; gap: var(--s-4); }

@media (max-width: 480px) {
  .auth-card { padding: var(--s-5); }
  .totp-input { font-size: 24px; letter-spacing: 0.3em; }
}

.full { grid-column: 1 / -1; }

/* ── Фильтр-тумблеры на складских страницах ─────────────────────────────── */
.filter-toggles { display: flex; gap: var(--s-3); flex-wrap: wrap; align-items: center; }
.chk {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: var(--fs-sm); color: var(--text-muted); cursor: pointer;
  padding: 6px 10px; border-radius: var(--r-md); border: 1px solid var(--border);
  background: var(--bg-card); user-select: none;
}
.chk:hover { background: var(--bg-subtle); }
.chk input { accent-color: var(--brand); }
.chk:has(input:checked) { color: var(--brand); border-color: var(--brand); background: var(--brand-soft); }

/* ── Раскрывающиеся строки позиций ──────────────────────────────────────── */
.items-table .item-row { cursor: pointer; }
.items-table .item-row:hover td { background: var(--bg-subtle); }
.items-table .item-row.is-open td { background: var(--brand-soft); }
.items-table .item-name { font-weight: 500; }
.expand-cell { text-align: center; color: var(--text-muted); }
.expand-ico { transition: transform 0.18s; width: 16px; height: 16px; }
.item-row.is-open .expand-ico { transform: rotate(90deg); color: var(--brand); }

.detail-row > td { background: var(--bg-subtle); padding: 0; }
.batch-panel { padding: var(--s-4); }
.batch-table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); margin-bottom: var(--s-3); }
.batch-table th {
  text-align: left; font-size: var(--fs-xs); font-weight: 600;
  color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.03em;
  padding: 6px 10px; border-bottom: 1px solid var(--border);
}
.batch-table td { padding: 8px 10px; border-bottom: 1px solid var(--border); }
.batch-table tr:last-child td { border-bottom: none; }

.batch-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-3); }
.inline-form { display: inline-flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; margin: 0; }
.inline-receipt > summary { display: inline-flex; }
.inline-receipt > summary::before { content: none; }

/* Кликабельные плитки-фильтры в hero */
.hero-stat--btn {
  cursor: pointer; font: inherit; text-align: right;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.06s;
}
.hero-stat--btn:hover { border-color: var(--brand); }
.hero-stat--btn:active { transform: translateY(1px); }
.hero-stat--btn.is-active {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}
.hero-stat--btn.is-active strong { color: var(--brand); }

/* ── Danger button + confirm dialog ─────────────────────────────────────── */
.btn-danger {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
  box-shadow: 0 6px 24px rgba(220,38,38,0.30);
  font-weight: 600;
}
.btn-danger:hover {
  background: #B91C1C;
  filter: brightness(1.05);
  color: #fff;
}
.btn-danger:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px rgba(220,38,38,0.30), 0 6px 24px rgba(220,38,38,0.30);
}

.confirm-dialog {
  border: none;
  padding: var(--s-6);
  border-radius: var(--r-xl);
  background: var(--bg-card);
  color: var(--text);
  box-shadow: var(--shadow-md);
  max-width: 420px;
  width: calc(100% - 32px);
}
.confirm-dialog::backdrop {
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(2px);
}
.confirm-dialog h3 {
  margin: var(--s-3) 0 var(--s-2);
  font-size: 18px;
  text-align: center;
}
.confirm-dialog p {
  margin: 0 0 var(--s-4);
  font-size: var(--fs-sm);
  text-align: center;
  line-height: 1.5;
}
.confirm-dialog__icon {
  width: 56px; height: 56px;
  margin: 0 auto;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: var(--warning-soft);
  color: var(--warning);
}
.confirm-dialog__icon--danger { background: var(--danger-soft); color: var(--danger); }
.confirm-dialog__icon [data-lucide],
.confirm-dialog__icon svg.lucide { width: 28px; height: 28px; }

.confirm-actions {
  display: flex; flex-direction: column; gap: var(--s-2);
  align-items: stretch;
}
.confirm-actions .btn-danger { width: 100%; padding: 14px 18px; font-size: var(--fs-base); }
.confirm-actions .btn-ghost  { align-self: center; opacity: 0.6; font-size: var(--fs-xs); }
.confirm-actions .btn-ghost:hover { opacity: 1; }

/* ── doctor-cabinet additions ─────────────────────────────────────────── */
.detail-row { display: flex; justify-content: space-between; gap: 16px; padding: 8px 0; border-bottom: 1px solid var(--border, rgba(128,128,128,.15)); font-size: var(--fs-sm, 14px); }
.detail-row:last-of-type { border-bottom: 0; }
.detail-row strong { text-align: right; }

.encounter { border: 1px solid var(--border, rgba(128,128,128,.2)); border-radius: 10px; margin-bottom: 10px; overflow: hidden; }
.encounter summary { padding: 10px 14px; cursor: pointer; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.encounter summary::-webkit-details-marker { display: none; }
.encounter[open] summary { border-bottom: 1px solid var(--border, rgba(128,128,128,.2)); }
.encounter__body { padding: 12px 14px; }
.encounter__field { margin-bottom: 10px; }
.encounter__field .muted { font-size: var(--fs-xs, 12px); text-transform: uppercase; letter-spacing: .04em; }

.photo-upload { grid-template-columns: repeat(3, 1fr); }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; }
.photo-card { margin: 0; border: 1px solid var(--border, rgba(128,128,128,.2)); border-radius: 10px; overflow: hidden; }
.photo-card img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; }
.photo-card figcaption { padding: 8px 10px; display: flex; flex-direction: column; gap: 2px; font-size: var(--fs-sm, 13px); }

@media (max-width: 720px) {
  .photo-upload { grid-template-columns: 1fr; }
  .detail-row { flex-direction: column; gap: 2px; }
  .detail-row strong { text-align: left; }
}

/* ═══ v2: cockpit layout (sidebar + full-viewport workspace) ═══════════════ */
html, body { height: 100%; }
body { overflow: hidden; }
body.allow-scroll { overflow: auto; }   /* страницы логина/печати */

.layout { display: grid; grid-template-columns: 212px minmax(0,1fr); height: 100vh; }

.sidebar { display: flex; flex-direction: column; gap: var(--s-2); background: var(--bg-card);
  border-right: 1px solid var(--border); padding: var(--s-4) var(--s-3); min-height: 0; }
.sidebar__brand { display: flex; align-items: center; gap: 10px; padding: 2px 6px 10px; border-bottom: 1px solid var(--border); }
.sidebar__brand img { width: 34px; height: 34px; }
.sidebar__brand-title { font-size: var(--fs-sm); font-weight: 700; line-height: 1.15; }
.sidebar__brand-sub { font-size: var(--fs-xs); color: var(--text-muted); }
.sidebar__nav { display: flex; flex-direction: column; gap: 2px; margin-top: var(--s-2); flex: 1; }
.sidebar__nav a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: var(--r-sm);
  color: var(--text-muted); text-decoration: none; font-size: var(--fs-sm); font-weight: 500; transition: background .12s, color .12s; }
.sidebar__nav a:hover { background: var(--bg-hover); color: var(--text); }
.sidebar__nav a.is-active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.sidebar__nav a svg, .sidebar__nav a i { width: 17px; height: 17px; }
.sidebar__foot { border-top: 1px solid var(--border); padding-top: var(--s-3); display: flex; flex-direction: column; gap: var(--s-2); }

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.topbar { display: flex; align-items: center; gap: var(--s-4); padding: 10px var(--s-5); }
.topbar h1 { font-size: 19px; margin: 0; white-space: nowrap; }
.topbar__search { flex: 1; max-width: 520px; position: relative; }
.topbar__search input { width: 100%; padding: 8px 12px 8px 34px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--bg-card); color: var(--text); font: inherit; font-size: var(--fs-sm); }
.topbar__search i, .topbar__search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--text-faint); pointer-events: none; }
.topbar__right { margin-left: auto; display: flex; align-items: center; gap: var(--s-3); flex-wrap: wrap; justify-content: flex-end; }

.workspace { flex: 1; min-height: 0; overflow: auto; padding: 0 var(--s-5) var(--s-4); }
.workspace--fixed { overflow: hidden; display: flex; flex-direction: column; }

/* панели-виджеты */
.wgrid { display: grid; gap: var(--s-3); height: 100%; min-height: 0; }
.wgrid > * { min-width: 0; }
.panel { min-height: 0; min-width: 0; display: flex; flex-direction: column; }
.panel__body { flex: 1; min-height: 0; overflow: auto; }
.panel .section-head { flex: 0 0 auto; }
.panel .section-head h2 { font-size: 15px; }

/* плитки-статы */
.tiles { display: grid; grid-template-columns: repeat(5, 1fr); gap: var(--s-3); }
.tile { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--r-md);
  padding: 10px 14px; display: flex; flex-direction: column; gap: 2px; text-decoration: none; color: inherit; }
.tile span { font-size: var(--fs-xs); color: var(--text-muted); }
.tile strong { font-size: 22px; font-weight: 700; line-height: 1.1; }
.tile:hover { border-color: var(--border-strong); }

/* мини-календарь */
.mini-cal { width: 100%; border-collapse: collapse; table-layout: fixed; }
.mini-cal th { font-size: 10px; text-transform: uppercase; color: var(--text-faint); padding: 3px 0; font-weight: 600; }
.mini-cal td { text-align: center; padding: 1px; }
.mini-cal a, .mini-cal span.d { display: flex; flex-direction: column; align-items: center; justify-content: center;
  height: 34px; border-radius: 8px; text-decoration: none; color: var(--text); font-size: var(--fs-xs); line-height: 1.1; }
.mini-cal a:hover { background: var(--bg-hover); }
.mini-cal .out { color: var(--text-faint); }
.mini-cal .today { background: var(--brand-soft); color: var(--brand); font-weight: 700; }
.mini-cal .cnt { font-size: 9px; color: var(--brand-2); font-weight: 700; }

/* календарь на месяц (расписание) */
.month-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; flex: 1; min-height: 0;
  grid-auto-rows: 1fr; }
.month-grid__head { font-size: var(--fs-xs); text-transform: uppercase; color: var(--text-faint); font-weight: 600; padding: 2px 6px; }
.mday { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 6px 8px;
  display: flex; flex-direction: column; gap: 4px; text-decoration: none; color: inherit; min-height: 0; overflow: hidden; }
.mday:hover { border-color: var(--brand-2); }
.mday--out { opacity: .38; }
.mday--today { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand) inset; }
.mday__num { font-size: var(--fs-sm); font-weight: 600; }
.mday__bar { height: 6px; border-radius: 3px; background: var(--brand-grad); }
.mday__cnt { font-size: var(--fs-xs); color: var(--text-muted); }

/* недельная сетка */
.week-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: var(--s-2); flex: 1; min-height: 0; }
.wday { display: flex; flex-direction: column; min-height: 0; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--r-md); }
.wday--today { border-color: var(--brand); }
.wday__head { padding: 7px 10px; border-bottom: 1px solid var(--border); font-size: var(--fs-sm); font-weight: 600; display:flex; justify-content:space-between; align-items:baseline; }
.wday__head small { color: var(--text-muted); font-weight: 400; }
.wday__list { flex: 1; overflow: auto; padding: 6px; display: flex; flex-direction: column; gap: 5px; }
.talon { border: 1px solid var(--border); border-left: 3px solid var(--brand-2); border-radius: 8px;
  padding: 5px 8px; font-size: var(--fs-xs); text-decoration: none; color: inherit; background: var(--bg-subtle); }
.talon:hover { border-color: var(--brand-2); }
.talon--done { border-left-color: var(--ok); }
.talon--cancel { border-left-color: var(--text-faint); opacity: .6; }
.talon b { font-size: var(--fs-xs); }
.talon .t { color: var(--text-muted); }

/* свободные окна в расписании врача: слоты зелёные, записи красноватые (2026-08-06) */
.talon--gap { background: var(--ok-soft); color: var(--ok);
  border: 1px dashed color-mix(in srgb, var(--ok) 45%, transparent); border-left-width: 3px; }
.row-gap td { background: var(--ok-soft); color: var(--ok); font-weight: 600; }
.row-busy td { background: color-mix(in srgb, var(--danger) 5%, transparent); }

/* компактная шапка страницы внутри workspace */
.page-head { display: flex; align-items: center; gap: var(--s-3); margin: 2px 0 var(--s-3); flex-wrap: wrap; }
.page-head .spacer { flex: 1; }

/* ── Свёрнутый сайдбар (кнопка или узкий экран) ── */
.layout.nav-collapsed { grid-template-columns: 64px minmax(0,1fr); }
.nav-collapsed .sidebar__brand-title,
.nav-collapsed .sidebar__brand-sub,
.nav-collapsed .sidebar__nav a span,
.nav-collapsed .nav-group summary span,
.nav-collapsed .nav-group__chev,
.nav-collapsed .nav-badge,
.nav-collapsed .nav-group__items,
.nav-collapsed .sidebar__foot .btn span,
.nav-collapsed #nav-collapse span { display: none; }
.nav-collapsed .sidebar__nav a,
.nav-collapsed .nav-group summary { justify-content: center; }
.nav-collapsed .sidebar__brand { justify-content: center; }
#nav-collapse { display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 8px; border: 1px solid var(--border); background: none;
  color: var(--text-muted); border-radius: var(--r-sm); cursor: pointer; font-size: var(--fs-sm); }
#nav-collapse:hover { background: var(--bg-hover); color: var(--text); }
.nav-collapsed #nav-collapse .nav-collapse__icon { transform: rotate(180deg); }
.nav-collapse__icon { transition: transform .18s; }
/* в свёрнутом виде иконка группы кликабельна как кнопка (курсор) */
.nav-collapsed .nav-group > summary { cursor: pointer; }

@media (max-width: 1100px) {
  body { overflow: auto; }
  .layout { grid-template-columns: 64px minmax(0,1fr); }
  .sidebar__brand-title, .sidebar__brand-sub, .sidebar__nav a span,
  .nav-group summary span, .nav-group__chev, .nav-badge, .nav-group__items,
  .sidebar__foot .btn span, #nav-collapse { display: none; }
  .sidebar__nav a, .nav-group summary { justify-content: center; }
  .tiles { grid-template-columns: repeat(2, 1fr); }
  .wgrid, .week-grid, .month-grid { height: auto; }
}

/* ═══ карта тела (локализация фото) ════════════════════════════════════════ */
.bodymap { position: relative; display: block; user-select: none; max-width: 100%; }
.bodymap img { display: block; width: 100%; height: auto; pointer-events: none; }
.bodymap--clickable { cursor: crosshair; border: 1px dashed var(--border-strong); border-radius: var(--r-sm); }
.bodymap--clickable:hover { border-color: var(--brand-2); }
.bodymap__dot { position: absolute; width: 13px; height: 13px; border-radius: 50%;
  background: var(--brand); border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.35);
  transform: translate(-50%, -50%); }
.bodymap__dot--link { cursor: pointer; transition: transform .1s; }
.bodymap__dot--link:hover { transform: translate(-50%, -50%) scale(1.45); z-index: 2; }
.bodymap__hint { font-size: var(--fs-xs); color: var(--text-muted); text-align: center; margin: 4px 0 0; }
.bodymap__sides { display: flex; justify-content: space-around; font-size: 10px; color: var(--text-faint);
  text-transform: uppercase; letter-spacing: .05em; margin-top: 2px; }

/* выбор локализации: одна фигура крупно + переключатель перед/зад */
.bodypick { max-width: 210px; margin: 0 auto; }
.bodypick__tabs { display: flex; gap: 4px; margin-bottom: 6px; }
.bodypick__tabs button { flex: 1; }
.bodypick__view { position: relative; width: 100%; aspect-ratio: 320 / 960; overflow: hidden;
  border: 1px dashed var(--border-strong); border-radius: var(--r-sm); cursor: crosshair; }
.bodypick__view:hover { border-color: var(--brand-2); }
.bodypick__view img { position: absolute; top: 0; left: 0; height: 100%; width: 200%; pointer-events: none; }
.bodypick__view.is-back img { left: -100%; }
.bodypick__dot { position: absolute; min-width: 18px; height: 18px; border-radius: 9px; padding: 0 3px;
  background: var(--brand); border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.4);
  transform: translate(-50%, -50%); pointer-events: none;
  color: #fff; font-size: 11px; font-weight: 700; line-height: 14px; text-align: center; }

/* lucide заменяет <i> на <svg> и теряет inline-стили — иконки в текстовом
   контексте держим строчными (кнопки/сайдбар живут своим флексом) */
h1 > svg, h2 > svg, h3 > svg, .form-label > svg, p > svg, summary > svg,
td > svg, .muted > svg, .page-head svg {
  display: inline-block; width: 1em; height: 1em; vertical-align: -0.15em;
}

/* ═══ Портал: чат / бейджи / модалки (2026-07-07) ═══ */
.nav-badge{margin-left:auto;background:var(--red,#e5484d);color:#fff;border-radius:999px;
  font-size:11px;line-height:1;padding:3px 7px;font-weight:700;min-width:18px;text-align:center;}
.chat-layout{display:grid;grid-template-columns:300px 1fr;gap:var(--s-4,16px);height:100%;min-height:0;}
.chat-list{display:flex;flex-direction:column;min-height:0;padding:0;}
.chat-list__head{display:flex;gap:8px;align-items:center;justify-content:space-between;
  padding:var(--s-3,12px);border-bottom:1px solid var(--border,rgba(128,128,128,.2));}
.chat-list__items{overflow-y:auto;min-height:0;flex:1;}
.chat-item{display:flex;gap:10px;align-items:center;padding:10px var(--s-3,12px);
  text-decoration:none;color:inherit;border-bottom:1px solid var(--border,rgba(128,128,128,.12));}
.chat-item:hover{background:var(--bg-hover,rgba(128,128,128,.08));}
.chat-item.is-active{background:var(--bg-hover,rgba(128,128,128,.14));}
.chat-item__avatar{font-size:20px;flex:none;}
.chat-item__body{min-width:0;flex:1;}
.chat-item__title{font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.chat-item__last{font-size:12px;opacity:.65;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.chat-item__unread{background:var(--red,#e5484d);color:#fff;border-radius:999px;
  font-size:11px;padding:3px 7px;font-weight:700;flex:none;}
.chat-main{display:flex;flex-direction:column;min-height:0;padding:0;}
.chat-main__head{display:flex;justify-content:space-between;align-items:center;
  padding:var(--s-3,12px);border-bottom:1px solid var(--border,rgba(128,128,128,.2));}
.chat-main__members{display:flex;gap:4px;align-items:center;font-size:13px;}
.chat-msgs{flex:1;overflow-y:auto;overflow-x:hidden;min-height:0;padding:var(--s-3,12px);
  display:flex;flex-direction:column;gap:8px;}
.msg{display:flex;}
.msg--mine{justify-content:flex-end;}
.msg__bubble{max-width:72%;background:var(--bg-hover,rgba(128,128,128,.10));
  border-radius:14px;padding:8px 12px;position:relative;}
.msg--mine .msg__bubble{background:var(--accent-soft,rgba(70,120,220,.16));}
.msg__author{font-size:12px;font-weight:700;opacity:.75;margin-bottom:2px;}
.msg__text{white-space:pre-wrap;word-break:break-word;}
.msg__meta{display:flex;gap:8px;justify-content:flex-end;align-items:center;
  font-size:11px;opacity:.55;margin-top:2px;}
.msg-eye{cursor:default;}
.msg-eye em{font-style:normal;}
.msg__foot{margin-top:2px;}
.msg-reacts{display:inline-flex;gap:4px;flex-wrap:wrap;align-items:center;}
.react{border:1px solid var(--border,rgba(128,128,128,.25));background:transparent;
  border-radius:999px;padding:1px 7px;font-size:12px;cursor:pointer;}
.react.is-mine{border-color:var(--accent,#4678dc);background:var(--accent-soft,rgba(70,120,220,.14));}
.react-add{position:relative;cursor:pointer;opacity:.5;padding:0 4px;}
.react-add:hover{opacity:1;}
/* пикер открывается ВНИЗ; появляется сразу, скрывается с задержкой,
   чтобы успеть довести курсор. Верхний отступ-«мостик» убирает зазор. */
.react-menu{display:flex;gap:2px;position:absolute;top:100%;left:0;margin-top:0;padding-top:10px;
  opacity:0;visibility:hidden;transform:translateY(4px);pointer-events:none;z-index:30;
  transition:opacity .15s, visibility .15s, transform .15s;transition-delay:.45s;white-space:nowrap;}
.react-menu__inner{display:flex;gap:2px;background:var(--panel-bg,#222);
  border:1px solid var(--border,rgba(128,128,128,.3));border-radius:10px;padding:4px;
  box-shadow:0 6px 24px rgba(0,0,0,.25);}
.msg--mine .react-menu{left:auto;right:0;}
.react-add:hover .react-menu, .react-menu:hover{opacity:1;visibility:visible;transform:none;
  pointer-events:auto;transition-delay:0s;}
.react-menu button{font-size:18px;line-height:1;background:none;border:none;cursor:pointer;padding:2px 4px;}
.react-menu button:hover{transform:scale(1.25);}
.react-menu button{background:none;border:none;font-size:17px;cursor:pointer;padding:2px 4px;}
.react-menu button:hover{transform:scale(1.25);}
.msg-enc{display:flex;gap:8px;align-items:center;border:1px solid var(--border,rgba(128,128,128,.3));
  border-radius:10px;padding:8px 10px;margin-bottom:4px;text-decoration:none;color:inherit;font-size:13px;}
.msg-enc:hover{border-color:var(--accent,#4678dc);}
.chat-input{display:flex;gap:8px;align-items:flex-end;padding:var(--s-3,12px);
  border-top:1px solid var(--border,rgba(128,128,128,.2));}
.chat-input textarea{flex:1;resize:none;border-radius:12px;padding:9px 12px;
  border:1px solid var(--border,rgba(128,128,128,.3));background:transparent;color:inherit;
  font:inherit;max-height:120px;}
.chat-empty{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px;}
.modal{border:none;border-radius:16px;padding:var(--s-5,20px);max-width:520px;width:92vw;
  background:var(--panel-bg,#fff);color:inherit;max-height:80vh;overflow-y:auto;}
:root[data-theme="dark"] .modal{background:#17171c;}
.modal::backdrop{background:rgba(0,0,0,.5);}
.chat-person{display:flex;justify-content:space-between;width:100%;padding:9px 10px;background:none;
  border:none;border-bottom:1px solid var(--border,rgba(128,128,128,.12));cursor:pointer;
  color:inherit;font:inherit;text-align:left;}
.chat-person:hover{background:var(--bg-hover,rgba(128,128,128,.08));}
.chat-member-picker{max-height:240px;overflow-y:auto;display:flex;flex-direction:column;gap:6px;}
.chat-check{display:flex;gap:8px;align-items:center;cursor:pointer;}
.enc-view dt{font-size:12px;opacity:.6;margin-top:8px;}
.enc-view dd{margin:0;white-space:pre-wrap;}

/* ═══ Встроенные сервисы (reports / медсестра) ═══ */
.ext-frame-wrap{height:100%;min-height:0;display:flex;}
.ext-frame{flex:1;width:100%;height:100%;border:none;border-radius:var(--radius,12px);
  background:#fff;}
:root[data-theme="dark"] .ext-frame{background:#111;}

/* ═══ Сайдбар-аккордеон: сервисы с подпунктами ═══ */
.nav-group{margin:0;}
.nav-group summary{list-style:none;cursor:pointer;display:flex;align-items:center;gap:10px;
  padding:9px 10px;border-radius:var(--r-sm);font-weight:500;user-select:none;
  color:var(--text-muted);}
.nav-group summary::-webkit-details-marker{display:none;}
.nav-group summary::marker{content:none;}
.nav-group summary{list-style-type:none;}
.nav-group summary svg, .nav-group summary i{width:17px;height:17px;}
.nav-group summary:hover{background:var(--bg-hover,rgba(128,128,128,.08));}
.nav-group summary.is-current{font-weight:600;color:var(--brand);}
.nav-group__chev{margin-left:auto;width:14px!important;height:14px!important;
  opacity:.5;transition:transform .18s ease;}
.nav-group[open] .nav-group__chev{transform:rotate(180deg);}
.nav-group__items{display:flex;flex-direction:column;margin-left:14px;padding-left:10px;
  border-left:1px solid var(--border,rgba(128,128,128,.2));}
.nav-group__items a{font-size:.93em;padding:7px 12px;}

/* ═══ Auth-страницы: иконка + подпись лейбла в одну строку (lucide теряет
   inline-стили при замене <i> на <svg>) ═══ */
.auth-form .form-label{display:flex;flex-direction:row;align-items:center;justify-content:flex-start;gap:6px;}
.auth-form .form-label svg{width:14px;height:14px;flex:none;}

/* ═══ Аватары ═══ */
.avatar{display:inline-flex;align-items:center;justify-content:center;flex:none;
  border-radius:50%;object-fit:cover;overflow:hidden;vertical-align:middle;}
.avatar--initials{color:#fff;font-weight:700;line-height:1;letter-spacing:.5px;
  text-transform:uppercase;}
.user-chip{display:flex;flex-direction:row;align-items:center;gap:10px;}
.chat-item__avatar.avatar{font-size:16px;}

/* аватар в сообщении чата */
.msg{display:flex;gap:8px;align-items:flex-end;}
.msg__avatar{width:32px;height:32px;font-size:14px;margin-bottom:2px;}
.msg--mine{justify-content:flex-end;}

/* ═══ Меню пользователя (аватар + выпадашка) ═══ */
.user-menu{position:relative;}
.user-menu > summary{list-style:none;cursor:pointer;display:flex;align-items:center;gap:4px;
  padding:3px;border-radius:999px;user-select:none;}
.user-menu > summary::-webkit-details-marker{display:none;}
.user-menu > summary:hover{background:var(--bg-hover,rgba(128,128,128,.1));}
.user-menu__chev{width:16px!important;height:16px!important;opacity:.5;transition:transform .18s;}
.user-menu[open] .user-menu__chev{transform:rotate(180deg);}
.user-menu__panel{position:absolute;top:calc(100% + 8px);right:0;z-index:40;min-width:230px;
  background:var(--panel-bg,#fff);border:1px solid var(--border,rgba(128,128,128,.2));
  border-radius:14px;box-shadow:0 12px 32px rgba(0,0,0,.22);padding:8px;}
:root[data-theme="dark"] .user-menu__panel{background:#17171c;}
.user-menu__head{display:flex;align-items:center;gap:10px;padding:8px 8px 12px;
  border-bottom:1px solid var(--border,rgba(128,128,128,.15));margin-bottom:6px;}
.user-menu__head strong{display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.user-menu__head span{font-size:var(--fs-xs);color:var(--text-muted);}
.user-menu__item{display:flex;align-items:center;gap:10px;width:100%;padding:9px 10px;
  border:none;background:none;color:inherit;font:inherit;cursor:pointer;border-radius:9px;text-align:left;}
.user-menu__item:hover{background:var(--bg-hover,rgba(128,128,128,.1));}

/* имя рядом с аватаром + доп. пункты меню пользователя */
.user-menu__name{font-weight:600;font-size:var(--fs-sm);white-space:nowrap;
  max-width:150px;overflow:hidden;text-overflow:ellipsis;}
@media (max-width:640px){ .user-menu__name{display:none;} }
.user-menu__sep{height:1px;background:var(--border,rgba(128,128,128,.15));margin:6px 0;}
.user-menu__label{font-size:var(--fs-xs);color:var(--text-muted);padding:2px 10px;}
.user-menu__themes{display:flex;gap:6px;padding:2px 6px 4px;}
.theme-opt{flex:1;display:flex;align-items:center;justify-content:center;gap:6px;
  padding:7px 8px;border:1px solid var(--border,rgba(128,128,128,.25));background:none;
  color:inherit;border-radius:9px;cursor:pointer;font-size:var(--fs-xs);}
.theme-opt:hover{background:var(--bg-hover,rgba(128,128,128,.1));}
.theme-opt.is-active{border-color:var(--brand,#BC181C);
  background:var(--brand-soft,rgba(188,24,28,.08));color:var(--brand,#BC181C);font-weight:600;}
label.user-menu__item{cursor:pointer;}

/* ГЛОБАЛЬНО убираем дефолтный треугольник <details><summary> (все движки) */
summary{list-style:none !important;}
summary::-webkit-details-marker{display:none !important;}
summary::marker{content:none !important;}

/* ═══ Доска задач (канбан) ═══ */
.board{display:flex;gap:var(--s-3);flex:1;height:auto;min-height:0;align-items:stretch;}
.board-col{margin-top:0;}   /* колонки — <section>; гасим глобальный section+section margin */
.board-col{flex:1 1 0;min-width:0;display:flex;flex-direction:column;min-height:0;background:var(--bg-subtle);
  border-radius:var(--r-lg);padding:8px;}
.board-col__head{font-weight:600;padding:6px 8px;display:flex;align-items:center;gap:8px;}
.board-col__count{background:var(--bg-hover);border-radius:999px;font-size:11px;padding:1px 8px;font-weight:700;}
.board-col__body{overflow-y:auto;min-height:0;flex:1;display:flex;flex-direction:column;gap:8px;padding:4px;}
.task-card{background:var(--bg-card);border:1px solid var(--border);border-radius:12px;
  padding:10px 12px;border-left:3px solid var(--border);}
.task-card.prio-high{border-left-color:var(--danger);}
.task-card.prio-low{border-left-color:var(--text-faint);}
.task-card__title{font-weight:600;margin-bottom:4px;}
.task-card__desc{font-size:var(--fs-xs);color:var(--text-muted);margin-bottom:6px;}
.task-card__meta{display:flex;gap:8px;align-items:center;flex-wrap:wrap;font-size:var(--fs-xs);margin-bottom:6px;}
.task-due{display:inline-flex;align-items:center;gap:4px;color:var(--text-muted);}
.task-due.is-overdue{color:var(--danger);font-weight:600;}
.task-due svg{width:13px;height:13px;}
.task-card__foot{display:flex;justify-content:space-between;align-items:center;}
.task-card__assignees{display:flex;}
.task-card__assignees .avatar{margin-right:-6px;border:2px solid var(--bg-card);}
.task-card__move{display:flex;flex-wrap:wrap;gap:4px;margin-top:8px;}
.task-move-btn{font-size:11px;padding:2px 7px;border:1px solid var(--border);background:none;
  color:var(--text-muted);border-radius:999px;cursor:pointer;}
.task-move-btn:hover{border-color:var(--brand);color:var(--brand);}
.task-history{display:flex;flex-direction:column;gap:8px;max-height:50vh;overflow-y:auto;}
.th-item{border-left:2px solid var(--border);padding:4px 10px;}
.th-meta{font-size:var(--fs-xs);color:var(--text-muted);}
@media (max-width:900px){ .board{grid-template-columns:1fr;} }

/* ═══ Календарь ═══ */
.cal-legend{display:flex;gap:16px;flex-wrap:wrap;font-size:var(--fs-xs);color:var(--text-muted);margin-bottom:var(--s-3);}
.cal-legend .dot{display:inline-block;width:10px;height:10px;border-radius:50%;margin-right:4px;vertical-align:middle;}
.dot-patients{background:#4F8FA8;} .dot-task{background:#C87A3F;}
.dot-holiday{background:#B8544B;} .dot-birthday{background:#7A9A57;}
.cal-grid{display:grid;grid-template-columns:repeat(7,1fr);gap:6px;}
.cal-wd{font-size:var(--fs-xs);color:var(--text-muted);text-align:center;padding:4px;font-weight:600;}
.cal-cell{min-height:92px;border:1px solid var(--border);border-radius:10px;padding:5px;
  display:flex;flex-direction:column;gap:3px;overflow:hidden;}
.cal-cell.is-out{opacity:.4;}
.cal-cell.is-today{border-color:var(--brand);box-shadow:inset 0 0 0 1px var(--brand);}
.cal-day{font-size:var(--fs-xs);font-weight:600;}
.cal-ev{font-size:10px;line-height:1.25;padding:2px 5px;border-radius:5px;white-space:nowrap;
  overflow:hidden;text-overflow:ellipsis;color:#fff;}
.ev-patients{background:#4F8FA8;} .ev-task{background:#C87A3F;}
.ev-holiday{background:#B8544B;} .ev-birthday{background:#7A9A57;}

/* ═══ Новости на Главной (компактная лента) ═══ */
.dash-news{flex:0 0 auto;margin-bottom:var(--s-3);}
.dash-news__head{display:flex;align-items:center;justify-content:space-between;margin-bottom:6px;}
.dash-news__head h2{margin:0;font-size:15px;}
.dash-news__row{display:flex;gap:var(--s-3);overflow-x:auto;padding-bottom:4px;}
.news-card{flex:0 0 300px;max-width:300px;background:var(--bg-card);border:1px solid var(--border);
  border-radius:var(--r-md);padding:10px 12px;border-left:3px solid var(--border);}
.news-card.is-pinned{border-left-color:var(--brand);}
.news-card__title{font-weight:600;margin-bottom:4px;}
.news-card__body{font-size:var(--fs-xs);color:var(--text-muted);white-space:pre-wrap;
  max-height:56px;overflow:hidden;margin-bottom:6px;}
.news-card__foot{display:flex;justify-content:space-between;align-items:center;
  font-size:11px;color:var(--text-faint);gap:8px;}
.news-card__actions{display:flex;gap:2px;}
.btn-icon--xs{width:26px;height:26px;padding:0;}
.dash-grid{flex:1;height:auto;min-height:0;}

/* ═══ Доска: цветные подписи колонок (чистый вид) + панель фильтров ═══ */
.board-col__head{white-space:nowrap;}     /* одна строка → колонки ровные */
.board-col--todo .board-col__head{color:#6B7280;}
.board-col--in_progress .board-col__head{color:#3B6FB0;}
.board-col--review .board-col__head{color:#B0803B;}
.board-col--done .board-col__head{color:#3B9A57;}
.board-col--todo .board-col__count{background:#6B7280;color:#fff;}
.board-col--in_progress .board-col__count{background:#3B6FB0;color:#fff;}
.board-col--review .board-col__count{background:#B0803B;color:#fff;}
.board-col--done .board-col__count{background:#3B9A57;color:#fff;}
.board-filters{display:flex;gap:10px;flex-wrap:wrap;align-items:end;margin-bottom:var(--s-3);
  padding:var(--s-3);background:var(--bg-subtle);border-radius:var(--r-md);flex:0 0 auto;}
.board-filters .form-group{margin:0;}
.board-filters .form-control{min-width:150px;}

/* кнопка «Применить» в фильтрах — вровень с полями, красная */
.board-filters .form-control{height:40px;}
.board-filters .btn{height:40px;padding:0 18px;align-self:end;}
/* кнопки-действия в топбаре вровень с иконкой-колоколом (38px) */
.topbar__right .btn{height:38px;}

/* Мультиселект-выпадашка (исполнители) */
.ms-dropdown{position:relative;}
.ms-dropdown > summary{list-style:none;cursor:pointer;display:flex;align-items:center;gap:8px;
  padding:10px 12px;border:1px solid var(--border);border-radius:var(--r-sm);background:var(--bg-card);}
.ms-dropdown > summary::-webkit-details-marker{display:none;}
.ms-dropdown > summary::before{content:none;}
.ms-dropdown > summary .ms-label{flex:1;color:var(--text);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.ms-dropdown > summary .ms-chev{margin-left:auto;width:16px;height:16px;opacity:.5;transition:transform .18s;}
.ms-dropdown[open] > summary .ms-chev{transform:rotate(180deg);}
.ms-panel{position:absolute;z-index:40;left:0;right:0;margin-top:4px;max-height:240px;overflow-y:auto;
  background:var(--bg-card);border:1px solid var(--border);border-radius:var(--r-md);
  box-shadow:var(--shadow-md);padding:4px;}
.ms-opt{display:flex;align-items:center;gap:8px;padding:7px 10px;border-radius:var(--r-sm);cursor:pointer;}
.ms-opt:hover{background:var(--bg-hover);}

/* ═══ Центр уведомлений (колокольчик) ═══ */
.notif-menu{position:relative;}
.notif-menu > summary{list-style:none;position:relative;}
.notif-menu > summary::-webkit-details-marker{display:none;}
.notif-menu > summary::before{content:none;}
.notif-badge{position:absolute;top:-4px;right:-4px;min-width:18px;height:18px;padding:0 5px;
  background:var(--brand,#BC181C);color:#fff;border-radius:999px;font-size:11px;font-weight:700;
  line-height:18px;text-align:center;border:2px solid var(--bg-card,#fff);box-sizing:content-box;}
.notif-panel{position:absolute;top:calc(100% + 8px);right:0;z-index:50;width:340px;max-width:90vw;
  background:var(--panel-bg,#fff);border:1px solid var(--border);border-radius:14px;
  box-shadow:0 12px 32px rgba(0,0,0,.22);overflow:hidden;}
:root[data-theme="dark"] .notif-panel{background:#17171c;}
.notif-panel__head{display:flex;align-items:center;justify-content:space-between;
  padding:10px 12px;border-bottom:1px solid var(--border);}
.notif-list{max-height:60vh;overflow-y:auto;}
.notif-item{display:flex;gap:10px;align-items:flex-start;padding:10px 12px;color:inherit;
  border-bottom:1px solid var(--border);}
.notif-item:hover{background:var(--bg-hover);}
.notif-item.is-unread{background:var(--brand-soft);}
.notif-item i,.notif-item svg{width:18px;height:18px;color:var(--brand);flex:none;margin-top:1px;}
.notif-item__text{font-size:var(--fs-sm);}
.notif-item__at{font-size:11px;color:var(--text-muted);margin-top:2px;}
.notif-panel__foot{border-top:1px solid var(--border);padding:4px;}

/* ═══ Временный вход (страница логина) ═══ */
.auth-divider{display:flex;align-items:center;gap:12px;margin:var(--s-4) 0;
  color:var(--text-faint);font-size:var(--fs-xs);}
.auth-divider::before,.auth-divider::after{content:"";flex:1;height:1px;background:var(--border);}
.temp-code{font-size:34px;font-weight:700;letter-spacing:6px;font-variant-numeric:tabular-nums;
  color:var(--brand);margin:4px 0;}
.temp-qr{width:180px;height:180px;border-radius:12px;background:#fff;padding:8px;
  border:1px solid var(--border);}

/* ═══ Мобильный режим: десктоп-«кокпит» → одна колонка (2026-07-09) ══════════
   Многие шаблоны задают grid-template-columns ИНЛАЙН — поэтому переопределяем
   через !important. Телефон: всё в один столбец, страница нормально скроллится. */
@media (max-width: 768px) {
  :root { --fs-base: 15px; --fs-sm: 14px; --fs-xs: 12.5px; }
  body { overflow: auto; }

  /* кокпит с фиксированной высотой на телефоне просто скроллим */
  .workspace { overflow: visible; padding: 0 var(--s-3) var(--s-4); }
  .workspace--fixed { overflow: visible; display: block; }

  /* контейнеры-сетки → одна колонка (перебиваем инлайн-стиль) */
  .wgrid, .dash-grid { grid-template-columns: 1fr !important; grid-template-rows: auto !important;
                       height: auto !important; }
  .form-grid { grid-template-columns: 1fr !important; }
  .chat-layout { grid-template-columns: 1fr !important; height: auto !important; }
  /* строка ввода чата прилипает НАД нижним таб-баром — иначе он её перекрывает */
  .chat-main .chat-input { position: sticky;
    bottom: calc(64px + env(safe-area-inset-bottom, 0px));
    background: var(--bg-card); z-index: 5; }
  .dashboard-grid { flex-direction: column; }
  .dashboard-grid > * { flex: 1 1 auto; width: 100%; }
  .week-grid { grid-template-columns: 1fr !important; height: auto !important; }
  .tiles { grid-template-columns: 1fr !important; }

  /* панели больше не тянутся по высоте кокпита — по содержимому */
  .wgrid > *, .panel { height: auto !important; min-height: 0; }

  /* топбар: заголовок + иконки в строку, поиск на всю ширину снизу */
  .topbar { flex-wrap: wrap; gap: var(--s-2); padding: 8px var(--s-3); }
  .topbar h1 { font-size: 17px; white-space: normal; }
  .topbar__right { flex-basis: 100%; justify-content: flex-start; }  /* кнопки действий переносятся под заголовок, не за край */
  .topbar__search { order: 5; flex: 1 1 100%; max-width: none; }
}

/* ═══ Мобильный нижний таб-бар + шторка «Ещё» + табы доски (2026-07-29) ═════
   Телефон (≤768px): сайдбар скрыт, навигация — фикс-бар снизу (Главная/Чат/
   Календарь/Ещё). «Ещё» открывает шторку с полным меню (клон .sidebar__nav —
   RBAC уже применён при рендере). Доска задач: колонки по одной, табы сверху. */
.bottombar { display: none; }
.more-sheet { display: none; }
.board-tabs { display: none; }
@media (max-width: 768px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .main { padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px)); }

  .bottombar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; display: flex;
    background: var(--bg-card); border-top: 1px solid var(--border);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    box-shadow: 0 -2px 12px rgba(15,23,42,.06); }
  .bottombar__item { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
    padding: 8px 4px 6px; font-size: 11px; font-family: inherit; color: var(--text-muted);
    text-decoration: none; background: none; border: 0; position: relative; cursor: pointer; }
  .bottombar__item svg { width: 22px; height: 22px; }
  .bottombar__item.is-active { color: var(--brand); }
  .bottombar__badge { position: absolute; top: 2px; left: calc(50% + 6px);
    background: var(--danger); color: #fff; border-radius: 999px; font-size: 10px;
    line-height: 1; padding: 2px 5px; font-weight: 700; min-width: 16px; text-align: center; }

  .more-sheet { display: block; position: fixed; inset: 0; z-index: 70; }
  .more-sheet[hidden] { display: none; }
  .more-sheet__backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.42); }
  .more-sheet__panel { position: absolute; left: 0; right: 0; bottom: 0; max-height: 76vh;
    overflow-y: auto; background: var(--bg-card); border-radius: var(--r-lg) var(--r-lg) 0 0;
    padding: 6px 12px calc(16px + env(safe-area-inset-bottom, 0px)); }
  .more-sheet__grip { width: 38px; height: 4px; border-radius: 2px; background: var(--border-strong);
    margin: 6px auto 10px; }
  /* клон меню: вернуть подписи/бейджи/подпункты, спрятанные правилом @1100px */
  .more-sheet__panel .sidebar__nav a span, .more-sheet__panel .nav-group summary span { display: inline; }
  .more-sheet__panel .nav-group__items { display: block; }
  .more-sheet__panel .nav-badge { display: inline-block; margin-left: auto; }
  .more-sheet__panel .nav-group__chev { display: none; }
  .more-sheet__panel .sidebar__nav a, .more-sheet__panel .nav-group summary { justify-content: flex-start; }
  .more-sheet__panel .nav-group summary { pointer-events: none; }  /* группы = заголовки, всё раскрыто */

  /* доска задач: одна колонка + табы выбора статуса */
  .board-tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 8px;
    -webkit-overflow-scrolling: touch; }
  .board-tab { flex: none; display: flex; align-items: center; gap: 6px; padding: 7px 12px;
    border: 1px solid var(--border); border-radius: 999px; background: var(--bg-card);
    font-family: inherit; font-size: var(--fs-sm); color: var(--text-muted); cursor: pointer; }
  .board-tab.is-active { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }
  .board-tab__count { background: var(--bg-hover); border-radius: 999px; font-size: 11px;
    padding: 1px 7px; font-weight: 700; }
  .board-tab.is-active .board-tab__count { background: var(--brand); color: #fff; }
  .board { display: block; }
  .board[data-col] .board-col { display: none; }
  .board[data-col="todo"] .board-col--todo,
  .board[data-col="in_progress"] .board-col--in_progress,
  .board[data-col="review"] .board-col--review,
  .board[data-col="done"] .board-col--done { display: flex; }
  .board-col__body { overflow-y: visible; }
}

/* ═══ Мобилка: панели колокольчика и меню юзера — фиксом на всю ширину ══════
   Триггеры на телефоне у левого края, а панели были absolute с right:0 →
   вылезали за левый край экрана (скрин Кира 2026-07-29). */
@media (max-width: 768px) {
  .notif-panel, .user-menu__panel {
    position: fixed; left: 8px; right: 8px; top: 62px;
    width: auto; min-width: 0; max-width: none;
    max-height: calc(100dvh - 62px - 72px - env(safe-area-inset-bottom, 0px));
    overflow-y: auto;
  }
}

/* hidden у бейджа отметки прихода должен побеждать display:inline-flex */
.vstatus-badge[hidden] { display: none !important; }

/* rich-поля: вставленный текст не тащит чужие шрифты/размеры/фон (2026-08-08) */
.rte-edit *, .encounter__field p * {
  font-family: inherit !important; font-size: inherit !important;
  background: transparent !important;
}


/* ===== REDESIGN-MAX OVERLAY (rollback: удалить блок до конца файла) ===== */
/* --- variant-max --- */
/* ═══════════════════════════════════════════════════════════════════════════
   ВАРИАНТ «МАКСИМУМ» — видимый рефреш оболочки поверх style.css.
   Включает всё из «минимума» + переработку поверхностей, сайдбара, топбара,
   панелей, плиток, кнопок и лёгкую микро-моторику. Бренд (красный+оранжевый)
   сохранён как идентичность, но используется сдержаннее — сплошной акцент
   вместо градиентного «свечения», спокойные нейтрали, слои и глубина.
   Разметку по-прежнему не меняет — только CSS. Откат = убрать файл.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── База из «минимума»: табличные цифры + фокус-кольцо ── */
.tile strong, .hero-stat strong, .data-table, .mini-cal, .month-grid,
.badge, .talon, .lamp-stats strong, .temp-code, .totp-input, .cal-day,
.board-col__count, .notif-item__at, .task-due, .day-board, .tl {
  font-variant-numeric: tabular-nums;
}
a:focus-visible, button:focus-visible, summary:focus-visible,
.btn:focus-visible, .tile:focus-visible, .chk:focus-visible,
input:focus-visible, select:focus-visible, textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}
.form-control:focus { outline: none; }

/* ── Нейтрали: чуть прохладнее и интенциональнее; больше воздуха ── */
:root {
  --bg:            #F3F5F7;
  --bg-card:       #FFFFFF;
  --bg-subtle:     #EBEEF2;
  --bg-hover:      #E3E7EC;
  --border:        #E2E6EB;
  --border-strong: #CBD1D9;
  --text:          #161A1F;
  --text-muted:    #5E6773;
  --text-faint:    #97A0AC;
  --shadow-sm:  0 1px 2px rgba(28,36,48,0.05), 0 1px 3px rgba(28,36,48,0.05);
  --shadow-md:  0 4px 12px rgba(28,36,48,0.08), 0 16px 40px rgba(28,36,48,0.09);
  --shadow-pop: 0 4px 16px rgba(188,24,28,0.18);
  --r-md: 12px;
  --r-lg: 18px;
}
[data-theme="dark"] {
  --bg:            #0B0D11;
  --bg-card:       #14171D;
  --bg-subtle:     #1A1E25;
  --bg-hover:      #222731;
  --border:        #262B34;
  --border-strong: #363D48;
  --text:          #ECEDEE;
  --text-muted:    #9AA3AF;
}

/* ── Сайдбар: отдельная тонированная поверхность + левый акцент активного ── */
.sidebar { background: var(--bg-subtle); }
.sidebar__nav a, .nav-group summary { position: relative; border-radius: 10px; }
.sidebar__nav a.is-active {
  background: var(--bg-card);
  color: var(--brand);
  box-shadow: var(--shadow-sm);
}
.sidebar__nav a.is-active::before {
  content: ""; position: absolute; left: -3px; top: 8px; bottom: 8px; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--brand-grad);
}
.sidebar__brand { padding-bottom: var(--s-3); }

/* ── Топбар: спокойный, просторный, поиск заметнее ── */
.topbar { padding: 12px var(--s-5); border-bottom: 1px solid var(--border); }
.topbar h1 { font-weight: 600; letter-spacing: -0.02em; }
.topbar__search input {
  background: var(--bg-subtle); border-color: transparent;
  transition: background .15s, border-color .15s, box-shadow .15s;
}
.topbar__search input:focus {
  background: var(--bg-card); border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft); outline: none;
}

/* ── Панели: мягче радиус, слоистая тень, лёгкий подъём при наведении ── */
.panel, .hero-card {
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  transition: box-shadow .18s ease, transform .18s ease;
}
.workspace:not(.workspace--fixed) .panel:hover { box-shadow: var(--shadow-md); }
.panel .section-head h2 { letter-spacing: -0.01em; }

/* ── Плитки-статы: крупные числа, иерархия, первый акцентный, подъём ── */
.tile {
  border-radius: var(--r-md);
  transition: transform .12s ease, box-shadow .18s ease, border-color .18s ease;
}
.tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.tile strong { font-size: 28px; letter-spacing: -0.03em; }
.tiles a.tile:first-child {
  background: linear-gradient(135deg, color-mix(in srgb, var(--brand) 9%, var(--bg-card)), var(--bg-card));
  border-color: color-mix(in srgb, var(--brand) 28%, var(--border));
}
.tiles a.tile:first-child strong { color: var(--brand); }

/* ── Кнопки: сплошной бренд вместо градиента-свечения, чётче форма ── */
.btn { border-radius: 10px; font-weight: 600; }
.btn-primary { background: var(--brand); box-shadow: var(--shadow-pop); }
.btn-primary:hover { background: #A5151A; filter: none; }
.btn-icon { border-radius: 10px; }

/* ── Бейджи: квадратнее, без капса, выше контраст ── */
.badge {
  border-radius: 6px; text-transform: none; letter-spacing: 0;
  font-weight: 600; font-size: 12px;
}

/* ── Таблицы данных: спокойный ховер с тёплым брендовым подтоном ── */
.data-table th { letter-spacing: 0.03em; }
.data-table tr:hover td { background: color-mix(in srgb, var(--brand) 4%, var(--bg-subtle)); }

/* ── Карточки-задачи / новости: единый мягкий радиус ── */
.task-card, .news-card { border-radius: var(--r-md); }

/* ── Заголовки страниц крупнее и плотнее ── */
h1 { font-size: 25px; letter-spacing: -0.025em; }
.auth-card__title { letter-spacing: -0.02em; }

/* ── Уважать «уменьшить движение» ── */
@media (prefers-reduced-motion: reduce) {
  .panel, .tile, .topbar__search input { transition: none; }
  .tile:hover { transform: none; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   СТРАНИЦА ВХОДА: сферы (двигаются) под «стеклом» + сеть точек сверху.
   Слои: .login-bg → .glass(.login-bg-img+.orbs, SVG-фильтр преломления) →
   .net-canvas (сеть точек, курсор) → .auth-card.
   data-fx на <body>: none | fluted (рифлёное) | textured (фактурное «капли»).
   Параметры — CSS-переменные + window.NET_CFG (крутит тюнер).
   ═══════════════════════════════════════════════════════════════════════════ */
.auth-page { position: relative; overflow: hidden; }

/* стекло — обёртка со сферами, к ней применяется SVG-фильтр преломления */
.glass { position: absolute; inset: 0; z-index: 0; pointer-events: none; }
body[data-fx="fluted"]   .glass { filter: url(#g-fluted); }
body[data-fx="textured"] .glass { filter: url(#g-textured); }

/* фоновый слой (картинка/градиент) — тема-зависимый:
   светлая → белый фон, тёмная → тёмный. Своя картинка --login-bg перекрывает. */
.login-bg {
  position: absolute; inset: -40px; z-index: 0; pointer-events: none;
  background-color: #ffffff;
  background-image: var(--login-bg, linear-gradient(135deg, #ffffff, #f2f3f5));
  background-size: cover; background-position: center;
}
:root[data-theme="dark"] .login-bg {
  background-color: #140f0e;
  background-image: var(--login-bg, linear-gradient(135deg, #1b1210, #0d0a09));
}

/* слой сфер — параметры в переменных (крутит тюнер) */
.orbs {
  position: absolute; inset: -40px; overflow: visible; pointer-events: none;
  --spd: 3;              /* скорость (больше = быстрее) */
  --sz: 1.8;             /* размер сфер */
  --amp: 1.9;            /* амплитуда движения */
  --blur: 60px;          /* размытие сфер */
  --orb-opacity: 0.8;
}
.orb {
  position: absolute; border-radius: 50%;
  filter: blur(var(--blur)); opacity: var(--orb-opacity); will-change: transform;
  mix-blend-mode: multiply;   /* светлая тема: мягкий тёплый тон на белом */
}
:root[data-theme="dark"] .orb { mix-blend-mode: screen; }  /* тёмная: свечение */
/* ТОЛЬКО бренд: красный #BC181C и оранжевый #EB611A */
.orb--1 { width: calc(380px*var(--sz)); height: calc(380px*var(--sz)); left: -40px;  top: -30px;
  background: radial-gradient(circle at 40% 40%, #EB611A, transparent 68%); animation: orbA calc(15s/var(--spd)) ease-in-out infinite; }
.orb--2 { width: calc(340px*var(--sz)); height: calc(340px*var(--sz)); right: -30px; top: 8%;
  background: radial-gradient(circle at 40% 40%, #BC181C, transparent 68%); animation: orbB calc(13s/var(--spd)) ease-in-out infinite; }
.orb--3 { width: calc(300px*var(--sz)); height: calc(300px*var(--sz)); left: 18%;   bottom: -50px;
  background: radial-gradient(circle at 40% 40%, #EB611A, transparent 68%); animation: orbC calc(17s/var(--spd)) ease-in-out infinite; }
.orb--4 { width: calc(240px*var(--sz)); height: calc(240px*var(--sz)); right: 20%;  bottom: 2%;
  background: radial-gradient(circle at 40% 40%, #BC181C, transparent 68%); animation: orbD calc(12s/var(--spd)) ease-in-out infinite; }
.orb--5 { width: calc(260px*var(--sz)); height: calc(260px*var(--sz)); left: 40%;   top: -50px;
  background: radial-gradient(circle at 40% 40%, #EB611A, transparent 70%); animation: orbB calc(16s/var(--spd)) ease-in-out infinite reverse; }
.orb--6 { width: calc(200px*var(--sz)); height: calc(200px*var(--sz)); left: 6%;    top: 44%;
  background: radial-gradient(circle at 40% 40%, #BC181C, transparent 68%); animation: orbA calc(14s/var(--spd)) ease-in-out infinite reverse; }

/* амплитуда через var(--amp): базовые сдвиги крупнее, чтобы двигались заметно */
@keyframes orbA { 0%,100%{ transform: translate3d(0,0,0) scale(0.9); }
  33%{ transform: translate3d(calc(90px*var(--amp)),calc(60px*var(--amp)),0) scale(1.2); }
  66%{ transform: translate3d(calc(36px*var(--amp)),calc(-70px*var(--amp)),0) scale(1); } }
@keyframes orbB { 0%,100%{ transform: translate3d(0,0,0) scale(0.95); }
  50%{ transform: translate3d(calc(-95px*var(--amp)),calc(72px*var(--amp)),0) scale(1.22); } }
@keyframes orbC { 0%,100%{ transform: translate3d(0,0,0) scale(1); }
  40%{ transform: translate3d(calc(78px*var(--amp)),calc(-56px*var(--amp)),0) scale(1.2); }
  75%{ transform: translate3d(calc(-46px*var(--amp)),calc(-20px*var(--amp)),0) scale(0.86); } }
@keyframes orbD { 0%,100%{ transform: translate3d(0,0,0) scale(0.92); }
  50%{ transform: translate3d(calc(-70px*var(--amp)),calc(-84px*var(--amp)),0) scale(1.22); } }
@media (prefers-reduced-motion: reduce) { .orb { animation: none !important; } }

/* сеть точек — поверх стекла, под карточкой */
.net-canvas { position: absolute; inset: 0; z-index: 0; display: block; pointer-events: none; }

/* контент всегда над фоном/сферами/сетью */
.auth-page > .auth-card,
.auth-page > .theme-toggle,
.auth-page > .btn-icon { position: relative; z-index: 1; }
.auth-page .auth-card { box-shadow: 0 20px 60px rgba(0,0,0,0.45); }

/* --- fix: mobile gallery scroll --- */
/* ── ФИКС: прокрутка фотогалереи на мобиле (не вкусовщина — дефект) ──────────
   Панель «Фото пациента» на десктопе имеет inline max-height:45% и внутренний
   .panel__body{overflow:auto}, чтобы лишние фото скроллились внутри панели.
   На мобиле .workspace--fixed становится display:block и скроллится вся
   страница — вложенный overflow:auto с обрезкой 45% превращал галерею в
   крошечный тач-ловящий бокс. Сбрасываем cap и внутренний скролл на телефоне:
   панели текут в общий скролл страницы. Чат не задет (у него .chat-msgs). */
@media (max-width: 768px) {
  .workspace--fixed .panel      { max-height: none !important; }
  .workspace--fixed .panel__body { overflow: visible !important; }
}

