:root {
  --bg: #fbf6ec;
  --surface: #ffffff;
  --surface-alt: #fbf6ec;
  --text: #232426;
  --muted: #645c53;
  --border: #e6decb;
  --primary: #1d5c63;
  --primary-dark: #144348;
  --primary-soft: #e2eff0;
  --terracotta: #c85a32;
  --terracotta-dark: #a64623;
  --accent: #e4a94f;
  --success: #16a34a;
  --success-soft: #dcfce7;
  --warning: #c85a32;
  --warning-soft: #fbe9e2;
  --danger: #dc2626;
  --danger-soft: #fee2e2;
  --radius: 14px;
  --shadow: 0 4px 18px rgba(29, 92, 99, 0.06);
}

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

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
}

/* Topbar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.brand-logo-img {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--terracotta);
  background: #fff;
}

.brand h1 {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--primary);
}

.status-dot {
  font-size: 0.75rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.status-dot::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
}
.status-dot.offline::before {
  background: var(--danger);
}

.nav-tabs {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
  align-items: center;
}

.staff-select-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.25rem 0.65rem;
}
.staff-select-wrap select {
  border: none;
  background: transparent;
  padding: 0.2rem 0.25rem;
  font-weight: 700;
  font-size: 0.85rem;
  width: auto;
  cursor: pointer;
}
.staff-select-wrap select:focus {
  outline: none;
}

.nav-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  padding: 0.5rem 0.9rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.15s ease;
}

.nav-btn:hover {
  background: var(--surface-alt);
}

.nav-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.badge {
  background: var(--accent);
  color: #111;
  font-size: 0.75rem;
  font-weight: 800;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
}
.nav-btn.active .badge {
  background: #fff;
  color: var(--primary);
}

.hidden {
  display: none !important;
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 1.25rem;
}

.view {
  display: none;
}
.view.active {
  display: block;
}

/* Common UI */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.15rem;
  box-shadow: var(--shadow);
  margin-bottom: 1rem;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
  flex-wrap: wrap;
}

.muted {
  color: var(--muted);
  font-size: 0.88rem;
}

.empty-state {
  color: var(--muted);
  text-align: center;
  padding: 1.25rem 0.5rem;
  font-size: 0.92rem;
}

input, select, textarea {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 0.92rem;
  font-family: inherit;
  background: #fff;
  color: var(--text);
}

input:focus, select:focus {
  outline: 2px solid var(--primary-soft);
  border-color: var(--primary);
}

label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--muted);
}

.row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}

button {
  font-family: inherit;
  cursor: pointer;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 0.6rem 1rem;
  font-weight: 700;
  transition: background 0.15s;
}
.btn-primary:hover:not(:disabled) {
  background: var(--primary-dark);
}
.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-secondary {
  background: var(--surface-alt);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.55rem 0.9rem;
  font-weight: 600;
}
.btn-secondary:hover {
  background: var(--border);
}

.btn-success {
  background: var(--success);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 0.5rem 0.85rem;
  font-weight: 700;
}

.btn-danger {
  background: var(--danger);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 0.5rem 0.85rem;
  font-weight: 700;
}

.btn-text {
  background: none;
  border: none;
  color: var(--primary);
  font-weight: 600;
  font-size: 0.85rem;
}

.btn-lg {
  width: 100%;
  padding: 0.8rem 1rem;
  font-size: 1rem;
}

.btn-whatsapp {
  background: linear-gradient(135deg, #1b5e66, #14484f);
  color: #fff;
  position: relative;
  overflow: hidden;
  transition: transform 0.18s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.btn-whatsapp:not(:disabled) {
  animation: wa-pulse 2.2s infinite;
}

.btn-whatsapp:hover:not(:disabled) {
  background: linear-gradient(135deg, #217079, #1b5e66);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(27, 94, 102, 0.35);
}

.btn-whatsapp:active:not(:disabled) {
  transform: scale(0.98);
}

@keyframes wa-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(27, 94, 102, 0.45);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(27, 94, 102, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(27, 94, 102, 0);
  }
}

/* Customer Menu */
.menu-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 350px;
  gap: 1.25rem;
  align-items: start;
}

.menu-main,
.pos-left,
.pos-right,
.kds-col {
  min-width: 0;
}

.hero-banner {
  background: linear-gradient(135deg, #16424a 0%, #1d5c63 65%, #236e75 100%);
  color: #fbf6ec;
  border: 2px solid var(--terracotta);
  border-radius: var(--radius);
  padding: 1.15rem 1.35rem;
  margin-bottom: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.hero-brand {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.hero-logo-img {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--accent);
  background: #fff;
  flex-shrink: 0;
}

.hero-banner h2 {
  font-size: 1.35rem;
  margin-bottom: 0.25rem;
}
.hero-banner p {
  opacity: 0.95;
  font-size: 0.93rem;
}

.search-box {
  min-width: 260px;
  flex: 1;
  max-width: 340px;
}

.chinita-floating {
  position: fixed;
  bottom: 1.25rem;
  left: 1.25rem;
  z-index: 60;
  display: flex;
  align-items: flex-end;
  gap: 0.65rem;
  max-width: calc(100vw - 2.5rem);
  animation: greeting-pop 0.55s cubic-bezier(0.22, 1, 0.36, 1);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.chinita-floating.fade-out {
  opacity: 0;
  transform: translateY(14px) scale(0.95);
  pointer-events: none;
}

.chinita-avatar-btn {
  background: none;
  border: none;
  padding: 0;
  flex-shrink: 0;
}

.chinita-mascot-canvas {
  width: 132px;
  height: 132px;
  display: block;
  background: transparent;
  filter: drop-shadow(0 8px 14px rgba(29, 92, 99, 0.28));
  cursor: pointer;
}

.chinita-bubble {
  max-width: 280px;
  background: var(--surface);
  border: 2px solid var(--accent);
  border-radius: 16px 16px 16px 4px;
  padding: 0.7rem 1.8rem 0.7rem 0.9rem;
  font-size: 0.88rem;
  line-height: 1.4;
  color: var(--text);
  box-shadow: 0 10px 26px rgba(35, 36, 38, 0.16);
  position: relative;
}

.chinita-close {
  position: absolute;
  top: 0.35rem;
  right: 0.45rem;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 0.9rem;
  padding: 0.15rem 0.35rem;
  border-radius: 6px;
}
.chinita-close:hover {
  background: var(--surface-alt);
  color: var(--text);
}

@keyframes greeting-pop {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.92);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes chinita-wave {
  0%, 100% {
    transform: translateY(0) rotate(0deg);
  }
  20% {
    transform: translateY(-6px) rotate(-6deg);
  }
  40% {
    transform: translateY(-3px) rotate(6deg);
  }
  60% {
    transform: translateY(-6px) rotate(-4deg);
  }
  80% {
    transform: translateY(-2px) rotate(3deg);
  }
}

.tracker-card {
  background: var(--warning-soft);
  border: 2px solid var(--accent);
  border-radius: var(--radius);
  padding: 0.9rem 1.1rem;
  margin-bottom: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.category-pills {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  padding-bottom: 0.5rem;
  margin-bottom: 1rem;
}

.cat-pill {
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 0.5rem 0.95rem;
  border-radius: 999px;
  font-weight: 600;
  white-space: nowrap;
  font-size: 0.88rem;
}

.cat-pill.active {
  background: var(--text);
  color: #fff;
  border-color: var(--text);
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 0.9rem;
}

.product-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.75rem;
  transition: transform 0.15s;
}
.product-card:hover {
  transform: translateY(-2px);
}

.prod-emoji {
  font-size: 2.3rem;
  line-height: 1;
  margin-bottom: 0.35rem;
}

.product-card h4 {
  font-size: 1rem;
  margin-bottom: 0.25rem;
}

.product-card p {
  font-size: 0.82rem;
  color: var(--muted);
}

.prod-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: 0.25rem;
}

.price {
  font-size: 1.08rem;
  font-weight: 800;
  color: var(--terracotta);
}

/* Cart */
.cart-panel {
  position: sticky;
  top: 76px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem;
  box-shadow: var(--shadow);
}

.cart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.cart-items {
  max-height: 250px;
  overflow-y: auto;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 0.5rem 0;
  margin-bottom: 0.85rem;
}

.cart-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0;
  border-bottom: 1px dashed var(--border);
}
.cart-item:last-child {
  border-bottom: none;
}

.cart-item-info {
  flex: 1;
  font-size: 0.88rem;
}
.cart-item-info strong {
  display: block;
}

.qty-controls {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.qty-btn {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-alt);
  font-weight: 700;
}

.cart-form {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.cart-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 1.05rem;
  padding-top: 0.25rem;
}
.cart-total-row strong {
  font-size: 1.25rem;
  color: var(--primary);
}

.cart-count-pill {
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 800;
  padding: 0.12rem 0.5rem;
  border-radius: 999px;
  margin-left: 0.25rem;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.field-label {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--muted);
}

.pay-pills {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.4rem;
}

.pay-pills-3 {
  grid-template-columns: repeat(3, 1fr);
}

.pay-pill {
  border: 1px solid var(--border);
  background: var(--surface-alt);
  color: var(--text);
  padding: 0.45rem 0.5rem;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 600;
  transition: all 0.15s ease;
}

.pay-pill:hover {
  border-color: var(--primary);
}

.pay-pill.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.quick-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: -0.25rem;
}

.quick-chip {
  border: 1px dashed var(--border);
  background: var(--bg);
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 600;
  padding: 0.22rem 0.55rem;
  border-radius: 999px;
  transition: all 0.15s;
}

.quick-chip:hover {
  background: var(--primary-soft);
  color: var(--primary);
  border-color: var(--primary);
}

.cart-total-box {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.65rem 0.9rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 700;
}

.cart-total-box strong {
  font-size: 1.35rem;
  color: var(--terracotta);
}

/* POS */
.cash-bar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.9rem 1.15rem;
  margin-bottom: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  box-shadow: var(--shadow);
}

.cash-kpis {
  display: flex;
  gap: 1.25rem;
  flex-wrap: wrap;
}

.cash-kpi span {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 600;
}
.cash-kpi strong {
  font-size: 1.05rem;
}

.pos-layout {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 1rem;
  align-items: start;
}

.compact-input {
  max-width: 220px;
}

.unpaid-list {
  display: grid;
  gap: 0.6rem;
}

.unpaid-card {
  border: 1px solid var(--border);
  background: #fbf6ec;
  border-radius: 12px;
  padding: 0.85rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  box-shadow: 0 2px 8px rgba(29, 92, 99, 0.05);
}

.pos-product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.6rem;
}

.pos-prod-btn {
  text-align: left;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.65rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  transition: border-color 0.15s;
}
.pos-prod-btn:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.movement-form {
  display: grid;
  grid-template-columns: 140px 100px 1fr auto;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.movements-list {
  max-height: 180px;
  overflow-y: auto;
  display: grid;
  gap: 0.4rem;
}
.mov-item {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  padding: 0.35rem 0.5rem;
  border-radius: 8px;
  background: var(--surface-alt);
}

/* Kitchen (KDS) */
.kitchen-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.toggle-sound {
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
  background: var(--surface);
  padding: 0.5rem 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  cursor: pointer;
}
.toggle-sound input {
  width: auto;
}

.kds-columns {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.kds-col {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem;
  min-height: 420px;
}

.kds-col-header {
  font-weight: 800;
  padding: 0.55rem 0.75rem;
  border-radius: 10px;
  margin-bottom: 0.75rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.kds-col-header.pending {
  background: var(--danger-soft);
  color: var(--danger);
}
.kds-col-header.preparing {
  background: var(--warning-soft);
  color: var(--warning);
}
.kds-col-header.ready {
  background: var(--success-soft);
  color: var(--success);
}

.kds-list {
  display: grid;
  gap: 0.75rem;
}

.kds-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.85rem;
  box-shadow: var(--shadow);
}

.kds-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.45rem;
}

.kds-num {
  font-weight: 900;
  font-size: 1.1rem;
  color: var(--primary);
}

.pill {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: var(--surface-alt);
}
.pill.paid {
  background: var(--success-soft);
  color: var(--success);
}
.pill.unpaid {
  background: var(--danger-soft);
  color: var(--danger);
}

.kds-items {
  list-style: none;
  margin: 0.5rem 0;
  padding: 0.5rem 0;
  border-top: 1px dashed var(--border);
  border-bottom: 1px dashed var(--border);
  font-size: 0.92rem;
}
.kds-items li {
  margin-bottom: 0.25rem;
}

.kds-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.6rem;
}
.kds-actions button {
  flex: 1;
}

/* Admin */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.9rem;
  margin-bottom: 1rem;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.15rem;
  box-shadow: var(--shadow);
}
.stat-card span {
  font-size: 0.82rem;
  color: var(--muted);
  font-weight: 600;
}
.stat-card strong {
  display: block;
  font-size: 1.5rem;
  margin-top: 0.25rem;
  color: var(--text);
}

.admin-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
th, td {
  text-align: left;
  padding: 0.6rem 0.5rem;
  border-bottom: 1px solid var(--border);
}
th {
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 12, 10, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 100;
}

.modal-box {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.25rem;
  max-width: 460px;
  width: 100%;
  max-height: 92vh;
  overflow-y: auto;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.modal-box.modal-wide {
  max-width: 860px;
}

.waiter-pad-grid {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 1rem;
  align-items: start;
}

@media (max-width: 760px) {
  .waiter-pad-grid {
    grid-template-columns: 1fr;
  }
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
  margin-top: 0.5rem;
}

/* Toast */
.toast-container {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  display: grid;
  gap: 0.5rem;
  z-index: 120;
}
.toast {
  background: var(--text);
  color: #fff;
  padding: 0.7rem 1rem;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: var(--shadow);
}
.toast.error {
  background: var(--danger);
}
.toast.success {
  background: var(--success);
}

.pos-inbox-tabs {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.75rem;
  margin-bottom: 0.85rem;
}

.pos-inbox-tab {
  flex: 1;
  min-width: 145px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  padding: 0.5rem 0.75rem;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.86rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  transition: all 0.15s ease;
}

.pos-inbox-tab:hover {
  border-color: var(--primary);
}

.pos-inbox-tab.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.pos-inbox-tab.active .badge {
  background: #fff;
  color: var(--primary);
}

/* Tables (Mesas) */
.tables-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 1rem;
}

.table-card {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.75rem;
  min-height: 170px;
}

.table-card.free {
  border-color: #bbf7d0;
  background: #f7fef9;
}

.table-card.occupied {
  border-color: var(--terracotta);
  background: #fff9f6;
}

.table-card.joined {
  grid-column: span 2;
  background: linear-gradient(135deg, #fff9f6, #fdeee7);
  border-width: 2.5px;
}

@media (max-width: 600px) {
  .table-card.joined {
    grid-column: span 1;
  }
}

.table-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.table-card-head h3 {
  font-size: 1.15rem;
}

.table-items-preview {
  font-size: 0.84rem;
  color: var(--muted);
  max-height: 80px;
  overflow-y: auto;
}

.table-actions {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.table-actions button {
  flex: 1;
  font-size: 0.84rem;
  padding: 0.45rem 0.6rem;
}

.compact-pills {
  margin-bottom: 0.75rem;
}
.compact-pills .cat-pill {
  padding: 0.35rem 0.7rem;
  font-size: 0.8rem;
}

.bill-btns {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.bill-btns .quick-chip {
  flex: 1;
  text-align: center;
  padding: 0.32rem 0.4rem;
  font-size: 0.8rem;
}

.kds-time {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--muted);
}
.kds-time.warn {
  color: var(--warning);
}
.kds-time.late {
  color: var(--danger);
}

/* Phone lookup bar */
.phone-lookup-bar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.65rem 1rem;
  margin-bottom: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  box-shadow: var(--shadow);
  font-size: 0.9rem;
}

.phone-lookup-controls {
  display: flex;
  gap: 0.45rem;
  align-items: center;
}
.phone-lookup-controls input {
  width: 180px;
  padding: 0.4rem 0.65rem;
}

/* Yape / Plin info box */
.yape-info-box {
  background: var(--surface-alt);
  border: 1px dashed var(--primary);
  border-radius: 10px;
  padding: 0.55rem 0.75rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.25rem;
}
.yape-info-box small {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
}
.yape-info-box strong {
  display: block;
  font-size: 1rem;
  color: var(--primary);
}
.yape-info-box .muted {
  font-size: 0.76rem;
}

.btn-sm {
  padding: 0.35rem 0.65rem;
  font-size: 0.8rem;
}

.delivery-breakdown {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.5rem 0.75rem;
  font-size: 0.85rem;
  display: grid;
  gap: 0.25rem;
}
.delivery-breakdown > div {
  display: flex;
  justify-content: space-between;
}

/* Admin Filter Bar */
.admin-filter-bar {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem;
  flex-wrap: wrap;
}
.filter-inputs {
  display: flex;
  align-items: flex-end;
  gap: 0.6rem;
  flex-wrap: wrap;
}
.filter-inputs input[type="date"] {
  width: 155px;
}
.filter-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* PIN Overlay */
.pin-box {
  text-align: center;
  align-items: center;
  max-width: 360px;
}
.pin-logo {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 3px solid var(--terracotta);
  object-fit: cover;
}
.pin-input {
  text-align: center;
  font-size: 1.5rem;
  letter-spacing: 0.35rem;
  font-weight: 800;
}

/* Stock badge */
.stock-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  background: var(--warning-soft);
  color: var(--warning);
  display: inline-block;
}
.stock-badge.low {
  background: var(--danger-soft);
  color: var(--danger);
}

/* Print */
.print-only {
  display: none;
}

@media print {
  .no-print, main {
    display: none !important;
  }
  .print-only {
    display: block !important;
    font-family: monospace;
    width: 280px;
    margin: 0 auto;
    font-size: 12px;
  }
  .print-only.report-a4 {
    font-family: 'Segoe UI', system-ui, sans-serif;
    width: 100%;
    max-width: 780px;
    font-size: 12.5px;
    color: #111;
  }
  .print-only.report-a4 table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
  }
  .print-only.report-a4 th,
  .print-only.report-a4 td {
    border: 1px solid #ccc;
    padding: 5px 7px;
    text-align: left;
  }
  .print-only.report-a4 th {
    background: #f3e8d2;
    color: #1d5c63;
  }
}

/* Mobile Sticky Cart Button */
.mobile-cart-fab {
  display: none;
}

@media (max-width: 1050px) {
  .menu-layout, .pos-layout, .kds-columns, .admin-grid {
    grid-template-columns: 1fr;
  }
  .cart-panel {
    position: static;
  }
  .movement-form {
    grid-template-columns: 1fr;
  }
  .mobile-cart-fab {
    position: fixed;
    bottom: 1.2rem;
    right: 1.2rem;
    width: 62px;
    height: 62px;
    z-index: 65;
    background: linear-gradient(135deg, #1b5e66, #14484f);
    color: #fff;
    border: 2.5px solid var(--accent);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 26px rgba(20, 72, 79, 0.38);
    transition: transform 0.15s ease;
  }
  .mobile-cart-fab:active {
    transform: scale(0.94);
  }
  .fab-icon {
    font-size: 1.6rem;
    line-height: 1;
  }
  .fab-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--terracotta);
    color: #fff;
    font-size: 0.78rem;
    font-weight: 800;
    min-width: 24px;
    height: 24px;
    padding: 0 5px;
    border-radius: 999px;
    border: 2px solid #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
}

@media (max-width: 640px) {
  .container {
    padding: 0.75rem;
    padding-bottom: 5.5rem;
  }
  .topbar {
    padding: 0.6rem 0.85rem;
  }
  .brand h1 {
    font-size: 1.02rem;
  }
  .brand-logo-img {
    width: 40px;
    height: 40px;
  }
  .nav-tabs {
    width: 100%;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 0.2rem;
  }
  .nav-btn {
    white-space: nowrap;
    padding: 0.45rem 0.75rem;
    font-size: 0.82rem;
  }
  .hero-banner {
    padding: 0.9rem 1rem;
  }
  .hero-logo-img {
    width: 54px;
    height: 54px;
  }
  .hero-banner h2 {
    font-size: 1.1rem;
  }
  .search-box {
    min-width: 100%;
    max-width: 100%;
  }
  .phone-lookup-bar {
    flex-direction: column;
    align-items: stretch;
  }
  .phone-lookup-controls {
    width: 100%;
  }
  .phone-lookup-controls input {
    flex: 1;
    width: auto;
  }
  .category-pills {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .product-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.65rem;
  }
  .product-card {
    padding: 0.75rem;
  }
  .product-card h4 {
    font-size: 0.9rem;
  }
  .product-card p {
    font-size: 0.75rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .prod-footer {
    flex-direction: column;
    align-items: stretch;
    gap: 0.4rem;
  }
  .prod-footer .btn-primary {
    width: 100%;
    padding: 0.5rem;
    font-size: 0.85rem;
  }
  .row-2 {
    grid-template-columns: 1fr;
  }
  .pos-product-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .filter-inputs,
  .filter-inputs input[type="date"] {
    width: 100%;
  }
  .chinita-floating {
    bottom: 1rem;
    left: 0.75rem;
  }
  .chinita-mascot-canvas {
    width: 92px;
    height: 92px;
  }
  .chinita-bubble {
    max-width: 215px;
    font-size: 0.8rem;
  }
  th, td {
    white-space: nowrap;
    font-size: 0.82rem;
  }
}
