/* Diario Fondeo - one stylesheet, no build step.
   Neutral surfaces, one accent, and colour reserved for meaning: the kind
   of plan, profit vs loss, and the NinjaTrader status. */

:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --border: #e2e5ea;
  --border-strong: #cdd2da;
  --text: #13161b;
  --text-2: #4a5260;
  --text-3: #5f6775;
  --accent: #2f5bd3;
  --accent-hover: #2549b0;
  --accent-soft: #e9eefc;
  --on-accent: #ffffff;
  --positive: #157a3c;
  --negative: #c0262d;
  --warn: #a35a00;
  --focus: #2f5bd3;
  --shadow-sm: 0 1px 2px rgba(17, 24, 39, 0.05);
  --shadow-md: 0 1px 2px rgba(17, 24, 39, 0.04), 0 4px 16px rgba(17, 24, 39, 0.06);
  --shadow-lg: 0 24px 64px rgba(17, 24, 39, 0.22);
  --backdrop: rgba(17, 24, 39, 0.42);
  --skeleton: #e8ebef;

  /* One pair per plan kind: text/accent colour and a soft background. */
  --k-agresivo: #c2410c;        --k-agresivo-bg: #fff1e8;
  --k-simetrico: #1d4ed8;       --k-simetrico-bg: #ebf0ff;
  --k-cumplimiento: #0f766e;    --k-cumplimiento-bg: #e5f5f2;
  --k-recuperacion: #a16207;    --k-recuperacion-bg: #fdf5dc;
  --k-retirar: #15803d;         --k-retirar-bg: #e6f6ec;
  --k-evaluacion: #6d28d9;      --k-evaluacion-bg: #f2ecff;
  --k-hecho: #4b5563;           --k-hecho-bg: #eef0f3;
  --k-faltan: #b91c1c;          --k-faltan-bg: #fdecec;

  /* Soft backgrounds for state (P6): the plan-kind soft pairs, named for what they mean. */
  --positive-soft: var(--k-retirar-bg);
  --warn-soft: var(--k-recuperacion-bg);
  --negative-soft: var(--k-faltan-bg);

  --radius: 12px;
  --radius-sm: 8px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "Segoe UI Mono", Consolas, monospace;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115;
    --surface: #171a20;
    --surface-2: #1e222a;
    --border: #2a2f39;
    --border-strong: #3a404c;
    --text: #e9ecf1;
    --text-2: #b4bbc7;
    --text-3: #8a93a1;
    --accent: #7c9cf5;
    --accent-hover: #9bb3f8;
    --accent-soft: #1f2a48;
    --on-accent: #0f1115;
    --positive: #4fcf83;
    --negative: #f2787d;
    --warn: #f0b04c;
    --focus: #8fabf7;
    --shadow-sm: none;
    --shadow-md: 0 1px 0 rgba(255, 255, 255, 0.02);
    --shadow-lg: 0 24px 64px rgba(0, 0, 0, 0.6);
    --backdrop: rgba(0, 0, 0, 0.6);
    --skeleton: #222731;

    --k-agresivo: #fb923c;        --k-agresivo-bg: rgba(251, 146, 60, 0.13);
    --k-simetrico: #7ea2ff;       --k-simetrico-bg: rgba(126, 162, 255, 0.13);
    --k-cumplimiento: #4fd1c0;    --k-cumplimiento-bg: rgba(79, 209, 192, 0.12);
    --k-recuperacion: #f5c04a;    --k-recuperacion-bg: rgba(245, 192, 74, 0.12);
    --k-retirar: #4fcf83;         --k-retirar-bg: rgba(79, 207, 131, 0.13);
    --k-evaluacion: #b69cff;      --k-evaluacion-bg: rgba(182, 156, 255, 0.13);
    --k-hecho: #a3abb8;           --k-hecho-bg: rgba(163, 171, 184, 0.12);
    --k-faltan: #f2787d;          --k-faltan-bg: rgba(242, 120, 125, 0.12);
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
p,
dl,
dd,
ul {
  margin: 0;
}

ul {
  padding: 0;
  list-style: none;
}

code {
  font-family: var(--mono);
  font-size: 0.92em;
  background: var(--surface-2);
  padding: 0.05em 0.35em;
  border-radius: 4px;
}

[hidden] {
  display: none !important;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

/* --- buttons ------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 40px;
  padding: 0 0.95rem;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 0.93rem;
  font-weight: 620;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.12s, border-color 0.12s, color 0.12s;
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.btn-sm {
  min-height: 32px;
  padding: 0 0.75rem;
  font-size: 0.87rem;
}

.btn-primary {
  background: var(--accent);
  color: var(--on-accent);
}

/* A disabled primary reads as a neutral inert control, not a pale blue one. */
.btn-primary:disabled {
  border-color: var(--border);
  background: var(--surface-2);
  color: var(--text-3);
  opacity: 1;
}

.btn-primary:not(:disabled):hover {
  background: var(--accent-hover);
}

.btn-secondary {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--text);
}

.btn-secondary:not(:disabled):hover {
  background: var(--surface-2);
}

.btn-ghost {
  background: transparent;
  color: var(--text-2);
}

.btn-ghost:not(:disabled):hover {
  background: var(--surface-2);
  color: var(--text);
}

.btn-danger {
  border-color: color-mix(in srgb, var(--negative) 45%, transparent);
  background: transparent;
  color: var(--negative);
}

.btn-danger:not(:disabled):hover {
  background: var(--negative-soft);
}

.btn-danger-ghost {
  min-height: 32px;
  border-color: color-mix(in srgb, var(--negative) 45%, transparent);
  background: transparent;
  color: var(--negative);
}

.btn-danger-ghost:not(:disabled):hover {
  background: var(--k-faltan-bg);
}

/* Armed (the first press of Quitar, Eliminar or Restablecer): the same in all three. */
.btn-danger-ghost[data-armed="true"] {
  border-color: var(--negative);
  background: var(--negative-soft);
  font-weight: 700;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-3);
  cursor: pointer;
}

.icon-btn:hover {
  background: var(--surface-2);
  color: var(--text);
}

/* --- header -------------------------------------------------------------- */

.offline-banner {
  position: sticky;
  top: 0;
  z-index: 20;
  padding: 0.5rem 1rem;
  background: var(--k-recuperacion-bg);
  color: var(--warn);
  border-bottom: 1px solid var(--border);
  font-size: 0.88rem;
  font-weight: 560;
  text-align: center;
}

.app-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.app-header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.9rem 1.5rem;
  max-width: 1080px;
  margin: 0 auto;
  padding: 1.1rem 1.5rem;
}

.brand-title {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

/* 0.1.8: the version beside the name, quieter than it. */
.brand-version {
  color: var(--text-3);
  font-size: 0.8rem;
  font-weight: 500;
  margin-left: 0.25rem;
}

.brand-sub {
  color: var(--text-3);
  font-size: 0.85rem;
}

/* T19: "Hoy" and "Estadísticas" are two pages; the header links them. */
.brand-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 2rem;
}

.app-nav {
  display: flex;
  gap: 0.25rem;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
}

.app-nav-link {
  padding: 0.35rem 0.85rem;
  border-radius: 7px;
  color: var(--text-2);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
}

.app-nav-link:hover {
  color: var(--text);
}

.app-nav-link[aria-current="page"] {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.header-status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
}

.status-chip,
.catalog-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  min-height: 38px;
  padding: 0.3rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  font-size: 0.85rem;
  line-height: 1.25;
}

.status-text {
  display: flex;
  flex-direction: column;
}

.status-label {
  font-weight: 600;
}

.status-age {
  color: var(--text-3);
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--text-3);
  flex: none;
}

.status-chip[data-state="fresh"] .status-dot {
  background: var(--positive);
  box-shadow: 0 0 0 3px var(--k-retirar-bg);
}

.status-chip[data-state="stale"] .status-dot {
  background: var(--warn);
  box-shadow: 0 0 0 3px var(--k-recuperacion-bg);
}

.status-chip[data-state="missing"] .status-dot {
  background: var(--negative);
  box-shadow: 0 0 0 3px var(--k-faltan-bg);
}

.catalog-label {
  color: var(--text-3);
}

.catalog-text {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.catalog-chip[data-state="empty"] .catalog-text {
  color: var(--warn);
}

/* T22: active accounts still on an older catalog version's rules. */
.catalog-older {
  color: var(--warn);
  font-size: 0.8rem;
}

.rules-notice {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.rules-notice p {
  margin: 0;
}

.rules-notice-title {
  font-weight: 600;
  color: var(--text);
}

.rules-notice-changes {
  margin: 0;
  padding-left: 1.1rem;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

/* F6: new rules for the open accounts (Hoy and Configuración). */
.rules-update {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.rules-update p {
  margin: 0;
}

.rules-update[hidden] {
  display: none;
}

.rules-update-title {
  font-weight: 600;
  color: var(--text);
}

.rules-update-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.25rem;
}

.rules-update-accounts {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.rules-update-account {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.rules-update-account p {
  margin: 0;
}

.rules-update-name {
  font-weight: 600;
  color: var(--text);
}

.rules-update-confirm {
  display: grid;
  gap: 0.4rem;
  padding: 0.6rem 0.7rem;
  border-radius: var(--radius-sm);
  background: var(--warn-soft);
}

.rules-update-confirm[hidden] {
  display: none;
}

.rules-update-confirm-text {
  margin: 0;
  color: var(--text);
  font-size: 0.86rem;
  font-weight: 600;
}

.exec-status[data-tone="warn"] {
  color: var(--warn);
}

/* T24: catalog and master table changes, each under its own heading. */
.rules-notice-grouped {
  padding-left: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.rules-group-title {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-2);
}

.rules-group ul {
  margin: 0.15rem 0 0;
  padding-left: 1.1rem;
}

/* T24: "Importar datos" - a menu of our two JSON files. */
.import-option {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding: 0.55rem 0.7rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.import-option:hover,
.import-option:focus-within {
  background: var(--surface-2);
}

.import-option:focus-within {
  outline: 2px solid var(--focus);
  outline-offset: -2px;
}

.import-option-title {
  font-weight: 600;
}

.import-option-sub {
  color: var(--text-3);
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
}

.import-message {
  margin: 0;
  font-weight: 600;
}

.import-errors {
  margin: 0.6rem 0 0;
  padding-left: 1.1rem;
  max-height: 50vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  overflow-wrap: anywhere;
  font-size: 0.9rem;
}

.rules-apply .check-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 38px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
}

.rules-apply input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 0;
  flex: none;
}

/* --- page ---------------------------------------------------------------- */

.page {
  max-width: 1080px;
  margin: 0 auto;
  padding: 1.75rem 1.5rem 4rem;
}

.section + .section {
  margin-top: 2.5rem;
}

.section-head {
  margin-bottom: 1rem;
}

.section-title {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.005em;
}

.section-sub {
  color: var(--text-3);
  font-size: 0.88rem;
}

.callout {
  padding: 0.85rem 1rem;
  margin-bottom: 1rem;
  border: 1px solid var(--border);
  border-left: 3px solid var(--warn);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-2);
  font-size: 0.9rem;
}

.empty-state {
  padding: 1.5rem;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  color: var(--text-2);
  text-align: center;
  font-size: 0.92rem;
}

.empty-state-quiet {
  padding: 0.9rem;
  color: var(--text-3);
}

/* --- plan cards ("Hoy") -------------------------------------------------- */

.plan-list {
  display: grid;
  gap: 1rem;
}

.plan {
  --k: var(--text-3);
  --k-bg: var(--surface-2);
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

.plan::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--k);
}

.plan[data-kind="AGRESIVO"] { --k: var(--k-agresivo); --k-bg: var(--k-agresivo-bg); }
.plan[data-kind="SIMETRICO"] { --k: var(--k-simetrico); --k-bg: var(--k-simetrico-bg); }
.plan[data-kind="CUMPLIMIENTO"] { --k: var(--k-cumplimiento); --k-bg: var(--k-cumplimiento-bg); }
.plan[data-kind="RECUPERACION"] { --k: var(--k-recuperacion); --k-bg: var(--k-recuperacion-bg); }
.plan[data-kind="RETIRAR"] { --k: var(--k-retirar); --k-bg: var(--k-retirar-bg); }
.plan[data-kind="QUEMAR"],
.plan[data-kind="AGOTADA"] { --k: var(--k-hecho); --k-bg: var(--k-hecho-bg); }
.plan[data-kind="EVALUACION"] { --k: var(--k-evaluacion); --k-bg: var(--k-evaluacion-bg); }
.plan[data-kind="HECHO_HOY"] { --k: var(--k-hecho); --k-bg: var(--k-hecho-bg); }
.plan[data-kind="FALTAN_DATOS"],
.plan[data-kind="REVISAR"],
.plan[data-kind="SIN_VINCULAR"] { --k: var(--k-faltan); --k-bg: var(--k-faltan-bg); }

.plan.is-flash {
  animation: flash 1.6s ease-out;
}

@keyframes flash {
  0% { box-shadow: 0 0 0 3px var(--accent); }
  100% { box-shadow: var(--shadow-md); }
}

.plan-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem 0 1.5rem;
}

.plan-name {
  font-size: 1.02rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.plan-meta {
  color: var(--text-3);
  font-size: 0.86rem;
}

/* Data feeds T0: "Datos: CQG" under the meta line; an unknown feed is a
   quiet prompt, TopstepX a refusal. */
.plan-feed {
  margin: 0.1rem 0 0;
  color: var(--text-3);
  font-size: 0.82rem;
}

.plan-feed-hint {
  color: inherit;
}

.plan-feed[data-tone="blocked"] {
  color: var(--negative);
}

/* Remote nodes R2.4: which node operates the account. */
.plan-node {
  margin: 0.1rem 0 0;
  color: var(--text-3);
  font-size: 0.82rem;
}

.plan-node[data-tone="blocked"] {
  color: var(--negative);
}

/* Data feeds T2: the account's feed is not the open profile's, or has none. */
.plan-feed-status {
  margin: 0.1rem 0 0;
  color: var(--text-3);
  font-size: 0.82rem;
}

.plan-feed-status[data-tone="blocked"] {
  color: var(--negative);
}

/* Data feeds T2: no provider assigned / open positions before a switch. */
.feed-banner-lines {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  margin: 0;
  padding-left: 1.1rem;
}

.plan-buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.4rem;
}

.plan-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1.25rem 2rem;
  padding: 0.9rem 1.25rem 1.1rem 1.5rem;
}

.pill {
  display: inline-block;
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  background: var(--k-bg);
  color: var(--k);
  font-size: 0.78rem;
  font-weight: 750;
  letter-spacing: 0.06em;
}

.plan-headline {
  margin-top: 0.7rem;
  font-size: 1.3rem;
  font-weight: 650;
  letter-spacing: -0.01em;
  color: var(--text);
}

.figures {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 2.25rem;
  margin-top: 0.7rem;
}

.figure dt,
.stat dt {
  color: var(--text-3);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.figure dd {
  font-size: 1.75rem;
  font-weight: 680;
  line-height: 1.15;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.figure:first-child dd {
  color: var(--k);
}

/* The ATM's own values (T12): what goes into NinjaTrader, secondary to the
   plan's figures but read off the card, so tabular and one notch darker
   than the reason. */
.plan-atm {
  margin-top: 0.45rem;
  color: var(--text-2);
  font-size: 0.85rem;
  font-weight: 560;
  font-variant-numeric: tabular-nums;
}

.plan-reason {
  margin-top: 0.75rem;
  max-width: 62ch;
  color: var(--text-2);
  font-size: 0.9rem;
}

.plan-next {
  margin-top: 0.6rem;
  display: inline-block;
  padding: 0.35rem 0.65rem;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 560;
  font-variant-numeric: tabular-nums;
}

.plan-stats {
  display: grid;
  align-content: start;
  gap: 0.8rem;
  min-width: 11rem;
  padding-left: 1.5rem;
  border-left: 1px solid var(--border);
}

.stat dd {
  font-size: 1.05rem;
  font-weight: 620;
  font-variant-numeric: tabular-nums;
}

.stat dd.stat-note {
  margin-top: 0.1rem;
  color: var(--text-3);
  font-size: 0.85rem;
  font-weight: 500;
}

.stat dd[data-tone="positive"] {
  color: var(--positive);
}

.stat dd[data-tone="negative"] {
  color: var(--negative);
}

.plan-foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.25rem 1.5rem;
  padding: 0.65rem 1.25rem 0.75rem 1.5rem;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 0.84rem;
}

.plan-master {
  color: var(--text-3);
}

/* T15: where the hedge's ratio comes from, the regla única, the techo. */
.plan-cobertura-notes {
  flex: 1 1 100%;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--text-3);
  font-size: 0.8rem;
}

/* T21: the plan's two outcomes, account and overlay side by side. */
.plan-cobertura-outcomes {
  flex: 1 1 100%;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--text-2);
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
}

/* T17: the other hedge route, and what the account has cost so far. */
.plan-cobertura-alt {
  flex: 1 1 100%;
  color: var(--text-3);
  font-size: 0.8rem;
}

.plan-cost {
  flex: 1 1 100%;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}

/* The overlay split into the method's cover and failed launches. */
.plan-cost-split,
.stats-split {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--text-3);
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
}

.plan-cost-split {
  flex: 1 1 100%;
}

.plan-cost-split[hidden],
.stats-split[hidden] {
  display: none;
}

.stats-split [data-tone="negative"] {
  color: var(--negative);
}

/* --- skeleton ------------------------------------------------------------ */

.skeleton-card {
  display: grid;
  gap: 0.7rem;
  padding: 1.25rem 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.skeleton-card span {
  display: block;
  height: 0.85rem;
  border-radius: 6px;
  background: var(--skeleton);
  animation: pulse 1.4s ease-in-out infinite;
}

.skeleton-card span:nth-child(1) { width: 30%; }
.skeleton-card span:nth-child(2) { width: 55%; height: 1.6rem; }
.skeleton-card span:nth-child(3) { width: 75%; }

@keyframes pulse {
  50% { opacity: 0.45; }
}

/* --- account lists ------------------------------------------------------- */

.account-list {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}

.account-list:empty {
  display: none;
}

.account-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.7rem 0.9rem 0.7rem 1.1rem;
}

.account-row + .account-row {
  border-top: 1px solid var(--border);
}

.account-row-id {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.15rem 0.75rem;
  min-width: 0;
}

.account-row-name {
  font-weight: 620;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.account-row-meta {
  color: var(--text-3);
  font-size: 0.86rem;
  font-variant-numeric: tabular-nums;
}

.sim-details {
  margin-top: 1rem;
}

.sim-details > summary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.2rem;
  color: var(--text-2);
  font-size: 0.9rem;
  font-weight: 560;
  cursor: pointer;
  list-style: none;
  border-radius: 6px;
}

.sim-details > summary::-webkit-details-marker {
  display: none;
}

.sim-details[open] > summary {
  margin-bottom: 0.25rem;
}

.sim-details[open] .section-sub {
  margin-bottom: 0.75rem;
}

.count-badge {
  min-width: 1.5rem;
  padding: 0.05rem 0.45rem;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-3);
  font-size: 0.78rem;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

/* --- "Revisa esto" (T14) ----------------------------------------------------
   Questions, not alarms: the warm accent of the callouts, one quiet panel,
   one row per question with its two answers. */

.review {
  margin-bottom: 1rem;
  border: 1px solid var(--border);
  border-left: 3px solid var(--warn);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.review-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.8rem 1rem 0 1.1rem;
}

.review-title {
  font-size: 0.95rem;
  font-weight: 700;
}

.review-sub {
  padding: 0.15rem 1rem 0.7rem 1.1rem;
  color: var(--text-3);
  font-size: 0.85rem;
}

.review-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem 1rem;
  padding: 0.7rem 0.9rem 0.7rem 1.1rem;
  border-top: 1px solid var(--border);
}

.review-text {
  min-width: 0;
  font-size: 0.92rem;
  font-weight: 540;
  font-variant-numeric: tabular-nums;
}

.review-buttons {
  display: flex;
  flex-shrink: 0;
  gap: 0.4rem;
}

/* --- "Cuentas cerradas" (T14) ------------------------------------------- */

.closed-details > summary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0.2rem;
  cursor: pointer;
  list-style: none;
  border-radius: 6px;
}

.closed-details > summary::-webkit-details-marker {
  display: none;
}

.closed-details > summary::before {
  content: "";
  width: 0.45rem;
  height: 0.45rem;
  border-right: 2px solid var(--text-3);
  border-bottom: 2px solid var(--text-3);
  transform: rotate(-45deg);
  transition: transform 0.12s;
}

.closed-details[open] > summary::before {
  transform: rotate(45deg);
}

.closed-details[open] > .section-sub {
  margin: 0.25rem 0 0.75rem;
  max-width: 70ch;
}

.closed-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 0.6rem 1.5rem;
  padding: 0.8rem 0.9rem 0.8rem 1.1rem;
}

.closed-row + .closed-row {
  border-top: 1px solid var(--border);
}

.closed-id {
  display: grid;
  gap: 0.1rem;
  min-width: 0;
}

.closed-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem 0.6rem;
}

.closed-meta,
.closed-dates {
  color: var(--text-3);
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
}

.closed-reason {
  color: var(--text-2);
  font-size: 0.84rem;
  max-width: 60ch;
}

.status-pill {
  --s: var(--k-hecho);
  --s-bg: var(--k-hecho-bg);
  padding: 0.12rem 0.55rem;
  border-radius: 999px;
  background: var(--s-bg);
  color: var(--s);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.status-pill[data-status="perdida"] { --s: var(--k-faltan); --s-bg: var(--k-faltan-bg); }
.status-pill[data-status="prueba_superada"] { --s: var(--k-retirar); --s-bg: var(--k-retirar-bg); }

/* Fixed columns, so the figures line up from one closed row to the next. */
.closed-figures {
  display: grid;
  grid-template-columns: 5.5rem 9.5rem 8.5rem;
  gap: 0 1.25rem;
}

.closed-figures dt {
  color: var(--text-3);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.closed-figures dd {
  font-size: 0.92rem;
  font-weight: 620;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.closed-figures dd.closed-gross {
  color: var(--text-3);
  font-size: 0.8rem;
  font-weight: 500;
}

.btn.is-placeholder {
  visibility: hidden;
}

.closed-net[data-tone="positive"] {
  color: var(--positive);
}

.closed-net[data-tone="negative"] {
  color: var(--negative);
}

.closed-row.is-confirming .account-row-buttons {
  visibility: hidden;
}

.row-confirm {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.row-confirm-text {
  font-size: 0.9rem;
  font-weight: 540;
}

.row-confirm-buttons {
  display: flex;
  gap: 0.4rem;
  margin-left: auto;
}

/* The payout amount and the close choice in the dialog's confirmation. */
.confirm-panel .segmented {
  width: min(100%, 28rem);
}

/* --- toast --------------------------------------------------------------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 1.5rem;
  z-index: 30;
  max-width: min(92vw, 34rem);
  padding: 0.75rem 1.1rem;
  transform: translateX(-50%);
  border-radius: var(--radius-sm);
  background: var(--text);
  color: var(--bg);
  box-shadow: var(--shadow-lg);
  font-size: 0.9rem;
  font-weight: 540;
}

.toast[data-tone="error"] {
  background: var(--negative);
  color: #fff;
}

/* --- dialog -------------------------------------------------------------- */

.dialog {
  width: min(100% - 2rem, 560px);
  max-height: min(100% - 2rem, 860px);
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-lg);
}

.dialog::backdrop {
  background: var(--backdrop);
}

.dialog[open] {
  display: flex;
  animation: dialog-in 0.16s ease-out;
}

@keyframes dialog-in {
  from { opacity: 0; transform: translateY(6px) scale(0.99); }
}

.dialog-form {
  display: flex;
  flex-direction: column;
  width: 100%;
  min-height: 0;
}

.dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.15rem 1.15rem 0.9rem 1.4rem;
  border-bottom: 1px solid var(--border);
}

.dialog-title {
  font-size: 1.1rem;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.dialog-sub {
  color: var(--text-3);
  font-size: 0.86rem;
  font-variant-numeric: tabular-nums;
}

.dialog-body {
  display: grid;
  gap: 1.1rem;
  padding: 1.2rem 1.4rem 1.3rem;
  overflow-y: auto;
}

.dialog-body .callout {
  margin: 0;
}

.field {
  display: grid;
  align-content: start;
  gap: 0.35rem;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.field > label,
.field > legend {
  padding: 0;
  font-size: 0.86rem;
  font-weight: 620;
  color: var(--text);
}

.field > legend {
  margin-bottom: 0.35rem;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

select,
input[type="number"],
input[type="text"],
input[type="email"],
input[type="password"],
input[type="date"],
textarea {
  width: 100%;
  min-height: 40px;
  padding: 0.45rem 0.7rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.94rem;
  font-variant-numeric: tabular-nums;
}

textarea {
  min-height: 5.5rem;
  resize: vertical;
  line-height: 1.45;
}

select {
  appearance: none;
  padding-right: 2.2rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%236c7482' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.8rem center;
  cursor: pointer;
}

select:disabled {
  background-color: var(--surface-2);
  color: var(--text-3);
}

input::placeholder {
  color: var(--text-3);
  opacity: 0.85;
}

select:focus-visible,
input:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 0;
  border-color: var(--focus);
}

[aria-invalid="true"] {
  border-color: var(--negative) !important;
}

.hint {
  color: var(--text-3);
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
}

.hint:empty {
  display: none;
}

.field-error,
.form-error {
  color: var(--negative);
  font-size: 0.83rem;
  font-weight: 540;
}

.form-error {
  padding: 0.6rem 0.8rem;
  border-radius: var(--radius-sm);
  background: var(--k-faltan-bg);
}

.segmented {
  display: inline-grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  padding: 3px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--surface-2);
  width: min(100%, 22rem);
}

.segmented input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segmented label {
  padding: 0.45rem 0.9rem;
  border-radius: 7px;
  color: var(--text-2);
  font-size: 0.9rem;
  font-weight: 580;
  text-align: center;
  cursor: pointer;
  transition: background-color 0.12s, color 0.12s;
}

.segmented input:checked + label {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm), 0 0 0 1px var(--border);
}

.segmented input:focus-visible + label {
  outline: 2px solid var(--focus);
  outline-offset: 1px;
}

.advanced {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.advanced > summary {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  list-style: none;
  padding: 0.7rem 0.9rem;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border-radius: var(--radius-sm);
}

.advanced > summary::-webkit-details-marker {
  display: none;
}

.advanced > summary::before,
.sim-details > summary::before {
  content: "";
  flex: none;
  width: 0.45rem;
  height: 0.45rem;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
  transition: transform 0.15s;
}

.advanced[open] > summary::before,
.sim-details[open] > summary::before {
  transform: rotate(45deg);
}

.advanced[open] > summary {
  border-bottom: 1px solid var(--border);
}

.advanced > .hint {
  padding: 0.7rem 0.9rem 0;
}

.advanced-grid {
  display: grid;
  align-items: start;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem 1rem;
  padding: 0.75rem 0.9rem 0.95rem;
}

.dialog-foot,
.confirm-panel {
  padding: 0.9rem 1.15rem 1rem 1.4rem;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.dialog-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}

.dialog-foot-secondary,
.dialog-foot-primary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
}

.dialog-foot-primary {
  margin-left: auto;
  justify-content: flex-end;
}

.save-status {
  margin-right: 0.35rem;
  color: var(--text-3);
  font-size: 0.83rem;
}

.save-status[data-tone="ok"] {
  color: var(--positive);
  font-weight: 620;
}

.save-status[data-tone="ok"]::before {
  content: "✓ ";
}

.confirm-panel {
  display: grid;
  gap: 0.8rem;
  background: var(--surface-2);
}

.confirm-text {
  font-size: 0.93rem;
  font-weight: 540;
}

.confirm-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

/* --- executions dialog ---------------------------------------------------- */

.dialog-wide {
  width: min(100% - 2rem, 760px);
}

.dialog-wide > .dialog-form {
  min-height: 0;
}

/* T18: the payout and close dialogs - small and focused. */
.dialog-narrow {
  width: min(100% - 2rem, 460px);
}

/* The add-PC and add-login dialogs: the shared dialog, 32rem at most, the gutter on a phone. */
.dialog-config {
  width: min(100% - 2rem, 32rem);
}

.dialog-body .settings-form { margin-top: 0; }

.funded-fields {
  display: grid;
  gap: 1.1rem;
}

.net-preview {
  padding: 0.6rem 0.8rem;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--text);
  font-weight: 620;
  font-variant-numeric: tabular-nums;
}

.net-preview:empty {
  display: none;
}

.dialog-foot-note {
  flex: 1 1 14rem;
  color: var(--text-3);
  font-size: 0.82rem;
}

.choice-list {
  display: grid;
  gap: 0.4rem;
}

.choice {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.choice:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.choice input {
  margin: 0.2rem 0 0;
  accent-color: var(--accent);
}

.choice-text {
  display: grid;
  gap: 0.1rem;
}

.choice-label {
  font-weight: 620;
}

.choice-hint {
  color: var(--text-3);
  font-size: 0.84rem;
}

.account-row-buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.4rem;
  flex-shrink: 0;
}

.exec-body {
  gap: 1.25rem;
}

.exec-status {
  color: var(--text-3);
  font-size: 0.9rem;
}

.exec-status[data-tone="error"] {
  color: var(--negative);
  font-weight: 560;
}

.exec-status[hidden] {
  display: none;
}

.exec-days {
  display: grid;
  gap: 1rem;
}

.exec-days:empty {
  display: none;
}

.exec-day {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  overflow: hidden;
}

.exec-day[data-today] {
  border-color: var(--border-strong);
}

.exec-day-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  padding: 0.7rem 0.9rem;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}

.exec-day-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.95rem;
  font-weight: 650;
}

.exec-day-title::first-letter {
  text-transform: uppercase;
}

.today-tag {
  padding: 0.08rem 0.5rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.exec-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.1rem;
  margin: 0;
}

.exec-stat {
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
}

.exec-stat dt {
  color: var(--text-3);
  font-size: 0.78rem;
}

.exec-stat dd {
  margin: 0;
  font-weight: 650;
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
}

.exec-stat dd[data-tone="positive"] {
  color: var(--positive);
}

.exec-stat dd[data-tone="negative"] {
  color: var(--negative);
}

.exec-explain {
  padding: 0.6rem 0.9rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-2);
  font-size: 0.88rem;
  font-weight: 540;
}

.exec-overlay {
  padding: 0.5rem 0.9rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-2);
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
}

.exec-day .exec-overlay:last-child {
  border-bottom: 0;
}

.exec-day .exec-explain:last-child {
  border-bottom: 0;
}

.exec-explain-solo {
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
}

.exec-none {
  padding: 0.75rem 0.9rem;
  color: var(--text-3);
  font-size: 0.88rem;
}

.exec-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  font-size: 0.87rem;
  font-variant-numeric: tabular-nums;
}

.exec-table th {
  padding: 0.45rem 0.9rem 0.35rem;
  color: var(--text-3);
  font-size: 0.74rem;
  font-weight: 600;
  text-align: left;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* Fixed widths, so every operation's fills line up with the next one's.
   Bug 1: the instrument column is gone (it is the operation's), so the
   price no longer shares a squeezed column with it. */
.exec-table th:nth-child(1) { width: 6.5rem; }
.exec-table th:nth-child(2) { width: 6rem; }
.exec-table th:nth-child(3) { width: 6.5rem; }
.exec-table th:nth-child(4) { width: 8rem; }
.exec-table th:nth-child(6) { width: 8.5rem; }

.exec-table td {
  padding: 0.42rem 0.9rem;
  border-top: 1px solid var(--border);
  vertical-align: middle;
}

.exec-table th:nth-child(3),
.exec-table th:nth-child(4),
.exec-table th:nth-child(6),
.exec-qty,
.exec-price,
.exec-result {
  text-align: right;
}

.exec-time {
  color: var(--text-2);
  font-family: var(--mono);
  font-size: 0.83rem;
}

.exec-instrument {
  font-weight: 560;
  white-space: nowrap;
}

.side-tag {
  display: inline-block;
  min-width: 4.2rem;
  padding: 0.05rem 0.45rem;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 650;
  text-align: center;
  background: var(--surface-2);
  color: var(--text-2);
}

.side-tag[data-tone="buy"] {
  background: var(--k-simetrico-bg);
  color: var(--k-simetrico);
}

.side-tag[data-tone="sell"] {
  background: var(--k-agresivo-bg);
  color: var(--k-agresivo);
}

.exec-order {
  white-space: nowrap;
}

.exec-order-name {
  color: var(--text-2);
}

.exec-muted {
  color: var(--text-3);
}

.role-tag {
  margin-left: 0.4rem;
  padding: 0.02rem 0.4rem;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  color: var(--text-3);
  font-size: 0.72rem;
  font-weight: 600;
}

.exec-order-name + .role-tag {
  margin-left: 0.4rem;
}

.exec-order > .role-tag:first-child {
  margin-left: 0;
}

.exec-foot {
  flex-wrap: nowrap;
}

.exec-note {
  color: var(--text-3);
  font-size: 0.8rem;
  max-width: 36rem;
}

.exec-qty-unit {
  display: none;
}

/* 0.1.4: an exit's gross result, beside its fill. */
.exec-result {
  font-weight: 650;
  white-space: nowrap;
}

.exec-result[data-tone="positive"] {
  color: var(--positive);
}

.exec-result[data-tone="negative"] {
  color: var(--negative);
}

/* Overlay stats T3: deposits and withdrawals on the overlay balance curve
   (the main chart's overlay panel since the layout rework). */
.overlay-marker {
  stroke: var(--surface);
  stroke-width: 1.5;
}

.overlay-marker.deposit { fill: var(--positive); }
.overlay-marker.withdrawal { fill: var(--negative); }

#overlay-status[data-tone="error"] { color: var(--negative); }
.overlay-warnings { margin: 0.25rem 0 0.75rem; padding-left: 1.25rem; font-size: 0.875rem; color: var(--negative); }
#overlay-account[data-tone="stale"] { color: var(--negative); }

/* Overlay stats T2: the hedge of each fired plan, theoretical vs real. */
.exec-gaps {
  border-top: 1px solid var(--border);
}

.exec-gaps-title {
  padding: 0.55rem 0.9rem 0.1rem;
  color: var(--text-2);
  font-size: 0.8rem;
  font-weight: 600;
}

.exec-gap-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.87rem;
  font-variant-numeric: tabular-nums;
}

.exec-gap-table th {
  padding: 0.45rem 0.9rem 0.35rem;
  color: var(--text-3);
  font-size: 0.74rem;
  font-weight: 600;
  text-align: left;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.exec-gap-table td {
  padding: 0.42rem 0.9rem;
  border-top: 1px solid var(--border);
  vertical-align: top;
}

.exec-gap-table .gap-num {
  text-align: right;
  white-space: nowrap;
}

.gap-diff {
  font-weight: 600;
}

.gap-diff[data-tone="positive"] { color: var(--positive); }
.gap-diff[data-tone="negative"] { color: var(--negative); }

.exec-gap-note {
  display: block;
  margin-top: 0.15rem;
  color: var(--text-3);
  font-size: 0.76rem;
}

.exec-gross-note {
  padding: 0.5rem 0.9rem;
  border-top: 1px solid var(--border);
  color: var(--text-3);
  font-size: 0.8rem;
}

/* Bug 6: the day's operations, entry to flat, with their fills folded in. */
.exec-trade-row {
  display: grid;
  grid-template-columns: 9.75rem minmax(0, 1fr) 11rem 8rem;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.9rem;
}

.exec-trade-head {
  white-space: nowrap;
  padding-bottom: 0.3rem;
  color: var(--text-3);
  font-size: 0.74rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.exec-trade-head > :nth-child(3),
.exec-trade-head > :nth-child(4),
.exec-trade-prices,
.exec-trade-row .exec-result {
  text-align: right;
}

.exec-trade-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.exec-trade {
  border-top: 1px solid var(--border);
}

.exec-trade-what {
  min-width: 0;
  color: var(--text-2);
}

.exec-trade-what strong {
  color: var(--text);
  font-weight: 560;
  white-space: nowrap;
}

.exec-trade-size,
.exec-trade-row .exec-time {
  white-space: nowrap;
}

.exec-trade-prices {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.exec-trade-fills {
  padding: 0 0.9rem 0.45rem;
}

.exec-trade-fills > summary {
  width: max-content;
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}

.exec-trade-fills[open] > summary {
  margin-bottom: 0.25rem;
}

.exec-trade-fills .exec-table {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm, 6px);
  background: var(--surface-2);
}

.exec-trade-fills .exec-table th,
.exec-trade-fills .exec-table td {
  padding-left: 0.6rem;
  padding-right: 0.6rem;
}

.exec-money {
  padding: 0.5rem 0.9rem;
  border-top: 1px solid var(--border);
  color: var(--text-2);
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
}

.exec-gap-table .gap-total td {
  border-top: 1px solid var(--border-strong);
  font-weight: 600;
}

#exec-empty p {
  margin: 0;
}

/* --- the day card of «Ver operaciones» (2026-10-29) ----------------------- */
/* Type, balances, SL and TP, margin to the drawdown floor, the day's hedge and
   tomorrow's type at a glance; the rest folds under «Ver detalle». */

.dc-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  padding: 0.7rem 0.9rem;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}

.dc-tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.6rem;
}

.dc-instrument {
  font-size: 0.9rem;
  font-weight: 650;
}

.dc-count {
  color: var(--text-3);
  font-size: 0.8rem;
}

.dc-kind,
.dc-pill {
  --k: var(--text-3);
  --k-bg: var(--surface);
}

.dc-kind[data-kind="AGRESIVO"], .dc-pill[data-kind="AGRESIVO"] { --k: var(--k-agresivo); --k-bg: var(--k-agresivo-bg); }
.dc-kind[data-kind="SIMETRICO"], .dc-pill[data-kind="SIMETRICO"] { --k: var(--k-simetrico); --k-bg: var(--k-simetrico-bg); }
.dc-kind[data-kind="CUMPLIMIENTO"], .dc-pill[data-kind="CUMPLIMIENTO"] { --k: var(--k-cumplimiento); --k-bg: var(--k-cumplimiento-bg); }
.dc-kind[data-kind="RECUPERACION"], .dc-pill[data-kind="RECUPERACION"] { --k: var(--k-recuperacion); --k-bg: var(--k-recuperacion-bg); }
.dc-kind[data-kind="RETIRAR"], .dc-pill[data-kind="RETIRAR"] { --k: var(--k-retirar); --k-bg: var(--k-retirar-bg); }
.dc-kind[data-kind="EVALUACION"], .dc-pill[data-kind="EVALUACION"] { --k: var(--k-evaluacion); --k-bg: var(--k-evaluacion-bg); }
.dc-kind[data-kind="QUEMAR"], .dc-pill[data-kind="QUEMAR"],
.dc-kind[data-kind="AGOTADA"], .dc-pill[data-kind="AGOTADA"] { --k: var(--k-hecho); --k-bg: var(--k-hecho-bg); }

.dc-kind {
  padding: 0.12rem 0.6rem;
  border-radius: var(--radius-sm);
  background: var(--k-bg);
  color: var(--k);
  font-size: 0.78rem;
  font-weight: 650;
}

.dc-body {
  display: grid;
  gap: 0.9rem;
  padding: 0.9rem;
}

.dc-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr));
  gap: 0.5rem;
}

.dc-tile {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.1rem;
  padding: 0.6rem 0.7rem;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  text-align: center;
}

.dc-label {
  color: var(--text-3);
  font-size: 0.78rem;
}

.dc-figure {
  font-size: 1rem;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.dc-sl-line {
  display: flex;
  justify-content: center;
  gap: 0.6rem;
  font-size: 0.92rem;
  font-variant-numeric: tabular-nums;
}

.dc-sl-key {
  color: var(--text-3);
}

.dc-sl-val {
  font-weight: 600;
}

.exec-card [data-tone="positive"] { color: var(--positive); }
.exec-card [data-tone="negative"] { color: var(--negative); }

.dc-dd {
  text-align: center;
}

.dc-dd-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  margin: 0.25rem 0;
}

.dc-dd-before {
  color: var(--text-3);
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
}

.dc-dd-arrow {
  color: var(--text-3);
}

/* The margin after the day is as big as the final balance. */
.dc-dd-chip {
  padding: 0.1rem 0.7rem;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 1rem;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.dc-dd-chip[data-tone="good"] { background: var(--k-retirar-bg); color: var(--k-retirar); }
.dc-dd-chip[data-tone="tight"] { background: var(--k-recuperacion-bg); color: var(--k-recuperacion); }
.dc-dd-chip[data-tone="low"] { background: var(--k-faltan-bg); color: var(--k-faltan); }

.dc-dd-note {
  color: var(--text-3);
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
}

.dc-dd-note b {
  color: var(--text);
  font-weight: 650;
}

.dc-hedge {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: baseline;
  gap: 0.75rem;
  padding-top: 0.65rem;
  border-top: 1px solid var(--border);
  font-size: 0.88rem;
  font-variant-numeric: tabular-nums;
}

.dc-hedge-title {
  color: var(--text-3);
}

.dc-hedge-mid {
  text-align: center;
}

.dc-hedge-diff {
  text-align: right;
}

.dc-hedge b {
  font-weight: 650;
}

.dc-next {
  text-align: center;
}

.dc-pill {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  padding: 0.3rem 1rem;
  border-radius: 999px;
  background: var(--k-bg);
  color: var(--k);
  font-size: 0.85rem;
}

.dc-pill b {
  font-weight: 650;
}

.dc-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: currentColor;
}

.dc-pill-fig {
  font-variant-numeric: tabular-nums;
}

.dc-more > summary {
  width: max-content;
  color: var(--accent);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
}

.dc-more[open] > summary {
  margin-bottom: 0.5rem;
}

/* Its blocks keep their own side padding (they sit flush in the old layout). */
.dc-detail {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  overflow: hidden;
}

.dc-detail > .exec-explain {
  border-bottom: 1px solid var(--border);
}

.dc-sec {
  margin: 0;
  padding: 0.75rem 0.9rem 0.3rem;
  color: var(--text-3);
  font-size: 0.78rem;
  font-weight: 650;
}

.dc-sec:not(:first-child) {
  border-top: 1px solid var(--border);
}

.dc-kv {
  display: grid;
  grid-template-columns: 1fr auto;
  margin: 0;
  padding: 0 0.9rem 0.5rem;
  font-size: 0.88rem;
}

.dc-kv dt,
.dc-kv dd {
  margin: 0;
  padding: 0.4rem 0;
  border-top: 1px solid var(--border);
}

.dc-kv dt:first-of-type,
.dc-kv dd:first-of-type {
  border-top: 0;
}

.dc-kv dt {
  color: var(--text-3);
}

.dc-kv dd {
  text-align: right;
  font-weight: 560;
  font-variant-numeric: tabular-nums;
}

.dc-money {
  margin: 0;
  padding: 0.45rem 0.9rem 0.6rem;
  color: var(--text-2);
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 36rem) {
  .dc-hedge {
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 0.2rem;
  }

  .dc-hedge-diff {
    text-align: center;
  }
}

/* --- small screens ------------------------------------------------------- */

@media (width <= 720px) {
  /* Rows stack on a phone, so there is no column to keep lined up. */
  .btn.is-placeholder {
    display: none;
  }

  .app-header-inner {
    padding: 0.9rem 1rem;
  }

  .page {
    padding: 1.25rem 1rem 3rem;
  }

  .plan-head {
    padding: 0.9rem 1rem 0 1.2rem;
  }

  .plan-body {
    grid-template-columns: 1fr;
    padding: 0.8rem 1rem 1rem 1.2rem;
  }

  .plan-stats {
    grid-template-columns: 1fr 1fr;
    min-width: 0;
    padding: 0.8rem 0 0;
    border-left: 0;
    border-top: 1px solid var(--border);
  }

  .plan-foot {
    padding: 0.6rem 1rem 0.7rem 1.2rem;
  }

  .closed-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .closed-figures {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .figures {
    gap: 0.5rem 1.5rem;
  }

  .figure dd {
    font-size: 1.45rem;
  }
}

@media (max-width: 520px) {
  .header-status {
    width: 100%;
  }

  .status-chip,
  .catalog-chip {
    flex: 1 1 auto;
  }

  .plan-head {
    flex-wrap: wrap;
    gap: 0.6rem;
  }

  .field-row,
  .advanced-grid {
    grid-template-columns: 1fr;
  }

  .dialog {
    width: 100%;
    max-width: none;
    max-height: 100%;
    margin: auto 0 0;
    border-radius: 14px 14px 0 0;
  }

  .dialog-foot-primary {
    width: 100%;
  }

  .dialog-foot-primary .btn {
    flex: 1;
  }

  .save-status {
    width: 100%;
    margin: 0;
  }

  .account-row {
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .account-row-buttons {
    margin-left: auto;
  }

  .review-row {
    flex-wrap: wrap;
  }

  .review-buttons {
    margin-left: auto;
  }

  .closed-row {
    grid-template-columns: 1fr;
  }

  .closed-figures {
    grid-template-columns: repeat(3, auto);
    justify-content: start;
    gap: 0.4rem 1.25rem;
  }

  .exec-foot {
    flex-wrap: wrap;
  }

  .exec-foot .btn {
    width: 100%;
  }

  /* Six columns do not fit: each fill becomes a two-line card. */
  .exec-table thead {
    display: none;
  }

  .exec-table tr {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.25rem 0.6rem;
    padding: 0.55rem 0.9rem;
    border-top: 1px solid var(--border);
  }

  .exec-table td {
    padding: 0;
    border: 0;
  }

  .exec-table .exec-time { grid-column: 1; grid-row: 1; }
  .exec-side { grid-column: 2; grid-row: 1; }
  .exec-price { grid-column: 3; grid-row: 1; font-weight: 600; }
  .exec-qty { grid-column: 1; grid-row: 2; text-align: left; color: var(--text-2); white-space: nowrap; }
  .exec-qty-unit { display: inline; }
  .exec-order { grid-column: 2; grid-row: 2; text-align: left; }
  .exec-table .exec-result { grid-column: 3; grid-row: 2; }

  .exec-trade-fills {
    padding-left: 0.6rem;
    padding-right: 0.6rem;
  }

  .exec-trade-fills .exec-table tr {
    padding: 0.45rem 0.6rem;
  }

  /* Bug 6: an operation becomes a two-line card on a phone. */
  .exec-trade-head {
    display: none;
  }

  .exec-trade-row {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.2rem 0.75rem;
  }

  .exec-trade-what { grid-column: 1; grid-row: 1; }
  .exec-trade-row .exec-result { grid-column: 2; grid-row: 1; }
  .exec-trade-prices { grid-column: 1 / -1; grid-row: 2; text-align: left; }
  .exec-trade-row .exec-time { grid-column: 1 / -1; grid-row: 3; }
}

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

/* --- T19: statistics ------------------------------------------------------ */

/* Chart series, fixed order (never cycled): Neto, Gastado, Retirado, Ganado.
   Validated with the dataviz palette checker on both surfaces; aqua and
   yellow sit under 3:1 on white, so every line also gets a direct end label
   and the tables carry every number. */
:root {
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --series-3: #1baf7a;
  --series-4: #eda100;
  --series-5: #e87ba4;
  --grid: #e8ebef;
}

@media (prefers-color-scheme: dark) {
  :root {
    --series-1: #3987e5;
    --series-2: #d95926;
    --series-3: #199e70;
    --series-4: #c98500;
    --series-5: #d55181;
    --grid: #262b34;
  }
}

.stats > .section + .section {
  margin-top: 1.25rem;
}

.card {
  padding: 1.1rem 1.25rem 1.2rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.6rem 1rem;
}

.card-title {
  font-size: 1rem;
  font-weight: 700;
}

.card-sub {
  color: var(--text-3);
  font-size: 0.85rem;
}

.kpi-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(9.5rem, 40vw), 1fr));
  gap: 0.6rem;
  margin-top: 0.75rem;
}

.kpi {
  display: grid;
  align-content: start;
  gap: 0.15rem;
  min-width: 0;
  padding: 0.8rem 0.95rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.kpi-big {
  padding: 1rem 1.1rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.kpi-label {
  color: var(--text-3);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* A short line key beside the tiles that are also chart series. */
.kpi-big[data-series="net"] .kpi-label::before,
.kpi-big[data-series="equity"] .kpi-label::before,
.kpi-big[data-series="spent"] .kpi-label::before,
.kpi-big[data-series="withdrawn"] .kpi-label::before {
  content: "";
  display: inline-block;
  width: 14px;
  height: 2px;
  margin: 0 0.45rem 0.2rem 0;
  border-radius: 1px;
  vertical-align: middle;
  background: var(--series-1);
}

.kpi-big[data-series="spent"] .kpi-label::before { background: var(--series-2); }
.kpi-big[data-series="withdrawn"] .kpi-label::before { background: var(--series-3); }

.kpi-value {
  font-size: 1.15rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.kpi-big .kpi-value {
  font-size: 1.6rem;
  letter-spacing: -0.01em;
}

/* stats-net-recovered round 2: «Balance» leads the five-tile headline. Five
   tiles share one row on a wide screen and wrap by width on a narrow one. */
#stats-headline {
  grid-template-columns: repeat(auto-fit, minmax(min(10.5rem, 100%), 1fr));
}

.kpi-big[data-emphasis="lead"] {
  border-color: var(--text-3);
}

.kpi-big[data-emphasis="lead"] .kpi-value {
  font-size: 2rem;
}

.kpi-value[data-tone="positive"] { color: var(--positive); }
.kpi-value[data-tone="negative"] { color: var(--negative); }

.kpi-sub {
  color: var(--text-3);
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--text-2);
  font-size: 0.86rem;
  cursor: pointer;
}

.toggle input {
  accent-color: var(--accent);
}

/* Layout rework: the chart's two series toggles, side by side. */
.toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1rem;
}

.toggle:has(input:disabled) {
  color: var(--text-3);
  cursor: not-allowed;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.1rem;
  margin: 0.8rem 0 0.25rem;
  color: var(--text-2);
  font-size: 0.85rem;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.chart {
  width: 100%;
  min-height: 1px;
}

.chart-svg {
  display: block;
  max-width: 100%;
  height: auto;
  overflow: visible;
}

.chart-grid line {
  stroke: var(--grid);
  stroke-width: 1;
}

.chart-grid line.divider {
  stroke: var(--border);
}

.chart-grid text.panel-caption {
  fill: var(--text-2);
  font-weight: 600;
}

.chart-grid line.zero {
  stroke: var(--border-strong);
}

.chart-grid text,
.chart-end-labels text {
  fill: var(--text-3);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.chart-end-labels text {
  fill: var(--text-2);
  font-weight: 600;
}

.series-line {
  fill: none;
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.series-line.s1 { stroke: var(--series-1); }
.series-line.s2 { stroke: var(--series-2); }
.series-line.s3 { stroke: var(--series-3); }
.series-line.s4 { stroke: var(--series-4); }
.series-line.s5 { stroke: var(--series-5); }
.series-line.dashed { stroke-dasharray: 6 4; }

.chart-hits rect {
  fill: transparent;
}

.chart-hits .crosshair {
  stroke: var(--text-3);
  stroke-width: 1;
  visibility: hidden;
}

.chart-hits .hit:hover .crosshair,
.chart-hits .hit:focus .crosshair {
  visibility: visible;
}

.chart-hits .hit:focus {
  outline: none;
}

.chart-hits .hit:focus rect {
  fill: var(--accent-soft);
  fill-opacity: 0.5;
}

.chart-caption {
  margin-top: 0.6rem;
  color: var(--text-3);
  font-size: 0.82rem;
}

.table-wrap {
  margin-top: 0.75rem;
  overflow-x: auto;
}

/* Cost table filters: they wrap on a phone, the table keeps its own scroll. */
.account-filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.account-toggle {
  margin-top: 0.6rem;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  font-variant-numeric: tabular-nums;
}

.data-table th,
.data-table td {
  padding: 0.55rem 0.6rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.data-table thead th {
  color: var(--text-3);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.data-table tbody th {
  font-weight: 650;
}

.data-table tbody tr:last-child > * {
  border-bottom: 0;
}

/* Layout rework: the account table's totals row carries the headline's
   figures, "Gastado en overlay" included. */
.data-table tfoot th,
.data-table tfoot td {
  border-top: 2px solid var(--border);
  border-bottom: 0;
  font-weight: 650;
}

.data-table .num {
  text-align: right;
  white-space: nowrap;
}

.data-table .strong {
  font-weight: 650;
}

.data-table [data-tone="positive"] { color: var(--positive); }
.data-table [data-tone="negative"] { color: var(--negative); }

.data-table .dates {
  min-width: 7.5rem;
  color: var(--text-3);
}

.account-cell {
  display: grid;
  gap: 0.05rem;
  min-width: 10rem;
}

.account-cell-meta,
.cell-sub {
  color: var(--text-3);
  font-size: 0.78rem;
  font-weight: 450;
}

.cell-sub {
  display: block;
}

.data-table .status-pill {
  white-space: nowrap;
}

@media (width <= 720px) {
  .kpi-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .kpi-big .kpi-value {
    font-size: 1.3rem;
  }

  .card {
    padding: 0.9rem 0.9rem 1rem;
  }
}

/* --- T25: /configuracion ------------------------------------------------- */

.settings-page > .section + .section {
  margin-top: 1.25rem;
}

.settings-form {
  display: grid;
  gap: 1.1rem;
  margin-top: 1rem;
}

.mode-list {
  display: grid;
  gap: 0.5rem;
}

.mode-option {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.7rem;
  align-items: start;
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.mode-option:hover {
  background: var(--surface-2);
}

.mode-option:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.mode-option input {
  margin: 0.2rem 0 0;
  accent-color: var(--accent);
}

.mode-text {
  display: grid;
  gap: 0.15rem;
}

.mode-title {
  font-weight: 650;
}

.mode-short {
  color: var(--text-2);
  font-size: 0.86rem;
}

.col-hint {
  display: block;
  margin-top: 0.1rem;
  color: var(--text-3);
  font-size: 0.8rem;
  font-weight: 450;
  letter-spacing: 0;
  text-transform: none;
  white-space: normal;
}

.import-warn { color: var(--warn); font-weight: 560; }

.import-confirm {
  display: grid;
  gap: 0.4rem;
  padding: 0.6rem 0.7rem;
  border-radius: var(--radius-sm);
  background: var(--warn-soft);
}

.import-confirm-text { margin: 0; color: var(--text); font-size: 0.86rem; font-weight: 600; }
.import-confirm-actions { display: flex; flex-wrap: wrap; gap: 0.4rem; }

/* Links on this page keep the link token, visited or not. */
.settings-page a:not(.btn):not(.index-link):not(.ready-tile),
.settings-page a:visited:not(.btn):not(.index-link):not(.ready-tile) { color: var(--accent); }

.mode-detail { margin: 0.35rem 0 0; display: grid; gap: 0.2rem; }
.mode-detail dt { margin-top: 0.4rem; color: var(--text); font-size: 0.85rem; font-weight: 650; }
.mode-detail dd { margin: 0; color: var(--text-2); font-size: 0.84rem; }

.section-scope { margin-top: 0.15rem; }

.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(14rem, 100%), 1fr));
  gap: 1rem;
}

/* Por casa (2026-10-22): one card per prop firm. */
.firms-list {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.firm-row {
  padding: 0.8rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.firm-row-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.3rem 1rem;
  margin-bottom: 0.6rem;
}

.firm-row-name {
  margin: 0;
  font-size: 1rem;
}

.firm-row-note {
  margin: 0;
  color: var(--text-3);
  font-size: 0.85rem;
}

.firm-row-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(13rem, 100%), 1fr));
  gap: 0.75rem;
}

.firm-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.7rem;
}

.settings-cushion {
  margin: 0;
  text-wrap: pretty;
  padding: 0.6rem 0.8rem;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  font-variant-numeric: tabular-nums;
}

.settings-cushion:empty {
  display: none;
}

.settings-actions {
  display: flex;
  justify-content: flex-end;
}

.import-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(16rem, 100%), 1fr));
  gap: 0.75rem;
  margin-top: 0.9rem;
}

.import-grid .import-option {
  border: 0;
  border-top: 1px solid var(--border);
  border-radius: 0;
}

.import-pick {
  align-self: flex-start;
  margin-top: 0.45rem;
}

/* --- T26: /simulador -------------------------------------------------------- */

.sim-page > .section + .section,
.sim-page > div > .section + .section {
  margin-top: 1.25rem;
}

.sim-controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(11rem, 100%), 1fr));
  gap: 0.9rem;
  margin: 0.9rem 0 0.6rem;
}

.sim-type-field {
  grid-column: span 2;
}

.sim-legend {
  display: grid;
  gap: 0.25rem;
  margin: 0.8rem 0 0;
  padding-left: 1.1rem;
  color: var(--text-2);
  font-size: 0.86rem;
}

.sim-teo {
  color: var(--k-evaluacion);
}

.sim-margin {
  color: var(--accent);
}

.sim-table td.sim-best {
  background: var(--accent-soft);
  font-weight: 700;
}

.tone-positive {
  color: var(--positive);
}

.tone-negative {
  color: var(--negative);
}

.sim-summary .hint {
  margin-top: 0.5rem;
}

.sim-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  margin-bottom: 0.4rem;
}

.sim-bar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* The tree scrolls inside its own box, never the page. */
.sim-treebox {
  margin-top: 0.6rem;
  max-height: 80vh;
  overflow: auto;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.sim-tree,
.sim-tree ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.sim-tree li {
  position: relative;
  display: flex;
  align-items: center;
}

.sim-kids {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 12px;
  padding-left: 22px;
}

.sim-kids::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 22px;
  border-top: 2px solid var(--border-strong);
}

.sim-kids > li {
  padding-left: 22px;
}

.sim-kids > li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 22px;
  border-top: 2px solid var(--border-strong);
}

.sim-kids > li::after {
  content: "";
  position: absolute;
  left: 0;
  border-left: 2px solid var(--border-strong);
}

.sim-kids > li:first-child::after {
  top: 50%;
  bottom: -6px;
}

.sim-kids > li:last-child::after {
  top: -6px;
  height: calc(50% + 6px);
}

.sim-node {
  display: flex;
  flex: none;
  flex-direction: column;
  gap: 3px;
  width: 404px;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: 0.8rem;
}

.sim-node-f {
  border-color: var(--positive);
  background: var(--k-retirar-bg);
}

.sim-node-q {
  border-color: var(--negative);
  background: var(--k-faltan-bg);
}

.sim-node-u {
  border-color: var(--warn);
  background: var(--k-recuperacion-bg);
}

.sim-node-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.sim-node-title {
  font-size: 0.84rem;
  font-weight: 650;
}

.sim-edge {
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.sim-edge-win {
  background: var(--k-retirar-bg);
  color: var(--positive);
}

.sim-edge-loss {
  background: var(--k-faltan-bg);
  color: var(--negative);
}

.sim-row {
  display: grid;
  grid-template-columns: 62px repeat(4, minmax(0, 1fr));
  gap: 4px;
  font-family: var(--mono);
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
}

.sim-row > span:not(.sim-k) {
  text-align: right;
}

.sim-k {
  font-family: var(--font);
  color: var(--text-3);
}

.sim-row-head > span {
  font-family: var(--font);
  font-size: 0.62rem;
  font-weight: 650;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.sim-note {
  color: var(--text-3);
  font-size: 0.74rem;
  font-variant-numeric: tabular-nums;
}

.sim-toggle {
  align-self: flex-start;
  margin-top: 4px;
}

@media (max-width: 520px) {
  .sim-type-field {
    grid-column: auto;
  }
}

/* T25/N3: the nav's sections must still fit a phone. */
@media (max-width: 520px) {
  .app-nav {
    width: 100%;
  }

  .app-nav-link {
    flex: 1 1 auto;
    padding: 0.35rem 0.45rem;
    font-size: 0.84rem;
    text-align: center;
  }
}

/* --- N3: the "Hoy" news banner and the Noticias page --------------------- */

.news-banner {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.news-banner-events {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  margin: 0;
  padding: 0;
  list-style: none;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.news-banner-holiday {
  color: var(--warn);
}

.news-banner-gate {
  font-weight: 600;
}

.news-banner[data-blocked="true"] {
  border-left-color: var(--negative);
}

.news-banner[data-blocked="true"] .news-banner-gate {
  color: var(--negative);
}

/* The Noticias page: the gate ("can I operate now?"), today's strip, and the
   week grouped by block window. Tokens only. */

.news-page .section-head {
  margin-bottom: 0.9rem;
}

.news-page .section-sub {
  max-width: 46rem;
}

.news-rule {
  margin-top: 0.35rem;
  color: var(--text-3);
  font-size: 0.82rem;
}

.news-rule summary {
  width: fit-content;
  color: var(--accent);
  font-weight: 600;
  cursor: pointer;
}

.news-rule summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

.news-rule ul {
  max-width: 46rem;
  margin: 0.5rem 0 0;
  padding-left: 1.1rem;
}

.news-rule li + li {
  margin-top: 0.2rem;
}

/* --- the gate --- */
.news-gate {
  margin-bottom: 1.25rem;
}

.news-gate-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.3rem 1.5rem;
}

.news-gate-state {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0;
  font-size: 1.3rem;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.news-gate-mark {
  flex: none;
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 999px;
  background: var(--positive);
}

.news-gate[data-state="blocked"] .news-gate-mark,
.news-gate[data-state="nodata"] .news-gate-mark {
  background: var(--negative);
}

.news-gate[data-state="loading"] .news-gate-mark {
  background: var(--text-3);
}

.news-gate[data-state="blocked"] .news-gate-state,
.news-gate[data-state="nodata"] .news-gate-state {
  color: var(--negative);
}

.news-gate[data-state="loading"] .news-gate-state {
  color: var(--text-3);
}

.news-gate-detail {
  max-width: 46rem;
  margin: 0.3rem 0 0;
  color: var(--text-2);
}

.news-gate-detail:empty {
  display: none;
}

.news-gate-age {
  margin: 0;
  color: var(--text-3);
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
}

/* --- today's strip: the blocked stretches of the session --- */
.news-strip {
  margin-top: 1rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--border);
}

.news-strip-label {
  margin: 0;
  color: var(--text-3);
  font-size: 0.82rem;
}

.news-strip-track {
  position: relative;
  height: 1.75rem;
  margin-top: 0.45rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.news-strip-block {
  position: absolute;
  top: -1px;
  bottom: -1px;
  left: var(--from);
  width: var(--span);
  border: 1px solid color-mix(in srgb, var(--warn) 45%, transparent);
  border-radius: 4px;
  background: var(--warn-soft);
}

.news-strip-block.is-current {
  border-color: color-mix(in srgb, var(--negative) 55%, transparent);
  background: var(--negative-soft);
}

.news-strip-now {
  position: absolute;
  top: -5px;
  bottom: -5px;
  left: var(--now);
  width: 2px;
  margin-left: -1px;
  border-radius: 999px;
  background: var(--accent);
}

.news-strip-hours {
  position: relative;
  height: 1.1rem;
  margin-top: 0.3rem;
  color: var(--text-3);
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
}

.news-strip-hours span {
  position: absolute;
  left: var(--at);
  transform: translateX(-50%);
}

.news-strip-hours span:first-child {
  transform: none;
}

.news-strip-hours span:last-child {
  transform: translateX(-100%);
}

.news-strip-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
  margin: 0.5rem 0 0;
  padding: 0;
  list-style: none;
  color: var(--text-2);
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
}

.news-strip-legend b {
  color: var(--text);
  font-weight: 650;
}

/* --- the week --- */
.news-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  margin-bottom: 0.75rem;
}

.news-toolbar-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
}

.news-days {
  display: grid;
  gap: 1rem;
}

.news-day-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.2rem 1rem;
}

.news-day-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
}

.news-day-count {
  color: var(--text-3);
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
}

/* A past day folds into one line: it no longer changes what you do today. */
.news-day-past {
  padding: 0.7rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-3);
}

.news-day-past summary {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.2rem 1rem;
  cursor: pointer;
  list-style: none;
}

.news-day-past summary::-webkit-details-marker {
  display: none;
}

.news-day-past summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
  border-radius: 4px;
}

.news-day-past .news-day-title {
  color: var(--text-2);
  font-weight: 600;
}

.news-day-past[open] summary {
  margin-bottom: 0.2rem;
}

/* Column grid shared by the header row and every event row. The time column
   is as wide as its longest value, «Todo el día», so a holiday row never
   wraps. */
.news-cols {
  display: grid;
  grid-template-columns: 5.25rem minmax(0, 1fr) 4.6rem 5rem 5rem;
  align-items: baseline;
  gap: 0 1rem;
}

.news-list-head {
  margin-top: 0.8rem;
  padding: 0 0 0.4rem 9.5rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-3);
  font-size: 0.78rem;
}

.news-list-head .is-num {
  text-align: right;
}

.news-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

/* One row = one block window (which may merge several events) or one event
   that does not block. The window, not the event, is the unit. */
.news-window {
  display: grid;
  grid-template-columns: 8.5rem minmax(0, 1fr);
  gap: 0 1rem;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--border);
}

.news-list > :last-child {
  border-bottom: 0;
  padding-bottom: 0.1rem;
}

.news-window-span {
  font-variant-numeric: tabular-nums;
}

.news-window-range {
  display: block;
  font-weight: 700;
}

.news-window-why {
  display: block;
  color: var(--text-3);
  font-size: 0.78rem;
}

.news-window.is-current .news-window-range,
.news-window.is-current .news-window-why {
  color: var(--negative);
}

.news-window-events {
  display: grid;
  gap: 0.4rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.news-event-time {
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.news-event-title {
  min-width: 0;
  overflow-wrap: anywhere;
}

.news-event-country {
  margin-left: 0.4rem;
  color: var(--text-3);
  font-size: 0.82rem;
}

.news-event-num {
  text-align: right;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}

.news-event-num:empty::before {
  content: "—";
  color: var(--text-3);
}

/* A keyword block on a low-impact event: said in words, not by colour. */
.news-keyword {
  display: inline-block;
  margin-left: 0.4rem;
  padding: 0.05rem 0.45rem;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  color: var(--text-2);
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

/* Impact: three steps of weight, one colour only at the top. */
.news-impact {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-3);
}

.news-impact[data-impact="High"] {
  justify-self: start;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  background: var(--warn-soft);
  color: var(--warn);
  font-weight: 750;
}

.news-impact[data-impact="Medium"] {
  color: var(--text);
  font-weight: 700;
}

/* What does not block, and what already happened, steps back. */
.news-window.is-quiet,
.news-window.is-past {
  color: var(--text-3);
}

.news-window.is-quiet .news-event-time,
.news-window.is-past .news-event-time,
.news-window.is-past .news-window-range {
  font-weight: 500;
}

.news-window.is-past .news-event-num,
.news-window.is-quiet .news-event-num {
  color: var(--text-3);
}

.news-window.is-past .news-impact[data-impact] {
  padding: 0;
  background: none;
  color: var(--text-3);
  font-weight: 600;
}

.news-now {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.3rem 0;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.news-now::after {
  content: "";
  flex: 1;
  height: 2px;
  border-radius: 999px;
  background: var(--accent);
}

.news-list:has(.news-now) > :has(+ .news-now) {
  border-bottom: 0;
}

/* Today with nothing to show still says so, under the "Ahora" line. */
.news-quiet-line {
  padding: 0.5rem 0 0.1rem;
  color: var(--text-3);
}

@media (max-width: 44rem) {
  .news-list-head {
    display: none;
  }

  .news-list {
    margin-top: 0.6rem;
    border-top: 1px solid var(--border);
  }

  .news-window {
    grid-template-columns: 1fr;
    gap: 0.3rem;
  }

  .news-window-range,
  .news-window-why {
    display: inline;
  }

  .news-window-why::before {
    content: " · ";
  }

  .news-window.is-quiet .news-window-span {
    display: none;
  }

  .news-cols {
    grid-template-columns: 3.2rem minmax(0, 1fr) auto;
    gap: 0.1rem 0.75rem;
  }

  /* «Todo el día» does not fit the narrow time column and would wrap onto
     several lines: on a holiday row the time takes the line above the title. */
  .news-cols.is-holiday {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .news-cols.is-holiday .news-event-time,
  .news-cols.is-holiday .news-event-num {
    grid-column: 1 / -1;
  }

  .news-event-num {
    grid-column: 2 / -1;
    text-align: left;
    font-size: 0.82rem;
  }

  .news-event-num::before {
    content: attr(data-label) " ";
    color: var(--text-3);
  }

  .news-event-num:empty {
    display: none;
  }

  .news-strip-hours span:nth-child(even) {
    display: none;
  }
}

/* C7: Operar on the plan card. */
.plan-operar {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.4rem;
  padding: 0 1.25rem 0.75rem 1.5rem;
}

/* Collapsed by updateOperar (operarAreaVisible) when it has nothing to say. */
.plan-operar[hidden] {
  display: none;
}

.operar-reason {
  margin: 0;
  color: var(--warn);
  font-size: 0.87rem;
  font-weight: 600;
}

.operar-blockers {
  color: var(--text-2);
  font-size: 0.84rem;
}

.operar-blockers ul {
  margin: 0.3rem 0 0;
  padding-left: 1.1rem;
}

.session-switch {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.4rem;
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.session-switch p {
  margin: 0;
}

.session-switch-text {
  font-weight: 650;
}

.session-switch[data-loading="true"] .session-switch-text::before {
  content: "";
  display: inline-block;
  width: 0.8em;
  height: 0.8em;
  margin-right: 0.5em;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  vertical-align: -0.1em;
  animation: session-switch-spin 0.9s linear infinite;
}

.nt8-launch {
  margin-bottom: 1rem;
}

.nt8-launch-title {
  margin: 0;
  font-size: 1rem;
}

.nt8-launch-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.nt8-launch-warning-line {
  margin: 0.25rem 0;
  color: var(--warn);
  font-size: 0.9rem;
}

.nt8-launch-exposure-note {
  margin: 0.25rem 0;
  color: var(--muted, inherit);
  font-size: 0.85rem;
}

.session-switch-failure {
  color: var(--warn);
  font-size: 0.87rem;
}

@keyframes session-switch-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .session-switch[data-loading="true"] .session-switch-text::before {
    animation: none;
  }
}

.link-btn {
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  font: inherit;
  font-size: 0.87rem;
  text-decoration: underline;
  cursor: pointer;
}

.operar-status {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.3rem;
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--border);
  border-left-width: 4px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.operar-status[data-tone="ok"] {
  border-left-color: var(--positive);
}

.operar-status[data-tone="pending"] {
  border-left-color: var(--accent);
}

.operar-status[data-tone="error"] {
  border-left-color: var(--warn);
}

.operar-status[data-tone="danger"] {
  border-color: var(--negative);
  background: var(--k-faltan-bg);
}

.operar-status p,
.operar-status ul {
  margin: 0;
}

.operar-status-text {
  font-weight: 650;
}

.operar-status[data-tone="danger"] .operar-status-text,
.operar-status[data-tone="danger"] .operar-status-instruction {
  color: var(--negative);
  font-weight: 700;
}

.operar-status-details {
  padding-left: 1.1rem;
  font-size: 0.87rem;
}

.operar-summary {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.35rem 1rem;
  margin: 0 0 0.75rem;
}

.operar-summary dt {
  color: var(--text-3);
}

.operar-summary dd {
  margin: 0;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.operar-overriding {
  margin: 0 0 0.75rem;
  padding-left: 1.1rem;
  color: var(--warn);
  font-weight: 600;
}

.check-line {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
  font-weight: 600;
}

/* P1: dev instances say so on every page, in a colour no normal page uses. */
.env-band {
  position: sticky;
  top: 0;
  z-index: 1000;
  padding: 4px 12px;
  background: #b4237d;
  color: #fff;
  font: 600 0.8rem/1.4 system-ui, sans-serif;
  letter-spacing: 0.06em;
  text-align: center;
}

/* 0.1.3: the environment is always named, in both. Prod is calm, dev is the
   same loud magenta as its band, so the two never look alike. */
.env-badge {
  display: inline-block;
  margin-top: 0.2rem;
  padding: 1px 8px;
  border-radius: 999px;
  font: 700 0.7rem/1.5 system-ui, sans-serif;
  letter-spacing: 0.08em;
  vertical-align: middle;
}
.env-badge-prod {
  background: #e3f1e8;
  color: #1e5e38;
  border: 1px solid #a8d5b7;
}
.env-badge-dev {
  background: #b4237d;
  color: #fff;
  border: 1px solid #8a1a5f;
}

/* Operar's dialog names the environment the plan goes to. */
.operar-env {
  margin: 0 0 0.75rem;
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
  font-weight: 700;
}
.operar-env-prod { background: #e3f1e8; color: #1e5e38; }
.operar-env-dev { background: #b4237d; color: #fff; }
.operar-env-unknown { background: #fff4d6; color: #7a4b00; }

/* P3: the version, small and out of the way, at the bottom of every page. */
.app-footer {
  padding: 1rem 12px 1.5rem;
  color: var(--text-3);
  font: 0.75rem/1.4 system-ui, sans-serif;
  text-align: center;
}

/* P8: first-run checklist. Compact (one line) once every step is green. */
.first-run-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; }
.first-run-list li { padding-left: 0.75rem; border-left: 3px solid currentColor; }
.first-run-ok { opacity: 0.7; }
.first-run-todo { font-weight: 500; }
.first-run-compact .card-title { display: inline; margin-right: 0.5rem; }
.first-run-compact .card-sub { display: inline; margin: 0; }

/* NT8 login per firm (Configuración) */
.nt8-login-list {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
  display: grid;
  gap: 0.6rem;
}

.nt8-login-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 1rem;
  padding: 0.6rem 0.8rem;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.nt8-login-row .nt8-login-firm {
  font-weight: 600;
}

.nt8-login-row .nt8-login-meta {
  color: var(--text-2);
  font-size: 0.86rem;
}

.nt8-login-row .nt8-login-actions {
  margin-left: auto;
  display: flex;
  gap: 0.4rem;
}

.nt8-login-form-title {
  margin: 0 0 0.6rem;
  font-size: 0.95rem;
}

.nt8-login-form .settings-actions,
#nt8-login-form .settings-actions {
  gap: 0.5rem;
}

/* Remote nodes R1: the Equipos page. */
.equipos-facts {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.35rem 1rem;
  margin: 0.8rem 0 0;
}

.equipos-facts dt {
  color: var(--text-2);
  font-size: 0.86rem;
}

.equipos-facts dd {
  margin: 0;
}

.equipos-pairing {
  padding: 0.8rem 1rem;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.equipos-pairing-status {
  margin: 0.6rem 0 0;
  font-weight: 620;
}

.equipos-pairing-status:empty { display: none; }

.equipos-pairing[hidden] {
  display: none;
}

.equipos-code {
  font-size: 1.35rem;
  font-weight: 650;
  letter-spacing: 0.08em;
}

.equipos-state {
  font-size: 0.86rem;
  font-weight: 560;
  color: var(--text-3);
}

.equipos-state[data-tone="ok"] {
  color: var(--positive);
}

.equipos-state[data-tone="error"] {
  color: var(--negative);
}

.equipos-skew {
  flex-basis: 100%;
  margin: 0;
  color: var(--warn);
  font-size: 0.86rem;
}

.equipos-outbox {
  flex-basis: 100%;
  margin: 0;
  color: var(--muted, inherit);
  font-size: 0.86rem;
}

.equipos-outbox[data-tone="warn"] {
  color: var(--warn);
}

.equipos-row select {
  min-width: 11rem;
}

/* R2.3c: the logins inside each node's card. */
.equipos-node-logins {
  flex-basis: 100%;
  display: grid;
  justify-items: start;
  gap: 0.5rem;
  padding-top: 0.6rem;
  border-top: 1px solid var(--border);
}

.equipos-node-logins-title {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 600;
}

.equipos-node-logins p {
  margin: 0;
}

.equipos-login-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.5rem;
  width: 100%;
}

.equipos-login {
  display: grid;
  gap: 0.2rem;
}

.equipos-login-head {
  display: flex;
  align-items: center;
  gap: 0.6rem 1rem;
}

/* CS-T6: Hoy's MT5 margin line */
/* CS-T13: the «Margen MT5» bar above both Hoy views - in use, reserved by
   hedges opening, free - over the equity. A stale reading is dimmed. */
.mt5-margin {
  margin: 0.5rem 0;
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: 0.85rem;
  color: var(--text-2);
  --seg-used: var(--accent);
  --seg-reserved: var(--warn);
  --seg-available: var(--positive);
}

.mt5-margin[hidden],
.mt5-margin [hidden] {
  display: none;
}

.mt5-margin-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 0.75rem;
}

.mt5-margin-title {
  color: var(--text);
}

.mt5-margin-source {
  margin-left: auto;
  color: var(--text-3);
  font-size: 0.78rem;
}

.mt5-margin-track {
  display: flex;
  margin-top: 0.4rem;
  height: 10px;
  border-radius: 999px;
  background: var(--skeleton);
  overflow: hidden;
}

.mt5-margin-seg {
  height: 100%;
  width: 0;
  transition: width 0.3s;
}

.mt5-margin-seg[data-seg="used"],
.mt5-margin-legend [data-seg="used"] .mt5-margin-swatch {
  background: var(--seg-used);
}

.mt5-margin-seg[data-seg="reserved"],
.mt5-margin-legend [data-seg="reserved"] .mt5-margin-swatch {
  background: var(--seg-reserved);
}

.mt5-margin-seg[data-seg="available"],
.mt5-margin-legend [data-seg="available"] .mt5-margin-swatch {
  background: var(--seg-available);
}

.mt5-margin-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
  margin: 0.4rem 0 0;
  padding: 0;
  list-style: none;
}

.mt5-margin-legend li {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.mt5-margin-swatch {
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 2px;
}

.mt5-margin-amount {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.mt5-margin-status {
  margin: 0.4rem 0 0;
}

.mt5-margin[data-tone="stale"] .mt5-margin-track,
.mt5-margin[data-tone="stale"] .mt5-margin-legend {
  opacity: 0.45;
  filter: grayscale(1);
}

.mt5-margin[data-tone="stale"] .mt5-margin-status {
  color: var(--warn);
}

.mt5-margin[data-tone="blocked"] .mt5-margin-status,
.mt5-margin[data-tone="blocked"] [data-seg="available"] .mt5-margin-amount {
  color: var(--negative);
}

/* CS-T13: «Esta cobertura ocupa X $» on each plan (classic row and card). */
.hedge-margin {
  margin: 0.25rem 0 0;
  font-size: 0.8rem;
  color: var(--positive);
}

.hedge-margin[hidden] {
  display: none;
}

.hedge-margin[data-tone="blocked"] {
  color: var(--negative);
}

@media (width <= 720px) {
  .mt5-margin-legend {
    flex-direction: column;
  }

  .mt5-margin-source {
    margin-left: 0;
    flex-basis: 100%;
  }
}

/* ===========================================================================
   Dashboard: «Hoy» (teams > firms > account cards). The classic list's rules
   above still dress the detail panel's pieces.
   =========================================================================== */

/* Only «Hoy» is this wide (its body is marked); the other pages keep 1080px. */
body[data-view="dashboard"] .page,
body[data-view="dashboard"] .app-header-inner {
  max-width: 1280px;
}

/* On a narrow screen the section nav wraps instead of pushing the page sideways. */
.app-nav {
  flex-wrap: wrap;
}

.app-nav-link {
  white-space: nowrap;
}

.dash-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.75rem 1rem;
}

.dash-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.dash-tools[hidden],
.dash[hidden] {
  display: none;
}

#dash-attention[aria-pressed="true"] {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-hover);
}

.dash {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.dash-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 0.75rem;
}

.dash-tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem 1.1rem;
  box-shadow: var(--shadow-sm);
}

.dash-tile-label,
.dash-tile-note {
  font-size: 0.82rem;
  color: var(--text-3);
}

.dash-tile-label {
  font-weight: 600;
}

.dash-tile-value {
  margin: 0.2rem 0 0.1rem;
  font-size: 1.85rem;
  font-weight: 750;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.dash-tile[data-tone="positive"] .dash-tile-value { color: var(--positive); }
.dash-tile[data-tone="negative"] .dash-tile-value { color: var(--negative); }
.dash-tile[data-tone="warn"] .dash-tile-value { color: var(--warn); }

.dash-teams {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.dash-team {
  --team: var(--positive);
  --team-bg: var(--surface);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.dash-team[data-tone="warn"] {
  --team: var(--warn);
  --team-bg: var(--k-recuperacion-bg);
  border-color: color-mix(in srgb, var(--warn) 35%, var(--border));
}

.dash-team[data-tone="down"] {
  --team: var(--negative);
  --team-bg: var(--k-faltan-bg);
  border-color: color-mix(in srgb, var(--negative) 35%, var(--border));
}

.dash-team-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem 1rem;
  padding: 0.75rem 0.9rem 0.75rem 1.1rem;
  background: var(--team-bg);
}

.dash-team-id {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.dash-dot {
  flex: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--team);
}

.dash-team-line {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 0.65rem;
}

.dash-team-name {
  margin: 0;
  font-size: 1.15rem;
}

.dash-team-link,
.dash-team-summary {
  font-size: 0.85rem;
  color: var(--text-2);
}

.dash-team-summary {
  margin: 0.1rem 0 0;
}

.dash-team-side {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.dash-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.dash-chip {
  font-size: 0.78rem;
  font-weight: 600;
  border-radius: 999px;
  padding: 0.22rem 0.65rem;
  background: var(--surface-2);
  color: var(--text-2);
}

.dash-chip[data-tone="ok"] { background: var(--k-retirar-bg); color: var(--positive); }
.dash-chip[data-tone="warn"] { background: var(--k-recuperacion-bg); color: var(--warn); }

.dash-fold {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  cursor: pointer;
}

.dash-fold:hover {
  background: var(--surface-2);
}

.dash-fold svg {
  transition: transform 0.15s;
}

.dash-fold[aria-expanded="true"] svg {
  transform: rotate(180deg);
}

.dash-fold[hidden] {
  display: none;
}

.dash-team-warning {
  margin: 0;
  padding: 0.6rem 1.1rem;
  border-top: 1px solid var(--border);
  background: var(--team-bg);
  color: var(--team);
  font-size: 0.9rem;
  font-weight: 600;
}

.dash-team-warning[hidden],
.dash-team-body[hidden] {
  display: none;
}

.dash-team-body {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.25rem 1.1rem 1.2rem;
  border-top: 1px solid var(--border);
}

.dash-casa {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding-top: 0.9rem;
}

.dash-casa-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.25rem 1rem;
}

.dash-casa-title {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.6rem;
}

.dash-casa-name {
  margin: 0;
  font-size: 1rem;
}

.dash-casa-counts,
.dash-casa-login {
  font-size: 0.85rem;
  color: var(--text-2);
}

.dash-casa-login[data-tone="warn"] {
  color: var(--warn);
  font-weight: 600;
}

.dash-casa-login[hidden] {
  display: none;
}

.dash-grid {
  position: relative;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 0.75rem;
  align-items: start;
}

.dash-card {
  --k: var(--k-hecho);
  --k-bg: var(--k-hecho-bg);
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  min-width: 0;
  padding: 0.75rem 0.75rem 0.65rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.dash-card[data-kind="AGRESIVO"] { --k: var(--k-agresivo); --k-bg: var(--k-agresivo-bg); }
.dash-card[data-kind="SIMETRICO"] { --k: var(--k-simetrico); --k-bg: var(--k-simetrico-bg); }
.dash-card[data-kind="CUMPLIMIENTO"] { --k: var(--k-cumplimiento); --k-bg: var(--k-cumplimiento-bg); }
.dash-card[data-kind="RECUPERACION"] { --k: var(--k-recuperacion); --k-bg: var(--k-recuperacion-bg); }
.dash-card[data-kind="RETIRAR"] { --k: var(--k-retirar); --k-bg: var(--k-retirar-bg); }
.dash-card[data-kind="EVALUACION"] { --k: var(--k-evaluacion); --k-bg: var(--k-evaluacion-bg); }
.dash-card[data-kind="FALTAN_DATOS"],
.dash-card[data-kind="REVISAR"] { --k: var(--k-faltan); --k-bg: var(--k-faltan-bg); }

.dash-card[data-live="false"] {
  background: color-mix(in srgb, var(--k-faltan-bg) 40%, var(--surface));
}

.dash-card.is-open {
  border-color: var(--accent);
  box-shadow: 0 4px 16px color-mix(in srgb, var(--accent) 18%, transparent);
}

.dash-card.is-flash {
  animation: dash-flash 1.2s ease-out;
}

@keyframes dash-flash {
  from { box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 40%, transparent); }
  to { box-shadow: var(--shadow-sm); }
}

.dash-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
}

.dash-card-id {
  min-width: 0;
}

.dash-card-name {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.dash-card-type {
  margin: 0;
  font-size: 0.78rem;
  color: var(--text-3);
}

.dash-card .pill {
  flex: none;
  font-size: 0.7rem;
  padding: 0.25rem 0.55rem;
}

.dash-card-reason {
  margin: 0;
  font-size: 0.84rem;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dash-figs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.4rem;
  margin: 0;
}

.dash-fig {
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 0.35rem 0.5rem;
  min-width: 0;
}

.dash-fig dt {
  font-size: 0.72rem;
  color: var(--text-3);
}

.dash-fig dd {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.dash-money {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.25rem 0.5rem;
  font-size: 0.84rem;
  color: var(--text-2);
}

.dash-money strong {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

/* A funded card: payouts made and the valid days towards the next one. */
.dash-payouts-line {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.25rem 0.5rem;
  margin: 0;
  font-size: 0.84rem;
  color: var(--text-2);
}

.dash-payouts-line[hidden],
.dash-days[hidden] {
  display: none;
}

.dash-days[data-met="true"] { color: var(--positive); }

.dash-today[data-tone="positive"] { color: var(--positive); }
.dash-today[data-tone="negative"] { color: var(--negative); }

.dash-bar {
  --bar: var(--positive);
}

.dash-bar[data-tone="evaluation"] {
  --bar: var(--k-evaluacion);
}

.dash-bar-text {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.78rem;
  color: var(--text-2);
}

.dash-bar-track {
  margin-top: 0.25rem;
  height: 6px;
  border-radius: 999px;
  background: var(--skeleton);
  overflow: hidden;
}

.dash-bar-fill {
  height: 100%;
  width: 0;
  background: var(--bar);
  border-radius: 999px;
  transition: width 0.3s;
}

.dash-feed {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
  font-size: 0.78rem;
  color: var(--text-2);
}

.dash-feed[hidden] {
  display: none;
}

.dash-feed-dot {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--positive);
}

.dash-feed[data-tone="blocked"] .dash-feed-dot { background: var(--negative); }
.dash-feed[data-tone="blocked"] { color: var(--negative); }
.dash-feed[data-tone="unset"] .dash-feed-dot { background: var(--warn); }

.dash-last {
  margin: 0;
  padding: 0.35rem 0.5rem;
  border-radius: var(--radius-sm);
  background: var(--k-faltan-bg);
  color: var(--negative);
  font-size: 0.82rem;
  font-weight: 600;
}

.dash-last[hidden] {
  display: none;
}

.dash-card-actions {
  display: flex;
  gap: 0.4rem;
  align-items: center;
}

.dash-card-actions [data-action="operar"] {
  flex: 1;
  min-height: 40px;
}

.dash-more {
  min-height: 40px;
  color: var(--accent);
  white-space: nowrap;
}

.dash-tree {
  min-height: 40px;
  padding-inline: 0.5rem;
  color: var(--accent);
  white-space: nowrap;
}

.dash-card.is-open .dash-more {
  background: var(--accent-soft);
}

/* The Operar area on a small card: the same pieces as the classic card. */
.dash-card .plan-operar {
  margin: 0;
  padding: 0;
  border: 0;
  gap: 0.35rem;
  font-size: 0.82rem;
}

.dash-card .operar-reason {
  margin: 0;
  padding: 0.35rem 0.5rem;
  border-radius: var(--radius-sm);
  background: var(--k-recuperacion-bg);
  color: var(--warn);
  font-weight: 600;
}

.dash-card .operar-status {
  margin: 0;
  padding: 0.45rem 0.55rem;
}

.dash-card .session-switch {
  margin: 0;
}

.dash-detail {
  --dash-arrow-left: 24px;
  position: relative;
  grid-column: 1 / -1;
  margin-top: 0.35rem;
  background: var(--surface);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
}

.dash-detail-arrow {
  position: absolute;
  top: -8px;
  left: var(--dash-arrow-left);
  width: 14px;
  height: 14px;
  background: var(--surface);
  border-left: 1px solid var(--accent);
  border-top: 1px solid var(--accent);
  transform: rotate(45deg);
}

.dash-detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.55rem 0.9rem;
  border-bottom: 1px solid var(--border);
}

.dash-detail-head [data-action="dash-detail"] {
  color: var(--accent);
}

.dash-detail-cols {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.dash-detail-col {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding: 0.85rem 0.95rem 1rem;
  min-width: 0;
  font-size: 0.88rem;
}

.dash-detail-col + .dash-detail-col {
  border-left: 1px solid var(--border);
}

.dash-detail-h {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-3);
}

.dash-detail-col p,
.dash-detail-col ul {
  margin: 0;
}

.dash-detail-col ul {
  padding-left: 1.1rem;
  color: var(--text-2);
}

.dash-detail-col [hidden] {
  display: none;
}

.dash-d-headline {
  font-weight: 650;
  font-size: 0.95rem;
}

.dash-d-next,
.dash-d-atm,
.dash-d-cost,
.dash-d-master,
.dash-d-feed {
  color: var(--text-2);
}

.dash-d-facts {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.3rem 0.75rem;
  margin: 0;
}

.dash-d-facts dt {
  color: var(--text-2);
}

.dash-d-facts dd {
  margin: 0;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.dash-d-facts dd[data-tone="positive"] { color: var(--positive); }
.dash-d-facts dd[data-tone="negative"] { color: var(--negative); }

.dash-detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.6rem 0.9rem;
  border-top: 1px solid var(--border);
}

.dash-detail-actions [hidden] {
  display: none;
}

@media (max-width: 760px) {
  .dash-detail-cols {
    grid-template-columns: 1fr;
  }

  .dash-detail-col + .dash-detail-col {
    border-left: 0;
    border-top: 1px solid var(--border);
  }

  .dash-grid {
    grid-template-columns: 1fr;
  }
}


/* --- Simuladores: the selector and «¿Voy en lo normal?» -------------------- */

.sim-switch {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.sim-switch .btn[aria-pressed="true"],
#sim-normal .btn[aria-pressed="true"],
#sim-rachas .btn[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.dev-actions {
  margin-top: 0.9rem;
}

.dev-caveat {
  margin: 0.4rem 0 0.6rem;
  padding: 0.7rem 0.9rem;
  border-left: 3px solid var(--warn);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 0.9rem;
}

.dev-caveat:empty {
  display: none;
}

.dev-verdict {
  margin: 0.5rem 0 0.4rem;
  font-size: 1.05rem;
  font-weight: 650;
  line-height: 1.45;
}

.dev-verdict[data-signal="señal"] {
  color: var(--negative);
}

.dev-modes {
  margin-bottom: 0.4rem;
}

.dev-user {
  margin: 0.3rem 0 0.5rem;
  color: var(--text);
  font-weight: 600;
}

.dev-user:empty {
  display: none;
}

.dev-stats th,
.dev-stats td {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.dev-lines {
  display: grid;
  gap: 0.25rem;
  margin: 0.4rem 0 0;
  padding-left: 1.1rem;
  color: var(--text-2);
  font-size: 0.9rem;
}

.dev-subtitle {
  margin: 1rem 0 0.2rem;
  color: var(--text-2);
  font-size: 0.95rem;
}

/* The simulated distribution as bars; the people who never got there in
   their own grey bar; the user's position as a strong line. */
.dev-bars rect {
  fill: var(--series-1);
  fill-opacity: 0.75;
}

.dev-bars rect.dev-bar-censored {
  fill: var(--text-3);
  fill-opacity: 0.45;
}

.dev-marker {
  stroke: var(--series-2);
  stroke-width: 2.5;
}

.dev-marker-label {
  fill: var(--series-2);
  font-size: 12px;
  font-weight: 700;
}

@media (width <= 720px) {
  .dev-caveat,
  .dev-lines {
    font-size: 0.86rem;
  }

  .dev-verdict {
    font-size: 0.98rem;
  }
}

/* --- Simuladores: «Rachas» ------------------------------------------------- */

.streak-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem 1.5rem;
}

.streak-filter {
  display: grid;
  gap: 0.3rem;
  min-width: 0;
}

.streak-filter-label {
  color: var(--text-2);
  font-size: 0.85rem;
  font-weight: 600;
}

.streak-group {
  margin-bottom: 0;
}

.streak-empty {
  margin-top: 1rem;
}

/* The verdict tile reads in words; its colour only repeats what it says. */
.streak-tiles .kpi[data-key="verdict"] .kpi-value {
  font-size: 1rem;
  line-height: 1.3;
}

.streak-tiles .kpi-sub {
  line-height: 1.35;
}

/* The coin: a neutral dashed line and its 95 % band as a soft area, so the
   user's own line (series 1) is the one that stands out. */
.series-line.streak-coin {
  stroke: var(--text-3);
}

.streak-band {
  fill: var(--text-3);
  fill-opacity: 0.16;
  stroke: none;
}

.streak-breakdowns .table-wrap + .table-wrap {
  margin-top: 1.1rem;
}

.streak-table-title {
  padding-bottom: 0.4rem;
  color: var(--text-2);
  font-weight: 600;
  text-align: left;
}

.streak-table td {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.streak-table thead th:not(:first-child) {
  text-align: right;
}

@media (width <= 720px) {
  .streak-filters {
    gap: 0.6rem 1rem;
  }

  .streak-table th,
  .streak-table td {
    font-size: 0.82rem;
  }
}

/* Stats-clarity ST3: a header row that names a group of columns. */
.data-table th.group-head {
  text-align: center;
  border-bottom: 1px solid var(--border);
}

/* Stats-clarity ST5: the per-row «Ver operaciones» button of the cost table. */
.account-executions {
  justify-self: start;
  margin-top: 0.35rem;
}

/* Stats-clarity SC4: «Coste por cuenta» fits a desktop screen. Six columns:
   the cost parts fold into one cell, and the state, type, chain and dates sit
   on lines under the account name. Narrow screens keep the wrap's own scroll. */
.account-table {
  min-width: 44rem;
}

.account-table th,
.account-table td,
.firm-table th,
.firm-table td {
  padding: 0.5rem 0.35rem;
}

.account-table thead th,
.account-table thead th.num,
.firm-table thead th,
.firm-table thead th.num {
  white-space: normal;
  line-height: 1.25;
}

.account-table .account-cell {
  min-width: 11rem;
}

.account-table .status-pill {
  justify-self: start;
  margin: 0.1rem 0 0.15rem;
}

/* «Calcular niveles en MT5»: the two prices are what the user types into MT5. */
.ml-result { margin-top: 0.75rem; padding: 0.75rem; border: 1px solid currentColor; border-radius: 8px; }
.ml-side { margin: 0 0 0.25rem; font-weight: 700; }
.ml-level { margin: 0.1rem 0; display: flex; gap: 0.5rem; align-items: baseline; }
.ml-price { font-size: 1.6rem; font-weight: 700; font-variant-numeric: tabular-nums; user-select: all; }

/* Idea A: a recovery confirmed for a cut the Diario never saw («Editar»). */
.recovery-fields {
  margin: 0.25rem 0 0.75rem;
  padding: 0.6rem 0.75rem 0.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.recovery-fields > legend {
  padding: 0 0.3rem;
  color: var(--text-2);
  font-size: 0.82rem;
  font-weight: 600;
}

/* Por casa: the day's tramos, when the firm leaves them to the trader. */
.operar-tramos {
  margin: 0.25rem 0 0.5rem;
}

.operar-tramos .hint {
  margin-top: 0.35rem;
}

/* Idea B: «Ajustar antes de enviar» in the Operar dialog. */
.operar-adjust {
  margin: 0.25rem 0 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.operar-adjust > summary {
  padding: 0.5rem 0.75rem;
  color: var(--accent);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
}

.operar-adjust[open] > summary {
  border-bottom: 1px solid var(--border);
}

.adjust-body {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.6rem 0.75rem 0.75rem;
}

.adjust-row {
  display: grid;
  grid-template-columns: 5.5rem auto 6.5rem auto;
  justify-content: start;
  align-items: center;
  gap: 0.15rem 0.4rem;
}

.adjust-row .adjust-hint {
  grid-column: 2 / -1;
}

.adjust-row[hidden] {
  display: none;
}

.adjust-label {
  color: var(--text-2);
  font-size: 0.85rem;
  font-weight: 600;
}

.adjust-step {
  min-width: 2rem;
  padding-left: 0.5rem;
  padding-right: 0.5rem;
}

.adjust-value {
  width: 100%;
  min-width: 0;
  font-variant-numeric: tabular-nums;
  font-weight: 650;
  text-align: center;
}

.adjust-row[data-changed] .adjust-value {
  color: var(--accent);
}

.adjust-hint {
  color: var(--text-3);
  font-size: 0.78rem;
}

.adjust-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.adjust-warn {
  margin: 0;
  color: var(--warn);
  font-size: 0.85rem;
  font-weight: 600;
}

.adjust-warn[hidden] {
  display: none;
}

.adjust-foot .hint[data-tone="error"] {
  color: var(--negative);
}

@media (max-width: 520px) {
  .adjust-row {
    grid-template-columns: 4.5rem auto 5.5rem auto;
  }
}

/* --- Estadísticas: tabs Resumen · Diario · Mañana (2026-10-29) ------------- */
/* «Diario» and «Mañana» are thin tables: one line per account, some thirty
   accounts a day on one screen. The detail opens under the row («▸»). */

.stats-tabs {
  display: flex;
  gap: 0.25rem;
  margin: 0.25rem 0 1rem;
  border-bottom: 1px solid var(--border);
}

.stats-tab {
  margin-bottom: -1px;
  padding: 0.5rem 0.95rem;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--text-3);
  font: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
}

.stats-tab:hover { color: var(--text); }

.stats-tab[aria-selected="true"] {
  border-bottom-color: var(--accent);
  color: var(--text);
}

.stats-tab:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

body[data-stats-tab="diario"] .page,
body[data-stats-tab="manana"] .page,
body[data-stats-tab="informe"] .page,
body[data-stats-tab="diario"] .app-header-inner,
body[data-stats-tab="manana"] .app-header-inner,
body[data-stats-tab="informe"] .app-header-inner {
  max-width: 1440px;
}

.jr-toolbar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.jr-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.jr-table {
  width: 100%;
  min-width: 940px;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 0.84rem;
  font-variant-numeric: tabular-nums;
}

.jr-table col.jr-c-acct { width: 16%; }
.jr-table col.jr-c-type { width: 14%; }
.jr-table col.jr-c-num { width: 10%; }
.jr-table col.jr-c-op { width: 13%; }
.jr-table col.jr-c-sltp { width: 11%; }
.jr-table col.jr-c-res { width: 13%; }
.jr-table col.jr-c-dd { width: 13%; }
.tm-table col.jr-c-acct { width: 16%; }
.tm-table col.jr-c-type { width: 14%; }
.tm-table col.tm-c-node { width: 10%; }
.tm-table col.tm-c-day { width: 7%; }
.tm-table col.tm-c-bal { width: 9%; }  /* 2026-11-03: the starting balance */
.tm-table col.jr-c-op { width: 13%; }
.tm-table col.jr-c-sltp { width: 12%; }
.tm-table col.tm-c-lots { width: 8%; }
.tm-table col.jr-c-dd { width: 11%; }

.jr-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 0.45rem 0.6rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-3);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}

.jr-table thead th.num,
.jr-table td.num { text-align: right; }

.jr-table > tbody > tr.jr-row > td {
  height: 2.1rem;
  padding: 0 0.6rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.jr-table > tbody > tr.jr-row:hover > td { background: var(--surface-2); }
.jr-table > tbody > tr.jr-row[data-open] > td { background: var(--surface-2); border-bottom-color: transparent; }
.jr-table > tbody > tr.jr-row[data-idle] > td { color: var(--text-3); }

/* One line per cell, cut with an ellipsis rather than wrapped. */
.jr-line {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
}

.jr-line > * { flex: none; }
.jr-line > :last-child { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
td.num .jr-line { justify-content: flex-end; }

.jr-acct { font-weight: 650; }
.jr-muted { color: var(--text-3); }
.jr-offline { color: var(--negative); }

.jr-tg {
  width: 1.2rem;
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  font: inherit;
  cursor: pointer;
}

.jr-tg:focus-visible { outline: 2px solid var(--accent); border-radius: 4px; }

.jr-kind { padding: 0.05rem 0.5rem; font-size: 0.74rem; }
.dc-kind[data-kind="REVISAR"], .dc-kind[data-kind="FALTAN_DATOS"] { --k: var(--k-faltan); --k-bg: var(--k-faltan-bg); }
.dc-kind[data-kind="HECHO_HOY"] { --k: var(--k-hecho); --k-bg: var(--k-hecho-bg); }

.jr-sl { color: var(--negative); }
.jr-tp { color: var(--positive); }
/* 2026-11-03: a day in two tandas lists each tanda's SL / TP, one per line. */
.jr-sltp-tandas .jr-line + .jr-line { margin-top: 0.1rem; }
.jr-tanda-n { font-size: 0.72rem; margin-right: 0.15rem; }
.jr-net { font-weight: 650; }
.jr-net[data-tone="positive"], .jr-day-fig b[data-tone="positive"], .jr-kv dd[data-tone="positive"] { color: var(--positive); }
.jr-net[data-tone="negative"], .jr-day-fig b[data-tone="negative"], .jr-kv dd[data-tone="negative"] { color: var(--negative); }

.jr-outcome {
  padding: 0 0.35rem;
  border-radius: 4px;
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 0.68rem;
  font-weight: 700;
}

.jr-outcome[data-outcome="tp"] { background: var(--k-retirar-bg); color: var(--k-retirar); }
.jr-outcome[data-outcome="sl"] { background: var(--k-faltan-bg); color: var(--k-faltan); }

.jr-dd { display: inline-flex; align-items: center; justify-content: flex-end; gap: 0.35rem; }
.jr-dd-chip { padding: 0.02rem 0.45rem; font-size: 0.8rem; }

.jr-table > tbody > tr.jr-day > th {
  padding: 0.4rem 0.6rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  font-weight: 400;
  text-align: left;
}

.jr-day-line {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.3rem 1rem;
  font-size: 0.82rem;
}

.jr-day-name { font-size: 0.88rem; font-weight: 650; }
.jr-day-name::first-letter { text-transform: uppercase; }
.jr-day-fig { color: var(--text-3); }
.jr-day-fig b { color: var(--text); font-weight: 650; }

.jr-table > tbody > tr.jr-det > td {
  padding: 0.3rem 0.6rem 0.7rem 2.2rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}

.jr-det-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
  gap: 0.5rem;
}

.jr-det-box {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.jr-det-title { padding-top: 0.5rem; }
.jr-kv { font-size: 0.82rem; }
/* The day's tandas (29-10): each one on two lines, the box twice as wide. */
.jr-det-wide { grid-column: span 2; }
.dc-kv.jr-kv-stack { grid-template-columns: 1fr; }
.jr-kv-stack dt { padding-bottom: 0; }
.jr-kv-stack dd { padding-top: 0.1rem; border-top: 0; text-align: left; }
@media (max-width: 48rem) { .jr-det-wide { grid-column: auto; } }
.jr-kv dt, .jr-kv dd { padding: 0.25rem 0; }
.jr-det-actions { margin-top: 0.5rem; }
.jr-det-line { margin: 0.2rem 0; font-size: 0.84rem; white-space: normal; }
.jr-note { margin-top: 0.6rem; }
.tm-summary { grid-template-columns: repeat(5, minmax(0, 1fr)); margin-bottom: 0.9rem; }

@media (max-width: 48rem) {
  .tm-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* On a wide screen the tables never scroll sideways, so their header can
   stay in view while the page scrolls through the days. */
@media (min-width: 64rem) {
  .jr-wrap { overflow: visible; }
  .jr-table thead th:first-child { border-top-left-radius: var(--radius-sm); }
  .jr-table thead th:last-child { border-top-right-radius: var(--radius-sm); }
}

/* --- «Ver árbol» (2026-10-29): an evaluation's real path, simulator style --- */
/* Real days have a coloured border and one column of what happened; the
   branches not taken are grey and dashed; simulated ones say so. */

.tree-dialog {
  width: min(100% - 2rem, 1400px);
}

.tree-box {
  max-height: 70vh;
}

.tree-real {
  width: 300px;
  border: 2px solid var(--accent);
  box-shadow: var(--shadow-sm);
}

.tree-next {
  border-style: dashed;
}

.tree-end {
  width: 260px;
}

.tree-ghost {
  border-style: dashed;
  opacity: 0.72;
}

.tree-alt-box {
  width: 250px;
}

.tree-alt-box > .sim-node-top {
  flex-wrap: wrap;
  justify-content: flex-start;
}

.tree-ghost:hover,
.tree-ghost:focus-within {
  opacity: 1;
}

.tree-alt-chip {
  background: var(--surface-2);
  color: var(--text-3);
}

.tree-sim-chip {
  opacity: 0.8;
}

.tree-sim-mark,
.tree-next-mark {
  align-self: flex-start;
  color: var(--text-3);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.tree-next-mark {
  color: var(--accent);
}

.tree-date {
  color: var(--text-3);
  font-weight: 400;
}

.tree-line {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
}

.tree-line > .sim-k {
  flex: 0 0 5.6rem;
}

.tree-v {
  font-weight: 600;
}

.tree-v[data-tone="positive"] { color: var(--positive); }
.tree-v[data-tone="negative"] { color: var(--negative); }

.tree-tag {
  padding: 0 0.35rem;
  border-radius: 4px;
  background: var(--k-retirar-bg);
  color: var(--k-retirar);
  font-size: 0.66rem;
  font-weight: 700;
}

.tree-tag-sl {
  background: var(--k-faltan-bg);
  color: var(--k-faltan);
}

.tree-tag-partial {
  background: var(--surface-2);
  color: var(--text-2);
}

.tree-dd {
  padding: 0 0.45rem;
  font-size: 0.78rem;
}

/* --- Estadísticas › Informe (2026-10-29): a day or a week ------------------ */

.rp-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.rp-seg,
.rp-nav {
  display: inline-flex;
  gap: 0.35rem;
}

.rp-seg .btn[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.rp-head {
  margin-bottom: 0.75rem;
}

.rp-title::first-letter {
  text-transform: uppercase;
}

.rp-headline {
  margin-bottom: 1.5rem;
}

/* 2026-11-03: the period's result leads the headline - a little bigger, bold. */
.rp-headline .kpi[data-emphasis="lead"] .kpi-value {
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}

#rp-source {
  margin-top: 0.75rem;
}

.rp-names {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}


@media (max-width: 48rem) {
  .rp-headline { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Informe, 29-10 review: the result spelled out, the bell, the hedge split. */

.rp-formula {
  margin: -0.75rem 0 1.5rem;
  font-variant-numeric: tabular-nums;
}

.rp-stat {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 320px);
  align-items: center;
  gap: 1rem;
  margin-top: 0.9rem;
  padding: 0.8rem 0.95rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.rp-stat-value {
  margin: 0.2rem 0;
  font-size: 1.05rem;
  font-weight: 700;
}

.rp-bell {
  width: 100%;
  height: auto;
}

.rp-bell-curve { fill: none; stroke: var(--text-3); stroke-width: 1.5; }
.rp-bell-area { fill: var(--accent-soft); }
.rp-bell-axis { stroke: var(--border-strong); stroke-width: 1; }
.rp-bell-tick { fill: var(--text-3); font-size: 9px; }
.rp-bell-marker { stroke: var(--accent); stroke-width: 2; }
.rp-bell-dot { fill: var(--accent); }

.rp-hedge-split [data-tone="positive"] { color: var(--positive); }
.rp-hedge-split [data-tone="negative"] { color: var(--negative); }

@media (max-width: 40rem) {
  .rp-stat { grid-template-columns: 1fr; }
}

/* Informe, second review (29-10 night): few words per box, centred both
   ways; a box that opens shows a discreet triangle and lists its accounts
   (or the split by firm) under the row of boxes. */

.rp-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(9.5rem, 40vw), 1fr));
  align-items: stretch;
}

.rp-grid .kpi {
  align-content: center;
  justify-items: center;
  min-height: 5.6rem;
  text-align: center;
}

.rp-opens {
  position: relative;
  cursor: pointer;
}

.rp-opens:hover,
.rp-opens.open {
  border-color: var(--border-strong);
}

.rp-opens.open {
  background: var(--accent-soft);
}

.rp-tri {
  position: absolute;
  top: 0.4rem;
  right: 0.45rem;
  padding: 0.1rem 0.2rem;
  border: 0;
  background: none;
  color: var(--text-3);
  font-size: 0.7rem;
  line-height: 1;
  cursor: pointer;
}

.rp-tri:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-radius: 3px;
}

.rp-drop {
  margin-top: 0.6rem;
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.rp-drop-title {
  margin: 0 0 0.35rem;
  color: var(--text-3);
  font-size: 0.8rem;
  font-weight: 600;
}

.rp-detail th[scope="row"],
.rp-detail td {
  white-space: normal;
}

.rp-stat-text {
  text-align: center;
}

.rp-hedge-split td,
.rp-hedge-split .num,
.rp-hedge-split thead th.num {
  text-align: center;
}

.rp-note {
  margin-top: 0.6rem;
}

/* Informe › Mes (2026-10-30): the P&L calendar, totals of every account. */

.rp-cal-wrap {
  margin-top: 0.75rem;
  overflow-x: auto;
}

.rp-calendar {
  display: grid;
  grid-template-columns: repeat(7, minmax(6.5rem, 1fr)) minmax(7.5rem, 1.15fr);
  gap: 0.4rem;
  min-width: 56rem;
}

.rp-cal-head {
  padding: 0.2rem 0;
  color: var(--text-3);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-align: center;
  text-transform: uppercase;
}

.rp-cal-cell {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-height: 6.4rem;
  padding: 0.45rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: inherit;
  font: inherit;
  text-align: left;
}

button.rp-cal-cell {
  cursor: pointer;
}

button.rp-cal-cell:hover {
  border-color: var(--border-strong);
}

button.rp-cal-cell:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.rp-cal-empty {
  border: 0;
  background: none;
}

.rp-cal-weekend,
.rp-cal-future {
  background: var(--surface-2);
}

.rp-cal-future {
  opacity: 0.55;
}

.rp-cal-today {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.rp-cal-cell[data-tone="positive"] { background: var(--k-retirar-bg); }
.rp-cal-cell[data-tone="negative"] { background: var(--k-faltan-bg); }

.rp-cal-week {
  background: var(--surface-2);
  border-style: dashed;
}

.rp-cal-week[data-tone="positive"],
.rp-cal-week[data-tone="negative"] {
  border-style: solid;
}

.rp-cal-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.3rem;
  margin-bottom: 0.15rem;
}

.rp-cal-num {
  color: var(--text-3);
  font-size: 0.75rem;
  font-weight: 600;
}

.rp-cal-total {
  font-size: 0.95rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.rp-cal-line {
  display: flex;
  justify-content: space-between;
  gap: 0.3rem;
  color: var(--text-2);
  font-size: 0.72rem;
  line-height: 1.25;
}

.rp-cal-val {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.rp-cal-ops {
  margin-top: auto;
  color: var(--text-3);
  font-size: 0.68rem;
  line-height: 1.25;
}

.rp-cal-ops + .rp-cal-ops {
  margin-top: 0;
}

.rp-cal-total[data-tone="positive"], .rp-cal-val[data-tone="positive"] { color: var(--positive); }
.rp-cal-total[data-tone="negative"], .rp-cal-val[data-tone="negative"] { color: var(--negative); }


/* P3 (config-polish): hints keep a readable measure; the longer explanations
   sit behind «¿Cómo funciona?» next to the control they explain. */
.settings-page .hint,
.settings-page .card-sub { max-width: 70ch; text-wrap: pretty; }

details.how { margin: 0.35rem 0 0; max-width: 70ch; }

details.how > summary {
  display: inline-block;
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 560;
  cursor: pointer;
}

details.how[open] > summary { margin-bottom: 0.25rem; }
details.how > .hint { margin: 0; color: var(--text-2); }

/* P4 (config-polish): below 720px the «Por casa» and NinjaTrader tables become
   one card per row, each cell labelled by its column (data-label). */
@media (width <= 720px) {
  .firms-table thead,
  .nt8-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }

  .firms-table,
  .firms-table tbody,
  .firms-table tr,
  .firms-table th,
  .firms-table td,
  .nt8-table,
  .nt8-table tbody,
  .nt8-table tr,
  .nt8-table th,
  .nt8-table td { display: block; }

  .firms-table tr,
  .nt8-table tr {
    padding: 0.8rem 0;
    border-bottom: 1px solid var(--border);
  }

  .firms-table th,
  .nt8-table th,
  .firms-table td,
  .nt8-table td { padding: 0.25rem 0; border-bottom: 0; }

  .firms-table td[data-label]::before,
  .nt8-table td[data-label]::before {
    content: attr(data-label);
    display: block;
    color: var(--text-2);
    font-size: 0.8rem;
    font-weight: 560;
  }

  .firms-table td[data-hint]::before { content: attr(data-label) " · " attr(data-hint); }

  .nt8-table select,
  .firms-table select,
  .firms-table input { width: 100%; max-width: none; }

  .firms-table .firm-table-actions { white-space: normal; }
}

/* Readiness strip: the three things Operar needs, each with its state in words. */
.readiness {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 1.1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  overflow: clip;
}

.ready-tile {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  min-width: 0;
  padding: 0.9rem 1.1rem;
  color: inherit;
  text-decoration: none;
}

.ready-tile + .ready-tile { border-left: 1px solid var(--border); }
.ready-tile:hover { background: var(--surface-2); }

.ready-mark {
  display: grid;
  flex: none;
  place-items: center;
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-3);
  font-size: 0.85rem;
  font-weight: 800;
}

.ready-tile[data-state="ok"] .ready-mark { background: var(--positive-soft); color: var(--positive); }
.ready-tile[data-state="pending"] .ready-mark { background: var(--warn-soft); color: var(--warn); }

.ready-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.ready-label {
  color: var(--text-3);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.ready-value {
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.ready-detail {
  color: var(--text-2);
  font-size: 0.84rem;
  overflow-wrap: anywhere;
}

.ready-detail:empty { display: none; }

/* Equipos: PC cards in two columns, each with a three-segment meter and, when
   something is missing, one box saying what to do first. */
.pc-list {
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.pc-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--surface);
}

.pc-card + .pc-card { border-top: 1px solid var(--border); }
.pc-check { text-wrap: pretty; }

.pc-row-toggle {
  display: grid;
  grid-template-columns: minmax(8rem, 1fr) minmax(10rem, auto) minmax(9rem, auto) 1.5rem;
  align-items: center;
  gap: 0.3rem 1rem;
  width: 100%;
  padding: 0.7rem 1rem;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.pc-row-toggle:hover { background: var(--surface-2); }
.pc-row-toggle:focus-visible { outline-offset: -2px; }

.pc-progress-box {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.pc-chevron {
  display: grid;
  place-items: center;
  color: var(--text-3);
  transition: transform 0.12s;
}

.pc-card[data-open="true"] .pc-chevron { transform: rotate(180deg); }

.pc-detail {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  padding: 0.8rem 1rem 0.9rem;
  background: color-mix(in srgb, var(--surface-2) 55%, var(--surface));
}

.pc-card[data-pending="true"] .pc-row-toggle .pc-progress { color: var(--warn); }

.pc-name { font-weight: 700; }

.pc-meta {
  margin: 0;
  color: var(--text-3);
  font-size: 0.8rem;
  overflow-wrap: anywhere;
}

.pc-meta:empty { display: none; }

.pc-card .equipos-state::before {
  content: "";
  display: inline-block;
  width: 0.5rem;
  height: 0.5rem;
  margin-right: 0.35rem;
  border-radius: 999px;
  background: currentcolor;
  vertical-align: 0.08em;
}

.pc-meter {
  display: flex;
  gap: 4px;
}

.pc-meter > span {
  flex: 1;
  box-sizing: border-box;
  height: 6px;
  border-radius: 3px;
  background: var(--border);
}

.pc-meter > span[data-state="ready"] { background: var(--positive); }
.pc-meter > span[data-state="pending"] { background: var(--warn); }
.pc-meter > span[data-state="unchecked"] {
  background: transparent;
  border: 1px dashed var(--border-strong);
}

.pc-first-fix {
  margin: 0 1rem 0.7rem;
  padding: 0.55rem 0.7rem;
  border-radius: var(--radius-sm);
  background: var(--warn-soft);
  font-size: 0.86rem;
}

.pc-first-fix strong {
  display: block;
  color: var(--warn);
  font-size: 0.74rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.pc-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: auto;
}

.pc-passing {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem 1rem;
  margin: 0;
  color: var(--positive);
  font-size: 0.86rem;
}

.pc-muted {
  margin: 0;
  color: var(--text-3);
  font-size: 0.86rem;
}

.pc-pending-title {
  margin: 0;
  color: var(--warn);
  font-size: 0.74rem;
  font-weight: 750;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.pc-pending {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin: 0;
  padding-left: 1.3rem;
  list-style: decimal;
  font-size: 0.88rem;
}

.pc-pending strong { color: var(--warn); font-weight: 650; }

.pc-pending-first {
  display: inline-block;
  padding: 0.02rem 0.45rem;
  border-radius: 999px;
  background: var(--warn-soft);
  color: var(--warn);
  font-size: 0.74rem;
  font-weight: 650;
}

.pc-pending-fix {
  display: block;
  color: var(--text-2);
  text-wrap: pretty;
}

.pc-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem 1rem;
  padding-top: 0.6rem;
  border-top: 1px solid var(--border);
}

.pc-foot .pc-meta { color: var(--text-3); font-size: 0.8rem; }

@media (width <= 560px) {
  .pc-row-toggle { grid-template-columns: minmax(0, 1fr) 1.5rem; padding: 0.7rem 0.8rem; }
  .pc-row-toggle .pc-chevron { grid-column: 2; grid-row: 1; }
  .pc-row-toggle .equipos-state,
  .pc-row-toggle .pc-progress-box { grid-column: 1 / -1; }
  .pc-first-fix { margin: 0 0.8rem 0.7rem; }
  .pc-detail { padding: 0.2rem 0.8rem 0.9rem; }
}

.subtable-title {
  margin: 0 0 -0.55rem;
  color: var(--text-2);
  font-size: 0.86rem;
  font-weight: 700;
}

/* A table, not prose: the disclosure's 70ch cap would make it scroll sideways. */
details.how.firms-others { max-width: none; }

.firms-others > summary { margin-bottom: 0.5rem; }

.firms-table tbody th[scope="row"] { min-width: 8.5rem; text-align: left; }

/* --- P6 (config-polish): Configuración as one page ----------------------------
   A sticky index on the left (chips on top under 860px), then the sections in
   cards: head (title, one sentence, optional secondary action) / body / foot
   band holding the scope note and the card's one primary button. */
.config-shell {
  display: grid;
  grid-template-columns: 13.5rem minmax(0, 1fr);
  gap: 2rem;
  margin-top: 1.5rem;
  align-items: start;
}

.config-index {
  position: sticky;
  top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.index-group-title {
  margin: 0;
  padding: 0 0.6rem 0.3rem;
  color: var(--text-3);
  font-size: 0.74rem;
  font-weight: 750;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.index-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.42rem 0.6rem;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-size: 0.92rem;
  font-weight: 560;
  text-decoration: none;
}

.index-link:hover {
  background: var(--surface-2);
  color: var(--text);
}

.index-link[aria-current] {
  background: var(--surface);
  color: var(--text);
  font-weight: 680;
  box-shadow: var(--shadow-sm), 0 0 0 1px var(--border);
}

.index-count {
  min-width: 1.35rem;
  padding: 0 0.4rem;
  border-radius: 999px;
  background: var(--warn-soft);
  color: var(--warn);
  font-size: 0.75rem;
  font-weight: 750;
  text-align: center;
}

.config-sections {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  min-width: 0;
}

.group-title {
  margin: 1.9rem 0 0;
  color: var(--text-2);
  font-size: 1.12rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.group-title:first-child { margin-top: 0; }

/* One surface per index group; its sections are told apart by their heading and a hairline. */
.config-group {
  padding: 0;
  min-width: 0;
  overflow: clip;
}

.config-section {
  min-width: 0;
  scroll-margin-top: 1rem;
}

.config-section + .config-section { border-top: 1px solid var(--border); }

.config-section > .card-head { padding: 1.2rem 1.25rem 0; }

.config-section .card-title { font-size: 1.12rem; }
.config-section .card-sub { color: var(--text-2); }

.card-body {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 0.9rem 1.25rem 1.3rem;
}

.card-form { display: block; }

.card-status { padding: 1rem 1.25rem 0; }

/* P11: one save bar at the end of each group (Conexión, Método). With changes it sticks to
   the bottom of the viewport while its group is on screen; without, it rests at the end. */
.group-bar {
  position: sticky;
  bottom: env(safe-area-inset-bottom, 0px);
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.6rem 1rem;
  padding: 0.85rem 1.25rem;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
}

.group-bar[data-dirty="false"] { position: static; }

.group-bar-note {
  margin: 0 auto 0 0;
  color: var(--text-2);
  font-size: 0.86rem;
  font-weight: 560;
}

/* A changed setting: a warn tint and «Sin guardar», the same everywhere. */
.row[data-dirty="true"] {
  margin-inline: -0.6rem;
  padding-inline: 0.6rem;
  border-radius: var(--radius-sm);
  background: var(--warn-soft);
}

.row-title {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.2rem 0.5rem;
}

.index-unsaved { position: relative; display: inline-flex; }

.index-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 999px;
  background: var(--warn);
}

/* A settings row: label and a short description on the left, the control on the right. */
.row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 26rem);
  gap: 0.5rem 2rem;
  align-items: start;
}

/* A row whose control needs the whole width (the cover modes): the text above, the control below. */
.row-wide { grid-template-columns: minmax(0, 1fr); }

.row-text { max-width: 52ch; }

.row + .row {
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.row-label {
  display: block;
  font-size: 0.93rem;
  font-weight: 650;
}

.row-desc {
  color: var(--text-3);
  font-size: 0.84rem;
  text-wrap: pretty;
}

.control {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-width: 0;
}

.control-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

/* A wide row's control takes the whole section width. */
.row-wide .control { max-width: none; }

/* Spread y stop: the two short fields side by side, the cushion note beside them. */
.row-wide .control-inline {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: end;
  gap: 0.75rem 1.5rem;
}

.row-wide .control-inline .control-pair {
  grid-template-columns: repeat(2, 11rem);
  align-items: end;
}

.row-wide .control-inline .settings-cushion {
  flex: 1 1 18rem;
  max-width: 44rem;
}

/* Cover modes as choice cards. */
.mode-list {
  grid-template-columns: repeat(auto-fill, minmax(20rem, 1fr));
}

/* Datos: the firms import and export share one cell. */
.import-tile {
  gap: 0.5rem;
  cursor: default;
}

.import-tile-pick {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  cursor: pointer;
}

.import-tile:hover { background: transparent; }
.import-tile .btn-ghost { align-self: flex-start; }

/* F7 (fuentes-remotas): Datos is a backup of the per-firm settings; the catalogue
   and master imports are a folded fallback for a PC without internet or key. */
.backup-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.backup-restore { cursor: pointer; }

.backup-restore:focus-within {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.backup-actions + .import-warn { margin: 0.45rem 0 0; font-size: 0.85rem; }

#firms-import-confirm { margin-top: 0.6rem; }

details.how.manual-import {
  max-width: none;
  margin-top: 1.25rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

details.how.manual-import > .hint { max-width: 70ch; }

@media (width <= 860px) {
  .config-shell {
    grid-template-columns: minmax(0, 1fr);
    gap: 1rem;
  }

  /* The chips wrap onto a second line instead of scrolling: nothing hides off-screen. */
  .config-index {
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.4rem 0.75rem;
  }

  .index-group {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem;
  }

  .index-group-title { display: none; }

  .index-link {
    border: 1px solid var(--border);
    background: var(--surface);
    white-space: nowrap;
  }

  .row { grid-template-columns: minmax(0, 1fr); }
  .readiness { grid-template-columns: minmax(0, 1fr); }
  .ready-tile + .ready-tile { border-left: 0; border-top: 1px solid var(--border); }
}

@media (width <= 560px) {
  .mode-list,
  .control-pair,
  .row-wide .control-inline .control-pair { grid-template-columns: minmax(0, 1fr); }
  .row-wide .control-inline > * { flex: 1 1 100%; }
}

/* «Ajustes por casa»: the provider has room, the stop is a narrow right-aligned figure, and
   «Restablecer» holds its place without being drawn on a row at its defaults. */
@media (width > 720px) {
  .firms-table th:nth-child(3),
  .firms-table td.col-stop { text-align: right; }

  .firms-table td.col-stop input { width: 7.5rem; text-align: right; }

  .firm-reset[data-visible="false"] { visibility: hidden; }
}

@media (width <= 720px) {
  .firm-reset[data-visible="false"] { display: none; }
}

/* A dirty «Por casa» row: tinted, with a dot before the name and «Sin guardar». */
.firms-table tr[data-dirty="true"] > * { background: var(--warn-soft); }

/* The dot sits in the cell's left padding, so marking a row never resizes the table. */
.firms-table tr > th:first-child,
.nt8-table tr > :first-child { position: relative; }

.firms-table tr[data-dirty="true"] > th::before,
.nt8-table tr[data-dirty="true"] > :first-child::before {
  content: "";
  position: absolute;
  top: 1.05em;
  left: 0;
  width: 0.4rem;
  height: 0.4rem;
  border-radius: 999px;
  background: var(--warn);
}

/* In the tables «Sin guardar» is read, not drawn: a chip widened the column on every edit. */
.firms-table .firm-dirty,
.nt8-table .dirty-chip {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.input-with-action {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.input-with-action input { flex: 1; min-width: 0; }

/* P15 (config-critique-2): touch targets on a phone. */
@media (width <= 520px) {
  details.how > summary {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
  }

  .nt8-table .btn-sm,
  .firms-table .btn-sm,
  .pc-foot .btn-sm,
  .import-tile .btn-sm,
  .backup-actions .btn-sm { min-height: 40px; }

  .nt8-table td.nt8-login-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
  }
}

/* --- Ancho único de las páginas (2026-11-03) --------------------------------
   Antes 1.080 px casi todas, 1.280 «Hoy» y 1.440 Diario/Mañana/Informe: ahora
   una sola medida, algo más ancha. En pantallas menores ocupa el ancho que
   haya, con el margen de siempre. */
:root { --page-max: 1600px; }

.page,
.app-header-inner,
body[data-view="dashboard"] .page,
body[data-view="dashboard"] .app-header-inner,
body[data-stats-tab] .page,
body[data-stats-tab] .app-header-inner {
  max-width: var(--page-max);
}

/* --- Estadísticas, alternativa A (2026-11-03) ---------------------------------
   Un solo selector arriba (Día · Semana · Mes · Todo, y ◀ Hoy ▶): el informe
   del periodo y, debajo, las cuentas que operaron en él. */
.stats-period {
  margin: 0.25rem 0 1rem;
}

.stats-period .rp-seg .btn[data-view="todo"] {
  margin-left: 0.5rem;
}

.jr-title {
  margin: 2rem 0 0.75rem;
}

/* --- Configuración (2026-11-10): the per-PC card ---------- */
/* A PC's card lists what it needs in three groups (Clicker, NinjaTrader,
   MetaTrader 5); a missing piece carries its fix text. */

.pc-col-title {
  margin: 0 0 0.4rem;
  font-size: 0.9rem;
  font-weight: 600;
}

.pc-checks {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.35rem;
  font-size: 0.88rem;
}

.pc-check[data-ok="true"] .pc-check-text { color: var(--positive); }
.pc-check[data-ok="false"] .pc-check-text { color: var(--warn); font-weight: 560; }

.pc-check-fix {
  display: block;
  margin-top: 0.1rem;
  color: var(--text-2);
}

.nt8-table select,
.firms-table select,
.firms-table input { width: min(100%, 15rem); }

.firms-table td { vertical-align: top; }
.firms-table .firm-table-actions { white-space: nowrap; }
.firms-table .field-error { margin: 0.2rem 0 0; }


.advanced > summary { cursor: pointer; }
.advanced > summary.card-title { display: list-item; }

/* O3: the live problems on Hoy - a PC that disconnected, a cover MT5 did not confirm. */
.live-problems { border-color: var(--warn); }
.live-problems-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.3rem; }
.live-problems-list li[data-tone="error"] { color: var(--negative); font-weight: 560; }
.live-problems-list li[data-tone="warn"] { color: var(--warn); font-weight: 560; }
.live-problems-foot { margin: 0.4rem 0 0; font-size: 0.88rem; display: flex; gap: 0.8rem; flex-wrap: wrap; }

/* O5: the first-run banner on Hoy and its five-step wizard. */
.setup-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem 1.2rem;
  border-color: var(--accent);
}
.setup-banner-title { margin: 0; font-size: 1rem; }
.setup-banner-line { margin: 0.2rem 0 0; }
.setup-banner-actions { display: flex; gap: 0.4rem; }

.dialog.wizard { width: min(100% - 2rem, 960px); }
.wizard-body {
  grid-template-columns: minmax(12rem, 16rem) 1fr;
  align-items: start;
  gap: 1.4rem;
}
@media (width <= 720px) {
  .wizard-body { grid-template-columns: 1fr; }
}
.wizard-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.4rem; }
.wizard-step {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.wizard-step[aria-current="step"] { border-color: var(--accent); background: var(--surface-2); }
.wizard-step:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.wizard-mark {
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 50%;
  background: var(--surface-2);
  font-size: 0.85rem;
  font-weight: 650;
}
.wizard-step[data-done="true"] .wizard-mark { background: var(--positive); color: var(--surface); }
.wizard-step-text { display: grid; }
.wizard-step-sub { color: var(--text-2); font-size: 0.82rem; }
.wizard-position { margin: 0 0 0.2rem; color: var(--text-3); font-size: 0.85rem; }
.wizard-title { margin: 0 0 0.4rem; font-size: 1.15rem; }
.wizard-subtitle { margin: 1.1rem 0 0.3rem; font-size: 0.98rem; }
.wizard-panel [data-step-panel] { display: grid; gap: 0.8rem; }
.wizard-panel [data-step-panel][hidden] { display: none; }
.wizard-checks { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.35rem; font-size: 0.9rem; }
.wizard-checks li[data-ok="true"] .pc-check-text { color: var(--positive); }
.wizard-checks li[data-ok="false"] .pc-check-text { color: var(--warn); font-weight: 560; }
.wizard-firms, .wizard-accounts { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; }
.wizard-firm, .wizard-account {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.9rem;
  padding: 0.5rem 0.7rem;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.wizard-account .btn { margin-left: auto; }
.wizard-firm label { min-width: 8rem; font-weight: 600; }

.dirty-chip,
.firm-dirty {
  display: inline-block;
  margin-top: 0.15rem;
  padding: 0.05rem 0.45rem;
  border-radius: 999px;
  background: var(--k-recuperacion-bg);
  color: var(--warn);
  font-size: 0.78rem;
  font-weight: 600;
}

.dirty-chip[hidden],
.firm-dirty[hidden] { display: none; }


.inline-note {
  margin: 0.25rem 0 0;
  font-size: 0.83rem;
  font-weight: 560;
  color: var(--positive);
}

.inline-note[data-tone="error"] { color: var(--negative); }
.inline-note[hidden] { display: none; }

/* P2 (config-polish): a PC's progress and its first blocking piece; «Añadir
   equipo» comes after the paired PCs. */
.pc-progress {
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--warn);
}

.pc-progress[data-ready="true"] { color: var(--positive); }


/* --- Estadísticas skeleton (2026-11-14) ------------------------------------ */
/* Each view paints a static skeleton of its own layout with the page. It sits
   after the view's status line and shows only while that line is a loading
   message; an error (data-tone="error") or a loaded view hides it. The blocks
   reuse the real tiles' and cards' classes, so the swap does not move
   anything. The shimmer is the page's --skeleton with a slightly lifted band
   moving across it, so light and dark both follow the theme. */
.stats-skeleton {
  display: none;
}

.exec-status:not([hidden]):not([data-tone="error"]) ~ .stats-skeleton {
  display: block;
}

/* Estadísticas loading appears late (2026-11-14): every visit is a new page,
   and a cached answer reaches the screen in ~140 ms, so «Cargando…» and the
   skeleton flashed for a moment before the figures. Both stay invisible for
   200 ms each time they show; a fast load goes straight to the figures. */
.exec-status:not([hidden]):not([data-tone="error"]) ~ .stats-skeleton,
:is(#stats-status, #rp-status, #jr-status, #tm-status):not([hidden]):not([data-tone="error"]) {
  animation: sk-appear 0s linear 200ms backwards;
}

@keyframes sk-appear {
  from { visibility: hidden; }
}

.stats-skeleton .kpi-row,
.stats-skeleton .kpi-grid {
  margin-top: 0;
}

.stats-skeleton .kpi-grid {
  margin-top: 0.75rem;
}

.stats-skeleton .rp-head {
  margin-bottom: 0.75rem;
}

.stats-skeleton .section + .section,
.stats-skeleton .kpi-row + .section,
.stats-skeleton .rp-headline + .section {
  margin-top: 1.25rem;
}

.sk {
  display: block;
  border-radius: 6px;
  background-color: var(--skeleton);
  background-image: linear-gradient(
    100deg,
    transparent 30%,
    color-mix(in srgb, var(--text) 8%, transparent) 50%,
    transparent 70%
  );
  background-size: 200% 100%;
  background-repeat: no-repeat;
  animation: sk-shimmer 1.4s ease-in-out infinite;
}

@keyframes sk-shimmer {
  from { background-position: 150% 0; }
  to { background-position: -50% 0; }
}

.sk-label { width: 55%; height: 0.72rem; }
.sk-value { width: 75%; height: 1.4rem; margin-top: 0.35rem; }
.sk-title { width: 9rem; height: 1rem; margin-bottom: 0.75rem; }
.sk-chart { width: 100%; height: 300px; }
.sk-row { height: 2.1rem; margin-top: 0.5rem; }
.rp-grid .kpi .sk-label { margin-inline: auto; }
.rp-grid .kpi .sk-value { margin-inline: auto; }

@media (prefers-reduced-motion: reduce) {
  .sk {
    animation: none;
    background-image: none;
  }
}

/* Configuración shows whole (2026-11-14): its sections fill in ~80 ms, and
   painting the half-loaded page first made every section grow and jump.
   configuracion.js drops data-loading once the settings and the PCs are in
   (or after 300 ms); the layout is kept meanwhile. The animation is the
   safety net: without the script the page still shows after 1 s. */
main[data-loading] {
  visibility: hidden;
  animation: config-reveal 0s linear 1s forwards;
}

@keyframes config-reveal {
  to {
    visibility: visible;
  }
}

/* --- session menu and change password -------------------------------------
   The account menu closes every page header (a <details>, so it opens and
   closes without script); the password form is the "Cuenta" group of
   Configuración. Login and setup pages live in login.css. */

.session-menu {
  position: relative;
  margin-left: auto;
}

/* Hoy also has its status chips. They follow the menu on a row of their own,
   so the menu keeps the slot it has on every other page. */
.app-header-inner > .header-status {
  flex: 1 0 100%;
}

.session-menu-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 32px;
  padding: 0 0.75rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: 0.87rem;
  font-weight: 620;
  cursor: pointer;
  list-style: none;
  transition: background-color 0.12s;
}

.session-menu-trigger::-webkit-details-marker {
  display: none;
}

.session-menu-trigger:hover,
.session-menu[open] > .session-menu-trigger {
  background: var(--surface-2);
}

/* The email follows "Cuenta"; a long one is cut with an ellipsis (its full text
   is the button's title) so it never widens the header. */
.session-menu-email {
  max-width: 16rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
  color: var(--text-2);
}

.session-menu-email[hidden] {
  display: none;
}

@media (max-width: 36rem) {
  .session-menu-email {
    display: none;
  }
}

.session-menu-icon {
  flex: none;
  color: var(--text-2);
}

.session-menu-panel {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 20;
  display: grid;
  min-width: min(14.5rem, calc(100vw - 2rem));
  padding: 4px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}

.session-menu-item {
  /* An <a> and two <button>s share this class: centre the text the same way
     and drop the link underline so the three rows read as one list. */
  display: flex;
  align-items: center;
  width: 100%;
  text-decoration: none;
  min-height: 38px;
  padding: 0 0.75rem;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 560;
  text-align: left;
  cursor: pointer;
}

.session-menu-item:hover {
  background: var(--surface-2);
}

.session-menu-item-danger {
  color: var(--negative);
}

.session-menu-item:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.password-form {
  inline-size: min(100%, 26rem);
}

/* Close every session: a quiet action under the password form, not a card of
   its own. The confirmation opens in place of the button. */
.closeall {
  display: grid;
  justify-items: start;
  gap: 0.5rem;
  margin: 0 1.25rem 1.25rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--border);
}

.closeall-title {
  font-size: 0.95rem;
  font-weight: 620;
}

.closeall .hint {
  max-inline-size: 52ch;
  margin: 0;
}

.closeall-confirm {
  display: grid;
  gap: 0.6rem;
}

.closeall-confirm[hidden] {
  display: none;
}

.closeall-ask {
  max-inline-size: 52ch;
  margin: 0;
  font-size: 0.9rem;
}

.closeall-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* The field and its show/hide button. The button sits inside the input's
   right edge; the input leaves room so the text never runs under it. */
.password-control {
  position: relative;
}

.password-control input {
  padding-right: 5.25rem;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 0.3rem;
  min-width: 44px;
  min-height: 32px;
  padding: 0 0.6rem;
  transform: translateY(-50%);
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-2);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 620;
  cursor: pointer;
}

.password-toggle:hover {
  background: var(--surface-2);
  color: var(--text);
}

/* Live feedback under the fields. The text says the state; colour only helps. */
.hint[data-state="short"],
.hint[data-state="mismatch"] {
  color: var(--text-2);
}

.hint[data-state="ok"],
.hint[data-state="match"] {
  color: var(--positive);
  font-weight: 560;
}

.hint[data-state="over"] {
  color: var(--negative);
}

/* Once a field is marked invalid, its message says so in the error colour. */
.hint[data-invalid="true"] {
  color: var(--negative);
  font-weight: 560;
}

/* A finished action reported in the form's message area is not an error. */
.form-error[data-tone="ok"] {
  background: var(--positive-soft);
  color: var(--positive);
}

.password-actions {
  justify-content: flex-start;
}
