:root {
  color-scheme: light dark;
  --bg: #f2f5f3;
  --surface: #ffffff;
  --text: #142722;
  --muted: #526761;
  --line: #dbe5df;
  --accent: #13694d;
  --soft: #e2f2e9;
  --warning: #9b5120;
  --shade: #f9fbfa;
  font-family: "Segoe UI", system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101917; --surface: #182420; --text: #f2f7f3; --muted: #a4b8af;
    --line: #30423a; --accent: #8ee0b7; --soft: #233c31; --warning: #ffb485; --shade: #1c2b25;
  }
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); }
main { max-width: 730px; margin: auto; padding: 24px 16px 42px; }
header { display: grid; gap: 14px; }
.heading { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
h1 { font-size: clamp(28px, 7vw, 40px); letter-spacing: -.045em; line-height: 1.06; margin: 4px 0; }
button, input, select { font: inherit; color: inherit; }
button, select { cursor: pointer; }
button { min-height: 39px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); padding: 7px 12px; font-size: 13px; font-weight: 650; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.quiet { flex-shrink: 0; color: var(--accent); }
.search { display: flex; align-items: center; border: 1px solid var(--line); background: var(--surface); border-radius: 14px; min-height: 54px; padding: 0 13px; gap: 10px; }
.search svg { width: 22px; stroke: var(--accent); fill: none; stroke-width: 1.8; flex: none; }
input { min-width: 0; border: 0; background: transparent; padding: 10px 0; font-size: 16px; }
.search input { width: 100%; }
.search input:focus-visible { outline-offset: 0; }
input::placeholder { color: var(--muted); }
.filters { display: flex; gap: 8px; flex-wrap: wrap; }
.filters button span { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); margin: 0 7px 1px 0; }
.filters button[aria-pressed="true"] { color: var(--accent); background: var(--soft); border-color: var(--accent); }
select { background: var(--surface); min-height: 39px; border: 1px solid var(--line); border-radius: 11px; padding: 7px 9px; font-size: 13px; font-weight: 650; }
#status { margin: 19px 0 10px; color: var(--muted); font-size: 13px; min-height: 18px; }
#offers { display: grid; gap: 10px; }
.card { padding: 15px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); overflow-wrap: anywhere; }
.card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 9px; }
h2 { margin: 0; font-size: 16px; line-height: 1.3; font-weight: 720; }
.stock { color: var(--muted); font-size: 11px; text-align: right; flex: 0 0 auto; white-space: nowrap; padding-top: 3px; }
.stock.yes { color: var(--accent); font-weight: 720; }
.stock.flag { color: var(--warning); font-weight: 720; }
.variant, .details { font-size: 13px; color: var(--muted); margin: 5px 0 0; line-height: 1.38; }
.price-line { display: flex; align-items: baseline; flex-wrap: wrap; gap: 5px 9px; margin: 11px 0 5px; }
.price { color: var(--accent); font-size: 23px; font-weight: 750; letter-spacing: -.035em; font-variant-numeric: tabular-nums; }
.converted { color: var(--muted); font-size: 13px; }
.foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 12px; padding-top: 11px; border-top: 1px solid var(--line); }
.seller { font-size: 13px; display: block; }
.source { color: var(--muted); display: block; margin-top: 3px; font-size: 11px; }
.go { flex-shrink: 0; color: var(--accent); background: var(--soft); border-color: transparent; }
#more { width: 100%; margin-top: 10px; }
#rate-panel { padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--shade); font-size: 13px; }
.rate-line { display: flex; justify-content: space-between; gap: 10px; }
.rate-line input { flex: 1; }
#rate-note { color: var(--muted); margin: 4px 0 0; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
@media (max-width: 380px) { main { padding: 15px 10px 30px; } .card { padding: 12px; } }
.home-header { gap: 4px; }
.home-header p { margin: 3px 0 12px; color: var(--muted); font-size: 14px; }
#home-status { margin: 0; font-size: 13px; color: var(--muted); }
#home-status:empty { display: none; }
#grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; }
.tile {
  display: flex; align-items: center; gap: 5px; min-width: 0; min-height: 36px;
  padding: 4px 6px; text-align: left; border-radius: 8px;
}
.tile:hover { border-color: var(--accent); }
.tile-label { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 12px; }
.tile-mark {
  display: grid; place-items: center; flex: 0 0 20px; height: 20px; border-radius: 5px;
  background: var(--soft); color: var(--accent); font-size: 9px; font-weight: 800;
}
.tile:nth-child(4n+2) .tile-mark { color: #156b9a; background: #d8effc; }
.tile:nth-child(4n+3) .tile-mark { color: #8346b1; background: #eedff9; }
.tile:nth-child(4n+4) .tile-mark { color: #8b4d14; background: #faead2; }
#all { width: 100%; margin-top: 8px; }
.back { flex: 0 0 36px; padding: 0; font-size: 26px; line-height: 1; color: var(--accent); }
#category-title, .sources-heading h1 { flex: 1; font-size: clamp(23px, 6vw, 36px); }
.provider, .provider select { max-width: 100%; }
.provider select { max-width: min(220px, 100%); }
#source-status, #form-message { color: var(--muted); font-size: 13px; margin: 13px 0 8px; }
#source-list { display: grid; gap: 8px; }
.source-entry {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 12px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--surface);
}
.source-entry b { display: block; font-size: 14px; overflow-wrap: anywhere; }
.source-entry small { display: block; color: var(--muted); margin-top: 3px; font-size: 12px; }
.add { background: var(--soft); color: var(--accent); width: 100%; margin-top: 12px; }
#supplier-form { margin-top: 10px; display: grid; gap: 8px; padding: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 13px; }
#supplier-form label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
#supplier-form input, #supplier-form select { width: 100%; padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--text); }
.form-pair { display: grid; grid-template-columns: 2fr 1fr; gap: 8px; }
@media (max-height: 610px) {
  #grid { gap: 4px; } .tile { min-height: 30px; padding: 3px 5px; }
  .home-header p { margin-bottom: 8px; } main:has(#home:not([hidden])) { padding-top: 10px; padding-bottom: 8px; }
}
