/* Стили контура 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;
  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;
}
.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; }

.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; }

.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); }

.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::backdrop { background: rgba(20, 39, 27, 0.45); }
.dlg-body { display: grid; gap: 12px; padding: 16px 18px 18px; }
.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 { margin: 0; padding: 8px 12px 10px; border: 1px solid var(--line); border-radius: var(--r); }
.dlg legend { padding: 0 4px; font-size: 12.5px; color: var(--ink-2); }
.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; }

/* Чипы — как фильтры в демо. */
.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; }

.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); }
.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; }
@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%; }

/* «Расписание клиники»: время × специалисты, слоты как в таблице демо. */
.cal { overflow-x: auto; }
.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; }

.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; }

/* ── Остаток рабочего места (Сессия 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); }

.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; }
.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; }

.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; }
.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; }
@media (max-width: 519px) {
  .task:has(.go.row) { flex-wrap: wrap; }
  .task .go.row { width: 100%; }
  .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 { grid-column: 1 / -1; }
.dlg 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); }
.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; }
.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; }
.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; }
.reg-row { cursor: pointer; }
.reg-row td small { display: block; }
.reg-card { color: inherit; text-decoration: none; display: block; }
@media (max-width: 559px) { .reg-filters .reg-q { grid-column: 1 / -1; } .reg-export { margin-left: 0; width: 100%; justify-content: center; } }

/* ── Записи 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; }

/* Рабочее место: «Расписание клиники» в левой колонке под заявками (11.09.2026). До 1100px —
   одна колонка, расписание последним, как было. */
.cols-2-1 > .stack { display: grid; gap: 20px; margin-bottom: 20px; align-content: start; }
.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); } }
