/* Ловец объявлений — мотив ценника: цена набрана широким Unbounded на «бирке»,
   новые объявления отмечены жёлтым маркером, как обводят объявления в газете. */
:root {
  --fog: #EDF0F3;
  --paper: #FFFFFF;
  --ink: #17202B;
  --slate: #5D6B7B;
  --line: #D8DEE5;
  --marker: #FFC933;
  --marker-soft: #FFF3C9;
  --drop: #13804B;
  --drop-soft: #E2F3E9;
  --danger: #B3261E;
  --tag: #17202B;
  --tag-ink: #FFFFFF;
  --focus: #2F6FDB;
  --radius-card: 16px;
  --radius-ctl: 12px;
  --pad: 16px;
  --tabbar-h: 58px;
  --sans: "Golos Text", -apple-system, "Segoe UI", Roboto, sans-serif;
  --wide: "Unbounded", "Golos Text", -apple-system, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --fog: #10151B; --paper: #19212A; --ink: #E8EDF2; --slate: #93A1B0; --line: #2A3540;
    --marker: #F5C33B; --marker-soft: #3A3218; --drop: #3BB273; --drop-soft: #15301F;
    --danger: #F2827A; --tag: #E8EDF2; --tag-ink: #10151B; --focus: #7FA7FF;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --fog: #10151B; --paper: #19212A; --ink: #E8EDF2; --slate: #93A1B0; --line: #2A3540;
  --marker: #F5C33B; --marker-soft: #3A3218; --drop: #3BB273; --drop-soft: #15301F;
  --danger: #F2827A; --tag: #E8EDF2; --tag-ink: #10151B; --focus: #7FA7FF;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--fog); color: var(--ink);
  font: 16px/1.45 var(--sans);
  -webkit-font-smoothing: antialiased;
  padding: env(safe-area-inset-top) 0 calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 12px);
  min-height: 100dvh;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
a { color: inherit; }
[hidden] { display: none !important; }

.screen { max-width: 680px; margin: 0 auto; padding: 0 var(--pad); }
.head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 18px 0 12px;
}
.head h1 {
  font: 700 22px/1.15 var(--wide); letter-spacing: -0.01em; margin: 0;
}
.head .sub { color: var(--slate); font-size: 14px; margin-top: 4px; }

/* ---------- кнопки ---------- */
.btn {
  border: 0; border-radius: var(--radius-ctl); padding: 12px 16px; font-weight: 600;
  background: var(--ink); color: var(--fog); min-height: 44px;
}
.btn.ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--line); }
.btn.soft { background: var(--paper); color: var(--ink); }
.btn.danger { background: transparent; color: var(--danger); box-shadow: inset 0 0 0 1.5px currentColor; }
.btn.wide { width: 100%; }
.btn:disabled { opacity: .45; }
.icon-btn {
  border: 0; background: var(--paper); width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center; color: var(--ink);
}
.icon-btn svg { width: 22px; height: 22px; }

/* ---------- фильтр по поискам (лента) ---------- */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px var(--pad) 12px; margin: 0 calc(-1 * var(--pad));
  scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; border: 0; border-radius: 999px; padding: 8px 14px; background: var(--paper);
  font-size: 14px; font-weight: 500; white-space: nowrap; color: var(--ink);
}
.chip[aria-pressed="true"] { background: var(--ink); color: var(--fog); }

/* ---------- карточка объявления ---------- */
.feed { display: flex; flex-direction: column; gap: 10px; }
.hit {
  position: relative; display: grid; grid-template-columns: 96px 1fr; gap: 12px;
  background: var(--paper); border-radius: var(--radius-card); padding: 10px;
  text-decoration: none; color: inherit;
}
.hit.unread::before {            /* жёлтый маркер нового */
  content: ""; position: absolute; left: 0; top: 14px; bottom: 14px; width: 4px;
  border-radius: 0 4px 4px 0; background: var(--marker);
}
.hit .ph {
  width: 96px; height: 96px; border-radius: 10px; object-fit: cover; background: var(--fog);
  display: grid; place-items: center; color: var(--slate); font-size: 12px; text-align: center;
}
.hit .body { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.hit .title {
  font-weight: 600; font-size: 15px; line-height: 1.3; margin: 0; padding-right: 36px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.hit .facts { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 13px; color: var(--slate); }
.hit .row { display: flex; align-items: center; gap: 10px; margin-top: auto; flex-wrap: wrap; }
.hit .src { font-size: 12px; color: var(--slate); }
.hit .fav {
  position: absolute; top: 6px; right: 6px; border: 0; background: transparent; width: 40px; height: 40px;
  display: grid; place-items: center; color: var(--slate);
}
.hit .fav[aria-pressed="true"] { color: var(--marker); }
.hit .fav svg { width: 22px; height: 22px; }
.hit .note { font-size: 12px; color: var(--slate); }
.hit.sample { opacity: .82; }

/* ценник: бирка с вырезом и «дыркой» под верёвочку */
.tag {
  --h: 30px;
  position: relative; display: inline-flex; align-items: center; height: var(--h);
  padding: 0 12px 0 22px; background: var(--tag); color: var(--tag-ink);
  font: 700 14px/1 var(--wide); letter-spacing: -0.01em; white-space: nowrap;
  clip-path: polygon(10px 0, 100% 0, 100% 100%, 10px 100%, 0 50%);
  border-radius: 0 6px 6px 0;
}
.tag::before {
  content: ""; position: absolute; left: 9px; top: 50%; width: 6px; height: 6px; margin-top: -3px;
  border-radius: 50%; background: var(--paper);
}
.tag.drop { background: var(--drop); color: #fff; }
.was { font-size: 13px; color: var(--slate); text-decoration: line-through; }
.badge-drop { font-size: 12px; font-weight: 600; color: var(--drop); background: var(--drop-soft);
  padding: 3px 8px; border-radius: 999px; }

.more { margin: 14px 0; }
.empty {
  background: var(--paper); border-radius: var(--radius-card); padding: 24px 20px; text-align: left;
}
.empty h2 { font: 700 18px/1.25 var(--wide); margin: 0 0 8px; }
.empty p { margin: 0 0 16px; color: var(--slate); }

/* ---------- поиски ---------- */
.search {
  background: var(--paper); border-radius: var(--radius-card); padding: 14px 16px; margin-bottom: 10px;
}
.search .top { display: flex; gap: 12px; align-items: flex-start; }
.search h3 { font-size: 16px; font-weight: 600; margin: 0; line-height: 1.3; flex: 1; }
.search .filters { font-size: 14px; color: var(--slate); margin: 6px 0 10px; }
.search .sites { display: flex; flex-direction: column; gap: 4px; font-size: 13px; margin-bottom: 12px; }
.search .sites .err { color: var(--danger); }
.search .sites .ok { color: var(--slate); }
.search .stats { display: flex; gap: 16px; font-size: 13px; color: var(--slate); margin-bottom: 12px; }
.search .stats b { color: var(--ink); font-weight: 600; }
.search .actions { display: flex; gap: 8px; }
.search .actions .btn { flex: 1; padding: 10px; min-height: 40px; font-size: 15px; }
.search.off h3, .search.off .filters { opacity: .55; }

/* переключатель */
.switch { position: relative; width: 50px; height: 30px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.switch span {
  position: absolute; inset: 0; border-radius: 999px; background: var(--line); transition: background .15s;
  pointer-events: none;
}
.switch span::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform .15s;
}
.switch input:checked + span { background: var(--drop); }
.switch input:checked + span::after { transform: translateX(20px); }
.switch input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 2px; }

/* ---------- форма поиска ---------- */
.sheet { padding-bottom: 24px; }
.cats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 8px; }
.cat {
  border: 0; background: var(--paper); border-radius: var(--radius-card); padding: 18px 14px; text-align: left;
  font-weight: 600; font-size: 16px; min-height: 84px; display: flex; flex-direction: column; gap: 6px;
}
.cat .emo { font-size: 26px; line-height: 1; }
.cat small { color: var(--slate); font-weight: 400; font-size: 13px; }
.group { background: var(--paper); border-radius: var(--radius-card); padding: 4px 16px; margin-bottom: 14px; }
.group-title { font-size: 14px; color: var(--slate); margin: 18px 4px 8px; font-weight: 500; }
.field { display: block; padding: 12px 0; border-bottom: 1px solid var(--line); }
.field:last-child { border-bottom: 0; }
.field .lbl { display: block; font-size: 13px; color: var(--slate); margin-bottom: 4px; }
.field input[type="text"], .field input[type="number"], .field input[type="search"], .field input[type="password"] {
  width: 100%; border: 0; background: transparent; padding: 4px 0; font-size: 17px; outline: none;
}
.field input::placeholder { color: var(--slate); opacity: .6; }
.field .req { color: var(--danger); }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.seg { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 4px; }
.seg button {
  border: 0; border-radius: 10px; padding: 9px 14px; background: var(--fog); font-weight: 500; min-height: 40px;
}
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--fog); }
.site-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0;
  border-bottom: 1px solid var(--line); }
.site-row:last-child { border-bottom: 0; }
.site-row .nm { font-weight: 500; }
.site-row small { display: block; color: var(--slate); font-size: 13px; }
.hint { font-size: 13px; color: var(--slate); margin: 6px 4px 0; }
.form-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 20px; }

/* ---------- настройки ---------- */
.card { background: var(--paper); border-radius: var(--radius-card); padding: 16px; margin-bottom: 12px; }
.card h2 { font-size: 17px; margin: 0 0 6px; }
.card p { margin: 0 0 12px; color: var(--slate); font-size: 15px; }
.card .btn + .btn { margin-top: 8px; }
.status { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; margin-bottom: 12px; }
.status::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--line); }
.status.on::before { background: var(--drop); }
.status.off::before { background: var(--danger); }
.steps { margin: 0; padding-left: 20px; color: var(--ink); }
.steps li { margin-bottom: 6px; }

.install {
  background: var(--marker-soft); border-radius: var(--radius-card); padding: 14px 16px; margin-bottom: 12px;
  font-size: 15px; display: flex; gap: 12px; align-items: flex-start;
}
.install b { display: block; margin-bottom: 2px; }
.install .x { margin-left: auto; border: 0; background: transparent; font-size: 22px; line-height: 1; padding: 0 4px; color: var(--slate); }

/* ---------- вход ---------- */
.login { min-height: 80dvh; display: flex; flex-direction: column; justify-content: center; gap: 16px; }
.login .mark { width: 72px; height: 72px; }
.login h1 { font: 700 26px/1.15 var(--wide); margin: 0; }
.login p { margin: 0; color: var(--slate); }
.err-text { color: var(--danger); font-size: 14px; min-height: 20px; }

/* ---------- нижняя панель ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: grid; grid-template-columns: repeat(4, 1fr);
  padding: 4px 6px env(safe-area-inset-bottom); height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  -webkit-backdrop-filter: saturate(160%) blur(16px); backdrop-filter: saturate(160%) blur(16px);
  border-top: 1px solid var(--line);
}
.tabbar a {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  text-decoration: none; color: var(--slate); font-size: 11px; font-weight: 500;
}
.tabbar a svg { width: 24px; height: 24px; }
.tabbar a[aria-current="page"] { color: var(--ink); }
.tabbar .dot {
  position: absolute; top: 2px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: var(--marker); color: #17202B; font-size: 11px; font-weight: 700;
  display: grid; place-items: center;
}

.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 14px);
  transform: translateX(-50%); z-index: 20; max-width: calc(100% - 32px);
  background: var(--ink); color: var(--fog); padding: 12px 16px; border-radius: 12px; font-size: 15px;
  box-shadow: 0 6px 24px rgba(0,0,0,.18);
}

.busy {
  position: fixed; inset: 0; z-index: 30; display: grid; place-items: center;
  background: color-mix(in srgb, var(--fog) 80%, transparent);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.busy .box { background: var(--paper); border-radius: var(--radius-card); padding: 22px 24px; max-width: 300px; text-align: center; }
.busy .spin {
  width: 34px; height: 34px; margin: 0 auto 12px; border-radius: 50%;
  border: 3px solid var(--line); border-top-color: var(--ink); animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* форма открывается «снизу вверх» — ответ на нажатие */
.slide-up { animation: up .22s ease-out; }
@keyframes up { from { transform: translateY(16px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .slide-up, .busy .spin { animation: none; }
  .switch span, .switch span::after { transition: none; }
}

.demo-bar { background: var(--marker); color: var(--tag-ink-fixed, #17202B); text-align: center; font-size: 13px; padding: 6px 12px; font-weight: 500; }

.search .btn.soft { background: var(--fog); }
.hit .title a { text-decoration: none; }
.hit .sname { flex-basis: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: -4px; }
.chip { max-width: 240px; overflow: hidden; text-overflow: ellipsis; }
.search .stats { flex-wrap: wrap; gap: 4px 16px; }
.search .stats span { white-space: nowrap; }
.pair { border-bottom: 1px solid var(--line); }
.pair:last-child { border-bottom: 0; }
.pair .field { border-bottom: 0; }
.status { align-items: flex-start; }
.status::before { flex: none; margin-top: 7px; }
