:root {
  --bg: #f8fafc; /* Modern soft slate background */
  --panel: #ffffff;
  --panel-card: #ffffff;
  --ink: #0f172a; /* Deep slate text */
  --muted: #64748b; /* Soft muted slate */
  --brand: #0284c7; /* Sky / Ocean primary */
  --brand-hover: #0369a1;
  --brand-light: #e0f2fe;
  --brand-dark: #075985;
  --success: #10b981;
  --success-dark: #059669;
  --success-light: #d1fae5;
  --warning: #f59e0b;
  --warning-light: #fef3c7;
  --danger: #ef4444;
  --danger-light: #fee2e2;
  --line: #e2e8f0;
  --grid-border: #e2e8f0;
  --nav-bg: #ffffff;
  --nav-ink: #0f172a;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.06), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

/* Sembunyikan panah dropdown bawaan browser dari <input list>, agar hanya tombol custom yang tampil */
input::-webkit-calendar-picker-indicator {
  opacity: 0 !important;
  display: none !important;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 13px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.app { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }

/* Universal Modern Top Navbar */
.top-nav {
  background: #ffffff;
  color: #0f172a;
  display: flex;
  align-items: center;
  padding: 0 18px;
  height: 52px;
  border-bottom: 1px solid #e2e8f0;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.04);
  z-index: 50;
  position: relative;
}

.logo { 
  font-size: 19px; 
  font-weight: 800; 
  margin-right: 24px; 
  color: #0f172a; 
  letter-spacing: -0.5px; 
  display: flex;
  align-items: center;
  gap: 4px;
}
.logo span { 
  color: #0284c7; 
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.nav-menu { display: flex; gap: 4px; height: 100%; align-items: center; margin-right: auto; }

.nav-group { position: relative; height: 100%; display: flex; align-items: center; }
.nav-group-label {
  padding: 0 12px;
  color: #475569;
  font-size: 12.5px;
  font-weight: 600;
  height: 34px;
  display: flex;
  align-items: center;
  border-radius: 8px;
  cursor: pointer;
  user-select: none;
  transition: all 0.15s ease;
}
.nav-group:hover .nav-group-label { background: #f1f5f9; color: #0f172a; }
.nav-group-label.active { background: #e0f2fe; color: #0284c7; }
.nav-group-items {
  display: none;
  position: absolute;
  top: 46px;
  left: 0;
  min-width: 190px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
  border-radius: 10px;
  z-index: 100;
  flex-direction: column;
  padding: 6px;
  animation: fadeIn 0.15s ease-out;
}
.nav-group:hover .nav-group-items { display: flex; }

.nav-link {
  padding: 7px 12px;
  color: #475569;
  text-decoration: none;
  display: flex;
  align-items: center;
  font-size: 12.5px;
  font-weight: 600;
  transition: all 0.15s ease;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  white-space: nowrap;
  gap: 6px;
}
.nav-icon { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; font-size: 14px; line-height: 1; }
.nav-link:hover { background: #f1f5f9; color: #0f172a; }
.nav-link.active { background: #e0f2fe; color: #0284c7; }

/* Tabs */
.tab-bar { display: flex; gap: 6px; margin-bottom: 12px; border-bottom: 1px solid #e2e8f0; padding-bottom: 8px; }
.tab-btn { 
  padding: 7px 18px; 
  border: 1px solid #e2e8f0; 
  background: #ffffff; 
  cursor: pointer; 
  font-size: 13px; 
  font-weight: 600;
  border-radius: 8px; 
  color: #475569;
  transition: all 0.15s ease;
}
.tab-btn:hover { background: #f8fafc; color: #0f172a; border-color: #cbd5e1; }
.tab-btn.active { 
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%); 
  color: #ffffff; 
  border-color: #0284c7; 
  box-shadow: 0 2px 6px rgba(2, 132, 199, 0.35);
}
.tab-content { display: none; }
.tab-content.active { display: block; animation: fadeIn 0.15s ease-out; }

.top-nav .btn { 
  color: #334155 !important; 
  border-color: #e2e8f0; 
  background: #f8fafc; 
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
}
.top-nav .btn:hover { background: #fee2e2; border-color: #fca5a5; color: #dc2626 !important; }
.top-nav #userInfo { 
  color: #0f172a !important; 
  font-weight: 600; 
  background: #f1f5f9; 
  padding: 4px 10px; 
  border-radius: 20px; 
  border: 1px solid #e2e8f0;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.main { flex: 1; padding: 14px 18px; display: flex; flex-direction: column; gap: 14px; overflow-y: auto; }
.header { display: flex; justify-content: space-between; align-items: center; }
.title { font-size: 20px; font-weight: 700; color: #0f172a; letter-spacing: -0.3px; }

/* Modern Cards */
.card { 
  background: var(--panel); 
  border: 1px solid var(--grid-border); 
  border-radius: var(--radius-md); 
  box-shadow: var(--shadow-sm); 
  padding: 14px 16px; 
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}
.card:hover {
  box-shadow: var(--shadow-md);
}
.grid-4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }

/* Modern Inputs */
.input, select, textarea {
  padding: 8px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  outline: none;
  font-size: 13.5px;
  background: #ffffff;
  color: var(--ink);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  font-family: inherit;
}
.input:focus, select:focus, textarea:focus { 
  border-color: #0284c7; 
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15); 
}

/* Modern Buttons with Smooth Transitions & Scale Feedback */
.btn {
  background: #f1f5f9;
  color: #1e293b;
  border: 1px solid #cbd5e1;
  padding: 7px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.15s ease;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.btn:hover { background: #e2e8f0; border-color: #94a3b8; }
.btn:active { transform: scale(0.98); }

.btn-primary {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  color: #ffffff;
  border: 1px solid #0284c7;
  box-shadow: 0 2px 6px rgba(2, 132, 199, 0.35);
}
.btn-primary:hover {
  background: linear-gradient(135deg, #0369a1 0%, #075985 100%);
  box-shadow: 0 4px 10px rgba(2, 132, 199, 0.45);
}

.btn-green, .btn-success {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #ffffff;
  border: 1px solid #059669;
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(16, 185, 129, 0.35);
}
.btn-green:hover, .btn-success:hover {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  box-shadow: 0 4px 10px rgba(16, 185, 129, 0.45);
}

.btn-danger {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: #ffffff;
  border: 1px solid #dc2626;
  font-weight: 600;
  box-shadow: 0 2px 6px rgba(239, 68, 68, 0.35);
}
.btn-danger:hover {
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
}

.btn-outline { 
  background: #ffffff; 
  border: 1px solid #cbd5e1; 
  color: #475569; 
}
.btn-outline:hover { 
  background: #f8fafc; 
  border-color: #94a3b8; 
  color: #0f172a; 
}

.btn-action, .btn-sm {
  height: 28px;
  padding: 0 10px;
  font-size: 11.5px;
  border-radius: 6px;
}

/* Modern DataGrid Table */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  border-radius: 8px;
  border: 1px solid var(--grid-border);
}
.datagrid { 
  width: 100%; 
  border-collapse: separate; 
  border-spacing: 0; 
  background: #ffffff; 
}
.datagrid th, .datagrid td { 
  padding: 8px 12px; 
  text-align: left; 
  border-bottom: 1px solid #f1f5f9;
}
.datagrid th { 
  background: #f8fafc; 
  font-weight: 700; 
  font-size: 11px; 
  text-transform: uppercase; 
  letter-spacing: 0.5px; 
  color: #64748b; 
  border-bottom: 1px solid #e2e8f0;
}
.datagrid tbody tr:last-child td {
  border-bottom: none;
}
.datagrid tbody tr:hover td { 
  background: #f8fafc; 
}

.badge { 
  padding: 3px 8px; 
  border-radius: 12px; 
  font-size: 11px; 
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.badge-green { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.badge-blue { background: #e0f2fe; color: #0369a1; border: 1px solid #bae6fd; }
.badge-amber { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.badge-red { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }

.flex-row { display: flex; gap: 8px; align-items: center; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }

.form-row { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.form-row.top { align-items: flex-start; }
.form-row label { width: 110px; text-align: right; font-size: 13px; font-weight: 600; color: #334155; white-space: nowrap; }
.form-row label.switch { width:44px; min-width:44px; max-width:44px; flex:0 0 44px; height:24px; margin:0; padding:0; text-align:left; display:inline-block; position:relative; }
.form-row .input, .form-row textarea, .form-row select { flex: 1; }
.form-row textarea { resize: vertical; }
.form-row .radio-group { display: flex; gap: 16px; align-items: center; }
.form-row .radio-group label { width: auto; text-align: left; white-space: nowrap; }
.form-row .radio-group input { flex: 0; margin-right: 4px; }
.form-row .input-group { flex: 1; display: flex; gap: 6px; align-items: center; }
.form-row.compact label { width: 60px; }
.card h3 { margin-bottom: 10px; font-size: 15px; font-weight: 700; color: #0f172a; }

/* Modern Modal & Backdrop */
.modal {
  position: fixed; 
  inset: 0; 
  background: rgba(15, 23, 42, 0.6); 
  backdrop-filter: blur(4px); 
  display: none; 
  align-items: center; 
  justify-content: center; 
  z-index: 1000;
  animation: fadeIn 0.15s ease-out;
}
.modal .card {
  padding: 0; 
  display: flex; 
  flex-direction: column; 
  border: 1px solid #cbd5e1; 
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  border-radius: var(--radius-lg);
  background: #ffffff;
  overflow: hidden;
  animation: scaleIn 0.15s ease-out;
}

.titlebar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #ffffff;
  color: #0f172a;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 700;
  height: 44px;
  border-bottom: 1px solid #e2e8f0;
  user-select: none;
}

.titlebar .ctl {
  background: #f1f5f9;
  border: none;
  color: #64748b;
  cursor: pointer;
  font-size: 16px;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.titlebar .ctl:hover {
  background: #fee2e2;
  color: #dc2626;
}

/* Loading Spinner */
.spinner-overlay { position:fixed; inset:0; background:rgba(255,255,255,0.7); backdrop-filter: blur(3px); display:flex; align-items:center; justify-content:center; z-index:9999; }
.spinner { width:40px; height:40px; border:4px solid #e2e8f0; border-top:4px solid #0284c7; border-radius:50%; animation:spin 0.8s linear infinite; }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes scaleIn { from { opacity: 0; transform: scale(0.96); } to { opacity: 1; transform: scale(1); } }

/* Cart highlight transition */
@keyframes cartHighlight {
  0% { background-color: #d1fae5; transform: scale(1.01); }
  50% { background-color: #a7f3d0; }
  100% { background-color: transparent; transform: scale(1); }
}
.cart-item-flash {
  animation: cartHighlight 0.4s ease-out;
}

/* ================= THEMES SYSTEM ================= */

/* --- 1. MODERN LIGHT THEME --- */
[data-theme="MODERN_LIGHT"] {
  --bg: #f8fafc;
  --panel: #ffffff;
  --ink: #0f172a;
  --muted: #64748b;
  --brand: #0284c7;
  --brand-hover: #0369a1;
  --line: #e2e8f0;
  --grid-border: #e2e8f0;
  --nav-bg: #ffffff;
  --nav-ink: #0f172a;
}

[data-theme="MODERN_LIGHT"] body {
  background: var(--bg);
  color: var(--ink);
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
}

[data-theme="MODERN_LIGHT"] .top-nav {
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

[data-theme="MODERN_LIGHT"] .card {
  border-radius: 10px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  border: 1px solid #e2e8f0;
}

[data-theme="MODERN_LIGHT"] .btn {
  border-radius: 6px;
  font-weight: 600;
}

[data-theme="MODERN_LIGHT"] .input {
  border-radius: 6px;
  border-color: #cbd5e1;
  box-shadow: none;
  padding: 6px 10px;
}

[data-theme="MODERN_LIGHT"] .input:focus {
  border-color: #0284c7;
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
  outline: none;
}

/* --- 2. MODERN DARK GLASS THEME --- */
[data-theme="MODERN_DARK"] {
  --bg: #0f172a;
  --panel: #1e293b;
  --ink: #f8fafc;
  --muted: #94a3b8;
  --brand: #38bdf8;
  --brand-hover: #0284c7;
  --line: #334155;
  --grid-border: #334155;
  --nav-bg: #1e293b;
  --nav-ink: #f8fafc;
}

[data-theme="MODERN_DARK"] body {
  background: #0f172a;
  color: #f8fafc;
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
}

/* Headers, labels, and text elements */
[data-theme="MODERN_DARK"] h1,
[data-theme="MODERN_DARK"] h2,
[data-theme="MODERN_DARK"] h3,
[data-theme="MODERN_DARK"] h4,
[data-theme="MODERN_DARK"] h5,
[data-theme="MODERN_DARK"] h6,
[data-theme="MODERN_DARK"] .header .title,
[data-theme="MODERN_DARK"] .form-row label,
[data-theme="MODERN_DARK"] #shiftStatus {
  color: #f8fafc !important;
}

[data-theme="MODERN_DARK"] label {
  color: #e2e8f0;
}

[data-theme="MODERN_DARK"] small,
[data-theme="MODERN_DARK"] .caption,
[data-theme="MODERN_DARK"] .muted,
[data-theme="MODERN_DARK"] .form-row small,
[data-theme="MODERN_DARK"] .hotkey {
  color: #94a3b8 !important;
}

[data-theme="MODERN_DARK"] .top-nav {
  background: #1e293b;
  color: #f8fafc;
  border-bottom: 1px solid #334155;
}

[data-theme="MODERN_DARK"] .logo {
  color: #f8fafc;
}

[data-theme="MODERN_DARK"] .logo span {
  color: #38bdf8;
}

[data-theme="MODERN_DARK"] .nav-group-label,
[data-theme="MODERN_DARK"] .nav-link {
  color: #cbd5e1;
}

[data-theme="MODERN_DARK"] .nav-link:hover {
  background: #334155;
  color: #ffffff;
}

[data-theme="MODERN_DARK"] .nav-link.active {
  background: #0284c7;
  color: #ffffff;
}

[data-theme="MODERN_DARK"] .nav-group-items {
  background: #1e293b;
  border-color: #334155;
  box-shadow: 0 10px 25px rgba(0,0,0,0.5);
}

[data-theme="MODERN_DARK"] .card,
[data-theme="MODERN_DARK"] .panel {
  background: #1e293b;
  color: #f8fafc;
  border: 1px solid #334155;
  border-radius: 10px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.3);
}

[data-theme="MODERN_DARK"] .input,
[data-theme="MODERN_DARK"] select,
[data-theme="MODERN_DARK"] textarea {
  background: #0f172a;
  color: #f8fafc;
  border: 1px solid #475569;
  border-radius: 6px;
  padding: 6px 10px;
  box-shadow: none;
}

[data-theme="MODERN_DARK"] select option {
  background: #1e293b;
  color: #f8fafc;
}

[data-theme="MODERN_DARK"] ::placeholder {
  color: #64748b;
  opacity: 1;
}

[data-theme="MODERN_DARK"] .input:focus,
[data-theme="MODERN_DARK"] select:focus,
[data-theme="MODERN_DARK"] textarea:focus {
  border-color: #38bdf8;
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.2);
  outline: none;
}

/* DataGrid & Tables in Dark Mode */
[data-theme="MODERN_DARK"] .datagrid {
  border-color: #334155;
  background: #1e293b;
}

[data-theme="MODERN_DARK"] .datagrid th {
  background: #0f172a;
  color: #94a3b8;
  border-color: #334155;
}

[data-theme="MODERN_DARK"] .datagrid td {
  border-color: #334155;
  color: #e2e8f0;
}

[data-theme="MODERN_DARK"] .datagrid tbody tr {
  background: #1e293b;
}

[data-theme="MODERN_DARK"] .datagrid tbody tr:nth-child(even) {
  background: #162032 !important;
}

[data-theme="MODERN_DARK"] .datagrid tbody tr:hover td {
  background: #334155 !important;
}

/* Dropdowns & Autocomplete */
[data-theme="MODERN_DARK"] .drop,
[data-theme="MODERN_DARK"] .cust-dd {
  background: #1e293b !important;
  color: #f8fafc !important;
  border-color: #334155 !important;
}

[data-theme="MODERN_DARK"] .drop div:hover,
[data-theme="MODERN_DARK"] .cust-dd:hover {
  background: #334155 !important;
  color: #ffffff !important;
}

/* F&B Cards and Touchscreen Components */
[data-theme="MODERN_DARK"] .menu-card {
  background: #1e293b !important;
  border-color: #334155 !important;
}

[data-theme="MODERN_DARK"] .menu-card .title {
  color: #f8fafc !important;
}

[data-theme="MODERN_DARK"] .menu-card .price {
  color: #38bdf8 !important;
}

[data-theme="MODERN_DARK"] .menu-card .stock-tag {
  color: #94a3b8 !important;
}

[data-theme="MODERN_DARK"] .cat-sidebar {
  background: #1e293b !important;
  border-color: #334155 !important;
}

[data-theme="MODERN_DARK"] .cat-btn {
  background: #0f172a !important;
  border-color: #334155 !important;
  color: #cbd5e1 !important;
}

[data-theme="MODERN_DARK"] .cat-btn.active {
  background: #0284c7 !important;
  color: white !important;
  border-color: #0369a1 !important;
}

[data-theme="MODERN_DARK"] .search-bar-wrap {
  background: #1e293b !important;
  border-color: #334155 !important;
}

[data-theme="MODERN_DARK"] .search-bar-wrap input {
  background: transparent !important;
  color: #f8fafc !important;
}

[data-theme="MODERN_DARK"] .cart-sidebar {
  background: #1e293b !important;
  border-color: #334155 !important;
}

[data-theme="MODERN_DARK"] .cart-header {
  background: #0f172a !important;
  border-color: #334155 !important;
  color: #f8fafc !important;
}

[data-theme="MODERN_DARK"] .order-type-tabs {
  background: #0f172a !important;
  border-color: #334155 !important;
}

[data-theme="MODERN_DARK"] .type-btn {
  background: #1e293b !important;
  color: #cbd5e1 !important;
  border-color: #334155 !important;
}

[data-theme="MODERN_DARK"] .type-btn.active {
  background: #0284c7 !important;
  color: white !important;
  border-color: #0369a1 !important;
}

[data-theme="MODERN_DARK"] .cart-summary {
  background: #0f172a !important;
  border-color: #334155 !important;
}

[data-theme="MODERN_DARK"] .cart-item {
  border-color: #334155 !important;
}

[data-theme="MODERN_DARK"] .cart-item .name {
  color: #f8fafc !important;
}

[data-theme="MODERN_DARK"] .qty-btn {
  background: #1e293b !important;
  color: #f8fafc !important;
  border-color: #334155 !important;
}

[data-theme="MODERN_DARK"] .summary-row {
  color: #cbd5e1 !important;
}

[data-theme="MODERN_DARK"] .summary-row.grand {
  color: #f8fafc !important;
  border-color: #334155 !important;
}

[data-theme="MODERN_DARK"] .fnb-layout {
  background: #0f172a !important;
}

[data-theme="MODERN_DARK"] .top-nav #userInfo {
  color: #f8fafc !important;
}

[data-theme="MODERN_DARK"] .modal .card {
  background: #1e293b;
  color: #f8fafc;
  border-color: #334155;
}

[data-theme="MODERN_DARK"] .titlebar {
  background: #0f172a;
  color: #f8fafc;
  border-bottom: 1px solid #334155;
}

[data-theme="MODERN_DARK"] .stat-mini {
  background: #0f172a;
  color: #f8fafc;
  border: 1px solid #334155;
}

[data-theme="MODERN_DARK"] .stat-mini span {
  color: #94a3b8;
}

[data-theme="MODERN_DARK"] .info-box {
  background: #0c4a6e;
  border-left-color: #38bdf8;
  color: #e0f2fe;
}

[data-theme="MODERN_DARK"] .warn-box {
  background: #451a03;
  border-left-color: #f59e0b;
  color: #fef3c7;
}

[data-theme="MODERN_DARK"] .btn-outline {
  border-color: #475569;
  color: #cbd5e1;
  background: transparent;
}

[data-theme="MODERN_DARK"] .btn-outline:hover {
  background: #334155;
  color: #ffffff;
}

/* ===== Toggle Switch (untuk Webhook, dll) ===== */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}
.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: #ccc;
  transition: 0.3s;
  border-radius: 24px;
}
.slider:before {
  content: "";
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.3s;
  border-radius: 50%;
}
.switch input:checked + .slider {
  background-color: #0078d7;
}
.switch input:checked + .slider:before {
  transform: translateX(20px);
}

/* ==========================================================================
   MOBILE & TABLET RESPONSIVE SYSTEM
   ========================================================================== */

.mobile-nav-toggle {
  display: none;
}
.mobile-nav-backdrop {
  display: none;
}
.mobile-bottom-nav {
  display: none;
}
.mobile-nav-header,
.mobile-nav-close {
  display: none;
}

@media (max-width: 1024px) {
  .grid-4 {
    grid-template-columns: repeat(2, 1fr) !important;
  }
  .header {
    flex-wrap: wrap !important;
    gap: 10px !important;
  }
  .header .flex-row {
    flex-wrap: wrap !important;
    gap: 6px !important;
  }
}

@media (max-width: 768px) {
  html, body {
    height: 100% !important;
    height: 100dvh !important;
    max-width: 100vw !important;
    overflow-x: hidden !important;
    box-sizing: border-box !important;
    font-size: 14px;
    -webkit-tap-highlight-color: transparent;
  }

  .app {
    height: 100% !important;
    height: 100dvh !important;
    max-height: 100% !important;
    overflow: hidden !important;
  }

  .layout, .main {
    max-width: 100vw !important;
    overflow-x: hidden !important;
    box-sizing: border-box !important;
  }

  .main {
    padding: 12px !important;
    padding-bottom: 110px !important; /* Ruang lega di bawah agar tombol & tabel tidak tertutup navbar */
    gap: 12px !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }

  .main > * {
    flex-shrink: 0 !important; /* Mencegah card/tabel/form di bawah terhimpit */
  }

  .main::after {
    content: '';
    display: block;
    height: 24px;
    flex-shrink: 0;
  }

  /* Top Navigation */
  .top-nav {
    height: 52px !important;
    padding: 0 12px !important;
    position: relative;
    z-index: 10002 !important;
  }
  .logo {
    font-size: 16px !important;
    margin-right: 8px !important;
  }

  .mobile-nav-toggle {
    display: none !important;
  }

  /* Mobile Slide-Out Drawer */
  .nav-menu {
    position: fixed !important;
    top: 0 !important;
    left: -340px !important;
    width: min(300px, 85vw) !important;
    height: 100vh !important;
    height: 100dvh !important;
    background: #ffffff !important;
    box-shadow: 4px 0 25px rgba(0,0,0,0.15) !important;
    z-index: 10001 !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 6px !important;
    padding: 16px !important;
    box-sizing: border-box !important;
    overflow-y: auto !important;
    transition: left 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
  }
  .nav-menu.open {
    left: 0 !important;
  }

  .mobile-nav-header,
  .mobile-nav-close {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    width: 100% !important;
    box-sizing: border-box !important;
    padding-bottom: 12px !important;
    border-bottom: 1px solid #e2e8f0 !important;
    margin-bottom: 10px !important;
  }
  .mobile-nav-title {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    font-weight: 700 !important;
    font-size: 15px !important;
    color: #0f172a !important;
  }
  .mobile-nav-icon {
    font-size: 17px !important;
  }
  .mobile-nav-close-btn {
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    border-radius: 50% !important;
    background: #f1f5f9 !important;
    border: 1px solid #cbd5e1 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 14px !important;
    font-weight: 700 !important;
    color: #475569 !important;
    cursor: pointer !important;
    padding: 0 !important;
    line-height: 1 !important;
    transition: all 0.15s ease !important;
    -webkit-tap-highlight-color: transparent !important;
  }
  .mobile-nav-close-btn:active {
    background: #e2e8f0 !important;
    color: #0f172a !important;
    transform: scale(0.92) !important;
  }

  .nav-menu .nav-group {
    width: 100% !important;
    flex-direction: column !important;
    align-items: stretch !important;
    height: auto !important;
  }
  .nav-menu .nav-group-label {
    width: 100% !important;
    height: 42px !important;
    font-size: 13px !important;
    padding: 0 12px !important;
    background: #f8fafc !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 6px !important;
    justify-content: flex-start !important;
  }
  .nav-menu .nav-group-label::after {
    content: "▼";
    margin-left: auto;
    font-size: 10px;
    color: #94a3b8;
  }
  .nav-menu .nav-group.expanded .nav-group-label::after {
    content: "▲";
  }
  .nav-menu .nav-group-items {
    display: none !important;
    position: static !important;
    box-shadow: none !important;
    border: none !important;
    border-left: 2px solid #0078d7 !important;
    margin-left: 12px !important;
    padding: 4px 0 6px 10px !important;
    gap: 4px !important;
  }
  .nav-menu .nav-group.expanded .nav-group-items {
    display: flex !important;
  }
  .nav-menu .nav-link {
    padding: 10px 12px !important;
    font-size: 13px !important;
    border-radius: 6px !important;
    white-space: normal !important;
  }

  /* Backdrop: Translucent & Soft (Not Pitch Black) */
  .mobile-nav-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.25);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    z-index: 10000;
    display: none;
    opacity: 0;
    transition: opacity 0.2s ease;
  }
  .mobile-nav-backdrop.show {
    display: block !important;
    opacity: 1 !important;
  }

  /* Sticky Bottom Navigation Bar for Mobile */
  .mobile-bottom-nav {
    display: flex !important;
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    height: 58px !important;
    background: #ffffff !important;
    border-top: 1px solid #cbd5e1 !important;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.06) !important;
    z-index: 9999 !important;
    justify-content: space-around !important;
    align-items: center !important;
    padding: 0 4px !important;
    padding-bottom: env(safe-area-inset-bottom, 0px) !important;
    box-sizing: content-box !important;
  }
  .mobile-bottom-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    text-decoration: none;
    color: #64748b;
    font-size: 10px;
    font-weight: 600;
    padding: 6px 0;
    cursor: pointer;
    border-radius: 6px;
  }
  .mobile-bottom-item:active {
    background: #f1f5f9;
  }
  .mobile-bottom-item.active {
    color: #0078d7 !important;
  }
  .mobile-bottom-item .icon {
    font-size: 20px;
    line-height: 1;
  }

  /* Dashboard Cards & Layout */
  .grid-4 {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px !important;
  }
  .dashboard-grid-2,
  div[style*="grid-template-columns:1fr 1fr"],
  div[style*="grid-template-columns: 1fr 1fr"],
  div[style*="grid-template-columns:repeat(4,1fr)"],
  div[style*="grid-template-columns: repeat(4, 1fr)"] {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }
  div[style*="grid-template-columns"] > * {
    min-width: 0 !important;
  }

  .flex-row {
    flex-wrap: wrap !important;
    gap: 6px !important;
  }
  .flex-row > * {
    min-width: 0;
  }

  /* Card headers and sub-headers on mobile */
  .card > div[style*="justify-content:space-between"],
  .card > div[style*="justify-content: space-between"] {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 8px !important;
  }
  .card > div[style*="justify-content:space-between"] > div,
  .card > div[style*="justify-content: space-between"] > div {
    flex-wrap: wrap !important;
    width: 100% !important;
  }

  /* Purchase order item rows */
  .po-row {
    flex-wrap: wrap !important;
    gap: 6px !important;
    padding: 8px 0 !important;
    border-bottom: 1px dashed #cbd5e1 !important;
  }
  .po-row > div:first-child {
    flex: 1 1 100% !important;
    width: 100% !important;
  }
  .po-row > input {
    flex: 1 1 35% !important;
  }
  .po-row > button {
    flex: 0 0 auto !important;
  }

  /* Kasir Retail Layout Mobile */
  .kasir-layout .scan-row,
  .kasir-layout > div:first-child {
    flex-wrap: wrap !important;
  }
  .kasir-main {
    flex-direction: column !important;
    gap: 12px !important;
  }
  .kasir-main > div:last-child {
    width: 100% !important;
  }

  .card {
    padding: 12px !important;
    border-radius: 8px !important;
    border: 1px solid #cbd5e1 !important;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04) !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    overflow-x: hidden;
  }
  .card h3 {
    font-size: 14px !important;
    margin-bottom: 8px !important;
  }
  .stat-label {
    font-size: 11px !important;
    color: #64748b !important;
  }
  .stat-val {
    font-size: 20px !important;
    font-weight: 700 !important;
  }

  /* Header & Action Rows */
  .header {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 8px !important;
  }
  .header .title {
    font-size: 18px !important;
  }
  .header .flex-row {
    width: 100% !important;
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 6px !important;
  }
  .header .flex-row .btn {
    flex: 1 1 auto !important;
    text-align: center !important;
  }

  /* Forms, Inputs & Buttons */
  .btn {
    min-height: 38px;
    padding: 8px 12px;
    font-size: 13px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  .input, select, textarea {
    min-height: 38px;
    font-size: 14px;
    padding: 6px 10px;
    border-radius: 6px;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
  }
  .form-row {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 5px !important;
    margin-bottom: 8px !important;
  }
  .form-row label {
    width: 100% !important;
    text-align: left !important;
    font-size: 12px !important;
    font-weight: 600;
  }
  .form-row label:empty {
    display: none !important;
  }
  .form-row label.switch { width:44px; min-width:44px; max-width:44px; flex:0 0 44px; height:24px; margin:0; padding:0; text-align:left; display:inline-block; position:relative; }
  /* Primary form action buttons on mobile */
  .card.tab-content .form-row > button.btn,
  .card.tab-content .form-row > button[onclick*="save"],
  .card.tab-content .form-row > button[onclick*="activate"] {
    width: 100% !important;
    min-height: 44px !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    border-radius: 8px !important;
    margin-top: 10px !important;
    background: #0284c7 !important;
    color: #ffffff !important;
    border: none !important;
    box-shadow: 0 2px 6px rgba(2,132,199,0.25) !important;
  }
  /* Form row button groups */
  .form-row > div[style*="display:flex"]:not(:has(input[type="file"])),
  .form-row > div[style*="display: flex"]:not(:has(input[type="file"])),
  .form-row .btn-group {
    width: 100% !important;
    display: flex !important;
    gap: 8px !important;
    margin-top: 6px !important;
  }
  .form-row > div[style*="display:flex"]:not(:has(input[type="file"])) > .btn,
  .form-row > div[style*="display: flex"]:not(:has(input[type="file"])) > .btn,
  .form-row .btn-group > .btn {
    flex: 1 1 0 !important;
    min-height: 44px !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    border-radius: 8px !important;
  }
  /* File upload and small utility buttons inside form rows */
  .form-row input[type="file"] ~ .btn,
  .form-row button[onclick*="clearLogo"] {
    width: auto !important;
    min-height: 36px !important;
    font-size: 12px !important;
    padding: 6px 12px !important;
    display: inline-flex !important;
    margin-top: 6px !important;
    flex: none !important;
  }

  /* All search & filter toolbars on mobile */
  .card[style*="display:flex"],
  .card[style*="display: flex"] {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 10px !important;
    box-sizing: border-box !important;
    overflow-x: hidden !important;
  }
  .card[style*="display:flex"] > *,
  .card[style*="display: flex"] > * {
    max-width: 100% !important;
    box-sizing: border-box !important;
  }
  .card input[style*="width"] {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }
  .card > div[style*="display:flex"],
  .card > div[style*="display: flex"] {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 6px !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }
  .card > div[style*="display:flex"] > .btn,
  .card > div[style*="display: flex"] > .btn {
    flex: 1 1 auto !important;
    min-width: 70px !important;
    text-align: center !important;
    padding: 8px 8px !important;
    font-size: 12px !important;
  }

  /* Tables: responsive horizontal scrolling */
  .table-responsive {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    margin: 6px 0 10px 0 !important;
    border-radius: 6px !important;
    box-sizing: border-box !important;
  }

  /* Tab content visibility: strictly hide inactive tabs */
  .tab-content,
  .card.tab-content {
    display: none !important;
  }
  .tab-content.active,
  .card.tab-content.active {
    display: block !important;
  }
  
  table.datagrid {
    display: table !important;
    width: 100% !important;
    min-width: 620px !important;
    border-collapse: separate !important;
    border-spacing: 0 !important;
  }
  table.datagrid th, table.datagrid td {
    white-space: nowrap !important;
    padding: 8px 10px !important;
    font-size: 13px !important;
  }
  /* Sticky first column on mobile for easy navigation */
  table.datagrid th:first-child,
  table.datagrid td:first-child {
    position: sticky !important;
    left: 0 !important;
    background: #f8fafc !important;
    z-index: 2 !important;
    box-shadow: 2px 0 4px rgba(0,0,0,0.06) !important;
  }
  table.datagrid td:first-child {
    background: #ffffff !important;
  }
  table.datagrid tbody tr:nth-child(even) td:first-child {
    background: #f9f9f9 !important;
  }

  /* Swipe indicator hint */
  .table-swipe-hint {
    display: flex !important;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: #64748b;
    margin-bottom: 6px;
    padding: 4px 8px;
    background: #f1f5f9;
    border-radius: 4px;
    width: fit-content;
  }

  /* Modals on mobile */
  .modal {
    padding: 10px !important;
    box-sizing: border-box !important;
  }
  .modal .card {
    width: 100% !important;
    max-width: 100% !important;
    max-height: 90vh !important;
    box-sizing: border-box !important;
    margin: auto !important;
    overflow-y: auto !important;
  }

  /* Tabs: Swipeable, modern pill tabs on mobile */
  .tab-bar {
    display: flex !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    white-space: nowrap !important;
    padding: 6px 8px 12px 8px !important;
    margin-bottom: 12px !important;
    gap: 8px !important;
    flex-wrap: nowrap !important;
    border-bottom: none !important;
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
  }
  .tab-bar::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
  }
  .tab-btn {
    flex-shrink: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 8px 18px !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    border-radius: 20px !important;
    border: 1px solid #cbd5e1 !important;
    background: #f1f5f9 !important;
    color: #475569 !important;
    min-height: 38px !important;
    line-height: 1.2 !important;
    box-sizing: border-box !important;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05) !important;
    transition: all 0.15s ease !important;
  }
  .tab-btn:hover {
    background: #e2e8f0 !important;
    color: #1e293b !important;
  }
  .tab-btn.active {
    background: #0284c7 !important;
    color: #ffffff !important;
    border-color: #0284c7 !important;
    box-shadow: 0 2px 6px rgba(2,132,199,0.3) !important;
  }

  /* Kasir Mobile & Touchscreen Optimization */
  .kasir-layout {
    gap: 8px !important;
  }
  .kasir-layout > div:first-child {
    flex-wrap: wrap !important;
    gap: 6px !important;
  }
  .kasir-main {
    flex-direction: column !important;
  }
  .kasir-main > div:last-child {
    width: 100% !important;
  }
  .pos-display {
    font-size: 26px !important;
    padding: 8px 12px !important;
  }
}

@media (max-width: 480px) {
  .grid-4 {
    grid-template-columns: 1fr !important;
  }
  .top-nav #userInfo {
    display: none !important;
  }
}

/* Platform Android - Sembunyikan fitur WhatsApp lokal yang butuh Go desktop daemon */
body.platform-android .tab-btn[data-tab="whatsapp"],
body.platform-android .tab-content[data-tab="whatsapp"],
body.platform-android .card.tab-content[data-tab="whatsapp"],
body.platform-android #waReceiptRow,
body.platform-android #btnWaStruk,
body.platform-android #btnWaStrukFnb,
body.platform-android .btn-wa-struk,
body.platform-android button[onclick*="sendWAStrukPPOB"],
body.platform-android button[onclick*="waStruk"] {
  display: none !important;
}



