/* ============================================
   TOKEN MANAGEMENT SYSTEM
   Professional POS Aesthetic
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&family=JetBrains+Mono:wght@500;700&display=swap');

:root {
  /* Core palette - charcoal & saffron */
  --bg: #fafaf7;
  --surface: #ffffff;
  --surface-hover: #f5f4f0;
  --border: #e5e5e0;
  --border-strong: #d4d4cf;

  --text: #1c1c1e;
  --text-muted: #6b6b6b;
  --text-faint: #a1a1a1;

  --accent: #c2410c;
  --accent-hover: #9a3412;
  --accent-soft: #fef3ec;

  --sidebar-bg: #1c1c1e;
  --sidebar-text: #d4d4d4;
  --sidebar-text-active: #ffffff;
  --sidebar-border: #2d2d30;

  --success: #15803d;
  --success-soft: #ecfdf5;
  --danger: #b91c1c;
  --danger-soft: #fef2f2;
  --warning: #a16207;
  --warning-soft: #fefce8;
  --info: #1e40af;
  --info-soft: #eff6ff;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-lg: 0 4px 12px rgba(0,0,0,0.06), 0 2px 4px rgba(0,0,0,0.04);

  --radius: 6px;
  --radius-sm: 4px;
  --radius-lg: 8px;
}

[data-theme="dark"] {
  --bg: #18181b;
  --surface: #212124;
  --surface-hover: #2a2a2e;
  --border: #2e2e32;
  --border-strong: #3a3a3f;

  --text: #f5f5f4;
  --text-muted: #a8a8a8;
  --text-faint: #6b6b6b;

  --accent: #ea580c;
  --accent-hover: #fb923c;
  --accent-soft: #2a1810;

  --sidebar-bg: #0a0a0c;
  --sidebar-border: #1f1f22;

  --success: #22c55e;
  --success-soft: #052e1a;
  --danger: #ef4444;
  --danger-soft: #2e1010;
  --warning: #ca8a04;
  --warning-soft: #2a210a;
  --info: #3b82f6;
  --info-soft: #0a1a2e;
}

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

html, body {
  font-family: 'Manrope', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.mono {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
}

/* ============ AUTH SCREENS ============ */
.auth-bg {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 2000;
  justify-content: center;
  align-items: center;
  padding: 20px;
  overflow-y: auto;
}
.auth-bg.show { display: flex; }

.auth-box {
  background: var(--surface);
  padding: 40px 36px;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 380px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
}

.auth-box h2 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--text);
  letter-spacing: -0.02em;
}

.auth-box .auth-subtitle {
  color: var(--text-muted);
  font-size: 13px;
  margin-bottom: 28px;
}

.auth-link {
  text-align: center;
  margin-top: 18px;
  font-size: 13px;
  color: var(--text-muted);
}
.auth-link a {
  color: var(--accent);
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}
.auth-link a:hover { text-decoration: underline; }

/* ============ LAYOUT ============ */
.app {
  display: grid;
  grid-template-columns: 220px 1fr;
  grid-template-rows: 56px 1fr;
  grid-template-areas: "sidebar topbar" "sidebar main";
  min-height: 100vh;
}

/* ============ SIDEBAR ============ */
.sidebar {
  grid-area: sidebar;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  padding: 20px 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--sidebar-border);
}

.logo {
  padding: 0 22px 22px;
  border-bottom: 1px solid var(--sidebar-border);
  margin-bottom: 14px;
}
.logo h1 {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: #ffffff;
  margin-bottom: 2px;
}
.logo p {
  font-size: 10px;
  color: #888;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  font-weight: 500;
}

.nav-list { flex: 1; padding: 0 8px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--sidebar-text);
  border-radius: var(--radius);
  margin-bottom: 2px;
  transition: background 0.15s, color 0.15s;
}
.nav-item:hover {
  background: rgba(255,255,255,0.06);
  color: #fff;
}
.nav-item.active {
  background: var(--accent);
  color: #fff;
}
.nav-item .icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
}
.nav-item .icon svg { width: 16px; height: 16px; }

/* ============ TOPBAR ============ */
.topbar {
  grid-area: topbar;
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid var(--border);
}

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

.user-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: var(--surface-hover);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
}
.user-badge .avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
}

.staff-display {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px 6px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 12.5px;
  font-weight: 600;
}
.staff-display select {
  background: transparent;
  border: none;
  color: var(--text);
  font-weight: 600;
  font-size: 12.5px;
  cursor: pointer;
  padding: 0 18px 0 0;
  outline: none;
  font-family: inherit;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%231c1c1e' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat;
  background-position: right 0 center;
}
[data-theme="dark"] .staff-display select {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%23f5f5f4' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
}
.staff-display select option {
  background: var(--surface);
  color: var(--text);
}

.shift-switch {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  color: var(--text);
  padding: 5px 6px 5px 10px;
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--border);
}
.shift-switch.morning {
  background: var(--warning-soft);
  color: var(--warning);
  border-color: var(--warning);
}
.shift-switch.evening {
  background: var(--info-soft);
  color: var(--info);
  border-color: var(--info);
}
.shift-switch .dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-faint);
}
.shift-switch.morning .dot { background: var(--warning); }
.shift-switch.evening .dot { background: var(--info); }

.shift-switch button {
  background: transparent;
  border: none;
  width: 22px;
  height: 22px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  color: inherit;
}
.shift-switch button:hover { background: rgba(0,0,0,0.06); }
[data-theme="dark"] .shift-switch button:hover { background: rgba(255,255,255,0.08); }

.topbar-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.icon-btn {
  background: transparent;
  border: 1px solid transparent;
  padding: 7px;
  border-radius: var(--radius);
  cursor: pointer;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.icon-btn:hover {
  background: var(--surface-hover);
  color: var(--text);
}
.icon-btn svg { width: 16px; height: 16px; }

/* ============ MAIN ============ */
.main {
  grid-area: main;
  padding: 24px 28px;
  overflow-y: auto;
}

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

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 12px;
}
.page-header h2 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}
.page-header .subtitle {
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 3px;
}

/* ============ SUB TABS ============ */
.sub-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}
.sub-tab {
  padding: 10px 16px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s;
}
.sub-tab:hover { color: var(--text); }
.sub-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.sub-page { display: none; }
.sub-page.active { display: block; }

/* ============ CARDS ============ */
.card {
  background: var(--surface);
  padding: 20px;
  border-radius: var(--radius-lg);
  margin-bottom: 16px;
  border: 1px solid var(--border);
}
.card h3 {
  color: var(--text);
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ============ FORM ============ */
.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}
.form-group { margin-bottom: 14px; }

label {
  display: block;
  margin-bottom: 5px;
  font-weight: 600;
  color: var(--text);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

input[type="text"],
input[type="number"],
input[type="password"],
input[type="email"],
select, textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  font-size: 14px;
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

input[readonly] {
  background: var(--surface-hover);
  color: var(--text-muted);
}

/* KOT number display - mono */
input#kotNumber {
  font-family: 'JetBrains Mono', monospace;
  font-size: 18px;
  font-weight: 700;
  text-align: center;
  letter-spacing: 1px;
  background: var(--text) !important;
  color: var(--surface) !important;
  border-color: var(--text) !important;
}

/* ============ BUTTONS ============ */
button {
  padding: 9px 16px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: inherit;
  transition: all 0.15s;
}

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

.btn-success {
  background: var(--success);
  color: #fff;
}
.btn-success:hover { filter: brightness(1.1); }

.btn-danger {
  background: var(--danger);
  color: #fff;
}
.btn-danger:hover { filter: brightness(1.1); }

.btn-warning {
  background: var(--warning);
  color: #fff;
}
.btn-warning:hover { filter: brightness(1.1); }

.btn-info {
  background: var(--info);
  color: #fff;
}
.btn-info:hover { filter: brightness(1.1); }

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border-strong);
}
.btn-secondary:hover { background: var(--surface-hover); }

.btn-reprint {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border-strong);
}
.btn-reprint:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

.btn-purple {
  background: var(--text);
  color: var(--surface);
}
.btn-purple:hover { filter: brightness(1.2); }

.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-full { width: 100%; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* ============ STATS ============ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}
.stat-card {
  background: var(--surface);
  padding: 16px 18px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}
.stat-card .label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.5px;
}
.stat-card .value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  margin-top: 4px;
  line-height: 1.1;
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: -1px;
}
.stat-card .sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}
.stat-card .change {
  font-size: 11px;
  margin-top: 6px;
  font-weight: 700;
  display: inline-block;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
}
.stat-card .change.up { color: var(--success); background: var(--success-soft); }
.stat-card .change.down { color: var(--danger); background: var(--danger-soft); }

/* ============ TABLES ============ */
.table-wrap {
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
}
.table-scroll { max-height: 440px; overflow-y: auto; }
table { width: 100%; border-collapse: collapse; }
thead {
  background: var(--surface-hover);
  position: sticky;
  top: 0;
  z-index: 5;
}
th {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border-strong);
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  color: var(--text);
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--surface-hover); }

/* ============ CHIPS ============ */
.chip-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip {
  background: var(--surface-hover);
  color: var(--text);
  padding: 5px 10px 5px 12px;
  border-radius: var(--radius);
  font-size: 12.5px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
}
.chip .remove {
  color: var(--text-muted);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 0 2px;
  transition: color 0.15s;
}
.chip .remove:hover { color: var(--danger); }

/* ============ SEARCH DROPDOWN ============ */
.search-wrap { position: relative; }
.search-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0; right: 0;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  max-height: 240px;
  overflow-y: auto;
  z-index: 100;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  display: none;
}
.search-dropdown.show { display: block; }
.search-item {
  padding: 9px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.search-item:last-child { border-bottom: none; }
.search-item:hover, .search-item.active {
  background: var(--surface-hover);
}
.search-item .cat-label {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 500;
}

/* ============ MODAL ============ */
.modal-bg {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 1000;
  justify-content: center;
  align-items: center;
}
.modal-bg.show { display: flex; }
.modal {
  background: var(--surface);
  padding: 24px;
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 400px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
}
.modal h3 {
  color: var(--text);
  margin-bottom: 18px;
  font-size: 16px;
  font-weight: 700;
}

/* ============ EMPTY ============ */
.empty {
  text-align: center;
  padding: 28px;
  color: var(--text-faint);
  font-size: 13px;
}

/* ============ FILTER BAR ============ */
.filter-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  align-items: end;
  margin-bottom: 18px;
}
.filter-bar .btn-cell { display: flex; gap: 6px; }

/* ============ BADGES ============ */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  background: var(--surface-hover);
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.badge-reprint {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent);
}
.badge-morning {
  background: var(--warning-soft);
  color: var(--warning);
  border-color: var(--warning);
}
.badge-evening {
  background: var(--info-soft);
  color: var(--info);
  border-color: var(--info);
}
.badge-cat {
  background: var(--surface-hover);
  color: var(--text);
  border-color: var(--border-strong);
}
.badge-multi {
  background: var(--text);
  color: var(--surface);
  border-color: var(--text);
}

/* ============ CART ============ */
.cart-list {
  background: var(--surface-hover);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 12px;
  min-height: 100px;
  margin-bottom: 12px;
}
.cart-empty {
  text-align: center;
  color: var(--text-faint);
  padding: 24px;
  font-size: 13px;
}
.cart-item {
  background: var(--surface);
  padding: 10px 14px;
  border-radius: var(--radius);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--border);
}
.cart-item:last-child { margin-bottom: 0; }
.cart-item .name { flex: 1; font-weight: 600; font-size: 13.5px; }
.cart-item .qty-control {
  display: flex;
  align-items: center;
  gap: 0;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  overflow: hidden;
}
.cart-item .qty-control button {
  width: 26px;
  height: 26px;
  padding: 0;
  background: var(--surface);
  border: none;
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  border-radius: 0;
}
.cart-item .qty-control button:hover { background: var(--surface-hover); }
.cart-item .qty-display {
  min-width: 32px;
  text-align: center;
  font-weight: 700;
  font-size: 13px;
  padding: 0 4px;
  font-family: 'JetBrains Mono', monospace;
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  line-height: 24px;
}
.cart-item .delete {
  background: transparent;
  color: var(--text-faint);
  padding: 4px 6px;
  border: none;
  cursor: pointer;
  font-size: 16px;
}
.cart-item .delete:hover { color: var(--danger); }

/* ============ QUICK BUTTONS ============ */
.quick-btns {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}
.quick-btn {
  background: var(--surface);
  color: var(--text);
  padding: 12px 10px;
  border-radius: var(--radius);
  cursor: pointer;
  text-align: left;
  font-size: 12.5px;
  font-weight: 600;
  border: 1px solid var(--border-strong);
  transition: all 0.15s;
  display: flex;
  flex-direction: column;
  gap: 3px;
  align-items: flex-start;
}
.quick-btn:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}
.quick-btn .qb-cat {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 500;
}
.quick-btn:hover .qb-cat { color: var(--accent); opacity: 0.7; }

/* ============ CHARTS ============ */
.chart-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
  gap: 16px;
}
.chart-box {
  background: var(--surface);
  padding: 18px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}
.chart-box h4 {
  color: var(--text);
  margin-bottom: 14px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.chart-canvas-wrap {
  position: relative;
  height: 280px;
}

/* ============ VOICE BUTTON ============ */
.voice-btn {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 30px;
  height: 30px;
  border-radius: var(--radius);
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.voice-btn:hover { background: var(--surface-hover); color: var(--text); }
.voice-btn.listening {
  background: var(--danger);
  color: #fff;
  animation: voicePulse 1.2s infinite;
}
@keyframes voicePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(185,28,28,0.4); }
  50% { box-shadow: 0 0 0 6px rgba(185,28,28,0); }
}
.input-with-voice { position: relative; }
.input-with-voice input { padding-right: 42px; }

/* ============ HEATMAP ============ */
.heatmap {
  display: grid;
  grid-template-columns: 60px repeat(24, 1fr);
  gap: 2px;
  padding: 8px;
  background: var(--surface-hover);
  border-radius: var(--radius);
  overflow-x: auto;
}
.heat-label {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-muted);
  padding: 4px;
  text-align: right;
  align-self: center;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.heat-cell {
  aspect-ratio: 1;
  min-width: 16px;
  border-radius: 2px;
  background: var(--border);
  cursor: help;
}
.heat-cell.l1 { background: #fed7aa; }
.heat-cell.l2 { background: #fb923c; }
.heat-cell.l3 { background: #ea580c; }
.heat-cell.l4 { background: #c2410c; }
.heat-cell.l5 { background: #7c2d12; }
[data-theme="dark"] .heat-cell { background: #2e2e32; }
.heat-header {
  font-size: 9px;
  color: var(--text-faint);
  text-align: center;
  padding: 4px 0 2px;
  font-weight: 600;
  font-family: 'JetBrains Mono', monospace;
}

/* ============ POS TOKEN LAYOUT ============ */
.pos-layout {
  display: grid;
  grid-template-columns: 200px 1fr 320px;
  gap: 14px;
  height: calc(100vh - 56px - 48px);
  min-height: 500px;
}

/* Left: Categories */
.pos-categories {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 8px;
  overflow-y: auto;
}
.pos-cat {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  margin-bottom: 2px;
  transition: background 0.15s;
  user-select: none;
}
.pos-cat:hover { background: var(--surface-hover); }
.pos-cat.active {
  background: var(--accent);
  color: #fff;
}
.pos-cat-badge {
  font-size: 11px;
  font-weight: 700;
  background: rgba(0,0,0,0.08);
  padding: 2px 8px;
  border-radius: 10px;
  font-family: 'JetBrains Mono', monospace;
}
.pos-cat.active .pos-cat-badge {
  background: rgba(255,255,255,0.25);
  color: #fff;
}

/* Center: Items */
.pos-items {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.pos-items-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-hover);
  gap: 12px;
}
.pos-cat-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}
.pos-kot {
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
  font-weight: 700;
  background: var(--text);
  color: var(--surface);
  padding: 6px 14px;
  border-radius: var(--radius);
  letter-spacing: 0.5px;
  white-space: nowrap;
}
.pos-items-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
  padding: 14px;
  overflow-y: auto;
  flex: 1;
  align-content: start;
}
.pos-item-tile {
  background: var(--surface);
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 16px 12px;
  cursor: pointer;
  transition: all 0.12s;
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  user-select: none;
}
.pos-item-tile:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.pos-item-tile:active {
  transform: scale(0.97);
}
.pos-item-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.25;
}

/* Right: Cart */
.pos-cart {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.pos-cart-header {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 16px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-hover);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-muted);
}
.pos-cart-body {
  flex: 1;
  overflow-y: auto;
}
.pos-cart-empty {
  text-align: center;
  padding: 40px 16px;
  color: var(--text-faint);
  font-size: 13px;
}
.pos-cart-item {
  display: grid;
  grid-template-columns: 22px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.pos-cart-item:last-child { border-bottom: none; }
.pos-cart-item-name {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-underline-offset: 3px;
  line-height: 1.3;
}
.pos-cart-item-controls {
  display: flex;
  align-items: center;
  gap: 0;
}
.pos-qty-btn {
  width: 26px;
  height: 26px;
  padding: 0;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.pos-qty-btn:hover { background: var(--surface-hover); border-color: var(--accent); }
.pos-qty {
  min-width: 30px;
  text-align: center;
  font-weight: 600;
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
  padding: 0 6px;
}
.pos-cart-del {
  background: transparent;
  border: none;
  color: var(--danger);
  font-size: 16px;
  cursor: pointer;
  padding: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.pos-cart-del:hover { background: var(--danger-soft); }
.pos-cart-footer {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--border);
  background: var(--surface-hover);
}
.pos-cart-footer button {
  width: 100%;
  padding: 12px;
  font-size: 13px;
}
.pos-cart-footer .btn-primary {
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Mobile responsive for POS */
@media (max-width: 900px) {
  .pos-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
    height: auto;
  }
  .pos-categories {
    display: flex;
    overflow-x: auto;
    padding: 6px;
  }
  .pos-cat {
    flex-shrink: 0;
    margin-right: 4px;
    margin-bottom: 0;
  }
  .pos-cart {
    min-height: 280px;
  }
}

/* ============ TOKEN TILE UI ============ */
.token-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
  max-width: 780px;
}
.token-card {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 24px 20px;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  min-height: 130px;
}
.token-card:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.token-card-icon {
  color: var(--text-muted);
  margin-bottom: 4px;
}
.token-card:hover .token-card-icon { color: var(--accent); }
.token-card-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
}
.token-card-sub {
  font-size: 12px;
  color: var(--text-muted);
}

.token-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.token-breadcrumb {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.cart-mini {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--text);
  color: var(--surface);
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.cart-mini:hover { background: var(--accent); }

.tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 8px;
}
.tile {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 14px 12px;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 70px;
  justify-content: center;
  user-select: none;
}
.tile:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.tile:active {
  transform: scale(0.98);
}
.tile-cat {
  background: var(--text);
  color: var(--surface);
  border-color: var(--text);
}
.tile-cat:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.tile-cat .tile-sub { color: rgba(255,255,255,0.65); }
.tile-cat:hover .tile-sub { color: rgba(255,255,255,0.8); }
.tile-title {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.2;
}
.tile-sub {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
}

/* ============ PRINT AREA ============ */
#printArea { display: none; }

@media print {
  @page { size: 80mm 210mm; margin: 0; }
  body { background: white !important; padding: 0; margin: 0; }
  .app, .modal-bg, .auth-bg { display: none !important; }
  #printArea {
    display: block !important;
    width: 70mm;
    padding: 2mm 4mm 2mm 5mm;
    font-family: Arial, sans-serif;
    color: black;
  }
  .print-datetime { text-align: center; font-size: 9.5pt; margin-bottom: 1.5mm; }
  .print-kot { text-align: center; font-size: 10pt; font-weight: bold; margin-bottom: 1.5mm; }
  .print-reprint-label {
    text-align: center; font-size: 8.5pt; font-weight: bold;
    margin-bottom: 1.5mm; border: 1px solid black; padding: 0.8mm;
  }
  .print-pickup {
    text-align: center; font-size: 12pt; font-weight: bold;
    margin-bottom: 2.5mm; border-top: 1px dashed black;
    border-bottom: 1px dashed black; padding: 1.5mm 0;
  }
  .print-table { width: 100%; border-collapse: collapse; font-size: 8.5pt; table-layout: fixed; }
  .print-table th {
    text-align: left; border-bottom: 1px solid black;
    padding: 1.5mm 1mm; font-size: 8pt;
  }
  .print-table th.center { text-align: center; }
  .print-table th.right { text-align: right; }
  .print-table th:first-child { width: 45%; }
  .print-table th:nth-child(2) { width: 35%; }
  .print-table th:nth-child(3) { width: 20%; }
  .print-table td {
    padding: 2mm 1mm; font-size: 9.5pt; font-weight: bold; vertical-align: top;
    word-wrap: break-word; overflow-wrap: break-word;
  }
  .print-table td.center { text-align: center; }
  .print-table td.right { text-align: right; }
  .print-spacer { height: 8mm; }
}

/* ============ MOBILE ============ */
@media (max-width: 768px) {
  .app {
    grid-template-columns: 1fr;
    grid-template-rows: 56px auto 1fr;
    grid-template-areas: "topbar" "sidebar" "main";
  }
  .sidebar {
    position: relative;
    height: auto;
    flex-direction: row;
    overflow-x: auto;
    padding: 8px;
    border-right: none;
    border-bottom: 1px solid var(--sidebar-border);
  }
  .nav-list { display: flex; flex: 1; padding: 0; }
  .logo { display: none; }
  .nav-item {
    padding: 7px 12px;
    white-space: nowrap;
    margin-bottom: 0;
    margin-right: 2px;
  }
  .main { padding: 16px; }
}
