/*
  MudMaster WebOffice: демо-страницы для показа.
  Токены по docs/platform/07-ux-ui.md, раздел 5: светлая тема, акцент MudMaster #E3A12F,
  Onest, шаг 4 px, радиусы 6 / 10 / 999, тени только у всплывающих слоёв.
  Свой ход: путь сделки нарисован как профиль перехода ГНБ (вход, горизонтальный участок, выход).
  Демо намеренно в одной светлой теме: так их будут записывать.
*/
:root {
  color-scheme: light;

  /* поверхности */
  --ground: #f3f4f1;
  --surface: #ffffff;
  --surface-2: #f8f9f6;
  --line: #e1e3dd;
  --line-strong: #c9ccc4;

  /* текст */
  --ink: #16181a;
  --ink-2: #4f555b;
  --ink-3: #62686e;

  /* оболочка: графит с зелёным оттенком, наследие демо 0.2 */
  --rail: #1b211e;
  --rail-2: #252d29;
  --rail-ink: #e6ebe7;
  --rail-ink-2: #9aa59f;

  /* бренд установки */
  --accent: #e3a12f;
  --accent-strong: #c98a1c;
  --accent-soft: #fbf1dc;
  --on-accent: #1a1408;

  /* смысл */
  --ok: #2f7a4b;
  --ok-soft: #e5f2ea;
  --warn: #855600;
  --warn-soft: #fbf0d6;
  --bad: #b3261e;
  --bad-soft: #fbe6e4;
  --info: #2b5f8e;
  --info-soft: #e3edf6;

  /* грунт для иллюстраций: слои разреза */
  --soil-1: #d9cdb4;
  --soil-2: #c7b38e;
  --soil-3: #a99070;
  --soil-4: #8a7458;

  --font: "Onest", "Segoe UI", system-ui, -apple-system, sans-serif;

  --t-12: 0.75rem;
  --t-13: 0.8125rem;
  --t-14: 0.875rem;
  --t-16: 1rem;
  --t-20: 1.25rem;
  --t-24: 1.5rem;
  --t-32: 2rem;
  --t-44: 2.75rem;

  --r-6: 6px;
  --r-10: 10px;
  --r-pill: 999px;

  --pop-shadow: 0 12px 32px -12px rgb(22 24 26 / 0.28), 0 2px 6px rgb(22 24 26 / 0.08);
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

*,
*::before,
*::after { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--t-14);
  line-height: 1.45;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--accent); color: var(--on-accent); }

:focus-visible {
  outline: 2px solid var(--accent-strong);
  outline-offset: 2px;
  border-radius: var(--r-6);
}

a { color: inherit; text-underline-offset: 3px; }

h1, h2, h3, h4 { margin: 0; text-wrap: balance; font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: 1.75rem; line-height: 1.15; letter-spacing: -0.02em; }
h2 { font-size: var(--t-16); line-height: 1.3; }
h3 { font-size: var(--t-14); }
p { margin: 0; }

svg.lucide, [data-lucide] { width: 18px; height: 18px; stroke-width: 1.75; flex: none; }

.muted { color: var(--ink-2); }
.quiet { color: var(--ink-3); font-size: var(--t-13); }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.right, .t th.right, .t td.right { text-align: right; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- оболочка кабинета ---------- */

.shell {
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
  min-height: 100%;
  background: linear-gradient(to right, var(--rail) 236px, var(--ground) 236px);
}

.rail {
  background: var(--rail);
  color: var(--rail-ink);
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 20px 12px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px 20px;
  text-decoration: none;
}
.brand-mark { width: 30px; height: 30px; flex: none; }
.brand-name { font-weight: 700; font-size: var(--t-16); letter-spacing: -0.01em; }
.brand-sub { display: block; color: var(--rail-ink-2); font-size: var(--t-12); font-weight: 400; }

.rail-nav { display: flex; flex-direction: column; gap: 2px; }
.rail-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 10px;
  border-radius: var(--r-6);
  color: var(--rail-ink-2);
  text-decoration: none;
  font-size: var(--t-14);
  transition: background 0.15s, color 0.15s;
}
.rail-nav a:hover { background: var(--rail-2); color: var(--rail-ink); }
.rail-nav a[aria-current="page"] { background: var(--rail-2); color: var(--rail-ink); box-shadow: inset 2px 0 0 var(--accent); }
.rail-nav .count {
  margin-left: auto;
  min-width: 20px;
  padding: 1px 6px;
  border-radius: var(--r-pill);
  background: var(--accent);
  color: var(--on-accent);
  font-size: var(--t-12);
  font-weight: 600;
  text-align: center;
}

.rail-foot {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 8px 0;
  border-top: 1px solid var(--rail-2);
}
.who { display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--rail-2); color: var(--rail-ink);
  font-size: var(--t-12); font-weight: 600; flex: none;
}
.who-name { font-size: var(--t-13); color: var(--rail-ink); }
.who-org { font-size: var(--t-12); color: var(--rail-ink-2); }
.who > span:last-child { min-width: 0; line-height: 1.35; }
.scene-nav { display: flex; gap: 4px; opacity: 0; transition: opacity 0.2s; }
.rail:hover .scene-nav, .scene-nav:focus-within { opacity: 1; }
.scene-nav a {
  flex: 1;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 6px; border-radius: var(--r-6);
  color: var(--rail-ink-2); font-size: var(--t-12); text-decoration: none; white-space: nowrap;
}
.scene-nav a:hover { background: var(--rail-2); color: var(--rail-ink); }
.scene-nav svg.lucide { width: 14px; height: 14px; }

.main { min-width: 0; display: flex; flex-direction: column; }

.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 32px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 5;
}
.search {
  flex: 1;
  max-width: 520px;
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-6);
  background: var(--surface-2);
  color: var(--ink-3);
}
.search input { border: 0; background: none; outline: none; font: inherit; color: var(--ink); width: 100%; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.icon-btn {
  position: relative;
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border: 1px solid transparent; border-radius: var(--r-6);
  background: none; color: var(--ink-2); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); border-color: var(--line); color: var(--ink); }
.icon-btn .dot { position: absolute; top: 7px; right: 8px; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2px var(--surface); }

.org-switch {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px; border: 1px solid var(--line); border-radius: var(--r-6);
  background: var(--surface); font: inherit; color: var(--ink); cursor: pointer;
}
.org-switch small { color: var(--ink-3); }

.page {
  padding: 28px 32px 48px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 1320px;
  width: 100%;
}
.page-head { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.page-head .lead { color: var(--ink-2); margin-top: 4px; }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- кнопки, поля ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 36px; padding: 0 14px;
  border: 1px solid var(--line-strong); border-radius: var(--r-6);
  background: var(--surface); color: var(--ink);
  font: inherit; font-weight: 500; text-decoration: none; white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}
.btn:hover { border-color: var(--ink-3); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
.btn-primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.btn-dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn-dark:hover { background: #2a2e31; }
.btn-ghost { border-color: transparent; background: none; color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--ink); border-color: var(--line); }
.btn-sm { min-height: 30px; padding: 0 10px; font-size: var(--t-13); }
.btn-lg { min-height: 44px; padding: 0 20px; font-size: var(--t-16); }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; }
.btn.is-busy { pointer-events: none; }
.btn.is-busy::before {
  content: ""; width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label, .label { font-size: var(--t-13); color: var(--ink-2); font-weight: 500; }
.input, .select, textarea.input {
  width: 100%;
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-6);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
}
.input:focus, .select:focus { outline: none; border-color: var(--accent-strong); box-shadow: 0 0 0 3px var(--accent-soft); }
.input::placeholder { color: var(--ink-3); }
.hint { font-size: var(--t-12); color: var(--ink-3); }

.qty {
  display: inline-flex; align-items: center;
  border: 1px solid var(--line-strong); border-radius: var(--r-6); background: var(--surface);
}
.qty button { width: 30px; height: 30px; border: 0; background: none; cursor: pointer; color: var(--ink-2); display: grid; place-items: center; }
.qty button:hover { color: var(--ink); }
.qty input { width: 44px; border: 0; text-align: center; font: inherit; background: none; color: var(--ink); }
.qty svg.lucide { width: 14px; height: 14px; }

.seg { display: inline-flex; max-width: 100%; overflow-x: auto; scrollbar-width: none; padding: 3px; gap: 2px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-6); }
.seg button {
  border: 0; background: none; padding: 6px 12px; border-radius: 4px;
  font: inherit; font-size: var(--t-13); color: var(--ink-2); cursor: pointer; white-space: nowrap;
}
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgb(22 24 26 / 0.12); }
.seg .n { color: var(--ink-3); font-weight: 400; margin-left: 4px; }

.switch { position: relative; display: inline-block; width: 36px; height: 20px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; border-radius: var(--r-pill); background: var(--line-strong); transition: background 0.15s; cursor: pointer; }
.switch span::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform 0.2s var(--ease); box-shadow: 0 1px 2px rgb(0 0 0 / 0.2); }
.switch input:checked + span { background: var(--ink); }
.switch input:checked + span::after { transform: translateX(16px); }
.switch input:focus-visible + span { outline: 2px solid var(--accent-strong); outline-offset: 2px; }

.check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.check input { accent-color: var(--ink); width: 16px; height: 16px; margin: 2px 0 0; }

/* ---------- плоскости ---------- */

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-10);
  min-width: 0;
}
.panel-head { display: flex; align-items: center; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.panel-head .actions { margin-left: auto; display: flex; gap: 8px; }
.panel-body { padding: 20px; }

.split { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 20px; align-items: start; }
.cols-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.cols-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; align-items: center; gap: 12px; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }

.kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 20px; margin: 0; }
.kv dt { color: var(--ink-3); font-size: var(--t-13); }
.kv dd { margin: 0; }

/* ---------- таблицы ---------- */

.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; }
.t th {
  text-align: left; font-weight: 500; font-size: var(--t-12); color: var(--ink-3);
  padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.t td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.t tr:last-child td { border-bottom: 0; }
.t th:first-child, .t td:first-child { padding-left: 20px; }
.t th:last-child, .t td:last-child { padding-right: 20px; }
.t tbody tr { transition: background 0.12s; }
.t tbody tr:hover { background: var(--surface-2); }
.t .title { font-weight: 500; white-space: nowrap; }
.t .sub { display: block; font-size: var(--t-12); color: var(--ink-3); margin-top: 2px; }
.t tfoot td { border-top: 1px solid var(--line); border-bottom: 0; font-weight: 600; }

/* ---------- метки статусов ---------- */

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 8px; border-radius: var(--r-pill);
  font-size: var(--t-12); font-weight: 500; white-space: nowrap;
  background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line);
}
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.chip.plain::before { display: none; }
.chip.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.chip.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.chip.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.chip.info { background: var(--info-soft); color: var(--info); border-color: transparent; }
.chip.accent { background: var(--accent-soft); color: #7a5208; border-color: transparent; }

.tag { display: inline-flex; align-items: center; gap: 4px; padding: 1px 6px; border-radius: 4px; font-size: var(--t-12); background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2); }

/* ---------- тосты ---------- */

.toasts {
  position: fixed; right: max(24px, env(safe-area-inset-right, 0px)); bottom: max(24px, env(safe-area-inset-bottom, 0px));
  display: flex; flex-direction: column; gap: 8px; z-index: 50;
}
.toast {
  display: flex; align-items: center; gap: 12px;
  min-width: 300px; max-width: 420px;
  padding: 12px 16px;
  background: var(--ink); color: #fff;
  border-radius: var(--r-10);
  box-shadow: var(--pop-shadow);
  animation: toast-in 0.35s var(--ease);
}
.toast svg.lucide { color: var(--accent); }
.toast .toast-act { margin-left: auto; color: var(--accent); font-weight: 600; text-decoration: none; white-space: nowrap; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0.4; } }

/* ---------- путь сделки: профиль перехода ГНБ ---------- */

.bore { position: relative; padding: 4px 0 0; }
.bore svg { display: block; width: 100%; height: 28px; overflow: visible; }
.bore .ground-line { stroke: var(--line-strong); stroke-width: 1; }
.bore .path-base { fill: none; stroke: var(--line); stroke-width: 6; stroke-linecap: round; }
.bore .path-done { fill: none; stroke: var(--ink); stroke-width: 6; stroke-linecap: round; transition: stroke-dashoffset 0.9s var(--ease); }
.bore .soil { fill: var(--surface-2); }
.bore-stops {
  display: grid;
  grid-template-columns: repeat(var(--n, 6), minmax(0, 1fr));
  margin-top: 6px;
}
.bore-stop { display: flex; flex-direction: column; align-items: center; gap: 2px; text-align: center; font-size: var(--t-12); color: var(--ink-3); }
.bore-stop strong { font-weight: 600; font-size: var(--t-13); color: var(--ink-2); }
.bore-stop.done strong { color: var(--ink); }
.bore-stop.now strong { color: var(--ink); }
.bore-stop.now { color: var(--ink-2); }
.bore .stop-dot { fill: var(--surface); stroke: var(--line-strong); stroke-width: 2; transition: fill 0.3s, stroke 0.3s; }
.bore .stop-dot.done { fill: var(--ink); stroke: var(--ink); }
.bore .stop-dot.now { fill: var(--accent); stroke: var(--on-accent); }
.bore .drill-head { fill: var(--accent); stroke: var(--on-accent); stroke-width: 1.5; }

/* ---------- плашка-уведомление в теле ---------- */

.note {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 12px 16px; border-radius: var(--r-10);
  background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2);
}
.note.accent { background: var(--accent-soft); border-color: #f0dcae; color: #5c3f06; }
.note.ok { background: var(--ok-soft); border-color: #cfe5d7; color: #1f5534; }
.note svg.lucide { margin-top: 1px; }

/* ---------- телефон ---------- */

.phone {
  width: 390px; max-width: 100%;
  height: 800px;
  border-radius: 48px;
  padding: 12px;
  background: #0f1211;
  box-shadow: 0 30px 60px -30px rgb(22 24 26 / 0.45), inset 0 0 0 1px #2c3330;
  flex: none;
}
.phone-screen {
  position: relative;
  height: 100%;
  border-radius: 38px;
  overflow: hidden;
  background: var(--ground);
  display: flex; flex-direction: column;
}
.phone-status {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 26px 6px; font-size: var(--t-13); font-weight: 600;
}
.phone-status .island { width: 110px; height: 30px; border-radius: 20px; background: #0f1211; }

/* ---------- анимации появления по действию ---------- */

.reveal { animation: reveal 0.45s var(--ease); }
@keyframes reveal { from { opacity: 0.2; transform: translateY(6px); } }

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

/* ---------- документ на листе: КП, счёт, акт сверки ---------- */

.paper {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 4px;
  box-shadow: 0 1px 0 var(--line), 0 18px 40px -28px rgb(22 24 26 / 0.35);
  padding: 40px 48px 44px;
  color: #1d2023;
  font-size: var(--t-13);
  line-height: 1.5;
}
.paper h3 { font-size: 1.125rem; letter-spacing: -0.01em; text-align: center; margin: 4px 0 2px; }
.paper .doc-sub { text-align: center; color: var(--ink-2); }
.paper .doc-top { display: flex; justify-content: space-between; gap: 24px; align-items: flex-start; padding-bottom: 18px; margin-bottom: 22px; border-bottom: 2px solid #1d2023; }
.paper .doc-brand { display: flex; gap: 10px; align-items: center; font-weight: 700; font-size: var(--t-16); }
.paper .doc-brand svg { width: 28px; height: 28px; }
.paper .doc-req { text-align: right; color: var(--ink-2); font-size: var(--t-12); line-height: 1.55; }
.paper .parties { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; margin: 18px 0; }
.paper .parties dt { color: var(--ink-3); }
.paper .parties dd { margin: 0; }
.dt { width: 100%; border-collapse: collapse; margin-top: 8px; }
.dt th, .dt td { border: 1px solid #c9ccc4; padding: 6px 8px; vertical-align: top; }
.dt th { background: #f3f4f1; font-weight: 600; font-size: var(--t-12); text-align: center; }
.dt td.r, .dt th.r { text-align: right; white-space: nowrap; }
.dt td.c { text-align: center; }
.dt tr.sum td { font-weight: 600; background: #fafaf8; }
.dt tr.mark td { background: var(--bad-soft); }
.dt .side { background: #eceee8; font-size: var(--t-13); text-align: left; }
.paper .doc-result { margin-top: 18px; padding: 12px 16px; background: #f3f4f1; border-radius: 4px; }
.paper .signs { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; margin-top: 32px; }
.paper .sign { display: flex; flex-direction: column; gap: 22px; }
.paper .sign-line { border-bottom: 1px solid #1d2023; height: 22px; position: relative; }
.paper .sign-line .stamp { position: absolute; left: 0; bottom: -8px; display: inline-flex; gap: 8px; align-items: center; padding: 4px 10px; border: 1.5px solid var(--info); color: var(--info); border-radius: 4px; font-size: var(--t-12); background: #fff; transform: rotate(-1.5deg); }
.paper .sign-line .stamp.wait { border-color: var(--line-strong); color: var(--ink-3); border-style: dashed; transform: none; }
.paper .quiet-note { margin-top: 14px; color: var(--ink-3); font-size: var(--t-12); }
.doc-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* ---------- кнопки каналов отправки ---------- */

.send-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.send-row .btn.sent { border-color: transparent; background: var(--ok-soft); color: var(--ok); }
.send-row .btn .ch { width: 18px; height: 18px; border-radius: 5px; display: grid; place-items: center; font-size: 10px; font-weight: 700; color: #fff; flex: none; }
.ch.tg { background: #2a9bd8; }
.ch.max { background: linear-gradient(135deg, #3b5bff, #9b4dff); }
.ch.mail { background: var(--ink-2); }
.ch svg.lucide { width: 12px; height: 12px; color: #fff; }

/* ---------- подтверждение действия на месте ---------- */

.confirm {
  display: flex; flex-wrap: wrap; gap: 12px; align-items: center;
  padding: 14px 16px; border-radius: var(--r-10);
  background: var(--ink); color: #fff;
}
.confirm .grow { color: rgb(255 255 255 / 0.85); }
.confirm strong { color: #fff; }
.confirm .btn { border-color: rgb(255 255 255 / 0.25); background: transparent; color: #fff; }
.confirm .btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }

/* ---------- шаги процесса в карточке ---------- */

.flow { display: flex; gap: 0; align-items: center; flex-wrap: wrap; font-size: var(--t-13); color: var(--ink-3); }
.flow span { display: inline-flex; align-items: center; gap: 6px; }
.flow span + span::before { content: ""; width: 22px; height: 1px; background: var(--line-strong); margin: 0 8px; }
.flow .done { color: var(--ok); }
.flow .now { color: var(--ink); font-weight: 600; }
.flow svg.lucide { width: 15px; height: 15px; }

/* ---------- карта доставки ---------- */

.map { position: relative; background: #e9ecdf; border-radius: var(--r-10); overflow: hidden; z-index: 0; }
.map.map-schematic { background: #edf0e6; }
.map .leaflet-container { font-family: var(--font); }
.map .leaflet-control-attribution { font-size: 10px; background: rgb(255 255 255 / 0.75); }
.map .leaflet-control-zoom a { color: var(--ink); }
.mpin { position: absolute; transform: translate(-50%, -50%); }
.mpin.start span, .mpin.end span { display: inline-block; padding: 3px 8px; border-radius: 999px; background: #fff; border: 1.5px solid var(--ink); font-size: 12px; font-weight: 600; white-space: nowrap; box-shadow: 0 2px 6px rgb(0 0 0 / .15); }
.mpin.end span { background: var(--ink); color: #fff; }
.mpin.truck { width: 38px; height: 38px; border-radius: 50%; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; border: 3px solid #fff; box-shadow: 0 0 0 6px rgb(227 161 47 / 0.25), 0 4px 10px rgb(0 0 0 / .25); }
.mcity { position: absolute; transform: translate(-50%, -50%); font-size: 12px; font-weight: 600; color: #4f555b; white-space: nowrap; text-shadow: 0 0 3px #fff, 0 0 3px #fff; }
.mriver { position: absolute; transform: translate(-50%, -50%) rotate(-24deg); font-size: 11px; font-style: italic; color: #4c7fa6; white-space: nowrap; }
.map-off { display: grid; place-items: center; height: 100%; color: var(--ink-3); }

/* ---------- калькулятор раствора ---------- */

.calc-inputs { display: flex; flex-direction: column; gap: 22px; }
.slider-row { display: grid; grid-template-columns: minmax(0, 1fr) 110px; gap: 16px; align-items: center; }
input[type="range"] { width: 100%; accent-color: var(--ink); }
.unit-input { position: relative; }
.unit-input input { padding-right: 34px; text-align: right; font-weight: 600; }
.unit-input span { position: absolute; right: 12px; top: 50%; translate: 0 -50%; color: var(--ink-3); font-size: var(--t-13); }
.soil-seg { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.soil-seg button { border: 1px solid var(--line-strong); background: var(--surface); border-radius: var(--r-6); padding: 10px 8px; font: inherit; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 6px; color: var(--ink-2); }
.soil-seg button[aria-pressed="true"] { border-color: var(--ink); color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); font-weight: 600; }
.soil-seg svg { width: 100%; height: 22px; border-radius: 4px; }
.calc-view { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.xsec { border-radius: 14px; overflow: hidden; background: #eef1ec; border: 1px solid var(--line); }
.xsec svg { display: block; width: 100%; height: auto; }
.results { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.res { padding: 16px 18px; border-left: 1px solid var(--line); }
.res:first-child { border-left: 0; }
.res strong { display: block; font-size: var(--t-24); font-weight: 700; letter-spacing: -0.02em; margin-top: 2px; }
.res.main { background: var(--ink); color: #fff; border-radius: 13px 0 0 13px; }
.res.main .label { color: #b9c0bc; }
.calc-cta { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; padding: 16px 20px; border-radius: 14px; background: var(--accent-soft); border: 1px solid #f0dcae; }
.calc-cta p { color: #5c3f06; }
.lead-form { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)) auto; gap: 8px; width: 100%; }
.pick-list { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.pick-list .pl { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px 16px; border-top: 1px solid var(--line); }
.pick-list .pl:first-child { border-top: 0; }
.pick-list .pl-head { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); }
@media (max-width: 1000px) { .results { grid-template-columns: repeat(2, minmax(0, 1fr)); } .res.main { border-radius: 13px 0 0 0; } .lead-form { grid-template-columns: minmax(0, 1fr); } }

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

@media (max-width: 1080px) {
  .split { grid-template-columns: minmax(0, 1fr); }
  .cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  .paper .dt { font-size: var(--t-12); }
  .paper .dt th, .paper .dt td { padding: 5px 4px; }
  .paper .dt td.r, .paper .dt th.r { white-space: normal; }
}

/* ---------- кнопка «Все экраны» ---------- */
.topbar .all-screens { white-space: nowrap; }
.all-screens-fab { position: fixed; left: max(16px, env(safe-area-inset-left, 0px)); bottom: max(16px, env(safe-area-inset-bottom, 0px)); z-index: 30; display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: 999px; background: var(--rail); color: var(--rail-ink); text-decoration: none; font-size: var(--t-14); font-weight: 600; box-shadow: 0 8px 24px rgb(15 18 17 / 0.25); }
.all-screens-fab:hover { background: #2a322e; }
.all-screens-fab svg.lucide { width: 16px; height: 16px; }
.scene-nav { opacity: 1; }
.onec-chip { text-decoration: none; }

/* ---------- подсказки ---------- */
.tip-i { display: inline-grid; place-items: center; width: 22px; height: 22px; margin-left: 4px; vertical-align: middle; border-radius: 50%; color: var(--ink-3); cursor: help; }
.tip-i:hover, .tip-i:focus-visible { color: var(--ink); background: var(--surface-2); }
.tip-i svg.lucide { width: 16px; height: 16px; }
h1 .tip-i svg.lucide { width: 18px; height: 18px; }
.tip-pop { position: fixed; z-index: 80; padding: 8px 12px; border-radius: 8px; background: var(--ink); color: #fff; font-size: var(--t-13); line-height: 1.4; font-weight: 400; box-shadow: var(--pop-shadow); pointer-events: none; animation: tip-in 0.16s var(--ease); text-wrap: pretty; }
@keyframes tip-in { from { opacity: 0; transform: translateY(2px); } }

/* ---------- нет связи ---------- */
.offline-bar { position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: #3a2c0c; color: #fde9bf; font-size: var(--t-13); font-weight: 500; }
.offline-bar svg.lucide { width: 16px; height: 16px; color: var(--accent); }

/* ---------- телефонная оболочка: шапка, вкладки, лист «Ещё» ---------- */
.mbar, .tabbar, .msheet { display: none; }

@media (max-width: 820px) {
  html { -webkit-tap-highlight-color: transparent; }
  body { font-size: 15px; }
  .shell { grid-template-columns: minmax(0, 1fr); background: var(--ground); }
  .rail, .topbar { display: none; }
  .mbar {
    display: flex; align-items: center; gap: 6px;
    position: sticky; top: 0; z-index: 20;
    padding: 8px max(12px, env(safe-area-inset-right, 0px)) 8px max(12px, env(safe-area-inset-left, 0px));
    padding-top: max(8px, env(safe-area-inset-top, 0px));
    background: rgb(255 255 255 / 0.92); backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px);
    border-bottom: 1px solid var(--line);
  }
  .is-offline .mbar { top: 39px; }
  .mbar-brand { display: grid; place-items: center; width: 36px; height: 36px; flex: none; }
  .mbar-brand .brand-mark { width: 28px; height: 28px; }
  .mbar-title { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.2; }
  .mbar-title strong { font-size: var(--t-16); font-weight: 600; }
  .mbar-title small { font-size: var(--t-12); color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .mbar .icon-btn { width: 40px; height: 40px; }
  .onec-dot { display: inline-flex; align-items: center; gap: 5px; padding: 4px 8px; border-radius: 999px; background: var(--ok-soft); color: var(--ok); font-size: var(--t-12); font-weight: 600; text-decoration: none; }
  .onec-dot span { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

  .tabbar {
    display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr);
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    padding: 6px max(4px, env(safe-area-inset-right, 0px)) max(8px, env(safe-area-inset-bottom, 0px)) max(4px, env(safe-area-inset-left, 0px));
    background: rgb(255 255 255 / 0.96); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid var(--line);
  }
  .tabbar .tab {
    position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px;
    padding: 6px 2px 4px; border: 0; background: none; font: inherit; font-size: 11px; font-weight: 500;
    color: var(--ink-3); text-decoration: none; cursor: pointer;
  }
  .tabbar .tab svg.lucide { width: 22px; height: 22px; }
  .tabbar .tab[aria-current="page"] { color: var(--ink); }
  .tabbar .tab[aria-current="page"]::before { content: ""; position: absolute; top: -6px; left: 30%; right: 30%; height: 3px; border-radius: 0 0 3px 3px; background: var(--accent); }
  .tabbar .tab .count { position: absolute; top: 0; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--accent); color: var(--on-accent); font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; box-shadow: 0 0 0 2px #fff; }

  .msheet { display: block; position: fixed; inset: 0; z-index: 60; }
  .msheet[hidden] { display: none; }
  .msheet-scrim { position: absolute; inset: 0; background: rgb(15 18 17 / 0.4); animation: fade 0.2s; }
  .msheet-card { position: absolute; left: 0; right: 0; bottom: 0; max-height: 86vh; overflow-y: auto; background: var(--surface); border-radius: 20px 20px 0 0; padding: 10px 16px max(16px, env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 14px; animation: sheet-up 0.32s var(--ease); }
  .msheet-card::before { content: ""; width: 40px; height: 4px; border-radius: 2px; background: var(--line-strong); align-self: center; }
  .msheet-who { display: flex; align-items: center; gap: 12px; }
  .msheet-who .avatar { width: 40px; height: 40px; background: var(--accent-soft); color: #7a5208; }
  .msheet-who small { display: block; color: var(--ink-3); font-size: var(--t-13); }
  .msheet-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .msheet-link { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 84px; padding: 10px 6px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-2); color: var(--ink); text-decoration: none; font-size: var(--t-13); font-weight: 500; text-align: center; line-height: 1.2; }
  .msheet-link svg.lucide { width: 22px; height: 22px; color: var(--ink-2); }
  .msheet-link[aria-current="page"] { border-color: var(--ink); background: var(--surface); }
  .msheet-link .count { position: absolute; top: 8px; right: 8px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--accent); color: var(--on-accent); font-size: 11px; font-weight: 700; line-height: 18px; }
  .msheet-foot { display: flex; gap: 8px; }
  .msheet-foot .btn { min-height: 44px; }
  @keyframes sheet-up { from { transform: translateY(30%); opacity: 0.6; } }
  @keyframes fade { from { opacity: 0; } }
  .msheet-open, .msheet-open body { overflow: hidden; }

  [data-shell] .page { padding: 16px max(16px, env(safe-area-inset-right, 0px)) calc(96px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); gap: 16px; }
  [data-shell] .page-head h1 { font-size: 1.5rem; }
  [data-shell] .page-head { gap: 12px; align-items: stretch; flex-direction: column; }
  [data-shell] .page-head .actions { margin-left: 0; }
  [data-shell] .page-head .actions .btn { flex: 1; }
  [data-shell]:not([data-app]) .all-screens-fab { display: none; }
  .toasts { left: 12px; right: 12px; bottom: calc(84px + env(safe-area-inset-bottom, 0px)); }
  .toast { min-width: 0; max-width: none; }
  .panel { border-radius: 14px; }
  .panel-head { padding: 12px 16px; }
  .panel-body { padding: 16px; }
  .cols-2, .cols-3 { grid-template-columns: minmax(0, 1fr); }
  .t th:first-child, .t td:first-child { padding-left: 16px; }
  .paper { padding: 24px 18px; }
  .paper .signs { grid-template-columns: 1fr; gap: 20px; }
  .paper .doc-top { flex-direction: column; }
  .paper .doc-req { text-align: left; }
  .seg { width: 100%; }
}
@media (pointer: coarse) {
  .btn { min-height: 44px; }
  .btn-sm { min-height: 36px; }
  .qty button { width: 40px; height: 40px; }
  .input, .select { min-height: 44px; font-size: 16px; }
}

/* ---------- таблицы карточками на телефоне ---------- */
@media (max-width: 640px) {
  table.t.cards, .t.cards tbody, .t.cards tfoot { display: block; }
  .t.cards thead { display: none; }
  .t.cards tr { display: flex; flex-direction: column; gap: 8px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
  .t.cards tbody tr:last-child { border-bottom: 0; }
  .t.cards td, .t.cards th { display: block; padding: 0 !important; border: 0; text-align: left; }
  .t.cards td:not(:first-child) { display: flex; justify-content: space-between; align-items: center; gap: 12px; text-align: right; min-height: 22px; }
  .t.cards td:not(:first-child)::before { content: attr(data-label); color: var(--ink-3); font-size: var(--t-13); text-align: left; font-weight: 400; }
  .t.cards td[data-label=""]:not(:first-child) { justify-content: flex-end; }
  .t.cards td[data-label=""]:not(:first-child)::before { display: none; }
  .t.cards td:first-child { font-weight: 500; }
  .t.cards .title { white-space: normal; }
  .t.cards tfoot tr { flex-direction: row; justify-content: space-between; background: var(--surface-2); }
  .t.cards tfoot td::before { display: none; }
  .t.cards td:empty { display: none; }
}

/* ---------- внутри рамки телефона ---------- */
.in-frame .all-screens-fab, .in-frame .mbar-brand { display: none; }
.in-frame .mbar { padding-left: 16px; }
.in-frame body::before { content: ""; position: fixed; z-index: 90; top: 0; left: 0; right: 0; height: 47px; background: rgb(255 255 255 / 0.94); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); pointer-events: none; }
.in-frame body { padding-top: 47px; }
.in-frame .mbar { top: 47px; }
.in-frame .offline-bar { top: 47px; }
.in-frame.is-offline .mbar { top: 86px; }
.in-frame .tabbar { padding-bottom: 24px; }
.in-frame .toasts { bottom: 104px; }
.in-frame .msheet-card { padding-bottom: 28px; }
.in-frame [data-shell] .page { padding-bottom: 112px; }

/* страницы-телефоны (водитель, документы сотрудника): на телефоне без рамки */
@media (max-width: 820px) {
  .phone { width: 100%; height: auto; min-height: 100vh; padding: 0; border-radius: 0; background: none; box-shadow: none; }
  .phone-screen { border-radius: 0; height: auto; min-height: 100vh; overflow: visible; }
  .phone-status { display: none; }
}

/* страницы-приложения (водитель, сотрудник) на телефоне без оболочки кабинета */
@media (max-width: 820px) {
  [data-app] .mbar, [data-app] .tabbar { display: none; }
  [data-app] .page { padding-bottom: 32px !important; }
  .phone-num { display: none; }
  .all-screens-fab { padding: 0; width: 48px; height: 48px; justify-content: center; font-size: 0; gap: 0; }
  .all-screens-fab svg.lucide { width: 20px; height: 20px; }
}
@media (min-width: 821px) { [data-shell] .all-screens-fab { display: none; } }
@media (max-width: 640px) {
  .bore-stop strong { font-size: 11px; letter-spacing: -0.01em; }
  .bore-stop span { display: none; }
  .bore-stop.now span { display: block; font-size: 11px; }
}
