:root {
  --ink: #17191c;
  --muted: #666b73;
  --line: #e2e0da;
  --bg: #faf9f6;
  --card: #fff;
  --accent: #17191c;
  --good: #1d6b43;
  --bad: #b3261e;
  --warn-bg: #fff4d6;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: inherit; text-underline-offset: 3px; }
img { max-width: 100%; display: block; }
h1 { font-size: 1.75rem; line-height: 1.2; margin: 0 0 .75rem; letter-spacing: -.01em; }
h2 { font-size: 1.1rem; margin: 2rem 0 .5rem; }
main { max-width: 1040px; margin: 0 auto; padding: 1.5rem 16px 4rem; min-height: 60vh; }
.muted { color: var(--muted); font-size: .9rem; }
.num { text-align: right; white-space: nowrap; }

.testmode { margin: 0; padding: .4rem 16px; background: var(--warn-bg); font-size: .85rem; text-align: center; }
.top { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1.5rem; padding: .9rem 16px; border-bottom: 1px solid var(--line); background: var(--card); }
.top .brand { font-weight: 700; font-size: 1.15rem; text-decoration: none; letter-spacing: -.01em; }
.top nav { display: flex; flex-wrap: wrap; gap: 1.1rem; flex: 1; }
.top nav a, .cartlink { text-decoration: none; }
.top nav a:hover, .cartlink:hover { text-decoration: underline; }
.cartlink b { display: inline-block; min-width: 1.4em; padding: 0 .35em; border-radius: 1em; background: var(--accent); color: #fff; font-size: .8rem; text-align: center; }

.flash { margin: 0 0 1.25rem; padding: .7rem 1rem; border: 1px solid var(--good); border-radius: 6px; background: #eef7f1; }
.flash.error { border-color: var(--bad); background: #fdf0ee; }
.crumb, .steps { margin: 0 0 .75rem; font-size: .9rem; color: var(--muted); }
.steps b { color: var(--ink); }

.grid { list-style: none; margin: 1.25rem 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1.5rem 1rem; }
.grid.small { grid-template-columns: repeat(auto-fill, minmax(120px, 160px)); }
.card { display: flex; flex-direction: column; gap: .15rem; text-decoration: none; }
.card img, .noimage, .gallery img, .grid.small img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; background: #eceae4; }
.noimage { display: block; }
.card:hover .cardname { text-decoration: underline; }
.cardname { margin-top: .5rem; }
.price { font-weight: 650; }
.price.big { font-size: 1.4rem; margin: 0 0 1rem; }

.product { display: grid; gap: 2rem; }
.gallery { display: grid; gap: .75rem; align-content: start; }
.description { margin: 1.5rem 0 1rem; }
.variants { border: 0; padding: 0; margin: 0 0 1rem; display: flex; flex-wrap: wrap; gap: .5rem; }
.variants legend { padding: 0; margin-bottom: .4rem; font-weight: 600; }
.variants input { position: absolute; opacity: 0; }
.variants span { display: block; padding: .45rem .9rem; border: 1px solid var(--line); border-radius: 6px; background: var(--card); cursor: pointer; }
.variants input:checked + span { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.variants input:focus-visible + span { outline: 2px solid var(--ink); outline-offset: 2px; }
.variants input:disabled + span { color: var(--muted); background: transparent; cursor: default; text-decoration: line-through; }

button, .button { display: inline-block; padding: .6rem 1.1rem; border: 1px solid var(--ink); border-radius: 6px; background: var(--card); color: var(--ink); font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; }
button.primary, .button.primary { background: var(--accent); color: #fff; }
button.danger { border-color: var(--bad); color: var(--bad); }
button.link { padding: 0; border: 0; background: none; font-weight: 400; text-decoration: underline; }
button:hover, .button:hover { opacity: .85; }
.actions { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; margin: 1.25rem 0 0; }

.form { max-width: 560px; }
.form.narrow { max-width: 360px; }
.form > label, .row label { display: block; margin: 0 0 .9rem; font-weight: 600; font-size: .9rem; }
input, select, textarea { width: 100%; padding: .55rem .65rem; border: 1px solid #b9b6ad; border-radius: 6px; background: var(--card); color: var(--ink); font: inherit; font-weight: 400; }
label input, label select, label textarea { margin-top: .25rem; }
input[type=radio], input[type=checkbox] { width: auto; margin: .3rem 0 0; accent-color: var(--ink); }
input[type=file] { padding: .4rem; }
.row { display: grid; grid-template-columns: 1fr 2fr; gap: 0 1rem; }
.form > label.choice, label.choice { display: flex; gap: .6rem; align-items: flex-start; margin: 0 0 .6rem; padding: .7rem .8rem; border: 1px solid var(--line); border-radius: 6px; background: var(--card); font-weight: 400; font-size: 1rem; }
.qty { width: 5rem; }

table.lines { width: 100%; border-collapse: collapse; margin: 1rem 0; }
.lines th, .lines td { padding: .6rem .5rem .6rem 0; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.lines th.num, .lines td.num { text-align: right; padding-right: 0; }
.lines thead th { font-size: .8rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.lines tfoot th { font-weight: 600; }
.lines tfoot .total th, .lines tfoot .total td { font-size: 1.15rem; font-weight: 700; }
.lines.edit input { margin: 0; min-width: 5rem; }
.low { color: var(--bad); }
.status { display: inline-block; padding: .1rem .55rem; border-radius: 1em; background: #eceae4; font-size: .85rem; }
.status.paid { background: var(--warn-bg); }
.status.shipped { background: #e1f1e7; }

.text { max-width: 680px; }
.text li { margin-bottom: .4rem; }
.formtext { padding: 1rem; border: 1px solid var(--line); border-radius: 6px; background: var(--card); white-space: pre-wrap; font: inherit; }

.bottom { display: grid; gap: 1.25rem; padding: 2rem 16px; border-top: 1px solid var(--line); background: var(--card); font-size: .9rem; color: var(--muted); }
.bottom nav { display: flex; flex-direction: column; gap: .3rem; }

@media (min-width: 720px) {
  .product { grid-template-columns: 1fr 1fr; }
  .bottom { grid-template-columns: repeat(3, auto); justify-content: space-between; padding: 2rem max(16px, calc((100% - 1008px) / 2)); }
}
@media (max-width: 560px) {
  .top nav { order: 3; flex-basis: 100%; }
  .lines.edit, .lines.edit tbody, .lines.edit tr, .lines.edit td { display: block; }
  .lines.edit thead { display: none; }
  .lines.edit td { border: 0; padding: .2rem 0; }
  .lines.edit tr { padding: .6rem 0; border-bottom: 1px solid var(--line); }
}
