/*
 * arm.css — общая раскладка и компоненты АРМов диагностики (УЗИ, рентген, ЭКГ, КТ, функциональная).
 * Подключается после tokens.css и ux.css. Три режима: телефон (один экран за раз),
 * планшет (>=900px: очередь слева, протокол справа), десктоп (>=1280px: ещё и панель снимков/ИИ).
 */

/* ===================== Каркас ===================== */
.app.arm { max-width: 720px; margin: 0 auto; min-height: 100vh; min-height: 100dvh; padding: 0; }
.arm-top {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px 8px;
  position: sticky; top: 0; z-index: 30; background: var(--bg);
}
.arm-top .ux-room-slot { margin: 0; }
.arm-top-spacer { flex: 1; }
.arm-ico {
  width: var(--ux-tap, 40px); height: var(--ux-tap, 40px); border-radius: 12px; flex-shrink: 0;
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer; font: inherit; padding: 0;
}
.arm-ico svg, .arm-btn svg, .arm-chip svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.arm-title { font-size: 15px; font-weight: 700; color: var(--muted); }

.arm-btn {
  min-height: var(--ux-tap-lg, 42px); padding: 0 16px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--subtle); color: var(--ink); font: inherit; font-size: 14.5px; font-weight: 700; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap;
}
.arm-btn.pri { background: var(--sage-dark); border-color: transparent; color: #fff; }
[data-theme="dark"] .arm-btn.pri { color: #0B1A10; }
.arm-btn:disabled { opacity: .55; cursor: default; }
.arm-btn.sm { min-height: 34px; padding: 0 12px; font-size: 13.5px; border-radius: 10px; }

/* ===================== Очередь ===================== */
#home-screen.arm-queue { display: none; padding-bottom: 24px; }
body.armed #home-screen.arm-queue { display: block; }
#login-screen { max-width: 380px; margin: 40px auto 0; }
.arm-hello { padding: 0 16px 4px; }
.arm-hello .home-greeting { padding: 0; font-size: 13px; color: var(--muted); }
.arm-hello .home-name { padding: 0; font-size: 22px; font-weight: 800; }
.stat-row { display: flex; gap: 8px; padding: 6px 14px; }
.stat-box { flex: 1; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 9px 12px; text-align: left; }
.stat-box .label { font-size: 12.5px; color: var(--muted); margin: 0; order: -1; }
.stat-box { display: flex; flex-direction: column; }
.stat-box .num { font-size: 22px; font-weight: 800; color: var(--ink); }
.stat-box.warn .num { color: var(--clay-dark); }
.arm-actions { display: flex; gap: 8px; padding: 8px 14px 0; }
.arm-actions .arm-btn { flex: 1; min-width: 0; padding: 0 8px; font-size: 14px; }
.arm-seg { display: flex; gap: 3px; margin: 12px 14px 6px; padding: 3px; background: var(--subtle); border: 1px solid var(--line); border-radius: 12px; overflow-x: auto; }
.arm-seg button {
  flex: 1; min-height: 34px; padding: 0 6px; border: 0; border-radius: 9px; background: transparent; color: var(--muted);
  font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.arm-seg button.on { background: var(--card); color: var(--sage-dark); font-weight: 700; box-shadow: 0 1px 3px rgba(0, 0, 0, .14); }
.arm-qtitle { display: flex; align-items: center; gap: 8px; padding: 6px 16px 0; }
.arm-qtitle b { flex: 1; font-size: 15px; }

#queue-list { padding: 4px 14px; display: flex; flex-direction: column; gap: 8px; }
.queue-date-title { font-size: 12.5px; color: var(--muted); margin: 8px 2px 0; text-transform: uppercase; letter-spacing: .05em; font-weight: 700; }
.queue-item {
  display: flex; align-items: flex-start; gap: 12px; margin: 0; padding: 10px 12px;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px; cursor: pointer;
}
.queue-item:active { background: var(--subtle); }
.queue-item.on { border-color: var(--sage-dark); box-shadow: 0 0 0 1px var(--sage-dark) inset; }
.queue-item.done { opacity: .72; }
.queue-time { font-family: var(--font-mono, ui-monospace, monospace); font-size: 15px; font-weight: 700; color: var(--ink); width: 46px; flex-shrink: 0; padding-top: 1px; }
.queue-info { flex: 1; min-width: 0; }
.q-row { display: flex; align-items: center; gap: 8px; }
.queue-patient { flex: 1; min-width: 0; font-size: 15.5px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.queue-service { font-size: 13px; color: var(--muted); margin-top: 1px; }
.queue-reason { font-size: 12.5px; color: var(--sage-dark); margin-top: 2px; }
.st { display: inline-flex; align-items: center; height: 24px; padding: 0 9px; border-radius: 999px; font-size: 12px; font-weight: 700; flex-shrink: 0; }
.st.wait { background: var(--info-bg); color: var(--info-ink); }
.st.draft { background: var(--clay-soft); color: var(--clay-dark); }
.st.final { background: var(--sage-soft); color: var(--sage-dark); }
.empty-note { padding: 20px 16px; color: var(--muted); font-size: 13.5px; text-align: center; }

/* ===================== Протокол ===================== */
#protocol-screen { display: none; }
#protocol-empty { display: none; }
body.has-protocol #protocol-screen { display: flex; flex-direction: column; }
.pr-aside { order: 1; }
.pr-main { order: 2; }
.pr-actions { order: 3; }
.pr-head { position: sticky; top: 0; z-index: 20; background: var(--bg); border-bottom: 1px solid var(--line); padding: 4px 8px 8px 4px; }
.pr-head-row { display: flex; align-items: center; gap: 4px; min-height: 52px; }
.pr-back, .pr-more {
  width: 44px; height: 44px; border: 0; background: transparent; color: var(--ink); cursor: pointer; border-radius: 12px;
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; padding: 0;
}
.pr-back svg, .pr-more svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.pr-who { flex: 1; min-width: 0; }
.pr-name { font-size: 18px; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pr-sub { font-size: 13px; color: var(--muted); }
.pr-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--clay-dark); margin-right: 6px; vertical-align: middle; }
.pr-dot.final { background: var(--sage-dark); }
.pr-dot.wait { background: var(--info-ink); }
.pr-info { padding: 6px 10px 0 14px; font-size: 13px; color: var(--muted); }
.pr-info b { color: var(--sage-dark); }
.pr-tpl { padding: 8px 10px 0 14px; display: flex; gap: 8px; }
.tpl-pill {
  appearance: none; -webkit-appearance: none; max-width: 100%; min-height: 36px; padding: 0 34px 0 14px; border-radius: 999px; border: 0;
  background: var(--sage-soft) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%233A7550' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'><path d='M6 9l6 6 6-6'/></svg>") no-repeat right 11px center / 15px;
  color: var(--sage-dark); font: inherit; font-size: 14px; font-weight: 700; cursor: pointer;
}
.pr-body { padding: 12px 12px 12px; display: flex; flex-direction: column; gap: 12px; }
.pr-card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; margin: 0; padding: 0; overflow: hidden; }
.pr-card-h {
  width: 100%; display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: none; border: 0;
  font: inherit; color: var(--ink); text-align: left; cursor: pointer; min-height: 48px;
}
.pr-card-t { flex: 1; font-size: 16px; font-weight: 700; }
.pr-card-s { font-size: 13px; color: var(--muted); }
.pr-card-c { width: 20px; height: 20px; color: var(--muted); fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform .15s; }
.pr-card.closed .pr-card-c { transform: rotate(180deg); }
.pr-card.closed .pr-card-b { display: none; }
.pr-card-b { padding: 0 14px 14px; display: flex; flex-direction: column; gap: 10px; }
.pr-card-b.pr-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.pr-grid .pr-field.ta { grid-column: 1 / -1; }
#protocol-fields { display: flex; flex-direction: column; gap: 12px; }

.pr-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.pr-fl { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.pr-fv { display: flex; align-items: center; gap: 8px; }
.pr-fv input, .pr-fv textarea {
  flex: 1; min-width: 0; min-height: var(--ux-tap-lg, 42px); padding: 8px 12px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--subtle); color: var(--ink); font: inherit; font-size: 16px; font-weight: 600;
}
.pr-fv textarea { min-height: 64px; font-weight: 500; resize: vertical; line-height: 1.4; }
.pr-fv input:focus, .pr-fv textarea:focus { outline: 2px solid var(--sage-dark); outline-offset: 0; background: var(--card); }
.pr-fv.review input, .pr-fv.review textarea { border-color: var(--clay-dark); background: var(--clay-soft); }
.pr-unit { font-size: 13px; color: var(--muted); flex-shrink: 0; }
.voice-btn {
  width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); background: var(--card); flex-shrink: 0; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; padding: 0; color: var(--ink); align-self: flex-start;
}
.voice-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.voice-btn.recording { background: var(--flag); color: #fff; border-color: var(--flag); }
.calc-box { background: var(--sage-soft); border-radius: 12px; padding: 10px 14px; }
.calc-row { display: flex; justify-content: space-between; font-size: 14px; padding: 3px 0; }
.calc-row b { color: var(--sage-dark); }

.ai-b { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 6px; background: var(--sage-soft); color: var(--sage-dark); font-size: 11.5px; font-weight: 700; }
.ai-b.warn { background: var(--clay-soft); color: var(--clay-dark); }
.ai-actions { display: flex; gap: 8px; margin-top: 6px; }
.ai-actions button { flex: 1; min-height: 38px; border-radius: 10px; border: 1px solid var(--line); background: var(--subtle); color: var(--ink); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
.ai-actions button.ok { background: var(--sage-dark); color: #fff; border-color: transparent; font-weight: 700; }
[data-theme="dark"] .ai-actions button.ok { color: #0B1A10; }

.pr-concl-h { display: flex; align-items: center; gap: 10px; padding: 12px 14px 0; }
.pr-concl-h .pr-card-t { flex: 1; }
.pr-concl-b { padding: 8px 14px 14px; }
.msg { font-size: 13px; padding: 4px 14px; min-height: 0; }
.msg.err { color: var(--flag); }
.msg.ok { color: var(--sage-dark); }
.pr-certify { margin: 0; padding: 8px 12px; border-radius: 12px; background: var(--sage-soft); color: var(--sage-dark); font-size: 13px; font-weight: 600; }
.pr-certify.warn { background: var(--clay-soft); color: var(--clay-dark); }

/* панель действий: внизу телефона/планшета */
.pr-actions {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; max-width: 720px; margin: 0 auto;
  display: flex; gap: 10px; padding: 10px 12px calc(12px + env(safe-area-inset-bottom, 0px));
  background: var(--card); border-top: 1px solid var(--line);
}
.pr-actions .arm-btn { min-height: 48px; border-radius: 14px; font-size: 15px; }
.pr-actions .grow { flex: 1; }
.pr-actions .grow2 { flex: 1.4; }
.pr-actions .pr-only-wide { display: none; }

/* ===================== Панель снимков и ИИ ===================== */
.pr-aside { display: flex; flex-direction: column; gap: 12px; }
.shots { display: flex; gap: 8px; flex-wrap: wrap; }
.shot {
  position: relative; width: 66px; height: 66px; border-radius: 12px; overflow: hidden; border: 1px solid var(--line);
  background: #1d2420 center / cover no-repeat; flex-shrink: 0; cursor: pointer; padding: 0;
}
.shot.on { outline: 2px solid var(--sage-dark); }
.shot-x {
  position: absolute; top: 3px; right: 3px; width: 22px; height: 22px; border-radius: 50%; border: 0; padding: 0;
  background: rgba(0, 0, 0, .6); color: #fff; font-size: 14px; line-height: 1; cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
}
.shot-add {
  width: 66px; height: 66px; border-radius: 12px; border: 1.5px dashed var(--line); background: var(--subtle); color: var(--muted);
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0; padding: 0;
}
.shot-add svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ai-banner { display: flex; align-items: center; gap: 10px; margin-top: 12px; padding: 10px 12px; border-radius: 12px; background: var(--sage-soft); font-size: 14px; }
.ai-banner svg { width: 20px; height: 20px; color: var(--sage-dark); fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.ai-banner > div { flex: 1; min-width: 0; }
.ai-banner .sub { color: var(--muted); font-size: 13px; }
.ai-list { padding: 4px 12px; background: var(--subtle); border: 1px solid var(--line); border-radius: 14px; }
.rv { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 14px; }
.rv:first-child { border-top: 0; }
.rv.review { background: var(--clay-soft); margin: 0 -12px; padding: 8px 12px; }
.rv > span:first-child { flex: 1; min-width: 0; }
.rv-btn { width: 32px; height: 32px; border-radius: 9px; border: 0; padding: 0; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0; }
.rv-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.rv-btn.ok { background: var(--sage-soft); color: var(--sage-dark); }
.rv-btn.no { background: var(--flag-bg); color: var(--flag); }
.rv.applied { opacity: .55; }
.pr-note { font-size: 13px; color: var(--muted); line-height: 1.45; }

/* ===================== Планшет и десктоп ===================== */
@media (min-width: 900px) {
  .app.arm { max-width: none; }
  body.armed .arm-body { display: grid; grid-template-columns: 340px minmax(0, 1fr); height: calc(100vh - 56px); height: calc(100dvh - 56px); }
  /* На десктопе .uzi-tabs (Очередь/График/Профиль/Архив/Тренажёр)
     остаётся видна и при открытом протоколе — здесь нет мобильного
     "назад", список и протокол показываются одновременно, и без этой
     навигации переключиться на другую вкладку было бы нечем (баг,
     сообщённый пользователем, сентябрь 2026). Высота area уменьшена
     на высоту нижней навигации, чтобы .pr-actions (sticky bottom
     внутри #protocol-screen) не оказалась под ней. */
  body.armed.has-protocol .arm-body { height: calc(100vh - 56px - 68px); height: calc(100dvh - 56px - 68px); }
  .arm-top { padding: 8px 16px; }
  body.armed #home-screen.arm-queue { overflow-y: auto; border-right: 1px solid var(--line); padding-bottom: 16px; }
  #protocol-screen { overflow-y: auto; }
  body.armed:not(.has-protocol) #protocol-empty {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; color: var(--muted); text-align: center; padding: 40px;
  }
  #protocol-empty svg { width: 44px; height: 44px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; opacity: .6; }
  .pr-head { top: 0; padding: 10px 20px 10px; }
  /* .pr-back спрятана (десктоп показывает очередь и протокол одновременно,
     "назад" не нужно), но .pr-more остаётся — это единственный вход
     к «Поделиться (обезличенно)»/«Обсудить с коллегами» (openProtoMenu()),
     у Заверить/Печать есть свои pr-only-wide кнопки ниже, а у этих двух — нет. */
  .pr-back { display: none; }
  .pr-head-row { min-height: 0; }
  .pr-name { font-size: 22px; }
  .pr-body { padding: 14px 20px 110px; }
  .pr-info, .pr-tpl { padding-left: 0; padding-right: 0; }
  .pr-actions { position: sticky; bottom: 0; max-width: none; padding: 10px 20px 12px; justify-content: flex-end; }
  .pr-actions .grow, .pr-actions .grow2 { flex: 0 0 auto; }
  .pr-actions .arm-btn { min-height: 42px; border-radius: 12px; }
  .pr-actions .pr-only-wide { display: inline-flex; }
  .pr-actions .pr-only-narrow { display: none; }
  #protocol-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; align-items: start; }
  #protocol-fields .pr-card.closed .pr-card-b.pr-grid { display: grid; }
  #protocol-fields .pr-card-h { cursor: default; }
  #protocol-fields .pr-card-c { display: none; }
  #protocol-fields .pr-card-s { display: none; }
  #protocol-fields .pr-card.wide { grid-column: 1 / -1; }
}
@media (min-width: 1280px) {
  body.has-protocol #protocol-screen { display: grid; grid-template-columns: minmax(0, 1fr) 380px; grid-template-rows: auto minmax(0, 1fr) auto; overflow: hidden; }
  body.has-protocol #protocol-screen > .pr-actions { grid-column: 1 / -1; grid-row: 3; }
  body.has-protocol #protocol-screen > .pr-head { grid-column: 1 / -1; }
  body.has-protocol #protocol-screen > .pr-main { overflow-y: auto; min-width: 0; grid-column: 1; grid-row: 2; }
  body.has-protocol #protocol-screen > .pr-aside { grid-column: 2; grid-row: 2; overflow-y: auto; border-left: 1px solid var(--line); background: var(--card); padding: 14px 16px; }
  .pr-aside .pr-card { border: 0; border-radius: 0; background: transparent; }
  .pr-aside .pr-card-b { padding: 0; }
  .pr-aside .pr-card-h { padding: 0 0 10px; }
  .shots { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .shot, .shot-add { width: auto; aspect-ratio: 1; height: auto; }
}
@media (max-width: 1279px) {
  .pr-aside { padding: 12px 12px 0; }
  .pr-aside .pr-card { border: 1px solid var(--line); }
}
@media (max-width: 899px) {
  body.has-protocol .arm-top { display: none; }
  body.has-protocol .app.arm { padding-bottom: 84px; }
  body.has-protocol #home-screen { display: none !important; }
  /* На мобильном протокол занимает весь экран — нижняя навигация
     (Очередь/График/Профиль/Архив/Тренажёр) прячется, вместо неё
     видна .pr-actions (Печать/Заверить/...); вернуться к вкладкам
     можно через .pr-back ("назад" в шапке протокола). */
  body.has-protocol .uzi-tabs { display: none; }
}

/* просмотр снимка */
.shot-view { position: fixed; inset: 0; z-index: 9000; background: rgba(0, 0, 0, .92); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 56px 12px 12px; }
.shot-view img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 8px; }
.shot-view-bar { position: absolute; top: 0; left: 0; right: 0; display: flex; gap: 8px; padding: 10px 12px; }
.pr-concl-h .voice-btn { align-self: center; }
.concl-ai { display: inline-flex; }
.rv { flex-wrap: wrap; row-gap: 2px; }
.rv > span:first-child { flex: 1 1 100%; }
.rv > b { flex: 1; }

/* ===================== Лаборатория: построчные показатели ===================== */
.lab-list { display: flex; flex-direction: column; }
.lab-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(96px, 128px) 58px; gap: 8px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); }
.lab-row:first-child { border-top: 0; }
.lab-name { font-size: 15px; font-weight: 600; }
.lab-ref { font-size: 12.5px; color: var(--muted); }
.lab-row input, .lab-row select {
  width: 100%; min-width: 0; min-height: var(--ux-tap-lg, 42px); padding: 6px 10px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--subtle); color: var(--ink); font: inherit; font-size: 16px; font-weight: 600;
}
.lab-row input:focus, .lab-row select:focus { outline: 2px solid var(--sage-dark); background: var(--card); }
.lab-row.review input { border-color: var(--clay-dark); background: var(--clay-soft); }
.lab-flag { font-size: 12px; font-weight: 700; white-space: nowrap; }
.pr-fv select { flex: 1; min-height: var(--ux-tap-lg, 42px); border-radius: 12px; border: 1px solid var(--line); background: var(--subtle); color: var(--ink); font: inherit; font-size: 16px; padding: 0 10px; }

/* ===================== Протоколы со схемами УЗИ ===================== */
.pr-fig { margin: 0 0 12px; padding: 10px 8px 4px; border-radius: 14px; background: #F6F3EC; border: 1px solid #E4DFD3; color: #23261F; }
.pr-fig-svg { display: block; width: 100%; max-height: 320px; overflow: visible; }
.pr-fig-svg .fg-cap { font: 600 10.5px system-ui, sans-serif; fill: #6B7263; }
.pr-fig-svg .ext { stroke: #B5533C; stroke-width: 1; stroke-dasharray: 3 3; opacity: .55; }
.pr-fig-svg .dm { stroke: #B5533C; stroke-width: 1.8; }
.pr-fig-svg .dm.off { opacity: .22; stroke-dasharray: 3 3; }
.pr-fig-svg .dm-ar { fill: #B5533C; }
.pr-fig-svg .mk { cursor: pointer; }
.pr-fig-svg .mk circle { fill: #fff; stroke: #B5533C; stroke-width: 1.8; }
.pr-fig-svg .mk .mk-n { font: 700 11px system-ui, sans-serif; fill: #23261F; text-anchor: middle; dominant-baseline: central; pointer-events: none; }
.pr-fig-svg .mk.filled circle { fill: #FBEFE6; }
.pr-fig-svg .mk.ok circle { stroke: #3A7550; fill: #E6F0E8; }
.pr-fig-svg .mk.high circle, .pr-fig-svg .mk.low circle { stroke: #B54B3C; fill: #F6DDD8; }
.pr-fig-svg .mk:focus-visible circle { stroke-width: 3; }
.pr-fig-svg .mv { font: 700 12.5px system-ui, sans-serif; fill: #23261F; paint-order: stroke; stroke: #F6F3EC; stroke-width: 3px; stroke-linejoin: round; pointer-events: none; }
.pr-fig-svg .mv.high, .pr-fig-svg .mv.low { fill: #B54B3C; }
.pr-fig-svg .mv.ok { fill: #2F6B41; }
.fg-legend { color: #6B7263; }

.pr-mk { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; margin-right: 6px; flex-shrink: 0;
  border: 1.5px solid var(--clay-dark); color: var(--ink); font-size: 11.5px; font-weight: 700; background: var(--card); }
.pr-fl { align-items: baseline; }
.pr-fl-t { color: var(--ink); font-weight: 600; }
.pr-norm { margin-left: auto; padding-left: 8px; font-size: 12.5px; color: var(--muted); font-weight: 500; white-space: nowrap; }
.pr-flag { flex-shrink: 0; min-width: 52px; font-size: 12.5px; font-weight: 700; color: var(--muted); }
.pr-flag.ok { color: var(--sage-dark); }
.pr-flag.high, .pr-flag.low { color: var(--flag); }
.pr-field.choice .pr-fl { margin-bottom: 2px; }
.pr-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.pr-chip { min-height: 42px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--subtle); color: var(--ink);
  font: inherit; font-size: 14.5px; font-weight: 600; cursor: pointer; }
.pr-chip.on { background: var(--sage-dark); border-color: transparent; color: #fff; }
[data-theme="dark"] .pr-chip.on { color: #0B1A10; }
.pr-field.flash { animation: prFlash 1.2s ease; border-radius: 12px; }
@keyframes prFlash { 0%, 60% { box-shadow: 0 0 0 3px var(--clay-dark); } 100% { box-shadow: 0 0 0 3px transparent; } }
.calc-ref { color: var(--muted); font-size: 12.5px; font-weight: 500; margin-left: 6px; }
.calc-row b.high, .calc-row b.low { color: var(--flag); }
@media (min-width: 1280px) { .pr-fig { max-width: 520px; } }
.pr-norm-note { grid-column: 1 / -1; margin: 0; }
.pr-fv textarea, #conclusion-text { overflow-y: hidden; resize: none; }

/* панель пометок на схеме */
.fg-tools { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 4px 6px; align-items: center; }
.fg-btn { min-height: 40px; padding: 0 10px; border-radius: 10px; border: 1px solid #E4DFD3; background: #fff; color: #23261F;
  font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.fg-btn svg { width: 20px; height: 20px; flex-shrink: 0; }
.fg-btn.ico { padding: 0; width: 40px; justify-content: center; }
.fg-btn.on { background: #3A7550; border-color: transparent; color: #fff; }
.fg-btn:disabled { opacity: .4; cursor: default; }
.fg-sep { width: 1px; height: 24px; background: #E4DFD3; margin: 0 2px; }
.fg-legend { font-size: 12.5px; padding: 0 4px 4px; }
.pr-fig.armed .pr-fig-svg { touch-action: none; cursor: crosshair; }
.pr-fig.armed .mk { pointer-events: none; }
.fa-item { cursor: pointer; }
@media (max-width: 420px) { .fg-btn:not(.ico) span { display: none; } .fg-btn:not(.ico) { width: 44px; padding: 0; justify-content: center; } }

/* ===== компактнее: панель пометок в одну строку, короткие числовые поля, норма отдельной строкой ===== */
.fg-tools { flex-wrap: nowrap; gap: 3px; overflow-x: auto; padding: 8px 2px 6px; }
.fg-btn, .fg-btn.ico { min-height: 36px; width: 36px; padding: 0; justify-content: center; border-radius: 9px; flex-shrink: 0; }
.fg-btn span { display: none; }
.fg-btn svg { width: 19px; height: 19px; }
.fg-sep { flex-shrink: 0; height: 20px; }
.pr-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 12px; }
.pr-grid .pr-field.ta { grid-column: 1 / -1; }
.pr-fv input[type="number"] { flex: 0 0 auto; width: 92px; min-width: 0; padding: 8px 10px; }
.pr-fv input[type="number"] + .pr-unit { min-width: 24px; }
.pr-fl { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; }
.pr-norm { flex: 1 0 100%; margin-left: 0; padding-left: 0; font-size: 12px; color: var(--muted); font-weight: 500; }
.pr-flag { min-width: 0; margin-left: 2px; }
.pt-card .pr-card-s { font-weight: 600; color: var(--ink); }
.pt-calc { font-size: 13.5px; font-weight: 700; color: var(--sage-dark); min-height: 0; }
.pt-calc:empty { display: none; }
.pr-fig-svg .part-off * { fill: none !important; stroke: #B5533C !important; stroke-width: 1.4 !important; stroke-dasharray: 4 3; opacity: .5; }
.pr-fig-svg .st-stenosis * { stroke: #E0A030 !important; }
.pr-fig-svg .st-occl * { stroke: #C0392B !important; stroke-dasharray: 4 3; }
@media (max-width: 380px) { .pr-fv input[type="number"] { width: 78px; } }
@media (min-width: 900px) { #protocol-fields .pr-card.closed .pr-card-b { display: flex; } }
.pt-card .pr-grid { grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); align-items: start; }
.pt-card .pr-field.choice { grid-column: auto; }
.pt-card .pr-chip { min-height: 38px; }

.fg-tools { flex-wrap: wrap; overflow: visible; }
.pr-fl .pr-flag { margin-left: auto; }

/* проверочные списки «N / патология / не визуализируется» */
.pr-field.tri { grid-column: 1 / -1; flex-direction: row; align-items: center; justify-content: space-between; gap: 8px; padding: 2px 0; border-bottom: 1px dotted var(--line); }
.pr-field.tri .pr-fl-t { font-size: 14.5px; font-weight: 500; flex: 1; min-width: 0; }
.pr-chips.tri { flex-wrap: nowrap; gap: 4px; }
.pr-chips.tri .pr-chip { min-height: 34px; min-width: 44px; padding: 0 9px; font-size: 13px; border-radius: 9px; }
.pr-chips.tri .pr-chip.on { background: var(--sage-dark); }
.pr-chips.tri .pr-chip.tri-1.on { background: var(--flag); }
.pr-chips.tri .pr-chip.tri-2.on { background: var(--muted); }
.pr-fig-svg .st-path * { fill: #E0857A !important; stroke: #B54B3C !important; }

/* ===== сегменты сосудов ===== */
.pr-qn { margin: 0 0 8px; }
.vseg { grid-column: 1 / -1; padding: 8px 0; border-top: 1px solid var(--line); }
.vseg:first-child { border-top: 0; }
.vs-t { display: flex; align-items: baseline; gap: 8px; margin-bottom: 6px; }
.vs-t > span:first-child { font-size: 15px; font-weight: 700; }
.vs-n { font-size: 12px; color: var(--muted); }
.vs-c { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.vs-chips { flex-wrap: nowrap; gap: 4px; }
.vs-chips .pr-chip { min-height: 34px; padding: 0 10px; font-size: 13px; border-radius: 9px; }
.vs-chips .pr-chip.amber.on { background: #D08B1F; }
.vs-chips .pr-chip.red.on { background: var(--flag); }
.vs-in { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; color: var(--muted); }
.vs-in input { width: 66px; min-height: 34px; padding: 4px 8px; border-radius: 9px; border: 1px solid var(--line); background: var(--subtle); color: var(--ink); font: inherit; font-size: 15px; font-weight: 600; }
.vs-in em { font-style: normal; }
.vs-st { display: none; }
.vseg.is-stenosis .vs-st { display: inline-flex; }
.pr-fig-svg .st-occl * { stroke: #2B2F33 !important; stroke-dasharray: 5 3; }
.vs-chips .pr-chip { min-height: 32px; padding: 0 8px; font-size: 12.5px; }
.vs-in input { width: 58px; min-height: 32px; font-size: 14.5px; }
.vs-c { gap: 6px 8px; }
.pr-fig-svg .st-warn * { fill: #F0C265 !important; stroke: #B98416 !important; }
.pr-fig-svg .st-dys * { fill: #B9A0D8 !important; stroke: #6E4C9A !important; }
.pr-fig-svg .st-warn text, .pr-fig-svg .st-path text, .pr-fig-svg .st-dys text { fill: #2B1410 !important; stroke: none !important; }
.pr-gnote { font-size: 12px; line-height: 1.4; color: var(--text-2, #6B7263); margin: 4px 0 8px; }
.pr-fig.cyc [data-part] { cursor: pointer; }
.pr-fig.cyc [data-part]:hover path, .pr-fig.cyc [data-part]:hover circle { filter: brightness(.94); }

.dyn-banner { display: flex; align-items: center; gap: 10px; background: #EAF2ED; color: #2F4A38; border: 1px solid #CFE0D5; border-radius: 12px; padding: 10px 12px; margin: 0 0 12px; font-size: 13px; }
[data-theme="dark"] .dyn-banner { background: #1C2A21; color: #BFE0CC; border-color: #2C4234; }
.dyn-banner svg { width: 20px; height: 20px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.dyn-banner span { flex: 1; }
.dyn-banner .arm-btn.sm { flex-shrink: 0; }
.dyn-t { width: 100%; border-collapse: collapse; font-size: 13.5px; margin-top: 4px; }
.dyn-t th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12px; padding: 4px 6px; }
.dyn-t th:nth-child(2), .dyn-t th:nth-child(4) { text-align: right; }
.dyn-t td { padding: 7px 6px; border-top: 1px solid var(--border); }
.dyn-t td:nth-child(2), .dyn-t td:nth-child(4) { text-align: right; white-space: nowrap; }
.dyn-ar { text-align: center !important; width: 22px; color: var(--muted); }
.dyn-ar.st-up { color: #B54B3C; } .dyn-ar.st-down { color: #3A7550; }
.dyn-concl { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); font-size: 13px; }
.dyn-concl p { margin: 4px 0 0; color: var(--muted); line-height: 1.45; }
.say-active { background: var(--sage-dark) !important; color: #fff !important; border-color: transparent !important; }

/* ===================== Нижняя навигация кабинета: Очередь / График / Профиль / Архив ===================== */
.uzi-tabs { position: fixed; left: 0; right: 0; bottom: 0; display: flex; gap: 4px; padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); background: var(--card); border-top: 1px solid var(--line); z-index: 40; }
body:not(.armed) .uzi-tabs { display: none; }
.uzi-tabs button { flex: 1; min-height: 52px; border: none; background: none; color: var(--muted); font: inherit; font-size: 11.5px; border-radius: 12px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; cursor: pointer; }
.uzi-tabs button.on { color: var(--sage-dark); background: rgba(126, 156, 132, .14); font-weight: 700; }
.uzi-tabs button svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
body.armed:not(.has-protocol) .app.arm { padding-bottom: 68px; }
body.tab-other .arm-body { display: block !important; height: auto !important; overflow: visible !important; }
#schedule-screen, #profile-screen, #archive-screen { padding-bottom: 12px; }

/* ---- График: горизонтальная лента дат ---- */
.sch-strip-wrap { overflow-x: auto; padding: 4px 18px 10px; -webkit-overflow-scrolling: touch; }
.sch-strip { display: flex; gap: 6px; width: max-content; }
.sch-day { position: relative; min-width: 46px; padding: 8px 4px 10px; border-radius: 12px; border: 1px solid var(--border); background: var(--card); color: var(--ink); display: flex; flex-direction: column; align-items: center; gap: 2px; cursor: pointer; font: inherit; }
.sch-day.today { border-color: var(--sage-dark); }
.sch-day.on { background: var(--sage-dark); color: #fff; border-color: transparent; }
.sch-wd { font-size: 10.5px; text-transform: uppercase; opacity: .75; }
.sch-dnum { font-size: 16px; font-weight: 700; }
.sch-dot { position: absolute; bottom: 4px; width: 5px; height: 5px; border-radius: 50%; background: var(--sage-dark); }
.sch-day.on .sch-dot { background: #fff; }

/* ---- Профиль ---- */
#prof-body { padding: 0 18px 18px; }
.pf-hero { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 8px 0 18px; }
.pf-photo-wrap { position: relative; width: 84px; height: 84px; border-radius: 50%; cursor: pointer; margin-bottom: 10px; }
.pf-photo-wrap img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; }
.pf-photo-ph { width: 100%; height: 100%; border-radius: 50%; background: var(--sage-soft); color: var(--sage-dark); display: flex; align-items: center; justify-content: center; font-size: 32px; }
.pf-photo-edit { position: absolute; right: -2px; bottom: -2px; width: 28px; height: 28px; border-radius: 50%; background: var(--sage-dark); color: #fff; display: flex; align-items: center; justify-content: center; border: 2px solid var(--bg); }
.pf-photo-edit svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.pf-hero-name { font-size: 18px; font-weight: 700; color: var(--ink); }
.pf-hero-sub { font-size: 13px; color: var(--muted); margin-top: 2px; }
.pf-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 0 0 16px; }
.pf-stats .stat-box { margin: 0; padding: 10px 6px; }
.pf-stats .stat-box .label { font-size: 10.5px; }
.pf-stats .stat-box .num { font-size: 19px; }
.pf-card { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 14px 16px; margin-bottom: 12px; }
.pf-card-h { font-size: 12.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; margin-bottom: 2px; }
.pf-card label { font-size: 12.5px; color: var(--muted); display: block; margin: 12px 0 4px; }
.pf-card label:first-of-type { margin-top: 10px; }
/* Профиль в АРМ УЗИ переиспользует классы .dprofile-*/.hub-* из ux.css
   (единый дизайн с врачебной версией), но там они завязаны на
   #dprofile-pane — здесь дублируем только поля ввода/лейблы под .hub-pad. */
.hub-pad label { font-size: 12.5px; color: var(--muted); display: block; margin: 12px 0 4px; }
.hub-pad label:first-of-type { margin-top: 0; }
.hub-pad input, .hub-pad textarea {
  width: 100%; padding: 10px 12px; border-radius: 9px; border: 1px solid var(--border);
  font-size: 13.5px; background: var(--bg); color: var(--ink); box-sizing: border-box;
  font-family: inherit; resize: vertical;
}
.pf-card-rows { padding: 4px 0; }
.pf-card-rows .pf-card-h { padding: 10px 16px 6px; margin-bottom: 0; }
.pf-row {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 16px; min-height: 52px;
  background: none; border: none; border-top: 1px solid var(--line); color: var(--ink); font: inherit; font-size: 14.5px; text-align: left; cursor: pointer;
}
.pf-card-rows .pf-card-h + .pf-row { border-top: none; }
.pf-row-ico { width: 30px; height: 30px; border-radius: 9px; background: var(--sage-soft); color: var(--sage-dark); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.pf-row-ico svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.pf-row-t { flex: 1; min-width: 0; }
.pf-row-sub { font-size: 11.5px; color: var(--muted); flex-shrink: 0; }
.pf-chev { width: 18px; height: 18px; color: var(--muted); flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.pf-row.danger { color: var(--flag); }
.pf-row.danger .pf-row-ico { background: var(--flag-bg); color: var(--flag); }

/* ---- Архив ---- */
.arch-item { display: flex; gap: 10px; align-items: flex-start; padding: 12px 18px; border-bottom: 1px solid var(--line); cursor: pointer; }
.arch-item:active { background: var(--subtle); }
.arch-ico { width: 34px; height: 34px; border-radius: 9px; background: var(--sage-soft); color: var(--sage-dark); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.arch-ico svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.arch-info { min-width: 0; flex: 1; }
.arch-title { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.arch-meta { font-size: 12px; color: var(--muted); margin-top: 1px; }
.arch-snip { font-size: 12px; color: var(--muted); margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.arch-prog-bar { height: 6px; border-radius: 3px; background: var(--subtle); overflow: hidden; margin-top: 6px; }
.arch-prog-bar > i { display: block; height: 100%; background: var(--sage-dark); }

@media (min-width: 900px) {
  #schedule-screen, #profile-screen, #archive-screen { max-width: 640px; margin: 0 auto; padding-top: 6px; }
  body.armed:not(.has-protocol) .app.arm { padding-bottom: 0; }
  .uzi-tabs { max-width: 640px; left: 50%; transform: translateX(-50%); border-radius: 16px 16px 0 0; border: 1px solid var(--line); border-bottom: none; box-shadow: 0 -4px 16px rgba(0,0,0,.08); }
}

body.tab-other #protocol-empty { display: none !important; }
