:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  color: #332219;
  background: #f5efe5;
  --ink: #302018;
  --paper: #fffcf7;
  --line: #e5d8c7;
  --accent: #f3cc72;
  --muted: #69564a;
  --green: #28533d;
  --gold-line: #b57e48;
  --shadow: 0 2px 4px #3520150a, 0 10px 27px #4529160c;
  --shell: min(100%, 1320px);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
button, input, select, textarea { font: inherit; }
button { min-height: 44px; border: 1px solid var(--line); border-radius: 13px; background: var(--paper); color: inherit; font-weight: 680; cursor: pointer; }
button:disabled { cursor: default; }
button:active:not(:disabled) { background-color: #eee0ca; }
button, summary { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
:focus-visible { outline: 3px solid #9a521f; outline-offset: 2px; }
h1, h2, h3, p { margin: 0; }
h2 { font-size: 1.2rem; letter-spacing: -.02em; }
h3 { font-size: 1rem; }
.muted, label span { color: var(--muted); }
.top { background: #302018; color: #fff7e7; padding-top: env(safe-area-inset-top); }
.top-inner, main { width: var(--shell); margin: auto; padding-inline: clamp(12px, 3.4vw, 46px); }
.top-inner { display: flex; align-items: center; justify-content: space-between; gap: 20px; min-height: 82px; }
.brand { display: flex; gap: 16px; align-items: center; flex: 0 0 auto; }
.brand img { display: block; width: auto; height: 62px; border-radius: 10px; }
.brand-label { border-left: 1px solid #715744; padding-left: 16px; color: #f1d8ad; font-size: .84rem; font-weight: 600; }
.tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.head-button, .network > summary, #catalog-select { color: #fff8e8; background: #473328; border: 1px solid #725642; padding: 8px 13px; font-size: .86rem; }
.head-button:disabled { opacity: .55; }
.head-button:active:not(:disabled) { background: #5d4130; }
.top :focus-visible { outline-color: var(--accent); }
.report-button { color: #302018; border-color: #ead59d; background: #f1dba6; }
.report-short { display: none; }
.report-button:active:not(:disabled) { background: #f3cc72; }
#catalog-select { width: auto; max-width: min(250px, 100%); font-weight: 700; border-radius: 12px; }
.network { position: relative; }
summary { cursor: pointer; list-style: none; }
summary::-webkit-details-marker { display: none; }
.network > summary { display: flex; align-items: center; min-height: 44px; border-radius: 13px; gap: 9px; white-space: nowrap; }
.connection { display: inline-flex; align-items: center; gap: 5px; font-weight: 780; }
.connection::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: #a9d8a9; }
.connection.off::before { background: #ffc067; }
#pending { color: #f0dac2; }
.popover { position: absolute; z-index: 6; top: calc(100% + 6px); right: 0; width: min(320px, calc(100vw - 24px)); padding: 16px; background: var(--paper); color: var(--ink); border: 1px solid var(--line); border-radius: 19px; box-shadow: 0 12px 42px #30201838; }
.popover p { margin: 8px 0; font-size: .91rem; overflow-wrap: anywhere; }
.popover ul { max-height: 180px; overflow: auto; padding-left: 19px; margin-block: 10px; font-size: .9rem; }
.popover button { width: 100%; margin-top: 6px; }
.popover :focus-visible { outline-color: #9a521f; }
.layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(342px, 33%); gap: clamp(20px, 3vw, 42px); align-items: start; padding-block: 34px 44px; }
.catalog-head { margin-bottom: 22px; }
h1 { font-family: Georgia, ui-serif, serif; font-size: clamp(2rem, 4.4vw, 3.55rem); font-weight: 500; letter-spacing: -.055em; line-height: 1.04; }
.catalog-section + .catalog-section { margin-top: 22px; }
.category-title { display: flex; align-items: center; gap: 12px; font-size: .98rem; margin: 0 0 11px; letter-spacing: -.01em; }
.category-title::after { content: ''; height: 1px; flex: 1; background: var(--line); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 207px), 1fr)); gap: 14px; align-items: stretch; }
.product { min-width: 0; overflow: hidden; padding: 8px; border: 1px solid var(--line); border-radius: 21px; background: var(--paper); box-shadow: var(--shadow); }
.product-photo { display: block; width: 100%; aspect-ratio: 1.55; object-fit: cover; border-radius: 14px; background: #e9dcca; }
.product-title { margin: 10px 4px 9px; min-height: 2.2em; font-family: Georgia, ui-serif, serif; font-size: clamp(1.05rem, 1.7vw, 1.38rem); line-height: 1.1; font-weight: 600; letter-spacing: -.032em; overflow-wrap: anywhere; }
.product-options { display: grid; gap: 7px; }
.product-option { display: grid; grid-template-columns: minmax(0, 1fr) 44px; gap: 6px; }
.product-option .add { min-height: 54px; padding: 6px 7px 6px 9px; display: flex; align-items: center; justify-content: space-between; text-align: left; gap: 3px; background: #faf2e5; border-color: #ede0ce; }
.product-option .add:disabled { opacity: .62; }
.option-text { display: grid; gap: 1px; min-width: 0; }
.option-text strong { font-size: .85rem; line-height: 1.12; overflow-wrap: break-word; }
.option-price { font-size: .79rem; font-variant-numeric: tabular-nums; color: var(--muted); white-space: nowrap; font-weight: 640; }
.quantity { flex-shrink: 0; min-width: 21px; padding: 1px 3px; text-align: center; color: #885227; font-size: .92rem; font-weight: 760; }
.product-option .remove { align-self: stretch; background: #fbeae6; color: #a12626; border-color: #dfaaa2; font-size: 1.25rem; line-height: 1; }
.product-option .remove:disabled { background: #fff5f2; color: #a7655e; border-color: #f0d8d3; }
.product-option.selected .add { border-color: var(--gold-line); background: #f9e7c4; }
.product-option.selected .quantity { border-radius: 7px; background: #443025; color: #fff9e9; font-size: .76rem; }
.product-option.selected .remove { border-color: #d58e84; background: #f8d8d2; }
.product-option .add:active:not(:disabled) { background: #f0d19d; }
.product-option .remove:active:not(:disabled) { background: #f2bcb3; }
.checkout { position: sticky; top: 16px; z-index: 2; padding: 17px; border: 1px solid #e2d2bd; border-radius: 24px; background: var(--paper); box-shadow: 0 14px 35px #3f291219; min-width: 0; }
.order-head { position: relative; }
#item-count { font-weight: 650; color: #6f5642; background: #f7edde; border-radius: 6px; padding: 3px 5px; font-size: .75rem; white-space: nowrap; }
.outline { padding: 7px 12px; border-color: #cfb79a; }
.outline:disabled { opacity: .58; }
#cart { margin: 7px 0 11px; padding: 0; list-style: none; max-height: 157px; overflow: auto; overscroll-behavior: contain; }
#cart li { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 5px 1px; font-size: .86rem; }
#cart li + li { border-top: 1px solid #eee4d7; }
#cart li > span:first-child { overflow-wrap: anywhere; }
#cart .empty { color: var(--muted); }
#cart .line-value { margin-left: auto; white-space: nowrap; font-variant-numeric: tabular-nums; }
.buyer { position: relative; }
label { display: block; font-size: .87rem; font-weight: 700; margin: 0 0 5px; }
input, select, textarea { width: 100%; padding: 9px 11px; border: 1px solid #cebca4; border-radius: 12px; background: #fffdf9; color: var(--ink); }
input, select { min-height: 46px; }
#customers { position: absolute; bottom: 100%; left: 0; right: 0; max-height: 182px; overflow: auto; background: #fffdf9; border: 1px solid var(--line); border-radius: 12px; z-index: 3; box-shadow: var(--shadow); }
#customers button { display: block; text-align: left; width: 100%; padding: 5px 10px; }
#customers button[aria-selected="true"] { background: #f7e5c3; border-color: #bc8b55; }
.total { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-top: 12px; padding: 11px 0 10px; border-top: 1px solid var(--line); color: #5d493b; font-weight: 750; font-size: .9rem; }
#total { font-size: clamp(1.45rem, 3.7vw, 2.28rem); color: var(--ink); letter-spacing: -.052em; font-weight: 800; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.payments { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 7px; }
.payments button { position: relative; display: grid; justify-items: center; align-content: center; gap: 3px; min-height: 61px; padding: 4px 1px; background: #fbf4e8; border-color: #e8d9c4; font-size: .77rem; font-weight: 740; }
.payments button img { display: block; }
.payments button:disabled { background: #f8f3eb; color: #6d6055; }
.payments button:disabled img { opacity: .72; }
.payments button[aria-pressed="true"] { background: #f5dfae; border-color: #956436; box-shadow: inset 0 0 0 1px #956436; color: #3e2a1d; }
.payments button[aria-pressed="true"]::after { content: '✓'; position: absolute; top: 3px; right: 4px; font-size: .73rem; color: #6e421e; }
.primary, .close-sale { background: var(--green); color: #fff; border: 1px solid transparent; min-height: 51px; width: 100%; padding: 9px 12px; }
.primary:active:not(:disabled) { background: #1d4030; }
.primary:disabled { background: #e2e8df; color: #53635a; }
.close-sale { margin-top: 10px; min-height: 54px; font-size: 1rem; font-weight: 780; border-radius: 15px; }
.toast { position: fixed; bottom: max(14px, env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); width: max-content; max-width: calc(100% - 24px); z-index: 7; background: var(--ink); color: white; padding: 8px 10px 8px 14px; border-radius: 16px; display: flex; align-items: center; flex-wrap: wrap; gap: 8px; box-shadow: 0 5px 25px #3020183d; }
.toast button { color: #ffde92; background: #463124; border-color: #947456; font-size: .84rem; }
dialog { width: min(504px, calc(100% - 28px)); max-height: 88dvh; border: 1px solid var(--line); border-radius: 25px; padding: 20px; background: var(--paper); color: var(--ink); box-shadow: 0 22px 78px #2c1b1a45; }
dialog::backdrop { background: #28180e8a; backdrop-filter: blur(5px); }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.close { width: 44px; flex: 0 0 auto; font-size: 1.4rem; }
dialog input { margin-bottom: 12px; }
dialog form p { margin: 6px 0 12px; }
.inline-error { font-size: .86rem; }
.inline-error:empty { display: none; }
.danger { padding: 7px 12px; width: 100%; border-color: #bc8a7b; color: #7a3022; }
.danger:disabled { opacity: .55; }
.report-total { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.report-total > div { padding: 12px; background: #f6e7c9; border-radius: 13px; }
.report-total strong { display: block; font-size: 1.4rem; }
#report h3 { margin: 17px 0 8px; }
.report-list { list-style: none; margin: 0; padding: 0; }
.report-list li { display: flex; justify-content: space-between; gap: 10px; border-bottom: 1px solid var(--line); padding: 6px 0; font-size: .94rem; }
.report-list li span:last-child { white-space: nowrap; }
.report-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
#report-status { margin-top: 6px; }
.error, .inline-error { color: #83271c; font-weight: 650; }
.error { background: #ffded5; padding: 10px; margin-top: 10px; border-radius: 10px; }
#copy-fallback { margin-top: 8px; min-height: 120px; }
@media (max-width: 1024px) {
  .brand-label { display: none; }
  .layout { grid-template-columns: minmax(0, 1fr) minmax(300px, 34%); gap: 18px; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
}
@media (max-width: 760px) {
  main, .top-inner { padding-inline: 11px; }
  .top-inner { display: grid; grid-template-columns: minmax(0, 1fr) 88px 105px; gap: 5px 7px; min-height: 0; padding-block: 5px 8px; }
  .tools { display: contents; }
  .brand { grid-column: 1; grid-row: 1; }
  .brand img { height: 48px; border-radius: 8px; }
  #catalog-select { grid-column: 2 / 4; grid-row: 1; width: 100%; max-width: none; min-width: 0; }
  #account { grid-column: 1 / 4; grid-row: 3; }
  .network { grid-column: 1; grid-row: 2; }
  #sync { grid-column: 2; grid-row: 2; }
  #report-open { grid-column: 3; grid-row: 2; }
  .head-button, .network > summary, #catalog-select { padding-inline: 8px; font-size: .78rem; }
  .network > summary { gap: 6px; }
  .connection { flex: 0 0 auto; }
  #pending { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  .popover { right: auto; left: 0; }
  .report-long { display: none; }
  .layout { grid-template-columns: 1fr; gap: 16px; padding-block: 18px 0; }
  .catalog-head { margin-bottom: 14px; }
  .category-title { margin-bottom: 8px; font-size: .9rem; }
  .product { padding: 6px; border-radius: 17px; }
  .product-photo { border-radius: 11px; }
  .product-title { margin: 8px 3px; font-size: 1.075rem; }
  .product-options { gap: 6px; }
  .product-option { gap: 4px; }
  .product-option .add { padding: 5px; gap: 1px; }
  .product-option button { border-radius: 10px; }
  .option-text strong { font-size: .77rem; }
  .option-price { font-size: .73rem; }
  .quantity { min-width: 15px; padding: 1px 2px; }
  .checkout { top: auto; bottom: 0; margin-inline: -4px; padding: 8px 10px calc(9px + env(safe-area-inset-bottom)); border-radius: 20px 20px 0 0; background: #fffaf2f5; box-shadow: 0 -5px 24px #36221129; backdrop-filter: blur(13px); }
  .total { margin-top: 4px; padding-block: 5px 7px; }
  #cart { max-height: min(82px, 13dvh); margin-block: 3px 6px; }
  #cart:has(.empty) { display: none; }
  .buyer { margin-block: 5px 7px; }
  .close-sale { margin-top: 8px; }
  .payments button { min-height: 54px; }
  .toast { bottom: calc(var(--checkout-height, 218px) + 7px); }
  dialog { max-height: 85dvh; width: 100%; max-width: 100%; margin: auto 0 0; border-radius: 24px 24px 0 0; padding-bottom: calc(18px + env(safe-area-inset-bottom)); }
}
@media (max-width: 375px) {
  .top-inner { grid-template-columns: minmax(0, 1fr) 81px 58px; }
  .report-default { display: none; }
  .report-short { display: inline; }
  .head-button, .network > summary { padding-inline: 7px; font-size: .74rem; }
  .network > summary { gap: 5px; }
}
@media (orientation: portrait) and (max-height: 630px) and (max-width: 450px) {
  .layout { padding-block-start: 12px; }
  .catalog-head { margin-bottom: 8px; }
  .product-photo { aspect-ratio: 1.9; }
  .product-title { font-size: 1rem; }
  .checkout { padding-block-start: 6px; }
  .payments button { min-height: 51px; }
  .close-sale { min-height: 50px; }
}
@media (orientation: landscape) and (max-height: 500px) {
  .top-inner { min-height: 56px; }
  .brand img { height: 45px; }
  .report-long { display: none; }
  #catalog-select { max-width: 210px; }
  .layout { grid-template-columns: minmax(0, 1fr) minmax(275px, 43%); align-items: start; padding-block-start: 12px; }
  .checkout { top: 6px; bottom: auto; margin: 0; padding: 10px; }
  .checkout .total { padding-block: 5px 8px; margin-top: 5px; }
  .checkout .payments button { min-height: 54px; }
  #cart { max-height: 58px; }
  .toast { bottom: 9px; }
  dialog { margin: auto; max-height: 92dvh; width: min(504px, calc(100% - 24px)); border-radius: 20px; }
}
@media (prefers-reduced-transparency: reduce) {
  .checkout { background: var(--paper); backdrop-filter: none; }
  dialog::backdrop { backdrop-filter: none; }
}

/* Sale steps and compact catalog. */
:root { --shell: min(100%, 1600px); }
.top-inner, main { padding-inline: clamp(11px, 2vw, 29px); }
.layout { gap: clamp(15px, 2vw, 28px); grid-template-columns: minmax(0, 1fr) minmax(309px, 27%); padding-block-start: 20px; }
.step-title { font-family: inherit; font-size: clamp(1rem, 1.65vw, 1.42rem); font-weight: 780; letter-spacing: -.03em; margin-bottom: 12px; }
.grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); gap: 10px; }
.option-icon { flex: 0 0 19px; width: 19px; height: 19px; fill: none; stroke: #784e2d; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.product-option .add { justify-content: start; gap: 5px; }
.product-option .quantity { margin-left: auto; }
.checkout .payments { margin-bottom: 10px; }
.checkout .order-head { border-top: 1px solid var(--line); padding-top: 5px; }
.buyer label[for="phone"] { margin-top: 8px; }
.report-scope { margin-bottom: 10px; font-size: .9rem; line-height: 1.4; }
@media (max-width: 760px) {
  .layout { grid-template-columns: 1fr; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .checkout .step-title { margin-bottom: 6px; }
  .checkout .payments { margin-bottom: 7px; }
  .checkout .total { margin-top: 2px; }
  .option-icon { flex-basis: 15px; width: 15px; height: 15px; }
  .product-option .add { gap: 2px; }
}
.option-text { grid-template-columns: auto minmax(0, 1fr); column-gap: 4px; align-items: center; }
.option-text strong { grid-column: 1 / -1; }
.option-icon { width: 15px; height: 15px; }
@media (orientation: landscape) and (max-height: 500px) {
  .layout { grid-template-columns: minmax(0, 1fr) minmax(275px, 40%); padding-block-start: 10px; }
  .checkout { max-height: calc(100dvh - 12px); overflow-y: auto; }
}
.confirm-actions { display: grid; gap: 9px; margin-block: 12px; }
#customer-search { position: absolute; bottom: calc(100% - 22px); left: 0; right: 0; z-index: 4; padding: 6px; background: var(--paper); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); }
#customer-search #customers { position: static; box-shadow: none; border: 0; }
#close-customers { display: grid; place-items: center; width: 44px; margin: 0 0 4px auto; padding: 0; font-size: 1.3rem; }
#sales-list { margin-top: 10px; }
#sales-list .sale-row { align-items: center; padding-block: 9px; }
.sale-row p { margin: 3px 0; }
.sale-paid, .sale-unpaid { font-size: .82rem; font-weight: 750; color: var(--green); }
.sale-unpaid { color: #863e1e; }
.sale-actions { flex: 0 0 auto; display: grid; gap: 5px; }
.sale-actions button { font-size: .82rem; }
.sale-actions button:last-child { color: #7a3022; }
#kit-adjustment { margin-top: 6px; color: var(--green); font-size: .84rem; font-weight: 740; }
#close-log { margin-top: 10px; }
#close-log summary { padding: 10px; border: 1px solid var(--line); border-radius: 10px; }
#close-log-text { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 190px; overflow-y: auto; }
#close-result, #last-close { margin-top: 7px; }
@media (max-width: 760px) {
  .top-inner { grid-template-columns: minmax(0, 1fr) 116px; }
  #catalog-select { grid-column: 2; }
  #report-open { grid-column: 2; }
  #account { grid-column: 1 / 3; }
}
#sales-open { display: inline-flex; align-items: center; justify-content: center; gap: 5px; white-space: nowrap; }
.sales-short { display: none; }
#seed-sales { margin-top: 8px; }
#sample-status { margin-top: 6px; }
#sales-list { max-height: min(52dvh, 510px); overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; padding-right: 4px; }
.sample-label { display: block; color: var(--muted); }
@media (max-width: 760px) {
  .top-inner { grid-template-columns: minmax(0, 1fr) 89px 94px; }
  #catalog-select { grid-column: 2 / 4; }
  #account { grid-column: 1 / 4; }
  #sales-open { grid-column: 2; grid-row: 2; padding-inline: 4px; }
  #report-open { grid-column: 3; }
  .sales-full { display: none; }
  .sales-short { display: inline; }
}
@media (max-width: 375px) {
  #pending { font-size: 0; }
  #pending::after { content: attr(data-number); font-size: .74rem; font-weight: 750; }
}

.product-promotion { margin: 0 4px 8px; color: var(--green); font-size: .81rem; font-weight: 750; }
.product-weight { display: inline-block; margin-left: 6px; white-space: nowrap; font: 600 .68rem system-ui, sans-serif; color: var(--muted); }
.catalog-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.catalog-bar .step-title { margin: 0; }
.catalog-controls { display: flex; flex-wrap: wrap; gap: 6px; }
.catalog-controls button { font-size: .77rem; }
.product-option.sold-out .option-price::after { content: ' · Esgotado'; color: #863e1e; white-space: normal; }
.setup-list { max-height: min(38dvh, 330px); overflow-y: auto; margin: 8px 0; }
.setup-row, .stock-row { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.setup-list.has-promotion .setup-row { grid-template-columns: minmax(0,1fr) 85px 50px; }
.setup-list .setup-row > label:last-child { display: none; }
.setup-list.has-promotion .setup-row > label:last-child { display: flex; }
.setup-row label { display: flex; align-items: center; gap: 5px; min-height: 44px; margin: 0; }
.setup-row input[type=checkbox] { width: 17px; min-height: 17px; margin: 0; accent-color: var(--green); }
.setup-row input:not([type=checkbox]) { width: 85px; margin: 0; }
#event-editor h3 { margin-top: 12px; }
#event-editor #event-save { margin-top: 10px; }
.customer-search-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding-inline: 4px; }
#customer-results { color: var(--muted); font-weight: 650; font-size: .8rem; }
#customer-search #customers { max-height: min(220px, 29dvh); overscroll-behavior: contain; scrollbar-gutter: stable; }
.header-actions-panel { display: flex; gap: 7px; }
#header-actions > summary { display: none; }
.subtotal { display: flex; justify-content: space-between; color: var(--muted); font-size: .9rem; padding-top: 5px; }
.order-totals #kit-adjustment { margin-top: 5px; }
.order-totals .total { margin-top: 6px; }
.product-options .product-promotion { margin: 4px 1px 0; }
@media (max-width: 760px) {
  .top-inner { grid-template-columns: minmax(0, 1fr) 84px 54px 44px; }
  #catalog-select { grid-column: 2 / 4; }
  #account { grid-column: 1 / 5; }
  #report-open { grid-column: 3 / 5; }
  #header-actions { grid-row: 1; grid-column: 4; position: relative; }
  #header-actions > summary { display: grid; place-items: center; min-height: 44px; min-width: 44px; background: #473328; border: 1px solid #725642; border-radius: 13px; }
  .header-actions-panel { position: absolute; top: calc(100% + 6px); right: 0; z-index: 8; padding: 6px; background: #302018; border: 1px solid #725642; border-radius: 12px; flex-direction: column; min-width: 145px; }
  .header-actions-panel button { text-align: left; }
}
#catalog .grid { align-items: start; }
#catalog .product-shelf {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 12px;
}
.product-shelf .product-photo { aspect-ratio: auto; height: clamp(105px, 16vw, 180px); }
.product-shelf .product-title { min-height: 0; }
.product-shelf .product-options { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.product-shelf .product-promotion { grid-column: 1 / -1; }
@media (max-width: 360px) {
  .product-shelf .product-options { grid-template-columns: 1fr; }
}

.cancel-draft { display: block; width: 100%; min-height: 44px; margin-top: 6px; color: #962b28; background: transparent; border-color: #e7c3bc; font-size: .86rem; }
.cancel-draft:active:not(:disabled) { background: #f9e4df; }
.cancel-draft:disabled { opacity: .55; }


#catalog { container-type: inline-size; }
@container (max-width: 699px) {
  #catalog .product-shelf { grid-template-columns: minmax(0, 1fr); }
}
#seed-customers { margin: 6px 4px 0; font-size: .82rem; }
.confirm-customer { margin: 0 0 12px; padding: 9px 12px; background: #f7edde; border-radius: 12px; }
.confirm-customer > div, .confirm-totals > div { display: flex; justify-content: space-between; gap: 10px; padding-block: 4px; }
.confirm-customer dt, .confirm-totals span { color: var(--muted); }
.confirm-customer dd { margin: 0; font-weight: 700; text-align: right; overflow-wrap: anywhere; }
#confirm-items { max-height: min(22dvh, 150px); overflow: auto; overscroll-behavior: contain; }
#confirm-items strong { white-space: nowrap; }
.confirm-totals { margin-top: 8px; }
.confirm-total { border-top: 1px solid var(--line); margin-top: 4px; font-size: 1.2rem; }
#confirm-discount { color: var(--green); }
.login-required > header, .login-required > main, .login-required > .toast { display: none; }
#login #sign-out { margin-top: 10px; width: 100%; }
#login .login-brand { display: none; }
#login .login-intro { margin-bottom: 14px; }
.login-required #login .dialog-head .close { display: none; }
.login-required #login { width: min(420px, calc(100% - 32px)); max-width: none; margin: auto; border-radius: 25px; padding: 24px; }
.login-required #login::backdrop { background: #302018; backdrop-filter: none; }
.login-required #login .login-brand { display: block; margin-bottom: 15px; }
.login-brand img { border-radius: 10px; object-fit: contain; width: 84px; height: auto; }
#login-demo { margin-top: 12px; }
#event-menu-prices { display: grid; grid-template-columns: minmax(0, 1fr) 105px; align-items: center; gap: 7px; padding: 10px; border: 1px solid var(--line); border-radius: 14px; background: #fbf3e8; }
#event-menu-prices label { margin: 0; }
#event-menu-prices input { margin: 0; }
.stock-label { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.stock-label small { color: #8c3c33; font-size: .78rem; line-height: 1.3; }
.stock-row > button { min-height: 44px; }
.mfa-step { margin-top: 12px; }
.mfa-step p { line-height: 1.45; }
.mfa-qr { display: block; width: min(220px, 100%); height: auto; margin: 10px auto; padding: 8px; border: 1px solid var(--line); border-radius: 14px; background: white; }
.mfa-secret { overflow-wrap: anywhere; font-size: .83rem; }
.mfa-secret code { display: block; margin-top: 6px; padding: 8px; border-radius: 9px; background: #f6eee3; font-size: .9rem; user-select: all; }
#mfa-verify { width: 100%; margin-top: 10px; }
#mfa-restart { width: 100%; margin-top: 8px; }
#register-list { max-height: 170px; overflow-y: auto; }
#register-list > li { display: flex; justify-content: space-between; gap: 12px; }
@media (max-width: 420px) {
  #event-menu-prices { grid-template-columns: 1fr; }
  #register-list > li { align-items: flex-start; flex-direction: column; gap: 2px; }
}

/* Production PDV: touch-first catalog and checkout. */
:root {
  --ink: #351e12;
  --paper: #fffdf9;
  --line: #e5dacc;
  --green: #126b49;
  --green-dark: #075336;
  --red: #b84236;
  --muted: #806e60;
}
html { min-height: 100%; background: #f7f2ea; }
body { min-height: 100dvh; color: var(--ink); background: radial-gradient(ellipse at 60% 10%, #fffaf1 0%, #f7f2ea 58%, #f1eade 100%); }
.top { background: linear-gradient(100deg, #29170c, #3a2113 58%, #28160d); box-shadow: 0 3px 14px #21120838; }
.top-inner { display: grid; grid-template-columns: minmax(140px, 180px) minmax(220px, 286px) minmax(0, 1fr); gap: 10px; min-height: 88px; padding-inline: clamp(11px, 1.5vw, 24px); }
.brand { min-width: 0; gap: 9px; }
.brand img { height: 61px; border-radius: 13px; }
.brand-label { padding-left: 10px; color: #f7e3bf; font-size: .79rem; white-space: nowrap; }
.context-picker { min-width: 0; min-height: 62px; display: flex; align-items: center; gap: 10px; padding: 8px 11px; border: 1px solid #edc15d; border-radius: 16px; color: #2b1b0d; background: linear-gradient(145deg, #ffd36b, #efb93f); box-shadow: inset 0 1px #ffffff7a, 0 5px 14px #e6a83124; }
.context-picker > img { flex: 0 0 auto; filter: brightness(0) saturate(100%) invert(10%) sepia(17%) saturate(1584%) hue-rotate(344deg) brightness(93%); }
.context-picker-copy { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 2px; }
#context-kicker { font-size: .62rem; line-height: 1.15; letter-spacing: .05em; font-weight: 850; }
#catalog-select { width: 100%; min-width: 0; max-width: none; min-height: 27px; padding: 0 20px 0 0; border: 0; border-radius: 0; color: #2b1b0d; background: transparent; font-size: .98rem; font-weight: 800; }
#catalog-select:focus-visible { outline: 2px solid #573318; outline-offset: 1px; }
#catalog-select option { color: #302018; background: #fffdf9; }
.header-actions { min-width: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); align-items: stretch; gap: 6px; }
.header-actions > .head-button, .header-actions > .network > summary { width: 100%; height: 58px; min-height: 58px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 5px 4px; border: 1px solid #725642; border-radius: 14px; color: #fff8e8; background: linear-gradient(145deg, #513725, #3d281a); font-size: clamp(.62rem, .75vw, .78rem); font-weight: 740; line-height: 1.1; text-align: center; white-space: normal; }
.header-actions > .head-button img, .network > summary > img { flex: 0 0 auto; filter: brightness(0) invert(1); }
.header-actions > .head-button:active:not(:disabled), .network > summary:active { background: #5d402c; }
.header-actions > .head-button:disabled { opacity: .52; }
.header-actions > .report-button { color: #2d1a0d; background: linear-gradient(140deg, #fff2cf, #f2d18e); border-color: #ebcf94; }
.header-actions > .report-button img { filter: none; }
.network { min-width: 0; position: relative; }
.header-actions > .network > summary { list-style: none; }
.network > summary::-webkit-details-marker { display: none; }
.network-copy { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.connection { display: inline-flex; align-items: center; gap: 5px; font-size: inherit; font-weight: 800; line-height: 1; }
.connection::before { width: 7px; height: 7px; background: #60d2a2; box-shadow: 0 0 0 3px #60d2a21f; }
.connection.off::before { background: #ffc067; }
#pending { color: #ecd9c3; font-size: .64rem; line-height: 1; }
.popover { z-index: 20; top: calc(100% + 8px); }
.layout { grid-template-columns: clamp(92px, 9vw, 122px) minmax(0, 1fr) minmax(320px, 380px); gap: clamp(10px, 1.25vw, 18px); align-items: start; padding-block: 14px 28px; }
.category-rail { position: sticky; top: 12px; display: flex; flex-direction: column; gap: 9px; min-width: 0; height: calc(100dvh - 155px); min-height: 255px; max-height: 760px; }
.category-list { display: flex; flex-direction: column; gap: 9px; }
.category-logout { width: 100%; min-height: 62px; margin-top: auto; display: flex; flex: 0 0 auto; flex-direction: column; align-items: center; justify-content: center; gap: 5px; border: 1px solid #e5c6bb; border-radius: 16px; color: #99483e; background: #fff9f6; box-shadow: 0 4px 14px #482b150b; font-size: .8rem; font-weight: 800; }
.category-logout img { display: block; }
.category-logout:hover { border-color: #c99084; background: #fff0ea; }
.category-button { min-height: 96px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 9px; padding: 10px 6px; border: 1px solid #e5dacc; border-radius: 19px; color: #5e3d21; background: #fffaf2; box-shadow: 0 4px 14px #482b150b; font-size: .83rem; font-weight: 780; line-height: 1.2; text-align: center; }
.category-button .product-glyph { width: 39px; height: 39px; color: #6a421d; }
.category-button.selected { border: 2px solid #eebd48; color: #fff8e8; background: linear-gradient(145deg, #5a3a21, #3f2918); box-shadow: 0 5px 16px #56381e38; }
.category-button.selected .product-glyph { color: #ffe6a7; }
.catalog-panel { min-width: 0; padding: 13px; border: 1px solid #e5dacc; border-radius: 23px; background: #fffdf9; box-shadow: 0 12px 30px #482b150d; }
.catalog-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 9px; margin: 0 2px 12px; }
.catalog-kicker { display: block; margin-bottom: 3px; color: #967e63; font-size: .64rem; font-weight: 850; letter-spacing: .07em; }
.catalog-heading .step-title { margin: 0; color: #351e12; font-family: inherit; font-size: clamp(1.1rem, 1.65vw, 1.45rem); font-weight: 820; letter-spacing: -.035em; line-height: 1.12; }
.items-count { flex: 0 0 auto; padding: 5px 9px; border-radius: 20px; color: #6a4b2e; background: #f4ead8; font-size: .74rem; font-weight: 750; white-space: nowrap; }
#catalog { min-width: 0; container-type: inline-size; }
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); align-items: stretch; gap: 8px; }
.product-group-heading { grid-column: 1 / -1; min-height: 34px; display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 2px; padding: 5px 11px; border-radius: 12px; color: #0c6241; background: #e7eee3; }
.product-group-heading strong { font-size: .94rem; }
.product-group-heading span { color: #5d7964; font-size: .78rem; font-weight: 760; white-space: nowrap; }
.product-card { min-width: 0; min-height: 104px; display: grid; grid-template-columns: clamp(85px, 9vw, 122px) minmax(0, 1fr) 42px; align-items: center; gap: 9px; padding: 7px; border: 1px solid #e5dacc; border-radius: 16px; background: linear-gradient(120deg, #fffaf2, #f9f2e6); box-shadow: 0 2px 7px #482b150a; cursor: pointer; transition: border-color .14s, box-shadow .14s, transform .14s; }
.product-card:hover { border-color: #d2b98d; box-shadow: 0 5px 14px #482b1518; transform: translateY(-1px); }
.product-card:focus-visible { outline: 3px solid #9a521f; outline-offset: 2px; }
.product-photo-button { width: 100%; height: clamp(82px, 8.4vw, 112px); min-height: 82px; overflow: hidden; padding: 0; border: 0; border-radius: 11px; background: #eee1cf; }
.product-photo-button img { display: block; width: 100%; height: 100%; object-fit: cover; }
.product-copy { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.product-copy > strong { color: #351e12; font-size: clamp(.86rem, 1vw, 1rem); font-weight: 790; line-height: 1.14; overflow-wrap: anywhere; }
.product-kind { color: #806e60; font-size: .75rem; line-height: 1.15; }
.product-subprice { display: inline-flex; align-items: center; gap: 6px; color: #684624; font-size: .83rem; font-variant-numeric: tabular-nums; font-weight: 730; }
.product-subprice img { width: 16px; height: 16px; object-fit: contain; }
.add-button { width: 42px; height: 46px; min-height: 46px; display: grid; place-items: center; padding: 0; border: 1px solid transparent; border-radius: 12px; color: #563c28; background: transparent; }
.add-button img { width: 20px; height: 20px; opacity: .72; }
.add-button:active:not(:disabled) { background: #f2eadc; }
.product-out { opacity: .62; cursor: default; }
.sold-label { color: #a03a31; font-size: .73rem; font-weight: 780; text-align: center; }
.empty-catalog { grid-column: 1 / -1; padding: 18px 10px; color: var(--muted); text-align: center; }
.checkout { position: static; inset: auto; max-height: none; min-width: 0; overflow: visible; margin: 0; padding: 14px; border: 1px solid #e5dacc; border-radius: 23px; background: #fffdf9; box-shadow: 0 12px 30px #482b1514; backdrop-filter: none; }
.checkout .step-title { margin: 0 0 10px; color: #351e12; font-family: inherit; font-size: clamp(1.12rem, 1.6vw, 1.38rem); font-weight: 820; letter-spacing: -.035em; line-height: 1.14; }
.order-head { display: flex; align-items: center; justify-content: space-between; gap: 9px; padding-bottom: 7px; border-bottom: 1px solid #eee5d9; }
.order-head h3 { min-width: 0; display: flex; align-items: center; flex-wrap: wrap; gap: 7px; color: #3a2619; font-size: 1.01rem; font-weight: 820; line-height: 1.25; }
#item-count { padding: 3px 8px; border-radius: 12px; color: #735b42; background: #f3eadb; font-size: .76rem; font-weight: 700; white-space: nowrap; }
.order-toggle-chevron { width: 8px; height: 8px; display: inline-block; flex: 0 0 auto; border: solid currentColor; border-width: 0 1.7px 1.7px 0; transform: rotate(45deg); transition: transform .14s ease; }
#cart { max-height: none; overflow: visible; overscroll-behavior: auto; margin: 2px 0 0; padding: 0; list-style: none; }
#cart li { min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; column-gap: 10px; row-gap: 2px; padding: 9px 1px; border-bottom: 1px solid #eee5d9; font-size: .86rem; }
#cart li + li { border-top: 0; }
#cart .order-item-name { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.order-item-name strong { color: #3a271a; font-size: .83rem; line-height: 1.24; overflow-wrap: anywhere; }
#cart .line-value { grid-column: 1; grid-row: 2; margin: 0; color: #725b43; font-size: .76rem; white-space: nowrap; }
.quantity-controls { grid-column: 2; grid-row: 1 / span 2; display: flex; align-items: center; justify-content: center; gap: 9px; }
.quantity-controls button { width: 46px; height: 48px; min-height: 48px; flex: 0 0 auto; display: grid; place-items: center; padding: 0; border-radius: 12px; font-size: 1.35rem; line-height: 1; }
.minus-button { border: 1px solid #e8b8b0; color: #b84236; background: #fff1ee; }
.plus-button { border: 1px solid #b6d7c5; color: #08734a; background: #eff8f1; }
.quantity-controls .quantity-count { min-width: 23px; color: #39291d; font-size: .94rem; text-align: center; font-variant-numeric: tabular-nums; }
#cart .empty { grid-column: 1 / -1; color: #806e60; font-size: .85rem; padding-block: 10px; }
.order-totals { padding-top: 5px; }
.subtotal { display: flex; justify-content: space-between; gap: 8px; padding: 3px 0; color: #806e60; font-size: .84rem; }
.order-totals #kit-adjustment { margin: 3px 0; color: #12724c; font-size: .8rem; font-weight: 740; }
.total { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-top: 2px; padding: 5px 0 10px; border: 0; color: #351e12; font-size: .97rem; font-weight: 800; }
.total output { color: #2d1a0e; font-size: clamp(1.65rem, 2.25vw, 2.12rem); font-weight: 900; letter-spacing: -.045em; font-variant-numeric: tabular-nums; }
.payment-section { padding: 0 0 11px; border: 0; }
.payment-choice-heading { display: flex; flex-wrap: wrap; align-items: baseline; gap: 5px 8px; margin-bottom: 8px; line-height: 1.35; }
.payment-choice-heading strong { color: #3a2619; font-size: .94rem; font-weight: 820; }
.payment-choice-heading span { color: #806e60; font-size: .74rem; }
.payments { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 7px; }
.payments button { min-width: 0; min-height: 62px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 5px 2px; border: 1px solid #e5dacc; border-radius: 13px; color: #59412e; background: #faf4ea; font-size: .76rem; font-weight: 770; }
.payments button img { width: 23px; height: 23px; object-fit: contain; }
.payments button[aria-pressed=true] { border-color: #16835a; color: #075336; background: #e5f3e9; box-shadow: inset 0 0 0 1px #16835a; }
.payments button:disabled { opacity: .48; }
.payment-required-note { margin: 9px 0 0; padding: 9px 10px; border: 1px solid #d35d52; border-radius: 12px; color: #922a23; background: #fff0ec; font-size: .79rem; font-weight: 650; line-height: 1.4; animation: payment-attention 1.7s ease-in-out infinite; }
.payment-required-note strong { font-weight: 850; }
@keyframes payment-attention {
  0%, 100% { border-color: #d35d52; box-shadow: 0 0 0 0 #d94c4030; }
  50% { border-color: #a92520; box-shadow: 0 0 0 4px #d94c401d; }
}
.checkout .buyer { display: grid; grid-template-columns: 1fr; gap: 5px; margin: 0; }
.buyer label { margin: 4px 0 0; color: #463123; font-size: .82rem; font-weight: 780; }
.buyer label span { color: #806e60; font-weight: 550; }
.buyer input { width: 100%; min-height: 46px; margin: 0; padding: 9px 11px; border: 1px solid #cfc0ad; border-radius: 11px; background: #fffdfa; }
.phone-hint { color: #9a452f; font-size: .73rem; line-height: 1.3; }
.close-sale { width: 100%; min-height: 56px; display: flex; align-items: center; justify-content: center; gap: 9px; margin-top: 11px; border: 1px solid #b6d1bb; border-radius: 14px; color: #075336; background: linear-gradient(145deg, #dfede0, #c8ddcc); font-size: 1.04rem; font-weight: 850; }
.close-sale img { width: 20px; height: 20px; }
.close-sale:disabled { color: #8a9b8a; background: #e6eee5; border-color: #d5dfd3; opacity: 1; }
.cancel-draft { width: 100%; min-height: 44px; display: flex; align-items: center; justify-content: center; gap: 7px; margin-top: 6px; border: 1px solid #e6c4bd; border-radius: 12px; color: #a13f35; background: transparent; font-size: .83rem; }
.cancel-draft:disabled { opacity: .48; }
#stock-warning { margin: 5px 0; }
.toast { z-index: 100; }

/* Long dialogs scroll once while their actions stay reachable. */
dialog { width: min(640px, calc(100% - 28px)); max-height: min(90dvh, 900px); display: flex; flex-direction: column; overflow: hidden; padding: 0; border: 1px solid #e5dacc; border-radius: 22px; background: #fffdf9; }
dialog[open] { display: flex; }
dialog .dialog-head { flex: 0 0 auto; align-items: center; margin: 0; padding: 15px 18px; border-bottom: 1px solid #eee5d9; background: #fffdf9; }
dialog .dialog-head h2 { color: #351e12; font-size: 1.18rem; line-height: 1.2; }
.dialog-eyebrow { display: block; margin-bottom: 3px; color: #8a745e; font-size: .64rem; font-weight: 850; letter-spacing: .07em; text-transform: uppercase; }
.dialog-body { min-height: 0; flex: 1 1 auto; overflow: auto; overscroll-behavior: contain; padding: 15px 18px; }
.dialog-footer { flex: 0 0 auto; display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 11px 18px calc(11px + env(safe-area-inset-bottom)); border-top: 1px solid #eee5d9; background: #fffdf9; }
.dialog-footer button { min-height: 46px; }
.dialog-footer button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; }
.dialog-footer button img { width: 16px; height: 16px; flex: 0 0 auto; }
#event-editor, #stock-dialog { width: min(780px, calc(100% - 28px)); }
#event-form { min-height: 0; display: flex; flex: 1 1 auto; flex-direction: column; overflow: hidden; }
#event-form .dialog-body { padding-block: 15px; }
#event-editor .setup-list { max-height: none; overflow: visible; margin-block: 8px 14px; }
#event-editor .setup-row { min-height: 48px; padding-block: 6px; }
#event-editor .setup-row > label:first-child { cursor: pointer; }
#event-editor .setup-row > input { min-height: 42px; }
#event-editor .dialog-footer { justify-content: flex-end; }
#event-editor .dialog-footer .outline { min-width: 112px; }
#event-editor #event-save { width: auto; min-width: 160px; margin: 0; min-height: 48px; }
#event-editor h3 { margin: 14px 0 7px; color: #3c291b; }
#stock-dialog #stock-list { min-height: 0; flex: 1 1 auto; overflow: auto; overscroll-behavior: contain; margin: 0; padding: 8px 18px; }
#stock-dialog .dialog-footer button { min-width: 112px; }
.stock-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.stock-actions button { min-height: 44px; }
#sales { width: min(920px, calc(100% - 28px)); }
#sales .dialog-body { padding-top: 12px; }
.sales-toolbar { display: grid; grid-template-columns: minmax(0, 1fr) minmax(190px, 270px); align-items: center; gap: 10px; margin-bottom: 12px; }
.sales-filters { display: flex; flex-wrap: wrap; gap: 5px; }
.sales-filters button { min-height: 40px; padding: 6px 9px; border-radius: 20px; color: #67513b; background: #f7f0e5; font-size: .75rem; }
.sales-filters button::after { content: attr(data-count); margin-left: 5px; color: #8d785f; font-size: .68rem; }
.sales-filters button[aria-pressed=true] { border-color: #ccae72; color: #3b2918; background: #ffedc2; }
.sales-search { min-height: 42px; display: flex; align-items: center; gap: 7px; padding: 0 10px; border: 1px solid #d8c9b7; border-radius: 11px; background: #fffdfa; }
.sales-search img { opacity: .65; }
.sales-search input { width: 100%; min-height: 38px; margin: 0; padding: 4px 0; border: 0; outline: 0; background: transparent; }
#sales-list { max-height: none; overflow: visible; margin-top: 6px; padding: 0; }
#sales-list .sale-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px 12px; padding: 12px 2px; border-bottom: 1px solid #eee5d9; }
#sales-list .sale-row > div:first-child { min-width: 0; display: grid; gap: 4px; }
#sales-list .sale-row strong { color: #39281b; font-size: .86rem; }
#sales-list .sale-row p { color: #806e60; font-size: .76rem; line-height: 1.35; overflow-wrap: anywhere; }
.sale-items-preview { color: #755f48; font-size: .73rem; line-height: 1.35; overflow-wrap: anywhere; }
#sales-list .sale-paid, #sales-list .sale-unpaid { width: fit-content; padding: 3px 8px; border-radius: 20px; color: #126b49; background: #e5f3e9; font-size: .7rem; font-weight: 800; }
#sales-list .sale-unpaid { color: #a24432; background: #fff0e7; }
.sale-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.sale-actions button { min-height: 40px; padding: 6px 9px; font-size: .74rem; }
.sales-footer { justify-content: space-between; }
.sales-footer button { min-width: 112px; }
#report { width: min(720px, calc(100% - 28px)); }
#report h3 { margin: 16px 0 7px; color: #3a281a; }
#report .dialog-footer { align-items: stretch; flex-direction: column; gap: 4px; }
#report #close-register { width: 100%; display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 50px; }
#report #close-register:disabled { opacity: .54; }
#report #close-result, #report #last-close { margin: 0; font-size: .78rem; }
#report .report-total > div { border: 1px solid #ecdfce; background: #faf4e9; }
#report .report-actions button { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; }
#report #register-list { max-height: none; overflow: visible; }
#report #close-log-text { max-height: none; white-space: pre-wrap; overflow-wrap: anywhere; }
#confirm-sale { width: min(580px, calc(100% - 28px)); }
#confirm-sale-detail { max-height: none; overflow: auto; }
#confirm-items { max-height: none; overflow: visible; }
#confirm-sale .confirm-actions { display: grid; grid-template-columns: 1fr 1fr; }
#confirm-sale .confirm-actions button { min-height: 49px; }
#confirm-sale > .muted { padding: 0 18px 14px; font-size: .78rem; }
#sale-registered { width: min(600px, calc(100% - 28px)); }
#sale-registered .dialog-body h3 { margin: 14px 0 7px; }
.sale-context-summary { margin-bottom: 10px; color: #6f5840; font-size: .87rem; }
#sale-registered .confirm-customer { margin-bottom: 10px; }
#sale-registered .sale-undo { width: 100%; margin-top: 12px; }
#sale-registered .confirm-total { color: #351e12; }
#image-viewer { width: min(700px, calc(100% - 28px)); }
.image-viewer-frame { min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; margin: 0; padding: 14px 18px 20px; }
.image-viewer-frame img { display: block; max-width: 100%; max-height: 62vh; width: auto; height: auto; object-fit: contain; border-radius: 14px; background: #f1e7d8; }
.image-viewer-frame figcaption { width: 100%; color: #725b43; font-size: .85rem; line-height: 1.4; text-align: center; }

@media (max-width: 1040px) {
  .top-inner { grid-template-columns: minmax(132px, 165px) minmax(205px, 250px) minmax(0, 1fr); gap: 7px; }
  .brand-label { display: none; }
  .header-actions { gap: 4px; }
  .header-actions > .head-button, .header-actions > .network > summary { font-size: .63rem; }
  .layout { grid-template-columns: 92px minmax(0, 1fr) minmax(310px, 35%); gap: 10px; }
  .catalog-panel { padding: 10px; }
  .checkout { padding: 12px; }
  .product-card { grid-template-columns: 90px minmax(0, 1fr) 40px; gap: 7px; }
  .product-photo-button { height: 82px; }
  .quantity-controls { gap: 7px; }
  .quantity-controls button { width: 44px; height: 46px; min-height: 46px; }
}
@media (max-width: 900px) {
  .top-inner { grid-template-columns: minmax(120px, 160px) minmax(0, 1fr); }
  .header-actions { grid-column: 1 / -1; }
  .layout { grid-template-columns: 96px minmax(0, 1fr); }
  .checkout { position: static; grid-column: 1 / -1; max-height: none; overflow: visible; }
}
@media (max-width: 620px) {
  main, .top-inner { padding-inline: 10px; }
  .top-inner { grid-template-columns: 104px minmax(0, 1fr); padding-block: 7px; }
  .brand img { height: 48px; }
  .context-picker { min-height: 54px; padding: 6px 8px; gap: 6px; }
  .context-picker > img { width: 23px; height: 23px; }
  #context-kicker { font-size: .52rem; }
  #catalog-select { font-size: .82rem; }
  .header-actions { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 3px; }
  .header-actions > .head-button, .header-actions > .network > summary { height: 55px; min-height: 55px; padding: 4px 2px; border-radius: 11px; font-size: .54rem; }
  .header-actions > .head-button img, .network > summary > img { width: 16px; height: 16px; }
  #pending { font-size: .5rem; }
  .network-copy { gap: 1px; }
  .layout { grid-template-columns: 1fr; gap: 10px; padding-block: 11px 22px; }
  .category-rail { position: static; height: auto; min-height: 0; max-height: none; flex-direction: row; overflow-x: auto; gap: 7px; padding: 1px 1px 5px; }
  .category-list { flex-direction: row; gap: 7px; }
  .category-logout { width: auto; min-width: 76px; min-height: 60px; margin: 0 0 0 auto; flex-direction: row; gap: 6px; padding: 7px 9px; border-radius: 14px; font-size: .7rem; }
  .category-button { min-width: 96px; min-height: 66px; flex-direction: row; gap: 6px; padding: 7px; border-radius: 14px; font-size: .7rem; }
  .category-button .product-glyph { width: 26px; height: 26px; }
  .catalog-panel { padding: 10px; border-radius: 18px; }
  .catalog-heading { align-items: center; margin-bottom: 9px; }
  .catalog-heading .step-title { font-size: 1.1rem; }
  .items-count { font-size: .65rem; }
  .product-grid { grid-template-columns: minmax(0, 1fr); gap: 7px; }
  .product-card { grid-template-columns: 100px minmax(0, 1fr) 42px; min-height: 93px; }
  .product-photo-button { height: 78px; min-height: 78px; }
  .product-copy > strong { font-size: .91rem; }
  .checkout { grid-column: 1; max-height: none; overflow: visible; position: static; padding: 12px; border-radius: 18px; }
  #event-editor .dialog-footer { gap: 7px; }
  #event-editor .dialog-footer button { min-width: 0; flex: 1 1 0; }
  #event-editor #event-save { min-width: 0; }
  .checkout .step-title { font-size: 1.13rem; }
  .sales-toolbar { grid-template-columns: 1fr; }
  .dialog-head { padding-inline: 15px !important; }
  .dialog-body { padding-inline: 15px; }
  .dialog-footer { padding-inline: 15px; }
}
@media (max-width: 390px) {
  .header-actions > .head-button, .header-actions > .network > summary { font-size: .48rem; }
  .header-actions > .head-button img, .network > summary > img { width: 14px; height: 14px; }
  .product-card { grid-template-columns: 85px minmax(0, 1fr) 40px; }
  .product-photo-button { height: 72px; min-height: 72px; }
  .quantity-controls { gap: 5px; }
  .quantity-controls button { width: 42px; height: 44px; min-height: 44px; }
  #cart li { column-gap: 6px; }
  .quantity-controls .quantity-count { min-width: 18px; }
  #confirm-sale .confirm-actions { grid-template-columns: 1fr; }
}
@media (max-height: 620px) and (min-width: 901px) {
  .top-inner { min-height: 74px; }
  .brand img { height: 54px; }
  .context-picker { min-height: 54px; }
  .header-actions > .head-button, .header-actions > .network > summary { height: 50px; min-height: 50px; }
  .layout { padding-block: 10px 18px; }
}
@media (prefers-reduced-motion: reduce) {
  .payment-required-note { animation: none; }
  .product-card, .order-toggle-chevron { transition: none; }
}
dialog:not([open]) { display: none; }
.product-glyph { width: 36px; height: 36px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.context-picker { position: relative; }
.context-picker-copy strong { min-width: 0; overflow: hidden; color: #2b1b0d; font-size: .96rem; line-height: 1.15; text-overflow: ellipsis; white-space: nowrap; }
.context-picker-copy small { overflow: hidden; color: #604321; font-size: .66rem; line-height: 1.1; text-overflow: ellipsis; white-space: nowrap; }
.context-chevron { flex: 0 0 auto; color: #2b1b0d; font-size: 1.45rem; font-weight: 700; line-height: 1; transform: translateY(-2px); }
#catalog-select { position: absolute; z-index: 3; inset: 0; width: 100%; height: 100%; min-height: 0; max-width: none; padding: 0; border: 0; border-radius: inherit; opacity: 0; cursor: pointer; }
.context-picker:focus-within { outline: 3px solid #573318; outline-offset: 2px; }
@media (max-width: 620px) {
  .context-picker-copy strong { font-size: .82rem; }
  .context-picker-copy small { font-size: .56rem; }
}
.brand { gap: 6px; }
.brand img { height: 55px; }
.brand-label { padding-left: 8px; font-size: .73rem; }
.header-actions > .head-button, .header-actions > .network > summary { font-size: clamp(.68rem, .88vw, .78rem); }
@media (max-width: 620px) {
  .brand img { height: 48px; }
  .brand-label { display: none; }
}
.detail-trigger {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 46px;
  padding: 6px 10px;
  border: 1px solid #e5d8c7;
  border-radius: 11px;
  background: #fbf6ee;
  color: #463123;
  text-align: left;
}
.checkout .detail-trigger { margin-top: 9px; }
.detail-trigger.has-details { border-color: #c4d8c7; background: #f0f5ed; }
.detail-trigger:disabled { opacity: .52; }
.detail-icon { flex: 0 0 auto; }
.detail-trigger-copy { display: grid; gap: 2px; min-width: 0; flex: 1; }
.detail-trigger-copy strong { font-size: .82rem; line-height: 1.16; }
.detail-trigger-copy small {
  overflow: hidden;
  color: #6d5a4c;
  font-size: .72rem;
  font-weight: 560;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.detail-chevron { flex: 0 0 auto; width: 8px; height: 8px; margin-right: 4px; border: solid #785d49; border-width: 0 1.6px 1.6px 0; transform: rotate(-45deg); }
.detail-section .detail-chevron { transform: rotate(45deg); }
.detail-section[open] .detail-chevron { transform: rotate(225deg); }
.detail-section[open] { border: 1px solid #e5d8c7; border-radius: 12px; }
.detail-section[open] .detail-trigger { border: 0; border-bottom: 1px solid #e5d8c7; border-radius: 11px 11px 0 0; }
.detail-section-body { display: grid; gap: 10px; padding: 12px; }

.compact-field { min-width: 0; }
.compact-field label { margin: 0 0 4px; color: #463123; font-size: .82rem; }
.compact-field label span { font-weight: 510; }
dialog .compact-field :is(input, select) {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  margin: 0;
  padding: 7px 10px;
  border: 1px solid #cfc0ad;
  border-radius: 10px;
  background: #fffdfa;
  color: #332219;
}
.compact-field :is(input, select)[aria-invalid='true'] { border-color: #a94438; }
.address-fields-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 9px 8px; }
.address-cep, .address-feedback { grid-column: 1 / -1; }
.address-street { grid-column: span 9; }
.address-number { grid-column: span 3; }
.address-district, .address-city { grid-column: span 5; }
.address-state { grid-column: span 2; }
.cep-search { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 7px; width: min(100%, 300px); }
.cep-search button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-width: 94px; padding: 5px 9px; margin: 0; }
.cep-search button:disabled { opacity: .64; }
.detail-note { color: #6d5a4c; font-size: .78rem; line-height: 1.35; }
.address-feedback[data-kind='success'] { color: #216342; }
.address-feedback[data-kind='warning'] { color: #79511f; }
.address-feedback[data-kind='error'], #sale-details-error, .amount-invalid { color: #a13c32; }
.address-feedback[data-kind='error'], #sale-details-error { font-weight: 650; }

#sale-details { width: min(560px, calc(100% - 28px)); }
#sale-details-form { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.sale-detail-body { display: grid; align-content: start; gap: 12px; }
.sale-address-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  margin: 0;
  padding: 8px 11px;
  border: 1px solid #e5d8c7;
  border-radius: 11px;
  background: #fbf6ee;
  cursor: pointer;
}
.sale-address-toggle strong { display: block; color: #463123; }
.sale-address-toggle small { display: block; margin-top: 2px; color: #6d5a4c; font-size: .75rem; font-weight: 550; }
label.sale-address-toggle input, label.remember-address input { flex: 0 0 auto; width: 20px; min-height: 20px; height: 20px; margin: 0; accent-color: #266043; }
#sale-address-content { display: grid; gap: 9px; }
.delivery-address-preview { padding: 9px 11px; border: 1px solid #d3e2d3; border-radius: 10px; background: #f0f5ed; color: #2b513c; font-size: .86rem; line-height: 1.4; overflow-wrap: anywhere; }
.remember-address { display: flex; align-items: center; gap: 9px; min-height: 44px; margin: 0; color: #463123; font-weight: 620; cursor: pointer; }
.sale-adjustments { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding-top: 11px; border-top: 1px solid #eee5d9; }
.sale-detail-total { margin-right: auto; font-size: .79rem; font-weight: 700; color: #6d5a4c; }
.sale-detail-total output { display: block; color: #332219; white-space: nowrap; font-size: 1.11rem; font-weight: 850; }
.sale-detail-total output.amount-invalid { color: #a13c32; }
.sale-detail-footer button { padding-inline: 10px; }
.sale-detail-footer .primary { width: auto; margin: 0; }
.sale-delivery-row dd { min-width: 0; overflow-wrap: anywhere; }
.sale-extra-preview { display: block; margin-top: 5px; color: #6d5a4c; font-size: .75rem; overflow-wrap: anywhere; }
.order-totals .extra-amount { margin: 4px 0 0; }
#sale-adjustment-warning { margin-top: 7px; }

@media (max-width: 420px) {
  .address-fields-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .address-street, .address-city { grid-column: span 4; }
  .address-number, .address-state { grid-column: span 2; }
  .address-district { grid-column: 1 / -1; }
  .sale-detail-footer { flex-wrap: wrap; }
  .sale-detail-footer button { flex: 1 0 auto; }
}

/* Two checkout steps share the same page scroll. */
.checkout.checkout-steps { display: grid; align-content: start; gap: 9px; padding: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; container-type: inline-size; }
.checkout-steps .checkout-step { min-width: 0; padding: 10px 12px; border: 1px solid #e5dacc; border-radius: 19px; background: #fffdf9; box-shadow: 0 8px 24px #482b1510; }
.checkout-steps #order-step-title { margin: 0; border-bottom: 1px solid #eee5d9; }
.checkout-step-label { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }
.checkout-step-label #item-count { font-size: .66rem; letter-spacing: 0; }
.checkout-steps .total { margin: 0; padding: 3px 0 0; }
.checkout-steps #payment-title { margin: 0 0 4px; }
.checkout-step-toggle { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; min-height: 44px; padding: 0 4px 0 0; border: 0; background: transparent; color: inherit; font: inherit; text-align: left; }
#payment-toggle:disabled .order-toggle-chevron { visibility: hidden; }
.checkout-step-toggle[aria-expanded='true'] .order-toggle-chevron { transform: rotate(225deg); }
.checkout-steps .payments { gap: 5px; margin: 0; }
.checkout-steps .payments button { min-height: 51px; }
#payment-expanded { padding-top: 8px; }
.checkout-steps .buyer { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
.checkout-buyer-field { min-width: 0; }
.checkout-steps .buyer label { margin: 0 0 3px; font-size: .76rem; }
.checkout-steps .buyer input { min-height: 44px; }
.checkout-steps .phone-hint { grid-column: 1 / -1; }
.checkout-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-top: 8px; }
.checkout-actions button { min-height: 44px; margin: 0; font-size: .81rem; }
.checkout-steps #clear-before-payment { width: auto; margin: 5px 0 0 auto; padding-inline: 9px; }
@container (max-width: 310px) {
  .checkout-steps .buyer { grid-template-columns: minmax(0, 1fr); }
}

.address-segments { display: flex; gap: 0; padding: 3px; border-radius: 11px; background: #efe6d8; }
.address-segments button { flex: 1 1 0; min-width: 0; border: 0; border-radius: 8px; padding: 5px 8px; background: transparent; color: #5f4836; font-size: .83rem; }
.address-segments button[aria-pressed='true'] { background: #fffdfa; color: #234f38; box-shadow: 0 1px 4px #58371e22; }
:is(.address-cep,.address-number,.address-priority) > label { color: #392518; font-weight: 820; font-size: .91rem; }
:is(.address-cep,.address-number,.address-priority) input[data-address-field], #delivery-complement { border-color: #b58e63; background: #fff8ea; font-weight: 650; }
.address-street { grid-column: span 7; }
.address-number { grid-column: span 5; }
.address-number-controls { display: flex; align-items: center; gap: 6px; }
.address-number-controls input:disabled { opacity: .55; }
.address-number-controls .without-number { display: flex; align-items: center; gap: 5px; min-height: 44px; flex: 0 0 auto; cursor: pointer; margin: 0; font-weight: 750; }
dialog .without-number input { width: 18px; height: 18px; min-height: 18px; accent-color: #266043; }
.sale-adjustments input { text-align: right; font-variant-numeric: tabular-nums; }
@media (max-width: 480px) {
  .address-street, .address-number { grid-column: 1 / -1; }
}

/* The catalog dialogs use the product rows and warm panels of the first prototype. */
:is(#event-editor, #stock-dialog) { background: linear-gradient(145deg, #fffdf9, #faf4ea); box-shadow: 0 28px 80px #1e110957; }
:is(#event-editor, #stock-dialog) .dialog-head h2 { font: 700 clamp(1.25rem, 2.2vw, 1.58rem)/1.15 Georgia, serif; }
:is(#event-editor, #stock-dialog) :is(.dialog-head, .dialog-footer) { background: #fffdfa; }
:is(#event-editor, #stock-dialog) .dialog-body { scrollbar-width: thin; scrollbar-color: #cbbba5 transparent; }
.editor-products-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin: 12px 0 7px; }
#event-editor .editor-products-head h3 { margin: 0; }
.editor-count, .stock-pill { border-radius: 8px; padding: 5px 8px; color: #126542; background: #e7f2e7; font-size: .73rem; font-weight: 770; }
#event-editor #event-items, #stock-dialog #stock-list { border: 1px solid #e9dfd1; border-radius: 13px; padding: 0; background: #fffdf9; overflow: visible; }
#event-editor .setup-row, #stock-dialog .stock-row { gap: 9px; padding: 6px 10px; }
#event-editor .setup-row:last-child, #stock-dialog .stock-row:last-child { border-bottom: 0; }
#event-editor .setup-row:has(> label:first-child input:checked) { background: #f2f7ee; }
#event-editor .setup-row:first-child, #stock-dialog .stock-row:first-child { border-radius: 12px 12px 0 0; }
#event-editor .setup-row:last-child, #stock-dialog .stock-row:last-child { border-radius: 0 0 12px 12px; }
#event-editor .setup-list.has-promotion .setup-row { grid-template-columns: minmax(0,1fr) auto auto; }
.editor-thumb { flex: 0 0 auto; width: 38px; height: 38px; object-fit: cover; border-radius: 8px; }
.editor-product-name { display: grid; gap: 2px; min-width: 0; overflow-wrap: anywhere; }
.editor-product-name strong { color: #4a3321; font-size: .84rem; }
.editor-product-name small { color: #735d4a; font-size: .74rem; }
#event-editor .editor-price { color: #725a42; }
#event-editor .editor-price input { width: 78px; min-height: 44px; padding-inline: 7px; text-align: right; font-variant-numeric: tabular-nums; }
#event-editor #event-promotion-title { border-top: 1px solid #e5d8c7; padding-top: 12px; }
.stock-summary { display: flex; gap: 8px; margin-bottom: 10px; }
.stock-summary span { padding: 7px 9px; color: #126542; background: #e7f2e7; border-radius: 8px; font-size: .8rem; font-weight: 750; }
.stock-summary span:last-child,.stock-out .stock-pill { color: #9c3d32; background: #fae8e3; }
#stock-dialog .stock-row { grid-template-columns: auto minmax(0,1fr) auto auto; }
.stock-actions .stock-toggle { display: inline-flex; gap: 5px; align-items: center; background: #fff2ed; color: #9c3d32; border-color: #e9c5bb; }
.stock-out .stock-actions .stock-toggle { background: #eaf4e9; color: #126542; border-color: #ccddc8; }
@media (max-width: 530px) {
  #stock-dialog .stock-row { grid-template-columns: auto minmax(0,1fr) auto; }
  #stock-dialog .stock-actions { grid-column: 2 / -1; }
}
.editor-event-fields { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 180px); gap: 9px; margin-bottom: 10px; }
.editor-event-fields:has(#event-date-field[hidden]) { grid-template-columns: minmax(0,1fr); }
.catalog-context-note { margin-bottom: 11px; padding: 9px 11px; border: 1px solid #efe2c5; border-radius: 10px; background: #fff8e9; color: #725a42; font-size: .83rem; }
.editor-promotion { margin-block: 12px; padding: 10px 12px; border: 1px solid #e5d8c7; border-radius: 12px; background: #faf4ea; }
#event-editor .editor-promotion #event-promotion-title { margin: 0 0 9px; padding-top: 0; border: 0; }
@media (max-width: 420px) {
  .editor-event-fields { grid-template-columns: 1fr; }
}

@media (min-width: 901px) and (max-width: 1040px) {
  @container (min-width: 440px) {
    .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .product-card { min-height: 89px; grid-template-columns: clamp(67px, 16cqi, 78px) minmax(0, 1fr) 44px; padding: 6px; }
    .product-photo-button { height: 74px; min-height: 74px; }
    .add-button { width: 44px; }
  }
}

.quantity-controls button:disabled { opacity: .5; }
.cancel-confirmation .dialog-body p { margin: 0; font-size: .92rem; line-height: 1.45; }
.cancel-confirmation .dialog-body .cancel-order-detail { margin-bottom: 6px; font-weight: 750; }
.cancel-confirmation .dialog-footer .danger { width: auto; background: #fff0ec; border-color: #e3b6ae; color: #9a3428; }
.confirm-footer-total { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 0 0 4px; color: #634a36; font-weight: 700; }
.confirm-footer-total strong { color: #351e12; font-size: 1.3rem; white-space: nowrap; }
.sales-filters button { min-height: 44px; }
.sales-search:focus-within { outline: 2px solid #9a521f; outline-offset: 2px; }
