:root {
  --bg: #f6f7f9; --card: #fff; --text: #1b1f24; --muted: #6b7280; --line: #e5e7eb;
  --accent: #e4002b; --good: #0a7d32; --chip: #eef0f3;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
/* Theme: data-theme="light" / "dark" on <html>; none = follow the system. */
:root[data-theme="dark"] { --bg: #111418; --card: #1a1e24; --text: #e8eaed; --muted: #9aa1ab; --line: #2b313a; --chip: #252b33; --good: #3ccf6e; color-scheme: dark; }
:root[data-theme="light"] { color-scheme: light; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) { --bg: #111418; --card: #1a1e24; --text: #e8eaed; --muted: #9aa1ab; --line: #2b313a; --chip: #252b33; --good: #3ccf6e; color-scheme: dark; }
}
.theme { display: flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.theme button { border: 0; background: none; color: var(--muted); font: inherit; font-size: 13px; padding: 6px 9px; cursor: pointer; }
.theme button.on { background: var(--chip); color: var(--text); font-weight: 700; }
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px; }
header { background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
header .wrap { display: flex; flex-wrap: wrap; gap: 10px 20px; align-items: center; padding-top: 10px; padding-bottom: 10px; }
h1 { font-size: 20px; margin: 0; white-space: nowrap; }
.logo { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: var(--accent); color: #fff; font-size: 17px; }
nav { display: flex; gap: 4px; }
.tab { border: 0; background: none; color: var(--muted); font: inherit; font-weight: 600; padding: 8px 12px; border-radius: 8px; cursor: pointer; }
.tab.active { background: var(--chip); color: var(--text); }
#city { max-width: 190px; }
#q { flex: 1 1 280px; font: inherit; font-size: 16px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--text); }
.filters { margin: 14px 0; display: grid; gap: 10px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
select { font: inherit; padding: 7px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--card); color: var(--text); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: var(--card); color: var(--text); padding: 5px 10px; border-radius: 999px; font: inherit; font-size: 14px; cursor: pointer; }
.chip.on { background: var(--text); color: var(--card); border-color: var(--text); }
.chip small { opacity: .6; margin-left: 4px; }
.muted { color: var(--muted); font-size: 14px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 6px; position: relative; }
.card img { width: 100%; height: 130px; object-fit: contain; background: #fff; border-radius: 8px; }
.card .name { font-weight: 600; font-size: 15px; line-height: 1.3; }
.card .unit { font-size: 13px; color: var(--muted); }
.price { font-size: 22px; font-weight: 800; }
.old { text-decoration: line-through; color: var(--muted); margin-left: 6px; font-size: 14px; }
.badge { display: inline-block; font-size: 12px; font-weight: 800; padding: 2px 7px; border-radius: 5px; background: var(--chip); color: var(--text); }
.off { position: absolute; top: 10px; right: 10px; background: var(--accent); color: #fff; font-weight: 800; font-size: 13px; padding: 3px 7px; border-radius: 6px; }
.soon { color: #b45309; font-weight: 600; font-size: 13px; }
.card .foot { margin-top: auto; display: flex; justify-content: space-between; align-items: center; gap: 6px; font-size: 13px; }
.link { color: inherit; font-size: 13px; background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; font-family: inherit; }
.more { display: block; margin: 18px auto; font: inherit; padding: 10px 18px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--text); cursor: pointer; }
.group { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-bottom: 12px; }
.group h3 { margin: 0 0 8px; font-size: 16px; }
.group table { width: 100%; border-collapse: collapse; font-size: 14px; }
.group td { padding: 6px 4px; border-top: 1px solid var(--line); vertical-align: top; }
.group td.num { text-align: right; white-space: nowrap; }
.group tr.best td { color: var(--good); font-weight: 700; }
.promo-tag { color: var(--accent); font-weight: 700; }
footer { margin: 30px auto; }
footer a { color: inherit; }
