/* Свободный приём — тренажёр клинического мышления */

:root {
  --bg:        #0e1319;
  --bg-2:      #151c25;
  --panel:     #1a222d;
  --panel-2:   #202a37;
  --line:      #2b3644;
  --line-2:    #384656;
  --text:      #e6edf5;
  --text-dim:  #97a5b8;
  --text-mute: #6b7a8d;
  --accent:    #3fa9c9;
  --accent-2:  #57c7e6;
  --ok:        #4bb98a;
  --warn:      #d9a33f;
  --alert:     #e0664f;
  --radius:    12px;
  --radius-sm: 8px;
  --shadow:    0 8px 28px rgba(0,0,0,.34);
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

/* Элементы с .speaking/.stetho-idle задают display, который перебивает
   атрибут hidden из UA-стилей — возвращаем ему приоритет. */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }

/* ---------- Верхняя панель ---------- */

.topbar {
  display: flex; align-items: center; gap: 24px;
  padding: 12px 22px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 30;
  flex-wrap: wrap;
}

.brand { display: flex; align-items: center; gap: 11px; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 8px; flex: none;
  background: linear-gradient(140deg, var(--accent), #2b7f99);
  position: relative;
}
.brand-mark::after {
  content: ""; position: absolute; inset: 0;
  background:
    linear-gradient(var(--text) 0 0) center/13px 2.5px no-repeat,
    linear-gradient(var(--text) 0 0) center/2.5px 13px no-repeat;
  opacity: .92;
}
.brand-name { font-weight: 650; font-size: 14.5px; letter-spacing: -.01em; }
.brand-sub  { font-size: 11.5px; color: var(--text-mute); }

.topbar-mid { display: flex; gap: 8px; flex: 1; flex-wrap: wrap; }
.chrono {
  display: grid; gap: 1px;
  padding: 5px 13px; border-radius: var(--radius-sm);
  background: var(--panel); border: 1px solid var(--line);
}
.chrono-label { font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-mute); }
.chrono-val {
  font-size: 15px; font-weight: 650; font-family: var(--mono);
  font-variant-numeric: tabular-nums; line-height: 1.15;
}

.topbar-right { display: flex; align-items: center; gap: 10px; }
.patient-chip {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 12px; border-radius: 20px;
  background: var(--panel); border: 1px solid var(--line);
  font-size: 12.5px; color: var(--text-dim);
}
.patient-chip .dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--ok);
  box-shadow: 0 0 0 3px rgba(75,185,138,.16);
}

/* ---------- Каркас ---------- */

.layout {
  display: grid;
  grid-template-columns: minmax(320px, 400px) minmax(0, 1fr);
  gap: 20px;
  padding: 20px 22px 48px;
  max-width: 1500px; margin: 0 auto;
  align-items: start;
}

.col-patient { display: grid; gap: 14px; position: sticky; top: 78px; }
.col-work { display: grid; gap: 14px; min-width: 0; }

/* ---------- Видео пациента ---------- */

.video-frame {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  background: #05080b;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  aspect-ratio: 1000 / 892;
}
.patient-video {
  position: absolute; inset: 0;
  width: 100%; height: 100%; object-fit: cover;
  opacity: 0; transition: opacity .45s ease;
}
.patient-video.is-active { opacity: 1; }

.video-badge {
  position: absolute; top: 10px; left: 10px;
  padding: 4px 10px; border-radius: 20px;
  background: rgba(10,15,20,.72); backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,.1);
  font-size: 11px; color: var(--text-dim); letter-spacing: .02em;
}

.speaking {
  position: absolute; top: 10px; right: 10px;
  display: flex; align-items: flex-end; gap: 2.5px; height: 24px;
  padding: 4px 10px; border-radius: 20px;
  background: rgba(10,15,20,.72); backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,.1);
}
.speaking .bar {
  width: 2.5px; border-radius: 2px; background: var(--accent-2);
  animation: talk .72s ease-in-out infinite;
}
.speaking .bar:nth-child(1) { height: 7px;  animation-delay: 0s; }
.speaking .bar:nth-child(2) { height: 13px; animation-delay: .11s; }
.speaking .bar:nth-child(3) { height: 9px;  animation-delay: .22s; }
.speaking .bar:nth-child(4) { height: 14px; animation-delay: .33s; }
.speaking .bar:nth-child(5) { height: 8px;  animation-delay: .44s; }
@keyframes talk { 0%,100% { transform: scaleY(.4); } 50% { transform: scaleY(1); } }
.speaking-label { font-size: 10.5px; color: var(--text-dim); margin-left: 5px; align-self: center; }

.subtitle {
  position: absolute; left: 10px; right: 10px; bottom: 10px;
  padding: 10px 13px; border-radius: var(--radius-sm);
  background: rgba(8,12,17,.86); backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,.09);
  font-size: 13.5px; line-height: 1.45; color: var(--text);
  animation: rise .3s ease;
}
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

/* ---------- Карточки левой колонки ---------- */

.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden;
}
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 13px; border-bottom: 1px solid var(--line);
  background: var(--panel-2);
}
.card-head h3 { font-size: 12.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-dim); }

/* Паспортная часть: пусто, пока врач не спросил. */
.passport {
  margin: 0; display: grid; grid-template-columns: auto minmax(0, 1fr);
}
.passport dt {
  padding: 7px 13px; border-bottom: 1px solid var(--line);
  font-size: 11px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--text-mute); white-space: nowrap;
}
.passport dd {
  margin: 0; padding: 7px 13px 7px 0; border-bottom: 1px solid var(--line);
  font-size: 12.5px; text-align: right;
}
.passport dt:last-of-type, .passport dd:last-of-type { border-bottom: 0; }
.passport dd.is-empty { color: var(--text-mute); font-style: italic; }
.passport dd.is-got { color: var(--text); animation: rise .25s ease; }

/* ---------- Показатели ---------- */

.vitals {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px;
  background: var(--line);
}
.vital { background: var(--panel); padding: 9px 11px; min-width: 0; }
.vital-label { font-size: 10.5px; color: var(--text-mute); text-transform: uppercase; letter-spacing: .05em; }
.vital-value {
  font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums;
  margin-top: 1px; display: flex; align-items: baseline; gap: 4px;
  white-space: nowrap;
}
.vital.is-wide .vital-value { font-size: 14px; }
.vital-unit { font-size: 10.5px; font-weight: 400; color: var(--text-mute); white-space: nowrap; }
.vital.is-warn  .vital-value { color: var(--warn); }
.vital.is-alert .vital-value { color: var(--alert); }
.vital.is-empty .vital-value { color: var(--text-mute); }
.vital.is-empty .vital-unit { font-style: italic; }

/* ---------- Карта осмотра ---------- */

.notepad {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden;
}
.notepad-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 13px; border-bottom: 1px solid var(--line);
  background: var(--panel-2);
}
.notepad-head h3 { font-size: 12.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-dim); }
.counter {
  min-width: 21px; height: 21px; padding: 0 6px; border-radius: 11px;
  display: grid; place-items: center;
  background: var(--line); color: var(--text-dim);
  font-size: 11px; font-weight: 650; font-variant-numeric: tabular-nums;
}
.notes { max-height: 250px; overflow-y: auto; }
.notes li {
  padding: 9px 13px; border-bottom: 1px solid var(--line);
  font-size: 13px; color: var(--text-dim);
  display: flex; gap: 9px; animation: rise .25s ease;
}
.notes li:last-child { border-bottom: 0; }
.notes-empty { color: var(--text-mute) !important; font-style: italic; }
.note-mark { flex: none; width: 5px; height: 5px; border-radius: 50%; margin-top: 7px; background: var(--text-mute); }
.note-mark.is-abn { background: var(--alert); box-shadow: 0 0 0 3px rgba(224,102,79,.16); }
.note-mark.is-ok  { background: var(--ok); }

/* ---------- Кнопки ---------- */

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 16px; border-radius: var(--radius-sm);
  border: 1px solid var(--line-2); background: var(--panel-2);
  color: var(--text); font: inherit; font-size: 13.5px; font-weight: 500;
  cursor: pointer; transition: .16s;
}
.btn:hover:not(:disabled) { background: #283446; border-color: #46586e; }
.btn:disabled { opacity: .42; cursor: not-allowed; }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.btn-primary {
  background: var(--accent); border-color: var(--accent); color: #04222c; font-weight: 600;
}
.btn-primary:hover:not(:disabled) { background: var(--accent-2); border-color: var(--accent-2); }

.btn-ghost { background: transparent; border-color: var(--line); color: var(--text-dim); }
.btn-ghost:hover:not(:disabled) { background: var(--panel-2); color: var(--text); }

.btn-lg { padding: 12px 22px; font-size: 14.5px; }
.btn-sm { padding: 6px 11px; font-size: 12px; }

.ico-play {
  width: 0; height: 0; flex: none;
  border-left: 8px solid currentColor;
  border-top: 5.5px solid transparent; border-bottom: 5.5px solid transparent;
}
.is-playing .ico-play {
  width: 9px; height: 11px; border: 0;
  background: linear-gradient(currentColor 0 0) left/3px 100% no-repeat,
              linear-gradient(currentColor 0 0) right/3px 100% no-repeat;
}

/* ---------- Протокол приёма ---------- */

.proto {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden;
}
.proto-head {
  display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap;
  padding: 13px 16px; border-bottom: 1px solid var(--line);
  background: var(--panel-2);
}
.proto-head h2 { font-size: 15px; }
.proto-hint { font-size: 12px; color: var(--text-mute); }

.log { max-height: 46vh; min-height: 180px; overflow-y: auto; }
.log-empty {
  padding: 34px 18px; text-align: center;
  color: var(--text-mute); font-style: italic; font-size: 13.5px;
}
.log-row {
  display: grid; grid-template-columns: 88px minmax(0, 1fr); gap: 12px;
  padding: 11px 16px; border-bottom: 1px solid var(--line);
  animation: rise .25s ease;
}
.log-row:last-child { border-bottom: 0; }

.log-meta { display: grid; gap: 2px; justify-items: start; }
.log-n {
  min-width: 20px; height: 20px; padding: 0 5px; border-radius: 6px;
  display: grid; place-items: center;
  background: var(--line); color: var(--text-dim);
  font-size: 11px; font-weight: 650; font-variant-numeric: tabular-nums;
}
.log-time { font-family: var(--mono); font-size: 11px; color: var(--text-mute); }
.log-cat { font-size: 10px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-mute); }

.log-body { min-width: 0; }
.log-act { font-size: 13.5px; font-weight: 600; }
.log-res { font-size: 13px; color: var(--text-dim); margin-top: 4px; line-height: 1.5; }
.log-res.is-ok   { color: var(--text-dim); }
.log-res.is-abn  { color: #f0a596; }
.log-res.is-warn { color: var(--warn); }
.log-res.is-key  { color: var(--text); }
.log-hint { font-size: 12.5px; color: var(--accent-2); margin-top: 5px; line-height: 1.5; }
.log-fix { font-size: 11.5px; color: var(--text-mute); margin-top: 2px; font-style: italic; }

/* Цветная левая метка по типу действия — видно алгоритм врача на глаз. */
.log-row.is-ask     .log-n { background: rgba(63,169,201,.22);  color: var(--accent-2); }
.log-row.is-measure .log-n { background: rgba(217,163,63,.2);   color: var(--warn); }
.log-row.is-exam    .log-n { background: rgba(75,185,138,.2);    color: var(--ok); }
.log-row.is-order   .log-n { background: rgba(150,170,195,.18);  color: var(--text-dim); }
.log-row.is-treat   .log-n { background: rgba(87,199,230,.16);   color: var(--accent-2); }
.log-row.is-dx      .log-n { background: var(--accent); color: #04222c; }
.log-row.is-unknown { background: rgba(217,163,63,.05); }
.log-row.is-unknown .log-act { color: var(--warn); font-weight: 500; }
.log-row.is-repeat { opacity: .62; }

/* ---------- Рабочая панель (аускультация) ---------- */

.panel {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden;
  animation: rise .3s ease;
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 11px 16px; border-bottom: 1px solid var(--line);
  background: var(--panel-2);
}
.panel-head h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-dim); }
.panel .auscult, .panel .coverage { padding: 0 16px; }
.panel .auscult { padding-top: 16px; }
.panel .coverage { padding-bottom: 16px; }

/* ---------- Консоль действий ---------- */

.console {
  background: var(--panel); border: 1px solid var(--line-2);
  border-radius: var(--radius); padding: 14px 16px 15px;
  display: grid; gap: 11px;
  box-shadow: var(--shadow);
  position: sticky; bottom: 12px;
}

.cats { display: flex; gap: 6px; flex-wrap: wrap; }
.cat-btn {
  padding: 6px 13px; border-radius: 20px;
  border: 1px solid var(--line); background: var(--bg-2);
  color: var(--text-dim); font: inherit; font-size: 12.5px;
  cursor: pointer; transition: .16s;
}
.cat-btn:hover { color: var(--text); border-color: var(--line-2); background: var(--panel-2); }
.cat-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.subcats { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.subcat-btn {
  padding: 4px 10px; border-radius: 999px; font-size: 12px;
  background: transparent; color: var(--text-mute);
  border: 1px dashed var(--line-2); cursor: pointer; transition: .15s;
}
.subcat-btn:hover { color: var(--text); border-color: var(--accent-2); }
.subcat-btn.is-on { color: var(--accent-2); border-style: solid; border-color: var(--accent-2); }
.subcat-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.cat-btn.is-on {
  background: var(--accent); border-color: var(--accent);
  color: #04222c; font-weight: 600;
}

.console-row { display: flex; gap: 9px; }
.console-input {
  flex: 1; min-width: 0;
  padding: 11px 14px; border-radius: var(--radius-sm);
  background: var(--bg-2); border: 1px solid var(--line-2);
  color: var(--text); font: inherit; font-size: 14px;
}
.console-input::placeholder { color: var(--text-mute); }
.console-input:focus { outline: none; border-color: var(--accent); background: #101821; }
.console-hint { font-size: 11.5px; color: var(--text-mute); line-height: 1.5; }

/* ---------- Уточнение неоднозначного ввода ---------- */

.clarify {
  display: grid; gap: 6px;
  padding: 12px 13px; border-radius: var(--radius-sm);
  background: rgba(217,163,63,.07); border: 1px solid rgba(217,163,63,.3);
  animation: rise .22s ease;
}
.clarify-head { font-size: 12.5px; color: var(--warn); margin-bottom: 2px; }
.clarify-btn {
  display: flex; align-items: baseline; gap: 10px; text-align: left;
  padding: 8px 12px; border-radius: var(--radius-sm);
  background: var(--panel-2); border: 1px solid var(--line-2);
  color: var(--text); font: inherit; font-size: 13px;
  cursor: pointer; transition: .16s;
}
.clarify-btn:hover { border-color: var(--accent); background: #283446; }
.clarify-btn.is-none { color: var(--text-mute); font-size: 12.5px; }
.clarify-cat {
  flex: none; font-size: 10px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--accent-2); min-width: 88px;
}

/* ---------- Аускультация ---------- */

.auscult { display: grid; grid-template-columns: minmax(200px, 260px) minmax(0, 1fr); gap: 20px; align-items: start; }
.chest-wrap {
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 10px;
}
.chest { width: 100%; height: auto; display: block; }
.chest-caption { fill: var(--text-mute); font-size: 10px; font-family: inherit; }
.chest-side { fill: var(--text-mute); font-size: 11px; font-weight: 700; font-family: inherit; }

.pt { cursor: pointer; }
.pt-hit { fill: transparent; }
.pt-ring {
  fill: rgba(63,169,201,.13); stroke: var(--accent); stroke-width: 1.6;
  transition: .18s;
}
.pt:hover .pt-ring { fill: rgba(63,169,201,.3); stroke: var(--accent-2); }
.pt-core { fill: var(--accent); transition: .18s; }
.pt.is-heard .pt-ring { stroke: var(--line-2); fill: rgba(150,170,190,.08); }
.pt.is-heard .pt-core { fill: var(--text-mute); }
.pt.is-abn .pt-ring { stroke: var(--alert); fill: rgba(224,102,79,.18); }
.pt.is-abn .pt-core { fill: var(--alert); }
.pt.is-current .pt-ring {
  stroke: var(--accent-2); stroke-width: 2.4;
  filter: drop-shadow(0 0 6px rgba(87,199,230,.6));
}
.pt.is-current.is-abn .pt-ring { stroke: var(--alert); filter: drop-shadow(0 0 7px rgba(224,102,79,.65)); }
.pt-pulse { fill: none; stroke: var(--accent-2); stroke-width: 2; opacity: 0; }
.pt.is-current .pt-pulse { animation: ping 1.5s ease-out infinite; }
.pt.is-current.is-abn .pt-pulse { stroke: var(--alert); }
@keyframes ping {
  0%   { r: 11; opacity: .7; }
  100% { r: 24; opacity: 0; }
}

.stetho { display: grid; gap: 12px; }
.stetho-screen {
  position: relative; border-radius: var(--radius);
  background: #080d13; border: 1px solid var(--line);
  overflow: hidden; aspect-ratio: 4 / 1; min-height: 110px;
}
.stetho-screen canvas { width: 100%; height: 100%; display: block; }
.stetho-idle {
  position: absolute; inset: 0; display: grid; place-items: center;
  color: var(--text-mute); font-size: 12.5px;
}

.stetho-readout {
  padding: 13px 15px; border-radius: var(--radius);
  background: var(--panel-2); border: 1px solid var(--line);
  border-left: 3px solid var(--line-2);
}
.stetho-readout.is-abn { border-left-color: var(--alert); }
.stetho-readout.is-ok  { border-left-color: var(--ok); }
.readout-title { font-size: 14.5px; font-weight: 600; }
.readout-desc { font-size: 13px; color: var(--text-dim); margin-top: 4px; }

.stetho-controls { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.vol { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-mute); }
.vol input { width: 96px; accent-color: var(--accent); }
.stetho-tip { font-size: 12px; color: var(--text-mute); }

.coverage { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 16px; }
.cov {
  padding: 4px 10px; border-radius: 20px; font-size: 11.5px;
  background: var(--bg-2); border: 1px solid var(--line); color: var(--text-mute);
}
.cov.is-heard { color: var(--text-dim); border-color: var(--line-2); }
.cov.is-abn { color: var(--alert); border-color: rgba(224,102,79,.45); background: rgba(224,102,79,.08); }

/* ---------- Разбор: перекрывающий лист ---------- */

.sheet {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(6,10,14,.82); backdrop-filter: blur(6px);
  overflow-y: auto; padding: 28px 18px 48px;
  animation: rise .3s ease;
}
.sheet-inner {
  max-width: 900px; margin: 0 auto;
  background: var(--bg-2); border: 1px solid var(--line-2);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 22px;
}
.sheet-foot {
  display: flex; gap: 10px; flex-wrap: wrap;
  padding-top: 16px; border-top: 1px solid var(--line); margin-top: 4px;
}

.result-head {
  display: flex; align-items: center; gap: 20px; flex-wrap: wrap;
  padding-bottom: 18px; border-bottom: 1px solid var(--line); margin-bottom: 18px;
}
.result-head h2 { font-size: 20px; }
.result-head p { font-size: 13.5px; color: var(--text-dim); margin-top: 4px; }
.result-total {
  flex: none; min-width: 116px; padding: 14px 18px;
  border-radius: var(--radius); text-align: center;
  background: var(--panel-2); border: 1px solid var(--line);
  font-size: 30px; font-weight: 700; font-variant-numeric: tabular-nums;
  letter-spacing: -.02em;
}
.result-total.is-good { color: var(--ok);    border-color: rgba(75,185,138,.4); }
.result-total.is-mid  { color: var(--warn);  border-color: rgba(217,163,63,.4); }
.result-total.is-bad  { color: var(--alert); border-color: rgba(224,102,79,.4); }

.scores {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); gap: 1px;
  background: var(--line); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; margin-bottom: 14px;
}
.score { background: var(--panel-2); padding: 12px 14px; }
.score-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-mute); }
.score-value { font-size: 20px; font-weight: 650; font-variant-numeric: tabular-nums; margin-top: 2px; }
.score-note { font-size: 11.5px; color: var(--text-mute); margin-top: 2px; }
.score.is-good .score-value { color: var(--ok); }
.score.is-mid  .score-value { color: var(--warn); }
.score.is-bad  .score-value { color: var(--alert); }

.block {
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--panel-2); padding: 16px 18px; margin-bottom: 12px;
}
.block h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-mute); margin-bottom: 10px; }
.block p { font-size: 13.5px; color: var(--text-dim); line-height: 1.6; }
.block.is-trap { border-left: 3px solid var(--warn); }
.block-note { font-size: 12px; color: var(--text-mute); margin-top: 10px; }
.all-clear { color: var(--ok) !important; font-size: 13.5px; }

/* Хронология — предъявленный алгоритм врача. */
.timeline { display: grid; gap: 1px; background: var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.tl {
  display: grid; grid-template-columns: 52px 108px minmax(0, 1fr); gap: 10px;
  background: var(--panel); padding: 7px 12px;
  font-size: 12.5px; align-items: baseline;
}
.tl.is-void { background: rgba(217,163,63,.06); }
.tl-time { font-family: var(--mono); font-size: 11px; color: var(--text-mute); }
.tl-cat { font-size: 10.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--accent-2); }
.tl.is-void .tl-cat { color: var(--warn); }
.tl-act { color: var(--text-dim); }

/* Группы ошибок. */
.err-group { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 12px; }
.err-group:first-child { border-top: 0; padding-top: 0; margin-top: 0; }
.err-group h4 {
  display: flex; align-items: center; gap: 8px;
  font-size: 12.5px; color: var(--alert); margin-bottom: 8px;
}
.err-n {
  min-width: 19px; height: 19px; padding: 0 5px; border-radius: 10px;
  display: grid; place-items: center;
  background: rgba(224,102,79,.18); color: var(--alert);
  font-size: 10.5px; font-weight: 650;
}
.err-group ul { display: grid; gap: 8px; }
.err-group li { display: grid; gap: 2px; font-size: 13px; padding-left: 12px; position: relative; }
.err-group li::before {
  content: ""; position: absolute; left: 0; top: 7px;
  width: 4px; height: 4px; border-radius: 50%; background: var(--alert);
}
.err-group li b { font-weight: 600; color: var(--text); }
.err-group li span { color: var(--text-mute); font-size: 12.5px; line-height: 1.5; }

.keylist { display: grid; gap: 7px; }
.keylist li { display: grid; gap: 2px; font-size: 13.5px; color: var(--text-dim); padding-left: 14px; position: relative; }
.keylist li::before {
  content: ""; position: absolute; left: 0; top: 8px;
  width: 5px; height: 5px; border-radius: 50%; background: var(--accent);
}
.keylist.is-bad li::before { background: var(--warn); }
.keylist li b { color: var(--text); font-weight: 600; }
.keylist li span { color: var(--text-mute); font-size: 12.5px; line-height: 1.5; }

.alts { display: grid; }
.alt { border-top: 1px solid var(--line); padding: 11px 0; }
.alt:first-child { border-top: 0; padding-top: 0; }
.alt.is-right { border-left: 3px solid var(--ok); padding-left: 12px; }
.alt.is-mine  { background: rgba(63,169,201,.06); }
.alt-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.alt-name { font-size: 13.5px; font-weight: 600; }
.alt-name em { color: var(--accent-2); font-weight: 500; font-style: normal; font-size: 12px; }
.alt-verdict { font-size: 11px; padding: 2px 8px; border-radius: 20px; background: var(--line); color: var(--text-dim); font-weight: 500; }
.alt.is-right .alt-verdict { background: rgba(75,185,138,.2); color: var(--ok); }
.alt-why { font-size: 13px; color: var(--text-dim); margin-top: 4px; line-height: 1.55; }

/* ---------- Витрина: студент / преподаватель ---------- */

.landing-wrap {
  min-height: 100vh;
  display: flex; flex-direction: column; justify-content: center;
  gap: 30px; padding: 40px 22px;
  max-width: 980px; margin: 0 auto;
}

.landing-cards {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 18px;
}

.landing-card {
  display: flex; flex-direction: column; gap: 12px;
  padding: 26px 26px 22px;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text); text-decoration: none;
  transition: .18s;
}
.landing-card:hover {
  border-color: var(--accent); background: var(--panel-2);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.landing-card h2 { font-size: 21px; }
.landing-card p { font-size: 14px; color: var(--text-dim); line-height: 1.6; flex: 1; }

.lc-tag {
  align-self: flex-start;
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .07em; font-weight: 650;
  padding: 3px 10px; border-radius: 20px;
  background: rgba(63,169,201,.16); color: var(--accent-2);
}
.lc-meta { font-size: 12px; color: var(--text-mute); }
.lc-go { font-size: 13.5px; font-weight: 600; color: var(--accent-2); }

.landing-card.is-teacher { border-style: dashed; }
.landing-card.is-teacher .lc-tag {
  background: rgba(217,163,63,.16); color: var(--warn);
}
.landing-card.is-teacher:hover { border-color: var(--warn); }
.lc-warn {
  font-size: 12px; color: var(--warn);
  padding: 8px 11px; border-radius: var(--radius-sm);
  background: rgba(217,163,63,.08); border: 1px solid rgba(217,163,63,.3);
}

.landing-foot {
  text-align: center; font-size: 12px; color: var(--text-mute); line-height: 1.6;
}

/* ---------- Диалог экспорта результата ---------- */

.export {
  position: fixed; inset: 0; z-index: 70;   /* поверх листа разбора */
  background: rgba(6,10,14,.82); backdrop-filter: blur(6px);
  overflow-y: auto; padding: 28px 18px 48px;
  display: grid; place-items: center;
  animation: rise .25s ease;
}
.export-card {
  width: min(560px, 100%);
  background: var(--bg-2); border: 1px solid var(--line-2);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 22px;
  display: grid; gap: 13px;
}
.export-card h3 { font-size: 17px; }
.export-note { font-size: 12.5px; color: var(--text-dim); line-height: 1.55; }
.export-field {
  display: grid; gap: 5px;
  font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-mute);
}
.export-field input {
  padding: 10px 13px; border-radius: var(--radius-sm);
  background: var(--bg); border: 1px solid var(--line-2);
  color: var(--text); font: inherit; font-size: 14px;
}
.export-field input:focus { outline: none; border-color: var(--accent); }
.export-code {
  padding: 10px 12px; border-radius: var(--radius-sm);
  background: var(--bg); border: 1px solid var(--line);
  color: var(--text-dim);
  font: 11px/1.6 var(--mono); word-break: break-all;
  min-height: 66px; resize: vertical;
}
.export-actions { display: flex; gap: 9px; flex-wrap: wrap; }
.export-hint { font-size: 12.5px; color: var(--ok); min-height: 1em; }

/* ---------- Страница преподавателя: каркас ---------- */

.teacher-main {
  max-width: 1180px; margin: 0 auto;
  padding: 22px 22px 64px;
  display: grid; gap: 18px;
}

.ttabs {
  display: flex; gap: 8px; flex-wrap: wrap;
  max-width: 1180px; margin: 0 auto; padding: 0 22px;
}
.ttab {
  padding: 8px 16px; border-radius: 20px;
  border: 1px solid var(--line); background: var(--panel);
  color: var(--text-dim); font: inherit; font-size: 13px; font-weight: 500;
  cursor: pointer; transition: .16s;
}
.ttab:hover { color: var(--text); border-color: var(--line-2); }
.ttab.is-on {
  background: var(--accent); border-color: var(--accent);
  color: #04222c; font-weight: 600;
}

.char-tabs {
  display: flex; gap: 8px; flex-wrap: wrap;
}
.char-tab {
  display: grid; gap: 1px; text-align: left;
  padding: 9px 15px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--panel);
  cursor: pointer; transition: .16s;
}
.char-tab:hover { border-color: var(--line-2); background: var(--panel-2); }
.char-tab.is-on {
  border-color: var(--accent); background: rgba(63,169,201,.08);
}
.ct-label { font-size: 13.5px; font-weight: 600; color: var(--text); }
.ct-dis { font-size: 11px; color: var(--text-mute); }

/* ---------- Методичка ---------- */

.m-sec { display: grid; gap: 10px; }
.m-sec h3 {
  font-size: 12.5px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-dim);
  padding-bottom: 8px; border-bottom: 1px solid var(--line);
}
.m-sec-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.m-sec-note { font-size: 11.5px; color: var(--text-mute); }
.m-load-err { color: var(--alert); font-size: 13.5px; }

.m-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 18px; flex-wrap: wrap;
  padding-bottom: 16px; border-bottom: 1px solid var(--line);
}
.m-head h2 { font-size: 20px; }
.m-dis { font-size: 13.5px; color: var(--text-dim); margin-top: 4px; }
.m-stats { font-size: 12px; color: var(--text-mute); margin-top: 6px; }
.m-run { display: flex; gap: 8px; flex-wrap: wrap; }

.m-trap {
  padding: 14px 16px; border-radius: var(--radius);
  background: rgba(217,163,63,.07); border: 1px solid rgba(217,163,63,.3);
  border-left: 3px solid var(--warn);
}
.m-trap h3 {
  font-size: 12px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--warn); margin-bottom: 6px;
}
.m-trap p { font-size: 13.5px; color: var(--text-dim); line-height: 1.6; }

.m-greet {
  padding: 13px 16px; border-radius: var(--radius);
  background: var(--panel); border: 1px solid var(--line);
}
.m-greet-head {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-bottom: 7px;
}
.m-greet-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--accent-2);
}
.m-greet-text { font-size: 14px; color: var(--text); line-height: 1.55; font-style: italic; }

/* Плашки-пометы */

.m-badge {
  flex: none;
  font-size: 10px; text-transform: uppercase; letter-spacing: .05em; font-weight: 650;
  padding: 2px 8px; border-radius: 20px;
  background: var(--line); color: var(--text-dim);
}
.m-badge.is-ok   { background: rgba(75,185,138,.16);  color: var(--ok); }
.m-badge.is-mid  { background: rgba(150,170,195,.16); color: var(--text-dim); }
.m-badge.is-warn { background: rgba(217,163,63,.18);  color: var(--warn); }
.m-badge.is-bad  { background: rgba(224,102,79,.18);  color: var(--alert); }
.m-badge.is-imp  { background: rgba(63,169,201,.2);   color: var(--accent-2); }
.m-badge.is-dim  { background: transparent; border: 1px solid var(--line); color: var(--text-mute); }

/* Кнопка прослушивания реплики */

.m-audio {
  flex: none;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 11px; border-radius: 20px;
  border: 1px solid var(--line-2); background: transparent;
  color: var(--text-dim); font: inherit; font-size: 11.5px;
  cursor: pointer; transition: .16s;
}
.m-audio:hover { color: var(--accent-2); border-color: var(--accent); }
.m-audio-ico {
  width: 0; height: 0; flex: none;
  border-left: 7px solid currentColor;
  border-top: 4.5px solid transparent; border-bottom: 4.5px solid transparent;
}
.m-audio.is-playing {
  color: var(--accent-2); border-color: var(--accent-2);
  background: rgba(63,169,201,.08);
}
.m-audio.is-playing .m-audio-ico {
  width: 8px; height: 10px; border: 0;
  background: linear-gradient(currentColor 0 0) left/2.5px 100% no-repeat,
              linear-gradient(currentColor 0 0) right/2.5px 100% no-repeat;
}

/* Паспортная часть */

.m-pass {
  padding: 10px 13px; border-radius: var(--radius-sm);
  background: var(--panel); border: 1px solid var(--line);
  display: grid; gap: 6px;
}
.m-pass.is-imp { border-left: 3px solid var(--accent); }
.m-pass-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.mp-field {
  font-size: 11px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--text-mute); min-width: 130px;
}
.mp-val { font-size: 13.5px; font-weight: 600; flex: 1; }
.mp-text { font-size: 12.5px; color: var(--text-dim); font-style: italic; line-height: 1.55; }
.mp-why { font-size: 12px; color: var(--accent-2); line-height: 1.5; }

/* Вопросы */

.m-q {
  padding: 11px 13px; border-radius: var(--radius-sm);
  background: var(--panel); border: 1px solid var(--line);
  display: grid; gap: 6px;
}
.m-q.is-imp { border-left: 3px solid var(--accent); }
.m-q-head { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.m-q-label { font-size: 13.5px; font-weight: 600; flex: 1; min-width: 200px; }
.m-q-tag { font-size: 12.5px; color: var(--text); font-weight: 500; }
.m-q-text { font-size: 12.5px; color: var(--text-dim); font-style: italic; line-height: 1.55; }
.m-q-why { font-size: 12px; color: var(--accent-2); line-height: 1.5; }

/* Показатели */

.m-vital {
  padding: 10px 13px; border-radius: var(--radius-sm);
  background: var(--panel); border: 1px solid var(--line);
  display: grid; gap: 5px;
}
.m-vital.is-abn { border-left: 3px solid var(--alert); }
.mv-row { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.mv-field {
  font-size: 11px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--text-mute); min-width: 90px;
}
.mv-val { font-size: 14.5px; font-weight: 650; font-variant-numeric: tabular-nums; flex: 1; }
.m-vital.is-abn .mv-val { color: var(--alert); }
.mv-note { font-size: 12.5px; color: var(--text-dim); }
.mv-tech { font-size: 11.5px; color: var(--text-mute); }

/* Приёмы осмотра, назначения, диагноз, правила — общая карточка пункта */

.m-item, .m-exam, .m-dx, .m-rule {
  padding: 11px 13px; border-radius: var(--radius-sm);
  background: var(--panel); border: 1px solid var(--line);
  display: grid; gap: 6px;
}
.m-exam.is-abn, .m-dx.is-ok { border-left: 3px solid var(--alert); }
.m-dx.is-ok { border-left-color: var(--ok); }
.m-item-head { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.m-item-label { font-size: 13.5px; font-weight: 600; flex: 1; min-width: 200px; }
.m-item-res { font-size: 13px; color: var(--text); line-height: 1.55; }
.m-item-why { font-size: 12.5px; color: var(--text-dim); line-height: 1.55; }
.m-dx-verdict { font-size: 11.5px; color: var(--warn); font-weight: 500; }
.m-dx.is-ok .m-dx-verdict { color: var(--ok); }

/* Группы по ролям (обязательно / полезно / зря / вредно) */

.m-group { display: grid; gap: 8px; }
.m-group h4 {
  display: flex; align-items: center; gap: 8px;
  font-size: 12.5px; margin-top: 4px;
}
.m-count {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px;
  display: grid; place-items: center;
  background: var(--line); color: var(--text-dim);
  font-size: 10.5px; font-weight: 650;
}
.m-group.is-ok   h4 { color: var(--ok); }
.m-group.is-mid  h4 { color: var(--text-dim); }
.m-group.is-warn h4 { color: var(--warn); }
.m-group.is-bad  h4 { color: var(--alert); }
.m-group.is-warn .m-item { border-style: dashed; }
.m-group.is-bad  .m-item { border-left: 3px solid var(--alert); }

/* Алгоритм */

.m-algo-note { font-size: 12.5px; color: var(--text-mute); line-height: 1.55; }
.m-rule-head { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.m-rule-text { font-size: 13.5px; font-weight: 600; flex: 1; min-width: 200px; }
.m-rule-why { font-size: 12.5px; color: var(--text-dim); line-height: 1.55; }

/* Ключевые находки и тактика */

.m-keys { display: grid; gap: 7px; }
.m-keys li {
  font-size: 13.5px; color: var(--text-dim); line-height: 1.55;
  padding-left: 14px; position: relative;
}
.m-keys li::before {
  content: ""; position: absolute; left: 0; top: 8px;
  width: 5px; height: 5px; border-radius: 50%; background: var(--accent);
}
.m-next { font-size: 13.5px; color: var(--text-dim); line-height: 1.65; }

/* Карта аускультации в методичке */

.m-ausc {
  padding: 13px; border-radius: var(--radius-sm);
  background: var(--panel); border: 1px solid var(--line);
  border-left: 3px solid var(--alert);
  display: grid; gap: 12px;
}
.m-ausc-body {
  display: grid; grid-template-columns: minmax(190px, 240px) minmax(0, 1fr);
  gap: 16px; align-items: start;
}
.m-chest {
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 8px;
}
.m-ausc-side { display: grid; gap: 10px; }

.m-readout {
  padding: 11px 13px; border-radius: var(--radius-sm);
  background: var(--panel-2); border: 1px solid var(--line);
  border-left: 3px solid var(--line-2);
  font-size: 13px; color: var(--text-dim); line-height: 1.55;
}
.m-readout b { color: var(--text); }
.m-readout-note { display: block; font-size: 12px; color: var(--text-mute); margin-top: 4px; }

.m-find {
  padding: 10px 12px; border-radius: var(--radius-sm);
  background: var(--bg-2); border: 1px solid var(--line);
  display: grid; gap: 5px;
}
.m-find.is-abn { border-left: 3px solid var(--alert); }
.m-find-head { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.m-find-title { font-size: 13px; font-weight: 600; flex: 1; }
.m-find-desc { font-size: 12.5px; color: var(--text-dim); line-height: 1.55; }
.m-find-where { font-size: 11.5px; color: var(--text-mute); }
.m-ausc-hint { font-size: 12px; color: var(--text-mute); line-height: 1.5; }

.m-point { cursor: pointer; }
.m-point .mpt-ring {
  fill: rgba(63,169,201,.13); stroke: var(--accent); stroke-width: 1.6;
  transition: .18s;
}
.m-point .mpt-core { fill: var(--accent); }
.m-point:hover .mpt-ring { fill: rgba(63,169,201,.32); stroke: var(--accent-2); }
.m-point:focus-visible { outline: none; }
.m-point:focus-visible .mpt-ring { stroke: var(--accent-2); stroke-width: 2.6; }
.m-point.is-abn .mpt-ring { stroke: var(--alert); fill: rgba(224,102,79,.2); }
.m-point.is-abn .mpt-core { fill: var(--alert); }
.m-point.is-abn:hover .mpt-ring { stroke: #f08a76; }

/* ---------- Критерии оценки ---------- */

.crit-intro p { font-size: 13.5px; color: var(--text-dim); line-height: 1.6; max-width: 720px; }
.crit-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1px; background: var(--line);
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
}
.crit { background: var(--panel); padding: 14px 16px; display: flex; gap: 13px; }
.crit-w {
  flex: none; font-size: 19px; font-weight: 700; color: var(--accent-2);
  font-variant-numeric: tabular-nums; min-width: 52px;
}
.crit-body { display: grid; gap: 3px; }
.crit-body b { font-size: 13.5px; }
.crit-body span { font-size: 12.5px; color: var(--text-dim); line-height: 1.5; }

.crit-grades { display: grid; gap: 1px; background: var(--line); border-radius: var(--radius); overflow: hidden; margin-top: 18px; }
.crit-grades h3 {
  font-size: 12.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-dim);
  background: var(--panel-2); padding: 10px 14px;
}
.cg-row {
  display: flex; gap: 14px; align-items: baseline;
  background: var(--panel); padding: 9px 14px;
}
.cg-row b { min-width: 90px; font-variant-numeric: tabular-nums; color: var(--accent-2); }
.cg-row span { font-size: 13px; color: var(--text-dim); }

/* ---------- Журнал результатов ---------- */

.j-add {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px 18px;
  display: grid; gap: 11px;
}
.j-add h3 { font-size: 15px; }
.j-note { font-size: 12.5px; color: var(--text-mute); line-height: 1.55; }
#jInput {
  padding: 10px 13px; border-radius: var(--radius-sm);
  background: var(--bg); border: 1px solid var(--line-2);
  color: var(--text); font: 11.5px/1.6 var(--mono);
  resize: vertical;
}
#jInput:focus { outline: none; border-color: var(--accent); }
.j-add-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.j-file-btn { position: relative; overflow: hidden; }
.j-file-btn input {
  position: absolute; inset: 0;
  opacity: 0; cursor: pointer;
}
.j-storage { font-size: 11.5px; color: var(--text-mute); }

.j-errors {
  display: grid; gap: 5px;
  padding: 11px 13px; border-radius: var(--radius-sm);
  background: rgba(224,102,79,.07); border: 1px solid rgba(224,102,79,.3);
  font-size: 12.5px;
}
.j-errors b { color: var(--alert); font-size: 12px; }
.j-err { color: var(--text-dim); word-break: break-all; }
.j-dup { color: var(--warn); }

/* Сводка */

.j-summary {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px 18px;
  display: grid; gap: 14px;
}
.j-summary h3 { font-size: 15px; }
.j-summary .scores { margin-bottom: 0; }
.j-sum-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px;
}
.j-sum-col { display: grid; gap: 8px; align-content: start; }
.j-sum-col h4 { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-dim); }
.j-sum-empty { font-size: 13px; color: var(--ok); }
.j-top { display: grid; gap: 6px; }
.j-top li {
  display: flex; gap: 9px; align-items: baseline;
  font-size: 12.5px; color: var(--text-dim); line-height: 1.45;
}
.j-top-n {
  flex: none; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px;
  display: grid; place-items: center;
  background: rgba(224,102,79,.18); color: var(--alert);
  font-size: 10.5px; font-weight: 650;
}
.j-top-dis { color: var(--text-mute); font-size: 11.5px; }
.j-dx-row {
  display: flex; justify-content: space-between; gap: 10px;
  font-size: 12.5px; color: var(--text-dim);
  padding: 5px 0; border-bottom: 1px solid var(--line);
}
.j-dx-row:last-child { border-bottom: 0; }
.j-dx-row b { color: var(--text); font-variant-numeric: tabular-nums; }

/* Таблица */

.j-table-card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden;
}
.j-table-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 11px 16px; border-bottom: 1px solid var(--line);
  background: var(--panel-2); flex-wrap: wrap;
}
.j-table-head h3 { font-size: 12.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-dim); }
.j-actions { display: flex; gap: 8px; }
.j-empty { padding: 30px 16px; text-align: center; color: var(--text-mute); font-style: italic; font-size: 13px; }

#jTable { overflow-x: auto; }
.j-row {
  display: grid;
  grid-template-columns: minmax(140px, 1.3fr) minmax(80px, .9fr) minmax(150px, 1.2fr)
                         64px 78px 58px 58px 118px 34px;
  gap: 4px 10px; align-items: center;
  padding: 10px 16px; border-bottom: 1px solid var(--line);
  font-size: 13px; min-width: 860px;
  cursor: pointer; transition: background .14s;
}
.j-row:last-child { border-bottom: 0; }
.j-row:not(.j-head-row):not(.is-err):hover { background: var(--panel-2); }
.j-row.is-open { background: var(--panel-2); }

.j-head-row {
  background: var(--bg-2); cursor: default;
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-mute);
}
.j-row.is-err { cursor: default; color: var(--alert); font-size: 12.5px; }

.j-name { font-weight: 600; }
.j-group, .j-case { color: var(--text-dim); }
.j-case { font-size: 12.5px; }
.j-total { font-weight: 650; font-variant-numeric: tabular-nums; }
.j-total.is-good { color: var(--ok); }
.j-total.is-mid  { color: var(--warn); }
.j-total.is-bad  { color: var(--alert); }
.j-c-num, .j-time { color: var(--text-dim); font-variant-numeric: tabular-nums; font-family: var(--mono); font-size: 12px; }
.j-date { color: var(--text-mute); font-size: 12px; }
.j-dx { font-size: 12.5px; }
.is-ok-text  { color: var(--ok); }
.is-bad-text { color: var(--alert); }

.j-del {
  width: 26px; height: 26px; border-radius: 7px;
  border: 1px solid transparent; background: transparent;
  color: var(--text-mute); font: inherit; font-size: 15px; line-height: 1;
  cursor: pointer; transition: .15s;
}
.j-del:hover { color: var(--alert); border-color: rgba(224,102,79,.4); background: rgba(224,102,79,.08); }

/* Развёрнутый разбор записи */

.jd {
  padding: 16px; border-bottom: 1px solid var(--line);
  background: var(--bg-2); display: grid; gap: 14px;
  min-width: 860px;
  animation: rise .22s ease;
}
.jd-head { display: flex; gap: 14px; align-items: baseline; flex-wrap: wrap; }
.jd-head b { font-size: 15px; }
.jd-head .jd-group { color: var(--text-dim); font-size: 13px; }
.jd-head .jd-case { font-size: 12.5px; color: var(--text-mute); }
.jd-grade { margin-left: auto; font-size: 13px; font-weight: 650; }

.jd-block { display: grid; gap: 8px; }
.jd-block h4 {
  font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-dim);
}
.jd-list { display: grid; gap: 5px; }
.jd-list li { font-size: 13px; color: var(--text-dim); padding-left: 12px; position: relative; }
.jd-list li::before {
  content: ""; position: absolute; left: 0; top: 8px;
  width: 4px; height: 4px; border-radius: 50%; background: var(--alert);
}
.jd-why { color: var(--text-mute); font-size: 12px; }
.jd-group { display: grid; gap: 5px; padding-top: 7px; border-top: 1px solid var(--line); }
.jd-group:first-child { border-top: 0; padding-top: 0; }
.jd-group b { font-size: 12.5px; color: var(--alert); }
.jd-ok { color: var(--ok); font-size: 13px; }

.jd-tl { display: grid; gap: 3px; counter-reset: jd; }
.jd-tl li {
  display: flex; gap: 12px; align-items: baseline;
  font-size: 12.5px; color: var(--text-dim);
  padding: 2px 0 2px 0; padding-left: 26px; position: relative;
  counter-increment: jd;
}
.jd-tl li::before {
  content: counter(jd); position: absolute; left: 0;
  min-width: 20px; height: 17px; padding: 0 4px; border-radius: 5px;
  background: var(--line); color: var(--text-mute);
  font-size: 10px; font-weight: 650; text-align: center; line-height: 17px;
}
.jd-ts { font-family: var(--mono); font-size: 11px; color: var(--text-mute); min-width: 40px; }
.jd-cat {
  font-size: 10px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--accent-2); min-width: 100px;
}
.jd-what { min-width: 0; }
.jd-unk { font-size: 13px; color: var(--warn); line-height: 1.55; }

.jd-code { display: grid; gap: 6px; }
.jd-code b { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-mute); }
.jd-code code {
  font: 10.5px/1.6 var(--mono); color: var(--text-mute);
  word-break: break-all;
  padding: 9px 11px; border-radius: var(--radius-sm);
  background: var(--bg); border: 1px solid var(--line);
}

/* ---------- Витрина: выбор случая ---------- */

.picker {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 22px;
  display: grid; gap: 12px;
}
.picker-title { font-size: 18px; }
.picker-sub { font-size: 13px; color: var(--text-dim); line-height: 1.5; }

.picker-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.picker-list { display: grid; gap: 8px; }
.picker-list li { display: flex; gap: 8px; align-items: stretch; }

.picker-item {
  flex: 1; min-width: 0;
  display: flex; gap: 14px; align-items: center;
  padding: 10px 14px;
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--text); text-decoration: none;
  transition: .15s;
}
.picker-item:hover {
  border-color: var(--accent); background: var(--panel-2);
}
.picker-num {
  flex: none; width: 30px; height: 30px; border-radius: 50%;
  background: var(--panel-2);
  display: grid; place-items: center;
  font-size: 13px; font-weight: 650; color: var(--accent-2);
}
.picker-body { display: grid; gap: 2px; min-width: 0; }
.picker-disease { font-weight: 600; font-size: 14px; }
.picker-label { font-size: 12.5px; color: var(--text-mute); }
.picker-custom {
  justify-self: start;
  font-size: 10px; text-transform: uppercase; letter-spacing: .06em; font-weight: 650;
  padding: 2px 8px; border-radius: 20px;
  background: rgba(63,169,201,.16); color: var(--accent-2);
}
.picker-shared {
  justify-self: start;
  font-size: 10px; text-transform: uppercase; letter-spacing: .06em; font-weight: 650;
  padding: 2px 8px; border-radius: 20px;
  background: rgba(99,199,140,.16); color: var(--ok);
}
.picker-del {
  flex: none; width: 30px; height: 30px;
  border: 1px solid var(--line); border-radius: 6px;
  background: none; color: var(--text-mute);
  cursor: pointer; font-size: 15px; line-height: 1;
}
.picker-del:hover { color: var(--alert); border-color: var(--alert); }

.picker-note { font-size: 12.5px; color: var(--ok); min-height: 1.1em; }
.picker-note.is-bad { color: var(--alert); }

.picker-text { display: grid; gap: 8px; }
.picker-text textarea {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  font-family: var(--mono); font-size: 12px;
  resize: vertical;
}
.picker-text .btn { justify-self: start; }

.picker-import { position: relative; cursor: pointer; }
.picker-import input { display: none; }

/* ---------- Свои случаи: метки в методичке ---------- */

.char-tab.is-custom {
  border-style: dashed;
  color: var(--accent-2);
}

/* Миниатюры результатов-изображений в протоколе и методичке */

.log-imgwrap {
  padding: 0; margin: 6px 0 2px;
  border: 1px solid var(--line); border-radius: 6px;
  background: var(--bg); cursor: zoom-in; overflow: hidden;
  display: inline-block;
}
.log-img { display: block; width: 170px; max-height: 120px; object-fit: cover; }
.m-thumb { display: block; width: 170px; max-height: 120px; object-fit: cover;
  border: 1px solid var(--line); border-radius: 6px; margin-top: 6px; }

/* Просмотр картинки во весь экран */

.imgview {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(6,10,14,.85);
  display: grid; place-items: center;
  padding: 26px; cursor: zoom-out;
  animation: rise .2s ease;
}
.imgview img {
  max-width: min(920px, 96vw); max-height: 90vh;
  border-radius: var(--radius); box-shadow: var(--shadow);
  background: #000;
}

/* ---------- Конструктор случаев ---------- */

#constructorRoot { display: block; }

.cn-bar {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 12px 14px;
}
.cn-bar-group { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.cn-saved { min-width: 250px; }
.cn-code { width: 170px; }
.cn-flash { font-size: 12.5px; color: var(--ok); }

/* Опубликованные случаи: видно студентам. */
.cn-shared {
  background: rgba(99,199,140,.08); border: 1px solid rgba(99,199,140,.35);
  border-radius: var(--radius-sm);
  padding: 10px 16px; margin-top: 12px;
}
.cn-shared-head { font-size: 12.5px; color: var(--ok); margin-bottom: 6px; }
.cn-shared-list { list-style: none; display: grid; gap: 6px; }
.cn-shared-list li { display: flex; gap: 10px; align-items: center; }
.cn-shared-name { flex: 1; font-size: 13px; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.cn-errors {
  background: rgba(224,102,79,.1); border: 1px solid rgba(224,102,79,.4);
  border-radius: var(--radius-sm);
  padding: 12px 16px; margin-top: 12px;
}
.cn-errors b { color: var(--alert); font-size: 13px; }
.cn-errors ul { margin-left: 18px; list-style: disc; }
.cn-errors li { font-size: 12.5px; color: var(--text-dim); }

.cn-sec {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px; margin-top: 14px;
}
.cn-sec h3 { font-size: 15px; margin-bottom: 4px; }
.cn-hint { font-size: 12.5px; color: var(--text-dim); margin-bottom: 12px; }

.cn-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 10px 16px; }
.cn-grid label { display: block; font-size: 11.5px; color: var(--text-mute);
  text-transform: none; }
.cn-wide { grid-column: 1 / -1; }

.cn-in {
  width: 100%;
  padding: 8px 10px;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  font: inherit; font-size: 13.5px;
}
textarea.cn-in { resize: vertical; min-height: 30px; }
.cn-num { width: 60px; text-align: center; }

.cn-row {
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--bg-2);
  padding: 10px 12px; margin: 8px 0;
  display: grid; gap: 8px;
}
.cn-row-main, .cn-row-sub {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
}
.cn-row-main > .cn-in, .cn-row-sub > .cn-in { flex: 1; min-width: 180px; }
.cn-row-sub > label { font-size: 11.5px; color: var(--text-mute); flex: 1; }
.cn-row-sub > label > .cn-in { margin-top: 3px; }

.cn-del {
  flex: none; width: 28px; height: 28px;
  border: 1px solid var(--line); border-radius: 6px;
  background: none; color: var(--text-mute);
  cursor: pointer; font-size: 14px; line-height: 1;
}
.cn-del:hover { color: var(--alert); border-color: var(--alert); }

.cn-chk {
  display: inline-flex; gap: 6px; align-items: center;
  font-size: 13px; color: var(--text-dim); cursor: pointer;
  white-space: nowrap; user-select: none;
}
.cn-radio { white-space: normal; }

.cn-imgrow { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.cn-thumb {
  display: block; width: 56px; height: 56px; object-fit: cover;
  border: 1px solid var(--line); border-radius: 6px;
}
.cn-file { position: relative; }
.cn-file input { display: none; }

.cn-ptgrid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
}
.cn-ptgrid.is-off { opacity: .45; }
.cn-pt {
  display: grid; gap: 4px;
  font-size: 12px; color: var(--text-mute);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 8px;
}

.cn-rule { font-size: 13px; color: var(--text-dim); }

/* ---------- Адаптив ---------- */

@media (max-width: 1080px) {
  .layout { grid-template-columns: 1fr; }
  .col-patient { position: static; }
  .video-frame { max-width: 460px; }
  .auscult { grid-template-columns: 1fr; }
  .chest-wrap { max-width: 260px; }
  .console { position: static; }

  .m-ausc-body { grid-template-columns: 1fr; }
  .m-chest { max-width: 240px; }
  .teacher-main, .ttabs { padding-left: 14px; padding-right: 14px; }
}
@media (max-width: 620px) {
  .topbar { gap: 12px; padding: 10px 14px; }
  .topbar-mid { order: 3; width: 100%; }
  .layout { padding: 14px; gap: 14px; }
  .vitals { grid-template-columns: repeat(2, 1fr); }
  .log-row { grid-template-columns: 1fr; gap: 6px; }
  .log-meta { display: flex; align-items: center; gap: 9px; }
  .tl { grid-template-columns: 1fr; gap: 2px; }
  .sheet { padding: 12px 8px 32px; }
  .sheet-inner { padding: 15px; }
  .clarify-cat { min-width: 0; }

  .landing-wrap { padding: 26px 14px; gap: 22px; }
  .landing-card { padding: 20px 18px 16px; }
  .picker { padding: 16px 14px; }
  .picker-item { padding: 9px 12px; gap: 10px; }
  .m-head { gap: 12px; }
  .cn-grid { grid-template-columns: 1fr; }
  .cn-saved { min-width: 0; flex: 1; }
  .m-run { width: 100%; }
  .char-tabs { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 4px; }
  .ttabs { flex-wrap: nowrap; overflow-x: auto; }
  .export { padding: 14px 10px 32px; }
  .jd-head { gap: 8px; }
  .jd-grade { margin-left: 0; }
}
