/* Jauap. Палитра: «ночная квартира с включённым светом» — тёмно-зелёные чернила, шалфейный фон, малахит для действий, янтарь для «нужен владелец». */
:root {
  --ink: #14201b;
  --ink-2: #47554f;
  --ink-3: #7b8882;
  --bg: #eef1ec;
  --surface: #ffffff;
  --line: #dbe1da;
  --accent: #1f7a5c;
  --accent-ink: #0f5a42;
  --accent-soft: #dff1e8;
  --mint: #57d6a4;
  --amber: #b9770a;
  --amber-soft: #fbf0d7;
  --danger: #b93a26;
  --danger-soft: #fbe6e1;
  --r-s: 8px; --r-m: 14px; --r-l: 22px;
  --font: 'Golos Text', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 16px/1.5 var(--font); }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(26px, 4.2vw, 38px); line-height: 1.12; font-weight: 700; letter-spacing: -0.02em; }
h2 { font-size: 20px; line-height: 1.25; font-weight: 600; letter-spacing: -0.01em; }
h3 { font-size: 16px; font-weight: 600; }
a { color: var(--accent-ink); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.muted { color: var(--ink-2); }
.small { font-size: 14px; }
.boot { min-height: 100vh; display: grid; place-items: center; }
.boot-note { color: var(--ink-3); }

/* ---------- каркас ---------- */
.shell { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }
.rail { background: var(--ink); color: #e9efe9; padding: 22px 14px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 20px; letter-spacing: -0.02em; padding: 4px 10px 20px; }
.brand svg { flex: none; display: block; }
.logo { display: inline-flex; }
.nav-btn { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border: 0; border-radius: var(--r-s); background: none; color: #b9c6bf; text-align: left; cursor: pointer; font-weight: 500; }
.nav-btn:hover { color: #fff; background: rgba(255,255,255,.06); }
.nav-btn[aria-current="page"] { background: #24352d; color: #fff; }
.nav-btn .count { margin-left: auto; background: #e8a317; color: #231a02; font-size: 12px; font-weight: 700; border-radius: 99px; padding: 1px 7px; }
.rail-foot { margin-top: auto; padding: 12px 10px 0; font-size: 13px; color: #94a39b; border-top: 1px solid #2a3b33; }
.rail-foot b { color: #e9efe9; font-weight: 600; display: block; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: #6b7872; display: inline-block; flex: none; }
.dot.on { background: var(--mint); box-shadow: 0 0 0 4px rgba(87,214,164,.18); }
.dot.wait { background: #e8a317; }
.dot.off { background: #d9644f; }
main { padding: 36px clamp(18px, 4vw, 52px) 80px; max-width: 1040px; width: 100%; }
.page-head { margin-bottom: 26px; display: flex; gap: 16px; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; }
.page-head p { margin-top: 8px; max-width: 62ch; color: var(--ink-2); }

@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .rail { position: fixed; inset: auto 0 0 0; height: auto; flex-direction: row; padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); z-index: 20; gap: 2px; }
  .rail .brand, .rail-foot { display: none; }
  .nav-btn { flex-direction: column; gap: 2px; font-size: 11px; padding: 7px 2px; text-align: center; justify-content: center; position: relative; }
  .nav-btn .count { position: absolute; top: 1px; right: 4px; margin: 0; font-size: 10px; padding: 0 5px; }
  main { padding: 22px 16px 110px; }
}

/* ---------- поверхности ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m); padding: 22px; }
.card + .card, .stack > * + * { margin-top: 16px; }
.card h2 { margin-bottom: 6px; }
.card .lead { color: var(--ink-2); margin-bottom: 16px; max-width: 64ch; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
@media (max-width: 640px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

/* ---------- кнопки и поля ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: var(--r-s); border: 1px solid var(--line); background: var(--surface); font-weight: 600; cursor: pointer; text-decoration: none; color: var(--ink); }
.btn:hover { border-color: var(--ink-3); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-ink); }
.btn.danger { color: var(--danger); }
.btn.ghost { border-color: transparent; background: none; color: var(--accent-ink); padding: 0 10px; }
.btn.sm { min-height: 34px; padding: 0 12px; font-size: 14px; }
.btn:disabled { opacity: .55; cursor: default; }
label.field { display: block; }
label.field > span { display: block; font-weight: 500; font-size: 14px; margin-bottom: 6px; }
label.field > small { display: block; color: var(--ink-3); font-size: 13px; margin-top: 5px; line-height: 1.35; }
input[type=text], input[type=tel], input[type=url], input[type=password], textarea, select {
  width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: var(--r-s); background: #fbfcfa; }
textarea { min-height: 96px; resize: vertical; line-height: 1.45; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); background: #fff; }
input[type=range] { width: 100%; accent-color: var(--accent); }

.switch { position: relative; display: inline-flex; align-items: center; gap: 12px; cursor: pointer; font-weight: 500; }
.switch input { position: absolute; opacity: 0; width: 52px; height: 30px; margin: 0; cursor: pointer; }
.switch i { width: 52px; height: 30px; border-radius: 99px; background: #c6cec7; position: relative; transition: background .15s; flex: none; }
.switch i::after { content: ''; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch input:checked + i { background: var(--accent); }
.switch input:checked + i::after { transform: translateX(22px); }
.switch input:focus-visible + i { outline: 2px solid var(--accent); outline-offset: 2px; }

.choice { display: grid; gap: 10px; }
.choice label { display: flex; gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: var(--r-s); cursor: pointer; align-items: flex-start; }
.choice label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.choice input { margin-top: 4px; accent-color: var(--accent); }
.choice b { font-weight: 600; display: block; }
.choice span { color: var(--ink-2); font-size: 14px; }

.tag { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 500; padding: 3px 10px; border-radius: 99px; background: #e7ebe6; color: var(--ink-2); white-space: nowrap; }
.tag.ok { background: var(--accent-soft); color: var(--accent-ink); }
.tag.warn { background: var(--amber-soft); color: #7a4d00; }
.tag.bad { background: var(--danger-soft); color: var(--danger); }
.notice { border-radius: var(--r-s); padding: 12px 14px; background: var(--amber-soft); color: #5c3b00; font-size: 15px; }
.notice.bad { background: var(--danger-soft); color: #7d2415; }
.notice.ok { background: var(--accent-soft); color: var(--accent-ink); }

/* ---------- подключение ---------- */
.connect { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: clamp(20px, 4vw, 56px); align-items: center; background: var(--ink); color: #eef3ee; border-radius: var(--r-l); padding: clamp(22px, 4vw, 48px); }
.connect h1 { color: #fff; }
.connect .sub { color: #b9c6bf; margin-top: 14px; max-width: 46ch; font-size: 17px; }
.steps { list-style: none; counter-reset: s; padding: 0; margin: 26px 0 0; display: grid; gap: 14px; }
.steps li { counter-increment: s; display: grid; grid-template-columns: 30px 1fr; gap: 12px; align-items: start; color: #dbe5de; }
.steps li::before { content: counter(s); width: 30px; height: 30px; border-radius: 50%; border: 1px solid #3d5247; display: grid; place-items: center; font-weight: 600; font-size: 14px; color: var(--mint); }
.steps b { color: #fff; font-weight: 600; }
.qr-box { background: #fff; color: var(--ink); border-radius: var(--r-m); padding: 18px; text-align: center; }
.qr-box img { width: 100%; aspect-ratio: 1; display: block; image-rendering: pixelated; border-radius: 6px; }
.qr-ph { width: 100%; aspect-ratio: 1; display: grid; place-items: center; background: #f1f4f0; border-radius: 6px; color: var(--ink-3); padding: 20px; text-align: center; gap: 12px; align-content: center; }
.qr-cap { font-size: 13px; color: var(--ink-3); margin-top: 10px; }
.spinner { width: 28px; height: 28px; border: 3px solid #d5dcd5; border-top-color: var(--accent); border-radius: 50%; animation: spin .9s linear infinite; margin: 0 auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.code { font-size: 30px; font-weight: 700; letter-spacing: .12em; padding: 14px; background: #f1f4f0; border-radius: var(--r-s); text-align: center; font-variant-numeric: tabular-nums; }
.connect .alt { margin-top: 22px; color: #b9c6bf; font-size: 15px; }
.connect .alt button { color: var(--mint); background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; font-weight: 500; }
.promise { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 16px; }
.promise div { padding: 18px; border-radius: var(--r-m); background: var(--surface); border: 1px solid var(--line); }
.promise b { display: block; margin-bottom: 4px; }
.promise span { color: var(--ink-2); font-size: 15px; }
@media (max-width: 820px) { .connect { grid-template-columns: 1fr; } .qr-box { max-width: 340px; margin: 0 auto; width: 100%; } .promise { grid-template-columns: 1fr; } }

/* ---------- главная ---------- */
.status { background: var(--ink); color: #eef3ee; border-radius: var(--r-l); padding: clamp(20px, 3.4vw, 34px); display: flex; gap: 20px; justify-content: space-between; align-items: center; flex-wrap: wrap; }
.status h1 { color: #fff; max-width: 20ch; }
.status p { color: #b9c6bf; margin-top: 10px; }
.status .switch { color: #fff; }
.status .switch i { background: #4a5c53; }
.facts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--r-m); overflow: hidden; }
.facts div { background: var(--surface); padding: 16px 18px; }
.facts b { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; display: block; line-height: 1.15; }
.facts span { color: var(--ink-2); font-size: 14px; }
@media (max-width: 640px) { .facts { grid-template-columns: 1fr 1fr; } }
.todo { list-style: none; padding: 0; margin: 0; }
.todo li { display: flex; gap: 12px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line); }
.todo li:first-child { border-top: 0; padding-top: 0; }
.todo .mark { width: 22px; height: 22px; border-radius: 50%; border: 2px solid #b9c3bb; flex: none; display: grid; place-items: center; font-size: 13px; color: #fff; }
.todo .done .mark { background: var(--accent); border-color: var(--accent); }
.todo .done .t { color: var(--ink-3); }
.todo .t { flex: 1; }

/* ---------- квартиры ---------- */
.apt { display: grid; grid-template-columns: 92px 1fr auto; gap: 16px; align-items: center; }
.apt .thumb { width: 92px; height: 72px; border-radius: var(--r-s); background: #e3e8e2 center/cover; display: grid; place-items: center; color: var(--ink-3); font-size: 12px; }
.apt .meta { color: var(--ink-2); font-size: 14px; margin-top: 2px; }
@media (max-width: 560px) { .apt { grid-template-columns: 64px 1fr; } .apt .thumb { width: 64px; height: 56px; } .apt .actions { grid-column: 1 / -1; } }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; }
.photo { position: relative; aspect-ratio: 4/3; border-radius: var(--r-s); background: #e3e8e2 center/cover; }
.photo button { position: absolute; top: 5px; right: 5px; width: 28px; height: 28px; border-radius: 50%; border: 0; background: rgba(20,32,27,.78); color: #fff; cursor: pointer; font-size: 16px; line-height: 1; }
.drop { aspect-ratio: 4/3; border: 1.5px dashed #aab5ad; border-radius: var(--r-s); display: grid; place-items: center; text-align: center; color: var(--ink-2); font-size: 13px; cursor: pointer; padding: 6px; }
.drop:hover { border-color: var(--accent); color: var(--accent-ink); }
fieldset { border: 0; padding: 0; margin: 0; }
legend { font-weight: 600; font-size: 17px; padding: 0; margin-bottom: 12px; }
.form-sec + .form-sec { margin-top: 26px; padding-top: 24px; border-top: 1px solid var(--line); }
.savebar { position: sticky; bottom: 0; background: linear-gradient(transparent, var(--bg) 30%); padding: 22px 0 14px; display: flex; gap: 10px; align-items: center; z-index: 5; }
@media (max-width: 820px) { .savebar { bottom: 62px; } }

/* ---------- диалоги и проверка ---------- */
.chat-list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m); overflow: hidden; }
.chat-item { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 14px 18px; border: 0; border-top: 1px solid var(--line); background: none; width: 100%; text-align: left; cursor: pointer; }
.chat-item:first-child { border-top: 0; }
.chat-item:hover { background: #f6f8f5; }
.chat-item.attn { box-shadow: inset 4px 0 0 #e8a317; }
.chat-item .who { font-weight: 600; }
.chat-item .last { color: var(--ink-2); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; grid-column: 1; }
.chat-item time { color: var(--ink-3); font-size: 13px; }
.thread { display: flex; flex-direction: column; gap: 8px; padding: 18px; background: #e6ebe4; border-radius: var(--r-m); min-height: 220px; max-height: 58vh; overflow-y: auto; }
.msg { max-width: min(78%, 520px); padding: 9px 13px; border-radius: 14px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 15px; line-height: 1.4; }
.msg.guest { background: #fff; align-self: flex-start; border-bottom-left-radius: 4px; }
.msg.bot { background: #d3f0e1; align-self: flex-end; border-bottom-right-radius: 4px; }
.msg.owner { background: #fde9bf; align-self: flex-end; border-bottom-right-radius: 4px; }
.msg small { display: block; font-size: 11px; color: var(--ink-3); margin-top: 3px; }
.msg.sys { align-self: center; background: none; color: var(--ink-2); font-size: 13px; padding: 2px; }
.msg .pics { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.msg .pics img { width: 84px; height: 64px; object-fit: cover; border-radius: 6px; }
.composer { display: flex; gap: 10px; margin-top: 12px; }
.composer input { flex: 1; }
.empty { text-align: center; padding: 44px 20px; color: var(--ink-2); }
.empty h2 { color: var(--ink); margin-bottom: 8px; }
.empty .btn { margin-top: 16px; }

/* ---------- первая настройка ---------- */
.wizard { max-width: 560px; margin: 0 auto; padding: 18px 18px 120px; min-height: 100vh; }
.wiz-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.wiz-top .brand { padding: 0; font-size: 19px; }
.wiz-count { font-size: 14px; color: var(--ink-2); font-weight: 500; font-variant-numeric: tabular-nums; }
.wiz-bar { height: 6px; border-radius: 99px; background: #d5dcd5; overflow: hidden; margin-bottom: clamp(22px, 5vw, 38px); }
.wiz-bar i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--accent), var(--mint)); animation: bar .5s cubic-bezier(.2,.8,.2,1) both; }
@keyframes bar { from { width: var(--from); } }
.wiz-step h1 { font-size: clamp(27px, 7vw, 36px); margin-bottom: 10px; }
.wiz-step .lead { color: var(--ink-2); font-size: 17px; margin-bottom: 24px; max-width: 46ch; }
.wiz-step.fwd { animation: inR .34s cubic-bezier(.2,.8,.2,1) both; }
.wiz-step.back { animation: inL .34s cubic-bezier(.2,.8,.2,1) both; }
@keyframes inR { from { opacity: 0; transform: translateX(34px); } }
@keyframes inL { from { opacity: 0; transform: translateX(-34px); } }
.wiz-step .stack > * + * { margin-top: 18px; }
.wiz-step .field > span { font-size: 15px; font-weight: 600; display: block; margin-bottom: 8px; }
.wiz-step input[type=text], .wiz-step input[type=time], .wiz-step textarea { font-size: 18px; padding: 14px; border-radius: 12px; background: #fff; border-color: #cfd7cf; }
.wiz-step input[type=time] { width: 100%; border: 1px solid #cfd7cf; min-height: 54px; }
.wiz-step .grid-2.keep { grid-template-columns: 1fr 1fr; }
.money { position: relative; }
.money input { font-size: 30px !important; font-weight: 700; letter-spacing: -0.01em; padding-right: 48px !important; font-variant-numeric: tabular-nums; }
.money b { position: absolute; right: 16px; top: 50%; transform: translateY(-50%); font-size: 26px; color: var(--ink-3); }
.stepper { display: inline-flex; align-items: center; gap: 4px; background: #fff; border: 1px solid #cfd7cf; border-radius: 12px; padding: 5px; }
.stepper button { width: 46px; height: 46px; border: 0; border-radius: 9px; background: var(--accent-soft); color: var(--accent-ink); font-size: 24px; font-weight: 600; cursor: pointer; line-height: 1; }
.stepper button:active { transform: scale(.94); }
.stepper output { min-width: 56px; text-align: center; font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 4px; }
.chip { border: 1px solid #c9d2ca; background: #fff; border-radius: 99px; padding: 10px 15px; font-size: 15px; font-weight: 500; cursor: pointer; color: var(--ink); transition: background .15s, border-color .15s, transform .15s; text-align: left; }
.chip:active { transform: scale(.96); }
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip.on::before { content: '✓ '; }
.photos.big { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
.photos.big .photo { animation: pop .3s cubic-bezier(.2,.8,.2,1) both; }
@keyframes pop { from { opacity: 0; transform: scale(.85); } }
.drop b { display: block; font-size: 30px; font-weight: 400; line-height: 1; color: var(--accent); }
.drop.first { grid-column: 1 / -1; aspect-ratio: auto; padding: 44px 16px; font-size: 16px; font-weight: 600; background: #fff; border-radius: var(--r-m); }
.wiz-foot { position: fixed; left: 0; right: 0; bottom: 0; padding: 12px 18px calc(12px + env(safe-area-inset-bottom)); background: linear-gradient(transparent, var(--bg) 28%); display: flex; gap: 10px; justify-content: space-between; align-items: center; max-width: 560px; margin: 0 auto; z-index: 10; }
.wiz-foot .btn { min-height: 54px; border-radius: 14px; }
.btn.big { min-height: 54px; padding: 0 26px; font-size: 17px; border-radius: 14px; flex: 1; max-width: 340px; margin-left: auto; }
.shake { animation: shake .35s; border-color: var(--danger) !important; }
@keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.wiz-done { text-align: center; padding-top: 12vh; display: grid; justify-items: center; gap: 14px; }
.wiz-done .lead { color: var(--ink-2); max-width: 36ch; font-size: 17px; margin-bottom: 10px; }
.wiz-done .btn.big { margin: 0; width: 100%; }
.tick svg { width: 96px; height: 96px; fill: none; stroke-width: 3.5; stroke-linecap: round; stroke-linejoin: round; }
.tick circle { stroke: var(--accent); fill: var(--accent-soft); stroke-dasharray: 151; stroke-dashoffset: 151; animation: draw .6s ease-out forwards; }
.tick path { stroke: var(--accent-ink); stroke-dasharray: 36; stroke-dashoffset: 36; animation: draw .35s .45s ease-out forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
details.more summary { cursor: pointer; font-weight: 600; font-size: 17px; }

/* ---------- брони и знания ---------- */
.bk-list { list-style: none; padding: 0; margin: 14px 0 0; }
.bk { display: grid; grid-template-columns: 150px 1fr auto; gap: 8px 14px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line); }
.bk.pending { box-shadow: inset 4px 0 0 #e8a317; padding-left: 12px; }
.bk-date b { display: block; font-variant-numeric: tabular-nums; }
.bk-date span { color: var(--ink-2); font-size: 13px; }
.bk-who { color: var(--ink-2); font-size: 15px; overflow-wrap: anywhere; }
.bk-act { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.bk-form { background: #f4f7f3; border-radius: var(--r-s); padding: 14px; margin: 12px 0 4px; display: grid; gap: 12px; }
.bk-form[hidden], .bk-form [hidden], .hourly[hidden] { display: none; }
.bk-form input[type=time] { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-s); background: #fff; min-height: 44px; }
.hourly { background: #fff; border: 1px solid #cfd7cf; border-radius: 14px; padding: 16px; }
.bk-form input[type=date] { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-s); background: #fff; min-height: 44px; }
.grid-2.keep { grid-template-columns: 1fr 1fr; }
@media (max-width: 640px) { .bk { grid-template-columns: 1fr; } .bk-act { justify-content: flex-start; } }
.know { list-style: none; padding: 0; margin: 0 0 12px; }
.know li { display: flex; gap: 10px; justify-content: space-between; align-items: center; padding: 9px 0; border-top: 1px solid var(--line); }
.know li:first-child { border-top: 0; }

#toast { position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%) translateY(20px); background: var(--ink); color: #fff; padding: 11px 18px; border-radius: 99px; font-size: 15px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 50; max-width: 90vw; }
#toast.show { opacity: 1; transform: translateX(-50%); }
#toast.err { background: var(--danger); }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation-duration: 0s !important; } }
