:root {
  --ink: #1c2430;
  --muted: #5d6b7a;
  --paper: #f4efe6;
  --card: #fffdf8;
  --line: #e4d9c8;
  --green: #1f6b4a;
  --green-deep: #144832;
  --amber: #a15c12;
  --best: #e7f5ee;
  color: var(--ink);
  font-family: Outfit, sans-serif;
  background:
    radial-gradient(circle at top left, #f7e7c8 0, transparent 28rem),
    var(--paper);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; }
button, input, select { font: inherit; color: inherit; }
h1, h2, h3 { font-family: Fraunces, serif; font-weight: 560; margin: 0; }
h1 {
  font-size: clamp(2.4rem, 5vw, 4.2rem);
  letter-spacing: -0.04em;
  white-space: nowrap;
}

.top, main, .settings, .site-foot {
  width: min(76rem, 100%);
  margin-inline: auto;
}
.top {
  display: grid;
  gap: 0.85rem;
  padding: 2rem clamp(1.2rem, 4vw, 4rem) 0.2rem;
}
.eyebrow {
  margin: 0 0 0.3rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.75rem;
  color: var(--green);
  font-weight: 650;
}
.lede { margin: 0; max-width: 40rem; color: var(--muted); font-size: 1.05rem; line-height: 1.45; }
.disclaimer { margin: 0.45rem 0 0; max-width: 40rem; color: var(--muted); font-size: 0.82rem; line-height: 1.4; }
.site-foot {
  padding: 0.2rem clamp(1.2rem, 4vw, 4rem) 1.4rem;
}
.site-foot button {
  border: 0;
  background: transparent;
  padding: 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 520;
  cursor: pointer;
  opacity: 0.7;
}
.site-foot button:hover { opacity: 1; text-decoration: underline; }
.ghost {
  margin-top: 0.8rem;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 999px;
  padding: 0.55rem 0.9rem;
  cursor: pointer;
  font-weight: 650;
}
.head-actions { display: flex; gap: 0.45rem; align-items: center; }
.head-actions .ghost { margin-top: 0; }
.qr {
  width: 240px;
  height: 240px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 0.9rem;
}
.secret {
  font-family: ui-monospace, Consolas, monospace;
  letter-spacing: 0.06em;
  word-break: break-all;
}
.settings { padding: 1rem clamp(1.2rem, 4vw, 4rem) 0; }
.settings-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 1.4rem;
  padding: 1.1rem 1.15rem 1.2rem;
}
#shop-list { list-style: none; margin: 0.8rem 0 0; padding: 0; }
.shop-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  padding: 0.75rem 0;
  border-top: 1px solid var(--line);
}
.shop-row a { color: inherit; }
.add-shop {
  display: grid;
  gap: 0.7rem;
  margin-top: 1rem;
  padding-top: 0.4rem;
}
.add-shop button {
  justify-self: start;
  border: 0;
  border-radius: 999px;
  padding: 0.75rem 1rem;
  background: var(--green);
  color: white;
  font-weight: 650;
  cursor: pointer;
}

main {
  display: grid;
  grid-template-columns: minmax(0, 34rem);
  gap: 1.4rem;
  align-items: start;
  padding: 1.2rem clamp(1.2rem, 4vw, 4rem) 1.2rem;
}
main:has(#results:not(:empty)) {
  grid-template-columns: minmax(0, 32rem) minmax(0, 1fr);
}
.panel, .shop {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 1.4rem;
  padding: 1.1rem 1.15rem 1.2rem;
  min-width: 0;
}
label { display: grid; gap: 0.35rem; font-size: 0.86rem; font-weight: 650; min-width: 0; }
input, select {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 0.8rem;
  padding: 0.72rem 0.8rem;
}
.search-row, .address { display: flex; gap: 0.7rem; min-width: 0; }
.search-row > *, .address > * { min-width: 0; }
#q { flex: 1 1 auto; }
.qty { flex: 0 0 5.2rem; width: 5.2rem; }
.address { margin: 0.9rem 0 1.1rem; }
.address label { flex: 1 1 0; }
#province { text-overflow: ellipsis; }

#suggestions, #basket { list-style: none; margin: 0.6rem 0 0; padding: 0; }
#suggestions {
  border: 1px solid var(--line);
  border-radius: 0.9rem;
  overflow: hidden;
  background: #fff;
}
#suggestions button, .basket-item {
  width: 100%;
  min-width: 0;
  text-align: left;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: 0.7rem 0.75rem;
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
  cursor: pointer;
}
#suggestions button span, .basket-item span { min-width: 0; overflow-wrap: anywhere; }
#suggestions button:hover { background: #f7f1e6; }
.hit-title, .line-title { font-weight: 520; }
.hit-meta, .muted { color: var(--muted); font-size: 0.84rem; }
.basket-item { cursor: default; align-items: center; }
.remove {
  border: 0;
  background: transparent;
  color: var(--amber);
  cursor: pointer;
  font-weight: 650;
}

#compare {
  width: 100%;
  margin-top: 0.8rem;
  border: 0;
  border-radius: 999px;
  padding: 0.85rem 1rem;
  background: var(--green);
  color: white;
  font-weight: 650;
  cursor: pointer;
}
#compare:disabled { opacity: 0.45; cursor: not-allowed; }
.status { min-height: 1.2rem; color: var(--muted); }

.results { display: grid; gap: 0.9rem; align-content: start; }
.empty {
  margin: 0;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 1.4rem;
  padding: 1.1rem 1.15rem;
  color: var(--muted);
  line-height: 1.45;
}
.shop.best { background: var(--best); border-color: #b7dcc8; }
.shop-head, .totals, .ship-line {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: baseline;
}
.shop-head { margin-bottom: 0.7rem; }
.badges { display: flex; flex-wrap: wrap; gap: 0.35rem; justify-content: flex-end; }
.badge {
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
  font-size: 0.75rem;
  font-weight: 650;
  background: #efe6d6;
}
.badge.free { background: #d7f0e2; color: var(--green-deep); }
.badge.manual { background: #f8e7d2; color: var(--amber); }
.badge.best { background: var(--green); color: white; }
.lines { margin: 0; padding: 0; list-style: none; }
.lines li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.35rem 0;
  border-top: 1px solid var(--line);
  font-size: 0.95rem;
}
.lines a { color: inherit; }
.totals { margin-top: 0.7rem; font-size: 1.15rem; }
.total { font-family: Fraunces, serif; font-size: 1.7rem; }
.note { color: var(--muted); font-size: 0.86rem; margin: 0.45rem 0 0; }
.options { margin: 0.35rem 0 0; padding-left: 1rem; color: var(--muted); font-size: 0.86rem; }
h2 { font-size: 1.35rem; margin: 0.2rem 0 0.4rem; }
.missing { color: var(--amber); font-size: 0.9rem; }

@media (max-width: 860px) {
  .top,
  main,
  main:has(#results:not(:empty)) { grid-template-columns: 1fr; }
  h1 { white-space: normal; }
}
