:root {
  --bg: #f6f7f5;
  --surface: #ffffff;
  --surface-2: #eef2ef;
  --text: #17201c;
  --muted: #5b6862;
  --border: #dde3df;
  --brand: #0e7c66;
  --brand-ink: #ffffff;
  --brand-soft: #dff1ec;
  --accent: #f2a900;
  --danger: #c0392b;
  --danger-soft: #fbe9e7;
  --ok: #1e8e3e;
  --warn-soft: #fff5d6;
  --radius: 14px;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.05), 0 4px 16px rgb(0 0 0 / 0.05);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1412;
    --surface: #171e1b;
    --surface-2: #1f2824;
    --text: #e8eeeb;
    --muted: #9aa8a1;
    --border: #2a3530;
    --brand: #2bb394;
    --brand-ink: #06110d;
    --brand-soft: #173a31;
    --danger: #ef6b5b;
    --danger-soft: #3a1d1a;
    --warn-soft: #3a3115;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(68px + env(safe-area-inset-bottom));
}
@media (min-width: 800px) { body { padding-bottom: 0; } }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 12px; }
h1 { font-size: 28px; }
h2 { font-size: 21px; }
h3 { font-size: 17px; }
p { margin: 0 0 12px; }

.container { max-width: 960px; margin: 0 auto; padding: 16px; }
.narrow { max-width: 560px; }

.header {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.header .inner { max-width: 960px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 16px; }
.logo { font-weight: 800; font-size: 20px; color: var(--text); display: flex; align-items: center; gap: 8px; }
.logo:hover { text-decoration: none; }
.logo-mark { width: 30px; height: 30px; border-radius: 9px; background: var(--brand); display: grid; place-items: center; color: var(--brand-ink); }
.topnav { display: none; gap: 4px; margin-left: auto; align-items: center; }
.topnav a { color: var(--muted); padding: 8px 12px; border-radius: 10px; font-weight: 500; position: relative; }
.topnav a.active, .topnav a:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
@media (min-width: 800px) { .topnav { display: flex; } }

.bottomnav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 10;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--surface); border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
}
.bottomnav a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0; font-size: 11px; color: var(--muted); position: relative; }
.bottomnav a.active { color: var(--brand); }
.bottomnav a:hover { text-decoration: none; }
.bottomnav svg { width: 24px; height: 24px; }
@media (min-width: 800px) { .bottomnav { display: none; } }

.dot { position: absolute; top: 4px; right: calc(50% - 18px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--danger); color: #fff; font-size: 11px; display: grid; place-items: center; font-weight: 700; }
.topnav .dot { top: -2px; right: -4px; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.card + .card { margin-top: 12px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.between { justify-content: space-between; }
.grid2 { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .grid2 { grid-template-columns: 1fr 1fr; } }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.big { font-size: 22px; font-weight: 700; }
.center { text-align: center; }

label.field { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 500; }
input, select, textarea {
  font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 10px; padding: 11px 12px; width: 100%;
  min-height: 44px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: -1px; border-color: transparent; }
textarea { min-height: 80px; resize: vertical; }
.check { display: flex; gap: 8px; align-items: center; font-size: 15px; }
.check input { width: 20px; height: 20px; min-height: 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 600; border: 0; border-radius: 12px; padding: 12px 18px; min-height: 46px;
  background: var(--brand); color: var(--brand-ink); cursor: pointer;
}
.btn:hover { filter: brightness(1.05); text-decoration: none; }
.btn:disabled { opacity: 0.55; cursor: default; }
.btn.secondary { background: var(--surface-2); color: var(--text); }
.btn.danger { background: var(--danger-soft); color: var(--danger); }
.btn.block { width: 100%; }
.btn.sm { min-height: 36px; padding: 6px 12px; font-size: 14px; border-radius: 10px; }

.tabs { display: inline-flex; background: var(--surface-2); padding: 4px; border-radius: 12px; gap: 4px; }
.tabs a { padding: 8px 14px; border-radius: 9px; color: var(--muted); font-weight: 600; }
.tabs a:hover { text-decoration: none; }
.tabs a.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.tabs button { font: inherit; border: 0; background: none; padding: 8px 14px; border-radius: 9px; cursor: pointer; color: var(--muted); font-weight: 600; }
.tabs button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; padding: 3px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.badge.ok { background: var(--brand-soft); color: var(--brand); }
.badge.warn { background: var(--warn-soft); color: #8a6400; }
.badge.bad { background: var(--danger-soft); color: var(--danger); }
@media (prefers-color-scheme: dark) { .badge.warn { color: var(--accent); } }

.alert { padding: 12px 14px; border-radius: 12px; background: var(--warn-soft); font-size: 14px; }
.alert.error { background: var(--danger-soft); color: var(--danger); }
.alert.info { background: var(--brand-soft); }

.hero { padding: 28px 0 8px; }
.hero h1 { font-size: 32px; }
@media (min-width: 800px) { .hero h1 { font-size: 42px; } }

.route { display: grid; grid-template-columns: 14px 1fr; gap: 2px 10px; align-items: center; }
.route .pin { width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--brand); justify-self: center; }
.route .pin.end { background: var(--brand); }
.route .line { width: 2px; height: 14px; background: var(--border); justify-self: center; }

.code { font: 700 34px/1 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: 8px; padding: 14px 18px; background: var(--brand-soft); color: var(--brand); border-radius: 12px; display: inline-block; }

.list-link { display: block; color: inherit; }
.list-link:hover { text-decoration: none; }
.list-link:hover .card { border-color: var(--brand); }

.chat { display: flex; flex-direction: column; gap: 8px; max-height: 360px; overflow-y: auto; padding: 4px; }
.msg { max-width: 80%; padding: 8px 12px; border-radius: 14px; background: var(--surface-2); font-size: 15px; }
.msg.mine { align-self: flex-end; background: var(--brand-soft); }
.msg.flagged { outline: 2px solid var(--accent); }

.toast-wrap { position: fixed; top: 70px; left: 50%; transform: translateX(-50%); z-index: 50; display: flex; flex-direction: column; gap: 8px; width: min(420px, calc(100% - 32px)); }
.toast { background: var(--text); color: var(--bg); padding: 12px 14px; border-radius: 12px; box-shadow: 0 8px 24px rgb(0 0 0 / 0.2); font-size: 14px; }
.toast b { display: block; }

.features { display: grid; gap: 12px; grid-template-columns: 1fr; margin-top: 24px; }
@media (min-width: 640px) { .features { grid-template-columns: repeat(3, 1fr); } }
.features .card h3 { margin-bottom: 6px; }
.stars { color: var(--accent); }
hr { border: 0; border-top: 1px solid var(--border); margin: 16px 0; }

/* Дополнения для версии без фреймворка */
[hidden] { display: none !important; }
.spinner { width: 28px; height: 28px; border: 3px solid var(--border); border-top-color: var(--brand); border-radius: 50%; animation: spin 0.8s linear infinite; margin: 40px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.price { font-size: 20px; font-weight: 700; white-space: nowrap; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; font-size: 15px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.photos { display: flex; gap: 8px; flex-wrap: wrap; }
.photos img { width: 84px; height: 84px; object-fit: cover; border-radius: 10px; border: 1px solid var(--border); }
.empty { text-align: center; color: var(--muted); padding: 32px 16px; }
.section-title { margin: 24px 0 12px; }
.rules { display: flex; gap: 6px; flex-wrap: wrap; }
.money-row { display: flex; justify-content: space-between; gap: 12px; font-size: 15px; }
.money-row.total { font-weight: 700; border-top: 1px solid var(--border); padding-top: 8px; }
.steps { counter-reset: s; list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.steps li { counter-increment: s; display: grid; grid-template-columns: 32px 1fr; gap: 10px; align-items: start; }
.steps li::before { content: counter(s); width: 28px; height: 28px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; font-weight: 700; font-size: 14px; }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; font-weight: 700; flex: none; }
.user-line { display: flex; gap: 10px; align-items: center; }
.err { color: var(--danger); font-size: 14px; }
.install-banner { display: flex; gap: 12px; align-items: center; justify-content: space-between; }
.topnav a.btn, .topnav a.btn:hover { color: var(--brand-ink); background: var(--brand); }
.grid2 > .card, .features > .card { margin-top: 0; }
