/* ARCADO — hoja de estilos
   Marca: azul marino #051632 (el fondo del logo). Modo claro y oscuro segun el sistema.
   Adaptable: ordenador (menu lateral fijo), tableta y movil (menu desplegable,
   tablas del cuadrante y de la cartera convertidas en tarjetas). */

:root {
  --marca: #051632;
  --marca-2: #0c2552;
  --marca-3: #16336b;
  --marca-texto: #eaf0fb;
  --marca-suave: #9fb1d1;

  --fondo: #f3f5f9;
  --panel: #ffffff;
  --panel-2: #f7f9fc;
  --borde: #e2e7ef;
  --borde-fuerte: #cdd5e2;
  --texto: #0d1a2e;
  --suave: #5b6980;
  --tenue: #8894a8;
  --azul: #1f5fd6;
  --azul-fondo: #eaf1fe;
  --boton: #051632;
  --boton-texto: #ffffff;
  --verde: #0e7a4d;
  --rojo: #b42336;
  --ambar: #9a6100;
  --sombra: 0 1px 2px rgba(5, 22, 50, .05), 0 6px 18px rgba(5, 22, 50, .06);
  --radio: 12px;
  --lateral: 236px;

  /* graficos (colores validados: CVD y contraste sobre el panel) */
  --serie-1: #2a78d6; --serie-2: #eb6834; --serie-3: #1f9e89;
  --rejilla: #eceff4; --eje-base: #c9d0db; --eje-texto: #7b8699;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --fondo: #07101f;
    --panel: #0e1a2f;
    --panel-2: #122038;
    --borde: #1e2c46;
    --borde-fuerte: #2a3b5b;
    --texto: #e7edf7;
    --suave: #9aa9c2;
    --tenue: #75849e;
    --azul: #6b9dff;
    --azul-fondo: #13264a;
    --boton: #3a6fe0;
    --boton-texto: #ffffff;
    --verde: #45c98a;
    --rojo: #f27487;
    --ambar: #e6a93f;
    --sombra: none;
    --serie-1: #3987e5; --serie-2: #d95926; --serie-3: #2bb59c;
    --rejilla: #1a2740; --eje-base: #2c3c5a; --eje-texto: #8494ae;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--fondo); color: var(--texto);
  font: 15px/1.5 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--azul); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--azul); outline-offset: 2px; border-radius: 4px; }
h1 { font-size: 26px; line-height: 1.2; margin: 0; letter-spacing: -.015em; font-weight: 650; }
h2 { font-size: 12.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--suave);
     margin: 36px 0 12px; font-weight: 650; display: flex; align-items: center; gap: 8px; }
.sub { color: var(--suave); margin: 6px 0 0; font-size: 14px; }
.mini { color: var(--suave); font-size: 12.5px; }
.pequeno { font-size: 13px; }
code { background: var(--panel-2); border: 1px solid var(--borde); border-radius: 5px;
  padding: 1px 6px; font-size: 12.5px; }

/* --- Estructura ---------------------------------------------------------- */
.app { display: grid; grid-template-columns: var(--lateral) minmax(0, 1fr); min-height: 100vh; }
.principal { min-width: 0; display: flex; flex-direction: column; }
.contenido { width: 100%; max-width: 1440px; margin: 0 auto; padding: 32px 36px 96px; }

.lateral {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  background: var(--marca); color: var(--marca-texto);
  display: flex; flex-direction: column; padding: 22px 14px 18px;
  border-right: 1px solid rgba(255, 255, 255, .06);
}
.logo { display: flex; align-items: center; gap: 12px; color: #fff; padding: 4px 10px 26px; }
.logo:hover { text-decoration: none; }
.logo-marca { width: 46px; height: auto; flex: none; color: #fff; }
.logo-texto { font-weight: 600; font-size: 19px; letter-spacing: .16em; }
.menu { display: flex; flex-direction: column; gap: 3px; }
.menu a {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 9px;
  color: var(--marca-suave); font-weight: 520; font-size: 14.5px; min-height: 42px;
}
.menu a:hover { background: var(--marca-2); color: #fff; text-decoration: none; }
.menu a.act { background: var(--marca-3); color: #fff; box-shadow: inset 3px 0 0 #6b9dff; }
.ico { width: 19px; height: 19px; flex: none; }
.menu .insignia { margin-left: auto; }
.lateral-pie { margin-top: auto; padding-top: 18px; border-top: 1px solid rgba(255, 255, 255, .08);
  display: flex; flex-direction: column; gap: 10px; }
.fuente { display: flex; gap: 10px; align-items: flex-start; font-size: 12.5px; color: var(--marca-suave);
  padding: 4px 12px; line-height: 1.35; }
.fuente small { color: #e6a93f; }
.punto { width: 8px; height: 8px; border-radius: 50%; background: #e6a93f; margin-top: 5px; flex: none;
  box-shadow: 0 0 0 3px rgba(230, 169, 63, .18); }
button.salir { display: flex; align-items: center; gap: 12px; width: 100%; background: none; border: none;
  color: var(--marca-suave); padding: 10px 12px; border-radius: 9px; font: inherit; font-size: 14px;
  cursor: pointer; min-height: 42px; }
button.salir:hover { background: var(--marca-2); color: #fff; }
.en-linea { display: inline; margin: 0; }

.barra-movil { display: none; }
.solo-movil { display: none; }
.par { display: inline-flex; gap: 6px; }
tr.inactivo td { color: var(--suave); }
.app { background: linear-gradient(to right, var(--marca) var(--lateral), transparent var(--lateral)); }
.velo { display: none; }

/* --- Cabecera de pagina --------------------------------------------------- */
.cabecera { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px 24px;
  margin-bottom: 24px; flex-wrap: wrap; }
.acciones { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* --- Tarjetas de cifras --------------------------------------------------- */
.tarjetas { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; margin-bottom: 14px; }
.tarjeta { background: var(--panel); border: 1px solid var(--borde); border-radius: var(--radio);
  padding: 16px 18px; box-shadow: var(--sombra); min-width: 0; }
.tarjeta > span { display: block; font-size: 11.5px; color: var(--suave); text-transform: uppercase;
  letter-spacing: .07em; font-weight: 600; }
.tarjeta strong { display: block; font-size: 24px; margin-top: 6px; letter-spacing: -.02em; font-weight: 650;
  overflow-wrap: anywhere; }
.tarjeta small { display: block; color: var(--suave); font-size: 12.5px; margin-top: 3px; }
.tarjeta.alerta { border-color: color-mix(in srgb, var(--rojo) 55%, var(--borde)); }
.tarjeta.alerta strong { color: var(--rojo); }
.tarjeta.destacada { background: var(--marca); border-color: var(--marca); color: #fff; }
.tarjeta.destacada > span, .tarjeta.destacada small { color: var(--marca-suave); }

/* --- Tablas -------------------------------------------------------------- */
.desliza { overflow-x: auto; border-radius: var(--radio); border: 1px solid var(--borde);
  background: var(--panel); box-shadow: var(--sombra); -webkit-overflow-scrolling: touch; }
table.datos { width: 100%; border-collapse: collapse; background: var(--panel); }
.desliza > table.datos { min-width: 100%; }
table.datos th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--suave); font-weight: 650; padding: 11px 12px; background: var(--panel-2);
  border-bottom: 1px solid var(--borde); white-space: nowrap; }
table.datos td { padding: 11px 12px; border-bottom: 1px solid var(--borde); font-size: 14px; vertical-align: middle; }
table.datos tbody tr:last-child td { border-bottom: none; }
table.datos tbody tr:hover { background: color-mix(in srgb, var(--azul) 4%, transparent); }
table.compacta td { padding: 7px 11px; font-size: 13.5px; }
table.compacta th { padding: 8px 11px; }
.desliza td.mini, .desliza th { white-space: nowrap; }
.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
/* Los títulos de las columnas de números, alineados con sus números (pesa más que table.datos th). */
table.datos th.n, table.datos td.n { text-align: right; }
table.datos th.c, table.datos td.c { text-align: center; }
.c { text-align: center; }
.valor { font-weight: 620; }
.fuerte { font-weight: 620; }
.pos { color: var(--verde); }
.neg { color: var(--rojo); }
.motivo { color: var(--suave); font-size: 13px; }
tr.recup { background: color-mix(in srgb, var(--ambar) 8%, transparent); }
tr.hecha { opacity: .6; }
.vacio { color: var(--suave); text-align: center; padding: 26px; }

table input:not([type=checkbox]):not([type=hidden]) {
  width: 96px; padding: 6px 8px; border: 1px solid var(--borde-fuerte); border-radius: 7px;
  background: var(--panel-2); color: var(--texto); font: inherit; font-size: 13.5px; text-align: right;
  font-variant-numeric: tabular-nums; }
table input:disabled { opacity: .6; }
table.config input:not([type=checkbox]):not([type=hidden]) { width: auto; text-align: left; }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--azul); cursor: pointer; }

/* --- Etiquetas y chips ---------------------------------------------------- */
.tag { display: inline-block; font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em;
  padding: 2px 8px; border-radius: 20px; margin-left: 6px; font-weight: 600; vertical-align: 1px;
  background: var(--panel-2); border: 1px solid var(--borde); color: var(--suave); white-space: nowrap; }
.tag.r-ok, .chip.ok { background: color-mix(in srgb, var(--verde) 13%, transparent);
  border-color: color-mix(in srgb, var(--verde) 45%, transparent); color: var(--verde); }
.tag.r-sin_capital, .tag.r-tope_cuentas { background: color-mix(in srgb, var(--rojo) 12%, transparent);
  border-color: color-mix(in srgb, var(--rojo) 45%, transparent); color: var(--rojo); }
.tag.r-cumbre, .tag.r-congelado { background: color-mix(in srgb, var(--ambar) 14%, transparent);
  border-color: color-mix(in srgb, var(--ambar) 45%, transparent); color: var(--ambar); }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 7px 13px; border-radius: 20px;
  font-size: 13px; font-weight: 600; border: 1px solid var(--borde); }
.cuenta { display: inline-block; background: var(--panel-2); border: 1px solid var(--borde); color: var(--suave);
  border-radius: 20px; padding: 0 8px; font-size: 11px; letter-spacing: 0; }
.insignia { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 10px; background: #e5484d;
  color: #fff; font-size: 11px; font-weight: 700; line-height: 20px; text-align: center; }
.insignia[hidden] { display: none; }

/* --- Botones ------------------------------------------------------------- */
button, .sec, .pri { font: inherit; cursor: pointer; border-radius: 9px; padding: 9px 16px; min-height: 40px;
  border: 1px solid var(--borde-fuerte); background: var(--panel); color: var(--texto); display: inline-flex;
  align-items: center; justify-content: center; gap: 8px; font-size: 14px; font-weight: 560; }
button:hover, .sec:hover { border-color: var(--azul); color: var(--azul); text-decoration: none; }
.pri { background: var(--boton); border-color: var(--boton); color: var(--boton-texto); font-weight: 620; }
.pri:hover { filter: brightness(1.18); color: var(--boton-texto); }
button.pequeno, .sec.pequeno { padding: 5px 11px; font-size: 12.5px; min-height: 32px; }
button:disabled { opacity: .55; cursor: progress; }

/* --- Avisos y notas ------------------------------------------------------ */
.avisos, .aviso { border-radius: var(--radio); padding: 12px 16px; margin: 16px 0; font-size: 14px;
  border: 1px solid color-mix(in srgb, var(--ambar) 50%, transparent);
  background: color-mix(in srgb, var(--ambar) 9%, var(--panel)); }
.avisos p { margin: 4px 0; font-size: 13.5px; }
.aviso.ok { border-color: color-mix(in srgb, var(--verde) 50%, transparent);
  background: color-mix(in srgb, var(--verde) 9%, var(--panel)); }
.aviso.err { border-color: color-mix(in srgb, var(--rojo) 50%, transparent);
  background: color-mix(in srgb, var(--rojo) 9%, var(--panel)); }
.nota { font-size: 13.5px; color: var(--suave); background: var(--panel); border: 1px solid var(--borde);
  border-left: 3px solid var(--ambar); border-radius: 10px; padding: 12px 16px; margin: 12px 0; }
.nota strong { color: var(--texto); }

/* --- Cuadrante ----------------------------------------------------------- */
.pasos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; margin: 4px 0 22px;
  background: var(--panel); border: 1px solid var(--borde); border-radius: var(--radio); overflow: hidden;
  box-shadow: var(--sombra); counter-reset: paso; list-style: none; padding: 0; }
.pasos li { padding: 14px 18px; display: flex; gap: 12px; align-items: flex-start; font-size: 13.5px;
  color: var(--suave); border-right: 1px solid var(--borde); }
.pasos li:last-child { border-right: none; }
.pasos li::before { counter-increment: paso; content: counter(paso); flex: none; width: 26px; height: 26px;
  border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 13px;
  background: var(--panel-2); border: 1px solid var(--borde-fuerte); color: var(--suave); }
.pasos li strong { display: block; color: var(--texto); font-size: 14px; }
.pasos li.hecho::before { content: "✓"; background: var(--verde); border-color: var(--verde); color: #fff; }
.pasos li.actual::before { background: var(--boton); border-color: var(--boton); color: #fff; }

.bloque-ordenes { margin-top: 26px; }
.bloque-ordenes > header { display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  flex-wrap: wrap; margin-bottom: 10px; }
.bloque-ordenes > header h2 { margin: 0; }
.bloque-ordenes.ventas .desliza { border-top: 3px solid var(--verde); }
.bloque-ordenes.compras .desliza { border-top: 3px solid var(--azul); }
.bloque-ordenes .total { font-size: 13.5px; color: var(--suave); }
.bloque-ordenes .total strong { color: var(--texto); }

.confirmar { position: sticky; bottom: 0; z-index: 5; margin-top: 18px; padding: 14px 18px;
  background: color-mix(in srgb, var(--panel) 94%, transparent); backdrop-filter: blur(8px);
  border: 1px solid var(--borde); border-radius: var(--radio); box-shadow: 0 -4px 20px rgba(5, 22, 50, .08);
  display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.confirmar p { margin: 0; flex: 1 1 340px; color: var(--suave); font-size: 13px; }
.confirmar input[type=text] { flex: 1 1 220px; padding: 9px 12px; border: 1px solid var(--borde-fuerte);
  border-radius: 9px; background: var(--panel-2); color: var(--texto); font: inherit; min-height: 40px; }

/* --- Cartera ------------------------------------------------------------- */
.bloque-valor { background: var(--panel); border: 1px solid var(--borde); border-radius: var(--radio);
  margin-bottom: 12px; box-shadow: var(--sombra); overflow: hidden; }
.bloque-valor > summary { list-style: none; cursor: pointer; padding: 16px 18px; }
.bloque-valor > summary::-webkit-details-marker { display: none; }
.bloque-valor[open] > summary { border-bottom: 1px solid var(--borde); }
.cab-valor { display: flex; justify-content: space-between; align-items: center; gap: 10px 18px; flex-wrap: wrap; }
.cab-valor h3 { margin: 0; font-size: 16px; display: flex; align-items: center; gap: 4px; }
.cab-valor h3::before { content: "›"; display: inline-block; width: 16px; color: var(--tenue);
  transition: transform .15s; font-size: 20px; line-height: 1; }
.bloque-valor[open] .cab-valor h3::before { transform: rotate(90deg); }
.met { display: flex; gap: 6px 22px; font-size: 13px; color: var(--suave); flex-wrap: wrap; }
.met strong { color: var(--texto); font-variant-numeric: tabular-nums; }
.barra-ocup { position: relative; height: 6px; background: var(--panel-2); border: 1px solid var(--borde);
  border-radius: 4px; margin: 12px 0 0; }
.barra-ocup .lleno { height: 100%; background: var(--serie-1); border-radius: 4px; }
.barra-ocup .marca-umbral { position: absolute; top: -4px; width: 2px; height: 12px; background: var(--ambar); }
.bloque-valor .desliza { border: none; border-radius: 0; box-shadow: none; }
.bloque-valor > .vacio { padding: 14px; }

/* --- Formularios --------------------------------------------------------- */
.rejilla { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px;
  background: var(--panel); border: 1px solid var(--borde); border-radius: var(--radio); padding: 20px;
  box-shadow: var(--sombra); }
.rejilla label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 620; min-width: 0; }
.rejilla input, .rejilla select, .rejilla textarea { padding: 9px 11px; border: 1px solid var(--borde-fuerte);
  border-radius: 9px; background: var(--panel-2); color: var(--texto); font: inherit; font-size: 14px;
  font-weight: 400; min-height: 40px; width: 100%; }
.rejilla input[type=checkbox] { width: 20px; height: 20px; min-height: 0; flex: none; padding: 0; margin: 1px 0 0; }
.rejilla textarea { font: 13px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; resize: vertical; }
.rejilla small { font-weight: 400; color: var(--suave); font-size: 12.5px; }
.rejilla label.check { flex-direction: row; align-items: flex-start; gap: 10px; flex-wrap: wrap; }
.rejilla label.check small { flex-basis: 100%; }
.rejilla .pie { grid-column: 1 / -1; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.span-todo { grid-column: 1 / -1; }
.subtitulo { font-size: 14px; margin: 22px 0 8px; font-weight: 650; }
.rejilla .subtitulo { margin: 10px 0 0; padding-top: 14px; border-top: 1px solid var(--borde); }
.linea { display: flex; gap: 10px; flex-wrap: wrap; padding: 14px 0 4px; }
.linea input, .linea select { padding: 9px 11px; border: 1px solid var(--borde-fuerte); border-radius: 9px;
  background: var(--panel-2); color: var(--texto); font: inherit; font-size: 14px; min-height: 40px;
  flex: 1 1 160px; min-width: 0; }
.plegable { margin-top: 14px; border: 1px solid var(--borde); border-radius: var(--radio); padding: 14px 18px;
  background: var(--panel); box-shadow: var(--sombra); }
.plegable summary { cursor: pointer; font-weight: 620; font-size: 14.5px; }
.filtro { margin: 10px 0; }
.filtro select { padding: 8px 11px; border: 1px solid var(--borde-fuerte); border-radius: 9px;
  background: var(--panel); color: var(--texto); font: inherit; min-height: 40px; }
.presets { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.presets button { font-weight: 520; }

/* --- Pestañas, filtros, avisos -------------------------------------------- */
.pestanas { display: flex; gap: 4px; border-bottom: 1px solid var(--borde); margin: 0 0 22px; overflow-x: auto; }
.pestanas a { padding: 10px 16px; color: var(--suave); font-weight: 560; white-space: nowrap;
  border-bottom: 2px solid transparent; margin-bottom: -1px; }
.pestanas a:hover { color: var(--texto); text-decoration: none; }
.pestanas a.act { color: var(--texto); border-bottom-color: var(--azul); }
.filtros-chip { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0 12px; }
.filtros-chip .chip { color: var(--suave); font-size: 12.5px; padding: 5px 12px; font-weight: 520; }
.filtros-chip .chip:hover { border-color: var(--azul); text-decoration: none; }
.filtros-chip .chip.act { border-color: var(--azul); color: var(--azul); background: var(--azul-fondo); }
.lista-avisos { background: var(--panel); border: 1px solid var(--borde); border-radius: var(--radio);
  box-shadow: var(--sombra); overflow: hidden; }
.aviso-item { display: grid; grid-template-columns: 150px 80px minmax(0, 1fr); gap: 12px;
  padding: 13px 16px; border-bottom: 1px solid var(--borde); align-items: start; }
.aviso-item:last-child { border-bottom: none; }
.aviso-item.no-leido { background: var(--azul-fondo); }
.aviso-item .cuando { color: var(--suave); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.aviso-item .que strong { display: block; font-size: 14.5px; }
.aviso-item .que span { color: var(--suave); font-size: 13.5px; }
.dos-col { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* --- Graficos ------------------------------------------------------------ */
.panel-grafico { background: var(--panel); border: 1px solid var(--borde); border-radius: var(--radio);
  padding: 18px 18px 8px; box-shadow: var(--sombra); position: relative; margin-bottom: 14px; min-width: 0; }
.panel-grafico h3 { margin: 0 0 2px; font-size: 15px; }
.panel-grafico .mini { margin: 0 0 8px; }
.grafico { width: 100%; height: auto; display: block; overflow: visible; }
.g-rejilla { stroke: var(--rejilla); stroke-width: 1; }
.g-base { stroke: var(--eje-base); stroke-width: 1; }
.g-eje { fill: var(--eje-texto); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.g-etiqueta { fill: var(--suave); font-size: 12px; }
path.g-serie-1 { fill: var(--serie-1); }
path.g-serie-2 { fill: var(--serie-2); }
path.g-serie-3 { fill: var(--serie-3); }
path.g-linea { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
path.g-linea.g-serie-1 { stroke: var(--serie-1); }
path.g-linea.g-serie-2 { stroke: var(--serie-2); stroke-dasharray: 5 4; }
circle.g-marca { stroke: var(--panel); stroke-width: 2; }
circle.g-serie-1 { fill: var(--serie-1); }
circle.g-serie-2 { fill: var(--serie-2); }
.g-referencia { stroke: var(--eje-texto); stroke-width: 1; stroke-dasharray: 2 3; }
.g-cruz { stroke: var(--eje-texto); stroke-width: 1; }
.g-hit { fill: transparent; }
.g-punto:hover path, .g-punto:focus path { opacity: .78; }
.g-punto:focus { outline: none; }
.leyenda { display: flex; gap: 8px 18px; font-size: 12.5px; color: var(--suave); margin: 4px 0 8px; flex-wrap: wrap; }
.leyenda i { display: inline-block; width: 18px; height: 0; border-top: 2px solid; vertical-align: middle; margin-right: 6px; }
.leyenda i.s1 { border-color: var(--serie-1); }
.leyenda i.s2 { border-color: var(--serie-2); border-top-style: dashed; }
.leyenda i.b1, .leyenda i.b2, .leyenda i.b3 { width: 12px; height: 12px; border: 0; border-radius: 3px; }
.leyenda i.b1 { background: var(--serie-1); } .leyenda i.b2 { background: var(--serie-2); } .leyenda i.b3 { background: var(--serie-3); }
.leyenda i.ref { border-color: var(--eje-texto); border-top-style: dotted; border-top-width: 1px; }
.tip { position: fixed; z-index: 50; pointer-events: none; background: var(--texto); color: var(--panel);
  font-size: 12.5px; padding: 7px 10px; border-radius: 7px; white-space: pre; box-shadow: var(--sombra);
  font-variant-numeric: tabular-nums; display: none; }

/* --- Acceso -------------------------------------------------------------- */
.pagina-acceso { background: var(--marca); }
.acceso { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); min-height: 100vh; }
.acceso-marca { display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: #fff; padding: 48px; text-align: center;
  background: radial-gradient(circle at 30% 20%, #0f2a5c 0%, var(--marca) 62%); }
.acceso-simbolo { width: min(300px, 60%); height: auto; color: #fff; }
.acceso-nombre { font-size: 40px; font-weight: 600; letter-spacing: .2em; margin: 30px 0 6px; }
.acceso-lema { color: var(--marca-suave); margin: 0; font-size: 15px; letter-spacing: .02em; }
.acceso-form { background: var(--fondo); display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.acceso-caja { width: 100%; max-width: 380px; }
.acceso-caja h1 { font-size: 28px; }
.acceso-caja .sub { margin-bottom: 22px; }
.acceso-caja form { display: flex; flex-direction: column; gap: 8px; }
.acceso-caja label { font-size: 13px; font-weight: 620; margin-top: 6px; }
.acceso-caja input { padding: 12px 14px; border: 1px solid var(--borde-fuerte); border-radius: 10px;
  background: var(--panel); color: var(--texto); font: inherit; font-size: 16px; min-height: 48px; }
.acceso-caja button { margin-top: 14px; min-height: 48px; font-size: 15px; }
.acceso-nota { color: var(--tenue); font-size: 12.5px; margin-top: 18px; }
.error { color: var(--rojo); font-size: 14px; margin: 0 0 12px; padding: 10px 12px; border-radius: 9px;
  background: color-mix(in srgb, var(--rojo) 10%, var(--panel)); border: 1px solid color-mix(in srgb, var(--rojo) 40%, transparent); }

/* =========================================================================
   Adaptable
   ========================================================================= */

/* Portatiles pequeños y tabletas en horizontal */
@media (max-width: 1180px) {
  :root { --lateral: 212px; }
  .contenido { padding: 28px 26px 90px; }
  .aviso-item { grid-template-columns: 130px 72px minmax(0, 1fr); }
}

/* Tabletas en vertical y moviles: menu desplegable */
@media (max-width: 900px) {
  .app { display: block; background: none; }
  .lateral { position: fixed; inset: 0 auto 0 0; width: min(280px, 84vw); z-index: 40;
    transform: translateX(-100%); transition: transform .22s ease; box-shadow: 0 0 40px rgba(0, 0, 0, .35); }
  body.menu-abierto .lateral { transform: none; }
  body.menu-abierto { overflow: hidden; }
  .velo { display: block; position: fixed; inset: 0; background: rgba(5, 12, 26, .5); z-index: 30; }
  .velo[hidden] { display: none; }
  .barra-movil { display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 20;
    background: var(--marca); color: #fff; padding: 8px 12px; padding-top: max(8px, env(safe-area-inset-top));
    min-height: 58px; }
  .boton-menu { background: none; border: none; color: #fff; padding: 8px; min-height: 44px; min-width: 44px; }
  .boton-menu:hover { color: #fff; background: var(--marca-2); }
  .boton-menu .ico { width: 24px; height: 24px; }
  .logo-movil { padding: 0; gap: 10px; }
  .logo-movil .logo-marca { width: 34px; }
  .logo-movil .logo-texto { font-size: 16px; }
  .contenido { padding: 22px 18px 90px; }
  .menu a, button.salir { min-height: 48px; font-size: 15.5px; }
  .dos-col { grid-template-columns: 1fr; }
  .pasos { grid-template-columns: 1fr; }
  .pasos li { border-right: none; border-bottom: 1px solid var(--borde); }
  .pasos li:last-child { border-bottom: none; }
  .acceso { grid-template-columns: 1fr; }
  .acceso-marca { padding: 44px 24px 36px; }
  .acceso-simbolo { width: 150px; }
  .acceso-nombre { font-size: 28px; margin-top: 18px; }
  .acceso-form { align-items: flex-start; padding: 32px 20px 48px; border-radius: 22px 22px 0 0; margin-top: -18px; }
}

/* Moviles */
@media (max-width: 640px) {
  body { font-size: 15px; }
  h1 { font-size: 23px; }
  h2 { margin-top: 30px; }
  .contenido { padding: 18px 14px 110px; }
  .cabecera { align-items: stretch; flex-direction: column; margin-bottom: 18px; }
  .acciones > * { flex: 1 1 auto; }
  .tarjetas { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .tarjeta { padding: 13px 14px; }
  .tarjeta strong { font-size: 19px; }
  .rejilla { grid-template-columns: 1fr; padding: 16px; }
  .rejilla input, .rejilla select, .rejilla textarea, .linea input, .linea select,
  .confirmar input[type=text], table input:not([type=checkbox]):not([type=hidden]) { font-size: 16px; }
  .linea > * { flex: 1 1 100%; }
  .confirmar { padding: 12px; margin-left: -4px; margin-right: -4px; }
  .confirmar p { display: none; }
  .solo-movil { display: block; }
  .confirmar { flex-wrap: nowrap; gap: 8px; }
  .confirmar input[type=text] { flex: 1 1 0; min-width: 0; min-height: 46px; }
  .confirmar button { flex: none; min-height: 46px; padding: 9px 14px; }
  .aviso-item { grid-template-columns: 1fr; gap: 4px; }
  .met { gap: 4px 14px; }

  /* Graficos: ancho minimo legible y desplazamiento lateral */
  .panel-grafico { overflow-x: auto; padding: 14px 12px 6px; -webkit-overflow-scrolling: touch; }
  .panel-grafico .grafico { min-width: 620px; }
  .panel-grafico .grafico.compacto { min-width: 0; }
  .g-eje, .g-etiqueta { font-size: 17px; }

  /* Tablas desplazables: la primera columna queda fija */
  .desliza table.datos:not(.apilable) th:first-child,
  .desliza table.datos:not(.apilable) td:first-child { position: sticky; left: 0; z-index: 1;
    background: var(--panel); box-shadow: 1px 0 0 var(--borde); }
  .desliza table.datos:not(.apilable) th:first-child { background: var(--panel-2); }

  /* Tablas apilables: cada fila se convierte en una tarjeta */
  .desliza:has(> table.apilable) { border: none; background: none; box-shadow: none; overflow: visible; }
  .bloque-ordenes.ventas .desliza, .bloque-ordenes.compras .desliza { border-top: none; }
  table.apilable, table.apilable tbody, table.apilable tr, table.apilable td { display: block; width: 100%; }
  table.apilable { background: none; }
  table.apilable thead { display: none; }
  table.apilable tr { background: var(--panel); border: 1px solid var(--borde); border-radius: var(--radio);
    margin-bottom: 10px; padding: 6px 14px; box-shadow: var(--sombra); }
  .bloque-ordenes.ventas table.apilable tr { border-left: 3px solid var(--verde); }
  .bloque-ordenes.compras table.apilable tr { border-left: 3px solid var(--azul); }
  table.apilable tbody tr:hover { background: var(--panel); }
  table.apilable td { display: flex; justify-content: space-between; align-items: center; gap: 12px;
    padding: 8px 0; border-bottom: 1px solid var(--borde); text-align: right; white-space: normal; }
  table.apilable td:last-child { border-bottom: none; }
  table.apilable td[data-e]::before { content: attr(data-e); color: var(--suave); font-size: 12.5px;
    font-weight: 560; text-align: left; flex: none; }
  table.apilable td.titulo-fila { font-size: 16px; justify-content: flex-start; gap: 10px; text-align: left; }
  table.apilable td.titulo-fila input[type=checkbox] { width: 22px; height: 22px; }
  table.apilable td:empty { display: none; }
  table.apilable td input:not([type=checkbox]):not([type=hidden]) { width: 140px; }
  table.apilable td { flex-wrap: wrap; }
  table.apilable .par { margin-left: auto; }
  table.apilable .par input { width: 96px; }
  table.apilable td.guardar { justify-content: flex-end; }
  table.apilable td.guardar button { width: 100%; min-height: 44px; }
  table.apilable tr.recup { background: color-mix(in srgb, var(--ambar) 8%, var(--panel)); }
}

/* Moviles pequeños */
@media (max-width: 380px) {
  .tarjetas { grid-template-columns: 1fr; }
  .logo-movil .logo-texto { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

@media print {
  .lateral, .barra-movil, .acciones, .confirmar, .velo { display: none !important; }
  .app { display: block; }
  body { background: #fff; }
}

.acciones-lista { margin: 22px 0 10px; }
.bloque-valor > summary .barra-ocup { margin-top: 12px; }
.acceso.acceso-solo { grid-template-columns: 1fr; }

/* --- Laboratorio sencillo ------------------------------------------------ */
.lab .paso { background: var(--panel); border: 1px solid var(--borde); border-radius: var(--radio);
  padding: 20px 22px; box-shadow: var(--sombra); margin-bottom: 16px; }
.paso-titulo { font-size: 18px; text-transform: none; letter-spacing: 0; color: var(--texto); margin: 0 0 6px; }
.paso-titulo .num { width: 30px; height: 30px; border-radius: 50%; background: var(--boton); color: #fff;
  display: inline-grid; place-items: center; font-size: 15px; flex: none; }
.lab .paso > .mini { font-size: 14px; margin: 0 0 14px; max-width: 75ch; }
.botones-rapidos { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.contador { margin-left: auto; font-weight: 620; color: var(--suave); }
.empresas { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.empresa { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 10px;
  align-items: center; padding: 10px 12px; border: 1px solid var(--borde-fuerte); border-radius: 10px;
  cursor: pointer; background: var(--panel-2); min-height: 56px; }
.empresa:hover { border-color: var(--azul); }
.empresa.marcada { border-color: var(--azul); background: var(--azul-fondo); }
.empresa input { grid-row: 1 / 3; width: 20px; height: 20px; }
.empresa-nombre { font-weight: 620; font-size: 14.5px; }
.empresa-datos { color: var(--suave); font-size: 12.5px; grid-column: 2; }
.empresa .tag { grid-column: 2; justify-self: start; margin: 4px 0 0; }
.factores { display: flex; flex-direction: column; gap: 8px; }
.factor-fila { display: grid; grid-template-columns: minmax(160px, 1.3fr) minmax(140px, 1fr) minmax(120px, .8fr) auto;
  gap: 12px; align-items: center; padding: 10px 12px; border: 1px solid var(--borde); border-radius: 10px; background: var(--panel-2); }
.factor-fila[hidden] { display: none; }
.factor-nombre { display: flex; flex-direction: column; }
.factor-input { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--suave); }
.factor-input input { padding: 9px 11px; border: 1px solid var(--borde-fuerte); border-radius: 9px; background: var(--panel);
  color: var(--texto); font: inherit; font-size: 16px; min-height: 44px; width: 100%; font-variant-numeric: tabular-nums; }
.factor-efecto { display: flex; flex-direction: column; }
.factor-efecto strong { font-size: 17px; font-variant-numeric: tabular-nums; }
.periodos { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.periodo { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border: 1px solid var(--borde-fuerte);
  border-radius: 10px; cursor: pointer; background: var(--panel-2); font-weight: 560; min-height: 46px; }
.periodo:has(input:checked) { border-color: var(--azul); background: var(--azul-fondo); }
.periodo input { width: 18px; height: 18px; accent-color: var(--azul); }
.rejilla.simple { box-shadow: none; border: none; padding: 0; background: none; max-width: 560px; }
.avanzadas { margin-bottom: 16px; }
.lanzar { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin: 6px 0 10px; }
.pri.grande { font-size: 17px; padding: 14px 30px; min-height: 54px; border-radius: 12px; }
.resumen-frase { font-size: 18px; line-height: 1.55; background: var(--panel); border: 1px solid var(--borde);
  border-left: 4px solid var(--azul); border-radius: var(--radio); padding: 16px 20px; margin: 0 0 16px; box-shadow: var(--sombra); }
.resumen-frase strong { font-weight: 680; }
@media (max-width: 640px) {
  .lab .paso { padding: 16px 14px; }
  .factor-fila { grid-template-columns: 1fr 1fr; }
  .factor-nombre { grid-column: 1 / -1; }
  .factor-fila [data-usar] { grid-column: 1 / -1; }
  .contador { margin-left: 0; flex-basis: 100%; }
  .empresas { grid-template-columns: 1fr 1fr; }
  .pri.grande { width: 100%; }
}
.lista-cambios { margin: 0 0 14px; padding-left: 18px; columns: 2 220px; font-size: 14px; }
.paso.aplicar { border-left: 4px solid var(--verde); }

/* --- Impuestos: España / Andorra / Dubái --- */
.paises { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin: 14px 0 22px; }
.pais { background: var(--panel); border: 1px solid var(--borde); border-radius: var(--radio); padding: 16px 18px; box-shadow: var(--sombra); }
.pais.real { border-color: var(--azul); box-shadow: 0 0 0 1px var(--azul) inset, var(--sombra); }
.pais h3 { margin: 0 0 2px; font-size: 16px; display: flex; align-items: center; gap: 8px; }
.pais h3 i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.pais.p-es h3 i { background: var(--serie-1); } .pais.p-ad h3 i { background: var(--serie-2); } .pais.p-ae h3 i { background: var(--serie-3); }
.pais .neto { font-size: 26px; font-weight: 700; margin: 10px 0 0; font-variant-numeric: tabular-nums; }
.pais .neto small { display: block; font-size: 12.5px; font-weight: 500; color: var(--suave); }
.pais dl { margin: 12px 0 0; display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; font-size: 13px; }
.pais dt { color: var(--suave); } .pais dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.pais dd.total, .pais dt.total { font-weight: 600; color: var(--texto); border-top: 1px solid var(--borde); padding-top: 4px; }
.chips-años { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0 4px; }
.chips-años a { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--borde); color: var(--texto); text-decoration: none; font-size: 13.5px; }
.chips-años a.act { background: var(--azul); border-color: var(--azul); color: #fff; }
.supuestos { font-size: 13px; color: var(--suave); line-height: 1.55; }
.supuestos li { margin: 3px 0; }
@media (max-width: 900px) { .paises { grid-template-columns: 1fr; } }

/* --- Mensaje para el broker --- */
.broker { background: var(--panel); border: 1px solid var(--borde); border-radius: var(--radio); padding: 16px 18px; margin: 22px 0; box-shadow: var(--sombra); }
.broker header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.broker header h2 { margin: 0; }
.broker textarea { width: 100%; box-sizing: border-box; font: 13.5px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--panel-2); color: var(--texto); border: 1px solid var(--borde); border-radius: 8px; padding: 12px; resize: vertical; }

/* --- Alta con invitación --- */
.acceso-caja.alta { max-width: 460px; }
.acceso-caja.alta .paso-titulo { margin: 22px 0 6px; font-size: 16px; }
.qr { background: #fff; border-radius: 12px; padding: 10px; width: 220px; max-width: 100%; margin: 10px 0; }
.qr-svg { display: block; width: 100%; height: auto; }
.clave { font: 600 17px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .04em; word-spacing: .3em;
  background: var(--panel-2); border: 1px solid var(--borde); border-radius: 8px; padding: 10px 12px; }
.quien { margin: 0 0 8px; font-size: 13px; color: var(--suave); text-align: center; }

/* Nombre del valor y número de cuenta en una sola línea en pantallas anchas. */
@media (min-width: 901px) { table.datos td.titulo-fila { white-space: nowrap; } }
