/* ==========================================================================
   CONSOLIDATED HOLISTIC CLIENT REPORT STYLES
   ========================================================================== */

/* ==========================================================================
   1. CSS CUSTOM PROPERTIES SYSTEM
   ========================================================================== */

:root {
  /* Colors */
  --color-primary: #294A7F;
  --color-primary-dark: #263145;
  --color-primary-light: #f0f4ff;
  --color-brand-light: #D1CFCD;
  --color-brand-medium: #878EB0;
  --color-brand-dark: #7A7D76;
  --color-success: #878EB0;
  --color-success-light: #9CA3C4;
  --color-success-bg: #f3f4f8;
  --color-warning: #b8770f;
  --color-warning-bg: #fff8e6;
  --color-error: #dc2626;
  --color-error-bg: #fef2f2;
  --color-text-primary: #263145;
  --color-text-secondary: #5a5e57;
  --color-text-muted: #5f6368;
  --color-text-inverse: #ffffff;
  --color-bg-primary: #ffffff;
  --color-bg-secondary: #f8f9fa;
  --color-bg-muted: #878EB0;
  --color-bg-hover: #f8fafc;
  --color-border: #e5e7eb;
  --color-border-light: #e5e7eb;
  --color-border-medium: #d1d5db;
  --color-border-dark: #6A7193;

  /* Spacing */
  --spacing-xs: 4px;
  --spacing-sm: 8px;
  --spacing-md: 12px;
  --spacing-lg: 15px;
  --spacing-xl: 20px;
  --spacing-2xl: 25px;
  --spacing-3xl: 30px;
  --spacing-4xl: 40px;
  --spacing-5xl: 60px;
  --gap-sm: 15px;
  --gap-md: 20px;
  --gap-lg: 25px;
  --gap-xl: 30px;
  --gap-2xl: 40px;

  /* Typography */
  --font-primary: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'Courier New', monospace;
  --text-xs: 10px;
  --text-sm: 11px;
  --text-base: 12px;
  --text-md: 13px;
  --text-lg: 14px;
  --text-xl: 16px;
  --text-2xl: 18px;
  --text-3xl: 20px;
  --text-4xl: 24px;
  --text-5xl: 36px;
  --font-light: 300;
  --font-normal: 400;
  --font-medium: 500;
  --font-semibold: 600;
  --font-bold: 700;
  --leading-tight: 1.3;
  --leading-normal: 1.4;
  --leading-relaxed: 1.5;

  /* Layout */
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --radius-xl: 12px;
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 0 20px rgba(0,0,0,0.1);
}

@media print {
  :root {
    --shadow-md: none;
    --shadow-xl: none;
  }
}

/* ==========================================================================
   2. BASE STYLES
   ========================================================================== */

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

body {
  font-family: var(--font-primary);
  line-height: var(--leading-normal);
  color: var(--color-text-primary);
  background: var(--color-bg-secondary);
}

/* ==========================================================================
   3. LAYOUT & CONTAINER STYLES
   ========================================================================== */

.report-container {
  max-width: 8.5in;
  margin: 0 auto;
  background: var(--color-bg-primary);
  box-shadow: var(--shadow-xl);
}

.section {
  page-break-inside: avoid;
}

.section-container {
  background: var(--color-bg-primary);
}

.section-container > div {
  padding: var(--spacing-4xl);
  border-bottom: none; /* Remove section separator lines */
}

/* ==========================================================================
   4. CONSOLIDATED TABLE SYSTEM
   ========================================================================== */

/* Standardized Table - Based on Properties table design */
.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin: var(--spacing-lg) 0;
  font-size: var(--text-md);
  background: var(--color-bg-primary);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.table th {
  background: var(--color-primary);
  color: var(--color-text-inverse);
  padding: var(--spacing-lg) var(--spacing-md);
  text-align: left;
  font-weight: var(--font-semibold);
  font-size: var(--text-md);
  border: 1px solid var(--color-primary);
  border-top: none;
  border-left: none;
}

.table th:first-child {
  border-left: 1px solid var(--color-primary);
}

.table th:last-child {
  text-align: right;
}

.table td {
  padding: var(--spacing-lg) var(--spacing-md);
  border: 1px solid var(--color-border-light);
  border-top: none;
  border-left: none;
  font-size: var(--text-md);
  vertical-align: top;
}

.table td:first-child {
  font-weight: var(--font-medium);
  color: var(--color-primary-dark);
  border-left: 1px solid var(--color-border-light);
  text-align: left;
}

.table td:last-child {
  text-align: right;
  font-weight: var(--font-semibold);
}

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

/* Total row styling */
.table tr.table-total td {
  background: var(--color-bg-secondary);
  font-weight: var(--font-bold);
  border-top: 2px solid var(--color-border-dark);
}

/* Button Styles */
.btn {
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 14px;
  display: inline-block;
  text-decoration: none;
  line-height: 1.5;
}

.btn-primary {
  background: #3B82F6;
  color: white;
}

.btn-primary:hover {
  background: #2563eb;
  transform: translateY(-1px);
}

.btn-primary:disabled {
  background: #e5e7eb;
  color: #9ca3af;
  cursor: not-allowed;
  transform: none;
}

/* Center-aligned columns (for specific use cases) */
.table th.text-center,
.table td.text-center {
  text-align: center;
}

/* Ensure first column (row headers) are always left-aligned */
.table td:first-child.text-center {
  text-align: left;
}

/* Standardized column widths for Account Details tables (3-column: Institution, Account Type, Account #) */
.table--account-details th:nth-child(1),
.table--account-details td:nth-child(1) {
  width: 50%;
}

.table--account-details th:nth-child(2),
.table--account-details td:nth-child(2) {
  width: 25%;
}

.table--account-details th:nth-child(3),
.table--account-details td:nth-child(3) {
  width: 25%;
}

/* Table Layout for Tax Summary */
.table-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--gap-xl);
}

.table-column {
  background: var(--color-bg-primary);
  border-radius: var(--radius-lg) 0 0 var(--radius-lg);
  overflow: hidden;
  page-break-inside: avoid;
  display: flex;
  flex-direction: row;
  align-items: stretch;
}

.table-column-header {
  background: var(--color-primary);
  color: var(--color-text-inverse);
  padding: var(--spacing-lg) var(--spacing-sm);
  font-weight: var(--font-semibold);
  font-size: var(--text-lg);
  text-align: center;
  writing-mode: vertical-lr;
  text-orientation: mixed;
  width: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.table-column-content {
  padding: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.table-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--spacing-xs) var(--spacing-lg);
  border: 1px solid var(--color-border-light);
  border-top: none;
  font-size: var(--text-md);
}

.table-row:first-child {
  border-top: 1px solid var(--color-border-light);
}

.table-row--highlight {
  background: var(--color-warning-bg);
  font-weight: var(--font-semibold);
}

.table-row--total {
  background: var(--color-bg-primary);
  font-weight: var(--font-bold);
}

.table-row-label {
  color: var(--color-primary-dark);
  flex: 1;
  text-align: left;
  font-weight: var(--font-semibold);
}

.table-row-value {
  color: var(--color-primary-dark);
  font-weight: var(--font-normal);
  text-align: right;
  white-space: nowrap;
}

/* Table Cell Modifiers */
.table-cell--masked {
  font-family: var(--font-mono);
  color: var(--color-text-secondary);
}

.table-cell--positive {
  color: var(--color-success);
}

.table-cell--negative {
  color: var(--color-error);
}

.table-cell--refund {
  color: var(--color-success);
}

/* ==========================================================================
   5. CONSOLIDATED CARD SYSTEM
   ========================================================================== */

/* Base Card */
.card {
  background: var(--color-bg-primary);
  border-radius: var(--radius-lg);
  padding: var(--spacing-xl);
  page-break-inside: avoid;
}

/* Card Modifiers */
.card--stat {
  text-align: center;
  padding: var(--spacing-xl);
  background: var(--color-brand-light);
  border: 1px solid var(--color-border-dark);
}

.card--vault-stat {
  padding: 16px 12px;
  background: var(--color-brand-light);
  border-radius: var(--radius-md);
  text-align: center;
  box-sizing: border-box;
  border: 1px solid var(--color-border-light);
}

.vault-stat-number {
  font-size: 18px;
  font-weight: bold;
  line-height: 1.2;
  margin: 0;
  display: block;
  padding-top: 8px;
}

.vault-stat-label {
  font-size: 10px;
  font-weight: 500;
  line-height: 1.3;
  margin: 0;
  display: block;
  padding-top: 4px;
  padding-bottom: 8px;
}

/* Vault stats 2x4 grid layout - for both HTML and PDF */
.vault-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 30px;
}

.card--account {
  border: 2px solid var(--color-primary);
  padding: var(--spacing-lg);
}

.card--insurance {
  border: 2px solid var(--color-primary);
  padding: var(--spacing-lg);
}


/* Status Cards */
.card--status {
  padding: 0;
  border: 2px solid;
  border-radius: var(--radius-lg);
  background: var(--color-bg-primary);
  overflow: hidden;
}

.card--status-success {
  border-color: var(--color-success-light);
}

.card--status-warning {
  border-color: var(--color-warning);
}

.card--status-error {
  border-color: var(--color-error);
}

.card--status-primary {
  border-color: var(--color-primary);
}

.card--status-neutral {
  border-color: var(--color-brand-medium);
}

.card-status-header {
  padding: var(--spacing-md) var(--spacing-lg);
  margin: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 64px;
}

.card--status-success .card-status-header {
  background: var(--color-success-light);
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

.card--status-warning .card-status-header {
  background: var(--color-warning);
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

.card--status-error .card-status-header {
  background: var(--color-error);
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

.card--status-primary .card-status-header {
  background: var(--color-primary);
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

.card--status-neutral .card-status-header {
  background: var(--color-brand-medium);
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

.card-status-title {
  font-size: var(--text-lg); /* Changed from xl to match H3 */
  font-weight: var(--font-semibold);
  margin: 0;
  color: var(--color-text-inverse);
  text-align: left;
}

.card-status-metric {
  font-size: var(--text-2xl);
  font-weight: var(--font-bold);
  color: var(--color-text-inverse);
  background: rgba(255, 255, 255, 0.2);
  padding: var(--spacing-xs) var(--spacing-md);
  border-radius: var(--radius-sm);
  min-width: 40px;
  text-align: center;
}

.card-status-content {
  padding: var(--spacing-md) var(--spacing-lg);
  text-align: left;
}

.card-status-content:empty {
  display: none;
}

.status-list {
  margin: 0;
  padding-left: var(--spacing-lg);
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  line-height: var(--leading-relaxed);
}

.status-list li {
  margin-bottom: var(--spacing-xs);
}

/* Card Content */
.card-header {
  margin-bottom: var(--spacing-xs);
  text-align: left;
}

.card-title {
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  color: var(--color-primary);
  margin: 0;
  text-align: left;
}


.card-subtitle {
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
  line-height: var(--leading-tight);
}

/* Stat Card Specific */
.stat-value {
  font-size: var(--text-4xl);
  font-weight: var(--font-bold);
  color: var(--color-primary);
  margin-bottom: var(--spacing-xs);
}

.stat-label {
  font-size: var(--text-base);
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.vault-stat-number {
  font-size: var(--text-3xl);
  font-weight: var(--font-bold);
  color: var(--color-primary);
}

.vault-stat-label {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  margin-top: var(--spacing-xs);
}

/* ==========================================================================
   6. CONSOLIDATED GRID SYSTEM
   ========================================================================== */

.grid {
  display: grid;
  gap: var(--gap-md);
}

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

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

.grid--4 {
  grid-template-columns: repeat(4, 1fr);
}

.grid--gap-sm {
  gap: var(--gap-sm);
}

.grid--gap-lg {
  gap: var(--gap-lg);
}

.grid--gap-xl {
  gap: var(--gap-xl);
}

/* ==========================================================================
   7. CONSOLIDATED STATUS SYSTEM
   ========================================================================== */

.status {
  padding: var(--spacing-sm);
  border-radius: var(--radius-sm);
  font-weight: var(--font-semibold);
  font-size: var(--text-base);
  text-align: center;
}

.status--success {
  background: var(--color-success);
  color: var(--color-text-inverse);
}

.status--error {
  background: var(--color-error);
  color: var(--color-text-inverse);
}

.status--neutral {
  background: var(--color-brand-medium);
  color: var(--color-text-inverse);
}

.status--warning {
  background: var(--color-warning);
  color: var(--color-text-inverse);
}

/* Badge System */
.badge {
  padding: 2px var(--spacing-sm);
  border-radius: var(--radius-xl);
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
  color: var(--color-text-inverse);
}

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

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

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

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

.badge--neutral {
  background: var(--color-brand-medium);
}

/* ==========================================================================
   8. HEADER STYLES
   ========================================================================== */

/* Report Header */
.report-header {
  background: linear-gradient(135deg, var(--color-primary-dark) 0%, var(--color-primary) 100%);
  color: var(--color-text-inverse);
  padding: var(--spacing-4xl) var(--spacing-4xl) var(--spacing-5xl) var(--spacing-4xl);
  position: relative;
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--spacing-3xl);
}

.logo-section {
  display: flex;
  align-items: center;
  gap: var(--spacing-lg);
}

.logo {
  width: 60px;
  height: 60px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
}

.company-info {
  color: var(--color-text-inverse);
  opacity: 0.9;
}

.company-name {
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
  margin-bottom: var(--spacing-xs);
}

.company-location {
  font-size: var(--text-sm);
}

.report-title {
  font-size: var(--text-5xl);
  font-weight: var(--font-light);
  margin-bottom: var(--spacing-xl);
  letter-spacing: -0.5px;
  clear: both;
}

.client-info {
  font-size: var(--text-2xl);
  opacity: 0.9;
}

/* Page Headers */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--spacing-xl);
  padding-bottom: var(--spacing-lg);
  border-bottom: 2px solid var(--color-border-light);
  position: relative;
}

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

.page-header--with-title .page-title {
  text-align: center;
  margin: 0;
  font-size: var(--text-2xl);
  font-weight: var(--font-semibold);
  color: var(--color-primary-dark);
  flex: 1;
}

.page-logo {
  width: 50px;
  height: 50px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Section Headers */
.section-header {
  margin-bottom: var(--spacing-3xl);
}

.section-title {
  font-size: var(--text-4xl);
  font-weight: var(--font-semibold);
  color: var(--color-primary-dark);
  margin-bottom: var(--spacing-sm);
}

.section-subtitle {
  font-size: var(--text-lg);
  color: var(--color-text-secondary);
  line-height: var(--leading-relaxed);
  text-align: left;
  width: 100%;
}

/* Category Headers */
.category-header {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
  margin-bottom: var(--spacing-md);
  padding-bottom: var(--spacing-sm);
  border-bottom: 2px solid var(--color-primary);
  page-break-after: avoid;
  page-break-inside: avoid;
}

.category-icon {
  font-size: var(--text-3xl);
}

.category-title {
  color: var(--color-primary);
  margin: 0;
  font-size: var(--text-xl);
  font-weight: var(--font-semibold);
}

h3 {
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  text-decoration: none;
  border-bottom: none;
  text-align: left;
  color: var(--color-primary-dark);
}


/* ==========================================================================
   9. TABLE OF CONTENTS
   ========================================================================== */

.toc {
  padding: var(--spacing-4xl);
  background: var(--color-bg-primary);
  border-bottom: 1px solid var(--color-border-light);
}

.toc-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--spacing-xl);
}

.toc-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--spacing-sm) 0;
  border-bottom: 1px dotted var(--color-border-medium);
  font-size: var(--text-lg);
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.toc-item:hover {
  background-color: var(--color-bg-hover);
  padding-left: var(--spacing-sm);
  padding-right: var(--spacing-sm);
  margin-left: calc(-1 * var(--spacing-sm));
  margin-right: calc(-1 * var(--spacing-sm));
  border-radius: var(--radius-sm);
}

.toc-item:last-child {
  border-bottom: none;
}

.toc-link {
  color: inherit;
  text-decoration: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.page-num {
  color: var(--color-text-muted);
  font-weight: var(--font-medium);
}

/* Disclaimer section */
.disclaimer-section {
  padding: var(--spacing-2xl) var(--spacing-4xl);
  background: var(--color-bg-secondary);
  border-top: 1px solid var(--color-border-light);
  margin-bottom: var(--spacing-xl);
}

.disclaimer-text {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  line-height: 1.5;
  text-align: left;
  margin: 0;
  max-width: none;
}

/* Executive Summary font consistency fix */
.card ul {
  font-size: var(--text-sm);
}

.card li {
  font-size: var(--text-sm);
  line-height: 1.4;
}

/* ==========================================================================
   10. ACCESSIBILITY STYLES
   ========================================================================== */

/* Essential Focus Indicators for ADA Compliance */
*:focus {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(41, 74, 127, 0.15);
}

/* Enhanced focus for interactive elements */
.toc-link:focus,
a:focus,
button:focus {
  background-color: var(--color-primary-light);
  border-radius: var(--radius-sm);
  transition: background-color 0.2s ease;
}

/* Table focus indicators */
.table th:focus,
.table td:focus {
  background-color: var(--color-primary-light);
  outline: 2px solid var(--color-primary);
  outline-offset: -1px;
}

/* Skip navigation link for screen readers */
.skip-link {
  position: absolute;
  left: -9999px;
  z-index: 999;
  padding: var(--spacing-md) var(--spacing-lg);
  background: var(--color-primary);
  color: var(--color-text-inverse);
  text-decoration: none;
  font-weight: var(--font-semibold);
  border-radius: var(--radius-sm);
}

.skip-link:focus {
  left: var(--spacing-md);
  top: var(--spacing-md);
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  :root {
    --color-text-secondary: #2d3748;
    --color-border-light: #4a5568;
  }
}

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

/* ==========================================================================
   11. UTILITY CLASSES
   ========================================================================== */

.section-spacing {
  margin-bottom: var(--spacing-lg);
  page-break-inside: auto;
}

.loading {
  padding: var(--spacing-4xl);
  text-align: center;
  color: var(--color-text-muted);
}

.text-positive {
  color: var(--color-success);
}

.text-negative {
  color: var(--color-error);
}

.text-warning {
  color: var(--color-warning);
}

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

.text-primary {
  color: var(--color-primary);
}

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

/* ==========================================================================
   12. PRINT & PDF STYLES
   ========================================================================== */

@media print {
  /* Reset and base print styles */
  * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
    color-adjust: exact !important;
  }
  
  /* WeasyPrint-specific fixes */
  html {
    font-size: 12pt !important;
  }
  
  body {
    font-size: 12pt !important;
    line-height: 1.4 !important;
    margin: 0 !important;
    padding: 0 !important;
    background: var(--color-bg-primary) !important;
  }
  
  /* Fix container widths for print */
  .report-container {
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
  }
  
  /* Fix grid layouts for WeasyPrint */
  .grid {
    display: block !important;
    margin-bottom: var(--spacing-lg);
    width: 100% !important;
    overflow: visible !important;
  }
  
  .grid--2 > * {
    display: inline-block !important;
    width: 49% !important;
    vertical-align: top !important;
    margin-right: 1% !important;
    margin-bottom: var(--spacing-md) !important;
    box-sizing: border-box !important;
  }
  
  .grid--2 > *:nth-child(2n) {
    margin-right: 0 !important;
  }
  
  /* Vault section 2x4 grid layout */
  .vault-stats-grid {
    display: grid !important;
    grid-template-columns: 1fr 1fr 1fr 1fr !important;
    grid-template-rows: 1fr 1fr !important;
    gap: 12px !important;
    margin-bottom: 30px !important;
  }
  
  .vault-stats-grid > * {
    width: auto !important;
    margin: 0 !important;
    display: block !important;
  }
  
  /* Vault card fixes for PDF - Remove all size constraints and let them expand */
  .card--vault-stat {
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    align-items: center !important;
    width: auto !important;
    height: auto !important;
    min-height: 80px !important;
    padding: 15px 10px !important;
    box-sizing: border-box !important;
    margin: 0 !important;
    text-align: center !important;
  }
  
  .vault-stat-number {
    font-size: 24px !important;
    font-weight: bold !important;
    line-height: 1.2 !important;
    margin-bottom: 4px !important;
  }
  
  .vault-stat-label {
    font-size: 12px !important;
    line-height: 1.3 !important;
  }
  
  .grid--3 > * {
    display: inline-block !important;
    width: 32.5% !important;
    vertical-align: top !important;
    margin-right: 1% !important;
    margin-bottom: var(--spacing-md) !important;
    box-sizing: border-box !important;
  }
  
  .grid--3 > *:nth-child(3n) {
    margin-right: 0 !important;
  }
  
  
  /* Fix flexbox layouts */
  .flex {
    display: block !important;
  }
  
  .flex > * {
    display: block !important;
    margin-bottom: var(--spacing-sm) !important;
  }
  
  /* Page setup for US Letter (8.5" x 11") */
  @page {
    size: 8.5in 11in;
    margin: 0.4in 0.4in 0.5in 0.4in; /* Reduced margins for more content space */
    
    @top-right {
      content: counter(page);
      font-family: var(--font-primary);
      font-size: 10pt;
      color: var(--color-text-secondary);
      margin-top: 0.2in;
    }
    
    @bottom-center {
      content: "This report is generated from client vault data as of 7/26/2025. Content may vary by available information. Kete LLC makes no representations regarding data accuracy, completeness, or timeliness. For informational purposes only - not legal, financial, or tax advice. (*) indicates third-party data sources. © 2025 Kete LLC. All rights reserved.";
      font-family: var(--font-primary);
      font-size: 7pt;
      color: var(--color-text-secondary);
      line-height: 1.3;
      width: 7.3in;
      text-align: center;
      margin-top: -0.2in;
    }
  }
  
  /* Title page - no page break after */
  @page:first {
    margin: 0.4in;
    
    @top-right {
      content: none; /* No page number on title page */
    }
    
    @bottom-center {
      content: none; /* No disclaimer on title page */
    }
  }
  
  /* Container and layout adjustments */
  .report-container {
    box-shadow: none;
    max-width: none;
    width: 100%;
    margin: 0;
    background: transparent;
  }
  
  /* Title Page and TOC on same page */
  .report-header {
    page-break-after: avoid;
    min-height: auto;
    height: auto;
    padding: var(--spacing-xl) var(--spacing-2xl) var(--spacing-2xl) var(--spacing-2xl);
    margin-bottom: var(--spacing-xl);
  }
  
  /* Fix logo size in print */
  .logo {
    width: 80px !important;
    height: 80px !important;
  }
  
  .logo img {
    width: 80px !important;
    height: 80px !important;
    display: block !important;
  }
  
  .toc {
    page-break-before: avoid;
    page-break-after: always;
    min-height: auto;
    padding: var(--spacing-xl) 0;
    border-bottom: none;
  }
  
  /* Hide disclaimer section in print (appears in page footer instead) */
  .disclaimer-section {
    display: none !important;
  }
  
  /* CLEAN PAGINATION RULES */
  
  /* Rule 1: Allow sections to flow naturally unless specifically forced */
  .section {
    page-break-before: auto;
    padding: 0;
    margin: 0;
    border-bottom: none !important;
  }
  
  /* First section doesn't need page break */
  .section:first-of-type {
    page-break-before: auto;
  }
  
  /* REVISED PAGINATION RULES */
  
  /* H3 headings should stay with their content */
  h3 {
    page-break-inside: avoid;
    break-inside: avoid;
    page-break-after: avoid;
  }
  
  /* Section-spacing: Allow natural breaking for large content */
  .section-spacing {
    page-break-inside: auto;
    break-inside: auto;
  }
  
  /* Category headers (H2) should stay with immediate content */
  .category-header {
    page-break-before: auto;
    page-break-after: avoid;
    page-break-inside: avoid;
  }
  
  /* Force all report sections to start on new pages */
  #executive-summary,
  #vault-audit,
  #key-dates,
  #known-accounts,
  #investment-overview,
  /* #tax-summary, -- Commented out for special handling */
  #income-summary,
  /* #real-estate-summary, -- Commented out for special handling */
  #property-detail,
  /* #insurance-overview, -- Commented out for special handling */
  #employer-benefits,
  #social-security,
  #estate-planning {
    page-break-before: always;
  }
  
  /* Tax Summary flows naturally, Insurance Overview avoids page break */
  #tax-summary {
    page-break-before: auto !important;
    page-break-after: auto !important;
    page-break-inside: auto !important;
    break-before: auto !important;
    break-after: auto !important;
    break-inside: auto !important;
  }
  
  #insurance-overview {
    page-break-before: avoid !important;
    page-break-after: auto !important;
    page-break-inside: auto !important;
    break-before: avoid !important;
    break-after: auto !important;
    break-inside: auto !important;
  }
  
  #real-estate-summary {
    page-break-before: always !important;
    page-break-after: auto !important;
    page-break-inside: auto !important;
    break-before: always !important;
    break-after: auto !important;
    break-inside: auto !important;
  }
  
  /* Always keep headers with their content */
  .page-header {
    margin-bottom: var(--spacing-lg);
    padding-bottom: var(--spacing-md);
    border-bottom: 2px solid var(--color-primary);
    page-break-after: avoid;
    page-break-inside: avoid;
  }
  
  .section-header {
    page-break-after: avoid;
    page-break-inside: avoid;
    margin-bottom: var(--spacing-md);
  }
  
  .page-title {
    font-size: 18pt;
    margin-bottom: var(--spacing-sm);
  }
  
  .section-subtitle {
    font-size: 11pt;
    margin-bottom: var(--spacing-lg);
  }
  
  /* Component-level pagination rules */
  
  /* Cards stay together - enhanced for PDF compatibility */
  .card {
    page-break-inside: avoid !important;
    break-inside: avoid !important;
    -webkit-page-break-inside: avoid !important;
    page-break-before: auto;
    page-break-after: auto;
    margin-bottom: var(--spacing-lg);
    border: 1px solid var(--color-border-light);
    box-sizing: border-box !important;
    width: 100% !important;
  }
  
  /* Fix all card content padding */
  .card-content {
    padding: var(--spacing-md) var(--spacing-lg) !important;
    margin: 0 !important;
  }
  
  /* Grid containers for action items - keep together when small */
  .grid {
    page-break-inside: avoid;
    break-inside: avoid;
  }
  
  .card--status {
    page-break-inside: avoid !important;
    break-inside: avoid !important;
    -webkit-page-break-inside: avoid !important;
    margin-bottom: var(--spacing-md);
  }
  
  /* Action item cards - extra protection */
  .card[style*="border: 1px solid var(--color-error)"],
  .card[style*="border: 1px solid var(--color-warning)"],
  .card[style*="border: 1px solid var(--color-primary)"] {
    page-break-inside: avoid !important;
    break-inside: avoid !important;
    -webkit-page-break-inside: avoid !important;
    page-break-before: auto;
    page-break-after: avoid;
    /* Fix height expansion issues */
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    min-height: 120px !important;
    height: auto !important;
  }
  
  /* Grid layouts - simplified for PDF compatibility */
  .grid {
    margin-bottom: var(--spacing-lg);
    page-break-inside: avoid !important;
    break-inside: avoid !important;
    -webkit-page-break-inside: avoid !important;
    page-break-before: auto;
    display: grid !important;
  }
  
  /* Ensure Tax Planning Action Items cards have equal heights */
  #tax-summary .grid--2 {
    align-items: stretch !important;
    grid-template-rows: 1fr !important;
  }
  
  /* Grid containers with cards must stay together completely */
  .grid:has(.card) {
    page-break-inside: avoid !important;
    break-inside: avoid !important;
    -webkit-page-break-inside: avoid !important;
    page-break-before: auto;
  }
  
  .grid--2 {
    grid-template-columns: 1fr 1fr !important;
    gap: var(--spacing-md) !important;
  }
  
  .grid--3 {
    grid-template-columns: 1fr 1fr 1fr !important;
    gap: var(--spacing-md) !important;
  }
  
  .grid--4 {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: var(--spacing-sm) !important;
  }
  
  /* DEBUG: Removed 4-column exceptions */
  
  /* CRITICAL FIX: Real Estate Summary cards on page 14 are height-constrained */
  #real-estate-summary .grid--4:first-of-type .card {
    /* Force adequate height for both lines of content */
    min-height: 120px !important;
    height: auto !important;
    max-height: none !important;
    
    /* Ensure content is visible */
    overflow: visible !important;
    
    /* Force proper display */
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    align-items: center !important;
    
    /* Ensure text doesn't get clipped */
    padding: var(--spacing-lg) !important;
    box-sizing: border-box !important;
    
    /* Page break protection */
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }
  
  /* Ensure the text elements inside are visible */
  #real-estate-summary .grid--4:first-of-type .card > div {
    width: 100% !important;
    overflow: visible !important;
  }
  
  
  /* Table layouts stay together as complete units */
  .table-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--gap-lg);
    margin-bottom: var(--spacing-xl);
    page-break-inside: avoid;
    break-inside: avoid;
  }
  
  /* Keep related grid layouts together (like bottom row in tax summary) */
  .section-spacing .table-layout + div[style*="display: grid"] {
    page-break-before: avoid;
    page-break-inside: avoid;
    break-inside: avoid;
  }
  
  .table-column {
    page-break-inside: avoid;
    break-inside: avoid;
  }
  
  /* Tables prefer to stay together but can break for very large tables */
  .table {
    page-break-inside: auto;
    margin-bottom: var(--spacing-xl);
    font-size: 10pt;
    border: 1px solid var(--color-border-light);
  }
  
  /* Table rows should never break across pages */
  .table tr {
    page-break-inside: avoid !important;
    break-inside: avoid !important;
    -webkit-page-break-inside: avoid !important;
  }
  
  /* Table headers should stay with content */
  .table thead {
    page-break-after: avoid;
  }
  
  .table th {
    background: var(--color-primary) !important;
    color: var(--color-text-inverse) !important;
    font-size: 10pt;
    padding: 8pt 6pt;
  }
  
  .table td {
    font-size: 10pt;
    padding: 6pt;
    border-bottom: 1px solid var(--color-border-light);
  }
  
  .table thead {
    break-inside: avoid;
    break-after: avoid;
  }
  
  .table tbody tr {
    page-break-inside: avoid;
    break-inside: avoid;
  }
  
  /* Action items - compact for print */
  .card[style*="border-left-width: 4px"] {
    margin-bottom: var(--spacing-md);
    padding: var(--spacing-sm) var(--spacing-md);
    break-inside: avoid;
    page-break-inside: avoid;
  }
  
  /* Remove interactive states for print */
  .toc-item:hover,
  .table tbody tr:hover,
  *:focus {
    background-color: transparent !important;
    outline: none !important;
    box-shadow: none !important;
  }
  
  /* Hide skip links and other screen-only elements */
  .skip-link {
    display: none !important;
  }
  
  /* Ensure backgrounds print */
  .card-status-header {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  
  /* Account Details section flows naturally */
  #known-accounts .category-header:nth-of-type(2) {
    page-break-before: auto;
  }
  
  /* Fix alignment issues in Known Accounts cards */
  #known-accounts .card-status-header {
    align-items: center !important;
    display: flex !important;
    justify-content: space-between !important;
    min-height: 64px !important;
  }
  
  #known-accounts .card-status-title {
    display: flex !important;
    align-items: center !important;
    line-height: 1.2 !important;
    vertical-align: middle !important;
  }
  
  
  /* Allow Tax Summary table layout to break if needed */
  #tax-summary .table-layout:first-of-type {
    page-break-inside: auto !important;
    break-inside: auto !important;
    page-break-before: avoid !important;
    break-before: avoid !important;
  }
  
  
  /* Specific rule to keep Return Summary header and content together */
  #tax-summary .category-header:first-of-type {
    page-break-after: avoid !important;
    break-after: avoid !important;
  }

  /* Real Estate Summary: Keep summary content with header */
  #real-estate-summary .page-header {
    page-break-after: avoid;
  }

  
  /* Force Tax Planning Action Items to new page */
  #tax-summary .section-spacing:last-child {
    page-break-before: auto;
  }
  
  /* Income Summary: Prevent categories from breaking across pages */
  #income-summary h3 {
    page-break-after: avoid;
    break-after: avoid;
  }
  
  #income-summary .table {
    page-break-before: avoid;
    break-before: avoid;
  }
  
  /* Keep each income category together (H3 + table) */
  #income-summary .section-spacing {
    /* DISABLED FOR DEBUGGING: page-break-inside: avoid; */
    /* DISABLED FOR DEBUGGING: break-inside: avoid; */
    page-break-inside: auto;
    break-inside: auto;
  }
  
  
  #real-estate-summary .category-header h2.category-title + div {
    page-break-before: avoid;
    break-before: avoid;
  }
  
  /* Allow Action Items to break to new page if needed */
  #real-estate-summary .section-spacing:last-child {
    page-break-before: auto;
    page-break-inside: avoid;
  }
  
  /* Property Detail: Keep two-column layout and fit on one page */
  #property-detail {
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }
  
  #property-detail .table-layout {
    grid-template-columns: 1fr 1fr !important;
    gap: var(--spacing-lg) !important;
    page-break-inside: avoid;
    break-inside: avoid;
  }
  
  /* Insurance Overview: Fix layout and page flow */
  #insurance-overview .section-spacing:first-child {
    page-break-after: auto;
    break-after: auto;
    page-break-before: auto;
    page-break-inside: auto;
    break-inside: auto;
  }
  
  /* Fix insurance card backgrounds reaching borders */
  #insurance-overview .card--status .card-status-header {
    margin: 0;
    padding: var(--spacing-sm) var(--spacing-md);
  }

  /* Fix vault audit section pagination and colored backgrounds */
  #vault-audit {
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }

  /* Vault audit uses standard card styles - no overrides needed */
  /* Removed vault-specific overrides that were breaking rendering */
  
  /* Fix Insurance Action Items font size and page breaks */
  #insurance-overview h2.category-title {
    font-size: var(--text-xl) !important;
  }
  
  #insurance-overview .section-spacing:last-child {
    page-break-before: auto;
    page-break-after: auto;
  }
  
  /* Insurance Overview: Ultra-compact spacing to fit on one page */
  #insurance-overview .card--status {
    margin-bottom: 2px !important;
  }
  
  #insurance-overview .card-status-header {
    padding: 3px 6px !important;
  }
  
  #insurance-overview .grid--4 {
    gap: 3px !important;
  }
  
  /* Section spacing optimization - reduced for better pagination */
  .section-spacing {
    margin-bottom: var(--spacing-md);
  }
  
  /* Subsection spacing - lighter spacing for nested content */
  .subsection {
    margin-bottom: var(--spacing-sm);
    /* Keep H3 sections together with their content */
    page-break-inside: avoid;
    break-inside: avoid;
  }
  
  /* PDF-friendly horizontal headers (WeasyPrint limitation workaround) */
  .table-column-header {
    /* Make headers horizontal for better PDF compatibility */
    writing-mode: horizontal-tb !important;
    text-orientation: mixed !important;
    width: auto !important;
    min-width: 120px !important;
    height: auto !important;
    min-height: 60px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
    text-align: center !important;
    padding: var(--spacing-md) var(--spacing-sm) !important;
    /* No transforms */
    transform: none !important;
  }
  
  /* Adjust table layout for horizontal headers */
  .table-layout {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: var(--spacing-lg) !important;
  }
  
  .table-column {
    display: flex !important;
    flex-direction: column !important;
    border: none !important;
    border-radius: 8px !important;
    overflow: hidden !important;
    background: var(--color-bg-primary) !important;
  }
  
  /* Header gets top corners only */
  .table-column-header {
    border-radius: 8px 8px 0 0 !important;
    margin: 0 !important;
    border: none !important;
  }
  
  /* Content gets bottom corners only */
  .table-column-content {
    border-radius: 0 0 8px 8px !important;
    flex: 1 !important;
    border: none !important;
    background: var(--color-bg-primary) !important;
  }
  
  
  /* Category headers */
  .category-header {
    page-break-after: avoid;
    margin-bottom: var(--spacing-md);
    border-bottom: 1px solid var(--color-primary);
  }
  
  .category-title {
    font-size: 12pt;
  }
  
  /* Prevent orphans and widows */
  h1, h2, h3, h4, h5, h6 {
    page-break-after: avoid;
    break-after: avoid;
  }
  
  p {
    orphans: 3;
    widows: 3;
  }
  
  /* Allow sections to flow naturally - removed forced page breaks */
  
  /* Print utility classes */
  .print-break-before {
    page-break-before: always;
  }
  
  .print-break-after {
    page-break-after: always;
  }
  
  .print-no-break {
    page-break-inside: avoid;
    break-inside: avoid;
  }
  
  .print-keep-together {
    page-break-inside: avoid;
    break-inside: avoid;
    orphans: 3;
    widows: 3;
  }
  
  /* Specific financial table optimizations */
  .financial-summary {
    page-break-inside: avoid;
    break-inside: avoid;
    margin-bottom: var(--spacing-xl);
  }
  
  /* Insurance cards grid - ensure proper breaks */
  .grid[style*="border:"] > .card--status {
    min-height: auto;
    break-inside: avoid;
  }
  
  /* Fix font size consistency - Executive Summary lists */
  .card ul {
    font-size: var(--text-sm) !important;
  }
  
  .card li {
    font-size: var(--text-sm) !important;
    line-height: 1.4 !important;
  }
  
  /* Vault Summary - allow break after document categories if needed */
  #vault-audit {
    page-break-inside: auto !important;
    page-break-after: always !important;
  }
  
  /* Keep the summary sections together */
  #vault-audit .grid--2.section-spacing {
    page-break-inside: avoid !important;
    page-break-after: auto !important;
  }
  
  /* Reduce header spacing */
  #vault-audit .page-header {
    margin-bottom: 8px !important;
    padding: 8px !important;
  }
  
  #vault-audit .section-header {
    margin-bottom: 8px !important;
  }
  
  #vault-audit .section-subtitle {
    margin-bottom: 8px !important;
    font-size: 10pt !important;
  }
  
  /* Reduce heading sizes and spacing */
  #vault-audit h1 {
    font-size: 18pt !important;
    margin-bottom: 8px !important;
  }
  
  #vault-audit h3 {
    font-size: 12pt !important;
    margin-bottom: 6px !important;
    margin-top: 4px !important;
  }
  
  /* Remove gap above Document Categories */
  #vault-audit h3[style*=\"margin-bottom: var(--spacing-xl)\"] {
    margin-top: 4px !important;
    margin-bottom: 8px !important;
  }
  
  /* Compact the two-column summary layout */
  #vault-audit .grid--2 {
    margin-bottom: 8px !important;
  }
  
  
  /* Fix coverage overview - use 2 columns instead of 3 to prevent overflow */
  #vault-audit .grid--3.grid--gap-sm {
    display: block !important;
    margin-bottom: 12px !important;
  }
  
  #vault-audit .grid--3.grid--gap-sm > div {
    display: inline-block !important;
    width: 32% !important;
    margin-right: 1% !important;
    margin-bottom: 8px !important;
    vertical-align: top !important;
    box-sizing: border-box !important;
  }
  
  #vault-audit .grid--3.grid--gap-sm > div:nth-child(3n) {
    margin-right: 0 !important;
  }
  
  /* Style the coverage cards */
  #vault-audit .grid--3 > div:not(.card) {
    background: var(--color-primary) !important;
    color: white !important;
    padding: 10px 8px !important;
    border-radius: 4px !important;
    text-align: center !important;
    font-size: 9pt !important;
  }
  
  #vault-audit .grid--3 > div:not(.card) > div:first-child {
    font-size: 16pt !important;
    font-weight: bold !important;
    margin-bottom: 4px !important;
    line-height: 1.1 !important;
  }
  
  /* Compact document category cards */
  #vault-audit .grid--3 {
    gap: 4px !important;
    margin-bottom: 8px !important;
  }
  
  #vault-audit .card--status {
    margin-bottom: 4px !important;
  }
  
  #vault-audit .card-status-header {
    padding: 6px 10px !important;
  }
  
  #vault-audit .card-status-title {
    font-size: 10pt !important;
  }
  
  #vault-audit .card-status-metric {
    font-size: 10pt !important;
  }
  
  #vault-audit .card-status-content {
    padding: 8px 12px !important;
    font-size: 9pt !important;
    min-height: 25px !important;
  }
  
  #vault-audit .status-list {
    margin: 2px 0 !important;
    padding-left: 16px !important;
  }
  
  #vault-audit .status-list li {
    margin-bottom: 2px !important;
    line-height: 1.2 !important;
  }
  
  /* Action Items section page break control */
  h2[style*="Action Items"] {
    page-break-before: auto;
    break-before: auto;
    page-break-after: avoid;
    break-after: avoid;
  }
  
  /* Container holding Action Items - prevent splitting */
  .section-spacing:last-child {
    /* DISABLED FOR DEBUGGING: page-break-inside: avoid; */
    /* DISABLED FOR DEBUGGING: break-inside: avoid; */
    page-break-inside: auto;
    break-inside: auto;
    orphans: 3;
    widows: 3;
  }
}

/* ==========================================================================
   13. RESPONSIVE STYLES
   ========================================================================== */

@media screen {
  .report-container {
    max-width: 8.5in;
  }
  
  .section-container > div {
    min-height: calc(11in - 200px);
    border-bottom: none; /* Remove grey line at end of sections */
  }
}

@media (max-width: 768px) {
  .grid--4 {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--spacing-xl);
  }
  
  /* Keep tax summary and property detail as two columns but make other table-layouts single column */
  .table-layout:not(#tax-summary .table-layout):not(#property-detail .table-layout) {
    grid-template-columns: 1fr;
    gap: var(--spacing-xl);
  }
  
  .grid--3 {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .grid--2 {
    grid-template-columns: 1fr;
  }
}
/* Property Detail Street View Styles */
.property-streetview-container {
    padding: 0 !important;
    position: relative;
    overflow: hidden;
    min-height: 200px;
}

.property-streetview-image {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover;
    display: block;
}

/* Print-specific styles for property street view */
@media print {
    .property-streetview-container {
        min-height: 150px;
        max-height: 200px;
        page-break-inside: avoid;
    }
    
    .property-streetview-image {
        width: 100% !important;
        height: auto !important;
        max-height: 200px;
        object-fit: contain;
        object-position: center;
    }
}

/* WeasyPrint-specific optimizations */
@media print {
    /* Ensure proper page breaks for property detail */
    #property-detail {
        page-break-before: auto;
        page-break-after: auto;
    }
    
    .table-layout {
        page-break-inside: avoid;
    }
}

/* Add Documents Page Styles - Integrated from modular version */
/* Add Documents Page Styles */
/* Production-ready modular CSS */

body {
    margin: 0;
    background: var(--color-bg-secondary);
    min-height: 100vh;
}

/* Header Styles */
.app-header {
    background: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    padding: var(--spacing-md) var(--spacing-xl);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-left {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.back-btn {
    padding: var(--spacing-sm);
    background: none;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    width: 40px;
    height: 40px;
}

.back-btn:hover {
    background: var(--color-bg-muted);
}

.back-btn img {
    width: 40px !important;
    height: 40px !important;
    object-fit: contain;
}

.page-title {
    margin: 0;
    font-size: 1.5rem;
    color: var(--color-text-primary);
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: var(--spacing-xl);
}

/* Step Indicator */
.step-indicator {
    display: flex;
    justify-content: space-between;
    margin-bottom: var(--spacing-xl);
    position: relative;
    padding: 0 var(--spacing-xl);
}

.step-indicator::before {
    content: '';
    position: absolute;
    top: 20px;
    left: var(--spacing-xl);
    right: var(--spacing-xl);
    height: 2px;
    background: var(--color-border);
    z-index: 0;
}

.step {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 1;
}

.step-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: white;
    border: 2px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    margin-bottom: var(--spacing-sm);
    color: var(--color-text-secondary);
}

.step.active .step-circle {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
}

.step.completed .step-circle {
    background: var(--color-text-secondary);
    color: white;
    border-color: var(--color-text-secondary);
}

.step-label {
    font-size: 0.875rem;
    color: var(--color-text-secondary);
    text-align: center;
}

/* Option Selection Section */
.options-section {
    background: white;
    border-radius: 12px;
    padding: var(--spacing-xl);
    margin-bottom: var(--spacing-xl);
}

.section-title {
    font-size: 1.75rem;
    color: var(--color-text-primary);
    margin-bottom: var(--spacing-sm);
}

.section-subtitle {
    color: var(--color-text-secondary);
    font-size: 1.1rem;
    margin-bottom: var(--spacing-xl);
}

.options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--spacing-lg);
}

.option-card {
    border: 2px solid var(--color-border);
    border-radius: 12px;
    padding: var(--spacing-xl);
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.option-card:hover {
    border-color: var(--color-primary);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.option-icon {
    font-size: 3rem;
    margin-bottom: var(--spacing-md);
    display: flex;
    justify-content: center;
    align-items: center;
}

.option-icon img {
    width: 40px !important;
    height: 40px !important;
    object-fit: contain;
}

.option-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: var(--spacing-sm);
    color: var(--color-text-primary);
}

.option-description {
    color: var(--color-text-secondary);
    font-size: 0.9rem;
    line-height: 1.5;
}

/* Processing Section */
.processing-section {
    display: none;
    background: white;
    border-radius: 12px;
    padding: var(--spacing-xl);
    margin-bottom: var(--spacing-xl);
}

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

.process-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-lg);
}

.process-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--color-text-primary);
}

/* Buttons */
.btn {
    padding: var(--spacing-md) var(--spacing-lg);
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
}

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

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

.btn-primary:disabled {
    background: var(--color-bg-muted);
    color: var(--color-text-muted);
    cursor: not-allowed;
}

.btn-secondary {
    background: var(--color-bg-muted);
    color: var(--color-text-primary);
    border: 1px solid var(--color-border);
}

/* Document Table */
.document-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: var(--spacing-xl);
    table-layout: fixed;
}

.document-table th,
.document-table td {
    padding: var(--spacing-md);
    text-align: left;
    border-bottom: 1px solid var(--color-border);
    vertical-align: middle;
}

.document-table th {
    background: var(--color-bg-muted);
    font-weight: 600;
    color: var(--color-text-primary);
}

/* Column widths to prevent jitter - Classification table (5 columns) */
#classificationSection .document-table th:nth-child(1),
#classificationSection .document-table td:nth-child(1) {
    width: 35%;
}

#classificationSection .document-table th:nth-child(2),
#classificationSection .document-table td:nth-child(2) {
    width: 10%;
}

#classificationSection .document-table th:nth-child(3),
#classificationSection .document-table td:nth-child(3) {
    width: 10%;
}

#classificationSection .document-table th:nth-child(4),
#classificationSection .document-table td:nth-child(4) {
    width: 30%;
}

#classificationSection .document-table th:nth-child(5),
#classificationSection .document-table td:nth-child(5) {
    width: 15%;
    min-width: 100px;
    padding: 8px var(--spacing-md);
    text-align: center;
    vertical-align: middle;
}


/* Column widths for Extraction table (4 columns) */
#extractionSection .document-table th:nth-child(1),
#extractionSection .document-table td:nth-child(1) {
    width: 20%;
}

#extractionSection .document-table th:nth-child(2),
#extractionSection .document-table td:nth-child(2) {
    width: 25%;
}

#extractionSection .document-table th:nth-child(3),
#extractionSection .document-table td:nth-child(3) {
    width: 35%;
}

#extractionSection .document-table th:nth-child(4),
#extractionSection .document-table td:nth-child(4) {
    width: 20%;
    min-width: 100px;
    padding: 8px var(--spacing-md);
    text-align: center;
    vertical-align: middle;
}

.document-name {
    color: var(--color-primary);
    cursor: pointer;
    text-decoration: underline;
}

.document-name:hover {
    color: var(--color-primary-dark);
}

/* Status Classes - Pill Style */
.status-uploaded,
.status-working,
.status-categorized,
.status-processed {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0px 7px;
    height: 19px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
    border: 1px solid;
    white-space: nowrap;
    box-sizing: border-box;
}

.status-uploaded {
    background-color: rgba(255, 193, 7, 0.1);
    color: #e67e22;
    border-color: #f39c12;
}

.status-working {
    background-color: var(--color-bg-muted);
    color: var(--color-text-inverse);
    border-color: var(--color-border);
}

.status-categorized {
    background-color: rgba(0, 123, 255, 0.1);
    color: var(--color-primary);
    border-color: var(--color-primary);
}

.status-processed {
    background-color: rgba(40, 167, 69, 0.1);
    color: var(--color-success);
    border-color: var(--color-success);
}

.status-processed::before {
    content: '✓ ';
    margin-right: 4px;
}

.status-complete {
    color: var(--color-success);
    font-weight: 600;
}

.edited-indicator {
    color: var(--color-warning);
    margin-left: var(--spacing-xs);
}

/* Progress Bar */
.progress-bar {
    width: 100%;
    height: 20px;
    background: var(--color-bg-muted);
    border-radius: 10px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--color-primary), var(--color-accent));
    width: 0%;
    transition: width 0.5s ease;
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

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

.modal {
    background: white;
    border-radius: 12px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
}

.modal-header {
    padding: var(--spacing-lg);
    border-bottom: 1px solid var(--color-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: var(--spacing-xs);
}

.modal-content {
    padding: var(--spacing-lg);
}

.modal-actions {
    padding: var(--spacing-lg);
    border-top: 1px solid var(--color-border);
    display: flex;
    gap: var(--spacing-md);
    justify-content: flex-end;
}

/* Form Elements */
.form-group {
    margin-bottom: var(--spacing-md);
}

.form-label {
    display: block;
    margin-bottom: var(--spacing-xs);
    font-weight: 600;
    color: var(--color-text-primary);
}

.form-select {
    width: 100%;
    padding: var(--spacing-sm) var(--spacing-md);
    border: 2px solid var(--color-border);
    border-radius: 6px;
    font-size: 1rem;
}

/* Input Method Toggle */
.input-method-toggle {
    display: flex;
    border: 2px solid var(--color-border);
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: var(--spacing-lg);
}

.toggle-btn {
    flex: 1;
    padding: var(--spacing-md);
    background: var(--color-bg-muted);
    border: none;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    border-right: 1px solid var(--color-border);
}

.toggle-btn:last-child {
    border-right: none;
}

.toggle-btn.active {
    background: var(--color-primary);
    color: white;
}

.toggle-btn:hover:not(.active) {
    background: var(--color-bg-secondary);
}

.input-method {
    display: none;
}

.input-method.active {
    display: block;
}

.method-hint {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    font-style: italic;
    margin-top: var(--spacing-xs);
}

/* Smart Search Dropdown */
.dropdown-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 2px solid var(--color-border);
    border-top: none;
    border-radius: 0 0 6px 6px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1001;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.dropdown-item {
    padding: var(--spacing-sm) var(--spacing-md);
    cursor: pointer;
    border-bottom: 1px solid var(--color-border);
    transition: background 0.2s ease;
}

.dropdown-item:hover,
.dropdown-item.highlighted {
    background: var(--color-bg-accent);
}

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

.dropdown-item .category-info {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    margin-top: 2px;
}

/* Edit Icon Button */
.edit-icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: var(--spacing-xs);
    border-radius: 4px;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.edit-icon-btn:hover {
    background: var(--color-bg-accent);
    transform: scale(1.1);
}

.edit-icon-btn img {
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.edit-icon-btn:hover img {
    opacity: 1;
}

/* Summary Info Panels */
.summary-info-panel {
    background: var(--color-bg-primary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg, 12px);
    margin-bottom: var(--spacing-xl);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.summary-header {
    background: var(--color-primary);
    color: var(--color-text-inverse);
    padding: var(--spacing-md) var(--spacing-xl);
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    border-bottom: 1px solid var(--color-border);
}

.summary-icon {
    font-size: 1.25rem;
}

.summary-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin: 0;
}

.summary-content {
    padding: var(--spacing-xl);
}

.summary-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: var(--spacing-md);
}

.stat-item {
    background: var(--color-brand-light);
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-md, 8px);
    padding: var(--spacing-md);
    text-align: center;
    box-sizing: border-box;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-primary);
    margin: 0 0 var(--spacing-xs) 0;
    line-height: 1.2;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--color-text-secondary);
    font-weight: 500;
    margin: 0;
}

.category-stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-sm, 6px);
    margin-bottom: var(--spacing-sm);
    height: 36px;
    box-sizing: border-box;
}

.category-stat:last-child {
    margin-bottom: 0;
}

.category-name {
    font-weight: 600;
    color: var(--color-text-primary);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    margin-right: var(--spacing-sm);
}

.category-count {
    background: var(--color-primary);
    color: var(--color-text-inverse);
    padding: 4px 8px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.85rem;
    min-width: 24px;
    text-align: center;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}