/* pos-native.css - Một Sợi Trà Standalone Web POS */

@font-face {
  font-family: "BVP";
  src: url("/assets/fonts/BeVietnamPro-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "BVP";
  src: url("/assets/fonts/BeVietnamPro-SemiBold.ttf") format("truetype");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "BVP";
  src: url("/assets/fonts/BeVietnamPro-Bold.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --terra: var(--mt-terra, #c05621);
  --terra-dark: var(--mt-terra-dark, #9e441a);
  --bg: var(--mt-bg, #f7f1ea);
  --cream: var(--mt-cream, #f3e7d8);
  --panel: var(--mt-panel, #fbf3e8);
  --card: var(--mt-card, #fffdfa);
  --ink: var(--mt-ink, #2a1c15);
  --ink-2: var(--mt-ink-2, #5c4638);
  --muted: var(--mt-muted, #8d7565);
  --line: var(--mt-line, #ecdcc9);
  --line-strong: var(--mt-line-strong, #d9c4a8);
  --price: var(--mt-price, #b34114);
  --primary: var(--mt-primary, #c05621);
  --primary-dark: var(--mt-primary-dark, #9e441a);
  --primary-soft: var(--mt-primary-soft, #fdebdd);
  --cream-soft: #f6ecdf;
  --chip-on: #f6e3d8;
  --danger: #c0392b;
  --danger-bg: #fdecea;
  --danger-line: #f0c6bf;
  --success: #4f6b45;
  --success-bg: #eef4ea;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

[hidden] {
  display: none !important;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg);
  color: var(--ink);
  font-family: "BVP", "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button, input, select, textarea {
  font-family: inherit;
  color: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

:focus-visible {
  outline: 2px solid var(--terra);
  outline-offset: 2px;
}

/* ==========================================================================
   Splash Screen
   ========================================================================== */
.splash {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 100;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.splash-mark {
  width: 80px;
  height: 80px;
  border-radius: 22px;
  background: var(--terra);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.5px;
  box-shadow: 0 10px 24px rgba(192, 86, 33, 0.28);
}

.splash-name {
  font-size: 22px;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -0.2px;
}

.splash-loader {
  width: 160px;
  height: 4px;
  background: var(--cream);
  border-radius: 99px;
  overflow: hidden;
  position: relative;
  margin-top: 8px;
}

.splash-loader span {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 40%;
  background: var(--terra);
  border-radius: 99px;
  animation: splash-bar 1.2s ease-in-out infinite alternate;
}

@keyframes splash-bar {
  0% { transform: translateX(0); width: 30%; }
  100% { transform: translateX(180%); width: 50%; }
}

.splash-text {
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
}

/* ==========================================================================
   Login Screen
   ========================================================================== */
.login {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 90;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow-y: auto;
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  padding: 36px 32px;
  box-shadow: 0 16px 36px rgba(42, 28, 21, 0.08);
  display: flex;
  flex-direction: column;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 18px;
  font-weight: 800;
  color: var(--ink);
  margin-bottom: 24px;
}

.login-mark {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--terra);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 17px;
  font-weight: 800;
}

.login-card h1 {
  font-size: 22px;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.2;
}

.login-sub {
  font-size: 13.5px;
  color: var(--muted);
  margin-top: 6px;
  margin-bottom: 24px;
}

.login-card form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.login-card label {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-2);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 4px;
}

.login-card input {
  height: 48px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: var(--panel);
  padding: 0 14px;
  font-size: 14.5px;
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s, background-color 0.15s;
}

.login-card input:focus {
  border-color: var(--terra);
  background: #fff;
}

.login-error {
  background: var(--danger-bg);
  border: 1px solid var(--danger-line);
  color: var(--danger);
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  margin-top: 4px;
}

.login-submit {
  height: 50px;
  margin-top: 12px;
  border: 0;
  border-radius: var(--radius-md);
  background: var(--terra);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(192, 86, 33, 0.25);
  transition: background-color 0.15s;
}

.login-submit:hover {
  background: var(--terra-dark);
}

/* ==========================================================================
   App Layout & Shell
   ========================================================================== */
.app {
  width: 100vw;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
}

/* Topbar: 60px height */
.topbar {
  height: 60px;
  flex: 0 0 60px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  z-index: 20;
}

.tab.brand {
  height: 42px;
  min-height: 42px;
  padding: 0 14px;
  border-radius: var(--radius-md);
  background: var(--cream-soft);
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  flex: 0 0 auto;
  cursor: pointer;
}

.tab.brand.on,
.tab.brand:hover {
  background: var(--cream);
  color: var(--ink);
}

.topbar .tabs {
  flex: 0 1 auto;
  min-width: 0;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
}

.topbar .tabs::-webkit-scrollbar {
  display: none;
}

.topbar .tab:not(.brand) {
  height: 42px;
  min-height: 42px;
  width: 180px;
  flex: 0 1 180px;
  min-width: 120px;
  max-width: 190px;
  padding: 0 12px;
  border-radius: var(--radius-md);
  background: var(--cream-soft);
  color: var(--ink-2);
  font-size: 13.5px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  overflow: hidden;
  cursor: pointer;
}

.topbar .tab.on {
  background: var(--terra);
  color: #fff;
}

.topbar .tab .lbl {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar .tab .x {
  flex: 0 0 auto;
  margin-left: auto;
  font-size: 13px;
  opacity: 0.8;
  padding: 2px 6px;
  border-radius: 6px;
  cursor: pointer;
}

.topbar .tab.on .x:hover {
  background: rgba(255, 255, 255, 0.22);
}

.addtab {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: #fff;
  color: var(--terra);
  font-size: 22px;
  font-weight: 700;
  display: grid;
  place-items: center;
  cursor: pointer;
  line-height: 1;
}

.addtab:hover {
  background: var(--panel);
}

.top-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.ghost {
  height: 42px;
  min-height: 42px;
  padding: 0 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: #fff;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-2);
  display: inline-flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  flex: 0 0 auto;
}

.ghost:hover {
  background: var(--panel);
  border-color: var(--line-strong);
}

.ghost svg,
.ghost .ghost-icon {
  width: 17px;
  height: 17px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.account {
  position: relative;
  flex: 0 0 auto;
}

.avatar {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  background: var(--ink);
  color: #f0c9a8;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 13.5px;
  border: 0;
  cursor: pointer;
}

.account-menu {
  position: absolute;
  right: 0;
  top: 50px;
  width: 200px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: 0 12px 28px rgba(42, 28, 21, 0.16);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 40;
}

.account-menu strong {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
}

.account-menu small {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}

.account-menu button,
.account-menu .account-link {
  height: 38px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--danger);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.account-menu button:hover,
.account-menu .account-link:hover {
  background: var(--danger-bg);
  border-color: var(--danger-line);
}

.account-menu .account-link {
  color: var(--ink-2);
}

.account-menu button.account-link {
  color: var(--ink-2);
  background: var(--panel);
  border-color: var(--line);
}

.account-menu button.account-link.danger {
  color: var(--danger);
}

.account-menu button.account-link.danger:hover {
  background: var(--danger-bg);
  border-color: var(--danger-line);
}

.account-menu .account-link:hover {
  background: var(--cream);
  border-color: var(--line);
}

/* ==========================================================================
   Workspace & Views
   ========================================================================== */
.work {
  flex: 1;
  position: relative;
  min-height: 0;
  overflow: hidden;
}

.view:not([hidden]) {
  display: flex;
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
}

.page:not([hidden]) {
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background: var(--bg);
  padding: 20px 24px;
}

/* Generic Search Input Component */
.search {
  height: 44px;
  border-radius: var(--radius-md);
  background: var(--card);
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  color: var(--muted);
}

.search svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  flex: 0 0 18px;
}

.search input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: none;
  background: transparent;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
}

.search input::placeholder {
  color: var(--muted);
}

.search:focus-within {
  border-color: var(--terra);
  background: #fff;
}

/* ==========================================================================
   Screen 1: Tables Screen
   ========================================================================== */
.view.tables:not([hidden]) {
  flex-direction: column;
  background: var(--bg);
}

.floors {
  display: flex;
  gap: 8px;
  padding: 12px 16px 0;
  align-items: center;
  flex-wrap: wrap;
}

.floors-tabs {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

.ft {
  height: 40px;
  min-height: 40px;
  padding: 0 14px 0 16px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink-2);
  display: inline-flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  background: transparent;
}

.ft b {
  min-width: 24px;
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(42, 28, 21, 0.07);
  color: inherit;
  font-size: 12px;
  font-weight: 800;
  line-height: 18px;
  text-align: center;
}

.ft.on b {
  background: rgba(255, 255, 255, 0.18);
}

.ft.on {
  background: var(--terra);
  color: #fff;
}

.ft:hover:not(.on) {
  background: var(--cream-soft);
}

.tables-search {
  height: 40px;
  max-width: 360px;
  flex: 1;
  border-radius: 10px;
}

.filters {
  display: flex;
  gap: 6px;
  padding: 6px 16px 0;
  align-items: center;
  flex-wrap: wrap;
}

.f {
  height: 38px;
  min-height: 38px;
  padding: 0 14px;
  border: 0;
  background: none;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-2);
  display: inline-flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  border-radius: 9px;
}

.f i {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  border: 1.6px solid #b49c88;
  flex: 0 0 13px;
}

.f b {
  font-size: 14px;
  font-weight: 800;
  color: var(--ink);
}

.f.on {
  color: var(--terra-dark);
  background: var(--cream-soft);
}

.f.on i {
  border-color: var(--terra);
  background: var(--terra);
  box-shadow: inset 0 0 0 3px var(--cream);
}

.f.on b {
  color: var(--terra-dark);
}

/* 8-column table grid */
.tgrid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  grid-auto-rows: 130px;
  gap: 6px;
  padding: 10px 16px;
  align-content: start;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(192, 86, 33, 0.28) transparent;
}

.tgrid::-webkit-scrollbar,
.grid::-webkit-scrollbar,
.rows::-webkit-scrollbar,
.plist::-webkit-scrollbar {
  width: 7px;
}

.tgrid::-webkit-scrollbar-thumb,
.grid::-webkit-scrollbar-thumb,
.rows::-webkit-scrollbar-thumb,
.plist::-webkit-scrollbar-thumb {
  background: rgba(192, 86, 33, 0.25);
  border-radius: 99px;
}

.t {
  position: relative;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
  text-align: center;
  transition: transform 0.08s, background-color 0.12s;
}

.t:hover {
  background: var(--cream-soft);
}

.t:focus-visible {
  outline: 2px solid var(--terra);
  outline-offset: 2px;
}

.t > svg {
  width: 58px;
  height: 40px;
  flex: 0 0 40px;
  stroke: #b09a86;
  fill: none;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.t > svg .top {
  fill: #fffdfa;
}

.t > svg .inn {
  stroke-width: 1.1;
  opacity: 0.55;
}

.t .nm {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ink);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.t .sub {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--muted);
}

/* Table open styling */
.t.open {
  border-color: var(--terra);
  background: #fff8f3;
}

.t.open > svg {
  stroke: var(--terra-dark);
}

.t.open > svg .top {
  fill: var(--terra);
}

.t.open > svg .inn {
  stroke: #fbe7da;
  opacity: 0.85;
}

.t.open .nm {
  color: var(--terra-dark);
}

.t.open .sub {
  color: var(--price);
}

/* Bottom action bar */
.actions {
  flex: 0 0 68px;
  border-top: 1px solid var(--line);
  background: var(--panel);
  display: flex;
  gap: 10px;
  padding: 10px 16px;
}

.a {
  flex: 1;
  height: 48px;
  min-height: 40px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: var(--card);
  font-size: 15px;
  font-weight: 600;
  color: var(--ink-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.12s;
}

.a:hover {
  background: var(--cream-soft);
}

.a.primary {
  background: var(--terra);
  border-color: var(--terra);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(192, 86, 33, 0.22);
}

.a.primary:hover {
  background: var(--terra-dark);
}

/* ==========================================================================
   Screen 2: Sale Screen
   ========================================================================== */
.view.sale:not([hidden]) {
  display: flex;
  background: var(--bg);
}

/* Category Rail: 176px */
.side {
  width: 176px;
  flex: 0 0 176px;
  background: var(--panel);
  border-right: 1px solid var(--line);
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
}

.nav {
  height: 50px;
  min-height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-2);
  white-space: nowrap;
  overflow: hidden;
  cursor: pointer;
  background: transparent;
  border: 0;
  width: 100%;
  text-align: left;
}

.nav:hover {
  background: var(--cream-soft);
}

.nav.on {
  background: var(--terra);
  color: #fff;
}

.nav .cnt {
  margin-left: auto;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--muted);
}

.nav.on .cnt {
  color: #f6d9c9;
}

.navsec {
  margin: 10px 10px 4px;
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #a9947f;
  font-weight: 700;
}

/* Main Product Area */
.main {
  flex: 1;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  overflow: hidden;
}

.searchrow {
  display: flex;
  gap: 10px;
  align-items: center;
}

.product-search {
  flex: 1;
  height: 48px;
}

/* Sale desktop only. Mobile has its own markup and interaction contract. */
body:not(.posm) #sale-screen .searchrow { position: relative; padding-bottom: 36px; }
body:not(.posm) #sale-screen #back-to-tables {
  position: absolute;
  bottom: 0;
  right: 0;
  padding: 4px 8px;
  min-height: 28px;
}
body:not(.posm) #sale-screen .product-search {
  min-width: 0;
  width: 100%;
  padding-right: 4px;
}

body:not(.posm) #sale-screen .product-search input { min-width: 0; }

body:not(.posm) #sale-screen .sale-create-product {
  flex: 0 0 48px;
  width: 48px;
  height: 44px;
  border: 0;
  border-left: 1px solid var(--line);
  border-radius: 0 12px 12px 0;
  background: transparent;
  color: var(--terra);
  font: inherit;
  font-size: 25px;
  cursor: pointer;
}

body:not(.posm) #sale-screen .sale-customize {
  position: absolute;
  top: auto;
  bottom: 0;
  right: 0;
  z-index: 3;
  width: 56px;
  height: 56px;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 18px 0 0 18px;
  display: grid;
  place-items: center;
  color: var(--ink-2);
  font: inherit;
  font-size: 16px;
  cursor: pointer;
}

body:not(.posm) #sale-screen .card .plus.stock {
  right: 8px;
  left: auto;
}

body:not(.posm) #sale-screen .card .ov { padding-right: 10px; }
body:not(.posm) #sale-screen .card .pprice { padding-right: 30px; }
body:not(.posm) #sale-screen .card .pname { margin-bottom: 4px; }
body:not(.posm) .note-options-overlay .size-row--two .track {
  width: 60%;
  margin-left: auto;
  margin-right: auto;
}
body:not(.posm) #sale-screen .card .ov {
  padding-top: 48px;
  background: linear-gradient(to top, rgba(20,14,10,.94), rgba(20,14,10,.61) 60%, transparent);
}
body:not(.posm) #sale-screen .card .pname,
body:not(.posm) #sale-screen .card .pprice {
  -webkit-text-stroke: .6px rgba(15,10,7,.9);
  paint-order: stroke fill;
  text-shadow: -1px 0 #140e0a, 1px 0 #140e0a, 0 -1px #140e0a, 0 1px #140e0a, 0 2px 3px #140e0a;
}
body:not(.posm) #sale-screen .sale-customize::before {
  content: '';
  position: absolute;
  width: 22px;
  height: 22px;
  right: 8px;
  bottom: 8px;
  background: rgba(255,255,255,.95);
  border: 1px solid var(--line);
  border-radius: 7px;
  z-index: -1;
}

body:not(.posm) #sale-screen .sale-cart-thumb {
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  object-fit: cover;
  border-radius: 10px;
  background: var(--cream-soft);
}

body:not(.posm) #sale-screen .card,
body:not(.posm) #sale-screen .sale-customize,
body:not(.posm) #sale-screen .sale-create-product { transition: opacity 100ms ease-out; }

body:not(.posm) #sale-screen .card:active,
body:not(.posm) #sale-screen .sale-customize:active,
body:not(.posm) #sale-screen .sale-create-product:active { opacity: .78; }

body:not(.posm) #sale-screen .sale-customize:focus-visible,
body:not(.posm) #sale-screen .sale-create-product:focus-visible {
  outline: 3px solid var(--terra);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  body:not(.posm) #sale-screen .card,
  body:not(.posm) #sale-screen .sale-customize,
  body:not(.posm) #sale-screen .sale-create-product { transition: none; }
}

.empty {
  grid-column: 1 / -1;
  padding: 36px 12px;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  text-align: center;
}

/* Product Grid */
.grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  align-content: start;
  overflow-y: auto;
  padding-right: 4px;
}

/* Product Cards */
.card {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  background: var(--cream);
  aspect-ratio: 1 / 1;
  min-height: 150px;
  box-shadow: 0 4px 10px rgba(42, 28, 21, 0.05);
}

/* WebView 86 has no aspect-ratio: keep the product tile tall enough. */
@supports not (aspect-ratio: 1 / 1) {
  .card {
    height: 168px;
  }
}

.card img {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.card .ov {
  position: absolute;
  top: auto;
  right: 0;
  bottom: 0;
  left: 0;
  padding: 32px 10px 8px;
  color: #fff;
  background: linear-gradient(to top, rgba(34, 22, 15, 0.88), rgba(34, 22, 15, 0.4) 60%, rgba(34, 22, 15, 0));
  display: flex;
  align-items: flex-end;
  gap: 6px;
}

.card .txt {
  flex: 1;
  min-width: 0;
}

.card .pname {
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1.2;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9), 0 0 7px rgba(0, 0, 0, 0.65), 0 0 2px rgba(0, 0, 0, 0.85);
}

.card .pprice {
  font-size: 14px;
  font-weight: 800;
  color: #ffd9b4;
  margin-top: 2px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.85), 0 0 6px rgba(0, 0, 0, 0.6);
}

.card .plus {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.95);
  color: var(--ink-2);
  display: grid;
  place-items: center;
  font-size: 16px;
  font-weight: 700;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
}

.card .plus.stock {
  font-size: 11.5px;
  font-weight: 800;
  border-radius: 8px;
  padding: 0 4px;
  width: auto;
  min-width: 28px;
}

.card .plus.out {
  font-size: 10px;
  color: var(--terra);
  background: rgba(255, 255, 255, 0.9);
}

.card.out {
  cursor: not-allowed;
}

.card.out img {
  filter: grayscale(0.65);
  opacity: 0.65;
}

/* Cart Column: 452px */
.cart {
  width: 452px;
  flex: 0 0 452px;
  background: var(--panel);
  border-left: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: 14px 16px;
  gap: 10px;
  min-height: 0;
  overflow: hidden;
}

.cart-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.cart-head h2 {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.2px;
  color: var(--ink);
}

.cart-count {
  flex: 0 0 auto;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0;
}

.tablechip {
  margin-left: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
  flex: 0 0 auto;
}

.tablechip b {
  color: var(--ink);
  font-weight: 700;
}

.custchip {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 150px;
  height: 32px;
  padding: 0 10px;
  border: 1px dashed var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.custchip span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
}

.custchip.has-customer {
  border-style: solid;
  border-color: #d8b48c;
  background: var(--cream-soft);
  color: var(--ink);
}

.custchip:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.custchip:hover:not(:disabled) {
  border-color: #d8b48c;
  color: var(--ink);
}

/* Cart Item Rows */
.rows {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
}

.rwrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.rnote {
  height: 34px;
  border: 1px dashed #ddc9b5;
  border-radius: 10px;
  background: #fffdf9;
  padding: 0 10px;
  font-size: 12.5px;
  color: var(--ink);
  outline: none;
}

.rnote:focus {
  border-style: solid;
  border-color: var(--terra);
  background: #fff;
}

.cart-trash {
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: 9px;
  border: 1px solid #e6c9c2;
  background: #fdeceb;
  color: #b3261e;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}

.cart-trash:disabled {
  opacity: 0.45;
  cursor: default;
}

.cart-trash.is-on {
  background: #b3261e;
  border-color: #b3261e;
  color: #fff;
}

.rdel {
  width: 26px;
  height: 26px;
  flex: none;
  margin-left: 6px;
  border-radius: 7px;
  border: 1px solid #e6c9c2;
  background: #fdeceb;
  color: #b3261e;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}

.ropt {
  font-size: 11.5px;
  line-height: 1.4;
  color: var(--terra);
}

.rnote-txt {
  font-size: 11.5px;
  line-height: 1.4;
  color: var(--muted);
}

.rnote-btn {
  height: 32px;
  border: 1px dashed #ddc9b5;
  border-radius: 10px;
  background: #fffdf9;
  padding: 0 10px;
  font-size: 12.5px;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  font-family: inherit;
}

.rnote-btn:hover {
  border-style: solid;
  border-color: var(--terra);
  background: #fff;
}

.r {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.rtop {
  width: 100%;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.r .side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  flex: 0 0 auto;
}

.r .rsize {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
}

.r img {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  object-fit: cover;
  flex: 0 0 52px;
}

.r .mid {
  flex: 1;
  min-width: 0;
}

.r .nm {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.25;
  color: var(--ink);
}

.r .un {
  font-size: 13px;
  color: var(--price);
  font-weight: 600;
  margin-top: 2px;
}

.r .lnote {
  width: 100%;
  font-size: 12px;
  font-weight: 600;
  color: var(--terra);
  line-height: 1.35;
  padding-top: 4px;
  border-top: 1px dashed var(--line);
  word-break: break-word;
}

.step {
  display: flex;
  align-items: center;
  gap: 4px;
}

.step button {
  width: 34px;
  height: 34px;
  min-width: 34px;
  min-height: 34px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 16px;
  font-weight: 700;
  color: var(--ink-2);
  cursor: pointer;
  display: grid;
  place-items: center;
}

.step button:hover {
  background: var(--cream-soft);
}

.step .q {
  width: 28px;
  text-align: center;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
}

.r .lt {
  width: auto;
  text-align: right;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
}

/* Totals */
.totals {
  border-top: 1px dashed var(--line);
  padding-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.tr {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--muted);
}

.tr.grand {
  margin-top: 2px;
  padding-top: 6px;
  border-top: 1px solid var(--line);
  color: var(--ink);
  align-items: baseline;
}

.tr.grand .l {
  font-size: 15px;
  font-weight: 700;
}

.tr.grand .v {
  font-size: 24px;
  font-weight: 800;
  color: var(--price);
  letter-spacing: -0.3px;
}

/* Cart Actions */
.cart-actions {
  display: grid;
  grid-template-columns: 1fr 3fr;
  gap: 8px;
  align-items: stretch;
}

.cart-actions .ghost {
  height: 64px;
  min-height: 48px;
  padding: 0 12px;
  border-radius: var(--radius-lg);
}

.pay {
  height: 64px;
  min-height: 48px;
  flex: 1;
  border-radius: var(--radius-lg);
  background: var(--terra);
  color: #fff;
  border: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(192, 86, 33, 0.28);
  transition: opacity 0.12s;
}

.pay:hover:not(:disabled) {
  background: var(--terra-dark);
}

.pay:disabled {
  background: var(--terra);
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
}

.pay-arrow {
  font-size: 20px;
  line-height: 1;
}

.pay-label {
  font-size: 16.5px;
  font-weight: 700;
  white-space: nowrap;
}

.pay-amount {
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.3px;
  white-space: nowrap;
}

/* ==========================================================================
   Payment Modal & Sheet
   ========================================================================== */
.payment-veil {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 80;
  background: rgba(42, 28, 21, 0.52);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.sheet {
  width: 1080px;
  max-width: 100%;
  height: 620px;
  max-height: 96vh;
  background: var(--card);
  border-radius: var(--radius-xl);
  display: flex;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(40, 22, 13, 0.35);
}

/* Left Column */
.pl {
  width: 440px;
  flex: 0 0 440px;
  background: var(--panel);
  border-right: 1px solid var(--line);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.eyebrow {
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #a9947f;
  font-weight: 700;
}

.h1 {
  font-size: 22px;
  font-weight: 800;
  color: var(--ink);
  margin-top: 4px;
}

.sub {
  font-size: 13px;
  color: var(--muted);
  margin-top: 2px;
}

.plist {
  margin-top: 10px;
  flex: 1;
  min-height: 80px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
}

.pli {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pli img {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  object-fit: cover;
}

.pli .n {
  flex: 1;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
}

.pli .q {
  font-size: 12.5px;
  color: var(--muted);
}

.pli .v {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ink);
}

.psep {
  height: 1px;
  background: var(--line);
  margin: 10px 0;
}

.ptl {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.ptl .l {
  font-size: 13.5px;
  color: var(--muted);
  font-weight: 600;
}

.ptl .v {
  font-size: 28px;
  font-weight: 800;
  color: var(--price);
  letter-spacing: -0.3px;
}

.methods {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.m {
  flex: 1;
  height: 48px;
  min-height: 40px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--line);
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-2);
  cursor: pointer;
  transition: all 0.12s;
}

.m input[type="radio"] {
  accent-color: var(--terra);
}

.m.on,
.m:has(input:checked) {
  background: var(--chip-on);
  border-color: var(--terra);
  color: var(--terra-dark);
  font-weight: 700;
}

.notebar {
  height: 44px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: #fffdf9;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  margin-top: 10px;
}

.notebar input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: none;
  background: transparent;
  font-size: 13px;
  color: var(--ink);
}

.notebar input::placeholder {
  color: #b09a86;
}

/* Right Column */
.pr {
  flex: 1;
  padding: 18px 22px;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.pane {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.given-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-2);
  margin-bottom: 6px;
}

.given {
  height: 72px;
  border-radius: var(--radius-lg);
  border: 2px solid var(--terra);
  background: #fdf6f1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
}

.given input {
  flex: 1;
  border: 0;
  background: transparent;
  outline: none;
  font-size: 32px;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -0.5px;
}

.given .clr {
  width: 38px;
  height: 38px;
  min-width: 38px;
  border-radius: 50%;
  border: 1px solid #e3c9b8;
  background: #fff;
  color: var(--terra-dark);
  font-size: 16px;
  font-weight: 700;
  display: grid;
  place-items: center;
  cursor: pointer;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.chip {
  flex: 1 1 calc(25% - 8px);
  min-width: 80px;
  height: 48px;
  min-height: 40px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: #fff;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-2);
  cursor: pointer;
  display: grid;
  place-items: center;
}

.chip:hover {
  background: var(--cream-soft);
}

.change {
  margin-top: 10px;
  height: 50px;
  border-radius: var(--radius-md);
  background: var(--success-bg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
}

.change .l {
  font-size: 14px;
  font-weight: 600;
  color: var(--success);
}

.change .v {
  font-size: 22px;
  font-weight: 800;
  color: var(--success);
}

/* QR Pane */
.qr-pane {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.qrwrap {
  flex: 1;
  display: grid;
  place-items: center;
  padding: 10px;
}

.qrimg {
  width: 240px;
  height: 240px;
  border-radius: var(--radius-lg);
  background: #fff;
  border: 1px solid var(--line);
  object-fit: contain;
}

.qrbadge {
  display: none;
  width: 240px;
  height: 240px;
  border-radius: var(--radius-lg);
  border: 1px dashed var(--line);
  background: #fffdf9;
  place-items: center;
  font-size: 54px;
  font-weight: 800;
  color: #d9c3b4;
}

.qramt {
  text-align: center;
  font-size: 26px;
  font-weight: 800;
  color: var(--price);
  margin-top: 4px;
}

.qrnote {
  text-align: center;
  font-size: 13px;
  color: var(--muted);
  margin-top: 4px;
  max-width: 320px;
}

/* Payment Actions */
.pactions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

.cancel {
  width: 140px;
  height: 56px;
  min-height: 44px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: #fff;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink-2);
  cursor: pointer;
}

.cancel:hover {
  background: var(--panel);
}

.confirm {
  flex: 1;
  height: 56px;
  min-height: 44px;
  border-radius: var(--radius-lg);
  border: 0;
  background: var(--terra);
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(192, 86, 33, 0.28);
}

.confirm:hover {
  background: var(--terra-dark);
}

/* ==========================================================================
   Pages: Invoices & Customers
   ========================================================================== */
.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

.page-head h1 {
  font-size: 24px;
  font-weight: 800;
  color: var(--ink);
}

.page-tools {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.invoice-list,
.customer-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.invoice-row,
.customer-row {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.invoice-row:hover,
.customer-row:hover {
  border-color: var(--line-strong);
}

/* Preset note chips */
.np-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.np-chip {
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--card);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-2);
  cursor: pointer;
}

.np-chip.is-on {
  background: var(--terra);
  border-color: var(--terra);
  color: #fff;
}

/* Modal and Overlays */
#modal-root:empty {
  display: none;
}

.modal {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 95;
  background: rgba(42, 28, 21, 0.48);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-card {
  width: 540px;
  max-width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--card);
  border-radius: var(--radius-xl);
  padding: 24px;
  box-shadow: 0 20px 48px rgba(42, 28, 21, 0.2);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modal-close {
  align-self: flex-end;
  border: 0;
  background: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--muted);
}

.cust-picker {
  gap: 10px;
}

/* Sale customer picker only; other dialogs and management pages stay unchanged. */
.customer-picker-overlay {
  background: transparent;
}
.customer-picker-overlay .sale-customer-dropdown {
  position: fixed;
  margin: 0;
  min-width: 0;
  overflow-y: auto;
  padding: 16px;
  box-shadow: 0 12px 36px #0003;
}
.sale-customer-dropdown .cust-list { max-height: 32vh; flex-shrink: 1; }
.sale-customer-dropdown .cust-row { min-height: 48px; flex-shrink: 0; }
.sale-customer-dropdown .rcpt-actions { flex-wrap: wrap; }
body:not(.posm) .sale-customer-dropdown { padding: 12px; }
body:not(.posm) .sale-customer-dropdown .h1 { font-size: 16px; margin: 0 26px 4px 0; }
body:not(.posm) .sale-customer-dropdown input[type="search"] { height: 42px; font-size: 14px; }
body:not(.posm) .sale-customer-dropdown .cust-row { border: 0; border-radius: 6px; min-height: 44px; padding: 8px 10px; }
body:not(.posm) .sale-customer-dropdown .cust-row.is-on { background: var(--panel); }
body:not(.posm) .sale-customer-dropdown .rcpt-actions .ghost { padding: 8px 10px; font-size: 13px; }

.cust-picker input[type="search"] {
  height: 44px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel);
  padding: 0 12px;
  font-size: 14.5px;
}

.cust-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 46vh;
  overflow-y: auto;
}

.cust-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  text-align: left;
  font: inherit;
  cursor: pointer;
}

.cust-row b {
  font-size: 14px;
  color: var(--ink);
}

.cust-row span {
  font-size: 12.5px;
  color: var(--muted);
  margin-left: auto;
}

.cust-row i {
  font-style: normal;
  font-size: 11.5px;
  font-weight: 700;
  color: #2e7d32;
}

.cust-row:hover {
  border-color: #d8b48c;
  background: var(--cream-soft);
}

.cust-row.is-on {
  border-color: #2e7d32;
  background: #f1f8f1;
}

.methods .m.is-disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.qrnote:empty {
  display: none;
}

#qr-warning {
  color: var(--danger);
  font-weight: 600;
}

/* Toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: 84px;
  transform: translateX(-50%) translateY(10px);
  background: #2f2119;
  color: #ffe9d6;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s, transform 0.15s;
  z-index: 110;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.25);
}

.toast.on,
.toast.is-active,
.toast:not(:empty) {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ==========================================================================
   Responsive Breakpoints
   ========================================================================== */
@media (max-width: 1200px) {
  .topbar {
    gap: 6px;
    padding: 0 10px;
  }
  .tab.brand {
    padding: 0 10px;
  }
  .tab.brand .tab-label {
    display: none;
  }
  .topbar .tabs {
    flex: 1 1 0;
  }
  .topbar .tab:not(.brand) {
    width: 150px;
    flex: 0 0 150px;
    min-width: 110px;
    padding: 0 9px;
  }
  .top-actions {
    gap: 4px;
  }
  .ghost {
    padding: 0 9px;
    font-size: 12.5px;
  }
}

@media (max-width: 1024px) {
  .sheet {
    width: 95vw;
    height: 90vh;
  }
  .pl {
    width: 380px;
    flex: 0 0 380px;
  }
}

@media (max-width: 900px) {
  .topbar {
    flex-wrap: wrap;
    height: auto;
    min-height: 60px;
    padding: 8px 12px;
  }

  .view.sale:not([hidden]) {
    flex-direction: column;
    overflow-y: auto;
  }

  .side {
    width: 100%;
    flex: 0 0 auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    flex-direction: row;
    overflow-x: auto;
    padding: 8px 12px;
  }

  .side .navsec {
    display: none;
  }

  .nav {
    width: auto;
    height: 40px;
  }

  .cart {
    width: 100%;
    flex: 0 0 auto;
    border-left: 0;
    border-top: 1px solid var(--line);
    max-height: 45vh;
  }

  .tgrid {
    grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
  }

  .sheet {
    flex-direction: column;
    height: auto;
    max-height: 94vh;
    overflow-y: auto;
  }

  .pl {
    width: 100%;
    flex: 0 0 auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .pr {
    width: 100%;
    flex: 0 0 auto;
  }
}

@media (max-width: 640px) {
  .topbar {
    flex: 0 0 auto;
    height: auto;
    gap: 8px 6px;
    padding: 8px 10px;
  }

  .topbar .tab.brand {
    order: 1;
    padding: 0 10px;
  }

  .topbar #open-table-btn,
  .topbar .addtab {
    order: 2;
  }

  .topbar .top-actions {
    order: 3;
    margin-left: auto;
    gap: 4px;
  }

  .topbar .top-actions .ghost {
    padding: 0 7px;
    font-size: 12px;
  }

  .topbar .tabs,
  .topbar #table-tabs {
    order: 4;
    flex: 1 1 100%;
    width: 100%;
    min-width: 0;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .topbar .tab:not(.brand) {
    width: 150px;
    flex: 0 0 150px;
    min-width: 150px;
  }
}

/* ==========================================================================
   Topping Picker Sheet & Cart Line Add-on
   ========================================================================== */
.topping-veil {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 95;
  background: rgba(42, 28, 21, 0.48);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow-y: auto;
}

.topping-card {
  width: 520px;
  max-width: 100%;
  max-height: 86vh;
  overflow-y: auto;
  background: var(--card);
  border-radius: var(--radius-xl);
  padding: 20px;
  box-shadow: 0 20px 48px rgba(42, 28, 21, 0.2);
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: relative;
}

.topping-head {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.topping-head .topping-name {
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
}

.topping-sub {
  font-size: 13px;
  color: var(--muted);
}

.topping-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  min-height: 0;
}

.topping-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
}

.topping-row:hover {
  border-color: var(--line-strong);
  filter: brightness(0.98);
}

.topping-row.is-on {
  border-color: var(--terra);
  background: #fff;
}

.topping-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.topping-name {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topping-price {
  font-size: 12.5px;
  color: var(--price);
}

.topping-step {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
}

.topping-step button {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 20px;
  line-height: 1;
  color: var(--ink);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.topping-step button:active {
  transform: scale(0.96);
  background: var(--cream);
}

.topping-qty {
  min-width: 24px;
  text-align: center;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.topping-total {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
  font-size: 14px;
}

.topping-total b,
#topping-total {
  font-size: 17px;
  font-weight: 700;
  color: var(--price);
}

.topping-actions {
  display: flex;
  flex-direction: row;
  justify-content: flex-end;
  gap: 10px;
}

.topping-actions .ghost {
  min-height: 44px;
  height: 44px;
  padding: 0 18px;
  font-size: 14px;
}

.topping-actions .confirm {
  flex: initial;
  min-height: 44px;
  height: 44px;
  padding: 0 24px;
  font-size: 14.5px;
}

.tag-topping {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 6px;
  border-radius: 999px;
  background: var(--cream);
  color: var(--terra);
  border: 1px solid var(--line);
  vertical-align: middle;
  margin-left: 6px;
}

.rwrap.is-topping .r {
  border-left: 3px solid var(--cream);
  background: var(--cream-soft);
}

@media (max-width: 560px) {
  .topping-card {
    max-height: 92vh;
    padding: 16px;
    border-radius: 16px;
  }
}

/* ==========================================================================
   Print Styles
   ========================================================================== */
@media print {
  body {
    background: #fff !important;
    color: #000 !important;
    overflow: visible !important;
  }

  .app,
  .splash,
  .login,
  .toast,
  #modal-root,
  .payment-veil {
    display: none !important;
  }

  #print-area {
    display: block !important;
    width: 80mm;
    margin: 0 auto;
    padding: 2mm 0;
    font-size: 12px;
    line-height: 1.4;
    color: #000 !important;
    background: #fff !important;
  }

  #print-area * {
    color: #000 !important;
    background: transparent !important;
    box-shadow: none !important;
  }

  #print-area.w58 {
    width: 58mm;
  }

  #print-area .rcpt {
    max-width: none;
    width: 100%;
  }

  #print-area .rcpt-qr {
    width: 120px;
    max-width: 55%;
  }
}

/* Desktop POS only; mobile does not load this stylesheet. */
.payment-loading-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  margin-right: 6px;
  vertical-align: middle;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: payment-loading-spin .75s linear infinite;
}
@keyframes payment-loading-spin { to { transform: rotate(360deg); } }
