:root {
  color-scheme: light;
  --ink: #302332;
  --plum: #6e345b;
  --plum-dark: #522741;
  --muted: #665b69;
  --edge: #ddd4df;
  --paper: #fffdfa;
  --lilac: #f3edf5;
  --wash: #faf7fa;
  --serif: "Baskervville", Georgia, "Times New Roman", serif;
  --sans: "DM Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-family: var(--sans);
  font-size: 16px;
  color: var(--ink);
  background: var(--wash);
}
*, *::before, *::after { box-sizing: border-box }
body { min-height: 100vh; margin: 0; display: flex; flex-direction: column }
body:has(dialog[open]) { overflow: hidden }
main { flex: 1; outline: 0 }
button, input, select, textarea { font: inherit }
button, a { -webkit-tap-highlight-color: transparent }
button { cursor: pointer }
button:disabled { cursor: wait; opacity: .66 }
a { color: inherit }
[hidden] { display: none !important }
:focus-visible { outline: 3px solid #824394; outline-offset: 3px }
h1, h2, h3, p { margin: 0 }
h1, h2, h3 { overflow-wrap: break-word }
.sr-only, .skip:not(:focus) {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
.skip:focus { position: fixed; top: .5rem; left: .5rem; z-index: 10; background: white; padding: .65rem }
.masthead { border-bottom: 1px solid var(--edge); background: var(--wash) }
.mast-inner, .studio { max-width: 70rem; width: calc(100% - clamp(2rem, 9vw, 9rem)); margin-inline: auto }
.mast-inner { display: flex; align-items: center; min-height: 4.25rem; gap: .7rem }
.brand { display: inline-flex; align-items: center; gap: .66rem; color: var(--plum-dark); font: bold 1.68rem/1 var(--serif); letter-spacing: -.065em; text-decoration: none }
.brand-mark { width: 1.72rem; height: 1.36rem; display: inline-block; position: relative; margin-top: .28rem; border: 2px solid var(--plum-dark); border-radius: .12rem; background: transparent }
.brand-mark::before { content: ""; position: absolute; top: -.47rem; left: -.21rem; right: -.21rem; height: .54rem; border: 1.5px solid var(--plum-dark); border-radius: .12rem .12rem .22rem .22rem; background: repeating-linear-gradient(90deg,var(--plum-dark) 0 .28rem,var(--wash) .28rem .52rem) }
.brand-mark::after { content: ""; position: absolute; right: .22rem; width: .34rem; bottom: 0; height: .66rem; background: var(--plum-dark) }
.mast-actions { margin-left: auto; display: flex; align-items: center; gap: .85rem }
.lang select { height: 2.5rem; color: var(--muted); font-weight: 650; font-size: .85rem; border: 0; background: transparent; cursor: pointer; padding: .25rem; }
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem; padding: .69rem 1.12rem; min-height: 2.75rem;
  border: 1px solid transparent; border-radius: .48rem; font-weight: 650; font-size: .94rem; line-height: 1.3;
  text-align: center; text-decoration: none; color: var(--ink); background: var(--paper); transition: background-color .15s, border-color .15s;
}
.button.primary { background: var(--plum); border-color: var(--plum); color: #fff }
.button.primary:hover { background: var(--plum-dark) }
.button.outline, .button.small, .button.quiet { border-color: #ccbfcf; background: transparent }
.button.outline:hover, .button.small:hover, .button.quiet:hover { background: #eee6ef; border-color: #ab97ae }
.button.quiet, .button.small { padding: .46rem .8rem; font-size: .88rem; min-height: 2.5rem }
.button.destructive { background: #903345; color: white }
.text-button { color: var(--plum); padding: .2rem 0; border: 0; background: none; font: 650 .93rem/1.5 var(--sans); text-decoration: underline; text-underline-offset: .18em }
.text-button.danger { color: #9d3446 }
.actions { display: flex; align-items: center; flex-wrap: wrap; gap: .75rem }
.studio { padding: .65rem 0 4rem }
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem }
.preview-label { font-size: .79rem; text-transform: uppercase; font-weight: 700; letter-spacing: .1em; color: var(--plum) }
.tabs { display: flex; flex-wrap: wrap; gap: .2rem 1.5rem; border-bottom: 1px solid var(--edge); align-items: stretch }
.tabs button { background: none; border: 0; border-bottom: 3px solid transparent; color: var(--muted); font-weight: 650; padding: .72rem .1rem; min-height: 2.75rem; font-size: .94rem }
.tabs button[aria-current] { color: var(--plum); border-bottom-color: var(--plum) }
.tabs button:hover { color: var(--plum-dark) }
.tools-menu { position: relative; margin-left: auto; align-self: center }
.tools-menu summary { cursor: pointer; color: var(--muted); font: 600 .9rem/1.4 var(--sans); padding: .65rem .2rem .65rem .6rem }
.tools-menu[open] summary, .tools-menu.active summary { color: var(--plum) }
.tools-options { position: absolute; z-index: 2; right: 0; top: 100%; width: max-content; min-width: 11.5rem; max-width: 85vw; display: grid; padding: .3rem; border: 1px solid var(--edge); border-radius: .45rem; background: var(--paper); box-shadow: 0 .3rem .9rem #30233214 }
.tools-options button, .tools-options a { width: 100%; display: block; min-height: 2.55rem; border: 0; border-radius: .25rem; padding: .62rem .72rem; color: var(--ink); text-align: left; text-decoration: none; font: 500 .91rem/1.35 var(--sans) }
.tools-options button:hover, .tools-options a:hover, .tools-options button[aria-current] { background: var(--lilac) }
.panel { padding-block: 1.75rem }
.section-head { margin-bottom: 1.13rem }
.section-head h1, .dialog-head h2 { font: 500 clamp(1.8rem,3vw,2.5rem)/1.08 var(--serif); letter-spacing: -.055em }
.surface, .product-list, .invoice-list { padding: clamp(1.1rem,3vw,1.8rem); border: 1px solid var(--edge); border-radius: .7rem; background: var(--paper) }
.empty { padding-block: 1rem; font-size: .95rem; color: var(--muted) }
.dialog-copy { max-width: 54ch; font-size: .97rem; line-height: 1.55; color: var(--muted); margin-top: .45rem }
.product-list, .invoice-list { padding-block: 0; list-style: none; margin: 0 }
.product-list li, .invoice-list li { display: flex; gap: 1rem; align-items: center; padding: 1rem 0 }
.product-list li + li, .invoice-list li + li { border-top: 1px solid var(--edge) }
.thumb { display: grid; place-items: center; flex: 0 0 3.5rem; width: 3.5rem; height: 3.5rem; background: #f0e5e8; color: #85546b; border-radius: .42rem; font: italic 1.7rem var(--serif); overflow: hidden }
.product-list li:nth-child(3n+2) .thumb { background: #e7e4ee; color: #76638a }
.product-list li:nth-child(3n) .thumb { background: #e6eddf; color: #55654d }
.thumb img { width: 100%; height: 100%; object-fit: cover }
.product-info { min-width: 0; flex: 1 }
.product-info h3, .invoice-list a { font-size: 1rem; font-weight: 660; overflow-wrap: anywhere }
.product-info p, .invoice-list p { margin: .18rem 0 0; color: var(--muted); font-size: .88rem; overflow-wrap: anywhere }
.product-meta { display: flex; flex-direction: column; align-items: flex-end; gap: .3rem }
.money { white-space: nowrap; font-variant-numeric: tabular-nums }
.sold { font-size: .76rem; padding: .13rem .4rem; background: #f4e1e3; color: #86394a; border-radius: .25rem }
.invoice-list li { justify-content: space-between; padding-block: 1.25rem }
.invoice-list a { color: var(--plum); text-underline-offset: .2em }
.editor-grid { display: grid; grid-template-columns: minmax(0,1.35fr) minmax(17rem,1fr); gap: clamp(1.2rem, 4.5vw,4rem); align-items: start }
#profile-form { max-width: 42rem }
#startup-status { color: var(--muted) }
#retry, #previous-booth { margin-top: .8rem }
.fields, .upload-field, .qr-fields { display: grid; gap: 1.06rem }
.fields label:not(.check), .field { display: grid; align-content: start; gap: .43rem; min-width: 0; font-size: .91rem; font-weight: 620; color: var(--ink) }
.fields input:not([type=checkbox]), .fields select, .fields textarea, .field input {
  display: block; width: 100%; min-width: 0; border-radius: .4rem; border: 1px solid #c8bdca; background: white;
  color: var(--ink); padding: .63rem .7rem; font: 400 1rem/1.32 var(--sans); min-height: 2.7rem;
}
.fields input[type=color] { padding: .24rem .38rem; cursor: pointer; width: 5.7rem }
.fields input[type=file] { font-size: .85rem; padding: .3rem; color: var(--muted) }
.fields input[type=file]::file-selector-button { border: 0; background: var(--lilac); color: var(--plum); padding: .45rem .6rem; border-radius: .23rem; margin-right: .5rem; font-weight: 600; cursor: pointer }
.fields textarea { resize: vertical; min-height: 4.5rem }
.fields select { cursor: pointer }
.fields > .button { justify-self: start }
.pair { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: .85rem }
.hint { font-size: .82rem; font-weight: 400; line-height: 1.48; color: var(--muted); margin-top: -.45rem }
.url-display { color: var(--plum); overflow-wrap: anywhere }
.check { display: flex; align-items: center; gap: .55rem; font-size: .9rem; line-height: 1.4 }
.check input { width: 1.06rem; height: 1.06rem; accent-color: var(--plum); margin: 0 }
.file-current { display: flex; align-items: center; gap: .8rem }
.file-current img { object-fit: contain; width: 3rem; height: 3rem; border: 1px solid var(--edge); background: #fff; border-radius: .25rem }
.qr-fields, .order-items { border: 0; padding: 0; min-width: 0; margin: 0 }
.qr-fields { padding-top: 1rem; border-top: 1px solid var(--edge) }
.qr-fields legend, .order-items legend { padding: 0; font-weight: 700; color: var(--plum); font-size: 1rem }
.qr-fields legend { padding-right: .6rem }
.qr-alternative { justify-self: start; margin-top: -.5rem }
.preview { background: #eee6f0; padding: clamp(1rem,3vw,1.9rem); border-radius: .65rem; position: sticky; top: 1rem }
.preview-label { margin: 0 0 1rem; color: #76617c }
.draft-paper { --invoice-accent: #783d66; padding: clamp(1.2rem,3.2vw,2.3rem); background: white; border-top: .34rem solid var(--invoice-accent); box-shadow: 0 .35rem .8rem #47394a15 }
.draft-paper.compact { padding: 1rem }
.paper-head { display: flex; align-items: center; gap: .55rem; min-width: 0 }
.paper-head img { width: 2.1rem; height: 2.1rem; object-fit: contain }
.paper-head p { overflow-wrap: anywhere; font-size: .9rem; font-weight: 650 }
.draft-paper > h3 { font: 500 2.2rem/1.2 var(--serif); margin: 1.15rem 0 1.7rem; letter-spacing: -.05em }
.draft-paper.compact > h3 { margin-block: .45rem .85rem }
.draft-product, .draft-total { display: flex; justify-content: space-between; gap: .5rem; padding-block: .55rem; font-size: .85rem }
.draft-total { border-top: 1px solid var(--edge) }
.draft-qr { display: grid; justify-items: center; gap: .3rem; margin-top: 1rem; font-size: .82rem; font-weight: 600; text-align: center; overflow-wrap: anywhere }
.draft-qr img { width: min(75%,9rem); height: auto }
.draft-footer { color: var(--muted); font-size: .8rem; margin-top: 1.5rem; text-align: center; white-space: pre-wrap; overflow-wrap: anywhere }
.draft-footer:empty { margin: 0 }
dialog { background: var(--paper); color: var(--ink); border: 1px solid #d6c9d8; border-radius: .85rem; width: min(32rem, calc(100% - 1.5rem)); max-height: calc(100dvh - 2rem); padding: clamp(1.15rem,3vw,2rem); box-shadow: 0 1rem 4rem #2b192940 }
dialog::backdrop { background: rgb(48 30 49 / .5) }
.access-tabs { display: flex; gap: .4rem; margin-bottom: 1.2rem }
.access-tabs button { padding: .45rem .9rem; min-height: 2.5rem; border: 1px solid var(--edge); border-radius: .4rem; color: var(--muted); background: transparent; font-weight: 600 }
.access-tabs button[aria-pressed=true] { color: var(--plum); background: var(--lilac); border-color: #c4adc2 }
.fields input#my-code { font: 600 clamp(.82rem,2.8vw,.98rem)/1.4 "Courier New", monospace; color: var(--plum-dark) }
#access-qr-image { width: min(14rem,100%); height: auto; justify-self: center }
#access-summary { padding: .9rem; border: 1px solid var(--edge); border-radius: .45rem; background: var(--wash); overflow-wrap: anywhere }
#access-summary h3 { font-size: 1.05rem }
#access-summary p, #access-summary dl { font-size: .88rem; color: var(--muted); line-height: 1.45; margin: .3rem 0 0 }
#access-summary dl, #access-summary dl div { display: flex; gap: .5rem }
#access-summary dl { column-gap: 1rem }
#access-summary dd { font-weight: 650; margin: 0 }
.dialog-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1.35rem }
.close { background: transparent; border: 1px solid var(--edge); color: var(--muted); border-radius: 50%; height: 2.33rem; min-width: 2.33rem; font-size: 1.48rem; display: grid; place-items: center; line-height: 1; padding-bottom: .12rem }
.dialog-copy { margin-bottom: 1.15rem }
.wide-dialog { width: min(55rem, calc(100% - 1.25rem)) }
.preview-frame { width: 100%; height: min(69dvh,44rem); display: block; border: 1px solid var(--edge); background: white }
.order-items .order-item { display: grid; grid-template-columns: 1fr 4.5rem; align-items: center; gap: 1rem; padding: .6rem 0; border-bottom: 1px solid var(--edge) }
.order-items input { text-align: center }
.order-name { display: grid; gap: .25rem; overflow-wrap: anywhere }
.order-name small { color: var(--muted); font-weight: 400 }
.order-total { display: flex; align-items: center; justify-content: space-between; padding: .7rem 0 }
.order-total strong { color: var(--plum); font-size: 1.22rem }
.error { font-size: .9rem; line-height: 1.45; color: #942f3c; padding: .64rem .75rem; border-radius: .3rem; background: #f9e8ea }
.toast { position: fixed; z-index: 2; bottom: 1.25rem; left: 50%; transform: translateX(-50%); width: max-content; max-width: calc(100% - 2rem); padding: .8rem 1rem; background: var(--plum-dark); color: #fff; border-radius: .45rem; box-shadow: 0 .2rem .8rem #3023322a; font-size: .92rem; text-align: center }
@media (max-width: 760px) {
  .editor-grid { grid-template-columns: minmax(0,1.3fr) minmax(13rem,1fr); gap: 1rem }
}
@media (max-width: 600px) {
  .mast-inner { min-height: 4.15rem; gap: .45rem }
  .brand { font-size: 1.43rem; gap: .5rem }
  .mast-actions { gap: .35rem }
  .button { min-height: 2.65rem }
  .studio { padding-bottom: 2rem }
  .tabs { gap: .1rem 1rem }
  .tabs button { font-size: .86rem; min-height: 2.5rem }
  .editor-grid { grid-template-columns: 1fr }
  .preview { position: static }
  .draft-paper { max-width: 23rem; margin-inline: auto }
  .product-list li { display: grid; grid-template-columns: 2.8rem minmax(0,1fr) auto; gap: .25rem .65rem }
  .thumb { grid-row: span 2; width: 2.8rem; height: 2.8rem }
  .product-list li > .button { grid-column: 3; grid-row: 1 / span 2 }
  .product-meta { grid-column: 2; flex-direction: row; align-self: start; align-items: center; gap: .4rem; font-size: .86rem }
}
@media (max-width: 365px) {
  .mast-inner, .studio { width: calc(100% - 1.4rem) }
  .brand { font-size: 1.23rem }
  .button { font-size: .86rem }
  .pair { grid-template-columns: 1fr }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important } }
