:root {
  --side-bg: #1f2633;
  --side-ink: #c3cad6;
  --side-muted: #7f899b;
  --side-hover: #273041;
  --side-active: #2f3a4d;

  --bg: #f4f5f7;
  --panel: #ffffff;
  --ink: #1d2330;
  --muted: #6b7385;
  --line: #e2e5ea;
  --line-soft: #eef0f3;
  --head: #f8f9fb;

  --accent: #3565c9;
  --accent-hover: #2c56ad;
  --accent-soft: #ebf0fa;
  --ok: #2d7a50;
  --ok-soft: #e7f3ec;
  --warn: #9a6a12;
  --warn-soft: #fbf3e2;
  --danger: #b83232;
  --danger-soft: #fbeaea;

  --radius: 8px;
  --font: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;

  /* окно переписки chat-kit — в тех же цветах */
  --ck-accent: #3565c9;
  --ck-font: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
/* место под полосу прокрутки есть всегда — страница не сдвигается, когда полоса появляется или исчезает */
html { scrollbar-gutter: stable; }
body { font: 14px/1.5 var(--font); color: var(--ink); background: var(--bg); }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
svg.i { width: 17px; height: 17px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

/* ——— каркас: меню слева, данные справа ——— */
.layout { display: flex; min-height: 100vh; }
.side { position: fixed; inset: 0 auto 0 0; width: 236px; z-index: 30; display: flex; flex-direction: column; background: var(--side-bg); color: var(--side-ink); }
.main { flex: 1; min-width: 0; margin-left: 236px; display: flex; flex-direction: column; }

.brand { display: flex; align-items: center; gap: 10px; padding: 16px 18px 14px; border-bottom: 1px solid rgba(255, 255, 255, .06); }
.brand .mark { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; background: #2f3a4d; color: #fff; }
.brand b { display: block; color: #fff; font-size: 14px; line-height: 1.25; font-weight: 600; }
.brand small { color: var(--side-muted); font-size: 12px; }

.nav { flex: 1; overflow: auto; padding: 8px 10px 16px; }
.nav .grp { margin: 14px 8px 4px; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--side-muted); }
.nav a { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 6px; color: var(--side-ink); text-decoration: none; }
.nav a:hover { background: var(--side-hover); color: #fff; }
.nav a.on { background: var(--side-active); color: #fff; }
.nav a.on svg { color: #8fb0f0; }
.nav .badge { margin-left: auto; min-width: 20px; padding: 0 6px; border-radius: 10px; background: #3a4558; color: #fff; font-size: 11px; line-height: 18px; text-align: center; }

.who { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-top: 1px solid rgba(255, 255, 255, .06); font-size: 13px; }
.who .ava { width: 30px; height: 30px; font-size: 12px; background: #3a4558; }
.who-t { flex: 1; min-width: 0; }
.who-t b { display: block; overflow: hidden; color: #fff; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.who-b { flex: none; display: grid; place-items: center; width: 28px; height: 28px; padding: 0; border: 0; border-radius: 6px; background: transparent; color: var(--side-muted); cursor: pointer; }
.who-b:hover { background: var(--side-hover); color: #fff; }
.who-b .i { width: 16px; height: 16px; }
.who small { display: block; color: var(--side-muted); font-size: 11px; }

.mbar { display: none; }
.scrim { display: none; }

/* ——— страница ——— */
/* Списки и карточки занимают всю ширину справа от меню при любом масштабе браузера — края у всех страниц одни */
.page { padding: 22px 28px 48px; width: 100%; }
.back { display: inline-flex; align-items: center; gap: 2px; margin: 0 0 6px -6px; padding: 3px 8px 3px 2px; border-radius: 6px; font-size: 14px; font-weight: 500; color: var(--accent); text-decoration: none; }
.back .i { width: 18px; height: 18px; }
.back:hover { background: var(--accent-soft); text-decoration: none; }
.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head h1 { margin: 0; font-size: 21px; font-weight: 600; }
.page-head .sub { color: var(--muted); font-size: 13px; }
.spacer { flex: 1; }

.btn { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 14px; border: 1px solid #d3d8e0; border-radius: 6px; background: #fff; cursor: pointer; white-space: nowrap; text-decoration: none; color: var(--ink); }
.btn:hover { background: #f7f8fa; text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-hover); }
.btn.danger { border-color: transparent; background: none; color: var(--danger); }
.btn.danger:hover { background: var(--danger-soft); }
.btn.small { height: 28px; padding: 0 10px; font-size: 13px; }
.btn.link { border-color: transparent; background: none; color: var(--accent); padding: 0 6px; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.card + .card { margin-top: 16px; }
.card-h { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.card-h h2 { margin: 0; font-size: 15px; font-weight: 600; }

.toolbar { display: flex; gap: 8px; flex-wrap: wrap; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.toolbar input, .toolbar select { height: 32px; padding: 0 10px; border: 1px solid #d3d8e0; border-radius: 6px; background: #fff; }
.toolbar input[type=search] { flex: 1; min-width: 180px; max-width: 340px; }

/* Ширина колонок задана заранее — не «дышит» от текста, поиска и фильтров */
table.grid { width: 100%; border-collapse: collapse; table-layout: fixed; }
.grid .c-num { width: 120px; }
.grid .c-st { width: 150px; }
.grid .c-s { width: 140px; }
.grid .c-m { width: 190px; }
.grid .c-l { width: 28%; }
.grid .c-act { width: 110px; }
.grid .show-sm { display: none; }
.grid th { padding: 9px 16px; background: var(--head); border-bottom: 1px solid var(--line); text-align: left; font-size: 12.5px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.grid td { padding: 10px 16px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.grid tbody tr:last-child td { border-bottom: 0; }
.grid tbody tr[data-href] { cursor: pointer; }
.grid tbody tr[data-href]:hover td { background: #f8fafd; }
.grid .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.grid .t { font-weight: 500; }
.grid .nw { white-space: nowrap; }
.grid .s { font-size: 12.5px; color: var(--muted); }
.grid tr.group td { padding: 8px 16px; background: var(--head); font-size: 12.5px; font-weight: 600; color: var(--muted); }
/* подпись раздела и «Ничего не найдено» стоят в первой ячейке и могут быть шире её */
.grid tr.group td:first-child, .grid tr.none td:first-child { overflow: visible; white-space: nowrap; }
.grid tr.none td { padding: 28px 16px; color: var(--muted); border-bottom: 0; }
.grid .off .t { color: var(--muted); }
.empty { padding: 32px 16px; text-align: center; color: var(--muted); }

.tag { display: inline-block; padding: 0 8px; border-radius: 4px; font-size: 12px; line-height: 20px; white-space: nowrap; background: #eef0f3; color: var(--muted); }
.tag.ok { background: var(--ok-soft); color: var(--ok); }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.tag.danger { background: var(--danger-soft); color: var(--danger); }
.tag.info { background: var(--accent-soft); color: var(--accent); }

.ava { width: 32px; height: 32px; border-radius: 50%; display: inline-grid; place-items: center; flex: none; background: #e3e7ee; color: #4a5568; font-size: 12px; font-weight: 600; }
.person { display: flex; gap: 10px; align-items: center; }

/* ——— главная ——— */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.stats .card + .card { margin-top: 0; }
.stat { padding: 14px 16px; }
.stat b { display: block; font-size: 24px; font-weight: 600; }
.stat span { color: var(--muted); font-size: 13px; }
.stat a { color: inherit; text-decoration: none; }
.cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
.cols .card + .card { margin-top: 0; }
.rows { list-style: none; margin: 0; padding: 0; }
.rows li { display: flex; gap: 10px; align-items: baseline; padding: 10px 16px; border-bottom: 1px solid var(--line-soft); }
.rows li:last-child { border-bottom: 0; }
.rows time { color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.rows .what { flex: 1; min-width: 0; }

/* ——— форма ——— */
.form { padding: 4px 0; }
.fs { padding: 14px 20px 6px; border-bottom: 1px solid var(--line-soft); }
.fs:last-child { border-bottom: 0; }
.fs h3 { margin: 0 0 10px; font-size: 13px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.row { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 14px; margin-bottom: 12px; align-items: start; }
.row > label { padding-top: 7px; font-size: 13.5px; }
.row > label small { display: block; color: var(--muted); font-size: 12px; line-height: 1.35; margin-top: 2px; }
.f-in, .row input[type=text], .row input[type=number], .row input[type=date], .row select, .row textarea {
  width: 100%; height: 34px; padding: 0 10px; border: 1px solid #d3d8e0; border-radius: 6px; background: #fff; }
.row input[type=number] { max-width: 180px; }
.row input[type=date] { max-width: 200px; }
.row textarea { height: auto; min-height: 60px; padding: 7px 10px; resize: vertical; }
.row input:focus, .row select:focus, .row textarea:focus, .toolbar input:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.row :disabled { background: #f5f6f8; color: var(--muted); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.two > div > span { display: block; font-size: 11.5px; color: var(--muted); margin-bottom: 2px; }
.checks { display: flex; flex-wrap: wrap; gap: 6px 16px; padding-top: 7px; }
.checks label { display: inline-flex; gap: 6px; align-items: center; cursor: pointer; }
.week { display: grid; grid-template-columns: 90px repeat(7, minmax(0, 1fr)); gap: 4px; align-items: center; font-size: 12.5px; }
.week .h { text-align: center; color: var(--muted); }
.week input { width: 100%; height: 30px; padding: 0 4px; border: 1px solid #d3d8e0; border-radius: 5px; text-align: center; font-size: 12.5px; }
.form-foot { position: sticky; bottom: 0; display: flex; gap: 8px; align-items: center; padding: 12px 20px; border-top: 1px solid var(--line); background: #fff; border-radius: 0 0 var(--radius) var(--radius); }
.form-foot .note { color: var(--muted); font-size: 12.5px; }
.err { margin: 12px 20px 0; padding: 9px 12px; border-radius: 6px; background: var(--danger-soft); color: var(--danger); }
.ro-note { margin: 12px 20px 0; padding: 9px 12px; border-radius: 6px; background: var(--head); color: var(--muted); font-size: 13px; }

/* ——— проверка бота ——— */
.botbox { max-width: 820px; }
.thread { height: calc(100vh - 330px); min-height: 300px; overflow: auto; padding: 16px; display: flex; flex-direction: column; gap: 8px; background: #f7f8fa; }
.bub { max-width: 82%; padding: 8px 12px; border-radius: 10px; white-space: pre-wrap; word-break: break-word; }
.bub.me { align-self: flex-end; background: var(--accent); color: #fff; }
.bub.bot, .bub.op { align-self: flex-start; background: #fff; border: 1px solid var(--line); }
.bub .who { display: block; font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.bub .src { display: block; margin-top: 6px; font-size: 12px; color: var(--muted); }
.sysmsg { align-self: center; font-size: 12.5px; color: var(--muted); text-align: center; }
.quick { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 16px; border-top: 1px solid var(--line); }
.quick button { padding: 3px 10px; border: 1px solid #d3d8e0; border-radius: 14px; background: #fff; font-size: 12.5px; cursor: pointer; }
.quick button:hover { border-color: var(--accent); color: var(--accent); }
.say { display: flex; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); }
.say input { flex: 1; height: 34px; padding: 0 10px; border: 1px solid #d3d8e0; border-radius: 6px; }

/* ——— переписка (chat-kit) ——— */
#chatwrap { flex: 1; display: flex; min-height: 0; height: 100vh; }
#chatwrap[hidden] { display: none; }
#chatroot { flex: 1; min-width: 0; min-height: 0; display: flex; }
#chatroot > * { flex: 1; min-width: 0; }
.chat-fail { padding: 24px; color: var(--muted); }

/* ——— окна ——— */
.modal-bg { position: fixed; inset: 0; z-index: 60; display: flex; align-items: flex-start; justify-content: center; padding: 32px 16px; background: rgba(20, 25, 35, .4); }
.modal-bg > .modal:not(.wide) { margin-top: 48px; }
.modal { width: min(440px, 100%); background: #fff; border-radius: 10px; box-shadow: 0 18px 50px rgba(0, 0, 0, .2); }
.modal p { margin: 0; padding: 18px 20px; }
.modal.wide { width: min(780px, 100%); max-height: calc(100vh - 64px); display: flex; flex-direction: column; }
.modal-h { display: flex; align-items: center; gap: 10px; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.modal-h h3 { margin: 0; flex: 1; font-size: 16px; font-weight: 600; }
.modal-body { flex: 1; min-height: 0; overflow: auto; }
.modal.wide .foot { flex: none; }
.modal .foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--line); }
.toast { position: fixed; right: 20px; bottom: 20px; z-index: 70; max-width: calc(100% - 40px); padding: 10px 14px; border-radius: 8px; background: #263041; color: #fff; font-size: 13px; box-shadow: 0 8px 24px rgba(0, 0, 0, .18); }

/* ——— узкие экраны: меню выезжает слева ——— */
@media (max-width: 1100px) {
  .grid .hide-md { display: none; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cols { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
  .side { transform: translateX(-100%); transition: transform .2s; }
  .menu-open .side { transform: none; }
  .menu-open .scrim { display: block; position: fixed; inset: 0; z-index: 25; background: rgba(20, 25, 35, .4); }
  .main { margin-left: 0; }
  .mbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px; height: 50px; padding: 0 16px; background: var(--side-bg); color: #fff; }
  .mbar button { display: grid; place-items: center; width: 34px; height: 34px; border: 0; border-radius: 6px; background: transparent; color: #fff; cursor: pointer; }
  .page { padding: 16px 16px 40px; }
  #chatwrap { height: calc(100vh - 50px); }
  .row { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .row > label { padding-top: 0; }
  .grid th, .grid td { padding-left: 12px; padding-right: 12px; }
  .grid .hide-sm { display: none; }
  .grid .show-sm { display: block; }
  .grid td { overflow-wrap: anywhere; }
  .grid .c-num { width: 84px; }
  .grid .c-st { width: 118px; }
  .grid .c-s { width: 100px; }
  .grid .c-m { width: 130px; }
  .grid .c-act { width: 92px; }
  .form-foot { padding: 12px 16px; }
  .fs { padding: 14px 16px 6px; }
}
@media (max-width: 520px) {
  .two { grid-template-columns: minmax(0, 1fr); }
  .stats { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
  .week { grid-template-columns: 54px repeat(7, minmax(0, 1fr)); gap: 2px; }
  .week input { padding: 0; font-size: 11px; }
}

/* ——— элементы форм: современный вид во всей панели (окно переписки chat-kit не трогаем) ——— */
:root { --field-line: #d0d5dd; --field-h: 36px; --ring: 0 0 0 3px rgba(53, 101, 201, .16); }
:where(#view, #modal) :is(input[type=text], input[type=number], input[type=search], input[type=tel], input[type=email], input[type=password], select, textarea),
.say input {
  height: var(--field-h); padding: 0 12px; border: 1px solid var(--field-line); border-radius: 8px; background-color: #fff;
  font-size: 14px; transition: border-color .15s, box-shadow .15s;
}
:where(#view, #modal) textarea { height: auto; min-height: 72px; padding: 8px 12px; line-height: 1.45; }
:where(#view, #modal) :is(input, select, textarea):hover:not(:disabled) { border-color: #b4bbc6; }
:where(#view, #modal) :is(input, select, textarea):focus-visible, .say input:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
:where(#view, #modal) :is(input, select, textarea):disabled { background-color: #f5f6f8; color: var(--muted); }
input[type=number]::-webkit-inner-spin-button, input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input[type=number] { -moz-appearance: textfield; }
:where(#view, #modal) select {
  appearance: none; padding-right: 34px; cursor: pointer;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7385' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 12px center;
}
.toolbar input, .toolbar select { height: 36px; }

/* флажок и кружок */
:where(#view, #modal) :is(input[type=checkbox]:not([role=switch]), input[type=radio]) {
  appearance: none; flex: none; width: 18px; height: 18px; margin: 0; display: inline-grid; place-content: center;
  border: 1.5px solid #b9c0cc; border-radius: 5px; background: #fff; cursor: pointer; transition: background .15s, border-color .15s, box-shadow .15s;
}
:where(#view, #modal) input[type=radio] { border-radius: 50%; }
:where(#view, #modal) input[type=checkbox]:not([role=switch])::before {
  content: ""; width: 10px; height: 10px; transform: scale(0); transition: transform .12s; background: #fff;
  clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
}
:where(#view, #modal) input[type=checkbox]:not([role=switch]):is(:checked, :indeterminate) { background: var(--accent); border-color: var(--accent); }
:where(#view, #modal) input[type=checkbox]:not([role=switch]):checked::before { transform: scale(1); }
:where(#view, #modal) input[type=checkbox]:indeterminate::before { transform: scale(1); clip-path: none; width: 9px; height: 2px; border-radius: 1px; }
:where(#view, #modal) input[type=radio]::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); transform: scale(0); transition: transform .12s; }
:where(#view, #modal) input[type=radio]:checked { border-color: var(--accent); }
:where(#view, #modal) input[type=radio]:checked::before { transform: scale(1); }
:where(#view, #modal) :is(input[type=checkbox], input[type=radio]):hover:not(:disabled) { border-color: var(--accent); }
:where(#view, #modal) :is(input[type=checkbox], input[type=radio]):focus-visible { outline: none; box-shadow: var(--ring); }
:where(#view, #modal) :is(input[type=checkbox], input[type=radio]):disabled { opacity: .5; cursor: default; }

/* переключатель «да / нет» */
.toggle { position: relative; display: inline-flex; align-items: center; gap: 10px; padding-top: 7px; cursor: pointer; user-select: none; }
.toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.toggle .track { position: relative; flex: none; width: 36px; height: 20px; border-radius: 10px; background: #cfd5de; transition: background .18s; }
.toggle .track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(16, 24, 40, .25); transition: transform .18s; }
.toggle input:checked + .track { background: var(--accent); }
.toggle input:checked + .track::after { transform: translateX(16px); }
.toggle input:focus-visible + .track { box-shadow: var(--ring); }
.toggle:has(input:disabled) { cursor: default; color: var(--muted); }
.toggle input:disabled + .track { opacity: .5; }

/* выбор нескольких: «чипы» */
.chips { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 2px; }
.chip { position: relative; display: inline-flex; align-items: center; height: 32px; padding: 0 12px; border: 1px solid var(--field-line); border-radius: 16px; background: #fff; cursor: pointer; user-select: none; font-size: 13.5px; transition: background .15s, border-color .15s, color .15s; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span::before { content: ""; display: inline-block; width: 0; height: 10px; margin-right: 0; background: var(--accent); transition: width .15s, margin .15s; clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%); }
.chip:hover { border-color: #b4bbc6; }
.chip:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 500; }
.chip:has(input:checked) span::before { width: 11px; margin-right: 6px; }
.chip:has(input:focus-visible) { box-shadow: var(--ring); }
.chip:has(input:disabled) { opacity: .55; cursor: default; }

/* выбор одного из двух-трёх: сегменты */
.segmented { display: inline-flex; gap: 2px; padding: 3px; border-radius: 9px; background: #eef0f3; }
.segmented label { position: relative; cursor: pointer; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span { display: block; padding: 5px 14px; border-radius: 7px; font-size: 13.5px; color: var(--muted); transition: background .15s, color .15s; }
.segmented input:checked + span { background: #fff; color: var(--ink); font-weight: 500; box-shadow: 0 1px 3px rgba(16, 24, 40, .12); }
.segmented input:focus-visible + span { box-shadow: var(--ring); }

/* календарь */
.dp { position: relative; display: inline-flex; align-items: center; width: 100%; max-width: 220px; }
.dp-btn { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; height: var(--field-h); padding: 0 12px; border: 1px solid var(--field-line); border-radius: 8px; background: #fff; cursor: pointer; text-align: left; transition: border-color .15s, box-shadow .15s; }
.dp-btn:hover:not(:disabled) { border-color: #b4bbc6; }
.dp-btn:focus-visible { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
.dp-btn.empty span { color: #9aa1ad; }
.dp-btn .i { color: var(--muted); }
.dp-btn:disabled { background: #f5f6f8; color: var(--muted); cursor: default; }
.dp-x { position: absolute; right: 36px; top: 50%; transform: translateY(-50%); width: 20px; height: 20px; padding: 0; border: 0; border-radius: 50%; background: #eef0f3; color: var(--muted); cursor: pointer; font-size: 14px; line-height: 20px; }
.dp-x:hover { background: #e2e5ea; color: var(--ink); }
.dp-pop { position: absolute; z-index: 80; width: 280px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff; box-shadow: 0 12px 32px rgba(16, 24, 40, .16); font-size: 13px; }
.dp-h { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.dp-h b { font-size: 14px; font-weight: 600; }
.dp-h button { width: 32px; height: 32px; border: 0; border-radius: 8px; background: none; color: var(--muted); font-size: 20px; line-height: 1; cursor: pointer; }
.dp-h button:hover { background: #f0f2f5; color: var(--ink); }
.dp-wd, .dp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; }
.dp-wd span { padding: 4px 0; font-size: 11.5px; color: #9aa1ad; }
.dp-grid button { height: 34px; border: 0; border-radius: 8px; background: none; font-size: 13px; cursor: pointer; }
.dp-grid button:hover { background: var(--accent-soft); color: var(--accent); }
.dp-grid button.wk { color: #c0504d; }
.dp-grid button.today { box-shadow: inset 0 0 0 1.5px var(--accent); font-weight: 600; }
.dp-grid button.sel { background: var(--accent); color: #fff; font-weight: 600; }
.dp-f { display: flex; justify-content: space-between; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line-soft); }
.dp-f button { padding: 4px 8px; border: 0; border-radius: 6px; background: none; color: var(--accent); cursor: pointer; }
.dp-f button:hover { background: var(--accent-soft); }

/* массовые действия */
.grid .c-chk { width: 48px; padding-right: 0; }
.chk { display: flex; align-items: center; justify-content: center; margin: -10px -2px -10px -8px; padding: 10px 2px 10px 8px; cursor: pointer; }
.bulkbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 16px; border-bottom: 1px solid #d6e0f5; background: var(--accent-soft); }
.bulkbar[hidden] { display: none; }
.bulkbar b { font-weight: 600; }
.bulkbar .s { color: var(--muted); font-size: 12.5px; }
.bulkbar .acts { display: flex; gap: 6px; flex-wrap: wrap; }
.bulkbar .btn.small { background: #fff; }
.bulkbar .btn.danger { border-color: #f0caca; }
.btn .i { width: 16px; height: 16px; }
.btn:disabled { opacity: .55; cursor: default; }

/* окна загрузки Excel и PDF */
.lead { margin: 0 0 12px; color: var(--muted); font-size: 13.5px; line-height: 1.5; }
.drop { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 30px 16px; border: 1.5px dashed #c3c9d4; border-radius: 12px; background: #fafbfc; text-align: center; cursor: pointer; transition: border-color .15s, background .15s; }
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.drop b { color: var(--accent); font-weight: 600; }
.drop span { color: var(--muted); font-size: 12.5px; }
.sum { display: flex; flex-wrap: wrap; gap: 8px; }
.sum .tag { padding: 0 10px; font-size: 13px; line-height: 26px; }
table.mini { width: 100%; border-collapse: collapse; font-size: 13px; }
.mini th { position: sticky; top: 0; padding: 6px 8px; border-bottom: 1px solid var(--line); background: var(--head); text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); }
.mini td { padding: 7px 8px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.mini .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.mini tr.warnrow td { background: #fffaeb; }
.mini tr.errrow td { background: #fdf2f2; }
.checks.col { flex-direction: column; gap: 8px; padding-top: 0; }
.opt { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; transition: border-color .15s, background .15s; }
.opt:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.opt input { margin-top: 2px !important; }
.opt b { display: block; font-weight: 500; }
.opt small { display: block; color: var(--muted); font-size: 12.5px; }
.pdf-head { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fafbfc; }
.pdf-head img { max-width: 120px; max-height: 36px; }
.pdf-head b { display: block; }
.pdf-head small, .nologo { color: var(--muted); font-size: 12.5px; }

/* логотип клиники */
.logo-field { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.logo-prev { display: grid; place-items: center; width: 180px; height: 72px; border: 1px dashed #c3c9d4; border-radius: 10px; background: repeating-conic-gradient(#f2f3f5 0% 25%, #fff 0% 50%) 50% / 16px 16px; }
.logo-prev img { max-width: 160px; max-height: 60px; }
.logo-prev span { color: var(--muted); font-size: 12.5px; }
.brand .mark.has-logo { padding: 3px; background: #fff; }
.brand .mark img { max-width: 100%; max-height: 100%; object-fit: contain; }

/* пометки графика по филиалам в карточке врача */
.warnline { margin-top: 3px; color: var(--warn); font-size: 12.5px; }

/* сворачиваемое меню: кнопка в шапке меню; свёрнутое — только значки */
.side, .main { transition: width .2s ease, margin-left .2s ease; }
.brand-t { flex: 1; min-width: 0; }
.brand-t b, .brand-t small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-toggle { flex: none; display: grid; place-items: center; width: 28px; height: 28px; padding: 0; border: 0; border-radius: 6px; background: transparent; color: var(--side-muted); cursor: pointer; }
.side-toggle:hover { background: var(--side-hover); color: #fff; }
.side-toggle .i { width: 16px; height: 16px; transition: transform .2s; }
@media (min-width: 861px) {
  body.side-mini .side { width: 68px; }
  body.side-mini .main { margin-left: 68px; }
  body.side-mini .brand { flex-direction: column; gap: 10px; padding: 14px 0 12px; }
  body.side-mini .brand-t { display: none; }
  body.side-mini .side-toggle .i { transform: rotate(180deg); }
  body.side-mini .nav { padding: 8px 10px 16px; overflow-x: hidden; }
  body.side-mini .nav .grp { height: 1px; margin: 10px 4px; overflow: hidden; background: rgba(255, 255, 255, .08); font-size: 0; }
  body.side-mini .nav a { position: relative; justify-content: center; padding: 9px 0; }
  body.side-mini .nav a span:not(.badge) { display: none; }
  body.side-mini .nav .badge { position: absolute; top: 2px; right: 4px; min-width: 16px; padding: 0 4px; font-size: 10px; line-height: 16px; }
  body.side-mini .who { justify-content: center; padding: 12px 0; }
  body.side-mini .who { flex-direction: column; gap: 6px; }
  body.side-mini .who > div { display: none; }
}

/* вкладки «Настройки» */
.subtabs { display: flex; gap: 4px; margin: -4px 0 16px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.subtabs a { padding: 9px 14px; border-bottom: 2px solid transparent; margin-bottom: -1px; color: var(--muted); text-decoration: none; white-space: nowrap; }
.subtabs a:hover { color: var(--ink); text-decoration: none; }
.subtabs a.on { color: var(--accent); border-color: var(--accent); font-weight: 600; }
.panel-note { padding: 10px 16px; border-bottom: 1px solid var(--line-soft); background: var(--head); color: var(--muted); font-size: 13px; }
.plain { padding-top: 7px; }

/* таблица прав роли */
.mx-wrap { overflow-x: auto; margin-bottom: 8px; }
table.matrix { width: 100%; min-width: 560px; border-collapse: collapse; }
.matrix th { padding: 8px 10px; border-bottom: 1px solid var(--line); background: var(--head); font-size: 12.5px; font-weight: 600; color: var(--muted); text-align: center; }
.matrix th:first-child { text-align: left; }
.matrix td { padding: 9px 10px; border-bottom: 1px solid var(--line-soft); text-align: center; vertical-align: middle; }
.matrix td:first-child { text-align: left; }
.matrix td b { display: block; font-weight: 500; }
.matrix td small { display: block; color: var(--muted); font-size: 12px; }
.matrix td.na { color: #c3c9d4; }
.matrix tbody tr:hover td { background: #f8fafd; }
.mx-col { display: inline-flex; flex-direction: column; align-items: center; gap: 4px; cursor: pointer; }

@media (max-width: 860px) {
  .side-toggle { display: none; } /* на телефоне меню и так выезжает по кнопке */
  .dp { max-width: none; }
  .bulkbar { padding: 10px 12px; }
  /* кнопки действий — одной строкой с прокруткой, а не стопкой в три ряда */
  .bulkbar .acts { order: 3; width: 100%; flex-wrap: nowrap; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
  .bulkbar .acts .btn { flex: none; }
  .grid .c-chk { width: 40px; }
  .grid .c-num { width: 72px; }
  .grid .c-st { width: 108px; }
  .grid td .tag { padding: 0 6px; font-size: 11px; }
}

/* стрелки порядка разделов */
.btn.small.icon { width: 28px; padding: 0; justify-content: center; }
.btn.small.icon + .btn.small.icon { margin-left: 4px; }
.grid tr.group .s { font-weight: 400; margin-left: 6px; }
/* первые шаги на главной */
.steps { list-style: none; margin: 0; padding: 4px 0; counter-reset: st; }
.steps li { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-top: 1px solid var(--line-soft); }
.steps li:first-child { border-top: 0; }
.steps li::before { counter-increment: st; content: counter(st); flex: none; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 600; background: var(--head); color: var(--muted); border: 1px solid var(--line); }
.steps li.done::before { content: "✓"; background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.steps li .what { flex: 1; min-width: 0; }
.steps li .what small { display: block; color: var(--muted); font-size: 12.5px; }
.steps li.done .what b { color: var(--muted); font-weight: 500; }
.card.first { margin-bottom: 16px; }
/* узкий экран: длинные названия разделов и кнопки шапок не раздвигают страницу */
.toolbar select { max-width: 100%; min-width: 0; text-overflow: ellipsis; }
.card-h { flex-wrap: wrap; }
/* название раздела идёт поверх соседних пустых ячеек, но не шире экрана */
.grid tr.group .glabel { display: inline-block; max-width: calc(100vw - 72px); overflow: hidden; text-overflow: ellipsis; vertical-align: top; }

/* ——— умный поиск ——— */
mark { background: #fff0b3; color: inherit; border-radius: 2px; padding: 0 1px; }
.gs-trigger { display: flex; align-items: center; gap: 8px; margin: 10px 10px 0; padding: 7px 10px; border: 1px solid rgba(255, 255, 255, .08); border-radius: 6px;
  background: rgba(255, 255, 255, .04); color: var(--side-muted); font: inherit; font-size: 13px; text-align: left; cursor: pointer; }
.gs-trigger:hover { background: var(--side-hover); color: #fff; }
.gs-trigger span { flex: 1; }
.gs-trigger kbd, .gs-in kbd { padding: 1px 5px; border: 1px solid rgba(255, 255, 255, .14); border-radius: 4px; font-family: inherit; font-size: 11px; line-height: 16px; color: var(--side-muted); }
.mbar .mbar-search { margin-left: auto; }
@media (min-width: 901px) {
  body.side-mini .gs-trigger { justify-content: center; margin: 10px 10px 0; padding: 8px 0; }
  body.side-mini .gs-trigger span, body.side-mini .gs-trigger kbd { display: none; }
}
.gs { position: fixed; inset: 0; z-index: 60; }
.gs-bg { position: absolute; inset: 0; background: rgba(15, 20, 30, .28); }
.gs-box { position: absolute; top: 12px; display: flex; flex-direction: column; max-height: calc(100vh - 24px); background: #fff; border-radius: 10px;
  box-shadow: 0 18px 50px rgba(15, 20, 30, .28); overflow: hidden; }
.gs-in { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.gs-in .i { color: var(--muted); flex: none; }
.gs-in input { flex: 1; min-width: 0; height: 32px; border: 0; outline: 0; font: inherit; font-size: 15px; background: transparent; }
.gs-in input::-webkit-search-cancel-button { display: none; }
.gs-in kbd { color: var(--muted); border-color: var(--line); }
.gs-list { overflow: auto; padding: 4px 0 8px; }
.gs-h { padding: 10px 16px 4px; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.gs-h span { letter-spacing: 0; margin-left: 4px; }
.gs-item { display: flex; flex-direction: column; gap: 1px; width: 100%; padding: 7px 16px; border: 0; background: none; font: inherit; text-align: left; cursor: pointer; color: var(--ink); }
.gs-item:hover { background: var(--head); }
.gs-item.on { background: var(--accent-soft); }
.gs-t { font-size: 14px; }
.gs-s { font-size: 12.5px; color: var(--muted); }
.gs-more .gs-t { color: var(--accent); font-size: 13px; }
.gs-tip { padding: 14px 16px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.gs-ex { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.gs-ex button { padding: 2px 10px; border: 1px solid var(--line); border-radius: 12px; background: #fff; font: inherit; font-size: 12.5px; color: var(--ink); cursor: pointer; }
.gs-ex button:hover { border-color: var(--accent); color: var(--accent); }

/* ——— разделы списков: свернуть / развернуть ——— */
.grid tr.group[data-grp] { cursor: pointer; }
.grid tr.group[data-grp]:hover td { background: #eef1f5; }
.grid tr.group td.gcell { overflow: visible; white-space: nowrap; }
.gtoggle { display: inline-flex; align-items: center; gap: 6px; padding: 0; border: 0; background: none; font: inherit; color: inherit; cursor: pointer; }
.gtoggle:disabled { cursor: default; }
.gtoggle .chev { width: 14px; height: 14px; flex: none; transition: transform .15s; }
.grid tr.group.open .chev { transform: rotate(90deg); }
.gtoggle:disabled .chev { opacity: .35; }
.toolbar .grp-all { margin-left: auto; height: 32px; }
/* узкий экран: название раздела — в строку поверх пустых ячеек, но с пределом в пикселях
   (не в vw: на телефоне ширина страницы растёт под содержимое, и предел в vw её раздвигает) */
@media (max-width: 860px) {
  .grid tr.group .glabel { max-width: 420px; }
}
@media (max-width: 520px) {
  .grid tr.group .glabel { max-width: 230px; }
}

/* ——— карточка врача ——— */
.dhead { display: flex; align-items: flex-start; gap: 14px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.ava.big { width: 48px; height: 48px; font-size: 16px; background: var(--accent-soft); color: var(--accent); }
.dh-t { flex: 1; min-width: 0; }
.dh-who { font-size: 14px; color: var(--ink); }
.dh-facts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.fact { display: inline-flex; align-items: center; gap: 5px; padding: 2px 10px; border: 1px solid var(--line); border-radius: 12px; font-size: 12.5px; color: var(--muted); background: #fff; }
.fact .i { width: 13px; height: 13px; }
.dhead > .tag { margin-top: 2px; }
.ftabs { display: flex; gap: 4px; padding: 0 20px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.ftabs button { padding: 11px 12px; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; background: none; font: inherit; font-size: 14px; color: var(--muted); white-space: nowrap; cursor: pointer; }
.ftabs button:hover { color: var(--ink); }
.ftabs button.on { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.ftabs .n { display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 2px; border-radius: 9px; background: var(--head); font-size: 11.5px; line-height: 18px; color: var(--muted); font-weight: 500; }
.ftabs button.on .n { background: var(--accent-soft); color: var(--accent); }
.form .fs[data-tabpane] { border-bottom: 0; padding-top: 18px; }
.row.wide { grid-template-columns: minmax(0, 1fr); gap: 8px; }
.row.wide > label { padding-top: 0; }
.agerange { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13.5px; }
.row .agerange input[type=number] { width: 90px; }

/* расписание: карточка на каждый филиал врача */
.plan { display: flex; flex-direction: column; gap: 12px; }
.pcard { border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.pcard.locked { background: #fafbfc; }
.pc-h { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 12px 14px 8px; }
.pc-h b { display: block; font-size: 14.5px; font-weight: 600; }
.pc-h .s { display: block; color: var(--muted); font-size: 12.5px; }
.pc-days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; padding: 4px 14px 10px; }
.pd { display: flex; flex-direction: column; gap: 4px; }
.pd-day { height: 30px; border: 1px solid var(--field-line, #d3d8e0); border-radius: 7px; background: #fff; font: inherit; font-size: 13px; color: var(--muted); cursor: pointer; }
.pd-day:hover:not(:disabled) { border-color: #b4bbc6; color: var(--ink); }
.pd.on .pd-day { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.pd-day:disabled { cursor: default; }
.tm { width: 100%; height: 30px; padding: 0 4px; border: 1px solid #d3d8e0; border-radius: 6px; text-align: center; font: inherit; font-size: 13px; font-variant-numeric: tabular-nums; background: #fff; }
.tm:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.tm:disabled { background: #f5f6f8; color: var(--muted); }
.pd:not(.on) .tm { visibility: hidden; }
.pc-quick { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 8px 14px; border-top: 1px solid var(--line-soft); }
.pc-quick .s, .pc-date .s { color: var(--muted); font-size: 12.5px; }
.pc-all { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; }
.pc-all .tm { width: 62px; }
.pc-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; padding: 8px 14px; border-top: 1px solid var(--line-soft); }
.pc-meta .toggle { padding-top: 0; font-size: 13px; white-space: nowrap; }
.pc-date { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.pc-meta input[type=text] { flex: 1; min-width: 220px; height: 32px; padding: 0 10px; border: 1px solid #d3d8e0; border-radius: 6px; font: inherit; font-size: 13px; }
.pc-err { padding: 0 14px; color: var(--danger, #b42318); font-size: 12.5px; }
.pc-err:empty { display: none; }
.pc-say { padding: 8px 14px 12px; color: var(--muted); font-size: 12.5px; border-top: 1px solid var(--line-soft); }
.plan-empty { padding: 14px; border: 1px dashed var(--line); border-radius: 10px; color: var(--muted); font-size: 13px; }
.plan-add select { height: 34px; max-width: 280px; }
@media (max-width: 700px) {
  .dhead { padding: 14px 16px; gap: 10px; }
  .ftabs { padding: 0 8px; }
  /* дни — строками: кнопка дня, «с», «до» */
  .pc-days { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .pd { display: grid; grid-template-columns: 56px minmax(0, 1fr) minmax(0, 1fr); gap: 6px; }
  .pd:not(.on) .tm { visibility: visible; opacity: .35; pointer-events: none; }
  .pc-all { margin-left: 0; }
  .pc-meta input[type=text] { flex: 1 1 100%; min-width: 0; }
}
.pc-date .dp { min-width: 150px; }

/* сортировка по клику на заголовок */
.grid th .th-sort { display: inline-flex; align-items: center; gap: 4px; padding: 0; border: 0; background: none; font: inherit; color: inherit; cursor: pointer; white-space: nowrap; }
.grid th .th-sort:hover { color: var(--ink); }
.th-sort .arr { font-size: 11px; opacity: .35; }
.th-sort:hover .arr { opacity: .8; }
.grid th.sorted .th-sort { color: var(--accent); }
.grid th.sorted .arr { opacity: 1; }
.th-sort:focus-visible { outline: 2px solid var(--accent-soft); border-radius: 4px; }

/* ——— карточка услуги и анализа ——— */
.ava.big.sq { border-radius: 12px; }
.ava.big.sq .i { width: 22px; height: 22px; }
.fact.warn { border-color: #f1d9a6; background: #fdf6e7; color: #8a5a00; }
/* выбор поиском: выбранное — значками, ниже поиск с подсказками */
.pk { display: flex; flex-direction: column; gap: 8px; }
.pk-sel { display: flex; flex-wrap: wrap; gap: 6px; }
.pk-chip { display: inline-flex; align-items: center; gap: 4px; height: 30px; padding: 0 4px 0 12px; border: 1px solid var(--accent); border-radius: 15px; background: var(--accent-soft); color: var(--accent); font-size: 13.5px; font-weight: 500; }
.pk-chip button { display: grid; place-items: center; width: 22px; height: 22px; padding: 0; border: 0; border-radius: 50%; background: none; color: inherit; font-size: 16px; line-height: 1; cursor: pointer; }
.pk-chip button:hover { background: rgba(53, 101, 201, .15); }
.pk-none { padding: 5px 0; color: var(--muted); font-size: 13px; }
.pk-find { position: relative; max-width: 520px; }
.pk-q { width: 100%; height: 34px; padding: 0 10px; border: 1px solid #d3d8e0; border-radius: 6px; font: inherit; font-size: 13.5px; background: #fff; }
.pk-q:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.pk-res { position: absolute; z-index: 20; top: calc(100% + 4px); left: 0; right: 0; max-height: 300px; overflow: auto; padding: 4px 0; border: 1px solid var(--line); border-radius: 8px; background: #fff; box-shadow: 0 10px 28px rgba(16, 24, 40, .14); }
.pk-r { display: flex; flex-direction: column; gap: 1px; width: 100%; padding: 6px 12px; border: 0; background: none; font: inherit; font-size: 13.5px; text-align: left; color: var(--ink); cursor: pointer; }
.pk-r .s { color: var(--muted); font-size: 12px; }
.pk-r:hover, .pk-r.on { background: var(--accent-soft); }
.pk-empty { padding: 8px 12px; color: var(--muted); font-size: 13px; }
.pk-sug { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 13px; }
.pk-sug:empty { display: none; }
.pk-sug .s { color: var(--muted); font-size: 12.5px; }
.pk-s { height: 26px; padding: 0 10px; border: 1px dashed #b9c3d6; border-radius: 13px; background: #fff; font: inherit; font-size: 12.5px; color: var(--ink); cursor: pointer; }
.pk-s:hover { border-style: solid; border-color: var(--accent); color: var(--accent); }
.chip.chip-all { font-weight: 500; }

/* ——— IP-телефония ——— */
.page-head .tel-badge { text-decoration: none; }
.subtabs .n { display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 4px; border-radius: 9px; background: var(--danger-soft); color: var(--danger); font-size: 11.5px; line-height: 18px; font-weight: 600; }
.stat.warn b { color: var(--danger); }
.tel-now { padding: 10px 16px; margin-bottom: 16px; font-size: 14px; }
.grid tr.tel-lost td:first-child { box-shadow: inset 3px 0 0 #e8b4b4; }
.tel-state { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.tel-state b { display: block; font-size: 15px; }
.tel-state .s { display: block; color: var(--muted); font-size: 12.5px; }
.tel-state .dot { width: 14px; height: 14px; border-radius: 50%; background: #c3cad6; flex: none; }
.tel-state.ok .dot { background: var(--ok); }
.tel-state.warn .dot { background: #d9a400; }
.tel-state.danger .dot { background: var(--danger); }
.sdot { display: inline-block; width: 9px; height: 9px; margin-right: 8px; border-radius: 50%; background: var(--ok); vertical-align: 0; }
.sdot.warn { background: #d9a400; }
.sdot.fail { background: var(--danger); }
.tel-phones { display: flex; flex-direction: column; gap: 6px; }
.tel-ph { display: grid; grid-template-columns: 130px minmax(0, 260px); gap: 10px; align-items: center; }
.tel-ext { font-size: 13.5px; color: var(--muted); }
.tel-two { display: flex; flex-wrap: wrap; gap: 8px; }
.tel-two > * { flex: 1 1 200px; max-width: 280px; }

/* ——— вход: по почте и паролю (auth.js) ——— */
body[data-auth] .side, body[data-auth] .mbar, body[data-auth] .scrim { display: none; }
body[data-auth] .main { margin-left: 0; }
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.auth-card { width: min(400px, 100%); padding: 26px 28px 22px; }
.auth-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 22px; }
.auth-brand b { display: block; font-size: 14px; }
.auth-brand small { color: var(--muted); font-size: 12px; }
.auth-logo { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: var(--side-bg); color: #fff; }
.auth-card h1 { margin: 0 0 6px; font-size: 20px; }
.auth-card .lead { margin: 0 0 18px; color: var(--muted); }
.auth-f { margin-bottom: 14px; }
.auth-f > label { display: block; margin-bottom: 6px; font-weight: 500; }
.auth-f input { width: 100%; }
.auth-card .err { margin: 0 0 14px; }
.auth-go { width: 100%; height: 40px; justify-content: center; }
.auth-links { margin-top: 12px; text-align: center; }
.auth-note { margin: 12px 0 0; color: var(--muted); font-size: 12.5px; }
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 76px; }
.pw-eye { position: absolute; top: 50%; right: 6px; transform: translateY(-50%); padding: 4px 8px; border: 0; border-radius: 6px; background: transparent; color: var(--accent); font-size: 12.5px; cursor: pointer; }
.pw-eye:hover { background: var(--head); }
.rules { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 6px 0 0; padding: 0; list-style: none; color: var(--muted); font-size: 12.5px; }
.rules li::before { content: "○"; margin-right: 5px; }
.rules li.ok { color: var(--ok); }
.rules li.ok::before { content: "✓"; }
#modal .auth-f input { width: 100%; }
#modal .fs .err { margin: 4px 0 0; }
.np { display: grid; gap: 8px; }
.np .segmented { justify-self: start; }
.np-own input { width: 100%; max-width: 320px; }
.np-hint { display: block; color: var(--muted); font-size: 12.5px; line-height: 1.45; }
.issued .row { grid-template-columns: 130px minmax(0, 1fr); }
.issued .np-hint { margin: 4px 0 8px; }
.pw-show { display: inline-block; padding: 4px 10px; border-radius: 6px; background: var(--head); font: 600 16px/1.4 ui-monospace, Consolas, monospace; letter-spacing: .04em; user-select: all; }
.dh-act { margin-top: 10px; }
@media (max-width: 860px) {
  .issued .row { grid-template-columns: minmax(0, 1fr); }
}

/* ——— «+ Добавить» в услугах и анализах: позицию или раздел ——— */
.addmenu { position: relative; display: inline-flex; }
.addmenu > .btn .i { width: 15px; height: 15px; margin-right: -4px; }
.addmenu-list { position: absolute; top: calc(100% + 6px); right: 0; z-index: 40; width: 270px; max-width: calc(100vw - 32px); padding: 6px;
  border: 1px solid var(--line); border-radius: 8px; background: #fff; box-shadow: 0 10px 30px rgba(16, 24, 40, .12); }
.addmenu-list.left { right: auto; left: 0; }
.addmenu-list button { display: block; width: 100%; padding: 8px 10px; border: 0; border-radius: 6px; background: none; color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.addmenu-list button:hover, .addmenu-list button:focus-visible { outline: none; background: var(--head); }
.addmenu-list b { display: block; font-weight: 500; }
.addmenu-list small { display: block; color: var(--muted); font-size: 12px; }
/* поле «Раздел» с «+ Новый раздел…» */
.catpick { display: grid; gap: 8px; }
.cat-new { padding: 10px 12px; border: 1px dashed var(--field-line); border-radius: 8px; background: var(--head); }
.cat-new[hidden] { display: none; }
/* отпуск врача: с … по … */
.awayrange { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; color: var(--muted); font-size: 13.5px; }
.awayrange .dp { flex: 0 1 190px; min-width: 150px; }
.grid .leave { color: var(--warn); }

/* ——— подсказка значком «?» (tip из shared.js) ——— */
.tip { display: inline-grid; place-items: center; width: 16px; height: 16px; margin-left: 6px; padding: 0; border: 1px solid #c5cbd5; border-radius: 50%;
  background: #fff; color: var(--muted); font: 600 10.5px/1 var(--font); vertical-align: 1px; cursor: help; transition: border-color .15s, color .15s; }
.tip:hover, .tip.on, .tip:focus-visible { border-color: var(--accent); color: var(--accent); outline: none; }
.tip-pop { position: fixed; z-index: 90; max-width: min(300px, calc(100vw - 16px)); padding: 8px 11px; border-radius: 7px; background: #1f2633; color: #fff;
  font-size: 12.5px; line-height: 1.45; box-shadow: 0 8px 24px rgba(16, 24, 40, .22); pointer-events: none; }
.pc-opt { display: inline-flex; align-items: center; }
