/* Стили контура CRM — фирменный стиль МегаВет74.
   Токены, шрифты и атомы (кнопки, карточки, чипы, слоты расписания) взяты из
   утверждённых демо-экранов CRM-демо/*.html, которые сами унаследованы от макета
   сайта: Literata в заголовках, Manrope в интерфейсе, тёмно-зелёный --deep, фирменный
   --lime, радиус 4px, тонкие линии вместо теней. Экран, уже нарисованный в демо, в
   рабочей CRM выглядит как в демо (решение 10.09.2026). Контрастные значения --ink-3 и
   --amber — с сайта, где их подняли до AA.
   Мобильная раскладка — исходная, десктоп добирается медиазапросами вверх: демо были
   свёрстаны под min-width:1520px, рабочая система так не может. */

/* Шрифты — со своего сервера: CSP пускает только 'self', а в CRM персональные данные,
   сторонних запросов со страниц не делаем. Кириллица и базовая латиница, OFL. */
@font-face {
  font-family: "Manrope"; font-style: normal; font-weight: 200 800; font-display: swap;
  src: url(/static/fonts/manrope-cyrillic-wght-normal.woff2) format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Manrope"; font-style: normal; font-weight: 200 800; font-display: swap;
  src: url(/static/fonts/manrope-latin-wght-normal.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Literata"; font-style: normal; font-weight: 200 900; font-display: swap;
  src: url(/static/fonts/literata-cyrillic-wght-normal.woff2) format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Literata"; font-style: normal; font-weight: 200 900; font-display: swap;
  src: url(/static/fonts/literata-latin-wght-normal.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --bg: #f2f4ef;
  --surface: #ffffff;
  --surface-2: #e8ebe2;
  --surface-3: #f7f8f4;
  --deep: #14271b;
  --deep-2: #1c3524;
  --deep-3: #24422c;
  --on-deep: #edf1e8;
  --on-deep-2: #9aac9b;
  --ink: #16211a;
  --ink-2: #5b685e;
  --ink-3: #5d6957;
  --line: #dde2d6;
  --line-2: #c7cfbe;
  --lime: #7cb342;
  --lime-ink: #4c7620;
  --lime-soft: #edf5e2;
  --coral: #d9603a;
  --coral-ink: #b24a28;
  --coral-soft: #fbebe5;
  --amber: #8f630f;
  --amber-soft: #fbf1de;
  --sky: #3b6e86;
  --sky-soft: #e6eff3;
  --violet: #6b5b95;
  --violet-soft: #eeebf5;
  --r: 4px;
  --ease: cubic-bezier(0.2, 0.7, 0.3, 1);
  --f: "Manrope", "Segoe UI", Arial, sans-serif;
  --f-serif: "Literata", Georgia, "Times New Roman", serif;
  --f-mono: ui-monospace, "JetBrains Mono", Consolas, monospace;
  --tap: 38px;
  --field-font: 14px;
}
/* Палец промахивается по 38px, а iOS зумит поле с шрифтом мельче 16px. */
@media (pointer: coarse) { :root { --tap: 44px; --field-font: 16px; } }

* { box-sizing: border-box; }

/* hidden должен побеждать display у компонентов (.btn, .grid2, .token-form…): иначе
   скрытая скриптом форма или кнопка остаётся на экране. */
[hidden] { display: none !important; }

html { background: var(--bg); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--f);
  font-size: 14.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

a { color: inherit; }
img { max-width: 100%; }
button, input, select, textarea { font-family: inherit; }
code { font-family: var(--f-mono); font-size: 0.88em; }
:focus-visible { outline: 2px solid var(--lime); outline-offset: 2px; }

h1, h2, h3 { font-family: var(--f-serif); font-weight: 500; letter-spacing: -0.015em; line-height: 1.18; }
h1 { font-size: clamp(22px, 5vw, 25px); margin: 0 0 8px; }
h2 { font-size: 17px; margin: 0 0 8px; }
h3 { font-size: 15px; margin: 0; }

/* ── Каркас: боковая панель и шапка из демо (Сессия 7) ──
   От 1100px панель стоит слева, как в демо; уже — выезжает по кнопке меню. */

.ico { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.btn .ico { width: 16px; height: 16px; }

.app { display: grid; grid-template-columns: minmax(0, 1fr); min-height: 100vh; }
.side {
  position: fixed; inset: 0 auto 0 0; z-index: 60; width: min(280px, 86vw);
  display: flex; flex-direction: column; overflow-y: auto;
  /* Раскрыли все группы на невысоком экране — полоса тонкая и в тон панели, не светлая системная. */
  scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
  background: var(--deep); color: var(--on-deep); border-right: 1px solid rgba(255, 255, 255, 0.08);
  transform: translateX(-100%); transition: transform 0.22s var(--ease);
}
.side.open { transform: none; }
.scrim { position: fixed; inset: 0; z-index: 55; background: rgba(20, 39, 27, 0.45); }
@media (min-width: 1100px) {
  .app { grid-template-columns: 232px minmax(0, 1fr); }
  .side { position: sticky; top: 0; height: 100vh; width: auto; transform: none; transition: none; }
  .scrim { display: none !important; }
  .menu-btn { display: none !important; }
}
.side-logo {
  display: flex; align-items: center; gap: 11px; padding: 22px 22px 18px; text-decoration: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.side-logo img { height: 20px; width: auto; display: block; }
.side-logo b {
  font-family: var(--f-serif); font-weight: 500; font-size: 12.5px; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--on-deep-2);
}
.side-sec { padding: 20px 14px 6px; font-size: 10px; font-weight: 600; letter-spacing: 0.19em; text-transform: uppercase; color: #6e8271; }
.side nav { display: flex; flex-direction: column; gap: 1px; padding: 0 10px; }
.side nav a, .side nav .soon {
  display: flex; align-items: center; gap: 11px; min-height: var(--tap); padding: 7px 12px; border-radius: var(--r);
  font-size: 13.5px; color: #b9c8b9; text-decoration: none; transition: background 0.18s var(--ease), color 0.18s var(--ease);
}
.side nav a .ico { color: #7f937f; transition: color 0.18s var(--ease); }
.side nav a:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }
.side nav a:hover .ico { color: var(--lime); }
.side nav a.on { background: var(--deep-3); color: #fff; font-weight: 500; }
.side nav a.on .ico { color: var(--lime); }
.side nav .soon { color: #6e8271; cursor: default; }
.side nav .soon em {
  margin-left: auto; font-style: normal; font-size: 9.5px; letter-spacing: 0.14em; text-transform: uppercase; color: #52665a;
}
/* Группы меню (30.09.2026): заголовок — как подпись раздела, со стрелкой; пункты — как обычные. */
.side nav .nav-grp { display: flex; flex-direction: column; gap: 1px; }
.side nav .nav-grp summary {
  display: flex; align-items: center; gap: 8px; min-height: 34px; margin-top: 6px; padding: 6px 12px; border-radius: var(--r);
  list-style: none; cursor: pointer; font-size: 10px; font-weight: 600; letter-spacing: 0.19em; text-transform: uppercase;
  color: #8a9d8b; transition: color 0.18s var(--ease), background 0.18s var(--ease);
}
.side nav .nav-grp summary::-webkit-details-marker { display: none; }
.side nav .nav-grp summary::after {
  content: ""; margin-left: auto; width: 6px; height: 6px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor;
  transform: rotate(-45deg); transition: transform 0.18s var(--ease);
}
.side nav .nav-grp[open] summary::after { transform: rotate(45deg); }
.side nav .nav-grp summary:hover { color: #fff; background: rgba(255, 255, 255, 0.06); }
.side nav .nav-grp summary:focus-visible { outline: 2px solid var(--lime); outline-offset: -2px; }
.side nav .nav-grp[data-here] summary { color: #d7e2d7; }
/* Невысокий экран с мышью (ноутбук, 1080p с панелями браузера): строки меню плотнее, чтобы панель
   с раскрытой группой помещалась без прокрутки. На сенсорных экранах высота строки не меняется. */
@media (min-width: 1100px) and (max-height: 960px) and (pointer: fine) {
  .side-sec { padding-top: 14px; }
  .side nav a, .side nav .soon { min-height: 32px; padding-top: 5px; padding-bottom: 5px; }
  .side nav .nav-grp summary { min-height: 28px; margin-top: 2px; padding-top: 4px; padding-bottom: 4px; }
}
.side nav .cnt {
  margin-left: auto; min-width: 20px; height: 19px; padding: 0 6px; border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--amber-soft); color: var(--amber); font-size: 11px; font-weight: 700; font-style: normal;
}
.side-foot { margin-top: auto; padding: 14px; border-top: 1px solid rgba(255, 255, 255, 0.1); font-size: 11.5px; color: var(--on-deep-2); }
.side-foot p { margin: 6px 0 0; }
.side-sys { display: inline-flex; align-items: center; min-height: 32px; color: #b9c8b9; text-decoration: none; font-size: 12.5px; }
.side-sys:hover, .side-sys.on { color: #fff; }

/* Плашка вошедшего сотрудника — «me» из демо, внизу панели (Сессия 8). */
.me { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.me .av {
  width: 33px; height: 33px; flex: none; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: var(--deep-3); color: #fff; font-size: 12px; font-weight: 600; letter-spacing: 0.02em;
}
.me b { display: block; color: #fff; font-size: 13px; font-weight: 600; line-height: 1.25; }
.me small { display: block; color: var(--on-deep-2); font-size: 11px; }
.me-acts { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; margin-bottom: 6px; }
.me-acts form { margin: 0; }
.me-acts a, .me-acts button {
  display: inline-flex; align-items: center; min-height: 32px; padding: 0; border: 0; background: none;
  color: #b9c8b9; font: 12.5px var(--f); text-decoration: none; cursor: pointer;
}
.me-acts a:hover, .me-acts button:hover { color: #fff; }

/* Вход и смена пароля — без каркаса. */
.auth { display: grid; min-height: 100vh; grid-template-columns: minmax(0, 1fr); }
.auth-side { display: none; }
@media (min-width: 900px) {
  .auth { grid-template-columns: minmax(280px, 38%) minmax(0, 1fr); }
  .auth-side {
    display: flex; flex-direction: column; justify-content: space-between; padding: 36px 40px;
    background: var(--deep); color: var(--on-deep-2); font-size: 13px;
  }
  /* Во flex-колонке картинка иначе растягивается на всю ширину панели. */
  .auth-side img { height: 22px; width: auto; align-self: flex-start; }
  .auth-logo { display: none; }
}
.auth-main { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; padding: 32px 16px; }
.auth-card {
  display: grid; gap: 14px; width: min(400px, 100%); padding: 24px 22px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
}
.auth-card h1 { margin: 0; }
.auth-card .note, .auth-card .msg { margin: 0; }
.auth-card .btn { width: 100%; }
.auth-logo { height: 20px; width: auto; justify-self: start; filter: brightness(0.25); }
.auth-foot { margin: 0; color: var(--ink-3); font-size: 12px; }
/* «Показать пароль» — глаз в поле пароля (правки персонала 23.09.2026, password-eye.js). */
.pw-wrap { position: relative; display: block; }
.pw-wrap input { width: 100%; padding-right: 44px; }
.pw-eye {
  position: absolute; top: 50%; right: 4px; transform: translateY(-50%);
  display: grid; place-items: center; width: 36px; height: 36px; padding: 0;
  background: none; border: 0; border-radius: 8px; color: var(--ink-3); cursor: pointer;
}
.pw-eye:hover, .pw-eye[aria-pressed="true"] { color: var(--ink); }
.pw-eye:focus-visible { outline: 2px solid var(--lime); outline-offset: 1px; }
.pw-eye svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 50; min-height: 60px;
  display: flex; align-items: center; gap: 12px; padding: 8px 16px;
  background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
@media (min-width: 1100px) { .topbar { min-height: 64px; padding: 0 26px; } }
.menu-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; flex: none;
  border: 1px solid var(--line-2); border-radius: var(--r); background: var(--surface); color: var(--ink); cursor: pointer;
}
.tb-title { min-width: 0; }
.crumb { font-size: 11.5px; color: var(--ink-3); letter-spacing: 0.05em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar h1 { font-size: 19px; margin: 0; }
/* До 1100 px (меню под ☰) заголовок экрана — не в шапке, а отдельной строкой над содержимым:
   в шапке остаются меню, «МегаВет74 · …» и кнопки (замечание пользователя 18.09.2026). */
.page-h1 { font-size: 22px; line-height: 1.2; margin: 0 0 16px; overflow-wrap: anywhere; }
.tb-title { flex: 1 1 auto; }
@media (max-width: 1099px) {
  .topbar h1 { display: none; }
}
@media (min-width: 1100px) {
  .page-h1 { display: none; }
}

.wrap { width: 100%; max-width: 1100px; padding: 20px 16px 46px; }
@media (min-width: 1100px) { .wrap { padding: 24px 26px 56px; } }

.lead { color: var(--ink-2); margin: 0 0 22px; max-width: 64ch; }
.note { color: var(--ink-3); font-size: 13px; }

.cards { display: grid; gap: 12px; grid-template-columns: 1fr; margin-bottom: 28px; }
@media (min-width: 640px) { .cards { grid-template-columns: repeat(3, 1fr); } }

.card { border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; background: var(--surface); }
.card.ok { border-color: #cbdcc7; background: var(--lime-soft); }
.card.bad { border-color: #efcdc0; background: var(--coral-soft); }
/* Заголовок карточки — «лейбл» демо: мелкие прописные с зелёной чертой. */
.card h2 {
  display: flex; align-items: center; gap: 9px; margin: 0 0 10px; font-family: var(--f);
  font-size: 10.5px; font-weight: 600; letter-spacing: 0.19em; text-transform: uppercase; color: var(--ink-3);
}
.card h2::before { content: ""; width: 20px; height: 1px; background: var(--lime); flex: none; }
.card .big { font-family: var(--f-serif); font-size: 22px; margin: 0 0 4px; }
.card .sub { color: var(--ink-3); font-size: 12.5px; margin: 0; }

.block { margin-bottom: 28px; }

/* Таблица на телефоне не помещается — прокрутка внутри своего контейнера. */
.tbl { width: 100%; border-collapse: collapse; display: block; overflow-x: auto; white-space: nowrap; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.tbl th, .tbl td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line); font-size: 13px; }
.tbl th { color: var(--ink-3); font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.15em; font-weight: 600; background: var(--surface-3); }
.tbl tr:last-child td { border-bottom: 0; }

.links { padding-left: 18px; color: var(--ink-2); }
.links a { font-family: var(--f-mono); color: var(--ink); }


/* ── Атомы форм ── */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap); padding: 8px 15px; border: 1px solid var(--line-2); border-radius: var(--r);
  background: var(--surface); color: var(--ink); font: 500 13.5px/1.2 var(--f); letter-spacing: 0.01em;
  cursor: pointer; white-space: nowrap;
  transition: background 0.18s var(--ease), border-color 0.18s var(--ease), color 0.18s var(--ease);
}
.btn:hover { border-color: var(--ink-2); }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn-lime { background: var(--lime); border-color: var(--lime); color: #10210a; font-weight: 600; }
.btn-lime:hover { background: #8cc352; border-color: #8cc352; }
.btn-solid { background: var(--deep); border-color: var(--deep); color: var(--on-deep); }
.btn-solid:hover { background: var(--deep-2); }
.btn-quiet { background: transparent; border-color: transparent; color: var(--ink-2); padding-inline: 11px; }
.btn-quiet:hover { background: var(--surface-2); color: var(--ink); border-color: transparent; }
.btn.danger { color: var(--coral-ink); }
.btn.danger:hover { background: var(--coral-soft); color: var(--coral-ink); }

.field { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--ink-2); }
.field input, .field select, .field textarea, .list-head select {
  min-height: var(--tap); padding: 7px 11px; border: 1px solid var(--line-2); border-radius: var(--r);
  background: var(--surface); color: var(--ink); font: var(--field-font)/1.3 var(--f);
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--lime); outline: none; box-shadow: 0 0 0 3px var(--lime-soft); }
.field textarea { resize: vertical; }
.field select:disabled { color: var(--ink-3); background: var(--surface-3); }

/* Визуально скрыто, но доступно: input внутри label-кнопки. */
.sr { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; clip: rect(0 0 0 0); }

.msg { margin: 8px 0 0; font-size: 13.5px; }
.msg:empty { display: none; }
.msg.ok { color: var(--lime-ink); }
.msg.bad { color: var(--coral-ink); }
.msg.warn { color: var(--amber); }

.eyebrow { margin: 0 0 4px; color: var(--ink-3); font-size: 12.5px; font-weight: 600; }

/* ── Документы (Сессия 3) ── */

.docs .card { margin-bottom: 24px; }
.token-form { display: grid; gap: 12px; max-width: 460px; }
.token-form .note { margin: 0; }

.drop {
  border: 1px dashed var(--line-2); border-radius: var(--r); padding: 16px;
  text-align: center; background: var(--surface-3);
}
.drop.over { border-color: var(--lime); background: var(--lime-soft); }
.drop-hint { margin: 0 0 10px; color: var(--ink-2); font-size: 13.5px; }
.drop .note { margin: 10px 0 0; font-size: 12px; }
/* На телефоне перетаскивать некуда — подсказку прячем, кнопки на всю ширину. */
@media (hover: none) { .drop-hint { display: none; } }
.pick { display: grid; gap: 8px; grid-template-columns: 1fr; }
@media (min-width: 480px) { .pick { grid-template-columns: 1fr 1fr; max-width: 420px; margin: 0 auto; } }
.pick .btn { position: relative; }

.picked { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 6px; }
.picked:empty { display: none; }
.picked li {
  display: grid; grid-template-columns: 44px 1fr auto 36px; align-items: center; gap: 10px;
  padding: 6px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); font-size: 13.5px;
}
.picked img, .picked .ext { width: 44px; height: 44px; border-radius: 3px; object-fit: cover; }
.picked .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picked .size { color: var(--ink-3); font-size: 12px; }
.picked .x { width: 36px; height: 36px; border: 0; background: none; font-size: 22px; cursor: pointer; color: var(--ink-3); }

.ext {
  display: inline-flex; align-items: center; justify-content: center; background: var(--surface-2);
  font: 600 11px var(--f-mono); color: var(--ink-2);
}

.meta { display: grid; gap: 12px; margin-top: 16px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .meta { grid-template-columns: 1fr 1fr; } .meta .wide { grid-column: 1 / -1; } }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.actions .btn { flex: 1 1 auto; }
@media (min-width: 640px) { .actions .btn { flex: 0 0 auto; } }
.actions progress { flex: 1 1 160px; height: 8px; accent-color: var(--lime); }

.list-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.list-head h2 { margin: 0; }

.doclist { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.doc { border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); padding: 14px 16px; }
.doc-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; }
.doc-head b { font-size: 14.5px; font-weight: 600; overflow-wrap: anywhere; }
.doc-meta { margin: 4px 0 0; color: var(--ink-3); font-size: 12.5px; }
.doc-comment { margin: 6px 0 0; font-size: 13.5px; }
.doc-actions { display: flex; justify-content: flex-end; margin-top: 8px; }

/* Бейдж категории — «статус» демо. */
.badge {
  display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 20px; font-size: 11.5px; font-weight: 600;
  border: 1px solid var(--line-2); background: var(--surface-2); color: var(--ink-2);
}
.badge.c-analysis, .badge.c-ultrasound, .badge.c-xray { background: var(--lime-soft); color: var(--lime-ink); border-color: #d3e6bc; }
.badge.c-contract, .badge.c-vet_passport { background: var(--sky-soft); color: var(--sky); border-color: #cbdde5; }

.files { display: grid; gap: 8px; margin-top: 10px; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
.file {
  display: flex; flex-direction: column; gap: 4px; padding: 0; border: 1px solid var(--line); border-radius: var(--r);
  background: var(--surface-3); cursor: pointer; overflow: hidden; text-align: left; font: inherit; color: inherit;
}
.file img, .file .ext { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: var(--surface-2); }
.file .name { padding: 0 6px 6px; font-size: 11px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Расписание (Сессия 5) ── */

/* Неделе из семи колонок тесно в 1000px — страница расписания шире остальных. */
.wrap-wide { max-width: 1440px; }
/* Только просмотр (врач, ассистент): без кнопок правки, смены не открываются. */
.sched.ro .toolbar-actions, .sched.ro .add { display: none !important; }
.sched.ro .shift, .sched.ro .blk { pointer-events: none; cursor: default; }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 6px; }
.weeknav { display: flex; align-items: center; gap: 6px; }
.weeknav .btn { min-width: var(--tap); padding-inline: 12px; }
.toolbar select, .toolbar input[type="date"] {
  min-height: var(--tap); padding: 7px 11px; border: 1px solid var(--line-2); border-radius: var(--r);
  background: var(--surface); color: var(--ink); font: var(--field-font)/1.3 var(--f); min-width: 0;
}
.toolbar-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-left: auto; }
@media (max-width: 639px) {
  .toolbar > * { flex: 1 1 100%; }
  .weeknav input[type="date"] { flex: 1 1 auto; }
  .toolbar-actions { margin-left: 0; }
  .toolbar-actions .btn { flex: 1 1 0; padding-inline: 10px; }
}
.week-label { font-size: 19px; margin: 12px 0; }

.view { transition: opacity 0.15s; }
.view[aria-busy="true"] { opacity: 0.5; }

/* Сетка «специалист × день» — таблица расписания демо: линии фоном сквозь зазор 1px. */
.sched-grid {
  display: grid; gap: 1px; grid-template-columns: minmax(140px, 190px) repeat(7, minmax(0, 1fr));
  background: var(--line); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden;
}
.sched-grid > * { background: var(--surface); padding: 5px; min-width: 0; }
.sched-grid > .corner, .sched-grid > .dayhead {
  background: var(--surface-3); padding: 9px 8px; font-size: 12.5px; font-weight: 600; color: var(--ink);
}
.sched-grid > .corner { font-size: 10.5px; letter-spacing: 0.15em; text-transform: uppercase; color: var(--ink-3); }
.dayhead { font-variant-numeric: tabular-nums; }
.dayhead b { font-weight: 600; }
.dayhead.weekend b { color: var(--coral-ink); }
.dayhead.today { box-shadow: inset 0 -2px 0 var(--lime); }
.sched-grid > .who { padding: 8px 10px; }

.who b { display: block; font-size: 13.5px; font-weight: 600; line-height: 1.3; }
.who span { display: block; font-size: 11.5px; line-height: 1.35; color: var(--ink-3); margin-top: 2px; }

.cell { display: flex; flex-direction: column; gap: 4px; min-height: 64px; }
.cell.today { background: #f7faf1; }
.cell.off { background: repeating-linear-gradient(45deg, var(--surface-2), var(--surface-2) 4px, var(--surface) 4px, var(--surface) 8px); }
.cell .empty { color: var(--ink-3); opacity: 0.5; font-size: 12px; padding: 4px 6px; }

/* Слоты — как в демо: занято (зелёный), недоступно (штриховка), свободно (пунктир). */
.shift, .blk, .add {
  display: flex; flex-direction: column; align-items: flex-start; gap: 1px; width: 100%;
  padding: 5px 7px; border: 0; border-radius: 3px; font: 11.5px/1.3 var(--f); text-align: left; cursor: pointer;
  transition: background 0.18s var(--ease), border-color 0.18s var(--ease), color 0.18s var(--ease);
}
.shift { background: #e4ede2; color: #2a5231; border-left: 2px solid var(--lime); }
.shift:hover { background: #d9e6d6; }
.shift b { font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.shift span { opacity: 0.78; font-size: 11px; overflow-wrap: anywhere; }
.shift .appts { opacity: 1; font-weight: 600; }
.blk {
  background: repeating-linear-gradient(45deg, var(--surface-2), var(--surface-2) 4px, var(--surface) 4px, var(--surface) 8px);
  color: var(--ink-2); border: 1px solid var(--line-2);
}
.blk b { font-weight: 600; }
.blk span { font-size: 11px; color: var(--ink-3); }
.blk:hover { border-color: var(--coral); color: var(--coral-ink); }
.add {
  align-items: center; justify-content: center; min-height: 30px; border: 1px dashed var(--line-2);
  background: transparent; color: var(--ink-3); font-size: 11px;
}
.add:hover, .add:focus-visible { border-color: var(--lime); color: var(--lime-ink); background: var(--lime-soft); }

/* Узкий экран: лента дней недели и карточки специалистов на выбранный день. */
.daystrip {
  position: sticky; top: 0; z-index: 1; display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px;
  padding: 6px 0; background: var(--bg);
}
.daybtn {
  display: flex; flex-direction: column; align-items: center; min-height: 54px; padding: 4px 0;
  border: 1px solid var(--line-2); border-radius: var(--r); background: var(--surface); color: var(--ink);
  font: 500 11.5px/1.2 var(--f); cursor: pointer;
}
.daybtn b { font-family: var(--f-serif); font-size: 17px; font-weight: 500; }
.daybtn.today { border-color: var(--lime); }
.daybtn.on { background: var(--deep); border-color: var(--deep); color: #fff; }
.daybtn .dot { width: 6px; height: 6px; margin-top: 3px; border-radius: 50%; background: var(--lime); }
.daybtn .dot.none { visibility: hidden; }
.agenda-day { font-size: 16px; margin: 10px 0; }
.agenda-day::first-letter { text-transform: uppercase; }
.agenda { display: grid; gap: 8px; }
.agenda-card { display: grid; gap: 8px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
.agenda-card .cell { min-height: 0; }
.agenda-card .cell.off { padding: 6px; border-radius: 3px; }
.agenda-card .shift, .agenda-card .blk { font-size: 13px; padding: 9px 12px; }
.agenda-card .shift b { font-size: 14.5px; }
.agenda-card .shift span, .agenda-card .blk span { font-size: 12.5px; }
.agenda-card .add { min-height: var(--tap); font-size: 13px; }

.legend { margin-top: 14px; font-size: 12.5px; }
.lg { display: inline-block; width: 12px; height: 12px; border-radius: 2px; vertical-align: -1px; }
.lg-shift { background: #e4ede2; border-left: 2px solid var(--lime); }
.lg-block { background: repeating-linear-gradient(45deg, var(--surface-2), var(--surface-2) 2px, var(--surface) 2px, var(--surface) 4px); border: 1px solid var(--line-2); }

/* ── Диалоги ── */

.dlg {
  width: min(640px, calc(100vw - 16px)); max-height: calc(100dvh - 16px); padding: 0;
  border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); color: var(--ink);
}
/* Широкий диалог — для длинных форм вроде «Создать график»: на обычном мониторе без
   прокрутки вбок, на узком экране сжимается как обычный. */
.dlg.dlg-wide { width: min(960px, calc(100vw - 32px)); }
.dlg::backdrop { background: rgba(20, 39, 27, 0.45); }
/* minmax(0, 1fr): иначе select с длинным пунктом («Терапевт, кардиолог, УЗИ-диагност…»)
   растягивает колонку по своей min-content-ширине и диалог уезжает в горизонтальный скролл.
   overflow-wrap: anywhere — длинная строка без пробелов из данных (ссылка на страницу сайта,
   e-mail, комментарий) переносится, а не раздвигает окно. */
.dlg-body { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; padding: 16px 18px 18px; overflow-wrap: anywhere; }
.dlg .field select { text-overflow: ellipsis; }
.dlg .field select, .dlg .field input, .dlg .field textarea { min-width: 0; max-width: 100%; }
/* У fieldset по умолчанию min-width: min-content, у вложенных сеток — колонка auto: поле выбора
   файла в тикете (356px) раздвигало окно на телефоне. */
.dlg fieldset { min-width: 0; }
/* «＋ Ещё питомец» (тикет CRM №23): добавленные питомцы — такими же блоками, кнопка — под ними. */
.more-pets, .more-pets-list { display: grid; gap: 12px; justify-items: start; }
.more-pets-list { justify-self: stretch; justify-items: stretch; }
.more-pets-list:empty { display: none; }
.more-pets-list legend { display: flex; align-items: center; gap: 8px; }
.dlg .tk-fields, .dlg .finder, .dlg .dups, .dlg .found { grid-template-columns: minmax(0, 1fr); }
.dlg-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: -4px 0 0; }
.dlg-head h2 { font-size: 19px; margin: 0; }
.dlg-head .x { width: 40px; height: 40px; margin: -6px -8px -6px 0; border: 0; background: none; font-size: 24px; color: var(--ink-3); cursor: pointer; border-radius: var(--r); }
.dlg-head .x:hover { background: var(--surface-2); color: var(--ink); }
.dlg-sub { margin: -6px 0 0; font-size: 13px; color: var(--ink-3); }
.grid2, .grid3 { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
@media (min-width: 520px) { .grid3 { grid-template-columns: repeat(3, 1fr); } }
.grid2 > *, .grid3 > * { min-width: 0; }
.field input[type="time"], .field input[type="date"] { width: 100%; }

.dlg fieldset, .data-form fieldset { margin: 0; padding: 8px 12px 10px; border: 1px solid var(--line); border-radius: var(--r); }
.dlg legend, .data-form legend { padding: 0 4px; font-size: 12.5px; color: var(--ink-2); }
.data-form fieldset { margin: 10px 0; }
.svc-list { display: grid; gap: 0; }
@media (min-width: 560px) { .svc-list { grid-template-columns: 1fr 1fr; } }
.svc-list .note { margin: 0; }
.svc-list label, .seg label, .wd label, .check {
  display: flex; align-items: center; gap: 8px; min-height: 36px; font-size: 13.5px; color: var(--ink); cursor: pointer;
}
.dlg input[type="checkbox"], .dlg input[type="radio"] { width: 18px; height: 18px; margin: 0; flex: none; accent-color: var(--lime-ink); }
.seg { display: flex; flex-wrap: wrap; column-gap: 20px; }
.wd { display: flex; flex-wrap: wrap; column-gap: 14px; }
/* «Создать график» по дням недели: у каждого дня свои часы и перерыв. */
.wd-hours { display: grid; gap: 6px; }
.wd-row { display: grid; grid-template-columns: 64px repeat(4, minmax(0, 1fr)); gap: 8px; align-items: center; }
.wd-row input[type="time"] { width: 100%; min-width: 0; }
.wd-row.off input[type="time"] { opacity: .45; }
.wd-head { font-size: 12.5px; color: var(--ink-2); }
.wd-hours .wd-row > label { display: flex; align-items: center; gap: 8px; min-height: 36px; font-size: 13.5px; color: var(--ink); cursor: pointer; }
.wd-hours .chips { margin-top: 2px; }
@media (max-width: 640px) {
  .wd-row { grid-template-columns: 1fr 1fr; row-gap: 4px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
  .wd-row > label { grid-column: 1 / -1; }
  .wd-head { position: sticky; top: -1px; z-index: 1; padding-block: 4px; background: var(--surface); }
  .wd-head > span:first-child { display: none; }
}

/* Чипы — как фильтры в демо. */
.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip {
  display: inline-flex; align-items: center; min-height: 32px; padding: 5px 12px; border: 1px solid var(--line-2);
  border-radius: 20px; background: var(--surface); color: var(--ink-2); font: 12.5px/1.2 var(--f); cursor: pointer;
  transition: border-color 0.18s var(--ease), background 0.18s var(--ease), color 0.18s var(--ease);
}
.chip:hover { border-color: var(--ink-3); color: var(--ink); }
@media (pointer: coarse) { .chip { min-height: 38px; } }

.preview { margin: 0; padding: 9px 12px; font-size: 13px; color: var(--ink-2); background: var(--surface-3); border: 1px solid var(--line); border-radius: var(--r); }
.preview.bad { color: var(--coral-ink); background: var(--coral-soft); border-color: #efcdc0; }
.preview:empty { display: none; }

.res h3 {
  margin: 0 0 6px; font-family: var(--f); font-size: 10.5px; font-weight: 600; letter-spacing: 0.19em;
  text-transform: uppercase; color: var(--ink-3);
}
.res ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.res li {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 5px 10px;
  border: 1px solid var(--line); border-radius: var(--r); background: var(--surface-3); font-size: 13px;
}

.dlg-actions { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 4px; }
.dlg-actions .btn { flex: 1 1 auto; }
@media (min-width: 640px) { .dlg-actions .btn { flex: 0 0 auto; } }

/* ── Тикеты разработчику (Сессия 18): кнопка в шапке, диалог, страница ── */

.tb-ticket { margin-left: auto; flex: none; }
@media (max-width: 719px) {
  .tb-ticket { width: 44px; height: 44px; padding: 0; justify-content: center; }
  .tb-ticket span { display: none; }
}
.side nav .cnt.ok { background: var(--lime-soft); color: var(--lime-ink); }
.tk-fields { display: grid; gap: 12px; }
.tk-fields[hidden] { display: none; }
.tk-picked { list-style: none; margin: -6px 0 0; padding: 0; display: grid; gap: 2px; font-size: 12.5px; color: var(--ink-2); }
.tk-picked:empty { display: none; }
.tk-picked li { overflow-wrap: anywhere; }
/* Снимок экрана в тикете (14.09.2026, как в CRM ЮниксAI): со снимком окно шире, пометки
   рисуются прямо по <canvas> — внутреннее разрешение как у снимка, на экране ужат по ширине. */
.dlg.dlg-ticket.has-shot { width: min(1100px, calc(100vw - 16px)); }
.tk-empty { display: grid; gap: 10px; padding: 14px 16px; border: 1px dashed var(--line-2); border-radius: var(--r); font-size: 13px; color: var(--ink-2); }
.tk-empty p { margin: 0; }
.tk-empty kbd { padding: 1px 5px; border: 1px solid var(--line-2); border-radius: 4px; background: var(--surface-3); font: 12px var(--f); color: var(--ink); }
.tk-row { display: flex; flex-wrap: wrap; gap: 8px; }
.tk-canvas { max-height: 58vh; overflow: auto; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface-2); }
.tk-canvas canvas { display: block; width: 100%; height: auto; cursor: crosshair; touch-action: none; }
.tk-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.tk-cap { font-size: 12.5px; color: var(--ink-2); }
.tk-gap { flex: 1; }
.tk-color { width: 26px; height: 26px; flex: none; padding: 0; border: 3px solid var(--surface); border-radius: 50%; background: var(--c); box-shadow: 0 0 0 1px var(--line-2); cursor: pointer; }
.tk-color.on { box-shadow: 0 0 0 2px var(--ink); }

.tks .panel-h .tk-add { margin-left: auto; }
.tks .chip[aria-pressed="true"] { background: var(--deep); border-color: var(--deep); color: var(--on-deep); }
.tk-list { display: grid; gap: 10px; padding: 12px 16px 16px; }
.tk-list:empty { display: none; }
.tk { padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); scroll-margin-top: 90px; }
.tk.hl { border-color: var(--lime); box-shadow: 0 0 0 3px var(--lime-soft); }
.tk-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.tk-head b { font-size: 14.5px; }
.tk-fresh { font-size: 10.5px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--amber); }
.tk-text { margin: 8px 0 0; font-size: 13.5px; white-space: pre-wrap; overflow-wrap: anywhere; }
.tk .file { text-decoration: none; }
.tk .file img { display: block; width: 100%; height: 84px; object-fit: cover; }
.tk .file span { padding: 4px 7px 6px; font-size: 11.5px; overflow-wrap: anywhere; }
.tk-dev a { color: var(--sky); }
/* Ответ разработчика под тикетом (22.09.2026) */
.tk-reply { margin-top: 10px; padding: 10px 12px; border-left: 3px solid var(--lime); border-radius: 0 var(--r) var(--r) 0; background: var(--lime-soft); }
.tk-reply.fresh { border-left-color: var(--amber); background: var(--amber-soft); }
.tk-reply-h { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; font-size: 12px; color: var(--ink-2); }
.tk-reply-h b { font-size: 12.5px; color: var(--ink); }
.tk-reply .tk-text { margin-top: 4px; }
.tk-reply .tk-text a { color: var(--sky); }
.badge.k-bug { background: var(--coral-soft); color: var(--coral-ink); border-color: #efcdc0; }
.badge.s-new { background: var(--amber-soft); color: var(--amber); border-color: transparent; }
.badge.s-sent { background: var(--sky-soft); color: var(--sky); border-color: #cbdde5; }
.badge.s-resolved { background: var(--lime-soft); color: var(--lime-ink); border-color: #d3e6bc; }

/* ── Рабочее место администратора (Сессия 7) — KPI, панель подтверждения и
   «Расписание клиники» из демо администратора. ── */

.kpis { display: grid; gap: 10px; grid-template-columns: 1fr; margin-bottom: 18px; }
@media (min-width: 560px) { .kpis { grid-template-columns: repeat(3, 1fr); } }
.kpi { padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
.kpi.acc { border-top: 2px solid var(--amber); }
.kpi .t { display: flex; align-items: center; gap: 8px; font-size: 10.5px; font-weight: 600; letter-spacing: 0.17em; text-transform: uppercase; color: var(--ink-3); }
.kpi .t .ico { width: 15px; height: 15px; color: var(--lime-ink); }
.kpi.acc .t .ico { color: var(--amber); }
.kpi > b { display: block; margin: 6px 0 2px; font: 500 28px/1.1 var(--f-serif); font-variant-numeric: tabular-nums; }
.kpi .d { font-size: 12.5px; color: var(--ink-3); }

.panel { margin-bottom: 20px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
.panel-h { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.panel-h h2 { margin: 0; font-size: 17px; }
.panel-h .sub { color: var(--ink-3); font-size: 12.5px; }
.panel-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-left: auto; }
.panel-tools input[type="date"] {
  min-height: var(--tap); padding: 7px 11px; border: 1px solid var(--line-2); border-radius: var(--r);
  background: var(--surface); color: var(--ink); font: var(--field-font)/1.3 var(--f); min-width: 0;
}
@media (max-width: 639px) {
  .panel-tools { margin-left: 0; width: 100%; }
  .panel-tools input[type="date"] { flex: 1 1 120px; }
}
.panel > .msg, .panel > .note { margin: 12px 16px; }

.segbar { display: inline-flex; border: 1px solid var(--line-2); border-radius: var(--r); overflow: hidden; background: var(--surface); }
.segbar > * {
  display: inline-flex; align-items: center; min-height: calc(var(--tap) - 2px); padding: 0 13px; border: 0;
  border-right: 1px solid var(--line); background: transparent; color: var(--ink-2); font: 12.5px var(--f);
  text-decoration: none; cursor: pointer;
}
.segbar > :last-child { border-right: 0; }
.segbar > :hover { background: var(--surface-3); }
.segbar > .on { background: var(--deep); color: #fff; font-weight: 500; }

/* Карточка заявки: на любой ширине — карточка, не строка таблицы (требование трекера). */
.pend-list { display: grid; gap: 10px; padding: 12px; }
.pend-list:empty { display: none; }
.pend {
  padding: 12px 14px 14px; border: 1px solid var(--line); border-left: 3px solid var(--amber);
  border-radius: var(--r); background: var(--surface); scroll-margin: 90px;
}
.pend.hl { animation: pend-hl 1.8s var(--ease); }
@keyframes pend-hl { from { background: var(--amber-soft); } to { background: var(--surface); } }
.pend-h { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin-bottom: 10px; }
.pend-h b { font-size: 14px; font-weight: 600; }
.pend-h .sub { font-size: 12.5px; color: var(--ink-3); }
/* Статусы — как в демо: пилюля с точкой. */
.st { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border: 1px solid; border-radius: 20px; font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.st::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.pend-h .st { margin-left: auto; }
.st-wait { background: var(--amber-soft); color: var(--amber); border-color: #eddcb4; }
.st-late, .st-bad { background: var(--coral-soft); color: var(--coral-ink); border-color: #efcdc0; }
.st-new { background: var(--lime-soft); color: var(--lime-ink); border-color: #d3e6bc; }
.st-work { background: var(--sky-soft); color: var(--sky); border-color: #cbdde5; }
.st-ok { background: #e4ede2; color: #2f5b36; border-color: #cbdcc7; }
.st-off { background: var(--surface-2); color: var(--ink-3); border-color: var(--line-2); }
.st-vio { background: var(--violet-soft); color: var(--violet); border-color: #ddd7ec; }
.pend-b { display: grid; gap: 10px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .pend-b { grid-template-columns: 1.1fr 1fr 1fr; } }
.pend-b > div { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; min-width: 0; }
.pend-b b { font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.pend-b span { font-size: 12.5px; color: var(--ink-2); }
.pend-b a {
  display: inline-flex; align-items: center; gap: 6px; min-height: 28px;
  color: var(--lime-ink); font-size: 13.5px; font-weight: 600; text-decoration: none;
}
.pend-b a .ico { width: 14px; height: 14px; }
.pend-when b { font: 500 18px/1.25 var(--f-serif); }
.pend-when b::first-letter { text-transform: uppercase; }
.pend-comment { margin: 10px 0 0; padding: 8px 11px; font-size: 13px; background: var(--surface-3); border: 1px solid var(--line); border-radius: var(--r); }
.pend-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.pend-actions .danger { margin-left: auto; }
/* Бот клиента у заявки (раздел 9 отчёта администраторов, 18.09.2026): придёт ли подтверждение. */
.pend-bot { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin: 10px 0 0; font-size: 13px; color: var(--ink-2); }
.callconf-phone { display: inline-flex; align-items: center; gap: 8px; font-size: 22px; font-weight: 600; color: var(--ink); text-decoration: none; }
.callconf-phone .ico { width: 20px; height: 20px; }
@media (max-width: 639px) {
  .pend-actions .btn { flex: 1 1 100%; }
  .pend-actions .danger { margin-left: 0; }
}
.pend-move, .pend-refuse {
  display: grid; gap: 10px; margin-top: 12px; padding: 12px;
  background: var(--surface-3); border: 1px solid var(--line); border-radius: var(--r);
}
.pend-move .note, .pend-refuse .note { margin: 0; }
.pend .msg { margin-top: 10px; }
.grid4 { display: grid; gap: 10px; grid-template-columns: 1fr 1fr; }
@media (min-width: 760px) { .grid4 { grid-template-columns: repeat(4, 1fr); } }
.grid4 > * { min-width: 0; }
.grid4 input[type="date"] { width: 100%; }

/* «Расписание клиники»: время × специалисты, слоты как в таблице демо.
   Строка врачей — отдельной сеткой над прокручиваемой: пока страница листается вниз, она
   остаётся под шапкой CRM, и видно, к кому относится столбец (тикет № 1 клиники, 19.09.2026).
   Прокрутка вбок осталась у нижней сетки, верхнюю двигает за ней desk.js (syncCalHead) —
   внутри блока с прокруткой прилипнуть к окну браузера шапка не может. Колонка времени
   остаётся слева при прокрутке вбок. */
.cal-head { position: sticky; top: 60px; z-index: 3; overflow: hidden; }
@media (min-width: 1100px) { .cal-head { top: 64px; } }
.cal-body { overflow-x: auto; }
.cal-t { position: sticky; left: 0; z-index: 1; }
.cal-hd.hcol { position: sticky; left: 0; z-index: 4; }
.cal-grid { display: grid; min-width: min-content; }
.cal-hd {
  padding: 9px 10px; background: var(--surface-3); border-bottom: 1px solid var(--line); border-right: 1px solid var(--line);
  font-size: 12.5px; font-weight: 600; min-width: 0;
}
.cal-hd b { font-weight: 600; }
.cal-hd small { display: block; font-weight: 400; font-size: 10.5px; color: var(--ink-3); }
.cal-hd.hcol { display: flex; align-items: flex-end; justify-content: center; font-size: 10.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-3); }
.cal-t {
  display: flex; align-items: center; justify-content: center; background: var(--surface-3);
  border-bottom: 1px solid var(--line); border-right: 1px solid var(--line);
  font-size: 11.5px; color: var(--ink-3); font-variant-numeric: tabular-nums;
}
.cal-c { display: flex; flex-direction: column; padding: 3px; min-width: 0; border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); }
.cal-c > .slot { flex: 1 1 auto; }

.slot {
  display: flex; flex-direction: column; justify-content: center; min-height: 30px; padding: 4px 7px;
  border-radius: 3px; font-size: 11.5px; line-height: 1.3; overflow: hidden; color: var(--ink);
}
button.slot { width: 100%; border: 0; font-family: inherit; text-align: left; cursor: pointer; }
.slot b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.slot span { opacity: 0.72; font-size: 10.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.slot.busy { background: #e4ede2; color: #2a5231; border-left: 2px solid var(--lime); }
.slot.wait { background: var(--amber-soft); color: #7a5510; border-left: 2px solid var(--amber); }
.slot.wait span { text-transform: uppercase; letter-spacing: 0.04em; opacity: 0.9; }
button.slot.busy:hover { background: #d9e6d6; }
button.slot.wait:hover { background: #f6e6c6; }
.slot.off { background: repeating-linear-gradient(45deg, var(--surface-2), var(--surface-2) 4px, transparent 4px, transparent 8px); color: var(--ink-3); }
.slot.free { align-items: center; border: 1px dashed var(--line-2); color: var(--ink-3); font-size: 11px; }
.slot.out { background: var(--surface-3); }
.slot.clash { outline: 2px solid var(--coral); outline-offset: -2px; }
/* «Без времени» внизу сетки (тикет CRM №16): записи без часа стопкой, под ними «+ без времени». */
.cal-t-untimed { border-top: 2px solid var(--line-2); font-size: 10.5px; line-height: 1.2; text-align: center; padding: 0 4px; text-transform: uppercase; letter-spacing: 0.06em; }
.cal-untimed { gap: 3px; border-top: 2px solid var(--line-2); background: var(--surface-2); }
.cal-untimed > .slot { flex: 0 0 auto; }
.slot.untimed-add { min-height: 26px; }

.panel .agenda { padding: 12px; }
.ag-list { display: grid; gap: 4px; }
.ag-list .slot { min-height: 0; padding: 8px 11px; font-size: 13.5px; }
.ag-list .slot b, .ag-list .slot span { white-space: normal; }
.ag-list .slot span { font-size: 12px; }
.ag-t { font-style: normal; font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; opacity: 0.8; }
.cal-empty { margin: 16px; }
.cal-legend { margin: 0; padding: 10px 16px 14px; }
.lg-wait { background: var(--amber-soft); border-left: 2px solid var(--amber); }
.lg-free { border: 1px dashed var(--line-2); }
/* Свободное время смены — клик открывает запись, как в демо. */
button.slot.free { background: transparent; cursor: pointer; font: 11px var(--f); color: var(--ink-3); text-align: center; }
button.slot.free:hover, button.slot.free:focus-visible { border-color: var(--lime); color: var(--lime-ink); background: var(--lime-soft); }
.agenda-card > .btn { justify-self: start; }
.agenda-card > .ag-book { display: flex; flex-wrap: wrap; gap: 6px; }

/* ── Остаток рабочего места (Сессия 7): быстрые кнопки, входящий поток, задачи,
   диалоги записи, обращения, клиента, пациента, задачи; карточки обращения и записи. ── */

.quick { display: grid; gap: 8px; grid-template-columns: 1fr 1fr; margin-bottom: 16px; }
.quick > :first-child { grid-column: 1 / -1; }
@media (min-width: 760px) {
  .quick { display: flex; flex-wrap: wrap; }
}

@media (min-width: 1100px) { .kpis-5 { grid-template-columns: repeat(5, 1fr); } }
.kpi.acc-lime { border-top: 2px solid var(--lime); }
.kpi.alert { border-top: 2px solid var(--coral); }
.kpi.alert > b { color: var(--coral-ink); }
.kpi.alert .t .ico { color: var(--coral-ink); }
/* Кликабельная карточка KPI — открывает список (21.09.2026, «Пора на повторный»). */
.kpi.kpi-link { cursor: pointer; transition: border-color .15s; }
.kpi.kpi-link:hover { border-color: var(--ink-3); }
.kpi.kpi-link:focus-visible { outline: 2px solid var(--lime); outline-offset: 2px; }
.ful-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.ful-list button { display: grid; gap: 3px; width: 100%; padding: 10px 12px; text-align: left; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); cursor: pointer; font: inherit; color: inherit; }
.ful-list button:hover { border-color: var(--ink-3); }
.ful-list .ful-static { display: grid; gap: 3px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
.ful-list .sub { font-size: 12.5px; color: var(--ink-3); }
/* Текст сообщения, ушедшего клиенту (правки персонала 23.09.2026): как в мессенджере, по строкам. */
.nt-text { white-space: pre-line; color: var(--ink-2); border-left: 2px solid var(--line); padding-left: 8px; margin-top: 2px; }

.cols-2-1 { display: grid; gap: 0 20px; grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 1100px) { .cols-2-1 { grid-template-columns: minmax(0, 2.35fr) minmax(310px, 1fr); } }

/* Входящий поток: чипы-фильтры, как в демо. */
.inbox-chips { padding: 12px 16px 0; }
/* Ряд фильтров прямо в панели (экран консультанта и др.) — с отступами, а не вплотную к линии и краю. */
.panel > .chips { padding: 12px 16px 0; }
/* Данные клиента в карточке (12.09.2026). */
.data-row { margin: 4px 0; }
.data-form { margin-top: 10px; }
.client-title { font-size: clamp(24px, 5vw, 30px); margin: 0 0 6px; color: var(--ink); }
.data-acts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.data-form h3 { margin: 6px 0 8px; font-size: 18px; }
.chip.on { background: var(--deep); border-color: var(--deep); color: #fff; }
.chip .n { margin-left: 6px; font-weight: 700; font-size: 11.5px; opacity: 0.65; }
.chip.on .n { opacity: 0.85; }
.panel .more { display: flex; justify-content: center; padding: 0 16px 14px; }
.panel .more:has(> [hidden]) { display: none; }
/* «Показать все» под блоками правой колонки рабочего места (тикет CRM №12). */
p.more { margin: 0; padding-top: 4px; }

.inbox-wrap { overflow-x: auto; margin-top: 12px; }
.inbox-tbl { width: 100%; border-collapse: collapse; }
.inbox-tbl th {
  text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--surface-3);
  font-size: 10.5px; font-weight: 600; letter-spacing: 0.15em; text-transform: uppercase; color: var(--ink-3); white-space: nowrap;
}
.inbox-tbl td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; font-size: 13px; }
.inbox-tbl tr:last-child td { border-bottom: 0; }
.inbox-tbl tbody tr { cursor: pointer; transition: background 0.16s var(--ease); }
.inbox-tbl tbody tr:hover { background: var(--surface-3); }
.inbox-tbl tbody tr.hot { background: #fdf7f4; }
.inbox-tbl tbody tr.hot:hover { background: #fbf0eb; }
.inbox-tbl .time { white-space: nowrap; font-size: 12.5px; color: var(--ink-2); }
.inbox-tbl .time b { color: var(--ink); font-variant-numeric: tabular-nums; }
.inbox-tbl .why { max-width: 300px; }
.inbox-tbl .acts { display: flex; gap: 6px; justify-content: flex-end; }
.inbox-tbl small, .lead-card small { display: block; color: var(--ink-3); font-size: 11.5px; }
.inbox-tbl .who b { font-size: 13.5px; }
.pet b { display: block; font-weight: 600; font-size: 13.5px; }
.src { display: inline-flex; align-items: flex-start; gap: 7px; color: var(--ink-2); font-size: 12.5px; }
.src .ico { width: 15px; height: 15px; margin-top: 2px; color: var(--ink-3); }
.src b { font-weight: 500; color: var(--ink); }
.btn-sm { min-height: 32px; padding: 5px 11px; font-size: 12.5px; }
.btn-sm .ico { width: 14px; height: 14px; }
.btn-ico { padding-inline: 8px; }
@media (pointer: coarse) { .btn-sm { min-height: 40px; } }

.lead-cards { display: grid; gap: 8px; padding: 12px; }
.lead-card {
  display: grid; gap: 6px; padding: 12px 14px; border: 1px solid var(--line); border-left: 3px solid var(--line-2);
  border-radius: var(--r); background: var(--surface); cursor: pointer;
}
.lead-card.hot { border-left-color: var(--lime); }
.lead-card-h { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: 12.5px; color: var(--ink-3); }
.lead-card-h .st { margin-left: auto; }
.lead-card .who b { font-size: 15px; }
.lead-card .src { font-size: 12.5px; }
.lead-card .acts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.lead-card .acts .btn { flex: 1 1 auto; }

/* Задачи на сегодня — список демо. */
.tasks { display: flex; flex-direction: column; }
.tasks:empty { display: none; }
.task { display: flex; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.task:last-child { border-bottom: 0; }
.task .ic {
  width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  flex: none; background: var(--surface-2); color: var(--ink-2);
}
.task .ic .ico { width: 14px; height: 14px; }
.task .ic.coral { background: var(--coral-soft); color: var(--coral-ink); }
.task .ic.amber { background: var(--amber-soft); color: var(--amber); }
.task .ic.sky { background: var(--sky-soft); color: var(--sky); }
.task .tx { min-width: 0; flex: 1; }
.task .tx > b { display: block; font-size: 13.5px; font-weight: 600; overflow-wrap: anywhere; }
.task .tx > button.link { padding: 0; border: 0; background: none; font: 600 13.5px/1.4 var(--f); color: var(--ink); text-align: left; cursor: pointer; }
.task .tx > button.link:hover { color: var(--lime-ink); text-decoration: underline; }
.task .tx span { display: block; margin-top: 2px; font-size: 12.5px; line-height: 1.45; color: var(--ink-2); overflow-wrap: anywhere; }
.task .tx .when { margin-top: 5px; font-size: 11.5px; color: var(--ink-3); }
.task .tx .when.late { color: var(--coral-ink); font-weight: 600; }
.task .go { display: flex; flex-direction: column; gap: 6px; align-self: center; }
.panel-h .st-bad { margin-left: 0; }

/* Сессия 9: итог приёма в сетке, панели «Итоги приёмов» и «Автокоммуникации». */
.stack { min-width: 0; }
.slot.busy.done { background: #eef3ec; color: #4a6a4f; }
.slot.noshow { background: var(--coral-soft); color: var(--coral-ink); border-left: 2px solid var(--coral); }
.slot.noshow b { text-decoration: line-through; }
button.slot.noshow:hover { background: #f7ddd3; }

/* Тикет CRM №5 (21.09.2026): свой цвет записей врача — ключ палитры из «Сотрудников».
   Подтверждённая запись — вся в цвете врача; ждущая и неявка сохраняют цвет статуса,
   от врача у них — полоса слева. */
.dc-red { --dc: #d64545; --dc-soft: #fbe3e3; --dc-ink: #8c2323; }
.dc-orange { --dc: #e07b28; --dc-soft: #fdebdb; --dc-ink: #8a4510; }
.dc-yellow { --dc: #d9ae00; --dc-soft: #fbf2c4; --dc-ink: #6e5700; }
.dc-green { --dc: #3f9a4a; --dc-soft: #e0f1e2; --dc-ink: #245a2b; }
.dc-teal { --dc: #1f9a93; --dc-soft: #d7f1ef; --dc-ink: #115c57; }
.dc-blue { --dc: #3a78c8; --dc-soft: #e0ebf8; --dc-ink: #1f4a82; }
.dc-violet { --dc: #7d55c7; --dc-soft: #ece4f8; --dc-ink: #4b2d85; }
.dc-pink { --dc: #d4508f; --dc-soft: #f9e1ed; --dc-ink: #85244f; }
.dc-brown { --dc: #8a6242; --dc-soft: #efe5db; --dc-ink: #573a23; }
.dc-gray { --dc: #6f7780; --dc-soft: #e8eaed; --dc-ink: #3d434a; }
.slot.busy.dc { background: var(--dc-soft); color: var(--dc-ink); border-left: 4px solid var(--dc); }
button.slot.busy.dc:hover { background: color-mix(in srgb, var(--dc-soft) 82%, var(--dc)); }
.slot.busy.done.dc { background: color-mix(in srgb, var(--dc-soft) 45%, #fff); color: color-mix(in srgb, var(--dc-ink) 75%, #fff); }
.slot.wait.dc, .slot.noshow.dc { border-left: 4px solid var(--dc); }
/* Жёлтый или оранжевый врач близок к янтарной «ждёт подтверждения» — у ждущей ещё и пунктир. */
.slot.wait.dc { border: 1px dashed var(--amber); border-left: 4px solid var(--dc); }
.cal-hd.dc { box-shadow: inset 0 3px 0 var(--dc); }
.dc-dot { display: inline-block; flex: none; width: 16px; height: 16px; border-radius: 50%; background: var(--dc, transparent); border: 1px solid var(--line-2); }
.stf-color { display: flex; align-items: center; gap: 8px; }
.stf-color select { flex: 1 1 auto; }

/* Тикет CRM №4 (21.09.2026): линия текущего времени поперёк сетки дня. Ячейка-строка
   растянута на всю ширину; отступ сверху — доля строки (--at), время прилипает к левому краю. */
.cal-now { display: flex; flex-direction: column; pointer-events: none; z-index: 2; }
.cal-now::before { content: ''; flex: 0 0 var(--at, 0%); }
.cal-now-line { position: relative; height: 0; border-top: 2px solid #e5372c; }
.cal-now-line i { position: sticky; left: 3px; display: inline-block; transform: translateY(-55%); padding: 1px 6px; border-radius: 9px; background: #e5372c; color: #fff; font: 600 10.5px/1.4 var(--f); font-style: normal; }
.lg-noshow { background: var(--coral-soft); border-left: 2px solid var(--coral); }
.task .go.row { flex-direction: row; flex-wrap: wrap; justify-content: flex-end; }
/* Кнопки уходят под текст по ширине самого списка, а не экрана: «Итоги приёмов» стоят в узкой правой
   колонке и на широком мониторе — рядом с кнопками текст сжимался в полоску (замечание 18.09.2026). */
.tasks { container-type: inline-size; }
@container (max-width: 519px) {
  .task:has(.go.row) { flex-wrap: wrap; }
  .task .go.row { width: 100%; justify-content: flex-start; padding-left: 40px; }
  .task .go.row .btn { flex: 1 1 0; }
}
.panel-b { padding: 6px 16px 14px; }
.panel-b > .note { margin: 10px 0 0; }
.props .dim { color: var(--ink-3); font-weight: 400; }

/* Диалоги Сессии 7. */
.field.wide, .check.wide { grid-column: 1 / -1; }
.dlg fieldset .grid2, .data-form fieldset .grid2 { margin-top: 4px; }
.finder { display: grid; gap: 6px; }
.found { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; max-height: 220px; overflow-y: auto; }
.found:empty { display: none; }
.found li.note { padding: 6px 2px; margin: 0; }
.found button {
  display: flex; flex-direction: column; align-items: flex-start; gap: 1px; width: 100%; min-height: var(--tap); padding: 7px 11px;
  border: 1px solid var(--line); border-radius: var(--r); background: var(--surface-3); font: 13.5px/1.3 var(--f); color: var(--ink);
  text-align: left; cursor: pointer;
}
.found button:hover, .found button:focus-visible { border-color: var(--lime); background: var(--lime-soft); }
.found button b { font-weight: 600; }
.found button span { font-size: 12px; color: var(--ink-3); }
/* Подсказки породы (breed-suggest.js, 15.09.2026): список поверх следующих полей, а не сдвигом формы. */
.suggest-host { position: relative; }
.suggest {
  position: absolute; top: 100%; left: 0; right: 0; z-index: 5; margin: 2px 0 0; padding: 4px; list-style: none;
  max-height: 248px; overflow-y: auto; border: 1px solid var(--line-2); border-radius: var(--r); background: var(--surface);
  box-shadow: 0 6px 18px rgba(20, 39, 27, 0.12);
}
.suggest li { padding: 7px 9px; border-radius: 3px; font-size: 13.5px; line-height: 1.3; color: var(--ink); cursor: pointer; }
.suggest li b { font-weight: 700; }
.suggest li span { font-size: 12px; color: var(--ink-3); }
.suggest li[aria-selected="true"] { background: var(--lime-soft); box-shadow: inset 2px 0 0 var(--lime); }
.picked-who {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; padding: 10px 12px;
  border: 1px solid #d3e6bc; border-left: 3px solid var(--lime); border-radius: var(--r); background: var(--lime-soft);
}
.picked-who > div { min-width: 0; flex: 1 1 180px; }
.picked-who b { display: block; font-size: 14px; font-weight: 600; }
.picked-who span { font-size: 12.5px; color: var(--ink-2); }
.person { display: grid; gap: 10px; }
.person > .note { margin: 0; }
.dups { display: grid; gap: 6px; }

/* Карточки обращения и записи: «свойство — значение», история, действия. */
.props { display: grid; margin: 0; }
.props > div { display: grid; grid-template-columns: minmax(110px, 38%) 1fr; gap: 12px; padding: 7px 0; border-bottom: 1px dashed var(--line); font-size: 13.5px; }
.props > div:last-child { border-bottom: 0; }
.props dt { color: var(--ink-3); font-size: 12.5px; }
.props dd { margin: 0; font-weight: 500; min-width: 0; overflow-wrap: anywhere; }
.props a { color: var(--lime-ink); font-weight: 600; }
.dur-line { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.dur-line .btn-sm { min-width: 44px; justify-content: center; }
/* «Комментарий для врача» в карточке записи (тикет CRM №32). */
.appt-note { white-space: pre-line; }
/* Тикет CRM №33: непустой комментарий для врача — жёлтой плашкой (карточка записи, «Мой день»). */
.appt-note.has { display: block; flex: 1 1 100%; padding: 7px 10px; border-radius: 8px; background: var(--amber-soft); border: 1px solid #eddcb4; border-left: 3px solid var(--amber); color: var(--ink); font-weight: 600; }
.slot-cmt { font-style: normal; margin-right: 3px; }
.appt-comment { display: flex; flex-direction: column; gap: 8px; width: 100%; }
.appt-comment textarea { width: 100%; }
.dur-err { flex-basis: 100%; font-size: 12.5px; }
.dur-err:empty { display: none; }
.card-sec {
  margin: 4px 0 0; font-family: var(--f); font-size: 10.5px; font-weight: 600; letter-spacing: 0.19em;
  text-transform: uppercase; color: var(--ink-3);
}
.tl { position: relative; margin: 0; padding: 0 0 0 22px; list-style: none; }
.tl::before { content: ""; position: absolute; left: 5px; top: 6px; bottom: 6px; width: 1px; background: var(--line-2); }
.tl li { position: relative; padding-bottom: 12px; font-size: 13px; }
.tl li:last-child { padding-bottom: 0; }
.tl li::before {
  content: ""; position: absolute; left: -22px; top: 5px; width: 11px; height: 11px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--line-2);
}
.tl li:last-child::before { border-color: var(--lime); background: var(--lime); }
.tl b { font-weight: 600; }
.tl small { display: block; color: var(--ink-3); font-size: 11.5px; }
.card-actions { display: flex; flex-wrap: wrap; gap: 8px; }
@media (max-width: 519px) { .card-actions .btn { flex: 1 1 100%; } }
.sub-form {
  display: grid; gap: 10px; padding: 12px; background: var(--surface-3); border: 1px solid var(--line); border-radius: var(--r);
}
.sub-form .note { margin: 0; }

/* Сессия 10: повторный визит — KPI, ссылки в карточках, «Мои приёмы» специалиста. */
@media (min-width: 1100px) { .kpis-6 { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1440px) { .kpis-6 { grid-template-columns: repeat(6, 1fr); } }
.props button.link {
  padding: 0; border: 0; background: none; font: inherit; font-weight: 600; color: var(--lime-ink);
  text-align: left; cursor: pointer; overflow-wrap: anywhere;
}
.props button.link:hover, .props button.link:focus-visible { text-decoration: underline; }
/* Строка сводки, открывающая список (23.09.2026): нажимается вся строка — курсор, подсветка, стрелка. */
.props > div.props-open { cursor: pointer; border-radius: 6px; margin: 0 -8px; padding-inline: 8px; }
.props > div.props-open:hover, .props > div.props-open:focus-visible { background: var(--surface-3); outline: none; }
.props > div.props-open:focus-visible { box-shadow: 0 0 0 2px var(--lime-ink); }
.props .po-v { color: var(--lime-ink); font-weight: 700; }
.props .po-go { display: block; margin-top: 2px; font-size: 11.5px; font-weight: 600; color: var(--lime-ink); }
.props > div.props-open:hover .po-go { text-decoration: underline; }
.my-appts { margin-bottom: 18px; }
.my-appts .task .tx .sub-form { margin-top: 10px; }
.my-appts .task .tx .when { color: var(--lime-ink); font-weight: 600; }
.my-note { margin: 0; padding: 0 16px 12px; }
.my-appts .tasks + .my-note, .my-appts #my-empty:not([hidden]) { padding-top: 12px; }

/* Сессия 12: AI-консультант — пересказ в карточке обращения (плашка из демо), переписка, экран диалогов. */
.ai-note {
  display: flex; gap: 11px; padding: 13px 15px; border-radius: var(--r); background: var(--surface-3);
  border: 1px solid var(--line); font-size: 12.5px; line-height: 1.55; color: var(--ink-2);
}
.ai-note > .ico { width: 18px; height: 18px; flex: none; margin-top: 1px; color: var(--lime-ink); }
.ai-note b { color: var(--ink); }
.ai-note button.link, .conv-row button.link {
  padding: 0; border: 0; background: none; font: inherit; font-weight: 600; color: var(--lime-ink); cursor: pointer;
}
.ai-note button.link:hover, .ai-note button.link:focus-visible { text-decoration: underline; }
.ai-chat {
  max-height: min(60vh, 520px); overflow-y: auto; padding: 12px; border: 1px solid var(--line);
  border-radius: var(--r); background: var(--surface-3);
}
.chat { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.chat-msg { display: flex; flex-direction: column; gap: 2px; max-width: 85%; }
.chat-msg .bubble {
  padding: 8px 12px; border-radius: 12px; font-size: 13.5px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere;
}
.chat-msg.bot { align-self: flex-start; }
.chat-msg.bot .bubble { background: var(--surface); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.chat-msg.user { align-self: flex-end; align-items: flex-end; }
.chat-msg.user .bubble { background: var(--lime-soft); border: 1px solid #d3e6bc; border-bottom-right-radius: 4px; }
.chat-msg small { padding: 0 4px; font-size: 11px; color: var(--ink-3); }
.chat-sys {
  align-self: center; max-width: 95%; padding: 4px 12px; border: 1px dashed var(--line-2); border-radius: 999px;
  background: var(--surface); font-size: 12px; color: var(--ink-2); text-align: center;
}
.chat-sys.ok { color: var(--lime-ink); border-color: #cfe3b5; }
.chat-sys.bad { color: var(--coral-ink); border-color: #efc7b9; }
.chat-sys a { color: inherit; font-weight: 600; }
@media (max-width: 519px) { .chat-msg { max-width: 94%; } }

/* ── Каналы уведомлений клиента (Сессия 16): карточка записи и страница клиента ── */
.chan-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.chan-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.chan-list b { min-width: 70px; font-weight: 600; }
.chan-t { color: var(--ink-3); font-size: 12.5px; font-weight: 400; }
.chan .note { margin: 6px 0 0; }
.chan-card { margin-bottom: 18px; }
.chan button.link { padding: 0; border: 0; background: none; font: inherit; font-size: 12.5px; color: var(--lime-ink); cursor: pointer; }
.chan button.link:hover, .chan button.link:focus-visible { text-decoration: underline; }
.chan button.link:disabled { color: var(--ink-3); cursor: default; }
.consent-card input[type="checkbox"] { width: 18px; height: 18px; margin: 0; flex: none; accent-color: var(--lime-ink); }
.consent-card .note { margin: 4px 0 0; }

/* ── База обращений (Сессия 21) ── */
.reg { display: grid; gap: 16px; }
.reg-filters { display: grid; gap: 10px 12px; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); padding: 14px 16px; align-items: end; }
.reg-filters .reg-q { grid-column: span 2; }
.reg-acts { display: flex; gap: 8px; flex-wrap: wrap; }
.reg-export { margin-left: auto; }
/* База клиентов (19.09.2026): сортировка списка — рядом с «Скачать в Excel». */
.cl-sort { display: inline-flex; align-items: center; gap: 8px; margin-left: auto; font-size: 12.5px; color: var(--ink-2); }
.cl-sort select { min-width: 0; min-height: var(--tap); padding: 6px 10px; border: 1px solid var(--line-2); border-radius: var(--r); background: var(--surface); color: var(--ink); font: 500 13px var(--f); }
.cl-sort + .reg-export { margin-left: 0; }
@media (max-width: 559px) { .cl-sort { margin-left: 0; flex: 1 1 100%; min-width: 0; } .cl-sort select { flex: 1 1 auto; min-width: 0; width: 100%; font-size: var(--field-font); } }
.reg-row { cursor: pointer; }
.reg-row td small { display: block; }
.reg-card { color: inherit; text-decoration: none; display: block; }
/* Все пациенты (24.09.2026): отметки «в стационаре», «умер» — пилюлями рядом. */
.pt-marks .st + .st { margin-left: 4px; }
.reg-card .who .st { margin-left: 6px; }
/* Мультивыбор в фильтре (24.09.2026): выглядит как select, внутри — галочки. */
.msel { position: relative; min-width: 0; }
.msel > summary {
  list-style: none; display: flex; align-items: center; min-height: var(--tap); padding: 7px 30px 7px 11px;
  border: 1px solid var(--line-2); border-radius: var(--r); background: var(--surface); color: var(--ink);
  font: var(--field-font)/1.3 var(--f); cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; position: relative;
}
.msel > summary::-webkit-details-marker { display: none; }
.msel > summary::after {
  content: ""; position: absolute; right: 12px; top: 50%; width: 7px; height: 7px; margin-top: -5px;
  border-right: 1.5px solid var(--ink); border-bottom: 1.5px solid var(--ink); transform: rotate(45deg);
}
.msel[open] > summary, .msel > summary:focus-visible { border-color: var(--lime); outline: none; box-shadow: 0 0 0 3px var(--lime-soft); }
.msel-list {
  position: absolute; z-index: 30; top: calc(100% + 4px); left: 0; min-width: 100%; max-height: 320px; overflow-y: auto;
  padding: 4px 0; background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r); box-shadow: 0 8px 24px rgb(20 39 27 / 14%);
}
.msel-opt { display: flex; align-items: center; gap: 9px; padding: 7px 12px; color: var(--ink); font-size: var(--field-font); white-space: nowrap; cursor: pointer; }
.msel-opt:hover { background: var(--surface-3); }
.msel-opt input { width: 16px; height: 16px; min-height: 0; margin: 0; padding: 0; accent-color: var(--lime-ink); flex: none; }
@media (max-width: 559px) { .reg-filters .reg-q { grid-column: 1 / -1; } .reg-export { margin-left: 0; width: 100%; justify-content: center; } }

/* Журнал выдачи рецептов (15.09.2026): «Распечатать журнал» — заголовок и таблица, без меню,
   фильтра и кнопок. */
.rx-tbl td:first-child { white-space: nowrap; font-variant-numeric: tabular-nums; }
.rx-tbl .drug { max-width: 280px; }
/* Единый запуск, Сессия 6: аннулированные рецепты и привязка к справочнику. */
.rx-void { display: block; color: var(--danger, #B04A2A); font-size: 12px; white-space: normal; }
.rx-tbl tr.rx-voided td { color: var(--ink-3, #8B968C); }
.rx-tbl tr.rx-voided td b { text-decoration: line-through; }
.rx-link { max-width: 220px; font-size: 13px; }
#rx > .panel { min-width: 0; }
.inv-rx { color: var(--danger, #B04A2A); }
@media print {
  body:has(#rx) { background: #fff; }
  body:has(#rx) .side, body:has(#rx) .scrim, body:has(#rx) .menu-btn, body:has(#rx) .tb-ticket, body:has(#rx) .rx-noprint { display: none !important; }
  body:has(#rx) .app { display: block; }
  body:has(#rx) .panel { border: 0; box-shadow: none; }
  body:has(#rx) .inbox-tbl th, body:has(#rx) .inbox-tbl td { padding: 4px 6px; font-size: 10px; }
  body:has(#rx) .inbox-tbl tr { break-inside: avoid; }
  body:has(#rx) .inbox-tbl a { color: inherit; text-decoration: none; }
}

/* ── Прайс (Этап 2, Сессия 5): разделы, строки с правкой на месте, окно позиции ──
   Ведёт руководитель, в том числе с телефона: строка — не таблица, а гибкий ряд, который
   на узком экране сам раскладывается в карточку (название, под ним цена и галочка). */
.prc { display: grid; gap: 16px; }
.prc .reg-filters { align-items: end; }
.prc-all { grid-column: 1 / -1; margin: 0; }
.prc-site-state { margin: 10px 16px 0; }

/* Подпись раздела — «лейбл» демо: мелкие прописные с зелёной чертой. */
.prc-sec {
  display: flex; align-items: center; gap: 9px; margin: 0; padding: 14px 16px 6px; font-family: var(--f);
  font-size: 10.5px; font-weight: 600; letter-spacing: 0.19em; text-transform: uppercase; color: var(--ink-3);
}
.prc-sec::before { content: ""; width: 20px; height: 1px; background: var(--lime); flex: none; }
.prc-rows { display: grid; }

.prc-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px;
  padding: 6px 16px 8px; border-top: 1px solid var(--line);
}
.prc-row:hover { background: var(--surface-3); }
/* Выключенная позиция: в прайсе и на сайте её нет, в списке она бледная. */
.prc-row.off { background: var(--surface-3); }
.prc-row.off .prc-inp { color: var(--ink-3); text-decoration: line-through; }
.prc-cell { display: flex; align-items: center; gap: 6px; }
.prc-cell-name { flex: 1 1 260px; min-width: 0; flex-wrap: wrap; }
.prc-cell-acts { display: flex; gap: 6px; margin-left: auto; }
.prc-rub { color: var(--ink-3); font-size: 13px; }

/* Поле правки на месте: выглядит как текст, рамка появляется под курсором и в фокусе. */
.prc-inp {
  width: 100%; min-height: var(--tap); padding: 5px 9px; border: 1px solid transparent; border-radius: var(--r);
  background: transparent; color: var(--ink); font: var(--field-font)/1.3 var(--f);
}
.prc-inp:hover { border-color: var(--line-2); background: var(--surface); }
.prc-inp:focus { border-color: var(--lime); outline: none; background: var(--surface); box-shadow: 0 0 0 3px var(--lime-soft); }
.prc-name { font-weight: 500; }
.prc-price { width: 112px; text-align: right; font-variant-numeric: tabular-nums; }
.prc-meta { flex: 1 1 100%; margin: 0 0 0 9px; font-size: 12px; color: var(--ink-3); }
.prc-cell-site { gap: 8px; font-size: 12.5px; color: var(--ink-2); cursor: pointer; }
.prc-cell-site input[type="checkbox"] { width: 18px; height: 18px; margin: 0; flex: none; accent-color: var(--lime-ink); }
.prc-state { flex: 1 1 100%; margin-left: 9px; font-size: 12.5px; color: var(--ink-3); }
.prc-state:empty { display: none; }
.prc-state.ok { color: var(--lime-ink); }
.prc-state.bad { color: var(--coral-ink); }

/* Телефон (375px): цена и галочка встают под названием, кнопки — своим рядом во всю ширину. */
@media (max-width: 559px) {
  .prc .reg-export { margin-left: 0; width: 100%; justify-content: center; }
  .prc-row { padding-inline: 12px; }
  .prc-cell-name { flex: 1 1 100%; }
  .prc-cell-acts { flex: 1 1 100%; margin-left: 0; }
  .prc-cell-acts .btn { flex: 1 1 auto; }
  .prc-price { width: 96px; }
}

/* Окно позиции: направления сайта и их подзаголовки. */
.prc-sub { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; margin-top: 6px; }
.prc-dirs { display: grid; gap: 4px; }
@media (min-width: 720px) { .prc-dirs { grid-template-columns: 1fr 1fr; } }
.prc-dir { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.prc-dir .check { flex: 1 1 160px; min-width: 0; }
.prc-dir .prc-group {
  flex: 0 1 190px; min-width: 0; min-height: 32px; padding: 4px 8px; border: 1px solid var(--line-2);
  border-radius: var(--r); background: var(--surface); color: var(--ink-2); font: 12.5px var(--f);
}
.prc-tags { margin-top: 4px; }
@media (min-width: 560px) { .prc-tags { display: grid; grid-template-columns: 1fr 1fr; column-gap: 14px; } .prc-tags legend { grid-column: 1 / -1; } }

/* Телефон: в окне позиции две колонки становятся одной — «Груминг и г…» в поле выбора
   раздела руководителю ничего не говорит. */
@media (max-width: 460px) { #prc-dlg .grid2 { grid-template-columns: minmax(0, 1fr); } }
/* У администратора в окне позиции нет себестоимости — пара полей превращается в одно. */
#prc-dlg .grid2:has(> label:only-child) { grid-template-columns: minmax(0, 1fr); }

/* История цены. */
.prc-hist { display: grid; gap: 2px; max-height: 50vh; overflow-y: auto; }
.prc-hist-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.prc-hist-row b { font-variant-numeric: tabular-nums; }

/* ── Записи dikidi: карточка клиента и «Архив dikidi» (Сессия 19) ── */
.hist-card { margin-bottom: 18px; }
.hist-card .note { margin: 4px 0 0; }
.hist { list-style: none; margin: 10px 0 0; padding: 0; display: grid; }
.hist-card .hist { max-height: 420px; overflow-y: auto; }
.hist li { display: grid; gap: 3px; min-width: 0; padding: 9px 0; border-bottom: 1px dashed var(--line); font-size: 13.5px; }
.hist li:last-child { border-bottom: 0; }
.hist-h { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.hist-h b { font-weight: 600; }
.hist-who { color: var(--ink-2); }
.hist-price { color: var(--ink-3); font-size: 12.5px; }
.hist small { color: var(--ink-3); font-size: 12.5px; overflow-wrap: anywhere; }
.hist small.hist-none { font-style: italic; }
.hist a { color: var(--lime-ink); font-weight: 600; }
.arch-list { margin: 0; padding: 2px 16px 12px; }
.arch-empty, #arch-msg:not(:empty) { margin: 12px 16px; }
.arch-unlinked { align-self: center; }

/* ── Сотрудники: учётки, коды, временные пароли ── */

.stf .panel-h .stf-add { margin-left: auto; }
.stf-list { display: grid; gap: 10px; padding: 12px 16px 16px; }
.stf-card { padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
.stf-card.off { background: var(--surface-3); color: var(--ink-2); }
.stf-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.stf-head b { font-size: 14.5px; }
.stf-code, .stf-secret code {
  font: 600 13px/1 ui-monospace, Consolas, monospace; letter-spacing: 0.08em; padding: 4px 8px;
  border-radius: 6px; background: var(--deep); color: var(--lime);
}
.stf-acts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.stf-secret { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 0; }
.stf-secret code { font-size: 22px; padding: 10px 14px; letter-spacing: 0.12em; user-select: all; }
.dlg .field .note { font-size: 12px; }
/* Специалист и карточка на сайте в окне сотрудника (16.09.2026). */
.stf-sub { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; margin-top: 6px; }
/* Поле выбора файла шириной 356px распирало окно на телефоне. */
.stf-photo input[type="file"] { width: 100%; min-width: 0; }
.stf-sub > .note, fieldset > .note { margin: 0; }
.stf-photo { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 12px; }
.stf-photo img, .stf-photo-none { width: 84px; aspect-ratio: 2 / 3; object-fit: cover; border-radius: var(--r); border: 1px solid var(--line); background: var(--surface-2); }
.stf-photo-none { display: grid; place-items: center; font-size: 12px; color: var(--ink-3); text-align: center; }
.stf-photo .field { flex: 1 1 200px; min-width: 0; }
.stf-site-state { margin: 10px 16px 0; }
/* Миниатюра фото слева на всю высоту карточки (17.09.2026). */
.stf-card.has-ava { display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: 12px; align-items: start; }
.stf-ava { width: 52px; aspect-ratio: 2 / 3; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); background: var(--surface-2); }
.stf-ava.none { display: grid; place-items: center; font-size: 10px; line-height: 1.1; color: var(--ink-3); text-align: center; }

/* Рабочее место: «Расписание клиники» в левой колонке под заявками (11.09.2026). До 1100px —
   одна колонка, расписание последним, как было. */
.cols-2-1 > .stack { display: grid; gap: 20px; margin-bottom: 20px; align-content: start; grid-template-columns: minmax(0, 1fr); }
/* Колонки не шире своей дорожки (21.09.2026, ноутбук клиники): без min-width: 0 элемент сетки
   растягивается по самому широкому содержимому — расписанию дня на 7+ специалистов — и оно
   уезжает под правую колонку вместо прокрутки вбок внутри .cal-body. */
.cols-2-1 > *, .cols-2-1 > .stack > * { min-width: 0; }
.cols-2-1 > .stack > .panel { margin-bottom: 0; }
@media (max-width: 1099px) {
  .cols-2-1 > .col-main { display: contents; }
  .cols-2-1 #day-panel { order: 9; }
}
@media (min-width: 1100px) { .cols-2-1 { grid-template-columns: minmax(0, 2.6fr) minmax(300px, 1fr); } }

/* ── Печатные формы в карточке клиента (14.09.2026) ── */
.forms-card .note { margin: 0; }
.forms-sub { font-size: 13px; font-weight: 600; color: var(--ink-2); margin: 16px 0 4px; }
.formlist { list-style: none; margin: 0; padding: 0; display: grid; max-height: 320px; overflow-y: auto; }
.formlist li { padding: 7px 0; border-bottom: 1px dashed var(--line); font-size: 13.5px; overflow-wrap: anywhere; }
.formlist li:last-child { border-bottom: 0; }
.formlist a { color: var(--lime-ink); font-weight: 600; }

/* ── Бонусные баллы в карточке клиента (16.09.2026) — .loyal из демо карточки пациента ── */
.loyal { background: linear-gradient(135deg, var(--deep) 0%, var(--deep-3) 100%); color: #fff; border-radius: var(--r); padding: 16px 18px; }
.loyal .t { font-size: 10.5px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--on-deep-2); }
.loyal b { display: block; font-family: var(--f-serif); font-weight: 400; font-size: 31px; line-height: 1.1; margin-top: 6px; font-variant-numeric: tabular-nums; }
.loyal b i { font-style: normal; font-size: 14px; color: var(--on-deep-2); margin-left: 5px; font-family: var(--f); }
.loyal .d { font-size: 12px; color: var(--on-deep-2); margin-top: 5px; overflow-wrap: anywhere; }
.loyal .acts { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 12px; }
.btn-ondeep { background: rgba(255, 255, 255, 0.12); color: #fff; border-color: rgba(255, 255, 255, 0.25); }
.btn-ondeep:hover { background: rgba(255, 255, 255, 0.2); color: #fff; }
.loy-card > .msg { margin: 10px 0 0; }
.loy-form { display: grid; gap: 12px; margin-top: 14px; }
.loy-form .note { margin: 0; }
.loy-form .field small { color: var(--ink-3); font-size: 11.5px; }
.loy-form .wide { grid-column: 1 / -1; }
.loy-form .grid3 { grid-template-columns: 1fr; }
@media (min-width: 560px) { .loy-form .grid3 { grid-template-columns: repeat(3, 1fr); } }
.loy-form fieldset { min-width: 0; margin: 0; padding: 8px 12px 10px; border: 1px solid var(--line); border-radius: var(--r); display: grid; gap: 8px; }
.loy-form fieldset:disabled { opacity: 0.6; }
.loy-form legend { padding: 0 4px; font-size: 12.5px; color: var(--ink-2); }
.loy-quote { display: grid; gap: 2px; padding: 10px 12px; border-radius: var(--r); background: var(--lime-soft); font-size: 13.5px; }
.loy-quote:empty { display: none; }
.loy-quote p { margin: 0; }
.loy-quote .msg { margin: 0; }
.loy-list { max-height: 360px; }
.loy-list li { display: grid; gap: 3px; }
.loy-list .hist-h { display: flex; flex-wrap: wrap; gap: 4px 10px; }
.loy-list small { color: var(--ink-3); font-size: 12.5px; }
.loy-list small.bad { color: var(--coral-ink); }
.loy-cancelled .hist-h { text-decoration: line-through; color: var(--ink-3); }
.loy-plus { color: var(--lime-ink); }
.loy-minus { color: var(--coral-ink); }
.loy-storno { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.loy-storno input { flex: 1 1 220px; min-height: var(--tap); padding: 0 10px; border: 1px solid var(--line-2); border-radius: var(--r); font: inherit; font-size: var(--field-font); }
.loy-storno .msg { margin: 0; }
.tbl tr.loy-cancelled-row td { color: var(--ink-3); text-decoration: line-through; }
.tbl tr.loy-cancelled-row td:last-child { text-decoration: none; color: var(--coral-ink); }

/* ── Вызов сотрудника и всплывающие уведомления (18.09.2026, отчёт администраторов) ── */

.tb-call { margin-left: auto; flex: none; }
.tb-call + .tb-ticket { margin-left: 0; }
/* «? Инструкция» (18.09.2026): глава базы знаний про этот экран — стоит перед «Вызвать». */
.tb-help { margin-left: auto; flex: none; }
.tb-help + .tb-call { margin-left: 0; }
/* «Обновления CRM» (25.09.2026) — первая кнопка шапки; точка — есть непрочитанное. */
.tb-news { margin-left: auto; flex: none; position: relative; }
.tb-news + .tb-help, .tb-news + .tb-call { margin-left: 0; }
.tb-news .news-dot { position: absolute; top: 6px; right: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--coral-ink); }
@media (max-width: 719px) {
  .tb-news { width: 44px; height: 44px; padding: 0; justify-content: center; }
  .tb-news span { display: none; }
}
.dlg-news { width: min(720px, calc(100vw - 32px)); }
.news-e { border-top: 1px solid var(--line); padding: 12px 0 4px; }
.news-e h3 { margin: 2px 0 4px; font-size: 16px; }
.news-meta { font-size: 13px; color: var(--ink-3); }
.news-where { margin: 0 0 6px; font-size: 13px; color: var(--ink-2); }
.news-e ul { margin: 0; padding-left: 20px; }
.news-e li { margin: 4px 0; line-height: 1.45; }
@media (max-width: 719px) {
  .tb-help { width: 44px; height: 44px; padding: 0; justify-content: center; }
  .tb-help span { display: none; }
}
@media (max-width: 719px) {
  .tb-call { width: 44px; height: 44px; padding: 0; justify-content: center; }
  .tb-call span { display: none; }
}
.nt-stack {
  position: fixed; z-index: 200; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  display: flex; flex-direction: column; gap: 10px; width: min(380px, calc(100vw - 32px));
  max-height: calc(100vh - 32px); overflow-y: auto;
}
.nt-stack:empty { display: none; }
.nt {
  padding: 12px 14px; border: 1px solid var(--line-2); border-left: 4px solid var(--lime);
  border-radius: var(--r); background: var(--surface); box-shadow: 0 10px 30px rgba(20, 39, 27, 0.18);
  animation: nt-in 0.25s ease-out;
}
.nt-call { border-left-color: var(--coral); }
.nt-lab { border-left-color: var(--amber); }
.nt-h { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.nt-h b { font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--coral-ink); }
.nt-lab .nt-h b { color: var(--amber); }
.nt-task .nt-h b { color: var(--lime-ink); }
.nt-h small { color: var(--ink-3); font-size: 12px; }
.nt-t { margin: 6px 0 2px; font-size: 15px; font-weight: 600; overflow-wrap: anywhere; }
/* Многострочный текст (сводка по баллам за день, 02.10.2026) — строками, обычным весом. */
.nt-t.nt-lines { white-space: pre-line; font-size: 14px; font-weight: 400; max-height: 50vh; overflow-y: auto; }
.nt-c { margin: 2px 0 0; font-size: 12.5px; color: var(--ink-2); white-space: pre-line; overflow-wrap: anywhere; }
.nt-a { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.nt .msg:empty { display: none; }
@keyframes nt-in { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .nt { animation: none; } }
/* Уведомления о записях (Этап 2, Сессия 7а): пришёл — синий, новая и перенос — зелёный, отмена — коралл. */
.nt-arrived { border-left-color: var(--sky); }
.nt-arrived .nt-h b { color: var(--sky); }
.nt-booked .nt-h b { color: var(--lime-ink); }
.nt-cancel { border-left-color: var(--coral); }
/* Стационар (Этап 2, Сессия 15): пациент лечащего врача поступил, переведён, выписан — фиолетовый. */
.nt-inpatient { border-left-color: var(--violet); }
.nt-inpatient .nt-h b { color: var(--violet); }
/* Список уведомлений в «Мой день». */
.sn-list .task { align-items: flex-start; flex-wrap: wrap; column-gap: 10px; }
.sn-list .task .tx { flex: 1 1 0; min-width: 0; }
/* Колонка «Мой день» узкая — кнопки под текстом, а не сбоку. */
.sn-list .task .go.row { width: 100%; justify-content: flex-start; padding-left: 20px; }
.sn-list .task .go.row .btn { flex: 0 0 auto; }
.sn-list .task .ic { width: 10px; height: 10px; border-radius: 50%; margin-top: 7px; flex: none; }
.sn-list .ic.ARRIVED { background: var(--sky); }
.sn-list .ic.BOOKED, .sn-list .ic.MOVED { background: var(--lime); }
.sn-list .ic.CANCELLED, .sn-list .ic.call { background: var(--coral); }
.sn-list .ic.INPATIENT { background: var(--violet); }
.sn-list .ic.lab-result, .sn-list .ic.task { background: var(--amber); }
.sn-list .task.read { opacity: 0.62; }
.sn-list .task.read .ic { background: var(--line-2); }
.sn-list .tx b { font-weight: 600; }
.sn-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.sn-head h2 { margin: 0; }
.sn-count { display: inline-block; min-width: 20px; padding: 0 6px; margin-left: 6px; border-radius: 10px; background: var(--coral); color: #fff; font-size: 12px; line-height: 20px; text-align: center; vertical-align: 2px; }
.sn-more summary { cursor: pointer; color: var(--ink-3); font-size: 13px; padding: 6px 0; }
/* Блок «Уведомления в мессенджер»: Telegram и MAX. */
.tg-state { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.tg-state + .tg-state { margin-top: 8px; }
.tg-box { border-top: 1px solid var(--line); }
.dw-pad.tg-box { padding-top: 12px; }
.tg-box .msg:empty { display: none; }
.tg-link { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; }
.tg-qr { width: 180px; max-width: 100%; flex: none; }
.tg-qr svg { display: block; width: 100%; height: auto; }
.tg-steps { flex: 1 1 220px; min-width: 0; }
.tg-steps p { margin: 0 0 8px; }
.tg-panel { padding: 14px 16px; }
.sn-line { display: block; }
.tg-panel .msg:empty { display: none; }
#call-sent .task { padding: 8px 0; }
#call-sent .ic { width: 10px; height: 10px; border-radius: 50%; margin-top: 6px; flex: none; }
#call-sent .ic.coral { background: var(--coral); }
#call-sent .ic.amber { background: var(--amber); }
#call-sent .ic.sky { background: var(--lime); }
.task .tx span.pre { white-space: pre-line; }
.task.hl { background: var(--lime-soft); }
.task .sub-form { margin-top: 8px; }
/* Строки в ячейке; у .blk расписания — штриховка и рамка, в таблицах они не нужны (тикет CRM №14). */
.inbox-tbl small.blk { display: block; width: auto; padding: 0; border: 0; border-radius: 0; background: none; color: inherit; font-size: 12px; pointer-events: auto; }
.inbox-tbl small.blk:hover { color: inherit; }

/* ── Карточка пациента (Этап 2, Сессия 3) — по демо «Единая карточка пациента» ── */
.pc-head { padding: 0; overflow: hidden; margin-bottom: 20px; }
.pet-hero { display: flex; flex-wrap: wrap; gap: 16px 20px; align-items: flex-start; padding: 18px; border-bottom: 1px solid var(--line); }
.pet-hero .big {
  width: 74px; height: 74px; border-radius: 50%; background: var(--surface-2); flex: none; display: flex;
  align-items: center; justify-content: center; font-size: 34px; border: 1px solid var(--line); overflow: hidden;
}
.pet-hero .big img { width: 100%; height: 100%; object-fit: cover; }
.pet-hero .idn { min-width: 0; flex: 1 1 260px; }
.pet-hero h1 { font-family: var(--f-serif); font-weight: 400; font-size: 27px; margin: 0; display: flex; align-items: center; gap: 11px; flex-wrap: wrap; }
.pet-hero .sub { font-size: 13px; color: var(--ink-2); margin-top: 6px; }
.pet-hero .tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 11px; }
.pet-hero .tags:empty { display: none; }
.pet-hero .hero-acts { display: flex; flex-wrap: wrap; gap: 8px; }
@media (min-width: 900px) { .pet-hero .hero-acts { margin-left: auto; } }
.owner { display: flex; align-items: center; gap: 10px 11px; padding: 13px 18px; background: var(--surface-3); flex-wrap: wrap; }
.owner .av {
  width: 34px; height: 34px; border-radius: 50%; background: var(--deep-2); color: #fff; display: flex;
  align-items: center; justify-content: center; font-size: 12px; font-weight: 600; flex: none;
}
.owner .oi b { display: block; font-size: 13.5px; font-weight: 600; }
.owner .oi small { display: block; font-size: 11.5px; color: var(--ink-3); }
.owner a { color: inherit; }
.owner .sep { width: 1px; height: 28px; background: var(--line-2); margin: 0 6px; }
.owner .kv { font-size: 12.5px; }
.owner .kv small { display: block; font-size: 10.5px; letter-spacing: 0.11em; text-transform: uppercase; color: var(--ink-3); }
.owner .kv b { font-weight: 600; }
@media (max-width: 699px) { .owner .sep { display: none; } .owner .kv { flex: 1 1 45%; } }
.pc-edit { display: grid; gap: 10px; padding: 16px 18px; border-top: 1px solid var(--line); }
.pc-cols { display: grid; gap: 20px; grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 1100px) { .pc-cols { grid-template-columns: minmax(280px, 1fr) minmax(0, 2.4fr); } }
.pc-stack { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
/* Телефон и планшет (тикет CRM №53): колонки встают друг под друга, и приёмы с назначениями уезжали под
   стационар, вес и отметку о смерти — на третий экран прокрутки. Теперь сразу после «Сводки» и «Важно при приёме». */
@media (max-width: 1099px) {
  .pc-stack { display: contents; }
  .pc-stack > * { order: 3; }
  .pc-stack > :nth-child(-n+2) { order: 1; }
  .pc-tabs-card { order: 2; }
  .pc-list li { scroll-margin-top: 76px; }
  /* Слияние дублей (у стойки): длинное имя в списке и «Объединить — остаётся эта карточка» раздвигали страницу шире экрана. */
  #pc-dup .sub-form { grid-template-columns: minmax(0, 1fr); }
  #pc-dup .dlg-actions .btn { white-space: normal; text-align: center; }
}
.pc-notes { display: flex; flex-direction: column; gap: 10px; }
.pc-note {
  padding: 11px 13px; border-radius: var(--r); background: var(--surface-3); border: 1px solid var(--line);
  font-size: 12.5px; color: var(--ink-2); line-height: 1.55; white-space: pre-line;
}
.pc-note b { color: var(--ink); }
.pc-note.warn { background: var(--coral-soft); border-color: #efcdc0; }
.pc-note.amber { background: var(--amber-soft); border-color: #eddcb4; }
/* «С последнего приёма врача» в процедурном приёме (правки персонала 23.09.2026). */
.dw-lastdoc { display: flex; flex-direction: column; gap: 4px; margin-bottom: 14px; }
.dw-lastdoc i { font-style: normal; color: var(--ink-3); }
.dw-lastdoc .note { margin: 2px 0 0; font-size: 12px; }
.pc-next { color: var(--lime-ink); }
.pc-spark { width: 100%; height: 88px; display: block; }
.pc-spark .grid { stroke: var(--line); stroke-width: 1; }
.pc-spark .curve { fill: none; stroke: var(--lime); stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.pc-spark .dot { fill: var(--coral); }
.pc-spark-axis { display: flex; justify-content: space-between; gap: 8px; font-size: 11.5px; color: var(--ink-3); margin: 7px 0 10px; }
.pc-weights { list-style: none; margin: 0 0 12px; padding: 0; }
.pc-weights li { display: flex; align-items: center; gap: 12px; padding: 6px 0; border-bottom: 1px dashed var(--line); font-size: 13px; }
.pc-weights li span { color: var(--ink-3); min-width: 84px; }
.pc-weights .x { margin-left: auto; border: 0; background: none; color: var(--ink-3); font-size: 18px; cursor: pointer; min-width: var(--tap); min-height: 28px; }
.pc-weights .x:hover { color: var(--coral-ink); }
#pc-death .sub-form { margin-top: 10px; }
#pc-death-view p { margin: 0 0 10px; font-size: 13px; }
.pc-tabs-card { padding: 0; min-width: 0; }
.pc-tabs { display: flex; border-bottom: 1px solid var(--line); overflow-x: auto; }
.pc-tabs button {
  padding: 12px 13px; font: inherit; font-size: 12.8px; color: var(--ink-2); background: none; border: 0;
  border-bottom: 2px solid transparent; white-space: nowrap; cursor: pointer; min-height: var(--tap);
}
.pc-tabs button:hover { color: var(--ink); }
.pc-tabs button[aria-selected="true"] { color: var(--ink); font-weight: 600; border-bottom-color: var(--lime); }
.pc-tabs .n { font-size: 11px; color: var(--ink-3); margin-left: 5px; font-weight: 600; }
.pc-tab { padding: 16px 18px; }
.pc-list { list-style: none; margin: 0; padding: 0; }
.pc-list li { display: grid; grid-template-columns: 130px minmax(0, 1fr) auto; gap: 4px 14px; align-items: center; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.pc-list li:last-child { border-bottom: 0; }
.pc-list .when { font-size: 12.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.pc-list .what b { display: block; font-size: 13.5px; font-weight: 600; }
.pc-list .what b a { color: var(--lime-ink); }
.pc-list .what small { display: block; font-size: 12px; color: var(--ink-3); }
@media (max-width: 599px) { .pc-list li { grid-template-columns: minmax(0, 1fr) auto; } .pc-list .when { grid-column: 1 / -1; } }
/* Протокол приёма во вкладке «Приёмы» карточки пациента — раскрывается под строкой приёма. */
.pc-proto { grid-column: 1 / -1; margin-top: 2px; }
.pc-proto summary { cursor: pointer; font-size: 12.5px; font-weight: 600; color: var(--lime-ink); width: max-content; }
.pc-proto dl { margin: 8px 0 0; display: grid; gap: 6px; padding: 10px 12px; background: var(--surface-2); border-radius: 10px; }
.pc-proto dl div { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 12px; }
.pc-proto dt { font-size: 12px; color: var(--ink-3); }
.pc-proto dd { margin: 0; font-size: 13px; white-space: pre-wrap; overflow-wrap: anywhere; }
.pc-proto .note { margin: 8px 0 0; }
.pc-proto-go { margin: 8px 0 0; }
@media (max-width: 599px) { .pc-proto dl div { grid-template-columns: 1fr; gap: 0; } }
/* История vet-office (Сессия 25): позиции архивного приёма и ссылки на его анализы. */
.pc-legacy-lines { width: 100%; margin-top: 8px; border-collapse: collapse; font-size: 12.5px; }
.pc-legacy-lines th { text-align: left; font-weight: 600; color: var(--ink-3); padding: 4px 8px; border-bottom: 1px solid var(--line); }
.pc-legacy-lines td { padding: 4px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.pc-legacy-lines th:nth-child(n+2), .pc-legacy-lines td:nth-child(n+2) { text-align: right; white-space: nowrap; }
.pc-legacy-links { margin: 8px 0 0; font-size: 12.5px; }
.linkish { background: none; border: 0; padding: 0; font: inherit; color: var(--lime-ink); text-decoration: underline; cursor: pointer; }
/* Скрытая карточка: удалена в vet-office, заведена ради истории. */
.pc-hidden { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin-bottom: 12px; padding: 10px 14px; border-radius: 12px; background: var(--surface-2); border: 1px dashed var(--line); }
.pc-hidden p { margin: 0; flex: 1 1 320px; font-size: 13px; }
.pc-tl li.acc::before { border-color: var(--lime); background: var(--lime); }
.pc-tl li.warn::before { border-color: var(--coral); background: var(--coral); }
.pc-tl li:last-child:not(.acc):not(.warn)::before { border-color: var(--line-2); background: var(--surface); }
.pc-tl small.dt { display: inline; }
/* Список питомцев в карточке клиента — ссылки на карточки пациентов. */
.pet-links { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.pet-links a { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border: 1px solid var(--line-2); border-radius: 20px; color: var(--ink); font-size: 13px; font-weight: 600; text-decoration: none; min-height: var(--tap); }
.pet-links a:hover { border-color: var(--lime); background: var(--lime-soft); }
.pet-links a.dead { color: var(--ink-3); font-weight: 500; }
.bad-text { color: var(--coral-ink); font-weight: 600; }
/* Вкладки карточки клиента (Этап 2, Сессия 3; 18.09.2026) — те же, что у карточки пациента. */
.docs .cl-tabs-card { padding: 0; margin-bottom: 18px; }
.cl-tabs-card .pc-tabs { border-bottom: 0; }

/* ── Рабочее место врача «Мой день» (Этап 2, Сессия 7; два экрана — 22.09.2026) ──
   Экран «Мой день»: ближайшие приёмы и календарь — широкой колонкой, уведомления и задачи — узкой
   справа (от 1100px); сетка расписания клиники — на соседней вкладке. Экран приёма: приём — широкая
   колонка, пациент — узкая справа (от 1000px); уже — пациент под приёмом. */
.dw-bar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 16px; margin-bottom: 16px; }
.dw-bar .dw-doc { min-width: min(100%, 320px); margin: 0; }
.dw-who { margin: 0; flex: 1 1 240px; align-self: center; }
.dw-who:empty { display: none; }
/* «Новая запись» и «Приём без записи» — одной группой справа, в одну строку (21.09.2026). */
.dw-acts { display: flex; flex-wrap: wrap; gap: 10px; margin-left: auto; }
.dw-desk-cols { display: grid; gap: 20px; grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 1100px) { .dw-desk-cols { grid-template-columns: minmax(0, 2.2fr) minmax(300px, 1fr); } }
/* Вкладки «Моё расписание» / «Расписание клиники» (правки персонала 23.09.2026): сетка — своим экраном. */
.dw-desktabs { margin-bottom: 16px; }
.dw-desktabs button { font-size: 15px; }
/* Ближайшие приёмы — карточками в ряд; идущий приём — зелёной полосой слева. */
.dw-next { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); padding: 0 16px 16px; }
.dw-next:empty { display: none; }
.dw-next .appt { border: 1px solid var(--line); border-left-width: 3px; border-radius: var(--r); }
.dw-next .appt:last-child { border-bottom: 1px solid var(--line); }
.appt.live { border-left-color: var(--lime); }
.dw-cal-h > .note { margin: 0; font-size: 12px; }

/* Экран приёма. */
.dw-back { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-bottom: 16px; }
.dw-back .note { margin: 0; }
#leave-dlg p { margin: 0; }
.dw-vcols { display: flex; flex-direction: column; gap: 20px; }
.dw-vmain { flex: 1 1 auto; min-width: 0; }
@media (min-width: 1000px) {
  .dw-vcols { flex-direction: row; align-items: flex-start; }
  .dw-vcols > .dw-right { flex: 0 0 clamp(300px, 26%, 380px); min-width: 0; }
}
.dw .stack { display: flex; flex-direction: column; gap: 20px; }
.dw .card.flush { padding: 0; overflow: hidden; }
.dw .card.flush > h2 { padding: 14px 16px 4px; }
.dw-pad { padding: 0 16px 14px; margin: 0; }
.dw-more { font-size: 13px; }
.dw-link { font-weight: 600; font-size: 13.5px; color: var(--ink); overflow-wrap: anywhere; }
.dw-link:hover { color: var(--lime-ink); }
/* «Результаты ждут просмотра» (тикет CRM №55): каждый анализ — своей ссылкой. */
.dw-links { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-direction: column; gap: 3px; }
.dw-links .dw-link { font-weight: 500; font-size: 13px; text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 2px; }
.dw-links .dw-link.out { color: var(--coral-ink); }
.dw-review-all { margin-top: 8px; align-self: flex-start; }

.dw-cal-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px 10px; }
.dw-cal-h h2 { margin: 0; }
.dw .card.flush .dw-cal-h h2 { padding: 0; }
.dw-cal-h .segbar > * { min-height: 32px; padding: 4px 10px; font-size: 12.5px; }
.dw-week { display: grid; grid-template-columns: repeat(7, 1fr); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.dw-week button {
  padding: 8px 2px 9px; border: 0; border-right: 1px solid var(--line); background: var(--surface); color: var(--ink-3);
  font: 500 11.5px/1.2 var(--f); cursor: pointer; min-height: var(--tap);
}
.dw-week button:last-child { border-right: 0; }
.dw-week button:hover { background: var(--surface-3); }
.dw-week button b { display: block; font: 500 16px/1.2 var(--f-serif); color: var(--ink); margin-top: 2px; }
.dw-week button i { display: block; width: 4px; height: 4px; border-radius: 50%; background: var(--lime); margin: 4px auto 0; }
.dw-week button.off { background: var(--surface-3); }
.dw-week button.off b { color: var(--ink-3); }
.dw-week button.today b { text-decoration: underline; text-decoration-color: var(--lime); text-underline-offset: 3px; }
.dw-week button.on { background: var(--deep); color: #9aac9b; }
.dw-week button.on b { color: #fff; }
.dw-dayline { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; padding: 11px 16px; border-bottom: 1px solid var(--line); }
.dw-dayline b { font: 500 15px/1.3 var(--f-serif); }
.dw-dayline span { margin-left: auto; font-size: 12px; color: var(--ink-3); }
.dw-day { display: flex; flex-direction: column; }
.dw-day:empty { display: none; }
#dw-day-empty { padding-top: 12px; }
.appt {
  display: flex; gap: 12px; width: 100%; padding: 11px 16px; border: 0; border-bottom: 1px solid var(--line);
  border-left: 2px solid transparent; background: none; text-align: left; font: inherit; color: inherit; cursor: pointer;
}
.appt:last-child { border-bottom: 0; }
.appt:hover { background: var(--surface-3); }
.appt.on { background: var(--lime-soft); border-left-color: var(--lime); }
.appt.past { opacity: 0.62; }
.appt.emg { border-left-color: var(--coral); }
.appt .hh { width: 48px; flex: none; font: 500 14.5px/1.25 var(--f-serif); font-variant-numeric: tabular-nums; }
.appt .hh small { display: block; font: 400 10.5px/1.3 var(--f); color: var(--ink-3); }
.appt .aa { min-width: 0; flex: 1; }
.appt .aa b { display: block; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appt .aa > span { display: block; font-size: 11.5px; color: var(--ink-3); margin-top: 1px; }
.appt .aa .tag { margin-top: 5px; }
/* Сумма приёма в строке дня (тикет CRM №38): нажатие — окно «что в счёте». */
.appt .aa .tag { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.bill-chip { font-size: 11.5px; font-weight: 600; color: var(--ink-2); border: 1px dashed var(--line-2); border-radius: 999px; padding: 1px 8px; cursor: pointer; }
.bill-chip:hover, .bill-chip:focus-visible { border-color: var(--lime); color: var(--ink); outline: none; }
.bill-chip.paid { border-style: solid; }
.bill-dlg { width: min(560px, calc(100vw - 32px)); }
.bill-h { margin: 14px 0 4px; font-size: 13px; font-weight: 700; }
.bill-lines { list-style: none; margin: 0; padding: 0; }
.bill-lines li { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 4px 12px; padding: 5px 0; border-bottom: 1px dashed var(--line); font-size: 13px; }
.bill-lines li span { overflow-wrap: anywhere; }
.bill-lines li i { font-style: normal; color: var(--ink-3); white-space: nowrap; }
.bill-lines li b { white-space: nowrap; text-align: right; }
.bill-sum { margin: 6px 0 0; text-align: right; font-weight: 700; }

.dw-visit { min-height: 180px; }
.dw-blank { padding: 28px 8px; text-align: center; }
.dw-blank b { font: 500 17px/1.3 var(--f-serif); }
.dw-blank .note { max-width: 46ch; margin: 8px auto 0; }
.dw-vh { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 10px 14px; margin-bottom: 14px; }
.dw-vh > div { flex: 1 1 260px; min-width: 0; }
.dw-title { margin: 0; font-size: 21px; }
.dw-vh .sub { margin-top: 4px; }
.dw-props { margin-bottom: 14px; }
.dw-open { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.dw-open .note { margin: 0; flex: 1 1 220px; }
.timer {
  display: inline-flex; align-items: center; gap: 7px; padding: 4px 11px; border-radius: 20px; background: var(--deep); color: #fff;
  font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums;
}
.timer i { width: 6px; height: 6px; border-radius: 50%; background: var(--lime); flex: none; }
.step-box { border: 1px solid var(--line-2); border-radius: var(--r); background: var(--surface); margin-bottom: 12px; }
.step-box.live { border-color: var(--lime); box-shadow: 0 0 0 3px rgba(124, 179, 66, 0.14); }
.step-box > .sh { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-bottom: 1px solid var(--line); }
.step-box > .sh .num {
  width: 21px; height: 21px; border-radius: 50%; background: var(--deep); color: #fff; font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; flex: none;
}
.step-box.live > .sh .num { background: var(--lime); color: #10210a; }
.step-box > .sh h4 { margin: 0; font-size: 13.5px; font-weight: 600; }
.step-box > .sh .right { margin-left: auto; font-size: 11.5px; }
.step-box > .in { padding: 13px 14px; }
.step-box textarea { width: 100%; min-height: 84px; }
.dw-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
/* Бланки приёма (Этап 2, Сессия 19): кнопки в несколько строк, на телефоне — во всю ширину. */
.dw-forms { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.dw-forms .btn { text-decoration: none; }
@media (max-width: 560px) { .dw-forms .btn { flex: 1 1 45%; justify-content: center; } }
.dw-chip { display: inline-flex; align-items: center; gap: 4px; padding: 4px 4px 4px 11px; border: 1px solid var(--line-2); border-radius: 20px; font-size: 12.5px; }
.dw-chip .x { border: 0; background: none; color: var(--ink-3); font-size: 16px; line-height: 1; cursor: pointer; min-width: 26px; min-height: 26px; }
.dw-chip .x:hover { color: var(--coral-ink); }
.dw-add { display: flex; flex-wrap: wrap; gap: 8px; }
.dw-add select { flex: 1 1 200px; min-width: 0; max-width: 100%; text-overflow: ellipsis; }
.dw-lead { display: grid; gap: 6px; margin-top: 4px; grid-template-columns: minmax(0, 1fr); }
.finish { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.dw-danger { color: var(--coral-ink); margin-left: auto; }

/* Протокол приёма (Этап 2, Сессия 8) — степпер, показатели осмотра и чипы диагноза по демо «Рабочее место врача». */
.stepper { display: flex; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); overflow-x: auto; margin-bottom: 14px; }
.stepper a {
  flex: 1 0 64px; padding: 10px 6px 11px; text-align: center; border-right: 1px solid var(--line); font-size: 11.5px; color: var(--ink-3);
  position: relative; cursor: pointer; text-decoration: none; transition: background 0.16s;
}
.stepper a:last-child { border-right: 0; }
.stepper a:hover { background: var(--surface-3); }
.stepper a i {
  display: block; width: 21px; height: 21px; margin: 0 auto 5px; border-radius: 50%; border: 1px solid var(--line-2); font-style: normal;
  font-size: 11px; font-weight: 600; line-height: 19px; color: var(--ink-3); background: var(--surface);
}
.stepper a.done { color: var(--ink-2); }
.stepper a.done i { background: var(--lime-soft); border-color: #cbe0b2; color: var(--lime-ink); }
.vitals {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; margin-bottom: 12px;
}
/* Разделители — тенью: при переносе на вторую строку пустые ячейки не закрашиваются. */
.vital { display: block; padding: 9px 12px 10px; box-shadow: 1px 0 0 var(--line), 0 1px 0 var(--line); }
.vital > span { display: block; font-size: 10.5px; letter-spacing: 0.11em; text-transform: uppercase; color: var(--ink-3); }
.vital > i { display: block; font-style: normal; font-size: 11px; color: var(--ink-3); }
.vital input {
  width: 100%; min-width: 0; border: 0; border-bottom: 1px dashed var(--line-2); background: transparent; padding: 3px 0 2px;
  font: 400 20px/1.2 var(--f-serif); color: var(--ink); font-variant-numeric: tabular-nums;
}
.vital input:focus { outline: none; border-bottom: 1px solid var(--lime); }
.vital input.bad, .field input.bad { border-color: var(--coral); color: var(--coral-ink); }
.vital > .dw-bp { display: flex; align-items: baseline; gap: 4px; }
.vital-ro > b { display: block; padding: 3px 0 2px; font: 400 20px/1.2 var(--f-serif); color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dw-bp b { color: var(--ink-3); font-weight: 400; }
.dw-grid, .dw-grid3 { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 640px) {
  .dw-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dw-grid3 { grid-template-columns: minmax(0, 0.8fr) minmax(0, 1fr) minmax(0, 1.4fr); }
}
.dx { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.dx:empty { display: none; }
.dx button {
  border: 1px solid var(--line-2); background: var(--surface); border-radius: 20px; padding: 5px 11px; font-size: 12px; color: var(--ink-2);
  cursor: pointer; min-height: 30px;
}
.dx button:hover { border-color: var(--lime); color: var(--lime-ink); background: var(--lime-soft); }
.fh { display: block; margin: 6px 0 0; font-size: 11.5px; color: var(--ink-3); }
.step-box .dw-kind { margin-bottom: 10px; }
.dw-nv-hint { margin: 10px 0 0; }
/* Назначения после приёма (22.09.2026): строка — что, к кому, когда; справа статус и действия. */
.dw-plan { display: grid; gap: 8px; margin-bottom: 12px; grid-template-columns: minmax(0, 1fr); }
.dw-plan > .note { margin: 0; }
.dw-plan-i {
  display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px 12px; align-items: center;
  padding: 10px 12px; border: 1px solid var(--line-2); border-radius: var(--r); background: var(--surface);
}
@media (min-width: 640px) { .dw-plan-i { grid-template-columns: minmax(0, 1fr) auto; } }
.dw-plan-w { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.dw-plan-w b { font-weight: 600; overflow-wrap: anywhere; }
.dw-plan-w .note { margin: 0; }
.dw-plan-a { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.dw-plan-s { grid-column: 1 / -1; margin: 2px 0 0; padding: 0; list-style: none; display: grid; gap: 4px; }
.dw-plan-s li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-size: 13px; padding-top: 4px; border-top: 1px dashed var(--line-2); }
.dw-plan-s li > span:first-child { min-width: 9em; font-variant-numeric: tabular-nums; }
.dw-plan-add { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; padding: 12px; border: 1px dashed var(--line-2); border-radius: var(--r); }
.dw-book-plan { margin: -4px 0 12px; padding: 8px 12px; background: var(--lime-soft); border-radius: var(--r); color: var(--lime-ink); }
/* Колонка сетки — minmax(0, 1fr): без неё неявная колонка растягивается по самому широкому
   содержимому (список «передать приём» с ФИО и специализацией врачей), блок вылезает за экран
   телефона, и iPhone уменьшает всю страницу (24.09.2026). */
.dw-finish {
  padding: 14px 16px; background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r); display: grid; gap: 8px;
  grid-template-columns: minmax(0, 1fr);
}
.dw-finish .note { margin: 0; }
/* Длинные подписи («Завершить приём и записать в карту») на узком экране переносятся, а не вылезают
   за рамку блока; на телефоне главная кнопка — во всю ширину. */
.dw-finish .finish .btn { max-width: 100%; white-space: normal; text-align: center; }
@media (max-width: 519px) { .dw-finish .finish .btn-lime { flex: 1 1 100%; } }
.dw-finish .dw-ready { color: var(--lime-ink); }
.dw-saved.bad { color: var(--coral-ink); }
.dw-done { margin: 0 0 12px; padding: 10px 12px; border-radius: var(--r); background: var(--lime-soft); }
.dw-fix { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-bottom: 12px; }
.dw-fix .note { margin: 0; flex: 1 1 260px; }
.dw-fix-h { margin: 0; font-weight: 600; font-size: 13.5px; }

.ctx-pet { display: flex; gap: 12px; align-items: center; padding: 15px 16px; border-bottom: 1px solid var(--line); background: var(--surface-3); margin-bottom: 12px; }
.ctx-pet .pic {
  width: 44px; height: 44px; border-radius: 50%; background: var(--surface-2); display: flex; align-items: center; justify-content: center;
  font-size: 21px; flex: none; border: 1px solid var(--line); overflow: hidden;
}
.ctx-pet .pic img { width: 100%; height: 100%; object-fit: cover; }
.ctx-pet b { display: block; font: 500 17px/1.25 var(--f-serif); }
.ctx-pet small { display: block; font-size: 11.5px; color: var(--ink-3); margin-top: 1px; }
.ctx-notes { display: flex; flex-direction: column; gap: 8px; }
.ctx-notes .note { margin: 0; }
.dw-full { width: 100%; justify-content: center; }
.mini-tbl { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.mini-tbl th { text-align: left; font-size: 10.5px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-3); padding: 0 0 6px; }
.mini-tbl td { padding: 6px 0; border-top: 1px dashed var(--line); }
.mini-tbl .r { text-align: right; }
.mini-tbl .dim { color: var(--ink-3); }

.dw-walkin { display: grid; gap: 12px; }
.dw-walkin .note { margin: 0; }
.dw-found { display: flex; flex-direction: column; gap: 8px; }
.dw-found:empty { display: none; }
.dw-hit { padding: 9px 11px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface-3); }
.dw-hit small { display: block; font-size: 12.5px; color: var(--ink-2); margin-bottom: 6px; }
.dw-pets { display: flex; flex-wrap: wrap; gap: 6px; }
.dw-picked { margin: 0; padding: 9px 11px; border-radius: var(--r); background: var(--lime-soft); font-weight: 600; font-size: 13.5px; }
.dw-kind { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px 18px; }
.dw-kind legend { font-size: 12.5px; color: var(--ink-2); margin-bottom: 4px; padding: 0; }

/* Этап 2, Сессия 12: вакцинация и обработки — вкладка карточки и блок приёма (vaccinations.js). */
.vx-due { display: grid; gap: 8px; margin-bottom: 12px; }
.vx-due:empty { display: none; }
.vx-lbl { margin: 0; font-size: 12px; font-weight: 600; color: var(--ink-3); text-transform: uppercase; letter-spacing: .04em; }
.vx-list { margin-bottom: 10px; }
.vx-list .what small.vx-over, .pc-over { color: var(--coral-ink); font-weight: 600; }
.vx-acts { display: inline-flex; align-items: center; gap: 2px; }
.vx-acts .x { border: 0; background: none; color: var(--ink-3); font-size: 18px; cursor: pointer; min-width: var(--tap); min-height: 32px; }
.vx-acts .x:hover { color: var(--coral-ink); }
.vx-form { margin-top: 10px; }
.vx-types { margin-top: 0; align-items: center; }
.vx-types .vx-lbl { margin-right: 4px; }
.vx-covers { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; }
.vx-quick { margin-top: 6px; }
.vx-hint { margin: 6px 0 0; }
@media (max-width: 519px) { .vx-form .vx-sd { grid-template-columns: 1fr; } }
@media (max-width: 599px) {
  .vx-list li { grid-template-columns: minmax(0, 1fr); }
  .vx-acts { justify-content: flex-start; margin-left: -11px; }
}

/* ── Лаборатория (Этап 2, Сессия 13): общий блок labs.js — вкладка «Анализы» и приём ── */
.lb-wrap { overflow-x: auto; }
.lb-tbl { table-layout: auto; }
.lb-tbl td { vertical-align: top; }
.lb-tbl td b { display: block; font-weight: 600; font-size: 13px; }
.lb-tbl td small { display: block; color: var(--ink-3); font-size: 11.5px; }
.lb-tbl .r { white-space: nowrap; padding-left: 8px; }
.lb-row { cursor: pointer; }
/* «Распечатать» у готового анализа — рядом со статусом (запрос клиники 25.09.2026). */
.lb-tbl .lb-st { display: inline-flex; gap: 8px; align-items: center; justify-content: flex-end; }
.lb-print { white-space: nowrap; }
.lb-row:hover td, .lb-row.open td { background: var(--surface-3); }
.lb-row:focus-visible { outline: 2px solid var(--lime); outline-offset: -2px; }
.lb-sum { padding-right: 10px !important; }
.lb-out, .lb-tbl .lb-out { color: var(--coral-ink); font-weight: 600; }
.lb-detail > td { border-top: 0 !important; padding: 0 0 12px !important; background: var(--surface-3); }
.lb-d { padding: 4px 10px 0; display: grid; gap: 8px; }
.lb-meta { margin: 0; font-size: 12px; color: var(--ink-2); }
.lb-steps { list-style: none; margin: 2px 0; padding: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; counter-reset: lbs; }
.lb-steps.lb-steps-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.lb-steps li { border-top: 3px solid var(--line); padding-top: 5px; font-size: 11.5px; color: var(--ink-3); }
.lb-steps li.done { border-top-color: var(--lime); color: var(--ink); }
.lb-steps li b { display: block; font-weight: 600; font-size: 11.5px; }
.lb-steps li small { display: block; font-size: 11px; color: var(--ink-3); }
.lb-vals { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 8px 10px; overflow-x: auto; }
.lb-vals tr.lb-high td, .lb-vals tr.lb-low td { color: var(--coral-ink); }
.lb-arrow { font-weight: 700; }
.lb-text .vx-lbl { display: block; margin-bottom: 2px; }
.lb-text p { margin: 0; white-space: pre-wrap; font-size: 13px; }
.lb-files { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.lb-files a { color: var(--lime-ink); font-weight: 600; margin-right: 8px; }
.lb-acts { display: flex; flex-wrap: wrap; gap: 6px; }
/* УЗИ и рентген (Этап 2, Сессия 14): снимки плиткой — открываются в новой вкладке. */
.im-shots { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 6px; }
.im-shots a { display: flex; align-items: center; justify-content: center; aspect-ratio: 1; background: #1b2320; border-radius: var(--r); overflow: hidden; color: #fff; font-size: 12px; font-weight: 600; text-decoration: none; }
.im-shots img { width: 100%; height: 100%; object-fit: cover; display: block; }
.im-shots a:focus-visible { outline: 2px solid var(--lime); outline-offset: 2px; }
.im-sends li { font-size: 12px; color: var(--ink-2); }
.im-adds { margin-top: 8px; }
.lb-form { margin-top: 10px; }
.lb-fh { margin: 0 0 4px; font-size: 14px; }
.lb-panels { margin-top: 0; align-items: center; }
.lb-panels .vx-lbl { margin-right: 4px; }
.lb-rhead { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
.lb-rhead .fh { margin: 0; }
.lb-vhead, .lb-vrow { display: grid; grid-template-columns: minmax(0, 2.2fr) minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 1.4fr) 32px; gap: 6px; align-items: center; }
.lb-vhead { font-size: 10.5px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); margin-top: 6px; }
.lb-rows { display: grid; gap: 4px; }
.lb-vrow input { width: 100%; min-width: 0; }
.lb-val { position: relative; display: block; }
.lb-flag { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); font-weight: 700; color: var(--coral-ink); pointer-events: none; }
.lb-vrow.lb-high input, .lb-vrow.lb-low input { border-color: #efcdc0; }
.lb-vrow.lb-high .lb-val input, .lb-vrow.lb-low .lb-val input { color: var(--coral-ink); font-weight: 600; }
.lb-vrow .x { border: 0; background: none; color: var(--ink-3); font-size: 18px; cursor: pointer; min-height: 32px; }
.lb-vrow .x:hover { color: var(--coral-ink); }
@media (max-width: 599px) {
  .lb-steps { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .lb-vhead { display: none; }
  .lb-vrow { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 32px; padding: 6px 0; border-bottom: 1px dashed var(--line); }
  .lb-vrow > input:first-child { grid-column: 1 / 3; }
  .lb-vrow > .x { grid-column: 3; grid-row: 1; }
  .lb-vrow > input:nth-child(4) { grid-column: 1 / 3; }
  .lb-form .lb-2 { grid-template-columns: 1fr; }
  .lb-tbl thead { display: none; }
  .lb-tbl tr.lb-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; }
  .lb-tbl tr.lb-row td:first-child { grid-column: 1; }
  .lb-tbl tr.lb-row td.r { grid-column: 2; grid-row: 1; }
  .lb-tbl tr.lb-row td.lb-sum { grid-column: 1 / -1; border-top: 0; padding-top: 0; }
  .lb-tbl tr.lb-detail, .lb-tbl tr.lb-detail > td { display: block; }
}

/* ── Стационар (Этап 2, Сессия 15): доска, пребывание, журнал ──
   Доску смотрят у боксов с телефона: на узком экране карточки в одну колонку, всё нажимается пальцем,
   у занятого места — кличка крупно, день пребывания, владелец с телефоном, режим, врач, питание и
   «требует внимания». Режим — цветом: лечение — синий, после операции — фиолетовый, гостиница — зелёный. */
.ip { display: grid; gap: 14px; }
.ip-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.ip-tabs > [aria-selected="true"] { background: var(--deep); color: #fff; font-weight: 500; }
.ip-sum { margin: 0; font-size: 13px; color: var(--ink-2); }
.ip-acts { display: flex; flex-wrap: wrap; gap: 8px; margin-left: auto; }
.ip-sec { margin-bottom: 18px; }
.ip-h { margin: 0 0 10px; font-size: 16px; }
.ip-h small { margin-left: 6px; font: 400 12.5px var(--f); color: var(--ink-3); }
.ip-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.ip-card {
  display: flex; flex-direction: column; align-items: stretch; gap: 5px; min-height: 150px; padding: 12px 14px; width: 100%;
  border: 1px solid var(--line); border-left: 4px solid var(--sky); border-radius: var(--r); background: var(--surface);
  color: var(--ink); font: inherit; text-align: left; cursor: pointer; transition: border-color .16s var(--ease), box-shadow .16s var(--ease);
}
button.ip-card:hover { border-color: var(--line-2); box-shadow: 0 2px 10px rgba(20, 39, 27, .08); }
button.ip-card:focus-visible { outline: 2px solid var(--lime); outline-offset: 2px; }
.ip-card.warn { border-left-color: var(--coral); }
.ip-card.free { border: 1px dashed var(--line-2); border-left-width: 1px; background: var(--surface-3); justify-content: flex-start; }
div.ip-card.free { cursor: default; }
/* Отпущен на ночь — ждём утром (правки персонала 26.09.2026). */
.ip-card.night { min-height: 0; cursor: default; border-left-color: var(--amber, #d9a441); border-style: dashed; border-left-style: solid; }
.ip-card.night .lb-acts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.ip-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.ip-place { font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); overflow-wrap: anywhere; }
.ip-day { flex: none; padding: 1px 8px; border-radius: 20px; background: var(--surface-2); font-size: 11.5px; font-weight: 600; color: var(--ink-2); }
.ip-pet { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 8px; }
.ip-pet b { font-family: var(--f-serif); font-size: 21px; font-weight: 600; line-height: 1.2; overflow-wrap: anywhere; }
.ip-pet small { color: var(--ink-3); font-size: 12px; }
.ip-ico { font-size: 18px; }
.ip-line { font-size: 13px; color: var(--ink-2); overflow-wrap: anywhere; }
.ip-line.dim { color: var(--ink-3); font-size: 12.5px; }
.ip-line .ico { width: 14px; height: 14px; vertical-align: -2px; }
.ip-feed { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ip-free { margin-top: 10px; font-family: var(--f-serif); font-size: 18px; color: var(--ink-3); }
.ip-chip { display: inline-block; padding: 1px 8px; border-radius: 20px; font-size: 11.5px; font-weight: 600; border: 1px solid; }
.ip-chip.m-treat { background: var(--sky-soft); color: var(--sky); border-color: #cbdde5; }
.ip-chip.m-postop { background: var(--violet-soft); color: var(--violet); border-color: #ddd7ec; }
.ip-chip.m-hotel { background: var(--lime-soft); color: var(--lime-ink); border-color: #d3e6bc; }
.ip-att { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 4px; }
.ip-att li { padding: 5px 9px; border-radius: var(--r); font-size: 12.5px; font-weight: 600; background: var(--sky-soft); color: var(--sky); }
.ip-att li.warn { background: var(--coral-soft); color: var(--coral-ink); }
.ip-foot { margin: 0; }
.ip-pad { margin: 12px 16px; }

/* Диалоги поступления и пребывания. */
.ip-form { display: grid; gap: 12px; }
.ip-form fieldset { margin: 0; }
.ip-modes { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.ip-mode { display: flex; gap: 8px; align-items: flex-start; min-height: var(--tap); padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--r); cursor: pointer; }
.ip-mode:has(input:checked) { border-color: var(--lime-ink); background: var(--lime-soft); }
.ip-mode input { margin-top: 2px !important; }
.ip-mode b { display: block; font-size: 13.5px; }
.ip-mode small { display: block; font-size: 11.5px; color: var(--ink-3); }
.ip-spot { display: grid; gap: 10px; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.ip-spot .fh { grid-column: 1 / -1; margin: 0; }
.ip-planned { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px 12px; }
.ip-planned .field { flex: 1 1 180px; }
.ip-quick { padding-bottom: 2px; }
/* Курс дневного стационара: «Продлить» в форме поступления и «забрали вечером» в выписке. */
.ip-cont-list, .ip-cont-on { display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface-3); }
.ip-cont-list .btn { align-self: flex-start; white-space: normal; text-align: left; }
.ip-cont-on p { margin: 0; }
.ip-cont-rx { display: flex; flex-direction: column; gap: 4px; margin: 0; }
.ip-goes-on { display: flex; gap: 8px; align-items: flex-start; cursor: pointer; font-size: 14px; }
.ip-goes-on input { margin-top: 3px; }
.ip-goes-on small { display: block; color: var(--ink-3); }
.ip-picked { margin: 0; padding: 8px 11px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface-3); font-size: 14px; }
.ip-props { margin-bottom: 4px; }
.ip-stay-acts .btn { flex: 0 1 auto; }
.ip-danger { color: var(--coral-ink); }
.ip-danger-solid { background: var(--coral); border-color: var(--coral); color: #fff; }
.ip-danger-solid:hover { background: var(--coral-ink); border-color: var(--coral-ink); }
.ip-moves summary, .ip-past summary { cursor: pointer; font-size: 13px; color: var(--ink-2); min-height: 32px; display: flex; align-items: center; }
.ip-moves .tl { margin-top: 8px; }
.ip-now p { margin: 0 0 6px; font-size: 13.5px; }
.ip-now .note { font-size: 12.5px; }
.ip-past { margin-top: 10px; }
.ip-past li { cursor: pointer; }
.ip-places { display: grid; gap: 8px; }
.ip-place-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.ip-place-row input:not([type]) , .ip-place-row input[maxlength] { flex: 1 1 160px; min-width: 0; }
.ip-place-row small { color: var(--ink-3); font-size: 12px; }
.ip-j-tbl td.r { text-align: right; font-variant-numeric: tabular-nums; }
.ip-j-card { width: 100%; text-align: left; font: inherit; cursor: pointer; }
.ip-print-only { display: none; font: 400 13px var(--f); color: var(--ink-3); }
/* Расписание: кабинет смены занят стационаром. */
.shift .cmt.inp { color: var(--violet); font-weight: 600; }

/* ── Стационарный лист (Этап 2, Сессия 16): наблюдения, итоги дня, графики ──
   Экран рассчитан на телефон: чипы в палец, форма в одну колонку, лента по дням. */
/* Части листа идут в общем потоке диалога, поэтому отступы — у самих блоков: иначе «+ Наблюдение»
   прилипает к графику, а кнопка «Изменить итог дня» — к линии следующего дня. */
.ip-chart-head { display: grid; gap: 4px; margin-bottom: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface-3); }
.ip-chart-head p { margin: 0; font-size: 13px; }
.ip-checks { color: var(--ink-2); }
.ip-checks.late { color: var(--coral-ink); font-weight: 600; }
.ip-dlg-c > .lb-acts { margin: 12px 0; }
.ip-add { justify-content: center; }
.ip-pick { display: flex; flex-wrap: wrap; gap: 7px; }
.ip-pick .chip[aria-pressed=true] { background: var(--deep); border-color: var(--deep); color: var(--on-deep); font-weight: 600; }
.ip-pick .chip.bad[aria-pressed=true] { background: var(--coral); border-color: var(--coral); color: #fff; }
.ip-flags { display: flex; flex-wrap: wrap; gap: 8px 14px; }
.ip-flag { display: flex; align-items: center; gap: 8px; min-height: var(--tap); font-size: 13.5px; cursor: pointer; }
.ip-more summary { cursor: pointer; min-height: var(--tap); display: flex; align-items: center; font-size: 13px; color: var(--ink-2); }
.ip-more > *:not(summary) { margin-top: 10px; }
.ip-cform, .ip-sform { margin: 12px 0; padding: 12px; border: 1px solid var(--lime-ink); border-radius: var(--r); background: var(--surface-3); }
.ip-charts { display: grid; gap: 12px; margin: 12px 0; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
.ip-chart { padding: 8px 12px 0; border: 1px solid var(--line); border-radius: var(--r); }
.ip-chart-h { display: flex; justify-content: space-between; gap: 8px; font-size: 12.5px; color: var(--ink-3); margin-bottom: 4px; }
/* День стационарного листа — не путать с чипом «N-й день» на доске (.ip-day выше). */
.ip-cday { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 12px; }
.ip-cday-h { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 10px; align-items: baseline; margin-bottom: 8px; font-size: 14px; }
.ip-checks-list { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 8px; }
.ip-check { display: grid; grid-template-columns: 62px minmax(0, 1fr) auto; gap: 4px 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
.ip-check.edit { display: block; padding: 0; border: 0; background: none; }
.ip-check-t { display: grid; }
.ip-check-t b { font-variant-numeric: tabular-nums; font-size: 14px; }
.ip-check-t small { color: var(--ink-3); font-size: 11.5px; }
/* .dlg-body рвёт длинные слова (overflow-wrap: anywhere) — в метках это «Активны/й»: они короткие
   и переносятся целиком, а комментарий — по словам. */
.ip-marks { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 13px; color: var(--ink-2); overflow-wrap: normal; }
.ip-marks > * { white-space: nowrap; }
.ip-marks .ip-t { color: var(--ink); font-variant-numeric: tabular-nums; }
.ip-marks .ip-bad { color: var(--coral-ink); font-weight: 600; }
.ip-note { margin: 4px 0 0; font-size: 13px; overflow-wrap: normal; }
.ip-check-a { display: flex; align-items: flex-start; gap: 4px; }
.ip-check-a .x { width: 32px; height: 32px; border: 0; background: none; font-size: 20px; color: var(--ink-3); cursor: pointer; border-radius: var(--r); }
.ip-check-a .x:hover { background: var(--coral-soft); color: var(--coral-ink); }
.ip-summary { margin: 10px 0; padding: 8px 11px; border-left: 3px solid var(--lime); background: var(--lime-soft); border-radius: 0 var(--r) var(--r) 0; }
.ip-summary b { font-size: 12.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--lime-ink); }
.ip-summary p { margin: 3px 0; font-size: 13.5px; white-space: pre-wrap; }

/* Лечение и уход (Сессия 17): план на сутки, питание, процедуры, услуги и расход. Базовые стили
   стоят ДО медиазапроса ниже — иначе мобильная раскладка не применится (на этом споткнулись в
   Сессии 16). У .panel и .ip-dlg-c своих отступов нет, поэтому разделы задают свои сами. */
.ip-care-bar { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: flex-end; margin-bottom: 10px; }
.ip-care-bar .field { flex: 0 0 auto; min-width: 0; }
.ip-care-bar .btn { min-height: var(--tap); }
.ip-care-sec { margin: 14px 0 0; padding-top: 12px; border-top: 1px solid var(--line); }
.ip-care-h { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: baseline; margin-bottom: 8px; }
.ip-care-h h3 { margin: 0; font-size: 14.5px; }
.ip-care-h small { color: var(--ink-2); }
.ip-care-h .btn { margin-left: auto; min-height: var(--tap); }

.ip-slots { list-style: none; margin: 0; padding: 0; }
.ip-slot { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: baseline; padding: 8px 0; border-bottom: 1px solid var(--line); }
.ip-slot:last-child { border-bottom: 0; }
.ip-slot.late { background: var(--coral-soft); border-radius: var(--r); padding-left: 8px; padding-right: 8px; }
.ip-slot-t { flex: 0 0 62px; font-weight: 700; font-variant-numeric: tabular-nums; }
.ip-slot-t .ip-night { display: block; font-weight: 500; font-size: 11px; color: var(--coral-ink); }
.ip-slot-w { flex: 1 1 200px; min-width: 0; overflow-wrap: normal; }
.ip-slot-w small { display: block; color: var(--ink-2); }
.ip-slot-w small.fh { font-size: 12px; color: var(--ink-3); }
.ip-slot-sum { flex: 0 0 auto; font-variant-numeric: tabular-nums; font-weight: 600; }
.ip-slot-a { flex: 0 0 auto; display: flex; flex-wrap: wrap; gap: 6px; margin-left: auto; }
.ip-slot-a .btn { min-height: var(--tap); }

.ip-care-total { margin: 8px 0 0; text-align: right; }
.ip-care-lines { padding-top: 4px; }
.ip-care-sug { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.ip-care-drug { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; margin-top: 8px; }
.ip-care-drug .field { flex: 1 1 120px; min-width: 0; }
.ip-care-drug .btn { min-height: var(--tap); }
.ip-care-ws > summary { cursor: pointer; min-height: var(--tap); display: flex; align-items: center; gap: 6px; font-weight: 600; }
.ip-care-ws > summary small { font-weight: 400; color: var(--ink-2); }

@media (max-width: 640px) {
  .ip-bar { display: grid; grid-template-columns: minmax(0, 1fr); }
  .ip-tabs { display: flex; width: 100%; }
  .ip-tabs > * { flex: 1 1 0; justify-content: center; min-height: 44px; }
  .ip-acts { margin-left: 0; }
  .ip-acts .btn { flex: 1 1 auto; justify-content: center; min-height: 44px; }
  .ip-grid { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .ip-card { min-height: 0; }
  .ip-spot { grid-template-columns: minmax(0, 1fr); }
  .ip-stay-acts .btn { flex: 1 1 calc(50% - 8px); justify-content: center; min-height: 44px; }
  .ip-dlg .props > div { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  /* Лист у бокса: время над записью, отметки во всю ширину, кнопки под ними, графики друг
     под другом — в две колонки на 375 px и метки, и комментарий рвались бы на каждом слове. */
  .ip-check { display: flex; flex-direction: column; gap: 6px; }
  .ip-check-t { display: flex; gap: 8px; align-items: baseline; }
  .ip-check-a { justify-content: flex-end; }
  .ip-charts { grid-template-columns: minmax(0, 1fr); }
  .ip-cform .dlg-actions .btn, .ip-sform .dlg-actions .btn { flex: 1 1 calc(50% - 8px); justify-content: center; min-height: 44px; }
  /* Уход у бокса: час и запись в столбик, кнопки во всю ширину — в строку на 375 px они
     налезают друг на друга, а «Выполнено» должно попадать пальцем с первого раза. */
  .ip-slot { flex-direction: column; align-items: stretch; gap: 4px; }
  .ip-slot-t { flex: 0 0 auto; }
  .ip-slot-t .ip-night { display: inline; margin-left: 6px; }
  .ip-slot .ip-chip { align-self: flex-start; }
  .ip-slot-sum { text-align: right; }
  .ip-slot-a { margin-left: 0; }
  .ip-slot-a .btn { flex: 1 1 calc(50% - 6px); justify-content: center; }
  .ip-care-bar { display: grid; grid-template-columns: minmax(0, 1fr); }
  .ip-care-bar .field, .ip-care-bar .btn { width: 100%; }
  .ip-care-h .btn { margin-left: 0; width: 100%; justify-content: center; }
  .ip-care-drug .field { flex: 1 1 100%; }
  .ip-care-drug .btn { width: 100%; justify-content: center; }
}


/* Журнал стационара на печать: заголовок с периодом и таблица, без меню, фильтра и кнопок. */
@media print {
  body:has(#ip) { background: #fff; }
  body:has(#ip) .side, body:has(#ip) .scrim, body:has(#ip) .menu-btn, body:has(#ip) .tb-ticket, body:has(#ip) .ip-noprint,
  body:has(#ip) #ip-board, body:has(#ip) .topbar, body:has(#ip) dialog { display: none !important; }
  body:has(#ip) .app { display: block; }
  body:has(#ip) .panel { border: 0; box-shadow: none; }
  body:has(#ip) .ip-print-only { display: inline; }
  body:has(#ip) .inbox-tbl th, body:has(#ip) .inbox-tbl td { padding: 4px 6px; font-size: 9.5px; }
  body:has(#ip) .inbox-tbl tr { break-inside: avoid; }
  body:has(#ip) .inbox-tbl a { color: inherit; text-decoration: none; }
}


/* ── Расчётный лист приёма (Этап 2, Сессия 9): услуги из прайса, расход препаратов, наборы ──
   Блок экрана приёма (worksheet.js): строка — название слева, количество, сумма и «×» справа;
   на телефоне строка складывается в две. Свернуть блок можно за заголовок: экран приёма и без
   него длинный. */
.ws-box > summary { cursor: pointer; list-style: none; }
.ws-box > summary::-webkit-details-marker { display: none; }
.ws-box > summary::after { content: '▾'; margin-left: auto; color: var(--ink-3); font-size: 12px; }
.ws-box:not([open]) > summary::after { content: '▸'; }
.ws-head { display: flex; align-items: baseline; gap: 10px; margin: 2px 0 4px; }
.ws-head h5 { margin: 0; font-size: 12px; font-weight: 700; letter-spacing: .02em; text-transform: uppercase; color: var(--ink-3); }
.ws-total { margin-left: auto; font-size: 14px; font-weight: 700; color: var(--ink); white-space: nowrap; }
.ws-list { margin: 0 0 4px; }
/* .ws-list > .ws-row, а не просто .ws-row: список — ещё и .pc-list, и сетка «.pc-list li» перебивала flex —
   на телефоне правая часть забирала всю ширину, название шло столбиком по букве (тикет CRM №37). */
.ws-list > .ws-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.ws-list > .ws-row:last-child { border-bottom: 0; }
.ws-main { min-width: 0; flex: 1 1 auto; }
.ws-name { display: block; font-weight: 600; font-size: 13px; overflow-wrap: anywhere; }
.ws-note { display: block; color: var(--ink-3); font-size: 11.5px; }
.ws-who { display: block; margin-top: 4px; max-width: 100%; font: 12px var(--f); color: var(--ink-2); background: transparent; border: 1px dashed var(--line-2); border-radius: 3px; padding: 2px 4px; }
.ws-billed { color: var(--ink-2); font-weight: 600; }
.ws-right { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.ws-qty { width: 58px; text-align: right; padding: 4px 6px; border: 1px solid var(--line); border-radius: var(--r-s, 6px); font: inherit; font-size: 13px; background: var(--surface); }
.ws-qty:disabled { background: var(--surface-3); color: var(--ink-2); }
.ws-unit { font-size: 12px; color: var(--ink-2); min-width: 54px; }
.ws-sum { font-size: 13px; font-weight: 600; white-space: nowrap; text-align: right; min-width: 104px; }
.ws-sum small { display: block; font-weight: 400; font-size: 11px; color: var(--ink-3); }
.ws-sum-none { font-weight: 400; color: var(--ink-3); }
/* Расход «входит в услугу» или без цены (28.09.2026): бледнее суммы — в счёт не идёт. */
.ws-sum-ref { font-weight: 500; color: var(--ink-3); }
.ws-incl { padding: 2px 8px; font-size: 12px; white-space: nowrap; }
.ws-row .x { border: 0; background: none; color: var(--ink-3); font-size: 18px; line-height: 1; cursor: pointer; min-width: 32px; min-height: 32px; }
.ws-row .x:hover { color: var(--coral-ink); }
.ws-bar { display: flex; flex-wrap: wrap; gap: 6px; margin: 2px 0 6px; }
.ws-add, .ws-drug { margin-bottom: 8px; }
.ws-q { width: 100%; }
.ws-found { display: grid; gap: 2px; max-height: 232px; overflow-y: auto; margin: 4px 0; }
.ws-sug { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 6px 8px; cursor: pointer; font: inherit; }
.ws-sug:hover, .ws-sug:focus-visible { border-color: var(--lime); background: var(--surface-3); }
.ws-sug-name { font-size: 13px; font-weight: 600; overflow-wrap: anywhere; }
.ws-sug-price { font-size: 13px; font-weight: 600; white-space: nowrap; }
.ws-sug-price small { font-weight: 400; color: var(--ink-3); }
.ws-sug-sec { grid-column: 1 / -1; font-size: 11px; color: var(--ink-3); }
.ws-drug-grid { display: grid; grid-template-columns: minmax(0, 1fr) 84px 118px; gap: 8px; }
.ws-kits { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line); }
.ws-kit-sel { max-width: 100%; flex: 1 1 200px; }
/* «Как в прошлый раз» (тикет CRM №38): лист прошлого приёма — свёрнут, раскрывается за заголовок. */
.ws-prev { margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line); }
.ws-prev > summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.ws-prev-lines { list-style: none; margin: 6px 0; padding: 0; }
.ws-prev-lines li { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 4px 12px; padding: 4px 0; border-bottom: 1px dashed var(--line); font-size: 12.5px; }
.ws-prev-lines li span { overflow-wrap: anywhere; }
.ws-prev-lines li i { font-style: normal; color: var(--ink-3); white-space: nowrap; }
.ws-prev-lines li b { white-space: nowrap; text-align: right; font-weight: 600; }
.ws-prev-field { margin: 6px 0 0; }
.ws-prev-pick { max-width: 100%; }

/* Телефон (375 px): строка в две — название сверху, количество и сумма снизу. */
@media (max-width: 520px) {
  .ws-list > .ws-row { flex-wrap: wrap; }
  .ws-right { width: 100%; justify-content: flex-end; }
  .ws-sum { min-width: 0; }
  .ws-drug-grid { grid-template-columns: minmax(0, 1fr); }
  .ws-kits .btn { flex: 1 1 calc(50% - 6px); justify-content: center; min-height: 40px; }
  .ws-kit-sel { flex: 1 1 100%; }
}

/* Назначения и лист выполнения (Этап 2, Сессия 10). Блок живёт на двух экранах — в приёме
   «Моего дня» и во вкладке карточки пациента, — поэтому опирается на общие .pc-list и .task.
   На телефоне (375 px) поля формы встают в одну колонку, а кнопки отметки — под строкой. */
.rx-list { margin: 0 0 4px; }
/* Строка назначения — не сетка «дата · текст · статус» обычного .pc-list: даты у назначения две,
   они идут в описании, поэтому строка своя. Селектор с .pc-list — чтобы перебить её сетку. */
.pc-list li.rx-row { display: flex; align-items: flex-start; gap: 10px; }
.rx-row .what { min-width: 0; flex: 1 1 auto; }
.rx-row .what > small { display: block; font-size: 12px; color: var(--ink-2); }
.rx-row .what > small.dim { color: var(--ink-3); }
.rx-right { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; flex-wrap: wrap; justify-content: flex-end; }
.rx-warn { color: var(--coral-ink); }
.rx-allergy { margin-bottom: 8px; }
.rx-form { margin: 6px 0 8px; }
.rx-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.rx-f-drug { grid-column: 1 / -1; }
.rx-reason input { border-color: var(--coral-ink); }
.rx-all { margin-left: auto; font-size: 12px; }
/* Файлы назначений со стороны (правки персонала 23.09.2026): другая клиника, фото листа. */
.rx-files { margin: 4px 0 8px; }
.pc-list li.rx-files-h { border: 0; padding-bottom: 0; font-size: 12px; color: var(--ink-2); }
.pc-list li.rx-file { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.rx-file .rx-page { margin-right: 6px; font-size: 12px; }
.rx-file small.dim { color: var(--ink-3); font-size: 12px; }
.rx-upload { margin-top: 10px; }
/* Строка листа выполнения живёт и в узкой колонке «Моего дня» (~250 px), и в карточке пациента:
   время и текст — в строку, кнопки отметки — отдельной строкой под ними, иначе в узкой колонке
   текст сжимается в столбик по букве. */
.rx-time { flex: 0 0 46px; font-size: 13px; font-weight: 700; color: var(--ink-2); }
.rx-slot { align-items: flex-start; gap: 8px; flex-wrap: wrap; }
.rx-slot .tx { flex: 1 1 120px; min-width: 0; }
.rx-slot .rx-right { flex: 1 1 100%; justify-content: flex-start; padding-left: 54px; margin-top: 4px; }
.rx-slot .tx > small { display: block; font-size: 11.5px; color: var(--ink-2); }
.rx-slot .tx > small.dim { color: var(--ink-3); }
.rx-done { background: #f4f8f3; }
.rx-missed .rx-time { color: var(--coral-ink); }
.rx-plan-head { font-weight: 600; }

@media (max-width: 520px) {
  .rx-grid { grid-template-columns: minmax(0, 1fr); }
  .pc-list li.rx-row { flex-wrap: wrap; }
  /* Отметка и «Отменить» — строкой под назначением, а не посреди его описания. */
  .rx-row .rx-right { flex: 1 1 100%; justify-content: flex-start; margin-top: 4px; }
  .rx-right .btn { flex: 1 1 calc(50% - 6px); justify-content: center; }
  /* У назначения рядом с чипом теперь две кнопки («Отменить» и «Рецепт», Сессия 11): на
     половину ширины их растягивать нельзя — разъезжаются по строкам. Лист выполнения, где
     кнопки отметки и правда удобнее крупными, правило сохраняет. */
  .rx-row .rx-right .st, .rx-row .rx-right .btn { flex: 0 0 auto; }
}

/* Шаблоны назначений (Этап 2, Сессия 11): экран /rx-templates и подстановка шаблона в блоке
   «Назначения». Опирается на общие .pc-list, .sub-form и .rx-grid — своего в разметке минимум.
   На телефоне (375 px) поля строки препарата встают в одну колонку, как и форма назначения. */
/* У .panel своего внутреннего отступа нет — его дают блоки внутри, как на других экранах. */
.rxt-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; padding: 12px 16px 0; }
.rxt-list { padding: 6px 16px 14px; }
.rxt-box { padding: 12px 16px 16px; }
.rxt-sec + .rxt-sec { margin-top: 14px; }
.rxt-sec-h { margin: 0 0 2px; font-size: 12px; font-weight: 600; color: var(--ink-3); text-transform: uppercase; letter-spacing: .04em; }
.rxt-card .what > small { display: block; font-size: 12px; color: var(--ink-2); }
/* Рекомендации владельцу в списке — только первые строки: целиком они открываются в правке. */
.rxt-recs { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.rxt-form { margin-top: 4px; }
.rxt-h { margin: 12px 0 4px; font-size: 13px; font-weight: 600; }
.rxt-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.rxt-f-title { grid-column: span 2; }
.rxt-flags { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; margin: 8px 0; }
.rxt-items { display: grid; gap: 8px; }
.rxt-item {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; align-items: end;
  padding: 10px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface-3, var(--surface-2));
}
.rxt-f-drug { grid-column: span 2; }
.rxt-f-note { grid-column: span 3; }
.rxt-drop { align-self: end; }
.rxt-form textarea { width: 100%; }

/* Подстановка шаблона в приёме: строка заготовки — отдельная карточка, чтобы было видно, где
   кончается один препарат и начинается другой, и чтобы «не назначать» относилось к своей строке. */
.rx-tpl { margin: 6px 0 8px; }
/* Список шаблонов — длинные названия («Дерматология: системная терапия и контроль»). У select
   ширина по умолчанию — по самой длинной опции: без width 100% и min-width 0 он растягивает
   собой весь блок назначений, и в узкой колонке карточки пациента поля уезжают за край. */
.rx-tpl, .rx-tpl-rows, .rx-tpl-row { min-width: 0; }
.rx-tpl-pick { flex: 1 1 100%; min-width: 0; }
.rx-tpl-sel { width: 100%; min-width: 0; }
.rx-tpl-rows { display: grid; gap: 10px; margin: 6px 0; }
.rx-tpl-row { padding: 10px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface-3, var(--surface-2)); }
.rx-tpl-row.rx-tpl-warn { border-color: var(--coral-ink); }
.rx-tpl-use { font-size: 13.5px; margin-bottom: 6px; }
.rx-tpl-recs { white-space: pre-line; }

@media (max-width: 720px) {
  .rxt-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rxt-item { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rxt-f-note { grid-column: span 2; }
}
@media (max-width: 520px) {
  .rxt-grid, .rxt-item { grid-template-columns: minmax(0, 1fr); }
  .rxt-f-title, .rxt-f-drug, .rxt-f-note { grid-column: auto; }
  .rxt-card .rx-right { flex: 1 1 100%; justify-content: flex-start; margin-top: 4px; }
  /* Чипы и кнопки шаблона — в одну строку слева, а не «половина ширины на кнопку»:
     правило Сессии 10 растягивает кнопки назначения, а здесь их две коротких. */
  .rxt-card .rx-right .st, .rxt-card .rx-right .btn { flex: 0 0 auto; }
}

/* ── Счёт приёма и оплата (Этап 2, Сессия 20) ────────────────────────────────────
   Экран /invoices/:id: слева строки счёта по разделам, справа итог и оплата. На узком экране —
   одной колонкой, итог и оплата под строками. Панель «К оплате» на главном и блок «Счета и долги»
   в карточке клиента — ниже. */
.inv-grid { display: grid; gap: 18px; grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 1100px) { .inv-grid { grid-template-columns: minmax(0, 1fr) 400px; } .inv-side { position: sticky; top: 84px; } }
.inv-main, .inv-side { display: grid; gap: 18px; min-width: 0; }
.inv > .msg { margin: 0 0 12px; }
.inv-who { padding: 12px 16px 0; font-size: 14px; }
.inv-hints { list-style: none; margin: 10px 16px 0; padding: 0; display: grid; gap: 6px; }
.inv-hints:empty { display: none; }
.inv-hints li { padding: 8px 10px; border-radius: var(--r); background: var(--amber-soft); color: var(--ink); font-size: 13px; border-left: 3px solid var(--amber); }
.inv-hints li.bad { background: var(--coral-soft); border-left-color: var(--coral); }
.inv-group { padding: 14px 16px 4px; }
.inv-gh { display: flex; justify-content: space-between; gap: 10px; margin: 0 0 6px; font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-2); }
.inv-gh span { font-variant-numeric: tabular-nums; color: var(--ink); letter-spacing: 0; }
.inv-tblwrap { overflow-x: auto; }
.inv-tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.inv-tbl th, .inv-tbl td { padding: 7px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.inv-tbl th { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-3); }
.inv-tbl .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.inv-tbl .inv-x { width: 40px; text-align: right; padding-block: 2px; }
.inv-tbl .note { font-size: 12px; margin-top: 2px; }
.inv-tag { color: var(--ink-3); font-size: 11.5px; }
.inv-tbl .inv-defer { white-space: nowrap; }
.inv-deferred { margin: 10px 8px 4px; padding: 12px 8px 4px; border: 1px dashed var(--line-2); border-radius: var(--r); }
.inv-deferred .inv-gh, .inv-deferred .inv-tbl td { color: var(--ink-2); }
.inv-deferred > .note { margin: 0 0 6px; font-size: 12.5px; }
.inv-empty { padding: 14px 16px; margin: 0; }
.inv-add { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) 90px; gap: 8px 12px; padding: 14px 16px 16px; border-top: 1px dashed var(--line); margin-top: 8px; }
.inv-add .field small { color: var(--ink-3); font-size: 11.5px; }
.inv-add .msg { grid-column: 1 / -1; margin: 0; }
.inv-add .msg:empty { display: none; }
.inv-sugg { grid-column: 1 / -1; list-style: none; margin: 0; padding: 4px; display: grid; gap: 2px; max-height: 300px; overflow-y: auto; border: 1px solid var(--line-2); border-radius: var(--r); background: var(--surface); }
.inv-sugg button { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; width: 100%; padding: 7px 9px; border: 0; border-radius: var(--r); background: none; color: var(--ink); font: inherit; font-size: 13.5px; text-align: left; cursor: pointer; }
.inv-sugg button:hover, .inv-sugg button:focus-visible { background: var(--lime-soft); }
.inv-sugg small { color: var(--ink-3); font-size: 12px; }
.inv-sugg .note { padding: 6px 9px; }
/* Скан у стойки и остаток Аптеки (единый запуск склада, Сессия 8). */
.inv-scan { display: grid; gap: 8px; padding: 14px 16px 0; border-top: 1px dashed var(--line); margin-top: 8px; }
.inv-scan .field small { color: var(--ink-3); font-size: 11.5px; }
.inv-scan .msg { margin: 0; }
.inv-scan .msg:empty { display: none; }
.inv-scan + .inv-add { border-top: 0; margin-top: 0; }
.inv-left { color: var(--ink-3); }
.inv-left.bad { color: var(--coral-ink); }
.bill-quick { margin-left: auto; }
.quick-list li { padding-inline: 0; }
#quick-dlg a.btn { text-decoration: none; }
.inv-kv { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; margin: 0; padding: 14px 16px; font-size: 14px; }
.inv-kv dt { color: var(--ink-2); }
.inv-kv dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.inv-kv .inv-due-k { padding-top: 8px; border-top: 1px solid var(--line); font-weight: 700; color: var(--ink); }
.inv-kv .inv-due { padding-top: 8px; border-top: 1px solid var(--line); font-size: 20px; font-weight: 700; }
.inv-kv .inv-due.bad { color: var(--coral-ink); }
.inv-acts { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 16px 14px; }
.inv-acts:empty { display: none; }
.inv-danger { color: var(--coral-ink); }
.inv-disc, .inv-cancel { display: grid; gap: 10px; padding: 12px 16px 16px; border-top: 1px dashed var(--line); }
.inv-disc .note, .inv-disc .msg, .inv-cancel .msg { margin: 0; }
/* Кассовый чек по счёту (касса, К2). */
#inv-rcpt-body { display: grid; gap: 8px; padding: 14px 16px 4px; font-size: 14px; }
#inv-rcpt-body p { margin: 0; }
#inv-rcpt-body details ul { margin: 6px 0 0; padding-left: 18px; font-size: 13px; color: var(--ink-2); }
.inv-rcpt > .field { margin: 8px 16px 0; }
.inv-rcpt > .dlg-actions { padding: 10px 16px 14px; margin: 0; justify-content: flex-start; flex-wrap: wrap; }
.inv-rcpt > .dlg-actions:empty { display: none; }
.inv-rcpt-manual { display: grid; gap: 10px; padding: 12px 16px 16px; border-top: 1px dashed var(--line); }
.inv-rcpt-manual .note { margin: 0; }
#inv-rcpt-msg { margin: 0 16px 12px; }
#inv-rcpt-msg:empty { display: none; }
/* Возврат по чеку CRM (касса, К3а). */
#inv-ref-body { display: grid; gap: 8px; padding: 14px 16px 4px; font-size: 14px; }
#inv-ref-body p { margin: 0; }
#inv-ref-body details ul { margin: 6px 0 0; padding-left: 18px; font-size: 13px; color: var(--ink-2); }
.inv-ref-form .note, .inv-ref-sum { margin: 0; }
.inv-ref-lines { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.inv-ref-lines:empty { display: none; }
.inv-ref-lines label { display: grid; grid-template-columns: 18px 1fr auto; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.inv-ref-lines input { width: 18px; height: 18px; accent-color: var(--lime); }
.inv-ref-lines span:last-child { font-variant-numeric: tabular-nums; white-space: nowrap; }
.inv-ref-sum { font-weight: 700; font-size: 15px; }
/* Сессия 12 единого запуска: правила возврата — строка, которую не вернуть, причина товара, ссылка «изменить дату». */
.inv-ref-lines li.off label { cursor: default; color: var(--ink-2); }
.inv-ref-lines small { color: var(--ink-2); font-size: 12px; }
.inv-ref-lines small.bad { color: var(--bad, #b42318); }
.inv-ref-cause { display: grid; gap: 4px; border: 0; margin: 0; padding: 0; }
.inv-ref-cause legend { padding: 0; font-size: 13px; color: var(--ink-2); }
.inv-ref-link { padding: 0; border: 0; background: none; font: inherit; color: var(--lime-ink); text-decoration: underline; cursor: pointer; }
.inv-ref-force { margin: 0 16px 10px; }
#inv-ref-msg { margin: 0 16px 12px; }
#inv-ref-msg:empty { display: none; }
/* Экран «Касса» (касса, К2). */
.kassa { display: grid; gap: 16px; }
.kassa-kv { grid-template-columns: minmax(180px, max-content) 1fr; }
.kassa-kv dd { text-align: left; }
.kassa .panel > .note { margin: 0; padding: 0 16px 14px; }
.kassa-devs { padding: 0 16px; }
.kassa-devs:empty { display: none; }
.kassa-acts { padding: 0 16px 14px; margin: 0; justify-content: flex-start; }
.kassa-acts:empty { display: none; }
.kassa-last { padding: 0 16px 14px; }
.kassa-last .note { margin: 0; }
.inv-cost { padding: 10px 16px 14px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--ink-2); }
.inv-cost p { margin: 0; }
.inv-cost > * + * { margin-top: 6px; }
.inv-cost-d summary { cursor: pointer; color: var(--ink); }
.inv-cost-d ul { margin: 4px 0 0; padding-left: 18px; }
.inv-cost-sum { font-weight: 600; color: var(--ink); }
.inv-form { padding: 14px 16px 16px; margin-top: 0; }
.inv-max-btn { justify-content: flex-end; }
.inv-check { display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.inv-check input { width: 18px; height: 18px; accent-color: var(--lime); }
.inv-pays { max-height: none; padding: 4px 16px 12px; }
@media (max-width: 640px) {
  .inv-add { grid-template-columns: 1fr; }
  .inv-tbl th:nth-child(3), .inv-tbl td:nth-child(3) { display: none; }
}

/* Панель «К оплате» на главном экране и блок «Счета и долги» в карточке клиента. */
.bill-list { list-style: none; margin: 0; padding: 0; display: grid; }
.bill-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; padding: 9px 16px; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.bill-list li:last-child { border-bottom: 0; }
.bill-list .bill-what { flex: 1 1 220px; min-width: 0; }
.bill-list .bill-what small { display: block; color: var(--ink-3); font-size: 12px; }
.bill-list .bill-sum { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.bill-list .bill-sum.bad { color: var(--coral-ink); }
.bill-h { margin: 0; padding: 10px 16px 4px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink-3); }
.bill-empty { padding: 12px 16px; margin: 0; }
.bill-card .bill-list li { padding-inline: 0; }
.bill-card .bill-h { padding-inline: 0; }
.bill-debt { display: inline-block; margin-left: 8px; }
.inv-acts a.btn, .bill-list a.btn, .bill-card a.btn { text-decoration: none; }

/* «Мой день»: расписание клиники (тикет CRM №6) и вкладки приёма —
   протокол, расчётный лист, назначения, прививки… (21.09.2026, просьба врачей). */
.dw-sched .panel-tools { margin-left: auto; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.dw-sched .cal-empty { margin: 16px; }
/* Вкладок приёма девять — переносом во вторую строку, а не прокруткой: все видны сразу. */
.dw-vtabs { margin: 0 0 14px; flex-wrap: wrap; overflow: visible; }
.dw-vtabs button { padding: 9px 11px; min-height: 40px; }
.dw-vpane > .step-box:last-child { margin-bottom: 12px; }
.stepper a.on { background: var(--lime-soft); color: var(--ink); font-weight: 600; box-shadow: inset 0 -2px 0 var(--lime); }
.stepper a.on i { background: var(--lime); border-color: var(--lime); color: #10210a; }
.dw-stepnav { display: flex; justify-content: space-between; gap: 10px; margin: 0 0 14px; }
.dw-stepnav:empty { display: none; }
/* Шаги протокола на телефоне (24.09.2026): вместо степпера — кнопки во всю ширину, открытый шаг
   раскрывается под своей кнопкой; заголовок внутри блока шага дублировал бы кнопку — скрыт. */
.dw-acc { display: none; }
@media (max-width: 639px) {
  .stepper { display: none; }
  .dw-acc {
    display: flex; align-items: center; gap: 10px; width: 100%; min-height: 48px; margin: 0 0 8px; padding: 10px 14px;
    border: 1px solid var(--line-2); border-radius: var(--r); background: var(--surface); color: var(--ink-2);
    font: 500 14px/1.3 var(--f); text-align: left; cursor: pointer; scroll-margin-top: 72px;
  }
  .dw-acc i {
    flex: none; width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--line-2); font-style: normal;
    font-size: 11.5px; font-weight: 600; line-height: 22px; text-align: center; color: var(--ink-3); background: var(--surface);
  }
  .dw-acc span { flex: 1 1 auto; min-width: 0; }
  .dw-acc .chev { flex: none; width: 8px; height: 8px; margin: 0 4px 4px; border: solid var(--ink-3); border-width: 0 2px 2px 0; transform: rotate(45deg); }
  .dw-acc.done { color: var(--ink); }
  .dw-acc.done i { background: var(--lime-soft); border-color: #cbe0b2; color: var(--lime-ink); }
  .dw-acc.on { margin-bottom: 0; border-color: var(--lime); border-radius: var(--r) var(--r) 0 0; background: var(--lime-soft); color: var(--ink); font-weight: 600; }
  .dw-acc.on i { background: var(--lime); border-color: var(--lime); color: #10210a; }
  .dw-acc.on .chev { margin: 4px 4px 0; transform: rotate(-135deg); }
  .dw-acc.on + .step-box { border-color: var(--lime); border-top: 0; border-radius: 0 0 var(--r) var(--r); }
  .dw-accbox > .sh .num, .dw-accbox > .sh h4 { display: none; }
  .dw-accbox > .sh:not(:has(.right)) { display: none; }
  .dw-accbox > .sh .right { margin-left: 0; }
}

/* ─── Аналитика руководителя (Этап 2, Сессия 26) — по демо «Дашборд руководителя» ─────────── */
.an-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-bottom: 14px; }
.an-seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: var(--r); overflow: hidden; background: var(--surface); }
.an-seg button { border: 0; border-right: 1px solid var(--line); background: transparent; padding: 7px 13px; min-height: var(--tap); font: inherit; font-size: 12.5px; color: var(--ink-2); cursor: pointer; transition: background .16s var(--ease); }
.an-seg button:last-child { border-right: 0; }
.an-seg button:hover { background: var(--surface-3); }
.an-seg button.on { background: var(--deep); color: #fff; font-weight: 500; }
.an-seg-sm button { min-height: 30px; padding: 4px 10px; font-size: 12px; }
@media (pointer: coarse) { .an-seg-sm button { min-height: 40px; } }
.an-dates { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; font-size: 12.5px; color: var(--ink-3); }
.an-dates label { display: inline-flex; align-items: center; gap: 6px; }
.an-dates input, .an-dates select { min-height: 32px; padding: 4px 8px; border: 1px solid var(--line-2); border-radius: var(--r); background: var(--surface); font: inherit; font-size: var(--field-font); color: var(--ink); }
.an-period { flex-basis: 100%; font-size: 12.5px; color: var(--ink-3); }
.an[aria-busy="true"] .kpis, .an[aria-busy="true"] .cols-2-1 { opacity: .55; transition: opacity .2s; }
.an-kpis { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
@media (min-width: 560px) { .an-kpis { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); } }
.an-kpis .kpi > b { font-size: 25px; }
.an-kpis .kpi .d { display: flex; flex-wrap: wrap; gap: 0 5px; }
.an-kpis .kpi .an-note { margin-top: 4px; font-size: 11.5px; }
.tnum { font-variant-numeric: tabular-nums; }
.delta { font-size: 11.5px; font-weight: 600; color: var(--ink-3); }
.delta.up { color: var(--lime-ink); }
.delta.down { color: var(--coral-ink); }
.an-scroll { overflow-x: auto; }
.an-pad { margin: 14px 16px; }
.an-legend { display: flex; flex-wrap: wrap; gap: 8px 16px; padding: 12px 16px; border-top: 1px solid var(--line); font-size: 11.5px; color: var(--ink-2); }
.an-legend i { display: inline-block; width: 11px; height: 11px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
.src-crm { background: var(--lime); }
.src-vo { background: var(--deep-2); }
.src-dikidi { background: var(--sky); }
/* График */
.an-chart-wrap { overflow-x: auto; padding-top: 8px; }
.chart { width: 100%; min-width: 420px; height: auto; display: block; overflow: visible; }
.chart .gl { stroke: var(--line); stroke-width: 1; }
.chart .lbl { font-size: 9px; fill: #8b968c; font-family: var(--f); }
.ck { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 10px; font-size: 12px; color: var(--ink-2); }
.ck i { display: inline-block; width: 14px; height: 3px; border-radius: 2px; margin-right: 7px; vertical-align: 3px; }
.ck .dim { color: var(--ink-3); }
.an-ck-r { margin-left: auto; }
/* Таблица врачей и сезонов */
.mtbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.mtbl th { text-align: left; font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--surface-3); white-space: nowrap; }
.mtbl th.r, .mtbl td.r { text-align: right; font-variant-numeric: tabular-nums; }
.mtbl td { padding: 12px; border-bottom: 1px solid var(--line); }
.mtbl tbody tr:last-child td { border-bottom: 0; }
.mtbl tfoot td { background: var(--surface-3); font-weight: 600; border-top: 1px solid var(--line); border-bottom: 0; }
.mtbl td small { display: block; font-size: 11.5px; }
.mtbl td small.dim, .mtbl .dim { color: var(--ink-3); }
.mtbl td.r small .delta { font-size: 11px; }
.mtbl .mini { height: 6px; border-radius: 4px; background: var(--surface-2); overflow: hidden; width: 78px; display: inline-block; vertical-align: middle; margin-right: 9px; }
.mtbl .mini i { display: block; height: 100%; background: var(--lime); }
.mtbl .mini i.hi { background: var(--amber); }
.mtbl .mini i.max { background: var(--coral); }
.an-season th, .an-season td { padding: 8px 7px; font-size: 12.5px; }
.an-season tbody th { font-size: 12.5px; letter-spacing: 0; color: var(--ink); background: var(--surface); text-transform: none; }
.an-season td.an-heat { position: relative; text-align: right; font-variant-numeric: tabular-nums; background: color-mix(in srgb, var(--lime) calc(var(--h, 0) * 55%), var(--surface)); white-space: nowrap; }
.an-season td.an-empty { background: var(--surface-3); }
.an-season td.an-tot { font-weight: 600; }
.an-srcs { position: absolute; left: 3px; right: 3px; bottom: 2px; display: flex; gap: 2px; }
.an-srcs i { flex: 1; height: 2px; border-radius: 1px; }
/* Способы оплаты, услуги */
.src-row { display: grid; grid-template-columns: 1fr auto; gap: 11px; align-items: center; font-size: 12.5px; padding: 7px 0; }
.src-row .sn b { display: block; font-size: 12.5px; font-weight: 600; }
.src-row .sb { height: 6px; border-radius: 4px; background: var(--surface-2); overflow: hidden; margin-top: 5px; }
.src-row .sb i { display: block; height: 100%; background: var(--lime); }
.src-row .sv { text-align: right; font-variant-numeric: tabular-nums; }
.src-row .sv b { font-size: 14px; font-weight: 600; }
.src-row .sv small { display: block; color: var(--ink-3); font-size: 11px; }
.metric-note { font-size: 11.5px; color: var(--ink-3); margin-top: 10px; line-height: 1.5; border-top: 1px dashed var(--line); padding-top: 10px; }
.an-items { margin-top: 10px; }
.an-items td:first-child { overflow-wrap: anywhere; padding-right: 8px; }
.an-items td.r { white-space: nowrap; }
/* ── Аналитика, Сессия 27: вкладки, воронка, «Требует внимания» ── */
.an-tabs { margin-bottom: 14px; }
.an-export { margin-left: auto; }
.an[aria-busy="true"] .an-pane { opacity: .55; transition: opacity .2s; }
/* Воронка — как в демо руководителя */
.funnel { display: flex; flex-direction: column; gap: 9px; }
.fn { position: relative; background: var(--surface-2); border-radius: var(--r); overflow: hidden; height: 46px; }
.fn > i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--deep-2); border-radius: var(--r); }
.fn > i.l2 { background: var(--deep-3); }
.fn > i.l3 { background: var(--lime-ink); }
.fn > i.l4 { background: var(--lime); }
.fn > span { position: absolute; inset: 0; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 0 15px; font-size: 13px; color: #fff; font-weight: 500; }
.fn.pale > span { color: #10210a; }
.fn .fn-l { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fn .fn-l em { font-style: normal; font-variant-numeric: tabular-nums; font-weight: 700; }
.fn > span > em { flex: none; font-style: normal; font-variant-numeric: tabular-nums; font-weight: 700; background: rgba(255, 255, 255, .94); color: #14271b; padding: 2px 9px; border-radius: 20px; font-size: 12px; }
@media (max-width: 559px) { .fn > span { font-size: 12px; padding: 0 10px; } }
.mini-tbl td.bad, .mini-tbl td.bad b, .mtbl td.bad b { color: var(--coral-ink); }
.props dd.bad { color: var(--coral-ink); }
.props dd.good { color: var(--lime-ink); }
.an-note-box { display: flex; gap: 10px; align-items: flex-start; margin-top: 13px; font-size: 12.5px; }
.an-note-box .ico { flex: none; width: 16px; height: 16px; color: var(--lime-ink); margin-top: 2px; }
.an-lost + .an-lost { margin-top: 14px; }
/* Требует внимания */
.att-grid { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 1100px) { .att-grid { grid-template-columns: repeat(2, 1fr); } }
.att .panel-h h2 { display: flex; align-items: center; gap: 8px; }
.att .panel-h h2 .ico { width: 17px; height: 17px; color: var(--coral-ink); }
.att.att-ok .panel-h h2 .ico { color: var(--lime-ink); }
.att-n { margin-left: auto; min-width: 26px; padding: 2px 9px; border-radius: 20px; background: var(--coral-soft); color: var(--coral-ink); font-weight: 700; font-size: 12.5px; text-align: center; font-variant-numeric: tabular-nums; }
.att-n.ok { background: var(--lime-soft); color: var(--lime-ink); font-weight: 600; }
.att-hint { margin: 0 0 8px; font-size: 12px; color: var(--ink-3); }
.att-list { list-style: none; margin: 0; padding: 0; }
.att-list li { border-top: 1px dashed var(--line); }
.att-list li:first-child { border-top: 0; }
.att-list a { display: block; padding: 8px 0 8px 12px; border-left: 3px solid var(--sky); color: inherit; text-decoration: none; min-height: var(--tap); }
.att-list li.warn a { border-left-color: var(--coral); }
.att-list a:hover b, .att-list a:focus-visible b { text-decoration: underline; }
.att-list b { display: block; font-size: 13px; font-weight: 600; overflow-wrap: anywhere; }
.att-list small { display: block; font-size: 11.5px; color: var(--ink-2); overflow-wrap: anywhere; }
.att-more { margin: 10px 0 0; font-size: 12px; color: var(--ink-3); }
.att-more a { color: var(--lime-ink); font-weight: 600; }
.att-later { margin-top: 14px; }
.an-lost th:not(:first-child), .an-lost td:not(:first-child) { width: 64px; }
.att-toggle { margin-top: 8px; padding: 6px 0; background: none; border: 0; font: inherit; font-size: 12.5px; font-weight: 600; color: var(--lime-ink); cursor: pointer; min-height: var(--tap); }
.att-toggle:hover, .att-toggle:focus-visible { text-decoration: underline; }

/* ── Справочник препаратов (Этап 2, Сессия 6) — строки как в прайсе ── */
.drg-name { font-weight: 500; padding: 5px 9px 0; }
.drg-name + .prc-meta, .drg-alias { margin-top: 2px; }
.drg-alias { font-style: italic; }
.drg-unit { min-width: 72px; justify-content: flex-end; color: var(--ink-2); font-size: 13px; }
.drg-routes { border: 0; padding: 0; margin: 4px 0 0; }
.drg-routes legend { font-size: 13px; color: var(--ink-2); margin-bottom: 6px; }
@media (max-width: 559px) { .drg-unit { min-width: 0; justify-content: flex-start; margin-left: 9px; } }

/* Склад (модуль Этапа 3, Сессия 1): строки — как у «Препаратов», справа колонки остатков по местам.
   На широком экране подписи мест — шапкой над списком, на телефоне — у каждой цифры. */
.stk-head { display: none; }
@media (min-width: 760px) {
  .stk-head { display: flex; align-items: center; gap: 12px; padding: 8px 16px 0; font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); }
  .stk-head .stk-h-name { flex: 1 1 260px; }
  .stk-head .stk-h-q { width: 96px; text-align: right; }
  .stk-head .stk-h-acts { width: 92px; }
  .stk-row .stk-q-label { display: none; }
}
.stk-q { width: 96px; justify-content: flex-end; gap: 4px; font-variant-numeric: tabular-nums; }
.stk-q b { font-weight: 600; }
.stk-q-unit { font-size: 12px; color: var(--ink-3); }
.stk-q-label { font-size: 11.5px; color: var(--ink-3); margin-right: auto; }
.stk-q.zero b { color: var(--ink-3); font-weight: 400; }
.stk-q.neg b { color: var(--coral-ink); }
.stk-row .prc-cell-acts { width: 92px; justify-content: flex-end; }
.stk-row.low { box-shadow: inset 3px 0 0 var(--amber); }
.badge.stk-chz { background: var(--sky-soft); color: var(--sky); border-color: #cbdde5; }
.badge.stk-low { background: var(--amber-soft); color: var(--amber); border-color: transparent; }
.stk-empty-note { margin: 10px 16px 0; }
.stk-bal { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 12px; }
.stk-bal .stk-q { width: auto; min-width: 120px; flex-direction: column; align-items: flex-start; gap: 0; padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface-3); }
.stk-bal .stk-q b { font-size: 18px; }
.stk-bal .stk-q-label { margin: 0; }
.stk-set { border: 1px solid var(--line); border-radius: var(--r); padding: 10px 14px 14px; margin: 0 0 12px; display: grid; gap: 10px; }
.stk-set legend { font-size: 13px; color: var(--ink-2); padding: 0 4px; }
.stk-batch .stk-q { width: auto; }
.stk-batch .stk-q-label { margin-right: 4px; }
.stk-nobatch { padding: 6px 0 4px; }
@media (max-width: 759px) {
  .stk-row .stk-q { width: auto; flex: 1 1 30%; justify-content: flex-start; padding-left: 9px; }
  .stk-row .stk-q-label { margin-right: 4px; }
  .stk-row .prc-cell-acts { width: auto; }
}
/* Поступления склада (модуль Этапа 3, Сессия 2): журнал накладных и накладная со строками-партиями. */
.rcp-empty { margin: 12px 16px; }
.rcp-row .prc-cell-name .st { margin-left: 8px; }
.rcp-sum { flex-direction: column; align-items: flex-end; gap: 0; min-width: 120px; font-variant-numeric: tabular-nums; }
.rcp-sum small { color: var(--ink-3); font-size: 11.5px; }
.rcp-back { margin: 0 0 12px; }
.rcp-notes { padding: 0 16px; font-size: 13.5px; }
.rcp-notes p { margin: 10px 0 0; }
.rcp-notes .bad, .rcp-total .bad, .rcp-line-foot.bad { color: var(--coral-ink); }
.rcp .muted { color: var(--ink-3); }
.rcp-head { display: grid; gap: 10px 12px; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); padding: 14px 16px; align-items: end; }
.rcp-head .rcp-sup, .rcp-head .rcp-comment { grid-column: span 2; }
.rcp-sup-row { display: flex; gap: 6px; }
.rcp-sup-row select { flex: 1 1 auto; min-width: 0; }
.rcp-lines { display: grid; gap: 10px; padding: 12px 16px 0; }
.rcp-lines:empty { display: none; }
.rcp-line { border: 1px solid var(--line); border-radius: var(--r); padding: 10px 12px; background: var(--surface); display: grid; gap: 8px; }
.rcp-line.ro { background: var(--surface-3); }
.rcp-line-h { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.rcp-line-h .btn { margin-left: auto; }
.rcp-line-n { font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums; min-width: 1.4em; }
.rcp-line-h .prc-meta { margin: 0; order: 5; flex-basis: 100%; padding-left: calc(1.4em + 10px); }
.rcp-line-grid { display: grid; gap: 8px 10px; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
.rcp-line-grid .field { margin: 0; }
.rcp-head > *, .rcp-line-grid > *, #rcp-doc-view, #rcp-doc { min-width: 0; }
.rcp-head input, .rcp-head select, .rcp-line-grid input, .rcp-line-grid select { width: 100%; min-width: 0; }
.rcp-num input { text-align: right; font-variant-numeric: tabular-nums; }
.rcp-line-foot { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 0; font-size: 13px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.rcp-line-foot b { margin-left: auto; color: var(--ink); }
.rcp-line-facts, .rcp-line-left { margin: 0; font-size: 13px; color: var(--ink-2); }
.rcp-add { display: grid; gap: 8px; padding: 12px 16px 0; }
.rcp-add-none { margin: 0; }
.rcp-total { display: grid; grid-template-columns: auto auto; justify-content: end; gap: 4px 16px; margin: 0; padding: 14px 16px; font-variant-numeric: tabular-nums; }
.rcp-total dt { color: var(--ink-3); font-size: 13px; text-align: right; }
.rcp-total dd { margin: 0; font-weight: 600; text-align: right; }
.rcp-acts { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 0 0 24px; }
.rcp-acts .note { margin: 0; flex: 1 1 260px; }
@media (max-width: 759px) {
  .rcp-head .rcp-sup, .rcp-head .rcp-comment { grid-column: 1 / -1; }
  .rcp-head { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rcp-line-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rcp-sum { align-items: flex-start; min-width: 0; padding-left: 9px; }
  .rcp-acts .btn { flex: 1 1 auto; }
}
/* Подсказки препарата из справочника в расчётном листе и назначениях. */
.drug-sug { display: grid; gap: 2px; margin-top: 4px; }
.drug-sug:empty { display: none; }
.drug-sug button { text-align: left; }
.drug-sug small { color: var(--ink-3); }
/* Движения склада (модуль Этапа 3, Сессия 3): журнал документов, новый документ, акт на печать, отчёт. */
.stk-short { color: var(--coral-ink); }
.stk-batch-acts a { font-size: 12.5px; }
.mov-new { display: flex; flex-wrap: wrap; gap: 8px; margin-left: auto; }
.mov-pad { margin: 10px 16px 0; }
.mov-batches { display: grid; gap: 4px; }
.mov-batches:empty { display: none; }
.mov-expired .drg-name { color: var(--coral-ink); }
/* Перемещение маркированного из Аптеки (Сессия 9 единого запуска): скан кодов упаковок в строке. */
.mov-chz-note { margin-bottom: 10px; }
.mov-codes { display: grid; gap: 6px; margin-top: 10px; }
.mov-codes .note { margin: 0; }
.mov-code-list { display: grid; gap: 4px; margin: 0; padding: 0; list-style: none; }
.mov-code-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 13px; }
.mov-code-list code { overflow-wrap: anywhere; word-break: break-all; }
.mov-code-list .btn { margin-left: auto; }
.mov-tbl-wrap { overflow-x: auto; margin: 12px 16px 0; }
.mov-tbl { display: table; white-space: normal; }
.mov-tbl .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.mov-tbl td.muted { color: var(--ink-3); }
.mov-tbl td.neg { color: var(--coral-ink); }
.mov-tbl td.b { font-weight: 600; }
.mov-tbl tr.mov-short td:first-child { box-shadow: inset 3px 0 0 var(--coral-ink); }
.mov-rep { min-width: 900px; }
/* Отчёт склада: сводка в рублях и печатный журнал (единый запуск склада, Сессия 10) */
.mov-rep-sum { min-width: 900px; }
.mov-rep-sum tfoot td { font-weight: 600; }
.mov-print-only { display: none; }
.mov-journal-head { padding: 0 0 8px; }
.mov-journal-head h2 { margin: 2px 0 4px; font-size: 18px; }
.mov-journal-head p { margin: 0; font-size: 12.5px; }
.mov-act { padding: 18px 16px 20px; }
.mov-act h2 { margin: 4px 0 10px; font-size: 20px; }
.mov-org { margin: 0; font-size: 12.5px; color: var(--ink-3); }
.mov-facts { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; margin: 0; font-size: 14px; }
.mov-facts dt { color: var(--ink-3); }
.mov-facts dd { margin: 0; }
.mov-act .mov-tbl-wrap { margin: 14px 0 0; }
.mov-total { margin: 10px 0 0; font-weight: 600; text-align: right; }
.mov-sign { display: grid; gap: 16px; margin-top: 28px; font-size: 14px; }
.mov-sign p { margin: 0; }
#mov .panel-h .sub { min-width: 0; }
@media (max-width: 759px) {
  .mov-new { margin-left: 0; width: 100%; }
  .mov-new .btn { flex: 1 1 auto; }
}
@media print {
  body:has(#mov) { background: #fff; }
  body:has(#mov) .side, body:has(#mov) .scrim, body:has(#mov) .menu-btn, body:has(#mov) .tb-ticket, body:has(#mov) .topbar,
  body:has(#mov) .mov-noprint, body:has(#mov) dialog { display: none !important; }
  body:has(#mov) .app { display: block; }
  body:has(#mov) .panel { border: 0; box-shadow: none; }
  body:has(#mov) .mov-tbl th, body:has(#mov) .mov-tbl td { padding: 4px 6px; font-size: 10.5px; }
  body:has(#mov) .mov-tbl tr { break-inside: avoid; }
  body:has(#mov) .mov-tbl a, body:has(#mov) .mov-tbl .linkish { color: inherit; text-decoration: none; }
  body:has(#mov) .mov-rep, body:has(#mov) .mov-rep-sum { min-width: 0; }
  body:has(#mov) .mov-print-only { display: block; }
  body:has(#mov) .mov-tbl-wrap { overflow: visible; margin: 6px 0 0; }
  body:has(#mov) .mov-pad { padding-left: 0; padding-right: 0; }
}

/* Инвентаризация (модуль «Склад», Этап 3, Сессия 4): таблица фактов с полями ввода, лист пересчёта. */
.cnt-tbl { min-width: 860px; }
.cnt-tbl input { width: 5.5em; text-align: right; font-variant-numeric: tabular-nums; padding: 4px 6px; }
.cnt-tbl input:disabled { background: var(--surface-2); }
.cnt-tbl tr.cnt-dirty td { background: var(--amber-soft); }
.cnt-tag { display: inline-block; margin-left: 6px; padding: 0 7px; border-radius: 20px; font-size: 11px; font-weight: 600; background: var(--lime-soft); color: var(--lime-ink); }
.cnt-tag-bad { background: var(--coral-soft); color: var(--coral-ink); }
.cnt-when { color: var(--ink-3); }
.cnt-drop { font-size: 12.5px; }
.cnt-head { padding: 12px 0 0; }
.cnt-sum { padding: 12px 0 0; justify-content: start; }
.cnt-sum dt { text-align: left; }
.cnt-check { flex-direction: row; align-items: center; gap: 6px; }
.cnt-sheet td.cnt-blank, .cnt-sheet th.cnt-blank { min-width: 90px; }
.cnt-sheet .cnt-empty-row td { height: 26px; }
#cnt .rcp-acts [hidden] { display: none !important; }
#cnt > div, #cnt .panel { min-width: 0; }
@media print {
  body:has(#cnt) { background: #fff; }
  body:has(#cnt) .side, body:has(#cnt) .scrim, body:has(#cnt) .menu-btn, body:has(#cnt) .tb-ticket, body:has(#cnt) .topbar,
  body:has(#cnt) .mov-noprint, body:has(#cnt) .cnt-draft-only, body:has(#cnt) .cnt-drop, body:has(#cnt) dialog, body:has(#cnt) .lead { display: none !important; }
  body:has(#cnt) .app { display: block; }
  body:has(#cnt) .panel { border: 0; box-shadow: none; }
  body:has(#cnt) .mov-tbl th, body:has(#cnt) .mov-tbl td { padding: 4px 6px; font-size: 10.5px; }
  body:has(#cnt) .mov-tbl tr { break-inside: avoid; }
  body:has(#cnt) .mov-tbl a { color: inherit; text-decoration: none; }
  body:has(#cnt) .cnt-tbl { min-width: 0; }
  body:has(#cnt) .cnt-sheet td { border: 1px solid #999; }
  body:has(#cnt) .cnt-tbl tr.cnt-dirty td { background: none; }
}

/* Склад: к заказу и сроки годности (Этап 3, Сессия 6) */
.sto > * { min-width: 0; }
.sto .chips { padding: 12px 16px 0; }
.sto-sup { margin: 16px 16px 0; }
.sto-sup small { font-weight: 400; color: var(--ink-3); }
.sto-sub { font-size: 12px; color: var(--ink-3); }
.sto-order { min-width: 760px; }
.sto-exp { min-width: 720px; }
/* Итоги по группам и складам (Сессия 4 единого запуска) */
.stk-sum { overflow-x: auto; padding: 4px 16px 12px; }
.stk-sum table { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
.stk-sum th, .stk-sum td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
.stk-sum th:first-child, .stk-sum td:first-child { text-align: left; white-space: normal; }
.stk-sum th { font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); }
.stk-sum tfoot td { font-weight: 600; border-bottom: 0; }
.stk-sum small { color: var(--ink-3); }
.badge.stk-human { background: var(--violet-soft); color: var(--violet); border-color: transparent; }
.mov-rep-group th { text-align: left; padding-top: 14px; font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); }
.stk-alerts { display: grid; gap: 8px; margin: 0 0 14px; }
.stk-alerts:empty { display: none; }
.stk-alert { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; padding: 10px 14px; border-radius: var(--r); background: var(--amber-soft); font-size: 14px; }
.stk-alert.bad { background: var(--coral-soft); }
.stk-alert a { margin-left: auto; }

/* ── Склад: маркировка Честного знака (Этап 3, Сессия 7) ─────────────────────────── */
.rcp-scan { display: grid; gap: 6px; padding: 12px 16px; margin: 0 0 12px; border: 1px dashed var(--lime); border-radius: var(--r); background: var(--lime-soft); }
.rcp-scan .field { margin: 0; }
.rcp-scan input#rcp-scan { width: 100%; min-width: 0; font-family: ui-monospace, Consolas, monospace; }
.rcp-scan .msg { margin: 0; min-height: 1.3em; }
.rcp-bind { display: grid; gap: 8px; padding: 10px 12px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); }
.rcp-bind p { margin: 0; }
.rcp-bind-opts, .rcp-bind-acts { display: flex; flex-wrap: wrap; gap: 6px; }
.rcp-bind-opts[hidden] { display: none; }
.rcp-bind .field { margin: 0; }
.rcp-bind input { width: 100%; min-width: 0; }
.rcp-codes { font-size: 13px; }
.rcp-codes summary { cursor: pointer; color: var(--lime-ink); }
.rcp-codes ol { margin: 6px 0 0; padding-left: 2.2em; display: grid; gap: 2px; }
.rcp-codes li { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 10px; }
.rcp-codes code, .chz-cis { font-family: ui-monospace, Consolas, monospace; font-size: 12px; word-break: break-all; }
.rcp-codes .prc-meta { margin: 0; }
.rcp-codes-none { margin: 0; font-size: 13px; color: var(--amber); }
/* Документы поступления и XML УПД (Сессия 7 единого запуска) */
.rcp-new-acts { margin-left: auto; display: flex; flex-wrap: wrap; gap: 8px; }
.rcp-new-acts .prc-add { margin-left: 0; }
.rcp-files { list-style: none; margin: 0; padding: 10px 16px 0; display: grid; gap: 6px; }
.rcp-files:empty { display: none; }
.rcp-files li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: 13.5px; min-width: 0; }
.rcp-files li a { word-break: break-all; }
.rcp-files .prc-meta { margin: 0; }
.rcp-files li .btn { margin-left: auto; }
#rcp-files-msg { padding: 0 16px; margin: 6px 0 12px; }
label.btn input[type=file] { display: none; }
.rcp-upd-report { margin: 0 16px 14px; padding: 10px 12px; border-radius: var(--r); background: var(--sky-soft); font-size: 13.5px; display: grid; gap: 4px; }
.rcp-upd-report p { margin: 0; }
.rcp-upd-report ul { margin: 0; padding-left: 1.3em; color: var(--amber); }
.rcp-line.unmatched { border-color: var(--amber); background: var(--amber-soft); }
.rcp-upd-name { font-size: 12.5px; color: var(--ink-3); order: 6; flex-basis: 100%; padding-left: calc(1.4em + 10px); margin: 0; }
.rcp-pick { display: grid; gap: 6px; }
.rcp-pick .field { margin: 0; }
.rcp-pick input { width: 100%; min-width: 0; }
.rcp-pick-acts { display: flex; flex-wrap: wrap; gap: 6px; }
#rcp-drug-kassa-q { width: 100%; min-width: 0; }
.chz > * { min-width: 0; }
.chz-find { display: flex; flex-wrap: wrap; align-items: end; gap: 10px; padding: 0 16px; }
.chz-find .chz-q { flex: 1 1 280px; margin: 0; }
.chz-find input { width: 100%; min-width: 0; font-family: ui-monospace, Consolas, monospace; }
#chz-find-msg { padding: 0 16px; }

/* ── Склад: акты вывода из оборота, Честный знак (Этап 3, Сессия 8) ──────────────── */
.chza > div, .chza .panel { min-width: 0; }
.chza .chips { padding: 12px 16px 0; }
.chza-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px 14px; padding: 0 16px; }
.chza-grid .field { margin: 0; }
.chza-grid .chza-wide { grid-column: 1 / -1; }
.chza-grid input, .chza-grid select { width: 100%; min-width: 0; }
.chza-scan { display: grid; margin: 14px 16px 0; padding: 12px 16px; border: 1px dashed var(--lime); border-radius: var(--r); background: var(--lime-soft); }
.chza-scan input { width: 100%; min-width: 0; font-family: ui-monospace, Consolas, monospace; }
#chza-scan-msg, #chza-new-msg { padding: 0 16px; min-height: 1.3em; }
.chza-new .rcp-acts { padding: 0 16px 16px; }
.chza-state .rcp-acts { padding: 0 16px 16px; }
.chza-steps { margin: 0 16px 12px; padding-left: 1.4em; font-size: 14px; display: grid; gap: 3px; }
.chza-h { text-align: center; line-height: 1.3; font-size: 17px !important; letter-spacing: .02em; }
.chza-no { margin: 0 0 12px; text-align: center; font-weight: 600; }
.chza-org { margin-bottom: 8px; }
.chza-sub { margin: 18px 0 6px; font-size: 14.5px; }
.chza-line { margin: 6px 0 0; font-size: 14px; }
.chza-line > span:first-child { color: var(--ink-3); }
.chza-fill { display: inline-block; min-width: 50%; border-bottom: 1px solid var(--line-2); min-height: 1.2em; }
.chza-tbl { min-width: 760px; }
.chza-tbl .chz-cis { font-size: 11px; min-width: 16em; }
.chza-causes { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: 14px; }
.chza-causes li { display: flex; align-items: center; gap: 8px; color: var(--ink-3); }
.chza-causes li.on { color: var(--ink); font-weight: 600; }
.chza-box { position: relative; flex: none; width: 14px; height: 14px; border: 1.5px solid currentColor; border-radius: 2px; }
.chza-causes li.on .chza-box::after {
  content: ""; position: absolute; left: 3px; top: 0; width: 4px; height: 8px;
  border: solid currentColor; border-width: 0 2px 2px 0; transform: rotate(45deg);
}
.chza-sign { margin-top: 8px; gap: 12px; }
.chza-foot { margin: 16px 0 0; font-size: 12px; color: var(--ink-3); }
.chza-foot:empty { display: none; }
@media print {
  html:has(#chza), body:has(#chza) { background: #fff; }
  body:has(#chza) .side, body:has(#chza) .scrim, body:has(#chza) .menu-btn, body:has(#chza) .tb-ticket, body:has(#chza) .topbar,
  body:has(#chza) .mov-noprint, body:has(#chza) dialog, body:has(#chza) .page-h1 { display: none !important; }
  body:has(#chza) .app { display: block; }
  body:has(#chza) .panel { border: 0; box-shadow: none; padding: 0; }
  body:has(#chza) .mov-tbl th, body:has(#chza) .mov-tbl td { padding: 3px 5px; font-size: 10px; border: 1px solid #999; }
  body:has(#chza) .mov-tbl tr { break-inside: avoid; }
  body:has(#chza) .chza-tbl { min-width: 0; }
  /* КИ — одной строкой: 31 знак моноширинным 8px влезает, рваный код с бумаги не перепишешь. */
  body:has(#chza) .chza-tbl .chz-cis { font-size: 8px; min-width: 0; white-space: nowrap; word-break: normal; }
  body:has(#chza) .chza-h { margin-top: 0; font-size: 15px !important; }
  body:has(#chza) .chza-no { margin-bottom: 8px; }
  body:has(#chza) .mov-facts, body:has(#chza) .chza-line, body:has(#chza) .chza-causes { font-size: 12px; }
  body:has(#chza) .chza-sub { margin: 12px 0 4px; font-size: 13px; }
  body:has(#chza) .chza-causes { grid-template-columns: repeat(3, auto); justify-content: start; gap: 3px 22px; }
  body:has(#chza) .chza-sign { margin-top: 4px; gap: 8px; font-size: 12px; }
  body:has(#chza) .chza-foot { margin-top: 10px; }
  body:has(#chza) .mov-tbl-wrap { overflow: visible; }
  body:has(#chza) .chza-sub { break-after: avoid; }
  body:has(#chza) .chza-sign, body:has(#chza) .mov-total { break-inside: avoid; }
}

/* Правила программы лояльности (Этап 2, Сессия 22) — раскрывающаяся панель на «Баллы и оплаты». */
.lrl > summary { cursor: pointer; list-style: none; }
.lrl > summary::-webkit-details-marker { display: none; }
.lrl > summary h2::before { content: ""; display: inline-block; width: 7px; height: 7px; margin: 0 10px 2px 2px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg); transition: transform .15s; }
.lrl[open] > summary h2::before { transform: rotate(45deg); }
#rules { min-width: 0; }
.lrl-form { margin-top: 0; }
/* У fieldset по умолчанию min-width: min-content — таблица уровней раздвигала страницу на телефоне. */
.lrl-form fieldset { min-width: 0; }
.lrl-form .grid3 { grid-template-columns: 1fr; margin: 6px 0 8px; }
@media (min-width: 560px) { .lrl-form .grid3 { grid-template-columns: repeat(3, 1fr); } }
.lrl-levels input { width: 100%; min-width: 72px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; font: inherit; background: var(--surface); }
.lrl-levels input:disabled { color: var(--ink-2); background: var(--surface-3); }
.lrl-levels td:first-child input { min-width: 120px; }
.lrl-chips { display: flex; flex-wrap: wrap; gap: 4px 16px; align-items: center; margin: 6px 0; }
.lrl-chips .note { flex-basis: 100%; margin: 0; }
/* На телефоне уровень — карточкой: название во всю ширину, четыре числа в две колонки с подписями. */
@media (max-width: 559px) {
  .lrl-levels thead { display: none; }
  .lrl-levels, .lrl-levels tbody { display: block; width: 100%; }
  .lrl-levels tr { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; padding: 10px 0; border-bottom: 1px dashed var(--line); }
  .lrl-levels tr:last-child { border-bottom: 0; }
  .lrl-levels td { display: block; padding: 0; border: 0; }
  .lrl-levels td:first-child { grid-column: 1 / -1; }
  .lrl-levels td::before { content: attr(data-label); display: block; margin-bottom: 3px; font-size: 11.5px; color: var(--ink-3); }
  .lrl-levels input, .lrl-levels td:first-child input { min-width: 0; }
}

/* ── Разбор карточек (Этап 2, Сессия 28в): пары клиентов, вид животного, эвтаназия ── */
.rv { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); }
.rv > * { min-width: 0; }
.rv-tabs { margin-bottom: 0; }
.rv-lookup { display: flex; flex-wrap: wrap; align-items: end; gap: 8px 10px; }
.rv-lookup .field { flex: 0 1 240px; }
.rv-found { display: flex; flex-wrap: wrap; gap: 6px; flex: 1 1 100%; }
.rv-found:empty { display: none; }
.rv-pane > .note { margin: 0 0 12px; max-width: 860px; }
.rv-list { display: grid; gap: 12px; }
.rv-pair { margin: 0; padding: 14px 16px; display: grid; gap: 10px; }
.rv-pair-h { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; }
.rv-pair .data-acts { margin-top: 0; }
.rv-cards { display: grid; gap: 10px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 760px) { .rv-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.rv-card { display: grid; gap: 4px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface-3); font-size: 13.5px; min-width: 0; overflow-wrap: anywhere; }
.rv-card-h { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.rv-card .note { font-size: 12.5px; }
.rv-acts { display: flex; flex-wrap: wrap; gap: 6px; }
.rv-tbl td.wrap { white-space: normal; min-width: 160px; }
.rv-pair p { margin: 0; }
.rv-why { font-weight: 600; }
.rv-quote { margin: 0; padding: 8px 12px; border-left: 3px solid var(--line-2); background: var(--surface-3); font-size: 13px; color: var(--ink-2); overflow-wrap: anywhere; }
.rv-euth-acts { align-items: end; }
.rv-date { flex: 0 0 auto; }
.rv-merge { display: grid; gap: 10px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 760px) { .rv-merge { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.rv-side { display: grid; gap: 8px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r); cursor: pointer; min-width: 0; }
.rv-side.on { border-color: var(--lime); background: var(--lime-soft); }
.rv-side > input { justify-self: start; }
.rv-side-t { font-weight: 600; }
.rv-side > input, .rv-side-t { grid-row: 1; }
.rv-side { grid-template-columns: auto minmax(0, 1fr); }
.rv-dl { grid-column: 1 / -1; display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 3px 10px; margin: 0; font-size: 13px; }
.rv-dl dt { color: var(--ink-3); }
.rv-dl dd { margin: 0; overflow-wrap: anywhere; }
.rv-result { display: grid; gap: 6px; }
.rv-result p { margin: 0; }
@media (max-width: 639px) {
  .rv-dl { grid-template-columns: minmax(84px, max-content) minmax(0, 1fr); font-size: 12.5px; }
}
.rv-nw { white-space: nowrap; }
@media (max-width: 639px) {
  .rv-tbl { border: 0; background: none; }
  .rv-tbl thead { display: none; }
  .rv-tbl tbody { display: grid; gap: 10px; }
  .rv-tbl tr { display: grid; gap: 6px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
  .rv-tbl td { display: block; padding: 0; border: 0; white-space: normal; min-width: 0; }
  .rv-tbl td.wrap { min-width: 0; }
  .rv-tbl td::before { content: attr(data-label); display: block; font-size: 11px; color: var(--ink-3); }
}

/* «Мои задачи» по темам и журнал прививок (тикет CRM №14). */
.tk-tabs { margin: 0 0 6px; }
.done-q { padding: 10px 16px 6px; max-width: 640px; }
.vax-block { padding: 14px 0 4px; }
.vax-block + .vax-block { border-top: 1px solid var(--line); }
.vax-block h3 { margin: 0; padding: 0 16px; font-size: 14px; font-weight: 600; color: var(--ink); }
.vax-block > .note { padding: 0 16px; }
.vax-block small.late { color: var(--coral-ink); }
.vax-block a.st { text-decoration: none; }

/* Возраст питомца рядом с датой рождения (правки персонала 26.09.2026, pet-age.js). */
.age-row { display: flex; align-items: center; gap: 8px; color: var(--ink-2); }
.field .age-row input { width: 76px; }
.age-hint { color: var(--ink-3); font-size: 12px; min-height: 0; }
.age-hint:empty { display: none; }

/* Служебные метки «нежелательный» / «агрессивный» (правки персонала 27.09.2026) — в формах карточек. */
.flag-set { margin: 12px 0 0; padding: 8px 12px 10px; border: 1px solid var(--line); border-radius: var(--r); display: flex; flex-wrap: wrap; gap: 4px 18px; min-width: 0; }
.flag-set legend { padding: 0 4px; font-size: 12.5px; color: var(--ink-2); }
.flag-set legend small { color: var(--ink-3); }
.flag-set[hidden] { display: none; }

/* Выбор роли после входа (правки персонала 27.09.2026, views/role.njk). */
.role-list { display: grid; gap: 8px; }
.role-btn {
  display: grid; gap: 2px; width: 100%; padding: 12px 14px; text-align: left; cursor: pointer;
  background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: var(--r); font: inherit;
}
.role-btn b { font-size: 15px; }
.role-btn small { color: var(--ink-3); font-size: 12.5px; }
.role-btn:hover, .role-btn:focus-visible { border-color: var(--ink-3); }
.role-btn.on { border-color: var(--lime); box-shadow: inset 3px 0 0 var(--lime); background: var(--lime-soft); }
.role-all { background: transparent; }

/* Заполненность карточек (правки персонала 27.09.2026): три группы — клиенты, пациенты, приёмы. */
.q-grid { display: grid; gap: 14px; grid-template-columns: 1fr; margin-top: 14px; }
@media (min-width: 1100px) { .q-grid { grid-template-columns: repeat(3, 1fr); } }
.q-grid .panel { min-width: 0; }

/* Склад: продажи Аптеки и сверка с кассой (единый запуск склада, Сессия 10) */
.sls > *, .skc > * { min-width: 0; }
.sls .panel-b .props { padding: 0; }
.sls-items { min-width: 760px; }
.sls-groups { min-width: 620px; }
.sls-groups tfoot td { font-weight: 600; }
.skc-tbl { min-width: 700px; }
.skc .chips { padding-top: 12px; }

/* Рекомендация вне приёма (тикет CRM №45): что дальше — позвонить, в карту, напомнить ботом. */
.dw-ref-modes { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 6px 0 2px; }
.dw-ref-bot { display: grid; gap: 8px; margin: 6px 0; padding: 10px 12px; border: 1px dashed var(--line); border-radius: 8px; }
.dw-ref-bot input[type="date"] { margin-top: 6px; }

/* Кассовая смена (единый запуск, Сессия 12а): раздел «Касса», cash.js. */
.cash-body { padding: 0 16px 14px; display: grid; gap: 8px; }
.cash-body:empty { display: none; }
.cash-body > p { margin: 0; }
.cash-open { display: grid; gap: 10px; max-width: 420px; }
.cash-list { padding: 0 16px 10px; max-height: none; }
.cash-list small { color: var(--ink-3); }
.cash-moves td .dlg-actions { padding: 0; flex-wrap: nowrap; }
.cash-foot { margin: 0; }
