:root {
  --bg: #f1f5f9;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --brand: #0f172a;
  --accent: #f59e0b;
  --price: #047857;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  padding-bottom: 90px;
}

/* ---------- Header ---------- */
.top {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--brand);
  color: #fff;
  padding: 12px 16px 0;
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
}
.top__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: 900px;
  margin: 0 auto;
}
h1 { font-size: 1.25rem; margin: 0; }

.toggle { display: flex; align-items: center; gap: 6px; font-size: .8rem; color: #cbd5e1; cursor: pointer; }
.toggle input { width: 18px; height: 18px; accent-color: var(--accent); }

.search {
  display: block;
  width: 100%;
  max-width: 900px;
  margin: 10px auto;
  padding: 12px 14px;
  font-size: 1rem;
  border: 0;
  border-radius: 10px;
  outline: none;
}
.search:focus { box-shadow: 0 0 0 3px var(--accent); }

.tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  max-width: 900px;
  margin: 0 auto;
  padding-bottom: 12px;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: 0 0 auto;
  border: 1px solid #334155;
  background: transparent;
  color: #e2e8f0;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
}
.tab.is-active { background: var(--accent); border-color: var(--accent); color: var(--brand); }

/* ---------- List ---------- */
.list { max-width: 900px; margin: 0 auto; padding: 16px; }

.cat { margin-bottom: 24px; }
.cat__title {
  font-size: .8rem;
  letter-spacing: .08em;
  color: var(--muted);
  margin: 0 0 10px;
}

.group {
  background: var(--card);
  border-radius: 12px;
  margin-bottom: 12px;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(0,0,0,.05);
}
.group__title {
  margin: 0;
  padding: 10px 14px;
  font-size: .95rem;
  background: #f8fafc;
  border-bottom: 1px solid var(--line);
}

.item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: none;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
}
.item:last-child { border-bottom: 0; }
.item:active { background: #fef3c7; }
.item__name { flex: 1; font-size: 1rem; }
.item__old { color: var(--muted); text-decoration: line-through; font-size: .85rem; display: none; }
body.show-old .item__old { display: inline; }
.item__price { font-weight: 700; font-size: 1.1rem; color: var(--price); min-width: 70px; text-align: right; }
.item__add {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--bg);
  display: grid; place-items: center;
  font-weight: 700; color: var(--muted);
}
.item.in-quote .item__add { background: var(--accent); color: var(--brand); }

.empty { text-align: center; color: var(--muted); padding: 40px 16px; }

/* ---------- Quote ---------- */
.quote {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 20;
  max-width: 900px;
  margin: 0 auto;
  background: var(--brand);
  color: #fff;
  border-radius: 14px 14px 0 0;
  box-shadow: 0 -4px 16px rgba(0,0,0,.2);
}
.quote__bar {
  display: flex; justify-content: space-between; align-items: center;
  width: 100%;
  padding: 16px 18px;
  background: none; border: 0; color: inherit; font: inherit; font-size: 1rem;
  cursor: pointer;
}
.quote__bar strong { font-size: 1.3rem; color: var(--accent); }
.quote__body { padding: 0 18px 16px; max-height: 50vh; overflow-y: auto; }
.quote__items { list-style: none; margin: 0 0 12px; padding: 0; }
.quote__items li {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 0;
  border-top: 1px solid #334155;
  font-size: .9rem;
}
.quote__items li span:first-child { flex: 1; }
.qty { display: flex; align-items: center; gap: 6px; }
.qty button {
  width: 28px; height: 28px;
  border-radius: 6px; border: 0;
  background: #334155; color: #fff; font-size: 1rem; cursor: pointer;
}
.btn { padding: 10px 14px; border-radius: 8px; font: inherit; cursor: pointer; }
.btn--ghost { width: 100%; background: none; border: 1px solid #475569; color: #cbd5e1; }

@media (min-width: 700px) {
  h1 { font-size: 1.5rem; }
  .list { columns: 2; column-gap: 16px; }
  .cat { break-inside: avoid-column; }
  .group { break-inside: avoid; }
}
