/* Core Design System & Theme Variables */
:root {
  --font-family: 'Outfit', 'Noto Sans KR', sans-serif;
  --bg-primary: #0a0e17;
  --bg-secondary: rgba(22, 28, 45, 0.7);
  --bg-glass: rgba(17, 24, 39, 0.55);
  --border-glass: rgba(255, 255, 255, 0.08);
  --border-glass-light: rgba(255, 255, 255, 0.04);

  /* Vibrant Accents */
  --primary-gradient: linear-gradient(135deg, #6366f1 0%, #06b6d4 100%);
  --primary-color: #6366f1;
  --secondary-color: #06b6d4;

  --color-revenue: #10b981;
  --color-revenue-bg: rgba(16, 185, 129, 0.1);
  --color-revenue-border: rgba(16, 185, 129, 0.2);

  --color-expenditure: #f43f5e;
  --color-expenditure-bg: rgba(244, 63, 94, 0.1);
  --color-expenditure-border: rgba(244, 63, 94, 0.2);

  --color-balance: #0ea5e9;
  --color-balance-bg: rgba(14, 165, 233, 0.1);

  /* Text colors */
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --text-dark: #1f2937;

  /* UI states */
  --sidebar-width: 260px;
  --header-height: 80px;
  --card-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── LIGHT THEME ────────────────────────────────────────────────────── */
[data-theme="light"] {
  --bg-primary: #f0f4f8;
  --bg-secondary: rgba(255, 255, 255, 0.9);
  --bg-glass: rgba(255, 255, 255, 0.88);
  --border-glass: rgba(0, 0, 0, 0.08);
  --border-glass-light: rgba(0, 0, 0, 0.04);
  --primary-color: #6366f1;
  --secondary-color: #06b6d4;
  --color-revenue: #059669;
  --color-revenue-bg: rgba(5, 150, 105, 0.08);
  --color-expenditure: #e11d48;
  --color-expenditure-bg: rgba(225, 29, 72, 0.08);
  --color-balance: #0284c7;
  --text-main: #0f172a;
  --text-muted: #475569;
  --card-shadow: 0 4px 24px 0 rgba(0, 0, 0, 0.08);
}

[data-theme="light"] body {
  background-color: #f0f4f8;
  background-image:
    radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.05) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(6, 182, 212, 0.05) 0px, transparent 50%);
}

[data-theme="light"] .sidebar {
  background-color: rgba(255, 255, 255, 0.97);
  border-right-color: rgba(0, 0, 0, 0.08);
  box-shadow: 2px 0 16px rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .logo-text h2 {
  background: linear-gradient(120deg, #0f172a 0%, #334155 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

[data-theme="light"] .nav-item:hover {
  background-color: rgba(99, 102, 241, 0.07);
  color: var(--text-main);
}

[data-theme="light"] .btn-refresh {
  background-color: rgba(0, 0, 0, 0.04);
  border-color: rgba(0, 0, 0, 0.1);
  color: var(--text-main);
}

[data-theme="light"] .btn-refresh:hover {
  background-color: rgba(99, 102, 241, 0.1);
  border-color: var(--primary-color);
}

[data-theme="light"] .top-header {
  border-bottom-color: rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .header-meta {
  background-color: rgba(99, 102, 241, 0.06);
  border-color: rgba(99, 102, 241, 0.15);
}

[data-theme="light"] .dashboard-card {
  background: rgba(255, 255, 255, 0.88);
  border-color: rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .dashboard-card h3 {
  color: var(--text-main);
  border-bottom-color: rgba(0, 0, 0, 0.07);
}

[data-theme="light"] .kpi-card {
  background: rgba(255, 255, 255, 0.88);
  border-color: rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .kpi-card:hover {
  border-color: rgba(99, 102, 241, 0.2);
  box-shadow: 0 8px 32px rgba(99, 102, 241, 0.1);
}

[data-theme="light"] .table-responsive {
  background-color: rgba(255, 255, 255, 0.5);
}

[data-theme="light"] .dashboard-table th {
  background-color: rgba(99, 102, 241, 0.04);
  color: var(--text-main);
  border-bottom: 2.5px solid rgba(0, 0, 0, 0.12) !important;
}

[data-theme="light"] .dashboard-table th,
[data-theme="light"] .dashboard-table td {
  border-bottom-color: rgba(0, 0, 0, 0.06) !important;
  border-right-color: rgba(0, 0, 0, 0.04) !important;
}

[data-theme="light"] .dashboard-table tbody tr:hover {
  background-color: rgba(99, 102, 241, 0.03);
}

[data-theme="light"] .row-total {
  background-color: rgba(99, 102, 241, 0.07) !important;
}

[data-theme="light"] .row-total td {
  border-top-color: rgba(99, 102, 241, 0.2) !important;
  border-bottom-color: rgba(99, 102, 241, 0.2) !important;
  color: var(--text-main);
}

[data-theme="light"] #revenue-table .row-subtotal {
  background-color: rgba(5, 150, 105, 0.12) !important;
  color: #065f46 !important;
}

[data-theme="light"] #expenditure-table .row-subtotal {
  background-color: rgba(225, 29, 72, 0.1) !important;
  color: #9f1239 !important;
}

[data-theme="light"] .row-subtotal:not(#revenue-table .row-subtotal):not(#expenditure-table .row-subtotal) {
  background-color: rgba(99, 102, 241, 0.05) !important;
  color: var(--text-main);
}

[data-theme="light"] .bg-revenue-header {
  background-color: rgba(5, 150, 105, 0.1) !important;
  color: #047857 !important;
}

[data-theme="light"] .bg-revenue-header-sub {
  background-color: rgba(5, 150, 105, 0.06) !important;
  color: #065f46 !important;
}

[data-theme="light"] .bg-expenditure-header {
  background-color: rgba(225, 29, 72, 0.1) !important;
  color: #be123c !important;
}

[data-theme="light"] .bg-expenditure-header-sub {
  background-color: rgba(225, 29, 72, 0.06) !important;
  color: #9f1239 !important;
}

[data-theme="light"] .search-input-wrapper input {
  background-color: rgba(255, 255, 255, 0.9);
  border-color: rgba(0, 0, 0, 0.1);
  color: var(--text-main);
}

[data-theme="light"] .search-input-wrapper input::placeholder {
  color: #94a3b8;
}

[data-theme="light"] .form-select,
[data-theme="light"] .form-select-inline {
  background-color: rgba(255, 255, 255, 0.9);
  border-color: rgba(0, 0, 0, 0.1);
  color: var(--text-main);
}

[data-theme="light"] .col-toggle-dropdown,
[data-theme="light"] .header-filter-dropdown {
  background: rgba(255, 255, 255, 0.98) !important;
  border-color: rgba(0, 0, 0, 0.1) !important;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12) !important;
}

[data-theme="light"] .col-toggle-item,
[data-theme="light"] .filter-option-item {
  color: var(--text-main) !important;
}

[data-theme="light"] .col-toggle-item:hover,
[data-theme="light"] .filter-option-item:hover {
  background-color: rgba(99, 102, 241, 0.06) !important;
}

[data-theme="light"] .filter-search {
  background-color: rgba(0, 0, 0, 0.04) !important;
  border-color: rgba(0, 0, 0, 0.1) !important;
  color: var(--text-main) !important;
}

[data-theme="light"] .progress-track {
  background-color: rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .table-info-badge {
  background-color: rgba(99, 102, 241, 0.07);
  border-color: rgba(99, 102, 241, 0.15);
  color: #6366f1;
}

[data-theme="light"] .settings-modal .modal-content {
  background: rgba(248, 250, 252, 0.98);
  border-color: rgba(0, 0, 0, 0.1);
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.15);
}

[data-theme="light"] .modal-overlay {
  background: rgba(15, 23, 42, 0.35);
}

[data-theme="light"] .settings-table th,
[data-theme="light"] .settings-table td {
  border-color: rgba(0, 0, 0, 0.08) !important;
  color: var(--text-main);
}

[data-theme="light"] .modal-tabs {
  border-bottom-color: rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .modal-tab-btn {
  color: var(--text-muted);
}

[data-theme="light"] .modal-tab-btn.active {
  color: #6366f1;
  border-bottom-color: #6366f1;
}

[data-theme="light"] .settings-card {
  background: rgba(241, 245, 249, 0.8);
  border-color: rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .settings-card h3 {
  color: var(--text-main);
}

[data-theme="light"] .settings-card input[type="text"],
[data-theme="light"] .settings-card select {
  background: rgba(255, 255, 255, 0.9);
  border-color: rgba(0, 0, 0, 0.1);
  color: var(--text-main);
}

[data-theme="light"] .checkbox-list label {
  color: var(--text-main);
}

[data-theme="light"] .monthly-filter-inline {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.06), rgba(6, 182, 212, 0.06)) !important;
  border-color: rgba(99, 102, 241, 0.15) !important;
}

/* Light Theme Color Accents for Utility Classes */
[data-theme="light"] .text-green {
  color: #047857 !important;
}

[data-theme="light"] .text-orange {
  color: #c2410c !important;
}

[data-theme="light"] .text-blue {
  color: #0369a1 !important;
}

[data-theme="light"] .text-primary-header {
  color: #4338ca !important;
}

[data-theme="light"] .text-success-header {
  color: #047857 !important;
}

[data-theme="light"] .text-warning-header {
  color: #b45309 !important;
}

[data-theme="light"] .text-danger-header {
  color: #be123c !important;
}

[data-theme="light"] .bg-green-light {
  background-color: rgba(5, 150, 105, 0.1) !important;
}

[data-theme="light"] .bg-orange-light {
  background-color: rgba(225, 29, 72, 0.08) !important;
}

[data-theme="light"] .bg-blue-light {
  background-color: rgba(2, 132, 199, 0.08) !important;
}

/* ── THEME TOGGLE BUTTON ─────────────────────────────────────────────── */
.btn-theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-glass);
  color: var(--text-main);
  padding: 10px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition-smooth);
  font-family: var(--font-family);
}

.btn-theme-toggle:hover {
  background: var(--primary-gradient);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
}

[data-theme="light"] .btn-theme-toggle {
  background: rgba(0, 0, 0, 0.04);
  border-color: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .btn-theme-toggle:hover {
  background: var(--primary-gradient);
  border-color: transparent;
  color: #fff;
}


/* Reset and Global Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-primary);
  color: var(--text-main);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.5;
  background-image:
    radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.08) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(6, 182, 212, 0.08) 0px, transparent 50%);
}

#app {
  display: flex;
  min-height: 100vh;
}

/* Sidebar Styling */
.sidebar {
  width: var(--sidebar-width);
  background-color: rgba(15, 23, 42, 0.95);
  border-right: 1px solid var(--border-glass);
  padding: 24px;
  display: flex;
  flex-direction: column;
  position: fixed;
  height: 100vh;
  z-index: 100;
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 40px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-glass);
}

.logo-icon {
  background: var(--primary-gradient);
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  color: #fff;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.4);
}

.logo-text h2 {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  background: linear-gradient(120deg, #fff 0%, #e2e8f0 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.logo-text span {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
}

.nav-menu {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-grow: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 14px 16px;
  border-radius: 12px;
  cursor: pointer;
  text-align: left;
  font-family: var(--font-family);
  font-size: 0.95rem;
  font-weight: 500;
  transition: var(--transition-smooth);
}

.nav-item i {
  font-size: 1.1rem;
  width: 20px;
  text-align: center;
}

.nav-item:hover {
  background-color: rgba(255, 255, 255, 0.05);
  color: #fff;
  transform: translateX(4px);
}

.nav-item.active {
  background: var(--primary-gradient);
  color: #fff;
  box-shadow: 0 4px 20px rgba(99, 102, 241, 0.25);
}

.sidebar-footer {
  padding-top: 20px;
  border-top: 1px solid var(--border-glass);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--color-revenue);
}

.pulse-green {
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  animation: pulse 1.8s infinite;
}

@keyframes pulse {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  }

  70% {
    transform: scale(1);
    box-shadow: 0 0 0 8px rgba(16, 185, 129, 0);
  }

  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
  }
}

.btn-refresh {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background-color: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-glass);
  color: var(--text-main);
  padding: 10px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.btn-refresh:hover {
  background-color: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

/* Main Content Area */
.main-content {
  margin-left: var(--sidebar-width);
  flex-grow: 1;
  padding: 32px;
  width: calc(100% - var(--sidebar-width));
}

.top-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 32px;
  border-bottom: 1px solid var(--border-glass);
  padding-bottom: 20px;
}

.header-title h1 {
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: -0.7px;
  margin-bottom: 4px;
}

.header-title p {
  color: var(--text-muted);
  font-size: 0.95rem;
}

.header-meta {
  background-color: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-glass-light);
  border-radius: 8px;
  padding: 8px 16px;
}

.meta-item {
  font-size: 0.85rem;
}

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

.meta-item .value {
  font-weight: 600;
}

/* Content Tab Views */
.tab-content {
  display: none;
  animation: fadeIn 0.4s ease-out;
}

.tab-content.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* KPI Cards Layout */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 30px;
}

.kpi-card {
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-glass);
  border-radius: 18px;
  padding: 24px;
  box-shadow: var(--card-shadow);
  position: relative;
  overflow: hidden;
  transition: var(--transition-smooth);
}

.kpi-card:hover {
  transform: translateY(-4px);
  border-color: rgba(255, 255, 255, 0.15);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
}

.card-revenue::before {
  background-color: var(--color-revenue);
}

.card-expenditure::before {
  background-color: var(--color-expenditure);
}

.card-balance::before {
  background-color: var(--color-balance);
}

.kpi-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 12px;
}

.kpi-header i {
  font-size: 1.25rem;
}

.icon-rev {
  color: var(--color-revenue);
}

.icon-exp {
  color: var(--color-expenditure);
}

.icon-bal {
  color: var(--color-balance);
}

.kpi-value {
  font-size: 1.85rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin-bottom: 12px;
}

.kpi-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.82rem;
  border-top: 1px solid var(--border-glass-light);
  padding-top: 12px;
}

.kpi-footer strong {
  color: var(--text-main);
}

.rate-badge {
  padding: 4px 8px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.75rem;
}

.bg-green-light {
  background-color: rgba(16, 185, 129, 0.15);
}

.text-green {
  color: #34d399;
}

.bg-orange-light {
  background-color: rgba(244, 63, 94, 0.15);
}

.text-orange {
  color: #f87171;
}

.bg-blue-light {
  background-color: rgba(14, 165, 233, 0.15);
}

.text-blue {
  color: #38bdf8;
}

/* Dashboard Cards and Grid */
.dashboard-charts-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 20px;
  margin-bottom: 30px;
}

.dashboard-card {
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-glass);
  border-radius: 18px;
  padding: 24px;
  box-shadow: var(--card-shadow);
}

.dashboard-card h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 20px;
  color: #fff;
  border-bottom: 1px solid var(--border-glass-light);
  padding-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Charts Wrapper */
.canvas-wrapper {
  position: relative;
  height: 280px;
  width: 100%;
}

/* Status progress list on right */
.status-progress-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.status-progress-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.status-label-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
}

.status-title {
  font-weight: 500;
  color: var(--text-main);
}

.status-percentage {
  font-weight: 600;
}

.progress-track {
  height: 8px;
  background-color: rgba(255, 255, 255, 0.06);
  border-radius: 4px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  border-radius: 4px;
  transition: width 0.8s ease-in-out;
}

.status-values {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Tables Styling */
.table-section {
  margin-top: 30px;
  margin-bottom: 30px;
}

.table-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.table-header-row h3 {
  border-bottom: none;
  padding-bottom: 0;
  margin-bottom: 0;
}

.table-info-badge {
  font-size: 0.75rem;
  background-color: rgba(99, 102, 241, 0.1);
  border: 1px solid rgba(99, 102, 241, 0.2);
  color: #a5b4fc;
  padding: 6px 12px;
  border-radius: 8px;
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
  border-radius: 12px;
  background-color: rgba(10, 15, 30, 0.3);
}

.dashboard-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9rem;
}

.dashboard-table th,
.dashboard-table td {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15) !important;
  border-right: 1px solid rgba(255, 255, 255, 0.08) !important;
}

.dashboard-table th:last-child,
.dashboard-table td:last-child {
  border-right: none !important;
}

.dashboard-table th {
  background-color: rgba(255, 255, 255, 0.02);
  color: #fff;
  font-weight: 600;
  font-size: 0.85rem;
  letter-spacing: -0.2px;
  text-transform: uppercase;
  border-bottom: 2.5px solid rgba(255, 255, 255, 0.22) !important;
}

.dashboard-table tbody tr {
  transition: background-color 0.2s ease;
}

.dashboard-table tbody tr:hover {
  background-color: rgba(255, 255, 255, 0.02);
}

.dashboard-table tbody tr:last-child td {
  border-bottom: none;
}

/* Special Columns */
.text-right {
  text-align: right;
  white-space: nowrap;
  width: 1%;
}

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

.text-small {
  font-size: 0.8rem;
}

/* Balanced Table Column Auto-Resizing & Distribution */
.dashboard-table {
  table-layout: auto;
}

#dashboard-settlement-table {
  table-layout: fixed !important;
}

#dashboard-settlement-table th,
#dashboard-settlement-table td {
  width: auto !important;
}

/* Force metadata and status columns to wrap cleanly on a single line and shrink to minimum width */
#transactions-table th:nth-child(1),
#transactions-table td:nth-child(1),
#transactions-table th:nth-child(2),
#transactions-table td:nth-child(2),
#transactions-table th:nth-child(3),
#transactions-table td:nth-child(3),
#transactions-table th:nth-child(5),
#transactions-table td:nth-child(5),
#transactions-table th:nth-child(6),
#transactions-table td:nth-child(6),
#analysis-transactions-table th:nth-child(1),
#analysis-transactions-table td:nth-child(1),
#analysis-transactions-table th:nth-child(2),
#analysis-transactions-table td:nth-child(2),
#analysis-transactions-table th:nth-child(3),
#analysis-transactions-table td:nth-child(3),
#analysis-transactions-table th:nth-child(8),
#analysis-transactions-table td:nth-child(8),
/* revenue-table column 1 sizing handled via colgroup */

/* Center-align date, status, and transaction numbers */
#transactions-table th:nth-child(1),
#transactions-table td:nth-child(1),
#transactions-table th:nth-child(2),
#transactions-table td:nth-child(2),
#transactions-table th:nth-child(3),
#transactions-table td:nth-child(3),
#transactions-table th:nth-child(5),
#transactions-table td:nth-child(5),
#transactions-table th:nth-child(6),
#transactions-table td:nth-child(6),
#analysis-transactions-table th:nth-child(1),
#analysis-transactions-table td:nth-child(1),
#analysis-transactions-table th:nth-child(2),
#analysis-transactions-table td:nth-child(2),
#analysis-transactions-table th:nth-child(3),
#analysis-transactions-table td:nth-child(3),
#analysis-transactions-table th:nth-child(8),
#analysis-transactions-table td:nth-child(8) {
  text-align: center;
}

/* Revenue & Expenditure table: all data cells default to left-align */
#revenue-table td,
#expenditure-table td {
  text-align: left;
}

/* Force right-alignment on money columns / text-right columns */
#revenue-table td.text-right,
#expenditure-table td.text-right,
#revenue-table td.cell-merged.text-right,
#expenditure-table td.cell-merged.text-right {
  text-align: right !important;
}

/* Revenue table: wrap text and clip overflow for fixed layout */
#revenue-table th,
#revenue-table td {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: normal;
  word-break: keep-all;
}

/* Center-align first two column headers of the revenue table */
#revenue-table th:nth-child(1),
#revenue-table th:nth-child(2) {
  text-align: center !important;
}

/* Set flexible column sizing for descriptions so they absorb leftover width when other columns hide */
#expenditure-table .col-desc,
#analysis-transactions-table th:nth-child(4),
#analysis-transactions-table td:nth-child(4),
#transactions-table th:nth-child(4),
#transactions-table td:nth-child(4) {
  white-space: normal;
  word-break: keep-all;
  min-width: 220px;
  width: auto;
}

/* Left-align description data cells in revenue and expenditure tables */
#revenue-table td.col-desc,
#expenditure-table td.col-desc {
  text-align: left !important;
}

/* Set minimal width targets for headers and cells to keep structure visually stable */
.dashboard-table th,
.dashboard-table td {
  min-width: 70px;
}

.bg-revenue-header {
  background-color: rgba(16, 185, 129, 0.15) !important;
  color: #34d399 !important;
}

.bg-revenue-header-sub {
  background-color: rgba(16, 185, 129, 0.08) !important;
  font-size: 0.78rem !important;
  color: #a7f3d0 !important;
}

.bg-expenditure-header {
  background-color: rgba(244, 63, 94, 0.15) !important;
  color: #f87171 !important;
}

.bg-expenditure-header-sub {
  background-color: rgba(244, 63, 94, 0.08) !important;
  font-size: 0.78rem !important;
  color: #fecdd3 !important;
}

.text-primary-header {
  color: #a5b4fc;
}

.text-success-header {
  color: #6ee7b7;
}

.text-warning-header {
  color: #fde047;
}

.text-danger-header {
  color: #fca5a5;
}

/* Totals / Summary Row styling */
.row-total {
  background-color: rgba(255, 255, 255, 0.04) !important;
  font-weight: 700;
}

.row-total td {
  border-top: 1px solid var(--border-glass) !important;
  border-bottom: 2px double var(--border-glass) !important;
  color: #ffffff;
}

.row-subtotal {
  font-weight: 600;
}

#revenue-table .row-subtotal {
  background-color: rgba(16, 185, 129, 0.22) !important;
  color: #a7f3d0 !important;
}

#revenue-table .row-subtotal td {
  border-top: 1px solid rgba(16, 185, 129, 0.4) !important;
  border-bottom: 1px solid rgba(16, 185, 129, 0.4) !important;
}

#revenue-table .row-subtotal td:not(.text-right) {
  text-align: left !important;
}

#expenditure-table .row-subtotal {
  background-color: rgba(244, 63, 94, 0.22) !important;
  color: #fecdd3 !important;
}

#expenditure-table .row-subtotal td {
  border-top: 1px solid rgba(244, 63, 94, 0.4) !important;
  border-bottom: 1px solid rgba(244, 63, 94, 0.4) !important;
}

#expenditure-table .row-subtotal td:not(.text-right) {
  text-align: left !important;
}

/* Fallback/Default subtotal styling */
.row-subtotal:not(#revenue-table .row-subtotal):not(#expenditure-table .row-subtotal) {
  background-color: rgba(255, 255, 255, 0.08) !important;
  color: #e2e8f0;
}

/* Filters & Inputs styling */
.table-filter-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  gap: 16px;
  flex-wrap: wrap;
}

.search-input-wrapper {
  position: relative;
  max-width: 320px;
  width: 100%;
}

.search-input-wrapper i {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.9rem;
}

.search-input-wrapper input {
  width: 100%;
  background-color: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-glass);
  color: #fff;
  padding: 10px 14px 10px 38px;
  border-radius: 10px;
  font-size: 0.88rem;
  outline: none;
  transition: var(--transition-smooth);
}

.search-input-wrapper input:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.filter-results-info {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.filter-actions-group {
  display: flex;
  gap: 10px;
}

.form-select-inline {
  background-color: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-glass);
  color: #fff;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.85rem;
  outline: none;
  cursor: pointer;
}

.form-select-inline:focus {
  border-color: var(--primary-color);
}


/* Monthly & Category Layout */
.monthly-analysis-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 20px;
  align-items: start;
}

.analysis-left-panel {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.analysis-right-panel {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

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

.form-group label {
  display: block;
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 6px;
  font-weight: 500;
}

.form-select {
  width: 100%;
  background-color: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-glass);
  color: #fff;
  padding: 10px;
  border-radius: 8px;
  font-size: 0.88rem;
  outline: none;
  cursor: pointer;
}

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

.summary-details {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 14px;
}

.summary-detail-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
}

.summary-detail-row span {
  color: var(--text-muted);
}

.summary-details hr {
  border: none;
  border-top: 1px solid var(--border-glass-light);
  margin: 8px 0;
}

/* Card Header Rows for Action Items */
.card-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border-glass-light);
  padding-bottom: 12px;
}

.card-header-row h3 {
  margin-bottom: 0 !important;
  border-bottom: none !important;
  padding-bottom: 0 !important;
}

/* Column toggler container & dropdown */
.col-toggle-container {
  position: relative;
  display: inline-block;
}

.btn-col-toggle {
  background-color: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.3);
  color: #a5b4fc;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition-smooth);
  outline: none;
}

.btn-col-toggle:hover {
  background-color: rgba(99, 102, 241, 0.25);
  border-color: rgba(99, 102, 241, 0.5);
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.2);
}

.col-toggle-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: rgba(11, 17, 32, 0.95);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-glass);
  border-radius: 12px;
  padding: 10px;
  min-width: 210px;
  z-index: 100;
  display: none;
  flex-direction: column;
  gap: 6px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  max-height: 280px;
  overflow-y: auto;
}

.col-toggle-dropdown.show {
  display: flex;
}

.col-toggle-item {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-main);
  font-size: 0.8rem;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 6px;
  transition: background-color 0.15s ease;
  user-select: none;
}

.col-toggle-item:hover {
  background-color: rgba(255, 255, 255, 0.06);
}

.col-toggle-item input[type="checkbox"] {
  appearance: none;
  width: 15px;
  height: 15px;
  border: 1.5px solid var(--border-glass);
  border-radius: 4px;
  background-color: transparent;
  cursor: pointer;
  position: relative;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.col-toggle-item input[type="checkbox"]:checked {
  background-color: var(--primary-color);
  border-color: var(--primary-color);
}

.col-toggle-item input[type="checkbox"]:checked::after {
  content: '\f00c';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  font-size: 9px;
  color: #fff;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

/* Responsive queries */
@media (max-width: 1200px) {
  .kpi-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-charts-grid {
    grid-template-columns: 1fr;
  }

  .monthly-analysis-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .sidebar {
    width: 70px;
    padding: 16px 8px;
  }

  .logo-text,
  .nav-item span,
  .sidebar-footer {
    display: none;
  }

  .nav-item {
    justify-content: center;
  }

  .main-content {
    margin-left: 70px;
    width: calc(100% - 70px);
    padding: 16px;
  }

  .table-filter-bar {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* -------------------------------------------------------------
   SETTINGS BUTTON & MODAL STYLES (MAPPING & REVENUE MERGE)
   ------------------------------------------------------------- */
.btn-settings {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #f3f4f6;
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.btn-settings:hover {
  background: rgba(59, 130, 246, 0.15);
  border-color: var(--primary-color);
  color: #fff;
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.3);
}

.settings-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
}

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

.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(10, 15, 30, 0.75);
  backdrop-filter: blur(8px);
}

.modal-content {
  position: relative;
  width: 90%;
  max-width: 950px;
  height: 80vh;
  max-height: 700px;
  background: rgba(17, 24, 39, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.6), 0 0 40px rgba(59, 130, 246, 0.15);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 2001;
  animation: modalFadeIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
    transform: scale(0.96);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.01);
}

.modal-header h2 {
  font-size: 1.15rem;
  font-weight: 600;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.btn-close-modal {
  background: transparent;
  border: none;
  color: #9ca3af;
  font-size: 1.5rem;
  cursor: pointer;
  transition: color 0.15s;
  padding: 0 5px;
  line-height: 1;
}

.btn-close-modal:hover {
  color: #fff;
}

.modal-tabs {
  display: flex;
  background: rgba(0, 0, 0, 0.2);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.modal-tab-btn {
  flex: 1;
  padding: 12px 16px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: #9ca3af;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.modal-tab-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.02);
}

.modal-tab-btn.active {
  color: var(--primary-color);
  border-bottom-color: var(--primary-color);
  background: rgba(59, 130, 246, 0.05);
}

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

.modal-tab-content {
  display: none;
  height: 100%;
}

.modal-tab-content.active {
  display: block;
}

/* Settings Grid (Tab 1) */
.settings-grid {
  display: grid;
  grid-template-columns: 1.1fr 1.3fr;
  gap: 20px;
  height: 100%;
  align-items: stretch;
}

.settings-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.settings-card h3 {
  font-size: 0.95rem;
  font-weight: 600;
  color: #e5e7eb;
  margin-top: 0;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding-bottom: 8px;
}

.form-group {
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 0.8rem;
  color: #9ca3af;
  font-weight: 500;
}

.form-group input[type="text"] {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 9px 12px;
  border-radius: 6px;
  color: #fff;
  font-size: 0.85rem;
  outline: none;
  transition: border-color 0.15s;
}

.form-group input[type="text"]:focus {
  border-color: var(--primary-color);
}

.checkbox-list {
  background: rgba(0, 0, 0, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 6px;
  max-height: 180px;
  overflow-y: auto;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.checkbox-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.8rem;
  color: #d1d5db;
  transition: background 0.15s;
}

.checkbox-item:hover {
  background: rgba(255, 255, 255, 0.03);
}

.checkbox-item input[type="checkbox"] {
  cursor: pointer;
  accent-color: var(--primary-color);
}

/* Merged Groups List (Tab 1 Right) */
.groups-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: rgba(0, 0, 0, 0.1);
  padding: 10px;
  border-radius: 6px;
}

.group-item {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 6px;
  padding: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.group-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.group-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: #fff;
}

.group-members {
  font-size: 0.75rem;
  color: #9ca3af;
}

.btn-icon-danger {
  background: transparent;
  border: none;
  color: #ef4444;
  cursor: pointer;
  font-size: 0.95rem;
  padding: 6px;
  border-radius: 4px;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-icon-danger:hover {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
}

/* Linkage Table (Tab 2) */
.settings-instruction {
  font-size: 0.82rem;
  color: #9ca3af;
  background: rgba(59, 130, 246, 0.05);
  border-left: 3px solid var(--primary-color);
  padding: 10px 14px;
  border-radius: 0 6px 6px 0;
  margin-bottom: 16px;
  line-height: 1.4;
}

.mapping-table-container {
  max-height: 380px;
  overflow-y: auto;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
}

.settings-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.settings-table th,
.settings-table td {
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 0.85rem;
}

.settings-table th {
  background: rgba(255, 255, 255, 0.03);
  color: #e5e7eb;
  font-weight: 600;
  position: sticky;
  top: 0;
  z-index: 1;
}

.settings-table td {
  color: #d1d5db;
}

/* Custom Multi-select Dropdown Checklist */
.custom-select-wrapper {
  position: relative;
  width: 100%;
}

.custom-select-trigger {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 8px 12px;
  border-radius: 6px;
  color: #e5e7eb;
  font-size: 0.82rem;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.2s;
  min-height: 36px;
}

.custom-select-trigger:hover {
  border-color: rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.05);
}

.custom-select-wrapper.open .custom-select-trigger {
  border-color: var(--primary-color);
  box-shadow: 0 0 5px rgba(59, 130, 246, 0.3);
}

.custom-select-options {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  width: 100%;
  max-height: 200px;
  overflow-y: auto;
  background: #111827;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
  z-index: 1010;
  display: none;
  padding: 6px 0;
}

.custom-select-wrapper.open .custom-select-options {
  display: block;
}

.custom-select-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  color: #d1d5db;
  font-size: 0.8rem;
  cursor: pointer;
  transition: background 0.15s;
}

.custom-select-option:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
}

.custom-select-option input[type="checkbox"] {
  cursor: pointer;
  accent-color: var(--primary-color);
}

.custom-select-trigger span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 90%;
}

/* Modal Footer */
.modal-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  gap: 10px;
  background: rgba(255, 255, 255, 0.01);
}

.btn-primary {
  background: var(--primary-color);
  color: #fff;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-primary:hover {
  background: #2563eb;
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.4);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  color: #d1d5db;
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
  color: #fff;
}

/* Interactive Table Headers */
.th-interactive {
  position: relative;
  padding: 8px 10px !important;
}

.header-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.header-filter-btn,
.header-sort-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 4px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
  background: rgba(255, 255, 255, 0.05);
}

.header-filter-btn:hover,
.header-sort-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

.header-filter-btn.active {
  color: #10b981 !important;
  /* green */
  background: rgba(16, 185, 129, 0.15) !important;
}

.header-sort-btn.active {
  color: #38bdf8 !important;
  /* blue */
  background: rgba(56, 189, 248, 0.15) !important;
}

.header-title {
  flex-grow: 1;
  text-align: center;
  font-weight: 600;
  font-size: 0.85rem;
  padding: 0 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Header Dropdown Menu */
.header-filter-dropdown {
  position: absolute;
  top: 100%;
  left: 5%;
  width: 200px;
  max-height: 250px;
  overflow-y: auto;
  background: rgba(15, 23, 42, 0.98);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
  z-index: 1000;
  padding: 10px;
  display: none;
  flex-direction: column;
  gap: 8px;
  text-align: left;
}

.header-filter-dropdown.show {
  display: flex;
}

.filter-search {
  width: 100%;
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  color: #fff;
  font-size: 0.75rem;
  margin-bottom: 5px;
}

.filter-search:focus {
  outline: none;
  border-color: #38bdf8;
}

.filter-options-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 150px;
  overflow-y: auto;
  padding-right: 4px;
}

.filter-option-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
  margin: 0;
  padding: 2px 0;
}

.filter-option-item input {
  cursor: pointer;
  margin: 0;
}

.filter-option-item:hover {
  color: #fff;
}

.filter-actions {
  display: flex;
  justify-content: space-between;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 8px;
  margin-top: 4px;
}

.filter-btn-sub {
  background: none;
  border: none;
  color: #38bdf8;
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
}

.filter-btn-sub:hover {
  background: rgba(56, 189, 248, 0.1);
}

.filter-btn-sub.clear {
  color: #ef4444;
}

.filter-btn-sub.clear:hover {
  background: rgba(239, 68, 68, 0.1);
}

/* Merged table cells alignment — high specificity to override browser td default */
.cell-merged,
.dashboard-table td.cell-merged,
#revenue-table td.cell-merged,
#expenditure-table td.cell-merged {
  vertical-align: middle !important;
  text-align: left !important;
  font-weight: 500;
  background-color: rgba(255, 255, 255, 0.01);
}

/* Interactive Table Cell Interactions for Monthly Matrix */
.interactive-cell {
  cursor: pointer;
  position: relative;
  transition: background-color 0.2s cubic-bezier(0.4, 0, 0.2, 1), color 0.2s ease, outline 0.2s ease;
}

/* Hover effects */
.interactive-cell:hover {
  background-color: rgba(255, 255, 255, 0.08) !important;
  color: #fff !important;
}

[data-theme="light"] .interactive-cell:hover {
  background-color: rgba(99, 102, 241, 0.08) !important;
  color: var(--primary-color) !important;
}

/* Active and highlight states */
.active-cell {
  background-color: rgba(99, 102, 241, 0.3) !important;
  color: #fff !important;
  font-weight: 700 !important;
  outline: 2px solid var(--primary-color) !important;
  outline-offset: -2px;
  box-shadow: inset 0 0 8px rgba(99, 102, 241, 0.4);
}

[data-theme="light"] .active-cell {
  background-color: rgba(99, 102, 241, 0.15) !important;
  color: var(--primary-color) !important;
  font-weight: 700 !important;
  outline: 2px solid var(--primary-color) !important;
  outline-offset: -2px;
  box-shadow: inset 0 0 6px rgba(99, 102, 241, 0.2);
}

/* Row & Column Highlight states for matrix navigation */
.active-row {
  background-color: rgba(255, 255, 255, 0.03) !important;
}

.active-col {
  background-color: rgba(255, 255, 255, 0.02) !important;
}

[data-theme="light"] .active-row {
  background-color: rgba(99, 102, 241, 0.04) !important;
}

[data-theme="light"] .active-col {
  background-color: rgba(99, 102, 241, 0.02) !important;
}

/* Specific styling for the reset button inside transaction card header */
#btn-reset-analysis-filter {
  transition: var(--transition-smooth);
}

#btn-reset-analysis-filter:hover {
  background: var(--primary-gradient);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35);
}

/* Monthly Matrix Table Sizing Optimization to Fit Single Screen Layout */
#monthly-matrix-table {
  table-layout: fixed !important;
  width: 100% !important;
}

#monthly-matrix-table th,
#monthly-matrix-table td {
  padding: 8px 10px !important;
  font-size: 0.76rem !important;
  height: auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: normal !important;
  word-break: keep-all !important;
}

/* First Column (구분) */
#monthly-matrix-table th:first-child,
#monthly-matrix-table td:first-child {
  width: 90px !important;
  min-width: 90px !important;
  text-align: left !important;
}

/* Data columns & Total Column auto-balanced */
#monthly-matrix-table th:not(:first-child),
#monthly-matrix-table td:not(:first-child) {
  width: auto !important;
  min-width: 80px !important;
  text-align: right !important;
}

/* Header Text Sizing and Wrapping */
#monthly-matrix-table th strong {
  display: block;
  font-size: 0.78rem;
  line-height: 1.25;
  white-space: normal !important;
  word-break: keep-all !important;
}

#monthly-matrix-table th span {
  display: block;
  font-size: 0.65rem;
  line-height: 1.15;
  opacity: 0.85;
  white-space: normal !important;
  word-break: keep-all !important;
}

/* Excel Upload Modal & Dropzone Styles */
.btn-upload-excel {
  background: var(--primary-gradient);
  color: white;
  border: none;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  transition: var(--transition-smooth);
  font-family: var(--font-family);
  font-size: 0.85rem;
}

.btn-upload-excel:hover {
  opacity: 0.9;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.upload-modal-content {
  max-width: 850px !important;
  width: 90% !important;
}

.upload-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-top: 24px;
}

.upload-card {
  background: rgba(255, 255, 255, 0.02);
  border: 2px dashed rgba(255, 255, 255, 0.15);
  border-radius: 16px;
  padding: 32px 16px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition-smooth);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 220px;
}

.upload-card:hover {
  border-color: rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.04);
}

.upload-card.dragover {
  border-color: var(--primary-color);
  background: rgba(99, 102, 241, 0.08) !important;
  box-shadow: 0 0 16px rgba(99, 102, 241, 0.2);
  transform: translateY(-2px);
}

.dropzone-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.upload-icon {
  font-size: 2.2rem;
  margin-bottom: 8px;
  transition: transform 0.3s ease;
}

.upload-card:hover .upload-icon {
  transform: translateY(-4px);
}

.upload-card.dragover .upload-icon {
  animation: bounce 0.8s infinite alternate;
}

@keyframes bounce {
  from {
    transform: translateY(0);
  }

  to {
    transform: translateY(-8px);
  }
}

.upload-card h3 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--text-main);
  border-bottom: none !important;
  padding-bottom: 0 !important;
}

.dropzone-help {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.3;
}

.file-status {
  font-size: 0.75rem;
  margin-top: 12px;
  padding: 4px 10px;
  border-radius: 20px;
  font-weight: 500;
  max-width: 100%;
  word-break: break-all;
  background-color: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
}

/* Status modifiers */
.file-status.ready {
  background-color: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.file-status.parsing {
  background-color: rgba(14, 165, 233, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(14, 165, 233, 0.3);
}

.file-status.error {
  background-color: rgba(244, 63, 94, 0.15);
  color: #f87171;
  border: 1px solid rgba(244, 63, 94, 0.3);
}

.upload-summary-info {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.upload-summary-info i {
  font-size: 0.95rem;
}

/* Light Theme overrides for Upload Modal */
[data-theme="light"] .upload-card {
  background: rgba(0, 0, 0, 0.02);
  border-color: rgba(0, 0, 0, 0.15);
}

[data-theme="light"] .upload-card:hover {
  background: rgba(0, 0, 0, 0.04);
  border-color: rgba(0, 0, 0, 0.25);
}

[data-theme="light"] .upload-card.dragover {
  background: rgba(99, 102, 241, 0.05) !important;
  border-color: var(--primary-color);
}

[data-theme="light"] .file-status {
  background-color: rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .file-status.ready {
  background-color: rgba(5, 150, 105, 0.08);
  color: #047857;
  border-color: rgba(5, 150, 105, 0.2);
}

[data-theme="light"] .file-status.parsing {
  background-color: rgba(2, 132, 199, 0.08);
  color: #0369a1;
  border-color: rgba(2, 132, 199, 0.2);
}

[data-theme="light"] .file-status.error {
  background-color: rgba(225, 29, 72, 0.08);
  color: #be123c;
  border-color: rgba(225, 29, 72, 0.2);
}

/* -------------------------------------------------------------
   PRINT & USER MANUAL BUTTON STYLES
   ------------------------------------------------------------- */
.btn-print {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 14px;
  height: 36px;
  border-radius: 8px;
  font-size: 0.84rem;
  font-weight: 600;
  color: #c084fc;
  background: rgba(192, 132, 252, 0.12);
  border: 1px solid rgba(192, 132, 252, 0.3);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  white-space: nowrap;
}

.btn-print:hover {
  background: rgba(192, 132, 252, 0.25);
  border-color: #c084fc;
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(192, 132, 252, 0.25);
}

[data-theme="light"] .btn-print {
  background: #faf5ff;
  border-color: #e9d5ff;
  color: #9333ea;
}

[data-theme="light"] .btn-print:hover {
  background: #9333ea;
  border-color: #9333ea;
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(147, 51, 234, 0.2);
}

.btn-print-outline {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0 10px;
  height: 32px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.btn-print-outline:hover {
  color: var(--text-main);
  border-color: var(--primary-color);
  background: rgba(255, 255, 255, 0.05);
}

[data-theme="light"] .btn-print-outline {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: #1e293b;
}

[data-theme="light"] .btn-print-outline:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
  color: #0f172a;
}

.btn-manual {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 14px;
  height: 36px;
  border-radius: 8px;
  font-size: 0.84rem;
  font-weight: 600;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.25);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  white-space: nowrap;
}

.btn-manual:hover {
  background: rgba(56, 189, 248, 0.2);
  border-color: #38bdf8;
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(56, 189, 248, 0.2);
}

[data-theme="light"] .btn-manual {
  background: #f0f9ff;
  border-color: #bae6fd;
  color: #0284c7;
}

[data-theme="light"] .btn-manual:hover {
  background: #e0f2fe;
  border-color: #0284c7;
  color: #0369a1;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.15);
}

/* Manual Navigation Tabs */
.manual-nav-tabs {
  display: flex;
  background: rgba(0, 0, 0, 0.25);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  overflow-x: auto;
  padding: 0 12px;
  gap: 4px;
}

[data-theme="light"] .manual-nav-tabs {
  background: rgba(0, 0, 0, 0.03);
  border-bottom-color: rgba(0, 0, 0, 0.08);
}

.manual-tab-btn {
  padding: 12px 14px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.manual-tab-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.02);
}

.manual-tab-btn.active {
  color: var(--primary-color);
  border-bottom-color: var(--primary-color);
  background: rgba(59, 130, 246, 0.08);
}

/* Manual Tab Panes */
.manual-tab-pane {
  display: none;
  animation: fadeIn 0.2s ease-in-out;
}

.manual-tab-pane.active {
  display: block;
}

/* Hero Box */
.manual-hero-box {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.12) 0%, rgba(16, 185, 129, 0.08) 100%);
  border: 1px solid rgba(59, 130, 246, 0.25);
  border-radius: 10px;
  padding: 16px 20px;
  margin-bottom: 20px;
}

.manual-hero-box h3 {
  margin: 0 0 6px 0;
  font-size: 1.05rem;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

.manual-hero-box p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.88rem;
  line-height: 1.5;
}

/* Steps Grid */
.manual-steps-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

@media (max-width: 768px) {
  .manual-steps-grid {
    grid-template-columns: 1fr;
  }
}

.manual-step-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 18px 16px;
  position: relative;
  transition: transform 0.2s, border-color 0.2s;
}

.manual-step-card:hover {
  transform: translateY(-2px);
  border-color: var(--primary-color);
}

.step-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(59, 130, 246, 0.15);
  color: var(--primary-color);
  margin-bottom: 10px;
  letter-spacing: 0.5px;
}

.manual-step-card h4 {
  margin: 0 0 8px 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

.manual-step-card p {
  margin: 0;
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.manual-step-card code {
  background: rgba(255, 255, 255, 0.08);
  padding: 2px 5px;
  border-radius: 4px;
  font-size: 0.8rem;
  color: var(--primary-color);
}

[data-theme="light"] .manual-step-card code {
  background: rgba(0, 0, 0, 0.06);
}

/* Tip Card */
.manual-tip-card {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 0.84rem;
  line-height: 1.5;
  color: var(--text-main);
}

.manual-tip-card i {
  color: #f59e0b;
  font-size: 1.1rem;
  margin-top: 2px;
  flex-shrink: 0;
}

/* Edufine Path List */
.manual-section-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-main);
  margin: 0 0 16px 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.edufine-path-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.edufine-path-item {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  overflow: hidden;
}

.path-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid var(--border-color);
  flex-wrap: wrap;
  gap: 8px;
}

[data-theme="light"] .path-header {
  background: rgba(0, 0, 0, 0.02);
}

.path-tag {
  font-size: 0.85rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 6px;
}

.path-tag.tag-rev {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
}

.path-tag.tag-exp {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
}

.path-tag.tag-his {
  background: rgba(59, 130, 246, 0.15);
  color: #3b82f6;
}

.path-crumb {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}

.path-body {
  padding: 12px 16px;
  font-size: 0.84rem;
  line-height: 1.6;
  color: var(--text-main);
}

.path-body ul {
  margin: 0;
  padding-left: 18px;
}

.path-body li {
  margin-bottom: 4px;
}

/* Formula Cards Grid */
.formula-cards-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.formula-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 14px 18px;
}

.formula-card.highlight-card {
  border-color: rgba(59, 130, 246, 0.4);
  background: linear-gradient(135deg, var(--bg-card) 0%, rgba(59, 130, 246, 0.05) 100%);
}

.formula-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.formula-header h4 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-main);
}

.formula-badge {
  font-size: 0.72rem;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
}

.formula-badge.badge-primary {
  background: var(--primary-color);
  color: #fff;
  font-weight: 600;
}

.formula-math {
  font-family: 'Outfit', monospace;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--primary-color);
  background: rgba(0, 0, 0, 0.2);
  padding: 8px 12px;
  border-radius: 6px;
  margin-bottom: 8px;
}

[data-theme="light"] .formula-math {
  background: rgba(0, 0, 0, 0.04);
}

.formula-desc {
  margin: 0;
  font-size: 0.83rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Detail Section */
.manual-detail-section {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 16px;
}

.manual-detail-section h4 {
  margin: 0 0 10px 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

.manual-detail-section p {
  margin: 0 0 10px 0;
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.manual-detail-section ul {
  margin: 0;
  padding-left: 18px;
  font-size: 0.84rem;
  color: var(--text-main);
  line-height: 1.6;
}

.manual-detail-section li {
  margin-bottom: 6px;
}

/* -------------------------------------------------------------
   EXCEL EXPORT & DRILLDOWN & EMPTY STATE STYLES
   ------------------------------------------------------------- */
/* Table Header Row & Action Bar Layout */
.table-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 12px;
}

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

.table-info-badge {
  font-size: 0.76rem;
  padding: 6px 12px;
  border-radius: 6px;
  background: rgba(99, 102, 241, 0.12);
  color: #818cf8;
  border: 1px solid rgba(99, 102, 241, 0.25);
  font-weight: 500;
  white-space: nowrap;
}

[data-theme="light"] .table-info-badge {
  background: #eef2ff;
  color: #4338ca;
  border-color: #c7d2fe;
  font-weight: 600;
}

.btn-col-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 12px;
  height: 32px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  color: #818cf8;
  background: rgba(99, 102, 241, 0.1);
  border: 1px solid rgba(99, 102, 241, 0.3);
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.btn-col-toggle:hover {
  background: rgba(99, 102, 241, 0.2);
  border-color: var(--primary-color);
  color: #fff;
}

[data-theme="light"] .btn-col-toggle {
  background: #eef2ff;
  border-color: #c7d2fe;
  color: #4338ca;
}

[data-theme="light"] .btn-col-toggle:hover {
  background: #4338ca;
  border-color: #4338ca;
  color: #ffffff;
}

.btn-settings {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 12px;
  height: 32px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-color);
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.btn-settings:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: var(--primary-color);
  color: #fff;
}

[data-theme="light"] .btn-settings {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: #1e293b;
}

[data-theme="light"] .btn-settings:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
  color: #0f172a;
}

.btn-export-excel {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 12px;
  height: 32px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  color: #10b981;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.btn-export-excel:hover {
  background: #10b981;
  color: #ffffff;
  border-color: #10b981;
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(16, 185, 129, 0.25);
}

[data-theme="light"] .btn-export-excel {
  background: #ecfdf5;
  border-color: #a7f3d0;
  color: #059669;
}

[data-theme="light"] .btn-export-excel:hover {
  background: #059669;
  border-color: #059669;
  color: #ffffff;
}

/* Clickable Drilldown Table Row / Cell Link */
.drilldown-link {
  color: var(--primary-color);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  font-weight: 600;
  transition: color 0.15s;
}

.drilldown-link:hover {
  color: #60a5fa;
}

/* Empty State Card */
.empty-state-card {
  text-align: center;
  padding: 48px 24px;
  background: var(--bg-card);
  border: 1px dashed var(--border-color);
  border-radius: 12px;
  margin: 20px 0;
}

.empty-state-card i {
  font-size: 3rem;
  color: var(--text-muted);
  margin-bottom: 16px;
  opacity: 0.7;
}

.empty-state-card h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-main);
  margin: 0 0 8px 0;
}

.empty-state-card p {
  font-size: 0.85rem;
  color: var(--text-muted);
  max-width: 480px;
  margin: 0 auto 20px auto;
  line-height: 1.5;
}

/* -------------------------------------------------------------
   PRINT OVERRIDES: OFFICIAL A4 LANDSCAPE DOCUMENT STYLE
   ------------------------------------------------------------- */
@page {
  size: landscape;
  margin: 6mm 8mm 6mm 8mm;
}

@media print {

  html,
  body {
    background: #ffffff !important;
    color: #111827 !important;
    font-size: 10.5pt !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  .app-container {
    display: block !important;
    width: 100% !important;
  }

  .sidebar,
  .btn-refresh,
  .btn-print,
  .btn-print-outline,
  .btn-manual,
  .btn-upload-excel,
  .btn-export-excel,
  .btn-col-toggle,
  .btn-settings,
  .table-actions,
  .table-filter-bar,
  .modal-container,
  .modal-overlay,
  .settings-modal,
  .user-manual-modal,
  .excel-upload-modal {
    display: none !important;
  }

  .main-content {
    margin-left: 0 !important;
    padding: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  .top-header {
    display: flex !important;
    justify-content: space-between !important;
    align-items: flex-end !important;
    border-bottom: 2px solid #111827 !important;
    padding-bottom: 8px !important;
    margin-bottom: 14px !important;
  }

  .top-header .header-title h1 {
    font-size: 1.35rem !important;
    color: #111827 !important;
    margin: 0 0 4px 0 !important;
    font-weight: 800 !important;
  }

  .top-header .header-title p {
    font-size: 0.85rem !important;
    color: #4b5563 !important;
    margin: 0 !important;
  }

  .header-meta {
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
  }

  .header-meta .meta-item {
    font-size: 0.85rem !important;
    color: #111827 !important;
    font-weight: 700 !important;
  }

  /* KPI Summary Cards: 1 Row 3 Columns */
  .kpi-grid,
  .metrics-grid {
    display: grid !important;
    grid-template-columns: 1fr 1fr 1fr !important;
    gap: 12px !important;
    margin-bottom: 14px !important;
    break-inside: avoid !important;
    page-break-inside: avoid !important;
    width: 100% !important;
  }

  .kpi-card,
  .metric-card {
    background: #ffffff !important;
    border: 1.5px solid #d1d5db !important;
    border-radius: 6px !important;
    padding: 10px 14px !important;
    box-shadow: none !important;
    break-inside: avoid !important;
    page-break-inside: avoid !important;
    display: flex !important;
    flex-direction: column !important;
  }

  .kpi-header {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
  }

  .kpi-header span {
    font-size: 0.78rem !important;
    color: #4b5563 !important;
    font-weight: 600 !important;
  }

  .kpi-value {
    font-size: 1.22rem !important;
    font-weight: 800 !important;
    color: #111827 !important;
    margin: 4px 0 6px 0 !important;
  }

  .kpi-footer {
    font-size: 0.74rem !important;
    color: #6b7280 !important;
    border-top: 1px solid #f3f4f6 !important;
    padding-top: 4px !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
  }

  /* Table Section: Clean High-Contrast */
  .dashboard-card.table-section {
    background: #ffffff !important;
    border: none !important;
    padding: 0 !important;
    box-shadow: none !important;
    margin-bottom: 14px !important;
    break-inside: avoid !important;
    page-break-inside: avoid !important;
  }

  .table-header-row {
    margin-bottom: 6px !important;
  }

  .table-header-row h3 {
    font-size: 1.05rem !important;
    color: #111827 !important;
    font-weight: 700 !important;
  }

  .table-responsive {
    overflow: visible !important;
  }

  .dashboard-table {
    width: 100% !important;
    border-collapse: collapse !important;
    border: 1.5px solid #111827 !important;
    font-size: 8.5pt !important;
    background: #ffffff !important;
    break-inside: avoid !important;
    page-break-inside: avoid !important;
  }

  .dashboard-table th,
  .dashboard-table td {
    border: 1px solid #9ca3af !important;
    padding: 5px 6px !important;
    color: #111827 !important;
    background: #ffffff !important;
  }

  .dashboard-table thead th {
    background-color: #f3f4f6 !important;
    color: #111827 !important;
    font-weight: 700 !important;
    border-bottom: 1.5px solid #111827 !important;
  }

  .dashboard-table thead th.th-revenue-group {
    background-color: #ecfdf5 !important;
    color: #065f46 !important;
  }

  .dashboard-table thead th.th-expenditure-group {
    background-color: #fff1f2 !important;
    color: #9f1239 !important;
  }

  .dashboard-table thead th.th-balance-budget {
    background-color: #eff6ff !important;
    color: #1e40af !important;
  }

  .dashboard-table thead th.th-balance-actual {
    background-color: #f0fdf4 !important;
    color: #166534 !important;
  }

  .dashboard-table tfoot td,
  .dashboard-table .row-total td {
    background-color: #f3f4f6 !important;
    font-weight: 700 !important;
    border-top: 2px solid #111827 !important;
  }

  .text-success-header,
  .text-green {
    color: #047857 !important;
  }

  .text-danger-header,
  .text-orange {
    color: #b91c1c !important;
  }

  .text-primary-header,
  .text-blue {
    color: #1d4ed8 !important;
  }

  /* ── 2페이지: 차트 및 시각화 분석 보고서 (Page Break) ── */
  .dashboard-charts-grid {
    break-before: page !important;
    page-break-before: always !important;
    display: grid !important;
    grid-template-columns: 1.4fr 1fr !important;
    gap: 16px !important;
    margin-top: 0 !important;
    padding-top: 8px !important;
    width: 100% !important;
    break-inside: avoid !important;
    page-break-inside: avoid !important;
  }

  .dashboard-card.chart-container,
  .dashboard-card.status-list-container {
    background: #ffffff !important;
    border: 1.5px solid #d1d5db !important;
    border-radius: 6px !important;
    padding: 14px 16px !important;
    box-shadow: none !important;
    break-inside: avoid !important;
    page-break-inside: avoid !important;
  }

  .dashboard-card.chart-container h3,
  .dashboard-card.status-list-container h3 {
    font-size: 1.05rem !important;
    color: #111827 !important;
    font-weight: 700 !important;
    border-bottom: 1.5px solid #e5e7eb !important;
    padding-bottom: 8px !important;
    margin-bottom: 12px !important;
  }

  .canvas-wrapper {
    height: 340px !important;
    width: 100% !important;
  }

  .canvas-wrapper canvas {
    max-height: 340px !important;
    width: 100% !important;
  }

  .status-progress-list {
    display: flex !important;
    flex-direction: column !important;
    gap: 10px !important;
  }

  .status-progress-item {
    background: #f9fafb !important;
    border: 1px solid #e5e7eb !important;
    border-radius: 6px !important;
    padding: 10px 12px !important;
  }

  /* 월별 분석 탭 등 기타 탭 인쇄 시 페이지 나눔 보호 */
  .monthly-analysis-layout {
    break-inside: avoid !important;
    page-break-inside: avoid !important;
  }
}