:root {
  /* Colors - Modern 2025/2026 SaaS Fintech System (Stripe/Ramp Style) */
  --primary: #0F766E;
  --primary-hover: #115E59;
  --primary-light: rgba(15, 118, 110, 0.05);
  --primary-alpha: rgba(15, 118, 110, 0.15);
  
  --bg: #F8FAFC;
  --panel: #FFFFFF;
  --border: #E2E8F0;
  
  --text: #0F172A;
  --muted: #64748B;
  
  --success: #16A34A; /* Green for primary actions & positive metrics */
  --success-light: #F0FDF4;
  --success-border: #BBF7D0;
  
  --warning: #F59E0B;
  --warning-light: #FFFBEB;
  --warning-border: #FDE68A;
  
  --error: #DC2626; /* Red for danger / mismatch */
  --error-light: #FEF2F2;
  --error-border: #FECACA;
  
  /* Sidebar Specific Colors */
  --sidebar-bg: #0F172A;
  --sidebar-text: #94A3B8;
  --sidebar-hover: #1E293B;
  --sidebar-active: #0F766E;
  --sidebar-active-text: #FFFFFF;

  /* Typography */
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-display: 'Poppins', system-ui, -apple-system, sans-serif;
  
  /* Spacing (8px grid) */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  
  /* Borders and Shadows */
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.08), 0 2px 4px -2px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.1), 0 4px 6px -4px rgba(15, 23, 42, 0.1);
  --shadow-xl: 0 20px 25px -5px rgba(15, 23, 42, 0.15), 0 8px 10px -6px rgba(15, 23, 42, 0.15);
  
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --sidebar-width: 260px;
}

/* Global Reset & Base */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body.auth-shell-locked {
  overflow: hidden;
}

body.auth-shell-locked .app-shell {
  visibility: hidden;
  pointer-events: none;
  user-select: none;
}

body.auth-shell-locked #auth-gate,
body.auth-shell-locked #auth-gate.hidden {
  display: grid !important;
}

button,
input,
select,
textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

/* App Layout Shell */
.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  min-height: 100vh;
  transition: grid-template-columns 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Sidebar styling */
.sidebar {
  background-color: var(--sidebar-bg);
  color: var(--sidebar-text);
  padding: var(--space-6) var(--space-4);
  display: flex;
  flex-direction: column;
  border-right: 1px solid rgba(255, 255, 255, 0.05);
  position: sticky;
  top: 0;
  height: 100vh;
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), padding 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 30;
}

.brand-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-8);
  position: relative;
}

.brand {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.brand-logo {
  height: auto;
  width: 100%;
  max-width: 180px;
  display: block;
}

.brand-logo-collapsed {
  display: none;
}

.brand-sub {
  font-size: 11px;
  color: #64748B;
  display: block;
  font-weight: 500;
}

.sidebar-collapse-btn {
  position: absolute;
  right: -28px;
  top: 4px;
  width: 24px;
  height: 24px;
  border-radius: 9999px;
  background-color: var(--sidebar-bg);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--sidebar-text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

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

.sidebar-chevron {
  width: 14px;
  height: 14px;
  transition: transform 0.3s ease;
}

/* Collapsed Sidebar Class */
.sidebar.collapsed {
  --sidebar-width: 78px;
  padding: var(--space-6) var(--space-3);
}

.sidebar.collapsed .brand-logo,
.sidebar.collapsed .brand-sub,
.sidebar.collapsed .nav-button span,
.sidebar.collapsed .session-panel-head {
  display: none !important;
}

.sidebar.collapsed .brand-logo-collapsed {
  display: block;
  height: 28px;
  width: auto;
  margin: 0 auto;
}

.sidebar.collapsed .sidebar-chevron {
  transform: rotate(180deg);
}

.sidebar.collapsed .sidebar-collapse-btn {
  right: -24px;
}

.sidebar.collapsed .nav-button {
  justify-content: center;
  padding: var(--space-3);
  border-radius: var(--radius-sm);
}

.sidebar.collapsed .nav-icon {
  margin-right: 0;
}

.sidebar.collapsed .session-panel {
  border-top: none;
  padding-top: 0;
  margin-top: auto;
  justify-content: center;
}

.sidebar.collapsed #session-signout {
  font-size: 0;
  padding: var(--space-2);
  border-radius: var(--radius-sm);
  background: rgba(220, 38, 38, 0.1);
  border-color: transparent;
  color: var(--error);
  height: 40px;
}

.sidebar.collapsed #session-signout::after {
  content: "➔";
  font-size: 14px;
}

/* Nav Stack and Buttons */
.nav-stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  flex-grow: 1;
}

.nav-button {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 10px 14px;
  width: 100%;
  border: none;
  background: transparent;
  color: var(--sidebar-text);
  border-radius: var(--radius-md);
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: var(--transition);
}

.nav-button:hover {
  background-color: var(--sidebar-hover);
  color: #FFFFFF;
}

.nav-button.active {
  background-color: var(--sidebar-active);
  color: var(--sidebar-active-text);
  box-shadow: 0 4px 12px rgba(15, 118, 110, 0.25);
}

.nav-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

/* Session Panel (Bottom of Sidebar) */
.session-panel {
  margin-top: auto;
  padding-top: var(--space-4);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.session-panel-head {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  margin-bottom: var(--space-3);
}

.session-panel-head strong {
  font-size: 13px;
  color: #FFFFFF;
  word-break: break-all;
}

.session-panel .panel-chip {
  align-self: flex-start;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  background-color: rgba(255, 255, 255, 0.1);
  color: var(--sidebar-text);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

#session-signout {
  width: 100%;
}

/* Workspace Area - 95% Width Utilization & Tight Padding */
.workspace {
  padding: var(--space-5) var(--space-6);
  width: 100%;
  max-width: 95%;
  margin: 0 auto;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  min-width: 0;
}

/* Sticky Workspace Header */
.workspace-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-6);
  background-color: var(--bg);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 15;
}

.header-info h1 {
  font-family: var(--font-display);
  font-size: 32px; /* Redesigned: Page Title 32px */
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.025em;
}

.header-info p {
  font-size: 13px;
  color: var(--muted);
  margin-top: var(--space-1);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.header-btn {
  background-color: #FFFFFF;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  width: 40px; /* Redesigned: 40px height */
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  color: var(--text);
}

.header-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
  background-color: var(--bg);
}

.header-btn svg {
  width: 18px;
  height: 18px;
}

/* Global Notification Badge style */
.notification-container {
  position: relative;
}

.notification-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  background-color: var(--error);
  border-radius: 9999px;
  border: 2px solid #FFFFFF;
}

/* User Profile Menu */
.profile-menu {
  position: relative;
}

.profile-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  cursor: pointer;
}

.profile-avatar {
  width: 40px;
  height: 40px;
  border-radius: 9999px;
  background: linear-gradient(135deg, var(--primary) 0%, #115E59 100%);
  color: #FFFFFF;
  font-weight: 600;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.profile-avatar:hover {
  transform: scale(1.03);
  box-shadow: var(--shadow-md);
}

.profile-menu-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 240px;
  background-color: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xl);
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  z-index: 25;
}

.profile-menu-label {
  font-size: 11px;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.05em;
}

.profile-menu-email {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  word-break: break-all;
}

/* Login/Out Button Style Override */
.topbar-login {
  min-height: 40px;
}

/* Section Head overrides */
.view-section {
  display: none;
}

.view-section.active {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.hidden-title {
  display: none !important;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

.section-head h1 {
  font-family: var(--font-display);
  font-size: 22px; /* Redesigned: Section Title 22px */
  font-weight: 600;
  color: var(--text);
}

.section-head p {
  font-size: 13px;
  color: var(--muted);
  margin-top: 4px;
}

.section-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

/* Cards & Layout Panels */
.tool-panel {
  background-color: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  box-shadow: var(--shadow-sm);
}

/* File Upload Card Grid */
.upload-card {
  padding: var(--space-5);
}

.upload-form-grid {
  display: grid;
  grid-template-columns: 320px 1fr 180px;
  gap: var(--space-5);
  align-items: stretch;
}

.input-col {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.file-col {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.file-col > span {
  font-weight: 600;
  font-size: 13px; /* Redesigned: Labels 13px */
  color: var(--text);
}

.action-col {
  display: flex;
  align-items: flex-end;
  justify-content: stretch;
}

.convert-btn {
  width: 100%;
  height: 40px; /* Redesigned: 40px height */
  font-size: 14px;
  display: flex;
  gap: var(--space-2);
}

/* Form Fields */
label {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

label span {
  font-size: 13px; /* Redesigned: Labels 13px */
  font-weight: 600;
  color: var(--text);
}

.picker-wrapper {
  position: relative;
  width: 100%;
}

.dropdown-chevron {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--muted);
  pointer-events: none;
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="url"],
select,
textarea {
  width: 100%;
  height: 40px; /* Redesigned: Standardized 40px height */
  padding: 8px 12px;
  background-color: #FFFFFF;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 14px;
  color: var(--text);
  outline: none;
  transition: var(--transition);
}

input:hover,
select:hover,
textarea:hover {
  border-color: #CBD5E1;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-alpha);
  background-color: #FFFFFF;
}

textarea {
  height: auto;
  resize: vertical;
}

.field-note {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

/* Search Suggestions dropdown (picker) */
.picker-search-field {
  position: relative;
}

.picker-search-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 50;
  background-color: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  max-height: 240px;
  overflow-y: auto;
  padding: 4px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.picker-search-option {
  padding: 8px 12px;
  font-size: 13.5px;
  text-align: left;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  color: var(--text);
}

.picker-search-option:hover,
.picker-search-option.active {
  background-color: var(--primary-light);
  color: var(--primary);
}

.picker-search-empty {
  padding: 8px 12px;
  font-size: 13px;
  color: var(--muted);
  text-align: center;
}

.picker-hidden-select {
  display: none;
}

/* Custom Drag & Drop File Zone */
.drag-drop-zone {
  flex-grow: 1;
  border: 2px dashed var(--border);
  border-radius: var(--radius-md);
  background-color: #F8FAFC;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--space-3);
  cursor: pointer;
  transition: var(--transition);
}

.drag-drop-zone:hover {
  border-color: var(--primary);
  background-color: var(--primary-light);
}

.drag-drop-zone.dragover {
  border-color: var(--primary);
  background-color: var(--primary-alpha);
  transform: scale(0.99);
}

.drag-drop-zone input[type="file"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  z-index: 5;
}

.drag-drop-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
}

.upload-icon {
  width: 36px;
  height: 36px;
  color: var(--muted);
  transition: var(--transition);
}

.drag-drop-zone:hover .upload-icon {
  color: var(--primary);
  transform: translateY(-2px);
}

.drag-drop-text {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text);
}

.browse-link {
  color: var(--primary);
  font-weight: 600;
  text-decoration: underline;
}

.drag-drop-subtext {
  font-size: 11.5px;
  color: var(--muted);
}

.drag-drop-zone.has-file {
  border-color: var(--success);
  background-color: var(--success-light);
}

.drag-drop-zone.has-file .upload-icon {
  color: var(--success);
}

/* Upload Progress Bar */
.upload-progress {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-top: var(--space-4);
  background: var(--bg);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
}

.progress-track {
  flex-grow: 1;
  height: 8px;
  background-color: var(--border);
  border-radius: 9999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background-color: var(--primary);
  border-radius: 9999px;
  transition: width 0.3s ease;
}

.progress-percent {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  min-width: 32px;
  text-align: right;
}

/* Status Line & Alerts (Toast Notifications) */
.status-line {
  min-height: 48px;
  margin: var(--space-4) 0;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  background-color: #FFFFFF;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.status-line:empty {
  display: none !important;
}

.status-line.error {
  background-color: var(--error-light);
  border-color: var(--error-border);
  color: var(--error);
}

.status-line.success {
  background-color: var(--success-light);
  border-color: var(--success-border);
  color: var(--primary);
}

/* Premium Button Architecture - Standardized to 40px Height */
.primary-button,
.secondary-button,
.mini-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  gap: var(--space-2);
  height: 40px; /* Redesigned: 40px Height throughout */
  padding: 8px 16px;
  font-size: 13.5px;
}

.primary-button {
  background-color: var(--success); /* Redesigned: Green filled primary button */
  color: #FFFFFF;
  border: 1px solid var(--success);
}

.primary-button:hover {
  background-color: #15803D; /* Darker green */
  border-color: #15803D;
  box-shadow: var(--shadow-sm);
}

.primary-button:focus-visible {
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.15);
}

.secondary-button,
.mini-button {
  background-color: #FFFFFF;
  border: 1px solid var(--border); /* Redesigned: Secondary actions outlined */
  color: var(--text);
}

.secondary-button:hover,
.mini-button:hover {
  border-color: var(--primary);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.mini-button.danger {
  color: var(--error);
  border-color: var(--error-border);
}

.mini-button.danger:hover {
  background-color: var(--error-light);
  border-color: var(--error);
  color: var(--error);
}

.primary-button:disabled,
.secondary-button:disabled,
.mini-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

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

/* Icon Buttons */
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px; /* Redesigned: 40px Height */
  height: 40px;
  background-color: #FFFFFF;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
  color: var(--text);
}

.icon-button:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.topbar-template-button {
  text-decoration: none;
}

.full-width {
  width: 100%;
}

.button-row {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-3);
  margin-top: var(--space-4);
}

/* KPI metric cards grid - Display in a single responsive row, equal height */
.dashboard {
  display: grid;
  grid-template-columns: repeat(6, minmax(130px, 1fr)); /* Single responsive row */
  gap: var(--space-4);
  margin: var(--space-2) 0 var(--space-3);
  align-items: stretch; /* Equal height */
}

.metric {
  background-color: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 100%;
  min-height: 110px;
  position: relative;
  overflow: hidden;
  border-left: 4px solid var(--border);
  transition: var(--transition);
}

.metric:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary);
}

.metric span {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--muted);
  letter-spacing: 0.05em;
}

.metric strong {
  font-family: var(--font-display);
  font-size: 30px; /* Redesigned: Card numbers 30px */
  font-weight: 600;
  color: var(--text);
  margin-top: var(--space-1);
  letter-spacing: -0.02em;
  line-height: 1.15;
}

/* Status variants for metric cards */
.metric.match {
  border-left-color: var(--success); /* Green for positive / match */
  background: linear-gradient(to right, var(--success-light) 0%, #FFFFFF 100%);
}

.metric.mismatch {
  border-left-color: var(--error); /* Red for mismatch */
  background: linear-gradient(to right, var(--error-light) 0%, #FFFFFF 100%);
}

.metric.progress {
  border-left-color: var(--primary);
  background: linear-gradient(to right, var(--primary-light) 0%, #FFFFFF 100%);
}

/* Small icon in top-right */
.metric::after {
  content: "";
  position: absolute;
  top: 12px;
  right: 12px;
  width: 18px;
  height: 18px;
  opacity: 0.15;
  background-size: contain;
  background-repeat: no-repeat;
  transition: var(--transition);
}

.metric:hover::after {
  opacity: 0.3;
  transform: scale(1.1);
}

/* KPI background icons selection */
#dashboard .metric:nth-child(1)::after,
#batch-dashboard .metric:nth-child(9)::after {
  /* Opening - Wallet */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%230F766E' stroke-width='2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M21 12V7a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2h14a2 2 0 002-2v-3a2 2 0 00-2-2h-1'/%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M16 12a1 1 0 112 0 1 1 0 01-2 0z'/%3E%3C/svg%3E");
}
#dashboard .metric:nth-child(2)::after,
#batch-dashboard .metric:nth-child(10)::after {
  /* Debit - Outflow */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23DC2626' stroke-width='2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M19 5l-14 14m0 0h11m-11 0V8'/%3E%3C/svg%3E");
}
#dashboard .metric:nth-child(3)::after,
#batch-dashboard .metric:nth-child(11)::after {
  /* Credit - Inflow */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2316A34A' stroke-width='2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M5 19L19 5m0 0H8m11 0v11'/%3E%3C/svg%3E");
}
#dashboard .metric:nth-child(4)::after,
#batch-dashboard .metric:nth-child(12)::after {
  /* Closing - Flag */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%230F766E' stroke-width='2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M3 21v-4m0 0V5a2 2 0 012-2h6.5l1 1H21l-3 6 3 6h-8.5l-1-1H5a2 2 0 00-2 2zm9-13.5V9'/%3E%3C/svg%3E");
}
#dashboard .metric:nth-child(5)::after,
#batch-dashboard .metric:nth-child(13)::after {
  /* Computed - Calculator */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%230F766E' stroke-width='2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M9 7h6m0 10v-3m-3 3h.01M9 17h.01M9 14h.01M12 14h.01M15 11h.01M12 11h.01M9 11h.01M7 21h10a2 2 0 002-2V5a2 2 0 00-2-2H7a2 2 0 00-2 2v14a2 2 0 002 2z'/%3E%3C/svg%3E");
}
#dashboard .metric:nth-child(6)::after,
#batch-dashboard .metric:nth-child(8)::after {
  /* Difference - Scales */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23F59E0B' stroke-width='2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M3 6l3 1m0 0l-3 9a5.002 5.002 0 006.001 0M6 7l3 9M6 7l6-2m6 2l3-1m-3 1l-3 9a5.002 5.002 0 006.001 0M18 7l3 9m-3-9l-6-2'/%3E%3C/svg%3E");
}

/* Report metrics icons */
#report-dashboard .metric:nth-child(1)::after {
  /* Records - Files */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748B' stroke-width='2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M8 7v8a2 2 0 002 2h6M8 7V5a2 2 0 012-2h4.586a1 1 0 01.707.293l4.414 4.414a1 1 0 01.293.707V15a2 2 0 01-2 2h-2M8 7H6a2 2 0 00-2 2v10a2 2 0 002 2h8a2 2 0 002-2v-2'/%3E%3C/svg%3E");
}
#report-dashboard .metric:nth-child(2)::after {
  /* Parsed */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2316A34A' stroke-width='2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4'/%3E%3C/svg%3E");
}
#report-dashboard .metric:nth-child(3)::after {
  /* Mismatch */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23F59E0B' stroke-width='2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z'/%3E%3C/svg%3E");
}
#report-dashboard .metric:nth-child(4)::after {
  /* Failed - X circle */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23DC2626' stroke-width='2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M10 14l2-2m0 0l2-2m-2 2l-2-2m2 2l2 2m7-2a9 9 0 11-18 0 9 9 0 0118 0z'/%3E%3C/svg%3E");
}

/* Preview Wrapping Block */
.preview-wrap {
  margin-top: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.preview-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-4);
}

.preview-head h2 {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
}

.preview-head p {
  font-size: 13px;
  color: var(--muted);
  margin-top: 2px;
}

.download-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

/* Import Directly into Tally Section - 4-Column Responsive Grid */
.tally-panel {
  background: linear-gradient(180deg, #FFFFFF 0%, #F8FCFA 100%) !important;
  border-color: var(--success-border) !important;
  padding: var(--space-5);
}

.compact-head {
  margin-bottom: var(--space-3);
}

.tally-panel-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr); /* Redesigned: 4-column responsive grid */
  gap: var(--space-4);
  align-items: end;
}

.tally-panel-grid label {
  gap: 6px;
}

.tally-panel-grid span {
  font-size: 13px; /* Redesigned: Labels 13px */
  font-weight: 600;
}

.tally-panel-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end; /* Redesigned: Action buttons aligned right */
  gap: var(--space-3);
  margin-top: var(--space-4);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border);
}

/* Tabs Navigation Styling */
.result-tabs {
  display: flex;
  gap: var(--space-6);
  border-bottom: 2px solid var(--border);
  margin-bottom: var(--space-2);
}

.result-tab {
  background: transparent !important;
  border: none !important;
  border-radius: 0 !important;
  padding: 12px 4px !important;
  font-size: 14.5px !important;
  font-weight: 600 !important;
  color: var(--muted) !important;
  cursor: pointer;
  position: relative;
  transition: var(--transition);
  height: auto !important; /* Reset 40px default */
}

.result-tab:hover {
  color: var(--text) !important;
}

.result-tab.active {
  color: var(--primary) !important;
}

.result-tab::after {
  content: "";
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 100%;
  height: 2px;
  background-color: var(--primary);
  transform: scaleX(0);
  transition: var(--transition);
}

.result-tab.active::after {
  transform: scaleX(1);
}

/* Date Range Filter Bar Styling */
.result-filters-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-3);
  padding: 10px 16px;
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-4);
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.result-filters-bar.hidden {
  display: none !important;
}

.filter-bar-title {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-weight: 600;
  font-size: 13.5px;
  color: var(--muted);
}

.filter-bar-icon {
  width: 16px;
  height: 16px;
  color: var(--primary);
  flex-shrink: 0;
}

.filter-inputs-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-4);
}

.filter-input-wrapper {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.filter-input-wrapper label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--muted);
  letter-spacing: 0.03em;
}

.filter-input-wrapper input[type="date"] {
  height: 36px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background-color: #FFFFFF;
  font-family: inherit;
  font-size: 13px;
  color: var(--text);
  outline: none;
  transition: var(--transition);
}

.filter-input-wrapper input[type="date"]:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-alpha);
}

#clear-date-filter-btn {
  height: 36px;
  padding: 6px 12px;
  font-size: 12.5px;
  border-radius: var(--radius-sm);
  gap: var(--space-1);
}

/* Result panel grid structures */
.result-panel {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.result-panel + .result-panel {
  margin-top: 0;
}

/* Ledger Mapping Section Toolbar (Sticky Glassmorphism) */
.panel-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-4);
  background-color: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.mapping-toolbar-grid {
  position: sticky;
  bottom: var(--space-4);
  z-index: 20;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  margin-top: var(--space-4);
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-4);
}

.toolbar-inputs-group {
  display: flex;
  align-items: flex-end;
  gap: var(--space-4);
  flex-grow: 1;
  flex-wrap: wrap;
}

.toolbar-inputs-group label {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

/* Larger Search field */
.panel-search {
  min-width: 280px;
  flex-grow: 1.5;
}

.panel-search input {
  height: 40px;
  font-size: 13.5px;
}

.inline-field select,
.inline-field input {
  height: 40px;
  font-size: 13px;
  padding: 6px 10px;
  min-width: 160px;
}

.bulk-contra-field {
  flex-shrink: 0;
}

.mapping-action-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.mapping-summary {
  margin-bottom: 0;
  font-size: 13px;
}

.panel-chip,
.mapping-summary {
  display: inline-flex;
  align-items: center;
  background-color: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 12px;
  border-radius: 9999px;
  font-weight: 600;
  height: 34px;
}

/* Enterprise Data Tables - Airtable/Notion Style */
.table-frame {
  max-height: 580px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background-color: var(--panel);
  box-shadow: var(--shadow-sm);
}

.mapping-table-frame {
  max-height: 620px;
}

table {
  width: 100%;
  border-collapse: separate; /* Required for sticky columns */
  border-spacing: 0;
  text-align: left;
  font-size: 14px; /* Redesigned: Table text 14px */
}

.preview-table {
  min-width: 1200px;
}

.mapping-table {
  min-width: 1300px;
}

.batch-table {
  min-width: 1800px;
}

.report-table {
  min-width: 1600px;
}

.report-pdf-table {
  min-width: 1000px;
}

.auth-table {
  min-width: 1100px;
}

th, td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  background-color: var(--panel);
}

th {
  position: sticky;
  top: 0;
  z-index: 12;
  background-color: #F8FAFC !important;
  color: var(--text);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border-bottom: 2px solid var(--border);
}

/* Sticky First Column (Row Select Checkboxes) */
th:first-child,
td:first-child {
  position: sticky;
  left: 0;
  z-index: 10;
  width: 50px;
  min-width: 50px;
  max-width: 50px;
  background-color: inherit;
  border-right: 1px solid var(--border);
  box-shadow: 2px 0 5px -2px rgba(15, 23, 42, 0.06);
}

th:first-child {
  z-index: 13;
  background-color: #F8FAFC !important;
}

/* Zebra Striping & Hover states */
tbody tr:nth-child(even) {
  background-color: #F8FAFC;
}

tbody tr:nth-child(odd) {
  background-color: #FFFFFF;
}

tbody tr:hover {
  background-color: var(--primary-light) !important;
}

/* Table Specific Cell Alignments */
td.amount,
th.amount {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Align columns by type */
.preview-table td:nth-child(4),
.preview-table td:nth-child(5),
.preview-table td:nth-child(6),
.mapping-table td:nth-child(4),
.mapping-table td:nth-child(5),
.mapping-table td:nth-child(6) {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Form controls inside mapping tables - Modern minimal dropdown */
.mapping-table td select,
.mapping-table td input[type="text"] {
  height: 34px;
  padding: 4px 8px;
  font-size: 13.5px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background-color: var(--panel);
  outline: none;
}

.mapping-table td select {
  min-width: 120px;
}

.mapping-table td input[type="text"] {
  min-width: 185px;
}

/* Badges & Pills */
.imported-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background-color: var(--success-light);
  color: #15803D;
  border: 1px solid var(--success-border);
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.preview-row.imported td {
  background-color: #F0FDF4;
}

.result-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 9999px;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.result-pill.ready {
  background-color: #F1F5F9;
  color: #475569;
}

.result-pill.parsing {
  background-color: var(--primary-light);
  color: var(--primary);
  border: 1px solid var(--primary-alpha);
}

.result-pill.matched,
.result-pill.parsed {
  background-color: var(--success-light);
  color: var(--success);
  border: 1px solid var(--success-border);
}

.result-pill.difference,
.result-pill.mismatch {
  background-color: var(--warning-light);
  color: var(--warning);
  border: 1px solid var(--warning-border);
}

.result-pill.failed,
.result-pill.bank-required {
  background-color: var(--error-light);
  color: var(--error);
  border: 1px solid var(--error-border);
}

/* Checkbox Alignment & Columns */
.mapping-select-cell,
.report-select-cell,
.batch-select-cell {
  width: 50px;
  text-align: center;
  padding: 0 var(--space-3) !important;
}

input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
  border-radius: 4px;
}

.row-select-stack {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Column filter button icons */
.column-header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.column-header.align-end {
  justify-content: flex-end;
}

.column-filter-button {
  background-color: transparent;
  border: 1px solid transparent;
  color: var(--muted);
  width: 22px;
  height: 22px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

.column-filter-button::before {
  content: "⛛";
  font-size: 10px;
}

.column-filter-button:hover {
  background-color: var(--border);
  color: var(--text);
}

.column-filter-button.active {
  background-color: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary-alpha);
}

/* Table Filter Popover - React Select style dropdown */
.table-filter-popover {
  position: fixed;
  width: 280px;
  background-color: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xl);
  padding: var(--space-4);
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  animation: filterOpen 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.table-filter-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.table-filter-head strong {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
}

.table-filter-search {
  margin-bottom: 0;
}

.table-filter-search span {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  font-weight: 600;
  display: block;
  margin-bottom: var(--space-1);
}

.table-filter-search input {
  height: 36px;
  font-size: 13px;
}

.table-filter-actions {
  display: flex;
  gap: var(--space-2);
}

.table-filter-options {
  max-height: 180px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background-color: #F8FAFC;
  padding: 4px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.table-filter-option {
  display: flex;
  flex-direction: row; /* Fix: explicitly declare row to override default label column styling */
  align-items: center;
  gap: var(--space-3);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  background-color: transparent;
  transition: var(--transition);
}

.table-filter-option:hover {
  background-color: var(--primary-light);
  color: var(--primary);
}

.table-filter-option input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  flex-shrink: 0;
  accent-color: var(--primary);
  cursor: pointer;
}

.table-filter-option-text {
  font-size: 13px;
  color: var(--text);
  word-break: break-all;
  line-height: 1.2;
}

.table-filter-empty {
  font-size: 12.5px;
  color: var(--muted);
  text-align: center;
  padding: var(--space-3);
}

/* Rules Section Grid Layouts */
.rule-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: var(--space-6);
  align-items: start;
}

.mapping-block h2 {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  margin-bottom: var(--space-3);
}

.mapping-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-3);
}

.mapping-grid label {
  gap: 4px;
}

.mapping-grid span {
  font-size: 12px;
  font-weight: 500;
}

.mapping-grid input {
  height: 38px;
}

.mapping-note {
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.5;
  margin-top: var(--space-3);
}

/* Auto Parser Sidebar card */
.aside-stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

.auto-panel {
  background-color: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  box-shadow: var(--shadow-sm);
}

.auto-panel h2 {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  margin-bottom: var(--space-3);
}

.detected-box {
  background-color: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  font-size: 12px;
  font-family: monospace;
  color: var(--text);
  line-height: 1.5;
  margin-top: var(--space-3);
}

.editor-mode {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 13.5px;
  margin-bottom: var(--space-4);
  border: 1px solid var(--border);
  background-color: var(--bg);
}

.editor-mode.create {
  background-color: var(--primary-light);
  border-color: var(--primary-alpha);
  color: var(--primary);
}

/* Saved Rules list layouts */
.saved-rules-panel {
  margin-top: var(--space-4);
}

.saved-rules-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}

.saved-rules-head h2 {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
}

.saved-rules-search-wrap {
  display: flex;
  gap: var(--space-2);
  align-items: center;
}

.saved-rules-search-wrap input {
  width: 280px;
}

@media (max-width: 576px) {
  .saved-rules-search-wrap {
    width: 100%;
  }
  .saved-rules-search-wrap input {
    flex-grow: 1;
    width: auto;
  }
}

.saved-rules-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.saved-rule-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr auto;
  gap: var(--space-4);
  background-color: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-4) var(--space-5);
  align-items: center;
}

.saved-rule-label {
  font-size: 10px;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.05em;
}

.saved-rule-value {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text);
  margin-top: 2px;
}

.saved-rule-actions {
  display: flex;
  gap: var(--space-2);
}

.saved-rules-empty {
  border: 2px dashed var(--border);
  background-color: #FFFFFF;
  color: var(--muted);
  font-size: 13.5px;
  text-align: center;
  padding: var(--space-6);
  border-radius: var(--radius-md);
}

/* Bank Directory Page Layout */
.bank-directory-grid {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: var(--space-6);
  align-items: start;
}

.bank-panel {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.bank-panel h2 {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
}

.bank-form {
  margin-top: 0;
  gap: var(--space-3);
}

.bank-select-wrap {
  margin-top: 0;
}

.bank-button-row {
  margin-top: var(--space-2);
}

.bank-bulk-panel {
  border-top: 1px solid var(--border);
  padding-top: var(--space-4);
  gap: var(--space-3);
}

.bank-list-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
}

.bank-directory-filters {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: var(--space-3);
  align-items: center;
  margin-bottom: var(--space-2);
}

.bank-directory-filters label {
  gap: var(--space-1);
}

/* Batch Testing Layout */
.batch-panel {
  margin-top: 0;
}

.batch-panel .form-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: var(--space-4);
  align-items: flex-end;
}

.form-action.batch-actions {
  display: flex;
  align-items: flex-end;
  height: 100%;
}

.batch-actions button {
  width: 100%;
}

.issue-panel h2 {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  color: var(--error);
}

.issue-list {
  margin-top: var(--space-3);
}

.issue-item {
  border: 1px solid var(--error-border);
  background-color: var(--error-light);
  border-radius: var(--radius-md);
  padding: var(--space-4);
}

.issue-item-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.issue-item-head strong {
  font-size: 14px;
  color: var(--error);
}

.issue-item-text {
  font-size: 13px;
  color: var(--muted);
  margin-top: 6px;
}

.batch-row.matched td {
  background-color: var(--success-light);
}

.batch-row.parsing td {
  background-color: var(--primary-light);
}

.batch-row.difference td {
  background-color: var(--warning-light);
}

.batch-row.failed td,
.batch-row.bank-required td {
  background-color: var(--error-light);
}

.batch-bank-select {
  min-width: 180px;
}

.cell-note {
  font-size: 12.5px;
  color: var(--muted);
  min-width: 200px;
}

/* Setup Guide / SQL Code Blocks */
.setup-grid {
  display: grid;
  grid-template-columns: 1fr 1.5fr 1fr;
  gap: var(--space-4);
  margin-top: var(--space-4);
}

.setup-card h2 {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  margin-bottom: var(--space-2);
}

.setup-steps {
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.6;
  padding-left: var(--space-4);
}

.code-block {
  background-color: #0F172A;
  color: #E2E8F0;
  padding: var(--space-3);
  border-radius: var(--radius-md);
  font-family: monospace;
  font-size: 11.5px;
  line-height: 1.5;
  border: 1px solid var(--border);
  max-height: 280px;
  overflow: auto;
  white-space: pre-wrap;
}

.report-row.parsed td {
  background-color: var(--success-light);
}

.report-row.mismatch td {
  background-color: var(--warning-light);
}

.report-row.failed td {
  background-color: var(--error-light);
}

/* Authentication Section login gate layout */
.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 999;
  background-color: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: grid;
  place-items: center;
  padding: var(--space-4);
}

.auth-gate-card {
  background-color: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 440px;
  padding: var(--space-6);
  display: flex;
  flex-direction: column;
  position: relative;
}

.auth-gate-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  border-radius: 9999px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  background-color: transparent;
  border: none;
  cursor: pointer;
  color: var(--muted);
  transition: var(--transition);
  z-index: 50;
}

.auth-gate-close:hover {
  background-color: var(--bg);
  color: var(--text);
}

/* Redesigned Premium Split-Screen Authentication Gate */
.auth-gate-container {
  display: flex;
  background-color: #FFFFFF;
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
  width: 100%;
  max-width: 880px;
  min-height: 580px;
  overflow: hidden;
  border: 1px solid var(--border);
  position: relative;
  animation: scaleUpAuth 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes scaleUpAuth {
  from {
    transform: scale(0.95);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.auth-gate-left {
  flex: 1;
  background: linear-gradient(135deg, #F0FDF4 0%, #ECFDF5 50%, #F0FDFA 100%);
  padding: 40px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border-right: 1px solid var(--border);
}

.auth-left-logo-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.auth-logo-img {
  height: 44px;
  width: auto;
}

.auth-logo-text {
  font-family: var(--font-sans);
  font-size: 22px;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -0.02em;
}

.auth-left-welcome h2 {
  font-family: var(--font-sans);
  font-size: 28px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: var(--space-2);
  line-height: 1.2;
  text-align: left;
}

.auth-left-welcome p {
  font-size: 14.5px;
  color: var(--muted);
  line-height: 1.6;
  text-align: left;
}

.auth-left-illustration {
  margin: var(--space-4) 0;
  display: flex;
  justify-content: center;
  align-items: center;
}

.finance-svg {
  width: 100%;
  max-width: 280px;
  height: auto;
  filter: drop-shadow(0 8px 20px rgba(15, 118, 110, 0.06));
}

.auth-left-marketing h3 {
  font-family: var(--font-sans);
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: var(--space-1);
}

.auth-left-marketing p {
  font-size: 13.5px;
  color: var(--muted);
  line-height: 1.4;
}

.auth-carousel-dots {
  display: flex;
  gap: 6px;
  margin-top: var(--space-3);
}

.auth-carousel-dots .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: #CBD5E1;
  transition: all 0.2s ease;
}

.auth-carousel-dots .dot.active {
  width: 18px;
  border-radius: 3px;
  background-color: var(--primary);
}

.auth-gate-right {
  flex: 1;
  padding: 40px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  background-color: #FFFFFF;
}

.auth-right-header {
  display: none; /* Hidden on desktop, shown on mobile screen sizes */
  text-align: center;
  margin-bottom: var(--space-6);
}

.auth-right-header .auth-gate-logo {
  height: 64px;
  width: auto;
  margin: 0 auto var(--space-3);
}

.auth-right-header h2 {
  font-family: var(--font-sans);
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: var(--space-1);
}

.auth-right-header p {
  font-size: 13.5px;
  color: var(--muted);
}

.auth-gate-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
  gap: var(--space-6);
}

.auth-gate-tabs .result-tab {
  flex: 1;
  text-align: center;
  padding: 10px 0;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--muted);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  height: auto;
}

.auth-gate-tabs .result-tab:hover {
  color: var(--text);
}

.auth-gate-tabs .result-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  background: none;
}

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

.auth-input-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.auth-input-group label {
  font-size: 13px;
  font-weight: 600;
  color: #475569;
  text-align: left;
}

.auth-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.auth-input-icon {
  position: absolute;
  left: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #94A3B8;
  pointer-events: none;
}

.auth-input-icon svg {
  width: 18px;
  height: 18px;
}

.auth-input-wrapper input {
  width: 100%;
  height: 48px !important; /* Standardized 48px height */
  padding: 10px 14px 10px 42px !important;
  font-size: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background-color: #FFFFFF;
  color: var(--text);
  outline: none;
  transition: all 0.15s ease;
}

.auth-input-wrapper input::placeholder {
  color: #94A3B8;
}

.auth-input-wrapper input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.auth-password-toggle {
  position: absolute;
  right: 14px;
  background: none;
  border: none;
  cursor: pointer;
  color: #94A3B8;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  transition: color 0.15s ease;
}

.auth-password-toggle svg {
  width: 18px;
  height: 18px;
}

.auth-password-toggle:hover,
.auth-password-toggle.visible {
  color: var(--primary);
}

.auth-mobile-row {
  display: flex;
  gap: 8px;
  align-items: center;
  width: 100%;
}

.auth-country-select {
  height: 48px;
  min-width: 95px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background-color: #FFFFFF;
  color: var(--text);
  padding: 0 10px;
  font-size: 14px;
  font-weight: 500;
  outline: none;
  cursor: pointer;
  transition: border-color 0.15s ease;
}

.auth-country-select:focus {
  border-color: var(--primary);
}

.auth-options-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13.5px;
  margin-top: 2px;
}

.auth-checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  margin: 0;
  flex-direction: row;
}

.auth-checkbox-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  accent-color: var(--primary);
}

.auth-checkbox-label span {
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
  text-align: left;
}

.auth-checkbox-label span a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
}

.auth-checkbox-label span a:hover {
  text-decoration: underline;
}

.auth-forgot-link {
  color: var(--primary);
  font-weight: 600;
  text-decoration: none;
  transition: color 0.15s ease;
}

.auth-forgot-link:hover {
  color: var(--primary-hover);
  text-decoration: underline;
}

.auth-submit-btn {
  height: 52px !important; /* Standardized 52px height */
  border-radius: 12px !important;
  font-size: 15px !important;
  font-weight: 600 !important;
  background-color: var(--primary) !important;
  border: 1px solid var(--primary) !important;
  color: #FFFFFF !important;
  width: 100% !important;
  transition: all 0.2s ease !important;
  box-shadow: 0 4px 12px rgba(15, 118, 110, 0.15);
}

.auth-submit-btn:hover {
  background-color: var(--primary-hover) !important;
  border-color: var(--primary-hover) !important;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(15, 118, 110, 0.2);
}

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

.auth-divider {
  display: flex;
  align-items: center;
  text-align: center;
  color: #94A3B8;
  margin: 10px 0;
  font-size: 13px;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  border-bottom: 1px solid var(--border);
}

.auth-divider span {
  padding: 0 10px;
}

.auth-footer-text {
  text-align: center;
  font-size: 13.5px;
  color: var(--muted);
  margin-top: 4px;
}

.auth-footer-text a {
  color: var(--primary);
  font-weight: 600;
  text-decoration: none;
  transition: color 0.15s ease;
}

.auth-footer-text a:hover {
  color: var(--primary-hover);
  text-decoration: underline;
}

/* Auth Gate Responsive Overrides */
@media (max-width: 768px) {
  .auth-gate-container {
    max-width: 440px;
    min-height: auto;
  }
  
  .auth-gate-left {
    display: none; /* Hide left panel on mobile */
  }
  
  .auth-gate-right {
    padding: 32px 24px;
  }
  
  .auth-right-header {
    display: block; /* Show header on mobile */
  }
}

/* Loading skeletons shimmer effect */
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.skeleton {
  background: linear-gradient(90deg, #F1F5F9 25%, #E2E8F0 50%, #F1F5F9 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 4px;
  display: inline-block;
}

.skeleton-text {
  height: 14px;
  width: 100%;
  margin-bottom: 6px;
}

.skeleton-title {
  height: 22px;
  width: 40%;
  margin-bottom: 12px;
}

/* Utility visibility classes */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.hidden {
  display: none !important;
}

/* Tooltips */
[data-tooltip] {
  position: relative;
}

[data-tooltip]::before {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 125%;
  left: 50%;
  transform: translateX(-50%) scale(0.9);
  background-color: #0F172A;
  color: #FFFFFF;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-md);
  z-index: 100;
}

[data-tooltip]:hover::before {
  opacity: 1;
  transform: translateX(-50%) scale(1);
}

/* Responsive Overrides */
@media (max-width: 1200px) {
  .dashboard {
    grid-template-columns: repeat(3, 1fr);
  }
  
  .upload-form-grid {
    grid-template-columns: 1fr;
    gap: var(--space-4);
  }
  
  .action-col {
    align-items: stretch;
  }
  
  .convert-btn {
    height: 40px;
  }

  .tally-panel-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 992px) {
  .app-shell {
    grid-template-columns: 1fr;
  }
  
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 260px;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 99;
  }
  
  .sidebar.mobile-open {
    transform: translateX(0);
  }
  
  .sidebar-collapse-btn {
    display: none;
  }

  .rule-grid,
  .bank-directory-grid,
  .setup-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .workspace {
    padding: var(--space-4);
  }
  
  .workspace-header {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-3);
  }
  
  .header-actions {
    width: 100%;
    justify-content: flex-end;
  }
  
  .dashboard {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .tally-panel-grid {
    grid-template-columns: 1fr;
  }
  
  .panel-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  
  .panel-search {
    max-width: 100%;
  }
  
  .mapping-action-row {
    justify-content: flex-start;
    gap: var(--space-2);
  }
  
  .inline-field {
    width: 100%;
  }
  
  .inline-field select,
  .inline-field input {
    flex-grow: 1;
  }
  
  .result-tabs {
    gap: var(--space-3);
  }
  
  .result-tab {
    font-size: 13px !important;
  }
}

/* ==========================================================================
   Ledger Mapping Rule System Styles
   ========================================================================== */

.mapping-account-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  border-radius: var(--radius-lg);
  animation: fadeInOverlay 0.25s ease-out;
}

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

.mapping-account-overlay .overlay-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  max-width: 440px;
  width: 90%;
  box-shadow: var(--shadow-2xl);
  text-align: center;
  animation: scaleInCard 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes scaleInCard {
  from { transform: scale(0.9) translateY(10px); opacity: 0; }
  to { transform: scale(1) translateY(0); opacity: 1; }
}

.mapping-account-overlay h2 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: var(--space-2);
}

.mapping-account-overlay p {
  font-size: 13.5px;
  color: var(--muted);
  line-height: 1.5;
  margin-bottom: var(--space-4);
}

.mapping-account-overlay input {
  width: 100%;
  height: 42px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 14px;
  outline: none;
  background-color: var(--bg);
  color: var(--text);
  transition: border-color var(--transition);
  text-align: center;
  font-weight: 600;
  letter-spacing: 0.05em;
}

.mapping-account-overlay input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-alpha);
}

/* Match Source Badges */
.match-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s;
  cursor: default;
}

.match-badge:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.match-exact {
  background-color: #ECFDF5;
  color: #059669;
  border: 1px solid #A7F3D0;
}

.match-contains {
  background-color: #EFF6FF;
  color: #2563EB;
  border: 1px solid #BFDBFE;
}

.match-default {
  background-color: #F5F3FF;
  color: #7C3AED;
  border: 1px solid #DDD6FE;
}

.match-manual {
  background-color: #FFFBEB;
  color: #D97706;
  border: 1px solid #FDE68A;
}

.match-draft {
  background-color: #EEF2F6;
  color: #475569;
  border: 1px solid #CBD5E1;
}

.match-fallback {
  background-color: #F8FAFC;
  color: #64748B;
  border: 1px solid #E2E8F0;
}

/* Status Badges */
.status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.status-active {
  background-color: #ECFDF5;
  color: #059669;
  border: 1px solid #A7F3D0;
}

.status-inactive {
  background-color: #FEF2F2;
  color: #DC2626;
  border: 1px solid #FCA5A5;
}

/* Forms and Layout Inside Modals */
.form-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-4);
}

.form-grid.compact {
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-3);
}

.form-grid.compact label {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.form-grid.compact label span {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.form-grid.compact input,
.form-grid.compact select {
  height: 38px;
  padding: 6px 10px;
  font-size: 13.5px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background-color: var(--panel);
  color: var(--text);
  outline: none;
  transition: border-color var(--transition);
}

.form-grid.compact input:focus,
.form-grid.compact select:focus {
  border-color: var(--primary);
}

.span-two {
  grid-column: span 2;
}

.modal-scroll-content {
  scrollbar-width: thin;
}

.details-section p {
  margin-bottom: var(--space-2);
  font-size: 14px;
}

.details-section h4 {
  font-size: 14px;
  font-weight: 600;
  margin-top: var(--space-3);
  margin-bottom: var(--space-2);
  color: var(--text);
}

.details-section ul {
  padding-left: var(--space-5);
  font-size: 13.5px;
}

.details-section li {
  margin-bottom: var(--space-1);
}

.mini-button.hidden {
  display: none !important;
}

.compact-table input,
.compact-table select {
  height: 32px;
  font-size: 13px;
  padding: 2px 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background-color: var(--panel);
  outline: none;
}

.cell-diff-warning {
  background-color: #FEF3C7 !important;
  color: #D97706 !important;
  font-weight: 600 !important;
}

.result-pill.matched-ref {
  background-color: var(--success-light);
  color: var(--success);
  border: 1px solid var(--success-border);
}

.result-pill.mismatch-ref {
  background-color: var(--warning-light);
  color: var(--warning);
  border: 1px solid var(--warning-border);
}

.batch-row.matched-ref td {
  background-color: #F0FDF4 !important;
}

.batch-row.mismatch-ref td {
  background-color: #FFFBEB !important;
}