:root {
  --bg: #eef3f0;
  --surface: #fff;
  --surface-2: #f4f7f5;
  --surface-3: #e7eeea;
  --text: #101f19;
  --muted: #6c7b75;
  --line: #dde6e1;
  --brand: #147a54;
  --brand-2: #0e5d40;
  --accent: #e4f5ec;
  --danger: #c23b47;
  --warning: #b66c13;
  --shadow: 0 18px 55px rgba(20, 49, 38, .11);
  --radius: 16px;
  --header: 64px;
  --font: "Inter", "Noto Sans Bengali", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif
}

[data-theme=dark] {
  --bg: #0b1310;
  --surface: #121d19;
  --surface-2: #182620;
  --surface-3: #22332c;
  --text: #edf6f2;
  --muted: #96aaa1;
  --line: #293a33;
  --brand: #42c58d;
  --brand-2: #65d9a8;
  --accent: #183c2e;
  --danger: #ff7d87;
  --warning: #f0b45f;
  --shadow: 0 20px 65px rgba(0, 0, 0, .35)
}

* {
  box-sizing: border-box
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "cv11", "ss01"
}

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

button,
a {
  transition: .16s ease
}

button {
  cursor: pointer
}

h1,
h2,
h3 {
  font-weight: 800;
  letter-spacing: -.02em;
  margin: 0
}

.hidden {
  display: none !important
}

.pos-body {
  overflow: hidden
}

.pos-app {
  position: relative;
  height: 100vh;
  display: grid;
  grid-template-rows: var(--header) 1fr
}

.pos-app::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--brand), var(--brand-2) 50%, var(--brand));
  z-index: 6
}

/* Header */
.pos-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 18px;
  background: linear-gradient(180deg, var(--surface), color-mix(in srgb, var(--surface) 93%, var(--brand) 7%));
  box-shadow: 0 1px 0 var(--line), 0 12px 28px -22px rgba(10, 40, 28, .55);
  z-index: 5
}

.brand-lockup,
.login-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 230px
}

.brand-mark {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(145deg, #199369, #0d6042);
  font-weight: 800;
  box-shadow: 0 8px 20px rgba(20, 122, 84, .25)
}

.brand-lockup div,
.login-brand div {
  display: grid;
  min-width: 0
}

.brand-lockup strong,
.login-brand strong {
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis
}

.brand-lockup small,
.login-brand small {
  color: var(--muted);
  font-size: 11px;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis
}

.cart-tabs {
  display: flex;
  gap: 6px;
  flex: 1;
  overflow: auto
}

.cart-tab {
  border: 1px solid var(--line);
  background: var(--surface-2);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  transition: background .15s ease, border-color .15s ease, color .15s ease
}

.cart-tab.active {
  border-color: var(--brand);
  background: var(--accent);
  color: var(--brand);
  font-weight: 700;
  box-shadow: 0 4px 14px -7px color-mix(in srgb, var(--brand) 50%, transparent)
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 7px
}

.header-actions form {
  display: contents
}

.icon-btn {
  height: 38px;
  min-width: 38px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface-2);
  display: inline-grid;
  place-items: center;
  text-decoration: none;
  transition: border-color .15s ease, color .15s ease, transform .1s ease, box-shadow .15s ease;
  cursor: pointer;
  color: inherit
}

.icon-btn:hover,
.secondary:hover {
  border-color: var(--brand);
  color: var(--brand);
  box-shadow: 0 6px 16px -8px color-mix(in srgb, var(--brand) 45%, transparent)
}

.icon-btn:active {
  transform: scale(.93)
}

.icon-btn .btn-ico {
  display: none;
  flex: 0 0 auto
}

.icon-btn.labeled {
  display: flex;
  padding: 0 10px;
  gap: 7px;
  width: auto
}

.icon-btn b {
  display: grid;
  place-items: center;
  min-width: 19px;
  height: 19px;
  border-radius: 10px;
  background: var(--accent);
  color: var(--brand);
  font-size: 10px
}

.icon-btn svg,
.customer-avatar svg,
.search-box>span svg,
.cart-empty>span svg,
.success-icon svg {
  display: block
}

/* Nav drawer — intentionally always dark green, matching the admin console sidebar's brand identity regardless of the POS light/dark toggle */
.nav-drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: min(300px, 86vw);
  background: #10251d;
  color: #dfece6;
  z-index: 25;
  display: flex;
  flex-direction: column;
  padding: 18px 14px;
  box-shadow: 24px 0 60px rgba(0, 0, 0, .4);
  transform: translateX(-100%);
  transition: transform .22s ease
}

.nav-drawer.open {
  transform: translateX(0)
}

.nav-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4px 18px;
  margin-bottom: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, .08)
}

.nav-drawer-head .brand-lockup strong {
  color: #fff
}

.nav-drawer-head .brand-lockup small {
  color: #8fb0a2
}

.nav-drawer-head .modal-close {
  background: rgba(255, 255, 255, .08);
  color: #dfece6
}

.nav-drawer-head .modal-close:hover {
  background: rgba(255, 255, 255, .16);
  color: #fff
}

.nav-drawer-links {
  display: grid;
  align-content: start;
  gap: 4px;
  flex: 1;
  overflow: auto;
  padding: 6px 2px
}

.nav-drawer>form {
  display: contents
}

.nav-drawer-links a,
.nav-drawer-signout {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 12px;
  border-radius: 10px;
  color: #9fb5ac;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  transition: background .15s ease, color .15s ease;
  border: 0;
  background: none;
  width: 100%;
  text-align: left;
  cursor: pointer
}

.nav-drawer-links a:hover {
  background: #1b392d;
  color: #fff
}

.nav-drawer-links a svg {
  color: inherit;
  flex: 0 0 auto
}

.nav-drawer-signout {
  margin-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, .08);
  padding-top: 16px;
  color: #ff8a93
}

.nav-drawer-signout:hover {
  background: rgba(255, 255, 255, .06);
  color: #ffb0b6
}

.nav-drawer-signout svg {
  color: inherit
}

/* Workspace */
.pos-workspace {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 430px
}

.catalog-pane {
  min-width: 0;
  padding: 16px 18px 12px;
  display: flex;
  flex-direction: column;
  overflow: hidden
}

.cart-pane {
  background: linear-gradient(165deg, var(--surface), color-mix(in srgb, var(--surface) 96%, var(--brand) 4%));
  border-left: 1px solid var(--line);
  box-shadow: -16px 0 44px -36px rgba(10, 30, 22, .5);
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 14px
}

/* Search + filters */
.search-row,
.filter-row {
  display: flex;
  gap: 10px;
  flex-shrink: 0
}

.search-box {
  height: 48px;
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0 14px;
  box-shadow: 0 6px 20px rgba(20, 60, 45, .06);
  transition: border-color .15s ease, box-shadow .15s ease
}

.search-box:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 14%, transparent)
}

.search-box>span {
  color: var(--muted);
  display: flex
}

.search-box:focus-within>span {
  color: var(--brand)
}

.search-box input {
  border: 0;
  outline: 0;
  background: transparent;
  min-width: 0;
  flex: 1;
  font-size: 14px
}

.search-box kbd,
.customer-card kbd,
.checkout-actions kbd,
.payment-modal kbd {
  font-size: 9px;
  padding: 3px 5px;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--muted);
  background: var(--surface-2);
  box-shadow: none
}

.secondary,
.primary {
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 10px 16px;
  background: var(--surface);
  font-weight: 700;
  font-size: 13px;
  transition: border-color .15s ease, color .15s ease, transform .1s ease
}

.secondary:active {
  transform: scale(.98)
}

.primary {
  background: linear-gradient(145deg, var(--brand), var(--brand-2));
  border: 0;
  color: #fff;
  box-shadow: 0 10px 24px -12px color-mix(in srgb, var(--brand) 65%, transparent)
}

.primary:hover {
  background: linear-gradient(145deg, var(--brand-2), var(--brand));
  transform: translateY(-1px);
  box-shadow: 0 14px 30px -12px color-mix(in srgb, var(--brand) 65%, transparent)
}

.primary:active {
  transform: translateY(0)
}

.wide {
  width: 100%
}

.filter-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(230px, .72fr);
  align-items: center;
  gap: 10px;
  padding: 12px 1px;
  overflow: visible
}

.filter-row>* {
  min-width: 0;
  width: 100%
}

/* Unified premium form controls */
.filter-row select,
.sale-extras input,
.sale-extras select,
.modal-search input,
.quick-form input,
.payment-inputs input,
.line-controls input,
.line-controls select,
.joined select {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 10px;
  padding: 10px 12px;
  outline: none;
  font-size: 13px;
  transition: border-color .15s ease, box-shadow .15s ease;
  min-width: 0
}

.filter-row select,
.line-controls select {
  padding-right: 26px;
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236c7b75' stroke-width='2.4' stroke-linecap='round'><path d='m6 9 6 6 6-6'/></svg>");
  background-repeat: no-repeat;
  background-position: right 7px center;
  background-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden
}

.filter-row select:focus,
.sale-extras input:focus,
.sale-extras select:focus,
.modal-search input:focus,
.quick-form input:focus,
.payment-inputs input:focus,
.line-controls input:focus,
.line-controls select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 16%, transparent)
}

.price-toggle {
  display: flex;
  padding: 3px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 11px
}

.price-toggle button {
  flex: 1
}

.price-toggle button {
  border: 0;
  background: transparent;
  border-radius: 8px;
  padding: 7px 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600
}

.price-toggle button.active {
  background: var(--accent);
  color: var(--brand);
  font-weight: 700
}

.pricing-filter {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0
}

.pricing-filter .price-toggle {
  flex: 1;
  min-width: 0
}

.result-count {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap
}

.filter-row .select2-container {
  font-size: 13px;
  min-width: 0 !important;
  max-width: 100%;
  width: 100% !important
}

.filter-row .select2-container .select2-selection--single {
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  outline: 0
}

.filter-row .select2-container .select2-selection--single .select2-selection__rendered {
  height: 38px;
  line-height: 38px;
  padding-left: 12px;
  padding-right: 34px;
  color: var(--text)
}

.filter-row .select2-container .select2-selection--single .select2-selection__placeholder {
  color: var(--muted)
}

.filter-row .select2-container .select2-selection--single .select2-selection__arrow {
  height: 38px;
  right: 6px
}

.filter-row .select2-container--focus .select2-selection--single,
.filter-row .select2-container--open .select2-selection--single {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 16%, transparent)
}

.select2-dropdown {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
  overflow: hidden
}

.select2-search--dropdown {
  padding: 8px
}

.select2-search--dropdown .select2-search__field {
  border: 1px solid var(--line) !important;
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text);
  padding: 8px 10px
}

.select2-results__option {
  padding: 8px 11px;
  font-size: 12px
}

.select2-container--default .select2-results__option--highlighted[aria-selected] {
  background: var(--brand);
  color: #fff
}

.select2-container--default .select2-results__option[aria-selected=true] {
  background: var(--accent);
  color: var(--brand)
}

[data-theme=dark] .select2-container--default .select2-selection--single .select2-selection__clear {
  color: var(--muted)
}

/* Product grid */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(185px, 1fr));
  gap: 12px;

  overflow-y: auto;
  overflow-x: hidden;

  padding: 10px 10px 20px;
  flex: 1;
  min-height: 0;

  /* Important */
  grid-auto-rows: max-content;
  align-items: stretch;
}


.product-card {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  padding: 13px;
  padding-bottom: 46px;
  min-height: 175px;
  height: auto;
  display: flex;
  flex-direction: column;
  align-self: start;
  cursor: pointer;
  /* Important */
  transform: none;
  box-shadow: 0 3px 12px -8px rgba(20, 60, 45, .18);
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease
}


.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(165px, 1fr));
  /* max-content, not auto: with auto the browser squeezed every row to the
     card's minimum height and long names pushed the price out of the card. */
  grid-auto-rows: max-content;
  gap: 12px;
  padding: 10px;
  overflow-y: auto;
  align-content: start;
}

.product-card {
  position: relative;
  width: 100%;
  /* Grow with the content: a two-line name plus a Bengali line was taller
     than a fixed-height card and pushed the price outside it. */
  height: auto;
  align-self: stretch;
  min-height: 185px;
  box-sizing: border-box;
  padding: 13px 13px 54px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}

.product-card:hover {
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--brand) 55%, var(--line));
  box-shadow: var(--shadow)
}

.product-top {
  display: flex;
  justify-content: space-between;
  gap: 8px
}

.product-symbol {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  border-radius: 13px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, var(--brand), var(--brand-2));
  color: #fff;
  font-size: 16px;
  font-weight: 800;
  box-shadow: 0 6px 16px -7px color-mix(in srgb, var(--brand) 65%, transparent)
}

.product-card:hover .product-symbol {
  box-shadow: 0 8px 20px -6px color-mix(in srgb, var(--brand) 70%, transparent)
}

.stock-pill {
  height: 24px;
  padding: 4px 9px;
  border-radius: 20px;
  background: var(--accent);
  color: var(--brand);
  font-size: 10px;
  font-weight: 700;
  box-shadow: 0 2px 8px -3px rgba(20, 122, 84, .35);
  white-space: nowrap
}

.stock-pill.out {
  background: color-mix(in srgb, var(--danger) 12%, var(--surface));
  color: var(--danger);
  box-shadow: 0 2px 8px -3px rgba(194, 59, 71, .3)
}

.product-card h3 {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
  margin: 12px 0 3px;
  line-height: 1.35
}

.product-card .bn {
  font-size: 11.5px;
  color: var(--muted);
  min-height: 15px
}

.product-footer {
  display: flex;
  align-items: end;
  margin-top: auto;
  padding-top: 10px
}

.product-price {
  padding-right: 42px
}

.product-price strong {
  display: block;
  font-size: 16px;
  font-weight: 800
}

.product-price strong.not-priced {
  color: var(--warning);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .01em
}

.product-price small,
.product-meta {
  color: var(--muted);
  font-size: 10px
}

.add-button {
  position: absolute;
  right: 12px;
  bottom: 12px;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  display: grid;
  place-items: center;
  transition: background .15s ease, transform .12s ease, box-shadow .15s ease;
  box-shadow: 0 6px 16px -6px color-mix(in srgb, var(--brand) 60%, transparent)
}

.add-button:hover {
  background: var(--brand-2);
  transform: scale(1.08)
}

.add-button:active {
  transform: scale(.94)
}

.product-grid.list-mode {
  display: block
}

.list-mode .product-card {
  min-height: 64px;
  margin-bottom: 7px;
  padding-bottom: 13px;
  display: grid;
  grid-template-columns: 52px minmax(180px, 1fr) 150px 40px;
  align-items: center
}

.list-mode .product-card h3 {
  margin: 0
}

.list-mode .product-top {
  display: contents
}

.list-mode .product-footer {
  display: contents
}

.list-mode .add-button {
  position: static
}

.list-mode .product-price {
  padding-right: 0
}

.state-panel {
  flex: 1;
  display: grid;
  place-content: center;
  place-items: center;
  color: var(--muted);
  text-align: center
}

.state-panel h3 {
  color: var(--text);
  margin: 10px 0 2px
}

.state-icon {
  font-size: 34px
}

.spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--line);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin .8s linear infinite
}

@keyframes spin {
  to {
    transform: rotate(360deg)
  }
}

/* Cart pane */
.customer-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(135deg, var(--surface-2), var(--surface));
  cursor: pointer;
  transition: border-color .15s ease, box-shadow .15s ease
}

.customer-card:focus,
.customer-card:hover {
  outline: 0;
  border-color: var(--brand);
  box-shadow: 0 6px 18px -10px color-mix(in srgb, var(--brand) 45%, transparent)
}

.customer-avatar {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  border-radius: 12px;
  background: var(--accent);
  color: var(--brand);
  display: grid;
  place-items: center;
  box-shadow: inset 0 0 0 1px rgba(20, 122, 84, .12)
}

.customer-main {
  min-width: 0;
  display: grid;
  flex: 1
}

.customer-main small {
  color: var(--muted);
  font-size: 10px;
  display: flex;
  justify-content: space-between
}

.customer-main strong {
  font-size: 13px;
  font-weight: 700;
  margin: 2px 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis
}

.customer-main span {
  font-size: 10px;
  color: var(--muted)
}

.customer-card .chevron {
  color: var(--muted);
  display: flex
}

.cart-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 3px 9px
}

.cart-heading h2 {
  font-size: 15px
}

.cart-heading span {
  color: var(--muted);
  font-size: 10px
}

.text-danger {
  border: 0;
  background: transparent;
  color: var(--danger);
  font-size: 11px;
  font-weight: 600
}

.cart-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column
}

.cart-lines {
  flex-shrink: 0
}

.cart-line {
  border-top: 1px solid var(--line);
  padding: 10px 2px
}

.line-head {
  display: flex;
  justify-content: space-between;
  gap: 10px
}

.line-head strong {
  font-size: 12px;
  font-weight: 700
}

.line-head button {
  border: 0;
  background: transparent;
  color: var(--muted)
}

.line-controls {
  display: grid;
  grid-template-columns: 82px 100px 1fr 70px;
  gap: 6px;
  margin-top: 8px
}

.line-controls input,
.line-controls select {
  width: 100%;
  background: var(--surface-2);
  padding: 7px;
  font-size: 11px
}

.line-controls label {
  font-size: 9px;
  color: var(--muted)
}

.line-controls label>* {
  display: block;
  margin-top: 3px
}

.line-total {
  display: flex;
  justify-content: space-between;
  margin-top: 7px;
  font-size: 11px;
  color: var(--muted)
}

.line-total b {
  color: var(--text)
}

.cart-empty {
  flex: 1;
  display: grid;
  place-content: center;
  text-align: center;
  color: var(--muted)
}

.cart-empty span {
  display: inline-grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--brand);
  margin: 0 auto 6px
}

.cart-empty h3 {
  color: var(--text);
  font-size: 14px;
  margin: 9px 0 2px
}

.cart-empty p {
  font-size: 11px
}

.sale-extras {
  border-top: 1px solid var(--line);
  padding-top: 9px;
  margin-top: 4px;
  flex-shrink: 0
}

.inline-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px
}

.sale-extras label {
  color: var(--muted);
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em
}

.sale-extras input,
.sale-extras select {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 8px
}

.joined {
  display: flex
}

.joined select {
  width: 48px;
  border-radius: 9px 0 0 9px;
  padding-left: 8px;
  padding-right: 22px;
  background-position: right 5px center
}

.joined input {
  border-radius: 0 9px 9px 0
}

.sale-extras details {
  font-size: 11px;
  color: var(--muted);
  margin-top: 9px;
  font-weight: 600
}

.sale-extras summary {
  cursor: pointer;
  padding: 4px 0
}

.sale-extras textarea {
  width: 100%;
  height: 48px;
  margin-top: 6px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  resize: none;
  font-size: 12px;
  transition: border-color .15s ease, box-shadow .15s ease
}

.sale-extras textarea:focus {
  outline: 0;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 16%, transparent)
}

.totals-panel {
  border-top: 1px solid var(--line);
  padding: 9px 2px 0;
  flex: 0 0 auto
}

.totals-panel>div {
  display: flex;
  justify-content: space-between;
  padding: 3px 0;
  color: var(--muted);
  font-size: 11px
}

.totals-panel strong {
  color: var(--text);
  font-weight: 700
}

.totals-panel .grand {
  align-items: end;
  margin-top: 6px;
  padding: 10px;
  border-radius: 12px;
  background: linear-gradient(120deg, var(--accent), transparent);
  color: var(--text);
  font-size: 14px
}

.totals-panel .grand strong {
  font-size: 23px;
  font-weight: 800;
  letter-spacing: -.045em
}

.checkout-actions {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 8px;
  margin-top: 8px;
  flex: 0 0 auto
}

.checkout-actions button {
  display: flex;
  align-items: center;
  justify-content: space-between
}

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(5, 13, 10, .55);
  backdrop-filter: blur(4px);
  z-index: 20
}

.pos-modal {
  position: fixed;
  z-index: 21;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(680px, calc(100vw - 28px));
  max-height: calc(100vh - 28px);
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: 0 32px 110px rgba(0, 0, 0, .4);
  padding: 22px
}

.pos-modal>header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px
}

.pos-modal h2 {
  margin: 2px 0 16px;
  font-size: 22px
}

.kicker {
  margin: 0;
  color: var(--brand);
  font-weight: 800;
  font-size: 9.5px;
  letter-spacing: .14em;
  text-transform: uppercase
}

.modal-close {
  border: 0;
  background: var(--surface-2);
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border-radius: 10px;
  font-size: 20px;
  line-height: 1;
  transition: background .15s ease, color .15s ease
}

.modal-close:hover {
  background: color-mix(in srgb, var(--danger) 14%, var(--surface-2));
  color: var(--danger)
}

.modal-search {
  display: flex;
  gap: 8px
}

.modal-search input {
  flex: 1;
  min-width: 0;
  height: 44px
}

.modal-search .secondary {
  white-space: nowrap
}

.quick-form {
  padding: 14px 0 4px;
  display: grid;
  gap: 10px
}

.quick-form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px
}

.customer-results,
.held-results {
  display: grid;
  gap: 8px;
  margin-top: 14px;
  max-height: min(52vh, 420px);
  overflow-y: auto;
  padding-right: 2px
}

.customer-option,
.held-option {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 11px 13px;
  background: var(--surface-2);
  width: 100%;
  text-align: left;
  transition: border-color .15s ease, box-shadow .15s ease
}

.customer-option {
  cursor: pointer
}

.customer-option:hover,
.held-option:hover {
  border-color: var(--brand);
  box-shadow: 0 6px 16px -10px color-mix(in srgb, var(--brand) 45%, transparent)
}

.customer-option .customer-avatar,
.held-option .customer-avatar {
  width: 36px;
  height: 36px;
  font-weight: 700;
  flex: 0 0 auto
}

.customer-option .details,
.held-option .details {
  display: grid;
  flex: 1;
  text-align: left;
  min-width: 0
}

.customer-option .details strong,
.held-option .details strong {
  font-weight: 700
}

.customer-option small,
.held-option small {
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis
}

.due-chip {
  padding: 5px 9px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--warning) 12%, var(--surface));
  color: var(--warning);
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap
}

.payment-modal {
  width: min(940px, calc(100vw - 28px))
}

.payment-layout {
  display: grid;
  grid-template-columns: 1fr 270px;
  gap: 18px
}

.amount-due {
  display: flex;
  align-items: end;
  justify-content: space-between;
  background: var(--accent);
  padding: 16px;
  border-radius: 14px
}

.amount-due strong {
  font-size: 25px;
  font-weight: 800
}

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

.payment-method {
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 12px;
  background: var(--surface-2);
  display: grid;
  grid-template-columns: 170px 1fr;
  gap: 10px;
  transition: border-color .15s ease
}

.payment-method:hover {
  border-color: color-mix(in srgb, var(--brand) 40%, var(--line))
}

.method-name {
  display: flex;
  align-items: center;
  gap: 9px
}

.method-name>span {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: var(--brand);
  border-radius: 10px;
  font-weight: 700
}

.method-name div {
  display: grid
}

.method-name strong {
  font-weight: 700
}

.method-name small {
  color: var(--muted);
  font-size: 9px
}

.payment-inputs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px
}

.payment-inputs label {
  font-size: 8px;
  color: var(--muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .03em
}

.payment-inputs input {
  width: 100%;
  padding: 8px;
  margin-top: 3px;
  font-size: 11px
}

.payment-summary {
  background: var(--surface-2);
  border-radius: 15px;
  padding: 14px
}

.payment-summary>div {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  padding: 5px
}

.payment-summary .change {
  font-size: 15px;
  color: var(--brand);
  font-weight: 700
}

.credit-warning {
  display: block !important;
  margin: 8px 0;
  padding: 9px !important;
  border-radius: 9px;
  background: var(--accent);
  color: var(--muted);
  font-size: 10px !important
}

.keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
  margin: 10px 0
}

.keypad button {
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  font-weight: 600;
  transition: border-color .15s ease, background .15s ease, transform .1s ease
}

.keypad button:hover {
  border-color: var(--brand);
  color: var(--brand)
}

.keypad button:active {
  transform: scale(.95)
}

.payment-summary>.keypad {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
  margin: 10px 0
}

.payment-summary>.keypad button {
  min-width: 0
}

.success-modal {
  text-align: center;
  width: min(500px, calc(100vw - 28px))
}

.success-icon {
  margin: 5px auto 10px;
  width: 60px;
  height: 60px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: var(--brand);
  box-shadow: 0 10px 26px -10px color-mix(in srgb, var(--brand) 60%, transparent)
}

.success-totals {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 16px 0
}

.success-totals>div {
  background: var(--surface-2);
  padding: 10px;
  border-radius: 11px;
  display: grid
}

.success-totals span {
  font-size: 9px;
  color: var(--muted)
}

.success-actions {
  display: flex;
  justify-content: center;
  gap: 7px
}

.success-actions a {
  text-decoration: none
}

.toast-region {
  position: fixed;
  right: 18px;
  top: 78px;
  z-index: 40;
  display: grid;
  gap: 7px
}

.toast {
  min-width: 280px;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--brand);
  border-radius: 11px;
  padding: 12px 13px;
  box-shadow: var(--shadow);
  font-size: 12px
}

.toast.error {
  border-left-color: var(--danger)
}

/* Login */
.login-body {
  background: radial-gradient(circle at 20% 15%, rgba(32, 169, 114, .14), transparent 35rem), var(--bg)
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-content: center;
  gap: 18px;
  width: min(420px, calc(100% - 30px));
  margin: auto
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 30px;
  box-shadow: var(--shadow)
}

.login-card h1 {
  margin: 5px 0 22px;
  font-size: 28px
}

.login-card label {
  display: grid;
  gap: 7px;
  margin: 13px 0;
  font-size: 11px;
  color: var(--muted);
  font-weight: 600
}

.login-card input {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
  transition: border-color .15s ease, box-shadow .15s ease
}

.login-card input:focus {
  outline: 0;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 16%, transparent)
}

.alert.error {
  padding: 10px;
  background: color-mix(in srgb, var(--danger) 12%, var(--surface));
  color: var(--danger);
  border-radius: 10px;
  font-size: 11px
}

@media(max-width:1080px) {
  .pos-workspace {
    grid-template-columns: minmax(0, 1fr) 380px
  }

  .brand-lockup {
    min-width: 180px
  }

  .product-grid {
    grid-template-columns: repeat(auto-fill, minmax(165px, 1fr))
  }

  .line-controls {
    grid-template-columns: 70px 90px 1fr 60px
  }
}

@media(max-width:820px) {
  .pos-body {
    overflow: auto
  }

  .pos-app {
    height: auto;
    min-height: 100vh
  }

  .pos-header {
    position: sticky;
    top: 0
  }

  .brand-lockup {
    min-width: 0
  }

  .brand-lockup div {
    display: none
  }

  .cart-tabs {
    display: none
  }

  .pos-workspace {
    display: block
  }

  .catalog-pane {
    height: 56vh
  }

  .cart-pane {
    min-height: 70vh;
    border-left: 0;
    border-top: 1px solid var(--line)
  }

  .payment-layout {
    grid-template-columns: 1fr
  }

  .payment-summary {
    position: sticky;
    bottom: 0
  }

  .payment-modal {
    top: 8px;
    transform: translateX(-50%);
    max-height: calc(100vh - 16px)
  }

  .quick-form-grid {
    grid-template-columns: 1fr 1fr
  }

  .list-mode .product-card {
    grid-template-columns: 48px 1fr 100px
  }

  .list-mode .stock-pill {
    display: none
  }

  .filter-row {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr)
  }

  .pricing-filter {
    grid-column: 1/-1
  }
}

@media(max-width:560px) {
  html,
  body {
    max-width: 100%;
    overflow-x: hidden
  }

  .pos-header {
    padding: 0 10px;
    gap: 8px
  }

  .header-actions .labeled span {
    display: none
  }

  /* No room for words on a phone: show a picture instead */
  .header-actions .labeled .btn-ico {
    display: block
  }

  .header-actions .labeled {
    position: relative;
    justify-content: center;
    padding: 0
  }

  .header-actions .labeled b {
    position: absolute;
    top: -5px;
    right: -5px
  }

  .catalog-pane {
    padding: 10px
  }

  .filter-row {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 7px;
    padding: 10px 0 8px
  }

  .filter-row .select2-container,
  .filter-row select {
    width: 100% !important;
    min-width: 0;
    max-width: 100%
  }

  .price-toggle {
    padding: 2px
  }

  .price-toggle button {
    padding: 7px 9px;
    font-size: 11px;
    white-space: nowrap
  }

  .pricing-filter {
    grid-column: 1/-1
  }

  .result-count {
    display: block
  }

  .product-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr))
  }

  .product-card {
    min-height: 156px;
    padding: 10px;
    padding-bottom: 44px
  }

  .cart-pane {
    padding: 10px
  }

  .payment-method {
    grid-template-columns: 1fr
  }

  .payment-inputs {
    grid-template-columns: 1fr 1fr
  }

  .success-actions {
    display: grid
  }

  .modal-search {
    display: grid
  }

  .quick-form-grid {
    grid-template-columns: 1fr
  }

  .search-box kbd {
    display: none
  }

  .line-controls {
    grid-template-columns: 1fr 1fr;
    row-gap: 8px
  }
}

@media(prefers-reduced-motion:reduce) {
  * {
    transition: none !important;
    animation: none !important
  }
}

.product-photo {
  object-fit: cover;
  background: var(--surface, #fff)
}
/* The nav drawer now renders the shared admin link list
   (management/_nav_links.html) instead of five hand-written links, so it
   needs the section headings and plain text links that list uses. */
.nav-drawer-links label{display:block;margin:14px 0 6px;padding:0 4px;font-size:9px;font-weight:800;letter-spacing:.14em;color:var(--muted,#7c8a84);text-transform:uppercase}
.nav-drawer-links label:first-child{margin-top:4px}
.nav-drawer-links a{display:block;padding:9px 10px;border-radius:9px;font-size:12.5px;font-weight:600;text-decoration:none;color:inherit}
.nav-drawer-links a:hover{background:rgba(127,127,127,.12)}
.nav-drawer-links a.active{background:var(--brand,#147a54);color:#fff;font-weight:700}

/* Counter operations: collecting a due and counting the drawer, both of
   which used to mean leaving the till for the admin. */
.counter-form{display:grid;gap:12px;padding:16px}
.counter-form label{display:grid;gap:5px;font-size:11px;font-weight:700;letter-spacing:.02em}
.counter-form input,.counter-form select{padding:11px 12px;border:1px solid var(--line,#d8e2dd);border-radius:10px;background:var(--surface,#fff);color:inherit;font:inherit;font-size:14px}
.counter-selected{margin:0;font-size:12.5px;color:var(--muted,#7c8a84)}
.counter-actions{display:flex;gap:10px;justify-content:flex-end;margin-top:4px}
.counter-actions button{padding:11px 18px;border-radius:10px;border:0;font-weight:800;font-size:12px;cursor:pointer}
.counter-actions .secondary{background:transparent;border:1px solid var(--line,#d8e2dd);color:inherit}
.counter-actions .primary{background:var(--brand,#147a54);color:#fff}
.counter-error{margin:0;color:var(--danger,#c84450);font-size:12px}
.counter-error.hidden,.counter-form.hidden{display:none}
.drawer-totals{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin:0 0 4px}
.drawer-totals div{padding:11px 12px;border:1px solid var(--line,#d8e2dd);border-radius:10px}
.drawer-totals span{display:block;font-size:10px;color:var(--muted,#7c8a84)}
.drawer-totals strong{font-size:17px}
.drawer-note{margin:0;font-size:11.5px;color:var(--muted,#7c8a84);line-height:1.6}
.drawer-warn{color:var(--danger,#c84450);font-weight:700}

/* Result rows in the counter modals (collect a due, held carts). */
.held-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 12px 14px;
  background: var(--surface-2);
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color .15s ease, box-shadow .15s ease
}

.held-row:hover,
.held-row:focus-visible {
  border-color: var(--brand);
  box-shadow: 0 6px 16px -10px color-mix(in srgb, var(--brand) 45%, transparent);
  outline: none
}

.held-row > div {
  display: grid;
  gap: 2px;
  min-width: 0
}

.held-row strong {
  font-size: 15px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap
}

.held-row small {
  color: var(--muted, #6b7280);
  font-size: 12.5px
}

.held-row > b {
  flex: 0 0 auto;
  font-size: 15px;
  font-variant-numeric: tabular-nums
}
