/* =========================================
   MODALS.CSS - CLEANED & CONSOLIDATED
   ========================================= */

/* --- 1. MODAL OVERLAY & BASE STYLES --- */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 3000;
  display: none;
  justify-content: center;
  align-items: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.modal-overlay.active {
  display: flex;
  opacity: 1;
}

.modal-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2rem;
  width: 90%;
  max-width: 400px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
  transform: translateY(20px);
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  position: relative;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-overlay.active .modal-box {
  transform: translateY(0);
}

/* Modal Sizes */
.modal-box-large {
  max-width: 600px;
  max-height: 85vh;
  overflow-y: auto;
}

.modal-box-medium {
  max-width: 450px;
}

/* Close Button (Global Default) */
.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 1.5rem;
  cursor: pointer;
  transition: color 0.2s;
  line-height: 1;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.modal-close:hover {
  color: var(--red);
  background: var(--red-bg);
}

.modal-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  color: var(--text);
  padding-right: 2rem; /* Space for close button */
}

.modal-actions {
  display: flex;
  gap: 1rem;
  margin-top: 1.5rem;
}

/* --- 2. BUTTON STYLES --- */
.btn-cancel {
  flex: 1;
  padding: 0.75rem;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-dim);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-cancel:hover {
  border-color: var(--text-dim);
  color: var(--text);
  background: var(--surface-hover);
}

.btn-create {
  flex: 1;
  padding: 0.75rem;
  background: var(--accent);
  border: none;
  border-radius: 8px;
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 4px 12px rgba(139, 92, 247, 0.3);
}

.btn-create:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(139, 92, 247, 0.4);
  opacity: 0.9;
}

.btn-small {
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  border-radius: 4px;
  padding: 0.4rem 0.8rem;
  transition: opacity 0.2s;
}

.btn-small:hover { opacity: 0.9; }

.btn-danger {
  flex: 1;
  padding: 0.75rem;
  background: var(--red);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
}

.btn-danger:hover { opacity: 0.9; }

.btn-outline-danger {
  width: 100%;
  padding: 0.75rem;
  background: transparent;
  border: 1px solid var(--red);
  color: var(--red);
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-outline-danger:hover {
  background: var(--red);
  color: #fff;
}

.btn-disabled {
  flex: 1;
  padding: 0.75rem;
  background: var(--border);
  color: var(--text-dim);
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: not-allowed;
}

.btn-sm {
  padding: 0.4rem 0.8rem;
  font-size: 0.85rem;
}

/* --- 3. TOAST NOTIFICATIONS --- */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 0.75rem 1.5rem;
  border-radius: 10px;
  font-size: 0.85rem;
  opacity: 0;
  transition: all 0.3s ease;
  z-index: 10000;
  pointer-events: none;
  box-shadow: 0 4px 12px var(--shadow);
  display: flex;
  align-items: center;
  gap: 1rem;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  pointer-events: auto;
}

/* --- 4. SCROLL TOP BUTTON --- */
.scroll-top-btn {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 48px;
  height: 48px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 50%;
  font-size: 1.5rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
}

.scroll-top-btn.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.scroll-top-btn:hover {
  background: #7c3aed;
  transform: translateY(-4px);
  box-shadow: 0 8px 20px rgba(124, 58, 237, 0.4);
}

/* --- 5. RAINBOW TOP BAR --- */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg, var(--accent), var(--green), var(--blue));
  z-index: 9999;
}

/* --- 6. NOSCRIPT FALLBACK --- */
noscript div,
.noscript-fallback {
  padding: 2rem;
  text-align: center;
  background: var(--red-bg);
  color: var(--red);
  margin: 2rem;
  border-radius: 8px;
}

/* --- 7. SCROLLBAR --- */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-dim);
}

/* --- 8. PRINT STYLES --- */
@media print {
  .app-header, footer, .toast, .modal-overlay, body::before {
    display: none !important;
  }
  main {
    padding: 0;
    max-width: 100%;
  }
  .card, .form-panel, .transactions-panel, .category-panel, .income-overview-panel {
    box-shadow: none;
    border: 1px solid #ddd;
    break-inside: avoid;
  }
}

/* --- 9. WARNING BOXES (Red Alerts) --- */
.warning-box {
  background: var(--red-bg);
  border: 1px solid var(--red);
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1rem;
}

.warning-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--red);
  margin-bottom: 0.5rem;
}

/* --- 10. LICENSE CONTENT --- */
.license-content {
  color: var(--text-dim);
  font-size: 0.85rem;
  line-height: 1.7;
  max-height: 400px;
  overflow-y: auto;
  padding-right: 0.5rem;
}

/* --- 11. FORM ELEMENTS & INPUTS (Global Defaults) --- */
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  margin-top: 0.5rem;
}

.checkbox-label input {
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.help-text {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-top: 0.25rem;
}

.input-full {
  width: 100%;
  padding: 0.65rem 0.85rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s;
}

.input-full:focus {
  border-color: var(--accent);
}

.input-sm {
  padding: 0.5rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 0.9rem;
  outline: none;
}

.input-sm:focus {
  border-color: var(--accent);
}

.w-24 { width: 6rem; }

.toggle-group {
  display: flex;
  gap: 0.5rem;
  background: var(--bg);
  padding: 0.25rem;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.currency-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 0.5rem;
}

.currency-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.currency-btn:hover {
  border-color: var(--accent);
  background: var(--surface-hover);
}

.curr-symbol { font-size: 1.2rem; font-weight: 700; }
.curr-flag { font-size: 1.5rem; margin-top: 0.25rem; }

/* =========================================
   SETTINGS MODAL POLISH (EXCLUSIVE CHANGES)
   ========================================= */

/* 1. Container & Layout */
#settingsModal .modal-box {
  max-width: 600px; /* Wider for better layout */
  border-radius: 20px; /* Softer, modern corners */
  padding: 0; /* Remove default padding, let children handle it */
  display: flex;
  flex-direction: column;
}

/* 2. Header Section */
#settingsModal .modal-title {
  padding: 1.5rem 1.5rem 0.5rem;
  margin-bottom: 0;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

#settingsModal .modal-close {
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;
  width: 36px;
  height: 36px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-dim);
  font-size: 1.4rem;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

#settingsModal .modal-close:hover {
  background: var(--surface-hover);
  color: var(--text);
  border-color: var(--text-dim);
  transform: rotate(90deg); /* Mechanical gear feel */
}

/* 3. Content Area */
#settingsModal .modal-body {
  padding: 0 1.5rem 1.5rem;
  overflow-y: auto;
  flex: 1;
}

/* 4. Form Groups */
#settingsModal .form-group {
  margin-bottom: 1.75rem;
  padding-bottom: 1.75rem;
  border-bottom: 1px solid var(--border);
}

#settingsModal .form-group:last-of-type {
  border-bottom: none;
  padding-bottom: 0;
}

#settingsModal label {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.6rem;
  display: block;
}

#settingsModal .help-text {
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-top: 0.5rem;
  line-height: 1.5;
}

/* 5. Currency Grid - Polished */
#settingsModal .currency-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 0.75rem;
  margin-top: 0.75rem;
}

#settingsModal .currency-btn {
  padding: 0.75rem 0.5rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

#settingsModal .currency-btn:hover {
  border-color: var(--accent);
  background: var(--surface-hover);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

#settingsModal .currency-btn:active {
  transform: translateY(0);
}

#settingsModal .curr-symbol {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.25rem;
}

#settingsModal .curr-flag {
  font-size: 1.3rem;
  filter: grayscale(0.2);
  transition: filter 0.2s;
}

#settingsModal .currency-btn:hover .curr-flag {
  filter: grayscale(0);
}

/* 6. Toggle Group - Segmented Control Style */
#settingsModal .toggle-group {
  background: var(--bg);
  padding: 0.25rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  gap: 0.25rem;
  display: flex;
}

#settingsModal .toggle-group .btn-small {
  flex: 1;
  padding: 0.5rem 0.75rem;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: 6px;
  background: transparent;
  color: var(--text-dim);
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

#settingsModal .toggle-group .btn-small:hover {
  color: var(--text);
  background: var(--surface-hover);
}

#settingsModal .toggle-group .btn-small[style*="background: var(--accent)"] {
  background: var(--accent) !important;
  color: #fff !important;
  box-shadow: 0 2px 8px rgba(139, 92, 247, 0.3);
}

/* 7. Select Inputs */
#settingsModal .payment-method-select {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-size: 0.95rem;
  outline: none;
  transition: all 0.2s ease;
  cursor: pointer;
  appearance: none; /* Custom arrow handling if needed */
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  background-size: 16px;
}

#settingsModal .payment-method-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(139, 92, 247, 0.15);
}

/* 8. Danger Zone - Professional & Distinct */
#settingsModal .danger-zone {
  margin-top: 2rem;
  padding: 1.5rem;
  background: rgba(239, 68, 68, 0.05);
  border: 1px dashed rgba(239, 68, 68, 0.3);
  border-radius: 12px;
  position: relative;
}

#settingsModal .danger-zone::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(239, 68, 68, 0.5), transparent);
}

#settingsModal .danger-zone .icon-lg {
  color: var(--red);
  margin-right: 0.5rem;
}

#settingsModal .danger-zone .text-red {
  color: var(--red);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.85rem;
}

#settingsModal .btn-outline-danger {
  width: 100%;
  padding: 0.85rem;
  background: transparent;
  border: 1px solid var(--red);
  color: var(--red);
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-top: 1rem;
}

#settingsModal .btn-outline-danger:hover {
  background: var(--red);
  color: #fff;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
  transform: translateY(-1px);
}

/* 9. Footer Actions */
#settingsModal .modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

#settingsModal .btn-cancel {
  padding: 0.75rem 1.25rem;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-dim);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

#settingsModal .btn-cancel:hover {
  border-color: var(--text-dim);
  color: var(--text);
  background: var(--surface-hover);
}

/* 10. Scrollbar for Settings Content */
#settingsModal .modal-body::-webkit-scrollbar {
  width: 6px;
}
#settingsModal .modal-body::-webkit-scrollbar-track {
  background: transparent;
}
#settingsModal .modal-body::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}
#settingsModal .modal-body::-webkit-scrollbar-thumb:hover {
  background: var(--text-dim);
}

/* --- 12. DRILL-DOWN MODAL (UPDATED & POLISHED) --- */

.drilldown-box {
  max-width: 900px;
  width: 95%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 0;
}

.drilldown-layout {
  display: flex;
  flex-direction: row;
  height: 100%;
  min-height: 500px;
}

/* --- LEFT PANEL (Summary & Stats) --- */
.drilldown-left {
  flex: 1;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 2rem 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  overflow-y: auto;
}

.drilldown-cat-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
  line-height: 1;
  animation: folderFloat 3s ease-in-out infinite;
}

.drilldown-cat-name {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.5rem;
  cursor: pointer;
  word-break: break-word;
  transition: color 0.2s;
}

.drilldown-cat-name:hover {
  color: var(--accent);
}

.category-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.8rem;
  background: var(--surface-hover);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s;
  margin: 0.5rem 0 1.5rem 0;
}

.category-status-badge:hover {
  border-color: var(--accent);
  background: var(--bg);
  transform: translateY(-1px);
}

/* UPDATED STATS SECTION */
.drilldown-cat-stats {
  width: 100%;
  text-align: left;
  margin-top: auto;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* --- FIXED LAYOUT FOR STAT ROWS --- */
.drilldown-stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
  transition: all 0.2s ease;
  width: 100%; /* Ensure full width */
}

.drilldown-stat-row:last-child {
  border-bottom: none;
}

/* Label: Flexible, can shrink and truncate */
.drilldown-stat-label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-dim);
  letter-spacing: 0.02em;
  text-transform: capitalize;

  /* CRITICAL FIXES */
  flex: 1 1 0;       /* Grow to fill, shrink if needed, base 0 */
  min-width: 0;      /* REQUIRED for text-overflow to work */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-right: 1rem; /* Gap before value */
}

/* Value: Never shrinks, guaranteed space */
.drilldown-stat-value {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
  text-align: right;

  /* CRITICAL FIXES */
  flex: 0 0 auto;    /* Do not grow, do not shrink */
  min-width: 60px;   /* Guaranteed minimum width for numbers */
  white-space: nowrap;
}

.drilldown-stat-value.positive { color: var(--green); }
.drilldown-stat-value.negative { color: var(--red); }

/* --- INTERACTIVE BUDGET ROW (Aligned & Clean) --- */

.drilldown-stat-row#budgetRowDisplay {
  cursor: pointer;
  padding: 0.5rem 0;
  margin: 0;
  border-radius: 0;
  background: transparent;
  border: none;
  transition: background 0.2s ease;
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.drilldown-stat-row#budgetRowDisplay:hover {
  background: var(--surface-hover);
}

/* The Value Styling: Dashed underline to indicate editability */
.drilldown-stat-row#budgetRowDisplay .drilldown-stat-value {
  border-bottom: 1px dashed var(--accent);
  padding-bottom: 2px;
  color: var(--accent);
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: -0.02em;
  line-height: 1.4;
  /* Ensure it respects the min-width set above */
  min-width: 60px;
}

/* Optional: Add underline on hover for extra clarity */
.drilldown-stat-row#budgetRowDisplay:hover .drilldown-stat-value {
  text-decoration: none; /* Remove default underline, rely on border */
  border-bottom-style: solid;
}

/* Status Text Badge */
.drilldown-stat-row .status-badge {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  background: var(--surface-hover);
}

.status-safe .status-badge { color: var(--green); background: var(--green-bg); }
.status-warn .status-badge { color: var(--yellow); background: var(--yellow-bg); }
.status-danger .status-badge { color: var(--red); background: var(--red-bg); }
.status-critical .status-badge { color: var(--red); background: var(--red-bg); }

/* Budget Input Form (Inline) */
.budget-input-form {
  display: none;
  margin-top: 0.5rem;
  padding: 0.75rem;
  background: var(--surface-hover);
  border-radius: 8px;
  border: 1px solid var(--border);
  animation: fadeIn 0.2s ease;
}

.budget-input-form label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-dim);
  margin-bottom: 0.5rem;
  display: block;
}

.budget-input-form input {
  width: 100%;
  padding: 0.6rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 600;
  text-align: right;
  margin-bottom: 0.5rem;
}

.budget-input-form button {
  flex: 1;
  padding: 0.5rem;
  border: none;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.2s;
}

.budget-input-form button:first-child {
  background: var(--green);
  color: white;
  margin-right: 0.5rem;
}

.budget-input-form button:last-child {
  background: var(--border);
  color: var(--text);
}

/* --- RIGHT PANEL (Tabs & Content) --- */
.drilldown-right {
  flex: 1.5;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  overflow: hidden;
}

.drilldown-tabs {
  display: flex;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0.5rem 1rem;
  gap: 0.5rem;
  flex-shrink: 0;
}

.drilldown-tab {
  padding: 0.5rem 1rem;
  background: transparent;
  border: none;
  border-radius: 6px;
  color: var(--text-dim);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s;
}

.drilldown-tab:hover {
  color: var(--text);
  background: var(--surface-hover);
}

.drilldown-tab.active {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 2px 8px rgba(139, 92, 237, 0.3);
}

.drilldown-view {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
  display: none;
}

.drilldown-view.active {
  display: block;
}

.quick-add-form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1.5rem;
}

.quick-add-form .font-bold { font-size: 0.9rem; margin-bottom: 0.75rem; display: block; }
.quick-add-form .flex { gap: 0.5rem; flex-wrap: wrap; }

.drilldown-tx-list { display: flex; flex-direction: column; gap: 0.75rem; }
.drilldown-view.hidden { display: none; }
.text-center.py-xl { padding-top: 3rem; padding-bottom: 3rem; }
.icon-large.opacity-50 { font-size: 3rem; opacity: 0.5; margin-bottom: 1rem; }

#debtSettingsPanel, #savingsSettingsPanel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  margin-top: 1rem;
}

#debtSettingsPanel.hidden, #savingsSettingsPanel.hidden { display: none; }

/* =========================================
   MISSING STYLES: Subcategory & Reset
   ========================================= */

/* --- Subcategory Panel (Drilldown View) --- */
.subcategory-panel-inner {
  padding: 1rem 0;
  height: 100%;
}

.subcategory-header {
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.75rem;
}

.subcategory-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.25rem;
}

.subcategory-desc {
  font-size: 0.85rem;
  color: var(--text-dim);
  line-height: 1.4;
}

.subcategory-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 1rem;
  max-height: 40vh; /* Prevent overflow issues in modal */
  overflow-y: auto;
}

/* Styling for individual subcategory items (assumed structure based on context) */
.subcategory-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0.8rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.9rem;
}

.subcategory-add {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px dashed var(--border);
}

.subcategory-add-btn {
  width: 100%;
  padding: 0.6rem 1rem;
  background: transparent;
  border: 1px dashed var(--border);
  border-radius: 8px;
  color: var(--text-dim);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.subcategory-add-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--surface-hover);
}

/* --- Factory Reset Input (Settings Modal) --- */
.input-reset-confirm {
  width: 100%;
  padding: 0.75rem;
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 1rem;
  font-weight: 700;
  text-align: center;
  outline: none;
  transition: all 0.2s ease;
  letter-spacing: 0.05em;
}

.input-reset-confirm:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
}

.input-reset-confirm:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Error state for reset input */
.text-red {
  color: var(--red);
}
