:root {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #16181d;
  background: #f6f7f9;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f1f3f5;
  --text: #16181d;
  --muted: #626976;
  --border: #e5e7eb;
  --accent: #111827;
  --success: #168a52;
  --danger: #d04444;
  --shadow: 0 8px 24px rgba(17, 24, 39, 0.06);
  --motion-fast: 180ms;
  --motion: 240ms;
  --motion-slow: 420ms;
  --ease: cubic-bezier(.22, .8, .3, 1);
}

* { box-sizing: border-box; }
html, body, #root { min-width: 320px; min-height: 100%; margin: 0; }
body { min-height: 100vh; background: var(--bg); overflow: hidden; }
button, input, textarea { font: inherit; }
button { border: 0; color: inherit; cursor: pointer; }
button:focus-visible, input:focus-visible, textarea:focus-visible { outline: 3px solid rgba(17, 24, 39, .16); outline-offset: 2px; }
button:disabled { cursor: not-allowed; }

.auth-gate { position: fixed; inset: 0; z-index: 120; display: grid; place-items: center; min-height: 100dvh; padding: 18px; background: var(--accent); color: white; transform: translate3d(0, 0, 0); backface-visibility: hidden; will-change: transform; }
.auth-gate.unlocking { animation: authGateLift 680ms cubic-bezier(.30, 0, .19, 1) forwards; pointer-events: none; }
.auth-gate.entering { animation: authGateDrop 680ms cubic-bezier(.30, 0, .19, 1) forwards; }
@keyframes authGateLift { to { transform: translate3d(0, -105%, 0); } }
@keyframes authGateDrop { from { transform: translate3d(0, -105%, 0); } to { transform: translate3d(0, 0, 0); } }
.auth-panel { width: min(390px, 100%); display: grid; gap: 22px; }
.auth-brand { display: flex; align-items: center; gap: 12px; }
.auth-brand .brand-mark { background: white; color: var(--accent); }
.auth-brand h2 { margin: 0; font-size: 22px; }
.auth-brand p { margin: 4px 0 0; color: rgba(255, 255, 255, .72); font-size: 13px; }
.pin-display { min-height: 70px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; align-items: center; padding: 14px; border-radius: 18px; background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .18); }
.pin-display span { width: 18px; height: 18px; justify-self: center; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .55); }
.pin-display span.filled { background: white; border-color: white; }
.pin-display.error { border-color: rgba(255, 255, 255, .8); box-shadow: 0 0 0 3px rgba(208, 68, 68, .25); }
.auth-error { margin-top: -12px; color: #ffd7d7; font-size: 13px; }
.auth-numpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.auth-numpad button { min-height: 64px; border-radius: 18px; background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .18); color: white; font-size: 24px; font-weight: 850; transition: transform var(--motion-fast), background var(--motion-fast); touch-action: manipulation; }
.auth-numpad button:active { transform: scale(.97); background: rgba(255, 255, 255, .18); }
.auth-numpad button:disabled { opacity: .55; }
.auth-numpad .auth-action { font-size: 14px; }

.app-shell { height: 100vh; height: 100dvh; overflow: hidden; }
.brand-mark { width: 42px; height: 42px; border-radius: 14px; background: var(--accent); color: white; display: grid; place-items: center; font-weight: 900; }
.role-pill { min-height: 44px; display: inline-flex; align-items: center; padding: 0 12px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); color: var(--muted); font-size: 12px; font-weight: 850; white-space: nowrap; }
.role-action { transition: background var(--motion-fast), color var(--motion-fast), border-color var(--motion-fast), transform var(--motion-fast); }
.role-action:hover { background: white; border-color: #ccd1d9; color: var(--text); }
.role-action:active { transform: translateY(1px); }
.menu-wrap { position: relative; }
.menu-button { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 14px; background: var(--accent); color: white; }
.menu-button.active { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.top-menu { position: absolute; top: calc(100% + 10px); right: 0; z-index: 80; width: 190px; padding: 7px; border-radius: 16px; background: white; border: 1px solid var(--border); box-shadow: 0 18px 48px rgba(17, 24, 39, .18); }
.top-menu button { width: 100%; min-height: 44px; display: flex; align-items: center; padding: 0 12px; border-radius: 11px; background: transparent; color: var(--text); text-align: left; font-weight: 800; }
.top-menu button:hover, .top-menu button.active { background: var(--surface-2); }
.ui-icon { width: 18px; height: 18px; display: block; flex: 0 0 auto; }

.workspace { height: 100%; display: grid; grid-template-columns: minmax(0, 1fr) 390px; gap: 18px; padding: 18px; overflow: hidden; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: 28px; box-shadow: var(--shadow); overflow: hidden; }
.catalog { display: grid; grid-template-rows: auto auto 1fr; min-width: 0; }
.catalog-head { padding: 18px 20px 10px; }
.catalog-toolbar { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; }
.search-box { min-height: 52px; display: flex; align-items: center; gap: 10px; padding: 0 15px; border-radius: 16px; background: var(--surface-2); border: 1px solid var(--border); color: var(--muted); }
.search-box input { width: 100%; border: 0; outline: 0; background: transparent; color: var(--text); }
.add-product-btn { min-width: 126px; padding: 0 16px; }
.category-row { display: flex; gap: 10px; padding: 8px 20px 16px; overflow-x: auto; scrollbar-width: none; }
.category-row::-webkit-scrollbar { display: none; }
.category-row button { min-height: 44px; display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; padding: 0 15px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border); color: var(--muted); transition: var(--motion-fast); }
.category-row button.active { background: var(--accent); border-color: var(--accent); color: white; }
.product-grid { overflow: auto; padding: 0 20px 20px; display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; align-content: start; }
.product-card { min-height: 224px; display: flex; flex-direction: column; text-align: left; padding: 12px; border-radius: 20px; background: white; border: 1px solid var(--border); transition: transform var(--motion) var(--ease), box-shadow var(--motion) var(--ease); }
.product-card:hover, .product-card:active { transform: translateY(-2px); box-shadow: var(--shadow); }
.product-image { height: 135px; display: grid; place-items: center; margin-bottom: 12px; border-radius: 16px; background: linear-gradient(145deg, #f6f7f9, #eceff3); font-size: 54px; }
.product-card h3 { margin: 0 0 5px; font-size: 15px; }
.product-card p { min-height: 32px; margin: 0 0 12px; color: var(--muted); font-size: 12px; line-height: 1.35; }
.product-card footer { display: flex; align-items: center; justify-content: space-between; margin-top: auto; }
.product-card footer strong { font-size: 14px; }
.product-card footer span:not(.add-button) { max-width: 95px; overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; font-size: 12px; font-weight: 750; }
.add-button { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 12px; background: var(--accent); color: white; }
.add-button .ui-icon { width: 17px; height: 17px; }
.manage-product-card { cursor: default; }
.manage-product-card:hover, .manage-product-card:active { transform: none; }
.product-manage-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.product-manage-actions button { min-height: 44px; border-radius: 13px; }
.product-empty { grid-column: 1 / -1; min-height: 360px; }

.backoffice-view { min-height: 0; overflow: auto; padding: 22px; }
.backoffice-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.backoffice-head h2 { margin: 0; font-size: 24px; }
.backoffice-head p { max-width: 360px; margin: 0; color: var(--muted); font-size: 13px; line-height: 1.45; text-align: right; }
.metric-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.metric-card { min-width: 0; padding: 18px; border-radius: 16px; background: var(--surface-2); border: 1px solid var(--border); }
.metric-card span { display: block; margin-bottom: 12px; color: var(--muted); font-size: 12px; font-weight: 800; }
.metric-card strong { display: block; overflow-wrap: anywhere; font-size: 26px; line-height: 1.05; }
.payment-split { margin-top: 16px; padding: 16px; border-radius: 16px; background: white; border: 1px solid var(--border); }
.payment-split h3 { margin: 0 0 8px; font-size: 16px; }
.split-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 11px 0; border-top: 1px solid var(--border); }
.split-row:first-of-type { border-top: 0; }
.split-row span { color: var(--muted); font-size: 13px; font-weight: 750; }
.history-list { display: grid; gap: 8px; }
.history-row { width: 100%; min-height: 68px; display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, .9fr) auto; gap: 14px; align-items: center; padding: 12px 14px; border-radius: 16px; background: var(--surface-2); border: 1px solid var(--border); text-align: left; transition: background var(--motion-fast), transform var(--motion-fast); }
.history-row:hover { background: #e9edf2; }
.history-row:active { transform: scale(.997); }
.history-row span { min-width: 0; }
.history-row strong, .history-row small { display: block; }
.history-row small { margin-top: 4px; color: var(--muted); font-size: 11px; line-height: 1.35; }
.history-row > strong { white-space: nowrap; font-size: 15px; }
.backoffice-empty { min-height: 430px; }

.order-panel { display: grid; grid-template-rows: auto auto 1fr auto; min-height: 0; container-type: inline-size; }
.order-head { padding: 18px; border-bottom: 1px solid var(--border); }
.order-title { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.order-title-copy { min-width: 0; }
.order-title h2 { margin: 0; font-size: 20px; }
.order-title-copy span { display: block; margin-top: 3px; color: var(--muted); font-size: 13px; }
.order-utility { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.order-type-control { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; padding: 4px; border-radius: 14px; background: var(--surface-2); }
.order-type-control button { min-height: 40px; border-radius: 11px; background: transparent; color: var(--muted); }
.order-type-control button.active { background: white; color: var(--text); box-shadow: 0 2px 8px rgba(0, 0, 0, .05); }
.detail-field { width: 100%; min-height: 46px; margin-top: 10px; padding: 0 12px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface-2); outline: 0; }
.quick-tools { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 12px 18px; border-bottom: 1px solid var(--border); }
.tool-button { min-width: 0; min-height: 46px; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 0 12px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border); }
.tool-button strong { font-size: 14px; }
.cart-list { min-height: 0; overflow: auto; padding: 10px 18px; }
.empty-state { height: 100%; display: grid; place-content: center; justify-items: center; padding: 34px; text-align: center; color: var(--muted); }
.empty-state .empty-icon { width: 74px; height: 74px; display: grid; place-items: center; margin-bottom: 14px; border-radius: 22px; background: var(--surface-2); border: 1px solid var(--border); font-size: 34px; }
.empty-state strong { margin-bottom: 6px; color: var(--text); font-size: 16px; }
.empty-state p { max-width: 230px; margin: 0; font-size: 13px; line-height: 1.5; }
.cart-item { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; gap: 12px; align-items: center; margin: 2px 0; padding: 12px 6px 12px 8px; border-bottom: 1px solid var(--border); border-radius: 14px; cursor: pointer; transition: background var(--motion-fast), transform var(--motion-fast); }
.cart-item:hover { background: var(--surface-2); }
.cart-item:active { transform: scale(.995); }
.cart-item.active { background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--accent); }
.cart-thumb { width: 52px; height: 52px; display: grid; place-items: center; border-radius: 15px; background: var(--surface-2); font-size: 26px; }
.cart-copy { min-width: 0; }
.cart-copy strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.cart-copy span { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; line-height: 1.35; }
.qty-control { display: flex; align-items: center; gap: 8px; }
.qty-control button { width: 44px; height: 44px; display: grid; place-items: center; padding: 0; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); }
.qty-control .ui-icon { width: 15px; height: 15px; }
.qty-control strong { min-width: 20px; text-align: center; }
@container (max-width: 330px) {
  .cart-item { grid-template-columns: 44px minmax(0, 1fr); gap: 8px 10px; }
  .cart-thumb { width: 44px; height: 44px; font-size: 22px; }
  .qty-control { grid-column: 2; justify-self: start; }
}
.order-summary { padding: 16px 18px 18px; border-top: 1px solid var(--border); background: white; }
.summary-row { display: flex; justify-content: space-between; margin: 7px 0; font-size: 13px; }
.summary-row.muted { color: var(--muted); }
.summary-rule { height: 1px; margin: 13px 0 10px; background: var(--border); }
.summary-total { display: flex; align-items: flex-end; justify-content: space-between; }
.summary-total span { color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.summary-total strong { font-size: 28px; line-height: 1; }
.payment-actions { min-height: 56px; margin-top: 12px; overflow: hidden; container-type: inline-size; }
.proceed-button { width: 100%; min-height: 56px; border-radius: 16px; background: var(--accent); color: white; font-size: 16px; font-weight: 850; transition: opacity var(--motion), transform var(--motion), max-height var(--motion); }
.proceed-button:disabled { opacity: .35; }
.proceed-button.hidden { min-height: 0; max-height: 0; opacity: 0; transform: translateY(10px) scale(.98); pointer-events: none; }
.payment-options { display: grid; grid-template-columns: 40px repeat(3, minmax(0, 1fr)); gap: 7px; max-height: 0; opacity: 0; transform: translateY(10px); pointer-events: none; transition: opacity var(--motion), transform var(--motion), max-height var(--motion); }
.payment-options.show { max-height: 58px; opacity: 1; transform: none; pointer-events: auto; }
.payment-back, .payment-option { min-width: 0; min-height: 48px; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 0 10px; border-radius: 13px; background: var(--surface-2); border: 1px solid var(--border); font-weight: 750; overflow: hidden; }
.payment-back { padding: 0; }
.payment-option-icon { display: none; }
.payment-option span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@container (max-width: 310px) {
  .payment-option { padding: 0; }
  .payment-option span { display: none; }
  .payment-option-icon { display: block; width: 20px; height: 20px; }
}

.context-overlay { position: fixed; inset: 0; z-index: 49; width: 100%; height: 100%; padding: 0; background: rgba(255, 255, 255, .05); backdrop-filter: blur(2px); }
.anchored-surface { position: fixed; z-index: 50; padding: 16px; border-radius: 22px; background: white; border: 1px solid var(--border); box-shadow: 0 24px 70px rgba(17, 24, 39, .22); opacity: 0; transform: translateY(-8px) scale(.97); transform-origin: 50% 0; transition: opacity var(--motion), transform var(--motion) var(--ease); }
.anchored-surface.ready { opacity: 1; transform: none; }
.anchored-surface.above { transform-origin: 50% 100%; }
.popover-arrow { position: absolute; top: -9px; left: var(--arrow-left); width: 18px; height: 18px; background: white; border-left: 1px solid var(--border); border-top: 1px solid var(--border); transform: translateX(-50%) rotate(45deg); }
.anchored-surface.above .popover-arrow { top: auto; bottom: -9px; border-left: 0; border-top: 0; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.popover-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.popover-head small { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; line-height: 1.4; }
.popover-head strong { display: block; font-size: 26px; line-height: 1.1; }
.popover-head.compact strong { font-size: 17px; }
.icon-square { width: 44px; height: 44px; display: grid; place-items: center; flex: 0 0 auto; padding: 0; border-radius: 12px; background: var(--surface-2); }
.popover-actions, .modal-actions { display: grid; grid-template-columns: 1fr 1.2fr; gap: 9px; margin-top: 14px; }
.primary-btn, .secondary-btn, .danger-btn, .danger-soft-btn { min-height: 46px; border-radius: 14px; font-weight: 850; }
.primary-btn { background: var(--accent); color: white; }
.primary-btn:disabled { opacity: .4; }
.secondary-btn { background: var(--surface-2); }
.danger-btn { background: var(--danger); color: white; }
.danger-soft-btn { background: #fff0f0; color: var(--danger); }
.confirm-surface { z-index: 54; }
.confirm-surface + .context-overlay { z-index: 53; }

.item-editor-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.item-title { min-width: 0; display: flex; align-items: center; gap: 10px; }
.item-title > span { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 13px; background: var(--surface-2); font-size: 24px; }
.item-title strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.item-fields label { min-width: 0; }
.item-fields label > span, .payment-field > span { display: block; margin: 0 0 6px 2px; color: var(--muted); font-size: 11px; }
.item-fields input { width: 100%; min-height: 48px; padding: 0 12px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface-2); outline: 0; font-size: 18px; font-weight: 800; cursor: pointer; }
.item-fields .wide-field { grid-column: 1 / -1; }
.item-actions { display: grid; grid-template-columns: 1fr 1.25fr; gap: 8px; margin-top: 14px; }
.inline-error { margin-top: 9px; color: var(--danger); font-size: 11px; }
.inline-error.visible { display: block; }

.numeric-overlay { z-index: 69; }
.numeric-popover { z-index: 70; }
.numeric-popover .popover-head strong { max-width: 245px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 28px; }
.quick-cash-block { margin-bottom: 12px; }
.quick-cash-block > span { display: block; margin: 0 0 7px 2px; color: var(--muted); font-size: 11px; }
.quick-cash-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.quick-cash-grid button { min-width: 0; min-height: 44px; padding: 0 7px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: clamp(10px, 1.5vw, 13px); font-weight: 800; }
.quick-cash-grid button.selected { background: var(--accent); border-color: var(--accent); color: white; }
.numeric-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.numeric-grid button { min-height: 48px; border-radius: 13px; background: var(--surface-2); border: 1px solid var(--border); font-size: 18px; font-weight: 850; }
.numeric-grid button:active { transform: scale(.97); }
.numeric-grid .wide-key { grid-column: span 3; }

.modal-backdrop { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; padding: 18px; background: rgba(17, 24, 39, .32); }
.payment-modal, .receipt-modal, .pin-modal, .product-editor-modal, .delete-product-modal, .logout-modal { width: min(560px, 100%); max-height: calc(100vh - 36px); overflow: auto; padding: 22px; border-radius: 28px; background: white; box-shadow: 0 24px 80px rgba(17, 24, 39, .22); }
.pin-modal, .delete-product-modal, .logout-modal { width: min(390px, 100%); }
.pin-modal-head, .product-modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.pin-modal-head h2, .product-modal-head h2 { margin: 0 0 6px; }
.pin-modal-head p, .product-modal-head p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.45; }
.manager-pin { background: var(--surface-2); border-color: var(--border); }
.manager-pin span { border-color: #b7bdc7; }
.manager-pin span.filled { background: var(--accent); border-color: var(--accent); }
.modal-numpad { margin-top: 14px; }
.modal-numpad button { background: var(--surface-2); border-color: var(--border); color: var(--text); }
.modal-numpad button:active { background: #e8ebef; }
.product-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.product-form-grid label { min-width: 0; }
.product-form-grid label > span { display: block; margin: 0 0 6px 2px; color: var(--muted); font-size: 11px; }
.product-form-grid input, .product-form-grid textarea { width: 100%; min-height: 48px; padding: 0 12px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); outline: 0; font-weight: 750; }
.product-form-grid textarea { min-height: 92px; padding-top: 12px; resize: vertical; line-height: 1.4; }
.product-form-grid .wide-field { grid-column: 1 / -1; }
.payment-modal header h2 { margin: 0 0 6px; }
.payment-modal header p { margin: 0 0 16px; color: var(--muted); font-size: 13px; }
.payment-total-layout { display: grid; grid-template-columns: minmax(0, 1fr) 46px; gap: 8px; }
.payment-total-layout.single { grid-template-columns: 1fr; }
.payment-total-card, .noncash-card { display: flex; align-items: center; justify-content: space-between; min-width: 0; padding: 14px 16px; border-radius: 16px; background: var(--surface-2); border: 1px solid var(--border); }
.payment-total-card > span, .noncash-card > span { color: var(--muted); font-size: 13px; }
.payment-total-values { display: flex; flex-direction: column; align-items: flex-end; overflow: hidden; }
.payment-total-values strong { font-size: 22px; animation: totalIn var(--motion) var(--ease); }
.payment-total-values strong.round-old-up { animation: roundOldUp var(--motion) var(--ease) forwards; }
.payment-total-values strong.round-new-up { animation: roundNewUp var(--motion) var(--ease); }
.payment-total-values strong.round-old-down { animation: roundOldDown var(--motion) var(--ease) forwards; }
.payment-total-values strong.round-new-down { animation: roundNewDown var(--motion) var(--ease); }
.payment-total-values small { margin-top: 2px; color: var(--muted); font-size: 10px; }
@keyframes totalIn { from { opacity: .3; transform: translateY(8px); } }
@keyframes roundOldUp { to { opacity: .25; color: var(--muted); transform: translateY(18px); } }
@keyframes roundNewUp { from { opacity: .25; color: var(--muted); transform: translateY(-18px); } to { opacity: 1; transform: none; } }
@keyframes roundOldDown { to { opacity: .25; color: var(--muted); transform: translateY(-18px); } }
@keyframes roundNewDown { from { opacity: .25; color: var(--muted); transform: translateY(18px); } to { opacity: 1; transform: none; } }
.round-button { width: 46px; min-height: 58px; display: grid; place-items: center; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border); }
.payment-field { display: block; margin-top: 14px; }
.payment-field input { width: 100%; padding: 14px; border-radius: 16px; border: 1px solid var(--border); background: white; outline: 0; font-size: 28px; font-weight: 900; cursor: pointer; }
.payment-field input.error { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(208, 68, 68, .1); }
.shake { animation: shake .28s ease; }
@keyframes shake { 0%, 100% { transform: none; } 25% { transform: translateX(-5px); } 50% { transform: translateX(5px); } 75% { transform: translateX(-3px); } }
.change-row { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; font-size: 17px; font-weight: 850; }
.noncash-card { display: block; text-align: center; margin-top: 14px; }
.noncash-card strong { display: block; margin: 8px 0; font-size: 30px; }
.noncash-card p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }

.receipt-modal { overflow: visible; text-align: center; }
.success-stage { padding: 22px 6px; animation: successIn var(--motion-slow) var(--ease); }
.success-check { width: 70px; height: 70px; display: grid; place-items: center; margin: 0 auto 14px; border-radius: 50%; background: #eaf7f0; color: var(--success); font-size: 34px; }
.success-stage h2 { margin: 0; }
.success-stage > strong { display: block; margin: 8px 0 4px; font-size: 30px; }
.success-stage p { margin: 0; color: var(--muted); }
@keyframes successIn { from { opacity: 0; transform: translateY(10px) scale(.98); } }
.receipt-stage { animation: receiptIn var(--motion-slow) var(--ease); }
@keyframes receiptIn { from { opacity: 0; transform: translateY(12px); } }
.thermal-receipt { position: relative; margin: 2px 0 18px; padding: 24px 20px; border: 1px solid #ece8dd; border-radius: 8px; background: #fffef9; box-shadow: 0 12px 30px rgba(17, 24, 39, .08); text-align: left; font-family: "Courier New", monospace; }
.thermal-receipt::before, .thermal-receipt::after { content: ""; position: absolute; left: 0; right: 0; height: 8px; background: radial-gradient(circle at 4px 0, transparent 4px, #fffef9 4.5px) repeat-x; background-size: 12px 8px; }
.thermal-receipt::before { top: -7px; transform: rotate(180deg); }
.thermal-receipt::after { bottom: -7px; }
.thermal-receipt header { text-align: center; }
.thermal-receipt header strong { display: block; font-size: 18px; letter-spacing: .08em; }
.thermal-receipt header small, .thermal-receipt footer { color: #777; font-size: 11px; }
.thermal-receipt hr { margin: 12px 0; border: 0; border-top: 1px dashed #aaa; }
.receipt-row, .receipt-item { display: flex; justify-content: space-between; gap: 12px; margin: 6px 0; font-size: 12px; }
.receipt-item { margin: 8px 0; font-size: 13px; }
.receipt-item span { text-align: left; }
.receipt-item small { display: block; color: #777; }
.receipt-row.total { margin-top: 9px; font-size: 17px; }
.thermal-receipt footer { text-align: center; line-height: 1.45; }

.toast { position: fixed; z-index: 100; left: 50%; bottom: 24px; padding: 12px 18px; border-radius: 14px; background: var(--accent); color: white; opacity: 0; transform: translate(-50%, 20px); pointer-events: none; transition: var(--motion); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 1100px) {
  .workspace { grid-template-columns: minmax(0, 1fr) clamp(290px, 40vw, 380px); gap: 12px; padding: 12px; }
  .product-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
  .metric-grid { grid-template-columns: 1fr; }
  .order-head { padding: 14px; }
  .order-title h2 { font-size: 18px; white-space: nowrap; }
  .role-pill { padding: 0 10px; }
}

@media (max-width: 700px) {
  body { overflow: auto; }
  .app-shell { height: auto; min-height: 100vh; min-height: 100dvh; overflow: visible; }
  .workspace { grid-template-columns: 1fr; padding: 10px; overflow: visible; }
  .catalog { height: min(680px, calc(100vh - 20px)); height: min(680px, calc(100dvh - 20px)); min-height: 520px; }
  .product-grid { min-height: 0; }
  .backoffice-view { padding: 18px; }
  .backoffice-head { display: block; }
  .backoffice-head p { max-width: none; margin-top: 6px; text-align: left; }
  .history-row { grid-template-columns: 1fr auto; }
  .history-row span:nth-child(2) { display: none; }
  .order-panel { min-height: 680px; }
}

@media (pointer: coarse) {
  .order-type-control button { min-height: 44px; }
}

@media (max-width: 520px) {
  .auth-panel { gap: 18px; }
  .auth-numpad button { min-height: 58px; border-radius: 16px; }
  .catalog-toolbar { grid-template-columns: 1fr; }
  .add-product-btn { width: 100%; }
  .quick-cash-grid { grid-template-columns: repeat(2, 1fr); }
  .item-fields, .product-form-grid { grid-template-columns: 1fr; }
  .item-fields .wide-field, .product-form-grid .wide-field { grid-column: auto; }
}

@media (max-height: 700px) {
  .auth-gate { align-items: start; overflow: auto; }
  .auth-panel { margin: 8px 0; gap: 14px; }
  .auth-numpad button { min-height: 48px; }
  .anchored-surface { padding: 12px; border-radius: 19px; }
  .numeric-grid { gap: 6px; }
  .numeric-grid button { min-height: 40px; }
  .payment-modal { padding: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  .auth-gate.unlocking, .auth-gate.entering { animation-duration: 1ms; }
  .auth-gate.unlocking, .auth-gate.entering { transform: none; }
}

@media print {
  @page {
    size: 58mm auto;
    margin: 0;
  }

  html,
  body {
    width: 58mm;
    margin: 0;
    padding: 0;
    background: #fff;
  }

  body * {
    visibility: hidden;
  }

  .thermal-receipt,
  .thermal-receipt * {
    visibility: visible;
  }

  .thermal-receipt {
    position: absolute;
    inset: 0 auto auto 0;
    width: 58mm;
    max-width: 58mm;
    box-sizing: border-box;
    padding: 6mm 4mm;
    margin: 0;
    box-shadow: none;
    border: 0;
    border-radius: 0;
    background: #fff;
    color: #000;
  }

  .thermal-receipt::before,
  .thermal-receipt::after {
    display: none;
  }

  .thermal-receipt header strong {
    font-size: 15px;
  }

  .thermal-receipt header small,
  .thermal-receipt footer {
    color: #444;
    font-size: 10px;
  }

  .receipt-row,
  .receipt-item {
    font-size: 11px;
    gap: 6px;
  }

  .receipt-item {
    font-size: 11px;
    margin: 6px 0;
  }

  .receipt-row.total {
    font-size: 14px;
    margin-top: 8px;
  }

  .receipt-item small {
    color: #555;
    font-size: 10px;
  }
}
