/* ============================================================
   VNPOS Design System v1.0
   Hệ thống POS & F&B - Giao diện tiếng Việt
   ============================================================ */

/* 1. DESIGN TOKENS */
:root {
  /* Brand */
  --primary: #1e293b;
  --primary-dark: #0f172a;
  --primary-light: #334155;
  --accent: #ff9900;
  --accent-dark: #d97e00;
  --accent-light: #ffb833;

  /* Semantic */
  --success: #22c55e;
  --success-bg: rgba(34,197,94,.12);
  --warning: #f59e0b;
  --warning-bg: rgba(245,158,11,.12);
  --danger: #ef4444;
  --danger-bg: rgba(239,68,68,.12);
  --info: #3b82f6;
  --info-bg: rgba(59,130,246,.12);
  --purple: #8b5cf6;
  --purple-bg: rgba(139,92,246,.12);
  --cyan: #06b6d4;
  --cyan-bg: rgba(6,182,212,.12);

  /* Backgrounds — 5-step slate scale */
  --bg-base: #0f172a;
  --bg-surface: #1e293b;
  --bg-card: #243345;
  --bg-elevated: #2b3c52;
  --bg-hover: #334460;

  /* Borders */
  --border: #2e4060;
  --border-light: #3d5270;

  /* Text */
  --text-primary: #f0f4f8;
  --text-secondary: #8ca3bc;
  --text-muted: #5a7090;
  --text-disabled: #3d506a;

  /* Table status */
  --table-available: #22c55e;
  --table-occupied: #3b82f6;
  --table-reserved: #f59e0b;
  --table-payment: #8b5cf6;
  --table-overdue: #ef4444;

  --radius-sm: 4px;
  --radius: 7px;
  --radius-md: 9px;
  --radius-lg: 11px;
  --radius-xl: 14px;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 3px rgba(0,0,0,.5);
  --shadow: 0 2px 8px rgba(0,0,0,.55);
  --shadow-md: 0 4px 16px rgba(0,0,0,.6);
  --shadow-lg: 0 8px 32px rgba(0,0,0,.72);

  --transition: 140ms ease;
  --transition-md: 220ms ease;

  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI Variable', 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
}

/* 2. RESET */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; }
body {
  font-family: var(--font);
  background: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.5;
  height: 100vh;
  overflow: hidden;
}
body.scrollable { overflow: auto; height: auto; }
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; border: none; outline: none; }
input, select, textarea { font-family: inherit; }
ul, ol { list-style: none; }

/* 3. APP LAYOUT */
.app { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }

.app-header {
  height: 52px;
  background: var(--primary-dark);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 8px;
  padding: 0 12px; flex-shrink: 0; z-index: 20;
}

.app-cmdbar {
  height: 44px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 4px;
  padding: 0 10px; flex-shrink: 0; z-index: 10;
}

.app-body { display: flex; flex: 1; overflow: hidden; }

.app-sidebar {
  width: 196px; flex-shrink: 0;
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  overflow-y: auto; display: flex; flex-direction: column;
}

.app-main { flex: 1; overflow: auto; background: var(--bg-base); }
.app-main-noscroll { flex: 1; overflow: hidden; background: var(--bg-base); display: flex; flex-direction: column; }

.app-panel {
  width: 308px; flex-shrink: 0;
  background: var(--bg-surface);
  border-left: 1px solid var(--border);
  display: flex; flex-direction: column; overflow: hidden;
}

/* 4. HEADER */
.logo {
  display: flex; align-items: center; gap: 8px;
  padding-right: 12px; border-right: 1px solid var(--border);
  flex-shrink: 0;
}
.logo-mark {
  width: 32px; height: 32px; border-radius: var(--radius);
  background: var(--accent); color: #fff;
  font-size: 15px; font-weight: 900; letter-spacing: -1px;
  display: flex; align-items: center; justify-content: center;
}
.logo-text { font-size: 14px; font-weight: 800; color: #fff; letter-spacing: .5px; }
.logo-sub { font-size: 10px; color: var(--text-muted); letter-spacing: .3px; }

.hdr-info { font-size: 11px; color: var(--text-secondary); display: flex; align-items: center; gap: 6px; }
.hdr-sep { width: 1px; height: 18px; background: var(--border); }
.hdr-clock {
  font-size: 14px; font-weight: 700; color: #fff;
  font-variant-numeric: tabular-nums; letter-spacing: 1px;
  background: var(--bg-card); padding: 3px 10px;
  border-radius: var(--radius); border: 1px solid var(--border);
}
.hdr-actions { margin-left: auto; display: flex; align-items: center; gap: 3px; }

.status-pill {
  display: flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: var(--radius-full);
  font-size: 11px; font-weight: 600;
  background: var(--bg-card); border: 1px solid var(--border);
  color: var(--text-secondary);
}
.status-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--success); animation: pulse 2.5s infinite;
}
.status-dot.offline { background: var(--danger); animation: none; }
.status-dot.slow { background: var(--warning); }

@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.4} }

/* 5. COMMAND BAR */
.cmd-btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 9px; border-radius: var(--radius);
  font-size: 12px; color: var(--text-secondary);
  background: var(--bg-card); border: 1px solid var(--border);
  transition: all var(--transition); white-space: nowrap; cursor: pointer;
}
.cmd-btn:hover { background: var(--bg-elevated); color: var(--text-primary); border-color: var(--border-light); }
.cmd-btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }
.cmd-btn.primary:hover { background: var(--primary-light); }
.cmd-btn.accent { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700; }
.cmd-btn.accent:hover { background: var(--accent-dark); }
.cmd-btn.success { background: var(--success); border-color: var(--success); color: #fff; font-weight: 600; }
.cmd-btn.success:hover { filter: brightness(.9); }

.key {
  display: inline-block; padding: 1px 4px;
  background: var(--bg-elevated); border: 1px solid var(--border-light);
  border-radius: 3px; font-size: 9px; font-weight: 700;
  color: var(--text-muted); font-family: var(--font-mono);
}
.cmd-btn.accent .key, .cmd-btn.primary .key { background: rgba(0,0,0,.2); border-color: rgba(255,255,255,.25); color: rgba(255,255,255,.75); }

.cmd-sep { width: 1px; height: 22px; background: var(--border); margin: 0 3px; }

.cmd-search {
  display: flex; align-items: center; gap: 7px;
  padding: 5px 10px; border-radius: var(--radius);
  background: var(--bg-card); border: 1px solid var(--border);
  color: var(--text-muted); font-size: 12px;
  min-width: 180px; cursor: text; flex: 1; max-width: 260px;
}
.cmd-search input {
  background: none; border: none; outline: none;
  color: var(--text-primary); font-size: 12px; width: 100%;
}
.cmd-search input::placeholder { color: var(--text-muted); }

/* 6. BUTTONS */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 7px 14px; border-radius: var(--radius);
  font-size: 13px; font-weight: 500; cursor: pointer;
  transition: all var(--transition); border: none; white-space: nowrap; min-height: 34px;
}
.btn-sm { padding: 4px 10px; font-size: 12px; min-height: 28px; }
.btn-lg { padding: 10px 20px; font-size: 14px; min-height: 40px; }
.btn-xl { padding: 14px 28px; font-size: 15px; min-height: 48px; font-weight: 700; }
.btn-xxl { padding: 16px 32px; font-size: 16px; min-height: 56px; font-weight: 800; }
.btn-block { width: 100%; }
.btn-icon { width: 32px; height: 32px; padding: 0; border-radius: var(--radius); font-size: 15px; }
.btn-icon.sm { width: 26px; height: 26px; font-size: 13px; }
.btn-icon.lg { width: 40px; height: 40px; font-size: 18px; }

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-light); }
.btn-accent { background: var(--accent); color: #fff; font-weight: 700; }
.btn-accent:hover { background: var(--accent-dark); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { filter: brightness(.9); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(.9); }
.btn-warning { background: var(--warning); color: #fff; }
.btn-warning:hover { filter: brightness(.9); }
.btn-info { background: var(--info); color: #fff; }
.btn-info:hover { filter: brightness(.9); }
.btn-purple { background: var(--purple); color: #fff; }
.btn-purple:hover { filter: brightness(.9); }
.btn-ghost {
  background: transparent; color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--bg-elevated); color: var(--text-primary); }
.btn-flat { background: var(--bg-elevated); color: var(--text-secondary); }
.btn-flat:hover { background: var(--bg-hover); color: var(--text-primary); }

.btn:disabled { opacity: .4; cursor: not-allowed; pointer-events: none; }
.btn-icon { background: transparent; color: var(--text-muted); border: none; }
.btn-icon:hover { background: var(--bg-elevated); color: var(--text-primary); }

/* 7. BADGES & CHIPS */
.badge {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 2px 7px; border-radius: var(--radius-full);
  font-size: 10px; font-weight: 700; white-space: nowrap; text-transform: uppercase; letter-spacing: .3px;
}
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger  { background: var(--danger-bg);  color: var(--danger);  }
.badge-info    { background: var(--info-bg);    color: var(--info);    }
.badge-primary { background: rgba(59,130,246,.2); color: #60a5fa; }
.badge-purple  { background: var(--purple-bg);  color: var(--purple);  }
.badge-gray    { background: rgba(90,115,153,.15); color: var(--text-secondary); }
.badge-accent  { background: rgba(255,152,0,.15); color: var(--accent); }
.badge-cyan    { background: var(--cyan-bg); color: var(--cyan); }

.chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 12px; border-radius: var(--radius-full);
  font-size: 12px; font-weight: 500; cursor: pointer;
  border: 1px solid var(--border); background: var(--bg-card);
  color: var(--text-secondary); white-space: nowrap;
  transition: all var(--transition);
}
.chip:hover { border-color: var(--border-light); color: var(--text-primary); }
.chip.active { background: var(--info); border-color: var(--info); color: #fff; }
.chip.active-success { background: var(--success); border-color: var(--success); color: #fff; }
.chip.active-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.chip.active-warning { background: var(--warning); border-color: var(--warning); color: #fff; }
.chip.active-accent { background: var(--accent); border-color: var(--accent); color: #fff; }

/* 8. FORMS */
.form-row { display: flex; gap: 12px; }
.form-row > * { flex: 1; }
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-label { font-size: 12px; font-weight: 600; color: var(--text-secondary); }
.form-label .req { color: var(--danger); }

.form-control {
  padding: 8px 11px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text-primary);
  font-size: 13px; outline: none; width: 100%;
  transition: border-color var(--transition);
}
.form-control:focus { border-color: var(--info); }
.form-control::placeholder { color: var(--text-muted); }
.form-control-sm { padding: 5px 8px; font-size: 12px; }
.form-control-lg { padding: 10px 14px; font-size: 15px; border-radius: var(--radius-md); }

select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%235a7399' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
}

/* 9. CARDS */
.card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); overflow: hidden;
}
.card-header {
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.card-title { font-size: 13px; font-weight: 700; }
.card-body { padding: 16px; }
.card-footer { padding: 12px 16px; border-top: 1px solid var(--border); background: var(--bg-elevated); }

/* 10. TABLE MAP */
.area-tabs {
  display: flex; gap: 4px; padding: 10px 14px 6px;
  border-bottom: 1px solid var(--border); overflow-x: auto;
  background: var(--bg-surface); flex-shrink: 0;
}

.filter-bar {
  display: flex; gap: 6px; padding: 8px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-surface); flex-shrink: 0;
  overflow-x: auto;
}

.table-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
  gap: 9px; padding: 14px;
  align-content: start;
}

.table-card {
  background: var(--bg-card); border: 2px solid var(--border);
  border-radius: var(--radius-lg); padding: 10px;
  cursor: pointer; transition: all var(--transition);
  min-height: 108px; display: flex; flex-direction: column;
  gap: 4px; position: relative; user-select: none;
}
.table-card:hover { border-color: var(--border-light); transform: translateY(-1px); box-shadow: var(--shadow); }
.table-card.selected { border-color: var(--info) !important; box-shadow: 0 0 0 2px rgba(59,130,246,.3); }

.table-card.available { border-color: rgba(34,197,94,.35); }
.table-card.available:hover { border-color: var(--table-available); }
.table-card.occupied { border-color: rgba(59,130,246,.5); background: rgba(59,130,246,.04); }
.table-card.reserved { border-color: rgba(245,158,11,.5); background: rgba(245,158,11,.04); }
.table-card.payment  { border-color: rgba(139,92,246,.5); background: rgba(139,92,246,.04); }
.table-card.overdue  { border-color: rgba(239,68,68,.6);  background: rgba(239,68,68,.06); }

.table-name { font-size: 14px; font-weight: 800; }
.table-area { font-size: 10px; color: var(--text-muted); }

.table-status-label {
  font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px;
  margin-top: 2px;
}
.table-card.available .table-status-label { color: var(--table-available); }
.table-card.occupied  .table-status-label { color: var(--table-occupied); }
.table-card.reserved  .table-status-label { color: var(--table-reserved); }
.table-card.payment   .table-status-label { color: var(--table-payment); }
.table-card.overdue   .table-status-label { color: var(--table-overdue); }

.table-meta { margin-top: auto; display: flex; flex-direction: column; gap: 2px; }
.table-total { font-size: 12px; font-weight: 700; }
.table-time  { font-size: 10px; color: var(--text-secondary); }
.table-guests { font-size: 10px; color: var(--text-muted); }

.table-badges {
  position: absolute; top: 7px; right: 7px;
  display: flex; gap: 2px;
}
.table-badge {
  width: 17px; height: 17px; border-radius: 50%;
  font-size: 9px; display: flex; align-items: center; justify-content: center;
}
.table-badge.call    { background: var(--warning); color: #fff; }
.table-badge.pay     { background: var(--purple);  color: #fff; }
.table-badge.overdue { background: var(--danger);  color: #fff; }

/* 11. PRODUCT GRID */
.category-bar {
  width: 160px; flex-shrink: 0;
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  overflow-y: auto; padding: 8px;
  display: flex; flex-direction: column; gap: 1px;
}

.cat-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; border-radius: var(--radius);
  font-size: 12px; font-weight: 500; cursor: pointer;
  color: var(--text-secondary); transition: all var(--transition);
}
.cat-item:hover { background: var(--bg-elevated); color: var(--text-primary); }
.cat-item.active { background: rgba(59,130,246,.22); color: #fff; font-weight: 700; }
.cat-icon { font-size: 16px; flex-shrink: 0; }
.cat-count { margin-left: auto; font-size: 10px; color: var(--text-muted); }

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 7px; padding: 10px;
  align-content: start;
}

.product-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); overflow: hidden;
  cursor: pointer; transition: all var(--transition);
  display: flex; flex-direction: column;
}
.product-card:hover { border-color: var(--border-light); transform: translateY(-1px); box-shadow: var(--shadow); }
.product-card.out { opacity: .45; cursor: not-allowed; }
.product-card.out:hover { transform: none; box-shadow: none; }
.product-card.selected { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(255,152,0,.25); }

.product-thumb {
  aspect-ratio: 4/3; display: flex; align-items: center; justify-content: center;
  font-size: 30px; background: var(--bg-elevated); position: relative; overflow: hidden;
}
.product-thumb .emoji { z-index: 1; position: relative; }

.product-badge {
  position: absolute; top: 5px; left: 5px;
  padding: 2px 5px; border-radius: var(--radius-sm);
  font-size: 8px; font-weight: 800; text-transform: uppercase;
}
.product-badge.hot  { background: #ef4444; color: #fff; }
.product-badge.new  { background: #22c55e; color: #fff; }
.product-badge.sig  { background: var(--accent); color: #fff; }
.product-badge.sale { background: #8b5cf6; color: #fff; }
.product-badge.veg  { background: #16a34a; color: #fff; }

.product-out-overlay {
  position: absolute; inset: 0;
  background: rgba(0,0,0,.5);
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; color: var(--danger);
  text-transform: uppercase; letter-spacing: .5px;
}

.product-info { padding: 7px 8px; flex: 1; display: flex; flex-direction: column; gap: 3px; }
.product-name { font-size: 11px; font-weight: 600; line-height: 1.3; color: var(--text-primary); }
.product-price { font-size: 12px; font-weight: 800; color: var(--accent); }
.product-old-price { font-size: 10px; color: var(--text-muted); text-decoration: line-through; }

/* 12. ORDER PANEL */
.order-header-strip {
  padding: 10px 14px; background: var(--bg-card);
  border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.order-num { font-size: 11px; font-weight: 700; color: var(--accent); font-family: var(--font-mono); }
.order-meta { font-size: 11px; color: var(--text-secondary); }
.order-channel { display: inline-flex; align-items: center; }

.order-items-wrap { flex: 1; overflow-y: auto; padding: 6px; }

.order-item {
  padding: 8px 9px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--bg-card);
  margin-bottom: 5px; display: flex; flex-direction: column; gap: 4px;
  position: relative; transition: border-color var(--transition);
}
.order-item:hover { border-color: var(--border-light); }
.order-item.selected-item { border-color: var(--accent); }

.order-item-name { font-size: 12px; font-weight: 700; padding-right: 20px; }
.order-item-mods { font-size: 10px; color: var(--text-muted); line-height: 1.4; }
.order-item-note { font-size: 10px; color: var(--info); font-style: italic; }

.order-item-row { display: flex; align-items: center; justify-content: space-between; gap: 6px; }

.qty-ctrl { display: flex; align-items: center; gap: 4px; }
.qty-btn {
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--bg-elevated); border: 1px solid var(--border);
  color: var(--text-primary); font-size: 14px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all var(--transition); line-height: 1;
}
.qty-btn:hover { background: var(--primary-light); border-color: var(--primary-light); }
.qty-val { width: 26px; text-align: center; font-size: 13px; font-weight: 800; }

.order-item-price { font-size: 12px; font-weight: 800; }

.item-status-dot {
  position: absolute; top: 7px; right: 7px;
  width: 7px; height: 7px; border-radius: 50%;
}
.item-status-dot.draft     { background: var(--text-muted); }
.item-status-dot.sent      { background: var(--warning); }
.item-status-dot.preparing { background: var(--info); }
.item-status-dot.ready     { background: var(--success); }
.item-status-dot.served    { background: var(--text-disabled); }
.item-status-dot.cancelled { background: var(--danger); }

/* 13. ORDER TOTALS */
.totals-panel {
  padding: 10px 14px;
  border-top: 1px solid var(--border);
  background: var(--bg-card); flex-shrink: 0;
}
.total-row {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 12px; color: var(--text-secondary); margin-bottom: 4px;
}
.total-row.grand {
  font-size: 15px; font-weight: 800; color: var(--text-primary);
  padding-top: 8px; border-top: 1px solid var(--border);
  margin-top: 4px; margin-bottom: 0;
}
.total-row.grand .tv { font-size: 18px; color: var(--accent); }
.total-row.discount .tv { color: var(--success); }
.total-row.discount { color: var(--success); }

.order-action-bar {
  padding: 10px; border-top: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 6px; flex-shrink: 0;
}
.order-action-row { display: flex; gap: 6px; }
.order-action-row .btn { flex: 1; font-size: 12px; padding: 8px 6px; }

/* 14. KDS */
.kds-board { display: flex; gap: 10px; padding: 10px; height: 100%; overflow-x: auto; align-items: flex-start; }

.kds-col { display: flex; flex-direction: column; gap: 6px; min-width: 240px; max-width: 240px; }
.kds-col-header {
  padding: 8px 12px; border-radius: var(--radius-md);
  background: var(--bg-card); border: 1px solid var(--border);
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px;
  display: flex; align-items: center; justify-content: space-between;
}

.kds-ticket {
  background: var(--bg-card); border: 2px solid var(--border);
  border-radius: var(--radius-lg); display: flex; flex-direction: column;
  overflow: hidden; transition: all var(--transition);
}
.kds-ticket.new      { border-color: var(--warning); animation: ticketIn .4s ease; }
.kds-ticket.making   { border-color: var(--info); }
.kds-ticket.ready    { border-color: var(--success); }
.kds-ticket.overdue  { border-color: var(--danger); }

@keyframes ticketIn { from{transform:scale(.93);opacity:.5} to{transform:scale(1);opacity:1} }

.kds-ticket-head {
  padding: 9px 12px; display: flex; align-items: center;
  justify-content: space-between; gap: 8px; flex-shrink: 0;
}
.kds-ticket.new    .kds-ticket-head { background: rgba(245,158,11,.1); }
.kds-ticket.making .kds-ticket-head { background: rgba(59,130,246,.1); }
.kds-ticket.ready  .kds-ticket-head { background: rgba(34,197,94,.1); }
.kds-ticket.overdue .kds-ticket-head { background: rgba(239,68,68,.1); }

.kds-order-id { font-size: 15px; font-weight: 900; }
.kds-table-name { font-size: 11px; color: var(--text-secondary); }
.kds-timer {
  font-size: 18px; font-weight: 900; font-family: var(--font-mono);
  color: var(--success);
}
.kds-timer.warn { color: var(--warning); }
.kds-timer.late { color: var(--danger); animation: blink 1s infinite; }
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:.3} }

.kds-items { padding: 8px 10px; display: flex; flex-direction: column; gap: 5px; flex: 1; }
.kds-item {
  display: flex; gap: 8px; align-items: flex-start;
  padding: 6px 8px; background: var(--bg-elevated); border-radius: var(--radius);
}
.kds-item.done { opacity: .45; }
.kds-qty { font-size: 14px; font-weight: 900; color: var(--accent); min-width: 22px; }
.kds-item-body { flex: 1; }
.kds-item-name { font-size: 12px; font-weight: 700; }
.kds-item-mods { font-size: 10px; color: var(--text-muted); margin-top: 1px; }
.kds-item-note { font-size: 10px; color: var(--info); font-style: italic; }

.kds-ticket-foot {
  padding: 8px 10px; border-top: 1px solid var(--border);
  display: flex; gap: 5px; flex-shrink: 0;
}
.kds-ticket-foot .btn { flex: 1; font-size: 11px; }

/* 15. SIDEBAR NAV */
.nav-section { padding: 6px 6px 0; }
.nav-section-label {
  font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: .8px;
  color: var(--text-muted); padding: 8px 8px 3px;
}
.nav-item {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 9px; border-radius: var(--radius);
  font-size: 12px; color: var(--text-secondary);
  cursor: pointer; transition: all var(--transition);
  text-decoration: none; position: relative;
}
.nav-item:hover { background: var(--bg-elevated); color: var(--text-primary); }
.nav-item.active { background: rgba(59,130,246,.2); color: #fff; font-weight: 700; }
.nav-item.active::before {
  content: ''; position: absolute; left: 0; top: 6px; bottom: 6px;
  width: 3px; background: var(--accent); border-radius: 0 2px 2px 0;
}
.nav-icon { width: 17px; flex-shrink: 0; font-size: 15px; text-align: center; }
.nav-badge { margin-left: auto; }
.nav-item span.nav-badge.badge { padding: 1px 5px; font-size: 9px; }

/* 16. MODALS */
.overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.72);
  z-index: 200; display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity var(--transition-md);
}
.overlay.open { opacity: 1; pointer-events: all; }

.modal {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-xl); width: 90%; max-width: 520px;
  max-height: 90vh; display: flex; flex-direction: column;
  transform: scale(.94) translateY(12px);
  transition: transform var(--transition-md); box-shadow: var(--shadow-lg);
}
.overlay.open .modal { transform: scale(1) translateY(0); }
.modal-lg  { max-width: 740px; }
.modal-xl  { max-width: 960px; }
.modal-sm  { max-width: 380px; }
.modal-xxl { max-width: 1100px; }

.modal-header {
  padding: 14px 18px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; flex-shrink: 0;
}
.modal-title { font-size: 14px; font-weight: 800; }
.modal-close {
  width: 27px; height: 27px; border-radius: 50%;
  background: var(--bg-elevated); border: none;
  color: var(--text-secondary); display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 15px; transition: all var(--transition);
}
.modal-close:hover { background: var(--bg-hover); color: var(--text-primary); }
.modal-body { padding: 18px; overflow-y: auto; flex: 1; }
.modal-footer {
  padding: 14px 18px; border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 7px; flex-shrink: 0;
}

/* 17. MODIFIER DIALOG */
.mod-group { margin-bottom: 14px; }
.mod-group-title {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .5px; color: var(--text-muted);
  margin-bottom: 7px; display: flex; align-items: center; gap: 8px;
}
.mod-required { color: var(--danger); font-size: 9px; font-weight: 700; }

.mod-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 5px;
}
.mod-option {
  padding: 7px 4px; border: 2px solid var(--border);
  border-radius: var(--radius); text-align: center;
  cursor: pointer; transition: all var(--transition);
  background: var(--bg-elevated);
}
.mod-option:hover { border-color: var(--info); background: rgba(59,130,246,.14); }
.mod-option.sel { border-color: var(--info); background: rgba(59,130,246,.28); }
.mod-option.sel-accent { border-color: var(--accent); background: rgba(255,107,43,.15); }
.mod-option.out { opacity: .35; cursor: not-allowed; pointer-events: none; }
.mod-opt-name { font-size: 11px; font-weight: 700; color: var(--text-primary); }
.mod-opt-price { font-size: 9px; color: var(--text-muted); margin-top: 2px; }
.mod-opt-price.priced { color: var(--accent); }

/* 18. PAYMENT */
.pay-methods { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 14px; }
.pay-method {
  padding: 10px 6px; border: 2px solid var(--border);
  border-radius: var(--radius-md); text-align: center;
  cursor: pointer; transition: all var(--transition);
  background: var(--bg-elevated);
}
.pay-method:hover { border-color: var(--border-light); }
.pay-method.active { border-color: var(--accent); background: rgba(255,107,43,.1); }
.pay-icon { font-size: 22px; margin-bottom: 4px; }
.pay-name { font-size: 11px; font-weight: 700; color: var(--text-primary); }

.numpad {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px;
  max-width: 280px; margin: 0 auto;
}
.numpad-btn {
  height: 52px; border-radius: var(--radius-md);
  background: var(--bg-elevated); border: 1px solid var(--border);
  font-size: 18px; font-weight: 700; color: var(--text-primary);
  cursor: pointer; transition: all var(--transition);
  display: flex; align-items: center; justify-content: center;
}
.numpad-btn:hover { background: var(--bg-hover); border-color: var(--border-light); }
.numpad-btn.accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.numpad-btn.ghost { background: transparent; color: var(--text-muted); }

.qr-box {
  width: 180px; height: 180px;
  background: #fff; border-radius: var(--radius-lg);
  padding: 10px; margin: 0 auto;
  display: flex; align-items: center; justify-content: center;
}

/* 19. STAT CARDS */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }

.stat-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 14px;
  display: flex; flex-direction: column; gap: 6px;
}
.stat-label { font-size: 11px; color: var(--text-muted); display: flex; align-items: center; gap: 5px; }
.stat-value { font-size: 22px; font-weight: 900; font-variant-numeric: tabular-nums; }
.stat-sub { font-size: 11px; display: flex; align-items: center; gap: 4px; }
.stat-sub.up { color: var(--success); }
.stat-sub.down { color: var(--danger); }
.stat-sub.neutral { color: var(--text-muted); }

/* 20. DATA TABLE */
.data-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.data-table th {
  padding: 9px 12px; text-align: left;
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px;
  color: var(--text-muted); border-bottom: 1px solid var(--border);
  white-space: nowrap; background: var(--bg-surface);
}
.data-table td {
  padding: 9px 12px; border-bottom: 1px solid var(--border);
  color: var(--text-secondary); vertical-align: middle;
}
.data-table tr:hover td { background: var(--bg-elevated); }
.data-table td.bold { color: var(--text-primary); font-weight: 600; }
.data-table td.mono { font-family: var(--font-mono); font-size: 11px; }

/* 21. TOAST */
#toasts {
  position: fixed; top: 16px; right: 16px; z-index: 999;
  display: flex; flex-direction: column; gap: 7px; pointer-events: none;
}
.toast {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 11px 14px; min-width: 240px; max-width: 340px;
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-left: 4px solid; border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); pointer-events: all;
  animation: toastIn .28s ease;
}
@keyframes toastIn { from{transform:translateX(110%);opacity:0} to{transform:translateX(0);opacity:1} }
.toast.hide { animation: toastOut .25s ease forwards; }
@keyframes toastOut { to{transform:translateX(110%);opacity:0} }
.toast.success { border-left-color: var(--success); }
.toast.warning { border-left-color: var(--warning); }
.toast.danger  { border-left-color: var(--danger);  }
.toast.info    { border-left-color: var(--info);    }
.toast-ico { font-size: 17px; flex-shrink: 0; margin-top: 1px; }
.toast-body { flex: 1; }
.toast-title { font-size: 12px; font-weight: 700; color: var(--text-primary); }
.toast-msg   { font-size: 11px; color: var(--text-secondary); margin-top: 2px; }
.toast-close { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 13px; padding: 0 2px; }
.toast-close:hover { color: var(--text-primary); }

/* 22. MISC UTILS */
.divider { height: 1px; background: var(--border); margin: 8px 0; }
.section-title {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px;
  color: var(--text-muted); padding: 10px 14px 6px;
}

.empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 48px 24px; gap: 10px; color: var(--text-muted); text-align: center;
}
.empty-ico { font-size: 48px; opacity: .4; }
.empty-title { font-size: 15px; font-weight: 700; color: var(--text-secondary); }
.empty-desc { font-size: 12px; }

.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--border); border-top-color: var(--accent);
  border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to{transform:rotate(360deg)} }

/* Flex helpers */
.row { display: flex; align-items: center; }
.row-between { display: flex; align-items: center; justify-content: space-between; }
.col { display: flex; flex-direction: column; }
.gap-1 { gap: 4px; } .gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; } .gap-5 { gap: 20px; }
.flex-1 { flex: 1; }
.shrink-0 { flex-shrink: 0; }
.ml-auto { margin-left: auto; }
.mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 12px; }
.p-2 { padding: 8px; } .p-3 { padding: 12px; } .p-4 { padding: 16px; }
.px-3 { padding-left: 12px; padding-right: 12px; }
.py-2 { padding-top: 8px; padding-bottom: 8px; }

.text-xs  { font-size: 10px; }
.text-sm  { font-size: 11px; }
.text-md  { font-size: 13px; }
.text-lg  { font-size: 15px; }
.text-xl  { font-size: 18px; }
.text-2xl { font-size: 22px; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.font-black { font-weight: 900; }
.text-primary  { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-muted    { color: var(--text-muted); }
.text-success  { color: var(--success); }
.text-warning  { color: var(--warning); }
.text-danger   { color: var(--danger); }
.text-accent   { color: var(--accent); }
.text-info     { color: var(--info); }
.text-right    { text-align: right; }
.text-center   { text-align: center; }

.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hidden { display: none !important; }
.rounded { border-radius: var(--radius); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-full { border-radius: var(--radius-full); }
.border-t { border-top: 1px solid var(--border); }
.border-b { border-bottom: 1px solid var(--border); }
.bg-card { background: var(--bg-card); }
.bg-surface { background: var(--bg-surface); }
.bg-elevated { background: var(--bg-elevated); }
.overflow-auto { overflow: auto; }
.overflow-y-auto { overflow-y: auto; }

/* Scrollbar */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-light); }

/* Price display */
.price { font-weight: 800; font-variant-numeric: tabular-nums; }
.price-main { font-size: 28px; font-weight: 900; color: var(--accent); font-variant-numeric: tabular-nums; }
.price-lg   { font-size: 20px; font-weight: 900; color: var(--accent); font-variant-numeric: tabular-nums; }
.price-md   { font-size: 15px; font-weight: 800; font-variant-numeric: tabular-nums; }

/* Waiter mobile */
.waiter-body { background: var(--bg-base); min-height: 100vh; overflow-y: auto; }
.waiter-header {
  position: sticky; top: 0; z-index: 10;
  background: var(--primary-dark); border-bottom: 1px solid var(--border);
  padding: 12px 16px; display: flex; align-items: center; gap: 12px;
}
.waiter-table-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-xl); padding: 14px;
  margin-bottom: 10px; cursor: pointer; transition: all var(--transition);
}
.waiter-table-card:hover { border-color: var(--border-light); }
.waiter-table-card.occupied { border-left: 4px solid var(--table-occupied); }
.waiter-table-card.call { border-left: 4px solid var(--warning); }
.waiter-table-card.payment { border-left: 4px solid var(--purple); }
.waiter-table-card.overdue { border-left: 4px solid var(--danger); }

.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--bg-surface); border-top: 1px solid var(--border);
  display: flex; padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
  z-index: 10;
}
.bottom-nav-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  font-size: 10px; font-weight: 600; color: var(--text-muted);
  cursor: pointer; padding: 4px 0; transition: all var(--transition);
}
.bottom-nav-item.active { color: var(--accent); }
.bottom-nav-item .ico { font-size: 20px; }

/* Customer display */
.customer-display {
  background: linear-gradient(135deg, var(--primary-dark) 0%, #0a1628 100%);
  min-height: 100vh; display: flex; flex-direction: column;
}

/* Admin header */
.admin-topbar {
  height: 56px; background: var(--bg-surface); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; padding: 0 20px; gap: 14px; flex-shrink: 0; z-index: 20;
}
