/* ════════════════════════════════════════════════════════════════
   TableX — Professional Restaurant Ordering System
   CSS with Dark/Light Mode using CSS Custom Properties
   ════════════════════════════════════════════════════════════════ */

/* ─── FONTS & RESET ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Layout */
  --status-bar-h: 56px;
  --bottom-nav-h: 68px;

  /* Light Theme */
  --bg:           #f4f5f7;
  --bg-surface:   #ffffff;
  --bg-muted:     #f0f1f3;
  --text-1:       #111827;
  --text-2:       #4b5563;
  --text-3:       #9ca3af;
  --border:       #e5e7eb;
  --accent:       #2563eb;
  --accent-hover: #1d4ed8;
  --accent-light: rgba(37,99,235,0.10);
  --success:      #16a34a;
  --success-light:rgba(22,163,74,0.12);
  --warning:      #d97706;
  --danger:       #dc2626;
  --danger-light: rgba(220,38,38,0.10);

  --status-bg:    #0f172a;
  --status-text:  #f8fafc;
  --status-muted: #94a3b8;
  --nav-bg:       #ffffff;
  --nav-border:   #e5e7eb;
  --nav-active:   #2563eb;
  --nav-text:     #6b7280;

  --shadow-sm:    0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md:    0 4px 16px rgba(0,0,0,.10), 0 2px 4px rgba(0,0,0,.06);
  --shadow-lg:    0 10px 40px rgba(0,0,0,.14);
  --radius-sm:    8px;
  --radius-md:    12px;
  --radius-lg:    16px;
  --radius-xl:    20px;

  --transition:   150ms ease;
}

[data-theme="dark"] {
  --bg:           #0f172a;
  --bg-surface:   #1e293b;
  --bg-muted:     #0f172a;
  --text-1:       #f1f5f9;
  --text-2:       #94a3b8;
  --text-3:       #475569;
  --border:       #334155;
  --accent:       #3b82f6;
  --accent-hover: #60a5fa;
  --accent-light: rgba(59,130,246,0.15);
  --success:      #22c55e;
  --success-light:rgba(34,197,94,0.12);
  --danger:       #f87171;
  --danger-light: rgba(248,113,113,0.12);

  --status-bg:    #0a0f1a;
  --status-text:  #f1f5f9;
  --status-muted: #64748b;
  --nav-bg:       #1e293b;
  --nav-border:   #334155;
  --nav-active:   #60a5fa;
  --nav-text:     #64748b;

  --shadow-sm:    0 1px 3px rgba(0,0,0,.3);
  --shadow-md:    0 4px 16px rgba(0,0,0,.4);
  --shadow-lg:    0 10px 40px rgba(0,0,0,.5);
}

/* ─── BASE ─────────────────────────────────────────────────── */
html { scroll-behavior: smooth; }

body {
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text-1);
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  transition: background var(--transition), color var(--transition);
}

/* ─── STATUS BAR ───────────────────────────────────────────── */
#status-bar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1000;
  height: var(--status-bar-h);
  background: var(--status-bg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  box-shadow: 0 2px 12px rgba(0,0,0,.2);
}

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

.app-logo {
  width: 32px; height: 32px;
  background: var(--accent);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: #fff;
}

.app-name {
  font-size: 18px;
  font-weight: 700;
  color: var(--status-text);
  letter-spacing: -0.3px;
}

.table-chip {
  display: flex;
  align-items: center;
  gap: 5px;
  background: rgba(59,130,246,0.25);
  border: 1px solid rgba(59,130,246,0.4);
  color: #93c5fd;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 20px;
  letter-spacing: 0.3px;
}

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

.status-icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: var(--status-muted);
  cursor: pointer;
  border: none;
  background: none;
  transition: background var(--transition), color var(--transition);
}

.status-icon.online  { color: #22c55e; }
.status-icon.offline { color: #ef4444; }
.status-icon.syncing { color: var(--accent); }

.settings-btn:hover {
  background: rgba(255,255,255,0.08);
  color: var(--status-text);
}

/* ─── MAIN CONTENT ─────────────────────────────────────────── */
#main-content {
  position: fixed;
  top: var(--status-bar-h);
  bottom: var(--bottom-nav-h);
  left: 0; right: 0;
  overflow: hidden;
}

.view {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  overflow-x: hidden;
  display: none;
  flex-direction: column;
  -webkit-overflow-scrolling: touch;
}

.view.active {
  display: flex;
}

/* ─── VIEW HEADER ──────────────────────────────────────────── */
.view-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 16px 8px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.view-head h5 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-1);
  margin: 0;
}

.view-head-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-ghost-sm {
  width: 34px; height: 34px;
  border: none;
  background: var(--bg-muted);
  color: var(--text-2);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}

.btn-ghost-sm:hover {
  background: var(--border);
  color: var(--text-1);
}

/* ─── TABLE BANNER ─────────────────────────────────────────── */
#table-banner {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  padding: 12px 16px;
  position: sticky;
  top: 0;
  z-index: 20;
}

#table-banner.has-table {
  background: var(--accent-light);
  border-bottom-color: rgba(59,130,246,0.2);
}

.banner-content {
  display: flex;
  align-items: center;
  gap: 12px;
}

.banner-icon {
  width: 38px; height: 38px;
  background: var(--accent-light);
  color: var(--accent);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

#table-banner.has-table .banner-icon {
  background: var(--accent);
  color: #fff;
}

.banner-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.banner-text strong {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-1);
}

.banner-text span {
  font-size: 12px;
  color: var(--text-2);
}

/* ─── CATEGORY BAR ─────────────────────────────────────────── */
.category-bar {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  padding: 10px 0;
  position: sticky;
  top: 63px;
  z-index: 15;
}

.category-scroll {
  display: flex;
  gap: 8px;
  padding: 0 16px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.category-scroll::-webkit-scrollbar { display: none; }

.cat-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 20px;
  border: 1.5px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: all var(--transition);
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}

.cat-pill:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.cat-pill.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 2px 8px rgba(37,99,235,0.3);
}

.cat-pill i { font-size: 12px; }

/* ─── SEARCH BAR ───────────────────────────────────────────── */
.search-wrap {
  padding: 10px 16px;
  background: var(--bg);
  sticky: top;
}

.search-field {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-surface);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 8px 12px;
  transition: border-color var(--transition);
}

.search-field:focus-within {
  border-color: var(--accent);
}

.search-field i {
  color: var(--text-3);
  font-size: 14px;
  flex-shrink: 0;
}

.search-field input {
  border: none;
  background: none;
  outline: none;
  width: 100%;
  font-family: inherit;
  font-size: 14px;
  color: var(--text-1);
}

.search-field input::placeholder { color: var(--text-3); }

/* ─── MENU GRID ────────────────────────────────────────────── */
.menu-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  padding: 12px 16px 16px;
}

@media (min-width: 600px) {
  .menu-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
}

@media (min-width: 900px) {
  .menu-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
}

.menu-card {
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border);
  overflow: hidden;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
  display: flex;
  flex-direction: column;
  -webkit-tap-highlight-color: transparent;
}

.menu-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--accent);
}

.menu-card:active {
  transform: translateY(0);
}

.menu-card-img {
  height: 90px;
  background: var(--bg-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  color: var(--text-3);
}

.menu-card-body {
  padding: 10px 12px 12px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.menu-card-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-1);
  line-height: 1.3;
}

.menu-card-desc {
  font-size: 11px;
  color: var(--text-3);
  line-height: 1.3;
  flex: 1;
}

.menu-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
}

.menu-card-price {
  font-size: 14px;
  font-weight: 700;
  color: var(--accent);
  font-family: 'DM Mono', monospace;
}

.menu-card-add {
  width: 26px; height: 26px;
  background: var(--accent);
  color: #fff;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  flex-shrink: 0;
}

/* ─── ORDER VIEW ───────────────────────────────────────────── */
.table-badge-sm {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--accent-light);
  color: var(--accent);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
}

.order-list {
  flex: 1;
  padding: 8px 16px;
}

.order-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-bottom: 8px;
  transition: border-color var(--transition);
}

.order-item-qty {
  width: 28px; height: 28px;
  background: var(--accent);
  color: #fff;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}

.order-item-info {
  flex: 1;
  min-width: 0;
}

.order-item-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.order-item-note {
  font-size: 11px;
  color: var(--text-3);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.order-item-price {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-1);
  font-family: 'DM Mono', monospace;
  flex-shrink: 0;
}

.order-item-remove {
  width: 28px; height: 28px;
  border: none;
  background: var(--danger-light);
  color: var(--danger);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  cursor: pointer;
  flex-shrink: 0;
  transition: background var(--transition);
}

.order-item-remove:hover { background: var(--danger); color: #fff; }

/* ─── ORDER FOOTER ─────────────────────────────────────────── */
.order-footer {
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
  padding: 16px 16px;
  position: sticky;
  bottom: 0;
}

.order-summary {
  margin-bottom: 14px;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  color: var(--text-2);
  padding: 4px 0;
}

.summary-row.total {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-1);
}

.summary-divider {
  height: 1px;
  background: var(--border);
  margin: 8px 0;
}

#order-subtotal, #order-total { font-family: 'DM Mono', monospace; }

.btn-submit {
  width: 100%;
  padding: 14px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
  box-shadow: 0 4px 14px rgba(37,99,235,0.35);
}

.btn-submit:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(37,99,235,0.4);
}

.btn-submit:active { transform: translateY(0); }

/* ─── HISTORY LIST ─────────────────────────────────────────── */
.history-list { padding: 8px 16px 16px; }

.history-card {
  background: var(--bg-surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.history-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-sm);
}

.history-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.history-card-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.history-table-badge {
  background: var(--accent-light);
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  font-family: 'DM Mono', monospace;
}

.history-time {
  font-size: 12px;
  color: var(--text-3);
}

.history-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
}

.status-synced   { background: var(--success-light); color: var(--success); }
.status-pending  { background: rgba(217,119,6,0.12); color: var(--warning); }
.status-failed   { background: var(--danger-light);  color: var(--danger);  }

.history-items-preview {
  font-size: 12px;
  color: var(--text-2);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.history-card-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.history-total {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-1);
  font-family: 'DM Mono', monospace;
}

.history-emp {
  font-size: 11px;
  color: var(--text-3);
}

/* ─── BOTTOM NAVIGATION ────────────────────────────────────── */
#bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 1000;
  height: var(--bottom-nav-h);
  background: var(--nav-bg);
  border-top: 1px solid var(--nav-border);
  display: flex;
  align-items: stretch;
  box-shadow: 0 -4px 20px rgba(0,0,0,.08);
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--nav-text);
  padding: 8px 4px;
  transition: color var(--transition);
  -webkit-tap-highlight-color: transparent;
  position: relative;
}

.nav-item.active { color: var(--nav-active); }

.nav-icon {
  position: relative;
  font-size: 20px;
  line-height: 1;
}

.nav-label {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.3px;
}

.cart-badge {
  position: absolute;
  top: -6px; right: -8px;
  background: var(--danger);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  width: 16px; height: 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'DM Mono', monospace;
}

/* ─── EMPTY STATE ──────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 32px;
  text-align: center;
  flex: 1;
}

.empty-icon {
  width: 72px; height: 72px;
  background: var(--bg-muted);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  color: var(--text-3);
  margin-bottom: 16px;
}

.empty-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-1);
  margin: 0 0 4px;
}

.empty-sub {
  font-size: 13px;
  color: var(--text-3);
  margin: 0;
}

/* ─── MODALS ───────────────────────────────────────────────── */
.modal-content {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl) !important;
  overflow: hidden;
}

.modal-header {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  padding: 18px 20px;
}

.modal-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-1);
}

.modal-body {
  padding: 20px;
  background: var(--bg-surface);
  color: var(--text-1);
}

.modal-footer {
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
  padding: 14px 20px;
  gap: 10px;
}

.btn-close {
  filter: none;
  opacity: 0.6;
}

[data-theme="dark"] .btn-close {
  filter: invert(1);
}

/* NEU — ans Ende der Datei anfügen */
#modal-table .modal-content {
  border-radius: 0 !important;
  border: none;
}

#modal-table .modal-header {
  padding: 20px 20px;
  padding-top: calc(20px + env(safe-area-inset-top));
}

#modal-table .modal-body {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

#modal-table .modal-footer {
  padding-bottom: calc(16px + env(safe-area-inset-bottom));
}

/* Schnellauswahl-Grid größer im Fullscreen */
#modal-table .table-quick-grid {
  grid-template-columns: repeat(6, 1fr);
}

@media (min-width: 600px) {
  #modal-table .table-quick-grid {
    grid-template-columns: repeat(8, 1fr);
  }
}

/* ─── TABLE QUICK GRID ─────────────────────────────────────── */
.table-quick-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

.table-quick-btn {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-muted);
  color: var(--text-2);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  font-family: 'DM Mono', monospace;
}

.table-quick-btn:hover,
.table-quick-btn.selected {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ─── TISCH-TABS ────────────────────────────────────────────── */
.order-table-tabs {
  display: flex;
  gap: 6px;
  padding: 10px 16px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
  flex-shrink: 0;
}

.order-table-tabs::-webkit-scrollbar { display: none; }

.tab-empty-hint {
  font-size: 13px;
  color: var(--text-3);
  margin: auto 0;
  padding: 4px 0;
}

.table-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 20px;
  border: 1.5px solid var(--border);
  background: var(--bg-muted);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  flex-shrink: 0;
  transition: all var(--transition);
}

.table-tab:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.table-tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 2px 8px rgba(37,99,235,0.3);
}

.table-tab-add {
  width: 36px;
  padding: 7px;
  justify-content: center;
}

.tab-item-count {
  background: rgba(255,255,255,0.25);
  color: inherit;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 10px;
  font-family: 'DM Mono', monospace;
}

.table-tab:not(.active) .tab-item-count {
  background: var(--accent-light);
  color: var(--accent);
}

/* ─── INLINE QTY-CONTROL IN BESTELLLISTE ────────────────────── */
.order-item {
  /* bestehende Styles bleiben, align-items anpassen: */
  align-items: center;
  gap: 10px;
}

.order-qty-control {
  display: flex;
  align-items: center;
  gap: 0;
  background: var(--bg-muted);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
}

.order-qty-btn {
  width: 30px; height: 30px;
  border: none;
  background: none;
  color: var(--accent);
  font-size: 11px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition);
}

.order-qty-btn:hover { background: var(--accent-light); }

.order-qty-val {
  min-width: 28px;
  text-align: center;
  font-size: 14px;
  font-weight: 700;
  font-family: 'DM Mono', monospace;
  color: var(--text-1);
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  line-height: 30px;
}

/* ─── QR READER ────────────────────────────────────────────── */
.qr-reader-box {
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 2px solid var(--accent);
}

#html5-qrcode-button-camera-permission,
#html5-qrcode-button-camera-start,
#html5-qrcode-button-camera-stop {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 6px 14px;
  font-family: inherit;
  cursor: pointer;
  margin: 4px;
}

/* ─── SETTINGS ─────────────────────────────────────────────── */
.settings-group {
  border-bottom: 1px solid var(--border);
}

.settings-group-last { border-bottom: none; }

.settings-group-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-3);
  padding: 14px 20px 6px;
}

.settings-item {
  padding: 8px 20px 14px;
}

.settings-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  margin-bottom: 8px;
}

.settings-label i {
  width: 16px;
  color: var(--accent);
  font-size: 12px;
}

.settings-input {
  background: var(--bg-muted) !important;
  border-color: var(--border) !important;
  color: var(--text-1) !important;
  border-radius: 8px !important;
}

.settings-input:focus {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 3px var(--accent-light) !important;
}

.settings-toggle-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 20px 14px;
}

.settings-toggle-item .settings-label {
  margin: 0;
  flex: 1;
  align-items: flex-start;
}

.settings-toggle-item .settings-label i {
  margin-top: 2px;
}

.settings-toggle-item .settings-label div {
  display: flex;
  flex-direction: column;
}

.settings-toggle-item .settings-label span {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-1);
}

.settings-toggle-item .settings-label small {
  font-size: 11px;
  color: var(--text-3);
}

.form-check-input {
  background-color: var(--bg-muted);
  border-color: var(--border);
}

.form-check-input:checked {
  background-color: var(--accent);
  border-color: var(--accent);
}

.sync-info-box {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-2);
  background: var(--bg-muted);
  border-radius: 8px;
  padding: 10px 12px;
}

.app-info-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text-2);
  padding: 3px 0;
}

.mono {
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  color: var(--accent);
}

/* ─── ITEM DETAIL MODAL ────────────────────────────────────── */
.item-modal-price {
  font-size: 26px;
  font-weight: 700;
  color: var(--accent);
  font-family: 'DM Mono', monospace;
}

.qty-row { text-align: center; }

.qty-control {
  display: inline-flex;
  align-items: center;
  gap: 0;
  background: var(--bg-muted);
  border-radius: 10px;
  overflow: hidden;
  border: 1.5px solid var(--border);
}

.qty-btn {
  width: 44px; height: 44px;
  border: none;
  background: none;
  color: var(--accent);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition);
}

.qty-btn:hover { background: var(--accent-light); }

.qty-value {
  width: 48px;
  text-align: center;
  font-size: 18px;
  font-weight: 700;
  font-family: 'DM Mono', monospace;
  color: var(--text-1);
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  line-height: 44px;
}

/* ─── FORMS ────────────────────────────────────────────────── */
.form-control, .form-select {
  background: var(--bg-muted) !important;
  border-color: var(--border) !important;
  color: var(--text-1) !important;
  border-radius: 8px !important;
  font-family: inherit;
}

.form-control:focus, .form-select:focus {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 3px var(--accent-light) !important;
}

.form-control::placeholder { color: var(--text-3) !important; }

.input-group-text {
  background: var(--bg-muted) !important;
  border-color: var(--border) !important;
  color: var(--text-2) !important;
}

textarea.form-control { resize: none; }

/* ─── BUTTONS ──────────────────────────────────────────────── */
.btn-primary {
  background: var(--accent) !important;
  border-color: var(--accent) !important;
  font-weight: 600;
}

.btn-primary:hover {
  background: var(--accent-hover) !important;
  border-color: var(--accent-hover) !important;
}

.btn-ghost {
  background: var(--bg-muted);
  border-color: var(--border);
  color: var(--text-2);
}

.btn-ghost:hover {
  background: var(--border);
  color: var(--text-1);
}

.btn-outline-secondary {
  border-color: var(--border) !important;
  color: var(--text-2) !important;
}

.btn-outline-secondary:hover {
  background: var(--bg-muted) !important;
  color: var(--text-1) !important;
}

.btn-outline-primary {
  border-color: var(--accent) !important;
  color: var(--accent) !important;
}

.btn-outline-primary:hover {
  background: var(--accent) !important;
  color: #fff !important;
}

/* ─── TOAST ────────────────────────────────────────────────── */
.pb-nav { padding-bottom: calc(var(--bottom-nav-h) + 8px) !important; }

#app-toast {
  min-width: 200px;
  border-radius: var(--radius-md) !important;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 500;
}

#app-toast.bg-success { background: var(--success) !important; }
#app-toast.bg-danger  { background: var(--danger)  !important; }
#app-toast.bg-warning { background: var(--warning) !important; color: #fff; }

.toast-body { padding: 10px 14px; color: #fff; }

/* ─── LOADING SPINNER ──────────────────────────────────────── */
.loading-spinner {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}

/* ─── SCROLLBAR ────────────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 10px;
}

/* ─── ANIMATIONS ───────────────────────────────────────────── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.menu-card, .order-item, .history-card {
  animation: fadeInUp 200ms ease both;
}

/* ─── SAFE AREAS (iPhone notch) ────────────────────────────── */
@supports (padding: env(safe-area-inset-bottom)) {
  #bottom-nav {
    padding-bottom: env(safe-area-inset-bottom);
    height: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom));
  }
  :root {
    --bottom-nav-h: calc(68px + env(safe-area-inset-bottom));
  }
}

/* ─── RESPONSIVE ───────────────────────────────────────────── */
@media (min-width: 768px) {
  #bottom-nav { display: flex; justify-content: center; }
  .nav-item { max-width: 120px; }
  .modal-dialog { max-width: 480px; }
}

/*
@media (min-width: 1024px) {
  #main-content { max-width: 960px; margin: 0 auto; }
  #status-bar, #bottom-nav { max-width: none; }
}
*/
