/* SnapAvto WebApp — токены 1:1 с iOS DESIGN.md */
:root {
  --asphalt: #101418;
  --graphite: #1b2027;
  --paper: #f0efe9;
  --chalk: #ffffff;
  --flare: #ff4a17;
  --volt: #cdff4f;
  --mist: #8b9099;
  --alarm: #ff3b5c;
  --mint: #14c08b;
  --hair: rgba(16, 20, 24, 0.08);
  --sunk: rgba(16, 20, 24, 0.045);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --tab-h: 78px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  min-height: 100%;
  background: var(--paper);
  color: var(--asphalt);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}
button, input, select, textarea { font: inherit; }
button { border: 0; background: none; cursor: pointer; }
a { color: inherit; }
img { max-width: 100%; display: block; }
#app { min-height: 100dvh; padding-bottom: calc(var(--tab-h) + var(--safe-bottom)); }
#app.no-tab { padding-bottom: 0; }

.micro {
  font-size: 9px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: 1.3px;
  text-transform: uppercase;
  color: var(--mist);
}
.gauge {
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  letter-spacing: -0.8px;
}
.brand-mark {
  width: 32px; height: 32px; border-radius: 10px;
  background: var(--asphalt); position: relative; flex-shrink: 0;
}
.brand-mark::before, .brand-mark::after {
  content: ""; position: absolute; left: 7px;
  height: 3px; border-radius: 99px;
}
.brand-mark::before { top: 10px; width: 15px; background: var(--volt); }
.brand-mark::after { top: 17px; width: 9px; background: rgba(255,255,255,.35); }

.topbar {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 16px 8px;
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: blur(12px);
}
.topbar h1 { margin: 0; font-size: 15px; font-weight: 800; letter-spacing: -0.3px; }
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 7px 10px; border-radius: 999px;
  background: var(--chalk); border: 1px solid var(--hair);
  font-size: 12px; font-weight: 600; color: var(--asphalt);
  white-space: nowrap;
}
.chip.active { background: var(--asphalt); color: var(--chalk); border-color: transparent; }
.chip .dot { width: 5px; height: 5px; border-radius: 50%; background: var(--mint); }
.chip .dot.off { background: var(--flare); }

.screen-pad { padding: 0 16px 24px; }
.hero-title {
  font-size: 28px; font-weight: 800; letter-spacing: -0.9px;
  margin: 4px 0 6px; line-height: 1.1;
}
.muted { color: var(--mist); font-size: 13px; font-weight: 500; }

.card {
  background: var(--chalk);
  border-radius: 22px;
  overflow: hidden;
  box-shadow: 0 5px 12px rgba(16,20,24,.05);
  margin-bottom: 14px;
}
.card.dim { opacity: .58; }
.card-photo {
  height: 196px; background: var(--graphite);
  position: relative; overflow: hidden;
}
.card-photo img { width: 100%; height: 100%; object-fit: cover; }
.card-photo .veil {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(16,20,24,.15), rgba(16,20,24,.55));
}
.badges {
  position: absolute; left: 12px; top: 12px;
  display: flex; flex-wrap: wrap; gap: 6px; z-index: 2;
}
.badge {
  font-size: 11px; font-weight: 700;
  padding: 5px 8px; border-radius: 999px;
}
.badge.deal { background: var(--volt); color: var(--asphalt); }
.badge.volt { background: var(--volt); color: var(--asphalt); }
.badge.dark { background: rgba(16,20,24,.85); color: var(--chalk); }
.badge.mist { background: rgba(139,144,153,.95); color: var(--chalk); }
.badge.flare { background: #E85D04; color: #fff; }
.badge.alarm { background: var(--alarm); color: #fff; }
.chip-sq {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 22px; height: 22px; padding: 0 5px;
  border: 1.2px solid rgba(16,20,24,.18); border-radius: 7px;
  font-family: var(--font-gauge, ui-monospace, monospace);
  font-size: 11px; font-weight: 800; color: var(--asphalt);
  background: #fff;
}
.card-body { padding: 14px 16px 16px; }
.card-title { font-size: 20px; font-weight: 800; letter-spacing: -0.5px; margin: 0 0 6px; line-height: 1.2; }
.card-sub { font-size: 13px; color: var(--mist); margin: 0 0 10px; }
.card-meta { font-size: 13px; font-weight: 600; color: var(--asphalt); margin: 6px 0 8px; white-space: normal; }
.price-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.price { font-size: 26px; letter-spacing: -1px; }
.strike { font-size: 11px; color: var(--mist); text-decoration: line-through; }
.pips { display: flex; align-items: center; gap: 8px; flex-wrap: nowrap; overflow: hidden; }
.pip { font-size: 12px; font-weight: 700; color: rgba(16,20,24,.72); white-space: nowrap; }
.pip.mist { color: var(--mist); font-weight: 600; }
.card-foot { display: flex; justify-content: space-between; margin-top: 12px; font-size: 11px; font-weight: 700; color: var(--mist); }
.facts { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.fact {
  font-size: 11px; font-weight: 700;
  padding: 5px 8px; border-radius: 999px;
  background: var(--sunk); color: var(--asphalt);
}
.icon-btn {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--chalk); border: 1px solid var(--hair);
  font-size: 14px; font-weight: 800; color: var(--asphalt);
  display: inline-flex; align-items: center; justify-content: center;
}
.icon-btn.active { background: var(--asphalt); color: var(--chalk); border-color: transparent; }
.rail {
  height: 6px; border-radius: 99px; background: rgba(16,20,24,.08);
  position: relative; margin: 12px 0 4px;
}
.rail .seg {
  position: absolute; top: 0; bottom: 0; border-radius: 99px;
  background: var(--volt);
}
.rail .mark {
  position: absolute; top: -3px; width: 2px; height: 12px;
  background: var(--asphalt); border-radius: 2px; transform: translateX(-50%);
}
.rail .anchor {
  position: absolute; top: -2px; width: 1px; height: 10px;
  background: var(--mist); transform: translateX(-50%);
}
.reason { font-size: 12px; font-weight: 600; color: var(--mist); margin-top: 8px; }

.instrument {
  background: var(--asphalt);
  color: var(--chalk);
  border-radius: 22px;
  padding: 18px;
  border: 1px solid rgba(255,255,255,.07);
  margin-bottom: 14px;
}
.instrument .volt { color: var(--volt); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 14px 16px; border-radius: 16px;
  font-size: 15px; font-weight: 800;
}
.btn-volt { background: var(--volt); color: var(--asphalt); }
.btn-flare { background: var(--flare); color: var(--chalk); }
.btn-ghost { background: transparent; color: var(--mist); }
.btn:disabled { opacity: .5; }

.tabbar {
  position: fixed; left: 14px; right: 14px;
  bottom: calc(10px + var(--safe-bottom));
  z-index: 50;
  display: flex; gap: 2px; padding: 5px;
  background: var(--asphalt);
  border-radius: 22px;
  box-shadow: 0 10px 22px rgba(16,20,24,.28);
}
.tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 10px 2px; border-radius: 15px; color: var(--mist);
  font-size: 9.5px; font-weight: 600; letter-spacing: -0.1px;
}
.tab svg { width: 15px; height: 15px; }
.tab.active { background: var(--volt); color: var(--asphalt); }

.login-wrap {
  min-height: 100dvh; background: var(--asphalt); color: var(--chalk);
  display: flex; flex-direction: column; justify-content: center;
  padding: 48px 20px 40px;
}
.login-wrap .brand { color: var(--volt); letter-spacing: 3px; font-size: 13px; font-weight: 800; }
.login-box {
  margin-top: 28px; padding: 22px;
  background: rgba(16,20,24,.55);
  border-radius: 24px;
}
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 11px; font-weight: 700; color: var(--mist); margin-bottom: 6px; }
.field input {
  width: 100%; padding: 14px 14px; border-radius: 14px;
  border: 1px solid rgba(255,255,255,.1); background: rgba(255,255,255,.06);
  color: var(--chalk); outline: none;
}
.err { color: #ff7366; font-size: 12.5px; font-weight: 600; margin-bottom: 10px; }

.sheet-backdrop {
  position: fixed; inset: 0; background: rgba(16,20,24,.45);
  z-index: 80; display: flex; align-items: flex-end; justify-content: center;
}
.sheet {
  width: 100%; max-width: 520px;
  background: var(--paper);
  border-radius: 24px 24px 0 0;
  padding: 12px 18px calc(24px + var(--safe-bottom));
  max-height: 85dvh; overflow: auto;
}
.sheet.dark { background: var(--asphalt); color: var(--chalk); }
.sheet .grab {
  width: 36px; height: 4px; border-radius: 99px;
  background: rgba(139,144,153,.35); margin: 0 auto 16px;
}
.list-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 0; border-bottom: 1px solid var(--hair);
  font-size: 15px; font-weight: 700;
}
.locked {
  padding: 40px 22px; text-align: center;
}
.locked h2 { font-size: 24px; font-weight: 800; letter-spacing: -0.6px; margin: 8px 0; }
.empty { padding: 40px 16px; text-align: center; color: var(--mist); font-weight: 600; }
.spinner {
  width: 22px; height: 22px; border: 2px solid rgba(16,20,24,.15);
  border-top-color: var(--flare); border-radius: 50%;
  animation: spin .7s linear infinite; margin: 24px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

.detail-hero { height: 330px; background: var(--graphite); position: relative; }
.detail-hero img { width: 100%; height: 100%; object-fit: cover; }
.detail-nav {
  position: absolute; left: 18px; right: 18px; top: 54px;
  display: flex; justify-content: space-between; z-index: 2;
}
.circle-btn {
  width: 38px; height: 38px; border-radius: 50%;
  background: rgba(16,20,24,.55); color: var(--chalk);
  display: grid; place-items: center; font-size: 14px; font-weight: 700;
}
.detail-body { padding: 18px 18px 120px; }
.action-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  padding: 12px 18px calc(12px + var(--safe-bottom));
  background: var(--paper);
  border-top: 1px solid var(--hair);
  display: flex; gap: 10px;
}
.action-bar .icon {
  width: 56px; height: 56px; border-radius: 18px;
  background: var(--sunk); display: grid; place-items: center;
  font-size: 18px; flex-shrink: 0;
}

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat {
  background: var(--chalk); border-radius: 18px; padding: 14px;
  border: 1px solid var(--hair);
}
.stat .n { font-size: 22px; font-weight: 800; letter-spacing: -0.6px; }
.stat .l { font-size: 11px; color: var(--mist); font-weight: 600; margin-top: 4px; }

.flag-opt {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 14px; border-radius: 16px; margin-bottom: 8px;
  background: var(--chalk); border: 1px solid var(--hair); text-align: left; width: 100%;
}
.flag-opt.on { border-color: color-mix(in srgb, var(--flare) 45%, transparent); background: color-mix(in srgb, var(--flare) 8%, white); }
.flag-opt strong { display: block; font-size: 15px; font-weight: 800; }
.flag-opt span { font-size: 12px; color: var(--mist); font-weight: 500; }

.toast {
  position: fixed; left: 50%; bottom: calc(100px + var(--safe-bottom));
  transform: translateX(-50%);
  background: var(--asphalt); color: var(--chalk);
  padding: 12px 16px; border-radius: 14px; font-size: 13px; font-weight: 700;
  z-index: 100; box-shadow: 0 8px 20px rgba(0,0,0,.25);
  max-width: 90%;
}
