:root {
  --black: #000;
  --ink: #1d1d1f;
  --gray: #6e6e73;
  --line: #d2d2d7;
  --soft: #f5f5f7;
  --white: #fff;
  --gutter: 22px;
  --nav: 48px;
  --foot: 40px;
  --r: 8px;
  --r-sm: 5px;
  --shadow: 0 6px 24px rgba(0, 0, 0, 0.12);
}

* { box-sizing: border-box; }
html {
  scroll-behavior: smooth; -webkit-text-size-adjust: 100%; overscroll-behavior-y: none; background: var(--white);
  /* шаги страницы мягко «примагничиваются»; колесо над шагом листает их целиком (app.js) */
  scroll-snap-type: y proximity; scroll-padding-top: var(--nav);
}
.app, .result, .faq { scroll-snap-align: start; }
body, button, a, label { -webkit-tap-highlight-color: transparent; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
input { -webkit-user-select: text; user-select: text; }
[hidden] { display: none !important; }
body {
  margin: 0;
  padding-bottom: var(--foot);
  overscroll-behavior-y: none;
  background: var(--white);
  color: var(--ink);
  font-family: 'Roboto', system-ui, sans-serif;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button, input { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; letter-spacing: -0.02em; }
.muted { color: var(--gray); }

/* ---------- Навигация: край в край с картой ---------- */
.nav {
  position: sticky; top: 0; z-index: 1000;
  background: var(--white);
}
.nav-inner { padding: 0 var(--gutter); height: var(--nav); display: flex; align-items: center; justify-content: space-between; }
.logo { text-decoration: none; font-weight: 700; font-size: 17px; letter-spacing: -0.01em; }
.logo span { color: var(--gray); font-weight: 300; }
.brand { display: flex; align-items: center; gap: 14px; min-width: 0; }
/* соседний сервис — в стиле переключателя языка */
.nav-pill {
  display: inline-flex; align-items: center; height: 26px; padding: 0 10px; border: 1px solid var(--line); border-radius: var(--r-sm);
  font-size: 12px; font-weight: 500; text-decoration: none; color: var(--ink); white-space: nowrap; transition: border-color 0.2s, background 0.2s, color 0.2s;
}
.nav-pill span { color: var(--gray); font-weight: 300; }
.nav-pill:hover { background: var(--black); border-color: var(--black); color: var(--white); }
.nav-pill:hover span { color: #a1a1a6; }
button.nav-pill { background: var(--white); cursor: pointer; font-family: inherit; }
.size-cost { margin: 8px 0 0; font-size: 12px; line-height: 1.4; color: var(--gray); }
.size-cost.paid { color: var(--ink); font-weight: 500; }

/* ---------- Окно аккаунта: вход по ссылке, пакеты кредитов ---------- */
.acct {
  width: min(440px, calc(100vw - 32px)); padding: 26px 24px 22px; border: 0; border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25); color: var(--ink); font-family: inherit;
}
.acct::backdrop { background: rgba(0, 0, 0, 0.35); }
.acct h3 { font-size: 22px; font-weight: 700; margin: 0 28px 10px 0; }
.acct p { margin: 0 0 14px; font-size: 14px; line-height: 1.5; }
.acct-close { position: absolute; top: 12px; right: 12px; width: 32px; height: 32px; border: 0; border-radius: 50%; background: var(--soft); font-size: 20px; line-height: 1; cursor: pointer; }
.acct-need { background: var(--soft); border-radius: var(--r-sm); padding: 10px 12px; font-weight: 500; }
.acct-form { display: flex; flex-direction: column; gap: 10px; margin: 6px 0 12px; }
.acct-form input { border: 1px solid var(--line); border-radius: var(--r-sm); padding: 11px 12px; font-size: 15px; outline: none; -webkit-user-select: text; user-select: text; }
.acct-form input:focus { border-color: var(--black); }
.acct-msg { font-size: 13px; color: #b4341f; min-height: 1em; margin: 0; }
.acct-link { display: block; border: 0; background: none; padding: 0; margin: 4px 0 12px; font: inherit; font-size: 13px; color: var(--gray); text-decoration: underline; cursor: pointer; text-align: left; }
.acct-link:hover { color: var(--ink); }
.acct-balance { font-size: 13px; color: var(--gray); }
.acct-packs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 4px 0 16px; }
.acct-pack {
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 12px 10px; min-width: 0;
  border: 1px solid var(--line); border-radius: var(--r); background: var(--white); cursor: pointer; text-align: left; font: inherit;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.acct-pack:hover:not(:disabled) { background: var(--black); color: var(--white); border-color: var(--black); }
.acct-pack:disabled { opacity: 0.5; cursor: default; }
.acct-pack.is-soon { cursor: default; color: var(--gray); background: var(--soft); border-color: transparent; }
.acct h3 .badge { font-size: 11px; vertical-align: middle; position: relative; top: -3px; }
.acct-soon { background: var(--soft); border-radius: var(--r-sm); padding: 10px 12px; }
.acct-pack-credits { font-size: 13px; font-weight: 500; }
.acct-pack b { font-size: 20px; font-weight: 700; }
.acct-pack small { font-size: 11px; color: var(--gray); }
.acct-pack:hover:not(:disabled) small { color: #a1a1a6; }
.acct-rules { margin: 0 0 14px; padding-left: 18px; font-size: 12px; line-height: 1.55; color: var(--gray); }
.acct p.acct-legal { font-size: 12px; margin-bottom: 8px; }
.nav-links { display: flex; align-items: center; gap: 20px; font-size: 13px; }
.nav-links a { text-decoration: none; color: var(--ink); opacity: 0.8; }
.nav-links a:hover { opacity: 1; }
.lang { display: flex; border: 1px solid var(--line); border-radius: var(--r-sm); padding: 2px; }
.lang button { border: 0; background: none; padding: 3px 9px; border-radius: 3px; font-size: 12px; font-weight: 500; cursor: pointer; color: var(--gray); }
.lang button[aria-pressed="true"] { background: var(--black); color: var(--white); }

/* ---------- Кнопки ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: var(--r); padding: 12px 24px;
  font-size: 16px; font-weight: 500; text-decoration: none; cursor: pointer;
  transition: background 0.2s, transform 0.1s, opacity 0.2s;
}
.btn:active { transform: scale(0.98); }
.btn-dark { background: var(--black); color: var(--white); }
.btn-dark:hover { background: #333; }
.btn-dark:disabled { background: #999; cursor: default; }
.btn-block { width: 100%; }
.btn-sm { padding: 6px 11px; font-size: 12px; border-radius: var(--r-sm); }
.btn-line { background: var(--white); border: 1px solid var(--line); color: var(--ink); }
.btn-line:hover:not(:disabled) { border-color: var(--black); }
.btn-line:disabled { opacity: 0.4; cursor: default; }
.tool { border-top: 1px solid var(--line); padding-top: 14px; }
.panel-footer {
  position: sticky; bottom: -16px; z-index: 3; margin-top: auto;
  padding: 14px 0 16px; background: var(--white); border-top: 1px solid var(--line);
}
.panel-footer .status { margin-top: 10px; }
.tool-field { margin-top: 12px; align-items: center; }
.tool .btn-block { margin-top: 12px; }
.tool-row { display: flex; gap: 6px; }
.tool-row .btn { flex: 1; }
.mini { border: 1px solid var(--line); border-radius: var(--r-sm); padding: 2px 6px; font-size: 12px; background: var(--white); }
.map-box.drawing { cursor: crosshair; }
.sec-line { pointer-events: none; }

/* ---------- Карта слева, настройки справа ---------- */
.app { padding: 16px var(--gutter) 0; }
.map-wrap {
  display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px;
  height: calc(100vh - var(--nav) - var(--foot) - 32px);
  height: calc(100svh - var(--nav) - var(--foot) - 32px);
  min-height: 480px;
}
.map-box { position: relative; isolation: isolate; border-radius: var(--r); overflow: hidden; background: var(--soft); }
#map { position: absolute; inset: 0; }
.leaflet-container { background: var(--soft); font-family: inherit; }
.leaflet-control-attribution { font-size: 10px; background: rgba(255, 255, 255, 0.7) !important; }
.leaflet-control-attribution a { color: var(--ink); }
.leaflet-bar { border-radius: var(--r-sm) !important; }
.leaflet-bar a { color: var(--ink); }
.leaflet-bar a:first-child { border-radius: var(--r-sm) var(--r-sm) 0 0 !important; }
.leaflet-bar a:last-child { border-radius: 0 0 var(--r-sm) var(--r-sm) !important; }

.frame {
  position: absolute; left: 50%; top: 50%; z-index: 500; pointer-events: none;
  width: 300px; height: 300px; transform: translate(-50%, -50%);
  border: 2px solid var(--black);
  box-shadow: 0 0 0 9999px rgba(255, 255, 255, 0.45);
}
.frame span {
  position: absolute; left: -2px; top: -26px;
  background: var(--black); color: var(--white); font-size: 12px; font-weight: 500;
  padding: 3px 8px; border-radius: 3px; white-space: nowrap;
}

.panel {
  display: flex; flex-direction: column; gap: 16px;
  min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  padding: 16px; border: 1px solid var(--line); border-radius: var(--r); background: var(--white);
}
.search { position: relative; }
.search input {
  width: 100%; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--white);
  padding: 10px 12px; font-size: 15px; outline: none;
}
.search input:focus { border-color: var(--black); }
.results {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 2;
  list-style: none; margin: 0; padding: 4px; background: var(--white); border: 1px solid var(--line); border-radius: var(--r-sm); box-shadow: var(--shadow);
  max-height: 260px; overflow: auto;
}
.results li { padding: 8px 9px; border-radius: 3px; font-size: 14px; cursor: pointer; line-height: 1.3; }
.results li:hover, .results li[aria-selected="true"] { background: var(--soft); }

.field-head { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; margin-bottom: 10px; }
.field-head b { font-weight: 500; white-space: nowrap; }
.field.sub { padding-left: 14px; margin-top: -6px; }
.field.sub .field-head { font-size: 13px; color: var(--gray); }
.field.sub.off { opacity: 0.45; pointer-events: none; }
input[type="range"] { width: 100%; -webkit-appearance: none; appearance: none; background: transparent; height: 20px; margin: 0; }
input[type="range"]::-webkit-slider-runnable-track { height: 3px; background: var(--line); border-radius: 2px; }
input[type="range"]::-moz-range-track { height: 3px; background: var(--line); border-radius: 2px; }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; margin-top: -7.5px; border-radius: 4px; background: var(--black); border: 0; }
input[type="range"]::-moz-range-thumb { width: 18px; height: 18px; border-radius: 4px; background: var(--black); border: 0; }

.toggles { display: flex; flex-direction: column; border-top: 1px solid var(--line); }
.toggle { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14px; cursor: pointer; }
/* невидимый чекбокс лежит внутри своего переключателя: иначе при фокусе браузер прокручивает к нему окно редактора */
.toggle input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; pointer-events: none; }
.toggle i { position: relative; width: 36px; height: 20px; border-radius: 4px; background: var(--line); transition: background 0.2s; flex: none; }
.toggle i::after { content: ''; position: absolute; left: 2px; top: 2px; width: 16px; height: 16px; border-radius: 3px; background: var(--white); transition: transform 0.2s; }
.toggle input:checked + i { background: var(--black); }
.toggle input:checked + i::after { transform: translateX(16px); }
.toggle input:disabled + i { opacity: 0.4; }
.toggle.sub { padding-left: 14px; font-size: 13px; color: var(--gray); }
.toggle.sub:has(input:disabled) { opacity: 0.5; }
.toggle input:focus-visible + i { outline: 2px solid var(--black); outline-offset: 2px; }
.toggles .field.sub { padding: 8px 0 10px 14px; margin: 0; border-bottom: 1px solid var(--line); }

.status { margin: 2px 0 0; font-size: 13px; color: var(--gray); line-height: 1.4; min-height: 18px; }
.status.error { color: var(--black); font-weight: 500; }
.progress { display: block; height: 3px; margin-top: 10px; background: var(--line); border-radius: 2px; overflow: hidden; margin-top: 8px; }
.progress::after { content: ''; display: block; height: 100%; width: 35%; background: var(--black); animation: slide 1.1s ease-in-out infinite; }
@keyframes slide { from { transform: translateX(-100%); } to { transform: translateX(300%); } }

/* ---------- Результат: превью слева, выгрузка справа ---------- */
/* каждый шаг целиком помещается в экран между шапкой и подвалом */
.result { padding: 24px var(--gutter) 20px; }
.result-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; margin-bottom: 20px; flex-wrap: wrap; }
.result h2 { font-size: clamp(34px, 5vw, 52px); font-weight: 700; }
.result-head .muted { margin: 10px 0 0; font-size: 15px; }
.stats { display: flex; gap: 36px; margin: 0; }
.stats div { text-align: right; }
.stats dt { font-size: 13px; color: var(--gray); }
.stats dd { margin: 4px 0 0; font-size: 32px; font-weight: 300; letter-spacing: -0.02em; }

/* колонка выгрузки тянется ровно на высоту вкладок и окна модели */
.result-body { --tabs-h: 38px; display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 20px; align-items: stretch; }
.result-main { min-width: 0; display: flex; flex-direction: column; }
.result-side { display: flex; flex-direction: column; gap: 12px; min-height: 0; }
.side-title { height: var(--tabs-h); display: flex; align-items: center; font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--gray); font-weight: 500; }

.stage { position: relative; height: clamp(360px, calc(100svh - var(--nav) - var(--foot) - 200px), 720px); border-radius: var(--r); overflow: hidden; overflow: clip; background: var(--soft); }
.viewer, .flat { position: absolute; inset: 0; }
.viewer canvas { display: block; width: 100%; height: 100%; }
.flat { overflow: hidden; cursor: grab; touch-action: none; background: var(--soft); }
.flat:active { cursor: grabbing; }
.flat img { position: absolute; left: 0; top: 0; transform-origin: 0 0; user-select: none; max-width: none; }
.viewer-hint {
  position: absolute; left: 12px; bottom: 12px; z-index: 2; pointer-events: none;
  font-size: 12px; color: var(--gray); background: rgba(255, 255, 255, 0.85); padding: 5px 9px; border-radius: var(--r-sm);
}

/* сегментированный переключатель (карта/спутник, вкладки превью) */
.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: var(--r); background: rgba(255, 255, 255, 0.92); box-shadow: 0 1px 6px rgba(0, 0, 0, 0.12); }
.seg button { border: 0; background: none; padding: 7px 15px; border-radius: var(--r-sm); font-size: 13px; font-weight: 500; cursor: pointer; color: var(--ink); }
.seg button[aria-pressed="true"], .seg button[aria-selected="true"] { background: var(--black); color: var(--white); }
.maptype { position: absolute; left: 12px; top: 12px; z-index: 700; }
.tabs { height: var(--tabs-h, 38px); box-sizing: border-box; align-items: center; margin: 0 0 12px; background: var(--soft); box-shadow: none; }

/* колонка выгрузки по высоте окна модели: невысокие кнопки сеткой, редактор внизу */
.downloads { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.dl {
  height: 50px; min-width: 0;
  display: flex; flex-direction: column; justify-content: center; align-items: flex-start; gap: 2px;
  padding: 0 10px; border-radius: var(--r); border: 1px solid var(--line); background: var(--white);
  cursor: pointer; text-align: left; transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.dl b { max-width: 100%; font-size: 12px; font-weight: 600; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dl span { font-size: 11px; line-height: 1.2; color: var(--gray); }
.dl:hover:not(:disabled) { background: var(--black); color: var(--white); border-color: var(--black); }
.dl:hover:not(:disabled) span { color: #a1a1a6; }
.dl:disabled { opacity: 0.45; cursor: default; }
.dl.busy span::after { content: ' · ' attr(data-busy); }
.quota { font-size: 12px; line-height: 1.5; color: var(--gray); margin: 10px 0 0; }
.quota + .quota { margin-top: 2px; }
/* короткие подписи — в свободных ячейках сетки рядом с последней кнопкой */
.dl-notes { display: flex; flex-direction: column; justify-content: center; gap: 2px; padding: 0 2px; min-width: 0; }
.dl-notes p { margin: 0; font-size: 11px; line-height: 1.35; color: var(--gray); }

/* ---------- Раздел-редактор иллюстрации ---------- */
/* две карточки редакторов делят оставшуюся высоту колонки поровну */
.editor-cta { flex: 1 1 0; min-height: 0; overflow: hidden; display: flex; flex-direction: column; padding: 14px; border: 1px solid var(--line); border-radius: var(--r); background: var(--soft); }
.editor-cta .btn { margin-top: auto; flex: none; padding: 10px 16px; font-size: 14px; }
.editor-cta h3 { font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 8px; flex: none; }
.editor-cta p { margin: 6px 0 10px; font-size: 12px; line-height: 1.45; min-height: 0; overflow: hidden; }
@media (max-height: 820px) { .editor-cta p { display: none; } .editor-cta h3 { margin-bottom: 10px; } }
.lidar-note { display: flex; align-items: center; gap: 8px; margin: 8px 0 0; font-size: 13px; color: var(--gray); }
.badge-dark { background: var(--black) !important; }
.badge { background: #16a34a; color: #fff; font-size: 11px; font-weight: 700; letter-spacing: 0.06em; padding: 2px 7px; border-radius: 4px; }
.editor .result-head h2 { display: flex; align-items: center; gap: 10px; }
/* редактор занимает весь экран между шапкой и подвалом */
.result.editor { display: flex; flex-direction: column; height: calc(100vh - var(--nav) - var(--foot)); height: calc(100svh - var(--nav) - var(--foot)); min-height: 560px; }
.stage-editor { flex: 1; height: auto; min-height: 400px; }
.illu-row { display: flex; gap: 6px; align-items: center; }
.illu-row .btn { flex: 1; }
.illu-row input[type="color"] { width: 30px; height: 28px; padding: 0; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--white); cursor: pointer; }

/* ---------- Панель иллюстрации ---------- */
/* строка сетки строго по высоте окна: иначе собственная высота canvas (×dpr) раздувает её и низ срезается */
.illu { position: absolute; inset: 0; display: grid; grid-template-columns: minmax(0, 1fr) 236px; grid-template-rows: minmax(0, 1fr); background: var(--white); }
.illu canvas { width: 100%; height: 100%; min-height: 0; display: block; touch-action: none; cursor: grab; }
.illu canvas.picking { cursor: crosshair; }
.illu canvas:active { cursor: grabbing; }
.illu-panel { border-left: 1px solid var(--line); padding: 12px 12px 0; overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column; gap: 14px; background: var(--white); }
/* кнопки сохранения всегда видны внизу панели */
.illu-export { position: sticky; bottom: 0; margin-top: auto; padding: 10px 0 12px; border-top: 1px solid var(--line); background: var(--white); }
.illu-group { display: flex; flex-direction: column; gap: 6px; }
.map-view { position: relative; min-width: 0; min-height: 0; overflow: hidden; overflow: clip; background: var(--soft); }
.mrange { display: flex; flex-direction: column; gap: 3px; font-size: 11px; color: var(--gray); padding: 2px 0 4px; }
.mrange input[type="range"] { width: 100%; margin: 0; }
.mrange select { width: 100%; padding: 4px 6px; }
.illu-title { font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--gray); }
.illu-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.illu-col { display: flex; flex-direction: column; gap: 4px; }
.illu-panel button[data-illview], .illu-panel button[data-illstyle], .illu-panel button[data-mappreset] {
  border: 1px solid var(--line); background: var(--white); border-radius: var(--r-sm);
  padding: 6px 8px; font-size: 12px; cursor: pointer; text-align: center;
}
.illu-panel button[aria-pressed="true"] { background: var(--black); color: var(--white); border-color: var(--black); }
.toggle.small { font-size: 12px; padding: 5px 0; }
.toggle.small i { width: 30px; height: 17px; }
.toggle.small i::after { width: 13px; height: 13px; }
.toggle.small input:checked + i::after { transform: translateX(13px); }
.swatches { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 8px; }
.swatches:empty { display: none; }
.swatch { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--ink); cursor: pointer; min-width: 0; }
.swatch input { width: 20px; height: 20px; padding: 0; border: 1px solid var(--line); border-radius: 4px; background: none; cursor: pointer; flex: none; }
.swatch span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.illu-labels { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.illu-labels li { display: flex; gap: 4px; }
.illu-labels input { flex: 1; min-width: 0; border: 1px solid var(--line); border-radius: var(--r-sm); padding: 4px 6px; font-size: 12px; }
.illu-labels button { border: 1px solid var(--line); background: var(--white); border-radius: var(--r-sm); width: 24px; cursor: pointer; font-size: 12px; }

/* сегментированный переключатель (карта/спутник, вкладки превью) */
.mode { width: 100%; box-shadow: none; border: 1px solid var(--line); background: var(--soft); }
.mode button { flex: 1; }
.shape { width: 100%; box-shadow: none; border: 1px solid var(--line); background: var(--white); }
.shape button { flex: 1; }
.frame.circle { border-radius: 50%; }


/* ---------- Вопросы ---------- */
.faq { padding: 80px var(--gutter) 72px; max-width: calc(760px + 2 * var(--gutter)); }
.faq h2 { font-size: clamp(34px, 5vw, 52px); font-weight: 700; line-height: 1.05; margin-bottom: 36px; }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary { list-style: none; cursor: pointer; padding: 18px 0; font-size: 18px; font-weight: 500; display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: '+'; font-weight: 300; font-size: 24px; line-height: 1; transition: transform 0.2s; }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details p { margin: 0 0 20px; font-size: 16px; line-height: 1.55; color: var(--gray); }

/* ---------- Подвал (закреплён) ---------- */
.footer {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 1000; height: var(--foot);
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 0 var(--gutter); font-size: 12px;
  background: var(--white);
  box-sizing: content-box; padding-bottom: env(safe-area-inset-bottom);
}
.footer p { margin: 0; white-space: nowrap; }
.footer .credits { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.footer .muted a { color: var(--gray); }
.footer-right { display: flex; align-items: center; gap: 18px; flex: none; font-size: 13px; }
.footer-right a { text-decoration: none; }
.mail { color: var(--gray); }
.mail:hover { color: var(--ink); }
.made a { font-weight: 700; border-bottom: 1px solid currentColor; }

/* ---------- Телеграм (компактный) ---------- */
.tg {
  position: fixed; left: var(--gutter); bottom: calc(var(--foot) + 12px); z-index: 1100;
  display: flex; align-items: center; gap: 9px;
  padding: 7px 8px 7px 7px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow);
  animation: rise 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
  max-width: calc(100vw - 2 * var(--gutter));
}
.tg-avatar { border: 0; padding: 0; background: none; cursor: pointer; flex: none; display: block; border-radius: 50%; }
.tg img { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; display: block; }
.tg.min { padding: 5px; gap: 0; border-radius: 50%; right: auto !important; }
.tg.min .tg-text, .tg.min .btn, .tg.min .tg-close { display: none; }
.tg-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.tg-text b { font-size: 12px; font-weight: 700; }
.tg-text span { font-size: 11px; color: var(--gray); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tg-close {
  position: absolute; top: -7px; right: -7px; width: 18px; height: 18px; border-radius: 50%;
  border: 0; background: var(--black); color: var(--white); cursor: pointer;
  display: flex; align-items: center; justify-content: center; padding: 0;
}
.tg-close svg { width: 8px; height: 8px; }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* ---------- Адаптив ---------- */
@media (max-width: 860px) {
  .illu { grid-template-columns: 1fr; grid-template-rows: minmax(120px, 1fr) minmax(0, 46%); }
  .illu-panel { border-left: 0; border-top: 1px solid var(--line); flex-direction: row; flex-wrap: wrap; gap: 10px 14px; }
  .illu-group { flex: 1 1 140px; }
}
@media (max-width: 1100px) {
  .result-body { grid-template-columns: 1fr; }
  .result-side { height: auto; min-height: 0; }
  .downloads { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
  .editor-cta { flex: none; }
}
@media (max-width: 760px) {
  :root { --gutter: 16px; }
  .brand { gap: 8px; }
  .nav-links { gap: 12px; }
  .nav-pill { padding: 0 7px; font-size: 11px; }
  body { padding-bottom: calc(var(--foot) + 60px); }
  .map-wrap { display: block; height: auto; min-height: 0; }
  .map-box { height: 60vh; min-height: 360px; }
  .panel { margin-top: 12px; overflow: visible; }
  .result { padding-top: 32px; }
  .stats { gap: 20px; }
  .stats div { text-align: left; }
  .footer .credits { display: none; }
  .footer { justify-content: flex-end; }
  .tg { right: var(--gutter); }
  .tg .btn { margin-left: auto; }
}
.mrange input[type="range"]::-webkit-slider-thumb { width: 14px; height: 14px; margin-top: -5.5px; }
.mrange input[type="range"]::-moz-range-thumb { width: 14px; height: 14px; }

/* ---------- Страницы с текстом: цены, условия ---------- */
.doc { max-width: calc(760px + 2 * var(--gutter)); padding: 48px var(--gutter) 96px; }
.doc h1 { font-size: clamp(34px, 5vw, 52px); font-weight: 700; line-height: 1.05; margin-bottom: 18px; }
.doc h2 { font-size: 20px; font-weight: 600; margin: 36px 0 10px; }
.doc p, .doc li { font-size: 16px; line-height: 1.6; color: var(--ink); }
.doc .muted { color: var(--gray); font-size: 14px; }
.doc .note { background: var(--soft); border-radius: var(--r); padding: 14px 16px; font-size: 15px; }
.doc .lead { font-size: 19px; color: var(--gray); margin-bottom: 28px; }
.doc ul { padding-left: 20px; }
.doc a { color: var(--ink); }
.doc-page, .doc-page * { -webkit-user-select: text; user-select: text; }
.plans { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 8px 0 12px; }
.plan { border: 1px solid var(--line); border-radius: var(--r); padding: 20px 22px; }
.plan h2 { margin: 0 0 6px; font-size: 18px; }
.doc .plan-price { font-size: 34px; font-weight: 300; letter-spacing: -0.02em; margin: 0 0 10px; }
.plan ul { margin: 0; padding-left: 18px; }
.plan li { font-size: 14px; line-height: 1.6; }
.price-table { width: 100%; border-collapse: collapse; margin: 4px 0 8px; font-size: 15px; }
.price-table td { padding: 11px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.price-table td:last-child { text-align: right; white-space: nowrap; padding-left: 16px; font-weight: 500; }
.footer-links { margin: 0; font-size: 12px; color: var(--gray); }
.footer-links a { color: var(--gray); text-decoration: none; }
.footer-links a:hover { color: var(--ink); }
@media (max-width: 760px) { .plans { grid-template-columns: 1fr; } .footer-links { display: none; } }

/* ---------- Админка ---------- */
.admin { padding: 32px var(--gutter) 96px; }
.admin h1 { font-size: clamp(30px, 4vw, 44px); font-weight: 700; margin: 0 0 6px; }
.admin h2 { font-size: 18px; font-weight: 600; margin: 34px 0 10px; }
.admin-head { margin-bottom: 18px; }
.admin-head .muted { margin: 0; font-size: 14px; }
.admin-tag { cursor: default; }
.admin-range button[aria-pressed="true"] { background: var(--black); color: var(--white); }
.admin-range { box-shadow: none; background: var(--soft); }
.admin-login { max-width: 420px; padding-top: 40px; }
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.tile { border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.tile span { font-size: 12px; color: var(--gray); }
.tile b { font-size: 28px; font-weight: 300; letter-spacing: -0.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile small { font-size: 12px; color: var(--gray); }
.charts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 12px; }
.chart-card { margin: 0; border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px 8px; min-width: 0; }
.chart-card figcaption { font-size: 13px; font-weight: 500; margin-bottom: 6px; }
.chart svg { width: 100%; height: auto; display: block; }
.chart .grid { stroke: #ececf0; stroke-width: 1; }
.chart .base { stroke: var(--line); stroke-width: 1; }
.chart .axis { font-size: 10px; fill: var(--gray); font-family: inherit; }
.chart .bar { fill: var(--black); pointer-events: none; }
.chart .hit { fill: transparent; cursor: default; }
.chart .hit.on { fill: rgba(0, 0, 0, 0.05); }
.chart-tip {
  position: fixed; z-index: 2000; pointer-events: none; transform: translateY(-100%);
  background: var(--black); color: var(--white); border-radius: var(--r-sm); padding: 6px 9px; font-size: 12px;
  display: flex; flex-direction: column; gap: 1px; white-space: nowrap;
}
.chart-tip span { color: #a1a1a6; font-size: 11px; }
.admin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.table-wrap { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.admin-table th { text-align: left; font-weight: 500; color: var(--gray); font-size: 12px; padding: 8px 10px 8px 0; border-bottom: 1px solid var(--line); }
.admin-table td { padding: 9px 10px 9px 0; border-bottom: 1px solid #f0f0f2; vertical-align: top; }
.admin-table td:not(:first-child), .admin-table th:not(:first-child) { white-space: nowrap; }
.admin-table code { font-size: 11px; color: var(--gray); }
@media (max-width: 960px) { .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } .charts, .admin-grid { grid-template-columns: 1fr; } }
