:root {
  --bg: #f6f7f9; --panel: #ffffff; --text: #111827; --muted: #6b7280; --line: #e5e7eb;
  --brand: #0f766e; --brand-2: #0d9488; --brand-soft: #e6f4f2; --warn: #b45309; --warn-soft: #fef3c7;
  --no: #b91c1c; --yes: #047857; --chip: #f3f4f6; --shadow: 0 1px 2px rgba(0,0,0,.05), 0 4px 16px rgba(0,0,0,.04);
  --radius: 14px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0f14; --panel: #121821; --text: #e5e7eb; --muted: #9ca3af; --line: #1f2937;
    --brand: #2dd4bf; --brand-2: #5eead4; --brand-soft: #0f2a2a; --warn: #fbbf24; --warn-soft: #3a2a07;
    --no: #f87171; --yes: #34d399; --chip: #1b2330; --shadow: none;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif; background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.45; }
a { color: var(--brand); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.muted { color: var(--muted); }
h1 { font-size: 1.35rem; margin: 0; letter-spacing: -.01em; }
h2 { font-size: 1.05rem; margin: 0; }
h3 { font-size: .95rem; margin: 0; }

.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 10px 20px; background: var(--panel); border-bottom: 1px solid var(--line); }
.logo { display: flex; align-items: center; gap: 8px; color: var(--brand); text-decoration: none; font-size: 1.2rem; font-weight: 500; }
.logo span { color: var(--text); } .logo b { color: var(--brand); }
.loc { margin-left: auto; display: flex; gap: 8px; align-items: center; }
select { font: inherit; color: inherit; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; max-width: 220px; }
.btn { font: inherit; border: 1px solid var(--line); background: var(--panel); color: var(--text); padding: 8px 14px; border-radius: 10px; cursor: pointer; display: inline-flex; gap: 6px; align-items: center; justify-content: center; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
@media (prefers-color-scheme: dark) { .btn.primary { color: #042f2e; } }
.btn.ghost:hover { border-color: var(--brand); }
.btn.block { width: 100%; margin-top: 12px; }
.link { background: none; border: 0; color: var(--brand); cursor: pointer; font: inherit; padding: 0; }

.layout { display: grid; grid-template-columns: 320px 1fr; gap: 20px; max-width: 1320px; margin: 0 auto; padding: 20px; }
.filters { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; align-self: start; position: sticky; top: 76px; max-height: calc(100vh - 96px); overflow: auto; box-shadow: var(--shadow); }
.filters-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.filters-head h2 { margin-right: auto; }
.bucket { border-top: 1px solid var(--line); padding: 12px 0; }
.bucket:first-child { border-top: 0; }
.bucket > summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; font-weight: 600; }
.bucket > summary::-webkit-details-marker { display: none; }
.bucket > summary::after { content: '▾'; color: var(--muted); transition: transform .15s; }
.bucket:not([open]) > summary::after { transform: rotate(-90deg); }
.bucket .count { font-weight: 500; color: var(--brand); font-size: .8rem; margin-left: 6px; }
.group { margin-top: 10px; }
.group .label { font-size: .8rem; color: var(--muted); margin-bottom: 6px; text-transform: uppercase; letter-spacing: .04em; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--line); background: var(--chip); color: var(--text); border-radius: 999px; padding: 5px 11px; font: inherit; font-size: .85rem; cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: #fff; }
@media (prefers-color-scheme: dark) { .chip[aria-pressed="true"] { color: #042f2e; } }
.range { display: flex; gap: 8px; align-items: center; }
.range input { width: 100%; font: inherit; color: inherit; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 7px 9px; }
.toggle { display: flex; align-items: center; gap: 8px; font-size: .9rem; margin-top: 8px; cursor: pointer; }
.toggle input { accent-color: var(--brand); width: 16px; height: 16px; }
.hint { font-size: .78rem; color: var(--muted); margin-top: 6px; }

.results-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-end; margin-bottom: 10px; flex-wrap: wrap; }
.results-head p { margin: 4px 0 0; }
.sort { display: flex; gap: 8px; align-items: center; }
.active-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.active-chips .chip { background: var(--brand-soft); border-color: transparent; }
.list { display: grid; gap: 12px; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.card-main { display: grid; grid-template-columns: 140px 1fr auto; gap: 16px; padding: 14px 16px; align-items: center; }
.thumb { width: 140px; height: 84px; border-radius: 10px; background: var(--chip); display: grid; place-items: center; overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: contain; }
.thumb .ph { font-weight: 700; color: var(--muted); font-size: 1.4rem; }
.card h3 { font-size: 1.05rem; }
.card .brand { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; }
.meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.tag { font-size: .75rem; background: var(--chip); border-radius: 6px; padding: 2px 7px; color: var(--muted); }
.tag.good { background: var(--brand-soft); color: var(--brand); }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.price { text-align: right; white-space: nowrap; }
.price .big { font-size: 1.15rem; font-weight: 700; }
.price .small { font-size: .78rem; color: var(--muted); }
.card-foot { display: flex; justify-content: space-between; align-items: center; border-top: 1px solid var(--line); padding: 8px 16px; font-size: .88rem; }
.variants { border-top: 1px solid var(--line); overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: .88rem; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; background: var(--bg); }
td.num, th.num { text-align: right; white-space: nowrap; }
tr.v:hover td { background: var(--brand-soft); cursor: pointer; }
.miss { color: var(--no); font-size: .78rem; }
.unk { color: var(--warn); font-size: .78rem; }
.yes { color: var(--yes); }
.no { color: var(--no); }
.q { color: var(--warn); }
.empty { background: var(--panel); border: 1px dashed var(--line); border-radius: var(--radius); padding: 30px; text-align: center; }

.compare-bar { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 8px 10px 8px 18px; display: flex; gap: 12px; align-items: center; box-shadow: 0 8px 30px rgba(0,0,0,.15); z-index: 30; }

dialog { border: 0; border-radius: 16px; padding: 0; width: min(900px, calc(100vw - 24px)); max-height: calc(100vh - 40px); background: var(--panel); color: var(--text); }
dialog::backdrop { background: rgba(0,0,0,.45); }
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--panel); z-index: 1; }
.modal-body { padding: 16px 20px 24px; }
.breakup td:last-child { text-align: right; }
.breakup tr.total td { font-weight: 700; font-size: 1rem; border-bottom: 0; }
.fgrid { columns: 2 240px; column-gap: 24px; }
.fgrid section { break-inside: avoid; margin-bottom: 14px; }
.fgrid ul { list-style: none; padding: 0; margin: 6px 0 0; }
.fgrid li { padding: 3px 0; font-size: .9rem; display: flex; gap: 8px; }
.cmp th:first-child, .cmp td:first-child { position: sticky; left: 0; background: var(--panel); }
.note { background: var(--warn-soft); color: var(--warn); border-radius: 10px; padding: 8px 12px; font-size: .85rem; margin: 10px 0; }

.foot { max-width: 1320px; margin: 10px auto 60px; padding: 0 20px; font-size: .85rem; }
.only-mobile { display: none; }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; padding: 12px 16px; }
  .filters { position: fixed; inset: 0; top: 0; max-height: none; border-radius: 0; z-index: 40; transform: translateX(-100%); transition: transform .2s; }
  .filters.open { transform: none; }
  .only-mobile { display: inline-flex; }
  .topbar { padding: 8px 16px; flex-wrap: wrap; }
  .loc { order: 3; width: 100%; margin: 0; }
  .loc select { flex: 1; max-width: none; min-width: 0; }
  .loc .btn { flex: none; }
  #openFilters { margin-left: auto; }
  .card-main { grid-template-columns: 84px 1fr; }
  .thumb { width: 84px; height: 60px; }
  .price { grid-column: 1 / -1; text-align: left; display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
  .hide-sm { display: none; }
}
