/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0d0f1a;
  --bg2: #13162a;
  --bg3: #1a1f38;
  --card: #1e2340;
  --card2: #252b4a;
  --border: rgba(255,255,255,0.07);
  --text: #e8eaf6;
  --text2: #8b92b8;
  --text3: #555e8a;
  --accent: #7c6af7;
  --accent2: #9b8bff;
  --green: #22d3a0;
  --green2: #1ab88a;
  --red: #f4637a;
  --red2: #e04a64;
  --yellow: #f9c846;
  --blue: #4a9eff;
  --sidebar-w: 240px;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 4px 24px rgba(0,0,0,0.35);
  --transition: 0.22s ease;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
}

/* ===== SIDEBAR ===== */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform var(--transition);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 28px 24px 20px;
  border-bottom: 1px solid var(--border);
}

.logo-icon {
  width: 40px; height: 40px;
  background: linear-gradient(135deg, var(--accent), #a78bfa);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  box-shadow: 0 4px 16px rgba(124,106,247,0.4);
}

.logo-text {
  font-size: 18px; font-weight: 700;
  background: linear-gradient(135deg, var(--accent2), #c4b5fd);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}

.sidebar-nav { display: flex; flex-direction: column; gap: 4px; padding: 20px 12px; flex: 1; }

.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border-radius: var(--radius-sm);
  background: none; border: none; color: var(--text2);
  font-family: 'Inter', sans-serif; font-size: 14px; font-weight: 500;
  cursor: pointer; text-align: left; width: 100%;
  transition: all var(--transition);
}
.nav-item:hover { background: var(--bg3); color: var(--text); }
.nav-item.active { background: linear-gradient(135deg, rgba(124,106,247,0.2), rgba(167,139,250,0.1)); color: var(--accent2); }
.nav-item .nav-icon { font-size: 18px; min-width: 22px; }

.sidebar-footer { padding: 16px 12px; border-top: 1px solid var(--border); }
.sidebar-user { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--bg3); }
.user-avatar { font-size: 22px; }
.user-info { display: flex; flex-direction: column; }
.user-name { font-size: 13px; font-weight: 600; }
.user-sub { font-size: 11px; color: var(--text3); }

/* ===== MAIN ===== */
.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex; flex-direction: column;
  min-height: 100vh;
  background: var(--bg);
}

/* ===== TOPBAR ===== */
.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 18px 32px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 50;
}

.menu-toggle {
  display: none;
  background: none; border: none; color: var(--text2);
  font-size: 20px; cursor: pointer;
  padding: 4px 8px; border-radius: 8px;
  transition: background var(--transition);
}
.menu-toggle:hover { background: var(--bg3); }

.topbar-title { font-size: 16px; font-weight: 600; flex: 1; }

/* ===== BUTTONS ===== */
.btn-primary {
  background: linear-gradient(135deg, var(--accent), #9b8bff);
  color: #fff; border: none;
  padding: 10px 20px; border-radius: 10px;
  font-family: 'Inter', sans-serif; font-size: 14px; font-weight: 600;
  cursor: pointer; transition: all var(--transition);
  box-shadow: 0 4px 14px rgba(124,106,247,0.35);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(124,106,247,0.5); }
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  background: var(--card2); color: var(--text2); border: 1px solid var(--border);
  padding: 10px 20px; border-radius: 10px;
  font-family: 'Inter', sans-serif; font-size: 14px; font-weight: 500;
  cursor: pointer; transition: all var(--transition);
}
.btn-secondary:hover { background: var(--bg3); color: var(--text); }

.btn-outline {
  background: transparent; color: var(--accent2);
  border: 1px solid rgba(124,106,247,0.4);
  padding: 10px 18px; border-radius: 10px;
  font-family: 'Inter', sans-serif; font-size: 14px; font-weight: 600;
  cursor: pointer; transition: all var(--transition);
}
.btn-outline:hover { background: rgba(124,106,247,0.1); border-color: var(--accent); }

.link-btn {
  background: none; border: none; color: var(--accent2);
  font-size: 13px; font-weight: 500; cursor: pointer;
  transition: color var(--transition);
}
.link-btn:hover { color: var(--accent); }

/* ===== VIEWS ===== */
.view { display: none; padding: 32px; flex-direction: column; gap: 24px; }
.view.active { display: flex; }

.section-header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.section-title { font-size: 26px; font-weight: 800; }
.section-sub { font-size: 14px; color: var(--text2); }

/* ===== STAT CARDS ===== */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }

.stat-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 22px 20px;
  display: flex; align-items: flex-start; gap: 16px;
  transition: transform var(--transition), box-shadow var(--transition);
  position: relative; overflow: hidden;
}
.stat-card::before {
  content: ''; position: absolute;
  width: 120px; height: 120px; border-radius: 50%;
  top: -30px; right: -30px; opacity: 0.08;
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }

.balance-card::before { background: var(--yellow); }
.income-card::before { background: var(--green); }
.expense-card::before { background: var(--red); }
.credits-card::before { background: var(--accent); }

.balance-card .stat-icon { background: rgba(249,200,70,0.15); }
.income-card .stat-icon { background: rgba(34,211,160,0.15); }
.expense-card .stat-icon { background: rgba(244,99,122,0.15); }
.credits-card .stat-icon { background: rgba(124,106,247,0.15); }

.stat-icon {
  width: 48px; height: 48px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; flex-shrink: 0;
}
.stat-label { font-size: 12px; color: var(--text3); font-weight: 500; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 6px; }
.stat-value { font-size: 24px; font-weight: 800; margin-bottom: 4px; }
.balance-card .stat-value { color: var(--yellow); }
.income-card .stat-value { color: var(--green); }
.expense-card .stat-value { color: var(--red); }
.credits-card .stat-value { color: var(--accent2); }
.stat-change { font-size: 12px; color: var(--text3); }

/* ===== DASHBOARD BODY ===== */
.dashboard-body { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

.chart-card, .recent-card, .full-card, .report-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px;
}

.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px;
}
.card-header h3 { font-size: 15px; font-weight: 700; }

.badge {
  background: rgba(124,106,247,0.15); color: var(--accent2);
  font-size: 11px; font-weight: 600; padding: 4px 10px; border-radius: 20px;
}

.chart-wrapper { display: flex; gap: 30px; align-items: center; min-height: 200px; }
.chart-wrapper canvas { max-width: 180px; max-height: 180px; }
.chart-legend { 
  display: flex; 
  flex-direction: column;
  gap: 8px; 
  flex: 1; 
  max-height: 400px;
  overflow-y: auto;
  padding-right: 8px;
}
.legend-item { display: flex; align-items: center; gap: 8px; font-size: 13px; padding: 6px 10px; border-bottom: 1px solid rgba(255,255,255,0.03); border-radius: 6px; transition: background 0.2s; margin-bottom: 2px; }
.legend-item:hover { background: var(--bg3); }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.legend-label { color: var(--text); flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; font-size: 13px; }
.legend-pct { font-weight: 500; font-size: 13px; color: var(--text3); }

.bar-chart-wrapper { height: 200px; }
.bar-chart-wrapper canvas { width: 100% !important; height: 200px !important; }

/* ===== RECENT LIST ===== */
.recent-list { display: flex; flex-direction: column; gap: 10px; }
.recent-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px; border-radius: var(--radius-sm);
  background: var(--bg3); transition: background var(--transition);
}
.recent-item:hover { background: var(--card2); }
.recent-cat-icon {
  width: 38px; height: 38px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center; font-size: 18px;
}
.recent-info { flex: 1; min-width: 0; }
.recent-desc { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.recent-date { font-size: 11px; color: var(--text3); }
.recent-amount { font-size: 14px; font-weight: 700; }
.amount-income { color: var(--green); }
.amount-expense { color: var(--red); }

/* ===== EMPTY STATE ===== */
.empty-state {
  text-align: center; padding: 48px 20px;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  color: var(--text3);
}
.empty-state span { font-size: 48px; }
.empty-state p { font-size: 14px; }

/* ===== FILTER BAR ===== */
.filter-bar {
  display: flex; gap: 12px; flex-wrap: wrap;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 20px;
}
.filter-group { flex: 1; min-width: 160px; }
.filter-input, .filter-select {
  width: 100%; padding: 10px 14px;
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text);
  font-family: 'Inter', sans-serif; font-size: 13px;
  outline: none; transition: border-color var(--transition);
}
.filter-input:focus, .filter-select:focus { border-color: var(--accent); }
.filter-select option { background: var(--bg3); }

/* ===== TRANSACTIONS TABLE ===== */
.transactions-table-wrap {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
}
.transactions-table { width: 100%; border-collapse: collapse; }
.transactions-table thead { background: var(--bg3); }
.transactions-table th {
  padding: 14px 18px; text-align: left;
  font-size: 11px; font-weight: 700; color: var(--text3);
  text-transform: uppercase; letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
}
.transactions-table td {
  padding: 14px 18px; font-size: 13px;
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}
.transactions-table tbody tr:hover td { background: var(--bg3); }
.transactions-table tbody tr:last-child td { border-bottom: none; }

.tx-category-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 20px;
  font-size: 12px; font-weight: 500;
}
.type-badge {
  display: inline-block; padding: 4px 10px; border-radius: 20px;
  font-size: 11px; font-weight: 700; text-transform: uppercase;
}
.type-gasto { background: rgba(244,99,122,0.15); color: var(--red); }
.type-ingreso { background: rgba(34,211,160,0.15); color: var(--green); }

/* SUMMARY CARDS */
.tx-summary-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 24px; }
.tx-summary-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 20px; }
.tx-summary-label { font-size: 12px; color: var(--text3); text-transform: uppercase; font-weight: 700; margin-bottom: 6px; }
.tx-summary-val { font-size: 22px; font-weight: 800; margin-bottom: 4px; }
.tx-summary-avg { font-size: 12px; color: var(--text2); }
.income-val { color: var(--green); }
.expense-val { color: var(--red); }
.net-val { color: var(--accent2); }

.tx-actions { display: flex; gap: 8px; }
.btn-icon {
  background: var(--bg3); border: 1px solid var(--border);
  color: var(--text2); width: 32px; height: 32px;
  border-radius: 8px; cursor: pointer; font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
}
.btn-icon:hover { background: var(--card2); color: var(--text); }
.btn-icon.delete:hover { background: rgba(244,99,122,0.15); color: var(--red); border-color: rgba(244,99,122,0.3); }

/* ===== BUDGET ===== */
.budget-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.budget-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 22px;
  transition: transform var(--transition);
}
.budget-card:hover { transform: translateY(-2px); }
.budget-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.budget-cat { display: flex; align-items: center; gap: 10px; }
.budget-cat-icon { font-size: 24px; }
.budget-cat-name { font-size: 14px; font-weight: 700; }
.budget-amounts { text-align: right; }
.budget-spent { font-size: 18px; font-weight: 800; }
.budget-limit { font-size: 12px; color: var(--text3); }
.progress-bar { height: 8px; background: var(--bg3); border-radius: 100px; overflow: hidden; margin-bottom: 10px; }
.progress-fill { height: 100%; border-radius: 100px; transition: width 0.6s ease; }
.progress-ok { background: linear-gradient(90deg, var(--green2), var(--green)); }
.progress-warn { background: linear-gradient(90deg, #f0a500, var(--yellow)); }
.progress-over { background: linear-gradient(90deg, var(--red2), var(--red)); }
.budget-remaining { font-size: 12px; color: var(--text3); }
.budget-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }

/* ===== REPORTS ===== */
.reports-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

.top-categories { display: flex; flex-direction: column; gap: 14px; }
.top-cat-item { display: flex; align-items: center; gap: 12px; }
.top-cat-rank { font-size: 14px; font-weight: 800; color: var(--text3); min-width: 20px; }
.top-cat-icon { font-size: 22px; }
.top-cat-info { flex: 1; }
.top-cat-name { font-size: 13px; font-weight: 600; }
.top-cat-bar-wrap { height: 6px; background: var(--bg3); border-radius: 100px; margin-top: 5px; }
.top-cat-bar { height: 100%; border-radius: 100px; background: linear-gradient(90deg, var(--accent), var(--accent2)); }
.top-cat-amount { font-size: 13px; font-weight: 700; color: var(--red); }

.monthly-summary { display: flex; flex-direction: column; gap: 10px; max-height: 260px; overflow-y: auto; }
.monthly-summary::-webkit-scrollbar { width: 4px; }
.monthly-summary::-webkit-scrollbar-track { background: transparent; }
.monthly-summary::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }

.month-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; background: var(--bg3); border-radius: var(--radius-sm);
  font-size: 13px;
}
.month-name { font-weight: 600; }
.month-vals { display: flex; gap: 16px; }
.month-income { color: var(--green); font-weight: 600; }
.month-expense { color: var(--red); font-weight: 600; }

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,0.6); backdrop-filter: blur(6px);
  display: none; align-items: center; justify-content: center;
  padding: 20px;
}
.modal-overlay.open { display: flex; animation: fadeIn 0.2s ease; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 20px; width: 100%; max-width: 480px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  animation: slideUp 0.25s ease;
}
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 24px 28px 0;
}
.modal-header h2 { font-size: 18px; font-weight: 800; }
.modal-close {
  background: var(--bg3); border: 1px solid var(--border);
  color: var(--text2); width: 32px; height: 32px; border-radius: 8px;
  cursor: pointer; font-size: 14px; transition: all var(--transition);
}
.modal-close:hover { background: var(--card2); color: var(--red); }

.modal-form { padding: 24px 28px 28px; display: flex; flex-direction: column; gap: 18px; }

.form-row { display: flex; gap: 16px; }
.two-col > .form-group { flex: 1; }

.form-group { display: flex; flex-direction: column; gap: 8px; }
.form-group label { font-size: 12px; font-weight: 700; color: var(--text2); text-transform: uppercase; letter-spacing: 0.5px; }

.form-group input, .form-group select, .form-group textarea {
  padding: 12px 14px;
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text);
  font-family: 'Inter', sans-serif; font-size: 14px;
  outline: none; transition: border-color var(--transition);
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { border-color: var(--accent); }
.form-group textarea { resize: vertical; min-height: 80px; }
.form-group select option { background: var(--bg3); }

.input-with-prefix { display: flex; align-items: center; }
.prefix {
  padding: 12px 12px;
  background: var(--bg3); border: 1px solid var(--border); border-right: none;
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  color: var(--text3); font-size: 14px; font-weight: 700;
}
.input-with-prefix input { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; flex: 1; }

.toggle-group { display: flex; gap: 8px; }
.toggle-btn {
  flex: 1; padding: 10px; border-radius: var(--radius-sm);
  background: var(--bg3); border: 1px solid var(--border);
  color: var(--text2); font-family: 'Inter', sans-serif; font-size: 13px;
  font-weight: 600; cursor: pointer; transition: all var(--transition);
}
.toggle-btn.active {
  background: linear-gradient(135deg, rgba(124,106,247,0.2), rgba(167,139,250,0.1));
  border-color: var(--accent); color: var(--accent2);
}
.toggle-btn[data-value="ingreso"].active {
  background: rgba(34,211,160,0.12);
  border-color: var(--green); color: var(--green);
}

.modal-actions { display: flex; gap: 12px; justify-content: flex-end; margin-top: 4px; }

/* ===== TOAST ===== */
.toast {
  position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%) translateY(100px);
  background: var(--card2); border: 1px solid var(--border);
  color: var(--text); padding: 12px 24px; border-radius: 100px;
  font-size: 14px; font-weight: 500; z-index: 500;
  transition: transform 0.3s ease, opacity 0.3s ease;
  opacity: 0; pointer-events: none; white-space: nowrap;
  box-shadow: var(--shadow);
}
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
.toast.success { border-color: rgba(34,211,160,0.4); color: var(--green); }
.toast.error { border-color: rgba(244,99,122,0.4); color: var(--red); }

/* ===== RESPONSIVE ===== */
/* ======= CREDITOS VIEW ======= */
.credits-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; margin-top: 20px; }
.credit-item { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; transition: transform 0.2s; }
.credit-item:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.credit-item-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 20px; }
.credit-title-group { flex: 1; }
.credit-name { font-size: 20px; font-weight: 700; margin-bottom: 4px; color: var(--text); }
.credit-type { font-size: 12px; color: var(--text3); text-transform: uppercase; letter-spacing: 0.5px; font-weight: 600; display: inline-block; background: var(--bg3); padding: 4px 8px; border-radius: 4px; }
.credit-debt-box { text-align: right; }
.credit-debt { font-size: 24px; font-weight: 800; color: var(--red); }
.credit-debt-label { font-size: 12px; color: var(--text3); }
.credit-details { background: var(--bg); border: 1px solid rgba(255,255,255,0.02); border-radius: 8px; padding: 16px; margin-bottom: 16px; }
.credit-detail-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; font-size: 14px; color: var(--text2); }
.credit-detail-row:last-child { margin-bottom: 0; padding-top: 12px; border-top: 1px solid rgba(255,255,255,0.05); }
.credit-detail-row strong { color: var(--text); font-weight: 600; }
.credit-highlight { color: var(--accent2); font-weight: 800; font-size: 16px; }
.credit-progress-bar { height: 8px; background: var(--bg3); border-radius: 4px; overflow: hidden; margin-top: 16px; }
.credit-progress-fill { height: 100%; background: var(--accent); border-radius: 4px; width: 0%; transition: width 1s ease; }

@media (max-width: 1100px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-body { grid-template-columns: 1fr; }
  .reports-grid { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  :root { --sidebar-w: 240px; }
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); box-shadow: 4px 0 30px rgba(0,0,0,0.4); }
  .main { margin-left: 0; }
  .menu-toggle { display: flex; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .tx-summary-cards { grid-template-columns: 1fr; gap: 12px; }
  .credits-grid { grid-template-columns: 1fr; }
  .view { padding: 20px 16px; }
  .topbar { padding: 14px 16px; }
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .modal { max-width: 100%; }
  .form-row.two-col { flex-direction: column; }
}

/* ===== PDF IMPORTER ===== */
.modal-wide { max-width: 780px !important; }

.pdf-modal-body { padding: 24px 28px; }

/* Drop zone */
.drop-zone {
  border: 2px dashed rgba(124,106,247,0.4);
  border-radius: var(--radius);
  background: rgba(124,106,247,0.04);
  padding: 48px 24px;
  text-align: center;
  transition: all var(--transition);
  cursor: pointer;
}
.drop-zone:hover, .drop-zone.drag-over {
  border-color: var(--accent);
  background: rgba(124,106,247,0.1);
}
.drop-zone-inner { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.drop-icon { font-size: 52px; margin-bottom: 4px; }
.drop-title { font-size: 18px; font-weight: 700; }
.drop-sub { font-size: 13px; color: var(--text3); margin-bottom: 8px; }

.pdf-tips {
  display: flex; align-items: center; gap: 10px;
  margin-top: 16px; padding: 12px 16px;
  background: rgba(249,200,70,0.07); border: 1px solid rgba(249,200,70,0.2);
  border-radius: var(--radius-sm); font-size: 13px; color: var(--text2);
}
.pdf-tips span { font-size: 18px; flex-shrink: 0; }

/* Processing */
.pdf-processing {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 16px; padding: 64px 0;
}
.pdf-spinner {
  width: 48px; height: 48px;
  border: 3px solid rgba(124,106,247,0.2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.pdf-proc-title { font-size: 16px; font-weight: 700; }
.pdf-proc-sub { font-size: 13px; color: var(--text3); }

/* Review */
.pdf-review-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px; flex-wrap: wrap; gap: 10px;
}
.pdf-filename { font-weight: 700; font-size: 14px; }
.pdf-pages {
  font-size: 12px; color: var(--text3);
  margin-left: 8px; padding: 2px 8px;
  background: var(--bg3); border-radius: 20px;
}
.pdf-found-badge {
  font-size: 13px; font-weight: 600; color: var(--green);
  background: rgba(34,211,160,0.1); border: 1px solid rgba(34,211,160,0.2);
  padding: 4px 12px; border-radius: 20px;
}
.pdf-review-info {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--text3);
  margin-bottom: 14px;
}

.pdf-table-wrap {
  overflow-x: auto; border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  max-height: 340px; overflow-y: auto;
}
.pdf-table-wrap::-webkit-scrollbar { width: 4px; height: 4px; }
.pdf-table-wrap::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }

.pdf-review-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.pdf-review-table thead { background: var(--bg3); position: sticky; top: 0; z-index: 2; }
.pdf-review-table th {
  padding: 10px 12px; text-align: left;
  font-size: 11px; font-weight: 700; color: var(--text3);
  text-transform: uppercase; letter-spacing: 0.4px;
  border-bottom: 1px solid var(--border);
}
.pdf-review-table td {
  padding: 8px 10px; border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.pdf-review-table tbody tr:last-child td { border-bottom: none; }
.pdf-review-table tbody tr:hover td { background: var(--bg3); }
.row-deselected { opacity: 0.4; }

.pdf-edit-input {
  background: var(--bg3); border: 1px solid transparent;
  border-radius: 7px; color: var(--text);
  font-family: 'Inter', sans-serif; font-size: 12px;
  padding: 6px 8px; outline: none; width: 100%;
  transition: border-color var(--transition);
}
.pdf-edit-input:focus { border-color: var(--accent); }
.pdf-edit-input.date-input { min-width: 130px; }
.pdf-edit-input.amount-input { min-width: 90px; }

.pdf-amount-wrap { display: flex; align-items: center; }
.pdf-amount-wrap .prefix {
  padding: 6px 7px; font-size: 12px;
  border-radius: 7px 0 0 7px;
}
.pdf-amount-wrap .amount-input { border-radius: 0 7px 7px 0; }

/* Raw text */
.pdf-raw-toggle { margin-top: 12px; }
.pdf-raw-text {
  margin-top: 8px; padding: 14px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius-sm); font-size: 11px;
  color: var(--text3); max-height: 160px; overflow-y: auto;
  white-space: pre-wrap; word-break: break-all;
  font-family: 'Courier New', monospace;
}

/* Modal footer */
.modal-footer {
  display: flex; align-items: center; gap: 16px;
  padding: 16px 28px 24px;
  border-top: 1px solid var(--border);
}
.pdf-footer-info { flex: 1; text-align: center; font-size: 13px; color: var(--text2); font-weight: 500; }

/* ======= CONTEXT MENU ======= */
.context-menu {
  position: absolute;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.5);
  padding: 4px;
  z-index: 9999;
  min-width: 180px;
}
.context-menu-item {
  padding: 10px 16px;
  cursor: pointer;
  border-radius: 4px;
  color: var(--text1);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background 0.2s;
}
.context-menu-item:hover {
  background: var(--surface3);
}
.context-menu-item.delete-item:hover {
  background: rgba(244, 99, 122, 0.1);
  color: var(--red);
}

/* ===== PLANIFICADOR DE ARRIENDO ===== */
.arriendo-grid {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 24px;
  align-items: start;
}

@media (max-width: 900px) {
  .arriendo-grid {
    grid-template-columns: 1fr;
  }
}

.arriendo-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 20px;
}

.arriendo-card:last-child {
  margin-bottom: 0;
}

.card-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  padding-bottom: 10px;
  margin-bottom: 4px;
}

.form-group-arriendo {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group-arriendo label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text2);
  text-transform: uppercase;
}

.input-help {
  font-size: 11px;
  color: var(--text3);
  margin-top: 2px;
  display: block;
}

.arriendo-divider {
  border: none;
  border-top: 1px dashed var(--border);
  margin: 10px 0;
}

.form-section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent2);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.arriendo-results-panel {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ASEQUIBILIDAD CARD (TERMÓMETRO DE RIESGO) */
.asequibilidad-card {
  border-radius: var(--radius);
  padding: 24px;
  border: 1px solid var(--border);
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}

/* Clases de estado dinámico */
.aseq-safe {
  background: linear-gradient(135deg, rgba(34,211,160,0.1), rgba(34,211,160,0.02));
  border-color: rgba(34,211,160,0.4);
}
.aseq-warn {
  background: linear-gradient(135deg, rgba(249,200,70,0.1), rgba(249,200,70,0.02));
  border-color: rgba(249,200,70,0.4);
}
.aseq-danger {
  background: linear-gradient(135deg, rgba(244,99,122,0.1), rgba(244,99,122,0.02));
  border-color: rgba(244,99,122,0.4);
}

.aseq-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.aseq-badge {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 20px;
  letter-spacing: 0.5px;
}

.aseq-safe .aseq-badge { background: rgba(34,211,160,0.18); color: var(--green); }
.aseq-warn .aseq-badge { background: rgba(249,200,70,0.18); color: var(--yellow); }
.aseq-danger .aseq-badge { background: rgba(244,99,122,0.18); color: var(--red); }

.aseq-percent {
  font-size: 24px;
  font-weight: 800;
}
.aseq-safe .aseq-percent { color: var(--green); }
.aseq-warn .aseq-percent { color: var(--yellow); }
.aseq-danger .aseq-percent { color: var(--red); }

.aseq-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 6px;
}

.aseq-desc {
  font-size: 13px;
  color: var(--text2);
  line-height: 1.5;
  margin-bottom: 14px;
}

.aseq-progress-bar {
  height: 8px;
  background: var(--bg3);
  border-radius: 100px;
  overflow: hidden;
  margin-bottom: 10px;
}

.aseq-progress-fill {
  height: 100%;
  border-radius: 100px;
  transition: width 0.4s ease, background 0.4s ease;
}
.aseq-safe .aseq-progress-fill { background: var(--green); }
.aseq-warn .aseq-progress-fill { background: var(--yellow); }
.aseq-danger .aseq-progress-fill { background: var(--red); }

/* RESUMEN LISTA */
.resumen-lista {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.resumen-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: var(--text2);
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255,255,255,0.02);
}

.resumen-row:last-child {
  border-bottom: none;
}

.resumen-val {
  font-weight: 700;
  font-size: 14px;
}

.color-green { color: var(--green); }
.color-red { color: var(--red); }
.color-accent { color: var(--accent2); }

.total-row {
  padding-top: 10px;
  border-top: 1px solid var(--border);
  color: var(--text);
}
.total-row .resumen-val {
  font-size: 18px;
}

/* ENTRADA CHECKLIST (COSTOS DE MUDANZA) */
.entrada-checklist {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.checklist-item {
  display: flex;
  align-items: center;
  background: var(--bg3);
  border: 1px solid var(--border);
  padding: 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  position: relative;
  transition: border-color 0.2s, background 0.2s;
}

.checklist-item:hover {
  background: var(--card2);
  border-color: rgba(124,106,247,0.3);
}

.checklist-item input {
  position: absolute;
  opacity: 0;
  cursor: pointer;
  height: 0; width: 0;
}

.checkmark {
  height: 18px;
  width: 18px;
  background-color: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  margin-right: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}

.checklist-item input:checked ~ .checkmark {
  background-color: var(--accent);
  border-color: var(--accent);
}

.checkmark::after {
  content: "✓";
  color: white;
  font-size: 11px;
  font-weight: bold;
  display: none;
}

.checklist-item input:checked ~ .checkmark::after {
  display: block;
}

.chk-label {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.chk-label span {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.chk-label small {
  font-size: 11px;
  color: var(--text3);
}

.chk-val {
  font-weight: 700;
  font-size: 13px;
  color: var(--text2);
}

.checklist-item input:checked ~ .chk-val {
  color: var(--text);
}

.entrada-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(124,106,247,0.08);
  border: 1px solid rgba(124,106,247,0.25);
  padding: 16px;
  border-radius: var(--radius-sm);
  margin-top: 4px;
  font-weight: 700;
  font-size: 14px;
}

.entrada-total span:last-child {
  font-size: 20px;
  color: var(--accent2);
}

/* REGLA 50/30/20 */
.rule-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.rule-labels {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.rule-desc {
  font-size: 11px;
  color: var(--text3);
}

.rule-desc strong {
  color: var(--text2);
}