/* ГеоШаг — стили интерфейса.
   Палитра полевого журнала: бумага, тушь, красная шашка нивелирной рейки, коричневый рельеф. */

:root {
  --bg: #eef1ec;
  --paper: #ffffff;
  --ink: #15191c;
  --ink-2: #4e575e;
  --ink-3: #7a838a;
  --line: #d3dad2;
  --line-2: #b9c3b7;
  --grid: #e4eae1;
  --grid-2: #d4ddd0;
  --rod: #d5231b;
  --relief: #9a4e1c;
  --focus: #1f5fd1;
  --ok: #1b7a43;
  --ok-bg: #e3f2e8;
  --warn: #975a00;
  --warn-bg: #fcefd6;
  --err: #b3122a;
  --err-bg: #fbe5e8;
  --info: #245db8;
  --info-bg: #e6edf9;
  --btn: #15191c;
  --btn-text: #ffffff;
  --bar-bg: #15191c;
  --bar-text: #ffffff;
  --bar-text-2: #b7c0bb;
  --scrim: rgba(12, 15, 17, 0.5);
  --plan-paper: #ffffff;
  --font-ui: 'Fira Sans Condensed', 'Roboto Condensed', 'Arial Narrow', system-ui, -apple-system, sans-serif;
  --font-display: 'Tektur', 'Fira Sans Condensed', 'Arial Narrow', system-ui, sans-serif;
  --r-card: 12px;
  --r-ctl: 8px;
  --r-btn: 10px;
  --gutter: 16px;
  --maxw: 720px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #111416;
    --paper: #1a1f22;
    --ink: #e9edea;
    --ink-2: #aeb7b3;
    --ink-3: #85908b;
    --line: #2c3438;
    --line-2: #3c464b;
    --grid: #1f262a;
    --grid-2: #29323a;
    --rod: #f0483c;
    --relief: #db9463;
    --focus: #7ea6f5;
    --ok: #5cc98a;
    --ok-bg: #16301f;
    --warn: #f0b454;
    --warn-bg: #33270f;
    --err: #ff7a8a;
    --err-bg: #3a1519;
    --info: #8fb3f5;
    --info-bg: #172440;
    --btn: #e9edea;
    --btn-text: #111416;
    --bar-bg: #0b0e10;
    --bar-text: #e9edea;
    --bar-text-2: #8f9994;
    --scrim: rgba(0, 0, 0, 0.62);
    color-scheme: dark;
  }
}
:root[data-theme='dark'] {
  --bg: #111416;
  --paper: #1a1f22;
  --ink: #e9edea;
  --ink-2: #aeb7b3;
  --ink-3: #85908b;
  --line: #2c3438;
  --line-2: #3c464b;
  --grid: #1f262a;
  --grid-2: #29323a;
  --rod: #f0483c;
  --relief: #db9463;
  --focus: #7ea6f5;
  --ok: #5cc98a;
  --ok-bg: #16301f;
  --warn: #f0b454;
  --warn-bg: #33270f;
  --err: #ff7a8a;
  --err-bg: #3a1519;
  --info: #8fb3f5;
  --info-bg: #172440;
  --btn: #e9edea;
  --btn-text: #111416;
  --bar-bg: #0b0e10;
  --bar-text: #e9edea;
  --bar-text-2: #8f9994;
  --scrim: rgba(0, 0, 0, 0.62);
  color-scheme: dark;
}

/* ——— Основа ——— */
*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: var(--bg);
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 17px;
  line-height: 1.42;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: contain;
  min-height: 100vh;
  min-height: 100dvh;
}
body.has-bar {
  padding-bottom: calc(84px + env(safe-area-inset-bottom, 0px));
}
[hidden] {
  display: none !important;
}
a {
  color: inherit;
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
}
img,
svg {
  max-width: 100%;
}
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}
h1,
h2,
h3 {
  text-wrap: balance;
}
.muted {
  color: var(--ink-3);
}
.center {
  text-align: center;
  justify-self: center;
  align-self: center;
}
.lead {
  margin: 0;
  color: var(--ink-2);
  max-width: 62ch;
}
.big {
  font-size: 20px;
  font-weight: 600;
  overflow-wrap: anywhere;
}
.h2 {
  font-size: 20px;
  margin: 8px 0 0;
}
.h3 {
  font-size: 17px;
  font-weight: 700;
  margin: 0 0 6px;
}
.ico {
  flex: none;
  vertical-align: -0.2em;
}

/* ——— Каркас ——— */
#app {
  min-height: 100vh;
}
.appbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 56px;
  padding: env(safe-area-inset-top, 0px) max(8px, env(safe-area-inset-right, 0px)) 0 max(8px, env(safe-area-inset-left, 0px));
  background: var(--bar-bg);
  color: var(--bar-text);
}
.demo .appbar {
  top: env(safe-area-inset-top, 0px);
  padding-top: 0;
}
.appbar .icon-btn {
  color: var(--bar-text);
}
.appbar-logo {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
}
.appbar-title {
  flex: 1;
  min-width: 0;
  padding: 6px 0;
}
.appbar h1 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 19px;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.appbar-sub {
  font-size: 13px;
  color: var(--bar-text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.appbar-actions {
  display: flex;
  align-items: center;
}
.appbar .btn-text {
  color: var(--bar-text);
}
#view {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 16px var(--gutter) 28px;
  outline: none;
}
.stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.grid2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 12px;
  align-items: end;
}
.grid3 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 12px;
  align-items: end;
}
.grid3.name-first > :first-child {
  grid-column: 1 / -1;
}
@media (min-width: 560px) {
  .grid3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .grid3.name-first > :first-child {
    grid-column: auto;
  }
}
@media (max-width: 340px) {
  .grid2 {
    grid-template-columns: 1fr;
  }
}
.bottombar:empty {
  display: none;
}
.bottombar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 25;
  background: var(--paper);
  border-top: 1px solid var(--line);
  padding: 10px var(--gutter) calc(10px + env(safe-area-inset-bottom, 0px));
}
.bar-row {
  display: flex;
  gap: 10px;
  max-width: calc(var(--maxw) - 2 * var(--gutter));
  margin: 0 auto;
  align-items: center;
}
.bar-row > span:empty {
  display: none;
}

/* ——— Кнопки ——— */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 18px;
  border-radius: var(--r-btn);
  border: 1.5px solid transparent;
  font-size: 17px;
  font-weight: 600;
  text-decoration: none;
  line-height: 1.15;
  text-align: center;
  transition: background 0.15s, transform 0.08s;
  -webkit-user-select: none;
  user-select: none;
}
.btn:active {
  transform: translateY(1px);
}
.btn[disabled] {
  opacity: 0.5;
  pointer-events: none;
}
.btn-primary {
  background: var(--btn);
  color: var(--btn-text);
}
.btn-ghost {
  background: var(--paper);
  border-color: var(--line-2);
  color: var(--ink);
}
.btn-danger,
.btn-ghost.danger {
  color: var(--err);
}
.btn-danger {
  background: var(--err);
  color: #fff;
}
.btn-wide {
  flex: 1;
  width: 100%;
}
.bar-row .btn {
  flex: none;
}
.bar-row .btn-wide {
  flex: 1;
}
.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--ink);
  text-decoration: none;
  font-size: 18px;
}
.icon-btn[disabled] {
  opacity: 0.3;
}
.btn-text {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0;
  background: none;
  padding: 10px 6px;
  color: var(--ink-2);
  font-weight: 600;
  font-size: 15px;
}
.row-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.row-btns .btn {
  flex: 1 1 auto;
}

/* ——— Карточки и сообщения ——— */
.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  padding: 14px;
}
.card > h2:first-child,
.card > h3:first-child {
  margin-top: 0;
}
.form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.msg {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  padding: 10px 12px;
  border-radius: var(--r-ctl);
  border-left: 4px solid var(--info);
  background: var(--info-bg);
  font-size: 15px;
  line-height: 1.35;
}
.msg .ico {
  margin-top: 1px;
}
.msg-ok {
  border-color: var(--ok);
  background: var(--ok-bg);
}
.msg-warn {
  border-color: var(--warn);
  background: var(--warn-bg);
}
.msg-error {
  border-color: var(--err);
  background: var(--err-bg);
}
.note-card {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 15px;
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  vertical-align: middle;
}
.badge-ok {
  color: var(--ok);
  background: var(--ok-bg);
}
.badge-err {
  color: var(--err);
  background: var(--err-bg);
}
.badge-muted {
  color: var(--ink-3);
  background: var(--grid);
}
.issues {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.issue {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  font-size: 15px;
  padding: 9px 10px;
  border-radius: var(--r-ctl);
  background: var(--info-bg);
}
.issue .ico {
  margin-top: 1px;
}
.issue-error {
  background: var(--err-bg);
}
.issue-error .ico {
  color: var(--err);
}
.issue-warn {
  background: var(--warn-bg);
}
.issue-warn .ico {
  color: var(--warn);
}
.issue-hint {
  background: var(--grid);
}
.issue-hint .ico {
  color: var(--rod);
}
.norm {
  display: inline-block;
  font-size: 12px;
  color: var(--ink-3);
  white-space: nowrap;
}
.issues-card summary {
  display: flex;
  gap: 8px;
  align-items: center;
  cursor: pointer;
  font-weight: 600;
  list-style: none;
}
.issues-card summary::-webkit-details-marker {
  display: none;
}
.hint-small {
  font-size: 14px;
  color: var(--ink-2);
  margin: 4px 0 0;
}

/* Подсказки «как выполнить» */
details.tips {
  background: var(--paper);
  border: 1px dashed var(--line-2);
  border-radius: var(--r-card);
  padding: 0 14px;
}
details.tips summary {
  display: flex;
  gap: 8px;
  align-items: center;
  min-height: 48px;
  cursor: pointer;
  font-weight: 600;
  color: var(--ink-2);
  list-style: none;
}
details.tips summary::-webkit-details-marker {
  display: none;
}
details.tips summary::after {
  content: '+';
  margin-left: auto;
  font-size: 22px;
  color: var(--ink-3);
}
details.tips[open] summary::after {
  content: '−';
}
details.tips ol {
  margin: 0 0 14px;
  padding-left: 22px;
  font-size: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
details.tips p {
  font-size: 16px;
  margin: 0 0 14px;
}
.tip-extra {
  border-top: 1px solid var(--line);
  padding-top: 10px;
}
details.how {
  font-size: 15px;
}
details.how summary {
  cursor: pointer;
  color: var(--ink-2);
  font-weight: 600;
  padding: 8px 0;
}

/* ——— «Дальше» и прогресс ——— */
.next-card {
  position: relative;
  display: block;
  text-decoration: none;
  color: var(--ink);
  border: 1.5px solid var(--ink);
  border-radius: var(--r-card);
  padding: 14px 52px 16px 26px;
  background-color: var(--paper);
  background-image: linear-gradient(var(--grid-2) 1px, transparent 1px), linear-gradient(90deg, var(--grid-2) 1px, transparent 1px),
    linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 40px 40px, 40px 40px, 8px 8px, 8px 8px;
  background-position: -1px -1px;
  overflow: hidden;
}
.next-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 12px;
  background: repeating-linear-gradient(to bottom, var(--rod) 0 14px, var(--paper) 14px 28px);
  border-right: 1.5px solid var(--ink);
}
.next-card.next-err::before {
  background: repeating-linear-gradient(to bottom, var(--err) 0 7px, var(--paper) 7px 14px);
}
.next-card.next-done::before {
  background: var(--ok);
}
.next-k {
  font-size: 14px;
  font-weight: 700;
  color: var(--rod);
}
.next-err .next-k {
  color: var(--err);
}
.next-done .next-k {
  color: var(--ok);
}
.next-t {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 22px;
  line-height: 1.15;
  margin: 2px 0 6px;
}
.next-x {
  font-size: 15px;
  color: var(--ink-2);
}
.next-go {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--btn);
  color: var(--btn-text);
}
.rod {
  display: flex;
  align-items: center;
  gap: 10px;
}
.rod-bar {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  border: 1.5px solid var(--ink);
  border-radius: 3px;
  overflow: hidden;
  height: 14px;
  background: var(--paper);
}
.rod-c + .rod-c {
  border-left: 1px solid var(--line-2);
}
.rod-c.on-r {
  background: var(--rod);
}
.rod-c.on-b {
  background: var(--ink);
}
.rod-pct {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 15px;
  min-width: 3.2em;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Этапы работы */
.stages {
  list-style: none;
  margin: 0;
  padding: 0;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  overflow: hidden;
}
.stage + .stage {
  border-top: 1px solid var(--line);
}
.stage > a {
  display: grid;
  grid-template-columns: 26px 1fr auto;
  grid-template-rows: auto auto;
  column-gap: 12px;
  align-items: center;
  padding: 12px 14px;
  text-decoration: none;
  color: inherit;
  min-height: 56px;
}
.stage-mark {
  grid-row: span 2;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid var(--line-2);
  color: var(--btn-text);
}
.stage.done .stage-mark {
  background: var(--ink);
  border-color: var(--ink);
}
.stage.current .stage-mark {
  border-color: var(--rod);
  box-shadow: inset 0 0 0 4px var(--paper), inset 0 0 0 12px var(--rod);
}
.stage.current {
  background: var(--grid);
}
.stage-t {
  font-weight: 600;
}
.stage-d {
  grid-column: 2;
  font-size: 14px;
  color: var(--ink-2);
}
.stage-go {
  grid-column: 3;
  grid-row: 1 / span 2;
  color: var(--ink-3);
}
.st-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 14px 12px 52px;
}
.st-chip {
  display: inline-grid;
  place-items: center;
  min-width: 44px;
  height: 34px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1.5px solid var(--line-2);
  text-decoration: none;
  font-weight: 600;
  font-size: 15px;
  background: var(--paper);
}
.st-chip.ok {
  background: var(--ok-bg);
  border-color: var(--ok);
  color: var(--ok);
}
.st-chip.part {
  background: var(--warn-bg);
  border-color: var(--warn);
}
.st-chip.bad {
  background: var(--err-bg);
  border-color: var(--err);
  color: var(--err);
}

/* ——— Поля ввода ——— */
.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}
.lbl {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-2);
  line-height: 1.25;
}
.field > input:not([type='checkbox']):not([type='radio']),
.field > select,
.field > textarea,
.num-wrap > input,
.form > input,
.search input {
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  border: 1.5px solid var(--line-2);
  border-radius: var(--r-ctl);
  background: var(--paper);
  font-size: 18px;
  outline: none;
}
.field textarea {
  min-height: 90px;
  resize: vertical;
}
.field > input:focus,
.field > select:focus,
.field > textarea:focus,
.num-wrap > input:focus,
.form > input:focus {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 30%, transparent);
}
.field select {
  appearance: none;
  -webkit-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-2) 50%), linear-gradient(135deg, var(--ink-2) 50%, transparent 50%);
  background-position: calc(100% - 20px) 21px, calc(100% - 14px) 21px;
  background-size: 6px 6px;
  background-repeat: no-repeat;
  padding-right: 36px;
}
input.invalid,
.ang.invalid {
  border-color: var(--err) !important;
  background: var(--err-bg) !important;
}
input.recognized,
.ang.recognized {
  background: var(--info-bg) !important;
  border-color: var(--info) !important;
}
.num-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.num-wrap .num {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}
.num-wrap .unit {
  position: absolute;
  right: 12px;
  color: var(--ink-3);
  pointer-events: none;
  font-size: 15px;
}
.num-wrap .cam {
  margin-left: 6px;
}
.field.compact input.num {
  min-height: 44px;
  font-size: 17px;
}
.field-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}
.field-row .field {
  flex: 1;
}

/* Угол: градусы · минуты · секунды */
.ang {
  display: flex;
  align-items: center;
  min-height: 52px;
  padding: 0 4px 0 8px;
  border: 1.5px solid var(--line-2);
  border-radius: var(--r-ctl);
  background: var(--paper);
  font-variant-numeric: tabular-nums;
  transition: background 0.3s, border-color 0.3s;
}
.ang:focus-within {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 30%, transparent);
}
.ang input {
  flex: none;
  min-width: 0;
  border: 0 !important;
  outline: none;
  background: transparent !important;
  box-shadow: none !important;
  padding: 8px 0 !important;
  min-height: 0 !important;
  font-size: 22px !important;
  font-weight: 600;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.ang .ang-d {
  width: 3.1ch;
}
.ang .ang-m {
  width: 2.3ch;
}
.ang[data-fmt='dm'] .ang-m {
  width: 3.7ch;
}
.ang .ang-s {
  width: 2.3ch;
}
.ang.signed .ang-d {
  width: 2.2ch;
}
.grid2 .ang {
  padding-left: 6px;
}
.grid2 .ang input {
  font-size: 19px !important;
}
.grid2 .ang .u {
  font-size: 17px;
  margin-top: 8px;
  padding-right: 2px;
}
.grid2 .cam {
  width: 36px;
  height: 36px;
}
.ang .u {
  font-size: 20px;
  color: var(--ink-3);
  padding: 0 3px 0 1px;
  align-self: flex-start;
  margin-top: 9px;
}
.ang input::placeholder,
.num::placeholder {
  color: var(--line-2);
}
.ang-sign {
  flex: none;
  width: 26px;
  height: 36px;
  border: 0;
  border-radius: 6px;
  background: var(--grid);
  font-size: 20px;
  font-weight: 700;
  margin-right: 4px;
}
.ang.neg .ang-sign {
  background: var(--ink);
  color: var(--btn-text);
}
.cam {
  margin-left: auto;
  display: grid;
  place-items: center;
  flex: none;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 8px;
  background: var(--grid);
  color: var(--ink);
}
.field-angle.compact .ang {
  min-height: 46px;
}
.field-angle.compact .ang input {
  font-size: 19px !important;
}

/* Переключатели */
.seg {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.seg-i {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  min-height: 44px;
  padding: 6px 14px;
  border: 1.5px solid var(--line-2);
  border-radius: 999px;
  background: var(--paper);
  font-weight: 600;
  font-size: 16px;
  cursor: pointer;
  line-height: 1.2;
}
.seg-i input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.seg-i small {
  font-weight: 400;
  font-size: 13px;
  color: var(--ink-2);
}
.seg-i.on {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--btn-text);
}
.seg-i.on small {
  color: inherit;
  opacity: 0.8;
}
.seg-i:has(input:focus-visible) {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}
.seg-v {
  flex-direction: column;
}
.seg-v .seg-i {
  border-radius: var(--r-ctl);
  padding: 10px 14px;
}
.seg.codes {
  flex-wrap: nowrap;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: thin;
}
.seg.codes .seg-i {
  flex: none;
  font-size: 15px;
  min-height: 40px;
}
.map-pick .seg-i {
  flex: 1;
  border-radius: var(--r-ctl);
  text-align: center;
}
.check {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  cursor: pointer;
  font-size: 16px;
  min-height: 32px;
}
.check input {
  flex: none;
  width: 22px;
  height: 22px;
  margin: 1px 0 0;
  accent-color: var(--ink);
}
.consent {
  font-size: 14px;
  color: var(--ink-2);
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.chip {
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--grid);
  font-weight: 600;
}

/* ——— Экраны ——— */
.tutorial {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  padding-top: 8px;
}
.tut-art {
  width: 100%;
  max-width: 340px;
  aspect-ratio: 3 / 2;
  display: grid;
  place-items: center;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  padding: 12px;
  background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 10px 10px;
}
.tut-art svg {
  width: 100%;
  height: 100%;
}
.tutorial h2 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 24px;
  line-height: 1.15;
  margin: 8px 0 0;
}
.tutorial p {
  margin: 0;
  max-width: 44ch;
  color: var(--ink-2);
  font-size: 17px;
}
.tut-dots {
  display: flex;
  gap: 8px;
  padding: 10px 0;
}
.tut-dots .dot {
  width: 28px;
  height: 8px;
  border: 1.5px solid var(--ink);
  border-radius: 2px;
  background: var(--paper);
  padding: 0;
}
.tut-dots .dot.on {
  background: var(--rod);
  border-color: var(--rod);
}
.hero-auth {
  display: flex;
  gap: 14px;
  align-items: center;
}
.hero-mark {
  flex: none;
}
.code-input {
  width: 100%;
  font-family: var(--font-display);
  font-size: 32px !important;
  letter-spacing: 0.35em;
  text-align: center;
  min-height: 60px;
  border: 1.5px solid var(--line-2);
  border-radius: var(--r-ctl);
  background: var(--paper);
}
.or {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink-3);
  font-size: 14px;
}
.or::before,
.or::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--line);
}
.install-card {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.install-card p {
  margin: 4px 0 8px;
  font-size: 15px;
  color: var(--ink-2);
}
.install-card > div {
  flex: 1;
}

/* Список объектов */
.proj-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.proj {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  text-decoration: none;
}
.proj-top {
  display: flex;
  align-items: center;
  gap: 8px;
}
.proj h3 {
  margin: 0;
  font-size: 18px;
  flex: 1;
}
.proj-meta {
  font-size: 14px;
  color: var(--ink-2);
}
.proj-next {
  font-size: 15px;
  font-weight: 600;
  color: var(--rod);
}
.proj-next.err {
  color: var(--err);
}
.dot-sync {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--warn);
}
.empty-hero,
.empty {
  text-align: center;
  padding: 18px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.empty-hero h2 {
  font-family: var(--font-display);
  font-weight: 600;
  margin: 0;
  font-size: 22px;
}
.empty-hero p,
.empty p {
  margin: 0;
  color: var(--ink-2);
  max-width: 46ch;
}
.sync-badge {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  color: var(--bar-text-2);
}
.sync-badge.busy .ico {
  animation: spin 1.2s linear infinite;
}
.sync-badge.err {
  color: #ffb4bd;
}
.sync-badge.off {
  color: #ffd27a;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Мастер */
.steps {
  display: flex;
  list-style: none;
  padding: 0;
  margin: 0;
  gap: 4px;
  counter-reset: s;
}
.steps li {
  flex: 1;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-3);
  padding-top: 8px;
  border-top: 4px solid var(--line);
  counter-increment: s;
}
.steps li.done {
  border-color: var(--ink);
  color: var(--ink-2);
}
.steps li.on {
  border-color: var(--rod);
  color: var(--ink);
}

/* Поверки, точки хода */
.check-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.check-item.done {
  border-color: var(--ok);
}
.points {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.point {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.point-head {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}
.point-head .field {
  flex: 1;
}
.point-n {
  display: grid;
  place-items: center;
  width: 34px;
  height: 48px;
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--ink-3);
}
.point-tools {
  display: flex;
}

/* Привязка и карта */
.tie-sum.ok {
  border-color: var(--ok);
}
.kv-mini {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 10px;
  font-variant-numeric: tabular-nums;
}
.kv-mini th {
  text-align: left;
  font-weight: 400;
  color: var(--ink-2);
  padding: 4px 8px 4px 0;
  font-size: 15px;
}
.kv-mini td {
  text-align: right;
  font-weight: 600;
  padding: 4px 0;
}
.map-box {
  position: relative;
  border-radius: var(--r-card);
  overflow: hidden;
  border: 1px solid var(--line);
  background: #283229;
}
.map {
  height: 52vh;
  min-height: 280px;
  max-height: 560px;
  width: 100%;
}
.map-off {
  display: grid;
  place-items: center;
  min-height: 160px;
  padding: 16px;
  text-align: center;
  color: #e9edea;
  font-size: 15px;
}
.map-tools {
  display: flex;
  gap: 8px;
  align-items: center;
}
.search {
  flex: 1;
  display: flex;
  gap: 4px;
  align-items: center;
}
.map-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}
.map-hint {
  display: flex;
  gap: 6px;
  align-items: center;
  font-weight: 600;
  color: var(--rod);
  margin-bottom: 4px;
}
.mk {
  position: relative;
}
.mk-dot {
  display: block;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #d5231b;
  border: 3px solid #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.5);
}
.mk-p .mk-dot {
  background: #fff;
  border-color: #15191c;
}
.mk-lbl {
  position: absolute;
  left: 20px;
  top: -4px;
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  white-space: nowrap;
  text-shadow: 0 0 3px #000, 0 0 2px #000;
}

/* Станция */
.st-diagram {
  width: 100%;
  max-height: 130px;
  font-family: var(--font-ui);
}
.circle-block {
  border-top: 1px solid var(--line);
  padding-top: 10px;
  margin-top: 10px;
}
.circle-tag {
  display: inline-block;
  margin-bottom: 8px;
  padding: 2px 10px;
  border-radius: 6px;
  background: var(--ink);
  color: var(--btn-text);
  font-weight: 700;
  font-size: 14px;
}
.circle-tag.kp {
  background: var(--rod);
  color: #fff;
}
.results {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1.5px dashed var(--line-2);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.res-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
  font-variant-numeric: tabular-nums;
}
.res-row > span:first-child {
  color: var(--ink-2);
  font-size: 15px;
  flex: 1 1 10em;
}
.res-row b {
  font-size: 17px;
}
.res-row.big b {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 22px;
}
.res-row .muted {
  font-size: 14px;
}
.lev-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.lev-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.lev-col {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Сводные показатели */
.stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.stat {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  padding: 10px 12px;
  border-top: 4px solid var(--line-2);
}
.stat.good {
  border-top-color: var(--ok);
}
.stat.bad {
  border-top-color: var(--err);
  background: var(--err-bg);
}
.stat-l {
  font-size: 14px;
  color: var(--ink-2);
}
.stat-v {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 24px;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.stat-s {
  font-size: 13px;
  color: var(--ink-2);
}

/* Таблицы ведомостей */
.tbl-wrap,
.doc-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
}
table.doc {
  border-collapse: collapse;
  min-width: 560px;
  width: 100%;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  background: var(--paper);
}
table.doc.small {
  font-size: 13px;
}
table.doc th,
table.doc td {
  border: 1px solid var(--line-2);
  padding: 4px 6px;
  vertical-align: top;
}
table.doc th {
  background: var(--grid);
  font-weight: 600;
  text-align: center;
  vertical-align: middle;
  font-size: 13px;
}
table.doc .a-right {
  text-align: right;
  white-space: nowrap;
}
table.doc .a-center {
  text-align: center;
}
table.doc .b {
  font-weight: 700;
}
table.doc tr.grp td {
  border-top: 2px solid var(--ink);
}
table.kv {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}
table.kv th {
  text-align: left;
  font-weight: 400;
  color: var(--ink-2);
  padding: 4px 10px 4px 0;
  vertical-align: top;
  width: 48%;
}
table.kv td {
  padding: 4px 0;
  font-weight: 600;
}
.note {
  font-size: 13px;
  color: var(--ink-2);
  margin: 6px 0;
}
.catalog {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}
.catalog th,
.catalog td {
  padding: 8px 6px;
  border-bottom: 1px solid var(--line);
  text-align: right;
}
.catalog th:first-child,
.catalog td:first-child {
  text-align: left;
}
.catalog th {
  font-size: 13px;
  color: var(--ink-2);
  font-weight: 600;
}
.catalog td:first-child {
  font-weight: 700;
}

/* Съёмка подробностей */
.limits {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  text-align: center;
}
.limits div {
  background: var(--grid);
  border-radius: var(--r-ctl);
  padding: 8px 4px;
}
.limits b {
  display: block;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 20px;
}
.limits span {
  font-size: 13px;
  color: var(--ink-2);
  line-height: 1.2;
  display: block;
}
.st-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.st-list a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  text-decoration: none;
}
.st-list .st-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 20px;
  min-width: 2.6em;
}
.st-list .st-info {
  flex: 1;
  font-size: 15px;
  color: var(--ink-2);
}
.pk-new {
  border: 1.5px solid var(--ink);
}
.pk-new-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}
.pk-no {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 22px;
}
.pk-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  padding: 10px 12px;
  border-radius: var(--r-ctl);
  background: var(--grid);
  font-variant-numeric: tabular-nums;
  font-size: 15px;
}
.pk-preview b {
  font-size: 17px;
}
.pk-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.pk {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 2px 12px;
  align-items: center;
  padding: 10px 6px 10px 12px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  font-variant-numeric: tabular-nums;
}
.pk.warn {
  border-color: var(--warn);
}
.pk-n {
  grid-row: span 2;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 20px;
  min-width: 1.8em;
  text-align: center;
}
.pk-a {
  font-size: 15px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.pk-b {
  font-size: 14px;
  color: var(--ink-2);
}
.pk-tools {
  grid-row: span 2;
  display: flex;
}
.pk-w {
  grid-column: 2 / span 2;
  font-size: 13px;
  color: var(--warn);
}
.code-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex: none;
}

/* План */
.plan-box {
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  background: var(--plan-paper);
  overflow: auto;
  max-height: 70vh;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x pan-y pinch-zoom;
}
.plan-inner svg {
  display: block;
  width: 100%;
  height: auto;
}
.plan-tools {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.plan-tools .check {
  font-size: 15px;
}
.zoom {
  display: flex;
  gap: 4px;
  margin-left: auto;
}
.zoom .icon-btn {
  background: var(--paper);
  border: 1px solid var(--line-2);
}
.legend {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 6px 12px;
  font-size: 14px;
  color: var(--ink-2);
}
.legend span {
  display: flex;
  gap: 8px;
  align-items: center;
}
.legend svg {
  flex: none;
  color: var(--ink);
}

/* Документы */
.checklist {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.checklist li {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 16px;
}
.checklist .ico {
  margin-top: 2px;
}
.checklist .ok .ico {
  color: var(--ok);
}
.checklist .bad .ico {
  color: var(--err);
}
.checklist .warn .ico {
  color: var(--warn);
}
.files {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.files a,
.files button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-ctl);
  background: var(--paper);
  text-decoration: none;
  text-align: left;
  font-size: 15px;
}
.files .fsize {
  white-space: nowrap;
  margin-left: auto;
  color: var(--ink-3);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.ext {
  flex: none;
  display: inline-grid;
  place-items: center;
  min-width: 44px;
  height: 26px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  background: var(--ink-2);
}
.ext-pdf {
  background: #c0172d;
}
.ext-xlsx {
  background: #1b7a43;
}
.ext-dxf {
  background: #245db8;
}
.ext-kml {
  background: #2e7d6a;
}
.report-embed h2 {
  font-size: 18px;
  margin: 22px 0 8px;
  padding-bottom: 4px;
  border-bottom: 1.5px solid var(--ink);
}
.report-embed h3 {
  font-size: 16px;
}
.report-embed .plan-wrap {
  background: var(--plan-paper);
  border: 1px solid var(--line);
  overflow: auto;
}
.report-embed .plan-wrap svg {
  width: 100%;
  height: auto;
  display: block;
}
.report-embed ul {
  padding-left: 20px;
  font-size: 15px;
}
.title-mini {
  text-align: center;
  padding: 18px 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  background: var(--paper);
}
.title-mini h1 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 24px;
  margin: 6px 0;
}

/* Справка */
.help-sec {
  scroll-margin-top: 70px;
}
.help-sec > summary {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  cursor: pointer;
  font-weight: 700;
  font-size: 17px;
  list-style: none;
}
.help-sec > summary::-webkit-details-marker {
  display: none;
}
.help-sec > summary::after {
  content: '+';
  margin-left: auto;
  font-size: 22px;
  color: var(--ink-3);
}
.help-sec[open] > summary::after {
  content: '−';
}
.glossary dt {
  font-weight: 700;
  margin-top: 10px;
}
.glossary dd {
  margin: 2px 0 0;
  color: var(--ink-2);
  font-size: 16px;
}
.howto {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.howto b {
  display: block;
}
.howto span {
  color: var(--ink-2);
  font-size: 16px;
}

/* ——— Уведомления, диалоги, шторки ——— */
#toasts {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(96px + env(safe-area-inset-bottom, 0px));
  z-index: 60;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  padding: 0 var(--gutter);
}
.toast {
  max-width: 520px;
  padding: 12px 16px;
  border-radius: var(--r-btn);
  background: var(--bar-bg);
  color: var(--bar-text);
  font-size: 15px;
  font-weight: 600;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.25);
  border-left: 5px solid var(--bar-text-2);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s, transform 0.2s;
}
.toast.show {
  opacity: 1;
  transform: none;
}
.toast-ok {
  border-left-color: #5cc98a;
}
.toast-error {
  border-left-color: #ff7a8a;
}
.toast-warn {
  border-left-color: #f0b454;
}
.modal-wrap,
.sheet-wrap {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: var(--scrim);
  opacity: 0;
  transition: opacity 0.2s;
}
.modal-wrap {
  display: grid;
  place-items: center;
  padding: var(--gutter);
}
.modal-wrap.show,
.sheet-wrap.show {
  opacity: 1;
}
.modal {
  width: 100%;
  max-width: 440px;
  background: var(--paper);
  border-radius: 14px;
  padding: 18px;
}
.modal h2 {
  margin: 0 0 8px;
  font-size: 20px;
}
.modal-body {
  color: var(--ink-2);
}
.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 16px;
  flex-wrap: wrap;
}
.sheet-wrap {
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.sheet {
  width: 100%;
  max-width: var(--maxw);
  max-height: 90vh;
  overflow: auto;
  background: var(--bg);
  border-radius: 16px 16px 0 0;
  padding: 0 var(--gutter) calc(16px + env(safe-area-inset-bottom, 0px));
  transform: translateY(40px);
  transition: transform 0.22s;
}
.sheet-wrap.show .sheet {
  transform: none;
}
.sheet-head {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0 8px;
  background: var(--bg);
}
.sheet-head h2 {
  margin: 0;
  font-size: 19px;
}
.sheet-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.ocr-img {
  width: 100%;
  max-height: 34vh;
  object-fit: contain;
  border-radius: var(--r-ctl);
  background: #000;
}
.ocr-status {
  display: flex;
  gap: 10px;
  align-items: center;
  font-weight: 600;
}
.ocr-status:empty {
  display: none;
}
.ocr-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-variant-numeric: tabular-nums;
}
.ocr-conf {
  font-weight: 600;
}
.ocr-high {
  color: var(--ok);
}
.ocr-medium {
  color: var(--warn);
}
.ocr-low {
  color: var(--err);
}
.spinner {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 3px solid var(--line-2);
  border-top-color: var(--rod);
  animation: spin 0.8s linear infinite;
  flex: none;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
  }
}

@media (min-width: 760px) {
  #view {
    padding-top: 24px;
  }
  .stats {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media print {
  .appbar,
  .bottombar,
  #toasts,
  .no-print {
    display: none !important;
  }
  body {
    background: #fff;
    padding: 0;
  }
  #view {
    max-width: none;
    padding: 0;
  }
}

.hint-list,
.plain-ol {
  margin: 6px 0 0;
  padding-left: 22px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 16px;
}
.help-sec p {
  font-size: 16px;
}
body:not(.has-bar) #toasts {
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
}

@media (max-width: 759px) {
  .stats > .stat:last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }
}
