/* ===================================================
   DARK THEME — ExpenseTracker Revamp
   Inspired by: dark navy financial dashboard
   =================================================== */

/* ── LIGHT THEME OVERRIDE ───────────────────────── */
body.light-theme {
  --bg-base:       #f0f2f5;
  --bg-secondary:  #ffffff;
  --bg-card:       #ffffff;
  --bg-card-alt:   #f5f7fa;
  --bg-hover:      #e8ecf2;
  --border:        #d0d7e3;
  --border-light:  #e2e8f0;

  --text-primary:  #1a2035;
  --text-secondary:#4a5568;
  --text-muted:    #8896ab;

  --accent-teal:   #0aaf98;
  --accent-blue:   #2b7de9;
  --accent-orange: #f97316;
  --accent-amber:  #d97706;
  --accent-purple: #7c3aed;
  --accent-pink:   #db2777;
  --accent-green:  #16a34a;
  --accent-red:    #dc2626;
  --accent-cyan:   #0891b2;

  --shadow: 0 4px 20px rgba(0,0,0,0.08);
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.06);
}

body.light-theme .navbar-dark-custom {
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

body.light-theme .modal-dark .modal-content {
  background: #ffffff;
  border-color: var(--border);
  color: var(--text-primary);
}

body.light-theme .modal-dark .btn-close,
body.light-theme .modal-dark .btn-close:hover,
body.light-theme .modal-dark .btn-close:focus,
.modal-dark .btn-close,
.modal-dark .btn-close:hover,
.modal-dark .btn-close:focus {
  background-image: none !important;
  filter: none !important;
  opacity: 1 !important;
  color: #ff0000 !important;
  --bs-btn-close-color: #ff0000 !important;
  box-shadow: none !important;
}

.modal-dark .btn-close::before {
  content: "\00D7" !important;
  font-size: 1.2rem !important;
  color: #ff0000 !important;
  opacity: 1 !important;
}

body.light-theme .table-dark-custom thead th {
  color: #1a2035 !important;
  background: #dde2ec !important;
  border-bottom: 2px solid #b0bcd4;
}

body.light-theme .content-card {
  background: var(--bg-card-alt);
  border: 1px solid var(--border);
}

body.light-theme .badge-store {
  background: #dbeafe;
  color: #1d4ed8;
}

body.light-theme .badge-cat {
  background: #d1fae5;
  color: #065f46;
}

body.light-theme .badge-pmt {
  background: #ede9fe;
  color: #5b21b6;
}

body.light-theme select,
body.light-theme input[type="text"],
body.light-theme input[type="search"] {
  background: #ffffff;
  color: var(--text-primary);
  border-color: var(--border);
}

body.light-theme .footer-dark {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  color: var(--text-secondary);
}

:root {
  --bg-base:       #0d1117;
  --bg-secondary:  #141929;
  --bg-card:       #1a2235;
  --bg-card-alt:   #1e2844;
  --bg-hover:      #243050;
  --border:        #2a3555;
  --border-light:  #1f2e4a;

  --text-primary:  #e8edf5;
  --text-secondary:#8a97b0;
  --text-muted:    #54637a;

  --accent-teal:   #0dd3b6;
  --accent-blue:   #4a9ffe;
  --accent-orange: #f97316;
  --accent-amber:  #fbbf24;
  --accent-purple: #9b6dff;
  --accent-pink:   #f472b6;
  --accent-green:  #22c55e;
  --accent-red:    #ef4444;
  --accent-cyan:   #22d3ee;

  /* Category palette (used in breakdown cards) */
  --cat-1: #0dd3b6;
  --cat-2: #4a9ffe;
  --cat-3: #f97316;
  --cat-4: #9b6dff;
  --cat-5: #fbbf24;
  --cat-6: #f472b6;
  --cat-7: #22c55e;
  --cat-8: #ef4444;

  --navbar-height: 54px;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 4px 20px rgba(0,0,0,0.4);
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.25);
}

/* ── BASE ────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  background-color: var(--bg-base);
  color: var(--text-primary);
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--accent-blue); text-decoration: none; }
a:hover { color: var(--accent-teal); }

h1,h2,h3,h4,h5,h6 { color: var(--text-primary); font-weight: 600; }

/* ── NAVBAR ──────────────────────────────────────── */
.navbar-dark-custom {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  height: var(--navbar-height);
  padding: 0 1rem;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 2px 12px rgba(0,0,0,0.5);
}

.navbar-dark-custom .navbar-brand {
  color: var(--text-primary) !important;
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 0.3px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.navbar-dark-custom .navbar-brand i {
  color: var(--accent-teal);
  font-size: 1.1rem;
}

/* Nav tabs style */
.navbar-dark-custom .nav-link {
  color: var(--text-secondary) !important;
  font-size: 0.825rem;
  font-weight: 500;
  padding: 6px 14px !important;
  border-radius: var(--radius-sm);
  transition: all 0.2s;
  white-space: nowrap;
}

.navbar-dark-custom .nav-link:hover {
  color: var(--text-primary) !important;
  background: var(--bg-hover);
}

.navbar-dark-custom .nav-link.active,
.navbar-dark-custom .nav-item.active .nav-link {
  color: var(--text-primary) !important;
  background: var(--bg-card-alt);
}

.navbar-dark-custom .navbar-toggler {
  border-color: var(--border);
  color: var(--text-secondary);
}

.navbar-dark-custom .navbar-toggler-icon {
  filter: invert(0.7);
}

.btn-add-receipt {
  background: var(--accent-blue);
  color: #fff !important;
  border: none;
  border-radius: var(--radius-sm);
  padding: 6px 14px;
  font-size: 0.825rem;
  font-weight: 600;
  transition: background 0.2s, transform 0.15s;
  white-space: nowrap;
}

.btn-add-receipt:hover {
  background: #3b8de8;
  color: #fff !important;
  transform: translateY(-1px);
}

.btn-logout {
  background: transparent;
  color: var(--text-secondary) !important;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 5px 12px;
  font-size: 0.825rem;
  transition: all 0.2s;
}

.btn-search-global {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 5px 10px;
  font-size: 0.825rem;
  cursor: pointer;
  transition: all 0.2s;
  line-height: 1;
}
.btn-search-global:hover {
  border-color: var(--accent-teal);
  color: var(--accent-teal);
}

.btn-add-receipt {
  background: var(--accent-teal);
  color: #0a0f1e !important;
  border: none;
  border-radius: var(--radius-sm);
  padding: 5px 12px;
  font-size: 0.825rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  line-height: 1.5;
}
.btn-add-receipt:hover {
  background: #0bbfa6;
  color: #0a0f1e !important;
}

.btn-logout:hover {
  border-color: var(--accent-red);
  color: var(--accent-red) !important;
}

/* ── PAGE HEADER ──────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 0 12px 0;
  flex-wrap: wrap;
  gap: 10px;
}

.page-title { font-size: 1.35rem; font-weight: 700; margin: 0; }
.page-subtitle { font-size: 0.78rem; color: var(--text-secondary); margin-top: 1px; }
.page-as-of { font-size: 0.8rem; color: var(--text-secondary); }

/* ── FILTER BAR ───────────────────────────────────── */
.filter-bar {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 120px;
  flex: 1;
}

.filter-group label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  font-weight: 600;
}

.filter-group select,
.filter-group input[type="month"],
.filter-group input[type="text"] {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 0.8rem;
  outline: none;
  transition: border-color 0.2s;
  width: 100%;
}

.filter-group select:focus,
.filter-group input:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 2px rgba(74, 159, 254, 0.15);
}

.filter-group select option { background: var(--bg-secondary); }

.btn-apply {
  background: var(--accent-blue);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 7px 18px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  align-self: flex-end;
}

.btn-apply:hover { background: #3b8de8; }

.btn-clear-filter {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 14px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s;
  align-self: flex-end;
}

.btn-clear-filter:hover {
  border-color: var(--text-secondary);
  color: var(--text-primary);
}

/* ── SUMMARY CARDS ────────────────────────────────── */
.summary-cards {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 14px;
  margin-bottom: 18px;
}

@media (max-width: 768px) {
  .summary-cards { grid-template-columns: 1fr 1fr; }
  .summary-card.combined { grid-column: 1 / -1; }
}

.summary-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s;
}

.summary-card:hover { border-color: var(--border-light); }

.summary-card.combined {
  background: linear-gradient(135deg, #0d2038 0%, #0a2430 100%);
  border-color: var(--accent-teal);
  box-shadow: 0 0 0 1px rgba(13,211,182,0.2), var(--shadow-sm);
}

.summary-card .owner-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.summary-card.combined .owner-label { color: var(--accent-teal); }

.summary-card .amount-large {
  font-size: 1.85rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.15;
  letter-spacing: -0.5px;
}

.summary-card.combined .amount-large {
  font-size: 2.1rem;
  color: #fff;
}

.summary-card .amount-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ── MAIN CONTENT CARD ────────────────────────────── */
.content-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  margin-bottom: 18px;
  overflow: hidden;
}

.content-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card-alt);
}

.content-card-header h5 {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
  margin: 0;
}

.content-card-body { padding: 0; }

/* ── TABLES ───────────────────────────────────────── */
.table-dark-custom {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.table-dark-custom thead th {
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  cursor: pointer;
}

.table-dark-custom thead th:hover { color: var(--text-primary); }

.table-dark-custom tbody tr {
  border-bottom: 1px solid rgba(42, 53, 85, 0.5);
  transition: background 0.15s;
  cursor: pointer;
}

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

.table-dark-custom tbody td {
  padding: 9px 14px;
  color: var(--text-primary);
  vertical-align: middle;
}

.table-dark-custom .amount-col {
  text-align: right;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
}

.table-dark-custom .text-muted-col { color: var(--text-secondary); }

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

/* Thumbnail in table */
.thumb-img {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  object-fit: cover;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
}

.thumb-placeholder {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.75rem;
}

/* ── BADGES / TAGS ────────────────────────────────── */
.badge-cat {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 0.68rem;
  font-weight: 600;
  background: rgba(74, 159, 254, 0.15);
  color: var(--accent-blue);
  border: 1px solid rgba(74, 159, 254, 0.25);
}

.badge-store {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 0.68rem;
  font-weight: 600;
  background: rgba(155, 109, 255, 0.15);
  color: var(--accent-purple);
  border: 1px solid rgba(155, 109, 255, 0.25);
}

.badge-pmt {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 0.68rem;
  font-weight: 600;
  background: rgba(249, 115, 22, 0.15);
  color: var(--accent-orange);
  border: 1px solid rgba(249, 115, 22, 0.25);
}

/* ── BREAKDOWN SECTION (like Currency Breakdown) ── */
.breakdown-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 14px 18px 8px;
}

.breakdown-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 0 18px 16px;
}

.breakdown-pill {
  background: var(--bg-card-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  min-width: 90px;
}

.breakdown-pill .pill-label {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 3px;
}

.breakdown-pill .pill-amount {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
}

.breakdown-pill .pill-sub {
  font-size: 0.68rem;
  color: var(--text-muted);
}

/* ── CHART ROW ────────────────────────────────────── */
.chart-row {
  display: grid;
  grid-template-columns: 1fr 1.6fr 1.3fr;
  gap: 14px;
  margin-bottom: 18px;
}

@media (max-width: 992px) {
  .chart-row { grid-template-columns: 1fr 1fr; }
  .chart-row .chart-card:last-child { grid-column: 1 / -1; }
}

@media (max-width: 600px) {
  .chart-row { grid-template-columns: 1fr; }
}

.chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}

.chart-card-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.chart-canvas-wrap {
  position: relative;
  height: 220px;
}

/* Pie legend */
.pie-legend { margin-top: 10px; }
.pie-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  color: var(--text-secondary);
  line-height: 1.8;
}
.pie-legend-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ── CATEGORY BREAKDOWN CARDS (bottom) ───────────── */
.category-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.category-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
  border-top: 3px solid var(--accent-blue);
}

.category-card:nth-child(1) { border-top-color: var(--cat-1); }
.category-card:nth-child(2) { border-top-color: var(--cat-2); }
.category-card:nth-child(3) { border-top-color: var(--cat-3); }
.category-card:nth-child(4) { border-top-color: var(--cat-4); }
.category-card:nth-child(5) { border-top-color: var(--cat-5); }
.category-card:nth-child(6) { border-top-color: var(--cat-6); }
.category-card:nth-child(7) { border-top-color: var(--cat-7); }
.category-card:nth-child(8) { border-top-color: var(--cat-8); }

.category-card .cat-name {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  font-weight: 700;
  margin-bottom: 8px;
}

.category-card .cat-amount {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-primary);
}

.category-card .cat-meta {
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.category-card .cat-pct {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* ── BUTTONS ──────────────────────────────────────── */
.btn-dark-primary {
  background: var(--accent-blue);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 7px 16px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-dark-primary:hover { background: #3b8de8; color: #fff; }

.btn-dark-secondary {
  background: var(--bg-card-alt);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 16px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

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

.btn-dark-danger {
  background: rgba(239, 68, 68, 0.15);
  color: var(--accent-red);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: var(--radius-sm);
  padding: 5px 12px;
  font-size: 0.78rem;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-dark-danger:hover {
  background: rgba(239, 68, 68, 0.25);
}

.btn-dark-success {
  background: rgba(34, 197, 94, 0.15);
  color: var(--accent-green);
  border: 1px solid rgba(34, 197, 94, 0.3);
  border-radius: var(--radius-sm);
  padding: 5px 12px;
  font-size: 0.78rem;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-dark-success:hover { background: rgba(34, 197, 94, 0.25); }

.btn-icon {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  padding: 5px 10px;
  font-size: 0.78rem;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-icon:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--text-muted);
}

/* ── FORMS ────────────────────────────────────────── */
.form-dark .form-label {
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.form-dark .form-control,
.form-dark .form-select {
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-dark .form-control:focus,
.form-dark .form-select:focus {
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(74, 159, 254, 0.15);
  outline: none;
}

.form-dark .form-control::placeholder { color: var(--text-muted); }

.form-dark .form-select option {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

/* Standalone dark form controls (outside .form-dark wrapper) */
.form-control-dark,
.form-select-dark {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  padding: 7px 12px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.form-control-dark:focus,
.form-select-dark:focus {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(74, 159, 254, 0.15);
  outline: none;
}
.form-control-dark::placeholder { color: var(--text-muted); }
.form-select-dark option { background: var(--bg-secondary); color: var(--text-primary); }

/* ── MODAL ────────────────────────────────────────── */
.modal-dark .modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
}

.modal-dark .modal-header {
  background: var(--bg-card-alt);
  border-bottom: 1px solid var(--border);
  padding: 14px 20px;
}

.modal-dark .modal-title { font-size: 0.95rem; font-weight: 700; }

.modal-dark .btn-close {
  filter: invert(1) opacity(0.6);
}

.modal-dark .modal-body { padding: 20px; font-size: 0.85rem; }

.modal-dark .modal-body strong { color: var(--text-secondary); }

.modal-dark .modal-footer {
  border-top: 1px solid var(--border);
  padding: 12px 20px;
}

/* ── UPLOAD DROPZONE ──────────────────────────────── */
.dropzone-dark {
  background: var(--bg-secondary);
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 40px 20px;
  text-align: center;
  transition: border-color 0.2s, background 0.2s;
  cursor: pointer;
}

.dropzone-dark:hover,
.dropzone-dark.dragover {
  border-color: var(--accent-blue);
  background: rgba(74, 159, 254, 0.05);
}

.dropzone-dark .dropzone-icon {
  font-size: 2.5rem;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.dropzone-dark p { color: var(--text-secondary); font-size: 0.85rem; }

/* ── FOOTER ───────────────────────────────────────── */
.footer-dark {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  padding: 12px 0;
  text-align: center;
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 24px;
}

/* ── PAGE CONTAINER ───────────────────────────────── */
.page-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 16px 40px;
}

@media (max-width: 768px) {
  .navbar-dark-custom {
    height: auto;
    padding: 0.45rem 0.8rem;
  }

  .navbar-dark-custom .page-container {
    flex-wrap: wrap;
    align-items: center;
  }

  .navbar-dark-custom .navbar-brand {
    max-width: 50%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .navbar-dark-custom .navbar-toggler {
    position: relative;
    margin: 0;
    border-radius: 0.35rem;
  }

  .navbar-dark-custom .navbar-collapse {
    width: 100%;
    margin-top: 0.5rem;
  }

  .navbar-dark-custom .navbar-nav {
    flex-direction: column;
  }

  .navbar-dark-custom .d-flex.align-items-center {
    width: 100%;
    justify-content: flex-start;
    gap: 0.4rem;
    margin-top: 0.5rem;
    flex-wrap: wrap;
  }

  .navbar-dark-custom .btn-search-global,
  .navbar-dark-custom .btn-add-receipt,
  .navbar-dark-custom .btn-logout {
    font-size: 0.8rem;
    padding: 0.35rem 0.6rem;
  }
}

/* ── UTILITIES ────────────────────────────────────── */
.text-teal   { color: var(--accent-teal)   !important; }
.text-blue   { color: var(--accent-blue)   !important; }
.text-orange { color: var(--accent-orange) !important; }
.text-purple { color: var(--accent-purple) !important; }
.text-green  { color: var(--accent-green)  !important; }
.text-red    { color: var(--accent-red)    !important; }
.text-muted-custom { color: var(--text-muted) !important; }
.text-secondary-custom { color: var(--text-secondary) !important; }

.divider { border-color: var(--border); margin: 0; }

.section-title {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 12px;
}

/* ── SCROLLBAR ────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ── RESPONSIVE TABLE WRAPPER ─────────────────────── */
.table-wrapper { overflow-x: auto; }

/* ── OVERRIDES FOR BOOTSTRAP inside dark containers ─ */
.modal-backdrop { background-color: rgba(0,0,0,0.75); }

/* Bootstrap card override */
.card-dark {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
}

.card-dark .card-body { padding: 16px; }
.card-dark .card-header {
  background: var(--bg-card-alt);
  border-bottom: 1px solid var(--border);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* Alert overrides */
.alert-dark-info {
  background: rgba(74, 159, 254, 0.1);
  border: 1px solid rgba(74, 159, 254, 0.3);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.82rem;
  padding: 10px 14px;
}

/* ── ANALYSIS TABLE OVERRIDES ─────────────────────── */
.analysis-year-select {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font-size: 0.82rem;
}

.view-toggle-dark {
  display: flex;
  gap: 4px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px;
}

.view-toggle-dark button {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  border-radius: 4px;
  padding: 5px 14px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.view-toggle-dark button.active {
  background: var(--bg-card-alt);
  color: var(--text-primary);
}

/* ── KPI CARDS ────────────────────────────────────── */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}
@media (max-width: 900px) { .kpi-row { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 500px) { .kpi-row { grid-template-columns: 1fr; } }

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.kpi-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}
.kpi-icon.teal   { background: rgba(13,211,182,0.12); color: var(--accent-teal); }
.kpi-icon.blue   { background: rgba(74,159,254,0.12); color: var(--accent-blue); }
.kpi-icon.orange { background: rgba(249,115,22,0.12); color: var(--accent-orange); }
.kpi-icon.purple { background: rgba(155,109,255,0.12); color: var(--accent-purple); }

.kpi-body { min-width: 0; flex: 1; }

.kpi-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.kpi-value-sm { font-size: 1rem; }

.kpi-label {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin: 3px 0 2px;
}

.kpi-sub {
  font-size: 0.72rem;
  color: var(--text-secondary);
}

/* ── GC / CC PAGE SPECIFICS ───────────────────────── */.stat-row {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.stat-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  flex: 1;
  min-width: 140px;
}

.stat-box .stat-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.stat-box .stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
}

.stat-box .stat-sub {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Progress bar for CC/GC cards */
.mini-progress {
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  margin-top: 8px;
  overflow: hidden;
}

.mini-progress-fill {
  height: 100%;
  border-radius: 2px;
  background: var(--accent-teal);
  transition: width 0.5s ease;
}

/* ── TD PAGE ──────────────────────────────────────── */
.td-badge-due    { background: rgba(239,68,68,0.15); color: var(--accent-red); border: 1px solid rgba(239,68,68,0.3); padding: 2px 8px; border-radius: 20px; font-size: 0.65rem; font-weight: 700; }
.td-badge-ok     { background: rgba(34,197,94,0.15); color: var(--accent-green); border: 1px solid rgba(34,197,94,0.3); padding: 2px 8px; border-radius: 20px; font-size: 0.65rem; font-weight: 700; }
.td-badge-mature { background: rgba(138,151,176,0.15); color: var(--text-muted); border: 1px solid var(--border); padding: 2px 8px; border-radius: 20px; font-size: 0.65px; font-weight: 700; }

/* ── LOGIN PAGE ───────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-base);
  background-image: radial-gradient(ellipse at 50% 0%, rgba(74,159,254,0.08) 0%, transparent 70%);
}

.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 40px 36px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow);
}

.login-card h2 {
  font-size: 1.6rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 6px;
}

.login-card .subtitle {
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.82rem;
  margin-bottom: 28px;
}

.login-card .brand-icon {
  text-align: center;
  margin-bottom: 16px;
  font-size: 2rem;
  color: var(--accent-teal);
}

/* ── PRICE CHART (dark bg) in modal ──────────────── */
#priceChart {
  background: transparent;
}

/* ── RECEIPT IMAGE in detail ──────────────────────── */
.receipt-img-thumb {
  max-width: 160px;
  max-height: 160px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  object-fit: cover;
}
