:root {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #152020;
  background: #f5f8f7;
  font-synthesis: none;
}

* { box-sizing: border-box; }

html { min-width: 320px; background: #f5f8f7; }
body { margin: 0; min-height: 100vh; background: #f5f8f7; color: #152020; }
button, a, input, select { font: inherit; }
button { min-height: 44px; min-width: 44px; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid #005fcc; outline-offset: 3px; }
button:disabled { cursor: not-allowed; opacity: .65; }
.touch-target { min-height: 44px; min-width: 44px; }

.app-shell { width: min(100%, 1120px); margin: 0 auto; padding: 16px 16px 92px; }
.app-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.app-title { margin: 0; font-size: clamp(1.6rem, 5vw, 2.4rem); }
.status-pill { border-radius: 999px; padding: 8px 12px; font-weight: 700; background: #d9f2ed; color: #063f37; }
.status-pill.offline { background: #fff0cf; color: #5a3900; }

.notice, .panel { background: #fff; border: 1px solid #cbd8d5; border-radius: 14px; padding: 16px; box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.notice { margin-bottom: 16px; }
.notice strong { display: block; margin-bottom: 6px; }
.layout { display: grid; gap: 16px; }
.panel h2 { margin-top: 0; }
.product-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; list-style: none; padding: 0; margin: 0; }
.product-card { border: 1px solid #d7e1df; border-radius: 12px; padding: 14px; background: #fbfdfc; }
.product-card strong, .product-card span { display: block; }
.product-card span { margin-top: 5px; color: #425351; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.primary-button { border: 0; border-radius: 10px; padding: 10px 16px; background: #0b5f5f; color: #fff; font-weight: 750; }
.secondary-button { border: 1px solid #0b5f5f; border-radius: 10px; padding: 10px 16px; background: #fff; color: #084c4c; font-weight: 700; }
.muted { color: #425351; }
.install-steps { margin: 8px 0 0; padding-left: 22px; }
.runtime-nav { position: fixed; z-index: 5; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; background: #d4dfdd; border-top: 1px solid #b8c8c5; }
.runtime-nav a { display: flex; min-height: 56px; align-items: center; justify-content: center; background: #fff; color: #0a4f4f; text-decoration: none; font-weight: 700; }

.login-screen { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login-card { width: min(100%, 420px); padding: 28px; border: 1px solid #cbd8d5; border-radius: 20px; background: #fff; box-shadow: 0 12px 32px rgba(17, 48, 45, .08); }
.login-title { margin: 0 0 20px; font-size: clamp(1.7rem, 7vw, 2.3rem); }
.login-form { display: grid; gap: 16px; }
.login-status { margin: 0 0 16px; color: #674600; }
.field-label { display: grid; gap: 7px; font-weight: 700; }
.field-input { width: 100%; min-height: 48px; border: 1px solid #aebfbb; border-radius: 12px; padding: 10px 12px; background: #fff; color: #152020; }

.app-layout { min-height: 100vh; padding: 76px 16px 92px; }
.shell-header { position: fixed; z-index: 20; top: 0; left: 0; right: 0; min-height: 64px; display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-bottom: 1px solid #cbd8d5; background: rgba(255,255,255,.97); }
.shell-brand { font-size: 1.08rem; white-space: nowrap; }
.shell-user { margin-left: auto; display: flex; align-items: center; gap: 10px; min-width: 0; }
.shell-user-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #425351; }
.connection-banner { border-radius: 999px; padding: 7px 10px; font-size: .82rem; font-weight: 800; white-space: nowrap; }
.connection-banner.online { background: #d9f2ed; color: #063f37; }
.connection-banner.offline { background: #fff0cf; color: #5a3900; }
.shell-content { width: min(100%, 1320px); margin: 0 auto; }

.bottom-nav { position: fixed; z-index: 30; left: 0; right: 0; bottom: 0; display: flex; overflow-x: auto; border-top: 1px solid #b8c8c5; background: #fff; }
.bottom-nav .nav-link { flex: 1 0 76px; min-height: 60px; display: flex; align-items: center; justify-content: center; padding: 8px; color: #31504c; text-decoration: none; font-size: .82rem; font-weight: 750; text-align: center; }
.bottom-nav .nav-link[aria-current="page"] { color: #064f4d; background: #e9f5f2; }
.sidebar-nav { display: none; }
.nav-link { min-height: 44px; }

.pos-screen { display: grid; gap: 14px; padding-bottom: 74px; }
.pos-toolbar { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; }
.pos-search { min-width: 0; }
.pos-scan-button { white-space: nowrap; }
.manual-code-form, .scanner-manual-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; }
.pos-status { min-height: 24px; margin: 0; }
.pos-grid { display: grid; gap: 14px; }
.catalog-panel { min-width: 0; }
.pos-product-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.pos-product-card { display: grid; gap: 5px; min-height: 112px; padding: 12px; border: 1px solid #d7e1df; border-radius: 14px; background: #fbfdfc; color: #152020; text-align: left; }
.pos-product-card:active { background: #edf7f5; }
.pos-product-name { font-size: .96rem; }
.pos-product-price { color: #075954; font-weight: 800; }
.cart-panel { display: none; }
.cart-panel.mobile-open { position: fixed; z-index: 35; inset: 72px 8px 68px; display: block; overflow: auto; box-shadow: 0 18px 50px rgba(9, 42, 39, .2); }
.cart-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.cart-header h2 { margin-bottom: 0; }
.cart-lines { display: grid; gap: 10px; margin-top: 14px; }
.cart-line { display: grid; gap: 10px; padding: 10px 0; border-bottom: 1px solid #e0e8e6; }
.cart-line-info { display: grid; gap: 4px; }
.cart-line-controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.quantity-button, .cart-remove { border: 1px solid #b9cac6; border-radius: 9px; background: #fff; color: #174b47; }
.quantity-button { width: 44px; padding: 6px; font-size: 1.15rem; font-weight: 800; }
.cart-remove { padding: 7px 10px; }
.cart-quantity { min-width: 28px; text-align: center; font-weight: 800; }
.cart-totals { display: grid; grid-template-columns: 1fr auto; gap: 8px 14px; margin-top: 18px; padding-top: 14px; border-top: 1px solid #cbd8d5; }
.cart-total-label, .cart-total-value { font-size: 1.12rem; }
.mobile-cart-bar { position: fixed; z-index: 28; left: 12px; right: 12px; bottom: 70px; min-height: 52px; border: 0; border-radius: 14px; padding: 10px 14px; background: #0b5f5f; color: #fff; font-weight: 800; box-shadow: 0 8px 22px rgba(9, 73, 69, .24); }
.scanner-overlay { position: fixed; z-index: 60; inset: 0; display: grid; place-items: center; padding: 16px; background: rgba(5, 24, 23, .78); }
.scanner-card { width: min(100%, 540px); max-height: 92vh; overflow: auto; border-radius: 20px; padding: 16px; background: #fff; }
.scanner-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.scanner-header h2 { margin: 0; }
.scanner-frame { position: relative; overflow: hidden; margin: 14px 0; min-height: 280px; border-radius: 18px; background: #0b1514; }
.scanner-frame::after { content: ""; position: absolute; inset: 18%; border: 3px solid rgba(255,255,255,.9); border-radius: 14px; pointer-events: none; }
.scanner-video { display: block; width: 100%; min-height: 280px; object-fit: cover; }
.scanner-message { min-height: 24px; }

.checkout-entry { margin-top: 18px; padding-top: 14px; border-top: 1px solid #cbd8d5; }
.checkout-button { width: 100%; min-height: 52px; font-size: 1rem; }
.checkout-overlay, .receipt-overlay { position: fixed; z-index: 70; inset: 0; display: grid; place-items: center; padding: 14px; background: rgba(5, 24, 23, .78); }
.checkout-card, .receipt-card { width: min(100%, 560px); max-height: 94vh; overflow: auto; border-radius: 20px; padding: 18px; background: #fff; box-shadow: 0 20px 60px rgba(0,0,0,.28); }
.checkout-header, .receipt-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.checkout-total { color: #075954; font-size: 1.25rem; }
.checkout-fields { display: grid; gap: 12px; margin-top: 14px; }
.checkout-preview { min-height: 24px; margin: 14px 0 6px; }
.checkout-error { min-height: 24px; margin: 6px 0 14px; color: #8b1e1e; font-weight: 700; }
.receipt-card { width: min(100%, 620px); }
.receipt-header > div { display: grid; gap: 4px; }
.receipt-disclaimer { border: 1px solid #9d6e0b; border-radius: 10px; padding: 10px; background: #fff7df; color: #5a3900; font-weight: 800; }
.receipt-meta { display: grid; gap: 4px; padding-bottom: 12px; border-bottom: 1px solid #d7e1df; }
.receipt-lines { display: grid; gap: 8px; margin: 14px 0; }
.receipt-line { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; }
.receipt-totals { display: grid; grid-template-columns: 1fr auto; gap: 7px 14px; padding-top: 12px; border-top: 1px solid #cbd8d5; }
.receipt-total-label, .receipt-total-value { font-size: 1.15rem; }
.receipt-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.receipt-share-preview { display: grid; gap: 10px; margin-top: 12px; padding-top: 12px; border-top: 1px solid #e0e8e6; }
.receipt-share-preview p { max-height: 180px; overflow: auto; white-space: pre-wrap; }

@media (min-width: 768px) {
  .app-shell { padding: 24px 24px 40px 220px; }
  .layout { grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); align-items: start; }
  .runtime-nav { top: 0; bottom: 0; right: auto; width: 188px; grid-template-columns: 1fr; grid-auto-rows: 64px; align-content: start; padding-top: 24px; border-top: 0; border-right: 1px solid #b8c8c5; }

  .app-layout { padding: 88px 24px 36px 220px; }
  .shell-header { left: 196px; min-height: 72px; padding: 12px 24px; }
  .bottom-nav { display: none; }
  .sidebar-nav { position: fixed; z-index: 25; top: 0; bottom: 0; left: 0; width: 196px; display: grid; align-content: start; gap: 6px; padding: 88px 12px 20px; border-right: 1px solid #b8c8c5; background: #fff; }
  .sidebar-nav .nav-link { display: flex; align-items: center; border-radius: 10px; padding: 10px 12px; color: #31504c; text-decoration: none; font-weight: 750; }
  .sidebar-nav .nav-link[aria-current="page"] { color: #064f4d; background: #e9f5f2; }

  .pos-screen { padding-bottom: 0; }
  .pos-grid { grid-template-columns: minmax(0, 1.7fr) minmax(300px, .8fr); align-items: start; }
  .pos-product-grid { grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); }
  .cart-panel { position: sticky; top: 88px; display: block; max-height: calc(100vh - 112px); overflow: auto; }
  .cart-panel.mobile-open { position: sticky; inset: auto; box-shadow: 0 1px 2px rgba(0,0,0,.04); }
  .cart-mobile-close, .mobile-cart-bar { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
