/* Дизайн-система: "гараж ночью". Тёмный графит, фото, один акцент (цвет кнопок из настроек бренда).
   Это ПРИЛОЖЕНИЕ, а не сайт: один и тот же интерфейс на телефоне и на компьютере, на широком экране он просто растягивается.
   Радиусы: 14px для элементов управления, 20px для карточек. Шрифт системный: внешние шрифты в РФ ненадёжны. */
:root {
  --radius: 14px; --radius-lg: 20px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --bg: #090b0f; --surface: #11141a; --surface-2: #181c24; --text: #f3f5f9; --muted: #9ba4b3; --line: rgb(255 255 255 / .10);
  --ok: #4ade9c; --err: #ff8f85; --on-err: #2a0d0a; --scrim: 9 11 15;
  --shadow: 0 24px 60px rgb(0 0 0 / .45);
  --ease: cubic-bezier(.16, 1, .3, 1);
  --pad: 14px; --tab-h: 62px; --bar-h: 56px;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f4f5f8; --surface: #ffffff; --surface-2: #eef0f4; --text: #11151c; --muted: #4b5563; --line: rgb(17 21 28 / .12);
  --ok: #0f7a4b; --err: #b42318; --on-err: #ffffff; --scrim: 244 245 248; --shadow: 0 24px 60px rgb(20 30 50 / .14);
  color-scheme: light;
}
@media (prefers-color-scheme: light) {
  :root[data-theme="auto"] {
    --bg: #f4f5f8; --surface: #ffffff; --surface-2: #eef0f4; --text: #11151c; --muted: #4b5563; --line: rgb(17 21 28 / .12);
    --ok: #0f7a4b; --err: #b42318; --on-err: #ffffff; --scrim: 244 245 248; --shadow: 0 24px 60px rgb(20 30 50 / .14);
    color-scheme: light;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 70px; }
body { overflow-x: clip; margin: 0; background: var(--bg); color: var(--text); font: 16px/1.55 var(--font); min-height: 100dvh; -webkit-font-smoothing: antialiased; }
img { max-width: 100%; display: block; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { line-height: 1.08; letter-spacing: -0.025em; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
.muted { color: var(--muted); }
.hide { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------- Кнопки, поля, общие элементы (используются и в админке) ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 22px; border: 1.5px solid transparent;
  border-radius: var(--radius); font-weight: 650; cursor: pointer; white-space: nowrap; text-decoration: none; transition: transform .15s var(--ease), background .2s, border-color .2s, opacity .2s; }
.btn:active { transform: scale(.98) translateY(1px); }
.btn[disabled] { opacity: .4; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:not([disabled]):hover { filter: brightness(1.08); }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--text); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { background: var(--err); color: var(--on-err); }
.btn-sm { min-height: 40px; padding: 0 14px; font-size: 14px; }
.btn-lg { min-height: 56px; padding: 0 30px; font-size: 17px; }

.field { display: grid; gap: 5px; margin-bottom: 10px; }
.field .err:empty { display: none; }
.field label { font-size: 14px; font-weight: 600; }
.field input, .field select, .field textarea { width: 100%; min-height: 46px; padding: 10px 14px; background: var(--surface-2); border: 1.5px solid var(--line); border-radius: var(--radius); transition: border-color .15s; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); outline: none; }
.field textarea { min-height: 96px; resize: vertical; }
.field input::placeholder, .field textarea::placeholder { color: var(--muted); opacity: .75; }
.field .err { color: var(--err); font-size: 13px; }
.field.bad input, .field.bad select { border-color: var(--err); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 340px) { .row2 { grid-template-columns: 1fr; } }

.skel { background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface) 50%, var(--surface-2) 75%); background-size: 200% 100%; border-radius: var(--radius); animation: sh 1.4s linear infinite; }
@keyframes sh { to { background-position: -200% 0; } }
.empty { padding: 22px; text-align: center; color: var(--muted); border: 1.5px dashed var(--line); border-radius: var(--radius); }
.alert { padding: 12px 14px; border-radius: var(--radius); background: color-mix(in srgb, var(--err) 14%, var(--surface)); color: var(--err); border: 1.5px solid var(--err); margin-bottom: 14px; }
.nav { display: flex; gap: 10px; margin-top: 20px; }
.nav .btn-primary { flex: 1; }
.consent { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; margin: 6px 0 16px; color: var(--muted); }
.consent input { width: 22px; height: 22px; margin-top: 1px; accent-color: var(--accent); flex: none; }
.summary { background: var(--surface-2); border-radius: var(--radius); padding: 14px 16px; margin: 4px 0 18px; }
.summary div { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; }
.summary div span:first-child { color: var(--muted); }

/* ---------- Каркас приложения ---------- */
.appbar { position: sticky; top: 0; z-index: 30; height: calc(var(--bar-h) + env(safe-area-inset-top)); padding: env(safe-area-inset-top) var(--pad) 0;
  display: flex; align-items: center; justify-content: space-between; gap: 12px; background: rgb(var(--scrim) / .86);
  backdrop-filter: blur(16px) saturate(1.4); -webkit-backdrop-filter: blur(16px) saturate(1.4); border-bottom: 1px solid var(--line); }
.brandmark { -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; display: flex; align-items: center; gap: 10px; font-weight: 750; font-size: 17px; letter-spacing: -0.01em; min-width: 0; }
.brandmark img { width: 34px; height: 34px; object-fit: contain; border-radius: 9px; }
.brandmark span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.page { padding: 12px var(--pad) calc(var(--tab-h) + 24px + env(safe-area-inset-bottom)); }
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; height: calc(var(--tab-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: rgb(var(--scrim) / .92); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border-top: 1px solid var(--line); }
.tabbar button { background: none; border: 0; cursor: pointer; color: var(--muted); font-weight: 650; font-size: 14px; display: grid; place-items: center; gap: 2px; align-content: center; position: relative; }
.tabbar button[aria-current="page"] { color: var(--text); }
.tabbar button[aria-current="page"]::before { content: ""; position: absolute; top: 0; width: 34px; height: 3px; border-radius: 0 0 3px 3px; background: var(--accent); }

/* Обложка: невысокая шапка с названием */
.cover { position: relative; isolation: isolate; margin: 0 calc(-1 * var(--pad)) 12px; height: clamp(104px, 17vh, 200px); display: flex; align-items: flex-end; overflow: hidden;
  background: radial-gradient(120% 120% at 80% 0%, color-mix(in srgb, var(--brand) 75%, #000), var(--bg)); color: #fff; }
.cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: -2; }
.cover::after { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(0deg, rgb(9 11 15 / .85) 0%, rgb(9 11 15 / .15) 70%, rgb(9 11 15 / .1) 100%); }
.cover .t { padding: 0 var(--pad) 14px; }
.cover h1 { font-size: clamp(26px, 5vw, 40px); font-weight: 800; letter-spacing: -0.03em; }
.cover p { margin-top: 2px; color: rgb(255 255 255 / .85); font-size: 14px; max-width: 60ch; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------- Запись ---------- */
.book { max-width: none; }
.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; margin-bottom: 12px; }
.steps i { height: 4px; border-radius: 4px; background: var(--line); transition: background .3s; }
.steps i.on { background: var(--accent); }
.step-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.step-title { font-size: 21px; }
.step-no { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.chip { display: inline-flex; align-items: center; min-height: 30px; padding: 0 12px; border-radius: 999px; background: var(--surface-2); font-size: 13px; color: var(--muted); }
.chip b { color: var(--text); font-weight: 650; }

/* Карточки услуг: одинакового размера, без цен */
.svc-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(clamp(136px, 18vw, 250px), 1fr)); gap: 10px; }
.svc { position: relative; isolation: isolate; aspect-ratio: 1 / 1; padding: 0; border: 0; border-radius: var(--radius-lg); overflow: hidden; cursor: pointer; text-align: left; color: #fff;
  display: flex; align-items: flex-end; background: linear-gradient(160deg, var(--surface-2), color-mix(in srgb, var(--brand) 40%, var(--surface))); transition: transform .3s var(--ease), box-shadow .2s; }
.svc:hover { transform: translateY(-2px); }
.svc img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: -2; transition: transform .6s var(--ease); }
.svc:hover img { transform: scale(1.05); }
.svc::after { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(0deg, rgb(9 11 15 / .88) 0%, rgb(9 11 15 / .25) 55%, rgb(9 11 15 / 0) 100%); }
.svc .tx { padding: 12px 14px 14px; display: grid; gap: 2px; width: 100%; }
.svc b { font-size: 16px; line-height: 1.2; letter-spacing: -0.01em; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.svc small { color: rgb(255 255 255 / .75); font-size: 13px; }
.svc .ok { position: absolute; top: 10px; right: 10px; width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: var(--on-accent); display: none; place-items: center; font-weight: 800; }
.svc[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--accent); }
.svc[aria-pressed="true"] .ok { display: grid; }
.svc-detail { margin-top: 10px; padding: 12px 14px; background: var(--surface-2); border-radius: var(--radius); color: var(--muted); font-size: 14px; }
.svc-detail b { color: var(--text); }

.form { max-width: 760px; }
.quote { margin: 4px 0 4px; padding: 14px 16px; border-radius: var(--radius); background: var(--surface-2); display: flex; justify-content: space-between; align-items: center; gap: 12px; border: 1.5px solid var(--line); }
.quote span { color: var(--muted); font-size: 14px; }
.quote b { font-size: 24px; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.quote.ready { border-color: var(--accent); }

.days { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 10px; scroll-snap-type: x proximity; scrollbar-width: thin; }
.day { flex: 0 0 auto; width: 62px; padding: 8px 0; text-align: center; background: var(--surface-2); border: 1.5px solid transparent; border-radius: var(--radius); cursor: pointer; scroll-snap-align: start; transition: background .2s; }
.day small { display: block; color: var(--muted); text-transform: capitalize; font-size: 12px; }
.day b { font-size: 19px; }
.day[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }
.day[aria-pressed="true"] small { color: inherit; opacity: .85; }
.day[disabled] { opacity: .3; cursor: not-allowed; }
.times { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 8px; margin-top: 6px; max-width: 900px; }
.time { min-height: 44px; background: var(--surface-2); border: 1.5px solid transparent; border-radius: var(--radius); cursor: pointer; font-weight: 650; font-variant-numeric: tabular-nums; }
.time[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }

/* Нижняя панель шагов (над вкладками) */
.stepnav { position: sticky; bottom: calc(var(--tab-h) + env(safe-area-inset-bottom) + 8px); display: flex; gap: 8px; margin-top: 14px; padding: 8px; border-radius: var(--radius-lg);
  background: rgb(var(--scrim) / .9); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border: 1px solid var(--line); z-index: 20; max-width: 760px; }
.stepnav .btn-primary { flex: 1; }

.done { text-align: center; padding: 28px 8px; }
.done h2 { font-size: 28px; margin: 12px 0 8px; }
.tick { width: 64px; height: 64px; border-radius: 50%; background: var(--accent); color: var(--on-accent); display: inline-grid; place-items: center; font-size: 32px; font-weight: 700; }
.install { margin-top: 12px; padding: 12px 14px; background: var(--surface-2); border-radius: var(--radius); font-size: 14px; max-width: 760px; }

/* Работы */
.works { display: grid; grid-template-columns: repeat(auto-fit, minmax(clamp(150px, 18vw, 260px), 1fr)); gap: 8px; }
.works button { padding: 0; border: 0; border-radius: var(--radius-lg); overflow: hidden; background: var(--surface-2); cursor: zoom-in; aspect-ratio: 4 / 3; }
.works img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s var(--ease); }
.works button:hover img { transform: scale(1.05); }
.lightbox { position: fixed; inset: 0; z-index: 80; background: rgb(0 0 0 / .94); display: grid; place-items: center; padding: 20px; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: var(--radius); object-fit: contain; }
.lb-btn { position: absolute; top: 50%; transform: translateY(-50%); width: 50px; height: 50px; border-radius: 50%; border: 1px solid rgb(255 255 255 / .25); background: rgb(255 255 255 / .08); color: #fff; font-size: 22px; cursor: pointer; }
.lb-prev { left: 12px; } .lb-next { right: 12px; } .lb-close { top: 20px; right: 12px; transform: none; }

/* О нас */
.info-list { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.info { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 14px 16px; }
.info small { color: var(--muted); display: block; font-size: 13px; }
.info b, .info a { font-size: 17px; font-weight: 650; text-decoration: none; }
.about-text { white-space: pre-line; color: var(--muted); max-width: 70ch; padding: 4px 2px 14px; }
.h-sec { font-size: 20px; margin: 4px 0 10px; }
.toast { position: fixed; left: 50%; bottom: calc(var(--tab-h) + 20px); transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 12px 18px; border-radius: var(--radius); z-index: 90; max-width: 90vw; }

/* Быстрый выбор марки и экран успеха */
.brandrow { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 6px; scrollbar-width: none; }
.brandrow::-webkit-scrollbar { display: none; }
.bchip { flex: none; min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1.5px solid var(--line); background: var(--surface-2); font-weight: 600; font-size: 14px; cursor: pointer; transition: background .2s, border-color .2s; }
.bchip:hover { border-color: var(--accent); }
.bchip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.done-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 16px; }
.cats { margin-bottom: 10px; }

/* Работы по разделам */
.wsec { margin-bottom: 26px; }
.wsec[hidden] { display: none; }
.wsec-title { font-size: 18px; margin: 4px 0 10px; letter-spacing: -0.01em; }
.wsec-title .muted { font-size: 14px; font-weight: 500; margin-left: 4px; }

/* На весь экран: формы, шаги и панели больше не прижаты к левому краю */
.form { max-width: none; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); column-gap: 14px; }
.form .row2 { display: contents; }
.form > .field-wide, .form > .quote, .form > .consent, .form > .full, .form > datalist, .form > .alert { grid-column: 1 / -1; }
.form .field textarea { min-height: 84px; }
.stepnav { max-width: none; }
.install { max-width: none; }
.times { max-width: none; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
.info-list { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.about-text { max-width: none; }
.step-cols { display: grid; grid-template-columns: minmax(280px, 380px) minmax(0, 1fr); gap: 18px 28px; align-items: start; }
.step-cols .summary { margin: 0; position: sticky; top: 76px; }
@media (max-width: 899px) { .step-cols { grid-template-columns: minmax(0, 1fr); } .step-cols .summary { position: static; } }
@media (min-width: 900px) { .brandrow.cats { flex-wrap: wrap; overflow: visible; } }
.form-car { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 900px) { .form-car { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 340px) { .form-car { grid-template-columns: minmax(0, 1fr); } }

.field { position: relative; }
.field.hint { margin-bottom: 6px; }
.brandrow.wrap { flex-wrap: wrap; overflow: visible; max-height: 150px; overflow-y: auto; }
.sug { position: absolute; left: 0; right: 0; top: 100%; z-index: 60; margin-top: 4px; max-height: min(260px, 36vh); overflow-y: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.sug button { display: block; width: 100%; text-align: left; padding: 11px 14px; border: 0; background: none; font-size: 15px; cursor: pointer; }
.sug button:hover, .sug button:focus { background: var(--surface-2); }

.brandrow.tall { max-height: 260px; }
.bchip.more { border-style: dashed; color: var(--accent); }
.field[hidden], .sug[hidden] { display: none !important; }
.appbar .btn-sm { white-space: nowrap; flex: none; }
@media (max-width: 480px) { .appbar { gap: 6px; } .appbar .btn-sm { padding: 0 10px; font-size: 13px; min-height: 36px; } .brandmark span { max-width: 18vw; } }
.field input { scroll-margin-top: 76px; }
.quote b { white-space: nowrap; }

.brandmark { -webkit-touch-callout: none; touch-action: manipulation; }
.brandmark.holding { opacity: .6; transition: opacity 1.5s linear; }
/* Узкие экраны: кнопки шага не должны выходить за край */
.stepnav { box-sizing: border-box; max-width: 100%; }
.stepnav .btn { min-width: 0; }
.stepnav .btn-primary { white-space: normal; line-height: 1.15; }
@media (max-width: 360px) { .stepnav { gap: 6px; padding: 6px; } .stepnav .btn { padding: 0 12px; font-size: 15px; } }
.done .btn, .remind .btn { white-space: normal; max-width: 100%; text-align: center; line-height: 1.2; padding-top: 8px; padding-bottom: 8px; }
.remind { margin-top: 12px; text-align: center; }
.info a { display: inline-flex; align-items: center; min-height: 40px; }

.barbtns { display: flex; gap: 8px; flex: none; align-items: center; }
.barbtns [hidden] { display: none; }
@media (max-width: 380px) { .brandmark span { max-width: 14vw; } }
