* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  font-family: Georgia, 'Times New Roman', serif;
  background: #F3F0E8;
  color: #2A2820;
}
.num { font-variant-numeric: tabular-nums; font-family: 'Courier New', monospace; }
button { font-family: inherit; }
input, select, textarea { font-family: Arial, sans-serif; }

/* Login */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-card { background: #fff; border: 1px solid #E4DFD1; border-radius: 14px; padding: 32px; width: 100%; max-width: 360px; text-align: center; }
.brand-mark { width: 52px; height: 52px; border-radius: 12px; background: #C9A227; color: #16233E; display: flex; align-items: center; justify-content: center; font-size: 28px; font-weight: 700; margin: 0 auto 14px; }
.login-card h1 { font-size: 20px; margin: 0 0 4px; }
.login-sub { color: #8A8578; font-size: 13px; margin-bottom: 20px; font-family: Arial, sans-serif; }
.login-card label { display: block; text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.4px; color: #8A8578; margin: 12px 0 4px; font-family: Arial, sans-serif; font-weight: 700; }
.login-card input { width: 100%; padding: 10px; border: 1px solid #D8D2C0; border-radius: 8px; font-size: 14px; }
.form-error { background: #FCE4E4; color: #8A362F; padding: 10px; border-radius: 8px; font-size: 13px; margin-bottom: 6px; font-family: Arial, sans-serif; }

/* Header / nav */
.header { background: #16233E; border-bottom: 3px solid #C9A227; }
.header-inner { max-width: 1180px; margin: 0 auto; padding: 14px 20px; display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark-sm { width: 36px; height: 36px; border-radius: 8px; background: #C9A227; color: #16233E; display: flex; align-items: center; justify-content: center; font-size: 18px; font-weight: 700; }
.brand-title { color: #F3F0E8; font-size: 16px; font-weight: 700; }
.brand-sub { color: #9DA8C4; font-size: 12px; font-family: Arial, sans-serif; }
.nav { display: flex; gap: 4px; background: #1C2C4D; padding: 4px; border-radius: 10px; flex-wrap: wrap; }
.nav-btn { padding: 8px 14px; border-radius: 7px; border: none; background: transparent; color: #9DA8C4; font-size: 13px; font-weight: 600; cursor: pointer; font-family: Arial, sans-serif; }
.nav-btn.active { background: #C9A227; color: #16233E; }
.btn-ghost { background: transparent; border: 1px solid #3A4A70; color: #C9D0E0; padding: 8px 14px; border-radius: 8px; font-size: 13px; cursor: pointer; font-family: Arial, sans-serif; }

.main { max-width: 1180px; margin: 0 auto; padding: 24px 20px 60px; }

/* Filter bar */
.filter-bar { display: flex; gap: 10px; align-items: center; margin-bottom: 18px; flex-wrap: wrap; }
.select-wrap { display: flex; align-items: center; gap: 6px; background: #FFF; border: 1px solid #D8D2C0; border-radius: 8px; padding: 6px 10px; }
.select-wrap select { border: none; background: transparent; font-size: 13px; outline: none; }
.search-wrap { display: flex; align-items: center; gap: 6px; background: #FFF; border: 1px solid #D8D2C0; border-radius: 8px; padding: 6px 10px; min-width: 220px; flex: 1; max-width: 340px; }
.search-wrap input { border: none; outline: none; font-size: 13px; width: 100%; background: transparent; }
.spacer { flex: 1; }
.btn-primary { background: #16233E; color: #F3F0E8; border: none; border-radius: 8px; padding: 9px 16px; font-size: 13px; font-weight: 700; cursor: pointer; font-family: Arial, sans-serif; }
.btn-secondary { background: #fff; color: #4A4638; border: 1px solid #D8D2C0; border-radius: 8px; padding: 9px 16px; font-size: 13px; font-weight: 700; cursor: pointer; font-family: Arial, sans-serif; }
.btn-danger { background: #A8443C; color: #fff; border: none; border-radius: 8px; padding: 9px 16px; font-size: 13px; font-weight: 700; cursor: pointer; font-family: Arial, sans-serif; }

/* KPI cards */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 20px; }
.kpi-card { background: #fff; border: 1px solid #E4DFD1; border-radius: 12px; padding: 16px 18px; }
.kpi-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.kpi-label { font-size: 11.5px; color: #8A8578; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; font-family: Arial, sans-serif; }
.kpi-value { font-size: 25px; font-weight: 700; }
.good { color: #3E6B5C; } .bad { color: #A8443C; } .gold { color: #8B6A12; }

/* Panels */
.panel-row { display: flex; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.panel { background: #fff; border: 1px solid #E4DFD1; border-radius: 12px; padding: 18px 20px; flex: 1; min-width: 280px; }
.panel-title { font-size: 15px; font-weight: 700; margin-bottom: 2px; }
.panel-sub { font-size: 12px; color: #8A8578; margin-bottom: 12px; font-family: Arial, sans-serif; }
.empty-state { padding: 40px 0; text-align: center; color: #8A8578; font-size: 13px; font-family: Arial, sans-serif; }

.legend-list { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.legend-item { display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-family: Arial, sans-serif; }
.legend-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.legend-name { flex: 1; color: #4A4638; }
.legend-value { font-weight: 600; }

/* Table */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; font-family: Arial, sans-serif; }
th { text-align: left; padding: 8px 10px; border-bottom: 2px solid #E4DFD1; color: #8A8578; font-size: 11px; text-transform: uppercase; letter-spacing: 0.4px; white-space: nowrap; }
td { padding: 9px 10px; border-bottom: 1px solid #EFEBE0; max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge { font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 20px; }
.badge-ingreso { background: #3E6B5C1A; color: #2E5346; }
.badge-gasto { background: #A8443C1A; color: #8A362F; }
.badge-transferencia { background: #B5AA8C33; color: #6B6244; }
.icon-btn { border: none; background: transparent; cursor: pointer; color: #8A8578; padding: 6px; border-radius: 6px; font-size: 12px; }
.icon-btn:hover { background: #F3F0E8; }

/* Cards grid (income/investments) */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.item-card { background: #fff; border: 1px solid #E4DFD1; border-radius: 12px; padding: 16px; }
.item-card-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 8px; }
.item-title { font-weight: 700; font-size: 14.5px; }
.item-sub { font-size: 12px; color: #8A8578; font-family: Arial, sans-serif; }
.item-row { display: flex; justify-content: space-between; font-size: 13px; margin-top: 6px; font-family: Arial, sans-serif; }
.item-actions { display: flex; gap: 4px; margin-top: 10px; }
.tag { display: inline-block; font-size: 10.5px; font-weight: 700; padding: 2px 8px; border-radius: 12px; background: #EAE5D6; color: #6B6244; font-family: Arial, sans-serif; }

/* Modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(22,35,62,0.45); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 50; }
.modal { background: #fff; border-radius: 14px; padding: 24px; width: 100%; max-width: 480px; max-height: 90vh; overflow-y: auto; }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.modal-title { font-size: 18px; font-weight: 700; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field-full { grid-column: 1 / -1; }
.field label { font-size: 11.5px; color: #8A8578; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px; font-family: Arial, sans-serif; }
.field input, .field select, .field textarea { border: 1px solid #D8D2C0; border-radius: 8px; padding: 9px 10px; font-size: 14px; background: #FBFAF6; }
.tipo-group { display: flex; gap: 6px; }
.tipo-btn { flex: 1; padding: 8px 6px; border-radius: 8px; border: 1px solid #D8D2C0; background: #FBFAF6; color: #6B6656; font-size: 12.5px; font-weight: 700; cursor: pointer; font-family: Arial, sans-serif; }
.tipo-btn.active { background: #16233E; color: #F3F0E8; border-color: #16233E; }
.modal-footer { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

/* Report */
.report-content { font-family: Georgia, serif; font-size: 15px; line-height: 1.65; }
.report-content h2 { font-size: 17px; color: #16233E; border-bottom: 2px solid #C9A227; padding-bottom: 4px; margin-top: 24px; }
.report-content ul { padding-left: 20px; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); padding: 10px 18px; border-radius: 8px; font-size: 13px; font-family: Arial, sans-serif; box-shadow: 0 4px 16px rgba(0,0,0,0.2); z-index: 100; }
.toast-error { background: #A8443C; color: #fff; }
.toast-ok { background: #3E6B5C; color: #fff; }

.loading-wrap { min-height: 60vh; display: flex; align-items: center; justify-content: center; color: #8A8578; font-family: Arial, sans-serif; }

@media (max-width: 720px) {
  .hide-mobile { display: none !important; }
  .form-grid { grid-template-columns: 1fr; }
}