* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: system-ui, sans-serif; background: #f5f5f5; color: #222; }
nav { background: #1a1a2e; padding: 12px 24px; display: flex; gap: 20px; flex-wrap: wrap; }
nav a { color: #e0e0e0; text-decoration: none; font-size: 14px; padding: 4px 10px; border-radius: 4px; }
nav a:hover { background: #16213e; color: #fff; }
nav a.nav-reporte { background: #e8b84b; color: #1a1a2e; font-weight: 700; }
nav a.nav-reporte:hover { background: #d4a43a; color: #1a1a2e; }
.nav-spacer { flex: 1; }
.nav-user { color: #aaa; font-size: 13px; padding: 4px 6px; }
.nav-logout { color: #e0e0e0; font-size: 13px; padding: 4px 10px; border-radius: 4px; border: 1px solid #444; }

/* Admin dropdown */
.nav-dropdown { position: relative; }
.nav-dropdown-trigger { color: #e0e0e0; font-size: 14px; padding: 4px 10px; border-radius: 4px; cursor: default; user-select: none; }
.nav-dropdown-menu { display: none; position: absolute; top: 100%; left: 0; background: #12122a; border-radius: 6px; min-width: 180px; box-shadow: 0 4px 12px rgba(0,0,0,.4); z-index: 100; padding: 4px 0; margin-top: 0; padding-top: 10px; }
.nav-dropdown-menu a { display: block; padding: 8px 16px; color: #ccc; font-size: 13px; border-radius: 0; }
.nav-dropdown-menu a:hover { background: #1e1e40; color: #fff; }
.nav-dropdown:hover .nav-dropdown-menu { display: block; }
main { max-width: 1100px; margin: 32px auto; padding: 0 20px; }
h1 { margin-bottom: 24px; font-size: 24px; }
h2 { margin: 24px 0 12px; font-size: 18px; }

form { background: #fff; padding: 20px; border-radius: 8px; box-shadow: 0 1px 4px rgba(0,0,0,.1); display: flex; flex-direction: column; gap: 12px; max-width: 600px; }
label { font-size: 13px; font-weight: 600; color: #555; }
input, select, textarea { padding: 8px 10px; border: 1px solid #ccc; border-radius: 4px; font-size: 14px; width: 100%; }
textarea { resize: vertical; min-height: 70px; }
button[type=submit] { background: #1a1a2e; color: #fff; border: none; padding: 10px 20px; border-radius: 4px; cursor: pointer; font-size: 14px; align-self: flex-start; }
button[type=submit]:hover { background: #16213e; }

table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 8px; overflow: hidden; box-shadow: 0 1px 4px rgba(0,0,0,.1); }
th { background: #1a1a2e; color: #fff; padding: 10px 14px; text-align: left; font-size: 13px; }
td { padding: 9px 14px; font-size: 13px; border-bottom: 1px solid #eee; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #f9f9f9; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 12px; font-size: 11px; font-weight: 700; }
.badge-ingreso { background: #d4edda; color: #155724; }
.badge-egreso { background: #f8d7da; color: #721c24; }

.delete-btn { background: none; border: none; color: #c0392b; cursor: pointer; font-size: 13px; padding: 0; }
.delete-btn:hover { text-decoration: underline; }
.msg { padding: 10px 16px; border-radius: 4px; margin-bottom: 16px; font-size: 13px; }
.msg-ok { background: #d4edda; color: #155724; }
.msg-err { background: #f8d7da; color: #721c24; }

/* $ prefix on monto inputs */
.input-prefix { position: relative; }
.input-prefix span { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: #777; font-size: 14px; pointer-events: none; }
.input-prefix input { padding-left: 26px; }

/* Tom Select overrides */
.ts-wrapper { width: 100%; }
.ts-control { border: 1px solid #ccc; border-radius: 4px; font-size: 14px; min-height: 36px; padding: 4px 10px; }
.ts-dropdown { font-size: 14px; }
.ts-wrapper.focus .ts-control { border-color: #1a1a2e; box-shadow: none; outline: none; }

/* View toggle */
.view-toggle-bar { display: flex; align-items: center; justify-content: space-between; margin: 24px 0 16px; }
.view-toggle { display: flex; gap: 0; border: 1px solid #ddd; border-radius: 6px; overflow: hidden; width: fit-content; }
.toggle-btn { background: #f5f5f5; border: none; padding: 7px 20px; font-size: 13px; cursor: pointer; color: #555; }
.toggle-btn:hover { background: #eaeaea; }
.toggle-btn.toggle-active { background: #1a1a2e; color: #fff; }
.export-btn { background: #f0f0f0; border: 1px solid #ddd; border-radius: 4px; padding: 6px 14px; font-size: 13px; color: #444; text-decoration: none; }
.export-btn:hover { background: #e0e0e0; }

/* Charts */
.chart-block { background: #fff; border-radius: 8px; box-shadow: 0 1px 4px rgba(0,0,0,.1); padding: 20px; margin-bottom: 24px; }

/* Date range filter */
.date-filter { display: flex; align-items: flex-end; gap: 20px; flex-wrap: wrap; margin-bottom: 24px; background: #fff; padding: 14px 16px; border-radius: 8px; box-shadow: 0 1px 4px rgba(0,0,0,.1); }
.date-presets { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.preset-label { font-size: 12px; font-weight: 600; color: #888; text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; }
.preset-btn { background: #f0f0f0; border: 1px solid #ddd; border-radius: 4px; padding: 5px 12px; font-size: 13px; cursor: pointer; color: #444; white-space: nowrap; }
.preset-btn:hover { background: #e0e0e0; }
.preset-btn.preset-active { background: #1a1a2e; color: #fff; border-color: #1a1a2e; }
.date-inputs { display: flex; gap: 12px; align-items: flex-end; }
.date-inputs > div { display: flex; flex-direction: column; gap: 4px; }
.date-inputs input { padding: 6px 10px; border: 1px solid #ccc; border-radius: 4px; font-size: 13px; }

/* Filter form (report page) */
.filter-form { flex-direction: row !important; flex-wrap: wrap; align-items: flex-end; max-width: none !important; margin-bottom: 24px; }
.filter-form > div { flex: 1; min-width: 160px; }
.row-ing td { color: #1a4731; background: #f0faf4; }
.row-egr td { color: #5c1a1a; background: #fdf2f2; }
.row-ing:hover td { background: #e3f5ea; }
.row-egr:hover td { background: #f9e5e5; }
.monto-cell { font-weight: 600; }

/* Totals bar */
.currency-totals { margin-bottom: 20px; }
.currency-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: #888; margin-bottom: 8px; }
.totals-bar { display: flex; gap: 16px; flex-wrap: wrap; }
.total-card { flex: 1; min-width: 160px; background: #fff; border-radius: 8px; padding: 16px 20px; box-shadow: 0 1px 4px rgba(0,0,0,.1); display: flex; flex-direction: column; gap: 4px; }
.total-label { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: #888; }
.total-val { font-size: 22px; font-weight: 700; }
.total-ing .total-val { color: #1a4731; }
.total-egr .total-val { color: #5c1a1a; }
.total-bal .total-label { color: #555; }
