:root {
  --fondo: #f4f6f8; --tarjeta: #ffffff; --texto: #0f172a; --tenue: #64748b; --borde: #e2e8f0;
  --acento: #0f766e; --peligro: #b91c1c; --alerta: #fef3c7; --alerta-texto: #92400e;
  --c0: #0f766e; --c1: #2563eb; --c2: #d97706; --c3: #dc2626; --c4: #7c3aed;
  --c5: #db2777; --c6: #65a30d; --c7: #0891b2; --c8: #78716c;
}
@media (prefers-color-scheme: dark) {
  :root {
    --fondo: #0b1220; --tarjeta: #111a2e; --texto: #e2e8f0; --tenue: #94a3b8; --borde: #1e293b;
    --acento: #2dd4bf; --peligro: #f87171; --alerta: #422006; --alerta-texto: #fde68a;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--fondo); color: var(--texto); line-height: 1.4;
  padding-bottom: calc(64px + env(safe-area-inset-bottom));
}
.barra {
  position: sticky; top: 0; z-index: 1; background: var(--fondo); border-bottom: 1px solid var(--borde);
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
}
.barra h1 { margin: 0; font-size: 1.1rem; }
main { padding: 16px; max-width: 640px; margin: 0 auto; }
h2 { font-size: 1rem; margin: 0 0 8px; }
.pila { display: flex; flex-direction: column; gap: 12px; }
.tarjeta {
  display: block; background: var(--tarjeta); border: 1px solid var(--borde); border-radius: 14px;
  padding: 14px; color: inherit; text-decoration: none;
}
.grande { font-size: 1.8rem; font-weight: 700; margin: 4px 0; font-variant-numeric: tabular-nums; }
.tenue { color: var(--tenue); }
.ok { color: var(--acento); font-weight: 600; }
.error { color: var(--peligro); font-weight: 600; }
.alerta, .aviso {
  display: block; background: var(--alerta); color: var(--alerta-texto); border-radius: 12px;
  padding: 12px; text-decoration: none; font-weight: 600;
}
.pestanas {
  position: fixed; bottom: 0; left: 0; right: 0; display: flex; background: var(--tarjeta);
  border-top: 1px solid var(--borde); padding-bottom: env(safe-area-inset-bottom);
}
.pestanas a { flex: 1; text-align: center; padding: 14px 0; color: var(--tenue); text-decoration: none; font-size: .8rem; }
.pestanas a.activa { color: var(--acento); font-weight: 700; }
.lista { list-style: none; margin: 0; padding: 0; background: var(--tarjeta); border: 1px solid var(--borde); border-radius: 14px; }
.lista > li { border-bottom: 1px solid var(--borde); padding: 10px 14px; overflow-wrap: anywhere; }
.lista > li:last-child { border-bottom: 0; }
.lista > li.vencida strong { color: var(--peligro); }
summary { list-style: none; cursor: pointer; }
summary::-webkit-details-marker { display: none; }
.fila { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.lista small { display: block; color: var(--tenue); }
.monto { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.edicion { display: grid; gap: 10px; margin-top: 12px; }
label { display: grid; gap: 4px; font-size: .85rem; color: var(--tenue); }
input, select, button, .boton {
  font: inherit; font-size: 16px; padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--borde); background: var(--fondo); color: var(--texto); max-width: 100%;
}
button, .boton { cursor: pointer; background: var(--tarjeta); text-align: center; text-decoration: none; display: inline-block; }
.primario { background: var(--acento); color: #fff; border-color: var(--acento); }
.peligro { color: var(--peligro); }
.botones { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.link-mail { color: var(--acento); font-size: .9rem; }
.selector-mes { display: flex; justify-content: space-between; align-items: center; }
.grafico { display: flex; gap: 16px; align-items: center; }
.torta { width: 120px; height: 120px; flex: none; }
.leyenda { list-style: none; margin: 0; padding: 0; font-size: .85rem; }
.punto { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; }
.color-0 { fill: var(--c0); background: var(--c0); }
.color-1 { fill: var(--c1); background: var(--c1); }
.color-2 { fill: var(--c2); background: var(--c2); }
.color-3 { fill: var(--c3); background: var(--c3); }
.color-4 { fill: var(--c4); background: var(--c4); }
.color-5 { fill: var(--c5); background: var(--c5); }
.color-6 { fill: var(--c6); background: var(--c6); }
.color-7 { fill: var(--c7); background: var(--c7); }
.color-8 { fill: var(--c8); background: var(--c8); }
body.login { display: grid; place-items: center; min-height: 100vh; padding: 16px; }
.tarjeta-login {
  width: 100%; max-width: 360px; background: var(--tarjeta); border: 1px solid var(--borde);
  border-radius: 16px; padding: 20px; display: grid; gap: 12px;
}
.tarjeta-login h1 { margin: 0; font-size: 1.3rem; }
.tarjeta-login form { display: grid; gap: 10px; }
.separador { text-align: center; color: var(--tenue); margin: 0; }
@media (max-width: 380px) { .grafico { flex-direction: column; align-items: flex-start; } }
