/* ==========================================================================
   GEPREK POS & MANAGER — Stylesheet Utama (Mobile-First, Light & Dark)
   ========================================================================== */

:root {
  --bg: #f1f5f9;
  --bg-elevated: #ffffff;
  --bg-muted: #e2e8f0;
  --text: #090d16;
  --text-muted: #334155;
  --border: #cbd5e1;

  --primary: #dc2626;
  --primary-hover: #b91c1c;
  --primary-soft: #fef2f2;
  --accent: #b45309;
  --accent-soft: #fffbeb;

  --success: #166534;
  --success-soft: #f0fdf4;
  --warning: #92400e;
  --warning-soft: #fffbeb;
  --danger: #b91c1c;
  --danger-soft: #fef2f2;
  --info: #1e40af;
  --info-soft: #eff6ff;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.1);
  --shadow-lg: 0 12px 28px rgba(15, 23, 42, 0.16);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;

  --sidebar-width: 248px;
  --header-height: 60px;
  --bottom-nav-height: 66px;
  --touch-min: 44px;

  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

[data-theme="dark"] {
  --bg: #0b1120;
  --bg-elevated: #1e293b;
  --bg-muted: #334155;
  --text: #ffffff;
  --text-muted: #e2e8f0;
  --border: #475569;

  --primary: #ef4444;
  --primary-hover: #dc2626;
  --primary-soft: rgba(239, 68, 68, 0.16);
  --accent: #f59e0b;
  --accent-soft: rgba(245, 158, 11, 0.16);

  --success: #4ade80;
  --success-soft: rgba(74, 222, 128, 0.14);
  --warning: #fbbf24;
  --warning-soft: rgba(251, 191, 36, 0.14);
  --danger: #f87171;
  --danger-soft: rgba(248, 113, 113, 0.16);
  --info: #60a5fa;
  --info-soft: rgba(96, 165, 250, 0.16);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 12px 28px rgba(0, 0, 0, 0.55);
}

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

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-tap-highlight-color: transparent;
  min-height: 100%;
}

img {
  max-width: 100%;
  display: block;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

.hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

/* ---------- Boot Screen ---------- */
.boot-screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 24px;
  text-align: center;
}

.boot-logo {
  border-radius: 18px;
  box-shadow: var(--shadow-md);
}

.boot-title {
  margin: 0;
  font-size: 1.4rem;
}

.boot-subtitle {
  margin: 0;
  color: var(--text-muted);
}

/* ---------- Banners ---------- */
.banner {
  position: sticky;
  top: 0;
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  font-size: 0.9rem;
  font-weight: 600;
}

.banner-info {
  background: var(--info);
  color: #ffffff;
}

.banner-warning {
  background: var(--warning);
  color: #ffffff;
}

/* ---------- App Shell Layout ---------- */
.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  display: none;
  flex-direction: column;
  width: var(--sidebar-width);
  background: var(--bg-elevated);
  border-right: 1px solid var(--border);
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 200;
  overflow-y: auto;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--border);
}

.sidebar-brand img {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  object-fit: cover;
}

.sidebar-brand-name {
  font-weight: 800;
  font-size: 1rem;
  line-height: 1.2;
}

.sidebar-brand-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  padding: 10px;
  gap: 4px;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: var(--touch-min);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--text);
  font-weight: 600;
  border: none;
  background: transparent;
  cursor: pointer;
  width: 100%;
  text-align: left;
  transition: background 0.15s ease, color 0.15s ease;
}

.nav-item:hover {
  background: var(--bg-muted);
}

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

.nav-icon {
  font-size: 1.2rem;
  width: 24px;
  text-align: center;
  flex-shrink: 0;
}

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.main-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding-bottom: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom, 0px));
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 150;
  height: var(--header-height);
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 14px;
}

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

.topbar-title {
  margin: 0;
  font-size: 1.08rem;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--bg-muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.page-content {
  padding: 16px;
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
  flex: 1;
}

/* ---------- Bottom Navigation (Mobile) ---------- */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 200;
  height: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--bg-elevated);
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  text-decoration: none;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 700;
  border: none;
  background: transparent;
  cursor: pointer;
  min-height: var(--touch-min);
}

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

.bottom-nav-icon {
  font-size: 1.25rem;
  line-height: 1;
}

/* Mobile Drawer Menu (untuk menu "Lainnya") */
.drawer-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.drawer-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 16px 10px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg);
  text-decoration: none;
  color: var(--text);
  font-weight: 700;
  font-size: 0.88rem;
  min-height: 82px;
  text-align: center;
}

.drawer-tile.active {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
}

@media (min-width: 900px) {
  .sidebar {
    display: flex;
  }
  .main-area {
    margin-left: var(--sidebar-width);
    padding-bottom: 24px;
  }
  .bottom-nav {
    display: none;
  }
  .page-content {
    padding: 24px;
  }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--touch-min);
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
  text-decoration: none;
  white-space: nowrap;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-sm {
  min-height: 36px;
  padding: 6px 12px;
  font-size: 0.85rem;
}

.btn-lg {
  min-height: 52px;
  padding: 12px 22px;
  font-size: 1rem;
}

.btn-block {
  width: 100%;
}

.btn-icon {
  min-width: var(--touch-min);
  min-height: var(--touch-min);
  padding: 0;
}

.btn-primary {
  background: var(--primary);
  color: #ffffff;
}
.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
}

.btn-secondary {
  background: var(--bg-muted);
  color: var(--text);
  border-color: var(--border);
}
.btn-secondary:hover:not(:disabled) {
  border-color: var(--text-muted);
}

.btn-outline {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}
.btn-outline:hover:not(:disabled) {
  background: var(--bg-muted);
}

.btn-danger {
  background: var(--danger);
  color: #ffffff;
}

.btn-success {
  background: var(--success);
  color: #ffffff;
}

/* ---------- Cards & Grid ---------- */
.card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px;
  box-shadow: var(--shadow-sm);
}

.card + .card {
  margin-top: 16px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.card-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
}

.card-subtitle {
  margin: 2px 0 0;
  font-size: 0.86rem;
  color: var(--text-muted);
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.grid-3 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

@media (min-width: 680px) {
  .grid-2 {
    grid-template-columns: repeat(2, 1fr);
  }
  .grid-3 {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ---------- Forms ---------- */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.form-label {
  font-size: 0.88rem;
  font-weight: 700;
}

.form-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  min-height: var(--touch-min);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.form-textarea {
  min-height: 84px;
  resize: vertical;
}

.form-check {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: var(--touch-min);
  cursor: pointer;
  font-weight: 600;
}

.form-check input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--primary);
}

/* ---------- Tabs ---------- */
.tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 6px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.tab-btn {
  min-height: var(--touch-min);
  padding: 8px 14px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-weight: 700;
  border-radius: var(--radius-sm);
  cursor: pointer;
  white-space: nowrap;
}

.tab-btn.active {
  background: var(--primary-soft);
  color: var(--primary);
}

/* ---------- Badges & Alerts ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 700;
}

.badge-primary { background: var(--primary-soft); color: var(--primary); }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-danger  { background: var(--danger-soft);  color: var(--danger); }
.badge-info    { background: var(--info-soft);    color: var(--info); }
.badge-muted   { background: var(--bg-muted);     color: var(--text-muted); }

.alert {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-size: 0.9rem;
  margin-bottom: 14px;
}
.alert-info    { background: var(--info-soft);    color: var(--info);    border-color: currentColor; }
.alert-warning { background: var(--warning-soft); color: var(--warning); border-color: currentColor; }
.alert-danger  { background: var(--danger-soft);  color: var(--danger);  border-color: currentColor; }
.alert-success { background: var(--success-soft); color: var(--success); border-color: currentColor; }

/* ---------- Auth / Wizard Screens ---------- */
.auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: var(--bg);
}

.auth-card {
  width: 100%;
  max-width: 480px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-lg);
}

.auth-header {
  text-align: center;
  margin-bottom: 20px;
}

.auth-logo {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  margin: 0 auto 10px;
  object-fit: cover;
}

.wizard-steps {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}

.wizard-step {
  flex: 1;
  text-align: center;
  padding: 8px 6px;
  border-radius: var(--radius-sm);
  background: var(--bg-muted);
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.wizard-step.active {
  background: var(--primary);
  color: #ffffff;
}

.wizard-step.done {
  background: var(--success-soft);
  color: var(--success);
}

/* ---------- PIN Pad ---------- */
.pin-dots {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin: 16px 0 20px;
}

.pin-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: transparent;
  transition: background 0.12s ease, border-color 0.12s ease;
}

.pin-dot.filled {
  background: var(--primary);
  border-color: var(--primary);
}

.pin-pad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  max-width: 300px;
  margin: 0 auto;
}

.pin-key {
  min-height: 58px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 1.35rem;
  font-weight: 800;
  cursor: pointer;
  transition: background 0.1s ease, transform 0.08s ease;
}

.pin-key:active {
  background: var(--primary-soft);
  transform: scale(0.97);
}

.pin-key-action {
  font-size: 0.95rem;
  font-weight: 700;
}

/* ---------- Table & List ---------- */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.data-table th,
.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.data-table th {
  background: var(--bg-muted);
  font-weight: 700;
  white-space: nowrap;
}

.data-table tr:last-child td {
  border-bottom: none;
}

.list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.list-row:last-child {
  border-bottom: none;
}

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(15, 23, 42, 0.62);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-box {
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
}

.modal-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
}

.modal-body {
  padding: 18px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 18px;
  border-top: 1px solid var(--border);
}

/* ---------- Toast ---------- */
.toast-container {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 1200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: calc(100vw - 32px);
  width: 340px;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  color: #ffffff;
  font-weight: 700;
  font-size: 0.9rem;
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  animation: toast-in 0.2s ease;
}

.toast-success { background: #15803d; }
.toast-error   { background: #b91c1c; }
.toast-warning { background: #b45309; }
.toast-info    { background: #1d4ed8; }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---------- Empty State & Skeleton ---------- */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
}

.empty-state-icon {
  font-size: 2.5rem;
  margin-bottom: 10px;
}

.empty-state-title {
  margin: 0 0 6px;
  font-size: 1.1rem;
  font-weight: 800;
}

.empty-state-desc {
  margin: 0 auto 16px;
  max-width: 440px;
  color: var(--text-muted);
  font-size: 0.92rem;
}

.skeleton {
  background: linear-gradient(90deg, var(--bg-muted) 25%, var(--border) 50%, var(--bg-muted) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.3s infinite;
  border-radius: var(--radius-sm);
}

@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ---------- Utilities ---------- */
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.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; }
.text-muted { color: var(--text-muted); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-sm { font-size: 0.85rem; }
.font-mono { font-family: var(--font-mono); }

/* ---------- Print Styles ---------- */
@media print {
  .sidebar,
  .topbar,
  .bottom-nav,
  .banner,
  .toast-container,
  .no-print {
    display: none !important;
  }
  .main-area {
    margin: 0 !important;
    padding: 0 !important;
  }
  body {
    background: #ffffff !important;
    color: #000000 !important;
  }
}

/* ---------- POS, Kitchen & Dashboard Extensions ---------- */
.pos-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  align-items: start;
}

@media (min-width: 960px) {
  .pos-layout {
    grid-template-columns: 1.45fr 1fr;
  }
  .pos-cart {
    position: sticky;
    top: calc(var(--header-height) + 16px);
  }
}

.pos-cat-pills {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.pill-btn {
  min-height: 38px;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font-weight: 700;
  font-size: 0.86rem;
  cursor: pointer;
  white-space: nowrap;
}

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

.pos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(145px, 1fr));
  gap: 10px;
}

.pos-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  padding: 10px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  cursor: pointer;
  text-align: left;
  min-height: 132px;
  transition: border-color 0.12s ease, transform 0.08s ease;
}

.pos-card:hover:not(:disabled) {
  border-color: var(--primary);
}

.pos-card:active:not(:disabled) {
  transform: scale(0.98);
}

.pos-card-out {
  opacity: 0.55;
  cursor: not-allowed;
}

.pos-card-img {
  width: 100%;
  height: 76px;
  object-fit: cover;
  border-radius: 8px;
}

.pos-card-placeholder {
  width: 100%;
  height: 60px;
  border-radius: 8px;
  background: var(--accent-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
}

.pos-card-name {
  font-weight: 700;
  font-size: 0.9rem;
  line-height: 1.25;
}

.pos-card-price {
  font-weight: 800;
  color: var(--primary);
  font-size: 0.92rem;
  margin-top: auto;
}

.pos-cart-items {
  max-height: 310px;
  overflow-y: auto;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.cart-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.cart-row:last-child {
  border-bottom: none;
}

.receipt-preview {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  white-space: pre-wrap;
  max-height: 320px;
  overflow-y: auto;
}

.kitchen-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

.kitchen-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  flex-direction: column;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}

.kpi-card {
  margin: 0 !important;
}

.kpi-value {
  font-size: 1.45rem;
  font-weight: 900;
  margin: 4px 0;
}

.text-warning {
  color: var(--warning);
}

/* ==========================================================================
   MOBILE-FIRST FIXES & RESPONSIVE OVERHAUL (Anti Tabrakan & Anti Geser)
   ========================================================================== */

html, body {
  overflow-x: hidden;
  max-width: 100vw;
}

#app-root,
.app-shell,
.main-area,
.page-content,
.card,
.pos-layout,
.pos-catalog,
.pos-cart,
.grid-2,
.grid-3,
.kpi-grid,
.kitchen-grid {
  min-width: 0;
  max-width: 100%;
}

.card,
.card > *,
.grid-2 > *,
.grid-3 > *,
.kpi-grid > *,
.pos-layout > * {
  min-width: 0;
}

.hide-sm {
  display: none;
}

@media (min-width: 640px) {
  .hide-sm {
    display: inline;
  }
}

/* Floating Cart Bar (khusus mobile di halaman Kasir) */
.pos-mobile-bar {
  position: fixed;
  left: 10px;
  right: 10px;
  bottom: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom, 0px) + 8px);
  z-index: 190;
  background: var(--primary);
  color: #ffffff;
  border-radius: var(--radius-md);
  padding: 10px 14px;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

@media (min-width: 960px) {
  .pos-mobile-bar {
    display: none !important;
  }
}

/* ---------- Aturan Khusus Layar HP (<= 720px) ---------- */
@media (max-width: 720px) {
  body {
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
  }

  .page-content {
    padding: 12px 10px 92px;
  }

  .topbar {
    padding: 0 10px;
    gap: 6px;
  }

  .topbar-title {
    font-size: 0.98rem;
  }

  .topbar-actions {
    gap: 6px;
    flex-shrink: 0;
  }

  .topbar-actions .btn {
    padding: 6px 10px;
    min-height: 38px;
  }

  .topbar-actions .btn-icon {
    min-width: 38px;
    min-height: 38px;
    padding: 0;
  }

  .card {
    padding: 13px;
    border-radius: var(--radius-md);
  }

  .card-header {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .card-header > div:last-child,
  .card-header > form,
  .card-header > select,
  .card-header > button,
  .card-header > a {
    width: 100%;
  }

  .card-header .form-input,
  .card-header .form-select {
    width: 100% !important;
    min-width: 0 !important;
  }

  /* Tombol boleh wrap teks di layar sangat sempit agar tidak meluber */
  .btn {
    white-space: normal;
    text-align: center;
    line-height: 1.25;
  }

  /* Tabs rapi horizontal swipeable tanpa scrollbar jelek */
  .tabs {
    gap: 4px;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 8px;
    margin-bottom: 12px;
  }
  .tabs::-webkit-scrollbar {
    display: none;
  }
  .tab-btn {
    min-height: 38px;
    padding: 6px 11px;
    font-size: 0.84rem;
    flex-shrink: 0;
  }

  /* Bottom nav anti tabrakan di HP 320px-412px */
  .bottom-nav-item {
    font-size: 0.66rem;
    padding: 4px 2px;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .bottom-nav-icon {
    font-size: 1.15rem;
  }

  /* KPI Grid 2 kolom rapi di HP */
  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
  .kpi-card {
    padding: 11px !important;
  }
  .kpi-value {
    font-size: 1.1rem;
    word-break: break-word;
  }

  /* POS Grid selalu pas 2 kolom di HP */
  .pos-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
  .pos-card {
    padding: 8px;
    min-height: 112px;
  }
  .pos-card-img,
  .pos-card-placeholder {
    height: 54px;
  }
  .pos-card-name {
    font-size: 0.84rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .pos-card-price {
    font-size: 0.86rem;
  }
  .pos-cart-items {
    max-height: none;
  }
  .cart-row {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
  }
  .cart-row > div:last-child {
    justify-content: flex-end;
  }

  /* Kitchen Display 1 kolom penuh di HP */
  .kitchen-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  /* Modal nyaman di HP */
  .modal-backdrop {
    padding: 8px;
    align-items: flex-end;
  }
  .modal-box {
    max-height: 90dvh;
    border-radius: 16px 16px 12px 12px;
  }
  .modal-header,
  .modal-body,
  .modal-footer {
    padding: 14px;
  }

  /* List row wrap rapi */
  .list-row {
    flex-wrap: wrap;
    gap: 6px;
  }

  /* Alert flex wrap rapi */
  .alert {
    font-size: 0.85rem;
    padding: 10px 12px;
  }

  /* Toast di tengah atas HP agar tidak terpotong */
  .toast-container {
    top: 10px;
    right: 10px;
    left: 10px;
    width: auto;
    max-width: none;
  }

  /* ---------- RESPONSIVE CARD-TABLE (NOL GESER KIRI-KANAN DI HP) ---------- */
  .table-wrap {
    overflow-x: visible;
    border: none;
    border-radius: 0;
  }

  table.data-table.mobile-cards,
  table.data-table.mobile-cards tbody,
  table.data-table.mobile-cards tr,
  table.data-table.mobile-cards td {
    display: block;
    width: 100%;
  }

  table.data-table.mobile-cards thead {
    display: none;
  }

  table.data-table.mobile-cards tr {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 8px 10px;
    margin-bottom: 10px;
  }

  table.data-table.mobile-cards tr:last-child {
    margin-bottom: 0;
  }

  table.data-table.mobile-cards td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 6px 0;
    border-bottom: 1px dashed var(--border);
    text-align: right;
    word-break: break-word;
  }

  table.data-table.mobile-cards td:last-child {
    border-bottom: none;
  }

  table.data-table.mobile-cards td::before {
    content: attr(data-label);
    font-weight: 700;
    color: var(--text-muted);
    font-size: 0.8rem;
    text-align: left;
    flex-shrink: 0;
    max-width: 44%;
  }

  table.data-table.mobile-cards td > .flex {
    justify-content: flex-end;
    flex-wrap: wrap;
  }

  table.data-table.mobile-cards td input.form-input {
    width: 110px !important;
    text-align: right;
  }

  /* Tabel tanpa thead (mis. Laba Rugi 2 kolom) — kontras tinggi & nominal tidak terpecah baris */
  table.data-table:not(.mobile-cards) {
    table-layout: auto;
    width: 100%;
  }
  table.data-table:not(.mobile-cards) td {
    padding: 10px 8px;
    font-size: 0.94rem;
    font-weight: 500;
    color: var(--text);
    vertical-align: middle;
  }
  table.data-table:not(.mobile-cards) td:last-child {
    width: 1%;
    white-space: nowrap;
    text-align: right;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
  }

  /* Input tanggal laporan di HP */
  .report-filter-bar {
    flex-direction: column;
    align-items: stretch !important;
  }
  .report-date-row {
    display: grid !important;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 6px;
    width: 100%;
  }
  .report-date-row .form-input {
    width: 100% !important;
    min-width: 0;
  }
}

/* ---------- Multi-Channel Bar & Quick Actions (Anti-Gaptek) ---------- */
.channel-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 8px;
}

.channel-btn {
  min-height: 46px;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  border: 2px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font-weight: 800;
  font-size: 0.92rem;
  cursor: pointer;
  transition: transform 0.08s ease, background 0.15s ease, border-color 0.15s ease;
}

.channel-btn:active {
  transform: scale(0.97);
}

.channel-btn.active.ch-offline {
  background: #1e293b;
  border-color: #1e293b;
  color: #ffffff;
}

.channel-btn.active.ch-gofood {
  background: #16a34a;
  border-color: #16a34a;
  color: #ffffff;
}

.channel-btn.active.ch-shopee {
  background: #ea580c;
  border-color: #ea580c;
  color: #ffffff;
}

.channel-btn.active.ch-grab {
  background: #15803d;
  border-color: #15803d;
  color: #ffffff;
}

.channel-btn.active.ch-online {
  background: var(--info);
  border-color: var(--info);
  color: #ffffff;
}

.quick-actions-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

@media (min-width: 720px) {
  .quick-actions-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.quick-action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 14px 10px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  text-decoration: none;
  font-weight: 800;
  font-size: 0.9rem;
  text-align: center;
  min-height: 82px;
  box-shadow: var(--shadow-sm);
}

.quick-action-btn:hover {
  border-color: var(--primary);
}

.quick-action-btn.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}


/* ==========================================================================
   GEPREK POS SIMPEL — KOMPONEN KASIR & SAMBEL PICKER
   ========================================================================== */
:root {
  --bg-subtle: var(--bg-muted, #f3f4f6);
}

.fw-600 { font-weight: 600; }
.text-xs { font-size: 0.78rem; }
.text-center { text-align: center; }

.kpi-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
}

.kpi-label {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 600;
}

.pos-cat-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.pos-card {
  position: relative;
  align-items: center;
  text-align: center;
  padding: 14px 10px;
}

.pos-card-emoji {
  font-size: 2rem;
  line-height: 1.1;
  margin-bottom: 2px;
}

.pos-card-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  min-width: 24px;
  height: 24px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--primary);
  color: #ffffff;
  font-size: 0.78rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.pos-cart-card {
  position: sticky;
  top: calc(var(--header-height, 56px) + 16px);
}

.cart-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 360px;
  overflow-y: auto;
  padding: 6px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.cart-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px dashed var(--border);
}

.cart-item:last-child {
  border-bottom: none;
}

.qty-control {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.qty-val {
  min-width: 24px;
  text-align: center;
  font-weight: 700;
}

.sambel-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
