/* ==========================================================================
   BCA PAYMENT GATEWAY — COMPACT ENTERPRISE DESIGN SYSTEM
   High-Density Dark Navy Slate (#0c1322), Hairline Borders (#1e293b) & BCA Blue
   ========================================================================== */

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

:root {
  /* Surface & Background Hierarchy */
  --bg-canvas: #060a14;
  --bg-primary: #060a14;
  --bg-subtle: #090e1a;
  --bg-surface: #0c1322;
  --bg-secondary: #0c1322;
  --bg-surface-elevated: #10192d;
  --bg-glass: rgba(12, 19, 34, 0.92);
  --bg-glass-card: #0c1322;
  --card-bg: #0c1322;
  --card-border: #1e293b;

  /* BCA Corporate FinTech Accent Palette */
  --bca-blue: #2563eb;
  --bca-primary: #2563eb;
  --bca-blue-hover: #1d4ed8;
  --bca-blue-light: #3b82f6;
  --accent-color: #2563eb;
  --accent-hover: #1d4ed8;
  --bca-blue-glow: rgba(37, 99, 235, 0.25);
  --accent-glow: rgba(37, 99, 235, 0.25);
  --bca-cyan: #38bdf8;
  --bca-cyan-glow: rgba(56, 189, 248, 0.22);

  /* Semantic Status Tokens */
  --success: #10b981;
  --success-bg: rgba(16, 185, 129, 0.12);
  --success-border: rgba(16, 185, 129, 0.3);

  --warning: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.12);
  --warning-border: rgba(245, 158, 11, 0.3);

  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.12);
  --danger-border: rgba(239, 68, 68, 0.3);

  /* Typography Colors */
  --text-main: #f1f5f9;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-placeholder: #475569;

  /* Crisp Hairline Borders */
  --border-subtle: #1e293b;
  --border-strong: #334155;
  --border-active: #38bdf8;

  /* Elevation Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.45);
  --shadow-md: 0 4px 12px -2px rgba(0, 0, 0, 0.55);
  --shadow-lg: 0 12px 32px -4px rgba(0, 0, 0, 0.75);
  --shadow-glow-blue: 0 0 18px -3px rgba(37, 99, 235, 0.35);

  /* Typography Stacks */
  --font-display: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', ui-monospace, monospace;

  /* Transitions & Radii (Sharp Enterprise Feel) */
  --transition-fast: 0.14s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --radius-sm: 5px;
  --radius-md: 7px;
  --radius-lg: 10px;
  --radius-xl: 12px;
  --radius-full: 9999px;

  /* Layout Dimensions */
  --mobile-header-height: 52px;
  --sidebar-width: 240px;
  --sidebar-collapsed-width: 64px;
}

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

html {
  font-size: 13px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  background-color: var(--bg-canvas);
  background-image:
    radial-gradient(ellipse 60% 40% at 15% 0%, rgba(37, 99, 235, 0.12) 0%, transparent 70%),
    radial-gradient(ellipse 50% 40% at 85% 100%, rgba(56, 189, 248, 0.06) 0%, transparent 70%);
  background-attachment: fixed;
  color: var(--text-main);
  font-family: var(--font-body);
  font-size: 13px;
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.02em;
  color: #ffffff;
}

h1 { font-size: 20px; line-height: 1.25; }
h2 { font-size: 17px; line-height: 1.3; }
h3 { font-size: 14.5px; line-height: 1.35; }
h4 { font-size: 13px; line-height: 1.4; }

:focus-visible {
  outline: 2px solid var(--bca-cyan);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Custom Thin Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: #1e293b;
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: #334155;
}

.body-scroll-locked {
  overflow: hidden !important;
  touch-action: none;
}

.spinner-inline {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Preset Amount Chips */
.preset-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.preset-chip {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 3px 10px;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition-fast);
  user-select: none;
}

.preset-chip:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border-color: var(--border-strong);
}

.preset-chip.active {
  background: rgba(37, 99, 235, 0.2);
  color: var(--bca-cyan);
  border-color: var(--bca-blue);
}

/* ==========================================================================
   Enterprise Surface Cards & Panels
   ========================================================================== */
.glass-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.glass-panel:hover {
  border-color: var(--border-strong);
}

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

.tabular-nums {
  font-variant-numeric: tabular-nums;
}

/* ==========================================================================
   Compact Enterprise Buttons (Height ~34px-36px)
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  min-height: 34px;
  padding: 0 13px;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--transition-fast);
  text-decoration: none;
  user-select: none;
  white-space: nowrap;
}

.btn:active:not(:disabled) {
  transform: translateY(0.5px);
}

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

.btn-primary {
  background: var(--bca-blue);
  border-color: var(--bca-blue-light);
  color: #ffffff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.btn-primary:hover:not(:disabled) {
  background: var(--bca-blue-hover);
  box-shadow: var(--shadow-glow-blue);
  color: #ffffff;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--border-subtle);
  color: var(--text-main);
}

.btn-secondary:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--border-strong);
  color: #ffffff;
}

.btn-danger {
  background: var(--danger-bg);
  color: #f87171;
  border-color: var(--danger-border);
}

.btn-danger:hover:not(:disabled) {
  background: #dc2626;
  border-color: #dc2626;
  color: #ffffff;
}

.btn-danger-solid {
  background: #dc2626;
  color: #ffffff;
  border-color: #ef4444;
}

.btn-danger-solid:hover:not(:disabled) {
  background: #b91c1c;
}

.btn-sm {
  height: 28px;
  min-height: 28px;
  padding: 0 10px;
  font-size: 12px;
  border-radius: var(--radius-sm);
}

.btn-block {
  width: 100%;
}

/* ==========================================================================
   Compact Forms & Inputs
   ========================================================================== */
.form-group {
  margin-bottom: 14px;
}

.form-label {
  display: block;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 5px;
  letter-spacing: 0.02em;
}

.form-control {
  width: 100%;
  min-height: 36px;
  padding: 7px 11px;
  background: #070b15;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-family: inherit;
  font-size: 13px;
  line-height: 1.4;
  transition: var(--transition-fast);
}

.form-control::placeholder {
  color: var(--text-placeholder);
}

.form-control:focus {
  outline: none;
  border-color: var(--bca-blue);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.25);
  background: #0a101f;
}

textarea.form-control {
  min-height: 70px;
  padding: 8px 11px;
}

select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
}

/* Input with leading SVG icon */
.input-icon-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon-wrap .input-icon {
  position: absolute;
  left: 10px;
  color: var(--text-muted);
  pointer-events: none;
  display: flex;
  align-items: center;
  transition: color var(--transition-fast);
}

.input-icon-wrap .form-control {
  padding-left: 34px;
}

.input-icon-wrap:focus-within .input-icon {
  color: var(--bca-cyan);
}

.input-action-btn {
  position: absolute;
  right: 4px;
  background: none;
  border: none;
  color: var(--text-muted);
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-fast);
}

.input-action-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
}

/* ==========================================================================
   Compact Status Badges (padding 2px 8px, font 11px)
   ========================================================================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  white-space: nowrap;
  width: fit-content;
  line-height: 1.4;
}

.badge-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  flex-shrink: 0;
}

.badge-success {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid var(--success-border);
}
.badge-success .badge-dot {
  background-color: var(--success);
  box-shadow: 0 0 6px var(--success);
}

.badge-pending {
  background: var(--warning-bg);
  color: var(--warning);
  border: 1px solid var(--warning-border);
}
.badge-pending .badge-dot {
  background-color: var(--warning);
}

.badge-danger {
  background: var(--danger-bg);
  color: #f87171;
  border: 1px solid var(--danger-border);
}
.badge-danger .badge-dot {
  background-color: var(--danger);
}

.badge-info {
  background: rgba(56, 189, 248, 0.12);
  color: var(--bca-cyan);
  border: 1px solid rgba(56, 189, 248, 0.25);
}

/* ==========================================================================
   Auth / Login Page (Compact Enterprise)
   ========================================================================== */
.auth-container {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 20px 14px;
}

.auth-card {
  width: 100%;
  max-width: 380px;
  padding: 28px 24px;
  animation: fadeInUp 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  border: 1px solid var(--border-strong);
  background: var(--bg-surface);
  box-shadow: var(--shadow-lg);
}

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

.auth-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--bca-blue), #38bdf8);
  margin-bottom: 12px;
  box-shadow: 0 4px 16px var(--bca-blue-glow);
  border: 1px solid rgba(255, 255, 255, 0.18);
}

.auth-logo svg {
  width: 22px;
  height: 22px;
  color: #ffffff;
}

.auth-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 4px;
  color: #ffffff;
}

.auth-subtitle {
  color: var(--text-secondary);
  font-size: 12.5px;
}

.auth-hint-box {
  margin-top: 14px;
  padding: 8px 10px;
  background: rgba(37, 99, 235, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.22);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
}

.auth-links {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px 16px;
}

.auth-link-item {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 12.5px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: var(--transition-fast);
}

.auth-link-item:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.05);
}

/* ==========================================================================
   Dashboard Layout & Collapsible Desktop Sidebar
   ========================================================================== */
.dashboard-wrapper {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-surface);
  border-right: 1px solid var(--border-subtle);
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 1100;
  transition: width var(--transition-normal), transform var(--transition-normal), padding var(--transition-normal);
}

.sidebar-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 4px 14px 4px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 14px;
  min-height: 44px;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 14.5px;
  font-weight: 700;
  font-family: var(--font-display);
  color: #ffffff;
  text-decoration: none;
  overflow: hidden;
  white-space: nowrap;
}

.brand-icon-badge {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  background: linear-gradient(135deg, var(--bca-blue), #38bdf8);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 10px var(--bca-blue-glow);
  flex-shrink: 0;
}

.sidebar-collapse-btn {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: var(--transition-fast);
}

.sidebar-collapse-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  border-color: var(--border-strong);
}

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

.sidebar-close-btn {
  display: none;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.sidebar-section-label {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 6px 10px 4px;
  white-space: nowrap;
  overflow: hidden;
}

.sidebar-menu {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-item a {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 36px;
  padding: 0 10px;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: var(--radius-md);
  font-weight: 500;
  font-size: 13px;
  transition: var(--transition-fast);
  border-left: 2px solid transparent;
  position: relative;
  white-space: nowrap;
}

.sidebar-item a svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.sidebar-item a:hover {
  background: rgba(255, 255, 255, 0.04);
  color: #ffffff;
}

.sidebar-item.active a {
  background: rgba(37, 99, 235, 0.14);
  color: #ffffff;
  border-left-color: var(--bca-cyan);
  font-weight: 600;
}

.sidebar-item.active a svg {
  color: var(--bca-cyan);
}

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

.sidebar-user-card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
}

/* Collapsed State (Desktop Only >= 768px) */
@media (min-width: 768px) {
  html.sidebar-collapsed-preload .sidebar,
  .sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
    padding: 14px 8px;
  }

  html.sidebar-collapsed-preload .main-content,
  body.sidebar-collapsed .main-content {
    margin-left: var(--sidebar-collapsed-width);
  }

  .sidebar.collapsed .sidebar-header-row {
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 0 0 12px 0;
  }

  .sidebar.collapsed .sidebar-logo-text,
  .sidebar.collapsed .sidebar-section-label,
  .sidebar.collapsed .sidebar-item a span,
  .sidebar.collapsed .sidebar-user-info,
  .sidebar.collapsed .logout-text {
    display: none;
  }

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

  .sidebar.collapsed .sidebar-item a {
    justify-content: center;
    padding: 0;
    border-left-width: 0;
  }

  .sidebar.collapsed .sidebar-item.active a {
    background: rgba(37, 99, 235, 0.22);
    border: 1px solid rgba(56, 189, 248, 0.35);
  }

  .sidebar.collapsed .sidebar-user-card {
    justify-content: center;
    padding: 6px;
  }

  .sidebar.collapsed #logoutBtn {
    padding: 0;
    justify-content: center;
  }

  /* Floating Tooltips on Hover in Collapsed Mode */
  .sidebar.collapsed .sidebar-item a[data-tooltip]::after,
  .sidebar.collapsed #logoutBtn[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    left: calc(100% + 12px);
    top: 50%;
    transform: translateY(-50%) translateX(-4px);
    background: #0f172a;
    color: #f8fafc;
    font-size: 12px;
    font-weight: 500;
    padding: 5px 10px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-strong);
    box-shadow: var(--shadow-lg);
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s ease, transform 0.15s ease;
    z-index: 1500;
  }

  .sidebar.collapsed .sidebar-item a[data-tooltip]:hover::after,
  .sidebar.collapsed #logoutBtn[data-tooltip]:hover::after {
    opacity: 1;
    visibility: visible;
    transform: translateY(-50%) translateX(0);
  }

  /* Keep nav overflow visible for tooltips in collapsed state */
  .sidebar.collapsed nav {
    overflow: visible !important;
  }
}

/* Main Content Area */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  padding: 20px 24px;
  min-width: 0;
  transition: margin-left var(--transition-normal);
}

body.sidebar-collapsed .main-content {
  margin-left: var(--sidebar-collapsed-width);
}

/* Dashboard Header */
.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-subtle);
}

.dashboard-title h2 {
  font-size: 17px;
  font-weight: 600;
  color: #ffffff;
}

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

.user-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 12px 4px 4px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
}

.avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--bca-blue), var(--bca-cyan));
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

/* Mobile Topbar (Hidden on Desktop) */
.mobile-topbar {
  display: none;
}

.mobile-drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(3, 7, 18, 0.78);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 1090;
  opacity: 0;
  transition: opacity var(--transition-normal);
  pointer-events: none;
}

.mobile-drawer-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

/* ==========================================================================
   Floating Bottom Navigation Bar (< 768px)
   ========================================================================== */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: calc(8px + env(safe-area-inset-bottom, 0px));
  left: 10px;
  right: 10px;
  height: 56px;
  background: rgba(12, 19, 34, 0.94);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  z-index: 1050;
  padding: 0 6px;
}

.mobile-bottom-nav-list {
  display: flex;
  align-items: center;
  justify-content: space-around;
  height: 100%;
  list-style: none;
}

.mobile-bottom-nav-item {
  flex: 1;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mobile-bottom-nav-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  width: 100%;
  min-height: 44px;
  color: var(--text-secondary);
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: none;
  font-family: var(--font-body);
  font-size: 10.5px;
  font-weight: 500;
  padding: 4px;
  border-radius: var(--radius-md);
  transition: var(--transition-fast);
  position: relative;
}

.mobile-bottom-nav-link svg {
  width: 18px;
  height: 18px;
}

.mobile-bottom-nav-link:active,
.mobile-bottom-nav-link.active {
  color: var(--bca-cyan);
  font-weight: 600;
}

.mobile-bottom-nav-link.active::after {
  content: '';
  position: absolute;
  top: 2px;
  width: 16px;
  height: 2px;
  background: var(--bca-cyan);
  border-radius: var(--radius-full);
}

.mobile-nav-badge {
  position: absolute;
  top: 5px;
  right: calc(50% - 14px);
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--danger);
  border: 1.5px solid var(--bg-surface);
  display: none;
}

/* ==========================================================================
   Stats Bento Grid (Compact 20-22px Metric Values)
   ========================================================================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

@media (max-width: 1200px) {
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.stat-card {
  padding: 14px 16px;
  min-width: 0;
}

.stat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  margin-bottom: 8px;
}

.stat-icon {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.04);
  flex-shrink: 0;
}

.stat-icon svg {
  width: 15px;
  height: 15px;
}

.stat-value {
  font-size: 21px;
  font-weight: 700;
  font-family: var(--font-display);
  color: #ffffff;
  font-variant-numeric: tabular-nums;
  line-height: 1.25;
  word-break: break-word;
}

.stat-footer {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 6px;
}

.stat-progress-track {
  height: 3px;
  width: 100%;
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-top: 8px;
}

.stat-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--bca-blue), var(--success));
  border-radius: var(--radius-full);
  transition: width 0.4s ease;
}

/* ==========================================================================
   Tabs & Section Panels
   ========================================================================== */
.tab-section {
  display: none;
  animation: fadeIn 0.2s ease;
}

.tab-section.active {
  display: block;
}

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

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

.row-header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-toolbar {
  padding: 12px 14px;
  margin-bottom: 14px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.filter-toolbar-search {
  flex: 1;
  min-width: 220px;
}

.filter-toolbar-select {
  width: 165px;
}

/* ==========================================================================
   Dense Enterprise Tables (padding 8px 14px, font 12.5px)
   ========================================================================== */
.table-responsive-wrapper,
.table-container {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: #080e1a;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.data-table th {
  padding: 8px 14px;
  background: #0f172a;
  font-size: 11px;
  text-transform: uppercase;
  color: var(--text-secondary);
  letter-spacing: 0.05em;
  font-weight: 600;
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}

.data-table td {
  padding: 8px 14px;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 12.5px;
  color: var(--text-main);
  vertical-align: middle;
}

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

.data-table tr:hover td {
  background: rgba(255, 255, 255, 0.025);
}

/* Mobile Card View Container */
.mobile-card-list {
  display: none;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  max-width: 100%;
  width: 100%;
}

.mobile-data-card {
  background: #09101d;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
  width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.mobile-data-card > * {
  min-width: 0;
  max-width: 100%;
}

.mobile-data-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-subtle);
  min-width: 0;
  max-width: 100%;
  width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.mobile-data-card-header > * {
  min-width: 0;
  max-width: 100%;
}

.mobile-card-title {
  font-weight: 600;
  font-size: 13.5px;
  color: #fff;
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.mobile-card-row,
.mobile-data-card-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  min-width: 0;
  max-width: 100%;
  width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.mobile-card-row > *,
.mobile-data-card-row > * {
  min-width: 0;
  max-width: 100%;
}

.mobile-card-value {
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.mobile-data-card .font-mono {
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-all;
}

.mobile-data-card-actions {
  display: flex;
  gap: 6px;
  padding-top: 8px;
  border-top: 1px solid var(--border-subtle);
  margin-top: 2px;
  min-width: 0;
  max-width: 100%;
  width: 100%;
}

.mobile-data-card-actions .btn {
  flex: 1;
  min-width: 0;
}

.api-key-pill {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  background: #050912;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 3px 8px;
  min-width: 0;
  max-width: 100%;
}

.api-key-pill .btn {
  flex-shrink: 0;
}

.api-key-text {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--bca-cyan);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 165px;
  min-width: 0;
}

/* ==========================================================================
   Skeleton, Empty & Error States
   ========================================================================== */
.skeleton {
  background: linear-gradient(90deg, rgba(255,255,255,0.03) 25%, rgba(255,255,255,0.07) 37%, rgba(255,255,255,0.03) 63%);
  background-size: 400% 100%;
  animation: skeleton-loading 1.4s ease infinite;
  border-radius: var(--radius-sm);
}

@keyframes skeleton-loading {
  0% { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}

.skeleton-line {
  height: 12px;
  width: 100%;
}

.skeleton-card {
  background: #09101d;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 28px 16px;
  color: var(--text-secondary);
}

.empty-state-icon {
  width: 36px;
  height: 36px;
  margin-bottom: 10px;
  color: var(--text-muted);
  opacity: 0.7;
}

.empty-state-title {
  font-size: 14px;
  font-weight: 600;
  color: #ffffff;
  margin-bottom: 4px;
}

.empty-state-desc {
  font-size: 12.5px;
  color: var(--text-secondary);
  max-width: 340px;
  margin-bottom: 14px;
}

.error-banner {
  background: var(--danger-bg);
  border: 1px solid var(--danger-border);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: #fecaca;
  margin: 6px 0;
  font-size: 12.5px;
}

/* ==========================================================================
   Modals & Bottom-Sheet Behavior
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(3, 7, 18, 0.8);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 1300;
  opacity: 0;
  transition: opacity var(--transition-normal);
  padding: 16px;
}

.modal-overlay.active {
  display: flex;
  opacity: 1;
}

.modal-content {
  width: 100%;
  max-width: 460px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xl);
  padding: 20px 22px;
  position: relative;
  transform: scale(0.96);
  transition: transform var(--transition-normal);
  box-shadow: var(--shadow-lg);
  max-height: 90vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.modal-overlay.active .modal-content {
  transform: scale(1);
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-fast);
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
}

.bottom-sheet-handle {
  display: none;
  width: 38px;
  height: 4px;
  background: rgba(255, 255, 255, 0.22);
  border-radius: var(--radius-full);
  margin: 0 auto 10px auto;
  flex-shrink: 0;
}

.qr-modal-body {
  text-align: center;
  padding: 8px 0 4px;
}

.qr-image-container {
  display: inline-block;
  padding: 10px;
  background: #ffffff;
  border-radius: var(--radius-md);
  margin-bottom: 12px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.45);
  max-width: 100%;
}

.qr-image-container img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
}

.qr-payload-box {
  background: #060a14;
  padding: 9px 11px;
  border-radius: var(--radius-md);
  font-family: var(--font-mono);
  font-size: 11.5px;
  word-break: break-all;
  max-height: 80px;
  overflow-y: auto;
  margin-bottom: 12px;
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
  text-align: left;
}

/* ==========================================================================
   Toast Notifications
   ========================================================================== */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-lg);
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
  animation: slideIn 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  min-width: 240px;
  max-width: 340px;
  font-size: 12.5px;
}

.toast-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.toast-message {
  flex: 1;
}

.toast-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
  line-height: 1;
}

.toast-success {
  border-left: 3px solid var(--success);
}
.toast-success .toast-icon { color: var(--success); }

.toast-error {
  border-left: 3px solid var(--danger);
}
.toast-error .toast-icon { color: var(--danger); }

.toast-hiding {
  opacity: 0;
  transform: translateX(10px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

/* ==========================================================================
   Keyframes
   ========================================================================== */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes pulse {
  0% { transform: scale(0.85); opacity: 0.5; }
  50% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(0.85); opacity: 0.5; }
}

/* ==========================================================================
   Responsive Breakpoints (Mobile < 768px)
   ========================================================================== */
@media (max-width: 767px) {
  .form-control {
    min-height: 40px;
    font-size: 16px; /* Prevent iOS Safari auto-zoom */
  }

  .btn {
    min-height: 38px;
  }

  .btn-sm {
    min-height: 32px;
  }

  .auth-card {
    padding: 22px 18px;
  }

  /* Sidebar acts as standard Off-Canvas Drawer on Mobile */
  .sidebar,
  .sidebar.collapsed {
    transform: translateX(-100%);
    width: 260px !important;
    max-width: 85vw;
    padding: 16px 12px !important;
    z-index: 1100;
    box-shadow: 12px 0 36px rgba(0, 0, 0, 0.7);
  }

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

  .sidebar-collapse-btn {
    display: none;
  }

  .sidebar-close-btn {
    display: flex;
  }

  /* Show Sticky Mobile Topbar */
  .mobile-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: var(--mobile-header-height);
    background: rgba(12, 19, 34, 0.94);
    border-bottom: 1px solid var(--border-subtle);
    padding: 0 12px;
    position: sticky;
    top: 0;
    z-index: 1000;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
  }

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

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

  .mobile-menu-trigger {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-subtle);
    color: var(--text-main);
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: var(--radius-md);
    flex-shrink: 0;
  }

  .mobile-status-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 10.5px;
    font-weight: 600;
    color: var(--success);
    background: var(--success-bg);
    border: 1px solid var(--success-border);
    padding: 2px 7px;
    border-radius: var(--radius-full);
  }

  .mobile-status-chip .dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--success);
    animation: pulse 1.6s infinite;
  }

  .mobile-bottom-nav {
    display: block;
  }

  .dashboard-wrapper {
    overflow-x: hidden;
    max-width: 100%;
  }

  .main-content,
  body.sidebar-collapsed .main-content {
    margin-left: 0 !important;
    padding: 14px 12px calc(82px + env(safe-area-inset-bottom, 0px)) 12px;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: hidden;
    transition: none;
  }

  .tab-section,
  .section-panel {
    min-width: 0;
    max-width: 100%;
  }

  .dashboard-header {
    margin-bottom: 14px;
    padding-bottom: 10px;
  }

  .dashboard-header .user-profile {
    display: none;
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 14px;
  }

  .stat-card {
    padding: 12px;
  }

  .stat-value {
    font-size: 18px;
  }

  .section-panel {
    padding: 12px !important;
  }

  .row-header-actions {
    width: 100%;
  }

  .row-header-actions .btn {
    flex: 1;
  }

  .filter-toolbar {
    padding: 10px 12px;
    gap: 8px;
  }

  .filter-toolbar-search,
  .filter-toolbar-select {
    width: 100%;
    min-width: 0;
  }

  .table-responsive-wrapper,
  .table-container {
    display: none;
  }

  .mobile-card-list {
    display: flex;
  }

  .modal-overlay {
    padding: 0;
    align-items: flex-end;
  }

  .modal-content {
    max-width: 100%;
    border-radius: 16px 16px 0 0;
    padding: 12px 16px calc(20px + env(safe-area-inset-bottom, 0px)) 16px;
    transform: translateY(100%);
    max-height: 92vh;
  }

  .modal-overlay.active .modal-content {
    transform: translateY(0);
  }

  .bottom-sheet-handle {
    display: block;
  }

  .toast-container {
    left: 10px;
    right: 10px;
    bottom: calc(74px + env(safe-area-inset-bottom, 0px)) !important;
    align-items: stretch;
  }

  .toast {
    min-width: 0;
    max-width: 100%;
  }

  .log-widget-container .log-bubble-btn {
    display: none;
  }

  .log-panel {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    top: auto !important;
    width: 100% !important;
    max-width: 100% !important;
    height: 75vh !important;
    max-height: 75vh !important;
    border-radius: 16px 16px 0 0 !important;
    transform: translateY(100%) !important;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    z-index: 1499 !important;
  }

  .log-panel.active {
    transform: translateY(0) !important;
  }
}

@media (max-width: 359px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
}
