:root {
  --ink: #15131a; --muted: #625d6b; --line: #e6e0d6; --bg: #faf7f2; --card: #fff;
  --accent: #ff4f1f; --accent-dark: #d93a0d; --accent-ink: #fff; --magenta: #ec008c;
  --warn-bg: #fff4dc; --warn-ink: #774c00; --ok: #1b6b3a;
  --radius: 14px;
  --display: 'Bricolage Grotesque', 'Arial Black', system-ui, sans-serif;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink); background: var(--bg);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); line-height: 1.45; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px; }
a { color: var(--accent-dark); }

header.site { background: var(--bg); border-bottom: 1px solid var(--line); }
.head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding-top: 12px; padding-bottom: 12px; flex-wrap: wrap; }
.logo img { display: block; height: 44px; width: auto; }
.tagline { margin: 0; font-size: 14px; color: var(--muted); }
.hero { background: var(--ink); color: #fff; }
.hero .wrap { padding-top: 34px; padding-bottom: 34px; }
.hero h1 { font-family: var(--display); font-weight: 800; font-size: clamp(30px, 5vw, 48px); line-height: 1.05; letter-spacing: -0.02em; margin: 0 0 10px; }
.hero p { margin: 0; max-width: 620px; color: #d9d4dd; font-size: 17px; }
.site-foot { border-top: 1px solid var(--line); padding: 22px 0 36px; color: var(--muted); font-size: 14px; }
.site-foot img { display: block; height: 30px; width: auto; margin-bottom: 6px; }
.site-foot p { margin: 0; }

.studio { display: grid; grid-template-columns: minmax(300px, 420px) 1fr; gap: 24px; padding-top: 24px; padding-bottom: 48px; align-items: start; }
@media (max-width: 860px) { .studio { grid-template-columns: 1fr; } .preview { order: -1; } .contact { text-align: left; } }

.step { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 0 0 14px; min-width: 0; }
fieldset.step:disabled { opacity: .55; }
legend { padding: 0; float: left; width: 100%; }
legend + * { clear: both; }
h2 { font-family: var(--display); font-weight: 800; font-size: 18px; margin: 0 0 12px; display: flex; align-items: center; gap: 8px; letter-spacing: -0.01em; }
.n { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; background: var(--accent); color: #fff; font-size: 14px; transform: rotate(-6deg); }

.drop { display: block; border: 2px dashed var(--line); border-radius: var(--radius); padding: 22px 14px; text-align: center; cursor: pointer; color: var(--muted); }
.drop strong { color: var(--accent); }
.drop small { display: block; margin-top: 6px; font-size: 12px; }
.drop.over { border-color: var(--accent); background: #fff1eb; }
.drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.drop:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.file-info { margin-top: 10px; font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.sub { margin-top: 10px; }

.row { display: flex; align-items: center; gap: 10px; margin: 10px 0; flex-wrap: wrap; }
.row > label:first-child, .label { min-width: 92px; font-size: 14px; color: var(--muted); }
input[type=number], input[type=text], select { font: inherit; padding: 7px 9px; border: 1px solid var(--line); border-radius: 7px; background: #fff; color: var(--ink); }
input[type=number] { width: 96px; }
input[type=text] { flex: 1; min-width: 160px; }
.unit { color: var(--muted); font-size: 14px; }
.check { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; cursor: pointer; }
.check.small { font-size: 13px; color: var(--muted); }
.check input { margin-top: 3px; }
.hint { color: var(--muted); font-size: 12px; display: block; margin-top: 6px; }

.shapes { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 8px; }
.shapes label { border: 1px solid var(--line); border-radius: 8px; padding: 10px 6px 8px; text-align: center; font-size: 13px; cursor: pointer; display: grid; justify-items: center; gap: 4px; }
.shapes input { position: absolute; opacity: 0; }
.shapes svg { width: 34px; height: 34px; }
.shapes label:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); background: #fff1eb; }
.shapes label:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }

.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg label { cursor: pointer; }
.seg input { position: absolute; opacity: 0; }
.seg span { display: block; padding: 6px 14px; font-size: 14px; }
.seg input:checked + span { background: var(--ink); color: #fff; }
.seg input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: -3px; }

.swatches { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.swatch { width: 32px; height: 32px; border-radius: 50%; border: 1px solid #b9bfc9; cursor: pointer; padding: 0; position: relative; }
.swatch[aria-pressed=true] { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--accent); }
.swatch.white { background: #fff; }
.swatch.custom { background: conic-gradient(red, yellow, lime, cyan, blue, magenta, red); overflow: hidden; }
.swatch.custom input { opacity: 0; width: 100%; height: 100%; cursor: pointer; }

.finished { margin: 4px 0 8px; font-weight: 600; }
.qty-label { margin: 14px 0 6px; }
.qty-table { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.qty-table label { display: grid; grid-template-columns: 18px 1fr auto auto; gap: 10px; align-items: center; padding: 8px 12px; border-top: 1px solid var(--line); cursor: pointer; font-size: 14px; font-variant-numeric: tabular-nums; }
.qty-table label:first-child { border-top: 0; }
.qty-table label:has(input:checked) { background: #fff1eb; }
.qty-table .each { color: var(--muted); min-width: 72px; text-align: right; }
.qty-table .tot { font-weight: 600; min-width: 80px; text-align: right; }
.qty-table .save { font-size: 11px; color: var(--ok); font-weight: 600; margin-left: 6px; }
.qty-table input { accent-color: var(--accent); margin: 0; }
.custom-qty input { width: 110px; }
.price-box { margin-top: 12px; padding: 12px 14px; background: var(--ink); color: #fff; border-radius: 10px; }
.price-box .total { font-family: var(--display); font-weight: 800; font-size: 28px; font-variant-numeric: tabular-nums; }
.price-box .each { color: #cfc9d4; font-size: 14px; }
.price-box small { display: block; color: #b9b2bf; margin-top: 2px; }
.totals { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; margin: 12px 0 0; font-size: 14px; font-variant-numeric: tabular-nums; }
.totals dt { color: var(--muted); } .totals dd { margin: 0; text-align: right; }
.totals .grand { font-weight: 700; color: var(--ink); font-size: 16px; padding-top: 6px; border-top: 1px solid var(--line); }

.warnings .warn { background: var(--warn-bg); color: var(--warn-ink); border-radius: 8px; padding: 9px 11px; font-size: 13px; margin-bottom: 8px; }
.warnings .ok { color: var(--ok); font-size: 13px; margin-bottom: 8px; }
.approve { background: #fff7f2; border: 1px solid #ffd2c2; border-radius: 8px; padding: 10px; margin-top: 10px; }

.actions { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
button { font: inherit; border-radius: 8px; padding: 9px 16px; cursor: pointer; border: 1px solid transparent; }
button.primary { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
button.primary:hover:not(:disabled) { background: var(--accent-dark); }
button.ghost { background: #fff; border-color: var(--line); color: var(--ink); }
button:disabled { opacity: .5; cursor: not-allowed; }
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.preview { position: sticky; top: 16px; display: grid; gap: 16px; }
@media (max-width: 860px) { .preview { position: static; } }
.proof-card, .order { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.proof-head { display: flex; justify-content: space-between; align-items: center; }
.status { font-size: 13px; color: var(--muted); }
.proof { aspect-ratio: 1; display: grid; place-items: center; border-radius: 10px; overflow: hidden; background: #efebe4; }
.proof svg { width: 100%; height: 100%; display: block; }
.proof .empty { color: var(--muted); }
.legend { font-size: 13px; color: var(--muted); margin-top: 10px; display: flex; align-items: center; gap: 8px; }
.cutkey { display: inline-block; width: 28px; border-top: 2px solid var(--magenta); }
.shop-only { margin-top: 10px; }

.order ul { list-style: none; padding: 0; margin: 0; }
.order li { display: grid; grid-template-columns: 56px 1fr auto; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.order li img { width: 56px; height: 56px; object-fit: contain; background: #eef0f3; border-radius: 6px; }
.order .meta { font-size: 13px; color: var(--muted); }
.order .ok { color: var(--ok); }
.order li button { padding: 5px 10px; font-size: 13px; }
.material { font-size: 13px; color: var(--muted); margin: 12px 0 0; }

dialog { border: 0; border-radius: var(--radius); padding: 0; width: min(1120px, 96vw); max-height: 94vh; }
dialog::backdrop { background: rgba(10, 12, 16, .55); }
.dialog-bar { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: #fff; flex-wrap: wrap; }
.dialog-bar span { display: flex; gap: 8px; }
.sheet { padding: 14px; background: #e9ebef; }
.sheet svg { width: 100%; height: auto; display: block; background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.15); }

@media print {
  @page { size: letter landscape; margin: 0; }
  body > *:not(dialog) { display: none !important; }
  dialog { position: static; width: auto; max-height: none; box-shadow: none; }
  .dialog-bar { display: none; }
  .sheet { padding: 0; background: #fff; }
  .sheet svg { width: 11in; height: 8.5in; box-shadow: none; }
}

/* Checkout */
#checkout-dialog { width: min(920px, 96vw); }
.co-body { display: grid; grid-template-columns: 1fr 300px; gap: 20px; padding: 16px; }
@media (max-width: 760px) { .co-body { grid-template-columns: 1fr; } }
.co fieldset { border: 0; padding: 0; margin: 0 0 14px; }
.co legend { font-family: var(--display); font-weight: 800; font-size: 16px; margin-bottom: 6px; }
.co label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.co label input, .co label select { display: block; width: 100%; margin-top: 3px; font: inherit; color: var(--ink); padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.co label.check { display: flex; color: var(--ink); }
.co label.check input { width: auto; display: inline; margin-top: 3px; }
.co-row { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 10px; }
@media (max-width: 520px) { .co-row { grid-template-columns: 1fr; } }
.co input:user-invalid { border-color: #c62828; }
.rush { background: #fff7f2; border: 1px solid #ffd2c2; border-radius: 8px; padding: 10px; }
.co-summary { background: var(--bg); border-radius: 10px; padding: 14px; align-self: start; }
.co-summary .totals { margin-top: 0; }
button.wide { width: 100%; margin-top: 14px; padding: 12px; font-size: 16px; }
.fine { font-size: 12px; color: var(--muted); margin: 10px 0 0; }
.co-error { background: #fdecea; color: #8a1c13; border-radius: 8px; padding: 9px 11px; font-size: 13px; margin: 12px 0 0; }
.co-progress { margin-top: 12px; font-size: 13px; color: var(--muted); }
.co-progress .bar { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; margin-bottom: 6px; }
.co-progress .bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.co-done { padding: 28px 20px; text-align: center; }
.co-done h2 { justify-content: center; font-size: 24px; }
