:root {
  --bg: #efeae2; --panel: #fbf9f5; --ink: #1f1d1b; --muted: #7b746b; --line: #e6dfd4; --soft: #f2ede5;
  --oak: #b48a5a; --oak-d: #94703f; --top: 62px;
  --serif: 'Italiana', 'Didot', Georgia, serif; --sans: 'Manrope', system-ui, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body { font: 400 14.5px/1.5 var(--sans); color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; overflow: hidden; }
button { font: inherit; color: inherit; cursor: pointer; }
small { font-size: .82em; }
.muted { color: var(--muted); }

/* top bar */
.topbar { height: var(--top); display: flex; align-items: center; gap: 18px; padding: 0 26px; background: #fbf9f5; border-bottom: 1px solid var(--line); position: relative; z-index: 3; }
.brand { display: flex; align-items: baseline; gap: 12px; color: inherit; text-decoration: none; }
.brand-name { font: 400 28px/1 var(--serif); letter-spacing: .22em; }
.brand-sub { font: 400 11px var(--serif); letter-spacing: .5em; text-transform: uppercase; color: var(--muted); }
.topline { margin-left: auto; font-size: 11px; letter-spacing: .22em; text-transform: uppercase; color: var(--muted); }
.kiosk-btn { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line); background: #fff; border-radius: 99px; padding: 7px 14px 7px 11px; font-size: 12.5px; font-weight: 600; transition: border-color .2s, background .2s; }
.kiosk-btn:hover { border-color: var(--ink); }
.kiosk-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.pill { font-size: 10.5px; letter-spacing: .16em; text-transform: uppercase; border: 1px solid var(--line); color: var(--muted); border-radius: 99px; padding: 4px 11px; }

.layout { display: grid; grid-template-columns: minmax(0, 1fr) 430px; height: calc(100svh - var(--top)); }

/* stage */
.stage { position: relative; overflow: hidden; background: #e9e4dc; touch-action: none; }
#c { display: block; width: 100%; height: 100%; outline: none; cursor: grab; }
#c:active { cursor: grabbing; }
.powered { position: absolute; z-index: 5; top: 18px; left: 18px; display: inline-flex; align-items: center; gap: 7px; padding: 9px 15px 9px 13px; border-radius: 99px;
  background: rgba(24, 22, 20, .86); color: #f6f2ec; font-size: 12.5px; text-decoration: none; backdrop-filter: blur(8px); box-shadow: 0 6px 22px rgba(0,0,0,.18); transition: transform .2s; }
.powered:hover { transform: translateY(-1px); }
.powered strong { font-weight: 700; letter-spacing: .02em; }
.powered svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 2; opacity: .8; }
.powered-dot { width: 7px; height: 7px; border-radius: 50%; background: #d9a86a; box-shadow: 0 0 0 3px rgba(217,168,106,.25); }

.tag { position: absolute; z-index: 4; transform: translate(-50%, calc(-100% - 12px)); pointer-events: none; display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px; border-radius: 99px;
  background: rgba(255,255,255,.94); font-size: 12px; font-weight: 600; box-shadow: 0 6px 18px rgba(40,30,20,.16); white-space: nowrap; transition: opacity .2s; }
.tag::after { content: ''; position: absolute; left: 50%; bottom: -5px; width: 10px; height: 10px; background: inherit; transform: translateX(-50%) rotate(45deg); border-radius: 2px; }
.tag-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--oak); }

.stage-tools { position: absolute; z-index: 4; right: 18px; bottom: 18px; display: flex; gap: 8px; }
.tool { display: inline-flex; align-items: center; gap: 8px; border: 0; border-radius: 99px; padding: 10px 16px 10px 13px; background: rgba(255,255,255,.92); box-shadow: 0 6px 18px rgba(40,30,20,.12); font-size: 13px; font-weight: 600; backdrop-filter: blur(6px); transition: transform .15s, background .2s; }
.tool:hover { transform: translateY(-1px); background: #fff; }
.tool.on { background: var(--ink); color: #fff; }
.tool.icon { padding: 10px; }
.tool svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linejoin: round; }
.stage-hint { position: absolute; left: 18px; bottom: 14px; margin: 0; font-size: 12px; color: #6f675d; pointer-events: none; }

.loader { position: absolute; inset: 0; z-index: 8; display: grid; place-content: center; justify-items: center; gap: 14px; background: #ece7df; transition: opacity .6s; }
.loader.done { opacity: 0; pointer-events: none; }
.loader-mark { font: 400 40px var(--serif); letter-spacing: .3em; }
.loader .bar { width: 180px; height: 2px; background: #d9d1c4; overflow: hidden; border-radius: 2px; }
.loader .bar i { display: block; height: 100%; width: 0; background: var(--ink); transition: width .3s; }
.loader p { margin: 0; color: var(--muted); font-size: 12.5px; }

/* attract loop (kiosk) */
.attract { position: absolute; inset: 0; z-index: 6; display: flex; align-items: flex-end; padding: 6vh 5vw; background: linear-gradient(180deg, rgba(20,18,16,0) 40%, rgba(20,18,16,.55) 100%); color: #fff; cursor: pointer; }
.attract-in h2 { font: 400 clamp(40px, 5.4vw, 76px)/1.02 var(--serif); margin: 6px 0 14px; letter-spacing: .02em; }
.attract-in p { margin: 0 0 22px; font-size: 18px; opacity: .92; max-width: 34ch; }
.attract-cta { display: inline-flex; align-items: center; gap: 10px; padding: 16px 26px; border-radius: 99px; background: #fff; color: var(--ink); font-weight: 700; font-size: 17px; animation: pulse 2.2s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(255,255,255,.55); } 50% { box-shadow: 0 0 0 16px rgba(255,255,255,0); } }
.eyebrow.light { color: #f1d9b8; }
.stage:has(.attract:not([hidden])) .stage-tools, .stage:has(.attract:not([hidden])) .stage-hint { opacity: 0; pointer-events: none; }

/* panel */
.panel { display: flex; flex-direction: column; min-height: 0; background: var(--panel); border-left: 1px solid var(--line); }
.panel-scroll { flex: 1; overflow-y: auto; padding: 26px 28px 10px; scrollbar-width: thin; }
.eyebrow { margin: 0; font-size: 11px; letter-spacing: .2em; text-transform: uppercase; color: var(--oak-d); font-weight: 600; }
h1 { font: 400 34px/1.08 var(--serif); margin: 6px 0 10px; letter-spacing: .01em; }
.lead { margin: 0 0 8px; color: #57514a; font-size: 14px; }
.block { padding: 18px 0; border-top: 1px solid var(--line); }
.block:first-of-type { margin-top: 14px; }
.block header { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.block h2 { margin: 0; font-size: 13px; letter-spacing: .12em; text-transform: uppercase; font-weight: 700; }
.block header span { font-size: 12.5px; color: var(--muted); }
.note { margin: 8px 0 0; font-size: 12.5px; color: var(--muted); }
.link { border: 0; background: none; padding: 0; font-size: 12.5px; color: #9a4b3a; text-decoration: underline; text-underline-offset: 3px; }

.cols { display: flex; gap: 8px; flex-wrap: wrap; }
.col-card { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 6px; min-width: 64px; height: 108px; padding: 8px 8px 7px; border: 1px solid var(--line); border-radius: 12px; background: #fff; transition: border-color .2s, box-shadow .2s, transform .15s; }
.col-card:hover { transform: translateY(-1px); }
.col-card.sel { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.col-card .stack { display: flex; flex-direction: column-reverse; gap: 2px; }
.col-card .unit { height: 13px; border-radius: 2px; position: relative; }
.col-card .unit i { position: absolute; left: 0; right: 0; bottom: 0; height: 10px; border-radius: 2px; }
.col-card .unit.sel { outline: 2px solid var(--oak); outline-offset: 1px; }
.col-card small { font-size: 10.5px; color: var(--muted); font-weight: 600; letter-spacing: .04em; }
.add-col { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }

.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 10px 0; }
.row-label { font-size: 13px; color: #57514a; }
.seg { display: inline-flex; background: var(--soft); border-radius: 99px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: none; border-radius: 99px; padding: 7px 13px; font-size: 12.5px; font-weight: 600; color: #6b645b; transition: background .2s, color .2s; }
.seg button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 4px rgba(40,30,20,.12); }
.seg.small { margin-bottom: 12px; }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 99px; background: #fff; }
.stepper button { width: 38px; height: 36px; border: 0; background: none; font-size: 18px; }
.stepper button:disabled { opacity: .3; cursor: default; }
.stepper output { min-width: 26px; text-align: center; font-weight: 700; }

.finishes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.finish { display: flex; align-items: center; gap: 11px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 12px; background: #fff; text-align: left; transition: border-color .2s, box-shadow .2s; }
.finish.on { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.finish .chip { width: 34px; height: 34px; border-radius: 8px; flex: none; background-size: 260%; background-position: 30% 40%; position: relative; overflow: hidden; box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); }
.finish .chip i { position: absolute; left: 0; right: 0; bottom: 0; height: 58%; box-shadow: inset 0 1px 0 rgba(0,0,0,.18); background-size: 260%; }
.finish b { display: block; font-size: 13px; }
.finish span { font-size: 11.5px; color: var(--muted); }

.toggle { display: flex; align-items: center; gap: 12px; cursor: pointer; font-size: 13.5px; margin: 6px 0 12px; }
.toggle input { position: absolute; opacity: 0; }
.toggle .track { width: 40px; height: 23px; border-radius: 99px; background: #d7cfc3; position: relative; flex: none; transition: background .2s; }
.toggle .track::after { content: ''; position: absolute; top: 3px; left: 3px; width: 17px; height: 17px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.toggle input:checked + .track { background: var(--ink); }
.toggle input:checked + .track::after { transform: translateX(17px); }
.toggle small { display: block; }

.colophon { font-size: 11.5px; color: var(--muted); margin: 18px 0 8px; }
.colophon a { color: inherit; }

.summary { border-top: 1px solid var(--line); padding: 14px 28px 18px; background: #fff; display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; }
.sum-price { margin: 0; font-size: 24px; font-weight: 700; letter-spacing: -.01em; }
.sum-meta { margin: 0; font-size: 12px; color: var(--muted); }
.sum-actions { display: flex; gap: 8px; }
.primary, .ghost { border-radius: 99px; padding: 11px 18px; font-weight: 700; font-size: 13.5px; border: 1px solid var(--ink); transition: transform .15s, background .2s; }
.primary { background: var(--ink); color: #fff; }
.primary:hover { background: #000; transform: translateY(-1px); }
.ghost { background: #fff; }
.ghost:hover { background: var(--soft); }
.ghost.sm { padding: 8px 13px; font-size: 12.5px; border-color: var(--line); }
.ghost.sm small { color: var(--muted); font-weight: 500; margin-left: 4px; }
.kiosk-only { display: none; }

/* dialogs */
.modal { border: 0; border-radius: 20px; padding: 28px; width: min(460px, 92vw); box-shadow: 0 30px 80px rgba(20,15,10,.3); color: var(--ink); }
.modal::backdrop { background: rgba(28,24,20,.42); backdrop-filter: blur(3px); }
.modal h2 { font: 400 28px/1.1 var(--serif); margin: 6px 0 8px; }
.modal .close { position: absolute; top: 12px; right: 12px; margin: 0; }
.modal .close button { width: 34px; height: 34px; border-radius: 50%; border: 0; background: var(--soft); font-size: 20px; line-height: 1; }
.modal.center { text-align: center; }
.field { width: 100%; padding: 11px 13px; border: 1px solid var(--line); border-radius: 10px; margin: 10px 0 14px; font: 13px var(--sans); background: var(--soft); }
.qr { width: 190px; margin: 14px auto 4px; }
.qr.big { width: 230px; }
.qr svg { width: 100%; height: auto; display: block; }
.take-total { font-weight: 700; font-size: 18px; margin: 10px 0 16px; }
.take-actions { display: flex; gap: 10px; justify-content: center; }

/* order sheet */
.sheet { width: min(820px, 96vw); max-height: 92vh; padding: 34px 38px 26px; }
.sheet-head { display: flex; justify-content: space-between; align-items: flex-end; padding-bottom: 16px; border-bottom: 2px solid var(--ink); }
.sheet-brand { font: 400 34px/1 var(--serif); letter-spacing: .26em; }
.sheet-brand-sub { font-size: 10.5px; letter-spacing: .4em; text-transform: uppercase; color: var(--muted); margin-top: 5px; }
.sheet-ref { display: grid; text-align: right; font-size: 12.5px; color: var(--muted); }
.sheet-ref strong { color: var(--ink); font-size: 15px; letter-spacing: .06em; text-transform: uppercase; }
.sheet-grid { display: grid; grid-template-columns: 1.35fr 1fr; gap: 18px; margin: 18px 0; align-items: stretch; }
.sheet-grid img { width: 100%; aspect-ratio: 16/10; object-fit: cover; border-radius: 12px; background: var(--soft); }
.sheet-dims { background: var(--soft); border-radius: 12px; padding: 16px 18px; font-size: 13px; display: grid; gap: 8px; align-content: start; }
.sheet-dims div { display: flex; justify-content: space-between; gap: 10px; border-bottom: 1px dashed #d8cfc2; padding-bottom: 6px; }
.sheet-dims div:last-child { border: 0; }
.sheet-dims b { font-weight: 700; }
.otable { width: 100%; border-collapse: collapse; font-size: 13px; }
.otable th { text-align: left; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); font-weight: 700; padding: 8px 6px; border-bottom: 1px solid var(--line); }
.otable td { padding: 10px 6px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.otable .n { text-align: right; white-space: nowrap; }
.otable td .sw { display: inline-block; width: 14px; height: 14px; border-radius: 3px; vertical-align: -2px; margin-right: 8px; box-shadow: inset 0 0 0 1px rgba(0,0,0,.1); }
.otable td small { display: block; color: var(--muted); margin-left: 22px; }
.otable tfoot td { font-weight: 700; border: 0; padding-top: 12px; font-size: 15px; }
.otable tfoot tr.muted td { font-weight: 400; font-size: 11.5px; padding-top: 2px; }
.sheet-h { font-size: 12px; letter-spacing: .14em; text-transform: uppercase; margin: 20px 0 8px; }
.o-detail { margin: 0; padding-left: 20px; font-size: 12.5px; color: #4f4942; display: grid; gap: 4px; }
.sheet-client { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 18px; }
.sheet-client label { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); display: grid; gap: 5px; }
.sheet-client input { font: 13px var(--sans); padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px; }
.sheet-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 20px; flex-wrap: wrap; }
.sheet-note { margin: 10px 0 0; text-align: right; font-size: 11.5px; color: var(--muted); }

.toast { position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 30px); opacity: 0; background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 12px; font-size: 13px; z-index: 50; transition: opacity .25s, transform .25s; pointer-events: none; max-width: 90vw; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* kiosk (trade show) mode */
html.kiosk { --top: 0px; }
html.kiosk .topbar { display: none; }
html.kiosk .layout { grid-template-columns: minmax(0, 1fr) 470px; height: 100svh; }
html.kiosk .powered { pointer-events: none; }
html.kiosk .colophon a, html.kiosk #share-btn, html.kiosk .stage-hint { pointer-events: none; }
html.kiosk #share-btn { display: none; }
html.kiosk .kiosk-only { display: block; grid-column: 1 / -1; padding: 16px; font-size: 17px; }
html.kiosk .panel-scroll { padding: 30px 30px 10px; }
html.kiosk h1 { font-size: 40px; }
html.kiosk .seg button { padding: 11px 16px; font-size: 14px; }
html.kiosk .stepper button { width: 50px; height: 46px; font-size: 22px; }
html.kiosk .finish { padding: 12px; }
html.kiosk .ghost.sm { padding: 12px 15px; font-size: 14px; }
html.kiosk .tool { padding: 14px 20px 14px 16px; font-size: 15px; }
html.kiosk .colophon { display: none; }
.exit-kiosk { position: fixed; top: 12px; right: 12px; z-index: 30; display: none; border: 0; border-radius: 99px; padding: 7px 12px; background: rgba(255,255,255,.7); font-size: 11.5px; font-weight: 600; color: var(--muted); }
html.kiosk .exit-kiosk { display: block; }

html.embed .topbar { display: none; }
html.embed .layout { height: 100svh; }

@media (max-width: 900px) {
  body { overflow: auto; }
  .layout { grid-template-columns: 1fr; grid-template-rows: 56svh auto; height: auto; }
  .panel { border-left: 0; border-top: 1px solid var(--line); }
  .panel-scroll { overflow: visible; padding: 20px; }
  .summary { position: sticky; bottom: 0; padding: 12px 18px; }
  .topline, .pill { display: none; }
  .topbar { padding: 0 16px; }
  .kiosk-btn { margin-left: auto; white-space: nowrap; }
  .brand-sub { letter-spacing: .3em; }
  .stage-tools .tool span { display: none; }
  .stage-tools .tool { padding: 10px; }
  .stage-hint { display: none; }
  .sheet { padding: 24px 18px; }
  .sheet-grid, .sheet-client { grid-template-columns: 1fr; }
}

@media print {
  body { overflow: visible; background: #fff; }
  body > *:not(#order-dialog) { display: none !important; }
  #order-dialog { position: static; display: block; box-shadow: none; width: 100%; max-height: none; padding: 0; }
  .no-print { display: none !important; }
  #order-dialog::backdrop { display: none; }
}
