  @import url('https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@300;400;500;600;700&display=swap');

  * { margin: 0; padding: 0; box-sizing: border-box; }
  body {
    font-family: 'Noto Sans KR', sans-serif;
    background: #ffffff;
    color: #1a1a2e;
    line-height: 1.6;
  }

  /* ========== Upload Screen ========== */
  #uploadScreen {
    min-height: 100vh;
    display: none;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
  }
  .upload-box {
    background: white;
    border-radius: 20px;
    padding: 60px 80px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    max-width: 600px;
    width: 90%;
  }
  .upload-box h1 { font-size: 28px; font-weight: 700; margin-bottom: 8px; color: #1a1a2e; }
  .upload-box p { font-size: 14px; color: #6b7280; margin-bottom: 24px; }

  .upload-zone {
    border: 3px dashed #cbd5e1;
    border-radius: 16px;
    padding: 48px 24px;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
  }
  .upload-zone:hover, .upload-zone.dragover {
    border-color: #3b82f6;
    background: #eff6ff;
  }
  .upload-zone input { display: none; }
  .upload-icon { font-size: 48px; margin-bottom: 16px; }
  .upload-zone h3 { font-size: 16px; font-weight: 600; color: #374151; margin-bottom: 8px; }
  .upload-zone span { font-size: 13px; color: #9ca3af; }

  .file-list {
    margin-top: 12px;
    text-align: left;
  }
  .file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 8px;
    margin-bottom: 6px;
    font-size: 13px;
  }
  .file-item .fi-left { display: flex; align-items: center; gap: 8px; }
  .file-item .fi-icon { font-size: 16px; }
  .file-item .fi-name { font-weight: 500; color: #374151; word-break: break-all; }
  .file-item .fi-year {
    background: #3b82f6;
    color: white;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
  }
  .file-item .fi-year.unknown { background: #f59e0b; }
  .file-item .fi-remove {
    background: none;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    font-size: 16px;
    padding: 0 4px;
    font-family: inherit;
  }
  .file-item .fi-remove:hover { color: #ef4444; }

  .year-select-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 14px;
    font-size: 13px;
    color: #374151;
  }
  .year-select-row select {
    padding: 6px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 13px;
    font-family: inherit;
    background: white;
    color: #1a1a2e;
  }

  .analyze-btn {
    margin-top: 16px;
    padding: 12px 32px;
    background: #3b82f6;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: white;
    font-family: inherit;
    transition: all 0.2s;
    width: 100%;
  }
  .analyze-btn:hover { background: #2563eb; }
  .analyze-btn:disabled { background: #94a3b8; cursor: not-allowed; }

  .upload-formats { margin-top: 24px; font-size: 12px; color: #9ca3af; }
  .upload-formats code { background: #f1f5f9; padding: 2px 6px; border-radius: 4px; }
  #uploadStatus { margin-top: 16px; font-size: 14px; color: #ef4444; }
  .sample-btn {
    margin-top: 20px;
    padding: 10px 24px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    color: #475569;
    font-family: inherit;
    transition: all 0.2s;
  }
  .sample-btn:hover { background: #e2e8f0; }

  /* ========== Dashboard ========== */
  #dashboard { display: block; }

  .header {
    background: #ffffff;
    color: #1a1a2e;
    padding: 24px 40px;
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e5e7eb;
  }
  .header h1 { font-size: 24px; font-weight: 700; margin-bottom: 4px; }
  .header p { font-size: 14px; color: #6b7280; }
  .header-right { position: relative; z-index: 1; }
  .new-file-btn {
    padding: 10px 20px;
    background: #3b82f6;
    border: none;
    border-radius: 8px;
    color: white;
    cursor: pointer;
    font-size: 13px;
    font-family: inherit;
    font-weight: 600;
    transition: all 0.2s;
  }
  .new-file-btn:hover { background: #2563eb; }

  .container { max-width: 1400px; margin: 0 auto; padding: 24px; }

  /* KPI Cards */
  .kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
  }
  .kpi-card {
    background: white;
    border-radius: 12px;
    padding: 20px 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    position: relative;
    overflow: hidden;
  }
  .kpi-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 4px; height: 100%;
  }
  .kpi-card.blue::before { background: #3b82f6; }
  .kpi-card.green::before { background: #10b981; }
  .kpi-card.orange::before { background: #f59e0b; }
  .kpi-card.red::before { background: #ef4444; }
  .kpi-card.purple::before { background: #8b5cf6; }
  .kpi-card.teal::before { background: #14b8a6; }

  .kpi-label { font-size: 12px; color: #6b7280; font-weight: 500; text-transform: uppercase; letter-spacing: 0.5px; }
  .kpi-value { font-size: 26px; font-weight: 700; margin: 4px 0; }
  .kpi-sub { font-size: 13px; color: #6b7280; }
  .kpi-change { font-size: 13px; font-weight: 600; }
  .kpi-change.up { color: #10b981; }
  .kpi-change.down { color: #ef4444; }

  /* Chart sections */
  .chart-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
  }
  .chart-card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    border: 1px solid #f1f5f9;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  }
  .chart-card.full { grid-column: 1 / -1; }
  .chart-card h3 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 16px;
    color: #374151;
  }
  .chart-container { position: relative; }

  /* Analysis section */
  .analysis-section {
    background: white;
    border-radius: 12px;
    padding: 32px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    margin-bottom: 20px;
  }
  .analysis-section h2 {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid #e5e7eb;
    color: #1a1a2e;
  }
  .analysis-section h3 {
    font-size: 16px;
    font-weight: 600;
    margin: 20px 0 10px;
    color: #374151;
  }
  .analysis-section p {
    font-size: 14px;
    color: #4b5563;
    margin-bottom: 8px;
  }

  .metric-table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0;
    font-size: 13px;
  }
  .metric-table th {
    background: #f8fafc;
    padding: 10px 14px;
    text-align: left;
    font-weight: 600;
    color: #374151;
    border-bottom: 2px solid #e2e8f0;
  }
  .metric-table td {
    padding: 10px 14px;
    border-bottom: 1px solid #f1f5f9;
  }
  .metric-table tr:hover td { background: #f8fafc; }
  .metric-table .num { text-align: right; font-variant-numeric: tabular-nums; }
  .positive { color: #10b981; font-weight: 600; }
  .negative { color: #ef4444; font-weight: 600; }
  .warning { color: #f59e0b; font-weight: 600; }

  .insight-box {
    background: #eff6ff;
    border-left: 4px solid #3b82f6;
    padding: 16px 20px;
    border-radius: 0 8px 8px 0;
    margin: 12px 0;
    font-size: 14px;
    color: #1e40af;
  }
  .insight-box.warn {
    background: #fef3c7;
    border-color: #f59e0b;
    color: #92400e;
  }
  .insight-box.danger {
    background: #fef2f2;
    border-color: #ef4444;
    color: #991b1b;
  }
  .insight-box.success {
    background: #ecfdf5;
    border-color: #10b981;
    color: #065f46;
  }

  .improvement-list {
    list-style: none;
    padding: 0;
  }
  .improvement-list li {
    padding: 12px 16px;
    margin: 8px 0;
    background: #f8fafc;
    border-radius: 8px;
    font-size: 14px;
    position: relative;
    padding-left: 36px;
  }
  .improvement-list li::before {
    content: '';
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 8px;
    height: 8px;
    border-radius: 50%;
  }
  .improvement-list li.high::before { background: #ef4444; }
  .improvement-list li.medium::before { background: #f59e0b; }
  .improvement-list li.low::before { background: #3b82f6; }
  .improvement-list li strong { color: #1a1a2e; }

  .footer {
    text-align: center;
    padding: 20px;
    color: #9ca3af;
    font-size: 12px;
  }

  /* Loading */
  .loading-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(26,26,46,0.9);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    color: white;
  }
  .loading-overlay.show { display: flex; }
  .spinner {
    width: 48px; height: 48px;
    border: 4px solid rgba(255,255,255,0.2);
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 16px;
  }
  @keyframes spin { to { transform: rotate(360deg); } }

  @media (max-width: 1024px) {
    .kpi-grid { grid-template-columns: repeat(2, 1fr); }
    .chart-row { grid-template-columns: 1fr; }
    .upload-box { padding: 40px 30px; }
  }

  /* Toast Notification */
  .toast-notification {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: #1a1a2e;
    color: white;
    padding: 14px 24px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    z-index: 9999;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
  }
  .toast-notification.show {
    opacity: 1;
    transform: translateY(0);
  }
  .toast-notification.success { border-left: 4px solid #10b981; }
  .toast-notification.error { border-left: 4px solid #ef4444; }

  /* Load from DB button */
  .load-db-btn {
    margin-top: 12px;
    padding: 10px 24px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    color: white;
    font-family: inherit;
    font-weight: 600;
    transition: all 0.2s;
  }
  .load-db-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(16,185,129,0.3); }

  /* Revenue breakdown stacked bar section */
  .revenue-breakdown-card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    margin-bottom: 24px;
  }
  .revenue-breakdown-card h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    color: #1a1a2e;
  }
  .breakdown-bar-container {
    position: relative;
    height: 60px;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    margin-bottom: 12px;
  }
  .breakdown-segment {
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 12px;
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
    transition: all 0.3s;
    cursor: default;
    position: relative;
  }
  .breakdown-segment:hover {
    filter: brightness(1.1);
  }
  .breakdown-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-top: 8px;
  }
  .breakdown-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #374151;
  }
  .breakdown-legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    flex-shrink: 0;
  }
  .breakdown-narrative {
    margin-top: 16px;
    padding: 16px;
    background: #f8fafc;
    border-radius: 8px;
    font-size: 14px;
    color: #374151;
    line-height: 1.8;
  }
  .breakdown-narrative strong { color: #1a1a2e; }

  /* Cost gauge section */
  .gauge-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    margin-top: 16px;
  }
  .gauge-item {
    background: white;
    border-radius: 10px;
    padding: 16px 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  }
  .gauge-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
  }
  .gauge-label { font-size: 14px; font-weight: 500; color: #374151; }
  .gauge-value { font-size: 14px; font-weight: 700; }
  .gauge-bar-bg {
    height: 10px;
    background: #e5e7eb;
    border-radius: 5px;
    overflow: hidden;
  }
  .gauge-bar-fill {
    height: 100%;
    border-radius: 5px;
    transition: width 0.8s ease;
  }
  .gauge-bar-fill.green { background: linear-gradient(90deg, #10b981, #34d399); }
  .gauge-bar-fill.yellow { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
  .gauge-bar-fill.red { background: linear-gradient(90deg, #ef4444, #f87171); }
  .gauge-status { font-size: 11px; margin-top: 4px; color: #6b7280; }

  /* Sensitivity analysis */
  .sensitivity-card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    margin-bottom: 24px;
  }
  .sensitivity-card h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    color: #1a1a2e;
  }
  .sensitivity-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
  }
  .sensitivity-table th {
    background: #f8fafc;
    padding: 10px 12px;
    text-align: left;
    font-weight: 600;
    color: #374151;
    border-bottom: 2px solid #e5e7eb;
  }
  .sensitivity-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #f1f5f9;
    color: #374151;
  }
  .sensitivity-table .num { text-align: right; }
  .sensitivity-table .impact-high { color: #ef4444; font-weight: 600; }
  .sensitivity-table .impact-med { color: #f59e0b; font-weight: 600; }
  .sensitivity-table .impact-low { color: #10b981; }
  .sensitivity-table tr:hover { background: #f8fafc; }

  /* Chart card full width */
  .chart-card.full { grid-column: 1 / -1; }

  /* ========== Sidebar Navigation ========== */
  .dashboard-layout {
    display: flex;
    min-height: 100vh;
  }
  .sidebar {
    width: 250px;
    min-width: 250px;
    background: #f8fafc;
    color: #1a1a2e;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 100;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
    border-right: 1px solid #e2e8f0;
  }
  .sidebar-header {
    padding: 24px 20px 16px;
    border-bottom: 1px solid #e2e8f0;
  }
  .sidebar-header h2 {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 4px;
    color: #1a1a2e;
  }
  .sidebar-header p {
    font-size: 12px;
    color: #9ca3af;
    margin: 0;
  }
  .sidebar-nav {
    flex: 1;
    padding: 12px 0;
  }
  .sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: #64748b;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    cursor: pointer;
    border-left: 3px solid transparent;
  }
  .sidebar-nav a:hover {
    background: #e2e8f0;
    color: #1e293b;
  }
  .sidebar-nav a.active {
    background: #eff6ff;
    color: #1e40af;
    border-left-color: #3b82f6;
    font-weight: 600;
  }
  .sidebar-nav a .nav-icon {
    font-size: 18px;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
  }
  .sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid #e2e8f0;
    font-size: 11px;
    color: #9ca3af;
    text-align: center;
  }
  .main-content {
    flex: 1;
    margin-left: 250px;
    min-height: 100vh;
    background: #ffffff;
  }
  .main-content .header {
    position: sticky;
    top: 0;
    z-index: 50;
  }
  .dash-section {
    display: none;
  }
  .dash-section.active {
    display: block;
  }

  /* Hamburger menu for mobile */
  .hamburger-btn {
    display: none;
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 200;
    background: #1a1a2e;
    border: none;
    color: white;
    font-size: 24px;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  }
  .sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 99;
  }

  @media (max-width: 768px) {
    .sidebar {
      transform: translateX(-100%);
    }
    .sidebar.open {
      transform: translateX(0);
    }
    .sidebar-overlay.open {
      display: block;
    }
    .main-content {
      margin-left: 0;
    }
    .hamburger-btn {
      display: flex;
    }
    .header {
      padding-left: 60px !important;
    }
  }

/* ========== Export Button ========== */
.export-btn {
  padding: 10px 20px;
  background: #10b981;
  border: none;
  border-radius: 8px;
  color: white;
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
  font-weight: 600;
  transition: all 0.2s;
}
.export-btn:hover { background: #059669; }

/* ========== Theme Toggle ========== */
.theme-toggle-btn {
  padding: 8px 12px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  cursor: pointer;
  font-size: 18px;
  transition: all 0.2s;
  line-height: 1;
}
.theme-toggle-btn:hover { background: #e2e8f0; }

/* ========== Dark Mode ========== */
body.dark-mode {
  background: #0f172a;
  color: #e2e8f0;
}
body.dark-mode .sidebar {
  background: #1e293b;
  border-right-color: #334155;
}
body.dark-mode .sidebar-header {
  border-bottom-color: #334155;
}
body.dark-mode .sidebar-header h2 { color: #f1f5f9; }
body.dark-mode .sidebar-nav a { color: #94a3b8; }
body.dark-mode .sidebar-nav a:hover { background: #334155; color: #f1f5f9; }
body.dark-mode .sidebar-nav a.active { background: #1e3a5f; color: #60a5fa; border-left-color: #3b82f6; }
body.dark-mode .sidebar-footer { border-top-color: #334155; }
body.dark-mode .main-content { background: #0f172a; }
body.dark-mode .header {
  background: #1e293b;
  border-bottom-color: #334155;
  color: #f1f5f9;
}
body.dark-mode .header h1 { color: #f1f5f9; }
body.dark-mode .header p { color: #94a3b8; }
body.dark-mode .kpi-card {
  background: #1e293b;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
body.dark-mode .kpi-label { color: #94a3b8; }
body.dark-mode .kpi-value { color: #f1f5f9; }
body.dark-mode .kpi-sub { color: #94a3b8; }
body.dark-mode .chart-card {
  background: #1e293b;
  border-color: #334155;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
body.dark-mode .chart-card h3 { color: #e2e8f0; }
body.dark-mode .analysis-section {
  background: #1e293b;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
body.dark-mode .analysis-section h2 { color: #f1f5f9; border-bottom-color: #334155; }
body.dark-mode .analysis-section h3 { color: #e2e8f0; }
body.dark-mode .analysis-section p { color: #94a3b8; }
body.dark-mode .metric-table th { background: #334155; color: #e2e8f0; border-bottom-color: #475569; }
body.dark-mode .metric-table td { border-bottom-color: #334155; color: #cbd5e1; }
body.dark-mode .metric-table tr:hover td { background: #334155; }
body.dark-mode .insight-box { background: #1e3a5f; border-color: #3b82f6; color: #93c5fd; }
body.dark-mode .insight-box.warn { background: #422006; border-color: #f59e0b; color: #fcd34d; }
body.dark-mode .insight-box.danger { background: #450a0a; border-color: #ef4444; color: #fca5a5; }
body.dark-mode .insight-box.success { background: #022c22; border-color: #10b981; color: #6ee7b7; }
body.dark-mode .improvement-list li { background: #334155; color: #e2e8f0; }
body.dark-mode .upload-zone { border-color: #475569; }
body.dark-mode .upload-zone:hover,
body.dark-mode .upload-zone.dragover { border-color: #3b82f6; background: #1e3a5f; }
body.dark-mode .upload-zone h3 { color: #e2e8f0; }
body.dark-mode .upload-zone span { color: #94a3b8; }
body.dark-mode .file-item { background: #1e3a5f; border-color: #334155; }
body.dark-mode .file-item .fi-name { color: #e2e8f0; }
body.dark-mode .revenue-breakdown-card { background: #1e293b; }
body.dark-mode .revenue-breakdown-card h3 { color: #f1f5f9; }
body.dark-mode .breakdown-narrative { background: #334155; color: #e2e8f0; }
body.dark-mode .gauge-item { background: #1e293b; }
body.dark-mode .gauge-label { color: #e2e8f0; }
body.dark-mode .gauge-bar-bg { background: #334155; }
body.dark-mode .gauge-status { color: #94a3b8; }
body.dark-mode .sensitivity-card { background: #1e293b; }
body.dark-mode .sensitivity-card h3 { color: #f1f5f9; }
body.dark-mode .sensitivity-table th { background: #334155; color: #e2e8f0; border-bottom-color: #475569; }
body.dark-mode .sensitivity-table td { border-bottom-color: #334155; color: #cbd5e1; }
body.dark-mode .sensitivity-table tr:hover { background: #334155; }
body.dark-mode .theme-toggle-btn { background: #334155; border-color: #475569; }
body.dark-mode .theme-toggle-btn:hover { background: #475569; }
body.dark-mode .hamburger-btn { background: #334155; }
body.dark-mode .toast-notification { background: #334155; }
body.dark-mode .sample-btn { background: #334155; border-color: #475569; color: #e2e8f0; }
body.dark-mode .sample-btn:hover { background: #475569; }

/* ========== Executive Summary & Action Plan Dark Mode ========== */
body.dark-mode .exec-summary-card { background: linear-gradient(135deg, #0f172a, #1e293b) !important; }
body.dark-mode .action-plan-item { background: #1e293b !important; }
body.dark-mode .action-plan-item h4 { color: #f1f5f9 !important; }
body.dark-mode .action-plan-item p { color: #94a3b8 !important; }
body.dark-mode .action-plan-item span[style*="background:white"] { background: #334155 !important; border-color: #475569 !important; color: #e2e8f0 !important; }
body.dark-mode .action-plan-item div[style*="border-top"] { border-top-color: #334155 !important; }
body.dark-mode div[style*="background:#f1f5f9"] { background: #334155 !important; }
body.dark-mode button[style*="background:#f1f5f9"] { background: #334155 !important; border-color: #475569 !important; color: #e2e8f0 !important; }
body.dark-mode .analysis-section h4 { color: #e2e8f0 !important; }

/* ========== KPI Card Animations ========== */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
.kpi-card {
  animation: fadeInUp 0.5s ease forwards;
}
.kpi-card:nth-child(1) { animation-delay: 0.05s; }
.kpi-card:nth-child(2) { animation-delay: 0.1s; }
.kpi-card:nth-child(3) { animation-delay: 0.15s; }
.kpi-card:nth-child(4) { animation-delay: 0.2s; }
.kpi-card:nth-child(5) { animation-delay: 0.25s; }
.kpi-card:nth-child(6) { animation-delay: 0.3s; }

.chart-card {
  animation: fadeInUp 0.5s ease forwards;
  animation-delay: 0.2s;
}

/* ========== Print Styles ========== */
@media print {
  .sidebar, .hamburger-btn, .sidebar-overlay, .header-right, #uploadScreen { display: none !important; }
  .main-content { margin-left: 0 !important; }
  .header { position: static !important; }
  .kpi-card, .chart-card, .analysis-section { break-inside: avoid; }
  body.dark-mode { background: white; color: #1a1a2e; }
  body.dark-mode .kpi-card,
  body.dark-mode .chart-card,
  body.dark-mode .analysis-section { background: white; color: #1a1a2e; }
  body.dark-mode .header { background: white; color: #1a1a2e; }
  body.dark-mode .header h1,
  body.dark-mode .header p { color: #1a1a2e; }
}

/* ========== Scrollbar Styling ========== */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }
body.dark-mode ::-webkit-scrollbar-thumb { background: #475569; }
body.dark-mode ::-webkit-scrollbar-thumb:hover { background: #64748b; }

/* ========== Sidebar hover effect polish ========== */
.sidebar-nav a {
  position: relative;
  overflow: hidden;
}
.sidebar-nav a::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(59,130,246,0.05), transparent);
  transform: translateX(-100%);
  transition: transform 0.4s ease;
}
.sidebar-nav a:hover::after {
  transform: translateX(100%);
}

/* ========== Sidebar Dividers ========== */
.sidebar-divider {
  padding: 16px 20px 6px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: #94a3b8;
}
.sidebar-divider span {
  display: block;
  padding-bottom: 4px;
  border-bottom: 1px solid #e2e8f0;
}
body.dark-mode .sidebar-divider { color: #64748b; }
body.dark-mode .sidebar-divider span { border-bottom-color: #334155; }

/* ========== Section Tabs ========== */
.section-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 24px;
  background: #f1f5f9;
  border-radius: 12px;
  padding: 4px;
  overflow-x: auto;
}
.section-tab {
  padding: 10px 20px;
  border: none;
  background: transparent;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: #64748b;
  font-family: inherit;
  transition: all 0.2s;
  white-space: nowrap;
}
.section-tab:hover {
  background: rgba(255,255,255,0.6);
  color: #1e293b;
}
.section-tab.active {
  background: white;
  color: #1e40af;
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
body.dark-mode .section-tabs { background: #1e293b; }
body.dark-mode .section-tab { color: #94a3b8; }
body.dark-mode .section-tab:hover { background: rgba(255,255,255,0.05); color: #e2e8f0; }
body.dark-mode .section-tab.active { background: #334155; color: #60a5fa; box-shadow: 0 1px 3px rgba(0,0,0,0.3); }

.tab-content {
  display: none;
}
.tab-content.active {
  display: block;
  animation: fadeInUp 0.3s ease;
}

/* ========== Mini KPI Cards (reusable) ========== */
.mini-kpi-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.mini-kpi {
  flex: 1;
  min-width: 160px;
  border-radius: 12px;
  padding: 16px 20px;
}
.mini-kpi-label {
  font-size: 12px;
  color: #6b7280;
  font-weight: 600;
}
.mini-kpi-value {
  font-size: 22px;
  font-weight: 700;
  margin: 4px 0;
}
.mini-kpi-sub {
  font-size: 12px;
  color: #6b7280;
}
body.dark-mode .mini-kpi { background: #1e293b !important; }
body.dark-mode .mini-kpi-label { color: #94a3b8; }
body.dark-mode .mini-kpi-value { color: #f1f5f9; }
body.dark-mode .mini-kpi-sub { color: #94a3b8; }

/* ========== Monthly Table ========== */
.monthly-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  overflow-x: auto;
  display: block;
}
.monthly-table th {
  background: #f8fafc;
  padding: 10px 8px;
  text-align: right;
  font-weight: 600;
  color: #374151;
  border-bottom: 2px solid #e2e8f0;
  white-space: nowrap;
  position: sticky;
  top: 0;
}
.monthly-table th:first-child {
  text-align: left;
  position: sticky;
  left: 0;
  background: #f8fafc;
  z-index: 2;
  min-width: 120px;
}
.monthly-table td {
  padding: 8px;
  border-bottom: 1px solid #f1f5f9;
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.monthly-table td:first-child {
  text-align: left;
  font-weight: 500;
  color: #374151;
  position: sticky;
  left: 0;
  background: white;
  z-index: 1;
}
.monthly-table tr:hover td { background: #f8fafc; }
.monthly-table tr:hover td:first-child { background: #f0f4f8; }
.monthly-table .row-total { font-weight: 700; background: #f0f9ff; }
.monthly-table .row-total td { border-top: 2px solid #e2e8f0; }
body.dark-mode .monthly-table th { background: #334155; color: #e2e8f0; border-bottom-color: #475569; }
body.dark-mode .monthly-table th:first-child { background: #334155; }
body.dark-mode .monthly-table td { border-bottom-color: #334155; color: #cbd5e1; }
body.dark-mode .monthly-table td:first-child { background: #0f172a; color: #e2e8f0; }
body.dark-mode .monthly-table tr:hover td { background: #1e293b; }
body.dark-mode .monthly-table tr:hover td:first-child { background: #1e293b; }
body.dark-mode .monthly-table .row-total { background: #1e3a5f; }

/* ========== Budget Inputs ========== */
.budget-form {
  max-width: 800px;
  margin: 0 auto;
}
.budget-input-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid #f1f5f9;
}
.budget-input-row label {
  flex: 0 0 180px;
  font-size: 13px;
  font-weight: 500;
  color: #374151;
}
.budget-input-row input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  text-align: right;
}
.budget-input-row input:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}
body.dark-mode .budget-input-row { border-bottom-color: #334155; }
body.dark-mode .budget-input-row label { color: #e2e8f0; }
body.dark-mode .budget-input-row input { background: #1e293b; border-color: #475569; color: #e2e8f0; }

/* ========== Progress Bar (Budget) ========== */
.progress-bar-container {
  height: 24px;
  background: #e5e7eb;
  border-radius: 12px;
  overflow: hidden;
  position: relative;
}
.progress-bar-fill {
  height: 100%;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  color: white;
  transition: width 0.8s ease;
  min-width: 36px;
}
.progress-bar-fill.safe { background: linear-gradient(90deg, #10b981, #34d399); }
.progress-bar-fill.warning { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.progress-bar-fill.danger { background: linear-gradient(90deg, #ef4444, #f87171); }
body.dark-mode .progress-bar-container { background: #334155; }

/* ========== Benchmark Cards ========== */
.benchmark-company-card {
  background: white;
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  padding: 16px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}
.benchmark-company-card:hover {
  border-color: #3b82f6;
  box-shadow: 0 4px 12px rgba(59,130,246,0.15);
}
.benchmark-company-card.selected {
  border-color: #3b82f6;
  background: #eff6ff;
}
body.dark-mode .benchmark-company-card { background: #1e293b; border-color: #334155; }
body.dark-mode .benchmark-company-card:hover { border-color: #3b82f6; }
body.dark-mode .benchmark-company-card.selected { background: #1e3a5f; border-color: #3b82f6; }

/* ========== KPI Gauge (circular) ========== */
.kpi-gauge-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.kpi-gauge-card {
  background: white;
  border-radius: 16px;
  padding: 24px;
  text-align: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.kpi-gauge-card .gauge-ring {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  margin: 0 auto 12px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}
.kpi-gauge-card .gauge-ring-value {
  font-size: 24px;
  font-weight: 700;
}
.kpi-gauge-card .gauge-title {
  font-size: 14px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 4px;
}
.kpi-gauge-card .gauge-target {
  font-size: 12px;
  color: #6b7280;
}
body.dark-mode .kpi-gauge-card { background: #1e293b; box-shadow: 0 1px 3px rgba(0,0,0,0.3); }
body.dark-mode .kpi-gauge-card .gauge-title { color: #e2e8f0; }
body.dark-mode .kpi-gauge-card .gauge-target { color: #94a3b8; }

/* ========== Tax Calendar ========== */
.tax-calendar {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  margin-top: 16px;
}
.tax-event {
  padding: 14px 16px;
  border-radius: 10px;
  border-left: 4px solid #3b82f6;
  background: #f8fafc;
  font-size: 13px;
}
.tax-event .tax-date {
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 2px;
}
.tax-event .tax-desc {
  color: #6b7280;
  font-size: 12px;
}
.tax-event.upcoming { border-left-color: #f59e0b; background: #fffbeb; }
.tax-event.overdue { border-left-color: #ef4444; background: #fef2f2; }
body.dark-mode .tax-event { background: #1e293b; }
body.dark-mode .tax-event .tax-date { color: #f1f5f9; }
body.dark-mode .tax-event .tax-desc { color: #94a3b8; }
body.dark-mode .tax-event.upcoming { background: #422006; }
body.dark-mode .tax-event.overdue { background: #450a0a; }

/* ========== Comparison highlight ========== */
.comparison-highlight {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
}
.comparison-highlight.up { background: #ecfdf5; color: #059669; }
.comparison-highlight.down { background: #fef2f2; color: #dc2626; }
body.dark-mode .comparison-highlight.up { background: #022c22; color: #6ee7b7; }
body.dark-mode .comparison-highlight.down { background: #450a0a; color: #fca5a5; }
