/* MARKET MIRROR PRO — el gran diagramador de payoff (web/lib/diagramador.js, tanda 5v-4 · 25-oct).
   Sólo con los tokens de color de la casa (los 6 temas sin tocar nada) y clases con prefijo dg-.
   Escritorio: 520 px de alto; 375 px: 360 px; «Pantalla completa»: toda la ventana. La página nunca
   se desplaza a lo ancho: el dibujo se rehace a la medida de su caja (ResizeObserver). */

.dg-raiz { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.dg-barra { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; justify-content: space-between; }
.dg-capas { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12.5px; color: var(--dim); min-width: 0; }
.dg-capa { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; white-space: nowrap; }
.dg-capa input { padding: 0; margin: 0; accent-color: var(--azul); }
.dg-btn-completa { padding: 4px 10px; font-size: 12.5px; }
.dg-caja { position: relative; width: 100%; min-width: 0; }
.dg-lienzo { width: 100%; min-width: 0; }
.dg-svg { display: block; width: 100%; height: auto; user-select: none; -webkit-user-select: none; touch-action: pan-y; }
.dg-svg:focus { outline: 1px solid var(--azul); outline-offset: 2px; }
.dg-sin { font-size: 13px; color: var(--dim); padding: 18px 8px; }

/* el dibujo */
.dg-fondo { fill: var(--panel); }
.dg-mini .dg-fondo { fill: var(--panel2); }
.dg-zona-pierde { fill: color-mix(in srgb, var(--rojo) 9%, transparent); }
.dg-zona-gana { fill: color-mix(in srgb, var(--verde) 9%, transparent); }
.dg-banda.dg-em1 { fill: color-mix(in srgb, var(--azul) 13%, transparent); }
.dg-banda.dg-em2 { fill: color-mix(in srgb, var(--azul) 6%, transparent); }
.dg-banda-borde { stroke: color-mix(in srgb, var(--azul) 55%, transparent); stroke-width: 1; stroke-dasharray: 2 3; }
.dg-banda-borde.dg-em2 { stroke: var(--dorado); stroke-dasharray: 6 3; }
.dg-banda-txt { font-size: 11px; fill: var(--azul); paint-order: stroke; stroke: var(--panel); stroke-width: 3px; }
.dg-banda-txt.dg-em2 { fill: var(--dorado); }
.dg-dist { fill: color-mix(in srgb, var(--azul) 26%, transparent); stroke: color-mix(in srgb, var(--azul) 70%, transparent); stroke-width: 1; }
.dg-rej { stroke: color-mix(in srgb, var(--borde) 70%, transparent); stroke-width: 1; }
.dg-eje { font-size: 11.5px; fill: var(--dim); font-variant-numeric: tabular-nums; }
.dg-cero { stroke: var(--dim); stroke-width: 1.2; }
.dg-h { stroke-width: 1.4; }
.dg-h-perdida { stroke: var(--rojo); stroke-width: 2; }
.dg-h-regla { stroke: var(--texto); stroke-dasharray: 6 4; }
.dg-h-ganancia { stroke: var(--verde); stroke-width: 1; stroke-dasharray: 2 3; }
.dg-h-limite { stroke: var(--rojo); stroke-width: 1.2; stroke-dasharray: 8 3; }
.dg-h-cerrar { stroke: var(--dorado); stroke-width: 1.6; stroke-dasharray: 4 3; }
.dg-h-txt { font-size: 12px; font-weight: 700; paint-order: stroke; stroke: var(--panel); stroke-width: 3.5px; }
text.dg-h-perdida, text.dg-h-limite { fill: var(--rojo); stroke: var(--panel); stroke-width: 3.5px; }
text.dg-h-regla { fill: var(--texto); stroke: var(--panel); stroke-width: 3.5px; }
text.dg-h-ganancia { fill: var(--verde); stroke: var(--panel); stroke-width: 3.5px; font-weight: 400; }
text.dg-h-cerrar { fill: var(--dorado); stroke: var(--panel); stroke-width: 3.5px; }
.dg-v { stroke-width: 1.2; stroke-dasharray: 4 3; }
.dg-v-vende { stroke: var(--rojo); }
.dg-v-compra { stroke: var(--azul); }
.dg-v-precio { stroke: var(--texto); stroke-dasharray: none; stroke-width: 1.6; }
.dg-v-eq { stroke: var(--dorado); stroke-dasharray: 2 3; }
.dg-v-base { stroke: var(--dim); stroke-dasharray: 3 3; }
.dg-v-limite { stroke: var(--rojo); stroke-dasharray: 5 4; }
.dg-v-marca { stroke: var(--dim); }
.dg-v-txt { font-size: 11.5px; paint-order: stroke; stroke: var(--panel2); stroke-width: 3px; fill: var(--dim); }
text.dg-v-vende { fill: var(--rojo); }
text.dg-v-compra { fill: var(--azul); }
text.dg-v-precio { fill: var(--texto); font-weight: 700; }
text.dg-v-eq { fill: var(--dorado); }
text.dg-v-limite { fill: var(--rojo); }
.dg-mini .dg-v { stroke-width: 1; }
.dg-c { fill: none; stroke-linejoin: round; stroke-linecap: round; }
.dg-c-vence { stroke: var(--texto); stroke-width: 2.8px; }
.dg-c-fecha { stroke: var(--verde); stroke-width: 3px; }
.dg-c-fecha-neg { stroke: var(--rojo); stroke-width: 3px; }
.dg-c-hoy { stroke: var(--azul); stroke-width: 1.6px; }
.dg-raya { stroke-dasharray: 6 4; }
.dg-c-defensa, .dg-c-comparar { stroke-width: 2.4px; }
.dg-mini .dg-c-vence { stroke-width: 2px; }
.dg-recorte { font-size: 12px; fill: var(--rojo); font-weight: 700; paint-order: stroke; stroke: var(--panel); stroke-width: 3px; }
.dg-toque { fill: transparent; cursor: crosshair; }
.dg-cruz-l { stroke: var(--dim); stroke-width: 1; stroke-dasharray: 3 3; }
.dg-punto { fill: var(--texto); stroke: var(--panel); stroke-width: 1.5; }
.dg-punto.dg-c-fecha { fill: var(--verde); }
.dg-punto.dg-c-hoy { fill: var(--azul); }
.dg-tip { position: absolute; z-index: 5; pointer-events: none; background: var(--panel2); border: 1px solid var(--borde); border-radius: 8px;
  padding: 5px 9px; font-size: 12.5px; box-shadow: 0 6px 18px color-mix(in srgb, var(--fondo) 60%, transparent); max-width: 280px; }

/* la lectura y la leyenda didáctica */
.dg-lectura { padding: 8px 10px; border: 1px solid var(--borde); border-radius: 8px; background: var(--panel); font-size: 13.5px; min-height: 64px;
  line-height: 1.5; overflow-wrap: anywhere; }
.dg-frase { color: var(--dim); }
.dg-pt { font-size: 14px; }
.dg-raiz .neg { color: var(--rojo); }
.dg-raiz .pos { color: var(--verde); }
.dg-n { white-space: nowrap; }
.dg-ley-det > summary { cursor: pointer; font-size: 13px; color: var(--azul); padding: 2px 0; }
.dg-leyenda-in { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr)); gap: 2px 16px; font-size: 12.5px; margin-top: 4px; }
.dg-leyenda:empty, .dg-avisos:empty { display: none; }
.dg-lg-item { display: flex; flex-direction: column; padding: 3px 0; border-bottom: 1px dashed color-mix(in srgb, var(--borde) 70%, transparent); min-width: 0; }
.dg-lg-a { display: none; color: var(--dim); font-size: 12px; }
.dg-lg-abierto .dg-lg-a { display: block; }
.dg-lg-c { display: block; margin-top: 1px; }
.dg-q { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; border-radius: 9px; border: 1px solid var(--borde);
  font-size: 11px; color: var(--azul); background: var(--panel); vertical-align: 1px; }
.dg-q:hover { border-color: var(--azul); }
.dg-lg { display: inline-block; width: 22px; height: 10px; margin-right: 6px; vertical-align: -1px; border-radius: 2px; }
.dg-lg-vence { background: var(--texto); height: 3px; vertical-align: 2px; }
.dg-lg-hoy { background: linear-gradient(90deg, var(--rojo) 50%, var(--verde) 50%); height: 3px; vertical-align: 2px; }
.dg-lg-zona { background: linear-gradient(90deg, color-mix(in srgb, var(--rojo) 30%, transparent) 50%, color-mix(in srgb, var(--verde) 30%, transparent) 50%); }
.dg-lg-perdida { background: var(--rojo); height: 2px; vertical-align: 3px; }
.dg-lg-regla { border-top: 2px dashed var(--texto); height: 0; vertical-align: 3px; }
.dg-lg-limite { border-top: 2px dashed var(--rojo); height: 0; vertical-align: 3px; }
.dg-lg-em1 { background: color-mix(in srgb, var(--azul) 30%, transparent); }
.dg-lg-em2 { background: color-mix(in srgb, var(--azul) 12%, transparent); border: 1px dashed var(--dorado); }
.dg-lg-dist { background: color-mix(in srgb, var(--azul) 40%, transparent); border-radius: 10px 10px 0 0; }
.dg-lg-v { border-left: 2px dashed var(--rojo); border-right: 2px dashed var(--azul); width: 14px; }
.dg-lg-eq { border-left: 2px dotted var(--dorado); width: 4px; }
.dg-lg-precio { border-left: 2px solid var(--texto); width: 4px; }
.dg-lg-gan { border-top: 1px dashed var(--verde); height: 0; vertical-align: 3px; }
.dg-aviso { margin: 0; padding: 6px 9px; border-left: 4px solid var(--dorado); border-radius: 6px; font-size: 12.5px;
  background: color-mix(in srgb, var(--dorado) 10%, transparent); }

/* «⤢ Pantalla completa»: el diagrama a toda la ventana, por encima de la ficha (Esc vuelve) */
.dg-completa { position: fixed !important; inset: 0; z-index: 270; overflow: auto; background: var(--fondo); padding: 12px 18px 18px; }
.dg-lectura-completa { display: none; }
.dg-completa .dg-lectura-completa { display: block; }
html.dg-sin-scroll, html.dg-sin-scroll body { overflow: hidden; }

@media (max-width: 640px) {
  .dg-capas { gap: 4px 10px; font-size: 12px; }
  .dg-lectura { font-size: 13px; }
  .dg-completa { padding: 8px 10px 14px; }
}
