/* ==========================================================================
   B2B API USER PANEL TEMPLATE - PROFESSIONAL LIGHT THEME DESIGN SYSTEM
   ========================================================================== */

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

/* Default Theme: Professional B2B Enterprise Light Theme */
:root {
  /* Core B2B Light Palette */
  --bg-main: #f8fafc;
  --bg-surface: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #f1f5f9;
  --bg-sidebar: #0f172a;
  /* Sharp B2B contrast slate sidebar */
  --bg-header: #ffffff;

  /* Borders & Dividers */
  --border-color: #e2e8f0;
  --border-subtle: #f1f5f9;
  --border-focus: #2563eb;

  /* Brand & Accents */
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: rgba(37, 99, 235, 0.08);
  --teal-accent: #0d9488;
  --teal-light: rgba(13, 148, 136, 0.1);

  /* Status Colors */
  --success: #059669;
  --success-bg: rgba(16, 185, 129, 0.12);
  --warning: #d97706;
  --warning-bg: rgba(245, 158, 11, 0.12);
  --danger: #dc2626;
  --danger-bg: rgba(239, 68, 68, 0.12);
  --info: #0284c7;
  --info-bg: rgba(2, 132, 199, 0.12);

  /* Method Colors */
  --method-get: #059669;
  --method-get-bg: rgba(16, 185, 129, 0.12);
  --method-post: #2563eb;
  --method-post-bg: rgba(37, 99, 235, 0.12);
  --method-put: #d97706;
  --method-put-bg: rgba(245, 158, 11, 0.12);
  --method-delete: #dc2626;
  --method-delete-bg: rgba(239, 68, 68, 0.12);

  /* Typography */
  --text-main: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', Consolas, Monaco, monospace;

  /* Elevation & Effects */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;

  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
}

/* Optional Dark Mode Override (via data-theme="dark") */
[data-theme="dark"] {
  --bg-main: #0b0f19;
  --bg-surface: #111827;
  --bg-card: #1f2937;
  --bg-card-hover: #2d3748;
  --bg-sidebar: #0f172a;
  --bg-header: #111827;
  --border-color: #374151;
  --border-subtle: #1f2937;
  --border-focus: #3b82f6;
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --primary-light: rgba(59, 130, 246, 0.12);
  --text-main: #f9fafb;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
}

/* Base Reset */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
  font-family: var(--font-sans);
  background-color: var(--bg-main);
  color: var(--text-main);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg-main);
}

::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ==========================================================================
   PAGE PRELOADER / LOADER OVERLAY
   ========================================================================== */
.page-loader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: var(--bg-main);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  transition: opacity 0.35s ease, visibility 0.35s ease;
  opacity: 1;
  visibility: visible;
}

.page-loader.fade-out {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.spinner-container {
  position: relative;
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.spinner {
  width: 56px;
  height: 56px;
  border: 3px solid var(--border-color);
  border-top-color: var(--primary);
  border-right-color: var(--teal-accent);
  border-radius: 50%;
  animation: spin 0.8s cubic-bezier(0.55, 0.15, 0.45, 0.85) infinite;
}

.loader-logo {
  position: absolute;
  font-weight: 800;
  font-size: 11px;
  color: var(--primary);
  letter-spacing: 0.5px;
}

.loader-text {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.2px;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

/* Layout Architecture */
.app-container {
  display: flex;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

/* Sidebar */
.sidebar {
  width: 260px;
  height: 100vh;
  max-height: 100vh;
  position: sticky;
  top: 0;
  background-color: var(--bg-sidebar);
  border-right: 1px solid #1e293b;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  z-index: 20;
  overflow: visible;
  transition: width var(--transition-normal), transform var(--transition-normal);
}

.sidebar-header {
  padding: 20px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid #1e293b;
  position: relative;
}

.sidebar-brand-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
  overflow: hidden;
}

.brand-logo {
  width: 34px;
  height: 34px;
  background: linear-gradient(135deg, var(--primary), var(--teal-accent));
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 16px;
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}

.brand-info {
  display: flex;
  flex-direction: column;
  white-space: nowrap;
  transition: opacity var(--transition-fast);
}

.brand-title {
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.2px;
  color: #f8fafc;
}

.brand-subtitle {
  font-size: 11px;
  color: #38bdf8;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Sidebar Collapse Toggle Button */
.sidebar-collapse-btn {
  background: #1e293b;
  border: 1px solid #334155;
  color: #94a3b8;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.sidebar-collapse-btn:hover {
  background: #334155;
  color: #f8fafc;
}

.sidebar-collapse-btn svg {
  transition: transform var(--transition-normal);
}

/* Merchant Info Widget in Sidebar */
.merchant-profile {
  margin: 16px;
  padding: 12px 14px;
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid #334155;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  gap: 12px;
  overflow: hidden;
  transition: all var(--transition-fast);
}

.merchant-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #334155;
  color: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 13px;
  border: 1px solid #475569;
  flex-shrink: 0;
}

.merchant-details {
  overflow: hidden;
  white-space: nowrap;
}

.merchant-name {
  font-weight: 600;
  font-size: 13px;
  color: #f8fafc;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.merchant-id {
  font-size: 11px;
  font-family: var(--font-mono);
  color: #94a3b8;
}

/* Navigation Links */
.sidebar-nav {
  flex: 1;
  min-height: 0;
  padding: 16px 12px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar-nav::-webkit-scrollbar {
  width: 4px;
}

.sidebar-nav::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar-nav::-webkit-scrollbar-thumb {
  background: #334155;
  border-radius: 4px;
}

.sidebar-nav::-webkit-scrollbar-thumb:hover {
  background: #475569;
}

.nav-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: #38bdf8;
  padding: 16px 12px 6px 12px;
  line-height: 1.4;
  white-space: nowrap;
  user-select: none;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  color: #94a3b8;
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-weight: 500;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  border-left: 3px solid transparent;
  transition: all var(--transition-fast);
}

.nav-item:hover {
  background: #1e293b;
  color: #f8fafc;
}

.nav-item:hover svg {
  color: #60a5fa;
}

.nav-item.active {
  background: rgba(37, 99, 235, 0.15);
  color: #60a5fa;
  border-left-color: #3b82f6;
  font-weight: 600;
}

.nav-item.active svg {
  color: #3b82f6;
}

.nav-item svg {
  width: 18px;
  height: 18px;
  stroke-width: 2;
  flex-shrink: 0;
  transition: color var(--transition-fast), transform var(--transition-fast);
}

.sidebar-footer {
  padding: 16px 12px;
  border-top: 1px solid #1e293b;
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: auto;
}

/* ==========================================================================
   COLLAPSED SIDEBAR STATE (ICONS ONLY) - ZERO FLASH ON REFRESH
   ========================================================================== */
html.sidebar-collapsed .sidebar,
.sidebar.collapsed {
  width: 72px !important;
}

html.sidebar-collapsed .sidebar {
  transition: none !important;
  /* Prevent expansion animation on initial frame */
}

html.sidebar-collapsed .sidebar .brand-info,
html.sidebar-collapsed .sidebar .merchant-details,
html.sidebar-collapsed .sidebar .nav-section-title,
html.sidebar-collapsed .sidebar .nav-text,
.sidebar.collapsed .brand-info,
.sidebar.collapsed .merchant-details,
.sidebar.collapsed .nav-section-title,
.sidebar.collapsed .nav-text {
  display: none !important;
}

html.sidebar-collapsed .sidebar .sidebar-header,
.sidebar.collapsed .sidebar-header {
  padding: 16px 8px;
  justify-content: center;
}

html.sidebar-collapsed .sidebar .sidebar-brand-wrapper,
.sidebar.collapsed .sidebar-brand-wrapper {
  gap: 0;
}

html.sidebar-collapsed .sidebar .sidebar-collapse-btn,
.sidebar.collapsed .sidebar-collapse-btn {
  position: absolute;
  right: -13px;
  top: 24px;
  box-shadow: var(--shadow-md);
  z-index: 100;
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

html.sidebar-collapsed .sidebar .sidebar-collapse-btn svg,
.sidebar.collapsed .sidebar-collapse-btn svg {
  transform: rotate(180deg);
}

html.sidebar-collapsed .sidebar .merchant-profile,
.sidebar.collapsed .merchant-profile {
  margin: 12px 8px;
  padding: 8px 0;
  justify-content: center;
  background: rgba(30, 41, 59, 0.5);
}

html.sidebar-collapsed .sidebar .sidebar-nav,
.sidebar.collapsed .sidebar-nav {
  padding: 12px 8px;
  gap: 6px;
  align-items: center;
}

html.sidebar-collapsed .sidebar .nav-item,
.sidebar.collapsed .nav-item {
  justify-content: center;
  padding: 10px 0;
  width: 100%;
  border-left: none !important;
  border-radius: var(--radius-sm);
  gap: 0;
}

html.sidebar-collapsed .sidebar .nav-item.active,
.sidebar.collapsed .nav-item.active {
  background: rgba(37, 99, 235, 0.25) !important;
  color: #60a5fa !important;
  box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.2);
}

html.sidebar-collapsed .sidebar .sidebar-footer,
.sidebar.collapsed .sidebar-footer {
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
  justify-content: center;
}

/* Main Content Area */
.main-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background-color: var(--bg-main);
}

/* Top Header Bar */
.header {
  height: 64px;
  background-color: var(--bg-header);
  border-bottom: 1px solid var(--border-color);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  z-index: 10;
  box-shadow: var(--shadow-sm);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 6px;
}


/* Quick API Key Pill */
.api-key-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-secondary);
}

.api-key-text {
  color: var(--text-main);
  font-weight: 600;
}

.copy-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  padding: 2px;
  border-radius: 4px;
}

.copy-btn:hover {
  color: var(--primary);
}

/* Header Right Options */
.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.wallet-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px;
  background: rgba(13, 148, 136, 0.08);
  border: 1px solid rgba(13, 148, 136, 0.25);
  border-radius: var(--radius-md);
}

.wallet-label {
  font-size: 11px;
  color: var(--teal-accent);
  font-weight: 700;
  text-transform: uppercase;
}

.wallet-amount {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 14px;
  color: var(--text-main);
}

/* Hide theme toggle button for now */
#themeToggleBtn {
  display: none !important;
}

.icon-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  transition: all var(--transition-fast);
}

.icon-btn:hover {
  background: var(--bg-card-hover);
  color: var(--text-main);
  border-color: var(--border-focus);
}

.notification-dot {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 8px;
  height: 8px;
  background: var(--primary);
  border-radius: 50%;
}

/* Main Scrollable View Area */
.content-area {
  flex: 1;
  overflow-y: auto;
  padding: 28px 32px;
}

/* App Page Footer & Copyright */
.app-footer {
  margin-top: auto;
  padding: 16px 32px;
  background-color: var(--bg-surface);
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  font-size: 12px;
  color: var(--text-secondary);
  flex-wrap: wrap;
  flex-shrink: 0;
}

.footer-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.footer-left span {
  color: var(--text-muted);
  font-weight: 500;
}

.footer-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.footer-right a {
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  transition: color var(--transition-fast);
}

.footer-right a:hover {
  color: var(--primary);
}

.footer-divider {
  color: var(--border-color);
}

.view-section {
  display: block;
  animation: fadeIn var(--transition-normal);
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ============================================================
   MARQUEE ALERT BAR
   ============================================================ */
.marquee-alert {
  width: 100%;
  background: linear-gradient(90deg, #1e3a8a 0%, #1d4ed8 50%, #1e3a8a 100%);
  color: #e0edff;
  font-size: 12.5px;
  font-weight: 500;
  display: flex;
  align-items: center;
  overflow: hidden;
  position: relative;
  height: 36px;
  flex-shrink: 0;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  z-index: 10;
}

.marquee-alert.alert-warning {
  background: linear-gradient(90deg, #78350f 0%, #d97706 50%, #78350f 100%);
  color: #fef3c7;
  border-bottom-color: rgba(255,255,255,0.1);
}

.marquee-alert.alert-danger {
  background: linear-gradient(90deg, #7f1d1d 0%, #dc2626 50%, #7f1d1d 100%);
  color: #fee2e2;
  border-bottom-color: rgba(255,255,255,0.1);
}

.marquee-alert.alert-success {
  background: linear-gradient(90deg, #064e3b 0%, #059669 50%, #064e3b 100%);
  color: #d1fae5;
  border-bottom-color: rgba(255,255,255,0.1);
}

.marquee-alert-badge {
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.15);
  border-right: 1px solid rgba(255, 255, 255, 0.12);
  padding: 0 14px;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  white-space: nowrap;
}

.marquee-alert-track {
  flex: 1;
  overflow: hidden;
  height: 100%;
  display: flex;
  align-items: center;
  position: relative;
  mask-image: linear-gradient(to right, transparent 0%, black 3%, black 97%, transparent 100%);
  -webkit-mask-image: linear-gradient(to right, transparent 0%, black 3%, black 97%, transparent 100%);
}

.marquee-alert-content {
  display: flex;
  gap: 64px;
  white-space: nowrap;
  animation: marqueeScroll 40s linear infinite;
  will-change: transform;
}

.marquee-alert-content:hover { animation-play-state: paused; }

.marquee-alert-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  opacity: 0.92;
}

.marquee-alert-item span { opacity: 0.5; font-size: 14px; }


@keyframes marqueeScroll {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

/* Section Page Header */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.page-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.3px;
}

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

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Cards & Grid Utilities */
.card-grid-4 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.card-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 24px;
}

.metric-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: all var(--transition-fast);
}

.metric-card:hover {
  border-color: #cbd5e1;
  box-shadow: var(--shadow-md);
}

.metric-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.metric-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.metric-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-main);
  color: var(--primary);
  border: 1px solid var(--border-color);
}

.metric-value {
  font-size: 26px;
  font-weight: 700;
  color: var(--text-main);
  font-family: var(--font-sans);
  letter-spacing: -0.5px;
}

.metric-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}

.trend-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 11px;
}

.trend-badge.up {
  color: var(--success);
  background: var(--success-bg);
}

.trend-badge.down {
  color: var(--danger);
  background: var(--danger-bg);
}

.trend-text {
  color: var(--text-muted);
}

/* Panels */
.panel-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  margin-bottom: 24px;
  overflow: hidden;
}

.panel-header {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f8fafc;
}

.panel-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
}

.panel-body {
  padding: 24px;
}

/* Filter Card Layout */
.filter-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}

.filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  align-items: end;
}

/* QUICK DATE PRESETS PILLS */
.date-presets-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.date-presets-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  margin-right: 4px;
}

.date-preset-btn {
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  padding: 5px 14px;
  border-radius: 20px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.date-preset-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
}

.date-preset-btn.active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
}

/* Form Controls & Buttons */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
}

.form-control,
.form-select {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 13px;
  width: 100%;
  outline: none;
  transition: all var(--transition-fast);
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.btn-primary {
  background-color: var(--primary);
  color: #fff;
  box-shadow: var(--shadow-sm);
}

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

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

.btn-secondary:hover {
  background-color: var(--bg-card-hover);
  border-color: #cbd5e1;
}

.btn-outline {
  background-color: transparent;
  border-color: var(--border-color);
  color: var(--text-secondary);
}

.btn-outline:hover {
  background-color: var(--bg-main);
  color: var(--text-main);
  border-color: #cbd5e1;
}

.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
}

/* Data Tables Base */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  padding: 16px;
}

.b2b-table {
  width: 100% !important;
  border-collapse: collapse;
  text-align: left;
  font-size: 13px;
}

.b2b-table th {
  background-color: #f1f5f9;
  color: var(--text-secondary);
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.b2b-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-main);
  vertical-align: middle;
}

.b2b-table tbody tr:hover {
  background-color: #f8fafc;
}

.font-mono {
  font-family: var(--font-mono);
  font-size: 12px;
}

/* ==========================================================================
   JQUERY DATATABLES STYLING OVERRIDES
   ========================================================================== */
.dataTables_wrapper {
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 13px;
}

.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter,
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate {
  color: var(--text-secondary) !important;
  margin-bottom: 12px;
}

.dataTables_wrapper .dataTables_filter input {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  color: var(--text-main);
  margin-left: 8px;
  outline: none;
}

.dataTables_wrapper .dataTables_length select {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  color: var(--text-main);
  margin: 0 4px;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
  border: 1px solid var(--border-color) !important;
  border-radius: var(--radius-sm) !important;
  background: var(--bg-surface) !important;
  color: var(--text-main) !important;
  padding: 4px 10px !important;
  margin: 0 2px !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
  background: var(--primary) !important;
  color: #ffffff !important;
  border-color: var(--primary) !important;
  font-weight: 600;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
  background: var(--bg-card-hover) !important;
  color: var(--primary) !important;
}

table.dataTable thead .sorting,
table.dataTable thead .sorting_asc,
table.dataTable thead .sorting_desc {
  cursor: pointer;
  position: relative;
}

/* Badges & Pills */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.badge-success {
  background: var(--success-bg);
  color: var(--success);
}

.badge-warning {
  background: var(--warning-bg);
  color: var(--warning);
}

.badge-danger {
  background: var(--danger-bg);
  color: var(--danger);
}

.badge-info {
  background: var(--info-bg);
  color: var(--info);
}

.method-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 11px;
  text-align: center;
  width: 60px;
}

.method-get {
  background: var(--method-get-bg);
  color: var(--method-get);
}

.method-post {
  background: var(--method-post-bg);
  color: var(--method-post);
}

.method-put {
  background: var(--method-put-bg);
  color: var(--method-put);
}

.method-delete {
  background: var(--method-delete-bg);
  color: var(--method-delete);
}

.status-code {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 12px;
}

.status-2xx {
  color: var(--success);
}

.status-4xx {
  color: var(--warning);
}

.status-5xx {
  color: var(--danger);
}

/* Dashboard Chart Container */
.chart-container {
  position: relative;
  width: 100%;
  height: 260px;
}

/* Payload Modal / Drawer */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
}

.modal-backdrop.show {
  opacity: 1;
  pointer-events: auto;
}

.modal-dialog {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 750px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

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

.modal-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px;
  display: flex;
}

.modal-close:hover {
  color: var(--text-main);
}

.modal-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-main);
  padding: 0 16px;
}

.modal-tab-btn {
  padding: 12px 18px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
}

.modal-tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 700;
}

.modal-body {
  padding: 20px 24px;
  overflow-y: auto;
  flex: 1;
}

.json-box {
  background: #0f172a;
  border: 1px solid #1e293b;
  border-radius: var(--radius-sm);
  padding: 16px;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.6;
  color: #38bdf8;
  overflow-x: auto;
}

/* AUTHENTICATION VIEW STYLES */
.auth-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  width: 100vw;
  background: radial-gradient(circle at top right, rgba(37, 99, 235, 0.08), transparent 40%),
    radial-gradient(circle at bottom left, rgba(13, 148, 136, 0.08), transparent 40%),
    var(--bg-main);
  padding: 20px;
}

.auth-card {
  width: 100%;
  max-width: 440px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 36px 32px;
}

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

.auth-logo {
  width: 48px;
  height: 48px;
  margin: 0 auto 16px auto;
  background: linear-gradient(135deg, var(--primary), var(--teal-accent));
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 22px;
  font-weight: 700;
  box-shadow: var(--shadow-md);
}

.auth-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-main);
}

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

.auth-nav {
  display: flex;
  background: var(--bg-main);
  padding: 4px;
  border-radius: var(--radius-sm);
  margin-bottom: 24px;
  border: 1px solid var(--border-color);
}

.auth-nav-btn {
  flex: 1;
  padding: 8px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 13px;
  border-radius: 4px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.auth-nav-btn.active {
  background: var(--bg-surface);
  color: var(--text-main);
  box-shadow: var(--shadow-sm);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.security-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 24px;
  font-size: 11px;
  color: var(--text-muted);
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--primary);
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-lg);
  animation: slideInRight 0.3s ease;
}

@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }

  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* Mobile Sidebar Backdrop Overlay */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1040;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.sidebar-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

body.sidebar-open {
  overflow: hidden !important;
}

/* Mobile Sidebar Close Button */
.mobile-sidebar-close {
  display: none;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #94a3b8;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.mobile-sidebar-close:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

/* Responsive adjustments */
@media (max-width: 1024px) {
  /* Sidebar Drawer on Mobile & Tablet */
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    height: 100dvh;
    width: 280px !important;
    z-index: 1050;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.3);
  }

  .sidebar.show {
    transform: translateX(0) !important;
  }

  /* Reset collapsed state styles on mobile drawer */
  html.sidebar-collapsed .sidebar,
  .sidebar.collapsed {
    width: 280px !important;
  }

  html.sidebar-collapsed .sidebar .brand-info,
  html.sidebar-collapsed .sidebar .merchant-details,
  html.sidebar-collapsed .sidebar .nav-section-title,
  html.sidebar-collapsed .sidebar .nav-text,
  .sidebar.collapsed .brand-info,
  .sidebar.collapsed .merchant-details,
  .sidebar.collapsed .nav-section-title,
  .sidebar.collapsed .nav-text {
    display: block !important;
  }

  html.sidebar-collapsed .sidebar .sidebar-header,
  .sidebar.collapsed .sidebar-header {
    padding: 20px 24px !important;
    justify-content: space-between !important;
  }

  html.sidebar-collapsed .sidebar .sidebar-brand-wrapper,
  .sidebar.collapsed .sidebar-brand-wrapper {
    gap: 12px !important;
  }

  html.sidebar-collapsed .sidebar .nav-item,
  .sidebar.collapsed .nav-item {
    justify-content: flex-start !important;
    padding: 10px 14px !important;
    gap: 12px !important;
  }

  html.sidebar-collapsed .sidebar .sidebar-footer,
  .sidebar.collapsed .sidebar-footer {
    display: flex !important;
    flex-direction: column !important;
    gap: 4px !important;
    padding: 16px 12px !important;
  }

  /* Toggle desktop collapse button vs mobile close button */
  .sidebar-collapse-btn {
    display: none !important;
  }

  .mobile-sidebar-close {
    display: flex !important;
  }

  /* Mobile Top Bar Header */
  .header {
    padding: 0 16px;
    height: 60px;
  }

  .mobile-menu-btn {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-surface);
    color: var(--text-main);
    transition: all var(--transition-fast);
    flex-shrink: 0;
  }

  .mobile-menu-btn:hover {
    background: var(--bg-card-hover);
    border-color: #cbd5e1;
  }

  .content-area {
    padding: 20px 16px;
  }
}

@media (max-width: 768px) {
  .header {
    padding: 0 12px;
    gap: 8px;
  }

  .header-left {
    gap: 8px;
  }

  .header-right {
    gap: 8px;
  }

  .api-key-pill {
    padding: 4px 8px;
    gap: 4px;
    font-size: 11px;
  }

  .api-key-pill > span:first-child {
    display: none; /* Hide 'API KEY:' label text on mobile */
  }

  .api-key-text {
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-block;
  }

  .wallet-badge {
    padding: 4px 8px;
    gap: 6px;
  }

  .wallet-label {
    display: none; /* Hide 'Prepaid Credit' label text on mobile */
  }

  .wallet-amount {
    font-size: 12px;
  }

  .wallet-badge .btn-sm {
    padding: 3px 8px;
    font-size: 11px;
    height: 26px;
    line-height: 1;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .page-title {
    font-size: 18px;
  }

  .card-grid-4,
  .card-grid-3 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .header {
    padding: 0 10px;
  }

  .api-key-text {
    max-width: 70px;
  }

  .marquee-alert-badge {
    padding: 0 8px;
    font-size: 9px;
  }
}