/* ============================================================================
   Modal "Ver grafo" (red CPM) — estilo según docs/estandarizacion.md
   ----------------------------------------------------------------------------
   Tokens --to-* del estándar, acotados a este modal (.tema-oscuro.gm) para no
   teñir el resto de SmartProjects, que sigue el sistema claro navy.
   El lienzo del grafo (#cytoscapeContainer) se mantiene SIEMPRE claro: los
   colores de nodos y aristas están calibrados sobre blanco.
   ============================================================================ */

.tema-oscuro.gm {
    --to-bg:      #1e1e20;
    --to-card:    #2a2a2d;
    --to-card-2:  #323236;
    --to-field:   #1c1c1e;
    --to-line:    rgba(255,255,255,.08);
    --to-line-2:  rgba(255,255,255,.14);
    --to-text:    rgba(255,255,255,.88);
    --to-text-2:  rgba(255,255,255,.55);
    --to-text-3:  rgba(255,255,255,.35);
    --to-hover:   rgba(255,255,255,.05);
    --to-accent:  #0a84ff;
    --to-cab:     #1a1a2e;
    --to-green:   #30d158;
    --to-red:     #ff6961;
    --to-amber:   #ff9f0a;
    --to-purple:  #bf5af2;
    --to-teal:    #40c8e0;
    --to-font: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    --to-fs-lg: 15px;
    --to-fs:    13px;
    --to-fs-sm: 12px;
    --to-fs-xs: 11px;

    position: fixed;
    inset: 0;
    z-index: 10000;                 /* escala del estándar: modal = 10000 */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(0,0,0,.64);
    font-family: var(--to-font);
    font-size: var(--to-fs);
    color: var(--to-text);
}

/* Una sola familia tipográfica, también en los controles (no la heredan solos) */
.gm input, .gm select, .gm button { font-family: var(--to-font); }

/* Caja ----------------------------------------------------------------- */
.gm-caja {
    width: min(1600px, 100%);
    height: 100%;
    max-height: 92vh;
    background: var(--to-card);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Cabecera: título + acciones ------------------------------------------- */
.gm-cab {
    padding: 12px 16px;
    background: var(--to-cab);
    color: #fff;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}
.gm-cab h3 {
    margin: 0;
    font-size: var(--to-fs-lg);
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
}
.gm-sub {
    font-size: var(--to-fs-xs);
    color: var(--to-text-2);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}
.gm-cab-acciones {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Filtros: una sola fila, grupos separados por .to-sep ------------------- */
.gm-filtros {
    padding: 8px 16px;
    background: var(--to-card);
    border-bottom: 1px solid var(--to-line);
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;               /* solo cae a dos filas si la pantalla no da */
    font-size: var(--to-fs-sm);
    flex-shrink: 0;
}
.gm-filtros label.gm-et {
    color: var(--to-text-2);
    white-space: nowrap;
}
.gm-chk {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    white-space: nowrap;
    color: var(--to-text);
}
.gm-chk input[type="checkbox"] {
    width: 14px;
    height: 14px;
    margin: 0;
    accent-color: var(--to-accent);
    cursor: pointer;
}
.to-sep {
    width: 1px;
    height: 18px;
    background: var(--to-line-2);
    flex-shrink: 0;
}

/* Campos (alto 30) y select compacto (alto 28) --------------------------- */
.gm input[type="text"],
.gm input[type="date"],
.gm select {
    height: 30px;
    padding: 0 8px;
    background: var(--to-field);
    color: var(--to-text);
    border: none;
    border-radius: 6px;
    font-size: var(--to-fs-sm);
    outline: none;
    color-scheme: dark;            /* el selector nativo de fecha sale oscuro */
}
.gm input::placeholder { color: var(--to-text-3); }
.gm select.to-compacto { height: 28px; padding-right: 24px; }
.gm select { cursor: pointer; }
.gm select:disabled { opacity: .45; cursor: default; }
.gm input:focus, .gm select:focus {
    box-shadow: 0 0 0 2px var(--to-accent);   /* anillo de foco, nunca outline:none a secas */
}

/* Botones ---------------------------------------------------------------- */
.gm .to-btn {
    height: 28px;
    padding: 0 12px;
    border: none;
    border-radius: 6px;
    background: rgba(255,255,255,.1);
    color: var(--to-text);
    font-size: var(--to-fs-sm);
    font-weight: 500;
    line-height: 28px;
    cursor: pointer;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: background-color .12s ease, color .12s ease;
}
.gm .to-btn i { font-size: 12px; }
.gm .to-btn:hover { background: rgba(255,255,255,.16); }
.gm .to-btn.pri { background: var(--to-accent); color: #fff; }
.gm .to-btn.pri:hover { background: #2b94ff; }
.gm .to-btn:disabled { opacity: .45; cursor: default; }
.gm .to-icono-btn {
    width: 28px;
    height: 28px;
    padding: 0;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--to-text-2);
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background-color .12s ease, color .12s ease;
}
.gm .to-icono-btn:hover { background: rgba(255,255,255,.1); color: #fff; }

/* Chip de filtro activo (quitar con un clic) ----------------------------- */
.gm-chip {
    display: none;                 /* se muestra desde JS */
    height: 24px;
    padding: 0 10px;
    border-radius: 6px;
    background: rgba(255,159,10,.16);
    color: var(--to-amber);
    font-size: var(--to-fs-xs);
    line-height: 24px;
    cursor: pointer;
    white-space: nowrap;
}
.gm-chip:hover { background: rgba(255,159,10,.26); }

/* Lienzo: SIEMPRE claro -------------------------------------------------- */
.gm-lienzo {
    flex: 1;
    position: relative;
    overflow: hidden;
    background: #fff;
    color: #212529;                /* superficie clara heredada: fijar el color */
}
.gm-lienzo #cytoscapeContainer { width: 100%; height: 100%; background: #fff; }

/* Leyenda sobre el lienzo claro ----------------------------------------- */
.gm-leyenda {
    position: absolute;
    bottom: 8px;
    left: 8px;
    max-width: 640px;
    padding: 6px 10px;
    border-radius: 6px;
    background: rgba(255,255,255,.94);
    box-shadow: 0 1px 4px rgba(0,0,0,.12);
    color: #374151;
    font-size: var(--to-fs-xs);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 12px;
}
.gm-leyenda b { font-weight: 600; margin-right: 2px; }
.gm-leyenda .it { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.gm-leyenda .pt { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.gm-leyenda .ln { width: 18px; height: 2px; display: inline-block; }
.gm-leyenda .ln.cr { height: 3px; }
.gm-leyenda .sep { width: 1px; height: 14px; background: #d1d5db; }
.gm-leyenda .mut { color: #6b7280; }
.gm-leyenda #leyendaFinanciera { flex-basis: 100%; }

/* Pie: resumen a la izquierda, botones a la derecha ---------------------- */
.gm-pie {
    padding: 10px 16px;
    border-top: 1px solid var(--to-line);
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
.gm-pie .gm-resumen {
    margin-right: auto;
    font-size: var(--to-fs-sm);
    color: var(--to-text-2);
    font-variant-numeric: tabular-nums;
}

/* Panel de ranking (modo riesgo) sobre el lienzo claro ------------------- */
.gm-ranking {
    position: absolute;
    top: 8px;
    right: 8px;
    bottom: 48px;                  /* deja ver la leyenda */
    width: 360px;
    overflow: auto;
    padding: 8px 10px;
    border-radius: 6px;
    background: rgba(255,255,255,.96);
    box-shadow: 0 1px 6px rgba(0,0,0,.14);
    color: #111827;
    font-size: var(--to-fs-xs);
}
.gm-ranking .mut { color: #6b7280; }
.gm-ranking .rk-cab { display: flex; align-items: center; gap: 6px; }
.gm-ranking .rk-cab b { font-weight: 600; font-size: var(--to-fs-sm); margin-right: auto; }
.gm-ranking .rk-sub { margin: 2px 0 6px; }
.gm-ranking .rk-x {
    width: 22px; height: 22px; padding: 0; border: none; border-radius: 6px;
    background: transparent; color: #6b7280; font-size: 13px; cursor: pointer;
}
.gm-ranking .rk-x:hover { background: #f3f4f6; color: #111827; }
.gm-ranking table { width: 100%; border-collapse: collapse; }
.gm-ranking th { text-align: left; font-weight: 600; color: #6b7280; padding: 2px 4px; border-bottom: 1px solid #e5e7eb; }
.gm-ranking td { padding: 4px; border-bottom: 1px solid #f3f4f6; vertical-align: top; line-height: 1.3; }
.gm-ranking td.r { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.gm-ranking tbody tr { cursor: pointer; }
.gm-ranking tbody tr:hover { background: #f9fafb; }
.gm-ranking tr.crit td:first-child { box-shadow: inset 3px 0 0 #ef4444; }
.gm-ranking .rk-c { color: #ef4444; font-size: 9px; }
.gm-ranking .rk-niv { display: inline-block; padding: 1px 6px; border-radius: 6px; color: #fff; font-weight: 600; font-size: 10px; }
.gm-ranking .rk-mot { color: #b45309; white-space: nowrap; }
.gm-ranking code { font-family: var(--to-mono, Menlo, monospace); font-size: 10.5px; }
