@font-face {
  font-family: 'Google Sans';
  src: url('/fonts/GoogleSans-Variable.ttf') format('truetype');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Google Sans';
  src: url('/fonts/GoogleSans-Variable-Italic.ttf') format('truetype');
  font-weight: 100 900;
  font-style: italic;
  font-display: swap;
}

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

/* Prevent text selection everywhere — app behaves like native */
*, *::before, *::after {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
input, textarea, [contenteditable] {
  -webkit-user-select: text;
  user-select: text;
}

@keyframes tab-pulse {
  0%   { opacity: 1; }
  50%  { opacity: 0.25; }
  100% { opacity: 1; }
}

@keyframes tab-alert {
  0%   { color: #f87171; }
  50%  { color: #ef444488; }
  100% { color: #f87171; }
}

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

/* Order item text pulse for "done" KDS status in order detail view */
@keyframes kds-ready-pulse-text {
  0%,100% { color: #4ade80; }
  50%     { color: #bbf7d0; }
}
.kds-ready-flash-text {
  animation: kds-ready-pulse-text 1.6s ease-in-out infinite;
}

:root {
  /* "Free" table card — dark theme: muted blue-slate */
  --card-free-bg:   #243044;
  --card-free-text: #94b8d4;
  --card-free-muted: rgba(148,184,212,0.45);

  /* Dark theme — deep navy */
  --bg:         #0d1520;
  --bg2:        #1a2535;
  --bg3:        #243044;
  --bg4:        #2e3d54;
  --text:       #edf2f7;
  --text2:      #94a3b8;
  --muted:      #5a7390;
  --accent:     #f59e0b;
  --accent-fg:  #1c1000;
  --accent-dim: #6b3a00;
  --success:    #22c55e;
  --success-fg: #052e16;
  --danger:     #f87171;
  --danger-sat: #ef4444;
  --danger-dim: #450a0a;
  --primary:    #3b82f6;
  --primary-fg: #ffffff;
  --border:     #253245;
  --shadow:     rgba(0,0,0,0.35);
  font-family: 'Google Sans', system-ui, 'Segoe UI', sans-serif;
  font-size: 16px;
  color: var(--text);
  background: var(--bg);
}

[data-theme="light"] {
  /* "Free" table card — light theme: cool light grey */
  --card-free-bg:    #dde5ef;
  --card-free-text:  #3d5270;
  --card-free-muted: rgba(61,82,112,0.45);

  /* Light theme — warm slate / off-white */
  --bg:         #f1f5f9;
  --bg2:        #ffffff;
  --bg3:        #e8edf4;
  --bg4:        #dce3ee;
  --text:       #1e293b;
  --text2:      #475569;
  --muted:      #7a8fa6;
  --accent:     #e08c00;
  --accent-fg:  #ffffff;
  --accent-dim: #fef3c7;
  --success:    #16a34a;
  --success-fg: #ffffff;
  --danger:     #dc2626;
  --danger-sat: #dc2626;
  --danger-dim: #fee2e2;
  --primary:    #2563eb;
  --primary-fg: #ffffff;
  --border:     #cdd6e0;
  --shadow:     rgba(0,0,0,0.10);
}

html, body {
  background: var(--bg);
  overscroll-behavior: none;
  overflow: hidden;
  height: 100%;
}

#root { height: 100%; display: flex; flex-direction: column; }

/* ── Layout ─────────────────────────────────────────────── */
.page {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  overflow: hidden;
  background: var(--bg);
}
.page--centered {
  align-items: center;
  justify-content: center;
}

/* ── Top Bar ─────────────────────────────────────────────── */
.top-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  min-height: 56px;
}
.top-bar__title {
  flex: 1;
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
}
.top-bar__user { font-size: 13px; color: var(--muted); }

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  padding: 12px 20px;
  cursor: pointer;
  min-height: 48px;
  transition: opacity 0.15s;
}
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn--primary  { background: var(--primary);    color: var(--primary-fg); }
.btn--accent   { background: var(--accent);     color: var(--accent-fg); }
.btn--success  { background: var(--success);    color: var(--success-fg); }
.btn--danger   { background: var(--danger-sat); color: #fff; }
.btn--secondary{ background: var(--bg3);        color: var(--text); }
.btn--lg       { min-height: 64px; font-size: 17px; border-radius: 14px; }

.icon-btn {
  background: none;
  border: none;
  color: var(--text);
  font-size: 20px;
  min-width: 44px;
  min-height: 44px;
  cursor: pointer;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.icon-btn--danger { color: var(--danger); }
.link-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 14px;
  text-decoration: underline;
  cursor: pointer;
  margin-top: 8px;
}

/* ── PIN Pad ─────────────────────────────────────────────── */
.pin-btn {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--bg2);
  color: var(--text);
  font-size: 22px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.1s;
}
.pin-btn:active { background: var(--bg3); }
.pin-btn--secondary { background: transparent; color: var(--muted); }
.pin-btn--confirm { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.pin-btn--confirm:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── Login ───────────────────────────────────────────────── */
.login-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  width: 100%;
  max-width: 340px;
  padding: 32px 24px;
}
.app-title { font-size: 32px; font-weight: 700; color: var(--accent); }
.app-subtitle { font-size: 14px; color: var(--muted); }
.login-greeting { font-size: 16px; color: var(--text); }
.text-input {
  width: 100%;
  background: var(--bg2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 10px;
  padding: 14px 16px;
  font-size: 16px;
  outline: none;
}
.text-input:focus { border-color: var(--accent); }
.error-msg { color: var(--danger); font-size: 14px; text-align: center; }

/* ── Zone Tab Bar (replaces old filter-tabs) ─────────────── */
.zone-tab-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
}
.zone-tab-bar::-webkit-scrollbar { display: none; }

/* ── Table Grid — density-driven via inline style ─────────── */
/* Cards use inline styles per density, grid columns come from JS */
.table-card-v2:active { transform: scale(0.96); }

/* ── Cart badge ──────────────────────────────────────────── */
.cart-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  background: var(--accent);
  color: var(--accent-fg);
  font-size: 10px;
  font-weight: 700;
  border-radius: 50%;
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Category Tabs ───────────────────────────────────────── */
.category-tabs {
  display: flex;
  align-items: center;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
}
.category-tabs__sticky {
  flex-shrink: 0;
  padding: 10px 0 10px 12px;
  display: flex;
  align-items: center;
  background: var(--bg2);
  z-index: 2;
}
.category-tabs__scroll-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: stretch;
  overflow: hidden;
}
.category-tabs__scroll {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  flex: 1;
}
.category-tabs__scroll::-webkit-scrollbar { display: none; }
.cat-tab {
  flex-shrink: 0;
  padding: 8px 16px;
  border-radius: 20px;
  border: 2px solid transparent;
  background: var(--bg3);
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: filter 0.12s;
}
.cat-tab--active { background: var(--accent); color: var(--accent-fg); }
.cat-tab--viewall {
  background: var(--bg3);
  color: var(--text);
  padding: 8px 10px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Category All Modal ──────────────────────────────────── */
.cat-all-modal {
  position: fixed;
  inset: 20px;
  background: var(--bg2);
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  z-index: 200;
  overflow: hidden;
}
.cat-all-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.cat-all-modal__title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}
.cat-all-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  padding: 16px;
  overflow-y: auto;
  flex: 1;
  align-content: start;
}
@media (min-width: 480px) {
  .cat-all-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}
@media (min-width: 720px) {
  .cat-all-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}
.cat-all-tile {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 76px;
  max-height: 76px;
  border-radius: 14px;
  border: none;
  cursor: pointer;
  overflow: hidden;
  padding: 8px 10px;
}
.cat-all-tile--active { outline: 3px solid #fff; }
.cat-all-tile__overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.cat-all-tile__name {
  position: relative;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  text-align: center;
  text-shadow: 0 1px 4px rgba(0,0,0,0.6);
  line-height: 1.3;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  word-break: break-word;
}

/* ── Product Grid ────────────────────────────────────────── */
.product-picker { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.product-area { flex: 1; overflow-y: auto; min-height: 0; overscroll-behavior: contain; scrollbar-width: none; }
.product-area::-webkit-scrollbar { display: none; }

/* Sub-category accordion */
.subcat-accordion { display: flex; flex-direction: column; gap: 4px; padding: 10px 12px; }
.subcat-section { border-radius: 12px; overflow: hidden; background: var(--bg2); border: 1px solid var(--border); }
.subcat-header {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  color: var(--text);
  transition: background 0.12s;
}
.subcat-header:active { background: var(--bg3); }
.subcat-header--open { background: var(--bg3); }
.subcat-header__pill {
  width: 4px;
  height: 28px;
  border-radius: 4px;
  flex-shrink: 0;
  opacity: 0.85;
}
.subcat-header__name { flex: 1; font-size: 14px; font-weight: 600; }
.subcat-header__count {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  background: var(--bg3);
  border-radius: 10px;
  padding: 2px 7px;
  flex-shrink: 0;
}
.subcat-header--open .subcat-header__count { background: var(--bg); }
.subcat-header__chevron { flex-shrink: 0; color: var(--muted); transition: transform 200ms ease; }
.subcat-body { padding: 0 0 6px; }
.subcat-body .product-grid { padding: 8px 10px; overflow-y: unset; }
.subcat-general .product-grid { padding: 8px 10px; }

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 10px;
  padding: 12px;
}
.product-btn {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 0;
  padding: 0;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  text-align: left;
  overflow: hidden;
}
.product-btn:active { background: var(--bg3); }

.product-btn__thumb {
  flex-shrink: 0;
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.product-btn__thumb-inner {
  width: 64px;
  height: 64px;
  border-radius: 10px;
  overflow: hidden;
  background: var(--bg3);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.product-btn__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.product-btn__initials {
  font-size: 24px;
  font-weight: 700;
  color: var(--muted);
  user-select: none;
}

.product-btn__info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding: 10px 12px;
}
.product-btn__name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.product-btn__price { font-size: 13px; color: var(--accent); font-weight: 600; margin-top: 4px; }
.product-btn__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 5px;
}
.product-tag-pill {
  font-size: 9px;
  font-weight: 600;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
  border-radius: 999px;
  padding: 1px 6px;
  line-height: 1.4;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* ── Cart Panel ──────────────────────────────────────────── */
.cart-panel {
  background: var(--bg2);
  border-top: 2px solid var(--border);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.cart-panel__title { font-size: 15px; font-weight: 600; color: var(--text); }
.cart-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  color: var(--text);
}

/* ── Order Summary ───────────────────────────────────────── */
.order-summary { display: flex; flex-direction: column; gap: 0; overflow-y: auto; flex: 1; padding: 12px; }
.order-item { padding: 12px 10px; border-bottom: 1px solid var(--border); }
.order-item--last { border-bottom: none; }
.order-item--paid { opacity: 0.5; }
.order-item--cancelled { opacity: 0.3; text-decoration: line-through; }
.order-item--selected { background: rgba(245,158,11,0.10); border-radius: 8px; }
.order-item__row { display: flex; align-items: center; gap: 8px; }
.order-item__name { flex: 1; font-size: 17px; font-weight: 600; color: #f59e0b; }
.order-item__name--served { color: var(--text); }
.order-item__name--cancelled { color: var(--muted); }
.order-item__qty { font-size: 15px; color: var(--muted); }
.order-item__price { font-size: 16px; color: var(--text); font-weight: 600; }
.order-item__modifier { font-size: 13px; color: var(--muted); padding-left: 16px; margin-top: 3px; }
.order-summary__total {
  display: flex;
  justify-content: space-between;
  padding: 16px 12px 8px;
  font-size: 18px;
  font-weight: 700;
  color: var(--accent);
  border-top: 2px solid var(--border);
  margin-top: 8px;
}
.badge { font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 20px; margin-left: 4px; }
.badge--paid     { background: var(--success);    color: var(--success-fg); }
.badge--cancelled{ background: var(--danger-dim); color: var(--danger); }
.badge--draft    { background: var(--accent-dim); color: var(--accent); }

/* ── Detail Body ─────────────────────────────────────────── */
.detail-body { display: flex; flex-direction: column; flex: 1; overflow-y: auto; min-height: 0; overscroll-behavior: contain; }
.action-bar {
  display: flex;
  gap: 8px;
  padding: 12px;
  background: var(--bg2);
  border-top: 1px solid var(--border);
}
.action-bar .btn { flex: 1; }

/* ── Modal ───────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: flex-end;
  z-index: 100;
}
.modal-overlay--top {
  align-items: flex-start;
}
.modal-sheet {
  background: var(--bg2);
  border-radius: 20px 20px 0 0;
  padding: 16px 20px 32px;
  width: 100%;
  max-height: 85svh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.modal-sheet--top {
  border-radius: 0 0 20px 20px;
  padding: 12px 20px 24px;
}
.modal-handle {
  width: 40px;
  height: 4px;
  background: var(--bg3);
  border-radius: 2px;
  margin: 0 auto 8px;
}
.modal-sheet--top .modal-handle {
  margin: 8px auto 0;
  order: 99;
}
.modal-title { font-size: 20px; font-weight: 700; text-align: center; }
.modal-price { font-size: 18px; color: var(--accent); text-align: center; font-weight: 600; }
.modal-section h3 { font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.5px; }
.modal-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  font-size: 15px;
  cursor: pointer;
}
.modal-option input { width: 20px; height: 20px; accent-color: var(--accent); }
.option-price { margin-left: auto; color: var(--accent); font-size: 13px; }
.modal-option--remove { color: var(--muted); }
.modal-notes {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 15px;
  resize: none;
}
.modal-qty {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
}
.qty-btn {
  width: 48px; height: 48px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--bg3);
  color: var(--text);
  font-size: 22px;
  cursor: pointer;
}
.qty-value { font-size: 24px; font-weight: 700; min-width: 36px; text-align: center; }

/* ── Decimal quantity panel (kg / liter / gram / mL products) ── */
.qty-decimal-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
  width: 100%;
}
.qty-decimal-input {
  font-size: 24px;
  font-weight: 700;
  width: 90px;
  text-align: center;
  background: var(--bg3);
  border: 2px solid var(--primary);
  border-radius: 10px;
  color: var(--text);
  outline: none;
  padding: 2px 4px;
  /* hide spinner arrows */
  -moz-appearance: textfield;
}
.qty-decimal-input::-webkit-outer-spin-button,
.qty-decimal-input::-webkit-inner-spin-button { -webkit-appearance: none; }

.qty-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
}
.qty-preset-btn {
  padding: 6px 12px;
  border-radius: 20px;
  border: 1.5px solid var(--border);
  background: var(--bg3);
  color: var(--text2);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.qty-preset-btn--active {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--primary-fg);
}

.qty-offsets {
  display: flex;
  gap: 8px;
  justify-content: center;
}
.qty-offset-btn {
  padding: 7px 14px;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}
.qty-offset-btn--add {
  background: rgba(34,197,94,0.12);
  color: var(--success);
  border-color: rgba(34,197,94,0.3);
}
.qty-offset-btn--sub {
  background: rgba(248,113,113,0.12);
  color: var(--danger);
  border-color: rgba(248,113,113,0.3);
}

/* ── User Menu Dropdown ──────────────────────────────────── */
.user-menu-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 200;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.25);
  min-width: 200px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.user-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 15px;
  cursor: pointer;
  text-align: left;
}
.user-menu-item:hover { background: var(--bg3); }
.user-menu-item--disabled { color: var(--muted); cursor: not-allowed; }
.user-menu-item--disabled:hover { background: transparent; }
.user-menu-item--danger { color: var(--danger); }
.user-menu-item__icon {
  font-size: 17px;
  flex-shrink: 0;
  width: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.user-menu-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

@keyframes longpress-fill { from { transform: scaleX(0); } to { transform: scaleX(1); } }
