:root {
  --bg: #f4f6f5;
  --surface: #ffffff;
  --text: #1c2421;
  --muted: #5f6b66;
  --line: #dde3e0;
  --accent: #0f7a55;
  --accent-soft: #e3f4ec;
  --warn: #8a5a00;
  --warn-soft: #fff4dc;
  --danger: #b3261e;
  --radius: 14px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111614; --surface: #1a211e; --text: #e8eeeb; --muted: #9aa8a2; --line: #2c3632;
    --accent: #3fc28f; --accent-soft: #163327; --warn: #f0c060; --warn-soft: #3a2f12; --danger: #ff8a80;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--text);
  font: 17px/1.5 system-ui, "Segoe UI", Arial, "Noto Sans Hebrew", sans-serif; }
a { color: var(--accent); }
.wrap { max-width: 760px; margin: 0 auto; padding: 16px 16px 48px; }
.muted { color: var(--muted); }
.center { text-align: center; }
.error { color: var(--danger); min-height: 1em; margin: 4px 0; }
h1 { font-size: 1.5rem; margin: 0 0 4px; }
h2 { font-size: 1.15rem; margin: 0 0 12px; }

.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--line); }
.brand { font-weight: 700; font-size: 1.1rem; text-decoration: none; color: var(--text); }
.menu-btn { font-size: 1.4rem; background: none; border: 0; color: var(--text); cursor: pointer; padding: 4px 8px; }
.menu { position: absolute; top: 100%; left: 12px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: 0 8px 24px rgba(0,0,0,.12); display: flex; flex-direction: column; min-width: 210px; overflow: hidden; }
.menu a, .menu button { padding: 12px 16px; text-align: right; text-decoration: none; color: var(--text);
  background: none; border: 0; font: inherit; cursor: pointer; border-bottom: 1px solid var(--line); }
.menu :last-child { border-bottom: 0; }
.menu a:hover, .menu button:hover { background: var(--accent-soft); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
input, select { font: inherit; width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface); color: var(--text); }
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
label { display: block; margin-bottom: 12px; font-weight: 600; }
label input, label select { margin-top: 4px; font-weight: 400; }
label.inline { display: flex; gap: 8px; align-items: center; }
label.inline input { width: auto; margin: 0; }
button { font: inherit; cursor: pointer; border-radius: 10px; }
button.primary { background: var(--accent); color: #fff; border: 0; padding: 12px 20px; font-weight: 700; }
button.link { background: none; border: 0; color: var(--accent); padding: 4px 6px; text-decoration: underline; }
button.danger { color: var(--danger); }
.row { display: flex; gap: 8px; }
.row button:not(.primary) { background: none; border: 1px solid var(--line); color: var(--text); padding: 12px 20px; }

.login { max-width: 380px; margin: 10vh auto 0; text-align: center; }
.login form { text-align: right; margin-top: 20px; }
.login button { width: 100%; }

.search-box { margin: 12px 0 8px; }
.search-box input { font-size: 1.25rem; padding: 16px 18px; border-radius: 16px; border: 2px solid var(--line); }
.results { list-style: none; padding: 0; margin: 12px 0; display: grid; gap: 10px; }
.result { display: block; text-decoration: none; color: inherit; }
.result:hover { border-color: var(--accent); }
.r-head { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.r-name { font-weight: 600; }
.r-bc { color: var(--muted); font-size: .8rem; direction: ltr; white-space: nowrap; }
.r-best { display: flex; justify-content: space-between; align-items: baseline; margin-top: 8px; padding: 8px 10px; border-radius: 10px; background: var(--bg); }
.r-best.win { background: var(--accent-soft); }
.r-sup { font-weight: 600; }
.r-price { font-size: 1.25rem; font-weight: 800; color: var(--accent); white-space: nowrap; }
.r-price small, .o-price small { font-size: .75rem; font-weight: 400; color: var(--muted); }
.r-others { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 6px; color: var(--muted); font-size: .9rem; }
.r-warn, .warn { color: var(--warn); font-size: .9rem; }
.r-warn { margin-top: 6px; }
.warn { background: var(--warn-soft); border-radius: 10px; padding: 10px 28px 10px 12px; margin: 8px 0; }

.back { display: inline-block; margin-bottom: 10px; text-decoration: none; }
.p-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.verdict { font-size: 1.1rem; background: var(--accent-soft); padding: 12px 14px; border-radius: 12px; }
.offers { list-style: none; padding: 0; display: grid; gap: 10px; }
.offer { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.offer.best { border: 2px solid var(--accent); }
.o-main { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.o-sup { font-size: 1.1rem; }
.o-price { font-size: 1.3rem; font-weight: 800; margin-inline-start: auto; }
.badge { background: var(--accent); color: #fff; border-radius: 999px; padding: 2px 10px; font-size: .8rem; font-weight: 700; }
.o-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; color: var(--muted); font-size: .88rem; margin-top: 6px; }
.o-note { color: var(--warn); }
.o-actions { margin-top: 6px; }
.history { margin-top: 16px; }
.history summary { cursor: pointer; font-weight: 600; }
.hist { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 8px; font-size: .92rem; }
.hist li { display: grid; gap: 2px; border-bottom: 1px solid var(--line); padding-bottom: 6px; }
.h-when { color: var(--muted); font-size: .8rem; }
.list { list-style: none; margin: 0 0 16px; display: grid; gap: 10px; }
.list li { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: baseline; }
dialog { border: 0; border-radius: var(--radius); padding: 20px; width: min(420px, 92vw); background: var(--surface); color: var(--text); }
dialog::backdrop { background: rgba(0,0,0,.4); }
@media (max-width: 480px) { .wrap { padding: 12px 12px 40px; } .r-price { font-size: 1.15rem; } }
