/* =========================================================================
   app.css · APP_CREDITO. Pensada para el móvil; en el PC se ve como una
   columna del ancho de un teléfono.
   Sin estilos en línea: la CSP solo permite esta hoja.
   ========================================================================= */
:root {
  --bg: #f2f3f7;
  --fuera: #e4e7ee;
  --panel: #ffffff;
  --panel-2: #f7f8fa;
  --borde: #dfe3e9;
  --borde-suave: #eceef2;
  --texto: #111827;
  --tenue: #6b7280;
  --primario: #2563eb;
  --primario-pulsado: #1d4ed8;
  --primario-suave: #dbe6fd;
  --sobre-primario: #ffffff;
  --peligro: #dc2626;
  --peligro-suave: #fee2e2;
  --ok: #15803d;
  --ok-suave: #dcfce7;
  --aviso: #b45309;
  --aviso-suave: #fef3c7;
  --neutro-suave: #eef0f4;
  --sombra: 0 1px 2px rgba(15, 23, 42, .04), 0 2px 8px rgba(15, 23, 42, .06);
  --fondo-modal: rgba(15, 23, 42, .45);
  --tc-1: #1e3a8a;
  --tc-2: #2563eb;
  --tc-3: #4f8cf7;
  --radio: 16px;
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --sar: env(safe-area-inset-right, 0px);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1220;
    --fuera: #060a13;
    --panel: #141d2f;
    --panel-2: #1a2438;
    --borde: #27344d;
    --borde-suave: #1e293d;
    --texto: #e8ecf2;
    --tenue: #94a3b8;
    --primario: #60a5fa;
    --primario-pulsado: #3b82f6;
    --primario-suave: #1c3159;
    --sobre-primario: #0b1220;
    --peligro: #f87171;
    --peligro-suave: #3f1717;
    --ok: #4ade80;
    --ok-suave: #14361f;
    --aviso: #fbbf24;
    --aviso-suave: #3d2e0a;
    --neutro-suave: #1e293d;
    --sombra: none;
    --fondo-modal: rgba(0, 0, 0, .6);
    --tc-1: #172554;
    --tc-2: #1d4ed8;
    --tc-3: #3b6fd8;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b1220;
  --fuera: #060a13;
  --panel: #141d2f;
  --panel-2: #1a2438;
  --borde: #27344d;
  --borde-suave: #1e293d;
  --texto: #e8ecf2;
  --tenue: #94a3b8;
  --primario: #60a5fa;
  --primario-pulsado: #3b82f6;
  --primario-suave: #1c3159;
  --sobre-primario: #0b1220;
  --peligro: #f87171;
  --peligro-suave: #3f1717;
  --ok: #4ade80;
  --ok-suave: #14361f;
  --aviso: #fbbf24;
  --aviso-suave: #3d2e0a;
  --neutro-suave: #1e293d;
  --sombra: none;
  --fondo-modal: rgba(0, 0, 0, .6);
  --tc-1: #172554;
  --tc-2: #1d4ed8;
  --tc-3: #3b6fd8;
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  background: var(--fuera);
  color: var(--texto);
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2 { margin: 0; }
h2 { font-size: 17px; }
p { margin: 0 0 8px; }
code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .86em; overflow-wrap: anywhere; }
.tenue { color: var(--tenue); }
.pequeno { font-size: 14px; }
.centrado-texto { text-align: center; }
.error-texto { color: var(--peligro); }
.ok-texto { color: var(--ok); }
.aviso-texto { color: var(--aviso); }
:focus-visible { outline: 3px solid var(--primario); outline-offset: 2px; }
.icono { width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icono.mini { width: 16px; height: 16px; vertical-align: -3px; }

/* En el simulador del PC, sin barras de desplazamiento (el iPhone no las enseña) */
.sim .contenido { scrollbar-width: none; }
.sim .contenido::-webkit-scrollbar { display: none; }

/* ---------- Estructura ---------- */
.app {
  height: 100%;
  max-width: 520px;
  margin: 0 auto;
  background: var(--bg);
  position: relative;
}
@media (min-width: 560px) {
  .app { box-shadow: 0 0 0 1px var(--borde), 0 10px 40px rgba(15, 23, 42, .12); }
}
.pantalla { height: 100%; display: flex; flex-direction: column; }
.contenido {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 6px calc(16px + var(--sar)) calc(28px + var(--sab)) calc(16px + var(--sal));
}
.pantalla.con-barra .contenido { padding-bottom: 28px; }
.pantalla.sin-cabecera .contenido { padding-top: calc(var(--sat) + 16px); }

.cabecera {
  flex: none;
  background: var(--bg);
  padding: calc(var(--sat) + 10px) calc(16px + var(--sar)) 8px calc(16px + var(--sal));
}
.cabecera-fila { display: flex; align-items: center; gap: 8px; min-height: 40px; position: relative; }
.cabecera h1 { font-size: 28px; font-weight: 750; letter-spacing: -.02em; flex: 1; min-width: 0; }
.cabecera h1.titulo-centro {
  position: absolute; left: 90px; right: 90px; text-align: center; font-size: 17px; font-weight: 650;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none;
}
.cabecera-derecha { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.atras {
  display: inline-flex; align-items: center; gap: 2px; border: 0; background: none; color: var(--primario);
  padding: 8px 8px 8px 0; margin-left: -4px; font-size: 17px; z-index: 1;
}
.atras .icono { width: 24px; height: 24px; }

/* Píldora de estado de Dropbox */
.pildora {
  display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--borde); background: var(--panel);
  border-radius: 999px; padding: 5px 11px 5px 9px; font-size: 13px; font-weight: 600; color: var(--tenue); white-space: nowrap;
}
.pildora.ok { color: var(--ok); }
.pildora.aviso { color: var(--aviso); border-color: var(--aviso); background: var(--aviso-suave); }
.pildora.mal { color: #fff; background: var(--peligro); border-color: var(--peligro); }
.pildora.prueba { color: var(--aviso); background: var(--aviso-suave); border-color: transparent; padding-left: 11px; }
.girando {
  width: 13px; height: 13px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent;
  display: inline-block; animation: girar .8s linear infinite; flex: none;
}
@keyframes girar { to { transform: rotate(360deg); } }

/* Barra de pestañas */
.barra {
  flex: none; display: flex; align-items: flex-end; justify-content: space-around;
  background: var(--panel); border-top: 1px solid var(--borde-suave);
  padding: 4px calc(6px + var(--sar)) calc(var(--sab) + 4px) calc(6px + var(--sal));
}
.pestana {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; border: 0; background: none;
  color: var(--tenue); font-size: 11px; font-weight: 600; padding: 6px 0 4px; min-width: 0;
}
.pestana .icono { width: 25px; height: 25px; }
.pestana.on { color: var(--primario); }
.barra-mas {
  flex: none; width: 54px; height: 54px; border-radius: 18px; border: 0; margin: -18px 6px 4px;
  background: var(--primario); color: var(--sobre-primario); display: grid; place-items: center;
  box-shadow: 0 6px 16px rgba(37, 99, 235, .35);
}
.barra-mas .icono { width: 28px; height: 28px; stroke-width: 2.4; }
.barra-mas:active { transform: scale(.96); background: var(--primario-pulsado); }

/* ---------- Botones ---------- */
.boton {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: 12px; border: 1px solid transparent;
  padding: 12px 16px; font-weight: 600; text-decoration: none; min-height: 46px; text-align: center;
}
.boton.primario { background: var(--primario); color: var(--sobre-primario); }
.boton.primario:active { background: var(--primario-pulsado); }
.boton.secundario { background: var(--panel); color: var(--texto); border-color: var(--borde); }
.boton.secundario .icono { color: var(--primario); }
.boton.peligro { background: var(--peligro); color: #fff; }
.boton.peligro-suave { background: var(--peligro-suave); color: var(--peligro); }
.boton.pequeno { min-height: 36px; padding: 7px 12px; font-size: 14px; border-radius: 10px; }
.boton.grande { width: 100%; min-height: 54px; font-size: 17px; border-radius: 14px; }
.boton:disabled { opacity: .5; cursor: default; }
.enlace { border: 0; background: none; color: var(--primario); font-weight: 600; font-size: 14px; padding: 4px 0; display: inline-flex; align-items: center; gap: 2px; }
.botones-col { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.botones-col .boton { width: 100%; justify-content: flex-start; }
.botones-col .boton.primario { justify-content: center; }

/* ---------- Avisos ---------- */
.aviso {
  background: var(--aviso-suave); color: var(--texto); border-radius: 12px; padding: 12px 14px; margin: 4px 0 12px;
  font-size: 14px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px;
}
.aviso .boton { margin-left: auto; }
.aviso.ok { background: var(--ok-suave); }
.aviso.mal { background: var(--peligro-suave); }

/* ---------- Tarjeta de crédito (Inicio) ---------- */
.tarjeta-credito {
  position: relative; overflow: hidden; color: #fff; border-radius: 22px; padding: 18px 20px 16px; margin: 6px 0 14px;
  background: linear-gradient(135deg, var(--tc-1) 0%, var(--tc-2) 58%, var(--tc-3) 100%);
  box-shadow: 0 10px 28px rgba(30, 58, 138, .28);
}
.tarjeta-credito::after {
  content: ""; position: absolute; width: 260px; height: 260px; right: -90px; top: -120px; border-radius: 50%;
  background: rgba(255, 255, 255, .08); pointer-events: none;
}
.tc-fila { display: flex; align-items: center; justify-content: space-between; gap: 10px; position: relative; z-index: 1; }
.tc-nombre { font-weight: 650; font-size: 15px; opacity: .92; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tc-chip { width: 36px; height: 26px; border-radius: 6px; background: linear-gradient(135deg, #f8e29b, #d4a73c); opacity: .92; flex: none; }
.tc-etiqueta { margin-top: 16px; font-size: 14px; opacity: .85; }
.tc-importe { font-size: 38px; font-weight: 760; letter-spacing: -.02em; line-height: 1.15; margin-bottom: 10px; font-variant-numeric: tabular-nums; }
.tc-pie { font-size: 13px; opacity: .9; margin-top: 6px; }
.tc-abajo { margin-top: 14px; align-items: flex-end; }
.tc-abajo span { display: flex; flex-direction: column; }
.tc-abajo span.derecha { text-align: right; align-items: flex-end; }
.tc-abajo small { font-size: 12px; opacity: .8; }
.tc-abajo b { font-size: 16px; }
.tc-limite { margin-top: 10px; position: relative; z-index: 1; }
.tc-limite small { font-size: 12px; opacity: .8; display: block; margin-top: 4px; }

/* ---------- Barras de progreso ---------- */
.progreso { height: 8px; background: var(--neutro-suave); border-radius: 99px; overflow: hidden; }
.progreso > div { height: 100%; width: 0; background: var(--primario); border-radius: 99px; }
.progreso.fino { height: 5px; }
.progreso.claro { background: rgba(255, 255, 255, .22); position: relative; z-index: 1; }
.progreso.claro > div { background: #fff; }

/* ---------- Paneles ---------- */
.panel { background: var(--panel); border-radius: var(--radio); padding: 14px 16px; margin-bottom: 14px; box-shadow: var(--sombra); }
.panel > h2 { margin-bottom: 10px; }
.panel-cab { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.panel-cab h2 { margin-bottom: 2px; }
.panel-total { font-size: 20px; white-space: nowrap; font-variant-numeric: tabular-nums; }

.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }
.tile {
  text-align: left; border: 0; background: var(--panel); border-radius: var(--radio); padding: 12px 14px; box-shadow: var(--sombra);
  display: flex; flex-direction: column; gap: 2px; min-width: 0;
}
.tile small { color: var(--tenue); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile b { font-size: 20px; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Cargos (líneas con emoji o día) */
.lista-cargos { display: flex; flex-direction: column; }
.cargo {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; border: 0; background: none;
  padding: 9px 0; border-top: 1px solid var(--borde-suave);
}
.lista-cargos .cargo:first-child { border-top: 0; }
.cargo-texto { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.cargo-concepto { font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cargo-texto small { color: var(--tenue); font-size: 13px; }
.cargo-importe { font-weight: 650; white-space: nowrap; font-variant-numeric: tabular-nums; display: inline-flex; align-items: center; gap: 4px; }
.cargo.pagado .cargo-concepto, .cargo.pagado .cargo-importe { color: var(--tenue); }
.cargo-dia {
  flex: none; width: 40px; height: 40px; border-radius: 12px; background: var(--neutro-suave);
  display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.05;
}
.cargo-dia b { font-size: 16px; }
.cargo-dia small { font-size: 10px; color: var(--tenue); text-transform: uppercase; }
.ultima { color: var(--ok); font-weight: 600; }
.emoji {
  flex: none; width: 40px; height: 40px; border-radius: 12px; background: var(--neutro-suave);
  display: grid; place-items: center; font-size: 21px; line-height: 1;
}
.emoji.grande { width: 64px; height: 64px; font-size: 34px; border-radius: 20px; }

/* Gráfica de 12 meses */
.grafica { display: grid; grid-template-columns: repeat(12, 1fr); gap: 3px; margin-top: 4px; }
.col { display: flex; flex-direction: column; align-items: center; border: 0; background: none; padding: 0; min-width: 0; }
.col-valor { font-size: 10px; color: var(--tenue); height: 15px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.col-barra { height: 110px; width: 100%; display: flex; align-items: flex-end; justify-content: center; }
.col-barra > span { display: block; width: 72%; max-width: 22px; background: var(--primario-suave); border-radius: 6px 6px 3px 3px; }
.col.actual .col-barra > span { background: var(--primario); }
.col.actual .col-valor, .col.actual .col-mes { color: var(--primario); font-weight: 700; }
.col-mes { font-size: 11px; color: var(--tenue); margin-top: 4px; }

/* Categorías */
.cats { display: flex; flex-direction: column; gap: 8px; }
.cat-fila { display: grid; grid-template-columns: 32px 92px 1fr auto; align-items: center; gap: 10px; font-size: 14px; }
.cat-fila .emoji { width: 32px; height: 32px; font-size: 17px; border-radius: 10px; }
.cat-nombre { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cat-fila b { font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------- Compras ---------- */
.segmentos { display: flex; background: var(--neutro-suave); border-radius: 12px; padding: 3px; margin: 4px 0 12px; gap: 2px; }
.segmentos button {
  flex: 1; border: 0; background: none; border-radius: 9px; padding: 8px 4px; font-size: 14px; font-weight: 600; color: var(--tenue);
}
.segmentos button.on { background: var(--panel); color: var(--texto); box-shadow: 0 1px 3px rgba(15, 23, 42, .12); }
.contador { font-size: 12px; color: var(--tenue); font-weight: 600; }
.buscador {
  display: flex; align-items: center; gap: 8px; background: var(--panel); border: 1px solid var(--borde); border-radius: 12px;
  padding: 0 12px; margin-bottom: 12px; color: var(--tenue);
}
.buscador input { flex: 1; border: 0; background: none; padding: 11px 0; outline: none; min-width: 0; color: var(--texto); }
.lista { background: var(--panel); border-radius: var(--radio); box-shadow: var(--sombra); overflow: hidden; }
.compra {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; border: 0; background: none;
  padding: 12px 14px; border-top: 1px solid var(--borde-suave);
}
.lista > :first-child { border-top: 0; }
.compra:active, .cargo:active, .mes-cab:active { background: var(--panel-2); }
.compra-texto { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.compra-concepto { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.compra-texto small { color: var(--tenue); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.compra-progreso { display: flex; align-items: center; gap: 8px; margin-top: 3px; }
.compra-progreso .progreso { flex: 1; }
.compra-progreso small { font-size: 12px; flex: none; }
.compra-derecha { display: flex; flex-direction: column; align-items: flex-end; flex: none; }
.compra-derecha b { font-variant-numeric: tabular-nums; }
.compra-derecha small { color: var(--tenue); font-size: 12px; }
.compra.terminada .compra-concepto { color: var(--tenue); }
.pie-lista { text-align: center; margin-top: 12px; }

/* ---------- Meses ---------- */
.fila-opciones { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 4px 0 6px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--borde); background: var(--panel); border-radius: 999px; padding: 7px 13px; font-size: 14px; font-weight: 550;
  white-space: nowrap;
}
.chip.on { background: var(--primario); border-color: var(--primario); color: var(--sobre-primario); }
.anio-cab { display: flex; align-items: baseline; justify-content: space-between; margin: 16px 2px 8px; }
.anio-cab h2 { font-size: 20px; }
.lista-meses { background: var(--panel); border-radius: var(--radio); box-shadow: var(--sombra); overflow: hidden; }
.mes { border-top: 1px solid var(--borde-suave); }
.mes:first-child { border-top: 0; }
.mes-cab {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; border: 0; background: none; padding: 12px 14px;
}
.mes-nombre { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.mes-nombre > span { display: flex; align-items: center; flex-wrap: wrap; }
.mes-nombre small { color: var(--tenue); font-size: 13px; }
.mes-derecha { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; width: 104px; flex: none; }
.mes-derecha b { font-variant-numeric: tabular-nums; }
.mes-derecha .progreso { width: 100%; }
.mes .flecha { color: var(--tenue); transition: transform .15s; width: 18px; height: 18px; }
.mes.abierto .flecha { transform: rotate(180deg); }
.mes.actual { box-shadow: inset 3px 0 0 var(--primario); }
.mes.pasado .mes-nombre b, .mes.pasado .mes-derecha b { color: var(--tenue); }
.mes .lista-cargos { padding: 0 14px 6px; background: var(--panel-2); }
.mes .cargo { border-top-color: var(--borde); }
.etiqueta {
  display: inline-block; margin-left: 8px; font-size: 11px; font-weight: 700; color: var(--primario); background: var(--primario-suave);
  border-radius: 6px; padding: 1px 6px; vertical-align: 2px; text-transform: uppercase; letter-spacing: .02em;
}

/* ---------- Detalle ---------- */
.detalle-cab { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 4px 0 14px; gap: 6px; }
.detalle-cab h2 { font-size: 24px; letter-spacing: -.01em; overflow-wrap: anywhere; }
.detalle-cab p { margin: 0; }
.datos { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.dato { background: var(--panel); border-radius: 14px; padding: 11px 13px; box-shadow: var(--sombra); display: flex; flex-direction: column; }
.dato small { color: var(--tenue); font-size: 13px; }
.dato b { font-size: 19px; font-variant-numeric: tabular-nums; }
.dato-destacado b { color: var(--primario); }
.dato-ok b { color: var(--ok); }
.dato-aviso b { color: var(--aviso); }
.dato .por-mes { font-size: 13px; color: var(--tenue); font-weight: 500; margin-left: 2px; }
.progreso-texto { margin: 8px 0 0; }
.plan { display: flex; flex-direction: column; margin-bottom: 8px; }
.plan-fila {
  display: grid; grid-template-columns: 30px 1fr auto 22px; align-items: center; gap: 8px; padding: 8px 0;
  border-top: 1px solid var(--borde-suave); font-variant-numeric: tabular-nums;
}
.plan-fila:first-child { border-top: 0; }
.plan-n { color: var(--tenue); font-size: 13px; text-align: center; }
.plan-fecha { display: flex; flex-direction: column; }
.plan-fecha small { font-size: 12px; color: var(--primario); font-weight: 600; }
.plan-importe { font-weight: 600; }
.plan-fila.pagado .plan-fecha, .plan-fila.pagado .plan-importe { color: var(--tenue); }
.plan-fila.proxima { background: var(--primario-suave); margin: 0 -10px; padding-left: 10px; padding-right: 10px; border-radius: 10px; border-top-color: transparent; }
.plan-fila.proxima + .plan-fila { border-top-color: transparent; }
.notas { white-space: normal; overflow-wrap: anywhere; margin: 0; }
.acciones { display: flex; flex-direction: column; gap: 10px; margin: 6px 0 14px; }
.acciones .boton { width: 100%; }

/* ---------- Formulario ---------- */
.formulario { padding-top: 4px; }
.campo { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.campo > span:first-child { font-size: 14px; font-weight: 600; color: var(--tenue); }
.campo > small { font-size: 13px; }
.campo input, .campo textarea, .modal input {
  width: 100%; border: 1px solid var(--borde); background: var(--panel); border-radius: 12px; padding: 12px 13px;
  font-size: 17px; outline: none; min-height: 48px;
}
.campo textarea { resize: vertical; min-height: 80px; }
.campo input:focus, .campo textarea:focus, .modal input:focus, .fila-codigo input:focus { border-color: var(--primario); box-shadow: 0 0 0 3px var(--primario-suave); }
.campo input[type="date"] { -webkit-appearance: none; appearance: none; display: block; text-align: left; }
.con-sufijo { position: relative; display: block; }
.con-sufijo input { padding-right: 34px; }
.con-sufijo i { position: absolute; right: 13px; top: 50%; transform: translateY(-50%); font-style: normal; color: var(--tenue); pointer-events: none; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-num { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--borde); background: var(--panel); border-radius: 999px; padding: 0 12px 0 4px; }
.chip-num input { width: 54px; border: 0; background: none; text-align: center; padding: 7px 0; font-size: 16px; font-weight: 650; outline: none; min-height: 0; }
.chip-num small { color: var(--tenue); font-size: 13px; }
.categorias .chip { font-size: 14px; padding: 7px 11px; }
.mas-opciones { margin: 4px 0 16px; }
.mas-opciones summary {
  list-style: none; cursor: pointer; color: var(--primario); font-weight: 600; padding: 8px 0 12px; display: flex; align-items: center; gap: 6px;
}
.mas-opciones summary::-webkit-details-marker { display: none; }
.mas-opciones summary .flecha { transition: transform .15s; }
.mas-opciones[open] summary .flecha { transform: rotate(90deg); }
.previa { background: var(--primario-suave); border-radius: 12px; padding: 12px 14px; font-size: 15px; line-height: 1.5; margin-bottom: 8px; }
.previa:empty { display: none; }
#form-error:empty, #ajustes-error:empty { display: none; }
.pantalla.es-form .contenido { padding-bottom: calc(28px + var(--sab)); }

/* ---------- Ajustes ---------- */
.fila-dato { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-top: 1px solid var(--borde-suave); font-size: 15px; }
.fila-dato:first-of-type { border-top: 0; }
.fila-dato > span:last-child { text-align: right; min-width: 0; overflow-wrap: anywhere; }
.panel .segmentos { margin: 0; }

/* ---------- Copias ---------- */
.copia { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-top: 1px solid var(--borde-suave); }
.copia-texto { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.copia-texto small { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cargando { display: flex; align-items: center; gap: 10px; color: var(--tenue); padding: 20px 0; justify-content: center; }

/* ---------- Vacíos, bienvenida y conexión ---------- */
.vacio { text-align: center; padding: 26px 18px; background: var(--panel); border-radius: var(--radio); box-shadow: var(--sombra); }
.vacio h2 { margin-bottom: 6px; }
.vacio .boton { margin-top: 8px; }
.vacio.pequeno-vacio { padding: 18px; }
.vacio.pequeno-vacio p { margin: 0; }
.vacio-emoji { font-size: 44px; margin-bottom: 6px; }

.bienvenida { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 8vh 6px 20px; gap: 10px; min-height: 100%; }
.bienvenida h1 { font-size: 34px; letter-spacing: -.02em; }
.bienvenida > p { max-width: 340px; }
.bienvenida .botones-col { width: 100%; max-width: 360px; margin: 18px 0 8px; }
.logo {
  width: 92px; height: 92px; border-radius: 26px; display: grid; place-items: center; margin-bottom: 8px;
  background: linear-gradient(135deg, var(--tc-1), var(--tc-2) 60%, var(--tc-3)); box-shadow: 0 12px 30px rgba(37, 99, 235, .3);
}
.logo span { width: 58px; height: 40px; border-radius: 8px; background: rgba(255, 255, 255, .95); position: relative; }
.logo span::before { content: ""; position: absolute; left: 0; right: 0; top: 9px; height: 7px; background: #1e3a8a; }
.logo span::after { content: ""; position: absolute; left: 8px; bottom: 7px; width: 16px; height: 5px; border-radius: 2px; background: #93b4f5; }

.conectar { padding-top: 6px; }
.pasos { padding: 0; margin: 0; list-style: none; counter-reset: paso; display: flex; flex-direction: column; gap: 14px; }
.pasos li {
  counter-increment: paso; background: var(--panel); border-radius: var(--radio); padding: 16px 16px 16px 56px; position: relative;
  display: flex; flex-direction: column; gap: 8px; box-shadow: var(--sombra);
}
.pasos li::before {
  content: counter(paso); position: absolute; left: 16px; top: 15px; width: 28px; height: 28px; border-radius: 50%;
  background: var(--primario); color: var(--sobre-primario); display: grid; place-items: center; font-weight: 700; font-size: 15px;
}
.pasos .boton { align-self: flex-start; }
.fila-codigo { display: flex; flex-wrap: wrap; gap: 8px; }
.fila-codigo input {
  flex: 1 1 100%; min-width: 0; border: 1px solid var(--borde); background: var(--panel-2); border-radius: 12px; padding: 11px 12px;
  font: 15px ui-monospace, Menlo, Consolas, monospace; outline: none; min-height: 46px;
}
.fila-codigo .boton { flex: 1; }

/* ---------- Diálogos ---------- */
.modal-fondo {
  position: fixed; inset: 0; background: var(--fondo-modal); display: flex; align-items: flex-end; justify-content: center; z-index: 50;
  animation: aparecer .15s ease-out;
}
.modal {
  background: var(--panel); width: 100%; max-width: 520px; border-radius: 22px 22px 0 0;
  padding: 20px calc(18px + var(--sar)) calc(18px + var(--sab)) calc(18px + var(--sal));
  animation: subir .2s ease-out; max-height: 90%; overflow-y: auto;
}
.modal h2 { font-size: 19px; margin-bottom: 8px; }
.modal p { color: var(--tenue); }
.modal .campo { margin: 12px 0; }
.modal-error:empty { display: none; }
.modal-botones { display: flex; gap: 10px; margin-top: 16px; }
.modal-botones .boton { flex: 1; }
@media (min-width: 560px) {
  .modal-fondo { align-items: center; }
  .modal { border-radius: 20px; max-width: 420px; }
}
@keyframes aparecer { from { opacity: 0; } }
@keyframes subir { from { transform: translateY(30px); opacity: .5; } }

/* ---------- Aviso flotante ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--sab) + 84px); transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  width: max-content; max-width: min(92vw, 460px); background: #111827; color: #fff; border-radius: 14px; padding: 11px 14px;
  font-size: 15px; display: flex; align-items: center; gap: 14px; z-index: 60; transition: opacity .2s, transform .2s;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .25);
}
.toast.visible { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast.error { background: #991b1b; }
.toast-accion { border: 0; background: none; color: #93c5fd; font-weight: 700; padding: 4px 2px; white-space: nowrap; }
:root[data-theme="dark"] .toast { background: #e5e7eb; color: #111827; }
:root[data-theme="dark"] .toast-accion { color: #1d4ed8; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .toast { background: #e5e7eb; color: #111827; }
  :root:not([data-theme="light"]) .toast-accion { color: #1d4ed8; }
}
.toast.error { background: #991b1b !important; color: #fff !important; }

/* Pantallas muy estrechas */
@media (max-width: 350px) {
  .tc-importe { font-size: 32px; }
  .tile b { font-size: 17px; }
  .cat-fila { grid-template-columns: 32px 70px 1fr auto; }
}
