/* Стили страницы записи (#/rec/<id>) по макету design/air/record.html — наполняются задачами T1–T10 переноса. */

/* ===== T1. Шапка записи и окно технических сведений =====
   Макет: design/air/record.html (?state=done) — record-refine.css, done.css, record-review.css.
   Перекрывает правила шапки из app.css (его не трогаем). Горизонтальный отступ контейнера — как у
   всей страницы (общий для app.css), не 44 px макета: иначе шапка разъедется с плеером. */
/* выше закреплённого плеера (app.css, z-index 20): иначе он перекрывает открытое меню «Действия» */
.record-head {
  position: relative; z-index: 21; background: transparent; border: 0; padding: 16px 0 10px;
  font-size: 15px; line-height: 1.55; color: #172c49;
}
/* меню пользователя в общей шапке — поверх .record-head (z-index 21): иначе «Выйти» не нажимается */
.screen-result > .app-bar { position: relative; z-index: 22; }
.record-head .container { display: block; padding-top: 6px; padding-bottom: 8px; }
.record-head .back { gap: 6px; min-height: 36px; font-size: 13px; font-weight: 500; color: #1858cd; }
.record-head .back:hover { color: #1858cd; text-decoration: underline; }
.record-head .head-title-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; margin-top: 4px; }
.record-head h1 { margin: 0; max-width: 100%; font-size: 26px; line-height: 28px; font-weight: 550; letter-spacing: -1px; }
.record-head #edit-title,
.record-head #edit-note {
  font: inherit; color: inherit; letter-spacing: inherit; background: transparent; border: 0; text-align: left; cursor: text;
  padding: 3px 0; border-radius: 5px; overflow-wrap: anywhere;
}
.record-head #edit-title:hover:not(:disabled),
.record-head #edit-note:hover:not(:disabled) { background: #ffffff80; box-shadow: 0 1px #91a1b5; }
.record-head #edit-title:disabled,
.record-head #edit-note:disabled { cursor: default; }
.record-head #edit-note { font-size: 13px; line-height: 1.5; color: #536780; max-width: 330px; letter-spacing: normal; }
.record-head .inline-record-input {
  font: inherit; width: min(100%, 540px); min-width: 0; background: #fff; border: 1px solid #72869d; border-radius: 6px;
  padding: 6px 9px; color: inherit;
}
.record-head textarea.inline-record-input { font-size: 14px; min-height: 65px; letter-spacing: normal; }
.record-head .inline-record-input:focus { outline: 2px solid #64798e; outline-offset: 2px; border-color: #64798e; box-shadow: none; }
.record-head #head-status { margin-left: auto; flex-shrink: 0; }
/* статус — бейдж макета (.badge и .unified .badge.phase-*): запись, обработка, ждёт подтверждения */
.record-head #head-status .badge { display: flex; gap: 6px; padding: 6px 10px; border-radius: 99px; font-size: 12px; font-weight: 500; line-height: 1.55; }
.record-head #head-status .badge-rec { background: #ffe1dc; color: #9d302c; }
.record-head #head-status .badge-primary { background: #dbe7ff; color: #214d98; }
.record-head #head-status .badge-warning { background: #ffebbe; color: #794500; }
.record-head .head-meta { gap: 18px; margin-top: 5px; font-size: 13px; line-height: 18px; color: #536780; font-variant-numeric: tabular-nums; }
.record-head .head-meta-item { display: block; gap: normal; align-items: normal; white-space: normal; }
.record-head .head-side {
  display: flex; flex-direction: row; align-items: center; justify-content: flex-end; gap: 24px; max-width: none; margin-top: 12px;
}
.record-tools { display: flex; align-items: center; gap: 10px; min-width: 0; flex-shrink: 0; }
.record-tools .btn {
  height: auto; min-height: 38px; padding: 8px 13px; border-radius: 9px; font-size: 12px; font-weight: 550;
  background: #ffffff60; border: 1px solid #c6d3e3; color: #4b607b;
}
.record-tools .btn:hover { background: #ffffff60; filter: brightness(.96); }
#record-tech-toggle { background: transparent; border-color: #c4d2e7; color: #405875; gap: 12px; }
#record-tech-toggle svg { flex: none; }
.record-tools :is(button, summary):focus-visible { outline: 2px solid #1858cd; outline-offset: 3px; }

/* Меню «Действия»: макет рисует один пункт (удаление) — остальные пункты в тех же токенах. */
.record-head .record-actions { position: relative; display: block; }
.record-actions > summary { display: flex; gap: 8px; list-style: none; cursor: pointer; }
.record-actions > summary::-webkit-details-marker { display: none; }
.record-actions-list {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 6; display: grid; min-width: 100%;
  background: #f8fbff; border: 1px solid #c6d3e3; border-radius: 9px; box-shadow: 0 8px 24px #172c491c; overflow: hidden;
}
.record-actions-list > button {
  min-height: 44px; padding: 8px 13px; border: 0; background: transparent; text-align: left; white-space: nowrap;
  font: inherit; font-size: 13px; color: #24354b; cursor: pointer;
}
.record-actions-list > button + button { border-top: 1px solid #e3eaf3; }
.record-actions-list > button:hover { background: #e3ebf5; }
.record-actions-list > button[aria-checked="true"] { color: #1858cd; font-weight: 550; }
.record-actions-list > button.danger { color: #9c332a; }
.record-actions-list > button:disabled { opacity: .5; cursor: default; }
.record-actions-list > button:focus-visible { outline: 2px solid #1858cd; outline-offset: -2px; }

/* Окно «Распознавание и время по шагам» (popover). Как в макете: общая часть — record-refine.css,
   оформление на широком экране (≥1000 px, окно под кнопкой, top/left ставит head.js) — done.css,
   на узком — окно по центру, record-refine.css. */
#record-tech {
  color: #24354b; border: 1px solid #bfd0e7; border-radius: 14px; background: #fff;
  max-width: calc(100vw - 32px); max-height: 80dvh; overflow: auto; font-size: 15px; line-height: 1.55;
}
#record-tech button:focus-visible { outline: 2px solid #1858cd; outline-offset: 3px; }
#record-tech .tech-header .btn { height: auto; color: #172c49; border-color: #d5e1f2; background: #fff; font-weight: 550; }
#record-tech .speakers-bar { display: block; font-size: inherit; }
@media screen and (min-width: 1000px) {
  #record-tech {
    position: fixed; inset: auto; margin: 0; width: 760px; padding: 0; box-shadow: 0 18px 60px #15346230;
    font-size: 13px; overscroll-behavior: contain;
  }
  #record-tech::backdrop { background: transparent; }
  #record-tech .tech-header {
    display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 20px 24px;
    background: #f2f6fd; border-bottom: 1px solid #dce5f2;
  }
  #record-tech h2 { font-size: 19px; font-weight: 600; margin: 0; }
  #record-tech .tech-header p { font-size: 12px; color: #607086; margin: 5px 0 0; }
  #record-tech .tech-header .btn { font-size: 22px; padding: 0; width: 34px; min-height: 34px; border-radius: 8px; }
  #record-tech .tech-grid { display: grid; grid-template-columns: 240px 1fr; gap: 24px; padding: 24px; }
  #record-tech h3 { font-size: 14px; font-weight: 600; margin: 0 0 12px; }
  #record-tech .tech-model {
    display: inline-block; background: #e2ecff; border-radius: 5px; padding: 6px 10px; color: #153e7b; font-weight: 600; margin: 0 0 16px;
  }
  #record-tech dl { margin: 0; }
  #record-tech .tech-stats > div { margin: 0 0 12px; }
  #record-tech .tech-stats dt { font-size: 12px; color: #607086; }
  #record-tech .tech-stats dd { margin: 3px 0 0; font-size: 17px; font-weight: 600; }
  #record-tech .tech-speakers-title { margin-top: 24px; }
  #record-tech .tech-speakers { display: flex; gap: 8px; margin: 0 0 7px; }
  #record-tech .tech-speakers span { padding: 4px 10px; border-radius: 5px; background: #e2ecff; color: #174ba3; }
  #record-tech .tech-speakers span + span { background: #e4f3ef; color: #24645a; }
  #record-tech .tech-caption { font-size: 12px; color: #607086; margin: 0; }
  #record-tech .tech-steps { border-left: 1px solid #e0e7ef; padding-left: 24px; }
  #record-tech .tech-steps dl > div { display: flex; justify-content: space-between; gap: 16px; padding: 9px 0; border-bottom: 1px solid #edf0f5; }
  #record-tech .tech-steps dd { margin: 0; white-space: nowrap; font-weight: 600; font-variant-numeric: tabular-nums; }
  #record-tech .tech-steps small { display: block; font-size: 11px; color: #607086; margin-top: 4px; }
  #record-tech .tech-usage { display: grid; gap: 7px; margin-top: 15px; font-size: 11px; color: #607086; }
  #record-tech .tech-usage span { display: flex; justify-content: space-between; gap: 8px; }
  #record-tech .tech-usage b { font-weight: 500; color: #405875; }
  #record-tech .tech-total {
    display: flex; align-items: center; justify-content: space-between; padding: 17px 24px;
    background: #edf3fc; border-top: 1px solid #dce5f2;
  }
  #record-tech .tech-total strong { font-size: 24px; color: #1858cd; font-variant-numeric: tabular-nums; }
}
#record-tech .tech-usage[hidden] { display: none; }

@media screen and (max-width: 999px) {
  .record-head .container { padding-top: 10px; padding-bottom: 12px; }
  .record-head h1 { font-size: 30px; line-height: 1.22; }
  .record-head .head-title-row { gap: 7px; }
  .record-head #edit-note { max-width: none; flex-basis: 100%; min-height: 38px; }
  .record-head #head-status { margin-left: 0; }
  .record-head .head-meta { gap: 8px; margin-top: 10px; }
  .record-head .head-side { justify-content: flex-start; align-items: normal; gap: 12px; }
  .record-tools { width: 100%; gap: 6px; flex-wrap: nowrap; }
  .record-tools .btn { min-height: 44px; padding: 7px 9px; font-size: 11px; }
  #record-tech-toggle { flex: 1; gap: 6px; background: #ffffff60; border-color: #c6d3e3; color: #4b607b; }
  #record-tech { inset: 0; margin: auto; padding: 18px; }
  #record-tech .tech-header { display: flex; align-items: start; gap: 12px; justify-content: space-between; }
  #record-tech .tech-header .btn { font-size: 13px; padding: 10px 16px; border-radius: 12px; min-height: 44px; }
  #record-tech h2 { font-size: 19px; margin: 0; }
  #record-tech h3 { font-size: 16px; margin: 18px 0 10px; }
  #record-tech p { font-size: 13px; }
  #record-tech .tech-grid { display: block; }
  #record-tech .tech-grid dl { margin: 0; }
  #record-tech .tech-grid dl > div {
    display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid #e3eaf3; font-size: 13px;
  }
  #record-tech .tech-grid dd { margin: 0; white-space: nowrap; }
  #record-tech .tech-grid small { display: block; }
  #record-tech .tech-total { display: flex; gap: 20px; margin-top: 18px; font-size: 13px; }
  #record-tech .tech-usage span { display: block; font-size: 12px; margin-top: 8px; }
}
@media print { #record-tech, .record-tools { display: none !important; } }

/* ===== T2 — транскрипция боковым окном (чат 2-26-175) =====
   Значения — вычисленные стили макета design/air/record.html?state=done&transcript=open на 1280 и 390
   (unified.css, record-refine.css, consult.css). Высоту держит окно, прокручивается только список
   #transcript: ограничений 650/320 px, из-за которых внизу был белый блок, нет. Классы .turn/.msg/.name
   остались от вкладки (на них опираются тесты), поэтому их правила из app.css здесь перекрыты.
   Кнопки обмена ролей и пояснения в окне нет: обмен — пункт меню «Действия» (решение владельца 9, T1). */
.record-tabs-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.transcript-toggle {
  height: auto; min-height: 44px; padding: 10px 16px; border: 1px solid rgb(213, 225, 242); border-radius: 12px;
  background: #fff; color: rgb(23, 44, 73); font-size: 12px; font-weight: 550; line-height: 1.55;
}
.transcript-scrim { position: fixed; inset: 0; z-index: 40; background: rgba(23, 40, 62, .4); }
.transcript-scrim[hidden], #transcript-drawer[hidden] { display: none; }
#transcript-drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 41;
  display: flex; flex-direction: column; overflow: hidden; overscroll-behavior: contain;
  width: 580px; max-width: 80vw; height: 100dvh; max-height: 100dvh; box-sizing: border-box;
  padding: 24px; border-left: 1px solid #b7cbed; border-radius: 20px 0 0 20px;
  background: #fff; color: rgb(23, 44, 73); font-size: 15px; line-height: 1.55;
}
#transcript-drawer .btn {
  height: auto; min-height: 44px; padding: 10px 16px; gap: 8px; border: 1px solid rgb(213, 225, 242); border-radius: 12px;
  background: #fff; color: rgb(23, 44, 73); font-weight: 550; line-height: 1.55;
}
#close-transcript { flex: none; align-self: flex-end; font-size: 13px; }
#transcript-drawer .transcript-panel {
  display: flex; flex-direction: column; flex: 1; min-height: 0; margin: 0; padding: 18px 0 0; overflow: hidden;
}
#transcript-title { flex: none; margin: 0 0 16px; font-size: 19px; font-weight: 550; line-height: 1.55; }
#transcript-drawer .speaker-tools { flex: none; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin: 18px 0; }
#transcript-drawer .speaker-tools[hidden] { display: none; }
#transcript-drawer .speaker-tools label { display: flex; align-items: center; gap: 7px; min-height: 44px; font-size: 13px; }
#transcript-drawer .speaker-tools input { accent-color: rgb(24, 88, 205); }
#transcript-drawer .transcript-body { display: flex; flex-direction: column; flex: 1; min-height: 0; overflow-y: auto; }
#transcript-drawer #transcript {
  display: block; flex: 1; min-height: 0; height: auto; max-height: none; padding: 0 6px 0 0; gap: 0;
  overflow-y: auto; overscroll-behavior: contain;
}
#transcript-drawer .transcript-turn {
  display: block; max-width: 90%; box-sizing: border-box; margin: 16px 0; padding: 15px; border-radius: 15px; background: #e6eeff;
}
#transcript-drawer .transcript-turn[hidden] { display: none; }
#transcript-drawer .transcript-turn[data-side="patient"] { margin-left: auto; background: #ddf2ec; }
#transcript-drawer .transcript-turn h3 { margin: 0 0 7px; color: rgb(83, 103, 128); font-size: 12px; font-weight: 700; line-height: 1.55; }
#transcript-drawer .transcript-turn[data-side="patient"] h3 { text-align: right; }
#transcript-drawer .transcript-turn .name { padding: 0; color: inherit; font-size: inherit; font-weight: inherit; line-height: inherit; }
#transcript-drawer .msg {
  display: block; max-width: none; margin: 0; padding: 0; border-radius: 0; background: none;
  font-size: 14px; line-height: 1.65; cursor: pointer;
}
@media (max-width: 999px) {
  #transcript-drawer {
    inset: 0; width: 100%; max-width: 100%; border: 0; border-radius: 0;
    padding: max(18px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right))
      max(18px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  }
  #transcript-drawer .speaker-tools { gap: 6px 14px; margin: 10px 0; }
  #transcript-title { font-size: 20px; }
  #transcript-drawer #transcript { padding-right: 10px; }
}
@media (max-width: 700px) {
  .transcript-toggle { padding: 10px; }
}


/* ===== T3 — лист документа (макет design/air/record.html, состояние done; done.css, record-refine.css).
   Только экран: печать листа не меняется (печатная форма — задача T6). На экране шапка госформы, таблица
   пациента, дата, врач и подпись скрыты; данные пациента — полями в левой колонке 300px, разделы — справа
   с номерами строк по порядку. Граница раскладки — 1000px, как в макете. ===== */
@media screen {
  .exam-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px;
    margin-bottom: 12px; padding: 4px 0; font-size: 13px; color: #536780; }
  .exam-toolbar #edit-actions { display: flex; align-items: center; gap: 8px; }
  .exam-toolbar #edit-actions .btn { min-height: 44px; padding: 0 12px; border-radius: 12px; font-size: 13px;
    font-weight: 550; }
  .exam-toolbar #exam-save { background: #fff; color: var(--primary); border: 1px solid #a8bee7; }
  .exam-toolbar #exam-save:disabled { background: #f5f8fd; color: #566a84; border-color: #d5e1f2; opacity: 1; }
  .exam-toolbar #exam-confirm { background: #1858cd; border: 1px solid #1858cd; color: #fff; }
  .exam-toolbar #exam-print, .exam-toolbar #exam-unconfirm { background: #fff; border: 1px solid #d5e1f2; color: #172c49; }

  .examdoc-sheet.exam-form { max-width: none; margin: 0; padding: 0; overflow: hidden; background: #fff;
    border: 1px solid #d5e1f2; border-radius: 12px; box-shadow: 0 4px 18px #244a8508;
    font-family: inherit; font-size: 14px; line-height: normal; color: #24354b; }
  .exam-form > .examdoc-top, .exam-form > h3, .exam-form > table.examdoc-pt,
  .exam-form .examdoc-date, .exam-form [data-field="doctor"], .exam-form .examdoc-sign,
  .exam-form .examdoc-h-print { display: none; }

  .exam-form .document-patient { padding: 18px; background: #f6f8fb; border-right: 1px solid #e0e7ef; }
  .exam-form .patient-fields { padding: 14px 12px; border: 1px solid #becfec; border-radius: 10px; background: #e2ecff; }
  .exam-form .patient-fields h3 { margin: 0 0 12px; font-size: 16px; font-weight: 550; line-height: 18px;
    color: #153e7b; text-align: left; letter-spacing: normal; }
  .exam-form .patient-grid { display: grid; grid-template-columns: 1fr; gap: 8px; }
  .exam-form .patient-field { display: block; }
  .exam-form .patient-field label { display: block; margin-bottom: 3px; font-size: 12px; color: #425b7c; }
  .exam-form .patient-field input { box-sizing: border-box; width: 100%; min-height: 32px; padding: 4px 7px;
    font: inherit; font-size: 14px; font-weight: 550; color: #172c49; background: #f8fbff;
    border: 1px solid #c5d4ed; border-radius: 5px; }
  .exam-form .patient-field input:placeholder-shown { background: #fff8e9; border-bottom: 1px dashed #b38a46; }
  .exam-form .patient-field input::placeholder { color: #855312; opacity: 1; }
  .exam-form .patient-field input:disabled { background: #f8fbff; border-bottom-style: solid; }
  .exam-form .patient-note { display: none; min-height: 0; }
  .exam-form .patient-field input[aria-invalid="true"] + .patient-note { display: block; color: #a33b26; font-size: 12px; }

  .exam-form .document-sections { padding: 0 24px 12px; }
  .exam-form .examdoc-f.form-row, .exam-form .examdoc-f-optional { margin: 0; padding: 11px 0 9px;
    border-radius: 0; border-bottom: 1px solid #e6ebf1; }
  .exam-form .examdoc-f:focus-within { background: none; }
  .exam-form .form-row .examdoc-h { display: block; margin: 0 0 4px; font-size: 14px; font-weight: 600;
    line-height: 21px; color: #24354b; }
  .exam-form .row-number { display: inline-block; min-width: 18px; margin-right: 9px; font-size: 12px; color: #607086; }
  .exam-form .examdoc-f .examdoc-t, .exam-form .examdoc-editable-list, .exam-form .examdoc-dx {
    margin: 0; padding: 3px 0; min-height: 30px; font-size: 14px; line-height: 1.5; color: #24354b;
    border: 1px solid transparent; border-radius: 4px; }
  .exam-form .examdoc-editable-list { padding-left: 1.2em; }
  .exam-form .examdoc-t:hover, .exam-form .examdoc-editable-list:hover, .exam-form .examdoc-dx:hover { background: #f7f9fc; }
  .exam-form .examdoc-t:focus, .exam-form .examdoc-editable-list:focus, .exam-form .examdoc-dx:focus-within {
    background: #f7f9fc; border-color: #1858cd; padding-left: 8px; }
  .exam-form .examdoc-editable-list:focus { padding-left: calc(1.2em + 8px); }
  .exam-form .examdoc-add-optional { font-size: 14px; }
  .exam-form .examdoc-dx-prelim[aria-pressed="false"] { font-size: 12px; }
}
@media screen and (min-width: 1000px) {
  .examdoc-sheet.exam-form { display: grid; grid-template-columns: 300px minmax(0, 1fr); align-items: start; }
  .exam-form .document-patient { grid-column: 1; grid-row: 1 / span 2; align-self: stretch; }
  .exam-form .document-sections { grid-column: 2; }
}
@media screen and (max-width: 999px) {
  .exam-toolbar { margin-bottom: 14px; }
  .exam-toolbar #edit-actions { flex-wrap: wrap; width: 100%; }
  .exam-toolbar #edit-actions .btn { padding: 10px 12px; font-size: 12px; }
  .examdoc-sheet.exam-form { display: block; border-radius: 18px; box-shadow: 0 6px 24px #244a8510; }
  .exam-form .document-patient { padding: 0; background: none; border-right: 0; }
  .exam-form .patient-fields { padding: 18px; background: #f6f8fb; border: 0; border-bottom: 1px solid #dce5ef;
    border-radius: 0; }
  .exam-form .patient-fields h3 { color: #172c49; }
  .exam-form .patient-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .exam-form .patient-field { display: flex; flex-direction: column; gap: 4px; }
  .exam-form .patient-field label { margin: 0; font-size: 12px; line-height: 14px; }
  .exam-form .patient-field input { min-height: 44px; padding: 8px; font-size: 16px; font-weight: 500;
    background: #fff; border-color: #ccd8e8; }
  .exam-form .patient-field[data-key="iin"], .exam-form .patient-field[data-key="phone"] {
    grid-column: 1 / -1; display: grid; grid-template-columns: 78px 1fr; align-items: center; column-gap: 12px; }
  .exam-form .patient-field[data-key="birth_date"] { grid-column: 2; grid-row: 2; }
  .exam-form .patient-field[data-key="iin"] { grid-row: 3; }
  .exam-form .patient-field[data-key="phone"] { grid-row: 4; }
  .exam-form .patient-field[data-key="iin"] .patient-note, .exam-form .patient-field[data-key="phone"] .patient-note {
    grid-column: 2; }
  .exam-form .document-sections { padding: 0; }
  .exam-form .examdoc-f.form-row, .exam-form .examdoc-f-optional { padding: 16px 28px; border-bottom-color: #edf2f7; }
  .exam-form .form-row .examdoc-h { display: flex; gap: 9px; padding-top: 8px; margin-bottom: 12px;
    font-weight: 500; color: #172c49; }
  .exam-form .row-number { display: block; margin: 0; }
  .exam-form .examdoc-f .examdoc-t, .exam-form .examdoc-editable-list, .exam-form .examdoc-dx {
    padding: 5px 8px; min-height: 130px; font-size: 16px; line-height: 1.6; background: #f5f8fd; border-radius: 10px; }
  .exam-form .examdoc-date + .form-row .examdoc-t { min-height: 96px; }
  .exam-form .examdoc-t:focus, .exam-form .examdoc-dx:focus-within { padding-left: 8px; }
}
@media print {
  .exam-form .document-patient, .exam-form .row-number, .exam-form .row-title { display: none; }
}

/* T4 — окно «Тематика и шаблон» по метке шаблона (design/air: record-refine.css, consult.css). */
#choose-template { font: inherit; font-size: 13px; cursor: pointer; padding: 7px 12px; min-height: 36px; border: 1px solid #bbcbe0; border-radius: 8px; background: #ffffff80; color: #405875; white-space: nowrap; align-self: flex-start; }
#choose-template::after { content: '⌄'; margin-left: 10px; }
#choose-template:focus-visible, #template-dialog button:focus-visible { outline: 2px solid #64798e; outline-offset: 3px; }
@media screen and (max-width: 999px) { #choose-template { margin-right: auto; min-height: 44px; } }
#template-dialog { --primary: #1858cd; --primary-strong: #1246a4; width: 440px; max-width: calc(100% - 32px); padding: 24px; border: 1px solid #d5e1f2; border-radius: 16px; overflow: visible; color: #172c49; font-size: 15px; }
#template-dialog::backdrop { background: #17283e66; }
#template-dialog h2 { font-size: 21px; font-weight: 700; margin: 0 0 24px; }
#template-dialog .summary-picks { display: grid; margin: 0; gap: 18px; grid-template-columns: minmax(0, 1fr); grid-auto-flow: row; border: 0; padding: 0; }
#template-dialog .choice-field { position: relative; display: grid; gap: 7px; font-size: 13px; min-width: 0; grid-template-columns: minmax(0, 1fr); color: #536780; }
#template-dialog .choice-trigger { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; min-height: 44px; padding: 10px 12px; background: #f8fbff; border: 1px solid #c6d3e3; border-radius: 8px; font: inherit; color: #24354b; text-align: left; cursor: pointer; }
#template-dialog .choice-trigger:disabled { opacity: .6; cursor: not-allowed; }
#template-dialog .choice-options { position: absolute; left: 0; right: 0; top: 100%; z-index: 10; margin-top: 5px; padding: 5px; border: 1px solid #c6d3e3; border-radius: 10px; background: #f8fbff; box-shadow: 0 10px 30px #172c4920; }
#template-dialog .choice-options[hidden] { display: none; }
#template-dialog .choice-options button { display: block; width: 100%; padding: 10px; min-height: 44px; background: transparent; border: 0; border-radius: 6px; text-align: left; font: inherit; color: #24354b; cursor: pointer; }
#template-dialog .choice-options button:hover, #template-dialog .choice-options button[aria-selected=true] { background: #e3ebf5; }
#template-dialog form { text-align: right; margin-top: 24px; }
#template-dialog .btn-primary { border-color: var(--primary); }
#template-dialog .btn { min-height: 44px; border-radius: 12px; font-size: 13px; font-weight: 550; padding: 10px 16px; }
@media print { #template-dialog { display: none !important; } }

/* T6 — печатная форма документа (решение владельца 5 от 27.09; макет design/record-wait/styles.css
   #print-preview, .print-controls и design/air/consult.css .print-controls .btn). «Печать» показывает
   форму без правки поверх страницы (views/record/print.js), всё остальное на экране и в печати скрыто;
   PDF сохраняет браузер. В печати форма идёт с начала листа — правила сильнее печати живого листа
   в app.css (body.has-examdoc .examdoc-sheet) за счёт #print-sheet. */
#print-preview { padding: 24px 16px 40px; }
.print-controls { max-width: 780px; margin: 0 auto 20px; display: flex; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; }
.print-controls .btn { margin: 8px; }
body.printing-preview #app > :not(#print-preview) { display: none; }
@media print {
  body.printing-preview #app > :not(#print-preview),
  body.printing-preview .print-controls { display: none !important; }
  body.printing-preview #print-preview { display: block !important; padding: 0; }
  body.printing-preview #print-sheet { position: static; width: 100%; max-width: none; border: 0; padding: 0;
    box-shadow: none; }
  body.printing-preview #print-sheet,
  body.printing-preview #print-sheet * { visibility: visible; }
}

/* ===== T5 — запись на экране записи: запись → обработка → документ (чат 2-26-175) =====
   Макет design/air: unified.css (#live-room, .live-*, [data-view=recording]) и record-review.css (до 999 px,
   заглушки разделов в обработке — .field-skeleton, document-pulse). Состояние экрана — data-view на корне
   (record/live.js): recording, processing, done. Живого текста нет — в #live-chat только «Слушаем…». */
.screen-result #live-room { grid-column: 1 / -1; background: #fff; border: 1px solid #cddcf1; border-radius: 20px;
  overflow: hidden; }
.screen-result #live-room[hidden] { display: none; }
.screen-result .live-top { display: flex; align-items: center; gap: 24px; padding: 24px 28px; background: #e2ecff;
  border-bottom: 1px solid #cbdcf7; height: 99px; box-sizing: border-box; }
.screen-result .live-top h2 { font-size: 24px; color: #173f7a; font-weight: 550; margin: 0 0 5px; }
.screen-result .live-top p { font-size: 13px; color: #496687; margin: 0; }
.screen-result .live-clock { display: flex; gap: 10px; align-items: center; font-size: 24px;
  font-variant-numeric: tabular-nums; margin-left: auto; color: #913a36; }
.screen-result .live-clock i { width: 9px; height: 9px; border-radius: 50%; background: #c84d47; }
.screen-result #finish-recording { min-width: 148px; white-space: pre; }
.screen-result #finish-recording:disabled { opacity: 1; background: #e0ece9; color: #246454; border-color: #b8d7ce; }
.screen-result .live-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; }
.screen-result #live-chat { height: 565px; overflow: auto; padding: 24px 32px; overscroll-behavior: contain; }
.screen-result .listening { font-size: 13px; color: #456386; margin: 12px 0 0; }
.screen-result .live-aside { background: #f2f7ff; padding: 24px; border-left: 1px solid #dce7f6; min-width: 0; }
.screen-result .live-aside h3 { font-size: 16px; margin: 14px 0 8px; font-weight: 550; color: #173f7a; }
.screen-result .live-aside p { font-size: 13px; line-height: 1.7; color: #4f6380; margin: 0; }
.screen-result .live-aside hr { border: 0; border-top: 1px solid #d1dff3; margin: 25px 0; }
.screen-result .live-aside button { margin-top: 24px; font-size: 12px; width: 100%; }
.screen-result .listening-wave { height: 52px; display: flex; align-items: center; gap: 5px; }
/* высоту полос задаёт уровень звука (live.js); без звука — ритм макета */
.screen-result .listening-wave i { display: block; width: 6px; height: 18px; border-radius: 3px; background: #1858cd; }
.screen-result .listening-wave i:nth-child(4n) { background: #168d88; }

/* во время записи — только комната разговора: документа ещё нет */
.screen-result[data-view=recording] .record-tabs-row,
.screen-result[data-view=recording] .main > [role=tabpanel],
.screen-result[data-view=recording] .layout > .side { display: none !important; }
.screen-result[data-view=recording] #rec-duration { display: none; }
.screen-result[data-view=recording] .player .skip { visibility: hidden; }
.screen-result[data-view=recording] .player .play { background: #ffe1dc; color: #9d302c; opacity: 1; }
.screen-result[data-view=recording] .wave-cursor { display: none; }
.screen-result[data-view=recording] .player .time { white-space: pre; }

/* обработка: разделы документа — две полоски-заглушки (макет: .field-skeleton, document-pulse) */
.screen-result .wait-skel { gap: 14px; }
.screen-result .wait-skel .wait-skel-line { height: 10px; background: #dce6f4; width: 92%;
  animation: t5-document-pulse 1.5s ease-in-out infinite; }
.screen-result .wait-skel .wait-skel-line:last-child { width: 65%; }
@keyframes t5-document-pulse { 50% { opacity: 0.35; } }

@media screen and (max-width: 999px) {
  .screen-result .live-layout { grid-template-columns: minmax(0, 1fr); }
  .screen-result .live-top { height: auto; padding: 18px; gap: 12px; flex-wrap: wrap; }
  .screen-result .live-top > div:first-child { flex-basis: 100%; }
  .screen-result .live-clock { margin-left: 0; margin-right: auto; }
  .screen-result #live-chat { height: 440px; padding: 18px; }
  .screen-result .live-aside { border-left: 0; border-top: 1px solid #dce7f6; padding: 18px; }
  .screen-result .live-aside h3 { margin-top: 0; }
  .screen-result .live-aside button { margin-top: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .screen-result .wait-skel .wait-skel-line { animation: none; }
}
@media print {
  .screen-result #live-room, .screen-result #live-alerts { display: none !important; }
}

/* T8 — теги лекарств в разделе «Назначения» (views/record/tags.js; макет design/air/drug-tags.css,
   состояние done; done.css и record-refine.css — вид раздела на компьютере). Зелёный тег и янтарный
   «доза?» — палитра макета; жёлтый, оранжевый и красный теги (цвет из проверки, решение 2 от 27.09)
   в макете не нарисованы — рамка и текст цветами пометок --mk-* (app.css), фон — их -bg. */
@media screen {
  .exam-form .tagged-copy { padding: 12px 14px 32px; border-radius: 10px; background: #f8fafd; font-size: 15px;
    line-height: 2.4; min-height: 112px; }
  .exam-form .tagged-prose { white-space: pre-wrap; margin: 0; padding-left: 1.2em; }
  .exam-form .drug-tag { display: inline-flex; vertical-align: baseline; align-items: center; border: 1px solid #83b59b;
    border-radius: 7px; background: #f1f8f4; line-height: 30px; white-space: nowrap; margin: 2px 3px 2px 0; }
  .exam-form .drug-tag-name { padding: 0 10px; color: #216345; font-weight: 550; }
  .exam-form .drug-tag button { font: inherit; line-height: 30px; border: 0; background: transparent; color: #216345;
    padding: 0 9px; cursor: pointer; }
  .exam-form .drug-tag .dose-trigger { border-left: 1px solid #b2d1c0; border-right: 1px solid #b2d1c0; font-size: 14px; }
  .exam-form .drug-tag .drug-tag-remove { font-size: 20px; padding: 0 9px; }
  .exam-form .drug-tag button:hover { background: #deeee4; }
  .exam-form .drug-tag.drug-needs-dose { border-color: #d2b47c; background: #fffcf5; }
  .exam-form .drug-needs-dose .drug-tag-name, .exam-form .drug-needs-dose button { color: #735019; }
  .exam-form .drug-needs-dose button:hover { background: #fbe8bf; }
  .exam-form .drug-tag.drug-yellow { border-color: var(--mk-yellow); background: var(--mk-yellow-bg); }
  .exam-form .drug-tag.drug-orange { border-color: var(--mk-orange); background: var(--mk-orange-bg); }
  .exam-form .drug-tag.drug-red { border-color: var(--mk-red); background: var(--mk-red-bg); }
  .exam-form .drug-yellow .drug-tag-name, .exam-form .drug-yellow button { color: var(--mk-yellow); }
  .exam-form .drug-orange .drug-tag-name, .exam-form .drug-orange button { color: var(--mk-orange); }
  .exam-form .drug-red .drug-tag-name, .exam-form .drug-red button { color: var(--mk-red); }
  .exam-form .drug-yellow .dose-trigger, .exam-form .drug-orange .dose-trigger,
  .exam-form .drug-red .dose-trigger { border-color: currentColor; }
  .exam-form .drug-tag .dose-attention { background: #fff0c9; color: #794500; }
  .exam-form .drug-tag button:disabled { cursor: default; opacity: .8; }
  .exam-form .drug-tag button:disabled:hover { background: transparent; }
  .exam-form .drug-tag .dose-attention:disabled:hover { background: #fff0c9; }
  .exam-form .dose-picker { margin: 14px 0 10px; padding: 16px 18px; border: 1px solid #a9bfdc; border-radius: 10px;
    background: white; max-width: 480px; line-height: 1.5; box-shadow: 0 5px 16px #214d8310; }
  .exam-form .dose-picker-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
  .exam-form .dose-picker-top b { font-size: 14px; color: #214d83; font-weight: 550; }
  .exam-form .dose-picker-top button { border: 0; background: transparent; color: #536780; font-size: 22px;
    cursor: pointer; padding: 0 6px; }
  .exam-form .dose-picker p { font-size: 12px; color: #536780; margin: 5px 0 12px; }
  .exam-form .dose-custom { display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; margin-top: 12px; }
  .exam-form .dose-custom label { grid-column: 1/-1; font-size: 12px; color: #536780; }
  .exam-form .dose-custom input { width: 100%; min-width: 0; border: 1px solid #b7cae3; border-radius: 6px;
    padding: 7px 10px; font: inherit; font-size: 14px; background: white; color: #172c49; }
  .exam-form .dose-custom button { background: #edf3fc; color: #214d83; border: 1px solid #b7cae3; border-radius: 6px;
    padding: 7px 12px; cursor: pointer; font: inherit; font-size: 13px; }
  .exam-form .dose-custom button:hover { background: #dce8fa; }
  .exam-form .edit-section-text { display: block; border: 0; background: transparent; color: #1858cd; font: inherit;
    font-size: 12px; line-height: 1.5; padding: 8px 0 0; cursor: pointer; text-decoration: underline;
    text-underline-offset: 3px; }
  .exam-form .edit-section-text:disabled { display: none; }
  .exam-form .drug-note { font-size: 12px; line-height: 1.5; color: #607086; margin: 3px 0; }
  .exam-form .drug-note:empty { display: none; }
}
@media screen and (min-width: 1000px) {
  .exam-form .tagged-copy { padding: 0; background: white; border-radius: 0; min-height: 0; font-size: 14px;
    line-height: 1.8; }
}

/* T9 — «Наше мнение» в левой колонке листа, под данными пациента (views/record/opinion.js; макет
   design/air/record-refine.css, «Patient context and prescription explanations share the left column»,
   и record-review.css). Зелёная и янтарная полосы — палитра макета; оранжевый и красный препарат
   (решение 2 от 27.09) в макете не нарисованы — полоса цветом пометки --mk-*, фон — её -bg, как у тегов T8. */
@media screen {
  .exam-form .document-patient { min-width: 0; }
  .exam-form .document-opinion .drug-check, .exam-form .document-opinion .check-pending { margin: 20px 0 0;
    padding: 18px 0 0; border: 0; border-top: 1px solid #d5dfeb; border-radius: 0; background: transparent; }
  .exam-form .document-opinion h3 { margin: 0 0 8px; font-size: 17px; font-weight: 550; color: #24354b;
    text-align: left; letter-spacing: normal; }
  .exam-form .document-opinion p { font-size: 13px; line-height: 1.55; color: #52647b; margin: 8px 0; }
  .exam-form .check-result { margin: 14px 0; padding: 10px 12px; border-left: 3px solid #b28a39; background: #fff8e8;
    font-size: 13px; border-radius: 0 6px 6px 0; }
  .exam-form .check-result.check-green { border-color: #237451; background: #eaf5ee; }
  .exam-form .check-result.check-orange { border-color: var(--mk-orange); background: var(--mk-orange-bg); }
  .exam-form .check-result.check-red { border-color: var(--mk-red); background: var(--mk-red-bg); }
  .exam-form .check-result summary { cursor: pointer; min-height: 24px; font-weight: 550; }
  .exam-form .check-skeleton { height: 44px; background: linear-gradient(#dce6f4 0 0) 0 0/94% 9px no-repeat,
    linear-gradient(#dce6f4 0 0) 0 22px/70% 9px no-repeat; animation: document-pulse 1.5s ease-in-out infinite; }
}
@keyframes document-pulse { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .exam-form .check-skeleton { animation: none; } }
@media screen and (max-width: 999px) {
  .exam-form .document-opinion .drug-check, .exam-form .document-opinion .check-pending { margin: 0; padding: 20px;
    background: #f6f8fb; border-bottom: 1px solid #d5dfeb; }
}
@media print {
  .exam-form .document-opinion { display: none; }
}
