*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
    :root {
      --bg: #f0f4f9; --surface: #ffffff; --surface2: #f7fafd; --border: #dde6f0;
      --blue-dark: #1a3a5c; --blue: #2563a8; --blue-mid: #3b82c4; --blue-light: #dbeafe; --blue-xlight: #eff6ff;
      --accent: #0ea5e9; --success: #16a34a; --success-bg: #dcfce7;
      --danger: #dc2626; --danger-bg: #fee2e2; --warn: #d97706; --warn-bg: #fef3c7;
      --text: #1e293b; --text2: #475569; --text3: #94a3b8;
      --mono: 'JetBrains Mono', monospace; --sans: 'Inter', sans-serif;
      --radius: 10px; --shadow: 0 1px 3px rgba(0,0,0,0.08); --shadow-md: 0 4px 12px rgba(0,0,0,0.10);
    }
    body { background: var(--bg); color: var(--text); font-family: var(--sans); min-height: 100vh; font-size: 14px; }

    /* ── LOGIN ── */
    #login-screen { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: linear-gradient(135deg, #1a3a5c 0%, #2563a8 50%, #0ea5e9 100%); }
    .login-box { width: 100%; max-width: 360px; background: var(--surface); border-radius: 16px; padding: 15px 11px;}
    .login-logo { display: flex; align-items: center; justify-content: center; margin-bottom: 28px; }
    .logo-icon { width: 56px; height: 56px; background: linear-gradient(135deg, var(--blue), var(--accent)); border-radius: 14px; display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 12px rgba(37,99,168,0.4); }
    .login-title { font-size: 20px; font-weight: 700; text-align: center; color: var(--blue-dark); margin-bottom: 6px; }
    .login-sub { font-size: 13px; color: var(--text3); text-align: center; margin-bottom: 28px; }
    .field { margin-bottom: 14px; }
    .field label { display: block; font-size: 12px; font-weight: 600; color: var(--text2); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.5px; }
    .field input { width: 100%; padding: 10px 14px; border: 1.5px solid var(--border); border-radius: var(--radius); background: var(--surface2); color: var(--text); font-family: var(--sans); font-size: 14px; outline: none; transition: border-color 0.2s, box-shadow 0.2s; }
    .field input:focus { border-color: var(--blue-mid); box-shadow: 0 0 0 3px rgba(37,99,168,0.12); }

    /* ── BUTTONS ── */
    .btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 18px; border: none; border-radius: var(--radius); font-family: var(--sans); font-size: 14px; font-weight: 600; cursor: pointer; transition: all 0.15s; white-space: nowrap; }
    .btn-primary { background: linear-gradient(135deg, var(--blue), var(--blue-mid)); color: white; box-shadow: 0 2px 8px rgba(37,99,168,0.3); width: 100%; }
    .btn-primary:hover { opacity: 0.92; transform: translateY(-1px); }
    .btn-danger { background: var(--danger-bg); color: var(--danger); border: 1px solid #fca5a5; }
    .btn-danger:hover { background: var(--danger); color: white; }
    .btn-warn { background: var(--warn-bg); color: var(--warn); border: 1px solid #fcd34d; }
    .btn-warn:hover { background: var(--warn); color: white; }
    .btn-ghost { background: var(--surface2); color: var(--text2); border: 1px solid var(--border); }
    .btn-ghost:hover { background: var(--blue-xlight); color: var(--blue); border-color: var(--blue-light); }
    .btn-blue-light { background: var(--blue-xlight); color: var(--blue); border: 1px solid var(--blue-light); }
    .btn-blue-light:hover { background: var(--blue-light); }
    .btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }
    .btn-sm { padding: 6px 12px; font-size: 12px; }
    .error-msg { color: var(--danger); font-size: 12px; margin-top: 10px; text-align: center; }

    /* ── TOPBAR ── */
    #dashboard { display: none; min-height: 100vh; }
    .topbar { background: var(--blue-dark); padding: 0 28px; height: 56px; display: flex; align-items: center; justify-content: space-between; box-shadow: 0 2px 8px rgba(0,0,0,0.15); position: sticky; top: 0; z-index: 50; }
    .topbar-brand { display: flex; align-items: center; gap: 10px; }
    .topbar-logo { width: 32px; height: 32px; background: transparent; border-radius: 8px; display: flex; align-items: center; justify-content: center; }
    .topbar-name { font-size: 15px; font-weight: 700; color: white; }
    .topbar-right { display: flex; align-items: center; gap: 12px; }
    .topbar-user { font-size: 12px; color: rgba(255,255,255,0.5); font-family: var(--mono); }
    .btn-logout { background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.15); color: rgba(255,255,255,0.7); padding: 6px 14px; border-radius: 7px; font-size: 12px; font-weight: 500; cursor: pointer; transition: all 0.15s; }
    .btn-logout:hover { background: rgba(255,255,255,0.2); color: white; }

    /* ── MAIN ── */
    .main { width: 100%; padding: 28px 24px; }
    .page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
    .page-title { font-size: 20px; font-weight: 700; color: var(--blue-dark); }
    .page-sub { font-size: 13px; color: var(--text3); margin-top: 2px; }
    .summary-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 24px; max-width: 480px; }
    .summary-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 14px; box-shadow: var(--shadow); flex-shrink: 0; }

    /* ── FILTROS (perfil / fase) ── */
    .filter-group { border-bottom: 1px solid var(--border); }
    .filter-group:last-child { border-bottom: none; }
    .filter-group-header { display: flex; align-items: center; justify-content: space-between; padding: 9px 14px; font-size: 12px; font-weight: 700; color: var(--text2); cursor: pointer; user-select: none; }
    .filter-group-header:hover { background: var(--surface2); }
    .filter-group-header .arrow-icon { font-size: 9px; color: var(--text3); transition: transform 0.15s; }
    .filter-group-header.expanded .arrow-icon { transform: rotate(90deg); }
    .filter-group-values { display: none; padding-bottom: 4px; }
    .filter-value-item { display: flex; justify-content: space-between; gap: 12px; padding: 6px 14px 6px 26px; font-size: 12px; color: var(--text2); cursor: pointer; white-space: nowrap; }
    .filter-value-item:hover { background: var(--surface2); }
    .filter-value-item.active { color: var(--blue); font-weight: 700; background: var(--blue-xlight); }

    .search-filter-bar { display: flex; align-items: stretch; flex: 1; min-width: 160px; max-width: 280px; border: 1.5px solid var(--border); border-radius: var(--radius); background: var(--surface); position: relative; isolation: isolate; z-index: 10000; transition: border-color 0.2s; }
    .search-filter-bar:focus-within { border-color: var(--blue-mid); }
    .search-filter-input { flex: 1; min-width: 0; padding: 8px 14px; border: none; background: transparent; color: var(--text); font-family: var(--sans); font-size: 13px; outline: none; border-radius: var(--radius) 0 0 var(--radius); }
    .search-filter-btn { flex-shrink: 0; display: flex; align-items: center; justify-content: center; width: 34px; border: none; border-left: 1px solid var(--border); background: transparent; color: var(--text3); cursor: pointer; border-radius: 0 var(--radius) var(--radius) 0; transition: background 0.15s, color 0.15s; }
    .search-filter-btn:hover { background: var(--surface2); color: var(--blue); }
    .search-filter-btn.has-active-filters { color: var(--blue); }
    .summary-label { font-size: 10px; font-weight: 600; color: var(--text3); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 2px; }
    .summary-value { font-size: 20px; font-weight: 700; color: var(--blue-dark); }
    .summary-value.green { color: var(--success); }
    .summary-value.red { color: var(--danger); }
    .summary-value.orange {color: var(--warn); }

    /* ── INSTANCE GRID ── */
    #instances-list { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
    @media (max-width: 1400px) { #instances-list { grid-template-columns: repeat(4, 1fr); } }
    @media (max-width: 1100px) { #instances-list { grid-template-columns: repeat(3, 1fr); } }
    @media (max-width: 768px)  { #instances-list { grid-template-columns: repeat(2, 1fr); } }
    @media (max-width: 480px)  { #instances-list { grid-template-columns: 1fr; } }

    .instance-card { min-width: 0; background: var(--surface); border-radius: var(--radius); overflow: visible; animation: fadeUp 0.3s ease; transition: transform 0.15s, box-shadow 0.15s; box-shadow: var(--shadow); display: flex; flex-direction: column; position: relative; }
    .instance-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
    .card-status-bar { height: 5px; width: 100%; flex-shrink: 0; border-radius: var(--radius) var(--radius) 0 0; }
    .instance-card.running { border: 1px solid #bbf7d0; background: #f0fdf4; }
    .instance-card.running .card-status-bar { background: var(--success); }
    .instance-card.error { border: 1px solid #fef08a; background: #fefce8; } /* Borde y fondo amarillo pastel */
    .instance-card.error .card-status-bar { background: #eab308; } /* Barra superior dorada/amarilla */
    .instance-card.stopped { border: 1px solid #fecaca; background: #fff5f5; }
    .instance-card.stopped .card-status-bar { background: var(--danger); }
    .instance-card:has(.dropdown-menu.open) {
        z-index: 999 !important;
    }
    /* ── CARD HEADER ── */
    .card-header { 
        display: flex; 
        align-items: flex-start; 
        justify-content: space-between; 
        padding: 10px 12px 6px; 
        gap: 6px; 
        overflow: visible !important; /* Añadimos esto para asegurar que deje salir cosas */
    }
    .card-name-row { display: flex; align-items: center; gap: 6px; flex: 1; min-width: 0; }
    .card-name { font-size: 13px; font-weight: 700; color: var(--blue-dark); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex-shrink: 1; }
    .stage-badge { font-size: 8px; font-weight: 700; padding: 2px 7px; border-radius: 20px; text-transform: uppercase; letter-spacing: 0.4px; flex-shrink: 0; white-space: nowrap; }
    .stage-badge.stage-production { background: var(--success-bg); color: var(--success); }
    .stage-badge.stage-development { background: var(--blue-xlight); color: var(--blue); }
    .stage-badge.stage-decommissioned { background: var(--surface2); color: var(--text3); }
    .version-badge { font-size: 8px; font-weight: 700; padding: 2px 7px; border-radius: 20px; background: var(--surface2); color: var(--text2); flex-shrink: 0; white-space: nowrap; font-family: var(--mono); }
    .card-url { font-family: var(--mono); font-size: 10px; color: var(--accent); text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; padding: 0 12px 6px; max-width: 100%; }
    .card-url:hover { text-decoration: underline; }
    /* ── BADGES DE ESTADO ── */
    .status-badge { font-size: 9px; font-weight: 600; padding: 1px 6px; border-radius: 20px; text-transform: uppercase; letter-spacing: 0.5px; display: inline-block; margin: 0 12px 6px; }
    .status-badge.running { background: var(--success-bg); color: var(--success); }
    .status-badge.error { background: var(--warn-bg); color: var(--warn); }
    .status-badge.stopped { background: var(--danger-bg); color: var(--danger); }

    /* ── DROPDOWN ── */
    .dropdown { 
        position: relative !important; 
        display: inline-block; /* Evita que herede comportamientos extraños de flex */
    }
    .dropdown-btn { background: none; border: none; cursor: pointer; padding: 2px 6px; border-radius: 6px; color: var(--text3); font-size: 16px; line-height: 1; transition: background 0.15s; flex-shrink: 0; }
    .dropdown-btn:hover { background: rgba(0,0,0,0.06); color: var(--text2); }
    
    /* El menú principal de los 3 puntos (Fijamos overflow: visible para que los submenús puedan salir por los lados) */
    .dropdown-menu { 
        display: none; 
        position: absolute; 
        top: calc(100% + 4px); 
        right: 0; 
        background: var(--surface); 
        border: 1px solid var(--border); 
        border-radius: 8px; 
        box-shadow: var(--shadow-md); 
        min-width: 140px; 
        z-index: 200; 
        overflow: visible !important; /* CRÍTICO: Quita cualquier 'hidden' viejo aquí */
    }
    .dropdown-menu.open { display: block; animation: fadeUp 0.15s ease; }
    
    .dropdown-item { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 9px 14px; font-size: 13px; font-weight: 500; cursor: pointer; transition: background 0.1s; border: none; background: none; width: 100%; text-align: left; color: var(--text); }
    .dropdown-item:hover { background: var(--surface2); }
    .dropdown-item.danger { color: var(--danger); }
    .dropdown-item.danger:hover { background: var(--danger-bg); }
    .dropdown-submenu-container {
        position: relative !important; /* Obligatorio para el cálculo del submenú */
        width: 100%;
    }
    
    .dropdown-menu .submenu-inline-content {
        display: none;
        position: absolute !important; /* Rompe el Flexbox del padre */
        top: -6px !important; /* Lo sube un pelín para alinearlo estéticamente con su botón */
        left: 100% !important; /* Lo saca completamente a la derecha */
        background: var(--surface) !important;
        border: 1px solid var(--border) !important;
        border-radius: 8px !important;
        box-shadow: var(--shadow-md) !important;
        min-width: 150px !important;
        width: max-content !important;
        z-index: 9999 !important; /* Se superpone por encima de cualquier otra tarjeta */
    }
    
    /* Comportamiento espejo automático si toca el borde derecho de la pantalla */
    .dropdown-menu.drop-left .submenu-inline-content {
        left: auto !important;
        right: 100% !important; /* Lo saca completamente a la izquierda */
    }
    
    /* Subbotones limpios adaptados al modo oscuro del tema */
    .submenu-inline-content .dropdown-item.sub-item {
        padding: 9px 14px !important; /* Quitamos la sangría de 32px que los empujaba a la derecha */
        font-size: 13px !important;
        font-weight: normal !important;
        color: var(--text) !important;
        background: transparent !important;
        border: none !important;
        text-align: left !important;
        width: 100% !important;
        cursor: pointer !important;
        display: flex !important;
        align-items: center !important;
        white-space: nowrap !important;
    }
    
    .submenu-inline-content .dropdown-item.sub-item:hover {
        background-color: var(--surface2) !important; 
    }
    
    .submenu-inline-content .dropdown-item.sub-item.danger {
        color: var(--danger) !important;
        font-weight: 500 !important;
    }
    .submenu-inline-content .dropdown-item.sub-item.danger:hover {
        background: var(--danger-bg) !important;
    }
    
    .dropdown-submenu-container .arrow-icon {
        font-size: 9px;
        color: var(--text3); 
    }

    /* ── CHART ── */
    .card-charts { padding: 4px 10px 8px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
    /* .chart-row { } */
    .chart-label { display: flex; justify-content: space-between; align-items: center; margin-bottom: 3px; }
    .chart-label-text { font-size: 9px; font-weight: 600; color: var(--text3); text-transform: uppercase; letter-spacing: 0.5px; }
    .chart-label-val { font-family: var(--mono); font-size: 10px; color: var(--text2); }
    .chart-wrap { position: relative; height: 32px; background: rgba(0,0,0,0.04); border-radius: 4px; overflow: hidden; }
    canvas.sparkline { display: block; width: 100%; height: 100%; }

    /* ── CARD FOOTER ── */
    .card-footer { display: flex; justify-content: flex-end; gap: 6px; padding: 0 10px 10px; flex-wrap: nowrap; align-items: center; }
    .card-storage { display: grid; grid-template-columns: 1fr 1fr; gap: 3px 10px; padding: 0 12px 8px; font-size: 10px; color: var(--text3); }
    .card-storage .storage-item { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .card-storage b { color: var(--text2); font-weight: 600; }
    .btn-restart { background: var(--blue-xlight); color: var(--blue); border: 1px solid var(--blue-light); padding: 5px 12px; border-radius: 7px; font-size: 12px; font-weight: 600; cursor: pointer; transition: all 0.15s; display: flex; align-items: center; gap: 5px; }
    .btn-restart:hover { background: var(--blue-light); }
    .btn-restart:disabled { opacity: 0.5; cursor: not-allowed; }
    .btn-logs { background: var(--surface2); color: var(--text2); border: 1px solid var(--border); padding: 5px 12px; border-radius: 7px; font-size: 12px; font-weight: 600; cursor: pointer; transition: all 0.15s; display: flex; align-items: center; gap: 5px; }
    .btn-logs:hover { background: var(--blue-xlight); color: var(--blue); border-color: var(--blue-light); }

    /* ── MONITOR ── */
    #monitor-screen { display: none; min-height: 100vh; }
    #monitor-list { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
    @media (max-width: 1400px) { #monitor-list { grid-template-columns: repeat(4, 1fr); } }
    @media (max-width: 1100px) { #monitor-list { grid-template-columns: repeat(3, 1fr); } }
    @media (max-width: 768px)  { #monitor-list { grid-template-columns: repeat(2, 1fr); } }
    @media (max-width: 480px)  { #monitor-list { grid-template-columns: 1fr; } }

    /* ── MODALS ── */
    .modal-overlay { display: none; position: fixed; inset: 0; background: rgba(15,23,42,0.6); z-index: 100; align-items: center; justify-content: center; padding: 20px; backdrop-filter: blur(2px); }
    .modal-overlay.open { display: flex; }
    .modal { background: var(--surface); border-radius: 14px; width: 100%; max-width: 420px; box-shadow: var(--shadow-md); animation: fadeUp 0.2s ease; overflow: hidden; }
    .modal-header { padding: 20px 24px 16px; border-bottom: 1px solid var(--border); }
    .modal-title { font-size: 16px; font-weight: 700; color: var(--blue-dark); }
    .modal-sub { font-size: 12px; color: var(--text3); margin-top: 3px; }
    .modal-body { padding: 20px 24px; }
    .modal-footer { display: flex; gap: 8px; padding: 0 24px 20px; justify-content: flex-end; }

    /* ── LOGS MODAL ── */
    .logs-modal-box { background: var(--surface); border-radius: 14px; width: 95vw; max-width: 1000px; box-shadow: var(--shadow-md); animation: fadeUp 0.2s ease; overflow: hidden; display: flex; flex-direction: column; max-height: 85vh; }
    .logs-modal-header { display: flex; align-items: center; justify-content: space-between; padding: 12px 20px; background: #0f172a; border-bottom: 1px solid #1e293b; flex-shrink: 0; }
    .log-live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--success); animation: pulse 1.5s infinite; }
    .log-live-text { font-family: var(--mono); font-size: 10px; color: var(--success); text-transform: uppercase; letter-spacing: 1px; }
    .log-close-btn { background: none; border: none; color: #475569; font-size: 20px; cursor: pointer; padding: 2px 6px; }
    .log-close-btn:hover { color: white; }
    .log-pre-wrap { background: #0f172a; flex: 1; overflow-y: auto; }
    .log-pre { font-family: var(--mono); font-size: 12px; line-height: 1.7; color: #94a3b8; padding: 14px 18px; white-space: pre-wrap; word-break: break-all; }
    .log-pre::-webkit-scrollbar { width: 5px; }
    .log-pre::-webkit-scrollbar-thumb { background: #334155; border-radius: 3px; }
    .log-line-err { color: #f87171; }
    .log-line-warn { color: #fbbf24; }
    .log-line-info { color: #38bdf8; }
    .logf-btn { background:none; border:1px solid #334155; border-radius:5px; color:#475569; 
        font-family:var(--mono); font-size:10px; padding:3px 10px; cursor:pointer; transition:all 0.15s; }
    .logf-btn:hover { background:#1e293b; }
    .logf-btn.logf-active { background:#1e293b; color:white; border-color:#475569; }

    .logs-modal-box.fullscreen {
        position: fixed !important;
        inset: 0 !important;
        width: 100vw !important;
        max-width: 100vw !important;
        height: 100vh !important;
        max-height: 100vh !important;
        border-radius: 0 !important;
        z-index: 200 !important;
    }
    .logs-modal-actions {
        display: flex;
        align-items: center;
        gap: 8px; 
    }
    
    #logs-download-btn {
        background: #28a745; /* Un tono verde sutil para indicar descarga/éxito */
        color: white;
        border: none;
        padding: 6px 12px;
        border-radius: 4px;
        cursor: pointer;
        font-size: 0.85rem;
        font-weight: bold;
        display: flex;
        align-items: center;
        gap: 4px;
        transition: background 0.2s;
    }
    
    #logs-download-btn:hover {
        background: #218838; 
    }

    /* ── FAB ── */
    .fab { position: fixed; bottom: 28px; right: 28px; width: 52px; height: 52px; border-radius: 50%; background: linear-gradient(135deg, var(--blue), var(--accent)); border: none; color: white; font-size: 24px; cursor: pointer; box-shadow: 0 4px 16px rgba(37,99,168,0.4); display: none; align-items: center; justify-content: center; transition: all 0.2s; z-index: 40; }
    .fab:hover { transform: scale(1.08); }

    /* ── RESULT ── */
    .result-card { display: none; background: var(--success-bg); border: 1px solid #86efac; border-radius: var(--radius); padding: 16px 20px; margin-bottom: 20px; animation: fadeUp 0.3s ease; }
    .result-title { font-size: 13px; font-weight: 700; color: var(--success); }
    .result-row { display: flex; gap: 8px; margin-bottom: 5px; font-family: var(--mono); font-size: 12px; }
    .result-label { color: var(--text3); min-width: 90px; }
    .result-value { color: var(--text); }
    .result-value.highlight { color: var(--blue); font-weight: 600; }
    .result-value.password { color: var(--warn); font-weight: 600; }
    .result-warn { font-size: 11px; color: var(--warn); margin-top: 8px; }

    /* ── EMPTY ── */
    .empty-state { text-align: center; padding: 60px 20px; color: var(--text3); grid-column: 1/-1; }
    .empty-icon { font-size: 40px; margin-bottom: 12px; opacity: 0.4; }

    /* ── SPINNER ── */
    .spinner { display: inline-block; width: 13px; height: 13px; border: 2px solid rgba(255,255,255,0.3); border-top-color: white; border-radius: 50%; animation: spin 0.6s linear infinite; }
    .spinner.dark { border-color: rgba(37,99,168,0.2); border-top-color: var(--blue); }

    @keyframes spin { to { transform: rotate(360deg); } }
    @keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
    @keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }



/* Estilos para el listado de librerías */
/* ── MODAL DIAGNÓSTICOS / PIP ── */
.diagnostics-modal-box {
    background: var(--surface);
    border-radius: 14px;
    width: 90vw;
    max-width: 1100px;
    box-shadow: var(--shadow-md);
    animation: fadeUp 0.2s ease;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    max-height: 75vh;
}
/* Contenedor acolchado para que la barra de búsqueda respire, igual que en los logs */
.pip-search-container {
    padding: 12px 20px;
    background: #0f172a;
    border-bottom: 1px solid #1e293b;
    flex-shrink: 0;
    display: flex;
}

/* Buscador estirado de izquierda a derecha */
.pip-search-field {
    background: #1e293b;
    border: 1px solid #334155;
    color: white;
    padding: 8px 14px;
    border-radius: 6px;
    font-family: var(--mono);
    font-size: 12px;
    width: 100%; /* Ocupa todo el ancho */
    outline: none;
    transition: border-color 0.15s;
}

.pip-search-field:focus {
    border-color: #475569;
}

/* Ajuste en la envoltura de la tabla para que encaje con el nuevo buscador */
.pip-table-wrapper {
    flex: 1;
    overflow-y: auto;
    background: #0f172a;
    padding: 0 10px 10px 10px; /* Quitamos padding superior para que no flote */
}

.pip-table {
    width: 100%;
    border-collapse: collapse;
    font-family: var(--mono);
    font-size: 12px;
    color: #94a3b8;
    text-align: left;
}

.pip-table th {
    background: #1e293b;
    color: white;
    padding: 10px;
    position: sticky;
    top: 0;
    z-index: 10;
    border-bottom: 2px solid #334155;
}

.pip-table td {
    padding: 8px 10px;
    border-bottom: 1px solid #1e293b;
}

.pip-table tr:hover td {
    background: #131d31;
    color: white;
}

/* ── COMPARATIVA (librerías / módulos) ── */
.compare-btn {
    background: #1e3a5f;
    color: #38bdf8;
    border: 1px solid #2563a8;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: background 0.2s;
}

.compare-btn:hover {
    background: #2563a8;
    color: white;
}

.compare-bar {
    padding: 12px 20px;
    background: #0f172a;
    border-bottom: 1px solid #1e293b;
    flex-shrink: 0;
    display: none;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.compare-select {
    background: #1e293b;
    border: 1px solid #334155;
    color: white;
    padding: 7px 10px;
    border-radius: 6px;
    font-family: var(--mono);
    font-size: 12px;
    outline: none;
}

.compare-generate-btn {
    background: var(--blue);
    color: white;
    border: none;
    padding: 7px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
}

.compare-generate-btn:hover { opacity: 0.9; }
.compare-generate-btn:disabled { opacity: 0.6; cursor: not-allowed; }

.compare-cancel-btn, .compare-back-btn {
    background: transparent;
    color: #94a3b8;
    border: 1px solid #334155;
    padding: 7px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
}

.compare-cancel-btn:hover, .compare-back-btn:hover {
    color: white;
    border-color: #475569;
}

.compare-bar-label {
    color: #94a3b8;
    font-size: 12px;
    font-family: var(--mono);
}

.compare-error {
    color: #f87171;
    font-size: 12px;
}

.pip-table tr.compare-match td {
    background: rgba(34,197,94,0.15);
    color: #4ade80;
}

.pip-table tr.compare-match:hover td {
    background: rgba(34,197,94,0.22);
    color: #4ade80;
}

.pip-table tr.compare-diff td {
    background: rgba(220,38,38,0.15);
    color: #f87171;
}

.pip-table tr.compare-diff:hover td {
    background: rgba(220,38,38,0.22);
    color: #f87171;
}

.compare-diff-count {
    color: #f87171;
    font-size: 12px;
    font-weight: 600;
}

.compare-version-tag {
    background: #1e293b;
    padding: 2px 8px;
    border-radius: 4px;
    color: #fbbf24;
    font-size: 11px;
}

/* ── VERSIÓN DE IMAGEN (vista de tarjetas, no tabla: solo hay un valor) ── */
.image-version-body {
    padding: 20px;
    background: #0f172a;
    overflow-y: auto;
}

.image-version-summary {
    text-align: center;
    font-size: 13px;
    font-weight: 600;
    padding: 10px 14px;
    border-radius: 8px;
    margin-bottom: 18px;
}

.image-version-summary.match {
    background: rgba(34, 197, 94, 0.15);
    color: #4ade80;
}

.image-version-summary.diff {
    background: rgba(220, 38, 38, 0.15);
    color: #f87171;
}

.image-version-cards {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
}

.image-version-card {
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 10px;
    padding: 16px 22px;
    text-align: center;
    min-width: 170px;
}

.image-version-card.match {
    border-color: #22c55e;
}

.image-version-card.diff {
    border-color: #dc2626;
}

.image-version-card-name {
    font-weight: 700;
    color: #38bdf8;
    margin-bottom: 8px;
    font-size: 13px;
}

.image-version-card-value {
    color: #fbbf24;
    font-family: var(--mono);
    font-size: 12px;
}