:root {
  --bg: #f4f8f2; --fg: #18261a; --muted: #5b6e5c; --border: #d2e4c8;
  --primary: #15803d; --primary-fg: #fff; --panel: #fbfdf9; --accent: #ea580c;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  color: var(--fg); background: var(--bg);
}
* { box-sizing: border-box; }
body { margin: 0; line-height: 1.5; }
.wrap { max-width: 1040px; margin: 0 auto; padding: 0 20px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.top { background: var(--panel); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 1; }
.bar { display: flex; align-items: center; gap: 12px; padding-top: 12px; padding-bottom: 12px; }
.brand { font-weight: 700; color: var(--primary); text-decoration: none; font-size: 1.2rem; }
.tag { font-size: .8rem; color: var(--muted); border: 1px solid var(--border); border-radius: 999px; padding: 2px 10px; }
.cart-link { margin-left: auto; font-weight: 600; color: var(--fg); text-decoration: none; border: 1px solid var(--border); border-radius: 10px; padding: 6px 12px; background: #fff; }
.cart-link span { background: var(--accent); color: #fff; border-radius: 999px; padding: 0 8px; margin-left: 4px; font-size: .85rem; }
.hero { padding: 28px 0 8px; max-width: 720px; }
h1 { margin: 0 0 8px; font-size: 2rem; line-height: 1.2; }
h2 { margin-top: 32px; font-size: 1.25rem; }
.button, button { font: inherit; cursor: pointer; }
.button, button:not(.ghost):not(.chip) { display: inline-block; background: var(--primary); color: var(--primary-fg); padding: 9px 16px; border-radius: 10px; text-decoration: none; font-weight: 600; border: 0; }
button:disabled { background: #b9c9b6 !important; cursor: not-allowed; }
.ghost { background: transparent; border: 1px solid var(--border); border-radius: 10px; padding: 8px 14px; color: var(--fg); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.muted { color: var(--muted); }
.search { display: flex; gap: 8px; margin-bottom: 12px; }
.search input { flex: 1; font: inherit; padding: 9px 12px; border: 1px solid var(--border); border-radius: 10px; background: #fff; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.chip { border: 1px solid var(--border); background: #fff; border-radius: 999px; padding: 4px 12px; font-size: .9rem; color: var(--fg); }
.chip.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.grid { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 4px; }
.card .cat { font-size: .75rem; color: var(--muted); }
.card .price { font-weight: 700; margin-top: auto; }
.card.oos { opacity: .7; }
.cart { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--border); }
.cart th, .cart td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); }
.cart input { width: 64px; font: inherit; padding: 4px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.dev code { background: #e7f2e0; padding: 1px 6px; border-radius: 6px; word-break: break-all; }
.own { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 4px 18px 12px; margin-top: 32px; }
.prompt { white-space: pre-wrap; background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 12px; font-size: .85rem; max-height: 420px; overflow: auto; }
.notice { background: #fff7ed; border: 1px solid #fed7aa; border-radius: 10px; padding: 10px 14px; }
.sub { color: var(--accent); font-weight: 600; }
.cart input[type="checkbox"] { width: auto; }
a.ghost { text-decoration: none; display: inline-block; }
footer { padding: 32px 20px; font-size: .85rem; }

/* ---- Responsive ---- */
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: 10px; }
.table-wrap > table { min-width: 720px; }
@media (max-width: 640px) {
  .wrap { padding: 0 14px; }
  .bar { gap: 8px; }
  .tag { display: none; }
  .brand { font-size: 1.05rem; }
  h1 { font-size: 1.6rem; }
  .hero { padding-top: 18px; }
  .search { flex-wrap: wrap; }
  .search input { flex: 1 1 100%; }
  .search button { flex: 1 1 100%; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
  .actions > * { flex: 1 1 auto; text-align: center; }
  /* Cart and review tables become one card per product. */
  .cart.stack thead { display: none; }
  .cart.stack, .cart.stack tbody, .cart.stack tfoot { display: block; width: 100%; }
  .cart.stack tr { display: block; padding: 10px 12px; border-bottom: 1px solid var(--border); }
  .cart.stack td { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 3px 0; border: 0; text-align: right; }
  .cart.stack td::before { content: attr(data-label); font-size: .85rem; font-weight: 600; color: var(--muted); text-align: left; }
  .cart.stack td.cell-name { font-weight: 700; font-size: 1.02rem; justify-content: flex-start; text-align: left; }
  .cart.stack td.cell-name::before, .cart.stack td.cell-action::before { content: none; }
  .cart.stack td.cell-action { justify-content: flex-end; }
  .cart.stack tfoot tr { display: flex; justify-content: space-between; font-size: 1.05rem; }
  .cart.stack tfoot th { padding: 0; border: 0; }
  .cart.stack tfoot th:empty { display: none; }
}
@media (max-width: 380px) {
  .grid { grid-template-columns: 1fr 1fr; }
  .cart-link { padding: 6px 10px; }
}
code { overflow-wrap: anywhere; }
a.chip { text-decoration: none; display: inline-block; }
@media (max-width: 640px) { .cart.stack td.cell-empty { display: none; } }
