/* ════════════════════════════════════════════════════════
   DESIGN TOKENS
════════════════════════════════════════════════════════ */
:root {
  --sidebar-w: 260px;
  --header-h: 62px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;

  /* ── DARK THEME ── */
  --bg-main:    #020617;
  --bg-header:  rgba(15, 23, 42, 0.85);
  --bg-surface: #0f172a;
  --bg-sidebar: #020617;
  --bg-card:    #0f172a;
  --bg-input:   #1e293b;

  --border-base:  #1e293b;
  --border-light: rgba(255,255,255,0.05);

  --text-primary:   #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted:     #64748b;

  --accent:        #2563eb;
  --accent-hover:  #1d4ed8;
  --primary:       #1d4ed8;
  --primary-hover: #1e40af;
  --primary-glow:  rgba(37, 99, 235, 0.25);
  --sidebar-grad-start: #164fe4;
  --sidebar-grad-end:   #122260;

  --success: #22c55e;
  --warning: #f59e0b;
  --danger:  #ef4444;
  --info:    #06b6d4;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.1);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.2);
  --shadow-lg: 0 12px 32px rgba(0,0,0,0.3);
  --sidebar-active: rgba(37, 99, 235, 0.12);
}

/* ════════════════════════════════════════════════════════
   COLOR THEMES
   ════════════════════════════════════════════════════════ */
[data-color-theme="biru"] {
  --accent:        #2563eb;
  --accent-hover:  #1d4ed8;
  --primary:       #1d4ed8;
  --primary-hover: #1e40af;
  --primary-glow:  rgba(37, 99, 235, 0.25);
  --sidebar-grad-start: #164fe4;
  --sidebar-grad-end:   #122260;
  --sidebar-active: rgba(37, 99, 235, 0.12);
}
[data-theme="light"][data-color-theme="biru"] {
  --sidebar-active: #eff6ff;
}

[data-color-theme="emerald"] {
  --accent:        #10b981;
  --accent-hover:  #059669;
  --primary:       #059669;
  --primary-hover: #047857;
  --primary-glow:  rgba(16, 185, 129, 0.25);
  --sidebar-grad-start: #047857;
  --sidebar-grad-end:   #064e3b;
  --sidebar-active: rgba(16, 185, 129, 0.12);
}
[data-theme="light"][data-color-theme="emerald"] {
  --sidebar-active: #ecfdf5;
}

[data-color-theme="indigo"] {
  --accent:        #6366f1;
  --accent-hover:  #4f46e5;
  --primary:       #4f46e5;
  --primary-hover: #4338ca;
  --primary-glow:  rgba(99, 102, 241, 0.25);
  --sidebar-grad-start: #4338ca;
  --sidebar-grad-end:   #312e81;
  --sidebar-active: rgba(99, 102, 241, 0.12);
}
[data-theme="light"][data-color-theme="indigo"] {
  --sidebar-active: #eef2ff;
}

[data-color-theme="amber"] {
  --accent:        #f59e0b;
  --accent-hover:  #d97706;
  --primary:       #d97706;
  --primary-hover: #b45309;
  --primary-glow:  rgba(245, 158, 11, 0.25);
  --sidebar-grad-start: #d97706;
  --sidebar-grad-end:   #78350f;
  --sidebar-active: rgba(245, 158, 11, 0.12);
}
[data-theme="light"][data-color-theme="amber"] {
  --sidebar-active: #fffbeb;
}

[data-color-theme="rose"] {
  --accent:        #f43f5e;
  --accent-hover:  #e11d48;
  --primary:       #e11d48;
  --primary-hover: #be123c;
  --primary-glow:  rgba(244, 63, 94, 0.25);
  --sidebar-grad-start: #e11d48;
  --sidebar-grad-end:   #881337;
  --sidebar-active: rgba(244, 63, 94, 0.12);
}
[data-theme="light"][data-color-theme="rose"] {
  --sidebar-active: #fff1f2;
}

[data-color-theme="slate"] {
  --accent:        #64748b;
  --accent-hover:  #475569;
  --primary:       #475569;
  --primary-hover: #334155;
  --primary-glow:  rgba(100, 116, 139, 0.25);
  --sidebar-grad-start: #475569;
  --sidebar-grad-end:   #1e293b;
  --sidebar-active: rgba(100, 116, 139, 0.12);
}
[data-theme="light"][data-color-theme="slate"] {
  --sidebar-active: #f8fafc;
}

[data-color-theme="violet"] {
  --accent:        #8b5cf6;
  --accent-hover:  #7c3aed;
  --primary:       #7c3aed;
  --primary-hover: #6d28d9;
  --primary-glow:  rgba(139, 92, 246, 0.25);
  --sidebar-grad-start: #6d28d9;
  --sidebar-grad-end:   #4c1d95;
  --sidebar-active: rgba(139, 92, 246, 0.12);
}
[data-theme="light"][data-color-theme="violet"] {
  --sidebar-active: #f5f3ff;
}

[data-color-theme="teal"] {
  --accent:        #0d9488;
  --accent-hover:  #0f766e;
  --primary:       #0f766e;
  --primary-hover: #115e59;
  --primary-glow:  rgba(13, 148, 136, 0.25);
  --sidebar-grad-start: #0f766e;
  --sidebar-grad-end:   #134e4a;
  --sidebar-active: rgba(13, 148, 136, 0.12);
}
[data-theme="light"][data-color-theme="teal"] {
  --sidebar-active: #f0fdfa;
}

[data-color-theme="orange"] {
  --accent:        #f97316;
  --accent-hover:  #ea580c;
  --primary:       #ea580c;
  --primary-hover: #c2410c;
  --primary-glow:  rgba(249, 115, 22, 0.25);
  --sidebar-grad-start: #ea580c;
  --sidebar-grad-end:   #7c2d12;
  --sidebar-active: rgba(249, 115, 22, 0.12);
}
[data-theme="light"][data-color-theme="orange"] {
  --sidebar-active: #fff7ed;
}

[data-color-theme="sky"] {
  --accent:        #0ea5e9;
  --accent-hover:  #0284c7;
  --primary:       #0284c7;
  --primary-hover: #0369a1;
  --primary-glow:  rgba(14, 165, 233, 0.25);
  --sidebar-grad-start: #0284c7;
  --sidebar-grad-end:   #0c4a6e;
  --sidebar-active: rgba(14, 165, 233, 0.12);
}
[data-theme="light"][data-color-theme="sky"] {
  --sidebar-active: #f0f9ff;
}

[data-color-theme="red"] {
  --accent:        #ef4444;
  --accent-hover:  #dc2626;
  --primary:       #dc2626;
  --primary-hover: #b91c1c;
  --primary-glow:  rgba(239, 68, 68, 0.25);
  --sidebar-grad-start: #dc2626;
  --sidebar-grad-end:   #7f1d1d;
  --sidebar-active: rgba(239, 68, 68, 0.12);
}
[data-theme="light"][data-color-theme="red"] {
  --sidebar-active: #fef2f2;
}

[data-color-theme="fuchsia"] {
  --accent:        #d946ef;
  --accent-hover:  #c026d3;
  --primary:       #c026d3;
  --primary-hover: #a21caf;
  --primary-glow:  rgba(217, 70, 239, 0.25);
  --sidebar-grad-start: #c026d3;
  --sidebar-grad-end:   #701a75;
  --sidebar-active: rgba(217, 70, 239, 0.12);
}
[data-theme="light"][data-color-theme="fuchsia"] {
  --sidebar-active: #fdf4ff;
}

/* ── LIGHT THEME ── */
[data-theme="light"] {
  --bg-main:    #f1f5f9;
  --bg-header:  rgba(255,255,255,0.92);
  --bg-surface: #ffffff;
  --bg-sidebar: #ffffff;
  --bg-card:    #ffffff;
  --bg-input:   #f1f5f9;

  --border-base:  #e2e8f0;
  --border-light: #f1f5f9;

  --text-primary:   #0f172a;
  --text-secondary: #334155;
  --text-muted:     #64748b;

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.06);
  --shadow-lg: 0 12px 30px rgba(0,0,0,0.08);
  --sidebar-active: #eff6ff;
}

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

body {
  font-family: var(--font-sans);
  background: var(--bg-main);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: background 0.25s ease, color 0.25s ease;
  overflow-x: hidden;
}

a { text-decoration: none; color: inherit; }

/* ════════════════════════════════════════════════════════
   LAYOUT WRAPPER
════════════════════════════════════════════════════════ */
.wrapper {
  display: flex;
  min-height: 100vh;
}

/* ════════════════════════════════════════════════════════
   SIDEBAR
════════════════════════════════════════════════════════ */
.main-sidebar {
  width: var(--sidebar-w);
  background: linear-gradient(180deg, var(--sidebar-grad-start, #164fe4) 0%, var(--sidebar-grad-end, #122260) 100%);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 200;
  transition: transform 0.3s cubic-bezier(0.4,0,0.2,1), width 0.3s cubic-bezier(0.4,0,0.2,1);
  overflow: hidden;
}

.main-sidebar.sidebar-collapsed {
  transform: translateX(-100%);
}

/* ── Sidebar Logo ── */
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 20px 30px 20px;
  height: auto;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

.logo-mark {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--accent), var(--primary));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px var(--primary-glow);
  flex-shrink: 0;
}

.logo-mark span {
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  font-family: var(--font-mono);
}

.logo-text {
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: #ffffff;
  background: none;
  -webkit-text-fill-color: #ffffff;
  white-space: nowrap;
}

/* ── Store Pill ── */
.sidebar-store {
  display: none !important;
  margin: 16px 12px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
  white-space: nowrap;
}

.store-icon {
  width: 34px;
  height: 34px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.store-icon i { color: #ffffff; font-size: 14px; }

.store-info { overflow: hidden; }
.store-label { font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; color: rgba(255, 255, 255, 0.5); }
.store-name  { font-size: 13px; font-weight: 700; color: #ffffff; overflow: hidden; text-overflow: ellipsis; }

/* ── Nav Menu ── */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 8px 10px;
}

.sidebar-nav::-webkit-scrollbar { width: 3px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.15); border-radius: 3px; }

.nav-section-label {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.45);
  padding: 16px 10px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: #ffffff;
  font-weight: 500;
  font-size: 13.5px;
  cursor: pointer;
  transition: all 0.18s;
  white-space: nowrap;
  overflow: hidden;
  margin-bottom: 2px;
}

.nav-item i {
  width: 18px;
  text-align: center;
  font-size: 14px;
  color: #ffffff;
  flex-shrink: 0;
  transition: color 0.18s;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.nav-item:hover i { color: #ffffff; }

.nav-item.active {
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
  font-weight: 700;
}

.nav-item.active i { color: #ffffff; }

.nav-badge {
  margin-left: auto;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 20px;
}

/* ── Sidebar Footer ── */
.sidebar-footer {
  padding: 14px 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
  white-space: nowrap;
}

.user-avatar {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--accent), var(--primary));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
}

.user-info { overflow: hidden; }
.user-name-text { font-size: 13px; font-weight: 700; color: #ffffff; }
.user-role-text { font-size: 11px; color: rgba(255, 255, 255, 0.5); }

.sidebar-logout {
  margin-left: auto;
  width: 30px;
  height: 30px;
  background: transparent;
  border: none;
  cursor: pointer;
  color: rgba(255, 255, 255, 0.6);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  font-size: 14px;
  flex-shrink: 0;
}

.sidebar-logout:hover { background: rgba(255, 255, 255, 0.1); color: #ffffff; }

/* ── Overlay (mobile) ── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 199;
  backdrop-filter: blur(4px);
}

.sidebar-overlay.active { display: block; }

/* ════════════════════════════════════════════════════════
   MAIN AREA
════════════════════════════════════════════════════════ */
#mainWrapper {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  transition: margin-left 0.3s cubic-bezier(0.4,0,0.2,1);
}

#mainWrapper.sidebar-collapsed {
  margin-left: 0;
}

/* ════════════════════════════════════════════════════════
   HEADER / TOPBAR
════════════════════════════════════════════════════════ */
.main-header {
  height: var(--header-h);
  background: var(--bg-header);
  border-bottom: 1px solid var(--border-base);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
}

.header-toggle {
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: all 0.2s;
  flex-shrink: 0;
}

.header-toggle:hover { background: var(--border-light); color: var(--text-primary); }

/* Context bar */
.nav-context-bar {
  display: flex;
  align-items: center;
  background: var(--bg-input);
  border: 1px solid var(--border-base);
  border-radius: var(--radius-md);
  height: 42px;
  padding: 0 4px;
  flex: 1;
  max-width: 480px;
  overflow: hidden;
}

.ctx-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
}

.ctx-item i { font-size: 13px; color: var(--accent); }

.ctx-info { display: flex; flex-direction: column; line-height: 1.2; }
.ctx-label { font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); }
.ctx-value { font-size: 13px; font-weight: 600; color: var(--text-primary); white-space: nowrap; }

.ctx-divider { width: 1px; height: 22px; background: var(--border-base); }

.header-spacer { flex: 1; }

/* Theme toggle */
.theme-toggle-wrap { display: flex; align-items: center; }

#themeToggle {
  position: relative;
  width: 44px;
  height: 24px;
  border-radius: 24px;
  background: var(--border-base);
  cursor: pointer;
  transition: background 0.3s;
  user-select: none;
}

#toggleKnob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
  transition: transform 0.3s;
  pointer-events: none;
}

/* User pill */
.user-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-input);
  border: 1px solid var(--border-base);
  border-radius: var(--radius-md);
  padding: 0 12px;
  height: 42px;
  cursor: pointer;
  transition: border-color 0.2s;
  position: relative;
}

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

.user-pill-avatar {
  width: 26px;
  height: 26px;
  background: var(--accent);
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  color: #fff;
}

.user-pill-name { font-size: 13px; font-weight: 600; color: var(--text-primary); white-space: nowrap; }
.user-pill-chevron { font-size: 11px; color: var(--text-muted); margin-left: 4px; }

/* Dropdown */
.user-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border-base);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  min-width: 240px;
  padding: 8px;
  z-index: 999;
  display: none;
  animation: fadeDown 0.18s ease;
}

.user-dropdown.open { display: block; }

@keyframes fadeDown {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.dd-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  margin-bottom: 4px;
}

.dd-avatar {
  width: 38px;
  height: 38px;
  background: var(--accent);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
}

.dd-name  { font-size: 13px; font-weight: 700; color: var(--text-primary); }
.dd-role  { font-size: 11px; color: var(--text-muted); }
.dd-badge { display: inline-block; margin-top: 3px; padding: 1px 8px; background: var(--sidebar-active); color: var(--accent); border-radius: 4px; font-size: 10px; font-weight: 700; }

.dd-sep { height: 1px; background: var(--border-base); margin: 4px 0; }

.dd-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
}

.dd-item:hover { background: var(--border-light); color: var(--text-primary); }
.dd-item i { width: 15px; text-align: center; color: var(--text-muted); }

.dd-item.danger:hover { background: rgba(239,68,68,0.08); color: var(--danger); }
.dd-item.danger:hover i { color: var(--danger); }

/* ════════════════════════════════════════════════════════
   PAGE CONTENT
════════════════════════════════════════════════════════ */
.content-wrapper { flex: 1; background: var(--bg-main); }

.content-header {
  padding: 28px 30px 0;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.page-title {
  font-size: 26px;
  font-weight: 900;
  letter-spacing: -0.03em;
  color: var(--text-primary);
}

.page-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.date-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-input);
  border: 1px solid var(--border-base);
  border-radius: var(--radius-md);
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

.date-badge i { color: var(--accent); }

.content { padding: 24px 30px 48px; animation: fadeUp 0.3s ease; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ════════════════════════════════════════════════════════
   KPI GRID
════════════════════════════════════════════════════════ */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.kpi-card {
  border-radius: 18px;
  padding: 24px;
  position: relative;
  overflow: hidden;
  cursor: default;
  transition: transform 0.3s cubic-bezier(0.4,0,0.2,1), box-shadow 0.3s;
  color: #fff;
}

.kpi-card:hover { transform: translateY(-5px); }

.kpi-card.revenue      { background: linear-gradient(135deg, #6366f1, #4f46e5); box-shadow: 0 6px 20px rgba(99,102,241,0.25); }
.kpi-card.transactions { background: linear-gradient(135deg, #0ea5e9, #0284c7); box-shadow: 0 6px 20px rgba(14,165,233,0.25); }
.kpi-card.profit       { background: linear-gradient(135deg, #10b981, #059669); box-shadow: 0 6px 20px rgba(16,185,129,0.25); }
.kpi-card.stock        { background: linear-gradient(135deg, #f43f5e, #e11d48); box-shadow: 0 6px 20px rgba(244,63,94,0.25); }

.kpi-card::before {
  content: '';
  position: absolute;
  top: -30px;
  right: -30px;
  width: 120px;
  height: 120px;
  background: rgba(255,255,255,0.06);
  border-radius: 50%;
}

.kpi-label { font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.1em; color: rgba(255,255,255,0.75); margin-bottom: 10px; }
.kpi-value { font-size: 30px; font-weight: 900; letter-spacing: -0.03em; margin-bottom: 8px; }

.kpi-trend {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.2);
}

.kpi-icon {
  position: absolute;
  bottom: 20px;
  right: 20px;
  font-size: 32px;
  color: rgba(255,255,255,0.15);
}

/* ════════════════════════════════════════════════════════
   ACTION GRID (Shortcuts)
════════════════════════════════════════════════════════ */
.action-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

.action-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-base);
  border-radius: var(--radius-md);
  padding: 18px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4,0,0.2,1);
  text-decoration: none;
}

.action-btn:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--accent);
  background: var(--bg-surface);
}

.action-icon {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: var(--sidebar-active);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: var(--accent);
  transition: transform 0.25s;
}

.action-btn:hover .action-icon { transform: scale(1.12); }

.action-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
  text-align: center;
}

/* ════════════════════════════════════════════════════════
   DASHBOARD LAYOUT
════════════════════════════════════════════════════════ */
.dash-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 20px;
}

.dash-left, .dash-right { min-width: 0; }

/* Panel Box */
.panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-base);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 20px;
  transition: box-shadow 0.2s;
}

.panel:hover { box-shadow: var(--shadow-md); }

.panel-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border-base);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.panel-title {
  font-size: 15px;
  font-weight: 800;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 9px;
}

.panel-title i { font-size: 14px; color: var(--accent); }

.panel-action {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  border: 1px solid var(--border-base);
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 5px;
}

.panel-action:hover { background: var(--sidebar-active); border-color: var(--accent); }

/* Chart wrapper */
.chart-wrap {
  padding: 20px;
  height: 320px;
  position: relative;
}

/* ════════════════════════════════════════════════════════
   TABLE
════════════════════════════════════════════════════════ */
.tbl-wrap {
  display: block;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  box-sizing: border-box;
}

table { width: 100%; border-collapse: collapse; }

thead tr { background: var(--bg-input); }

th {
  padding: 11px 16px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  text-align: left;
  border-bottom: 1px solid var(--border-base);
  white-space: nowrap;
}

td {
  padding: 12px 16px;
  font-size: 13px;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-base);
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--bg-input); }

/* ════════════════════════════════════════════════════════
   RIGHT COLUMN PANELS
════════════════════════════════════════════════════════ */

/* Payment chart */
.payment-donut-wrap {
  height: 200px;
  position: relative;
  margin: 20px auto;
  max-width: 220px;
}

.payment-list {
  padding: 0 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pay-item {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pay-dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex-shrink: 0;
}

.pay-label { font-size: 13px; font-weight: 600; color: var(--text-secondary); flex: 1; }
.pay-pct   { font-size: 12px; font-weight: 700; color: var(--text-muted); }
.pay-bar-track { flex: 1; height: 5px; background: var(--border-base); border-radius: 10px; overflow: hidden; }
.pay-bar-fill  { height: 100%; border-radius: 10px; }

/* Business status panel */
.biz-body { padding: 20px; }

.biz-plan-label { font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; color: var(--accent); margin-bottom: 8px; }
.biz-badge {
  display: inline-block;
  background: linear-gradient(135deg, var(--accent), var(--primary));
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  padding: 5px 14px;
  border-radius: 6px;
  letter-spacing: 0.05em;
  margin-bottom: 20px;
}

.biz-usage { margin-bottom: 14px; }
.biz-usage-row { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-muted); margin-bottom: 5px; }
.biz-usage-val { font-weight: 700; color: var(--text-primary); }

.progress-track { background: var(--border-base); height: 7px; border-radius: 10px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 10px; background: linear-gradient(90deg, var(--accent), var(--primary)); transition: width 0.6s ease; }

.upgrade-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: 100%;
  background: var(--sidebar-active);
  border: 1px solid var(--accent);
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  border-radius: var(--radius-md);
  padding: 11px;
  margin-top: 18px;
  cursor: pointer;
  transition: all 0.2s;
}

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

/* Summary Stats */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  padding: 20px;
}

.stat-item {
  background: var(--bg-input);
  border-radius: var(--radius-md);
  padding: 14px;
}

.stat-item-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); margin-bottom: 6px; }
.stat-item-value { font-size: 20px; font-weight: 900; color: var(--text-primary); letter-spacing: -0.02em; }
.stat-item-sub   { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* ════════════════════════════════════════════════════════
   FOOTER
════════════════════════════════════════════════════════ */
.main-footer {
  background: var(--bg-surface);
  border-top: 1px solid var(--border-base);
  padding: 14px 30px;
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.footer-brand { font-weight: 700; color: var(--accent); }

/* ════════════════════════════════════════════════════════
   TRANSITIONS
════════════════════════════════════════════════════════ */
*,
.main-sidebar,
.panel,
.kpi-card,
.action-btn,
.nav-item,
.user-pill,
.upgrade-btn {
  transition-property: background-color, border-color, box-shadow, color, transform;
  transition-duration: 0.2s;
  transition-timing-function: ease;
}

/* ════════════════════════════════════════════════════════
   RESPONSIVE
════════════════════════════════════════════════════════ */
@media (max-width: 1280px) {
  .action-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 1100px) {
  .dash-layout { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .main-sidebar {
    transform: translateX(-100%);
    box-shadow: var(--shadow-lg);
  }

  .main-sidebar.sidebar-open { transform: translateX(0); }

  #mainWrapper { margin-left: 0 !important; }

  .nav-context-bar {
    display: flex !important;
    overflow: visible !important;
  }
  .nav-context-bar .ctx-item:not(.notification-bell-wrap) {
    display: none !important;
  }
  .nav-context-bar .ctx-divider {
    display: none !important;
  }

  #notifDropdown {
    position: fixed !important;
    top: calc(var(--header-h) + 4px) !important;
    left: 10px !important;
    right: 10px !important;
    width: auto !important;
    max-width: none !important;
    z-index: 9999 !important;
    box-sizing: border-box !important;
  }

  .tbl-wrap th, .tbl-wrap td {
    white-space: nowrap !important;
    padding: 8px 12px !important;
    font-size: 12px !important;
  }

  /* Allow specific text-heavy columns to wrap on mobile/tablet */
  #tenantBody td:nth-child(2),
  #tenantBody td:nth-child(3),
  #orderanBody td:nth-child(2),
  #revenueTableBody td:nth-child(2),
  #expiringTableBody td:nth-child(1) {
    white-space: normal !important;
    min-width: 140px !important;
    word-break: break-word !important;
  }

  .panel-card {
    padding: 16px !important;
  }

  .content-header { padding: 20px 16px 0; }
  .content { padding: 16px 16px 48px; }
  .main-footer { padding: 12px 16px; }

  .kpi-value { font-size: 22px; }
  .kpi-card  { padding: 18px; }
}

@media (max-width: 500px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .action-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .action-icon { width: 38px; height: 38px; font-size: 16px; }
  .action-label { font-size: 10px; }
  .user-pill-name { display: none; }

  .toolbar {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 12px !important;
  }
  .toolbar > div {
    width: 100% !important;
    justify-content: space-between !important;
  }
  .toolbar .search-input-wrap {
    width: 100% !important;
  }
}

/* ── Loading pulse ── */
.loading-pulse {
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ════════════════════════════════════════════════════════
   BISAN DIALOG (Custom Alert & Confirm)
════════════════════════════════════════════════════════ */
.bisan-dialog-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.6); backdrop-filter: blur(4px);
  z-index: 9999; display: none; align-items: center; justify-content: center;
  opacity: 0; transition: opacity 0.3s ease;
}
.bisan-dialog-overlay.active { opacity: 1; }
.bisan-dialog-box {
  background: var(--bg-card); border: 1px solid var(--border-base);
  border-radius: var(--radius-lg); width: 90%; max-width: 400px;
  box-shadow: var(--shadow-lg); overflow: hidden;
  transform: translateY(20px) scale(0.95); opacity: 0; transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.bisan-dialog-overlay.active .bisan-dialog-box {
  transform: translateY(0) scale(1); opacity: 1;
}
.bisan-dialog-header {
  padding: 20px 24px 12px; display: flex; align-items: center; gap: 12px;
  font-size: 18px; font-weight: 800; color: var(--text-primary);
}
.bisan-dialog-header i.fa-circle-question { color: var(--accent); }
.bisan-dialog-header i.fa-circle-info { color: #3b82f6; }
.bisan-dialog-body {
  padding: 0 24px 24px; font-size: 14px; color: var(--text-secondary); line-height: 1.5;
}
.bisan-dialog-footer {
  padding: 16px 24px; background: var(--bg-surface); border-top: 1px solid var(--border-base);
  display: flex; justify-content: flex-end; gap: 12px;
}

/* MODAL PRINT PREVIEW */
#printPreviewModal {
  position: fixed; inset: 0; background: rgba(0,0,0,0.65); backdrop-filter: blur(4px);
  z-index: 9999; display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity 0.25s;
}
#printPreviewModal.active { opacity: 1; pointer-events: auto; }

.ppm-box {
  background: var(--bg-main); border: 1px solid var(--border-base);
  border-radius: var(--radius-lg); width: 100%; max-width: 800px; height: 85vh;
  display: flex; flex-direction: column; overflow: hidden;
  box-shadow: var(--shadow-xl); transform: translateY(20px); transition: transform 0.25s;
}
#printPreviewModal.active .ppm-box { transform: translateY(0); }

.ppm-header {
  padding: 16px 24px; background: var(--bg-card); border-bottom: 1px solid var(--border-base);
  display: flex; justify-content: space-between; align-items: center;
}
.ppm-header h2 { font-size: 18px; font-weight: 800; display: flex; align-items: center; gap: 10px; margin: 0; }
.ppm-close { background: none; border: none; font-size: 20px; color: var(--text-muted); cursor: pointer; }

.ppm-body {
  flex: 1; display: grid; grid-template-columns: 300px 1fr; overflow: hidden;
}

@media (max-width: 768px) {
  .ppm-body { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
}

.ppm-sidebar {
  background: var(--bg-card); border-right: 1px solid var(--border-base);
  padding: 24px; display: flex; flex-direction: column; gap: 20px; overflow-y: auto;
}
.ppm-preview-area {
  background: var(--sidebar-active); display: flex; align-items: flex-start; justify-content: center;
  padding: 30px; overflow-y: auto;
}

.ppm-receipt-container {
  background: white; color: black; padding: 15px; margin: 0 auto;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  font-family: 'JetBrains Mono', monospace, sans-serif;
  font-size: 12px; line-height: 1.4;
  /* Lebar dinamis via JS (width 100%, max-width berubah) */
  width: 100%;
}
.ppm-receipt-container.size-58 { max-width: 219px; /* setara 58mm pada layar */ }
.ppm-receipt-container.size-80 { max-width: 302px; /* setara 80mm pada layar */ }

.ppm-group { display: flex; flex-direction: column; gap: 8px; }
.ppm-label { font-size: 12px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; }

.ppm-radio-label {
  display: flex; align-items: center; gap: 10px; padding: 12px;
  background: var(--bg-input); border: 1px solid var(--border-base);
  border-radius: var(--radius-md); cursor: pointer; transition: all 0.2s;
}
.ppm-radio-label:hover { border-color: var(--accent); }
.ppm-radio-label input[type="radio"] { margin: 0; accent-color: var(--accent); cursor: pointer; }
.ppm-radio-text { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.ppm-radio-desc { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

.ppm-footer {
  padding: 16px 24px; border-top: 1px solid var(--border-base); background: var(--bg-card);
  display: flex; justify-content: flex-end; gap: 12px;
}
.ppm-btn-cancel { padding: 10px 20px; background: transparent; border: 1px solid var(--border-base); color: var(--text-secondary); border-radius: var(--radius-md); font-weight: 700; cursor: pointer; }
.ppm-btn-print { padding: 10px 20px; background: var(--accent); border: none; color: white; border-radius: var(--radius-md); font-weight: 700; cursor: pointer; display: flex; align-items: center; gap: 8px; }

/* Screen Preview support for receipt formatting */
.ppm-receipt-container .print-header { text-align: center; margin-bottom: 10px; }
.ppm-receipt-container .print-header h2 { margin: 0; font-size: 15px; font-family: 'Inter', sans-serif; }
.ppm-receipt-container .print-header p { margin: 2px 0; font-size: 11px; }
.ppm-receipt-container .print-divider { border-bottom: 1px dashed #000; margin: 8px 0; }
.ppm-receipt-container .print-item { clear: both; overflow: hidden; margin-bottom: 4px; font-size: 11px; }
.ppm-receipt-container .print-item-name { width: 100%; font-weight: bold; font-size: 12px; margin-bottom: 2px; text-align: left; }
.ppm-receipt-container .print-item-details { clear: both; overflow: hidden; font-size: 11px; padding-left: 10px; }
.ppm-receipt-container .print-item-details span:first-child { float: left; }
.ppm-receipt-container .print-item-details span:last-child { float: right; text-align: right; }
.ppm-receipt-container .print-total { clear: both; overflow: hidden; font-weight: bold; font-size: 12px; margin-top: 5px; }
.ppm-receipt-container .print-total span:first-child { float: left; }
.ppm-receipt-container .print-total span:last-child { float: right; text-align: right; }
.ppm-receipt-container .print-footer { text-align: center; margin-top: 15px; font-size: 11px; font-style: italic; }

/* ── COLLAPSED STATE ON DESKTOP ── */
@media (min-width: 768px) {
  /* Set width of collapsed sidebar */
  .main-sidebar.sidebar-collapsed {
    width: 70px;
    transform: none; /* Override translateX(-100%) */
  }

  /* Set margin of main wrapper when sidebar is collapsed */
  #mainWrapper.sidebar-collapsed {
    margin-left: 70px;
  }

  /* Hide logo text, only show centered logo mark */
  .main-sidebar.sidebar-collapsed .sidebar-logo {
    justify-content: center;
    padding: 18px 0 30px 0;
    height: auto;
  }
  .main-sidebar.sidebar-collapsed .logo-text {
    display: none;
  }

  /* Hide store info, only show centered store icon */
  .main-sidebar.sidebar-collapsed .sidebar-store {
    margin: 16px 8px;
    padding: 8px;
    justify-content: center;
  }
  .main-sidebar.sidebar-collapsed .store-info {
    display: none;
  }

  /* Hide section labels */
  .main-sidebar.sidebar-collapsed .nav-section-label {
    display: none;
  }

  /* Center nav item icons and hide labels/badges */
  .main-sidebar.sidebar-collapsed .nav-item {
    justify-content: center;
    padding: 12px;
  }
  .main-sidebar.sidebar-collapsed .nav-item span,
  .main-sidebar.sidebar-collapsed .nav-item .nav-badge {
    display: none;
  }
  .main-sidebar.sidebar-collapsed .nav-item i {
    margin: 0;
    font-size: 16px;
  }

  /* Hide user details and logout button in footer, show centered avatar */
  .main-sidebar.sidebar-collapsed .sidebar-footer {
    justify-content: center;
    padding: 14px 8px;
  }
  .main-sidebar.sidebar-collapsed .user-info,
  .main-sidebar.sidebar-collapsed .sidebar-logout {
    display: none;
  }
}

/* ── Responsive Toast Notifications ── */
#bisan-toast-container {
  position: fixed;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

/* Desktop Style */
@media (min-width: 769px) {
  #bisan-toast-container {
    bottom: 20px;
    right: 20px;
    width: 350px;
  }
}

/* Mobile Style */
@media (max-width: 768px) {
  #bisan-toast-container {
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
  }
}

.bisan-toast {
  background: var(--bg-surface);
  border: 1px solid var(--border-base);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 14px 16px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  pointer-events: auto;
  animation: bisanSlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  transition: all 0.3s ease;
}

.bisan-toast.success-toast {
  border-left: 4px solid var(--success);
}

.bisan-toast.info-toast {
  border-left: 4px solid var(--info);
}

.bisan-toast.warning-toast {
  border-left: 4px solid var(--warning);
}

.bisan-toast-icon {
  font-size: 18px;
  margin-top: 2px;
}

.bisan-toast-content {
  flex: 1;
}

.bisan-toast-title {
  font-weight: 800;
  font-size: 13px;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.bisan-toast-desc {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.bisan-toast-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.bisan-toast-close:hover {
  color: var(--text-primary);
}

/* Keyframes */
@keyframes bisanSlideIn {
  from {
    transform: translateY(100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@media (max-width: 768px) {
  @keyframes bisanSlideIn {
    from {
      transform: translateY(-100%);
      opacity: 0;
    }
    to {
      transform: translateY(0);
      opacity: 1;
    }
  }
  
  .bisan-toast {
    border-radius: 0;
    border-left: none;
    border-bottom: 3px solid var(--accent);
  }
  
  .bisan-toast.success-toast { border-bottom: 3px solid var(--success); }
  .bisan-toast.info-toast { border-bottom: 3px solid var(--info); }
  .bisan-toast.warning-toast { border-bottom: 3px solid var(--warning); }
}

/* ════════════════════════════════════════════════════════
   TOAST NOTIFICATION (Bisan POS)
════════════════════════════════════════════════════════ */
.bisan-toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.bisan-toast {
  background: #2a2f32; /* WhatsApp Web dark style */
  border-radius: 8px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.3);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 300px;
  max-width: 400px;
  pointer-events: auto;
  animation: toastFadeIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  position: relative;
  overflow: hidden;
  border-left: 4px solid var(--accent);
}

.bisan-toast.toast-hiding {
  animation: toastFadeOut 0.3s ease forwards;
}

.bisan-toast-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: #111b21;
}

.bisan-toast-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
}

.bisan-toast-title {
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  margin: 0;
  line-height: 1.2;
}

.bisan-toast-message {
  font-size: 13px;
  color: #fff; /* Changed to white */
  margin: 0;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.bisan-toast-close {
  background: none;
  border: none;
  color: #8696a0;
  font-size: 20px;
  cursor: pointer;
  padding: 0;
  position: absolute;
  top: 8px;
  right: 12px;
  line-height: 1;
  transition: color 0.2s;
}

.bisan-toast-close:hover {
  color: #fff;
}

@keyframes toastFadeIn {
  from { opacity: 0; transform: translateY(30px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes toastFadeOut {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(50px); }
}

