:root {
  --bg: #f6f4f1; --card: #fff; --ink: #24221f; --muted: #6f6a63; --line: #e3ded7;
  --accent: #8a6f52; --accent-ink: #fff; --ok: #2f7d4f; --warn: #a86a10; --err: #b3372f;
  --radius: 10px; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #1b1a18; --card: #252320; --ink: #eeeae4; --muted: #a29b91; --line: #3a3732; --accent: #c7a57f; --accent-ink: #1b1a18; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font-size: 16px; line-height: 1.45; }
a { color: var(--accent); }
.top { position: sticky; top: 0; z-index: 5; display: flex; gap: 12px; align-items: center; justify-content: space-between;
  padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top)); background: var(--card); border-bottom: 1px solid var(--line); }
.brand { font-weight: 700; text-decoration: none; color: var(--ink); }
.top nav { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; font-size: 15px; }
.top nav a { text-decoration: none; color: var(--muted); }
.top nav a.on { color: var(--ink); font-weight: 600; }
main { max-width: 960px; margin: 0 auto; padding: 16px; padding-bottom: 80px; }
h1 { font-size: 22px; margin: 4px 0 14px; } h2 { font-size: 18px; margin: 22px 0 10px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px 12px; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
input, select, textarea { font: inherit; font-size: 16px; color: var(--ink); background: var(--bg); border: 1px solid var(--line);
  border-radius: 8px; padding: 10px; width: 100%; }
textarea { min-height: 70px; }
button, .btn { font: inherit; border: 0; border-radius: 8px; padding: 11px 16px; background: var(--accent); color: var(--accent-ink);
  font-weight: 600; cursor: pointer; text-decoration: none; display: inline-block; }
button.ghost, .btn.ghost { background: transparent; color: var(--accent); border: 1px solid var(--line); }
button.link { background: none; color: var(--muted); padding: 0; font-weight: 400; }
button:disabled { opacity: .5; cursor: default; }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th, td { text-align: left; padding: 9px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
tr.click { cursor: pointer; } tr.click:hover td { background: var(--bg); }
.muted { color: var(--muted); font-size: 14px; }
.pill { display: inline-block; font-size: 12px; padding: 2px 9px; border-radius: 99px; background: var(--bg); border: 1px solid var(--line); white-space: nowrap; }
.price { font-size: 24px; font-weight: 700; }
.err { color: var(--err); } .warn { color: var(--warn); } .ok { color: var(--ok); }
.login { max-width: 360px; margin: 10vh auto; }
.login img { width: 200px; height: 200px; display: block; margin: 10px auto; background: #fff; border-radius: 8px; }
#toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--ink); color: var(--bg);
  padding: 10px 16px; border-radius: 8px; max-width: calc(100% - 32px); z-index: 10; }
.lines { font-size: 14px; margin: 6px 0 0; padding-left: 18px; color: var(--muted); }
@media (max-width: 640px) {
  .hide-sm { display: none; }
  table.stack thead { display: none; } table.stack tr { display: block; border-bottom: 1px solid var(--line); padding: 8px 0; }
  table.stack td { display: block; border: 0; padding: 2px 0; }
}
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; margin-bottom: 6px; }
.tile { display: block; color: var(--ink); font-size: 14px; cursor: pointer; }
.tile input { position: absolute; opacity: 0; pointer-events: none; }
.tile-in { display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; padding: 8px; text-align: center;
  border: 1px solid var(--line); border-radius: 10px; background: var(--card); }
.tile-in img { width: 100%; height: 104px; object-fit: contain; background: #fff; border-radius: 6px; padding: 4px; }
.tile-t { line-height: 1.25; } .tile-s { font-size: 12px; color: var(--muted); }
.tile input:checked + .tile-in { border: 2px solid var(--accent); padding: 7px; box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent); }
.tile input:focus-visible + .tile-in { outline: 2px solid var(--accent); outline-offset: 2px; }
.fabric { margin: 8px 0; padding: 10px 12px; border-radius: 8px; background: var(--bg); font-size: 14px; }
.sticky { position: sticky; bottom: 8px; z-index: 3; box-shadow: 0 4px 18px rgba(0,0,0,.12); }
.sticky .price { font-size: 20px; }
