/* ==========================================================================
   KSCARDB Financial Appraisal - Modern Banking Design System
   Kerala State Co-operative Agricultural & Rural Development Bank Ltd.
   Head Office, Trivandrum - Project Appraisal & Feasibility Evaluation System
   ========================================================================== */

/* --------------------------------------------------------------------------
   Design Tokens & CSS Variables (Light Theme Default)
   -------------------------------------------------------------------------- */
:root {
  /* Color Palette - Core Banking Brand */
  --primary-50: #eff6ff;
  --primary-100: #dbeafe;
  --primary-200: #bfdbfe;
  --primary-300: #93c5fd;
  --primary-400: #60a5fa;
  --primary-500: #3b82f6;
  --primary-600: #2563eb;
  --primary-700: #1d4ed8;
  --primary-800: #1e40af;
  --primary-900: #0f2a4a;
  --primary-950: #0a1c33;

  /* Accent Semantics */
  --emerald-50: #ecfdf5;
  --emerald-100: #d1fae5;
  --emerald-500: #10b981;
  --emerald-600: #059669;
  --emerald-700: #047857;

  --amber-50: #fffbeb;
  --amber-100: #fef3c7;
  --amber-500: #f59e0b;
  --amber-600: #d97706;
  --amber-700: #b45309;

  --rose-50: #fff1f2;
  --rose-100: #ffe4e6;
  --rose-500: #f43f5e;
  --rose-600: #e11d48;
  --rose-700: #be123c;

  --sky-50: #f0f9ff;
  --sky-100: #e0f2fe;
  --sky-500: #0ea5e9;
  --sky-600: #0284c7;
  --sky-700: #0369a1;

  --indigo-50: #eef2ff;
  --indigo-500: #6366f1;
  --indigo-600: #4f46e5;

  /* Theme Dependent Surface & Typography Colors (Light) */
  --bg-page: #f8fafc;
  --bg-surface: #ffffff;
  --bg-surface-secondary: #f1f5f9;
  --bg-surface-tertiary: #e2e8f0;
  --bg-surface-translucent: rgba(255, 255, 255, 0.85);

  --border-color: #e2e8f0;
  --border-subtle: #f1f5f9;
  --border-strong: #cbd5e1;
  --border-focus: #2563eb;

  --text-main: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --text-on-primary: #ffffff;

  /* Header */
  --header-bg: linear-gradient(135deg, #091e3a 0%, #0f2a4a 45%, #16365c 100%);
  --header-border: rgba(56, 189, 248, 0.25);
  --header-text: #ffffff;
  --header-subtext: #94a3b8;

  /* Sidebar */
  --sidebar-bg: #ffffff;
  --sidebar-border: #e2e8f0;
  --sidebar-active-bg: #eff6ff;
  --sidebar-active-text: #0284c7;
  --sidebar-active-border: #0284c7;

  /* KPI Cards */
  --kpi-bg: #ffffff;
  --kpi-border: #e2e8f0;
  --kpi-title: #64748b;
  --kpi-value: #0f172a;

  /* Form Inputs */
  --input-bg: #ffffff;
  --input-border: #cbd5e1;
  --input-text: #0f172a;
  --input-disabled-bg: #f8fafc;
  --input-disabled-text: #94a3b8;
  --input-focus-ring: rgba(37, 99, 235, 0.15);

  /* Financial Tables */
  --table-bg: #ffffff;
  --table-border: #e2e8f0;
  --table-th-bg: #f8fafc;
  --table-th-text: #0f172a;
  --table-th-border: #cbd5e1;
  --table-td-text: #1e293b;
  --table-row-hover: #f1f5f9;
  --table-row-subheading: #f8fafc;
  --table-row-subheading-text: #0f2a4a;
  --table-row-total: #e2e8f0;
  --table-row-total-text: #0f172a;
  --table-row-total-border: #94a3b8;
  --table-row-pat: #ecfdf5;
  --table-row-pat-text: #065f46;
  --table-row-pat-border: #059669;
  --table-row-accent: #eff6ff;
  --table-row-accent-text: #1e40af;

  /* Pills */
  --sheet-pill-bg: #ffffff;
  --sheet-pill-border: #cbd5e1;
  --sheet-pill-text: #475569;
  --sheet-pill-hover-bg: #f1f5f9;
  --sheet-pill-active-bg: #0f2a4a;
  --sheet-pill-active-text: #ffffff;

  /* Badges */
  --badge-emerald-bg: #ecfdf5;
  --badge-emerald-text: #059669;
  --badge-emerald-border: rgba(5, 150, 105, 0.2);

  --badge-amber-bg: #fffbeb;
  --badge-amber-text: #d97706;
  --badge-amber-border: rgba(217, 119, 6, 0.2);

  --badge-rose-bg: #fff1f2;
  --badge-rose-text: #e11d48;
  --badge-rose-border: rgba(225, 29, 72, 0.2);

  --badge-blue-bg: #eff6ff;
  --badge-blue-text: #2563eb;
  --badge-blue-border: rgba(37, 99, 235, 0.2);

  /* Shadows */
  --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.04);
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.08), 0 1px 2px -1px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.03);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.03);

  /* Radii */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;

  /* Fonts */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-mono: 'SF Mono', 'Cascadia Code', 'Consolas', Menlo, Monaco, monospace;
}

/* --------------------------------------------------------------------------
   Dark Mode Overrides ([data-theme="dark"])
   -------------------------------------------------------------------------- */
[data-theme="dark"] {
  --bg-page: #0a0e17;
  --bg-surface: #111827;
  --bg-surface-secondary: #1a2333;
  --bg-surface-tertiary: #243046;
  --bg-surface-translucent: rgba(17, 24, 39, 0.85);

  --border-color: #243046;
  --border-subtle: #1a2333;
  --border-strong: #374763;
  --border-focus: #38bdf8;

  --text-main: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #8493a8;
  --text-light: #64748b;
  --text-on-primary: #ffffff;

  /* Header */
  --header-bg: linear-gradient(135deg, #060b13 0%, #0c1626 45%, #132238 100%);
  --header-border: rgba(56, 189, 248, 0.2);
  --header-text: #f8fafc;
  --header-subtext: #8493a8;

  /* Sidebar */
  --sidebar-bg: #111827;
  --sidebar-border: #243046;
  --sidebar-active-bg: #1a2333;
  --sidebar-active-text: #38bdf8;
  --sidebar-active-border: #38bdf8;

  /* KPI Cards */
  --kpi-bg: #111827;
  --kpi-border: #243046;
  --kpi-title: #8493a8;
  --kpi-value: #f8fafc;

  /* Form Inputs */
  --input-bg: #1a2333;
  --input-border: #2e3e58;
  --input-text: #f8fafc;
  --input-disabled-bg: #121926;
  --input-disabled-text: #64748b;
  --input-focus-ring: rgba(56, 189, 248, 0.25);

  /* Financial Tables */
  --table-bg: #111827;
  --table-border: #243046;
  --table-th-bg: #172132;
  --table-th-text: #e2e8f0;
  --table-th-border: #2e3e58;
  --table-td-text: #cbd5e1;
  --table-row-hover: #1a2333;
  --table-row-subheading: #172132;
  --table-row-subheading-text: #38bdf8;
  --table-row-total: #1c273a;
  --table-row-total-text: #f8fafc;
  --table-row-total-border: #475a7a;
  --table-row-pat: #064e3b;
  --table-row-pat-text: #6ee7b7;
  --table-row-pat-border: #10b981;
  --table-row-accent: #172c4a;
  --table-row-accent-text: #93c5fd;

  /* Pills */
  --sheet-pill-bg: #1a2333;
  --sheet-pill-border: #2e3e58;
  --sheet-pill-text: #cbd5e1;
  --sheet-pill-hover-bg: #243046;
  --sheet-pill-active-bg: #0284c7;
  --sheet-pill-active-text: #ffffff;

  /* Badges */
  --badge-emerald-bg: rgba(16, 185, 129, 0.15);
  --badge-emerald-text: #34d399;
  --badge-emerald-border: rgba(52, 211, 153, 0.3);

  --badge-amber-bg: rgba(245, 158, 11, 0.15);
  --badge-amber-text: #fbbf24;
  --badge-amber-border: rgba(251, 191, 36, 0.3);

  --badge-rose-bg: rgba(244, 63, 94, 0.15);
  --badge-rose-text: #fb7185;
  --badge-rose-border: rgba(251, 113, 133, 0.3);

  --badge-blue-bg: rgba(56, 189, 248, 0.15);
  --badge-blue-text: #38bdf8;
  --badge-blue-border: rgba(56, 189, 248, 0.3);

  /* Shadows */
  --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.4), 0 1px 2px -1px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.5), 0 2px 4px -2px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.6), 0 4px 6px -4px rgba(0, 0, 0, 0.5);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.7), 0 8px 10px -6px rgba(0, 0, 0, 0.6);
}

/* --------------------------------------------------------------------------
   Global Resets & Base Typography
   -------------------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 14px;
  scroll-behavior: smooth;
  color-scheme: light;
}

[data-theme="dark"] html,
html[data-theme="dark"] {
  color-scheme: dark;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-page);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  transition: background-color 0.25s ease, color 0.25s ease;
}

/* Tabular numbers for clean numeric column alignment */
.tabular-nums,
.num-col,
.numeric-input {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

/* --------------------------------------------------------------------------
   Modern App Header & Branding Bar
   -------------------------------------------------------------------------- */
.app-header {
  background: var(--header-bg);
  color: var(--header-text);
  padding: 10px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-md);
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 2px solid var(--header-border);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  height: 64px;
}

.brand-wrapper {
  display: flex;
  align-items: center;
  gap: 14px;
}

.bank-logo-badge {
  width: 44px;
  height: 44px;
  background: #ffffff;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.25);
  flex-shrink: 0;
}

.app-bank-logo {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.bank-logo-badge-sm {
  width: 32px;
  height: 32px;
  background: #ffffff;
  border-radius: var(--radius-xs);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
  flex-shrink: 0;
}

.app-bank-logo-sm {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.bank-emblem {
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 17px;
  color: #ffffff;
  box-shadow: 0 2px 10px rgba(2, 132, 199, 0.4);
  letter-spacing: 0.5px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  flex-shrink: 0;
}

.brand-titles h1 {
  font-size: 15.5px;
  font-weight: 700;
  letter-spacing: 0.2px;
  color: #ffffff;
  margin: 0;
  line-height: 1.25;
}

.brand-titles .sub-title {
  font-size: 11px;
  color: var(--header-subtext);
  font-weight: 400;
  margin-top: 1px;
}

.header-status-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* Live Auto-Save Pill */
.auto-save-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  background-color: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
  transition: all 0.2s ease;
  white-space: nowrap;
}

.auto-save-badge .dot {
  width: 6px;
  height: 6px;
  background-color: #10b981;
  border-radius: 50%;
  box-shadow: 0 0 6px #10b981;
  animation: pulse-dot 2s infinite ease-in-out;
}

@keyframes pulse-dot {
  0% {
    transform: scale(0.9);
    opacity: 0.7;
  }

  50% {
    transform: scale(1.3);
    opacity: 1;
  }

  100% {
    transform: scale(0.9);
    opacity: 0.7;
  }
}

.mern-sync-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  background-color: rgba(59, 130, 246, 0.12);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.28);
  transition: all 0.2s ease;
  white-space: nowrap;
}

.mern-sync-badge.connected {
  background-color: rgba(16, 185, 129, 0.12);
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.28);
}

.mern-sync-badge .dot {
  width: 6px;
  height: 6px;
  background-color: #3b82f6;
  border-radius: 50%;
  box-shadow: 0 0 6px #3b82f6;
}

.mern-sync-badge.connected .dot {
  background-color: #10b981;
  box-shadow: 0 0 6px #10b981;
}

/* Header Buttons */
.header-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.18);
  background-color: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.header-btn:hover {
  background-color: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.35);
  transform: translateY(-1px);
}

.header-btn:active {
  transform: translateY(0);
}

.header-btn.primary-action {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  border-color: #38bdf8;
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(2, 132, 199, 0.3);
}

.header-btn.primary-action:hover {
  background: linear-gradient(135deg, #0369a1 0%, #075985 100%);
  box-shadow: 0 3px 8px rgba(2, 132, 199, 0.4);
}

.header-btn.success-action {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  border-color: #34d399;
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(5, 150, 105, 0.3);
}

.header-btn.success-action:hover {
  background: linear-gradient(135deg, #047857 0%, #065f46 100%);
  box-shadow: 0 3px 8px rgba(5, 150, 105, 0.4);
}

/* --------------------------------------------------------------------------
   Floating Action Window (Quick File Actions Toolbar just below Header)
   -------------------------------------------------------------------------- */
.floating-actions-window-bar {
  position: sticky;
  top: 64px;
  z-index: 90;
  display: flex;
  justify-content: flex-end;
  padding: 8px 24px 0 24px;
  pointer-events: none;
  margin-bottom: 4px;
}

.floating-actions-card {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-surface-translucent);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  padding: 5px 12px;
  box-shadow: 0 10px 25px -4px rgba(0, 0, 0, 0.22), 0 4px 8px -2px rgba(0, 0, 0, 0.1);
  animation: floatingBarSlideDown 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes floatingBarSlideDown {
  from {
    opacity: 0;
    transform: translateY(-8px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.floating-actions-card .header-btn {
  font-size: 11.5px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  box-shadow: none;
}

@media (max-width: 900px) {
  .floating-actions-window-bar {
    justify-content: center;
    padding: 6px 12px 0 12px;
    overflow-x: auto;
  }
  .floating-actions-card {
    max-width: 100%;
    overflow-x: auto;
    border-radius: var(--radius-lg);
  }
}

/* --------------------------------------------------------------------------
   Modern Dark/Light Mode Theme Toggle Switch
   -------------------------------------------------------------------------- */
.theme-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px;
  border-radius: var(--radius-full);
  border: 1px solid rgba(255, 255, 255, 0.25);
  background-color: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  -webkit-user-select: none;
  user-select: none;
}

.theme-toggle-btn:hover {
  background-color: rgba(255, 255, 255, 0.22);
  border-color: rgba(255, 255, 255, 0.45);
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.3);
}

.theme-toggle-icon {
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s ease;
}

.theme-toggle-btn:hover .theme-toggle-icon {
  transform: rotate(20deg);
}

.theme-pill-track {
  width: 28px;
  height: 16px;
  background-color: rgba(0, 0, 0, 0.35);
  border-radius: var(--radius-full);
  position: relative;
  transition: background-color 0.2s ease;
  display: inline-block;
  vertical-align: middle;
}

[data-theme="dark"] .theme-pill-track {
  background-color: #0284c7;
}

.theme-pill-thumb {
  width: 12px;
  height: 12px;
  background-color: #ffffff;
  border-radius: 50%;
  position: absolute;
  top: 2px;
  left: 2px;
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .theme-pill-thumb {
  transform: translateX(12px);
}

/* --------------------------------------------------------------------------
   Vertical Layout & Two-Column Workspace Container
   -------------------------------------------------------------------------- */
.app-layout {
  display: flex;
  max-width: 1600px;
  margin: 0 auto;
  min-height: calc(100vh - 64px);
  position: relative;
}

/* --------------------------------------------------------------------------
   Vertical Sidebar Navigation
   -------------------------------------------------------------------------- */
.app-sidebar {
  width: 300px;
  flex-shrink: 0;
  background-color: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  padding: 18px 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: sticky;
  top: 64px;
  height: calc(100vh - 64px);
  overflow-y: auto;
  box-shadow: var(--shadow-xs);
  transition: background-color 0.25s ease, border-color 0.25s ease;
}

.sidebar-section-title {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  padding: 0 8px 10px 8px;
}

.vertical-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.vertical-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: all 0.15s ease;
  font-family: inherit;
  position: relative;
}

.vertical-nav-item:hover {
  background-color: var(--bg-surface-secondary);
  color: var(--text-main);
  border-color: var(--border-color);
  transform: translateX(2px);
}

.vertical-nav-item.active {
  background-color: var(--sidebar-active-bg);
  color: var(--sidebar-active-text);
  border-color: var(--sidebar-active-border);
  font-weight: 700;
  box-shadow: var(--shadow-xs);
}

.vertical-nav-item.active::before {
  content: '';
  position: absolute;
  left: -14px;
  top: 6px;
  bottom: 6px;
  width: 4px;
  background-color: var(--primary-600);
  border-radius: 0 4px 4px 0;
}

[data-theme="dark"] .vertical-nav-item.active::before {
  background-color: #38bdf8;
}

.nav-icon-badge {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background-color: var(--bg-surface-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
  border: 1px solid var(--border-color);
  transition: all 0.15s ease;
}

.vertical-nav-item.active .nav-icon-badge {
  background-color: var(--primary-600);
  color: #ffffff;
  border-color: var(--primary-600);
}

[data-theme="dark"] .vertical-nav-item.active .nav-icon-badge {
  background-color: #0284c7;
  color: #ffffff;
}

.nav-text-col {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.nav-text-title {
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-text-desc {
  font-size: 10.5px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-badge-pill {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  background-color: var(--bg-surface-tertiary);
  color: var(--text-muted);
}

.vertical-nav-item.active .nav-badge-pill {
  background-color: var(--primary-600);
  color: #ffffff;
}

/* Nav Menu Group & Sub-Menu for Banking Schedules (Sheets 1 - 8) */
.nav-menu-group {
  display: flex;
  flex-direction: column;
  width: 100%;
}

.nav-chevron {
  font-size: 11px;
  color: var(--text-muted);
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  margin-left: 2px;
  flex-shrink: 0;
}

.nav-chevron.open {
  transform: rotate(180deg);
}

.vertical-nav-item.active .nav-chevron {
  color: var(--sidebar-active-text);
}

.nav-submenu {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 4px 0 6px 14px;
  padding-left: 10px;
  border-left: 2px solid var(--border-color);
  animation: fadeInSubmenu 0.2s ease;
}

[data-theme="dark"] .nav-submenu {
  border-left-color: rgba(56, 189, 248, 0.35);
}

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

.nav-submenu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6.5px 10px;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-secondary);
  border-radius: var(--radius-xs);
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: all 0.15s ease;
  font-family: inherit;
}

.nav-submenu-item:hover {
  background-color: var(--bg-surface-secondary);
  color: var(--text-main);
  transform: translateX(2px);
}

.nav-submenu-item.active {
  background-color: var(--primary-50);
  color: var(--primary-800);
  border-color: var(--primary-200);
  font-weight: 700;
}

[data-theme="dark"] .nav-submenu-item.active {
  background-color: rgba(2, 132, 199, 0.22);
  color: #38bdf8;
  border-color: rgba(56, 189, 248, 0.4);
}

.submenu-icon {
  font-size: 13px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
}

.submenu-text {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 11px;
}

.submenu-active-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--primary-600);
  flex-shrink: 0;
}

[data-theme="dark"] .submenu-active-dot {
  background-color: #38bdf8;
  box-shadow: 0 0 6px #38bdf8;
}

/* Sidebar Footer Summary Card */
.sidebar-summary-card {
  margin-top: 20px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background-color: var(--bg-surface-secondary);
  border: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sidebar-summary-title {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

.sidebar-metric-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11.5px;
}

.sidebar-metric-row strong {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  color: var(--text-main);
}

.sidebar-jump-btn {
  margin-top: 6px;
  width: 100%;
  padding: 7px 10px;
  font-size: 11px;
  font-weight: 700;
  border-radius: var(--radius-xs);
  border: 1px dashed var(--border-strong);
  background-color: transparent;
  color: var(--primary-600);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.15s ease;
}

[data-theme="dark"] .sidebar-jump-btn {
  color: #38bdf8;
}

.sidebar-jump-btn:hover {
  background-color: var(--bg-surface-tertiary);
  border-style: solid;
}

/* --------------------------------------------------------------------------
   Main Workspace Content Area
   -------------------------------------------------------------------------- */
.app-workspace {
  flex: 1;
  min-width: 0;
  padding: 20px 24px 60px 24px;
}

/* --------------------------------------------------------------------------
   KPI Summary Metric Cards Grid
   -------------------------------------------------------------------------- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.kpi-card {
  background-color: var(--kpi-bg);
  border: 1px solid var(--kpi-border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
  border-top: 3px solid var(--primary-600);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.kpi-card.highlight-emerald {
  border-top-color: var(--emerald-500);
}

.kpi-card.highlight-blue {
  border-top-color: var(--sky-500);
}

.kpi-card.highlight-amber {
  border-top-color: var(--amber-500);
}

.kpi-card.highlight-rose {
  border-top-color: var(--rose-500);
}

.kpi-card.highlight-indigo {
  border-top-color: var(--indigo-500);
}

.kpi-title {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--kpi-title);
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.kpi-icon {
  font-size: 14px;
  opacity: 0.8;
}

.kpi-value {
  font-size: 17.5px;
  font-weight: 800;
  color: var(--kpi-value);
  margin: 4px 0 6px 0;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.3px;
}

.kpi-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--radius-xs);
  width: fit-content;
  line-height: 1.3;
}

.kpi-badge.badge-success {
  background-color: var(--badge-emerald-bg);
  color: var(--badge-emerald-text);
  border: 1px solid var(--badge-emerald-border);
}

.kpi-badge.badge-warning {
  background-color: var(--badge-amber-bg);
  color: var(--badge-amber-text);
  border: 1px solid var(--badge-amber-border);
}

.kpi-badge.badge-danger {
  background-color: var(--badge-rose-bg);
  color: var(--badge-rose-text);
  border: 1px solid var(--badge-rose-border);
}

.kpi-badge.badge-info {
  background-color: var(--badge-blue-bg);
  color: var(--badge-blue-text);
  border: 1px solid var(--badge-blue-border);
}

.kpi-badge.badge-neutral,
.kpi-badge.badge-waiting {
  background-color: var(--bg-surface-tertiary);
  color: var(--text-muted);
  border: 1px solid var(--border-color);
  font-weight: 600;
}

/* --------------------------------------------------------------------------
   Cards, Panels & Content Blocks
   -------------------------------------------------------------------------- */
.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: 18px;
  overflow: hidden;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.panel-header {
  padding: 12px 18px;
  background-color: var(--bg-surface-secondary);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.panel-header h2 {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.panel-header .header-hint {
  font-size: 11.5px;
  color: var(--text-muted);
}

.panel-body {
  padding: 18px;
}

/* --------------------------------------------------------------------------
   Form Fields, Layouts & Grids
   -------------------------------------------------------------------------- */
.form-grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

.form-grid-4 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.form-group label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.form-group .label-hint {
  font-size: 11px;
  font-weight: 400;
  color: var(--text-muted);
}

.form-control {
  padding: 8px 12px;
  border: 1px solid var(--input-border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--input-text);
  background-color: var(--input-bg);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
  font-family: inherit;
  width: 100%;
}

.form-control:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--input-focus-ring);
}

.form-control[readonly],
.form-control[disabled] {
  background-color: var(--input-disabled-bg);
  color: var(--input-disabled-text);
  cursor: not-allowed;
}

.form-control.numeric-input {
  text-align: right;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

/* --------------------------------------------------------------------------
   Annual Capacity Utilization Progression Grid
   -------------------------------------------------------------------------- */
.capacity-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(95px, 1fr));
  gap: 10px;
  margin-top: 8px;
}

.capacity-item {
  background-color: var(--bg-surface-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  text-align: center;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.capacity-item:hover {
  border-color: var(--border-focus);
  transform: translateY(-1px);
}

.capacity-item .cap-year {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.capacity-item input {
  width: 100%;
  text-align: center;
  font-size: 13px;
  font-weight: 800;
  color: var(--text-main);
  background-color: var(--input-bg);
  padding: 4px 6px;
  border: 1px solid var(--input-border);
  border-radius: var(--radius-xs);
  font-family: var(--font-mono);
}

.capacity-item input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 2px var(--input-focus-ring);
}

/* --------------------------------------------------------------------------
   Financial Tables (High-Density, Sticky Headers, Formatted)
   -------------------------------------------------------------------------- */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--table-border);
}

.fin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  background-color: var(--table-bg);
}

.fin-table th,
.fin-table td {
  padding: 8px 12px;
  border: 1px solid var(--table-border);
  white-space: nowrap;
  color: var(--table-td-text);
}

.fin-table thead th {
  background-color: var(--table-th-bg);
  color: var(--table-th-text);
  font-weight: 700;
  text-align: left;
  position: sticky;
  top: 0;
  z-index: 5;
  border-bottom: 2px solid var(--table-th-border);
  font-size: 11.5px;
  letter-spacing: 0.2px;
}

.fin-table th.num-col,
.fin-table td.num-col {
  text-align: right;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.fin-table tbody tr:hover {
  background-color: var(--table-row-hover);
}

.fin-table tr.row-subheading {
  background-color: var(--table-row-subheading);
  font-weight: 700;
  color: var(--table-row-subheading-text);
  letter-spacing: 0.3px;
}

.fin-table tr.row-subheading td {
  color: var(--table-row-subheading-text);
}

.fin-table tr.row-total {
  background-color: var(--table-row-total);
  font-weight: 700;
  color: var(--table-row-total-text);
  border-top: 2px solid var(--table-row-total-border);
  border-bottom: 2px solid var(--table-row-total-border);
}

.fin-table tr.row-total td {
  color: var(--table-row-total-text);
}

.fin-table tr.row-pat {
  background-color: var(--table-row-pat);
  font-weight: 700;
  color: var(--table-row-pat-text);
  border-top: 2px solid var(--table-row-pat-border);
  border-bottom: 2px solid var(--table-row-pat-border);
}

.fin-table tr.row-pat td {
  color: var(--table-row-pat-text);
}

.fin-table tr.row-accent {
  background-color: var(--table-row-accent);
  font-weight: 600;
  color: var(--table-row-accent-text);
}

.fin-table tr.row-accent td {
  color: var(--table-row-accent-text);
}

.table-input {
  width: 100%;
  padding: 4px 8px;
  border: 1px solid var(--input-border);
  border-radius: var(--radius-xs);
  font-size: 12px;
  color: var(--input-text);
  background-color: var(--input-bg);
  font-family: inherit;
  transition: border-color 0.15s ease;
}

.table-input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 2px var(--input-focus-ring);
}

.table-input.num {
  text-align: right;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

/* Action button inside tables */
.btn-row-action {
  background: none;
  border: none;
  cursor: pointer;
  padding: 3px 6px;
  border-radius: var(--radius-xs);
  font-size: 12px;
  color: var(--text-muted);
  transition: all 0.15s ease;
}

.btn-row-action:hover {
  background-color: var(--badge-rose-bg);
  color: var(--rose-600);
}

/* --------------------------------------------------------------------------
   Worksheet Sub-Tab Pill Bar (Sheets 1 - 8)
   -------------------------------------------------------------------------- */
.sheet-pills-bar {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.sheet-pills-bar::-webkit-scrollbar {
  height: 4px;
}

.sheet-pills-bar::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: var(--radius-full);
}

.sheet-pill {
  padding: 6px 14px;
  border-radius: var(--radius-full);
  border: 1px solid var(--sheet-pill-border);
  background-color: var(--sheet-pill-bg);
  color: var(--sheet-pill-text);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.sheet-pill:hover {
  background-color: var(--sheet-pill-hover-bg);
  color: var(--text-main);
  border-color: var(--border-strong);
}

.sheet-pill.active {
  background-color: var(--sheet-pill-active-bg);
  border-color: var(--sheet-pill-active-bg);
  color: var(--sheet-pill-active-text);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

/* --------------------------------------------------------------------------
   Visual Financial Progress / Proportion Bars
   -------------------------------------------------------------------------- */
.finance-split-container {
  margin: 16px 0;
  padding: 14px 16px;
  background-color: var(--bg-surface-secondary);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

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

.finance-split-bar {
  display: flex;
  height: 12px;
  width: 100%;
  border-radius: var(--radius-full);
  overflow: hidden;
  background-color: var(--bg-surface-tertiary);
}

.split-segment-loan {
  background: linear-gradient(90deg, #0284c7, #38bdf8);
  height: 100%;
  transition: width 0.3s ease;
}

.split-segment-margin {
  background: linear-gradient(90deg, #d97706, #fbbf24);
  height: 100%;
  transition: width 0.3s ease;
}

.finance-split-legend {
  display: flex;
  gap: 20px;
  margin-top: 8px;
  font-size: 11.5px;
  color: var(--text-muted);
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.legend-dot.loan {
  background-color: #0284c7;
}

.legend-dot.margin {
  background-color: #d97706;
}

/* --------------------------------------------------------------------------
   Live Feasibility Suggestions / Advisor Card (Capital Outlay & Operating)
   -------------------------------------------------------------------------- */
.feasibility-advisor-card {
  margin: 16px 0 20px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background-color: var(--bg-surface);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.feasibility-advisor-card.status-feasible {
  border-left: 4px solid var(--badge-emerald-text);
}

.feasibility-advisor-card.status-warning {
  border-left: 4px solid var(--badge-amber-text);
}

.feasibility-advisor-card.status-critical {
  border-left: 4px solid var(--badge-rose-text);
}

.feasibility-advisor-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px 16px;
  background-color: var(--bg-surface-secondary);
  border-bottom: 1px solid var(--border-color);
}

.feasibility-advisor-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-main);
}

.feasibility-advisor-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.feasibility-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 700;
  font-family: var(--font-mono);
}

.feasibility-pill.ok {
  background-color: var(--badge-emerald-bg);
  color: var(--badge-emerald-text);
  border: 1px solid var(--badge-emerald-border);
}

.feasibility-pill.warn {
  background-color: var(--badge-amber-bg);
  color: var(--badge-amber-text);
  border: 1px solid var(--badge-amber-border);
}

.feasibility-pill.bad {
  background-color: var(--badge-rose-bg);
  color: var(--badge-rose-text);
  border: 1px solid var(--badge-rose-border);
}

.feasibility-advisor-list {
  list-style: none;
  margin: 0;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.feasibility-suggestion-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background-color: var(--bg-surface-secondary);
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--text-secondary);
}

.feasibility-suggestion-item.severity-critical {
  background-color: var(--badge-rose-bg);
  border-color: var(--badge-rose-border);
}

.feasibility-suggestion-item.severity-warning {
  background-color: var(--badge-amber-bg);
  border-color: var(--badge-amber-border);
}

.feasibility-suggestion-item.severity-success {
  background-color: var(--badge-emerald-bg);
  border-color: var(--badge-emerald-border);
}

.feasibility-suggestion-item.severity-info {
  background-color: var(--badge-blue-bg);
  border-color: var(--badge-blue-border);
}

.feasibility-suggestion-icon {
  font-size: 15px;
  line-height: 1.2;
  flex-shrink: 0;
}

.feasibility-suggestion-body strong {
  color: var(--text-main);
  display: block;
  margin-bottom: 2px;
}

/* --------------------------------------------------------------------------
   Live Report Preview Section at the Bottom
   -------------------------------------------------------------------------- */
.live-report-preview-section {
  margin-top: 40px;
  border-top: 4px solid var(--primary-600);
  border-radius: var(--radius-md);
  background-color: var(--bg-surface);
  border-left: 1px solid var(--border-color);
  border-right: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.live-preview-banner {
  padding: 14px 20px;
  background: linear-gradient(135deg, var(--bg-surface-secondary) 0%, var(--bg-surface) 100%);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.live-report-preview-section.is-hidden-preview {
  display: none;
}

.live-preview-title h3 {
  font-size: 14.5px;
  font-weight: 800;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.live-preview-title p {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 2px;
}

.live-preview-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Full Report Document (Used for both Live Preview and Printing) */
.full-printable-report {
  background-color: var(--bg-surface);
  padding: 32px 36px;
}

.report-bank-header {
  text-align: center;
  border-bottom: 2px double var(--border-strong);
  padding-bottom: 16px;
  margin-bottom: 22px;
}

.report-header-flex {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  margin-bottom: 6px;
}

.report-header-logo-container {
  width: 58px;
  height: 58px;
  background: #ffffff;
  padding: 4px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.report-header-logo {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.report-header-text {
  text-align: center;
}

.report-bank-header .bank-name {
  font-size: 19px;
  font-weight: 800;
  color: var(--text-main);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.report-bank-header .bank-sub {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-top: 3px;
}

.report-bank-header .report-title {
  font-size: 14.5px;
  font-weight: 800;
  color: var(--primary-700);
  margin-top: 8px;
  letter-spacing: 0.5px;
}

[data-theme="dark"] .report-bank-header .report-title {
  color: #38bdf8;
}

.report-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 10px 20px;
  background-color: var(--bg-surface-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-bottom: 22px;
}

.report-meta-item {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  padding: 2px 0;
}

.report-meta-item .meta-label {
  font-weight: 600;
  color: var(--text-muted);
}

.report-meta-item .meta-val {
  font-weight: 700;
  color: var(--text-main);
  font-family: var(--font-mono);
}

.report-section {
  margin-bottom: 26px;
}

.report-section h3 {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
  border-left: 4px solid var(--primary-600);
  padding-left: 10px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.report-section h3 .sheet-tag {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.report-signatures {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-top: 45px;
  padding-top: 16px;
  text-align: center;
}

.signature-box {
  border-top: 1px solid var(--border-strong);
  padding-top: 8px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-secondary);
}

.signature-role {
  font-size: 10.5px;
  color: var(--text-muted);
  font-weight: 500;
  margin-top: 3px;
}

/* Page Break Divider for Screen & Print */
.report-page-break {
  margin: 30px 0 20px 0;
  border-top: 1px dashed var(--border-color);
}

/* --------------------------------------------------------------------------
   App Splash Screen (Pre-hydration initial state)
   -------------------------------------------------------------------------- */
.app-splash-container {
  min-height: 80vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  text-align: center;
  padding: 40px;
}

.app-splash-logo {
  width: 64px;
  height: 64px;
  object-fit: contain;
  margin-bottom: 16px;
  border-radius: 12px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}

.app-splash-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 6px;
  letter-spacing: -0.2px;
}

.app-splash-desc {
  font-size: 13px;
  opacity: 0.7;
  max-width: 400px;
  margin: 0 auto;
}

/* --------------------------------------------------------------------------
   Component Layout & Semantic Utility Classes (Replaces inline styles)
   -------------------------------------------------------------------------- */
.app-loading-state {
  padding: 40px;
  text-align: center;
  font-family: inherit;
}

.text-truncate-header {
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.text-hint-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

.font-semibold {
  font-weight: 600;
}

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

.bank-brand-title {
  font-weight: 800;
  font-size: 13px;
}

.mt-4 {
  margin-top: 18px;
}

.mt-3 {
  margin-top: 14px;
}

.mt-2 {
  margin-top: 12px;
}

.mr-2 {
  margin-right: 6px;
}

.sidebar-search-box-wrap {
  position: relative;
  margin-bottom: 12px;
}

.sidebar-search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 13px;
  pointer-events: none;
  opacity: 0.6;
}

.sidebar-nav-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.metric-emerald {
  color: var(--emerald-600) !important;
}

.metric-rose {
  color: var(--rose-600) !important;
}

.preset-buttons-wrap {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

.btn-preset-action {
  padding: 3px 8px;
  font-size: 11px;
  color: inherit;
  border-color: var(--border-strong);
  background: var(--bg-surface-secondary);
}

.table-col-sl {
  width: 40px;
}

.table-col-num-lg {
  width: 220px;
}

.table-col-idx {
  width: 30px;
}

.table-col-head {
  width: 160px;
}

.table-col-val {
  width: 140px;
}

.table-col-cost-type {
  width: 110px;
}

.table-col-calc-type {
  width: 130px;
}

.table-col-pct {
  width: 90px;
}

.table-col-action {
  width: 40px;
}

.table-text-right {
  text-align: right;
}

.table-text-center {
  text-align: center;
}

.particulars-filter-wrap {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.particulars-pills-wrap {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.btn-category-pill {
  padding: 3px 8px;
  font-size: 10.5px;
  border-color: var(--border-strong);
}

.btn-category-active {
  color: #ffffff !important;
  background-color: var(--primary-600) !important;
}

.btn-category-inactive {
  color: inherit;
  background-color: var(--bg-surface-secondary);
}

.particulars-search-input {
  width: 160px;
  padding: 4px 8px;
  font-size: 11px;
}

.particulars-add-actions {
  margin-top: 14px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.btn-row-add {
  color: inherit;
  border-color: var(--border-strong);
  background: var(--bg-surface-secondary);
}

.table-max-w-tax {
  max-width: 650px;
}

.table-max-w-wc {
  max-width: 720px;
}

.table-max-w-repay {
  max-width: 780px;
}

.dscr-summary-box {
  margin-top: 20px;
  padding: 16px;
  background: var(--bg-surface-secondary);
  border-radius: 8px;
  border: 1px solid var(--border-color);
}

.dscr-summary-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
}

.dscr-summary-metrics {
  margin-top: 8px;
  display: flex;
  gap: 20px;
  font-size: 13px;
  flex-wrap: wrap;
}

.irr-pct-callout {
  color: var(--emerald-600);
  font-size: 13px;
}

.panel-card-mb {
  margin-bottom: 20px;
}

.audit-controls-wrap {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.audit-guide-text {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.sensitivity-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
}

.table-footnote-muted {
  text-align: center;
  font-size: 10px;
  color: var(--text-muted);
}

.irr-highlight-badge {
  color: var(--emerald-600);
  font-size: 12px;
}

.hidden-file-input {
  display: none;
}

.modal-header-icon-save {
  font-size: 22px;
}

.modal-header-icon-folder {
  font-size: 24px;
}

.modal-title-save {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}

.modal-title-folder {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
}

.modal-subtitle {
  font-size: 12px;
  opacity: 0.7;
  margin-top: 2px;
}

.modal-form-group-mb {
  margin-bottom: 16px;
}

.save-title-label {
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 6px;
  display: block;
}

.required-star {
  color: var(--rose-500);
}

.save-title-input {
  width: 100%;
  padding: 9px 12px;
  font-size: 14px;
}

.save-modal-summary {
  background: var(--bg-surface-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 16px;
}

.save-modal-summary-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 6px;
  font-weight: 700;
}

.save-modal-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 8px;
  font-size: 12px;
}

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

.modal-actions-wrap {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.btn-modal-action-secondary {
  padding: 8px 14px;
  background: var(--bg-surface-secondary);
  color: inherit;
  border-color: var(--border-strong);
}

.database-templates-container {
  margin-bottom: 20px;
  padding: 16px;
  background: var(--bg-surface-secondary);
  border-radius: 8px;
  border: 1px solid var(--border-color);
}

.database-templates-title {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 6px;
}

.database-templates-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
}

.database-template-card {
  padding: 14px;
  background: var(--bg-surface);
  border-radius: 8px;
  border: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.database-template-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 6px;
}

.database-template-name {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
}

.database-template-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: var(--radius-full);
  background: rgba(16, 185, 129, 0.12);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.28);
  white-space: nowrap;
}

.database-template-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin: 0 0 12px 0;
  line-height: 1.4;
}

.database-template-footer {
  margin-top: auto;
}

.database-template-btn {
  width: 100%;
  justify-content: center;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
}

.btn-modal-action-default {
  padding: 8px 14px;
}

.btn-modal-action-primary {
  padding: 8px 18px;
  font-weight: 700;
}

.modal-body-padded {
  padding: 16px 20px;
}

.btn-saved-filter {
  background: var(--bg-surface-secondary);
  color: inherit;
  border-color: var(--border-strong);
}

.search-field-hint {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
}

.auto-save-status-text {
  font-size: 11px;
  color: var(--emerald-600);
  font-weight: 600;
}

.empty-state-icon-lg {
  font-size: 32px;
  margin-bottom: 8px;
}

.empty-state-icon-xl {
  font-size: 36px;
  margin-bottom: 8px;
}

.empty-state-heading {
  margin: 0 0 6px 0;
  font-size: 15px;
}

.empty-state-text {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
}

.empty-state-text-max {
  margin: 0 0 16px 0;
  font-size: 13px;
  color: var(--text-muted);
  max-width: 420px;
}

.btn-empty-clear {
  margin-top: 12px;
  padding: 5px 12px;
  font-size: 12px;
}

.btn-empty-create {
  padding: 8px 16px;
  font-weight: 600;
}

.saved-item-info-col {
  flex: 1;
  min-width: 0;
}

.saved-item-header-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.saved-item-product-span {
  margin-left: 8px;
}

.modal-footer-wrap {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px 20px;
  border-top: 1px solid var(--border-color);
  background: var(--bg-surface-secondary);
}

.modal-footer-hint {
  font-size: 12px;
  color: var(--text-muted);
}

.btn-modal-close-footer {
  padding: 6px 16px;
  background: var(--bg-surface);
  border-color: var(--border-strong);
  color: inherit;
}

/* --------------------------------------------------------------------------
   App Splash Screen (Pre-hydration initial state)
   -------------------------------------------------------------------------- */
.app-splash-container {
  min-height: 80vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  text-align: center;
  padding: 40px;
}

.app-splash-logo {
  width: 64px;
  height: 64px;
  object-fit: contain;
  margin-bottom: 16px;
  border-radius: 12px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}

.app-splash-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 6px;
  letter-spacing: -0.2px;
}

.app-splash-desc {
  font-size: 13px;
  opacity: 0.7;
  max-width: 400px;
  margin: 0 auto;
}

/* --------------------------------------------------------------------------
   Component Layout & Semantic Utility Classes (Replaces inline styles)
   -------------------------------------------------------------------------- */
.app-loading-state {
  padding: 40px;
  text-align: center;
  font-family: inherit;
}

.text-truncate-header {
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.text-hint-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

.font-semibold {
  font-weight: 600;
}

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

.bank-brand-title {
  font-weight: 800;
  font-size: 13px;
}

.mt-4 {
  margin-top: 18px;
}

.mt-3 {
  margin-top: 14px;
}

.mt-2 {
  margin-top: 12px;
}

.mr-2 {
  margin-right: 6px;
}

.sidebar-search-box-wrap {
  position: relative;
  margin-bottom: 12px;
}

.sidebar-search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 13px;
  pointer-events: none;
  opacity: 0.6;
}

.sidebar-nav-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.metric-emerald {
  color: var(--emerald-600) !important;
}

.metric-rose {
  color: var(--rose-600) !important;
}

.preset-buttons-wrap {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

.btn-preset-action {
  padding: 3px 8px;
  font-size: 11px;
  color: inherit;
  border-color: var(--border-strong);
  background: var(--bg-surface-secondary);
}

.table-col-sl {
  width: 40px;
}

.table-col-num-lg {
  width: 220px;
}

.table-col-idx {
  width: 30px;
}

.table-col-head {
  width: 160px;
}

.table-col-val {
  width: 140px;
}

.table-col-cost-type {
  width: 110px;
}

.table-col-calc-type {
  width: 130px;
}

.table-col-pct {
  width: 90px;
}

.table-col-action {
  width: 40px;
}

.table-text-right {
  text-align: right;
}

.table-text-center {
  text-align: center;
}

.particulars-filter-wrap {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.particulars-pills-wrap {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.btn-category-pill {
  padding: 3px 8px;
  font-size: 10.5px;
  border-color: var(--border-strong);
}

.btn-category-active {
  color: #ffffff !important;
  background-color: var(--primary-600) !important;
}

.btn-category-inactive {
  color: inherit;
  background-color: var(--bg-surface-secondary);
}

.particulars-search-input {
  width: 160px;
  padding: 4px 8px;
  font-size: 11px;
}

.particulars-add-actions {
  margin-top: 14px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.btn-row-add {
  color: inherit;
  border-color: var(--border-strong);
  background: var(--bg-surface-secondary);
}

.table-max-w-tax {
  max-width: 650px;
}

.table-max-w-wc {
  max-width: 720px;
}

.table-max-w-repay {
  max-width: 780px;
}

.dscr-summary-box {
  margin-top: 20px;
  padding: 16px;
  background: var(--bg-surface-secondary);
  border-radius: 8px;
  border: 1px solid var(--border-color);
}

.dscr-summary-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
}

.dscr-summary-metrics {
  margin-top: 8px;
  display: flex;
  gap: 20px;
  font-size: 13px;
  flex-wrap: wrap;
}

.irr-pct-callout {
  color: var(--emerald-600);
  font-size: 13px;
}

.panel-card-mb {
  margin-bottom: 20px;
}

.audit-controls-wrap {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.audit-guide-text {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.sensitivity-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
}

.table-footnote-muted {
  text-align: center;
  font-size: 10px;
  color: var(--text-muted);
}

.irr-highlight-badge {
  color: var(--emerald-600);
  font-size: 12px;
}

.hidden-file-input {
  display: none;
}

.modal-header-icon-save {
  font-size: 22px;
}

.modal-header-icon-folder {
  font-size: 24px;
}

.modal-title-save {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}

.modal-title-folder {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
}

.modal-subtitle {
  font-size: 12px;
  opacity: 0.7;
  margin-top: 2px;
}

.modal-form-group-mb {
  margin-bottom: 16px;
}

.save-title-label {
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 6px;
  display: block;
}

.required-star {
  color: var(--rose-500);
}

.save-title-input {
  width: 100%;
  padding: 9px 12px;
  font-size: 14px;
}

.save-modal-summary {
  background: var(--bg-surface-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 16px;
}

.save-modal-summary-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 6px;
  font-weight: 700;
}

.save-modal-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 8px;
  font-size: 12px;
}

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

.modal-actions-wrap {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.btn-modal-action-secondary {
  padding: 8px 14px;
  background: var(--bg-surface-secondary);
  color: inherit;
  border-color: var(--border-strong);
}

/* --------------------------------------------------------------------------
   Authentication: Login Page & Form Styles
   -------------------------------------------------------------------------- */
.login-page-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background: var(--bg-body);
}

.login-card {
  width: 100%;
  max-width: 440px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  padding: 32px 28px;
}

.login-header {
  text-align: center;
  margin-bottom: 24px;
}

.login-logo {
  width: 72px;
  height: 72px;
  object-fit: contain;
  margin: 0 auto 12px;
  display: block;
}

.login-title {
  font-size: 19px;
  font-weight: 700;
  color: var(--text-main);
  margin: 0 0 6px 0;
  line-height: 1.3;
}

.login-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0;
}

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

.login-form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.login-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
}

.login-input {
  width: 100%;
  padding: 10px 14px;
  font-size: 14px;
  background: var(--bg-surface-secondary);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  outline: none;
  transition: border-color 0.15s ease;
}

.login-input:focus {
  border-color: var(--primary-500);
}

.login-submit-btn {
  margin-top: 8px;
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 600;
  width: 100%;
  border-radius: 8px;
  justify-content: center;
}

.login-error-alert {
  padding: 10px 14px;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.28);
  border-radius: 8px;
  color: #f87171;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.login-error-alert.login-success-alert {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.35);
  color: #10b981;
}

.login-hint-box {
  margin-top: 24px;
  padding: 12px 14px;
  background: var(--bg-surface-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 12px;
}

.login-hint-title {
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--text-main);
}

.login-hint-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 4px;
  color: var(--text-muted);
}

.login-hint-btn {
  background: none;
  border: none;
  color: var(--primary-500);
  cursor: pointer;
  padding: 0;
  font-size: 11px;
  text-decoration: underline;
}

/* --------------------------------------------------------------------------
   Dashboard & Home Screens (SuperAdmin & User Home)
   -------------------------------------------------------------------------- */
.dashboard-page-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px 20px;
}

.dashboard-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
}

.dashboard-title-group h2 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-main);
  margin: 0 0 4px 0;
}

.dashboard-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0;
}

.dashboard-user-badge-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.dashboard-user-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  background: var(--bg-surface-secondary);
  border: 1px solid var(--border-color);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
}

/* User Menu Dropdown Trigger & Popover Card */
.user-menu-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.dashboard-user-pill.user-menu-trigger {
  cursor: pointer;
  outline: none;
  font-family: inherit;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  -webkit-user-select: none;
  user-select: none;
}

.dashboard-user-pill.user-menu-trigger:hover {
  background: var(--bg-surface-tertiary);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.dashboard-user-pill.user-menu-trigger:active,
.dashboard-user-pill.user-menu-trigger.active {
  background: var(--bg-surface-tertiary);
  border-color: var(--primary-500);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.user-menu-caret {
  font-size: 8px;
  opacity: 0.65;
  margin-left: 2px;
  transition: transform 0.2s ease;
}

.user-menu-trigger.active .user-menu-caret {
  transform: rotate(180deg);
}

/* User Menu Dropdown Card */
.user-menu-dropdown-card {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 280px;
  max-width: 320px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl), 0 14px 28px -4px rgba(0, 0, 0, 0.25);
  padding: 8px 0;
  z-index: 1000;
  animation: userMenuDropdownSlide 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  transform-origin: top right;
}

@keyframes userMenuDropdownSlide {
  from {
    opacity: 0;
    transform: translateY(-8px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.user-menu-profile-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px 12px;
}

.user-menu-avatar-large {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg-surface-secondary);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.user-menu-details {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  text-align: left;
}

.user-menu-fullname {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-menu-email {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-menu-role-chip {
  align-self: flex-start;
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 4px;
  font-weight: 700;
  text-transform: uppercase;
}

.user-menu-divider {
  height: 1px;
  background: var(--border-color);
  margin: 6px 0;
}

.user-menu-action-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 10px 16px;
  background: transparent;
  border: none;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s ease;
  font-family: inherit;
  color: inherit;
}

.user-menu-action-row:hover,
.user-menu-action-row:focus-visible {
  background: var(--bg-surface-secondary);
}

.user-menu-action-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-menu-action-icon {
  font-size: 17px;
  width: 24px;
  text-align: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.user-menu-action-text {
  display: flex;
  flex-direction: column;
}

.user-menu-action-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
}

.user-menu-action-desc {
  font-size: 11px;
  color: var(--text-muted);
}

.user-menu-action-danger:hover {
  background: rgba(239, 68, 68, 0.08);
}

.user-menu-action-danger:hover .user-menu-action-title {
  color: #ef4444;
}

.user-menu-action-danger .user-menu-action-title {
  color: #ef4444;
}

.user-menu-status-badge {
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: rgba(124, 58, 237, 0.15);
  color: #8b5cf6;
  border: 1px solid rgba(139, 92, 246, 0.35);
  animation: pulse-pwa 2.5s infinite;
}

.role-tag-super {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(139, 92, 246, 0.15);
  color: #a78bfa;
  font-weight: 700;
  text-transform: uppercase;
}

.role-tag-user {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  font-weight: 700;
  text-transform: uppercase;
}

.status-tag-active {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  font-weight: 600;
}

.status-tag-suspended {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  font-weight: 600;
}

.dashboard-controls-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.dashboard-search-container {
  flex: 1;
  min-width: 280px;
  position: relative;
}

.dashboard-search-input {
  width: 100%;
  padding: 10px 14px 10px 38px;
  font-size: 14px;
  background: var(--bg-surface);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  outline: none;
}

.dashboard-search-input:focus {
  border-color: var(--primary-500);
}

.dashboard-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  color: var(--text-muted);
  pointer-events: none;
}

.dashboard-kpi-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.dashboard-kpi-item {
  padding: 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 8px;
}

.dashboard-kpi-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 2px;
}

.dashboard-kpi-label {
  font-size: 12px;
  color: var(--text-muted);
}

/* User Management Table */
.admin-table-container {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  overflow: hidden;
}

.admin-users-table {
  width: 100%;
  border-collapse: collapse;
}

.admin-users-table th {
  background: var(--bg-surface-secondary);
  padding: 12px 14px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.admin-users-table td {
  padding: 12px 14px;
  font-size: 13px;
  color: var(--text-main);
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}

.admin-users-table tr:hover {
  background: var(--bg-surface-secondary);
}

.user-actions-cell {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.btn-user-action {
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-user-action:hover {
  border-color: var(--primary-500);
  color: var(--primary-500);
}

.btn-action-suspend {
  border-color: rgba(239, 68, 68, 0.3);
  color: #f87171;
}

.btn-action-suspend:hover {
  background: rgba(239, 68, 68, 0.1);
  border-color: #ef4444;
  color: #ef4444;
}

.btn-action-activate {
  border-color: rgba(16, 185, 129, 0.3);
  color: #34d399;
}

.btn-action-activate:hover {
  background: rgba(16, 185, 129, 0.1);
  border-color: #10b981;
  color: #10b981;
}

.btn-back-home {
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
}

/* --------------------------------------------------------------------------
   Print Stylesheet (@media print) - Strict Black & White Archival Banking PDF
   Prints ONLY the Complete 8-Worksheet Report Document
   -------------------------------------------------------------------------- */
@media print {
  @page {
    size: A4 landscape;
    margin: 14mm;
  }

  *,
  *::before,
  *::after {
    background: transparent !important;
    color: #000000 !important;
    box-shadow: none !important;
    text-shadow: none !important;
  }

  html,
  body {
    width: 100% !important;
    max-width: 100% !important;
    background-color: #ffffff !important;
    font-family: 'Helvetica Neue', Arial, sans-serif !important;
    font-size: 8pt !important;
    color: #000000 !important;
    margin: 0 !important;
    padding: 0 !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  /* Completely HIDE application frame, sidebar, active input panels, buttons */
  .app-header,
  .floating-actions-window-bar,
  .app-sidebar,
  .mobile-backdrop,
  .kpi-grid,
  .active-tab-panel,
  .live-preview-banner,
  .theme-toggle-btn,
  .header-status-actions,
  .btn-row-action,
  .finance-split-container,
  .feasibility-advisor-card,
  .mobile-swipe-hint,
  .report-page-break,
  button,
  input,
  select {
    display: none !important;
  }

  .app-layout {
    display: block !important;
    max-width: 100% !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .app-workspace {
    padding: 0 !important;
    margin: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    display: block !important;
  }

  .live-report-preview-section {
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    box-shadow: none !important;
    width: 100% !important;
    max-width: 100% !important;
    overflow: visible !important;
  }

  .live-report-preview-section.is-hidden-preview {
    display: block !important;
  }

  .full-printable-report {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
    box-sizing: border-box !important;
  }

  .report-bank-header {
    border-bottom: 1.5px solid #000000 !important;
    margin-bottom: 8px !important;
    padding-bottom: 6px !important;
  }

  .report-header-flex {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 14px !important;
  }

  .report-header-logo-container {
    width: 44px !important;
    height: 44px !important;
    background: #ffffff !important;
    border: 1px solid #000000 !important;
    padding: 2px !important;
    box-shadow: none !important;
    border-radius: 4px !important;
  }

  .report-header-logo {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;
    display: block !important;
  }

  .report-header-text {
    text-align: center !important;
  }

  .report-bank-header .bank-name {
    font-size: 13pt !important;
    font-weight: 800 !important;
    color: #000000 !important;
    line-height: 1.2 !important;
  }

  .report-bank-header .bank-sub {
    font-size: 7.5pt !important;
    color: #333333 !important;
    margin-top: 1px !important;
  }

  .report-bank-header .report-title {
    color: #000000 !important;
    font-size: 9.5pt !important;
    font-weight: 700 !important;
    margin-top: 3px !important;
    letter-spacing: 0.5px !important;
  }

  .full-printable-report .report-meta-grid {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 8px 16px !important;
    background: #f8fafc !important;
    border: 1px solid #94a3b8 !important;
    border-top: 2px solid #0f172a !important;
    margin-bottom: 12px !important;
    padding: 8px 12px !important;
    font-size: 7.5pt !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  .full-printable-report .report-meta-item {
    display: flex !important;
    flex-direction: column !important;
    justify-content: flex-start !important;
    align-items: flex-start !important;
    gap: 1px !important;
    padding: 2px 6px !important;
    border-left: 2px solid #cbd5e1 !important;
  }

  .full-printable-report .report-meta-item .meta-label {
    font-size: 6.5pt !important;
    font-weight: 600 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.3px !important;
    color: #475569 !important;
  }

  .full-printable-report .report-meta-item .meta-val {
    font-size: 8pt !important;
    font-weight: 700 !important;
    color: #0f172a !important;
  }

  /* Stack Sheet 7 & Sheet 8 vertically so each gets its own A4 landscape page */
  .sensitivity-grid {
    display: block !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .table-responsive,
  .fin-table-container {
    width: 100% !important;
    max-width: 100% !important;
    overflow: visible !important;
    margin-bottom: 6px !important;
    border: none !important;
  }

  .fin-table,
  .table-max-w-780 {
    width: 100% !important;
    max-width: 100% !important;
    font-family: 'Helvetica Neue', Arial, sans-serif !important;
    font-size: 6.5pt !important;
    border: 1px solid #000000 !important;
    border-collapse: collapse !important;
    table-layout: auto !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
    margin-bottom: 6px !important;
  }

  .fin-table th,
  .fin-table td {
    border: 1px solid #444444 !important;
    padding: 2.5px 3.5px !important;
    color: #000000 !important;
    line-height: 1.25 !important;
    vertical-align: middle !important;
    word-break: normal !important;
  }

  .fin-table th:first-child,
  .fin-table td:first-child {
    white-space: normal !important;
    max-width: 64mm !important;
  }

  .fin-table thead th {
    background-color: #efefef !important;
    color: #000000 !important;
    font-weight: bold !important;
    font-size: 6.5pt !important;
    text-align: center !important;
    white-space: normal !important;
  }

  .fin-table th.num-col,
  .fin-table td.num-col {
    text-align: right !important;
    font-family: 'Helvetica Neue', Arial, sans-serif !important;
    font-variant-numeric: tabular-nums !important;
    white-space: nowrap !important;
  }

  .fin-table tr {
    page-break-inside: avoid !important;
    break-inside: avoid !important;
    page-break-after: auto !important;
  }

  .fin-table tr.total-row td,
  .fin-table tr.grand-total td,
  .fin-table tr.highlight-row td,
  .fin-table tr.row-total td,
  .fin-table tr.row-accent td,
  .fin-table tr.row-pat td {
    font-weight: 700 !important;
    background-color: #f3f4f6 !important;
  }

  /* One sheet per A4 landscape page with clean alignment */
  .report-section {
    page-break-inside: avoid !important;
    break-inside: avoid !important;
    page-break-after: always !important;
    break-after: page !important;
    margin: 0 0 8px 0 !important;
    padding: 0 !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .report-section.report-last-sheet,
  .sensitivity-grid .report-section:last-child {
    page-break-after: auto !important;
    break-after: auto !important;
  }

  .report-section h3 {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    color: #000000 !important;
    border-left: 3px solid #000000 !important;
    border-bottom: 1px solid #cccccc !important;
    font-size: 9pt !important;
    padding: 2px 6px 3px 8px !important;
    margin: 0 0 6px 0 !important;
    text-transform: uppercase !important;
    font-weight: 700 !important;
  }

  .sheet-tag {
    border: 1px solid #000000 !important;
    padding: 1px 6px !important;
    font-size: 7pt !important;
    font-weight: 700 !important;
    border-radius: 3px !important;
  }

  .signature-grid {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 16px !important;
    margin-top: 16px !important;
    page-break-inside: avoid !important;
  }

  .signature-box {
    border-top: 1px solid #000000 !important;
    color: #000000 !important;
    padding-top: 6px !important;
    font-size: 7.5pt !important;
  }
}

/* --------------------------------------------------------------------------
   Mobile Navigation Controls & PWA Styles
   -------------------------------------------------------------------------- */
.mobile-nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background-color: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #ffffff;
  font-size: 18px;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.mobile-nav-toggle:hover {
  background-color: rgba(255, 255, 255, 0.22);
}

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

.mobile-drawer-header {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 0 4px 14px 4px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 14px;
}

.btn-drawer-close {
  background: none;
  border: none;
  font-size: 18px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px 10px;
  border-radius: var(--radius-xs);
}

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

.sidebar-mobile-actions {
  display: none;
}

.sidebar-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 9px 12px;
  font-size: 12px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background-color: var(--bg-surface);
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.15s ease;
}

.sidebar-action-btn:hover {
  background-color: var(--bg-surface-secondary);
}

.sidebar-action-btn.primary {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  border-color: #38bdf8;
  color: #ffffff;
}

.sidebar-action-btn.success {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  border-color: #34d399;
  color: #ffffff;
}

.sidebar-action-btn.pwa {
  background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);
  border-color: #c4b5fd;
  color: #ffffff;
}

.pwa-install-btn {
  background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);
  border-color: #a78bfa;
  color: #ffffff;
  animation: pulse-pwa 2.5s infinite;
}

@keyframes pulse-pwa {
  0% {
    box-shadow: 0 0 0 0 rgba(124, 58, 237, 0.5);
  }

  70% {
    box-shadow: 0 0 0 8px rgba(124, 58, 237, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(124, 58, 237, 0);
  }
}

.mobile-backdrop {
  display: none;
}

.mobile-swipe-hint {
  display: none;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  background-color: var(--bg-surface-secondary);
  padding: 5px 10px;
  border-radius: var(--radius-xs);
  margin-bottom: 6px;
  text-align: center;
  border: 1px dashed var(--border-color);
}

/* --------------------------------------------------------------------------
   Responsive Media Queries (Mobile & Tablet)
   -------------------------------------------------------------------------- */
@media (max-width: 900px) {
  .app-header {
    padding: 8px 14px;
    height: 56px;
  }

  .brand-wrapper {
    gap: 10px;
  }

  .mobile-nav-toggle {
    display: inline-flex;
  }

  .bank-logo-badge {
    width: 36px;
    height: 36px;
    padding: 2px;
  }

  .bank-emblem {
    width: 34px;
    height: 34px;
    font-size: 14px;
    border-radius: 6px;
  }

  .brand-titles h1 {
    font-size: 13.5px;
    letter-spacing: 0;
  }

  .brand-titles .sub-title {
    display: none;
  }

  .header-actions-desktop {
    display: none !important;
  }

  .theme-label-desktop {
    display: none;
  }

  .theme-toggle-btn {
    padding: 4px 8px;
  }

  .auto-save-badge span:not(.dot) {
    display: none;
  }

  .auto-save-badge {
    padding: 6px;
  }

  .mern-sync-badge span:not(.dot) {
    display: none;
  }

  .mern-sync-badge {
    padding: 6px;
  }

  /* Off-canvas Sliding Sidebar Drawer */
  .mobile-backdrop {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.65);
    -webkit-backdrop-filter: blur(3px);
    backdrop-filter: blur(3px);
    z-index: 999;
  }

  .app-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 290px;
    max-width: 85vw;
    height: 100vh;
    z-index: 1000;
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-xl);
    border-right: 1px solid var(--border-strong);
    padding: 16px 14px;
  }

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

  .mobile-drawer-header {
    display: flex;
  }

  .sidebar-mobile-actions {
    display: block;
  }

  .vertical-nav-item.active::before {
    left: -14px;
  }

  /* Workspace & Content on Mobile */
  .app-workspace {
    padding: 14px 12px 60px 12px;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-bottom: 16px;
  }

  .kpi-card {
    padding: 10px 12px;
  }

  .kpi-value {
    font-size: 15.5px;
  }

  .kpi-title {
    font-size: 9.5px;
  }

  .form-grid-3,
  .form-grid-4 {
    grid-template-columns: 1fr !important;
    gap: 12px;
  }

  .form-control {
    font-size: 14px;
    padding: 9px 12px;
  }

  .mobile-swipe-hint {
    display: block;
  }

  .table-responsive {
    border-radius: var(--radius-xs);
  }

  .fin-table th,
  .fin-table td {
    padding: 6px 8px;
    font-size: 11.5px;
  }

  .sheet-pills-bar {
    gap: 4px;
  }

  .sheet-pill {
    padding: 5px 10px;
    font-size: 11px;
  }

  .live-preview-banner {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding: 12px 14px;
  }

  .live-preview-actions {
    flex-direction: column;
    width: 100%;
  }

  .live-preview-actions button {
    width: 100%;
    justify-content: center;
  }

  .full-printable-report {
    padding: 16px 12px;
  }

  .report-bank-header .bank-name {
    font-size: 15px;
  }

  .report-bank-header .report-title {
    font-size: 12.5px;
  }

  .report-meta-grid {
    grid-template-columns: 1fr !important;
    gap: 8px;
    padding: 10px 12px;
  }

  .report-signatures {
    grid-template-columns: 1fr;
    gap: 24px;
  }
}

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

  .brand-titles h1 {
    font-size: 12px;
  }

  .capacity-row {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* --------------------------------------------------------------------------
   Saved Preparations, Search & Modal Styles
   -------------------------------------------------------------------------- */
.active-prep-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.35);
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  color: #10b981;
}

[data-theme="light"] .active-prep-badge {
  background: rgba(16, 185, 129, 0.18);
  border-color: rgba(5, 150, 105, 0.35);
  color: #047857;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeInModal 0.18s ease-out;
}

.modal-container {
  background: var(--bg-surface);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg, 12px);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: scaleInModal 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-container.modal-wide {
  max-width: 860px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-surface-secondary);
}

.modal-close-btn {
  background: transparent;
  border: none;
  font-size: 18px;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px 10px;
  border-radius: var(--radius-sm, 6px);
  transition: all 0.15s ease;
}

.modal-close-btn:hover {
  background: var(--bg-surface-tertiary);
  color: var(--text-main);
}

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

/* Saved files search controls */
.saved-files-controls-row {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.saved-files-search-wrap {
  position: relative;
  flex: 1;
  min-width: 250px;
  display: flex;
  align-items: center;
}

.search-icon-symbol {
  position: absolute;
  left: 12px;
  font-size: 14px;
  pointer-events: none;
  opacity: 0.6;
}

.saved-files-search-input {
  width: 100%;
  padding: 9px 34px 9px 34px;
  font-size: 13px;
  border-radius: var(--radius-md, 8px);
  border: 1px solid var(--border-strong);
  background: var(--input-bg);
  color: var(--input-text);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.saved-files-search-input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--input-focus-ring);
}

.search-clear-btn {
  position: absolute;
  right: 10px;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 13px;
  padding: 4px;
  border-radius: 4px;
}

.search-clear-btn:hover {
  color: var(--text-main);
}

.saved-files-top-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.saved-files-status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--text-muted);
  padding: 6px 2px 10px 2px;
  border-bottom: 1px solid var(--border-subtle);
  flex-wrap: wrap;
  gap: 6px;
}

.saved-files-list-container {
  margin-top: 12px;
  max-height: 52vh;
  overflow-y: auto;
  padding-right: 4px;
}

.saved-files-empty-state {
  text-align: center;
  padding: 45px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  color: var(--text-main);
}

.saved-files-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.saved-file-card {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md, 8px);
  padding: 14px 16px;
  background: var(--bg-surface);
  transition: all 0.15s ease;
}

.saved-file-card:hover {
  border-color: var(--primary-400);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.06);
}

.saved-file-card.is-active-card {
  border-color: var(--emerald-500);
  background: rgba(16, 185, 129, 0.05);
}

.saved-file-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 10px;
}

.saved-file-title {
  font-size: 14.5px;
  font-weight: 700;
  margin: 0;
  color: var(--text-main);
  letter-spacing: -0.2px;
}

.badge-active-file {
  font-size: 9.5px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  background: var(--emerald-600);
  color: #ffffff;
  letter-spacing: 0.5px;
}

.saved-file-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 3px;
  line-height: 1.4;
}

.saved-file-date {
  font-size: 11px;
  color: var(--text-light);
  white-space: nowrap;
}

.saved-file-card-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 8px;
  margin-bottom: 12px;
  padding: 8px 12px;
  background: var(--bg-surface-secondary);
  border-radius: 6px;
}

.metric-box {
  display: flex;
  flex-direction: column;
}

.metric-label {
  font-size: 10px;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.3px;
  font-weight: 600;
}

.metric-val {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-main);
  margin-top: 2px;
}

.saved-file-card-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

.btn-resume-action {
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 700;
  border-radius: var(--radius-sm, 6px);
  background: var(--primary-600);
  color: #ffffff;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.15s ease;
}

.btn-resume-action:hover {
  background: var(--primary-700);
}

.file-action-btn {
  padding: 5px 10px;
  font-size: 11.5px;
  font-weight: 600;
  border-radius: var(--radius-sm, 6px);
  background: var(--bg-surface-secondary);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  cursor: pointer;
  transition: all 0.15s ease;
}

.file-action-btn:hover {
  background: var(--bg-surface-tertiary);
  color: var(--text-main);
  border-color: var(--border-strong);
}

.file-action-btn.danger {
  color: var(--rose-600);
}

.file-action-btn.danger:hover {
  background: var(--rose-50);
  border-color: var(--rose-500);
}

/* Floating Toast Notification */
.toast-notification {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #0f2a4a;
  color: #ffffff;
  padding: 12px 18px;
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 600;
  z-index: 2000;
  animation: toastSlideUp 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  border-left: 4px solid var(--emerald-500);
}

.toast-notification.toast-info {
  border-left-color: var(--sky-500);
}

.toast-notification.toast-error {
  border-left-color: var(--rose-500);
}

.toast-icon {
  font-size: 15px;
}

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

@keyframes scaleInModal {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

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

@media (max-width: 640px) {
  .saved-files-controls-row {
    flex-direction: column;
    align-items: stretch;
  }

  .saved-files-search-wrap {
    min-width: 100%;
  }

  .saved-files-card-header {
    flex-direction: column;
  }

  .toast-notification {
    left: 16px;
    right: 16px;
    bottom: 16px;
  }
}

/* --------------------------------------------------------------------------
   Header Quick Search Bar & Saved Reports Dropdown
   -------------------------------------------------------------------------- */
.header-report-search-container {
  position: relative;
  width: 250px;
  flex-shrink: 0;
  margin: 0;
}

.header-btn.save-prep-btn {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.4) 0%, rgba(29, 78, 216, 0.55) 100%);
  border-color: rgba(96, 165, 250, 0.45);
  font-weight: 700;
}

.header-btn.save-prep-btn:hover {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.6) 0%, rgba(29, 78, 216, 0.75) 100%);
  border-color: #60a5fa;
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.4);
}

.header-report-search-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.header-report-search-icon {
  position: absolute;
  left: 10px;
  font-size: 13px;
  pointer-events: none;
  opacity: 0.7;
  color: #94a3b8;
}

.header-report-search-input {
  width: 100%;
  padding: 6px 30px 6px 32px;
  font-size: 12px;
  border-radius: var(--radius-full, 9999px);
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  outline: none;
  transition: all 0.2s ease;
}

.header-report-search-input::placeholder {
  color: rgba(255, 255, 255, 0.65);
}

.header-report-search-input:focus {
  background: rgba(255, 255, 255, 0.22);
  border-color: #38bdf8;
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.25);
}

.header-report-search-clear {
  position: absolute;
  right: 8px;
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.7);
  font-size: 12px;
  cursor: pointer;
  padding: 2px;
  border-radius: 50%;
}

.header-report-search-clear:hover {
  color: #ffffff;
}

/* Header Live Search Dropdown */
.header-report-search-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  left: auto;
  width: 440px;
  max-width: 90vw;
  background: var(--bg-surface);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  box-shadow: 0 16px 36px -4px rgba(0, 0, 0, 0.35);
  z-index: 500;
  overflow: hidden;
  animation: scaleInModal 0.15s ease-out;
}

.header-search-dropdown-title {
  padding: 9px 14px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: var(--bg-surface-secondary);
  border-bottom: 1px solid var(--border-subtle);
}

.header-search-loading {
  padding: 20px 14px;
  font-size: 13px;
  color: #38bdf8;
  font-weight: 600;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.search-dropdown-creator-pill {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 10.5px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: var(--radius-full, 9999px);
  background: rgba(147, 51, 234, 0.14);
  color: #c084fc;
  border: 1px solid rgba(147, 51, 234, 0.3);
  margin-right: 6px;
}

.header-search-no-results {
  padding: 16px 14px;
  font-size: 12.5px;
  color: var(--text-muted);
  text-align: center;
}

.header-search-dropdown-list {
  max-height: 280px;
  overflow-y: auto;
}

.header-search-dropdown-item {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: background 0.15s ease;
}

.header-search-dropdown-item:last-child {
  border-bottom: none;
}

.header-search-dropdown-item:hover {
  background: var(--sidebar-active-bg, #eff6ff);
}

.search-dropdown-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.search-dropdown-borrower {
  font-weight: 700;
  font-size: 13px;
  color: var(--text-main);
}

.search-dropdown-product {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--primary-600);
  background: rgba(37, 99, 235, 0.08);
  padding: 1px 7px;
  border-radius: 4px;
}

.search-dropdown-item-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
}

.search-dropdown-open-pill {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--emerald-600);
}

.header-search-dropdown-footer {
  padding: 9px 14px;
  font-size: 11.5px;
  font-weight: 600;
  text-align: center;
  background: var(--bg-surface-secondary);
  border-top: 1px solid var(--border-color);
  color: var(--primary-600);
  cursor: pointer;
  transition: background 0.15s ease;
}

.header-search-dropdown-footer:hover {
  background: var(--bg-surface-tertiary);
}

/* Sidebar Search Input */
.sidebar-search-container {
  margin-bottom: 12px;
}

.sidebar-search-input {
  width: 100%;
  padding: 7px 12px 7px 30px;
  font-size: 12px;
  border-radius: var(--radius-sm, 6px);
  border: 1px solid var(--border-strong);
  background: var(--input-bg);
  color: var(--input-text);
  outline: none;
  transition: border-color 0.15s;
}

.sidebar-search-input:focus {
  border-color: var(--border-focus);
}

/* Saved Search Filter Pills in Modal */
.saved-search-filter-pills {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.search-filter-pill {
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  border-radius: var(--radius-full, 9999px);
  border: 1px solid var(--border-strong);
  background: var(--bg-surface-secondary);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.search-filter-pill:hover {
  background: var(--bg-surface-tertiary);
  color: var(--text-main);
}

.search-filter-pill.active {
  background: var(--primary-600);
  color: #ffffff;
  border-color: var(--primary-600);
}

/* Match Highlight */
.highlight-search-match {
  background: rgba(245, 158, 11, 0.2);
  color: var(--text-main);
  padding: 1px 4px;
  border-radius: 3px;
  border-bottom: 2px solid #f59e0b;
}


/* Live Recalculation Badge - Hidden per user request */
.live-recalc-pill {
  display: none !important;
}

/* Required Field Indicator */
.field-required {
  color: #ef4444;
  margin-left: 3px;
  font-weight: 700;
}

/* Refresh / Recalculate Button Styling */
.header-btn.btn-refresh-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: #ffffff;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.header-btn.btn-refresh-action:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.38);
  color: #38bdf8;
  transform: translateY(-1px);
}

/* Light Mode High Contrast Visibility for Refresh Button and Panel Action Buttons */
[data-theme="light"] .header-btn.btn-refresh-action,
[data-theme="light"] .live-preview-actions .header-btn:not(.primary-action):not(.success-action),
[data-theme="light"] .audit-controls-wrap .header-btn:not(.primary-action):not(.success-action),
[data-theme="light"] .live-preview-banner .header-btn:not(.primary-action):not(.success-action),
[data-theme="light"] .panel-card .header-btn:not(.primary-action):not(.success-action):not(.save-prep-btn),
[data-theme="light"] .saved-files-top-actions .header-btn:not(.primary-action):not(.success-action) {
  background-color: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  color: #0f172a !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .header-btn.btn-refresh-action:hover,
[data-theme="light"] .live-preview-actions .header-btn:not(.primary-action):not(.success-action):hover,
[data-theme="light"] .audit-controls-wrap .header-btn:not(.primary-action):not(.success-action):hover,
[data-theme="light"] .live-preview-banner .header-btn:not(.primary-action):not(.success-action):hover,
[data-theme="light"] .panel-card .header-btn:not(.primary-action):not(.success-action):not(.save-prep-btn):hover,
[data-theme="light"] .saved-files-top-actions .header-btn:not(.primary-action):not(.success-action):hover {
  background-color: #f1f5f9 !important;
  border-color: #0284c7 !important;
  color: #0284c7 !important;
}

.mobile-drawer-user-info {
  margin: 10px 0 16px 0;
  display: flex;
  flex-direction: column;
}

.mobile-drawer-user-info .btn-back-home {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 14px;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

/* --------------------------------------------------------------------------
   Comprehensive Mobile & Tablet Responsive Overrides
   -------------------------------------------------------------------------- */
.admin-table-container {
  overflow-x: auto;
}

@media (max-width: 900px) {
  .header-right-cluster {
    gap: 8px;
    flex-wrap: nowrap;
  }

  .header-report-search-container {
    width: 180px;
  }

  .header-report-search-dropdown {
    width: min(380px, calc(100vw - 24px));
    min-width: 0;
  }

  .floating-actions-card {
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
    padding: 8px 10px;
    border-radius: 14px;
  }

  .dashboard-container {
    padding: 16px 14px 48px 14px;
  }

  .dashboard-header-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 18px;
  }

  .dashboard-user-badge-wrap {
    width: 100%;
    justify-content: space-between;
  }

  .user-menu-dropdown-card {
    right: 0;
    left: auto;
    max-width: calc(100vw - 24px);
  }
}

@media (max-width: 640px) {
  html,
  body {
    overflow-x: hidden;
  }

  .app-header {
    height: auto;
    min-height: 54px;
    padding: 8px 10px;
    flex-wrap: wrap;
    gap: 8px;
  }

  .brand-titles h1 {
    font-size: 12.5px;
    max-width: 56vw;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .header-right-cluster {
    width: 100%;
    justify-content: space-between;
    gap: 6px;
  }

  .header-report-search-container {
    flex: 1;
    width: auto;
    min-width: 0;
  }

  .header-report-search-dropdown {
    position: fixed;
    top: 100px;
    left: 12px;
    right: 12px;
    width: auto;
    max-width: none;
  }

  .dashboard-user-pill {
    padding: 5px 10px;
    font-size: 12px;
    gap: 5px;
  }

  .user-name-label {
    max-width: 90px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .floating-actions-window-bar {
    padding: 8px 10px 0 10px;
  }

  .floating-actions-card {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  .floating-actions-card .header-btn {
    width: 100%;
    justify-content: center;
    padding: 7px 8px;
    font-size: 11.5px;
  }

  .login-page-wrap {
    padding: 16px 12px;
  }

  .login-card {
    padding: 24px 18px;
    width: 100%;
    max-width: 100%;
  }

  .dashboard-title-group h2 {
    font-size: 18px;
  }

  .dashboard-controls-row {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .dashboard-search-container {
    min-width: 100%;
  }

  .dashboard-kpi-bar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .admin-users-table th,
  .admin-users-table td {
    padding: 9px 10px;
    font-size: 12px;
    white-space: nowrap;
  }

  .saved-files-grid {
    grid-template-columns: 1fr !important;
  }

  .saved-file-card {
    padding: 14px;
  }

  .saved-file-card-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .saved-file-card-actions {
    flex-wrap: wrap;
    gap: 6px;
  }

  .saved-file-card-actions button {
    flex: 1 1 calc(50% - 6px);
    justify-content: center;
  }

  .user-modal-grid {
    grid-template-columns: 1fr !important;
    gap: 10px;
  }

  .modal-container,
  .modal-container.modal-wide {
    width: calc(100vw - 20px);
    max-width: none;
    max-height: 92vh;
    margin: 0;
  }

  .modal-header,
  .modal-body,
  .modal-footer {
    padding-left: 14px;
    padding-right: 14px;
  }

  .modal-footer {
    flex-wrap: wrap;
    gap: 8px;
  }

  .panel-card {
    padding: 14px 12px;
  }

  .panel-header-flex {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .particulars-add-actions {
    flex-wrap: wrap;
  }

  .particulars-add-actions button {
    flex: 1 1 auto;
  }
}

@media (max-width: 440px) {
  .dashboard-kpi-bar {
    grid-template-columns: 1fr;
  }

  .saved-file-card-metrics {
    grid-template-columns: 1fr;
  }

  .saved-file-card-actions button {
    flex: 1 1 100%;
  }

  .floating-actions-card {
    grid-template-columns: 1fr;
  }
}

/* Profile Edit Email OTP Inputs */
.otp-input-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.otp-code-input {
  flex: 1;
  letter-spacing: 3px;
  font-weight: 700;
}

.otp-sent-hint {
  margin-top: 6px;
}

/* Password Strength Checklist */
.password-strength-checklist {
  list-style: none;
  margin: 8px 0 0 0;
  padding: 8px 10px;
  border-radius: 6px;
  background: var(--bg-surface-secondary);
  border: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11.5px;
}

.pw-rule-item {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
}

.pw-rule-item.valid {
  color: #10b981;
  font-weight: 600;
}

.pw-mismatch-hint {
  margin-top: 5px;
  font-size: 11.5px;
  color: #f87171;
  font-weight: 600;
}
