:root {
  --bg: #f7f5f0; --panel: #fff; --ink: #24303a; --muted: #6b7680; --line: #e3ded4;
  --accent: #1f7a6d; --accent-ink: #fff; --warn: #b3412e; --ok: #2f7d32;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #161b1f; --panel: #1f262c; --ink: #e6e9ec; --muted: #9aa4ad; --line: #2f3940;
          --accent: #3fb3a1; --accent-ink: #0d1a18; --warn: #ef7f69; --ok: #7bc77f; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink);
       font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.top { display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: center; padding: 12px 24px;
       background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 2; }
.brand { font-weight: 800; font-size: 1.3rem; color: var(--ink); }
.brand span { color: var(--accent); }
.cats { display: flex; gap: 16px; flex-wrap: wrap; }
.search { flex: 1; min-width: 160px; }
.search input { width: 100%; }
.who { display: flex; gap: 12px; align-items: center; white-space: nowrap; flex-wrap: wrap; }
.cart { font-weight: 600; }

main { max-width: 1080px; margin: 0 auto; padding: 24px 16px 48px; }
footer { text-align: center; color: var(--muted); font-size: .85rem; padding: 24px 16px; border-top: 1px solid var(--line); }
h1 small { color: var(--muted); font-weight: 400; font-size: 1rem; }
.hero { padding: 24px 0 8px; }
.hero h1 { margin: 0 0 4px; font-size: 2rem; }
.lead { color: var(--muted); }
.crumbs { color: var(--muted); font-size: .9rem; }
.empty { color: var(--muted); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 16px; color: var(--ink); display: block; }
a.card:hover { border-color: var(--accent); text-decoration: none; }
.card h2 { margin: 0 0 6px; font-size: 1.15rem; color: var(--accent); }
.card p { margin: 0; color: var(--muted); font-size: .92rem; }
.item img { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: 6px; }
.item h3 { font-size: 1rem; margin: 10px 0 4px; }
.price { font-weight: 700; color: var(--ink) !important; margin: 4px 0 10px !important; }
.price.big { font-size: 1.5rem; }
.detail { display: grid; grid-template-columns: minmax(0, 360px) 1fr; gap: 24px; }
.detail img { width: 100%; border-radius: 10px; }
@media (max-width: 640px) { .detail { grid-template-columns: 1fr; } .top { padding: 12px 16px; } }

button, input, select { font: inherit; }
input, select { padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--ink); }
button { padding: 8px 14px; border-radius: 6px; border: 1px solid var(--accent); background: var(--panel); color: var(--accent); cursor: pointer; }
button.primary { background: var(--accent); color: var(--accent-ink); }
button.link { border: 0; padding: 0; background: none; color: var(--accent); }

.form { display: grid; gap: 12px; max-width: 720px; }
.form.narrow { max-width: 360px; }
.form label { display: grid; gap: 4px; font-size: .9rem; color: var(--muted); }
.form fieldset { border: 1px solid var(--line); border-radius: 10px; display: grid; gap: 10px; padding: 12px 16px 16px; }
.form legend { font-weight: 600; color: var(--ink); padding: 0 4px; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }

table.lines { width: 100%; border-collapse: collapse; background: var(--panel); border-radius: 10px; overflow: hidden; }
.lines th, .lines td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; }
.lines th { font-size: .85rem; color: var(--muted); font-weight: 600; }
.lines input.qty { width: 72px; }
.thumb { width: 56px; height: 42px; object-fit: cover; border-radius: 4px; }
.total { font-size: 1.1rem; text-align: right; }
.actions { display: flex; justify-content: flex-end; gap: 16px; align-items: center; }
.totals { display: grid; grid-template-columns: auto auto; justify-content: end; gap: 4px 24px; }
.totals dd { margin: 0; text-align: right; }
.status { font-size: .8rem; padding: 2px 8px; border-radius: 99px; border: 1px solid currentColor; }
.s-PLC { color: var(--accent); } .s-SHP { color: var(--ok); } .s-CAN { color: var(--warn); }
.error { color: var(--warn); min-height: 1em; }
.field-error { color: var(--warn); font-size: .8rem; min-height: 0; }

.flash { position: fixed; right: 16px; bottom: 16px; padding: 10px 16px; border-radius: 8px; opacity: 0;
         transition: opacity .2s; background: var(--ink); color: var(--bg); pointer-events: none; }
.flash.ok, .flash.error { opacity: 1; }
.flash.error { background: var(--warn); }
@media (max-width: 640px) { .lines th:nth-child(1), .lines td:nth-child(1) { display: none; } }
