:root {
  --bg: #141416;
  --surface: #1e1e21;
  --surface-2: #28282d;
  --surface-3: #323238;
  --text: #f3f3f5;
  --muted: #9b9ba4;
  --faint: #6b6b74;
  --accent: #4c9eff;
  --accent-dim: rgba(76, 158, 255, 0.13);
  --green: #3ecf6a;
  --green-dim: rgba(62, 207, 106, 0.13);
  --red: #f4564a;
  --red-dim: rgba(244, 86, 74, 0.12);
  --amber: #ffc53d;
  --hairline: rgba(255, 255, 255, 0.06);
  --shadow: 0 10px 34px rgba(0, 0, 0, 0.45);
  --nav-h: 66px;
  --r-lg: 22px;
  --r-md: 14px;
  --r-sm: 11px;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  height: 100%;
  overscroll-behavior-y: none;
  -webkit-font-smoothing: antialiased;
}

#app { padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px) + 26px); }

button { font-family: inherit; border: none; background: none; color: inherit; cursor: pointer; }
input { font-family: inherit; }

.ic {
  width: 20px; height: 20px;
  fill: none; stroke: currentColor;
  stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round;
  flex: 0 0 auto;
}

/* ── Шапка страницы ── */

.page-head {
  display: flex; align-items: center; gap: 12px;
  padding: 20px 18px 4px;
}
.page-head h1 {
  font-size: 26px; font-weight: 800; letter-spacing: -0.4px;
}
.page-sub {
  color: var(--muted); font-size: 12.5px; margin-top: 3px;
  display: flex; align-items: center; gap: 6px;
  font-weight: 500;
}
.page-head .spacer { flex: 1; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  color: var(--muted);
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.15s, color 0.15s;
}
.icon-btn:active { transform: scale(0.92); color: var(--text); }
.icon-btn .ic { width: 19px; height: 19px; }
.icon-btn.spinning .ic { animation: rot 0.9s linear infinite; }
@keyframes rot { to { transform: rotate(360deg); } }

.live-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--green); flex: 0 0 auto;
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse { 50% { opacity: 0.35; } }

/* ── Чипы фильтров ── */

.chips {
  display: flex; flex-wrap: wrap; gap: 8px;
  padding: 14px 18px 4px;
}
.chip {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 999px;
  padding: 9px 14px;
  font-size: 14px; font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s;
  flex: 0 0 auto;
}
.chip .chip-label { color: var(--muted); font-weight: 450; }
.chip .ic { width: 15px; height: 15px; color: var(--faint); }
.chip.chip-active {
  background: var(--accent-dim);
  border-color: rgba(76, 158, 255, 0.35);
  color: var(--accent);
}
.chip.chip-active .chip-label { color: var(--accent); opacity: 0.75; }
.chip.chip-active .ic { color: var(--accent); }

/* ── Строка-ссылка ── */

.link-row {
  display: flex; align-items: center; gap: 10px;
  margin: 10px 18px 0;
  padding: 13px 16px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  font-size: 14.5px; font-weight: 600;
  cursor: pointer;
  user-select: none;
}
.link-row .ic { color: var(--red); width: 19px; height: 19px; }
.link-row .lr-spacer { flex: 1; }
.link-row .lr-count {
  color: var(--muted); font-size: 13px; font-weight: 600;
  background: var(--surface-2);
  border-radius: 999px; padding: 3px 10px;
}
.link-row .lr-chevron { color: var(--faint); width: 16px; height: 16px; }

/* ── Карточки объявлений ── */

.cards { padding: 12px 14px 0; display: flex; flex-direction: column; gap: 10px; }

.card {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  padding: 16px;
}
.card.flash-new { animation: flashNew 2.4s ease-out; }
@keyframes flashNew {
  0% { border-color: var(--green); box-shadow: 0 0 0 1px var(--green), 0 0 26px rgba(62, 207, 106, 0.22); }
  100% { border-color: var(--hairline); box-shadow: none; }
}
.card.removing { transition: opacity 0.25s, transform 0.25s; opacity: 0; transform: scale(0.96); }

.card-top { display: flex; align-items: flex-start; gap: 10px; }
.price-block { flex: 1; min-width: 0; }
.price {
  font-size: 25px; font-weight: 800; letter-spacing: -0.5px;
  display: flex; align-items: center; gap: 6px;
}
.price .cur { font-size: 15px; font-weight: 600; color: var(--muted); margin-top: 7px; }
.price .ic.bolt { width: 17px; height: 17px; color: var(--amber); stroke: none; fill: currentColor; }
.price-sub { color: var(--faint); font-size: 12.5px; margin-top: 1px; font-weight: 500; }

.card-actions { display: flex; align-items: center; gap: 8px; }
.round-btn {
  width: 36px; height: 36px; border-radius: 12px;
  background: var(--surface-2);
  color: var(--muted);
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.15s;
}
.round-btn .ic { width: 17px; height: 17px; }
.round-btn:active { transform: scale(0.9); }
.pill-btn {
  border-radius: 12px;
  padding: 9px 16px;
  font-size: 13.5px; font-weight: 700;
  background: var(--accent); color: #fff;
  display: inline-flex; align-items: center; gap: 6px;
  transition: transform 0.15s, opacity 0.15s;
}
.pill-btn .ic { width: 15px; height: 15px; }
.pill-btn.danger { background: var(--red-dim); color: var(--red); }
.pill-btn:active { transform: scale(0.95); opacity: 0.85; }

.seller-row {
  display: flex; align-items: center; gap: 10px;
  margin-top: 14px;
}
.avatar {
  width: 34px; height: 34px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 12.5px; font-weight: 700; color: #fff;
  flex: 0 0 auto;
}
.seller-name {
  font-size: 15px; font-weight: 650;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  display: flex; align-items: center; gap: 6px;
  min-width: 0;
}
.dot-online { width: 7px; height: 7px; border-radius: 50%; background: var(--green); flex: 0 0 auto; }
.dot-online.off { background: var(--faint); }
.seller-name .ic.store { width: 15px; height: 15px; color: var(--amber); }
.badge-new {
  background: var(--green-dim); color: var(--green);
  font-size: 10px; font-weight: 800; letter-spacing: 0.5px;
  border-radius: 6px; padding: 2.5px 6px;
  flex: 0 0 auto;
}
.seller-stats { margin-left: auto; color: var(--muted); font-size: 12.5px; font-weight: 500; white-space: nowrap; }

.info-rows {
  margin-top: 13px;
  background: var(--surface-2);
  border-radius: var(--r-md);
  padding: 4px 13px;
}
.info-row {
  display: flex; gap: 16px; align-items: baseline;
  padding: 7.5px 0;
  font-size: 13.5px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}
.info-row:last-child { border-bottom: none; }
.info-row .k { color: var(--muted); flex: 0 0 auto; font-weight: 450; }
.info-row .v { margin-left: auto; text-align: right; min-width: 0; font-weight: 550; }
.info-row .v.green { color: var(--green); }

/* ── Радар ── */

.radar-summary {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
  padding: 14px 18px 4px;
}
.stat-pill {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  padding: 12px 8px 10px;
  text-align: center;
}
.stat-pill b { font-size: 20px; font-weight: 800; letter-spacing: -0.5px; display: block; }
.stat-pill span { color: var(--muted); font-size: 10.5px; font-weight: 550; text-transform: uppercase; letter-spacing: 0.4px; }
.stat-pill.green b { color: var(--green); }
.stat-pill.red b { color: var(--red); }
.stat-pill.blue b { color: var(--accent); }

.feed { padding: 12px 14px 0; display: flex; flex-direction: column; gap: 8px; }
.feed-item {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  padding: 11px 13px;
  display: flex; align-items: center; gap: 11px;
  font-size: 14px;
}
.feed-item .fi-ic {
  width: 34px; height: 34px; border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  flex: 0 0 auto;
}
.feed-item .fi-ic .ic { width: 17px; height: 17px; }
.feed-item.enter .fi-ic { background: var(--green-dim); color: var(--green); }
.feed-item.exit .fi-ic { background: var(--surface-2); color: var(--faint); }
.feed-item.exit { opacity: 0.75; }
.feed-item .fi-body { flex: 1; min-width: 0; }
.feed-item .fi-name { font-weight: 650; font-size: 14px; }
.feed-item .fi-sub {
  color: var(--muted); font-size: 12px; margin-top: 1px; font-weight: 450;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.feed-item .fi-time { color: var(--faint); font-size: 11px; font-weight: 550; flex: 0 0 auto; }
.feed-item .mini-bl {
  background: var(--red-dim); color: var(--red);
  border-radius: 10px; padding: 7px 12px;
  font-size: 12.5px; font-weight: 700; flex: 0 0 auto;
}
.feed-empty { text-align: center; color: var(--muted); padding: 46px 24px; font-size: 13.5px; line-height: 1.5; }

/* ── ЧС ── */

.bl-tools { padding: 14px 18px 0; display: flex; flex-direction: column; gap: 9px; }
.input-wrap {
  display: flex; align-items: center; gap: 9px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  padding: 0 13px;
}
.input-wrap .ic { color: var(--faint); width: 17px; height: 17px; }
.input-wrap input {
  flex: 1; background: none; border: none; outline: none;
  color: var(--text);
  padding: 12px 0;
  font-size: 15px; font-weight: 500;
}
.input-wrap input::placeholder { color: var(--faint); font-weight: 450; }
.bl-add-row { display: flex; gap: 8px; }
.bl-add-row .input-wrap { flex: 1; }
.add-btn {
  width: 46px; border-radius: var(--r-md);
  background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center;
  flex: 0 0 auto;
  transition: transform 0.15s;
}
.add-btn:active { transform: scale(0.92); }

.bl-list {
  margin: 12px 18px 0;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  overflow: hidden;
}
.bl-row {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 15px;
  font-size: 14.5px; font-weight: 500;
  border-bottom: 1px solid var(--hairline);
}
.bl-row:last-child { border-bottom: none; }
.bl-row .bl-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bl-row .bl-del {
  color: var(--faint); width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 9px;
}
.bl-row .bl-del:active { background: var(--red-dim); color: var(--red); }
.bl-row .bl-del .ic { width: 15px; height: 15px; }
.bl-more { text-align: center; color: var(--faint); font-size: 12.5px; padding: 12px; font-weight: 500; }

.danger-btn {
  margin: 12px 18px;
  width: calc(100% - 36px);
  background: var(--red-dim); color: var(--red);
  border-radius: var(--r-md); padding: 13px;
  font-size: 14.5px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.danger-btn .ic { width: 17px; height: 17px; }

/* ── Настройки ── */

.set-group { margin: 16px 18px 0; }
.set-group-title {
  color: var(--faint); font-size: 11.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.7px;
  padding: 0 6px 7px;
}
.set-card {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  overflow: hidden;
}
.set-row {
  display: flex; align-items: center; gap: 10px;
  padding: 12.5px 15px;
  font-size: 14.5px; font-weight: 500;
  border-bottom: 1px solid var(--hairline);
  cursor: pointer;
  user-select: none;
}
.set-row:last-child { border-bottom: none; }
.set-row .sr-label { flex: 1; display: flex; align-items: center; gap: 8px; }
.set-row .sr-label .ic { width: 16px; height: 16px; color: var(--muted); }
.set-row .sr-value { color: var(--muted); font-size: 13.5px; font-weight: 550; }
.set-row .sr-chevron { color: var(--faint); width: 16px; height: 16px; }

.switch {
  width: 46px; height: 28px; border-radius: 999px;
  background: var(--surface-3); position: relative; transition: background 0.2s;
  flex: 0 0 auto;
}
.switch::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 22px; height: 22px; border-radius: 50%;
  background: #fff; transition: transform 0.22s cubic-bezier(0.3, 1.2, 0.5, 1);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}
.switch.on { background: var(--accent); }
.switch.on::after { transform: translateX(18px); }

.primary-btn {
  margin: 16px 18px 0; width: calc(100% - 36px);
  background: var(--accent); color: #fff;
  border-radius: var(--r-md); padding: 14px;
  font-size: 15px; font-weight: 700;
  transition: transform 0.15s, opacity 0.15s;
}
.primary-btn:active { transform: scale(0.98); opacity: 0.9; }
.primary-btn.stop { background: var(--red-dim); color: var(--red); }
.note-text { color: var(--faint); font-size: 12.5px; padding: 14px 24px; line-height: 1.5; font-weight: 450; }

/* ── Наббар ── */

.tabbar {
  position: fixed; z-index: 40;
  left: 14px; right: 14px;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 12px);
  background: rgba(30, 30, 34, 0.92);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 24px;
  box-shadow: var(--shadow);
  display: flex; gap: 4px;
  padding: 6px;
  height: var(--nav-h);
}
.tab {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px;
  color: var(--faint);
  border-radius: 18px;
  position: relative;
  transition: background 0.2s, color 0.2s;
}
.tab .ic { width: 21px; height: 21px; }
.tab span { font-size: 10px; font-weight: 650; letter-spacing: 0.1px; }
.tab.active { color: var(--accent); background: var(--accent-dim); }
.tab-badge {
  position: absolute; top: 7px; right: calc(50% - 24px);
  background: var(--red); color: #fff;
  font-size: 9.5px; font-weight: 800;
  border-radius: 999px; min-width: 16px; height: 16px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 4px;
  border: 2px solid var(--surface);
}
.tab-badge[hidden] { display: none; }

/* ── Шторка ── */

.sheet-overlay {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(0, 0, 0, 0.6);
  opacity: 0; transition: opacity 0.22s;
}
.sheet-overlay.show { opacity: 1; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 51;
  background: var(--surface);
  border-radius: 26px 26px 0 0;
  border-top: 1px solid var(--hairline);
  transform: translateY(100%);
  transition: transform 0.28s cubic-bezier(0.3, 0.9, 0.4, 1);
  max-height: 76vh;
  display: flex; flex-direction: column;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.sheet.show { transform: translateY(0); }
.sheet-grab {
  width: 38px; height: 4px; border-radius: 3px;
  background: var(--surface-3); margin: 10px auto 4px; flex: 0 0 auto;
}
.sheet-title {
  text-align: center; font-size: 15.5px; font-weight: 700;
  padding: 8px 18px 12px; flex: 0 0 auto;
}
.sheet-body { overflow-y: auto; padding: 0 10px 12px; }
.sheet-opt {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 14px;
  font-size: 15px; font-weight: 500;
  border-radius: var(--r-sm);
  cursor: pointer;
}
.sheet-opt:active { background: var(--surface-2); }
.sheet-opt .so-label { flex: 1; }
.sheet-opt .so-check { color: var(--accent); width: 19px; height: 19px; opacity: 0; }
.sheet-opt.selected .so-check { opacity: 1; }
.sheet-opt.destructive { color: var(--red); }
.sheet-actions { padding: 8px 16px 14px; flex: 0 0 auto; }
.sheet-actions .primary-btn { margin: 0; width: 100%; }
.sheet-input-wrap { padding: 2px 16px 8px; }
.sheet-input-wrap .input-wrap { background: var(--surface-2); }

/* ── Тосты ── */

#toast-root {
  position: fixed; left: 0; right: 0;
  bottom: calc(var(--nav-h) + 30px);
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  z-index: 60; pointer-events: none;
}
.toast {
  background: var(--surface-3);
  border: 1px solid rgba(255, 255, 255, 0.09);
  color: var(--text); font-size: 13px; font-weight: 550;
  border-radius: 999px; padding: 10px 18px;
  animation: toastIn 0.22s ease-out;
  box-shadow: var(--shadow);
}
.toast.out { transition: opacity 0.3s; opacity: 0; }
@keyframes toastIn { from { transform: translateY(10px); opacity: 0; } }

.skeleton { padding: 36px 0; text-align: center; color: var(--faint); font-size: 13.5px; }
.error-box {
  margin: 14px 18px; background: var(--red-dim); color: var(--red);
  border: 1px solid rgba(244, 86, 74, 0.25);
  border-radius: var(--r-md); padding: 13px 15px; font-size: 13.5px; font-weight: 500;
  line-height: 1.45;
}
