:root {
  /* Core Colors (Bank Theme) */
  --bg-dark: #f0f4f8;
  --bg-darker: #e1e8f0;
  --bg-body: #f8fafc;
  --bg-panel: #ffffff;
  --bg-panel-hover: #f8fafc;
  
  /* Brand Accents (Deep Institutional Navy) */
  --accent-primary: #0f4c81;
  --accent-secondary: #0a3359;
  --accent-primary-rgb: 15, 76, 129;
  --accent-glow: rgba(15, 76, 129, 0.1);
  
  /* Status Colors (Refined) */
  --status-success: #059669;
  --status-warning: #d97706;
  --status-danger: #e11d48;
  --status-info: #0284c7;
  
  /* Text */
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  
  /* Borders */
  --border-light: #e2e8f0;
  --border-glow: rgba(15, 76, 129, 0.15);

  /* Geometry & Spacing */
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 24px;
  --radius-full: 9999px;
  
  --spacing-xs: 4px;
  --spacing-sm: 8px;
  --spacing-md: 16px;
  --spacing-lg: 24px;
  --spacing-xl: 40px;
  
  /* Typography */
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

@media (max-width: 768px) {
  :root {
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 12px;
    --spacing-lg: 16px;
    --spacing-xl: 20px;
  }
  .page-content {
    padding: 12px !important;
    padding-bottom: 100px !important;
  }
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: var(--font-family);
  background: #fdfdfd;
  color: var(--text-primary);
  min-height: 100vh;
  background-attachment: fixed;
  scroll-behavior: smooth;
  opacity: 0;
  transition: opacity 0.35s ease-out;
  /* Fallback: ensure page becomes visible even if JS fails to add .loaded */
  animation: forceVisible 0s 2s forwards;
}

@keyframes forceVisible {
  to { opacity: 1; }
}

body.loaded {
  opacity: 1;
  animation: none;
}

/* Page Transition */
.page-transitioning .page-content {
  opacity: 0 !important;
  transform: translateY(-4px) !important;
  transition: opacity 0.15s ease, transform 0.15s ease !important;
}

.page-content {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.2s ease 0.05s, transform 0.2s ease 0.05s;
}

/* Typography Scale */
h1 { font-size: 2.25rem; font-weight: 700; line-height: 1.2; letter-spacing: -0.02em; }
h2 { font-size: 1.875rem; font-weight: 600; line-height: 1.3; letter-spacing: -0.01em; }
h3 { font-size: 1.5rem; font-weight: 600; line-height: 1.4; }
h4 { font-size: 1.25rem; font-weight: 500; line-height: 1.5; }
p { font-size: 1rem; line-height: 1.6; color: var(--text-secondary); }
small { font-size: 0.875rem; color: var(--text-muted); }

/* Links */
a { color: var(--accent-primary); text-decoration: none; transition: all 0.2s ease; }
a:hover { color: var(--accent-secondary); }

/* Base Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--spacing-sm);
  padding: 12px 24px; border-radius: var(--radius-md); font-family: var(--font-family);
  font-size: 0.95rem; font-weight: 700; cursor: pointer; border: none; outline: none;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
  letter-spacing: 0.2px;
}

.btn-primary {
  background: var(--accent-primary);
  color: #fff; 
  box-shadow: 0 2px 6px rgba(15, 76, 129, 0.2);
}

.btn-primary:hover {
  background: var(--accent-secondary);
  transform: translateY(-1px); 
  box-shadow: 0 4px 12px rgba(15, 76, 129, 0.3);
}

.btn-primary:active { transform: translateY(0); box-shadow: none; }

.btn-secondary {
  background: #ffffff; color: var(--text-secondary);
  border: 1px solid #cbd5e1;
}

.btn-secondary:hover {
  background: #f1f5f9; color: var(--text-primary);
  border-color: #94a3b8;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
}

.btn-xs {
  padding: 4px 8px;
  font-size: 0.72rem;
}

/* Inputs */
.form-group { margin-bottom: var(--spacing-md); }
.form-label { display: block; font-size: 0.82rem; font-weight: 600; color: var(--text-secondary); margin-bottom: var(--spacing-xs); }

.form-control {
  width: 100%; padding: 10px 14px;
  background: #ffffff; border: 1px solid var(--border-light);
  border-radius: var(--radius-sm); color: var(--text-primary);
  font-family: var(--font-family); font-size: 0.92rem; transition: all 0.2s ease;
}

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

.form-control:focus {
  outline: none; border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-glow); background: #ffffff;
}

/* Utility Classes */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mb-1 { margin-bottom: var(--spacing-sm); }
.mb-2 { margin-bottom: var(--spacing-md); }
.mb-3 { margin-bottom: var(--spacing-lg); }
.mb-4 { margin-bottom: var(--spacing-xl); }
.mt-1 { margin-top: var(--spacing-sm); }
.mt-2 { margin-top: var(--spacing-md); }

/* Custom Scrollbar - Light Theme */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: var(--radius-full); }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* Animations */
@keyframes pulse {
  0% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.05); }
  100% { opacity: 1; transform: scale(1); }
}

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

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

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

.toast {
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  min-width: 280px;
  max-width: 380px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.1);
  transform: translateX(120%);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.toast.show {
  transform: translateX(0);
  opacity: 1;
}

.toast-icon { font-size: 1.1rem; flex-shrink: 0; margin-top: 2px; }
.toast-content { flex: 1; }
.toast-title { font-weight: 600; margin-bottom: 2px; color: var(--text-primary); font-size: 0.88rem; }
.toast-message { color: var(--text-secondary); font-size: 0.82rem; line-height: 1.4; }

.toast-close {
  background: none; border: none; color: var(--text-muted); cursor: pointer; padding: 4px; border-radius: 4px; transition: background 0.2s;
}
.toast-close:hover { background: rgba(0,0,0,0.05); color: var(--text-primary); }

.toast.success .toast-icon { color: var(--status-success); }
.toast.error .toast-icon { color: var(--status-danger); }
.toast.info .toast-icon { color: var(--status-info); }
.toast.warning .toast-icon { color: var(--status-warning); }

@media (max-width: 520px) {
  .toast-container {
    left: max(12px, env(safe-area-inset-left));
    right: max(12px, env(safe-area-inset-right));
    bottom: max(80px, env(safe-area-inset-bottom));
  }
  .toast { min-width: 0; max-width: none; width: 100%; }
}

/* Global FAB */
.global-fab {
  position: fixed;
  bottom: 80px;
  right: 24px;
  background: var(--accent-primary);
  color: white;
  border-radius: 50px;
  padding: 12px 24px;
  box-shadow: 0 4px 16px rgba(15, 76, 129, 0.35);
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 1000;
  text-decoration: none;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  font-weight: 600;
  font-size: 0.88rem;
}
.global-fab:hover {
  transform: translateY(-2px);
  background: var(--accent-secondary);
  box-shadow: 0 6px 20px rgba(15, 76, 129, 0.4);
  color: white;
}
@media (max-width: 768px) {
  .global-fab {
    padding: 14px;
    border-radius: 50%;
    bottom: calc(80px + env(safe-area-inset-bottom));
    right: 16px;
    width: 52px;
    height: 52px;
  }
  .global-fab span { display: none; }
}

/* ─── Process Type Badges ─── */
.process-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.process-badge.clear-file { background: #dcfce7; color: #166534; }
.process-badge.mbdf { background: #fef3c7; color: #92400e; }
.process-badge.bdf { background: #fee2e2; color: #991b1b; }

/* ─── Card Styles ─── */
.info-card {
  background: #fff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: var(--spacing-md);
  transition: all 0.2s;
}
.info-card:hover {
  border-color: rgba(var(--accent-primary-rgb), 0.3);
  box-shadow: 0 4px 12px rgba(0,0,0,0.04);
}

/* ─── Empty State ─── */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-muted);
}
.empty-state i { font-size: 2.5rem; margin-bottom: var(--spacing-md); opacity: 0.25; }
.empty-state h4 { color: var(--text-secondary); margin-bottom: 6px; font-size: 1rem; }
.empty-state p { font-size: 0.85rem; max-width: 320px; margin: 0 auto; }
