/* Estilo Polar (el mismo de Polar Stock): vidrio esmerilado, relieve neumórfico, acento dorado y degradado Nova */
:root {
  --ink: #1f2023;
  --muted: #6b7280;
  --line: rgba(31, 32, 35, .07);
  --gold: #b8955a;
  --gold-soft: rgba(184, 149, 90, .14);
  --bad: #a8473d;
  --bad-soft: rgba(168, 71, 61, .1);
  --r: 22px;
  --serif: "Cormorant Garamond", Georgia, serif;
  --nova: linear-gradient(120deg, #29cca1, #2bc9c4 20%, #1a79d8 50%, #7c52ef 80%, #8c2fdd);
  /* Neumorfismo: luz arriba a la izquierda, sombra abajo a la derecha */
  --base: #f3f4f6;
  --hi: rgba(255, 255, 255, .95);
  --lo: rgba(156, 163, 175, .45);
  --raised-sm: -3px -3px 7px var(--hi), 3px 3px 8px var(--lo);
  --pressed: inset 3px 3px 7px var(--lo), inset -3px -3px 7px var(--hi);
  --surface: linear-gradient(145deg, #fbfbfc, #e5e7eb);
  --dark: linear-gradient(145deg, #3b3b40, #151517);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }   /* también en bloques con display grid / flex */
html, body { margin: 0; min-height: 100%; }
body {
  font: 14px/1.45 Inter, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--base);
  background-image: radial-gradient(1000px 700px at 15% 0%, #ffffff 0%, transparent 65%);
  background-attachment: fixed;
  display: flex;
}
.glass {
  background: linear-gradient(165deg, rgba(255, 255, 255, .82), rgba(255, 255, 255, .5));
  backdrop-filter: blur(24px) saturate(140%);
  -webkit-backdrop-filter: blur(24px) saturate(140%);
  border: 1px solid rgba(255, 255, 255, .95);
  border-radius: var(--r);
  box-shadow: inset 0 1px 1px #fff, inset 0 -2px 6px rgba(156, 163, 175, .12), 0 3px 0 -1px #e9ebef, 0 5px 0 -2px rgba(209, 213, 219, .8),
    0 34px 48px -24px rgba(55, 65, 81, .25), 0 14px 24px -14px rgba(55, 65, 81, .12);
}

/* Barra lateral */
.side { position: sticky; top: 16px; margin: 16px 0 16px 16px; height: calc(100vh - 32px); width: 220px; flex: none; padding: 26px 16px; display: flex; flex-direction: column; gap: 26px; }
.brand { display: flex; align-items: center; gap: 12px; padding-left: 6px; font: 600 26px/1 var(--serif); letter-spacing: .12em; }
.brand img { width: 38px; height: 38px; border-radius: 11px; box-shadow: var(--raised-sm); }
.brand small { display: block; font: 500 10px Inter, sans-serif; letter-spacing: .4em; color: var(--gold); margin-top: 6px; text-transform: uppercase; }
nav { display: flex; flex-direction: column; gap: 6px; }
nav a { color: var(--muted); text-decoration: none; padding: 10px 14px; border-radius: 14px; font-weight: 500; display: flex; align-items: center; gap: 10px; transition: box-shadow .2s, color .2s; }
nav a::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: transparent; flex: none; }
nav a:hover { color: var(--ink); box-shadow: var(--raised-sm); }
nav a.on { color: var(--ink); font-weight: 600; box-shadow: var(--pressed); }
nav a.on::before { background: var(--gold); box-shadow: 0 0 8px var(--gold); }
.quick { margin-top: auto; display: flex; flex-direction: column; gap: 8px; }

main { flex: 1; min-width: 0; padding: 28px 32px 60px; }
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
h1 { font: 600 30px/1.15 Inter, sans-serif; margin: 0; letter-spacing: -.01em; }
h2 { font: 600 17px/1.3 Inter, sans-serif; margin: 0 0 14px; }
h2 small { font-weight: 400; color: var(--muted); font-size: 13px; margin-left: 6px; }
.sub { color: var(--muted); margin-top: 6px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.muted { color: var(--muted); }
.empty { color: var(--muted); padding: 22px; text-align: center; }

/* Botones y campos: relieve neumórfico; al presionar se hunden */
.btn { font: 500 13px Inter, sans-serif; border: 0; border-radius: 999px; padding: 11px 20px; background: var(--dark); color: #fff; cursor: pointer; white-space: nowrap;
  box-shadow: var(--raised-sm), inset 0 1px 0 rgba(255, 255, 255, .14); transition: box-shadow .15s, transform .15s; }
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: none; box-shadow: inset 3px 3px 7px rgba(0, 0, 0, .45), inset -2px -2px 5px rgba(255, 255, 255, .08); }
.btn.ghost { background: var(--surface); color: var(--ink); }
.btn.ghost:active { box-shadow: var(--pressed); }
.btn.gold { background: linear-gradient(145deg, #d3b47c, #a8844b); }
.btn.sm { padding: 7px 14px; font-size: 12px; }
.btn.link { background: none; box-shadow: none; color: var(--muted); padding: 4px 8px; }
.btn.link:hover { color: var(--bad); transform: none; }
.btn.danger { background: var(--bad); }
input, select, textarea { font: inherit; color: inherit; border: 0; background: var(--base); border-radius: 14px; padding: 10px 14px; outline: none; box-shadow: var(--pressed); transition: box-shadow .2s; min-width: 0; }
input:focus, select:focus, textarea:focus { box-shadow: var(--pressed), 0 0 0 2px var(--gold); }
select { appearance: none; padding-right: 34px; cursor: pointer; box-shadow: var(--raised-sm);
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%236e6c68' stroke-width='1.5'/%3E%3C/svg%3E") no-repeat right 14px center, var(--surface); }
input[type=checkbox] { appearance: none; width: 38px; height: 22px; padding: 0; border-radius: 999px; position: relative; cursor: pointer; flex: none; }
input[type=checkbox]::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--surface); box-shadow: var(--raised-sm); transition: left .2s, background .2s; }
input[type=checkbox]:checked::after { left: 19px; background: linear-gradient(145deg, #d3b47c, #a8844b); }
input[type=color] { width: 44px; height: 34px; padding: 4px; cursor: pointer; }
label { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--muted); font-weight: 500; }
/* Todo lo que se cuenta en pesos lleva $ dentro del campo */
.cash { position: relative; display: block; }
.cash::before { content: "$"; position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.cash input { width: 100%; padding-left: 26px; }
.chip { border: 0; background: var(--surface); box-shadow: var(--raised-sm); border-radius: 999px; padding: 8px 14px; cursor: pointer; font: 500 12px Inter, sans-serif; color: var(--muted); }
.chip:active { box-shadow: var(--pressed); }

/* Selector de mes: flechas y lista */
.month { display: flex; align-items: center; gap: 8px; }
.month select { font-weight: 600; }

/* KPIs y tarjetas */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 22px; margin-bottom: 22px; }
.kpi { padding: 22px 24px; min-width: 0; }
.kpi .k { color: var(--muted); font-size: 12px; font-weight: 500; text-transform: uppercase; letter-spacing: .08em; }
.kpi .v { font: 500 30px/1.15 Inter, sans-serif; letter-spacing: -.02em; margin: 12px 0 6px; color: #3f4248; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.kpi .s { color: var(--muted); font-size: 12px; }
.kpi.accent .v { color: var(--gold); }
.kpi.bad .v { color: var(--bad); }
.kpi .btn { margin-top: 4px; }
.up { color: var(--bad); font-weight: 600; }
.down { color: #16795f; font-weight: 600; }
.card { padding: 24px; min-width: 0; margin-bottom: 22px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); gap: 0 22px; }
#banner .glass, .notice .glass { padding: 14px 18px; margin-bottom: 18px; display: flex; align-items: center; gap: 14px; justify-content: space-between; border-left: 3px solid var(--gold); }

/* Próximos pagos */
.pays { display: grid; gap: 8px; }
.pay { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 14px; align-items: center; padding: 12px 14px; border-radius: 14px; background: rgba(255, 255, 255, .6); border: 1px solid var(--line); }
.pay b { font-variant-numeric: tabular-nums; white-space: nowrap; }
.pay span { display: block; font-size: 12px; color: var(--muted); }
.pay.soon { background: var(--bad-soft); border-color: rgba(168, 71, 61, .35); }
.pay.soon span { color: var(--bad); font-weight: 600; }

/* Categorías: cada renglón se abre con su desglose */
.cats { display: grid; }
.cats details { border-bottom: 1px solid var(--line); }
.cats details:last-child { border-bottom: 0; }
.cats summary { list-style: none; cursor: pointer; display: grid; grid-template-columns: 12px minmax(0, 1fr) 3em auto 64px; gap: 12px; align-items: center; padding: 12px 6px; border-radius: 12px; }
.cats summary::-webkit-details-marker { display: none; }
.cats summary:hover { background: rgba(255, 255, 255, .55); }
.cats details[open] > summary { background: var(--gold-soft); }
.sw { width: 12px; height: 12px; border-radius: 4px; flex: none; }
.cats .name { font-weight: 500; overflow-wrap: anywhere; }
.cats .name::after { content: ""; display: inline-block; width: 6px; height: 6px; margin: 0 0 2px 10px; border: solid var(--gold); border-width: 0 1.5px 1.5px 0; transform: rotate(-45deg); transition: transform .15s; }
.cats details[open] .name::after { transform: rotate(45deg); }
.pct { font-size: 12px; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
/* Dona a la izquierda (fijo al bajar por la lista) y la lista con los desgloses a la derecha */
.catpie { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 28px; align-items: start; }
.pie { width: 100%; position: sticky; top: 24px; }
/* 2 px de separación entre rebanadas */
.pie path, .pie circle { stroke: #fff; stroke-width: 2; stroke-linejoin: round; cursor: pointer; transition: opacity .15s; }
.pie:hover path:not(:hover) { opacity: .55; }
.pie text { text-anchor: middle; font: 600 21px Inter, sans-serif; fill: var(--ink); font-variant-numeric: tabular-nums; }
.pie text.sm { font: 500 12px Inter, sans-serif; fill: var(--muted); }
.amt { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right; }
.delta { font-size: 12px; text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.total { display: flex; justify-content: space-between; padding: 14px 6px 0; margin-top: 4px; border-top: 1px solid rgba(184, 149, 90, .55); font-weight: 600; }
/* Desglose de una categoría: por comercio (cada uno se abre con sus cargos) y por tarjeta */
.break { padding: 8px 6px 18px 30px; display: grid; gap: 16px; }
.break h3 { margin: 0 0 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 600; }
.lines details > summary, .lines > div { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 12px; padding: 7px 8px; border-radius: 10px; font-size: 13px; }
.lines details > summary { cursor: pointer; list-style: none; }
.lines details > summary::-webkit-details-marker { display: none; }
.lines details > summary:hover { background: rgba(255, 255, 255, .6); }
.lines .n { color: var(--muted); font-size: 12px; white-space: nowrap; }
.lines b { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right; }
.lines span { overflow-wrap: anywhere; }
.items { margin: 2px 0 6px 12px; padding-left: 12px; border-left: 1px solid rgba(184, 149, 90, .55); }
.items div { display: grid; grid-template-columns: 5.5em minmax(0, 1fr) auto; gap: 12px; padding: 4px 8px; font-size: 12px; color: var(--muted); }
.items b { color: var(--ink); font-weight: 500; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.items span { overflow-wrap: anywhere; }

/* Gráficas: barras delgadas con punta redonda; los nombres siempre van junto a la barra */
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--muted); margin: -4px 0 14px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.hbars { display: grid; gap: 12px; }
.hbar { display: grid; grid-template-columns: minmax(0, 10em) minmax(0, 1fr); gap: 4px 12px; align-items: center; font-size: 13px; }
.hbar > span { overflow-wrap: anywhere; grid-row: span 2; }
.hbar .b { display: grid; grid-template-columns: minmax(0, 1fr) 6.5em; gap: 8px; align-items: center; }
.hbar .b i { display: block; height: 8px; border-radius: 0 4px 4px 0; min-width: 2px; }
.hbar .b b { font-weight: 600; font-size: 12px; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.hbar .b.prev i { background: #cfd3da !important; }
.hbar .b.prev b { color: var(--muted); font-weight: 500; }
.hbar.one { grid-template-columns: minmax(0, 10em) minmax(0, 1fr); }
.hbar.one > span { grid-row: auto; }
/* Columnas apiladas por mes: 2 px de separación entre segmentos */
.cols { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 80px); justify-content: space-around; gap: 10px; align-items: end; height: 220px; border-bottom: 1px solid var(--line); }
.col { display: flex; flex-direction: column-reverse; justify-content: flex-start; gap: 2px; height: 100%; cursor: pointer; border-radius: 6px; padding: 0 2px; }
.col:hover { background: rgba(255, 255, 255, .6); }
.col.on { background: var(--gold-soft); }
.col i { display: block; width: 100%; min-height: 1px; }
.col i:last-child { border-radius: 4px 4px 0 0; }
.colx { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 80px); justify-content: space-around; gap: 10px; margin-top: 6px; font-size: 11px; color: var(--muted); text-align: center; }
.colx b { display: block; color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; font-size: 11px; }
#tip { position: fixed; z-index: 20; pointer-events: none; max-width: 260px; padding: 10px 12px; border-radius: 12px; background: rgba(31, 32, 35, .94); color: #fff; font-size: 12px; line-height: 1.5; white-space: pre-line; box-shadow: 0 10px 30px -10px rgba(0, 0, 0, .4); }

/* Tablas */
.table { padding: 6px 0; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 600; padding: 12px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 10px 14px; border-bottom: 1px solid var(--line); }
tbody tr:last-child td { border-bottom: 0; }
tfoot td { font-weight: 600; border-top: 1px solid var(--line); border-bottom: 0; }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td.d { color: var(--muted); font-size: 12px; white-space: nowrap; }
td select { padding: 6px 30px 6px 10px; font-size: 13px; max-width: 200px; }
td input:not([type=checkbox]) { padding: 7px 10px; width: 100%; }
td .cash input { padding-left: 22px; }
td .cash::before { left: 10px; }
tr.click { cursor: pointer; }
tr.click:hover td { background: rgba(255, 255, 255, .55); }
tr.off td { color: var(--muted); text-decoration: line-through; }
tr.off td select, tr.off td:first-child { text-decoration: none; }
.badge { display: inline-block; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; white-space: nowrap; background: rgba(20, 20, 20, .06); color: var(--muted); margin-left: 6px; text-decoration: none; }
.filters { margin-bottom: 18px; }
.filters input[type=search] { flex: 1 1 220px; }

/* Subir estados */
.drop { display: grid; place-items: center; gap: 10px; text-align: center; padding: 40px 20px; border: 2px dashed rgba(184, 149, 90, .5); border-radius: var(--r); cursor: pointer; transition: background .2s, border-color .2s; }
.drop.over { background: var(--gold-soft); border-color: var(--gold); }
.drop svg { width: 34px; height: 34px; fill: none; stroke: var(--gold); stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.drop b { font-size: 15px; }
/* En celular no se arrastra: el texto dice "toca" */
.drop .dedo { display: none; }
@media (pointer: coarse) { .drop .fino { display: none; } .drop .dedo { display: block; } }
.welcome ol { margin: 0 0 12px; padding-left: 20px; display: grid; gap: 6px; }
.stmt .form { margin-bottom: 14px; }
.avance { display: flex; align-items: center; gap: 16px; padding: 16px 20px; margin-top: 16px; border-radius: var(--r); }
.avance[hidden] { display: none; }
.avance div { display: grid; gap: 2px; min-width: 0; }
.avance b { font-size: 15px; overflow-wrap: anywhere; }
#avpaso { font-size: 13px; color: var(--muted); }
/* Poli, la mascota de Polar (copiada de Polar Stock, ahí se diseñó): la estrella rellena con el degradado Nova girando por dentro,
   brillo de vidrio y dos ojitos. Todo en em: el tamaño es font-size. Aquí sólo piensa (data-state="think") mientras lee un PDF */
.poli { --turn: 7s; font-size: 56px; width: 1em; height: 1em; position: relative; display: inline-block; flex: none;
  filter: drop-shadow(0 .04em .1em rgba(26, 121, 216, .45)); animation: sway 4s ease-in-out infinite; }
.poli .ball { position: absolute; inset: 0; overflow: hidden; background: #3a3bb8;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M13.3 3.2C15.6 7 17.3 9.2 20.8 10.7Q23 12 20.8 13.3C17.3 14.8 15.6 17 13.3 20.8Q12 23 10.7 20.8C8.4 17 6.7 14.8 3.2 13.3Q1 12 3.2 10.7C6.7 9.2 8.4 7 10.7 3.2Q12 1 13.3 3.2z'/%3E%3C/svg%3E") center / 100% 100% no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M13.3 3.2C15.6 7 17.3 9.2 20.8 10.7Q23 12 20.8 13.3C17.3 14.8 15.6 17 13.3 20.8Q12 23 10.7 20.8C8.4 17 6.7 14.8 3.2 13.3Q1 12 3.2 10.7C6.7 9.2 8.4 7 10.7 3.2Q12 1 13.3 3.2z'/%3E%3C/svg%3E") center / 100% 100% no-repeat; }
.poli .ball::before { content: ""; position: absolute; inset: -30%; filter: blur(.14em);
  background: conic-gradient(#29cca1, #2bc9c4 18%, #1a79d8 38%, #7c52ef 60%, #8c2fdd 80%, #29cca1); animation: turn var(--turn) linear infinite; }
.poli .ball::after { content: ""; position: absolute; inset: 0;
  background: radial-gradient(circle at 43% 36%, rgba(255, 255, 255, .8), rgba(255, 255, 255, .15) 12%, transparent 24%), radial-gradient(circle at 62% 70%, rgba(20, 0, 60, .4), transparent 40%); }
.poli .eyes { position: absolute; inset: 0; animation: look 7s ease-in-out infinite; }
.poli .eye { position: absolute; top: 39%; width: .075em; height: .15em; border-radius: .04em; background: #fff; box-shadow: 0 0 .05em rgba(255, 255, 255, .8);
  animation: blink 4.2s infinite; transform-origin: 50% 60%; }
.poli .eye:first-child { left: 37.5%; } .poli .eye:last-child { left: 55%; }
.poli[data-state="think"] { --turn: 1.4s; }
.poli[data-state="think"] .eyes { animation: ponder 1.6s ease-in-out infinite; }
.poli[data-state="think"] .eye { animation: none; height: .12em; }
@keyframes turn { to { transform: rotate(360deg); } }
@keyframes sway { 25% { transform: translateY(-.025em) rotate(-5deg); } 75% { transform: translateY(.01em) rotate(5deg); } }
@keyframes blink { 0%, 92%, 100% { transform: scaleY(1); } 95% { transform: scaleY(.1); } }
@keyframes look { 0%, 30%, 82%, 100% { transform: none; } 38%, 52% { transform: translateX(-.05em); } 60%, 74% { transform: translateX(.05em); } }
@keyframes ponder { 0%, 100% { transform: translate(.035em, -.06em); } 50% { transform: translate(-.03em, -.07em); } }
@media (prefers-reduced-motion: reduce) { .poli, .poli *, .poli *::before { animation: none !important; } }
/* Cabecera de cada PDF subido: sello verde si se leyó, rojo si no */
.stmt { border-left: 4px solid #16795f; scroll-margin-top: 16px; }
.stmt.mal { border-left-color: var(--bad); }
.leido { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 16px; }
.stmt.mal .leido { margin-bottom: 0; }
.leido > div { flex: 1; min-width: 0; }
.leido h2 { margin: 0 0 4px; overflow-wrap: anywhere; }
.leido span:not(.sello) { font-size: 14px; color: var(--muted); }
.sello { flex: none; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: rgba(22, 121, 95, .12); color: #16795f; font-weight: 700; }
.stmt.mal .sello { background: var(--bad-soft); color: var(--bad); }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; padding: 6px 12px; border-radius: 999px; }
.check.ok { background: rgba(22, 121, 95, .1); color: #16795f; }
.check.no { background: var(--bad-soft); color: var(--bad); }
.foot { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; margin-top: 16px; }

/* Ventana (dialog) */
dialog { width: min(560px, calc(100vw - 32px)); max-width: none; max-height: none; padding: 0; border: 0; background: none; overflow: visible; color: var(--ink); }
dialog:focus, dialog:focus-visible, dialog .sheet:focus { outline: none; }
dialog::backdrop { background: rgba(20, 20, 20, .25); backdrop-filter: blur(4px); }
dialog .sheet { max-height: calc(100dvh - 48px); overflow-y: auto; padding: 26px; background: rgba(243, 244, 246, .96); }
dialog h2 { margin-bottom: 18px; }
.form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form .wide { grid-column: 1 / -1; }
.form input, .form select { width: 100%; }
.sheet .foot { margin-top: 22px; }
.sheet .foot .left { margin-right: auto; }

#toast { position: fixed; bottom: 24px; left: 50%; transform: translate(-50%, 20px); background: var(--ink); color: #fff; padding: 11px 20px; border-radius: 999px; opacity: 0; transition: .25s; pointer-events: none; font-weight: 500; z-index: 30; max-width: calc(100vw - 32px); text-align: center; }
#toast.on { opacity: 1; transform: translate(-50%, 0); }

/* Ajustes */
.list { display: grid; gap: 8px; }
.list > div { display: grid; grid-template-columns: auto minmax(0, 1fr) minmax(0, 1fr) auto; gap: 10px; align-items: center; }
.list.rules > div { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; }
.list.cards > div { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; }
.list input, .list select { width: 100%; }
.note { font-size: 12px; color: var(--muted); margin: -6px 0 14px; }

@media (max-width: 860px) {
  body { flex-direction: column; }
  .side { position: static; height: auto; width: auto; margin: 16px 16px 0; padding: 18px 16px; gap: 14px; }
  /* Menú en columnas alineadas; los botones van abajo en una fila, tras una línea dorada delgada */
  nav { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 6px 10px; }
  nav a { padding: 10px; gap: 8px; white-space: nowrap; }
  .quick { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; padding-top: 16px; border-top: 1px solid rgba(184, 149, 90, .55); }
  .quick .btn { padding: 10px 4px; font-size: 12px; white-space: normal; }
  main { padding: 20px 16px 48px; }
  .head .month { width: 100%; }
  .head .month select { flex: 1; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .kpi { padding: 16px; }
  .kpi .v { font-size: 22px; margin: 8px 0 4px; }
  .kpi .k { font-size: 11px; letter-spacing: .05em; }
  .card { padding: 18px 14px; }
  .catpie { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .pie { position: static; width: min(240px, 100%); justify-self: center; }
  .cats summary { grid-template-columns: 12px minmax(0, 1fr) auto; row-gap: 2px; padding: 12px 6px; }
  .cats .pct { grid-column: 2; grid-row: 2; text-align: left; }
  .cats .delta { grid-column: 3; grid-row: 2; }
  .cats summary .amt { grid-column: 3; grid-row: 1; }
  .break { padding-left: 8px; }
  .hbar, .hbar.one { grid-template-columns: minmax(0, 1fr); }
  .hbar > span { grid-row: auto; }
  .cols { gap: 4px; height: 180px; }
  .colx { gap: 4px; font-size: 10px; }
  .colx b { font-size: 9.5px; }
  .filters > * { flex: 1 1 100% !important; }
  .form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pay { grid-template-columns: minmax(0, 1fr) auto; }
  .pay .btn { grid-column: 1 / -1; }
  .list > div { grid-template-columns: auto minmax(0, 1fr) auto; }
  .list > div > :nth-child(3) { grid-column: 2; }
  .list.rules > div, .list.cards > div { grid-template-columns: minmax(0, 1fr) auto; }
  .list.rules > div > :nth-child(2), .list.cards > div > :nth-child(2) { grid-column: 1; }
  .foot { justify-content: stretch; }
  .foot .btn { flex: 1; }
  .sheet .foot .left { margin-right: 0; }
}
@media (max-width: 760px) {
  dialog .sheet { padding: 20px 16px; }
}
