/* «Ровный шов» — мобильная вёрстка. Крупные элементы: пользуются в мастерской, иногда в перчатках. */

:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --text: #15171c;
  --muted: #5b6270;
  --border: #d9dce2;
  --accent: #e8590c;        /* цвет раскалённого металла */
  --accent-text: #ffffff;
  --arc: #1c7ed6;           /* цвет дуги */
  --radius: 16px;
  --tap: 56px;              /* минимальная высота нажимаемого элемента */
  --gutter: 16px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14161a;
    --surface: #1f2228;
    --text: #f1f3f5;
    --muted: #a3aab6;
    --border: #343842;
    --accent: #ff7a2e;
    --accent-text: #14161a;
    --arc: #4dabf7;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 18px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
}

a { color: inherit; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: var(--tap);
  padding: env(safe-area-inset-top) var(--gutter) 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.brand {
  font-weight: 700;
  font-size: 20px;
  text-decoration: none;
}

.topbar-title {
  margin: 0;
  font-size: 20px;
}

.back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin-left: -10px;
  font-size: 34px;
  line-height: 1;
  text-decoration: none;
}

.page {
  max-width: 720px;
  margin: 0 auto;
  padding: var(--gutter) var(--gutter) calc(var(--gutter) * 2 + env(safe-area-inset-bottom));
}

/* Плитки главного экрана: две колонки на телефоне. */
.tiles {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.tile {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 150px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
}

.tile:active { transform: scale(0.98); }

.tile .icon {
  width: 44px;
  height: 44px;
  color: var(--accent);
  margin-bottom: auto;
}

.tile-title {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.2;
}

.tile-hint,
.list-hint {
  font-size: 15px;
  color: var(--muted);
}

.list {
  display: flex;
  flex-direction: column;
  margin-top: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.list-item {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: var(--tap);
  padding: 10px 16px;
  text-decoration: none;
}

.list-item + .list-item { border-top: 1px solid var(--border); }

.list-title { font-weight: 600; }

.notice {
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 6px solid var(--arc);
  border-radius: var(--radius);
}

.notice p { margin: 0; }
.notice p + p { margin-top: 6px; }
.notice-title { font-weight: 700; }

.button {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: var(--tap);
  margin-top: 16px;
  padding: 0 20px;
  background: var(--accent);
  color: var(--accent-text);
  border: 0;
  border-radius: var(--radius);
  font: inherit;
  font-weight: 700;
  text-decoration: none;
}

:focus-visible {
  outline: 3px solid var(--arc);
  outline-offset: 2px;
}

/* ---------- Подбор режимов ---------- */

:root {
  --warn-bg: #fff4e6;
  --warn-border: #f08c00;
  --info-bg: #e7f5ff;
  --ok: #2b8a3e;
  --draft: #868e96;
}

@media (prefers-color-scheme: dark) {
  :root {
    --warn-bg: #3a2a16;
    --warn-border: #ffa94d;
    --info-bg: #172a3a;
    --ok: #69db7c;
    --draft: #adb5bd;
  }
}

.topbar-step {
  margin-left: auto;
  color: var(--muted);
  font-size: 15px;
  white-space: nowrap;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.chip {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 4px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 15px;
  text-decoration: none;
}

.question {
  margin: 4px 0 12px;
  font-size: 24px;
  line-height: 1.25;
}

.options {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.option {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 64px;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
}

.option:active,
.num:active { transform: scale(0.98); }

.option-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.option-title {
  font-size: 19px;
  font-weight: 700;
  line-height: 1.25;
}

.option-hint {
  color: var(--muted);
  font-size: 15px;
}

.option-code {
  flex-shrink: 0;
  max-width: 40%;
  color: var(--muted);
  font-size: 13px;
  text-align: right;
}

.pos-icon {
  flex-shrink: 0;
  width: 52px;
  height: 52px;
}

.pos-metal { fill: var(--muted); opacity: 0.55; }
.pos-seam { fill: var(--accent); }
.pos-seam-line { stroke: var(--accent); stroke-width: 6; stroke-linecap: round; fill: none; }
.pos-arrow { stroke: var(--arc); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; fill: none; }

.num-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.num {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: var(--tap);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 22px;
  font-weight: 700;
  text-decoration: none;
}

.num-small {
  min-height: 44px;
  min-width: 52px;
  padding: 0 10px;
  font-size: 18px;
}

.num-active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
}

.num-form {
  margin-top: 20px;
}

.num-form label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
}

.num-form-row {
  display: flex;
  gap: 10px;
}

.num-form input {
  flex: 1;
  min-width: 0;
  min-height: var(--tap);
  padding: 0 14px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font: inherit;
  font-size: 20px;
}

.num-form .button { margin-top: 0; }

.diameters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.diameters-label { color: var(--muted); }

.alert {
  margin: 0 0 12px;
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 16px;
}

.alert-warn {
  background: var(--warn-bg);
  border-left: 5px solid var(--warn-border);
}

.alert-info {
  background: var(--info-bg);
  border-left: 5px solid var(--arc);
}

.values {
  margin: 0 0 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.value {
  padding: 12px 16px;
}

.value + .value { border-top: 1px solid var(--border); }

.value dt {
  color: var(--muted);
  font-size: 15px;
}

.value dd {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 2px 0 0;
}

.value-text {
  font-size: 19px;
  font-weight: 700;
}

.value-main .value-text {
  font-size: 30px;
  color: var(--accent);
}

.value-estimate .value-text { font-style: italic; }

.value-note {
  color: var(--muted);
  font-size: 15px;
}

.value-source {
  color: var(--muted);
  font-size: 13px;
}

.badge {
  display: inline-block;
  padding: 0 6px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  font-style: normal;
  vertical-align: middle;
}

.badge-estimate { background: var(--warn-bg); color: var(--warn-border); }
.badge-ok { color: var(--ok); }
.badge-draft { color: var(--draft); }

.disclaimer {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 15px;
}

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

.ref-intro p { margin: 0 0 8px; }
.ref-h { margin: 24px 0 8px; font-size: 22px; }

.ref-card {
  margin-bottom: 12px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.ref-card h3 { margin: 0 0 4px; font-size: 19px; }
.ref-maker { color: var(--muted); font-weight: 400; font-size: 15px; }
.ref-meta { margin: 6px 0; color: var(--muted); font-size: 15px; }
.ref-meta li { margin: 2px 0; }
.ref-src { margin: 8px 0 0; font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.ref-scroll { overflow-x: auto; max-width: 100%; -webkit-overflow-scrolling: touch; }
.ref-card { min-width: 0; }

.ref-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
}

.ref-table th,
.ref-table td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  white-space: nowrap;
}

.ref-table th { color: var(--muted); font-weight: 600; font-size: 13px; }

.print-only { display: none; }

@media print {
  :root { --bg: #fff; --surface: #fff; --text: #000; --muted: #333; --border: #999; }
  body { font-size: 12pt; background: #fff; color: #000; }
  .topbar { position: static; border: 0; }
  .no-print { display: none !important; }
  .print-only { display: initial; }
  th.print-only, td.print-only { display: table-cell; width: 2em; border: 1px solid #999; }
  .ref-card { break-inside: avoid; border-color: #999; }
  .ref-src a { color: #000; }
  .page { max-width: none; padding: 0; }
}

/* ---------- Ручной ввод с пачки: свой цвет, чтобы не путать с данными завода ---------- */

:root {
  --manual: #7048e8;
  --manual-bg: #f3f0ff;
  --error-bg: #fff5f5;
  --error: #e03131;
}

@media (prefers-color-scheme: dark) {
  :root {
    --manual: #b197fc;
    --manual-bg: #2b2540;
    --error-bg: #3b1e1e;
    --error: #ff8787;
  }
}

.badge-manual {
  background: var(--manual-bg);
  color: var(--manual);
  border: 1px solid var(--manual);
  white-space: nowrap;
}

.manual-banner {
  margin: 0 0 12px;
  padding: 12px 14px;
  background: var(--manual-bg);
  border-left: 5px solid var(--manual);
  border-radius: 12px;
  font-size: 16px;
}

.manual-banner p { margin: 6px 0 0; }

.value-manual { box-shadow: inset 5px 0 0 var(--manual); }
.value-manual.value-main .value-text { color: var(--manual); }

.option-manual { border-color: var(--manual); }
.option-add { border-style: dashed; color: var(--manual); }
.option-manual .badge-manual { align-self: flex-start; margin-top: 4px; }
.chip-manual { border-color: var(--manual); color: var(--manual); }

.button-manual { background: var(--manual); color: #fff; }
.button-secondary { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.button-danger { background: var(--surface); color: var(--error); border: 1px solid var(--error); }

.lead { margin: 0 0 4px; }
.empty { color: var(--muted); margin-top: 16px; }
.shelf-card { margin-top: 12px; }
.card-actions { display: flex; flex-wrap: wrap; gap: 0 10px; }
.card-actions > * { flex: 1 1 140px; }
.card-actions .button { width: 100%; margin-top: 8px; }

/* ---------- Формы ---------- */

.form { display: flex; flex-direction: column; gap: 14px; }

.field-group {
  margin: 0;
  padding: 12px 14px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.field-group legend { padding: 0 6px; font-weight: 700; }
.field { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.field-label { color: var(--muted); font-size: 15px; }
.field-hint { margin: 4px 0 8px; color: var(--muted); font-size: 14px; }
.req { color: var(--error); }

.form input:not([type=checkbox]):not([type=radio]),
.form select,
.form textarea {
  width: 100%;
  min-height: 48px;
  padding: 8px 12px;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  font: inherit;
}

.checks { display: flex; flex-direction: column; gap: 4px; }

.check {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
}

.check input { width: 22px; height: 22px; flex-shrink: 0; accent-color: var(--accent); }
.check-icon .pos-icon { width: 36px; height: 36px; }
.check-confirm { padding: 8px 12px; background: var(--warn-bg); border-radius: 10px; font-weight: 600; }

.pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 10px; }
/* Выпадающие списки в две колонки на телефоне обрезаются («Обычная стал…») — на узком экране по одному в строку. */
@media (max-width: 480px) {
  .pair:has(select) { grid-template-columns: minmax(0, 1fr); }
}

/* Подсказка в пустом поле не должна выглядеть как уже введённое значение. */
.form ::placeholder { color: var(--muted); opacity: 0.55; font-style: italic; }

/* Длинный заголовок блока формы — не вылезает за рамку. */
.field-group legend { max-width: 100%; white-space: normal; }
.field-group-hint { margin: 0 0 4px; color: var(--muted); font-size: 14px; }

/* Поля, которые к выбранному способу сварки не относятся (например, напряжение для электрода). */


.current-rows { display: flex; flex-direction: column; gap: 6px; }

.current-row {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) 60px 60px;
  gap: 6px;
}

.current-head { color: var(--muted); font-size: 13px; }
.form .current-row input,
.form .current-row select { min-height: 44px; padding: 6px 8px; }

.alert ul { margin: 6px 0 0; padding-left: 20px; }
.alert-title { margin: 0; font-weight: 700; }
.alert-error { background: var(--error-bg); border-left: 5px solid var(--error); }

/* ---------- Чертёж: расшифровщик, схемы соединений ---------- */

.palette {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.palette-key {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 56px;
  padding: 4px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 12px;
  font: inherit;
}

.palette-symbol { font-size: 22px; font-weight: 700; line-height: 1.1; }
.palette-title { font-size: 11px; color: var(--muted); line-height: 1.1; text-align: center; }

.decoded {
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.decoded-part {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 16px;
}

.decoded-part + .decoded-part { border-top: 1px solid var(--border); }
.decoded-text { align-self: flex-start; padding: 2px 8px; background: var(--bg); border-radius: 6px; font-size: 18px; font-weight: 700; }
.decoded-title { color: var(--muted); font-size: 15px; }
.decoded-meaning { font-size: 17px; }
.decoded-unknown { box-shadow: inset 5px 0 0 var(--warn-border); }
.decoded-unknown .decoded-title { color: var(--warn-border); font-weight: 700; }

.joint-figure {
  margin: 16px 0 0;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-align: center;
}

.joint-figure figcaption { color: var(--muted); font-size: 14px; }
.joint-svg { width: 100%; max-width: 360px; height: auto; }
.j-metal { fill: var(--muted); opacity: 0.45; stroke: var(--text); stroke-width: 1; }
.j-seam { fill: var(--accent); stroke: var(--accent); stroke-width: 1; }

.joint-card {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  margin-bottom: 8px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
}

.joint-card .joint-svg { max-width: 112px; }
.joint-card-text { font-size: 15px; }
.joint-code { font-weight: 700; font-size: 18px; color: var(--accent); margin-right: 4px; }

/* ---------- Справочник обозначений ---------- */

.guide-card {
  margin-top: 12px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.guide-card h2 { margin: 0 0 8px; font-size: 20px; }
.guide-card ul, .guide-card ol { margin: 6px 0; padding-left: 22px; }
.guide-card li { margin: 4px 0; }
.guide-card code { padding: 1px 6px; background: var(--bg); border-radius: 6px; font-weight: 700; }
.guide-card blockquote { margin: 8px 0 0; padding: 8px 12px; border-left: 4px solid var(--border); color: var(--muted); font-size: 15px; }
.guide-card .values { margin-top: 8px; }
.guide-q { margin: 10px 0 0; font-weight: 700; }
.guide-example { font-size: 18px; overflow-wrap: anywhere; }
.guide-sign-meaning { font-size: 16px; font-weight: 400; }
.sign-symbol { display: inline-block; min-width: 1.6em; color: var(--accent); font-weight: 700; font-size: 20px; }

.guide-svg { width: 100%; height: auto; margin: 4px 0 8px; }
.g-metal { fill: var(--muted); opacity: 0.35; }
.g-seam { stroke: var(--accent); stroke-width: 5; }
.g-line { stroke: var(--text); stroke-width: 1.6; }
.g-arrow { fill: var(--text); }
.g-text { fill: var(--text); font-size: 15px; font-weight: 700; }
.g-muted { fill: var(--muted); font-weight: 400; }
.g-small { font-size: 12px; }

/* ---------- Тренажёр ---------- */

.quiz-stats { margin: 0 0 8px; color: var(--muted); }
.quiz-question { margin: 4px 0 8px; font-size: 20px; font-weight: 700; }
.quiz-show {
  margin: 0 0 12px;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 30px;
  font-weight: 800;
  text-align: center;
  color: var(--accent);
}
.quiz-option-text { font-size: 17px; font-weight: 600; }
.quiz-mark { font-size: 24px; font-weight: 800; }
.quiz-right { border-color: var(--ok); box-shadow: inset 5px 0 0 var(--ok); }
.quiz-right .quiz-mark { color: var(--ok); }
.quiz-wrong { border-color: var(--error); box-shadow: inset 5px 0 0 var(--error); }
.quiz-wrong .quiz-mark { color: var(--error); }
.alert-ok { background: var(--info-bg); border-left: 5px solid var(--ok); margin-top: 12px; }
.quiz-option + .alert, .options + .alert { margin-top: 12px; }

/* ---------- ISO 2553 ---------- */

.guide-h3 { margin: 12px 0 4px; font-size: 17px; }
.iso-system { width: 100%; height: auto; }
.iso-part { fill: var(--muted); opacity: 0.35; }
.iso-weld { fill: var(--accent); }
.iso-ref-line { stroke: var(--text); stroke-width: 1.6; }
.iso-dashed { stroke-dasharray: 8 5; }
.iso-sym { fill: none; stroke: var(--accent); stroke-width: 2.2; }
.iso-fill { fill: var(--text); stroke: none; }
.iso-text { fill: var(--text); font-size: 14px; font-weight: 700; }
.iso-muted { fill: var(--muted); font-weight: 400; font-size: 13px; }

.iso-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.iso-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px;
  background: var(--bg);
  border-radius: 12px;
}

.iso-symbol { width: 64px; height: 61px; }
.iso-ref { stroke: var(--muted); stroke-width: 1.5; }
.iso-shape { fill: none; stroke: var(--accent); stroke-width: 2.2; stroke-linejoin: round; }
.iso-shape .iso-fill { fill: var(--accent); }
.iso-name { font-weight: 700; font-size: 15px; line-height: 1.25; }
.iso-en { color: var(--muted); font-size: 13px; }
.iso-note { color: var(--muted); font-size: 13px; }
.joint-extra { display: block; margin-top: 4px; color: var(--muted); font-size: 13px; }
.joint-note { color: var(--warn-border); }

/* ---------- Вход и пользователи ---------- */

.login-logo { display: flex; flex-direction: column; align-items: center; margin: 16px 0; }
.login-logo img { border-radius: 22px; }
.login-logo h1 { margin: 8px 0 0; font-size: 26px; }
.invite-box p { margin: 6px 0; }
.invite-link {
  width: 100%;
  min-height: 48px;
  margin: 6px 0 0;
  padding: 8px 10px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  font: inherit;
  font-size: 14px;
}
.user-blocked { opacity: 0.6; }

.account {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  margin-top: 20px;
  color: var(--muted);
  font-size: 15px;
}
.account a, .link-button { color: var(--arc); font: inherit; }
.link-button { padding: 0; background: none; border: 0; text-decoration: underline; cursor: pointer; }

/* ---------- Дневник ---------- */

.progress-card { margin-top: 12px; }
.progress-label { margin: 10px 0 4px; color: var(--muted); font-size: 14px; }
.chip-active { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }

.journal-row { position: relative; }
.journal-row .journal-card { padding-right: 60px; }
.journal-delete { position: absolute; top: 50%; right: 8px; transform: translateY(-50%); margin: 0; }
.icon-button {
  width: 44px; height: 44px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); font-size: 20px; cursor: pointer;
}
.icon-button:hover, .icon-button:focus-visible { border-color: #c0392b; }
.journal-card {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  margin-top: 10px;
  padding: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
}

.journal-thumb { width: 84px; height: 84px; object-fit: cover; border-radius: 10px; background: var(--bg); }
.journal-thumb-empty { display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 12px; }
.journal-text { display: flex; flex-direction: column; min-width: 0; }
.journal-date { color: var(--muted); font-size: 14px; }
.journal-topic { font-weight: 700; font-size: 17px; overflow-wrap: anywhere; }
.journal-tags { color: var(--muted); font-size: 14px; }
.journal-links { margin-top: 20px; }

.photo-pick {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 64px;
  margin-top: 8px;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  font-weight: 700;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}
.photo-pick input { position: absolute; left: 0; top: 0; width: 1px; height: 1px; opacity: 0; }
.photo-pick:focus-within { outline: 3px solid var(--arc); }
.photo-preview { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 8px; }
.photo-preview:empty { display: none; }
.photo-preview-item { margin: 0; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.photo-preview-item img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; display: block; }
.photo-preview-item figcaption { font-size: 12px; color: var(--muted, #666); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.photo-preview-nopic { display: flex; align-items: center; justify-content: center; aspect-ratio: 1; padding: 6px; border-radius: 8px;
  border: 1px solid var(--border); font-size: 12px; text-align: center; }
.photo-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.photo-thumb { display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.photo-thumb img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; }
.photo-thumb .check { min-height: 32px; }

.entry-topic { margin: 4px 0 8px; font-size: 22px; }
.photo-gallery { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; }
.photo-gallery img { width: 100%; height: auto; border-radius: 12px; display: block; }
.entry-note { white-space: pre-wrap; }
.print-photos { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.print-photos img { width: 110px; height: 110px; object-fit: cover; border-radius: 6px; }
@media print { .print-entry { break-inside: avoid; } }

/* ---------- Разбор шва ИИ ---------- */

.tips { margin: 6px 0 0; padding-left: 20px; }
.ai-card {
  margin: 12px 0;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 5px solid var(--arc);
  border-radius: var(--radius);
}
.ai-title { margin: 0 0 8px; font-size: 19px; }
.ai-wait { display: flex; align-items: center; gap: 10px; margin: 0; }
.spinner {
  width: 22px;
  height: 22px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } }
.ai-grade { display: inline-block; margin: 0 0 6px; padding: 2px 12px; border-radius: 999px; font-weight: 800; }
.ai-grade-good { background: var(--info-bg); color: var(--ok); }
.ai-grade-warn { background: var(--warn-bg); color: var(--warn-border); }
.ai-grade-bad { background: var(--error-bg); color: var(--error); }
.ai-list { margin: 4px 0; padding-left: 20px; }
.ai-list li { margin: 4px 0; }
.ai-conf { display: block; color: var(--muted); font-size: 13px; }
.ai-more { font-size: 13px; color: var(--arc); }
.ai-disagree summary { cursor: pointer; color: var(--arc); min-height: 44px; display: flex; align-items: center; }

/* ---------- Пачка по фото ---------- */

.scan-box {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 4px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 5px solid var(--arc);
  border-radius: var(--radius);
}
.scan-box p { margin: 0; }
.or-divider { margin: 12px 0; text-align: center; color: var(--muted); }
.field-uncertain { background: var(--warn-bg); border-radius: 10px; box-shadow: 0 0 0 2px var(--warn-border); padding: 4px 8px; }
fieldset.field-uncertain { padding: 12px 14px 14px; }

.offline-note {
  margin: 0 0 12px;
  padding: 10px 14px;
  background: var(--warn-bg);
  border-left: 5px solid var(--warn-border);
  border-radius: 12px;
  font-size: 15px;
}
.defect-code { display: inline-block; min-width: 2.6em; padding: 0 6px; margin-right: 4px; background: var(--bg); border-radius: 6px; color: var(--accent); font-size: 15px; }
.doubt { margin-top: 8px; font-size: 14px; }

/* «Мои режимы» — свои цифры студента, фиолетовые, как ручной ввод: не путать со справочником. */
.my-mode {
  margin-top: 10px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--manual);
  border-radius: 12px;
}
.my-mode-bad { border-left-color: #c0392b; }
.my-mode p { margin: 0 0 4px; }
.my-mode-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.my-mode-rating { font-size: 14px; color: var(--muted); }
.my-mode-bad .my-mode-rating { color: #c0392b; font-weight: 600; }
.my-mode-values { font-size: 18px; font-weight: 700; }
.my-mode-tags { font-size: 14px; color: var(--muted); }
.my-mode-note { white-space: pre-wrap; font-size: 15px; }
.my-modes-block { margin-top: 16px; }

/* Действия после результата: две кнопки рядом, «заново» — ссылкой. */
.actions-title { margin: 16px 0 6px; font-weight: 700; }
.actions-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.actions-row .button { margin: 0; padding-left: 8px; padding-right: 8px; }
.link-center { display: block; text-align: center; margin: 14px auto 4px; min-height: 44px; line-height: 44px; }
.button-manual-outline { background: var(--manual-bg); color: var(--manual); border: 1px dashed var(--manual); }

/* Выбор электрода: группы по марке и поиск. */
.option-group { margin: 14px 0 0; font-size: 17px; color: var(--muted); }
.option-unknown { border-width: 2px; }
.filter-box { display: block; margin-top: 6px; }
.filter-box input {
  width: 100%; min-height: 48px; padding: 8px 12px; font: inherit;
  background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 10px;
}
.filter-box input::placeholder { color: var(--muted); }
.filter-empty { color: var(--muted); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Спрятанное скриптом (поиск, поля не для этого способа) — прятать всегда, даже у элементов с display: flex. */
[hidden] { display: none !important; }
.button-small { min-height: 44px; margin-top: 8px; font-size: 15px; }

/* Шпаргалка по дефектам: карточки раскрываются по нажатию. */
.defect summary { list-style: none; cursor: pointer; display: flex; flex-direction: column; gap: 4px; }
.defect summary::-webkit-details-marker { display: none; }
.defect summary h2 { margin: 0; }
.defect-looks { color: var(--text); }
.defect-more { color: var(--accent); font-weight: 700; font-size: 15px; }
.defect-more::after { content: " ▾"; }
.defect[open] .defect-more { display: none; }
.button-manual-outline { margin-bottom: 12px; }

.card-actions .button { padding: 0 10px; white-space: nowrap; }
/* Длинный заголовок вверху — в одну строку с многоточием. */
.topbar-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
form + .scan-box { margin-top: 16px; }

/* ИИ ещё не подключён — заметно, чтобы пример не приняли за настоящий разбор. */
.mock-banner { border-left-width: 6px; }
.mock-banner .alert-title { font-size: 18px; }
.mock-note { padding: 8px 10px; background: var(--warn-bg); border-radius: 8px; font-weight: 600; }

/* ---------- Меню разделов ----------
   Телефон: нижняя панель с пятью главными разделами (большие кнопки под палец).
   Компьютер и планшет (от 900 px): вертикальная панель слева со всеми разделами. */
.sidenav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex; justify-content: space-around;
  padding: 4px 4px calc(4px + env(safe-area-inset-bottom));
  background: var(--surface); border-top: 1px solid var(--border);
}
.sidenav .sidenav-brand, .sidenav .sidenav-more, .sidenav .sidenav-sep, .sidenav .sidenav-label { display: none; }
.sidenav-item {
  flex: 1 1 0; min-width: 0; min-height: 56px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--muted); text-decoration: none; border-radius: 12px; font-size: 12px; font-weight: 600;
}
.sidenav-item .icon { width: 26px; height: 26px; }
.sidenav-item.is-active { color: var(--accent); background: var(--bg); }
.sidenav-short { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
body.has-nav .page { padding-bottom: calc(var(--gutter) * 2 + 72px + env(safe-area-inset-bottom)); }

@media (min-width: 900px) {
  body.has-nav { padding-left: 240px; }
  body.has-nav .page { padding-bottom: calc(var(--gutter) * 2); }
  .sidenav {
    top: 0; right: auto; width: 240px; flex-direction: column; justify-content: flex-start; gap: 2px;
    padding: 12px 10px; border-top: 0; border-right: 1px solid var(--border); overflow-y: auto;
  }
  .sidenav .sidenav-brand {
    display: block; padding: 8px 12px 14px; font-weight: 800; font-size: 20px; color: var(--text); text-decoration: none;
  }
  .sidenav .sidenav-label { display: inline; }
  .sidenav .sidenav-short { display: none; }
  .sidenav .sidenav-sep { display: block; height: 1px; margin: 8px 6px; background: var(--border); }
  .sidenav-item {
    flex: 0 0 auto; flex-direction: row; justify-content: flex-start; gap: 12px;
    min-height: 48px; padding: 0 12px; font-size: 16px; color: var(--text);
  }
  .sidenav-item:hover { background: var(--bg); }
  .sidenav-item.is-active { color: var(--accent); background: var(--bg); box-shadow: inset 3px 0 0 var(--accent); }
  .sidenav-item .icon { width: 24px; height: 24px; color: var(--accent); flex-shrink: 0; }
  .sidenav .sidenav-more { display: flex; }
  /* Название уже есть в панели — на главной не повторяем. */
  body.has-nav .brand { visibility: hidden; }
}
@media print { .sidenav { display: none; } body.has-nav { padding-left: 0; } }

/* Цифры из справочника рядом с разбором ИИ — отдельной заметной плашкой. */
.ref-numbers { margin: 12px 0; padding: 12px 14px; border: 2px solid var(--accent); border-radius: 12px; background: var(--bg); }
.ref-numbers-empty { border-style: dashed; }
.ref-numbers-title { margin: 0 0 4px; font-weight: 800; font-size: 17px; }
.ref-numbers-hint { margin: 0 0 6px; color: var(--muted); font-size: 14px; }
.ref-numbers-hint-strong { padding: 8px 10px; border-radius: 8px; background: var(--bg); border: 1px dashed var(--accent); color: var(--text); }

/* Справочник для мастера: оглавление и поиск сверху; якоря не прячутся под шапкой. */
.ref-toc { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
[id] { scroll-margin-top: 72px; }
.to-top {
  position: fixed; right: 16px; bottom: calc(84px + env(safe-area-inset-bottom)); z-index: 15;
  width: 48px; height: 48px; display: flex; align-items: center; justify-content: center;
  border-radius: 50%; background: var(--accent); color: var(--accent-text); font-size: 24px; font-weight: 800;
  text-decoration: none; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}
@media (min-width: 900px) { .to-top { bottom: 24px; } .sidenav { overflow-x: hidden; } }
@media print { .to-top { display: none; } }

/* Документы: поиск и выдержки. */
.docs-search { display: flex; gap: 8px; margin: 10px 0; }
.docs-search input {
  flex: 1; min-width: 0; min-height: 48px; padding: 8px 12px; font: inherit;
  background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 10px;
}
.docs-search .button { margin: 0; flex-shrink: 0; }
.docs-kinds { margin-bottom: 8px; }
.docs-group h3 a { color: inherit; }
.docs-hit { display: flex; flex-direction: column; gap: 2px; padding: 8px 0; border-top: 1px solid var(--border); color: var(--text); text-decoration: none; }
.docs-hit-title { font-weight: 700; }
.docs-hit-text { color: var(--muted); font-size: 15px; }
.docs-more summary { cursor: pointer; padding: 8px 0; color: var(--accent); font-weight: 700; }
.docs-excerpt p { white-space: pre-wrap; overflow-wrap: anywhere; }
.docs-excerpt-hit { border-color: var(--accent); }
.doc-title { margin: 4px 0 8px; font-size: 19px; overflow-wrap: anywhere; }
mark { background: #ffe08a; color: #14161a; border-radius: 3px; padding: 0 2px; }

/* Шпаргалка «Швы на чертежах». */
.steps { padding-left: 22px; }
.steps li { margin-bottom: 6px; }
.letters-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.letter-card {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px;
  border: 1px solid var(--border); border-radius: 12px; color: var(--text); text-decoration: none; text-align: center;
}
.letter-card .joint-svg { max-width: 120px; }
.letter-code { font-size: 26px; font-weight: 800; color: var(--accent); line-height: 1; }
.letter-title { font-size: 14px; }
.signs-table { display: flex; flex-direction: column; }
.sign-row { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 10px; align-items: center; padding: 8px 0; border-top: 1px solid var(--border); }
.sign-row:first-child { border-top: 0; }
.sign-symbol { font-size: 24px; text-align: center; color: var(--accent); font-weight: 700; }
.sign-where { color: var(--muted); font-size: 14px; }
.example-card {
  display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; padding: 12px 14px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); text-decoration: none;
}
.example-text { font-family: ui-monospace, Consolas, monospace; font-size: 18px; font-weight: 700; overflow-wrap: anywhere; }
.example-body { display: grid; grid-template-columns: 100px minmax(0, 1fr); gap: 10px; align-items: center; }
.example-body .joint-svg { max-width: 100px; }
.example-parts { display: flex; flex-direction: column; gap: 3px; font-size: 15px; }
.example-more { color: var(--accent); font-weight: 700; font-size: 15px; }

/* Открытый раздел в меню — заметно: залит оранжевым, текст и значок белые. */
.sidenav .sidenav-item.is-active { background: var(--accent); color: var(--accent-text); box-shadow: none; font-weight: 800; }
.sidenav .sidenav-item.is-active .icon { color: var(--accent-text); }
@media (min-width: 900px) {
  .sidenav .sidenav-item.is-active:hover { background: var(--accent); }
}
@media (max-width: 899px) {
  .sidenav .sidenav-item.is-active-mobile { background: var(--accent); color: var(--accent-text); font-weight: 800; }
}

/* Панель разделов на длинных страницах — закреплена под шапкой, не уезжает при прокрутке. */
.sticky-bar {
  position: sticky; top: calc(var(--tap) + 1px + env(safe-area-inset-top)); z-index: 9;
  margin: 0 calc(-1 * var(--gutter)) 12px; padding: 8px var(--gutter);
  background: var(--bg); border-bottom: 1px solid var(--border);
}
.sticky-bar .ref-toc, nav.sticky-bar { margin-top: 0; }
.sticky-bar .filter-box { margin-top: 8px; }
.sticky-bar .chip.chip-active { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
/* Якорь не прячется под шапкой и закреплённой панелью (высоту панели подставляет скрипт). */
[id] { scroll-margin-top: calc(72px + var(--sticky-h, 0px)); }
/* На телефоне — одна строка с прокруткой вбок, чтобы панель не занимала пол-экрана. */
@media (max-width: 899px) {
  .sticky-bar .ref-toc, nav.sticky-bar {
    flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch;
  }
  .sticky-bar .ref-toc::-webkit-scrollbar, nav.sticky-bar::-webkit-scrollbar { display: none; }
  .sticky-bar .chip { flex-shrink: 0; white-space: nowrap; }
}
@media print { .sticky-bar { position: static; } }

/* Схемы дефектов: металл серый, шов оранжевый, дефект красный. */
.defect-pic { display: block; margin: 6px 0 4px; }
.defect-svg { width: 100%; max-width: 420px; height: auto; display: block; }
.d-metal { fill: var(--muted); opacity: 0.4; stroke: var(--text); stroke-width: 1; }
.d-weld { fill: var(--accent); opacity: 0.85; }
.d-def { fill: #c0392b; }
.d-hole { fill: var(--surface); stroke: #c0392b; stroke-width: 1.5; }
.d-crack { fill: none; stroke: #c0392b; stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.d-slag { fill: #4b3f36; stroke: #c0392b; stroke-width: 1.5; }
.d-outline { fill: none; stroke: #c0392b; stroke-width: 1.5; stroke-dasharray: 4 3; }
.d-ripple { fill: none; stroke: var(--surface); stroke-width: 1.4; opacity: 0.8; }
.d-arrow { stroke: var(--text); stroke-width: 1.2; }
.d-dot { fill: var(--text); }
.d-label { fill: var(--text); font-size: 13px; font-weight: 700; }
.d-cap { fill: var(--muted); font-size: 11px; }
.defect-pic-small .defect-svg { max-width: 260px; }

/* Меню: пункты внутри «Справочника» и «Моего» — только на компьютере, на телефоне их открывают из раздела. */
.sidenav .sidenav-sub { display: none; }
@media (min-width: 900px) {
  .sidenav .sidenav-sub {
    display: block; margin: 0 0 0 46px; padding: 6px 10px; border-radius: 8px;
    color: var(--muted); font-size: 15px; text-decoration: none;
  }
  .sidenav .sidenav-sub:hover { background: var(--bg); color: var(--text); }
  .sidenav .sidenav-sub.is-current { color: var(--accent); font-weight: 800; background: var(--bg); }
  .sidenav .sidenav-main + .sidenav-sub { margin-top: 2px; }
}
/* Списки в разделах «Справочник» и «Моё»: значок слева, число записей. */
.list .list-item.list-item-icon { display: flex; flex-direction: row; align-items: center; justify-content: flex-start; gap: 12px; text-align: left; }
.list-item-icon > .icon { width: 28px; height: 28px; flex-shrink: 0; color: var(--accent); }
.list-item-icon > span { display: flex; flex-direction: column; min-width: 0; }
.list-count { display: inline-block; min-width: 24px; padding: 0 7px; border-radius: 12px; background: var(--bg);
  color: var(--muted); font-size: 14px; font-weight: 700; text-align: center; }
.logout-form { margin-top: 16px; }
/* Вложенные пункты меню — с линией слева: видно, что они входят в раздел над ними. */
@media (min-width: 900px) {
  .sidenav .sidenav-sub { margin-left: 23px; padding-left: 22px; border-left: 2px solid var(--border); border-radius: 0 8px 8px 0; }
  .sidenav .sidenav-sub.is-current { border-left-color: var(--accent); }
}

/* Аналоги электродов. */
.analog-group h3 { font-size: 17px; }
.ref-analogs { display: inline-block; margin: 0 0 6px; font-size: 15px; }
.analog-list { list-style: none; margin: 6px 0 0; padding: 0; }
.analog-item { display: flex; flex-direction: column; gap: 2px; padding: 8px 6px; border-top: 1px solid var(--border); }
.analog-name { color: var(--text); }
.analog-facts { color: var(--muted); font-size: 14px; }
.analog-item.analog-current { background: var(--manual-bg); border-radius: 8px; }

/* Мой аппарат: ток делениями шкалы; аттестации. */
.machine-hint { margin: 12px 0; padding: 12px 14px; border-radius: 12px; background: var(--surface); border: 2px solid var(--accent); }
.machine-hint-title { margin: 0; font-weight: 800; }
.machine-hint-value { margin: 4px 0; font-size: 22px; font-weight: 800; color: var(--accent); }
.cert-reminder { display: block; text-decoration: none; color: inherit; font-weight: 700; }
.cert-expired { border-color: var(--error); }
.cert-soon { border-color: var(--warn-border); }
.cert-status { font-weight: 700; }

/* Меню 3: на телефоне внизу Главная · Режимы · Чертёж · Шов · Меню; на компьютере «Меню» не нужно — всё видно слева.
   Подсветка: is-active-m — для нижней панели, is-active-d — для левого меню. */
@media (max-width: 899px) {
  .sidenav .sidenav-item.only-desktop { display: none; }
  .sidenav .sidenav-item.is-active-m { background: var(--accent); color: var(--accent-text); font-weight: 800; }
}
@media (min-width: 900px) {
  .sidenav .sidenav-item.only-mobile { display: none; }
  .sidenav .sidenav-item.is-active-d { background: var(--accent); color: var(--accent-text); font-weight: 800; }
  .sidenav .sidenav-item.is-active-d .icon { color: var(--accent-text); }
}
/* Главная. */
.home-search { margin: 0 0 12px; }
.ref-h-link { font-size: 15px; font-weight: 600; margin-left: 8px; }
.my-mode-link { display: block; text-decoration: none; color: var(--text); }
.my-mode-link .my-mode-values, .my-mode-link .my-mode-tags { display: block; }
.quick { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.quick-link {
  display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 8px 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; color: var(--text);
  text-decoration: none; font-weight: 600; font-size: 15px;
}
.quick-link .icon { width: 24px; height: 24px; color: var(--accent); flex-shrink: 0; }
@media (min-width: 700px) { .quick { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.menu-user { margin-top: 16px; }
.home-account { margin-top: 18px; color: var(--muted); font-size: 15px; }

/* Расчёты. */
.calc-total { margin: 0 0 6px; font-size: 24px; color: var(--accent); }
.weight-items { margin: 0; padding-left: 20px; }
.weight-items li { padding: 8px 0; border-top: 1px solid var(--border); }
.weight-items li { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 8px; align-items: center; }
.weight-item-text { display: flex; flex-direction: column; min-width: 0; }
.weight-item-kg { font-weight: 800; white-space: nowrap; }
.weight-remove { width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; text-decoration: none; color: var(--muted); }
.calc-groups summary { cursor: pointer; }

/* Почему так получается. */
.trouble-causes li { margin-bottom: 6px; }
.trouble-check { display: block; margin-top: 2px; }

/* ---------- «Как варить…» ---------- */
.howto-modes { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.howto-modes .button { margin-top: 0; flex: 1 1 auto; padding: 8px 16px; text-align: center; line-height: 1.25; }
.howto-ref { font-size: 13px; font-weight: 600; color: var(--muted); text-decoration: none; white-space: nowrap; }
.howto-sources li { font-size: 15px; scroll-margin-top: 72px; }
.howto-sources li:target { background: var(--warn-bg); }

/* ---------- Смета работ ---------- */
.est-row { padding: 10px 0; border-bottom: 1px solid var(--border); }
.est-row-top { display: grid; grid-template-columns: minmax(0, 7.5em) minmax(0, 1fr); gap: 6px; }
.est-row-nums { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.2fr); gap: 6px; margin-top: 6px; }
.est-row select, .est-row input { min-height: 44px; padding: 6px 8px; min-width: 0; width: 100%; }
.est-sum { grid-column: 1 / -1; text-align: right; color: var(--muted); font-size: 15px; min-height: 1em; }
.est-total { font-size: 20px; margin: 8px 0; }
.est-sub { text-align: right; margin: 6px 0 0; }
.est-text { width: 100%; font: inherit; font-size: 15px; }
.est-list { margin-top: 12px; }
.est-table th, .est-table td { white-space: normal; padding-left: 4px; padding-right: 4px; }
.est-table td:not(:first-child), .est-table th:not(:first-child) { white-space: nowrap; text-align: right; }
.est-summary p { margin: 4px 0; }

/* ---------- Затемнение маски ---------- */
.shade-result { display: flex; align-items: center; gap: 14px; margin: 12px 0; padding: 12px 16px; background: var(--info-bg); border-left: 5px solid var(--arc); border-radius: 12px; }
.shade-num { font-size: 44px; font-weight: 800; line-height: 1; }
.shade-h { margin: 14px 0 6px; font-size: 17px; }
.shade-sub { margin: 8px 0 4px; color: var(--muted); }
.shade-steps { display: flex; flex-wrap: wrap; gap: 6px; }
.shade-step { display: inline-flex; flex-direction: column; align-items: center; min-width: 58px; padding: 4px 8px; border: 1px solid var(--border); border-radius: 8px; font-size: 13px; color: var(--muted); }
.shade-step b { font-size: 18px; color: var(--text, inherit); }
.mode-shade { margin: 8px 0; }
.list > .empty { margin: 0; padding: 14px 16px; }

/* Левое меню: пункты раздела разворачиваются. На телефоне обёртки не мешают нижней панели. */
.sidenav-group, .sidenav-row { display: contents; }
.sidenav-chevron, .sidenav-children { display: none; }
@media (min-width: 900px) {
  .sidenav-group { display: block; }
  .sidenav-row { display: flex; align-items: center; gap: 2px; }
  .sidenav-row .sidenav-item { flex: 1 1 auto; min-width: 0; }
  .sidenav .sidenav-chevron { display: block; margin-left: auto; flex-shrink: 0; transition: transform .15s; transform: rotate(-90deg); }
  .sidenav-group.is-open .sidenav-chevron { transform: none; }
  .sidenav-group.is-open .sidenav-children { display: block; margin: 2px 0 6px; }
}

/* ---------- Разбор по фото: на проверке, прогресс ---------- */
.checks-box { margin: 0 0 14px; padding: 12px 14px; border-radius: 12px; background: var(--info-bg); border-left: 5px solid var(--arc); }
.checks-title { margin: 0 0 8px; font-weight: 800; }
.check-row { display: block; padding: 8px 0; border-top: 1px solid var(--border); color: inherit; text-decoration: none; }
.check-row:first-of-type { border-top: 0; }
.check-row-solo { border-top: 0; padding: 4px 0 0; }
.check-name { display: block; font-weight: 700; margin-bottom: 4px; }
.progress { display: block; height: 10px; border-radius: 5px; background: var(--border); overflow: hidden; }
.progress-bar { display: block; height: 100%; background: var(--accent); transition: width .5s; }
.progress-text { display: block; margin-top: 4px; font-size: 15px; color: var(--muted); }
.progress-text b { color: var(--text, inherit); }

.recent-checks { display: flex; flex-direction: column; gap: 8px; }
.recent-progress { display: block; width: 100%; }
.recent-checks .journal-text { flex: 1 1 auto; min-width: 0; }
.journal-card.is-current-check { box-shadow: inset 4px 0 0 var(--accent); }

/* Кнопки «Снять камерой» / «Из галереи» */
.photo-buttons { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; margin-top: 8px; }
.photo-pick-btn { margin-top: 0; width: 100%; background: var(--surface); color: var(--text, inherit); font: inherit; font-weight: 700; }
.photo-preview-item { position: relative; }
.photo-preview-del { position: absolute; top: 4px; right: 4px; width: 32px; height: 32px; border: 0; border-radius: 50%;
  background: rgba(0, 0, 0, .6); color: #fff; font-size: 16px; line-height: 32px; cursor: pointer; }
.photo-count:empty { display: none; }

/* ---------- Беларусь: пометки и выбор страны ---------- */
.country-note { margin: 0 0 14px; padding: 12px 14px; border-radius: 12px; background: var(--info-bg); border-left: 5px solid #4aa564; }
.country-note-title { margin: 0 0 6px; font-weight: 800; }
.country-note ul { margin: 0; padding-left: 20px; }
.country-note li { margin: 4px 0; }
.country-switch { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 14px; }
.country-switch-label { width: 100%; color: var(--muted); font-size: 15px; }
.country-switch .chip { cursor: pointer; font: inherit; }

.by-hint { display: block; margin: 4px 0 2px; padding: 4px 8px; border-left: 3px solid #4aa564; background: var(--info-bg); border-radius: 0 6px 6px 0; font-size: 14px; }
