:root {
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --bg: #f4f5f7;
  --card: #ffffff;
  --ink: #1f2933;
  --muted: #6b7280;
  --grid: #e5e7eb;
  --blue: #1ba6d9;
  --orange: #f07a24;
  --gray: #a3a9b3;
  --owe: #b4441c;
  --credit: #137a4a;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: var(--font); background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.45; }
h1 { font-size: 1.5rem; margin: 0; }
h2 { font-size: 1.1rem; margin: 0 0 .25rem; }
.muted { color: var(--muted); margin: .2rem 0 .6rem; }

.top { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 1rem; padding: 1.2rem 1.5rem; background: var(--card); border-bottom: 1px solid var(--grid); }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.actions form { margin: 0; }
main { max-width: 1200px; margin: 0 auto; padding: 1.2rem; }

button, .button { font: inherit; background: var(--ink); color: #fff; border: 0; border-radius: 6px; padding: .5rem .9rem; cursor: pointer; text-decoration: none; display: inline-block; }
.button.secondary { background: transparent; color: var(--ink); border: 1px solid var(--grid); }
select, input { font: inherit; padding: .45rem .6rem; border: 1px solid #cfd4da; border-radius: 6px; background: #fff; }

.card { background: var(--card); border-radius: 10px; padding: 1.1rem 1.2rem; margin-bottom: 1.1rem; box-shadow: 0 1px 2px rgba(0,0,0,.05); }
.note { background: #eaf6fb; color: #0e5673; border-radius: 8px; padding: .7rem 1rem; }
.alert .button { margin-left: .5rem; padding: .3rem .7rem; }
.alert { background: #fdecea; color: #8a1c12; border-radius: 8px; padding: .7rem 1rem; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 1rem; margin-bottom: 1.1rem; }
.kpi { background: var(--card); border-radius: 10px; padding: 1rem 1.1rem; box-shadow: 0 1px 2px rgba(0,0,0,.05); }
.kpi .label { color: var(--muted); font-size: .85rem; }
.kpi .value { font-size: 1.7rem; font-weight: 600; margin: .2rem 0; font-variant-numeric: tabular-nums; }
.kpi .value.owe { color: var(--owe); }
.kpi .value.credit { color: var(--credit); }
.kpi .value.small { font-size: 1.3rem; white-space: nowrap; }
.kpi .unit { font-size: .8rem; color: var(--muted); font-weight: 400; }
.kpi .sub { color: var(--muted); font-size: .82rem; }

.chart { position: relative; height: 320px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { padding: .45rem .6rem; border-bottom: 1px solid var(--grid); text-align: left; white-space: nowrap; }
th { font-weight: 600; font-size: .85rem; color: var(--muted); }
.n { text-align: right; }
tr.future td { color: var(--muted); }
tr.current { background: #f2f9fc; }
.tag { font-size: .72rem; background: var(--blue); color: #fff; border-radius: 4px; padding: .05rem .35rem; margin-left: .3rem; }

footer { font-size: .82rem; padding: .5rem .2rem 2rem; }

body.login { display: flex; min-height: 100vh; align-items: center; justify-content: center; }
.login-card { width: 100%; max-width: 380px; }
.login-card label { display: block; margin: .8rem 0; font-size: .9rem; }
.login-card input { display: block; width: 100%; margin-top: .3rem; }
.login-card button { width: 100%; margin-top: .5rem; }

@media (max-width: 600px) {
  .top { padding: 1rem; }
  .chart { height: 260px; }
  .kpi .value { font-size: 1.4rem; }
}
