:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --text: #1c2026;
  --muted: #6b7380;
  --border: #dde1e7;
  --accent: #1f6feb;
  --accent-soft: #e3edfd;
  --row-hover: #f3f6fb;
  --ok: #1a7f37;      --ok-bg: #dcf3e3;
  --warn: #9a6700;    --warn-bg: #fff1c7;
  --bad: #c62828;     --bad-bg: #fde2e1;
  --info: #0b62c4;    --info-bg: #dcebfd;
  --neutral: #57606a; --neutral-bg: #eaeef2;
  --bar: #4c8df6;
  --radius: 8px;
  --mono: ui-monospace, "Cascadia Code", Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1216;
    --surface: #171b21;
    --surface-2: #1f242c;
    --text: #e3e7ed;
    --muted: #8b95a3;
    --border: #2b323c;
    --accent: #6ea8ff;
    --accent-soft: #1b2b44;
    --row-hover: #1c222a;
    --ok: #5bd17e;      --ok-bg: #16301f;
    --warn: #e8b84a;    --warn-bg: #352a10;
    --bad: #ff7b72;     --bad-bg: #3d1a1a;
    --info: #79b8ff;    --info-bg: #142a45;
    --neutral: #a3adba; --neutral-bg: #262c35;
    --bar: #5a96f0;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

h1 { font-size: 1.55rem; margin: 0 0 .4rem; line-height: 1.25; }
h2 { font-size: 1.1rem; margin: 1.6rem 0 .6rem; }
.panel h2 { margin-top: 0; }

code, .mono { font-family: var(--mono); font-size: .9em; }
.muted { color: var(--muted); }
.small { font-size: .85em; font-weight: normal; }
.nowrap { white-space: nowrap; }

/* ---- шапка ---- */
.topbar {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: .7rem 1.5rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand { font-weight: 700; color: var(--text); letter-spacing: .01em; }
.topbar nav { display: flex; flex-wrap: wrap; gap: .25rem; }
.topbar nav a {
  padding: .35rem .7rem;
  border-radius: 6px;
  color: var(--muted);
}
.topbar nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.topbar nav a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.topbar nav a.api { font-family: var(--mono); font-size: .85em; align-self: center; }

main { max-width: 1400px; margin: 0 auto; padding: 1.4rem 1.5rem 3rem; }

.crumbs { margin: 0 0 .5rem; font-size: .9em; }
.meta { margin: 0 0 1.2rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.summary { margin: .8rem 0; display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }

/* ---- фильтры ---- */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  align-items: flex-end;
  padding: .9rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.filters label { display: flex; flex-direction: column; gap: .25rem; font-size: .8rem; color: var(--muted); }
.filters label.grow { flex: 1 1 240px; }
.filters label.price input { width: 8.5rem; }
.filters .actions { display: flex; gap: .75rem; align-items: center; }

input, select, button {
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: .4rem .6rem;
}
select { max-width: 16rem; }
input:focus, select:focus, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
button[type="submit"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  cursor: pointer;
  padding: .4rem 1.1rem;
}
@media (prefers-color-scheme: dark) {
  button[type="submit"] { color: #0f1216; }
}
.link-btn {
  border: 0;
  background: none;
  padding: 0;
  color: var(--accent);
  cursor: pointer;
}
.link-btn:hover { text-decoration: underline; }

/* ---- таблицы ---- */
.table-wrap {
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.table-wrap.narrow { max-width: 900px; }

table.data { width: 100%; border-collapse: collapse; }
table.data th, table.data td {
  padding: .5rem .75rem;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--border);
}
table.data thead th {
  background: var(--surface-2);
  font-size: .8rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .03em;
  white-space: nowrap;
  position: sticky;
  top: 0;
}
table.data tbody tr:last-child > * { border-bottom: 0; }
table.data tbody tr:hover { background: var(--row-hover); }
table.data .num { text-align: right; font-variant-numeric: tabular-nums; }
table.data td.title { min-width: 16rem; }
table.data td.url { max-width: 18rem; }
table.data td.url a { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
table.data td.reason { min-width: 14rem; }
table.data td.detail { min-width: 14rem; max-width: 28rem; }
th.sortable a { color: inherit; }
th.sortable a:hover { color: var(--accent); text-decoration: none; }
th[aria-sort] a { color: var(--accent); }
.arrow { font-size: .75em; }

table.data .empty-row td { text-align: center; color: var(--muted); padding: 2rem; }
.empty { color: var(--muted); font-style: italic; margin: .4rem 0; }

table.params th { width: 40%; font-weight: 500; color: var(--muted); }
table.stars th { width: 7rem; }
table.stars td.num { width: 5rem; }
.star-on { color: #f5a623; letter-spacing: .05em; }
.star-off { color: var(--border); letter-spacing: .05em; }

/* ---- бейджи ---- */
.badge {
  display: inline-block;
  padding: .1rem .5rem;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 600;
  line-height: 1.5;
  white-space: nowrap;
  background: var(--neutral-bg);
  color: var(--neutral);
}
.badge.ok, .badge.private { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }
.badge.info, .badge.company { background: var(--info-bg); color: var(--info); }
.badge.c1 { background: #ede4fd; color: #6639ba; }
.badge.c2 { background: #fde4f2; color: #a2286e; }
.badge.c3 { background: #dff5f5; color: #127373; }
.badge.c4 { background: #fdebdc; color: #a04b0c; }
.badge.c5 { background: #e6efd9; color: #4d6b1f; }
.badge.c6 { background: #e4e8fd; color: #3a4bb0; }
@media (prefers-color-scheme: dark) {
  .badge.c1 { background: #2c2147; color: #c5a6ff; }
  .badge.c2 { background: #42182f; color: #ff9ad2; }
  .badge.c3 { background: #133535; color: #7fdcdc; }
  .badge.c4 { background: #3d2510; color: #ffb27a; }
  .badge.c5 { background: #233016; color: #b4d97e; }
  .badge.c6 { background: #1d2447; color: #a3b1ff; }
}

/* ---- карточка ---- */
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 1rem; }
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
}
dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: .4rem 1rem; margin: 0; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; overflow-wrap: anywhere; }
dd.price { font-weight: 600; }

.gallery { display: flex; flex-wrap: wrap; gap: .75rem; }
.gallery img {
  display: block;
  width: 260px;
  height: 195px;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface-2);
}

.desc {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .9rem 1.1rem;
  max-width: 900px;
}
.desc-text { white-space: pre-line; margin: 0 0 .5rem; overflow-wrap: anywhere; }
.desc-text:last-child { margin-bottom: 0; }

/* ---- мини-графики ---- */
.chart-col { width: 40%; min-width: 120px; vertical-align: middle !important; }
.hbar {
  height: .7rem;
  width: var(--w, 0%);
  min-width: 2px;
  background: var(--bar);
  border-radius: 3px;
}
.up { color: var(--bad); }
.down { color: var(--ok); }

/* ---- JSON ---- */
details.json summary {
  cursor: pointer;
  font-family: var(--mono);
  font-size: .82rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
details.json[open] summary { color: var(--text); }
details.json pre, pre.hint {
  margin: .5rem 0 0;
  padding: .6rem .75rem;
  background: var(--surface-2);
  border-radius: 6px;
  font-family: var(--mono);
  font-size: .8rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 24rem;
  overflow: auto;
}

/* ---- пагинация ---- */
.pager { display: flex; flex-wrap: wrap; gap: .3rem; margin: 1rem 0; align-items: center; }
.pager a, .pager span {
  min-width: 2.2rem;
  padding: .3rem .6rem;
  text-align: center;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
}
.pager a:hover { border-color: var(--accent); text-decoration: none; }
.pager .current { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.pager .disabled { color: var(--muted); opacity: .5; }
.pager .gap { border: 0; background: none; }
@media (prefers-color-scheme: dark) {
  .pager .current { color: #0f1216; }
}

.error-box { max-width: 640px; margin: 3rem auto; text-align: center; }
.error-box h1 { font-size: 3rem; color: var(--muted); }
.error-box pre.hint { text-align: left; }

@media (max-width: 640px) {
  .topbar { flex-direction: column; align-items: flex-start; gap: .4rem; padding: .6rem 1rem; }
  main { padding: 1rem; }
}

/* ---- v0.2: вход ---- */
.topbar .logout { margin-left: auto; }
.topbar .logout button, button.link-btn[type="submit"] {
  background: none; border: 0; padding: 0; color: var(--muted); cursor: pointer;
}
.topbar .logout button:hover { color: var(--text); text-decoration: underline; }
.login-box { max-width: 360px; margin: 4rem auto; display: flex; flex-direction: column; gap: .9rem; }
.login-box h1 { margin: 0; }
label.field { display: flex; flex-direction: column; gap: .3rem; font-size: .85rem; color: var(--muted); }
.form-error { margin: 0; padding: .5rem .75rem; border-radius: 6px; background: var(--bad-bg); color: var(--bad); }

/* ---- v0.2: формы, баннер, прокси ---- */
.banner {
  padding: .6rem 1.5rem;
  background: var(--warn-bg);
  color: var(--warn);
  border-bottom: 1px solid var(--border);
  font-weight: 600;
}
.banner a { color: inherit; text-decoration: underline; }
textarea {
  font: inherit; font-family: var(--mono); font-size: .85rem;
  color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 6px; padding: .5rem .6rem;
  width: 100%; resize: vertical;
}
textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
button { cursor: pointer; }
button:disabled { opacity: .55; cursor: default; }
button.danger { color: var(--bad); }
.actions-cell { text-align: right; }
.actions-cell button { padding: .25rem .6rem; font-size: .85rem; }
table.data tr.row-active { background: var(--accent-soft); }
table.data tr.row-active:hover { background: var(--accent-soft); }
.form-panel { margin-top: 1.5rem; max-width: 900px; display: flex; flex-direction: column; gap: .8rem; }
.form-panel h2 { margin: 0; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: .8rem 1rem; align-items: end; }
.form-grid .wide { grid-column: 1 / -1; }
label.check { display: flex; align-items: center; gap: .45rem; font-size: .9rem; color: var(--text); }
.row-actions { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }
.form-ok { margin: 0; padding: .5rem .75rem; border-radius: 6px; background: var(--ok-bg); color: var(--ok); }
.hint-text { font-size: .8rem; color: var(--muted); margin: 0; }
fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: .7rem 1rem 1rem; margin: 0; }
legend { padding: 0 .4rem; color: var(--muted); font-size: .85rem; }

/* ---- v0.2: подписки, айтемы ---- */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.page-head h1 { margin-bottom: .3rem; }
a.button {
  display: inline-block; padding: .4rem 1rem; border-radius: 6px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
}
a.button:hover { text-decoration: none; background: var(--surface-2); }
a.button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
@media (prefers-color-scheme: dark) { a.button.primary { color: #0f1216; } }
form.inline { display: inline-flex; align-items: center; gap: .5rem; margin: 0; }
button.toggle, button.toggle[type="submit"] {
  position: relative; width: 2.4rem; height: 1.3rem; padding: 0;
  border-radius: 999px; border: 1px solid var(--border); background: var(--neutral-bg);
  vertical-align: middle; transition: background .15s;
}
button.toggle span {
  position: absolute; top: 50%; left: .15rem; width: .95rem; height: .95rem;
  margin-top: -.475rem; border-radius: 50%; background: var(--muted); transition: left .15s;
}
button.toggle.on, button.toggle.on[type="submit"] { background: var(--ok); border-color: var(--ok); }
button.toggle.on span { left: 1.25rem; background: #fff; }
table.data tr.row-off td { opacity: .6; }
table.data tr.row-off td:first-child { opacity: 1; }
.field-error { color: var(--bad); font-size: .8rem; }
.grow-input { flex: 1 1 320px; min-width: 0; }
.thumb-cell { width: 64px; padding-top: .3rem; padding-bottom: .3rem; }
.thumb {
  display: block; width: 56px; height: 42px; object-fit: cover;
  border-radius: 4px; background: var(--surface-2);
}
.thumb-empty { border: 1px dashed var(--border); }
a.thumb-link { display: block; }
td.badges { min-width: 8rem; }
td.badges .badge { margin: .1rem .15rem .1rem 0; }
.toolbar { display: flex; flex-wrap: wrap; gap: .75rem 1.5rem; align-items: center; margin: .5rem 0; }
.segmented { display: inline-flex; flex-wrap: wrap; align-items: center; gap: .2rem; }
.segmented a { padding: .25rem .65rem; border-radius: 6px; color: var(--muted); border: 1px solid transparent; }
.segmented a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.segmented a.current { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.kind-filter a:hover { text-decoration: none; }
.kind-link { display: inline-flex; align-items: center; gap: .3rem; padding: .1rem .35rem; border-radius: 999px; color: var(--muted); border: 1px solid transparent; }
.kind-link.current { border-color: var(--accent); color: var(--text); }

/* кнопка-иконка «открыть на Авито» в строках таблиц */
td.open-cell { width: 2.4rem; padding-left: .25rem; padding-right: .5rem; text-align: center; }
a.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 1.9rem; height: 1.9rem; border-radius: 6px;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--muted);
}
a.icon-btn:hover { color: var(--accent); border-color: var(--accent); text-decoration: none; }

/* O7: LLM-анализ */
.llm-panel { margin: 0 0 1rem; display: flex; flex-direction: column; gap: .6rem; }
.llm-answer { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.5; padding: .75rem 1rem; border-radius: 6px; background: var(--surface-2); }
.spinner { width: 1.1rem; height: 1.1rem; border-radius: 50%; border: 2px solid var(--border); border-top-color: var(--accent); animation: spin .8s linear infinite; }
.spinner[hidden] { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- карточка объявления ---------- */
.crumbs .sep { color: var(--muted); margin: 0 .2rem; }
.crumbs .back-link { margin-left: 1rem; }
.item-layout { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 1.75rem; align-items: start; margin-bottom: 1.5rem; }
.item-gallery { position: sticky; top: 1rem; min-width: 0; }
.gallery-main { position: relative; margin: 0; border-radius: var(--radius); overflow: hidden; background: var(--surface-2); aspect-ratio: 4 / 3; display: flex; align-items: center; justify-content: center; }
.gallery-main a { display: flex; width: 100%; height: 100%; align-items: center; justify-content: center; }
.gallery-main img { max-width: 100%; max-height: 100%; object-fit: contain; display: block; }
.gallery-empty span { color: var(--muted); }
.gal-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 2.4rem; height: 2.4rem; border-radius: 50%; border: 0; background: rgba(0,0,0,.45); color: #fff; font-size: 1.5rem; line-height: 1; opacity: 0; transition: opacity .15s; }
.gal-nav.prev { left: .6rem; } .gal-nav.next { right: .6rem; }
.gallery-main:hover .gal-nav, .gal-nav:focus-visible { opacity: 1; }
.gal-count { position: absolute; right: .6rem; bottom: .6rem; padding: .1rem .5rem; border-radius: 999px; background: rgba(0,0,0,.55); color: #fff; font-size: .8em; }
.gal-count .muted { color: #ddd; }
.gallery-thumbs { display: flex; gap: .5rem; overflow-x: auto; padding: .6rem 0 .2rem; scrollbar-width: thin; }
.gal-thumb { flex: 0 0 auto; width: 84px; height: 63px; padding: 0; border: 2px solid transparent; border-radius: 6px; overflow: hidden; background: var(--surface-2); }
.gal-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gal-thumb.active { border-color: var(--accent); }
.gal-thumb:hover { border-color: var(--border); }
.gal-thumb.active:hover { border-color: var(--accent); }
.item-info { min-width: 0; }
.item-info > section { margin-top: 1.4rem; }
.item-info h2 { margin: 0 0 .5rem; }
.price-row { display: flex; align-items: baseline; flex-wrap: wrap; gap: .6rem; }
.price-big { font-size: 2.1rem; font-weight: 700; letter-spacing: -.01em; white-space: nowrap; }
.drop-badge { font-size: .95em; }
.item-title { font-size: 1.35rem; margin: .35rem 0 .5rem; }
.item-badges { display: flex; flex-wrap: wrap; gap: .3rem; margin-bottom: .8rem; }
.item-actions { margin-bottom: 1rem; }
.item-facts { margin: 0; }
.seller-box { padding: .9rem 1rem; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); display: flex; flex-direction: column; gap: .6rem; }
.seller-box p { margin: 0; }
.seller-head { display: flex; gap: .75rem; align-items: center; }
.seller-avatar { flex: 0 0 auto; width: 2.6rem; height: 2.6rem; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 1.15rem; }
.seller-name { font-weight: 600; margin-right: .3rem; }
.spec-table { border-collapse: collapse; width: 100%; }
.spec-table th, .spec-table td { text-align: left; padding: .35rem .5rem .35rem 0; border-bottom: 1px dashed var(--border); vertical-align: top; }
.spec-table th { font-weight: normal; color: var(--muted); width: 45%; }
.item-info .llm-panel { margin: 1.2rem 0 0; }
.chart-panel { margin-bottom: 1rem; }
.price-chart { width: 100%; max-width: 900px; height: auto; display: block; }
.price-chart .grid { stroke: var(--border); stroke-width: 1; }
.price-chart .grid.v { stroke-dasharray: 3 4; }
.price-chart .axis-line { stroke: var(--muted); stroke-width: 1; }
.price-chart .axis { fill: var(--muted); font-size: 11px; font-family: inherit; }
.price-chart .line { fill: none; stroke: var(--accent); stroke-width: 2.25; stroke-linejoin: round; stroke-linecap: round; }
.price-chart .dot { fill: var(--surface); stroke: var(--accent); stroke-width: 2.25; }
.price-chart .hit { fill: transparent; }
.price-chart .pt:hover .dot { fill: var(--accent); }
.history-details, .tech-details { margin-top: .8rem; }
.history-details summary, .tech-details summary { cursor: pointer; color: var(--muted); }
.tech-details[open] summary { margin-bottom: .6rem; }
@media (max-width: 860px) {
  .item-layout { grid-template-columns: 1fr; gap: 1rem; }
  .item-gallery { position: static; }
  .gal-nav { opacity: 1; }
  .price-big { font-size: 1.8rem; }
}

/* фото, которое так и не загрузилось */
img.img-broken { visibility: hidden; }
.thumb-link:has(img.img-broken), .gallery-main:has(img.img-broken) { background: var(--surface-2) repeating-linear-gradient(45deg, transparent 0 6px, var(--border) 6px 7px); }

/* бейдж событий в меню */
.nav-count { display: inline-block; min-width: 1.4em; padding: 0 .4em; margin-left: .15rem; border-radius: 999px; background: var(--accent); color: #fff; font-size: .75em; font-weight: 600; text-align: center; line-height: 1.5; }

/* тост */
.toast { position: fixed; right: 1.2rem; bottom: 1.2rem; z-index: 50; max-width: min(90vw, 26rem); padding: .7rem 1rem; border-radius: var(--radius); background: var(--text); color: var(--bg); box-shadow: 0 6px 24px rgba(0,0,0,.25); }
.toast.bad { background: var(--warn-bg); color: var(--warn); border: 1px solid var(--warn); }
.toast[hidden] { display: none; }

/* сортируемые заголовки */
th.sortable a { display: inline-flex; align-items: center; gap: .25rem; }
th.sortable.num a { justify-content: flex-end; }
th.sortable .arrow { font-size: .7em; }
th.id-col, td.id-col { width: 1%; white-space: nowrap; }

/* шапка страницы, флеш, автообновление */
.head-actions { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.section-head { margin-top: 1.4rem; }
.section-head h2 { margin: 0; }
.flash { margin: .4rem 0 .8rem; padding: .5rem .75rem; border-radius: 6px; background: var(--info-bg); color: var(--info); }
.flash.ok { background: var(--ok-bg); color: var(--ok); }
label.autorefresh { color: var(--muted); font-size: .85rem; cursor: pointer; }

/* «⚡ Собрать сейчас» */
button.scan-btn, button.scan-btn[type="submit"] {
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
  padding: .4rem .9rem; white-space: nowrap;
}
button.scan-btn:hover { border-color: var(--accent); color: var(--accent); }
button.scan-btn.compact { width: 1.9rem; height: 1.9rem; padding: 0; display: inline-flex; align-items: center; justify-content: center; }
td.actions-col { white-space: nowrap; }
td.actions-col form.inline { gap: 0; margin-right: .3rem; vertical-align: middle; }
td.actions-col a.icon-btn { vertical-align: middle; }

/* чипсы */
.chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip { padding: .25rem .75rem; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--muted); font-size: .9rem; white-space: nowrap; }
.chip:hover { border-color: var(--accent); color: var(--text); text-decoration: none; }
.chip.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600; }
.chip.zero { opacity: .5; }
.llm-status p { margin: .2rem 0; }
.chip-n { font-size: .8rem; opacity: .7; font-variant-numeric: tabular-nums; margin-left: .15rem; }
.view-toggle { margin-left: auto; }

/* плитки */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1.1rem .9rem; }
.tile { position: relative; display: flex; flex-direction: column; min-width: 0; }
.tile.off { opacity: .6; }
.tile-img { display: block; aspect-ratio: 4 / 3; border-radius: var(--radius); overflow: hidden; background: var(--surface-2); }
.tile-img img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .2s; }
.tile:hover .tile-img img { transform: scale(1.03); }
.tile-img:has(img.img-broken) { background: var(--surface-2) repeating-linear-gradient(45deg, transparent 0 6px, var(--border) 6px 7px); }
.tile-noimg { display: flex; height: 100%; align-items: center; justify-content: center; color: var(--muted); font-size: .85rem; }
.tile-open { position: absolute; top: .4rem; right: .4rem; opacity: 0; transition: opacity .15s; }
.tile:hover .tile-open, .tile-open:focus-within { opacity: 1; }
.tile-body { padding: .5rem .1rem 0; display: flex; flex-direction: column; gap: .2rem; }
.tile-price { font-weight: 700; font-size: 1.1rem; white-space: nowrap; }
.tile-title { color: var(--text); line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.tile-title:hover { color: var(--accent); }
.tile-badges { display: flex; flex-wrap: wrap; gap: .2rem; }
.tile-badges .badge { font-size: .72rem; }
.tiles .empty { grid-column: 1 / -1; }
.list-view.view-table .list-tiles { display: none; }
.list-view.view-tiles .list-table { display: none; }

/* шапка: бренд не переносится, меню скроллится в одну строку */
.brand { white-space: nowrap; }
@media (max-width: 1100px) {
  .topbar { gap: 1rem; }
  .topbar nav { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; min-width: 0; }
  .topbar nav::-webkit-scrollbar { display: none; }
  .topbar nav a { white-space: nowrap; }
}
@media (max-width: 640px) {
  .topbar nav { width: 100%; }
  /* на телефоне айтемы всегда плитками */
  .list-view.view-table .list-tiles { display: grid; }
  .list-view.view-table .list-table, .view-toggle { display: none; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .9rem .6rem; }
  .tile-price { font-size: 1rem; }
}

/* ---- фильтры «за последние N» ---- */
.age-filter.on select { border-color: var(--accent); color: var(--accent); }
form.inline .age-filter { display: inline-flex; align-items: center; gap: .35rem; font-size: .85rem; color: var(--muted); }
form.inline .age-filter select { padding: .2rem .4rem; }
#window-form { flex-wrap: wrap; gap: .5rem 1rem; }

/* ---- форма подписки по шагам ---- */
.steps [hidden] { display: none !important; }
.step { display: flex; flex-direction: column; gap: .8rem; }
.step + .step { border-top: 1px solid var(--border); padding-top: 1rem; }
.steps[data-step] .step + .step { border-top: 0; padding-top: 0; }
.step h2 { display: flex; align-items: center; gap: .5rem; font-size: 1.1rem; }
.step-n {
  display: inline-flex; align-items: center; justify-content: center;
  width: 1.6rem; height: 1.6rem; border-radius: 50%;
  background: var(--accent); color: #fff; font-size: .85rem; font-weight: 600;
}
@media (prefers-color-scheme: dark) { .step-n { color: #0f1216; } }
.import-box { display: flex; flex-direction: column; gap: .5rem; padding: .8rem 1rem; border-radius: var(--radius); background: var(--surface-2); }
.import-box .field { font-size: .85rem; color: var(--muted); }
.import-box p { margin: 0; }
.or-line { text-align: center; }
.step-summary { margin: 0; padding: .5rem .8rem; border-radius: 6px; background: var(--surface-2); display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }
.step-summary span { font-weight: 600; overflow-wrap: anywhere; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; padding: .4rem 1.1rem; }
@media (prefers-color-scheme: dark) { button.primary { color: #0f1216; } }
button.secondary, button.secondary[type="submit"] { background: var(--surface); border-color: var(--border); color: var(--text); }
button.secondary:hover { border-color: var(--accent); color: var(--accent); }
.adv-details { border: 1px solid var(--border); border-radius: var(--radius); padding: .6rem 1rem; }
.adv-details summary { cursor: pointer; color: var(--muted); }
.adv-details[open] summary { margin-bottom: .8rem; color: var(--text); }
