/* La planilla de gastos. Los tokens (colores, radios, tipografías) son los de espacio
   (frontend/src/app.css): oscuro = paleta dothecode, claro = slate. Sigue al sistema. */

@font-face {
  font-family: "Geist Variable";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("fuentes/geist-latin-ext-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Geist Variable";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("fuentes/geist-latin-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Geist Mono Variable";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("fuentes/geist-mono-latin-wght-normal.woff2") format("woff2-variations");
}

:root {
  color-scheme: light dark;
  --bg: #f8fafc;
  --surface: #ffffff;
  --fg: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --border-suave: rgba(15, 23, 42, 0.06);
  --hover: rgba(15, 23, 42, 0.05);
  --accent: #f37020;
  --accent-fg: #ffffff;
  --pagado: #10b981;
  --impago: #ef4444;
  --proyectado: #d97706;
  --radio-card: 0.75rem;
  --radio-boton: 0.5rem;
  --sans: "Geist Variable", system-ui, sans-serif;
  --mono: "Geist Mono Variable", ui-monospace, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a1422;
    --surface: #0f1c2e;
    --fg: #f5f5f7;
    --muted: #8a99b0;
    --border: rgba(255, 255, 255, 0.08);
    --border-suave: rgba(255, 255, 255, 0.04);
    --hover: rgba(245, 245, 247, 0.05);
    --proyectado: #fbbf24;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { font-size: 16px; }
@media (width >= 40rem) { html { font-size: 17px; } }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p, dl, dd, ul { margin: 0; padding: 0; }
ul { list-style: none; }
a { color: inherit; text-decoration: none; }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 0.25rem; }
.apagado { color: var(--muted); font-size: 0.875rem; }

/* Todo el ancho de la ventana: sin un máximo que centre el contenido (RW3). */
main { display: flex; flex-direction: column; gap: 1rem; padding: 1rem; min-height: 100vh; }
@media (width >= 40rem) { main { padding: 1.5rem 2rem; } }

.encabezado { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem; }
.encabezado h1 { font-size: 1.25rem; font-weight: 600; }
.acciones { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; }
.selector {
  display: flex; align-items: center; gap: 0.25rem;
  padding: 0.375rem 0.5rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radio-boton);
}
.selector a { padding: 0.125rem 0.5rem; border-radius: 0.25rem; font-size: 0.75rem; font-weight: 500; color: var(--muted); transition: color 0.15s, background 0.15s; }
.selector a:hover { color: var(--fg); }
.selector a.activa { background: var(--accent); color: var(--accent-fg); }
.boton {
  padding: 0.5rem 0.75rem; border: 1px solid var(--border); border-radius: var(--radio-boton);
  font-size: 0.875rem; font-weight: 500; transition: background 0.15s;
}
.boton:hover { background: var(--hover); }

/* La franja del mes queda a la vista al desplazar (RW5). */
.franja {
  position: sticky; top: 0; z-index: 2;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem 2rem;
  margin: 0 -1rem; padding: 0.75rem 1rem;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
@media (width >= 40rem) { .franja { margin: 0 -2rem; padding: 0.75rem 2rem; } }
.mes { display: flex; align-items: center; gap: 0.75rem; }
.mes h2 { font-size: 1.125rem; font-weight: 600; min-width: 11.5rem; text-align: center; }
.flecha { display: grid; place-items: center; padding: 0.375rem; border-radius: var(--radio-boton); color: var(--muted); transition: background 0.15s; }
.flecha:hover { background: var(--hover); }
.flecha svg { width: 1.25rem; height: 1.25rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.cifras { display: flex; flex-wrap: wrap; gap: 0.5rem 2.25rem; }
.cifra dt { color: var(--muted); font-size: 0.6875rem; letter-spacing: 0.05em; text-transform: uppercase; }
.cifra dd { font-family: var(--mono); font-size: 1.25rem; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cifra-total dd { color: var(--accent); }
.cifra-pagado dd { color: var(--pagado); }
.cifra-impago dd { color: var(--impago); }
.cifra-proyectado dd { color: var(--proyectado); }
.aviso { color: var(--proyectado); font-family: var(--sans); font-size: 0.6875rem; font-weight: 400; }

.pestañas { display: flex; align-items: flex-end; border-bottom: 1px solid var(--border); }
.desliza { display: flex; flex: 1; min-width: 0; gap: 0.25rem; overflow-x: auto; scrollbar-width: none; }
.desliza::-webkit-scrollbar { display: none; }
.pestaña {
  display: flex; flex-shrink: 0; align-items: baseline; gap: 0.5rem;
  margin-bottom: -1px; padding: 0 0.75rem 0.5rem;
  border-bottom: 2px solid transparent;
  color: var(--muted); font-size: 0.875rem; white-space: nowrap; transition: color 0.15s;
}
.pestaña:hover { color: var(--fg); }
.pestaña.activa { border-bottom-color: var(--accent); color: var(--fg); }
.pestaña .nombre { font-weight: 500; }
.pestaña .monto { color: var(--muted); font-family: var(--mono); font-size: 0.75rem; font-variant-numeric: tabular-nums; }
.pestaña:not(.activa) .monto { opacity: 0.7; }
.punto { display: inline-block; flex-shrink: 0; width: 0.5rem; height: 0.5rem; border-radius: 999px; }

.barra { display: flex; align-items: center; justify-content: flex-end; gap: 0.25rem; margin-bottom: 0.25rem; color: var(--muted); font-size: 0.75rem; }
.barra span { margin-right: 0.25rem; }
.barra a { padding: 0.125rem 0.375rem; border-radius: 0.25rem; transition: color 0.15s; }
.barra a:hover { color: var(--fg); }
.barra a.activa { color: var(--fg); font-weight: 500; }

/* Un gasto por renglón. Las columnas de montos tienen ancho fijo para que las cifras
   queden alineadas de un renglón a otro y con el pie. */
.renglon {
  display: grid;
  grid-template-columns: 0.625rem minmax(0, 1fr) 2.5rem 11rem 10rem 6rem;
  align-items: baseline; gap: 0 0.75rem;
  padding: 0.625rem 0.25rem;
  border-bottom: 1px solid var(--border-suave);
  transition: background 0.15s;
}
.renglon:hover { background: var(--hover); }
.renglones > .renglon:last-child { border-bottom: 0; }
.renglon .nombre { overflow: hidden; font-size: 0.875rem; text-overflow: ellipsis; white-space: nowrap; }
.renglon .moneda { color: var(--muted); font-size: 0.6875rem; text-align: right; }
.renglon .principal { font-family: var(--mono); font-size: 0.875rem; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.renglon .secundario { color: var(--muted); font-family: var(--mono); font-size: 0.75rem; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.renglon .estado { color: var(--muted); font-size: 0.6875rem; text-align: right; }
.renglon .compras { grid-column: 2 / -1; margin-top: 0.125rem; color: var(--muted); font-size: 0.6875rem; }
.marca { color: var(--proyectado); font-family: var(--sans); font-size: 0.6875rem; font-style: normal; }
.estado-punto { align-self: center; width: 0.625rem; height: 0.625rem; border: 1px solid color-mix(in srgb, var(--fg) 30%, transparent); border-radius: 999px; }
.pagado .estado-punto { border-color: var(--pagado); background: var(--pagado); }
.impago .estado { color: var(--impago); }
.proyectado .estado-punto { border-style: dashed; border-color: var(--proyectado); }
.proyectado .estado { color: var(--proyectado); }
.proyectado .nombre, .proyectado .principal { color: var(--muted); font-style: italic; }
.renglon.resumen { grid-template-columns: 0.5rem minmax(0, 1fr) 11rem 16.75rem; }
.renglon.resumen .punto { align-self: center; }
.renglon.resumen a.nombre:hover { color: var(--accent); }

.pie { margin-top: 0.25rem; padding-top: 0.5rem; border-top: 1px solid var(--border); }
.pie div {
  display: grid; grid-template-columns: minmax(0, 1fr) 11rem 16.75rem; gap: 0 0.75rem;
  padding: 0.25rem 0.25rem 0.25rem 1.625rem;
  color: var(--muted); font-size: 0.75rem;
}
.pie dd { font-family: var(--mono); font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.pie .total { color: var(--fg); font-size: 0.875rem; font-weight: 600; }
.pie .aviso { display: block; }
.sin-gastos { padding: 1.5rem 0.25rem; }
.sin-anotar { margin-top: 0.75rem; padding: 0 0.25rem; }
.rotulo { margin-bottom: 0.5rem; color: var(--muted); font-size: 0.75rem; font-weight: 500; letter-spacing: 0.05em; text-transform: uppercase; }
.vacio {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.75rem;
  height: 16rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radio-card); color: var(--muted);
}
.vacio a { color: var(--accent); font-size: 0.875rem; font-weight: 500; }

/* Teléfono: sin la moneda ni el equivalente, y los montos más angostos. */
@media (width < 40rem) {
  .renglon { grid-template-columns: 0.625rem minmax(0, 1fr) auto 4.5rem; }
  .renglon .moneda, .renglon .secundario { display: none; }
  .renglon.resumen { grid-template-columns: 0.5rem minmax(0, 1fr) auto; }
  .pie div { grid-template-columns: minmax(0, 1fr) auto 4.5rem; }
  .cifras { gap: 0.5rem 1.25rem; }
  .cifra dd { font-size: 1rem; }
  .mes h2 { min-width: 0; }
}

/* ──── Σ Totales: tabla cruzada y charts ──── */
.totales { display: flex; flex-direction: column; gap: 1rem; }
.caja { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radio-card); padding: 1rem; }
.tabla-caja { padding: 0; overflow-x: auto; }
.cruzada { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.cruzada th, .cruzada td { padding: 0.5rem 1rem; border-bottom: 1px solid var(--border-suave); white-space: nowrap; }
.cruzada thead th { color: var(--muted); font-size: 0.75rem; font-weight: 500; border-bottom-color: var(--border); }
.cruzada th { text-align: left; font-weight: 400; }
.cruzada th[scope="row"] { position: sticky; left: 0; background: var(--surface); }
.cruzada .numero { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.cruzada thead .numero { font-family: var(--sans); }
.cruzada .suma { font-weight: 600; }
.cruzada tbody tr:hover td, .cruzada tbody tr:hover th { background: var(--hover); }
.cruzada tfoot th, .cruzada tfoot td { border-top: 1px solid var(--border); border-bottom: 0; font-weight: 600; }
.cruzada tfoot .suma { color: var(--accent); }

.charts { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr)); }
.chart { display: flex; flex-direction: column; gap: 0.75rem; min-height: 15rem; }
.chart .rotulo { margin: 0; }
.leyenda-vacia { margin: auto; }

/* El texto de los charts va en tinta; el color lo lleva la marca de al lado. */
.lista-chart { display: flex; flex-direction: column; gap: 0.375rem; flex: 1; min-width: 0; font-size: 0.8125rem; }
.lista-chart li { display: grid; grid-template-columns: 0.5rem minmax(0, 1fr) auto 2.75rem; align-items: baseline; gap: 0.5rem; }
.lista-chart .punto { align-self: center; }
.lista-chart .nombre { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lista-chart .valor, .lista-chart .pct { font-family: var(--mono); font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.lista-chart .pct { color: var(--muted); font-size: 0.75rem; }
.punto.pagado, .tramo.pagado { background: var(--pagado); }
.punto.impago, .tramo.impago { background: var(--impago); }
.punto.proyectado, .tramo.proyectado { background: var(--proyectado); }

.dona-y-lista { display: flex; flex-wrap: wrap; align-items: center; gap: 1.25rem; }
.dona { width: 9rem; height: 9rem; flex-shrink: 0; }
.dona circle { fill: none; stroke-width: 5; transition: stroke-width 0.15s; }
.dona circle:hover { stroke-width: 6.5; }

.apilada { display: flex; gap: 2px; height: 1.5rem; }
.tramo { min-width: 3px; border-radius: 4px; transition: opacity 0.15s; }

.barras-h { display: flex; flex-direction: column; gap: 0.625rem; font-size: 0.8125rem; }
.barras-h li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.25rem 0.75rem; }
.barras-h .nombre { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.barras-h .valor { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.riel { grid-column: 1 / -1; height: 0.375rem; }
.barra-h { display: block; height: 100%; min-width: 3px; border-radius: 0 4px 4px 0; background: var(--accent); }

.barras-v { display: flex; align-items: stretch; gap: 2px; flex: 1; min-height: 10rem; }
.barras-v li { position: relative; display: flex; flex: 1; flex-direction: column; gap: 0.375rem; min-width: 0; outline: 0; }
.barras-v .columna { display: flex; flex: 1; align-items: flex-end; border-bottom: 1px solid var(--border); }
.barra-v { width: 100%; min-height: 2px; border-radius: 4px 4px 0 0; background: color-mix(in srgb, var(--accent) 45%, transparent); transition: background 0.15s; }
.barras-v .actual .barra-v, .barras-v li:hover .barra-v, .barras-v li:focus-visible .barra-v { background: var(--accent); }
.barras-v .incompleto .barra-v { height: 100% !important; background: repeating-linear-gradient(135deg, var(--border) 0 4px, transparent 4px 8px); }
.barras-v .etiqueta { color: var(--muted); font-size: 0.6875rem; text-align: center; }
.barras-v .actual .etiqueta { color: var(--fg); font-weight: 500; }
.globo {
  position: absolute; bottom: calc(100% + 0.25rem); left: 50%; z-index: 3; transform: translateX(-50%);
  padding: 0.25rem 0.5rem; background: var(--fg); color: var(--bg); border-radius: 0.375rem;
  font-size: 0.75rem; white-space: nowrap; pointer-events: none; opacity: 0; transition: opacity 0.1s;
}
.barras-v li:hover .globo, .barras-v li:focus-visible .globo { opacity: 1; }
.barras-v li:first-child .globo, .barras-v li:nth-child(2) .globo { left: 0; transform: none; }
.barras-v li:last-child .globo, .barras-v li:nth-last-child(2) .globo { left: auto; right: 0; transform: none; }

/* ──── Menú: un panel que entra desde la derecha ──── */
button { font: inherit; color: inherit; cursor: pointer; }
.boton { display: inline-flex; align-items: center; gap: 0.5rem; background: transparent; }
.boton svg { width: 1rem; height: 1rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
button.flecha { border: 0; background: transparent; }
#menu {
  inset: 0 0 0 auto; width: min(20rem, 88vw); height: 100dvh; max-height: none; margin: 0; padding: 1.25rem;
  background: var(--surface); color: var(--fg); border: 0; border-left: 1px solid var(--border);
  box-shadow: -1rem 0 3rem rgba(0, 0, 0, 0.25); overflow-y: auto;
}
#menu:popover-open { display: flex; flex-direction: column; gap: 0.125rem; }
#menu::backdrop { background: rgba(2, 6, 23, 0.55); }
@media (prefers-reduced-motion: no-preference) {
  #menu { transition: translate 0.2s ease-out, display 0.2s allow-discrete, overlay 0.2s allow-discrete; translate: 100% 0; }
  #menu:popover-open { translate: 0 0; }
  @starting-style { #menu:popover-open { translate: 100% 0; } }
}
.menu-cabeza { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.5rem; font-size: 1.125rem; }
#menu .rotulo { margin: 1rem 0 0.25rem; padding: 0 0.75rem; }
#menu a, #menu .salir button {
  display: block; width: 100%; padding: 0.5rem 0.75rem; border: 0; border-radius: var(--radio-boton);
  background: transparent; font-size: 0.9375rem; text-align: left; transition: background 0.15s;
}
#menu a:hover, #menu .salir button:hover { background: var(--hover); }
#menu .salir { margin-top: auto; padding-top: 1rem; border-top: 1px solid var(--border); }
#menu .salir button { color: var(--muted); }

/* ──── Editar: el círculo de pagado, el renglón que abre el panel y el panel ──── */
.marcar { display: contents; }
button.estado-punto { padding: 0; background: transparent; transition: transform 0.15s, border-color 0.15s; }
button.estado-punto:hover { transform: scale(1.3); border-color: var(--pagado); }
.pagado button.estado-punto { background: var(--pagado); }
.abrir { grid-column: 2 / -1; display: grid; grid-template-columns: subgrid; align-items: baseline; }
.abrir .compras { grid-column: 1 / -1; }

.sumar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin-top: 1rem; padding: 0 0.25rem; color: var(--muted); font-size: 0.75rem; }
input, select {
  padding: 0.4375rem 0.625rem; background: var(--bg); color: var(--fg);
  border: 1px solid var(--border); border-radius: var(--radio-boton); font: inherit; font-size: 0.875rem;
}
input:focus-visible, select:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.sumar select, .sumar button { padding: 0.25rem 0.625rem; font-size: 0.75rem; }
.sumar select { border-style: dashed; }
.sumar button, .campos button, .compra button {
  padding: 0.4375rem 0.75rem; background: transparent; border: 1px solid var(--border); border-radius: var(--radio-boton); font-size: 0.8125rem; font-weight: 500;
}
.sumar button:hover, .campos button:hover, .compra button:hover { background: var(--hover); }

.mensajes { display: flex; flex-direction: column; gap: 0.375rem; }
.mensaje { padding: 0.5rem 0.75rem; background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--muted); border-radius: var(--radio-boton); font-size: 0.875rem; }
.mensaje.error { border-left-color: var(--impago); }
.mensaje.warning { border-left-color: var(--proyectado); }

.telon { position: fixed; inset: 0; z-index: 10; background: rgba(2, 6, 23, 0.55); }
.panel {
  position: fixed; inset: 0 0 0 auto; z-index: 11; display: flex; flex-direction: column; gap: 1.25rem;
  width: min(28rem, 100vw); padding: 1.25rem; overflow-y: auto;
  background: var(--surface); border-left: 1px solid var(--border); box-shadow: -1rem 0 3rem rgba(0, 0, 0, 0.25);
}
.panel > header { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.panel h2 { font-size: 1.125rem; font-weight: 600; }
.panel section { display: flex; flex-direction: column; gap: 0.75rem; }
.nota { padding: 0.5rem 0.75rem; border-left: 3px solid var(--proyectado); background: var(--hover); border-radius: 0.25rem; font-size: 0.8125rem; }
.campos { display: flex; flex-direction: column; gap: 0.75rem; }
.campos label { display: flex; flex-direction: column; gap: 0.25rem; color: var(--muted); font-size: 0.75rem; }
.campos input[name="monto"], .campos input[name="cotizacion"] { font-family: var(--mono); font-size: 1.125rem; }
.campos label.tilde { flex-direction: row; align-items: center; gap: 0.5rem; color: var(--fg); font-size: 0.875rem; }
.tilde input { width: 1rem; height: 1rem; accent-color: var(--pagado); }
.campos .principal-boton { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.campos .principal-boton:hover { background: var(--accent); opacity: 0.9; }
.falta { margin-top: 0.5rem; padding-top: 0.75rem; border-top: 1px solid var(--border); }

.compras-lista { display: flex; flex-direction: column; gap: 0.5rem; }
.compras-lista li { display: flex; align-items: center; gap: 0.25rem; }
.compra { display: grid; flex: 1; grid-template-columns: 7.75rem minmax(0, 1fr) 5.5rem auto; gap: 0.25rem; min-width: 0; }
.compra input { min-width: 0; padding: 0.3125rem 0.4375rem; font-size: 0.75rem; }
.compra input[name="monto"] { font-family: var(--mono); text-align: right; }
.compra button { padding: 0.3125rem 0.5rem; font-size: 0.6875rem; }
.quitar { display: grid; place-items: center; padding: 0.25rem; background: transparent; border: 0; border-radius: 0.25rem; color: var(--muted); }
.quitar:hover { color: var(--impago); }
.quitar svg { width: 0.875rem; height: 0.875rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.total-panel { display: flex; justify-content: space-between; padding-top: 0.5rem; border-top: 1px solid var(--border); font-size: 0.875rem; }
.total-panel strong { font-family: var(--mono); font-variant-numeric: tabular-nums; }

.borrar { margin-top: auto; padding-top: 1rem; border-top: 1px solid var(--border); font-size: 0.8125rem; }
.borrar summary { color: var(--muted); cursor: pointer; }
.borrar form { display: flex; flex-direction: column; gap: 0.5rem; margin-top: 0.75rem; }
.peligro { padding: 0.5rem 0.75rem; background: transparent; border: 1px solid var(--impago); border-radius: var(--radio-boton); color: var(--impago); font-size: 0.8125rem; font-weight: 500; text-align: left; }
.peligro:hover { background: color-mix(in srgb, var(--impago) 12%, transparent); }
@media (width < 40rem) { .compra { grid-template-columns: minmax(0, 1fr) 5rem; } .abrir { grid-template-columns: subgrid; } }

/* En Mix un total va por moneda, y debajo su equivalente en una sola. */
.cifra dd { font-size: 1.125rem; }
.equivale { color: var(--muted); font-family: var(--mono); font-size: 0.75rem; font-variant-numeric: tabular-nums; font-weight: 400; white-space: nowrap; }
.pie .equivale { display: block; }
.pie div { grid-template-columns: minmax(0, 1fr) minmax(11rem, auto) 16.75rem; }

/* ──── Administrar: gastos y orígenes ──── */
.boton.acento { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.boton.acento:hover { background: var(--accent); opacity: 0.9; }
.barra form { display: contents; }
.barra button { padding: 0.125rem 0.375rem; background: transparent; border: 0; border-radius: 0.25rem; color: var(--muted); font-size: 0.75rem; }
.barra button:hover { color: var(--fg); }
.barra .separador { margin: 0 0.25rem; color: var(--border); font-style: normal; }
.ayuda { margin: 0.75rem 0.25rem; font-size: 0.75rem; }
[data-ordenable] [data-id] { cursor: grab; }
.llevado { opacity: 0.4; }

.ficha { display: flex; flex: 1; flex-wrap: wrap; align-items: flex-end; gap: 0.5rem 0.75rem; min-width: 0; }
.ficha label { display: flex; flex-direction: column; gap: 0.25rem; color: var(--muted); font-size: 0.6875rem; }
.ficha label.ancho { flex: 1; min-width: 12rem; }
.ficha label.tilde { flex-direction: row; align-items: center; gap: 0.375rem; padding-bottom: 0.5rem; color: var(--fg); font-size: 0.8125rem; }
.ficha input[type="color"] { width: 3rem; height: 2.125rem; padding: 0.125rem; }
.ficha button, .botones button {
  padding: 0.4375rem 0.75rem; background: transparent; border: 1px solid var(--border); border-radius: var(--radio-boton); font-size: 0.8125rem; font-weight: 500;
}
.ficha button:hover, .botones button:hover { background: var(--hover); }
.ficha .principal-boton { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.caja .ficha + .apagado { margin-top: 0.75rem; font-size: 0.75rem; }
.caja > .rotulo { margin-bottom: 0.75rem; }
.catalogo { display: flex; flex-direction: column; }
.catalogo li { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0.5rem 0.75rem; padding: 0.75rem 0.25rem; border-bottom: 1px solid var(--border-suave); }
.catalogo li:target { background: var(--hover); border-radius: var(--radio-boton); }
.catalogo .agarre { align-self: center; color: var(--muted); cursor: grab; }
.catalogo .punto { align-self: center; width: 0.75rem; height: 0.75rem; }
.botones { display: flex; align-items: flex-end; gap: 0.375rem; }
.botones > form > button { padding: 0.4375rem 0.625rem; }
.quitar-del-catalogo { position: relative; font-size: 0.8125rem; }
.quitar-del-catalogo summary { padding: 0.4375rem 0.625rem; color: var(--muted); cursor: pointer; list-style: none; }
.quitar-del-catalogo summary:hover { color: var(--impago); }
.quitar-del-catalogo form { position: absolute; right: 0; z-index: 4; margin-top: 0.25rem; padding: 0.5rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radio-boton); box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.25); white-space: nowrap; }
.botones .peligro { border-color: var(--impago); }

/* ──── Entrada, cotizaciones, historial y ajustes ──── */
.entrada main { align-items: center; justify-content: center; }
.entrada form { width: min(22rem, 100%); padding: 1.5rem; }
.entrada h1 { font-size: 1.25rem; font-weight: 600; }
.entrada input { font-size: 1rem; }
.angosta { max-width: 32rem; }
.caja .campos .apagado { margin-top: -0.375rem; font-size: 0.75rem; }
.listado li { display: flex; align-items: baseline; gap: 1.5rem; padding: 0.5rem 0.25rem; border-bottom: 1px solid var(--border-suave); font-size: 0.875rem; }
.listado li > span:first-child, .listado time { flex-shrink: 0; width: 9rem; color: var(--muted); font-family: var(--mono); font-size: 0.8125rem; font-variant-numeric: tabular-nums; }
.listado .principal { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.historial .texto { flex: 1; min-width: 0; }
.historial .estado { flex-shrink: 0; width: 5rem; color: var(--proyectado); font-size: 0.6875rem; text-align: right; }
.historial .deshecha .texto { color: var(--muted); text-decoration: line-through; }
.paginas { display: flex; align-items: center; justify-content: center; gap: 1rem; margin-top: 1rem; }
@media (width < 40rem) { .listado li { flex-wrap: wrap; gap: 0.25rem 1rem; } }
