/* KBGC Bar POS — Square-style iPad UI */

:root {
  --bg: #000000;
  --bg-elevated: #141414;
  --bg-bill: #1a1a1a;
  --bg-nav: #0d0d0d;
  --text: #ffffff;
  --text-muted: #9a9a9a;
  --text-dim: #6b6b6b;
  --border: #2a2a2a;
  --pay-blue: #2f6fed;
  --pay-blue-press: #255dcc;
  --nav-active: #3b82f6;
  --radius: 12px;
  --radius-sm: 10px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --status-h: 36px;
  --nav-h: 56px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display",
    "Helvetica Neue", Helvetica, Arial, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
  max-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

/* Lock document so only inner panels scroll (iOS / PWA rubber-band) */
html,
body {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

button {
  font-family: inherit;
  border: none;
  background: none;
  color: inherit;
  cursor: pointer;
  padding: 0;
}

img {
  display: block;
  max-width: 100%;
}

/* ——— App shell ——— */
.pos-app {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  max-height: 100%;
  overflow: hidden;
  background: var(--bg);
  padding-top: var(--safe-top);
  padding-bottom: var(--safe-bottom);
}

/* ——— Status bar (server + printer) ——— */
.status-bar {
  flex: 0 0 var(--status-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 16px;
  font-size: 13px;
  color: var(--text);
  background: var(--bg);
}

.status-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 10px 0 6px;
  margin-left: -6px;
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  flex-shrink: 0;
}

.status-back-btn[hidden] {
  display: none !important;
}

.status-back-btn i {
  font-size: 12px;
  color: var(--text-muted);
}

.status-back-btn:active {
  background: rgba(255, 255, 255, 0.08);
}

.status-right {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-left: auto;
  flex-shrink: 0;
}

.status-server-wrap,
.status-printer-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-server,
.status-printer {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}

.status-server.is-disconnected {
  color: #ff6b6b;
}

.status-icon {
  font-size: 14px;
  line-height: 1;
  width: auto;
  height: auto;
}

/* ——— Main split ——— */
.pos-main {
  flex: 1;
  display: flex;
  min-height: 0;
  overflow: hidden;
  gap: 10px;
  padding: 0 10px 8px;
}

.pos-main[hidden] {
  display: none !important;
}

/* ——— Menu pane ——— */
.menu-pane {
  flex: 1 1 65%;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: hidden;
  /* Clip rubber-band paint without creating a second scrollport */
  isolation: isolate;
}

.menu-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 4px 0;
}

.menu-title {
  margin: 0;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  border-bottom: 3px solid #fff;
  padding-bottom: 2px;
  line-height: 1.1;
}

.menu-header-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

/* PC Sell (`/pos/pc` only — not applied on /pos): wider bill + larger type */
.pos-pc {
  --nav-h: 64px;
  font-size: 16px;
}

.pos-pc .pos-main {
  gap: 12px;
}

.pos-pc .menu-pane {
  flex: 1 1 50%;
  min-width: 0;
}

.pos-pc .bill-pane {
  flex: 0 0 46%;
  width: 46%;
  max-width: none;
  min-width: 420px;
}

.pos-pc .menu-title {
  font-size: 32px;
}

.pos-pc .cat-tile .cat-name {
  font-size: 22px;
}

.pos-pc .item-card .item-name {
  font-size: 22px;
}

.pos-pc .item-card .item-price {
  font-size: 15px;
}

.pos-pc .item-card.coupon .item-price {
  font-size: 16px;
}

.pos-pc .bill-title {
  font-size: 30px;
}

.pos-pc .bill-tab {
  font-size: 17px;
}

.pos-pc .pay-btn {
  font-size: 20px;
}

.pos-pc .pay-btn.secondary {
  font-size: 18px;
}

.pos-pc .bottom-nav {
  font-size: 16px;
}

.pos-pc .nav-item {
  font-size: 13px;
  gap: 4px;
}

.pos-pc .nav-item i {
  font-size: 22px;
}

.pos-pc .nav-item .nav-icon-svg {
  width: 22px;
  height: 22px;
}

.pos-pc .modal-card {
  width: min(480px, 100%);
  padding: 32px 28px 24px;
}

.pos-pc .modal-title {
  font-size: 17px;
}

.pos-pc .dialog-card .modal-title {
  font-size: 20px;
}

.pos-pc .dialog-message {
  font-size: 17px;
}

.pos-pc .modal-btn {
  height: 52px;
  font-size: 18px;
}

.pos-pc .send-card .modal-btn {
  min-height: 50px;
  font-size: 16px;
}

.pos-pc .send-card .pay-header .modal-title,
.pos-pc .pay-header .modal-title {
  font-size: 16px;
}

.pos-pc .scan-header .modal-title,
.pos-pc .assign-card .pay-header .modal-title {
  font-size: 20px;
}

.pos-pc .scan-actions .modal-btn {
  height: 48px;
  font-size: 16px;
}

.pos-pc .assign-lead {
  font-size: 16px;
}

.icon-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--text);
}

.icon-btn:active {
  background: rgba(255, 255, 255, 0.08);
}

.icon-btn.is-active {
  background: #34A853;
  color: #fff;
}

.icon-btn i {
  font-size: 18px;
  line-height: 1;
}

.discounts-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm, 12px);
  background: rgba(52, 168, 83, 0.18);
  border: 1px solid rgba(52, 168, 83, 0.45);
  color: #7dcea0;
  flex-shrink: 0;
}

.discounts-banner[hidden] {
  display: none !important;
}

.discounts-banner-text {
  font-size: 15px;
  font-weight: 600;
}

.discounts-done-btn {
  border: 1px solid #34A853;
  background: transparent;
  color: #7dcea0;
  border-radius: 8px;
  padding: 6px 12px;
  font-weight: 700;
  min-height: 36px;
  cursor: pointer;
}

.discounts-done-btn:active {
  background: rgba(52, 168, 83, 0.2);
}

.item-card.coupon {
  min-height: 120px;
  background: #1e3a2f;
  border-width: 2px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: stretch;
}

.item-card.coupon .item-meta {
  position: relative;
  padding: 14px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Photo tiles pin price absolutely; coupons stack name + price in flow */
.item-card.coupon .item-price {
  position: static;
  left: auto;
  bottom: auto;
  color: #7dcea0;
  font-size: 14px;
  font-weight: 600;
}

.bill-line.is-coupon .bill-line-price {
  color: #7dcea0;
}

/* Category tabs — wide, scrollable folder tabs (our colors, no selection frame) */
.category-grid[hidden] {
  display: none !important;
}

.category-grid {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: flex-end;
  gap: 0;
  flex: 0 0 auto;
  width: 100%;
  min-height: 52px;
  padding: 0 2px;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: auto;
  overscroll-behavior: none;
  scrollbar-width: none;
  border-bottom: 1px solid var(--border);
  touch-action: pan-x;
}

.category-grid::-webkit-scrollbar {
  display: none;
}

.cat-tile {
  flex: 0 0 auto;
  width: 148px;
  min-width: 148px;
  height: 48px;
  margin: 0 -2px 0 0;
  padding: 8px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  position: relative;
  overflow: hidden;
  border: none;
  border-radius: 14px 14px 0 0;
  box-shadow: none;
  outline: none;
  z-index: 1;
  transition: opacity 0.12s ease;
}

.cat-tile:active {
  opacity: 0.92;
}

/* Active = brighter only — keep same tab height/width */
.cat-tile.active {
  z-index: 3;
  opacity: 1;
  border: none;
  box-shadow: none;
  outline: none;
}

.cat-tile.dimmed {
  opacity: 0.5;
  z-index: 0;
}

.cat-tile .cat-name {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.1;
  color: #fff;
  white-space: nowrap;
}

.cat-tile .cat-count {
  display: none;
}

.cat-tile.dark-text .cat-name,
.cat-tile.dark-text .cat-count,
.cat-tile.dark-text .cat-icon {
  color: #1a1a1a;
}

.cat-tile .cat-icon {
  display: none;
}

/*
 * Custom translate scroll (not native overflow).
 * iPad native overflow rubber-band was sticking the product pane on fast reverse.
 */
.item-scroll {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  touch-action: none;
  overscroll-behavior: none;
}

.item-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: minmax(120px, auto);
  gap: 8px;
  padding-bottom: 4px;
  overflow: visible;
  will-change: transform;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.item-card {
  position: relative;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #111;
  min-height: 120px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: left;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
  /* No filter here — filter inside -webkit-overflow-scrolling shifts/blurs text on iPad */
  transition: transform 0.07s ease;
  border: 2px solid rgba(255, 255, 255, 0.16);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.item-card::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 3;
  background: rgba(255, 255, 255, 0);
  pointer-events: none;
  transition: background 0.07s ease;
}

/* .is-pressed via pointerdown — :active alone feels dead on iPad */
.item-card:active,
.item-card.is-pressed {
  transform: scale(0.94);
}

.item-card:active::after,
.item-card.is-pressed::after {
  background: rgba(255, 255, 255, 0.14);
}

.item-card.tall,
.item-card.wide,
.item-card.cocktail {
  grid-row: span 1;
  min-height: 120px;
}

.item-card.cocktail {
  background: #161616;
}

.item-card .item-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #1a1a1a;
  /* Dim photo — opacity only (no CSS filter; cheaper while scrolling) */
  opacity: 0.26;
}

.item-card .item-gradient {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.92) 0%,
    rgba(0, 0, 0, 0.55) 48%,
    rgba(0, 0, 0, 0.32) 100%
  );
  pointer-events: none;
}

.item-card .item-meta {
  z-index: 1;
  padding: 12px 14px 28px;
  width: 100%;
}

.item-card .item-name {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.2;
  color: #fff;
  letter-spacing: -0.01em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.item-card .item-price {
  position: absolute;
  left: 14px;
  bottom: 10px;
  z-index: 2;
  margin: 0;
  font-size: 12px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.72);
  line-height: 1;
}

/* Cocktail tiles use the same dim full-bleed look — no circular thumb */
.item-card.cocktail .item-thumb-wrap {
  display: none;
}

.item-card.cocktail .item-img {
  opacity: 0.26;
}

.item-card.cocktail .item-gradient {
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.92) 0%,
    rgba(0, 0, 0, 0.55) 48%,
    rgba(0, 0, 0, 0.32) 100%
  );
}

.item-card.cocktail .item-meta {
  padding: 12px 14px 28px;
}

.item-card.hidden {
  display: none;
}

/* ——— Bill pane ——— */
.bill-pane {
  flex: 0 0 32%;
  max-width: 360px;
  min-width: 280px;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg-bill);
  border-radius: 16px;
  overflow: hidden;
}

.bill-header {
  padding: 16px 18px 0;
}

.bill-title {
  margin: 0 0 12px;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.bill-header:has(.bill-subtitle:not([hidden])) .bill-title {
  margin-bottom: 4px;
}

.bill-subtitle {
  margin: 0 0 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
}

.bill-subtitle[hidden] {
  display: none;
}

.bill-tabs {
  display: flex;
  gap: 20px;
  border-bottom: 1px solid var(--border);
}

.bill-tab {
  padding: 10px 0;
  font-size: 15px;
  font-weight: 500;
  color: var(--text-muted);
  position: relative;
}

.bill-tab.active {
  color: var(--text);
  font-weight: 600;
}

.bill-tab.active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  background: #fff;
  border-radius: 2px 2px 0 0;
}

.bill-body {
  flex: 1;
  min-height: 0;
  overflow-y: scroll;
  overflow-x: hidden;
  padding: 8px 0;
  -webkit-overflow-scrolling: auto;
  overscroll-behavior: none;
  overscroll-behavior-y: none;
  touch-action: pan-y;
  scrollbar-width: thin;
}

.bill-panel {
  display: none;
  flex-direction: column;
}

.bill-panel.active {
  display: flex;
}

.bill-panel[hidden] {
  display: none !important;
}

.bill-lines {
  display: flex;
  flex-direction: column;
}

.bill-section-hr {
  display: block;
  width: calc(100% - 36px);
  margin: 10px 18px;
  border: 0;
  border-top: 1px solid #3a3a3a;
  height: 0;
}

.bill-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px 6px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text);
}

.bill-section-title::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--text-muted);
}

.bill-section.is-draft .bill-section-title {
  color: #f0c14b;
}

.bill-section.is-draft .bill-section-title::before {
  background: #f0c14b;
  box-shadow: 0 0 0 3px rgba(240, 193, 75, 0.18);
}

.bill-section.is-sent .bill-section-title {
  color: #c8c8c8;
}

.bill-section.is-sent .bill-section-title::before {
  background: #8a8a8a;
}

.bill-line-status {
  flex-shrink: 0;
  margin-left: 6px;
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.bill-line-status.draft {
  color: #f0c14b;
  background: rgba(240, 193, 75, 0.12);
}

.bill-line-status.sent {
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.06);
}

/* ——— Actions panel ——— */
.action-grid,
.action-details-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 12px 14px 8px;
}

.action-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 12px 14px;
  border-radius: 999px;
  background: #2a2a2a;
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  text-align: left;
}

.action-btn i {
  width: 18px;
  flex-shrink: 0;
  color: var(--text-muted);
  font-size: 15px;
  text-align: center;
}

.action-btn span {
  flex: 1;
  line-height: 1.2;
}

.action-btn:active:not(:disabled) {
  background: #343434;
  transform: scale(0.98);
}

.action-btn:disabled {
  opacity: 0.38;
  pointer-events: none;
}

.action-btn.danger,
.action-btn.danger i {
  color: #ff6b6b;
}

.action-btn.primary-action {
  background: #243552;
}

.action-btn.primary-action i {
  color: #8eb6ff;
}

.action-details {
  margin-top: 8px;
  padding-top: 4px;
  border-top: 1px solid var(--border);
}

.action-details-title {
  margin: 0;
  padding: 12px 18px 4px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

/* ——— Member panel ——— */
.member-bound {
  padding: 12px 14px 4px;
}

.member-bound-heading {
  margin-bottom: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.member-bound-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.member-bound-row {
  display: flex;
  flex-direction: column;
}

.member-card {
  display: block;
  width: 100%;
  padding: 14px 16px;
  border-radius: 14px;
  background: #242424;
  text-align: left;
}

.member-card-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.member-card-top {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.member-card-main {
  flex: 1;
  min-width: 0;
  text-align: left;
  padding: 0;
  background: transparent;
}

.member-card-main:active .member-card-name {
  opacity: 0.85;
}

.member-card-name {
  font-size: 18px;
  font-weight: 700;
}

.member-card-no {
  margin-top: 4px;
  font-size: 14px;
  color: var(--text-muted);
}

.member-card-hint {
  display: block;
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-dim);
}

.member-unbind {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  min-height: 40px;
  border-radius: 10px;
  background: rgba(229, 57, 53, 0.16);
  color: #ff6b6b;
  font-size: 16px;
  display: grid;
  place-items: center;
}

.member-unbind:active {
  background: #e53935;
  color: #fff;
}

.member-search {
  padding: 12px 14px 0;
}

.member-search-label {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}

.member-search-row {
  display: flex;
  gap: 8px;
}

.member-search-input {
  flex: 1;
  min-width: 0;
  height: 44px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #121212;
  color: var(--text);
  font-size: 15px;
}

.member-search-input:focus {
  outline: none;
  border-color: #3a3a3a;
}

.member-search-btn {
  flex-shrink: 0;
  height: 44px;
  padding: 0 16px;
  border-radius: 12px;
  background: var(--pay-blue);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
}

.member-search-btn:active {
  background: var(--pay-blue-press);
}

.member-hint {
  margin: 8px 14px 0;
  font-size: 12px;
  color: var(--text-dim);
}

.member-results {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 14px 16px;
}

.member-result {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  min-height: 56px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 2px solid transparent;
  background: #242424;
  text-align: left;
}

.member-result:active:not(:disabled) {
  background: #2e2e2e;
}

.member-result.bound {
  outline: none;
  border: 2px solid #34a853;
  background: rgba(52, 168, 83, 0.12);
}

.member-result.inactive {
  opacity: 0.7;
}

.member-result:disabled {
  opacity: 0.45;
}

.member-result-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.member-result-meta {
  font-size: 13px;
  color: var(--text-muted);
}

.member-empty {
  margin: 8px 0 0;
  text-align: center;
  color: var(--text-dim);
  font-size: 14px;
}

.bill-footer[hidden] {
  display: none;
}

/* ——— Toast ——— */
.pos-toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--nav-h) + 18px);
  transform: translateX(-50%);
  z-index: 120;
  max-width: min(420px, calc(100% - 32px));
  padding: 12px 18px;
  border-radius: 12px;
  background: #2c2c2e;
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  pointer-events: none;
}

.pos-toast[hidden] {
  display: none;
}

.bill-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 18px;
  min-height: 48px;
}

/* Enter/bump baked into first paint — no transform slide (janky after full re-render) */
.bill-line.just-added {
  animation: bill-line-enter 0.18s ease-out;
}

.bill-line.qty-bumped {
  animation: bill-line-bump 0.16s ease-out;
}

.bill-line:active {
  background: rgba(255, 255, 255, 0.04);
}

.bill-line.locked {
  opacity: 0.72;
  cursor: default;
}

.bill-line.locked:active {
  background: transparent;
}

.bill-line-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.bill-line-qty {
  color: var(--text-muted);
  font-size: 14px;
  flex-shrink: 0;
}

.bill-line-name {
  font-size: 16px;
  font-weight: 400;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bill-line-price {
  font-size: 16px;
  font-weight: 400;
  flex-shrink: 0;
}

.bill-line-controls {
  display: none;
  gap: 6px;
  align-items: center;
}

.bill-line.expanded .bill-line-controls {
  display: flex;
}

.bill-line.expanded .bill-line-price {
  display: none;
}

.qty-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: #2a2a2a;
  font-size: 18px;
  line-height: 1;
  display: grid;
  place-items: center;
}

.qty-btn:active {
  background: #3a3a3a;
}

.bill-empty {
  padding: 32px 18px;
  text-align: center;
  color: var(--text-dim);
  font-size: 15px;
}

.bill-footer {
  padding: 8px 14px 14px;
  border-top: 1px solid var(--border);
}

.bill-totals {
  padding: 4px 4px 12px;
}

.total-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 4px 0;
  font-size: 15px;
}

.total-row.muted {
  color: var(--text-muted);
  font-size: 14px;
}

.total-row.total {
  font-size: 20px;
  font-weight: 700;
  margin-top: 0;
}

.pay-btn {
  width: 100%;
  height: 56px;
  border-radius: var(--radius);
  background: var(--pay-blue);
  color: #fff;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.pay-btn + .pay-btn {
  margin-top: 8px;
}

.pay-btn.secondary {
  height: 48px;
  background: #2a2a2a;
  font-size: 16px;
}

.pay-btn.secondary:active:not(:disabled) {
  background: #343434;
}

.pay-btn:active:not(.secondary) {
  background: var(--pay-blue-press);
}

.pay-btn:disabled {
  opacity: 0.4;
  pointer-events: none;
}

/* ——— Bottom nav ——— */
.bottom-nav {
  flex: 0 0 var(--nav-h);
  display: flex;
  align-items: center;
  padding: 0 16px;
  background: var(--bg-nav);
  border-top: 1px solid #1f1f1f;
  gap: 8px;
}

.nav-logout {
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  padding: 10px 8px;
  flex-shrink: 0;
}

.nav-items {
  flex: 1;
  display: flex;
  justify-content: flex-end;
  gap: 4px;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 72px;
  padding: 6px 8px;
  color: var(--text);
  font-size: 11px;
  font-weight: 500;
  border-radius: 8px;
}

.nav-item i {
  font-size: 18px;
  line-height: 1;
}

.nav-item .nav-icon-svg {
  width: 18px;
  height: 18px;
  display: block;
  flex-shrink: 0;
}

.nav-item.active {
  color: var(--nav-active);
}

.nav-item:active {
  background: rgba(255, 255, 255, 0.05);
}

/* ——— Modal ——— */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  display: grid;
  place-items: center;
  z-index: 100;
  padding: 24px;
}

.modal-overlay[hidden] {
  display: none;
}

.modal-card {
  width: min(420px, 100%);
  background: #1c1c1e;
  border-radius: 16px;
  padding: 28px 24px 20px;
  text-align: center;
}

.modal-title {
  margin: 0;
  font-size: 15px;
  font-weight: 500;
  color: var(--text-muted);
}

.modal-amount {
  margin: 12px 0 8px;
  font-size: 48px;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.modal-hint {
  margin: 0 0 24px;
  font-size: 13px;
  color: var(--text-dim);
}

.modal-actions {
  display: flex;
  gap: 10px;
}

.modal-btn {
  flex: 1;
  height: 48px;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
}

.modal-btn.ghost {
  background: #2c2c2e;
  color: #fff;
}

.modal-btn.secondary {
  background: #3a3a3c;
  color: #fff;
}

.modal-btn.primary {
  background: var(--pay-blue);
  color: #fff;
}

.modal-btn.danger {
  background: #e53935;
  color: #fff;
}

.modal-btn:active {
  opacity: 0.88;
}

/* ——— App dialog (alert / confirm) ——— */
.dialog-overlay {
  z-index: 220;
}

.dialog-card {
  width: min(420px, 100%);
  text-align: left;
}

.dialog-card .modal-title {
  margin: 0 0 10px;
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  text-align: left;
}

.dialog-message {
  margin: 0 0 22px;
  font-size: 15px;
  line-height: 1.45;
  color: var(--text-muted);
  white-space: pre-wrap;
}

.dialog-card.alert-only #appDialogCancel {
  display: none;
}

/* ——— Send to bar confirm modal ——— */
.send-overlay {
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.send-card {
  width: min(400px, 100%);
  max-height: calc(100dvh - 32px);
  padding: 14px 16px 14px;
  text-align: left;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.send-card .pay-header {
  padding: 0;
  margin-bottom: 4px;
  flex-shrink: 0;
}

.send-card .pay-close {
  width: 36px;
  height: 36px;
}

.send-lead {
  margin: 4px 0 8px;
  font-size: 17px;
  font-weight: 600;
  color: #fff;
  line-height: 1.3;
  flex-shrink: 0;
}

.send-review {
  flex: 1 1 auto;
  min-height: 160px;
  max-height: min(42vh, 320px);
  overflow-y: auto;
  margin-bottom: 12px;
  border-top: 1px solid #2e2e30;
  border-bottom: 1px solid #2e2e30;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.send-review-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  font-size: 16px;
  border-bottom: 1px solid #2a2a2c;
}

.send-review-line:last-child {
  border-bottom: 0;
}

.send-review-line-name {
  min-width: 0;
  color: #fff;
}

.send-review-line-qty {
  color: var(--text-muted);
  margin-right: 6px;
}

.send-review-line-price {
  flex-shrink: 0;
  color: var(--text-muted);
}

.send-card .send-actions {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.2fr) minmax(0, 1.2fr);
  gap: 8px;
  margin: 0;
  flex-shrink: 0;
}

.send-card .modal-btn {
  height: auto;
  min-height: 46px;
  font-size: 14px;
  line-height: 1.2;
  white-space: normal;
  padding: 8px 6px;
}

.send-card .pay-header .modal-title {
  font-size: 15px;
}

/* ——— Pay + signature modal ——— */
.pay-overlay {
  align-items: stretch;
  justify-content: center;
  padding: 20px;
}

.pay-card {
  width: min(560px, 100%);
  max-height: calc(100dvh - 40px);
  padding: 18px 20px 16px;
  text-align: left;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.pay-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.pay-header-text {
  min-width: 0;
}

.pay-header .modal-title {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.pay-step-indicator {
  margin: 4px 0 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}

.pay-close {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #2c2c2e;
  flex-shrink: 0;
}

.pay-step {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  margin: 8px 0 10px;
}

.pay-card .modal-amount {
  margin: 4px 0 4px;
  font-size: 44px;
  text-align: left;
}

.pay-member {
  margin: 0 0 12px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-muted);
}

.pay-receipt {
  padding: 16px 14px 14px;
  border-radius: 14px;
  background: linear-gradient(180deg, #f7f4ee 0%, #efe8dc 100%);
  color: #1a1a1a;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55);
}

.pay-receipt-brand {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #6b6358;
}

.pay-receipt-tab {
  margin-top: 6px;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #141414;
}

.pay-receipt-meta {
  margin-top: 4px;
  font-size: 12px;
  color: #7a7268;
}

.pay-receipt-rule {
  margin: 14px 0;
  border: 0;
  border-top: 1px dashed #c4b8a8;
}

.pay-receipt-lines {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pay-receipt-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 14px;
  line-height: 1.35;
}

.pay-receipt-line-name {
  min-width: 0;
  font-weight: 600;
}

.pay-receipt-line-qty {
  margin-right: 6px;
  color: #6b6358;
  font-weight: 600;
}

.pay-receipt-line-price {
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.pay-receipt-total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-top: 4px;
  font-size: 18px;
  font-weight: 800;
}

.pay-receipt-shares-title {
  margin: 0 0 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #6b6358;
}

.pay-receipt-share {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 0;
  font-size: 13px;
  border-top: 1px solid rgba(196, 184, 168, 0.55);
}

.pay-receipt-share:first-of-type {
  border-top: 0;
}

.pay-receipt-share-name {
  min-width: 0;
  font-weight: 600;
}

.pay-receipt-share-amt {
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.pay-confirm {
  padding: 4px 0;
}

.pay-confirm-title {
  margin: 0 0 12px;
  font-size: 16px;
  font-weight: 700;
}

.pay-confirm-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid #2e2e30;
}

.pay-confirm-row:last-child {
  border-bottom: 0;
}

.pay-confirm-name {
  font-size: 15px;
  font-weight: 600;
}

.pay-confirm-meta {
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-muted);
}

.pay-confirm-amt {
  font-size: 16px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.pay-confirm-signed {
  color: #6fcf97;
  font-size: 12px;
  font-weight: 700;
}

.pay-actions {
  flex-wrap: wrap;
}

.pay-sign-block {
  flex: 0 0 auto;
  margin-bottom: 10px;
}

.pay-sign-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
}

.pay-sign-clear {
  font-size: 14px;
  font-weight: 500;
  color: #fff;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.pay-sign-pad {
  display: block;
  width: 100%;
  height: 160px;
  border-radius: 12px;
  background: #f4f4f5;
  cursor: crosshair;
  touch-action: none;
}

.pay-sign-hint {
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--text-dim);
}

.pay-card .modal-hint {
  margin: 0 0 12px;
}

.pay-card .modal-actions {
  flex: 0 0 auto;
}

.pay-card .modal-btn:disabled {
  opacity: 0.4;
  pointer-events: none;
}

/* ——— Member detail modal ——— */
.member-detail-overlay {
  align-items: stretch;
  justify-content: center;
  padding: 24px;
}

.member-detail-overlay[hidden] {
  display: none;
}

.member-detail-card {
  width: min(440px, 92vw);
  max-height: calc(100dvh - 48px);
  display: flex;
  flex-direction: column;
  background: #1c1c1e;
  border-radius: 18px;
  overflow: hidden;
  text-align: center;
}

.member-detail-toolbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px 8px;
}

.member-detail-close {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #2c2c2e;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 16px;
  flex-shrink: 0;
}

.member-detail-close:active {
  background: #3a3a3c;
}

.member-detail-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.member-detail-btn {
  min-height: 36px;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
}

.member-detail-btn.ghost {
  background: #2c2c2e;
  color: #fff;
}

.member-detail-btn.danger {
  background: #e53935;
  color: #fff;
}

.member-detail-btn.primary {
  background: var(--pay-blue);
  color: #fff;
}

.member-detail-btn:active {
  opacity: 0.88;
}

.member-detail-btn[hidden] {
  display: none;
}

.member-detail-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 8px 22px 28px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.member-detail-photo-wrap {
  position: relative;
  width: min(260px, 70vw);
  aspect-ratio: 3 / 4;
  border-radius: 14px;
  overflow: hidden;
  background: #111;
  border: 1px solid var(--border);
}

.member-detail-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.member-detail-photo[hidden] {
  display: none !important;
}

.member-detail-photo-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--text-dim);
  font-size: 64px;
  background: linear-gradient(180deg, #1a1a1a 0%, #0d0d0d 100%);
}

.member-detail-photo-fallback[hidden] {
  display: none !important;
}

.member-detail-name {
  margin: 8px 0 4px;
  font-size: 34px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.member-detail-no {
  margin: 0;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.member-detail-last-visit {
  margin: 0;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
}

.member-detail-block.member-detail-notes-block {
  width: 100%;
  margin-top: 10px;
  text-align: left;
}

.member-detail-notes-block .member-detail-block-head {
  justify-content: flex-start;
}

.member-detail-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  padding: 14px 0;
  border-top: 1px solid #2e2e30;
  border-bottom: 1px solid #2e2e30;
  margin-bottom: 4px;
}

.member-stat {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 0 10px;
  border-right: 1px solid #2e2e30;
}

.member-stat:first-child {
  padding-left: 0;
}

.member-stat:last-child {
  border-right: 0;
  padding-right: 0;
}

.member-stat-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
}

.member-stat-value {
  font-size: 16px;
  font-weight: 600;
  color: #fff;
}

.member-detail-rows {
  display: flex;
  flex-direction: column;
}

.member-detail-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 52px;
  padding: 12px 0;
  border-bottom: 1px solid #2e2e30;
}

.member-detail-row-label {
  flex-shrink: 0;
  font-size: 15px;
  color: #fff;
}

.member-detail-row-value {
  min-width: 0;
  text-align: right;
  font-size: 15px;
  color: var(--text-muted);
}

.member-value-bar {
  display: inline-block;
  width: 96px;
  height: 10px;
  border-radius: 6px;
  background: #3a3a3c;
  vertical-align: middle;
}

.member-detail-block {
  margin-top: 22px;
}

.member-detail-block-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  font-size: 16px;
  font-weight: 600;
  color: #fff;
}

.member-detail-link {
  font-size: 15px;
  font-weight: 500;
  color: #fff;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.member-detail-link:active {
  opacity: 0.7;
}

.member-notes {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.member-note-card {
  padding: 14px 16px;
  border-radius: 12px;
  background: #2c2c2e;
}

.member-note-text {
  margin: 0 0 10px;
  font-size: 15px;
  line-height: 1.4;
  color: #fff;
}

.member-note-meta {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
}

.member-detail-empty {
  margin: 0;
  font-size: 14px;
  color: var(--text-dim);
}

/* ——— Scan modal ——— */
.scan-overlay .scan-card {
  width: min(520px, 100%);
  text-align: left;
  padding: 20px;
}

.scan-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.scan-header .modal-title {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
}

.scan-reader {
  width: 100%;
  height: 280px;
  min-height: 280px;
  border-radius: 12px;
  overflow: hidden;
  background: #000;
  position: relative;
}

.scan-reader video,
.scan-reader canvas {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover;
  border-radius: 12px !important;
}

#scanReader__scan_region,
#scanReader__dashboard_section_csr {
  display: none !important;
}

.scan-actions {
  margin: 0 0 10px;
}

.scan-actions .modal-btn {
  width: 100%;
  height: 42px;
  font-size: 14px;
}

.scan-status {
  margin: 12px 0 4px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}

.scan-status.ok {
  color: #3dd68c;
}

.scan-status.err {
  color: #ff6b6b;
}

.scan-hint {
  margin: 0 0 14px;
  font-size: 12px;
  color: var(--text-dim);
}

.scan-hint code {
  color: var(--text-muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
}

.scan-manual {
  display: flex;
  gap: 8px;
}

.scan-input {
  flex: 1;
  height: 48px;
  border-radius: 12px;
  border: 1px solid #333;
  background: #111;
  color: #fff;
  padding: 0 14px;
  font-size: 16px;
  font-family: inherit;
  outline: none;
}

.scan-input:focus {
  border-color: var(--pay-blue);
}

.scan-submit {
  flex: 0 0 auto;
  width: 96px;
  height: 48px;
}

/* ——— Tables / open tickets ——— */
.tables-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  padding: 4px 16px 10px;
  background: var(--bg);
}

.tables-screen[hidden] {
  display: none !important;
}

.tables-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 56px;
  padding: 0 2px;
  margin-bottom: 12px;
  flex-shrink: 0;
}

.tables-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.tables-title {
  margin: 0;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1;
}

.tables-refresh-btn {
  flex-shrink: 0;
}

.tables-new-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  padding: 0 16px;
  border-radius: 12px;
  background: var(--pay-blue);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  flex-shrink: 0;
}

.tables-new-btn:active {
  background: var(--pay-blue-press);
  transform: scale(0.98);
}

.tables-grid {
  flex: 1;
  min-height: 0;
  overflow: auto;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  align-content: start;
  padding: 0 0 8px;
  -webkit-overflow-scrolling: touch;
}

.table-tile {
  height: 176px;
  border-radius: 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  text-align: left;
  transition: transform 80ms ease, background 80ms ease, border-color 80ms ease;
}

.table-tile:active {
  transform: scale(0.98);
}

.table-tile.is-open {
  background: var(--bg-bill);
}

.table-tile.is-active {
  border-color: var(--nav-active);
}

.table-tile-name {
  flex: 0 0 auto;
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.15;
  letter-spacing: -0.01em;
}

.table-tile-body {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 4px;
  margin-top: 12px;
  min-height: 0;
  overflow: hidden;
}

.table-tile-mem {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  line-height: 1.25;
}

.table-tile-more {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  line-height: 1.25;
}

.table-tile-empty,
.table-tile-nomem {
  font-size: 15px;
  font-weight: 500;
  line-height: 1.25;
}

.table-tile-empty {
  color: var(--text-dim);
}

.table-tile-nomem {
  color: #ff6b6b;
}

.table-tile-total {
  flex: 0 0 auto;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.table-tile.is-empty .table-tile-total {
  color: var(--text-dim);
  font-weight: 500;
}

/* Assign member modal */
.assign-overlay {
  z-index: 210;
  padding: 16px;
}

.assign-card {
  width: min(480px, 100%);
  text-align: left;
  max-height: min(720px, 92vh);
  display: flex;
  flex-direction: column;
}

.assign-card .pay-header .modal-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

.assign-lead {
  margin: 0 0 14px;
  font-size: 14px;
  color: var(--text-muted);
}

.assign-search {
  margin-bottom: 12px;
}

.assign-search-input {
  width: 100%;
  height: 48px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #111;
  color: var(--text);
  padding: 0 14px;
  font-size: 16px;
  font-family: inherit;
}

.assign-search-input:focus {
  outline: none;
  border-color: var(--nav-active);
}

.assign-selected {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.assign-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 12px;
  border-radius: 10px;
  background: #2c2c2e;
  font-size: 14px;
  font-weight: 600;
}

.assign-chip-remove {
  color: var(--text-muted);
  font-size: 14px;
  padding: 4px;
}

.assign-results {
  flex: 1;
  min-height: 180px;
  max-height: 320px;
  overflow: auto;
  margin-bottom: 16px;
  border-radius: 12px;
  background: #111;
  border: 1px solid var(--border);
}

.assign-result {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 14px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.assign-result:last-child {
  border-bottom: none;
}

.assign-result:active {
  background: rgba(255, 255, 255, 0.04);
}

.assign-result.is-selected {
  background: rgba(47, 111, 237, 0.18);
}

.assign-result.inactive {
  opacity: 0.45;
}

.assign-result-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

.assign-result-meta {
  font-size: 13px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.assign-actions {
  flex-shrink: 0;
}

@media (max-width: 900px) {
  .tables-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 700px) {
  .tables-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .tables-title {
    font-size: 26px;
  }
}

/* ——— Transactions (history / voids) ——— */
.tx-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  padding: 4px 16px 10px;
  background: var(--bg);
}

.tx-screen[hidden] {
  display: none !important;
}

.tx-header {
  display: flex;
  align-items: center;
  height: 56px;
  padding: 0 2px;
  margin-bottom: 4px;
  flex-shrink: 0;
}

.tx-title {
  margin: 0;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1;
}

.tx-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  margin-bottom: 12px;
  padding: 0 2px;
}

.tx-filters {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.tx-filter {
  height: 40px;
  min-width: 72px;
  padding: 0 14px;
  border-radius: 10px;
  background: var(--bg-elevated);
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 600;
  border: 1px solid transparent;
  transition: background 120ms ease, color 120ms ease;
}

.tx-filter.is-active {
  background: var(--bg-bill);
  color: var(--nav-active);
  border-color: var(--border);
}

.tx-filter:active {
  transform: scale(0.98);
}

.tx-search {
  flex: 1;
  min-width: 0;
  height: 44px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 15px;
}

.tx-search::placeholder {
  color: var(--text-dim);
}

.tx-body {
  flex: 1;
  min-height: 0;
  display: flex;
  gap: 12px;
  overflow: hidden;
}

.tx-list {
  flex: 0 0 40%;
  max-width: 40%;
  min-width: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-right: 4px;
  -webkit-overflow-scrolling: touch;
}

.tx-row {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  column-gap: 12px;
  row-gap: 4px;
  min-height: 56px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--bg-elevated);
  border: 1px solid transparent;
  text-align: left;
  color: var(--text);
  transition: transform 80ms ease, background 80ms ease, border-color 80ms ease;
}

.tx-row:active {
  transform: scale(0.98);
}

.tx-row.is-selected {
  background: var(--bg-bill);
  border-color: var(--nav-active);
}

.tx-row-main {
  grid-column: 1;
  grid-row: 1;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.2;
}

.tx-row-meta {
  grid-column: 1;
  grid-row: 2;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  line-height: 1.2;
}

.tx-row-amount {
  grid-column: 2;
  grid-row: 1;
  font-size: 16px;
  font-weight: 600;
  text-align: right;
  font-variant-numeric: tabular-nums;
  align-self: start;
}

.tx-row-status {
  grid-column: 2;
  grid-row: 2;
  font-size: 12px;
  font-weight: 600;
  text-align: right;
  color: var(--text-muted);
  align-self: end;
}

.tx-row-status.is-voided {
  color: #ff6b6b;
}

.tx-list-empty {
  margin: 24px 8px;
  font-size: 15px;
  font-weight: 500;
  color: var(--text-dim);
  text-align: center;
}

.tx-detail {
  flex: 1;
  min-width: 0;
  min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.tx-detail-empty {
  height: 100%;
  min-height: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 500;
  color: var(--text-dim);
  background: var(--bg-elevated);
  border-radius: 16px;
}

.tx-receipt {
  background: var(--bg-bill);
  border-radius: 16px;
  padding: 20px 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 0;
  min-height: 100%;
  box-sizing: border-box;
}

.tx-receipt-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.tx-receipt-title {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}

.tx-receipt-status {
  flex-shrink: 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  padding-top: 6px;
}

.tx-receipt-status.is-voided {
  color: #ff6b6b;
}

.tx-receipt-meta {
  margin: 0 0 12px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
}

.tx-receipt-members {
  margin: 0 0 14px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}

.tx-receipt-rule {
  height: 1px;
  background: var(--border);
  margin: 0 0 12px;
}

.tx-receipt-lines {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 14px;
}

.tx-receipt-line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  font-size: 16px;
}

.tx-receipt-line-name {
  color: var(--text);
  font-weight: 400;
  min-width: 0;
}

.tx-receipt-line-qty {
  color: var(--text-muted);
  font-weight: 500;
}

.tx-receipt-line-price {
  flex-shrink: 0;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.tx-receipt-total {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 20px;
}

.tx-receipt-total span:last-child {
  font-variant-numeric: tabular-nums;
}

.tx-receipt-actions {
  display: flex;
  gap: 10px;
  margin-top: auto;
}

.tx-action-btn {
  flex: 1;
  height: 52px;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  transition: transform 80ms ease, opacity 80ms ease, background 80ms ease;
}

.tx-action-btn:active:not(:disabled) {
  transform: scale(0.98);
}

.tx-action-btn.ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}

.tx-action-btn.danger {
  background: #e53935;
  color: #fff;
}

.tx-action-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

@media (max-width: 900px) {
  .tx-body {
    flex-direction: column;
  }

  .tx-list {
    flex: 0 0 auto;
    max-width: none;
    max-height: 38%;
  }
}

/* ——— Placeholder screens ——— */
.placeholder-screen {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.placeholder-screen[hidden] {
  display: none;
}

.placeholder-screen p {
  margin: 0;
  font-size: 22px;
  font-weight: 600;
  color: var(--text-muted);
}

.placeholder-back {
  padding: 12px 24px;
  border-radius: 12px;
  background: var(--pay-blue);
  font-weight: 600;
  font-size: 15px;
}

/* ——— Responsive tweaks ——— */
@media (max-width: 900px) {
  .bill-pane {
    flex-basis: 34%;
    min-width: 240px;
  }

  .menu-title {
    font-size: 24px;
  }

  .cat-tile {
    width: 128px;
    min-width: 128px;
    height: 48px;
  }

  .cat-tile .cat-name {
    font-size: 18px;
  }
}

@media (max-width: 700px) {
  .pos-main {
    flex-direction: column;
  }

  .bill-pane {
    flex: 0 0 42%;
    max-width: none;
    min-width: 0;
  }

  .item-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .cat-tile {
    width: 120px;
    min-width: 120px;
    height: 48px;
  }
}

/* ——— AirBar PIN lock ——— */
.auth-lock {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: calc(24px + var(--safe-top)) 24px calc(24px + var(--safe-bottom));
  transition: opacity 140ms ease;
}

.auth-lock[hidden] {
  display: none;
}

body.auth-locked .pos-app,
body.auth-locked .placeholder-screen {
  pointer-events: none;
}

.auth-lock-inner {
  width: min(360px, 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.auth-brand {
  margin: 0;
  font-size: 40px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text);
}

.auth-staff {
  margin: 10px 0 0;
  font-size: 16px;
  font-weight: 500;
  color: var(--text-muted);
}

.auth-dots {
  display: flex;
  gap: 14px;
  margin-top: 36px;
  min-height: 16px;
  align-items: center;
  justify-content: center;
}

.auth-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1.5px solid var(--text-muted);
  background: transparent;
  transition: background 80ms ease, border-color 80ms ease;
}

.auth-dot.filled {
  background: var(--text);
  border-color: var(--text);
}

.auth-dots.shake {
  animation: auth-dot-shake 360ms ease;
}

@keyframes auth-dot-shake {
  0%,
  100% {
    transform: translateX(0);
  }
  20% {
    transform: translateX(-10px);
  }
  40% {
    transform: translateX(10px);
  }
  60% {
    transform: translateX(-7px);
  }
  80% {
    transform: translateX(7px);
  }
}

@keyframes bill-line-enter {
  from {
    background: rgba(255, 255, 255, 0.16);
  }
  to {
    background: transparent;
  }
}

@keyframes bill-line-bump {
  from {
    background: rgba(255, 255, 255, 0.1);
  }
  to {
    background: transparent;
  }
}

.auth-hint {
  margin: 14px 0 0;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-dim);
  min-height: 1.2em;
}

.auth-hint.is-error {
  color: #ff6b6b;
}

.auth-pad {
  margin-top: 40px;
  display: grid;
  grid-template-columns: repeat(3, 76px);
  gap: 16px 22px;
  justify-content: center;
}

.auth-key {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 28px;
  font-weight: 400;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 80ms ease, background 80ms ease;
}

.auth-key:active {
  transform: scale(0.96);
  background: #222222;
}

.auth-key-spacer {
  width: 76px;
  height: 76px;
}

.auth-key-back {
  font-size: 22px;
  background: transparent;
  color: var(--text-muted);
}

.auth-key-back:active {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}
