:root, html[data-theme="light"] {
  --bg: #f6f7f9; --card: #ffffff; --ink: #1b1f24; --muted: #5d6673; --line: #e2e5ea;
  --accent: #2563c9; --accent-soft: #e6eefb; --ok: #1f8a4c; --danger: #c23b32;
  --note-bg: #fff7e0; --note-ink: #6b4e00; --radius: 10px;
}
html[data-theme="dark"] {
  --bg: #12151a; --card: #1b2028; --ink: #e8ebef; --muted: #9aa4b2; --line: #2c333d;
  --accent: #6aa0ff; --accent-soft: #1d2a40; --ok: #4cc184; --danger: #ff7b70;
  --note-bg: #332a12; --note-ink: #f1d58a;
}
.theme-toggle, .locale-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; padding-left: 0; padding-right: 0; cursor: pointer;
}
.theme-toggle svg { display: block; }
.locale-toggle { font-size: 12px; font-weight: 700; letter-spacing: 0.02em; }
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.5 -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; }
a { color: var(--accent); }
.wrap { max-width: 980px; margin: 0 auto; padding: 20px 16px; }
.muted { color: var(--muted); }
.top { position: sticky; top: 0; z-index: 200; background: var(--card); border-bottom: 1px solid var(--line); }
.top-in { max-width: 980px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { font-weight: 700; font-size: 17px; color: var(--ink); text-decoration: none; }
nav { display: flex; gap: 8px; align-items: center; }
button { font: inherit; cursor: pointer; }
.btn { text-decoration: none; display: inline-block; border: 1px solid var(--line); background: var(--card); color: var(--ink); padding: 7px 14px; border-radius: 8px; font-size: 14px; }
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.08); color: #fff; }
.btn.danger:hover { border-color: var(--danger); color: var(--danger); }
.btn.big { padding: 12px 34px; font-size: 17px; border-radius: 10px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.card + .card { margin-top: 16px; }
h1 { font-size: 22px; margin: 0 0 4px; }
h2 { font-size: 16px; margin: 0 0 10px; }
.note { margin: 14px 0; padding: 10px 14px; border-radius: var(--radius); background: var(--note-bg); color: var(--note-ink); font-size: 14px; }

/* вход */
.login { min-height: 55vh; display: grid; place-items: center; text-align: center; }
.login p { max-width: 520px; margin: 8px auto 24px; color: var(--muted); }

/* список клиентов */
.bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; margin: 14px 0; }
.bar .grp { display: flex; flex-wrap: wrap; gap: 8px; }
input, select, textarea { font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 6px 9px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.search { min-width: 0; flex: 1 1 200px; max-width: 320px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 9px 8px; border-top: 1px solid var(--line); vertical-align: middle; }
thead th { border-top: 0; color: var(--muted); font-weight: 500; font-size: 13px; }
tbody tr.click { cursor: pointer; }
tbody tr.click:hover { background: var(--accent-soft); }
.dots { display: inline-flex; gap: 3px; }
.dots i { width: 9px; height: 9px; border-radius: 50%; background: var(--line); display: inline-block; }
.dots i.full { background: var(--ok); }
.dots i.part { background: var(--accent); }
.empty { text-align: center; padding: 36px 12px; color: var(--muted); }
.tblwrap { overflow-x: auto; }

/* анкета */
.head { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; }
.head-back { flex: none; white-space: nowrap; font-size: 14px; }
.head h1 { margin: 0; flex: 1 1 auto; min-width: 0; font-size: 22px; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.head-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; flex: none; margin-left: auto; }
.saved { font-size: 13px; color: var(--muted); }
.steps { display: flex; gap: 6px; margin: 16px 0; overflow-x: auto; padding-bottom: 2px; }
.step { flex: 0 0 auto; display: flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--card); color: var(--ink); padding: 8px 16px; border-radius: 8px; font-size: 14px; white-space: nowrap; text-decoration: none; }
.step:hover { border-color: var(--accent); }
.step.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.step.full::after { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }
.sec + .sec { margin-top: 20px; }
.sec h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.sec-note { margin: 4px 0 10px; font-size: 13px; color: var(--muted); line-height: 1.45; max-width: 52em; }
.sec-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; margin-bottom: 4px; }
.sec-head h2 { margin: 0; }
.sec-head .btn { flex: none; }
.field { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: 12px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); }
.field:first-of-type { border-top: 0; }
.field.wide { grid-template-columns: 1fr; gap: 6px; }
.field label { font-size: 14px; }
.field label .req { color: var(--danger); }
.field small { display: block; color: var(--muted); font-size: 12px; }
.field-row { display: flex; flex-wrap: wrap; gap: 8px 20px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); }
.field-row:first-child { border-top: 0; }
.field-row > .field { display: flex; flex-direction: row; flex: 0 1 auto; align-items: center; gap: 8px; border-top: 0; padding: 0; min-width: 0; max-width: none; }
.field-row > .field label { flex: none; white-space: nowrap; margin: 0; }
.field-row > .field label small { display: none; }
.field-row > .field .ctl { flex: none; flex-wrap: nowrap; }
.field-row > .field .ctl input[type=number] { width: 88px; }
.field-row > .field .unit { min-width: 0; font-size: 12px; white-space: nowrap; }
.exam-sec { margin-top: 10px; }
.exam-sys-desc { margin: 0 0 10px; font-size: 13px; }
.exam-sys-items { display: grid; gap: 8px; }
.exam-sys-items > .fold {
  /* пункт внутри группы — чуть мягче внешнего аккордеона */
  background: color-mix(in srgb, var(--bg) 55%, var(--card));
  border-color: color-mix(in srgb, var(--accent) 18%, var(--line));
}
/* один признак — без вложенной раскрывалки, поля сразу в группе */
.exam-flat-item { display: grid; gap: 8px; }
.exam-lines-wrap { margin: 4px 0 8px; }
.exam-lines-head { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: baseline; margin-bottom: 6px; font-size: 13px; }
.exam-line-list { display: grid; gap: 10px; }
.exam-entry-list { display: grid; gap: 10px; }
.exam-add-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.exam-line-card {
  display: grid;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
}
/* вложенная группа (ШКГ и т.п.) — другим цветом, чем внешний fold */
.exam-nest {
  border: 1px solid color-mix(in srgb, var(--accent) 40%, var(--line));
  border-radius: 10px;
  background: color-mix(in srgb, var(--accent-soft) 85%, var(--card));
  overflow: hidden;
}
.exam-nest-sum {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  user-select: none;
}
.exam-nest-sum::-webkit-details-marker { display: none; }
.exam-nest-mark {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: var(--accent);
  flex: none;
  opacity: .85;
}
.exam-nest-name {
  flex: 1 1 auto;
  min-width: 0;
  font: inherit;
  font-weight: 600;
  font-size: 14px;
  color: var(--ink);
  border: 1px solid transparent;
  background: transparent;
  border-radius: 6px;
  padding: 2px 6px;
}
.exam-nest-name:hover, .exam-nest-name:focus {
  border-color: var(--line);
  background: var(--card);
  outline: none;
}
.exam-nest-count { font-size: 12px; flex: none; }
.exam-nest-body { padding: 0 10px 10px; }
.exam-nest-card {
  margin-top: 10px;
  border: 1px solid color-mix(in srgb, var(--accent) 40%, var(--line));
  border-radius: 10px;
  background: color-mix(in srgb, var(--accent-soft) 85%, var(--card));
}
.exam-nest-card > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  font-weight: 600;
  font-size: 14px;
  user-select: none;
}
.exam-nest-card > summary::-webkit-details-marker { display: none; }
.exam-nest-title { flex: 1 1 auto; min-width: 0; }
.exam-nest-card-body { padding: 0 12px 10px; }
.exam-line-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto;
  gap: 8px 8px;
  align-items: end;
}
.exam-line-top .btn { padding: 4px 10px; min-width: 32px; }
.exam-line-label { min-width: 0; }
.exam-desc-btn {
  position: relative;
  padding: 5px 8px !important;
  min-width: 0 !important;
  font-size: 12px;
  line-height: 1.2;
  white-space: nowrap;
  align-self: end;
  margin-bottom: 1px;
}
.exam-desc-btn.empty { color: var(--muted); }
.exam-reply-btn {
  padding: 5px 8px !important;
  min-width: 0 !important;
  font-size: 12px;
  line-height: 1.2;
  white-space: nowrap;
  align-self: end;
  margin-bottom: 1px;
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 35%, var(--line));
}
/* сильнее .cv-dialog { width: min(820px…) } */
.cv-dialog.exam-reply-dlg {
  width: max-content;
  max-width: min(200px, calc(100vw - 32px));
  min-width: 0;
  padding: 10px 12px 12px;
}
.exam-reply-dlg .cv-head { margin: 0; }
.exam-reply-dlg .cv-head b { font-size: 14px; font-weight: 600; }
.exam-reply-dlg .cv-x { padding: 2px 8px; font-size: 13px; }
.exam-reply-opts {
  display: grid;
  gap: 4px;
  margin: 10px 0 0;
}
.exam-reply-opt {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  cursor: pointer;
  color: var(--ink);
}
.exam-reply-opt input {
  margin: 0;
  flex: none;
  accent-color: var(--accent);
  width: 14px;
  height: 14px;
}
.exam-reply-actions { margin-top: 10px; gap: 6px; }
.exam-reply-actions .btn { padding: 4px 10px; font-size: 13px; }
.exam-desc-btn.has-tip:hover::after,
.exam-desc-btn.has-tip:focus-visible::after {
  content: attr(data-tip);
  position: absolute;
  left: 0;
  top: calc(100% + 6px);
  z-index: 40;
  display: block;
  width: max-content;
  max-width: min(360px, 70vw);
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.45;
  white-space: pre-wrap;
  text-align: left;
  box-shadow: 0 8px 24px rgba(0,0,0,.14);
  pointer-events: none;
}
.exam-desc-dlg { width: min(520px, 100%); }
.exam-desc-view {
  margin: 0 0 12px;
  padding: 10px 12px;
  max-height: min(50vh, 360px);
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  font: inherit;
  line-height: 1.45;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--bg) 70%, var(--card));
}
.exam-desc-dlg textarea {
  width: 100%;
  min-height: 160px;
  margin-top: 8px;
  resize: vertical;
  font: inherit;
  color: var(--ink);
}
.exam-desc-hint { margin: 8px 0 0; font-size: 13px; }

.exam-slider-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 14px;
  align-items: start;
}
.exam-slider-grid > .slider-field,
.exam-slider-grid > .exam-num-field {
  border-top: 0;
  padding: 4px 0;
  margin: 0;
  max-width: none;
}
.exam-num-ctl {
  flex: none;
  flex-wrap: nowrap;
}
.exam-num-ctl input[type=number] {
  width: 88px;
  max-width: 88px;
  text-align: right;
}
.exam-text-field {
  display: grid;
  gap: 6px;
  align-items: start;
  padding: 4px 0;
}
.exam-text-field .exam-sign-link { justify-self: start; max-width: 100%; }
.exam-text-field textarea {
  width: 100%;
  min-height: 64px;
  margin: 0;
}

.slider-field { align-items: center; }
.exam-sign-link {
  position: relative;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
  flex: 1 1 auto;
  min-width: 0;
  max-width: 100%;
  overflow: visible;
  text-decoration: underline;
  text-decoration-color: rgba(127,127,127,.45);
  text-underline-offset: 3px;
}
.exam-sign-txt {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.exam-sign-link:hover { color: var(--accent); text-decoration-color: currentColor; }
.exam-sign-link.has-tip:hover::after,
.exam-sign-link.has-tip:focus-visible::after {
  content: attr(data-tip);
  position: absolute;
  left: 0;
  top: calc(100% + 6px);
  z-index: 50;
  display: block;
  width: max-content;
  max-width: min(320px, 70vw);
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.4;
  white-space: normal;
  text-align: left;
  text-decoration: none;
  box-shadow: 0 8px 24px rgba(0,0,0,.14);
  pointer-events: none;
}
.exam-help-dlg { width: min(480px, 100%); }
.exam-help-body {
  margin: 10px 0 0;
  font-size: 15px;
  line-height: 1.55;
  color: var(--muted);
  white-space: pre-wrap;
}
.slider-line {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 6px 8px;
  width: 100%;
  min-width: 0;
}
.slider-name {
  font-size: 13px;
  font-weight: 600;
  margin: 0;
  white-space: nowrap;
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.slider-span {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.25;
  white-space: nowrap;
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* одинаковый блок ползунок+сброс во всех строках */
.slider-control {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex: none;
  width: 156px;
}
.slider-control input[type=range] {
  width: 120px;
  min-width: 120px;
  max-width: 120px;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}
.slider-control input[type=range][data-empty="1"] { opacity: .55; }
.slider-val {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  text-align: right;
  font-size: 12px;
  width: 1.6em;
  flex: none;
}
.slider-val:empty { visibility: hidden; }
.slider-reset {
  padding: 2px 0;
  min-width: 24px;
  width: 24px;
  margin: 0;
  font-size: 14px;
  line-height: 1;
  flex: none;
}
@media (max-width: 720px) {
  .exam-slider-grid { grid-template-columns: 1fr; }
}
.ctl { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ctl input[type=number] { width: 110px; text-align: right; }
.ctl input[type=text], .ctl select { width: 100%; max-width: 360px; }
textarea { width: 100%; min-height: 80px; resize: vertical; }
.unit { color: var(--muted); font-size: 13px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.seg button { border: 0; background: transparent; color: var(--muted); padding: 5px 13px; font-size: 13px; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.scale { display: flex; flex-wrap: wrap; gap: 4px; }
.scale button { min-width: 32px; padding: 4px 0; border: 1px solid var(--line); background: var(--card); color: var(--muted); border-radius: 6px; font-size: 13px; }
.scale button.on { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.scale button.clr { padding: 4px 8px; }
.rows td { padding: 4px; border-top: 0; }
.rows input { width: 100%; }
.rows th { padding: 4px; }
.nav2 { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 16px; }
.other-tab h2 { margin: 0 0 6px; font-size: 17px; text-transform: none; letter-spacing: 0; color: var(--ink); }
.other-tab > .muted { margin: 0 0 18px; font-size: 14px; }
.other-danger { display: grid; gap: 8px; justify-items: start; padding: 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); }
.other-danger .muted { margin: 0; font-size: 13px; max-width: 42em; }

/* жалобы: чипы + окно деталей */
.cmp-list { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 14px; }
.cmp-chip { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 8px; padding: 10px 14px; font: inherit; cursor: pointer; min-width: 140px; max-width: 280px; }
.cmp-chip:hover { border-color: var(--accent); }
.cmp-chip.on { border-color: var(--accent); background: var(--accent-soft); }
.cmp-title { font-size: 14px; font-weight: 600; }
.cmp-sum { font-size: 12px; color: var(--muted); line-height: 1.35; }
.cmp-chip.on .cmp-sum { color: var(--accent); }
.cmp-dlg { width: min(480px, 100%); }
.cmp-body { display: grid; gap: 14px; margin-top: 12px; }
.cmp-check { display: inline-flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 600; cursor: pointer; user-select: none; }
.cmp-check input { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; }
.cmp-block { display: grid; gap: 8px; }
.cmp-lbl { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.cmp-attrs { display: flex; flex-wrap: wrap; gap: 6px; }
.cmp-attr { border: 1px solid var(--line); background: var(--bg); color: var(--ink); border-radius: 8px; padding: 6px 12px; font: inherit; font-size: 13px; cursor: pointer; }
.cmp-attr.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.cmp-attr:disabled, .cmp-body textarea:disabled, .cmp-slide.off { opacity: .45; }
.cmp-attr:disabled, .cmp-body textarea:disabled { cursor: not-allowed; }
.cmp-body textarea { width: 100%; min-height: 72px; resize: vertical; }
.cmp-slide { display: grid; gap: 4px; }
.cmp-slide-val { font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--accent); line-height: 1.1; }
.cmp-slide input[type=range] { width: 100%; height: 28px; margin: 0; cursor: pointer; accent-color: var(--accent); }
.cmp-slide input[type=range]:disabled { cursor: not-allowed; }
.cmp-slide-ends { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }
.cmp-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.err { color: var(--danger); font-size: 13px; }
.foot { color: var(--muted); font-size: 13px; }

@media (max-width: 640px) {
  .field { grid-template-columns: 1fr; gap: 6px; }
  .field-row > .field { flex: 1 1 calc(50% - 8px); max-width: none; }
  .hide-sm { display: none; }
}

/* хранение */
.store { margin: 14px 0; }
.fold-body p { margin: 0 0 10px; font-size: 14px; }
.fold-body p:last-child { margin-bottom: 0; }
.fold-body .grp { display: flex; flex-wrap: wrap; gap: 8px; }
.fold-body code { font-size: 13px; }
.sec > .fold { margin-top: 10px; }
.sec > .fold > .fold-body { padding-top: 4px; }

/* фото и файлы анализов */
.dropzone { border: 1.5px dashed var(--line); border-radius: var(--radius); padding: 14px; display: grid; gap: 8px; }
.dropzone.drag { border-color: var(--accent); background: var(--accent-soft); }
.dz-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; font-size: 14px; }
.dz-pick { cursor: pointer; }
.files-msg:empty { display: none; }
.files { list-style: none; margin: 0; padding: 0; }
.files li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding: 6px 0; border-top: 1px solid var(--line); font-size: 14px; }
.files li:first-child { border-top: 0; }
.files li a { word-break: break-all; }
.files li .muted { font-size: 13px; }
.files li .btn { margin-left: auto; padding: 2px 10px; }
.files-empty { margin: 0; font-size: 14px; }

/* раскрывающийся блок: <details class="fold"> — см. fold() в src/app/app.ts */
.fold { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.fold > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: var(--radius); user-select: none; }
.fold > summary::-webkit-details-marker { display: none; }
.fold > summary:hover { background: var(--accent-soft); }
.fold > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.fold-title { font-weight: 600; font-size: 15px; }
.fold-status { color: var(--muted); font-size: 14px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fold-chev { width: 9px; height: 9px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); margin: -4px 4px 0 auto; transition: transform .15s; flex: none; }
.fold[open] > summary .fold-chev { transform: rotate(-135deg); margin-top: 4px; }
.fold[open] > summary { border-bottom: 1px solid var(--line); border-radius: var(--radius) var(--radius) 0 0; }
.fold.warn > summary .fold-status { color: var(--danger); }
.fold-body { padding: 14px 16px 16px; }
@media (prefers-reduced-motion: reduce) { .fold-chev { transition: none; } }

/* перенос анализов через ИИ */
.ai { display: grid; gap: 10px; }
.ai-lead { margin: 0; font-size: 14px; color: var(--muted); }
.ai-steps { margin: 0; padding-left: 22px; display: grid; gap: 12px; font-size: 14px; }
.ai-steps li > div + .grp, .ai-steps li > textarea, .ai-steps li > textarea + .grp { margin-top: 8px; }
.ai-steps .grp { display: flex; flex-wrap: wrap; gap: 8px; }
.ai-steps textarea { font: 13px/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; min-height: 90px; }
.ai-msg { font-size: 13px; }
.ai-msg:empty { display: none; }
.ai-msg.ok { color: var(--ok); }
.ai-msg.err { color: var(--danger); }
.ai-preview { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; display: grid; gap: 8px; }
.ai-preview h3 { margin: 0; font-size: 15px; }
.ai-preview p { margin: 0; font-size: 13px; }
.ai-preview .grp { display: flex; flex-wrap: wrap; gap: 8px; }
.ai-table td, .ai-table th { padding: 6px; font-size: 13px; }
.ai-table td small { display: block; }
.ai-table .num { text-align: right; white-space: nowrap; }
.ai-table .ai-note { color: var(--muted); }
.ai-table tr.st-unit .ai-note, .ai-table tr.st-uncertain .ai-note, .ai-table tr.st-option .ai-note { color: var(--danger); }
.hidden-note { margin: 12px 0 0; font-size: 13px; }

/* настройки: колонка разделов слева, содержимое справа */
.set-lead { margin: 0 0 16px; font-size: 14px; }
.set { display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: 20px; align-items: start; }
.set-side { display: flex; flex-direction: column; gap: 4px; position: sticky; top: 12px; }
.set-tab { display: block; padding: 9px 12px; border-radius: 8px; color: var(--ink); text-decoration: none; font-size: 15px; border: 1px solid transparent; }
.set-tab:hover { background: var(--accent-soft); }
.set-tab.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; border-color: var(--accent-soft); }
.set-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px; }
.set-head h2 { font-size: 18px; margin: 0; }
.set-head .muted { font-size: 14px; }
.set-hint { margin: 6px 0 14px; font-size: 14px; }
.set-tpls { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.set-tpls .btn { padding: 4px 10px; font-size: 13px; }
.set-list { display: grid; gap: 8px; }
.set-form { display: grid; gap: 2px; }
.set-form > p { margin: 0 0 8px; font-size: 14px; }
.set-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 12px; align-items: center; padding: 7px 0; border-top: 1px solid var(--line); font-size: 14px; }
.set-row:first-of-type { border-top: 0; }
.set-row small { display: block; color: var(--muted); font-size: 12px; }
.set-row a { font-size: 12px; margin-left: 4px; }
.set-row input[type=text], .set-row input[type=password], .set-row select { width: 100%; }
.set-row .ctl input { flex: 1 1 160px; min-width: 0; }
.set-row input[type=number] { width: 90px; }
.set-row.wide { grid-template-columns: 1fr; gap: 6px; }
.set-checks { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.set-checks label { display: inline-flex; align-items: center; gap: 5px; }
.set-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; min-height: 32px; }
.set-add { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.ok { color: var(--ok); }
.set-saved { font-size: 13px; }
.articles-css-dlg { width: min(720px, 100%); display: flex; flex-direction: column; max-height: calc(100vh - 32px); overflow: hidden; }
.articles-css-dlg .cv-head { flex: none; }
.articles-css-dlg > .muted { flex: none; }
.articles-css-dlg .grp { flex: none; margin-top: 10px; }
.articles-css { width: 100%; flex: 1 1 auto; min-height: min(50vh, 420px); font: 12px/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; tab-size: 2; resize: vertical; }
.agent-text-dlg { width: min(720px, 100%); display: flex; flex-direction: column; max-height: calc(100vh - 32px); overflow: hidden; }
.agent-text-dlg .cv-head { flex: none; }
.agent-text-dlg .grp { flex: none; margin-top: 10px; }
.agent-text-ta { width: 100%; flex: 1 1 auto; min-height: min(50vh, 420px); font: 14px/1.45 inherit; resize: vertical; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--ink); box-sizing: border-box; }
.set-agent-text-row { align-items: start; }
.set-agent-texts { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-start; }
.study-ai-fold { margin-bottom: 16px; }
.study-ai-list { display: flex; flex-direction: column; gap: 10px; margin: 10px 0; }
.study-ai-item { display: grid; grid-template-columns: auto 1fr; gap: 6px 10px; align-items: start; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; background: var(--bg); }
.study-ai-item input { margin-top: 4px; }
.study-ai-meta { display: flex; flex-direction: column; gap: 2px; }
.study-ai-body { grid-column: 1 / -1; margin: 0; white-space: pre-wrap; font: 13px/1.45 inherit; max-height: 180px; overflow: auto; color: var(--ink); }
.studies-head { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-start; justify-content: space-between; margin-bottom: 14px; }
.studies-head .muted { flex: 1 1 240px; margin: 0; }
.study-card { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin-bottom: 12px; background: var(--bg); }
.study-row { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: end; margin-bottom: 10px; }
.study-row label, .study-title, .study-text { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.study-row input[type=date], .study-row select { min-width: 140px; }
.study-title input, .study-text textarea { width: 100%; box-sizing: border-box; color: var(--ink); }
.study-title, .study-text { width: 100%; margin-bottom: 8px; }
.study-card .btn.danger { margin-left: auto; }
@media (max-width: 700px) {
  .set { grid-template-columns: 1fr; gap: 12px; }
  .set-side { flex-direction: row; position: static; }
  .set-tab { flex: 1; text-align: center; border-color: var(--line); background: var(--card); }
  .set-row { grid-template-columns: 1fr; gap: 6px; }
}
@media (max-width: 560px) {
  .top-in { flex-wrap: wrap; }
  nav { flex-wrap: wrap; gap: 6px; }
  nav .btn { padding: 6px 10px; }
}

/* перенос анализов: вкладки и отправка фото провайдеру */
.ai-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 4px; flex-wrap: wrap; }
.ai-tabs button { border: 1px solid transparent; border-bottom: 0; background: transparent; color: var(--muted); padding: 8px 14px; border-radius: 8px 8px 0 0; font-size: 14px; margin-bottom: -1px; }
.ai-tabs button:hover { color: var(--accent); }
.ai-tabs button.on { background: var(--card); color: var(--accent); font-weight: 600; border-color: var(--line); border-bottom: 1px solid var(--card); }
.ai-pane { display: grid; gap: 10px; }
.ai-pane[hidden] { display: none; }
.ai-auto .set-row:first-child { border-top: 0; }
.ai-thumbs { display: flex; flex-wrap: wrap; gap: 10px; }
.ai-thumbs:empty { display: none; }
.ai-thumb { position: relative; margin: 0; width: 112px; }
.ai-thumb img, .ai-pdf { width: 112px; height: 112px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; background: var(--bg); font-weight: 700; color: var(--muted); }
.ai-thumb figcaption { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 3px; }
.ai-thumb .btn { position: absolute; top: 4px; right: 4px; padding: 0 8px; line-height: 22px; }
.ai-privacy { margin: 0; font-size: 13px; }
.ai-wait { font-size: 13px; align-self: center; }
.ai-raw summary { cursor: pointer; font-size: 13px; color: var(--muted); }
.ai-raw pre { white-space: pre-wrap; word-break: break-word; font-size: 12px; max-height: 260px; overflow: auto; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 8px; }
.ai [hidden] { display: none !important; }

/* переключатель вкл/выкл */
.sw { position: relative; display: inline-flex; align-items: center; cursor: pointer; }
.sw input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.sw-track { width: 42px; height: 24px; border-radius: 999px; background: var(--line); border: 1px solid var(--line); position: relative; transition: background .18s, border-color .18s; }
.sw-knob { position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .18s; }
.sw input:checked + .sw-track { background: var(--ok); border-color: var(--ok); }
.sw input:checked + .sw-track .sw-knob { transform: translateX(18px); }
.sw input:focus-visible + .sw-track { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { .sw-track, .sw-knob { transition: none; } }

/* выбор модели со значками возможностей */
.mp-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.mp { position: relative; display: flex; align-items: center; gap: 6px; flex: 1 1 240px; min-width: 0; }
.mp > input { flex: 1; min-width: 0; width: 100%; }
.mp-caps { display: inline-flex; gap: 4px; flex: none; }
.mp-caps:empty { display: none; }
.cap.guess { opacity: .7; }
.mp-open { padding: 6px 10px; flex: none; }
.mp-open:disabled { opacity: .45; cursor: default; }
.mp-pop { position: absolute; z-index: 50; top: calc(100% + 4px); left: 0; right: 0; min-width: 280px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 28px rgba(0,0,0,.18); padding: 8px; display: grid; gap: 6px; }
.mp-pop[hidden] { display: none; }
.mp-q { width: 100%; }
.mp-list { max-height: 300px; overflow: auto; display: grid; gap: 2px; }
.mp-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; text-align: left; border: 0; background: transparent; color: var(--ink); padding: 6px 8px; border-radius: 6px; font-size: 13px; }
.mp-item:hover, .mp-item.on { background: var(--accent-soft); }
.mp-id { min-width: 0; overflow-wrap: anywhere; }
.mp-id small { display: block; color: var(--muted); font-size: 11px; }
.mp-empty { margin: 6px; font-size: 13px; }
.cap-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 11px; color: var(--muted); border-top: 1px solid var(--line); padding-top: 6px; }
.cap-legend span { display: inline-flex; align-items: center; gap: 3px; }
.cap-legend .cap { width: 14px; height: 14px; }
[data-ai-novision]:empty { display: none; }
[data-ai-novision] { display: block; margin-top: 4px; }

/* цвета возможностей моделей */
.cap-vision { color: #1d6fd8; } .cap-pdf { color: #d03b3b; } .cap-tools { color: #c06a00; }
.cap-reasoning { color: #8a3fd6; } .cap-free { color: #1a8a4a; }
html[data-theme="dark"] {
  .cap-vision { color: #6cb2ff; } .cap-pdf { color: #ff8a8a; } .cap-tools { color: #ffbd4d; }
  .cap-reasoning { color: #c9a2ff; } .cap-free { color: #5fdc98; }
}

/* индикатор связи с провайдером */
.conn { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); white-space: nowrap; }
.conn .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--line); box-shadow: 0 0 0 2px rgba(127,127,127,.15); display: inline-block; }
.conn.ok { color: var(--ok); } .conn.ok .dot { background: var(--ok); box-shadow: 0 0 0 3px rgba(31,138,76,.2); }
.conn.bad { color: var(--danger); } .conn.bad .dot { background: var(--danger); box-shadow: 0 0 0 3px rgba(194,59,50,.2); }
.conn.wait .dot { background: var(--accent); animation: connpulse 1s infinite ease-in-out; }
@keyframes connpulse { 50% { opacity: .3; } }
@media (prefers-reduced-motion: reduce) { .conn.wait .dot { animation: none; } }
[data-connerr]:empty { display: none; }
.fold-status .conn { font-size: inherit; }
.fold.moved { animation: foldmoved 1.2s ease-out; }
@keyframes foldmoved { 0% { box-shadow: 0 0 0 3px var(--accent); } 100% { box-shadow: 0 0 0 0 transparent; } }
@media (prefers-reduced-motion: reduce) { .fold.moved { animation: none; outline: 2px solid var(--accent); } }

/* выбор провайдера у агента: настроенные подсвечены */
select.prov-sel.ready { border-color: var(--ok); box-shadow: 0 0 0 1px var(--ok) inset; }
select.prov-sel option.opt-ready { color: var(--ok); font-weight: 600; }
select.prov-sel optgroup { color: var(--muted); font-style: normal; }

/* карточки настроек (хранение, прочее…) */
.store-card { margin-top: 14px; }
.store-card h2 { font-size: 16px; }
.store-card p { margin: 0 0 10px; font-size: 14px; }
.store-card .grp { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.store-card .small, .gate .small { font-size: 13px; }
.store-path-lab { display: grid; gap: 6px; font-size: 13px; color: var(--muted); margin: 0 0 12px; }
.store-path-lab input { width: 100%; font: 13px/1.4 ui-monospace, Consolas, monospace; }
.enc-form[hidden] { display: none; }
.enc-form input[type=password] { flex: 1 1 160px; }
.gate { display: grid; gap: 8px; }
.gate .grp { display: flex; flex-wrap: wrap; gap: 8px; }
.gate input[type=password] { flex: 1 1 180px; max-width: 280px; }
.gate .err:empty { display: none; }
[data-enc-err]:empty { display: none; }

/* анализы: значение · ед. изм. · норма · отклонение · критичность — одинаковые плашки в колонках */
input[type=number]::-webkit-inner-spin-button, input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input[type=number] { -moz-appearance: textfield; appearance: textfield; }
.ctl .unit { min-width: 72px; }
.lab-cols { display: inline-flex; gap: 8px; flex: none; }
.norm, .dev, .crit, .norm-h, .dev-h, .crit-h { flex: none; width: 70px; text-align: center; }
.dev, .crit, .dev-h, .crit-h { width: 92px; }
.norm, .dev, .crit { display: inline-block; padding: 4px 0; border-radius: 8px; border: 1px solid var(--line); font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; cursor: help; }
.norm { background: var(--accent-soft); color: var(--ink); }
.dev, .crit { background: var(--bg); }
.dev.empty, .crit.empty { color: var(--muted); font-weight: 400; }
.dev.zero { color: var(--ok); }
.dev.up { color: #c2410c; background: rgba(234,88,12,.08); border-color: rgba(234,88,12,.35); }
.dev.down { color: #1d4ed8; background: rgba(37,99,235,.08); border-color: rgba(37,99,235,.35); }
html[data-theme="dark"] {
  .dev.up { color: #ffb37a; background: rgba(251,146,60,.12); border-color: rgba(251,146,60,.4); }
  .dev.down { color: #93c5fd; background: rgba(96,165,250,.12); border-color: rgba(96,165,250,.4); }
}
.fhead { padding: 2px 0 6px; }
.fhead .ctl { font-size: 10.5px; text-transform: uppercase; letter-spacing: .02em; color: var(--muted); }
.fhead .fh-val { width: 72px; text-align: right; }
.fhead .unit { color: var(--muted); font-size: 11px; }
@media (max-width: 900px) {
  .field:has(.lab-cols) { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .fhead > span:first-child { display: none; }
}
@media (max-width: 640px) {
  .ctl:has(.lab-cols) { flex-wrap: wrap; row-gap: 6px; }
  .ctl:has(.lab-cols) input[type=number], .fhead .fh-val { width: 72px; flex: none; }
  .ctl:has(.lab-cols) .unit, .fhead .unit { min-width: 0; flex: 1; font-size: 12px; }
  .lab-cols { flex-basis: 100%; gap: 6px; }
  .norm, .dev, .crit, .norm-h, .dev-h, .crit-h { width: auto; flex: 1; font-size: 12px; }
  .fhead .ctl { letter-spacing: 0; }
}

/* норма у клиента: нажатие — изменить */
button.norm { font-family: inherit; line-height: inherit; }
button.norm:hover { border-color: var(--accent); }
.norm.own { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); position: relative; }
.norm.own::after { content: ""; position: absolute; top: 3px; right: 4px; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }
.norm-edit { flex: none; width: 70px; text-align: center; padding: 3px 4px; border-radius: 8px; font-size: 13px; font-weight: 600; }
@media (max-width: 640px) { .norm-edit { width: auto; flex: 1; min-width: 0; } }

/* настройки → веса */
.w-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; margin: 10px 0; }
.w-card { padding: 4px 8px; }
.w-table td, .w-table th { padding: 7px 8px; }
.w-table td small { display: block; color: var(--muted); font-size: 11px; }
.w-table tr.w-sec th { padding-top: 16px; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); border-top: 0; }
.w-table .w-def { color: var(--muted); font-variant-numeric: tabular-nums; }
.w-in { width: 90px; text-align: center; font-weight: 600; font-variant-numeric: tabular-nums; }
.w-in.own { border-color: var(--accent); background: var(--accent-soft); }
.w-in.bad { border-color: var(--danger); }
.w-reset { padding: 3px 9px; }
.w-reset[hidden] { display: none; }
tbody[hidden], tr[hidden] { display: none; }
@media (max-width: 640px) { .w-table th:nth-child(2), .w-table td:nth-child(2) { display: none; } }

/* нормы и веса: безопасный диапазон, кривая */
.w-safe b { font-variant-numeric: tabular-nums; }
.w-safe small { display: block; color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.w-normcell, .w-curvecell { display: inline-flex; align-items: center; gap: 6px; }
.w-curve.own { border-color: var(--accent); color: var(--accent); }
.w-curve:disabled { opacity: .45; cursor: default; }
.w-own { font-size: 11px; color: var(--accent); }

/* критичность в анкете: от зелёного к красному */
.crit.k0 { color: var(--ok); background: rgba(31,138,76,.10); border-color: rgba(31,138,76,.35); }
.crit.k1 { color: #8a6d00; background: rgba(234,179,8,.14); border-color: rgba(234,179,8,.45); }
.crit.k2 { color: #b45309; background: rgba(245,158,11,.16); border-color: rgba(245,158,11,.5); }
.crit.k3 { color: #c2410c; background: rgba(234,88,12,.16); border-color: rgba(234,88,12,.5); }
.crit.k4 { color: #fff; background: #c23b32; border-color: #c23b32; }
html[data-theme="dark"] {
  .crit.k0 { color: #6ee7a8; background: rgba(74,222,128,.12); border-color: rgba(74,222,128,.35); }
  .crit.k1 { color: #fde68a; background: rgba(250,204,21,.12); border-color: rgba(250,204,21,.4); }
  .crit.k2 { color: #fcd34d; background: rgba(245,158,11,.16); border-color: rgba(245,158,11,.45); }
  .crit.k3 { color: #fdba74; background: rgba(251,146,60,.18); border-color: rgba(251,146,60,.5); }
  .crit.k4 { color: #fff; background: #d9443a; border-color: #d9443a; }
}
.dev, .dev-h { width: 112px; }
.crit, .crit-h { width: 84px; }

/* окно-редактор кривой критичности */
body.cv-lock { overflow: hidden; padding-right: var(--cv-sbw, 0px); }
/* flex-start: при смене Норма→Наличие/Текст сжимается низ, шапка и радиоточки не прыгают */
.cv-overlay { position: fixed; inset: 0; z-index: 2000; background: rgba(10,12,16,.55); display: flex; align-items: flex-start; justify-content: center; padding: 24px 16px 16px; overflow: auto; animation: cvfade .15s ease-out; }
@keyframes cvfade { from { opacity: 0; } }
.cv-dialog { background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: 14px; width: min(820px, 100%); max-height: calc(100vh - 32px); overflow: auto; padding: 16px 18px; box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.cv-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.cv-head b { font-size: 17px; }
.cv-safe { font-size: 13px; color: var(--ok); margin-top: 2px; }
.cv-x { padding: 4px 11px; }
.cv-kinds { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 12px 0 10px; }
.cv-kind { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; cursor: pointer; }
.cv-kind input { margin: 0; }
.cv-ctrls { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; margin: 12px 0 6px; font-size: 14px; }
.cv-ctrls label { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.cv-ctrls input[type=number] { width: 76px; text-align: center; }
.cv-svg { width: 100%; height: auto; display: block; touch-action: none; user-select: none; }
.cv-svg .cv-t { fill: var(--muted); font-size: 12px; }
.cv-gl { stroke: var(--line); } .cv-gl0 { stroke: var(--muted); }
.cv-safezone { fill: rgba(31,138,76,.10); }
.cv-area { fill: rgba(194,59,50,.12); } .cv-line { fill: none; stroke: var(--danger); stroke-width: 2.5; }
.cv-probe { stroke: var(--accent); stroke-dasharray: 4 4; stroke-width: 1.5; } .cv-pdot { fill: var(--accent); }
.cv-lbox { fill: var(--accent-soft); stroke: var(--accent); } .cv-ltxt { fill: var(--accent); font-size: 13px; font-weight: 600; }
.cv-pt { fill: var(--card); stroke: var(--danger); stroke-width: 2.5; cursor: grab; } .cv-pt.fixed { fill: var(--danger); }
.cv-help { margin-top: 10px; } .cv-help ul { margin: 0; padding-left: 18px; font-size: 13px; color: var(--muted); }
@media (prefers-reduced-motion: reduce) { .cv-overlay { animation: none; } }

/* чат «Поговорить с доктором» */
.talk-dlg { width: min(560px, 100%); display: flex; flex-direction: column; max-height: calc(100vh - 32px); overflow: hidden; }
.talk-dlg .cv-head { flex: none; }
.talk-bar { flex: none; margin: 10px 0 8px; }
.talk-prov { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); font-weight: 600; }
.talk-prov select { font-weight: 500; color: var(--ink); max-width: 100%; }
.talk-log { flex: 1 1 auto; min-height: 220px; max-height: min(48vh, 420px); overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding: 10px 4px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); }
.talk-hint { font-size: 14px; padding: 8px 10px; }
.talk-msg { display: flex; flex-direction: column; gap: 4px; max-width: 92%; }
.talk-user { align-self: flex-end; }
.talk-assistant { align-self: flex-start; }
.talk-bubble { padding: 8px 12px; border-radius: 12px; font-size: 14px; line-height: 1.4; white-space: pre-wrap; word-break: break-word; }
.talk-user .talk-bubble { background: var(--accent-soft); color: var(--ink); border: 1px solid var(--accent); }
.talk-assistant .talk-bubble { background: var(--card); border: 1px solid var(--line); }
.talk-meta { font-size: 12px; color: var(--muted); padding: 0 4px; }
.talk-compose { flex: none; display: flex; gap: 8px; align-items: flex-end; margin-top: 10px; }
.talk-compose textarea { flex: 1; min-height: 56px; margin: 0; }
.talk-compose .btn { flex: none; }
.talk-err { margin: 8px 0 0; }
.talk-empty { padding: 18px 4px 8px; display: grid; gap: 12px; justify-items: start; }
.talk-empty p { margin: 0; font-size: 14px; max-width: 36em; }
@media (max-width: 640px) { .norm, .dev, .crit, .norm-h, .dev-h, .crit-h { width: auto; flex: 1; } .dev { flex: 1.4; } }
.cv-norm { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; font-size: 14px; }
.cv-norm label { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }
.cv-norm input { width: 96px; text-align: center; font-weight: 600; font-variant-numeric: tabular-nums; }
.cv-norm input.bad { border-color: var(--danger); }
.cv-nreset { padding: 4px 10px; font-size: 13px; }
.cv-nhint { font-size: 12px; }
.cv-zero { margin: 12px 0 0; }
[data-chart][hidden], .cv-zero[hidden] { display: none; }
.w-safe b.own { color: var(--accent); }
.w-files { display: flex; flex-wrap: wrap; gap: 8px; }

/* поле значения анализа — узкое: числа короткие */
.ctl:has(.lab-cols) input[type=number] { width: 72px; flex: none; }

/* сужение: отклонение и критичность; шарики-метки источника нормы */
.dev, .dev-h { width: 96px; } .dev { font-size: 12px; }
.crit, .crit-h { width: 56px; }
.marks, .marks-h { flex: none; width: 46px; text-align: center; }
.marks { display: inline-flex; align-items: center; justify-content: center; gap: 4px; cursor: help; }
.mk { width: 10px; height: 10px; border-radius: 50%; display: inline-block; opacity: .22; border: 2px solid transparent; box-sizing: border-box; }
.mk-s { background: #8b95a3; } .mk-r { background: #8b5cf6; } .mk-o { background: #22b8e6; }
.mk.on { opacity: 1; }
.mk.ring { opacity: 1; background: transparent; border-color: #8b5cf6; }
.fhead .marks-h { font-size: 9.5px; letter-spacing: 0; }
.cv-sub { font-size: 13px; }
@media (max-width: 640px) { .norm, .dev, .crit, .norm-h, .dev-h, .crit-h { width: auto; flex: 1; } .dev { flex: 1.5; } .marks, .marks-h { flex: none; width: 40px; } }
.crit, .crit-h { width: 64px; }
.marks, .marks-h { width: 52px; }
.fhead .crit-h, .fhead .marks-h, .fhead .dev-h { font-size: 9.5px; letter-spacing: 0; }

/* сводка «Требуют внимания»: строка названий над группами анализов */
.attn { margin: 10px 0 16px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); font-size: 14px; line-height: 1.7; }
.attn:empty { display: none; }
.attn-title { font-weight: 600; color: var(--ink); margin-right: 2px; }
.attn-sep { color: var(--muted); }
.attn-item { border: 0; background: none; padding: 0; font: inherit; font-weight: 600; cursor: pointer; text-decoration: underline dotted; text-underline-offset: 3px; }
.attn-item:hover { text-decoration-style: solid; }
.attn-item.k1 { color: #8a6d00; } .attn-item.k2 { color: #b45309; } .attn-item.k3 { color: #c2410c; } .attn-item.k4 { color: #c23b32; }
html[data-theme="dark"] .attn-item.k1 { color: #fde68a; }
html[data-theme="dark"] .attn-item.k2 { color: #fcd34d; }
html[data-theme="dark"] .attn-item.k3 { color: #fdba74; }
html[data-theme="dark"] .attn-item.k4 { color: #ff7b72; }
.fs-bad { color: var(--danger); font-weight: 600; }
.field.flash { animation: fieldflash 1.6s ease-out; border-radius: 8px; }
@keyframes fieldflash { 0% { background: var(--accent-soft); box-shadow: 0 0 0 2px var(--accent); } 100% { background: transparent; box-shadow: 0 0 0 0 transparent; } }
@media (prefers-reduced-motion: reduce) { .field.flash { animation: none; outline: 2px solid var(--accent); } }

/* название анализа — ссылка на статью (без стрелки); рядом карандаш → Нормы и веса */
.art-link { color: inherit; text-decoration: underline; text-decoration-color: rgba(127,127,127,.45); text-underline-offset: 3px; }
.art-link:hover { color: var(--accent); text-decoration-color: currentColor; }
.lab-name-gap { display: inline-block; width: 0.55em; }
.lab-norm-edit {
  display: inline-flex; align-items: center; justify-content: center;
  vertical-align: -2px; color: var(--muted); text-decoration: none;
  border-radius: 4px; padding: 1px;
}
.lab-norm-edit:hover, .lab-norm-edit:focus-visible {
  color: var(--accent); background: var(--accent-soft); outline: none;
}
.w-table tr.w-focus td { background: var(--accent-soft); }
.w-table tr.w-focus { outline: 2px solid var(--accent); outline-offset: -2px; }
.login-todo { margin-top: 28px; font-size: 14px; }

/* Настройки → Диагнозы: карточки разделов, как на главной странице статей */
.dx-lead { margin: -4px 0 14px; font-size: 14px; }
.dx-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(175px, 1fr)); gap: 12px; }
.dx-card { display: flex; flex-direction: column; gap: 6px; padding: 16px 14px 14px; min-height: 160px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); color: var(--ink); text-decoration: none; transition: border-color .15s, background .15s, transform .15s; }
.dx-card:hover, .dx-card:focus-visible { border-color: var(--accent); background: var(--accent-soft); transform: translateY(-2px); }
.dx-ico { color: var(--accent); flex: none; }
.dx-card .dx-ico { margin-bottom: 6px; }
.dx-name { font-weight: 600; font-size: 15px; line-height: 1.25; hyphens: auto; overflow-wrap: anywhere; }
.dx-desc { font-size: 13px; color: var(--muted); line-height: 1.35; flex: 1; }
.dx-count { font-size: 13px; font-variant-numeric: tabular-nums; }
.dx-secbar { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; min-width: 0; }
.dx-secbar a { flex-shrink: 0; white-space: nowrap; font-size: 14px; }
.dx-secbar h2 { margin: 0; font-size: 18px; flex-shrink: 0; white-space: nowrap; }
.dx-secbar .muted { flex-shrink: 0; white-space: nowrap; font-size: 14px; }
.dx-secbar .dx-sec-sort { flex-shrink: 0; }
.dx-secbar .dx-sec-sort button { padding: 4px 10px; font-size: 12px; }
.dx-secbar input[type=search] { flex: 1 1 auto; min-width: 0; }
.lab-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; }
.lab-chips .dx-chip-n { margin-left: 4px; font-variant-numeric: tabular-nums; opacity: 0.65; font-weight: 600; }
.lab-card { padding: 4px 8px; }
.lab-table td, .lab-table th { padding: 7px 8px; vertical-align: top; }
.lab-table td small { display: block; color: var(--muted); font-size: 11px; }
.lab-name { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.lab-type { display: inline-flex; align-items: center; justify-content: center; width: 1.35em; height: 1.35em; border-radius: 50%; border: 1px solid var(--line); font-size: 11px; font-weight: 700; line-height: 1; color: var(--muted); flex-shrink: 0; }
.lab-unit { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.lab-refs {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 1.4em; height: 1.4em; padding: 0 5px; margin-left: 2px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--card);
  color: var(--accent); font: inherit; font-size: 11px; font-weight: 700;
  font-variant-numeric: tabular-nums; line-height: 1; cursor: pointer;
}
.lab-refs:hover, .lab-refs:focus-visible { border-color: var(--accent); background: var(--accent-soft); outline: none; }
.lab-refs.zero { color: var(--muted); font-weight: 600; cursor: default; border-style: dashed; }
.w-dxrefs { margin: 8px 0 0; padding: 0 0 0 1.1em; max-height: min(55vh, 420px); overflow: auto; }
.w-dxrefs li { margin: 4px 0; line-height: 1.35; }
.w-dxrefs-dlg { max-width: 480px; width: min(92vw, 480px); }
.lab-own { font-size: 11px; color: var(--accent); font-weight: 600; }
.lab-newform { margin: 0 0 12px; padding: 12px; display: grid; gap: 10px; }
.lab-newform[hidden] { display: none !important; }
.lab-newgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.lab-newgrid label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
.dx-secbar #lab-new { flex-shrink: 0; }
.dx-back { margin: 0 0 10px; }
.dx-head { align-items: center; justify-content: flex-start; gap: 10px; }
.dx-head .muted { margin-left: auto; }
.dx-tools { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 12px; }
.dx-tools input[type=search] { flex: 1 1 220px; }
.dx-chips { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.dx-chip { border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 999px; padding: 5px 12px; font: inherit; font-size: 13px; cursor: pointer; }
a.dx-chip { text-decoration: none; }
.dx-chip.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.i18n-card .grp { margin-bottom: 10px; }
.i18n-ta { width: 100%; min-height: min(55vh, 520px); font: 13px/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; tab-size: 2; resize: vertical; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--ink); box-sizing: border-box; }
.dx-list { list-style: none; margin: 0; padding: 0; columns: 2 280px; column-gap: 28px; }
.dx-list li { break-inside: avoid; padding: 5px 0; font-size: 14px; line-height: 1.4; }
.dx-list li small { display: block; font-size: 12px; }
.dx-flag { display: inline-block; font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 999px; vertical-align: 1px; background: rgba(127,127,127,.12); color: var(--muted); }
.dx-flag.f-urgent { background: rgba(194,59,50,.12); color: var(--danger); }
.dx-flag.f-child { background: rgba(37,99,201,.12); color: var(--accent); }
.dx-flag.f-elderly { background: rgba(124,58,237,.12); color: #7c3aed; }
@media (max-width: 640px) { .dx-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } .dx-card { min-height: 140px; } }

/* Агенты: общий провайдер и группы */
.set-shared { margin-bottom: 18px; border-color: var(--accent); }
.set-shared-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.set-shared .set-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 8px; font-size: 13px; }
.set-group { font-size: 15px; margin: 18px 0 8px; text-transform: none; letter-spacing: 0; }
.set-group .muted { font-weight: 400; }

/* Анализы по датам: полоса дат сверху и строка «Сохранить» внизу */
.lab-top { padding: 12px 14px 10px; margin-bottom: 12px; }
.lab-dates { display: flex; align-items: stretch; gap: 8px; }
.ld-new { flex: none; border: 1px dashed var(--accent); background: var(--card); color: var(--accent); border-radius: 10px; padding: 0 12px; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; min-height: 96px; }
.ld-new.on { background: var(--accent-soft); border-style: solid; }
.ld-scroll { flex: 1; display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; align-items: stretch; }
.ld-none { align-self: center; font-size: 13px; }
.ld-chip { flex: none; width: 34px; min-height: 96px; border: 1px solid var(--line); border-bottom: 4px solid var(--line); background: var(--bg); color: var(--ink); border-radius: 8px; padding: 6px 0; cursor: pointer; display: flex; align-items: center; justify-content: center; font: inherit; }
.ld-chip:hover { border-color: var(--accent); }
.ld-chip.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600; }
.ld-txt { writing-mode: vertical-rl; transform: rotate(180deg); font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; line-height: 1; }
.ld-txt small { font-size: 10px; margin-top: 4px; color: var(--muted); }
.ld-chip.k0 { border-bottom-color: var(--ok); } .ld-chip.k1 { border-bottom-color: #eab308; } .ld-chip.k2 { border-bottom-color: #f59e0b; } .ld-chip.k3 { border-bottom-color: #ea580c; } .ld-chip.k4 { border-bottom-color: #c23b32; }
.ld-cap { margin: 8px 0 0; font-size: 14px; }
.ld-state { color: var(--muted); }
.ld-state.dirty { color: #b45309; font-weight: 600; }
.lab-save { position: sticky; bottom: 0; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin: 18px -16px -16px; padding: 12px 16px; background: var(--card); border-top: 1px solid var(--line); border-radius: 0 0 12px 12px; box-shadow: 0 -6px 14px rgba(0,0,0,.05); }
.lab-save label { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; }
.lab-save input[type=date], .lab-save input[type=time] { width: auto; }
.ls-msg { flex: 1; font-size: 13px; min-width: 120px; }
.ls-msg.ok { color: var(--ok); } .ls-msg.err { color: var(--danger); }
.ls-btns { display: inline-flex; gap: 8px; margin-left: auto; }
.ls-ask { flex-basis: 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 14px; padding: 8px 10px; border-radius: 8px; background: var(--accent-soft); }
.ls-ask[hidden] { display: none; }

/* Настройки → Диагнозы: способ расчёта и признаки диагнозов */
.dx-method { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; font-size: 14px; }
.dx-method label { display: flex; gap: 8px; align-items: center; }
.dx-method p { margin: 2px 0 0; font-size: 13px; }
.dx-filled { font-size: 12px; color: var(--ok); }
.dx-filled.none { color: var(--muted); }
.dx-acc { display: grid; gap: 8px; }
.dx-item summary { align-items: center; }
.dx-title { display: inline-flex; flex-wrap: wrap; align-items: baseline; gap: 6px; min-width: 0; flex: 1; }
.dx-title .fold-title { flex: none; }
.dx-art { text-decoration: none; color: var(--accent); font-size: 13px; padding: 0 2px; }
.dx-art:hover { text-decoration: underline; }
.dx-also { font-size: 12px; }
.dx-tag { display: inline-block; margin-left: 6px; font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 999px; background: rgba(127,127,127,.12); color: var(--muted); }
.dx-tag.own { background: rgba(8,145,178,.14); color: #0e7490; }
.dx-tag.ai { background: rgba(124,58,237,.12); color: #7c3aed; }
.dx-tag.ok { background: rgba(31,138,76,.12); color: var(--ok); }
.dx-form h4 { margin: 16px 0 6px; font-size: 14px; }
.dx-form h4 small { font-weight: 400; font-size: 12px; }
.dx-meta { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; font-size: 14px; }
.dx-meta label { display: inline-flex; align-items: center; gap: 6px; }
.dx-meta input[type=number] { width: 80px; }
.dx-doc-dlg { width: min(420px, 100%); }
.dx-doc-list { display: grid; gap: 6px; margin: 12px 0; }
.dx-doc-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px; }
.dx-doc-row .btn { padding: 2px 10px; }
.dx-doc-add select { width: 100%; font: inherit; }
.dx-doc-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; margin-top: 14px; }
.dx-signs { width: 100%; border-collapse: collapse; }
.dx-signs th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 4px 6px; }
.dx-signs td { padding: 3px 6px 3px 0; }
.dx-signs select, .dx-signs input { width: 100%; }
.dx-signs td:nth-child(2) { width: 190px; } .dx-signs td:nth-child(3) { width: 76px; } .dx-signs td:nth-child(4) { width: 190px; } .dx-signs td:last-child { width: 40px; }
.dx-form > .btn { margin-top: 6px; }
.dx-text { margin: 0; padding-left: 18px; font-size: 14px; }
.dx-later { margin: 0; font-size: 13px; }
.dx-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; }
.dx-why { display: block; font-size: 12px; color: var(--muted); margin: 2px 0 4px; line-height: 1.35; }
.dx-why .dx-tag { margin-left: 0; }
.dx-nolist { font-size: 13px; margin: 10px 0 0; padding: 8px 10px; border-radius: 8px; background: rgba(234,179,8,.12); }

/* Настройки → Осмотр */
.exam-list { margin-bottom: 16px; }
.exam-body { display: grid; gap: 12px; }
.exam-field { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
.exam-field input, .exam-field textarea, .exam-meta input, .exam-meta select { font: inherit; color: var(--ink); }
.exam-field textarea { width: 100%; min-height: 72px; resize: vertical; }
.exam-meta { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: end; font-size: 13px; color: var(--muted); }
.exam-meta label { display: grid; gap: 4px; }
.exam-meta label[hidden] { display: none; } /* иначе display:grid перебивает атрибут hidden */
.exam-meta select, .exam-meta input[type=number], .exam-meta input[type=text] { min-width: 120px; }
.exam-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.exam-add { display: grid; gap: 10px; margin-top: 8px; }
.exam-add > b { font-size: 14px; }

/* Карточка клиента → Диагнозы: вероятные диагнозы по анализам */
.dxt-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px; }
.dxt-title { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.dxt-head h2 { margin: 0; font-size: 17px; text-transform: none; letter-spacing: 0; color: var(--ink); }
.dxt-head .muted { font-size: 13px; }
.dxt-src { position: relative; display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px; font-size: 13px; }
.dxt-date { font: inherit; font-size: 13px; font-weight: 600; color: var(--accent); background: transparent; border: 0; border-bottom: 1px dashed var(--accent); padding: 0; cursor: pointer; border-radius: 0; }
.dxt-date:hover { filter: brightness(1.1); }
.dxt-date-menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; min-width: 160px; max-height: 280px; overflow: auto; display: grid; gap: 2px; padding: 6px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 28px rgba(0,0,0,.14); }
.dxt-date-menu[hidden] { display: none; }
.dxt-date-menu button { display: block; width: 100%; text-align: left; font: inherit; font-size: 13px; padding: 7px 10px; border: 0; border-radius: 7px; background: transparent; color: var(--ink); cursor: pointer; }
.dxt-date-menu button:hover { background: var(--accent-soft); }
.dxt-date-menu button.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.dxt-info { width: 22px; height: 22px; padding: 0; border-radius: 50%; border: 1.5px solid var(--muted); background: transparent; color: var(--muted); font-size: 13px; font-weight: 700; line-height: 1; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.dxt-info:hover { border-color: var(--accent); color: var(--accent); }
.dxt-sort { flex: none; }
.dxt-sort button { padding: 4px 10px; font-size: 12px; }
.dxt-note-dlg { width: min(520px, 100%); }
.dxt-note { font-size: 15px; margin: 10px 0 0; color: var(--muted); line-height: 1.55; }
.exp-dlg { width: min(420px, 100%); }
.exp-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 14px; }
.exp-lbl { flex: none; width: 64px; font-size: 13px; color: var(--muted); font-weight: 600; }
.exp-labs { margin-top: 12px; display: grid; gap: 8px; padding-left: 74px; }
.exp-radio { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.exp-radio input { margin: 0; }
.exp-radio select { font: inherit; font-size: 14px; }
.exp-empty { margin: 0; font-size: 13px; }
.exp-actions { margin-top: 18px; display: flex; justify-content: flex-end; }
@media (max-width: 480px) { .exp-labs { padding-left: 0; } }
.dxt-filter { margin-bottom: 10px; }
.dxt-item summary { gap: 10px; }
.dxt-talk { flex: none; padding: 4px 10px; font-size: 12px; margin-left: auto; }
.talk-who { margin: 0; font-size: 13px; }
.talk-who b { color: var(--ink); font-weight: 600; }
.talk-who .talk-prov { display: inline-flex; flex-direction: row; align-items: center; gap: 6px; font-weight: 500; }
.talk-who .talk-prov select { max-width: 12em; }
.dxt-p { flex: none; min-width: 52px; text-align: center; font-weight: 700; font-size: 14px; font-variant-numeric: tabular-nums; padding: 3px 6px; border-radius: 8px; }
.dxt-p.p1 { background: rgba(127,127,127,.12); color: var(--muted); }
.dxt-p.p2 { background: rgba(234,179,8,.16); color: #8a6d00; }
.dxt-p.p3 { background: rgba(234,88,12,.16); color: #c2410c; }
.dxt-p.p4 { background: #c23b32; color: #fff; }
.dxt-body p { margin: 6px 0; display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline; font-size: 14px; }
.dxt-lbl { flex: none; width: 76px; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.dxt-chip { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 13px; border: 1px solid var(--line); background: var(--bg); }
.dxt-chip small { color: var(--muted); }
.dxt-chip.pro { border-color: rgba(194,59,50,.35); background: rgba(194,59,50,.07); }
.dxt-chip.con { border-color: rgba(31,138,76,.35); background: rgba(31,138,76,.07); }
.dxt-chip.miss { border-style: dashed; }
.dxt-look { font-size: 13px; flex: 1; min-width: 0; }
.dxt-meta { font-size: 12px !important; }
.dxt-more { text-align: center; margin-top: 10px; }
@media (max-width: 640px) { .dxt-lbl { width: 100%; } }

/* «Дополнительные анализы» из справочника */
.lab-extra { margin-top: 12px; }
.lab-extra h3 { margin: 0 0 8px; font-size: 15px; text-transform: none; letter-spacing: 0; }
.lab-extra h3 small { font-weight: 400; font-size: 12px; }
.lab-extra-row { display: flex; align-items: center; gap: 6px; }
.lab-extra-row .field { flex: 1; min-width: 0; }
/* строки из плашки «Требуют внимания» — сверху списка, цвет как у ссылок в плашке */
.lab-extra-row.lab-attn {
  border-radius: 8px; padding: 3px 6px; margin: 1px 0;
  outline: 1px solid transparent;
}
.lab-extra-row.lab-attn.k1 { background: rgba(138, 109, 0, 0.12); outline-color: rgba(138, 109, 0, 0.28); }
.lab-extra-row.lab-attn.k2 { background: rgba(180, 83, 9, 0.12); outline-color: rgba(180, 83, 9, 0.28); }
.lab-extra-row.lab-attn.k3 { background: rgba(194, 65, 12, 0.14); outline-color: rgba(194, 65, 12, 0.3); }
.lab-extra-row.lab-attn.k4 { background: rgba(194, 59, 50, 0.14); outline-color: rgba(194, 59, 50, 0.32); }
.lab-extra-row.lab-attn + .lab-extra-row:not(.lab-attn) {
  margin-top: 10px; padding-top: 8px;
  border-top: 1px solid var(--line);
}
html[data-theme="dark"] {
  .lab-extra-row.lab-attn.k1 { background: rgba(253, 230, 138, 0.12); outline-color: rgba(253, 230, 138, 0.28); }
  .lab-extra-row.lab-attn.k2 { background: rgba(252, 211, 77, 0.12); outline-color: rgba(252, 211, 77, 0.28); }
  .lab-extra-row.lab-attn.k3 { background: rgba(253, 186, 116, 0.14); outline-color: rgba(253, 186, 116, 0.3); }
  .lab-extra-row.lab-attn.k4 { background: rgba(255, 123, 114, 0.14); outline-color: rgba(255, 123, 114, 0.32); }
}
.lab-rm { flex: none; padding: 4px 10px; }
.lab-add { position: relative; margin-top: 10px; display: grid; gap: 8px; }
.lab-add input[type=search] { width: 100%; }
.lab-add-res { display: grid; gap: 4px; }
.lab-add-res:empty { display: none; }
.lab-add #labpick { justify-self: start; }
.labpick-dlg { width: min(720px, 100%); display: flex; flex-direction: column; max-height: calc(100vh - 32px); overflow: hidden; padding-bottom: 12px; }
.labpick-body { overflow: auto; flex: 1; min-height: 0; margin: 0 -4px; padding: 0 4px 4px; }
.labpick-lead { margin: 0 0 12px; font-size: 13px; }
.labpick-grid { margin-top: 4px; }
button.labpick-card { text-align: left; cursor: pointer; font: inherit; }
.labpick-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.labpick-bar .labpick-secname { font-size: 16px; }
.labpick-bar input[type=search] { flex: 1 1 140px; min-width: 120px; }
.labpick-list { display: grid; gap: 4px; }
.labpick-row { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); }
.labpick-row[hidden] { display: none; }
.labpick-info { flex: 1; min-width: 0; display: grid; gap: 2px; }
.labpick-info b { font-size: 14px; }
.labpick-info small { display: block; font-size: 12px; }
.labpick-add { flex: none; min-width: 36px; padding: 4px 12px; font-size: 18px; line-height: 1; }
.lab-res { text-align: left; border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 8px; padding: 7px 10px; font: inherit; font-size: 14px; cursor: pointer; }
.lab-res:hover, .lab-res:focus-visible { border-color: var(--accent); background: var(--accent-soft); }
.lab-al { display: block; font-size: 12px; }
button.dxt-chip { font: inherit; font-size: 13px; cursor: pointer; color: var(--ink); }
button.dxt-chip.miss:hover { border-color: var(--accent); background: var(--accent-soft); }
