@font-face { font-family: "League Spartan"; src: url("brand/LeagueSpartan-VF.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
:root {
  color-scheme: light dark;
  --bg: #f6f5f2; --surface: #fff; --ink: #1c1a20; --muted: #6b6870; --line: #e3e0da; --field: #c9c5bd;
  --accent: #4b1d8f; --on-accent: #fff; --accent-soft: #efe9f8; --warn: #9a4a00; --warn-soft: #fbefe0;
  --error: #b3261e; --error-soft: #fbeae8; --ok: #1d6b3a; --ok-soft: #e5f3ea; --neutral-soft: #eeece7;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141216; --surface: #1e1b22; --ink: #f0edf3; --muted: #a7a2ad; --line: #322d38; --field: #4a4452;
    --accent: #b794f4; --on-accent: #1b0f33; --accent-soft: #2c2240; --warn: #f0b070; --warn-soft: #3a2a18;
    --error: #f2968e; --error-soft: #3d1f1d; --ok: #7fd09c; --ok-soft: #1b3324; --neutral-soft: #2a2630;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
a { color: var(--accent); }
main { max-width: 1100px; margin: 0 auto; padding: 28px 16px 64px; }
h1, h2, .brand { font-family: "League Spartan", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
h1 { margin: 0; font-size: 30px; line-height: 1.15; font-weight: 700; letter-spacing: -.01em; }
h2 { margin: 36px 0 12px; font-size: 19px; font-weight: 700; }
.card h2 { margin: 0; }
p { margin: 0; }
.muted { margin: 6px 0 0; color: var(--muted); }
.top { position: sticky; top: 0; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 18px; padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--line); }
.top a:not(.button) { padding: 4px 0; text-decoration: none; color: var(--muted); border-bottom: 2px solid transparent; }
.top a[aria-current="page"] { color: var(--ink); font-weight: 600; border-bottom-color: var(--accent); }
.top a.brand { font-size: 20px; font-weight: 700; color: var(--accent); }
.top .new { min-height: 34px; padding: 5px 12px; }
.top .end { margin-left: auto; }
.switch { display: inline-flex; padding: 2px; background: var(--neutral-soft); border-radius: 8px; }
.switch button { min-height: 30px; padding: 3px 12px; font-size: 14px; font-weight: 500; color: var(--muted); background: none; border-radius: 6px; }
.switch button[aria-current] { font-weight: 600; color: var(--ink); background: var(--surface); box-shadow: 0 1px 2px rgba(0, 0, 0, .15); }
input.amount { width: 110px; text-align: right; }
.page { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 22px; }
.card { padding: 20px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.login { max-width: 380px; margin: 12vh auto 0; display: grid; gap: 16px; }
.stack { display: grid; gap: 16px; align-content: start; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 12px; }
.narrow { max-width: 640px; }
label { display: grid; gap: 4px; font-weight: 600; font-size: 14px; }
label.inline { display: inline-grid; margin-bottom: 16px; }
label.check { display: flex; gap: 8px; align-items: center; font-weight: 400; }
input, select, textarea { width: 100%; min-height: 40px; padding: 8px 10px; font: inherit; font-weight: 400; color: inherit; background: var(--surface); border: 1px solid var(--field); border-radius: 8px; }
input[type="checkbox"] { width: 18px; min-height: 18px; height: 18px; accent-color: var(--accent); }
textarea { resize: vertical; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button, .button { display: inline-block; min-height: 40px; padding: 8px 16px; font: inherit; font-weight: 600; text-align: center; text-decoration: none; border: 1px solid transparent; border-radius: 8px; cursor: pointer; }
.primary { color: var(--on-accent); background: var(--accent); }
.primary:hover { filter: brightness(1.1); }
.secondary { color: var(--accent); background: var(--surface); border-color: var(--accent); }
.secondary:hover { background: var(--accent-soft); }
.link { min-height: 0; padding: 0; color: var(--accent); background: none; font-weight: 400; text-decoration: underline; }
.link.danger { color: var(--error); }
.actions { display: flex; flex-wrap: wrap; gap: 10px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-bottom: 28px; }
.kpi { display: grid; gap: 2px; padding: 16px; color: inherit; text-decoration: none; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.kpi span { font-size: 13px; color: var(--muted); }
.kpi strong { font: 700 25px/1.2 "League Spartan", -apple-system, sans-serif; font-variant-numeric: tabular-nums; }
.kpi.alert strong { color: var(--error); }
.table-wrap { overflow-x: auto; margin-bottom: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 11px 12px; text-align: left; vertical-align: middle; border-bottom: 1px solid var(--line); }
tbody tr:last-child td { border-bottom: 0; }
th { font-size: 12px; font-weight: 600; color: var(--muted); }
.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.sub { display: block; font-size: 13px; color: var(--muted); }
.warn { display: block; margin-top: 2px; font-size: 13px; font-weight: 600; color: var(--warn); }
tr.new { background: var(--accent-soft); }
.pill { display: inline-block; padding: 1px 9px; font: 600 12px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; letter-spacing: 0; vertical-align: middle; border-radius: 999px; white-space: nowrap; }
.pill.cobrada { color: var(--ok); background: var(--ok-soft); }
.pill.pendiente { color: var(--warn); background: var(--warn-soft); }
.pill.vencida { color: var(--error); background: var(--error-soft); }
.pill.historica { color: var(--muted); background: var(--neutral-soft); }
.flash { padding: 10px 14px; margin: 0 0 16px; border-radius: 8px; background: var(--surface); border: 1px solid var(--line); }
.flash.error { color: var(--error); border-color: var(--error); }
.flash.ok { color: var(--ok); border-color: var(--ok); }
.quarters { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 16px; }
.quarter { display: grid; padding: 12px; color: inherit; text-decoration: none; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.quarter span { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.quarter.active { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; margin-bottom: 16px; }
.filters .grow { flex: 1 1 240px; }
.filters label { flex: 0 1 180px; }
.invoice-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.summary-card { position: sticky; top: 72px; }
.detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; align-items: start; }
.line-row { display: grid; grid-template-columns: minmax(0, 1fr) 84px 110px auto; gap: 10px; align-items: end; }
.line-row .link { padding-bottom: 10px; }
.totals { display: grid; gap: 6px; margin: 0; font-variant-numeric: tabular-nums; }
.totals div { display: flex; justify-content: space-between; gap: 12px; }
.totals dt { color: var(--muted); }
.totals dd { margin: 0; }
.totals .grand { margin-top: 4px; padding: 10px 12px; font-weight: 700; font-size: 17px; color: var(--on-accent); background: var(--accent); border-radius: 8px; }
.totals .grand dt { color: inherit; }
.inline-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; }
.qr { display: flex; justify-content: center; padding: 8px; background: #fff; border-radius: 8px; }
.qr svg { max-width: 100%; height: auto; }
code { overflow-wrap: anywhere; font-size: 13px; }
@media (max-width: 820px) {
  .invoice-layout { grid-template-columns: minmax(0, 1fr); }
  .summary-card { position: static; }
}
@media (max-width: 640px) {
  .top { position: static; }
  .hide-sm { display: none; }
  h1 { font-size: 25px; }
  .line-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .line-row .grow { grid-column: 1 / -1; }
  .line-row .link { grid-column: 1 / -1; padding: 0; text-align: left; }
}
