/* HEIM — сайт heim.run
 * Стиль по бренд-буку HEIM: HEIM Black, Signal White, Concrete Grey, Premium Sand; Montserrat (запасной — Arial).
 * Идея: «жёсткий» слой (сетка-чертёж, фокусная рамка, выноски) + «мягкий» слой сервиса (тёплый свет, скруглённые формы).
 */

@font-face {
  font-family: "Montserrat";
  src: url("/assets/fonts/Montserrat-var.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --black: #000000;          /* HEIM Black */
  --white: #FFFFFF;          /* Signal White */
  --concrete: #8A8D8F;       /* Concrete Grey — линии, сетка, иконки */
  --ink-2: #55585A;          /* вторичный текст: Concrete Grey, затемнённый до контраста 7:1 */
  --line: #E6E6E6;           /* Line Grey из стандарта документов */
  --sand: #CDB371;           /* Premium Sand — акцент сервиса, только заливкой под чёрным текстом */
  --sand-tint: rgba(205, 179, 113, 0.16);
  --sand-ring: rgba(205, 179, 113, 0.55);

  --font: "Montserrat", Arial, "Helvetica Neue", sans-serif;
  --font-head: "Montserrat", "Arial Black", Arial, sans-serif;

  --gutter: clamp(16px, 4vw, 48px);
  --r-sheet: 28px;
  --r-card: 18px;
  --r-field: 14px;
  --ease-lock: cubic-bezier(0.2, 0.8, 0.2, 1);
}

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

html { -webkit-text-size-adjust: 100%; }
html:has(dialog[open]) { overflow: hidden; }

body {
  margin: 0;
  background: var(--white);
  color: var(--black);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.5;
  font-variant-numeric: lining-nums;
  -webkit-font-smoothing: antialiased;
}

[hidden] { display: none !important; }

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

button, input, textarea { font: inherit; color: inherit; }

:focus-visible { outline: 2.5px solid var(--black); outline-offset: 3px; }

.ico { width: 20px; height: 20px; flex: none; }

.muted { color: var(--ink-2); margin: 0; }

/* ---------- Страница ---------- */

.page {
  position: relative;
  isolation: isolate;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  overflow-x: clip;
}

/* Сетка-чертёж, как миллиметровка в бренд-буке */
.page::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background-image:
    linear-gradient(rgba(138, 141, 143, 0.16) 1px, transparent 1px),
    linear-gradient(90deg, rgba(138, 141, 143, 0.16) 1px, transparent 1px),
    linear-gradient(rgba(138, 141, 143, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(138, 141, 143, 0.07) 1px, transparent 1px);
  background-size: 80px 80px, 80px 80px, 16px 16px, 16px 16px;
  background-position: center center;
  -webkit-mask-image: radial-gradient(ellipse 70% 65% at 50% 46%, #000 25%, transparent 88%);
          mask-image: radial-gradient(ellipse 70% 65% at 50% 46%, #000 25%, transparent 88%);
}

/* Тёплый свет: «мягкий» слой поверх «жёсткого» */
.page::after {
  content: "";
  position: fixed;
  z-index: -1;
  width: 80vmax;
  height: 80vmax;
  right: -28vmax;
  top: -34vmax;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(205, 179, 113, 0.30), rgba(205, 179, 113, 0.10) 55%, rgba(205, 179, 113, 0) 100%);
  pointer-events: none;
}

.demo-badge {
  margin: 0;
  padding: 8px var(--gutter);
  background: var(--sand);
  color: var(--black);
  font-size: 0.8rem;
  font-weight: 600;
  text-align: center;
}

/* ---------- Шапка ---------- */

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px var(--gutter);
}

.logo { display: inline-flex; border-radius: 4px; }
.logo-mark { height: 48px; width: 48px; fill: var(--black); }

/* ---------- Кнопки ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  padding: 12px 24px;
  border: 1.5px solid transparent;
  border-radius: 999px;
  font-weight: 700;
  font-size: 1rem;
  line-height: 1.2;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.2s, box-shadow 0.25s, color 0.2s, border-color 0.2s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(0.98); }

.btn-primary { background: var(--black); color: var(--white); }
@media (hover: hover) { .btn-primary:hover { box-shadow: 0 0 0 6px var(--sand-ring); } }
.btn-primary:disabled { background: var(--concrete); box-shadow: none; cursor: not-allowed; transform: none; }

.btn-ghost {
  min-height: 44px;
  padding: 9px 18px;
  font-size: 0.92rem;
  border-color: var(--black);
  background: rgba(255, 255, 255, 0.72);
  -webkit-backdrop-filter: blur(8px);
          backdrop-filter: blur(8px);
}
@media (hover: hover) { .btn-ghost:hover { background: var(--sand-tint); } }

.btn-soft { background: var(--white); border-color: var(--black); font-size: 0.92rem; min-height: 44px; padding: 9px 18px; }
@media (hover: hover) { .btn-soft:hover { background: var(--sand-tint); } }

.btn-quiet { background: transparent; border-color: var(--line); }
.btn-quiet:hover { border-color: var(--black); }

.btn-wide { width: 100%; }

.linklike {
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}

/* ---------- Главный экран ---------- */

.stage {
  position: relative;
  flex: 1;
  display: grid;
  place-items: center;
  padding: 24px var(--gutter) 120px;
}

/* Фокусная рамка: четыре угла, «прицел» на главном действии */
.corner {
  position: absolute;
  width: var(--corner, 44px);
  height: var(--corner, 44px);
  fill: var(--black);
}
.corner.tl { top: 0; left: 0; }
.corner.tr { top: 0; right: 0; rotate: 90deg; }
.corner.br { bottom: 0; right: 0; rotate: 180deg; }
.corner.bl { bottom: 0; left: 0; rotate: 270deg; }

.frame { position: absolute; inset: 0; pointer-events: none; --corner: clamp(28px, 3.4vw, 46px); }
.frame .corner { transition: translate 0.45s var(--ease-lock); }

/* ---------- Подвал ---------- */

.base {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 28px;
  padding: 18px var(--gutter) calc(18px + env(safe-area-inset-bottom));
  background: var(--black);
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.84rem;
}
.base p { margin: 0; }
.base-links { display: flex; flex-wrap: wrap; gap: 6px 22px; }
.base-links a, .base-links .linklike { color: var(--white); }
.base .copy { margin-left: auto; }
.base :focus-visible { outline-color: var(--white); }

@media (max-width: 899px) {
  .stage { padding-bottom: 28px; display: flex; flex-direction: column; align-items: center; gap: 28px; }
  .base .copy { margin-left: 0; }
}

@media (max-width: 559px) {
  .top { padding-top: 16px; padding-bottom: 8px; }
  .logo-mark { height: 42px; width: 42px; }
  .btn-ghost span { font-size: 0.86rem; }
  .stage { padding-top: 8px; }
}

/* ---------- Окна (форма заявки, поддержка) ---------- */

.sheet {
  padding: 0;
  border: 0;
  width: min(600px, 100vw - 32px);
  max-width: none;
  max-height: min(880px, 100vh - 48px);
  max-height: min(880px, 100svh - 48px);
  border-radius: var(--r-sheet);
  background: var(--white);
  color: var(--black);
  box-shadow: 0 32px 90px rgba(0, 0, 0, 0.28);
  overflow: hidden;
}
.sheet-small { width: min(500px, 100vw - 32px); }
.sheet::backdrop { background: rgba(0, 0, 0, 0.42); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.sheet[open] { animation: sheet-in 0.32s var(--ease-lock); }
.sheet[open]::backdrop { animation: fade-in 0.3s ease; }

@keyframes sheet-in { from { opacity: 0; translate: 0 18px; scale: 0.985; } }
@keyframes fade-in { from { opacity: 0; } }

.sheet-inner {
  display: flex;
  flex-direction: column;
  max-height: inherit;
  height: 100%;
}

.sheet-head {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 4px 12px;
  padding: 18px 18px 6px 24px;
}
.sheet-head .sheet-title { margin: 0; }

.progress { display: flex; gap: 6px; margin: 0; padding: 0; list-style: none; grid-column: 1; }
.progress li { flex: 1; height: 4px; border-radius: 2px; background: var(--line); transition: background-color 0.3s; }
.progress li.on { background: var(--black); }
.step-count { grid-column: 1; margin: 6px 0 0; font-size: 0.84rem; color: var(--ink-2); }
.sheet-head .icon-btn { grid-column: 2; grid-row: 1 / span 2; }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
}
.icon-btn:hover { background: var(--sand-tint); }

.sheet-body { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 4px 24px 24px; }

.sheet-title {
  margin: 8px 0 20px;
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 1.6rem;
  line-height: 1.15;
  letter-spacing: -0.015em;
}
.sheet-title:focus { outline: none; }

.sheet-foot {
  display: flex;
  gap: 12px;
  padding: 14px 24px calc(18px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: var(--white);
}
.sheet-foot [data-next] { flex: 1; }

@media (max-width: 559px) {
  .sheet, .sheet-small {
    width: 100vw;
    max-height: calc(100svh - 10px);
    height: calc(100svh - 10px);
    margin: auto 0 0;
    border-radius: 24px 24px 0 0;
  }
  .sheet-small:not(.sheet-chat) { height: fit-content; }
  .sheet[open] { animation: sheet-up 0.36s var(--ease-lock); }
  .sheet-body { padding: 4px 18px 20px; }
  .sheet-head { padding-left: 18px; }
  .sheet-foot { padding-left: 18px; padding-right: 18px; }
  .sheet-title { font-size: 1.4rem; }
}
@keyframes sheet-up { from { translate: 0 100%; } }

/* ---------- Поля ---------- */

.field { margin: 0 0 22px; padding: 0; border: 0; min-width: 0; position: relative; }
.label { display: block; margin: 0 0 8px; padding: 0; font-weight: 600; font-size: 0.9rem; }
.hint { margin: 7px 0 0; font-size: 0.82rem; line-height: 1.45; color: var(--ink-2); }
.hint a { color: var(--black); }

input[type="text"], input[type="tel"], textarea {
  width: 100%;
  padding: 14px 16px;
  border: 1.5px solid var(--line);
  border-radius: var(--r-field);
  background: var(--white);
  font-size: 1rem;
  line-height: 1.4;
  transition: border-color 0.2s, box-shadow 0.2s;
}
textarea { resize: vertical; min-height: 96px; }
@media (hover: hover) { input[type="text"]:hover, input[type="tel"]:hover, textarea:hover { border-color: var(--concrete); } }
input[type="text"]:focus, input[type="tel"]:focus, textarea:focus { outline: none; border-color: var(--black); box-shadow: 0 0 0 4px var(--sand-tint); }
[aria-invalid="true"] { border-color: var(--black) !important; box-shadow: 0 0 0 4px rgba(205, 179, 113, 0.45) !important; }
::placeholder { color: #8F9294; }

.visually-hidden, .cat input, .svc input {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

/* Выбор: мягкая карточка становится «в фокусе» — углы рамки и строгая форма */
.pick {
  position: relative;
  border: 1.5px solid var(--line);
  border-radius: var(--r-card);
  background: var(--white);
  cursor: pointer;
  transition: border-radius 0.3s var(--ease-lock), border-color 0.2s, background-color 0.2s;
}
@media (hover: hover) { .pick:hover { border-color: var(--concrete); } }
.pick.is-on {
  border-color: transparent;
  border-radius: 4px;
  background:
    linear-gradient(var(--black), var(--black)) left top / 16px 3px no-repeat border-box,
    linear-gradient(var(--black), var(--black)) left top / 3px 16px no-repeat border-box,
    linear-gradient(var(--black), var(--black)) right top / 16px 3px no-repeat border-box,
    linear-gradient(var(--black), var(--black)) right top / 3px 16px no-repeat border-box,
    linear-gradient(var(--black), var(--black)) left bottom / 16px 3px no-repeat border-box,
    linear-gradient(var(--black), var(--black)) left bottom / 3px 16px no-repeat border-box,
    linear-gradient(var(--black), var(--black)) right bottom / 16px 3px no-repeat border-box,
    linear-gradient(var(--black), var(--black)) right bottom / 3px 16px no-repeat border-box,
    var(--sand-tint);
}
.pick:has(input:focus-visible) { outline: 2.5px solid var(--black); outline-offset: 3px; }

.cats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cat { display: flex; flex-direction: column; gap: 10px; padding: 16px 18px; font-weight: 700; }
.cat-ico { width: 30px; height: 30px; }

.services { display: grid; gap: 8px; }
.svc {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 14px;
  align-items: baseline;
  padding: 14px 16px;
}
.svc-name { font-weight: 600; }
.svc-price { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.svc-inc { grid-column: 1 / -1; font-size: 0.8rem; color: var(--ink-2); }

.photos { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.photo-add {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 10px 18px;
  border: 1.5px dashed var(--concrete);
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
}
@media (hover: hover) { .photo-add:hover { border-color: var(--black); background: var(--sand-tint); } }
.photo-add:has(input:focus-visible) { outline: 2.5px solid var(--black); outline-offset: 3px; }
.photo-add input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.thumb { position: relative; width: 72px; height: 72px; border-radius: 12px; overflow: hidden; background: var(--line); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .x {
  position: absolute; top: 4px; right: 4px;
  width: 26px; height: 26px; border: 0; border-radius: 50%;
  background: rgba(0, 0, 0, 0.72); color: var(--white);
  display: grid; place-items: center; cursor: pointer;
}
.thumb .x .ico { width: 14px; height: 14px; }
.thumb .state {
  position: absolute; inset: auto 0 0 0; margin: 0; padding: 3px 4px;
  background: rgba(0, 0, 0, 0.72); color: var(--white);
  font-size: 0.66rem; text-align: center; border: 0; cursor: default;
}
.thumb .state.fail { background: var(--sand); color: var(--black); font-weight: 700; cursor: pointer; }


.suggest {
  position: absolute;
  z-index: 5;
  left: 0; right: 0;
  margin: 6px 0 0;
  padding: 6px;
  list-style: none;
  max-height: 260px;
  overflow: auto;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--r-field);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.12);
}
.suggest li { padding: 11px 12px; border-radius: 10px; cursor: pointer; font-size: 0.95rem; }
.suggest li small { display: block; color: var(--ink-2); font-size: 0.8rem; }
.suggest li[aria-selected="true"], .suggest li:hover { background: var(--sand-tint); }

.check { display: flex; gap: 12px; align-items: flex-start; font-size: 0.88rem; line-height: 1.45; cursor: pointer; }
.check input { flex: none; width: 22px; height: 22px; margin: 0; accent-color: var(--black); cursor: pointer; }

/* Итог */
.summary { margin: 0 0 6px; }
.summary div { display: grid; grid-template-columns: 96px 1fr; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.summary dt { color: var(--ink-2); font-size: 0.85rem; }
.summary dd { margin: 0; font-weight: 600; font-size: 0.95rem; overflow-wrap: anywhere; }

.price {
  position: relative;
  margin: 22px 0 14px;
  padding: 28px 16px 26px;
  text-align: center;
  --corner: 26px;
}
.price .corner { transition: translate 0.5s var(--ease-lock), opacity 0.3s; }
.price.is-loading .corner.tl { translate: -10px -10px; opacity: 0.35; }
.price.is-loading .corner.tr { translate: 10px -10px; opacity: 0.35; }
.price.is-loading .corner.br { translate: 10px 10px; opacity: 0.35; }
.price.is-loading .corner.bl { translate: -10px 10px; opacity: 0.35; }
.price-label { margin: 0; font-size: 0.86rem; color: var(--ink-2); }
.price-value {
  margin: 2px 0 0;
  font-family: var(--font-head);
  font-weight: 900;
  font-size: clamp(2.5rem, 2rem + 3vw, 3.4rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.split { margin: 0 0 12px; }
.split div { display: flex; justify-content: space-between; gap: 16px; padding: 12px 14px; border-radius: 12px; }
.split div:first-child { background: var(--sand-tint); }
.split dt { font-size: 0.92rem; }
.split dd { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.timer { font-variant-numeric: tabular-nums; }

/* Готово */
.done { text-align: center; padding-top: 8px; }
.done-mark {
  width: 76px; height: 76px; margin: 4px auto 18px;
  display: grid; place-items: center;
  background:
    linear-gradient(#000, #000) left top / 18px 4px no-repeat,
    linear-gradient(#000, #000) left top / 4px 18px no-repeat,
    linear-gradient(#000, #000) right top / 18px 4px no-repeat,
    linear-gradient(#000, #000) right top / 4px 18px no-repeat,
    linear-gradient(#000, #000) left bottom / 18px 4px no-repeat,
    linear-gradient(#000, #000) left bottom / 4px 18px no-repeat,
    linear-gradient(#000, #000) right bottom / 18px 4px no-repeat,
    linear-gradient(#000, #000) right bottom / 4px 18px no-repeat;
}
.done-mark .ico { width: 36px; height: 36px; }
.done-text { margin: 0 auto; max-width: 34ch; font-size: 1.05rem; }
.done-apps { margin-top: 26px; padding: 16px; border-radius: var(--r-card); background: var(--sand-tint); }
.done-apps p { margin: 0 0 10px; font-weight: 600; font-size: 0.92rem; }
.done-apps .app-links { justify-content: center; }

.form-error {
  margin: 16px 0 0;
  padding: 12px 14px;
  border-left: 3px solid var(--black);
  background: var(--sand-tint);
  font-size: 0.9rem;
  font-weight: 600;
}

/* Поддержка */
.channels { list-style: none; margin: 14px 0 22px; padding: 0; display: grid; gap: 8px; }
.channels:empty { display: none; }
.channel {
  display: flex; align-items: center; gap: 14px;
  padding: 13px 16px;
  border: 1.5px solid var(--line);
  border-radius: 16px;
  text-decoration: none;
}
.channel:hover { border-color: var(--black); background: var(--sand-tint); }
.channel b { display: block; font-size: 0.95rem; }
.channel span { font-size: 0.85rem; color: var(--ink-2); }
.sent { text-align: center; padding: 16px 0 4px; }
.sent p { margin: 0; font-weight: 600; }

/* ---------- Появление ---------- */

@keyframes lock { from { translate: var(--from); opacity: 0; } 60% { opacity: 1; } }
@keyframes appear { from { opacity: 0; } }

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

/* ---------- Простые страницы (документы, 404) ---------- */
.doc { place-items: start center; padding-top: 32px; padding-bottom: 64px; }
.doc-body { width: min(720px, 100%); padding: clamp(24px, 4vw, 48px); background: rgba(255, 255, 255, 0.92); border: 1px solid var(--line); border-radius: var(--r-card); }
.doc-body h1 { margin: 0 0 20px; font-family: var(--font-head); font-weight: 900; font-size: clamp(1.8rem, 1.3rem + 2vw, 2.6rem); line-height: 1.1; letter-spacing: -0.02em; }
.doc-body p { max-width: 68ch; }
.doc-note { padding: 12px 14px; border-left: 3px solid var(--black); background: var(--sand-tint); font-weight: 600; }

[data-hours] { margin-bottom: 18px; }

/* ---------- Чат поддержки ---------- */
.sheet-chat { height: min(700px, 100vh - 48px); height: min(700px, 100svh - 48px); }
.sheet-chat .sheet-head .step-count { grid-column: 1; margin: 2px 0 0; }
.chat-body { display: flex; flex-direction: column; gap: 12px; padding-top: 8px; }
.chat-intro p { margin: 0 0 12px; color: var(--ink-2); font-size: 0.92rem; }
.chat-intro .channels { margin: 0; }
.chat-log { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.msg { max-width: 82%; padding: 10px 14px; border-radius: 18px; font-size: 0.95rem; line-height: 1.4; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg time { display: block; margin-top: 3px; font-size: 0.72rem; opacity: 0.7; font-variant-numeric: tabular-nums; }
.msg.client { align-self: flex-end; background: var(--black); color: var(--white); border-bottom-right-radius: 6px; }
.msg.staff { align-self: flex-start; background: var(--sand-tint); border: 1px solid rgba(205, 179, 113, 0.45); border-bottom-left-radius: 6px; }
.msg.staff b { display: block; font-size: 0.75rem; font-weight: 700; margin-bottom: 2px; }
.msg.system { align-self: center; max-width: 100%; padding: 2px 8px; background: none; color: var(--ink-2); font-size: 0.8rem; text-align: center; }
.msg.pending { opacity: 0.6; }
.chat-compose { padding: 10px 24px calc(14px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--white); }
.chat-extra { display: grid; grid-template-columns: 1fr 1.4fr; gap: 8px; margin-bottom: 8px; }
.chat-extra input { padding: 10px 14px; font-size: 0.92rem; }
.chat-row { display: flex; gap: 8px; align-items: flex-end; }
.chat-row textarea { min-height: 48px; max-height: 160px; resize: none; padding: 12px 16px; border-radius: 24px; }
.chat-send { flex: none; width: 48px; min-height: 48px; padding: 0; }
.chat-meta { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 16px; margin-top: 8px; }
.chat-meta .hint { margin: 0; }
.tg-link { display: inline-flex; align-items: center; gap: 6px; font-size: 0.85rem; font-weight: 700; text-decoration: none; padding: 6px 0; }
.tg-link .ico { width: 18px; height: 18px; }
@media (hover: hover) { .tg-link:hover span { text-decoration: underline; text-underline-offset: 3px; } }
.btn-ghost { position: relative; }
.unread { position: absolute; top: 6px; right: 8px; width: 9px; height: 9px; border-radius: 50%; background: var(--sand); box-shadow: 0 0 0 2px var(--white); }
@media (max-width: 559px) {
  .sheet-chat { height: calc(100svh - 10px); }
  .chat-compose { padding-left: 14px; padding-right: 14px; }
  .chat-extra { grid-template-columns: 1fr; }
}

/* ---------- Вход через Яндекс ID ---------- */

.login-body { display: grid; gap: 14px; padding-top: 6px; }
.login-lead { margin: 0; line-height: 1.55; color: var(--ink-2); }
.btn-wide { width: 100%; }
.ya-mark {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #fc3f1d;
  color: #fff;
  font-weight: 800;
  font-size: 0.95rem;
  line-height: 1;
}
.login-body .hint { margin: 0; }
.account-row { margin: -4px 0 14px; font-size: 0.85rem; color: var(--ink-2); }
.account-row b { color: var(--black); font-weight: 700; }
input[readonly] { background: var(--paper, #f4f4f2); color: var(--ink-2); cursor: default; }

/* Квартира, подъезд, этаж, домофон — четыре отдельных поля */
.flat-fields legend { padding: 0; }
.flat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 0 0 14px; }
.flat-grid > div { min-width: 0; }
.sub-label { display: block; margin: 0 0 6px; font-size: 0.8rem; font-weight: 600; color: var(--ink-2); }
.check-small { font-size: 0.9rem; align-items: center; }
.flat-grid input:disabled { background: var(--sand-tint); color: var(--ink-2); cursor: not-allowed; }
@media (min-width: 640px) { .flat-grid { grid-template-columns: repeat(4, 1fr); } }

/* =====================================================================
   Главная: карта на весь экран — фон сайта. Поверх неё: шапка, карточка «Оставить заявку»
   и панель слева (вход, форма заявки). Страница не прокручивается.
   ===================================================================== */

html:has(body.home) { height: 100%; overflow: hidden; }
body.home { height: 100%; overflow: hidden; background: #F3F1EA; }

.map-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  --pad-l: 0px;
  --pad-b: 0px;
  /* Пока карта не загрузилась (или файлов карты нет), фоном остаётся сетка-чертёж из бренд-бука */
  background-color: #F3F1EA;
  background-image:
    linear-gradient(rgba(138, 141, 143, 0.16) 1px, transparent 1px),
    linear-gradient(90deg, rgba(138, 141, 143, 0.16) 1px, transparent 1px),
    linear-gradient(rgba(138, 141, 143, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(138, 141, 143, 0.07) 1px, transparent 1px);
  background-size: 80px 80px, 80px 80px, 16px 16px, 16px 16px;
  background-position: center;
}
.map-bg .map-canvas { position: absolute; inset: 0; opacity: 0; transition: opacity 0.6s ease; }
.home.has-map .map-bg .map-canvas { opacity: 1; }
.map-bg .maplibregl-ctrl-bottom-right { z-index: 2; }
.map-bg .maplibregl-ctrl-attrib { font-size: 0.68rem; }
.map-bg .maplibregl-canvas { outline: none; }

/* Булавка стоит по центру свободной области (не под панелью): остриё — ровно в центре, двигается сама карта */
.map-pin {
  position: absolute;
  z-index: 3;
  width: 34px;
  height: 43px;
  left: calc(var(--pad-l) + (100% - var(--pad-l)) / 2);
  top: calc((100% - var(--pad-b)) / 2);
  translate: -50% -100%;
  fill: var(--black);
  filter: drop-shadow(0 6px 6px rgba(0, 0, 0, 0.22));
  opacity: 0;
  pointer-events: none;
}
.home.has-map.picking .map-pin { opacity: 1; animation: pin-drop 0.45s var(--ease-lock); }
@keyframes pin-drop { from { translate: -50% calc(-100% - 22px); opacity: 0; } }

.home .page {
  position: fixed;
  inset: 0;
  z-index: 1;
  display: block;
  min-height: 0;
  overflow: hidden;
  pointer-events: none;
}
.home .page::before, .home .page::after { display: none; }
.home .page > * { pointer-events: none; }
.home .page button, .home .page a, .home .intro, .home .acct-menu, .home .apps, .home .base { pointer-events: auto; }

.home .demo-badge {
  position: absolute;
  top: 8px;
  left: 50%;
  translate: -50% 0;
  z-index: 6;
  max-width: calc(100vw - 24px);
  padding: 4px 14px;
  border-radius: 999px;
  font-size: 0.72rem;
  text-align: center;
  pointer-events: auto;
}

/* ---------- Шапка ---------- */

.home .top {
  position: absolute;
  inset: 0 0 auto 0;
  z-index: 5;
  align-items: flex-start;
  padding: 16px 20px;
}
.home .logo {
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.14);
}
.home .logo-mark { width: 36px; height: 36px; }

.top-right { display: flex; align-items: center; gap: 8px; position: relative; }

.pill {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 44px;
  height: 44px;
  padding: 0 14px;
  border: 1.5px solid var(--black);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.95);
  -webkit-backdrop-filter: blur(8px);
          backdrop-filter: blur(8px);
  font-weight: 700;
  font-size: 0.9rem;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
  transition: background-color 0.2s;
  -webkit-tap-highlight-color: transparent;
}
@media (hover: hover) { .pill:hover { background: #FBF6E8; } }
.pill .unread { position: absolute; top: 6px; right: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--sand); border: 2px solid var(--black); }
.pill-short { display: none; }

/* Приложения: компактные иконки площадок */
.apps {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px 4px 14px;
  border: 1.5px solid var(--black);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.95);
  -webkit-backdrop-filter: blur(8px);
          backdrop-filter: blur(8px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
}
.app-group { display: flex; align-items: center; gap: 8px; }
.app-group + .app-group { margin-left: 8px; padding-left: 12px; border-left: 1px solid var(--line); }
.app-name { font-size: 0.78rem; font-weight: 700; }
.app-links { display: inline-flex; gap: 5px; }
.store {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1.5px solid var(--black);
  border-radius: 50%;
  background: var(--white);
  color: var(--black);
  text-decoration: none;
  transition: background-color 0.2s, color 0.2s;
}
.store .ico { width: 18px; height: 18px; }
a.store:hover { background: var(--black); color: var(--white); }
.store.soon { border-style: dashed; border-color: var(--concrete); color: var(--ink-2); cursor: default; }
.store small { display: none; }
.top .store-label {
  position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}
/* в окне «Готово» площадки — с подписями */
.done-apps .store { display: inline-flex; align-items: center; gap: 6px; width: auto; height: auto; padding: 6px 12px; border-radius: 999px; font-size: 0.8rem; font-weight: 700; }
.done-apps .store small { display: inline; font-size: 0.72rem; font-weight: 500; }
.apps-toggle { display: none; padding: 0; }

/* Аккаунт */
.acct { position: relative; }
.acct-btn { padding: 0 14px 0 4px; }
.avatar { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--black); color: var(--white); font-weight: 800; font-size: 0.92rem; }
.acct-name { max-width: 13ch; overflow: hidden; text-overflow: ellipsis; }
.acct-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 8;
  width: min(300px, calc(100vw - 32px));
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--white);
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.22);
  animation: appear 0.18s ease both;
}
.acct-head { display: flex; flex-direction: column; gap: 2px; margin: 0; padding: 10px 10px 4px; }
.acct-head b { font-size: 1rem; }
.acct-head span { font-size: 0.86rem; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.acct-note { margin: 0; padding: 4px 10px 10px; font-size: 0.78rem; line-height: 1.45; color: var(--ink-2); border-bottom: 1px solid var(--line); }
.menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%; margin-top: 4px; padding: 11px 10px;
  border: 0; border-radius: 12px; background: none; font-weight: 600; font-size: 0.92rem; text-align: left; cursor: pointer;
}
.menu-item:hover { background: var(--sand-tint); }
.menu-item .ico { width: 20px; height: 20px; }

/* ---------- Стартовая карточка ---------- */

.home .intro-wrap {
  position: absolute;
  left: 20px;
  top: 50%;
  translate: 0 -48%;
  width: min(400px, calc(100vw - 40px));
}
.home .intro {
  position: relative;
  padding: 34px 30px 28px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.95);
  -webkit-backdrop-filter: blur(10px);
          backdrop-filter: blur(10px);
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.16);
}
.home .intro .frame { position: absolute; inset: -9px; pointer-events: none; --corner: 30px; }
.home .intro h1 {
  margin: 0 0 12px;
  font-family: var(--font-head);
  font-weight: 900;
  font-size: clamp(1.9rem, 1.3rem + 1.5vw, 2.4rem);
  line-height: 1.04;
  letter-spacing: -0.025em;
  text-wrap: balance;
}
.home .lead { margin: 0; font-size: 1.02rem; line-height: 1.5; color: var(--ink-2); text-wrap: pretty; }
.home .btn-cta { width: 100%; margin-top: 22px; min-height: 58px; padding: 16px 24px; font-size: 1.05rem; }
.home .fee-note { margin: 12px 0 0; font-size: 0.82rem; color: var(--ink-2); }
.home .fee-note span { color: var(--black); font-weight: 700; font-variant-numeric: tabular-nums; }
.home .facts { display: flex; flex-wrap: wrap; gap: 6px; margin: 18px 0 0; padding: 0; list-style: none; }
.home .facts li { padding: 5px 11px; border: 1px solid var(--line); border-radius: 999px; font-size: 0.76rem; font-weight: 600; }
.home.has-panel .intro-wrap { display: none; }
@media (prefers-reduced-motion: no-preference) {
  .js.home .intro { animation: appear 0.6s ease both; }
}

/* ---------- Подвал: тонкая строка ---------- */

.home .base {
  position: absolute;
  left: 20px;
  bottom: 12px;
  z-index: 4;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 14px;
  max-width: calc(100vw - 280px);
  padding: 6px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.9);
  -webkit-backdrop-filter: blur(6px);
          backdrop-filter: blur(6px);
  color: var(--ink-2);
  font-size: 0.72rem;
  line-height: 1.4;
}
.home .base .base-links { gap: 2px 14px; }
.home .base-links a, .home .base-links .linklike { color: var(--black); }
.home .base .copy { margin-left: 0; }
.home .base :focus-visible { outline-color: var(--black); }

/* ---------- Панели слева: вход и заявка ---------- */

.sheet-side {
  position: fixed;
  inset: 88px auto 52px 20px;
  z-index: 30;
  width: min(420px, calc(100vw - 40px));
  height: auto;
  max-height: none;
  margin: 0;
  border-radius: 22px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.24);
}
#login-sheet.sheet-side { bottom: auto; }
.sheet-side[open] { animation: side-in 0.34s var(--ease-lock); }
@keyframes side-in { from { opacity: 0; translate: -28px 0; } }
.sheet-side .sheet-title { margin-top: 6px; }

.place-box { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; margin: 0 0 22px; }
.place-box .btn { white-space: nowrap; }
.map-text { margin: 0; font-size: 0.84rem; line-height: 1.45; color: var(--ink-2); }
.place-box.is-set .map-text { color: var(--black); font-weight: 600; }

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

@media (max-width: 719px) {
  .home .top { padding: 10px 12px; }
  .home .logo { width: 48px; height: 48px; border-radius: 14px; }
  .home .logo-mark { width: 31px; height: 31px; }
  .top-right { gap: 6px; }
  .pill { height: 42px; padding: 0 12px; }
  .pill-text .pill-label { display: none; }
  .pill-text .pill-short { display: inline; }
  [data-open="support"] .pill-short { display: none; }
  .acct-name { display: none; }
  .acct-btn { padding: 0 4px; }
  .apps-toggle { display: inline-flex; }
  .apps {
    display: none;
    position: absolute;
    top: 50px;
    right: 0;
    z-index: 8;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 18px;
    box-shadow: 0 22px 60px rgba(0, 0, 0, 0.22);
  }
  .apps.open { display: flex; }
  .app-group { justify-content: space-between; gap: 18px; }
  .app-group + .app-group { margin: 0; padding: 10px 0 0; border: 0; border-top: 1px solid var(--line); }

  .home .intro-wrap { left: 12px; right: 12px; top: auto; bottom: 44px; width: auto; translate: none; }
  .home .intro { padding: 20px 18px 18px; border-radius: 20px; }
  .home .intro .frame { display: none; }
  .home .intro h1 { font-size: 1.55rem; margin-bottom: 0; }
  .home .lead, .home .facts { display: none; }
  .home .btn-cta { margin-top: 14px; min-height: 54px; }
  .home .fee-note { margin-top: 10px; text-align: center; }

  .home .base { left: 12px; right: 12px; bottom: 8px; max-width: none; justify-content: center; text-align: center; padding: 4px 8px; background: transparent; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
  .home .base [data-company] { display: none; }
  .map-bg .maplibregl-ctrl-group { display: none; }

  .sheet-side {
    inset: auto 0 0 0;
    width: auto;
    height: min(78svh, 680px);
    border-radius: 24px 24px 0 0;
  }
  .home.picking #order-sheet.sheet-side { height: min(56svh, 500px); }
  #login-sheet.sheet-side { height: auto; }
  .sheet-side[open] { animation: sheet-up 0.36s var(--ease-lock); }
}

@media (max-height: 640px) and (min-width: 720px) {
  .sheet-side { top: 76px; bottom: 44px; }
  .home .intro { padding: 22px 24px 20px; }
  .home .facts { display: none; }
}

/* ---------- О компании ---------- */
.company-body { padding-bottom: 28px; }
.company-card { display: flex; align-items: center; gap: 14px; margin: 0 0 16px; padding: 14px; border-radius: var(--r-card); background: var(--sand-tint); }
.company-logo { flex: none; width: 52px; height: 52px; fill: var(--black); }
.company-name { margin: 0; font-weight: 800; font-size: 1.05rem; letter-spacing: 0.01em; }
.company-brand { margin: 2px 0 0; font-size: 0.82rem; color: var(--ink-2); }
.company-about p { margin: 0 0 10px; font-size: 0.95rem; line-height: 1.55; }
.company-points { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 20px; padding: 0; list-style: none; }
.company-points li { padding: 5px 11px; border: 1px solid var(--line); border-radius: 999px; font-size: 0.78rem; font-weight: 600; }
.company-sub { margin: 0 0 8px; font-size: 0.9rem; font-weight: 700; }
.reqs { margin: 0; border-top: 1px solid var(--line); }
.reqs div { display: grid; grid-template-columns: 11rem 1fr; gap: 4px 12px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 0.86rem; }
.reqs dt { color: var(--ink-2); }
.reqs dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.company-docs { display: flex; flex-direction: column; gap: 6px; margin-top: 18px; font-size: 0.86rem; }
@media (max-width: 559px) { .reqs div { grid-template-columns: 1fr; gap: 2px; } }
@media (max-width: 719px) { .home .base [data-open="company"] { font-weight: 600; } }
