/* ============================================================
   car-watch · пульт мониторинга
   индустриальная тема: графит, янтарь, моноширинные данные
   ============================================================ */

:root {
  --bg:        #0a0c0f;
  --bg-grid:   #10141a;
  --panel:     #12161c;
  --panel-2:   #171c23;
  --line:      #232b35;
  --line-soft: #1a212a;
  --text:      #e7ebf0;
  --muted:     #9aa6b4;
  --dim:       #6b7684;
  --amber:     #ffb020;
  --amber-dim: #6b4a0d;
  --teal:      #35d0ba;
  --red:       #ff5d5d;
  --green:     #5ee08a;
  --radius:    3px;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(255,176,32,.07), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(53,208,186,.05), transparent 60%),
    linear-gradient(var(--bg-grid) 1px, transparent 1px) 0 0 / 100% 44px,
    linear-gradient(90deg, var(--bg-grid) 1px, transparent 1px) 0 0 / 44px 100%,
    var(--bg);
  color: var(--text);
  font-family: "Segoe UI", "PT Sans", system-ui, sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

/* ---------------- верхняя панель ---------------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 28px;
  padding: 12px 22px;
  background: rgba(10,12,15,.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 12px; }
.mark {
  display: grid; place-items: center;
  width: 38px; height: 38px;
  border: 2px solid var(--amber);
  color: var(--amber);
  font-family: "Bahnschrift", "DIN Alternate", sans-serif;
  font-weight: 700; font-size: 15px; letter-spacing: .04em;
  border-radius: var(--radius);
  box-shadow: 0 0 18px rgba(255,176,32,.18) inset;
}
.brand-name {
  font-family: "Bahnschrift", "DIN Alternate", sans-serif;
  font-size: 17px; font-weight: 700; letter-spacing: .18em;
}
.brand-sub {
  font-size: 10px; letter-spacing: .16em; text-transform: uppercase;
  color: var(--dim);
}

.status { display: flex; align-items: center; gap: 9px; min-width: 210px; }
.led {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--dim);
  box-shadow: 0 0 0 3px rgba(85,96,109,.15);
  transition: background .25s, box-shadow .25s;
}
.led.on {
  background: var(--green);
  box-shadow: 0 0 0 3px rgba(94,224,138,.15), 0 0 14px rgba(94,224,138,.7);
  animation: pulse 1.6s ease-in-out infinite;
}
.led.err { background: var(--red); box-shadow: 0 0 0 3px rgba(255,93,93,.15), 0 0 14px rgba(255,93,93,.6); }
@keyframes pulse { 50% { opacity: .45; } }

.status-text { font-size: 13px; }
.status-phase {
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 10.5px; color: var(--amber); letter-spacing: .08em;
  text-transform: uppercase;
}

.stats { display: flex; gap: 10px; margin-left: auto; }
.chip {
  display: flex; flex-direction: column; align-items: flex-end;
  padding: 4px 12px;
  border-left: 2px solid var(--line);
}
.chip b {
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 17px; line-height: 1.1; color: var(--text);
}
.chip span { font-size: 9.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--dim); }

.controls { display: flex; gap: 8px; }

/* ---------------- кнопки ---------------- */
.progress {
  position: sticky;
  top: 63px;
  z-index: 45;
  background: rgba(10, 12, 15, .96);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.progress[hidden] { display: none; }
.progress-track { height: 3px; background: var(--line-soft); overflow: hidden; }
.progress-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--amber-dim), var(--amber));
  box-shadow: 0 0 12px rgba(255, 176, 32, .5);
  transition: width .5s ease;
}
.progress.indeterminate .progress-fill {
  width: 35% !important;
  animation: slide 1.4s ease-in-out infinite;
}
@keyframes slide {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(320%); }
}
.progress-label {
  padding: 5px 22px;
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 10.5px;
  letter-spacing: .06em;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn {
  font-family: "Bahnschrift", "DIN Alternate", sans-serif;
  font-size: 12px; font-weight: 600; letter-spacing: .1em;
  padding: 9px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-2);
  color: var(--text);
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s, transform .08s;
  text-decoration: none;
  display: inline-flex; align-items: center; gap: 6px;
}
.btn:hover { border-color: var(--dim); background: #1d242d; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .35; cursor: not-allowed; }

.btn-start { border-color: var(--amber-dim); color: var(--amber); }
.btn-start:hover { background: rgba(255,176,32,.1); border-color: var(--amber); }
.btn-stop { border-color: #4a1f1f; color: var(--red); }
.btn-stop:hover { background: rgba(255,93,93,.1); border-color: var(--red); }
.btn-accent { background: var(--amber); color: #14100a; border-color: var(--amber); }
.btn-accent:hover { background: #ffc04d; }

.send-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 2px;
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 10.5px;
  letter-spacing: .04em;
  border: 1px solid var(--line);
  color: var(--muted);
  white-space: nowrap;
}
.send-badge[hidden] { display: none; }
.send-badge.ok { color: var(--green); border-color: rgba(94, 224, 138, .4); background: rgba(94, 224, 138, .07); }
.send-badge.err { color: var(--red); border-color: rgba(255, 93, 93, .4); background: rgba(255, 93, 93, .07); }
.btn-ghost { background: transparent; }
.btn-sm { padding: 6px 11px; font-size: 11px; }
.btn-save {
  width: 100%; justify-content: center;
  background: var(--panel-2); border-color: var(--amber-dim); color: var(--amber);
  margin-top: 4px;
}
.btn-save:hover { background: rgba(255,176,32,.08); border-color: var(--amber); }

/* ---------------- раскладка ---------------- */
.layout {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 18px;
  padding: 18px 22px 40px;
  align-items: start;
}

.sidebar {
  display: flex; flex-direction: column; gap: 12px;
  position: sticky; top: 74px;
  max-height: calc(100vh - 92px);
  overflow-y: auto;
  padding-right: 4px;
}
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--line); border-radius: 3px; }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 15px 16px;
}
.panel h2 {
  margin: 0 0 12px;
  font-family: "Bahnschrift", "DIN Alternate", sans-serif;
  font-size: 11px; font-weight: 700; letter-spacing: .18em; text-transform: uppercase;
  color: var(--muted);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line-soft);
}

/* ---------------- поля ---------------- */
.field { margin-bottom: 11px; }
.field label {
  display: block; margin-bottom: 5px;
  font-size: 11px; letter-spacing: .06em; color: var(--muted);
}
.field label i { font-style: normal; color: var(--dim); font-size: 10px; }
.field label b { color: var(--amber); font-family: "Cascadia Mono", Consolas, monospace; }

input[type="text"], input[type="password"], input[type="number"], .select {
  width: 100%;
  padding: 8px 10px;
  background: #0d1116;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 12px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, .select:focus {
  border-color: var(--amber-dim);
  box-shadow: 0 0 0 2px rgba(255,176,32,.1);
}

input[type="range"] {
  width: 100%; height: 3px; -webkit-appearance: none; appearance: none;
  background: var(--line); border-radius: 2px; outline: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 19px; height: 19px; border-radius: 50%;
  background: var(--amber); cursor: pointer;
  box-shadow: 0 0 10px rgba(255,176,32,.5);
}

input[type="checkbox"] {
  appearance: none; -webkit-appearance: none;
  width: 15px; height: 15px; flex: none;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: #0d1116;
  cursor: pointer; position: relative;
  transition: background .15s, border-color .15s;
}
input[type="checkbox"]:checked {
  background: var(--amber); border-color: var(--amber);
}
input[type="checkbox"]:checked::after {
  content: ""; position: absolute; left: 4px; top: 1px;
  width: 4px; height: 8px;
  border: solid #14100a; border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

/* ---------------- сайты ---------------- */
.sites { display: flex; flex-direction: column; gap: 8px; }
.site {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.site:hover { border-color: var(--line); background: var(--panel-2); }
.site span { font-size: 13px; }

/* ---------------- профили ---------------- */
.profiles { display: flex; flex-direction: column; gap: 8px; }
.profile {
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 9px 10px;
  background: var(--panel-2);
  transition: border-color .15s;
}
.profile:hover { border-color: var(--line); }
.profile.off { opacity: .45; }
.p-head { display: flex; align-items: center; gap: 9px; }
.p-prio {
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 10px; color: var(--amber);
  border: 1px solid var(--amber-dim);
  border-radius: 2px; padding: 1px 5px;
}
.p-title { font-size: 12px; line-height: 1.3; flex: 1; }
.p-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 6px;
  margin-top: 8px;
}
.p-grid input { padding: 5px 7px; font-size: 11px; }
.p-grid label { font-size: 9.5px; color: var(--dim); letter-spacing: .08em; text-transform: uppercase; }
.p-lpg { display: flex; gap: 4px; margin-top: 6px; }
.p-lpg button {
  flex: 1; padding: 4px; font-size: 10px;
  background: #0d1116; border: 1px solid var(--line); color: var(--muted);
  border-radius: 2px; cursor: pointer; font-family: inherit;
}
.p-lpg button.active { border-color: var(--amber); color: var(--amber); background: rgba(255,176,32,.08); }

/* ---------------- каналы ---------------- */
.channel { border-top: 1px solid var(--line-soft); padding-top: 12px; margin-top: 12px; }
.channel:first-of-type { border-top: none; padding-top: 0; margin-top: 0; }
.ch-head { display: flex; align-items: center; gap: 9px; cursor: pointer; margin-bottom: 10px; }
.ch-head span {
  font-family: "Bahnschrift", "DIN Alternate", sans-serif;
  font-size: 12px; letter-spacing: .1em; text-transform: uppercase;
}
.ch-body { padding-left: 24px; }

.save-note { font-size: 11px; color: var(--green); text-align: center; min-height: 16px; margin-top: 6px; }

.tunnel-box {
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: #0d1116;
}
.tunnel-box[hidden] { display: none; }
.tunnel-label {
  font-size: 9.5px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--dim); margin-bottom: 5px;
}
.tunnel-url {
  display: block;
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 11px;
  color: var(--teal);
  text-decoration: none;
  word-break: break-all;
}
.tunnel-url:hover { color: var(--amber); }

/* ---------------- основная область ---------------- */
.main { min-width: 0; }

.toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 0 0 14px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.toolbar-left { display: flex; align-items: baseline; gap: 12px; }
.toolbar h1 {
  margin: 0;
  font-family: "Bahnschrift", "DIN Alternate", sans-serif;
  font-size: 22px; font-weight: 700; letter-spacing: .02em;
}
.count {
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 12px; color: var(--amber);
  border: 1px solid var(--amber-dim); border-radius: 2px; padding: 2px 8px;
}
.toolbar-right { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.select { width: auto; min-width: 130px; padding: 7px 9px; }

/* ---------------- карточки результатов ---------------- */
.results {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 14px;
}

.placeholder {
  grid-column: 1 / -1;
  padding: 60px 20px;
  text-align: center;
  color: var(--dim);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}

.card {
  display: flex; flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 3px solid var(--amber-dim);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color .18s, transform .18s, box-shadow .18s;
  animation: rise .35s ease both;
}
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
.card:hover {
  border-color: var(--line);
  border-left-color: var(--amber);
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(0,0,0,.45);
}
.card.p1 { border-left-color: var(--amber); }
.card.p2 { border-left-color: #d98a1a; }
.card.p3 { border-left-color: var(--teal); }
.card.p4, .card.p5, .card.p6 { border-left-color: #4a6b8a; }

.card.removed { opacity: .62; border-left-color: #5a2a2a; }
.card.removed .card-photo img { filter: grayscale(.85); }
.card.removed .card-price { color: var(--dim); text-decoration: line-through; }
.badge.removed {
  color: #ff8a8a;
  border-color: rgba(255,93,93,.45);
  background: rgba(40,12,12,.9);
  font-weight: 700;
}

.card-photo {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #0d1116;
  overflow: hidden;
}
.card-photo img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform .4s ease;
}
.card:hover .card-photo img { transform: scale(1.04); }
.card-photo .noimg {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; height: 100%;
  color: var(--dim); font-size: 10px; letter-spacing: .14em;
  background:
    repeating-linear-gradient(45deg, #0d1116 0 10px, #0f141a 10px 20px);
}
.card-photo .noimg svg { width: 46px; height: 46px; opacity: .35; }

.pick-wrap {
  position: absolute;
  top: 8px; right: 8px;
  z-index: 3;
  display: grid;
  place-items: center;
  width: 30px; height: 30px;
  background: rgba(10, 12, 15, .82);
  border: 1px solid var(--line);
  border-radius: 3px;
  cursor: pointer;
  backdrop-filter: blur(4px);
  transition: border-color .15s, background .15s;
}
.pick-wrap:hover { border-color: var(--amber); }
.pick-wrap input { width: 16px; height: 16px; }
.card.picked { border-color: var(--amber); box-shadow: 0 0 0 1px var(--amber-dim) inset; }
}
.badge {
  position: absolute; top: 8px; left: 8px;
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 9.5px; letter-spacing: .1em;
  padding: 3px 7px;
  background: rgba(10,12,15,.85);
  border: 1px solid var(--line);
  border-radius: 2px;
  color: var(--muted);
  backdrop-filter: blur(4px);
}
.badge.src-drom { color: var(--teal); border-color: rgba(53,208,186,.35); }
.badge.src-avito { color: #7fb2ff; border-color: rgba(127,178,255,.35); }
.badge.src-autoru { color: #ff9d7f; border-color: rgba(255,157,127,.35); }

.card-body { padding: 14px 15px 15px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.card-top { display: flex; flex-direction: column; gap: 6px; }
.card-title { font-size: 14px; font-weight: 600; line-height: 1.35; margin: 0; color: #eef2f6; }
.card-price {
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 20px; font-weight: 700; color: var(--amber);
  white-space: nowrap;
  letter-spacing: -.01em;
}
.card-meta {
  display: flex; flex-direction: column; gap: 4px;
  font-size: 12px; line-height: 1.5; color: var(--muted);
  padding: 8px 0;
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
}
.card-meta .place { color: #dfe5ec; font-weight: 500; }
.card-meta .specs { color: #c3ccd6; letter-spacing: .01em; }
.card-desc {
  font-size: 12.5px; line-height: 1.5; color: var(--muted);
  margin: 0;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-foot {
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px;
  margin-top: auto; padding-top: 10px;
}
.card-profile {
  font-size: 9.5px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--dim);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.card-link {
  font-size: 11.5px; color: var(--amber); text-decoration: none;
  border: 1px solid var(--amber-dim);
  border-radius: 2px;
  padding: 5px 11px;
  transition: background .15s, border-color .15s;
  white-space: nowrap;
}
.card-link:hover { background: var(--amber); border-color: var(--amber); color: #14100a; }

/* ---------------- журнал ---------------- */
.logbox {
  margin-top: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}
.logbox summary {
  padding: 10px 14px;
  cursor: pointer;
  font-size: 11px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--muted);
  user-select: none;
}
.logbox pre {
  margin: 0; padding: 0 14px 14px;
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 11px; line-height: 1.6;
  color: var(--muted);
  max-height: 260px; overflow-y: auto;
  white-space: pre-wrap;
}

/* ---------------- тост ---------------- */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translate(-50%, 20px);
  padding: 11px 20px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-left: 3px solid var(--amber);
  border-radius: var(--radius);
  font-size: 13px;
  opacity: 0; pointer-events: none;
  transition: opacity .25s, transform .25s;
  z-index: 100;
  max-width: 70vw;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.ok { border-left-color: var(--green); }
.toast.err { border-left-color: var(--red); }

/* ---------------- адаптив ---------------- */
@media (max-width: 1100px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; max-height: none; }
  .stats { display: none; }
}

/* ============================================================
   ФИЛЬТРЫ ПО ПАРАМЕТРАМ
   ============================================================ */
.filterbar {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: 14px;
  padding: 14px 16px;
  margin-bottom: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.fb-group { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.fb-group > label {
  font-size: 10px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--dim);
}
.fb-pair { display: flex; align-items: center; gap: 5px; }
.fb-pair input { width: 82px; }
.fb-pair .dash { color: var(--dim); font-size: 11px; }
.fb-group select { min-width: 118px; }
.fb-group > input { width: 118px; }
.fb-reset { margin-left: auto; align-self: flex-end; }

/* ---------------- двойной ползунок цены ---------------- */
.dual {
  position: relative;
  width: 190px;
  height: 22px;
  display: flex;
  align-items: center;
}
.dual-track {
  position: absolute;
  left: 0; right: 0;
  height: 3px;
  background: var(--line);
  border-radius: 2px;
}
.dual-fill {
  position: absolute;
  height: 100%;
  background: var(--amber);
  border-radius: 2px;
  box-shadow: 0 0 8px rgba(255, 176, 32, .45);
}
.dual input[type="range"] {
  position: absolute;
  left: 0;
  width: 100%;
  height: 22px;
  margin: 0;
  background: none;
  pointer-events: none;
  -webkit-appearance: none;
  appearance: none;
}
.dual input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  pointer-events: auto;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--amber);
  border: 2px solid #0a0c0f;
  cursor: grab;
  box-shadow: 0 0 8px rgba(255, 176, 32, .6);
}
.dual input[type="range"]::-webkit-slider-thumb:active { cursor: grabbing; }
.dual input[type="range"]::-moz-range-thumb {
  pointer-events: auto;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--amber);
  border: 2px solid #0a0c0f;
  cursor: grab;
}
.dual-values {
  display: flex;
  justify-content: space-between;
  width: 190px;
  margin-top: 3px;
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 10px;
  color: var(--muted);
}

.fb-sort select {
  min-width: 150px;
  border-color: var(--amber-dim);
  color: var(--amber);
  font-weight: 600;
}
.fb-sort select:focus { border-color: var(--amber); }

.range-scale {
  display: flex; justify-content: space-between;
  margin-top: 4px;
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 9.5px; color: var(--dim);
}

.h-count {
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 10px; color: var(--amber);
  border: 1px solid var(--amber-dim); border-radius: 2px;
  padding: 1px 5px; margin-left: 6px;
}

.btn-block { width: 100%; justify-content: center; margin-top: 8px; }

/* ---------------- форма нового профиля ---------------- */
.profile-form {
  margin-top: 10px;
  padding: 12px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: #0d1116;
}
.profile-form[hidden] { display: none; }
.pf-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pf-row .field { margin-bottom: 8px; }
.pf-actions { display: flex; gap: 8px; margin-top: 4px; }
.pf-actions .btn { flex: 1; justify-content: center; }

/* ---------------- удаление профиля ---------------- */
.p-del {
  flex: none;
  width: 22px; height: 22px;
  display: grid; place-items: center;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 2px;
  color: var(--dim);
  font-size: 14px; line-height: 1;
  cursor: pointer;
  transition: color .15s, border-color .15s, background .15s;
}
.p-del:hover { color: var(--red); border-color: var(--red); background: rgba(255,93,93,.08); }

/* ============================================================
   КАРТА
   ============================================================ */
.mapbox {
  margin-top: 26px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.map-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}
.map-head h2 {
  margin: 0;
  font-family: "Bahnschrift", "DIN Alternate", sans-serif;
  font-size: 12px; font-weight: 700; letter-spacing: .18em; text-transform: uppercase;
  color: var(--muted);
}
.map-legend { display: flex; gap: 16px; flex-wrap: wrap; }
.lg {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 10.5px; color: var(--dim); letter-spacing: .04em;
}
.lg .dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.lg .dot.me { background: var(--amber); box-shadow: 0 0 8px rgba(255,176,32,.8); }
.lg .dot.p1 { background: var(--amber); }
.lg .dot.p3 { background: var(--teal); }
.lg .ring {
  width: 10px; height: 10px; border-radius: 50%;
  border: 1px dashed var(--dim); display: inline-block;
}

.map-wrap { position: relative; background: #080a0d; }
#map { display: block; width: 100%; height: auto; }

.map-grid { stroke: #151b23; stroke-width: 1; }
.map-ring { fill: none; stroke: #1e2733; stroke-width: 1; stroke-dasharray: 3 5; }
.map-ring-label {
  fill: var(--dim);
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 9px; letter-spacing: .08em;
}
.map-axis { stroke: #1a222c; stroke-width: 1; }

.map-me { fill: var(--amber); }
.map-me-halo { fill: rgba(255,176,32,.14); animation: halo 2.6s ease-out infinite; }
@keyframes halo {
  0% { r: 8; opacity: .8; }
  100% { r: 26; opacity: 0; }
}
.map-me-label {
  fill: var(--amber);
  font-family: "Bahnschrift", "DIN Alternate", sans-serif;
  font-size: 11px; font-weight: 700; letter-spacing: .12em;
}

.map-city { cursor: pointer; }
.map-city circle { transition: r .15s, fill-opacity .15s; }
.map-city:hover circle { fill-opacity: 1; }
.map-city text {
  fill: var(--muted);
  font-family: "Segoe UI", sans-serif;
  font-size: 9.5px;
  pointer-events: none;
  paint-order: stroke;
  stroke: #080a0d;
  stroke-width: 3px;
  stroke-linejoin: round;
}
.map-city:hover text { fill: var(--text); }
.map-city:focus { outline: none; }
.map-city:focus-visible circle { stroke: var(--text); stroke-width: 2; }

.map-pop {
  position: absolute;
  min-width: 240px; max-width: 320px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-left: 3px solid var(--amber);
  border-radius: var(--radius);
  padding: 10px 12px;
  box-shadow: 0 14px 40px rgba(0,0,0,.6);
  z-index: 20;
  font-size: 12px;
}
.map-pop[hidden] { display: none; }
.map-pop h4 {
  margin: 0 0 8px;
  font-size: 11px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted);
}
.map-pop a {
  display: flex; justify-content: space-between; gap: 10px;
  padding: 6px 0;
  border-top: 1px solid var(--line-soft);
  color: var(--text); text-decoration: none;
}
.map-pop a:hover { color: var(--amber); }
.map-pop a span:last-child {
  font-family: "Cascadia Mono", Consolas, monospace;
  color: var(--amber); white-space: nowrap;
}

/* ============================================================
   ДОСТУПНОСТЬ
   ============================================================ */
:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
}
.btn:focus-visible, .site:focus-visible, .card-link:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
}

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

@media (max-width: 760px) {
  .filterbar { gap: 10px; }
  .fb-group { flex: 1 1 140px; }
  .fb-pair input { width: 100%; }
  .fb-reset { margin-left: 0; width: 100%; justify-content: center; }
  .toolbar-right { width: 100%; }
  .toolbar-right .select { flex: 1 1 130px; }
}

/* ============================================================
   МОБИЛЬНЫЙ СЛОЙ (PWA)
   ============================================================ */
.mobile-only { display: none; }
.mobile-nav { display: none; }
.drawer-backdrop { display: none; }

@media (max-width: 760px) {
  body { padding-bottom: 68px; }

  .mobile-only { display: inline-flex; }

  /* --- верхняя панель --- */
  .topbar {
    padding: 10px 14px;
    gap: 10px;
    flex-wrap: nowrap;
  }
  .progress { top: 54px; }
  .progress-label { padding: 4px 14px; font-size: 10px; }
  .brand-sub { display: none; }
  .mark { width: 32px; height: 32px; font-size: 13px; }
  .brand-name { font-size: 14px; letter-spacing: .12em; }
  .status { min-width: 0; flex: 1; }
  .status-text { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .status-phase { display: none; }
  .stats { display: none; }
  .controls { gap: 6px; }
  .controls .btn { padding: 9px 12px; font-size: 11px; }

  /* --- раскладка --- */
  .layout {
    grid-template-columns: 1fr;
    padding: 12px 14px 20px;
    gap: 12px;
  }

  /* --- боковая панель как выдвижной ящик --- */
  .sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: min(88vw, 360px);
    max-height: none;
    z-index: 90;
    padding: 16px 14px 90px;
    background: var(--bg);
    border-right: 1px solid var(--line);
    transform: translateX(-102%);
    transition: transform .26s cubic-bezier(.4, 0, .2, 1);
    overflow-y: auto;
    box-shadow: 24px 0 60px rgba(0, 0, 0, .6);
  }
  .sidebar.open { transform: none; }

  .drawer-backdrop {
    display: block;
    position: fixed; inset: 0;
    background: rgba(0, 0, 0, .6);
    backdrop-filter: blur(2px);
    z-index: 85;
  }
  .drawer-backdrop[hidden] { display: none; }

  /* --- фильтры сворачиваются --- */
  .filterbar {
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding: 14px;
  }
  .filterbar.open { display: flex; }
  .fb-group { flex: 1 1 auto; }
  .fb-pair input { width: 100%; }
  .fb-group select, .fb-group > input { width: 100%; min-width: 0; }
  .fb-reset { width: 100%; justify-content: center; margin-left: 0; }

  /* --- тулбар --- */
  .toolbar { gap: 10px; }
  .toolbar h1 { font-size: 19px; }
  .toolbar-right {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .toolbar-right .select { width: 100%; min-width: 0; }
  .toolbar-right .btn { justify-content: center; }
  .toolbar-right .btn-accent { grid-column: 1 / -1; }

  /* --- карточки --- */
  .results { grid-template-columns: 1fr; gap: 12px; }
  .card-photo { aspect-ratio: 16 / 10; }
  .card-body { padding: 13px 14px 14px; }
  .card-title { font-size: 15px; }
  .card-price { font-size: 21px; }
  .card-link {
    padding: 12px 16px;
    font-size: 13px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }

  /* --- карта --- */
  .map-head { padding: 10px 14px; }
  .map-legend { gap: 10px; }
  .lg { font-size: 9.5px; }
  .map-pop {
    left: 8px !important;
    right: 8px;
    max-width: none;
    bottom: 8px;
    top: auto !important;
  }

  /* --- нижняя навигация --- */
  .mobile-nav {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 95;
    background: rgba(10, 12, 15, .96);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--line);
    box-shadow: 0 -12px 30px rgba(0, 0, 0, .55);
    padding-bottom: env(safe-area-inset-bottom, 0);
  }
  .mobile-nav button {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-height: 56px;
    padding: 8px 4px;
    background: none;
    border: none;
    color: var(--dim);
    font-family: "Bahnschrift", "DIN Alternate", sans-serif;
    font-size: 10px;
    letter-spacing: .08em;
    text-transform: uppercase;
    cursor: pointer;
    transition: color .15s;
  }
  .mobile-nav button.active { color: var(--amber); }
  .mobile-nav button:active { background: rgba(255, 176, 32, .06); }
  .nav-ico { font-size: 17px; line-height: 1; }

  /* --- журнал --- */
  .logbox { margin-top: 16px; }
}

@media (max-width: 380px) {
  .brand-name { display: none; }
  .toolbar-right { grid-template-columns: 1fr; }
}

/* ============================================================
   TELEGRAM MINI APP
   ============================================================ */
body.tg .topbar { padding-top: max(10px, env(safe-area-inset-top)); }
body.tg .mobile-nav { padding-bottom: max(env(safe-area-inset-bottom, 0px), 4px); }
body.tg .layout { padding-bottom: 24px; }
