/* ==========================================================
   PQC Migration Dashboard — Light Mode
   Universidad Católica Boliviana · Tesis Maestría
   ========================================================== */

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

:root {
    --bg-base:    #f0f4f8;
    --bg-card:    #ffffff;
    --bg-surface: #ffffff;

    --cyan:        #0891b2;
    --cyan-light:  #e0f2fe;
    --cyan-mid:    rgba(8,145,178,0.12);
    --violet:      #7c3aed;
    --violet-light:#ede9fe;
    --violet-mid:  rgba(124,58,237,0.12);
    --amber:       #d97706;
    --amber-light: #fef3c7;
    --amber-mid:   rgba(217,119,6,0.12);
    --green:       #059669;
    --green-light: #d1fae5;
    --green-mid:   rgba(5,150,105,0.12);
    --red:         #dc2626;
    --red-light:   #fee2e2;

    --text-primary:   #1e293b;
    --text-secondary: #475569;
    --text-muted:     #94a3b8;

    --border:       #e2e8f0;
    --border-focus: #0891b2;

    --shadow-sm:  0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md:  0 4px 12px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.04);
    --shadow-lg:  0 8px 24px rgba(0,0,0,0.10), 0 4px 8px rgba(0,0,0,0.04);
    --shadow-xl:  0 20px 40px rgba(0,0,0,0.12);

    --r-sm: 8px;
    --r-md: 12px;
    --r-lg: 16px;
    --r-xl: 20px;

    --font:      -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', 'Helvetica Neue', Arial, sans-serif;
    --font-mono: 'Courier New', 'Consolas', 'Lucida Console', monospace;

    --t-fast: 0.15s ease;
    --t-mid:  0.25s ease;
}

html { scroll-behavior: smooth; }

body {
    font-family: var(--font);
    background: var(--bg-base);
    color: var(--text-primary);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: #f1f5f9; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ============================================================
   HEADER
   ============================================================ */
.app-header {
    background: linear-gradient(135deg, #0f2744 0%, #1e3a5f 100%);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(15,39,68,0.3);
}

.header-inner {
    max-width: 1600px;
    margin: 0 auto;
    padding: 0 28px;
    height: 68px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.header-brand { display: flex; align-items: center; gap: 14px; }

.brand-icon {
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, #22d3ee, #0891b2);
    border-radius: var(--r-md);
    display: grid;
    place-items: center;
    font-size: 18px;
    color: #fff;
    flex-shrink: 0;
    box-shadow: 0 0 16px rgba(34,211,238,0.4);
}

.brand-text h1 { font-size: 16px; font-weight: 700; color: #fff; letter-spacing: -0.2px; }
.brand-text p  { font-size: 11px; color: rgba(255,255,255,0.55); }

.header-controls { display: flex; align-items: center; gap: 10px; }

.api-status-pill {
    display: flex; align-items: center; gap: 7px;
    padding: 6px 12px;
    border-radius: 50px;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.15);
    font-size: 12px; font-weight: 500;
    color: rgba(255,255,255,0.75);
    transition: all var(--t-mid);
}
.api-status-pill.connected {
    background: rgba(52,211,153,0.2);
    border-color: rgba(52,211,153,0.35);
    color: #6ee7b7;
}
.api-status-pill.error {
    background: rgba(248,113,113,0.2);
    border-color: rgba(248,113,113,0.35);
    color: #fca5a5;
}
.status-dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: rgba(255,255,255,0.4);
    transition: all var(--t-mid);
}
.api-status-pill.connected .status-dot {
    background: #34d399;
    box-shadow: 0 0 6px #34d399;
    animation: pulse-dot 2s infinite;
}
.api-status-pill.error .status-dot { background: #f87171; }
@keyframes pulse-dot {
    0%,100% { opacity:1; } 50% { opacity:0.4; }
}

.last-update-pill {
    display: flex; align-items: center; gap: 6px;
    padding: 6px 11px;
    border-radius: 50px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.12);
    font-size: 11px; color: rgba(255,255,255,0.55);
    font-family: var(--font-mono);
}
.last-update-pill i { font-size: 10px; }

.refresh-btn {
    width: 34px; height: 34px;
    border-radius: 8px;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.15);
    color: rgba(255,255,255,0.7);
    cursor: pointer;
    display: grid; place-items: center;
    font-size: 13px;
    transition: all var(--t-fast);
}
.refresh-btn:hover { background: rgba(255,255,255,0.2); color: #fff; }
.refresh-btn.spinning i { animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.header-glow {
    height: 2px;
    background: linear-gradient(90deg, transparent, #22d3ee 30%, #7c3aed 70%, transparent);
    opacity: 0.5;
}

/* ============================================================
   MAIN LAYOUT
   ============================================================ */
.app-main {
    max-width: 1600px;
    margin: 0 auto;
    padding: 28px 28px 60px;
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.section-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 14px; gap: 12px;
}
.section-title {
    display: flex; align-items: center; gap: 10px;
}
.section-title > i { font-size: 16px; color: var(--cyan); }
.section-title h2 { font-size: 15px; font-weight: 700; color: var(--text-primary); }
.section-badge {
    font-size: 10px; font-weight: 700;
    padding: 3px 10px; border-radius: 50px;
    background: var(--cyan-light); color: var(--cyan);
    border: 1px solid rgba(8,145,178,0.2);
    text-transform: uppercase; letter-spacing: 0.5px;
}
.section-hint {
    font-size: 11px; color: var(--text-muted);
    display: flex; align-items: center; gap: 5px;
}

/* ============================================================
   METRIC CARDS
   ============================================================ */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.metric-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--r-xl);
    padding: 22px 24px;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: all var(--t-mid);
    animation: card-in 0.4s ease both;
}
.metric-card:nth-child(1) { animation-delay:0.05s; }
.metric-card:nth-child(2) { animation-delay:0.10s; }
.metric-card:nth-child(3) { animation-delay:0.15s; }
.metric-card:nth-child(4) { animation-delay:0.20s; }
@keyframes card-in {
    from { opacity:0; transform:translateY(16px); }
    to   { opacity:1; transform:translateY(0); }
}

.metric-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

/* Colored top border strip */
.metric-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    border-radius: var(--r-xl) var(--r-xl) 0 0;
}
.card-cyan::before   { background: linear-gradient(90deg, var(--cyan), #22d3ee); }
.card-violet::before { background: linear-gradient(90deg, var(--violet), #a78bfa); }
.card-amber::before  { background: linear-gradient(90deg, var(--amber), #fbbf24); }
.card-green::before  { background: linear-gradient(90deg, var(--green), #34d399); }

.card-glow { display: none; } /* Not needed in light mode */

.card-inner { display: flex; align-items: flex-start; gap: 16px; padding-top: 4px; }

.card-icon-wrap {
    width: 48px; height: 48px;
    border-radius: var(--r-md);
    display: grid; place-items: center;
    font-size: 20px;
    flex-shrink: 0;
}
.card-cyan   .card-icon-wrap { background: var(--cyan-light);   color: var(--cyan); }
.card-violet .card-icon-wrap { background: var(--violet-light); color: var(--violet); }
.card-amber  .card-icon-wrap { background: var(--amber-light);  color: var(--amber); }
.card-green  .card-icon-wrap { background: var(--green-light);  color: var(--green); }

.card-data { flex: 1; min-width: 0; }

.card-value {
    font-size: 32px; font-weight: 800;
    line-height: 1.1; letter-spacing: -1px;
    min-height: 36px;
}
.card-cyan   .card-value { color: var(--cyan); }
.card-violet .card-value { color: var(--violet); }
.card-amber  .card-value { color: var(--amber); }
.card-green  .card-value { color: var(--green); }

.card-label    { font-size: 13px; font-weight: 600; color: var(--text-primary); margin-top: 4px; }
.card-sublabel { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

.card-badge {
    position: absolute; top: 14px; right: 14px;
    font-size: 10px; font-weight: 700;
    padding: 3px 9px; border-radius: 50px;
}
.card-cyan   .card-badge { background: var(--cyan-light);   color: var(--cyan);   border: 1px solid rgba(8,145,178,0.2); }
.card-violet .card-badge, .card-badge-violet { background: var(--violet-light); color: var(--violet); border: 1px solid rgba(124,58,237,0.2); }
.card-amber  .card-badge, .card-badge-amber  { background: var(--amber-light);  color: var(--amber);  border: 1px solid rgba(217,119,6,0.2); }
.card-green  .card-badge, .card-badge-green  { background: var(--green-light);  color: var(--green);  border: 1px solid rgba(5,150,105,0.2); }

/* ============================================================
   DECISION SECTION
   ============================================================ */
.decision-panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--r-xl);
    box-shadow: var(--shadow-sm);
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    divide-x: 1px solid var(--border);
    overflow: hidden;
}

.decision-item {
    padding: 20px 22px;
    display: flex; align-items: center; gap: 14px;
    border-right: 1px solid var(--border);
    transition: background var(--t-fast);
}
.decision-item:last-child { border-right: none; }
.decision-item:hover { background: #f8fafc; }

.dec-icon {
    width: 40px; height: 40px;
    border-radius: 10px;
    display: grid; place-items: center;
    font-size: 16px; flex-shrink: 0;
}
.dec-blue   { background: var(--cyan-light);   color: var(--cyan); }
.dec-green  { background: var(--green-light);  color: var(--green); }
.dec-violet { background: var(--violet-light); color: var(--violet); }
.dec-amber  { background: var(--amber-light);  color: var(--amber); }

.dec-content { flex: 1; min-width: 0; }
.dec-label {
    display: block; font-size: 10px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.6px;
    color: var(--text-muted); margin-bottom: 4px;
}
.dec-value {
    display: block; font-size: 22px; font-weight: 700;
    color: var(--text-primary); letter-spacing: -0.5px;
}
.dec-value.bajo  { color: var(--green); }
.dec-value.medio { color: var(--amber); }
.dec-value.alto  { color: var(--red); }
.dec-value.recommendation {
    font-size: 12px; font-weight: 500;
    letter-spacing: 0; color: var(--cyan); line-height: 1.4;
}

/* ============================================================
   NODES
   ============================================================ */
.nodes-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
}

.node-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: 16px 20px;
    display: flex; align-items: center; gap: 14px;
    box-shadow: var(--shadow-sm);
    transition: all var(--t-mid);
}
.node-card:hover {
    box-shadow: var(--shadow-md);
    border-color: rgba(8,145,178,0.3);
    transform: translateY(-1px);
}
.node-icon {
    width: 38px; height: 38px;
    border-radius: 9px;
    background: var(--cyan-light);
    border: 1px solid rgba(8,145,178,0.2);
    display: grid; place-items: center;
    color: var(--cyan); font-size: 15px;
    flex-shrink: 0;
}
.node-info { flex: 1; min-width: 0; }
.node-name { font-size: 12px; font-weight: 600; color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.node-phase { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.node-status {
    font-size: 10px; font-weight: 700;
    padding: 3px 9px; border-radius: 50px;
    background: var(--green-light);
    border: 1px solid rgba(5,150,105,0.25);
    color: var(--green); white-space: nowrap;
}

.node-skeleton {
    height: 70px;
    background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--r-lg);
    border: 1px solid var(--border);
}
@keyframes shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ============================================================
   CHARTS
   ============================================================ */
.charts-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
.charts-full { grid-template-columns: 1fr; }

.chart-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--r-xl);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: box-shadow var(--t-mid);
}
.chart-card:hover { box-shadow: var(--shadow-md); }
.chart-full { width: 100%; }

.chart-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px 12px;
    border-bottom: 1px solid var(--border);
    gap: 10px;
}
.chart-header h3 {
    display: flex; align-items: center; gap: 8px;
    font-size: 13px; font-weight: 700; color: var(--text-primary);
}
.chart-header h3 i { color: var(--cyan); font-size: 13px; }
.chart-header-right { display: flex; align-items: center; gap: 8px; }

.chart-tag {
    font-size: 10px; font-weight: 600;
    padding: 2px 8px; border-radius: 50px;
    background: #f1f5f9; border: 1px solid var(--border);
    color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px;
}
.ml-badge {
    font-size: 10px; font-weight: 700;
    padding: 2px 9px; border-radius: 50px;
    background: var(--green-light);
    border: 1px solid rgba(5,150,105,0.25);
    color: var(--green); font-family: var(--font-mono);
}

.chart-body {
    padding: 16px;
    height: 270px;
    position: relative;
}
.chart-body-tall { height: 320px; }

.chart-legend {
    display: flex; justify-content: center; gap: 24px;
    padding: 0 16px 14px;
    font-size: 12px; color: var(--text-secondary);
}
.legend-dot {
    display: inline-block; width: 8px; height: 8px;
    border-radius: 50%; margin-right: 5px;
}
.dot-cyan   { background: var(--cyan); }
.dot-amber  { background: var(--amber); }
.dot-green  { background: var(--green); }

/* ============================================================
   TABLES
   ============================================================ */
.table-wrapper {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--r-xl);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }

.data-table thead tr {
    background: #f8fafc;
    border-bottom: 2px solid var(--border);
}
.data-table th {
    padding: 11px 16px;
    text-align: left;
    font-size: 10px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.7px;
    color: var(--text-muted); white-space: nowrap;
}

.data-table tbody tr {
    border-bottom: 1px solid #f1f5f9;
    transition: background var(--t-fast);
}
.data-table tbody tr:last-child { border-bottom: none; }
.data-table tbody tr:nth-child(even) { background: #fafbfc; }
.data-table tbody tr:hover { background: #f0f9ff; }
.data-table tbody tr.clickable { cursor: pointer; }
.data-table tbody tr.clickable:hover { background: #e0f2fe; }

.data-table td {
    padding: 12px 16px;
    color: var(--text-secondary);
    vertical-align: middle;
}
.data-table td strong {
    font-weight: 700; color: var(--text-primary);
    font-family: var(--font-mono); font-size: 12px;
}

.table-loading {
    text-align: center; padding: 32px !important;
    color: var(--text-muted); font-size: 13px;
}
.table-loading i { margin-right: 8px; color: var(--cyan); }

/* Status badges */
.status-badge-small {
    display: inline-block;
    padding: 3px 9px; border-radius: 50px;
    font-size: 10px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.4px;
}
.status-badge-small.hibrido   { background: var(--cyan-light);   border: 1px solid rgba(8,145,178,0.25);  color: var(--cyan); }
.status-badge-small.clasico   { background: var(--red-light);    border: 1px solid rgba(220,38,38,0.25);  color: var(--red); }
.status-badge-small.completado { background: var(--green-light); border: 1px solid rgba(5,150,105,0.25); color: var(--green); }

.status-badge-large {
    display: inline-flex; align-items: center;
    padding: 5px 14px; border-radius: 50px;
    font-size: 11px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.5px;
}
.status-badge-large.hibrido   { background: var(--cyan-light);   border: 1px solid rgba(8,145,178,0.25);  color: var(--cyan); }
.status-badge-large.clasico   { background: var(--red-light);    border: 1px solid rgba(220,38,38,0.25);  color: var(--red); }
.status-badge-large.completado { background: var(--green-light); border: 1px solid rgba(5,150,105,0.25); color: var(--green); }

/* ============================================================
   SIMULATOR
   ============================================================ */
.simulator-panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--r-xl);
    box-shadow: var(--shadow-sm);
    padding: 24px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 28px;
    align-items: start;
}

.sim-form {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    align-items: end;
}

.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label {
    font-size: 11px; font-weight: 700; color: var(--text-secondary);
    text-transform: uppercase; letter-spacing: 0.5px;
}
.form-group select,
.form-group input {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 13px;
    padding: 9px 12px;
    outline: none;
    transition: all var(--t-fast);
    width: 100%;
}
.form-group select:focus,
.form-group input:focus {
    border-color: var(--cyan);
    background: var(--bg-card);
    box-shadow: 0 0 0 3px rgba(8,145,178,0.12);
}

.btn-predict {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    padding: 11px 20px;
    background: linear-gradient(135deg, #0891b2, #0e7490);
    border: none; border-radius: var(--r-sm);
    color: #fff; font-family: var(--font);
    font-size: 13px; font-weight: 700;
    cursor: pointer; transition: all var(--t-mid);
    width: 100%; grid-column: span 2;
    box-shadow: 0 2px 8px rgba(8,145,178,0.3);
}
.btn-predict:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(8,145,178,0.4);
}
.btn-predict:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.prediction-result {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    overflow: hidden;
    animation: fade-in 0.3s ease;
}
.prediction-result.hidden { display: none; }
@keyframes fade-in {
    from { opacity:0; transform:translateY(6px); }
    to   { opacity:1; transform:translateY(0); }
}

.pred-header {
    display: flex; align-items: center; gap: 8px;
    padding: 12px 16px;
    background: var(--cyan-light);
    border-bottom: 1px solid rgba(8,145,178,0.2);
    font-size: 12px; font-weight: 700; color: var(--cyan);
}
.pred-grid {
    display: grid; grid-template-columns: 1fr 1fr;
    gap: 1px; background: var(--border);
}
.pred-item {
    display: flex; flex-direction: column; gap: 4px;
    padding: 14px 16px; background: var(--bg-card);
}
.pred-label {
    font-size: 10px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.5px;
    color: var(--text-muted);
}
.pred-value {
    font-size: 20px; font-weight: 800;
    color: var(--text-primary); letter-spacing: -0.5px;
}

/* ============================================================
   MODAL
   ============================================================ */
.modal {
    display: none;
    position: fixed; inset: 0; z-index: 1000;
    align-items: center; justify-content: center;
}
.modal[style*="block"] { display: flex !important; }

.modal-backdrop {
    position: absolute; inset: 0;
    background: rgba(15,39,68,0.5);
    backdrop-filter: blur(6px);
}

.modal-content {
    position: relative; z-index: 1;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--r-xl);
    width: min(95vw, 820px);
    max-height: 88vh;
    display: flex; flex-direction: column;
    animation: modal-in 0.2s ease;
    box-shadow: var(--shadow-xl);
}
@keyframes modal-in {
    from { opacity:0; transform:scale(0.96) translateY(16px); }
    to   { opacity:1; transform:scale(1) translateY(0); }
}

.modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 18px 22px;
    border-bottom: 1px solid var(--border);
    background: #f8fafc;
    flex-shrink: 0;
}
.modal-title { display: flex; align-items: center; gap: 10px; }
.modal-title i { color: var(--cyan); font-size: 17px; }
.modal-title h2 { font-size: 15px; font-weight: 700; color: var(--text-primary); }

.modal-close-btn {
    width: 30px; height: 30px; border-radius: 7px;
    background: #f1f5f9; border: 1px solid var(--border);
    color: var(--text-secondary); cursor: pointer;
    display: grid; place-items: center; font-size: 13px;
    transition: all var(--t-fast);
}
.modal-close-btn:hover { background: var(--red-light); border-color: rgba(220,38,38,0.3); color: var(--red); }

.modal-body { padding: 22px; overflow-y: auto; flex: 1; }

.modal-loading {
    text-align: center; padding: 48px;
    color: var(--text-muted); font-size: 14px;
    display: flex; align-items: center; justify-content: center; gap: 10px;
}
.modal-loading i { color: var(--cyan); font-size: 20px; }

.modal-status-row {
    display: flex; align-items: center; gap: 12px;
    margin-bottom: 18px; padding: 12px 14px;
    background: #f0f9ff;
    border: 1px solid rgba(8,145,178,0.15);
    border-radius: var(--r-md);
}

.detail-grid {
    display: grid; grid-template-columns: repeat(3, 1fr);
    gap: 1px; background: var(--border);
    border-radius: var(--r-md); overflow: hidden;
    margin-bottom: 18px;
    border: 1px solid var(--border);
}
.detail-item {
    background: var(--bg-card); padding: 12px 14px;
    display: flex; flex-direction: column; gap: 3px;
}
.detail-item.full-width { grid-column: span 3; }
.detail-item .label {
    font-size: 10px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.6px;
    color: var(--text-muted);
}
.detail-item .value {
    font-size: 13px; font-weight: 500;
    color: var(--text-primary); word-break: break-all;
}

.signatures-section { border-top: 1px solid var(--border); padding-top: 18px; }
.signatures-section h3 {
    display: flex; align-items: center; gap: 8px;
    font-size: 13px; font-weight: 700; color: var(--text-primary);
    margin-bottom: 12px;
}
.signatures-section h3 i { color: var(--violet); }

.signature-cards { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }

.signature-card {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: var(--r-md); padding: 14px;
    transition: border-color var(--t-fast);
}
.signature-card:hover { border-color: rgba(8,145,178,0.3); }

.sig-algorithm {
    display: flex; align-items: center; gap: 8px;
    font-size: 13px; font-weight: 700; color: var(--text-primary);
    margin-bottom: 10px;
}
.badge {
    font-size: 10px; font-weight: 700;
    padding: 2px 8px; border-radius: 50px;
    text-transform: uppercase; letter-spacing: 0.3px;
}
.badge.ml-dsa, .badge.verificado {
    background: var(--green-light);
    border: 1px solid rgba(5,150,105,0.3);
    color: var(--green);
}
.badge.ecdsa {
    background: #f1f5f9; border: 1px solid var(--border);
    color: var(--text-muted);
}

.sig-details {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px;
}
.sig-details span { display: flex; flex-direction: column; gap: 3px; }
.sig-label { font-size: 10px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.4px; }
.sig-value { font-size: 13px; font-weight: 600; color: var(--text-primary); font-family: var(--font-mono); }

.expand-wrap { margin-top: 10px; border-top: 1px dashed var(--border); padding-top: 10px; }
.expand-label { font-size: 10px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.6px; margin-bottom: 5px; display: block; }
.expand-text {
    font-family: var(--font-mono); font-size: 11px;
    background: #f1f5f9; padding: 10px 12px;
    border-radius: 6px; word-break: break-all;
    color: var(--text-secondary);
    border: 1px solid var(--border);
    max-height: 80px; overflow: hidden;
    line-height: 1.5;
}
.expand-text.expanded { max-height: none; }
.expand-btn {
    margin-top: 5px; font-size: 11px; font-weight: 600;
    color: var(--cyan); background: none; border: none;
    cursor: pointer; display: inline-flex; align-items: center; gap: 4px;
    padding: 0;
}
.expand-btn:hover { color: var(--text-primary); }

.fabric-data-section { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }
.fabric-data-section h3 {
    font-size: 12px; font-weight: 700; color: var(--text-secondary);
    margin-bottom: 8px; display: flex; align-items: center; gap: 7px;
}
.json-block {
    background: #f8fafc; border: 1px solid var(--border);
    border-radius: 8px; padding: 12px 14px;
    font-family: var(--font-mono); font-size: 11px;
    color: var(--text-secondary);
    max-height: 180px; overflow-y: auto;
    white-space: pre-wrap; word-break: break-all;
    line-height: 1.6;
}

/* ============================================================
   FOOTER
   ============================================================ */
.app-footer {
    background: #1e3a5f;
    padding: 28px;
    margin-top: 16px;
}
.footer-inner {
    max-width: 1600px; margin: 0 auto;
    text-align: center;
    display: flex; flex-direction: column;
    align-items: center; gap: 8px;
}
.footer-brand {
    display: flex; align-items: center; gap: 8px;
    font-size: 14px; font-weight: 700; color: #fff;
}
.footer-brand i { color: #22d3ee; }
.app-footer p { font-size: 12px; color: rgba(255,255,255,0.5); }
.footer-tech {
    display: flex; align-items: center; gap: 16px;
    flex-wrap: wrap; justify-content: center; margin-top: 4px;
}
.footer-tech span { font-size: 11px; color: rgba(255,255,255,0.4); display: flex; align-items: center; gap: 5px; }
.footer-tech i { color: #22d3ee; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1200px) {
    .cards-grid     { grid-template-columns: repeat(2, 1fr); }
    .decision-panel { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 900px) {
    .charts-section  { grid-template-columns: 1fr; }
    .simulator-panel { grid-template-columns: 1fr; }
    .detail-grid     { grid-template-columns: 1fr 1fr; }
    .detail-item.full-width { grid-column: span 2; }
    .sig-details { grid-template-columns: 1fr 1fr; }
    .decision-panel { grid-template-columns: 1fr 1fr; }
    .nodes-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
    .app-main { padding: 16px 14px 48px; }
    .header-inner { padding: 0 14px; }
    .cards-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
    .brand-text p { display: none; }
    .last-update-pill { display: none; }
    .sim-form { grid-template-columns: 1fr; }
    .btn-predict { grid-column: span 1; }
    .pred-grid { grid-template-columns: 1fr; }
    .detail-grid { grid-template-columns: 1fr; }
    .detail-item.full-width { grid-column: span 1; }
    .decision-panel { grid-template-columns: 1fr; }
    .nodes-grid { grid-template-columns: 1fr; }
    .decision-item { border-right: none; border-bottom: 1px solid var(--border); }
}



/* ============================================================
   SECCIÓN DE SEGURIDAD
   ============================================================ */

.security-section {
    margin-top: 12px;
}

.security-matrix {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--r-xl);
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-sm);
}

.matrix-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.matrix-card {
    padding: 16px;
    border-radius: var(--r-md);
    border: 1px solid var(--border);
    background: #f8fafc;
    transition: all var(--t-mid);
}

.matrix-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.matrix-card .matrix-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.matrix-card .matrix-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 50px;
    font-size: 10px;
    font-weight: 700;
    margin-bottom: 8px;
}

.matrix-card .matrix-detail {
    font-size: 12px;
    color: var(--text-secondary);
    padding: 3px 0;
    display: flex;
    justify-content: space-between;
    border-bottom: 1px dashed var(--border);
}

.matrix-card .matrix-detail:last-child {
    border-bottom: none;
}

.matrix-card .matrix-detail .label {
    color: var(--text-muted);
}

.matrix-card .matrix-detail .value {
    font-weight: 600;
    color: var(--text-primary);
}

.matrix-card.secure .matrix-badge { background: var(--green-light); color: var(--green); }
.matrix-card.hybrid .matrix-badge { background: var(--amber-light); color: var(--amber); }
.matrix-card.risk .matrix-badge { background: var(--red-light); color: var(--red); }

.hash-analyzer {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--r-xl);
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-sm);
}

.hash-analyzer h3 {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.hash-analyzer h3 i {
    color: var(--cyan);
}

.hash-form {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.hash-form .form-group {
    flex: 1;
}

.hash-form .form-group input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    font-family: var(--font-mono);
    font-size: 12px;
    background: #f8fafc;
    transition: all var(--t-fast);
}

.hash-form .form-group input:focus {
    border-color: var(--cyan);
    background: var(--bg-card);
    box-shadow: 0 0 0 3px rgba(8,145,178,0.12);
}

.hash-form .form-group select {
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    background: #f8fafc;
    font-size: 13px;
    min-width: 140px;
}

.btn-analyze {
    padding: 10px 24px;
    background: linear-gradient(135deg, #7c3aed, #6d28d9);
    border: none;
    border-radius: var(--r-sm);
    color: #fff;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all var(--t-mid);
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(124,58,237,0.3);
}

.btn-analyze:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(124,58,237,0.4);
}

.hash-result {
    margin-top: 16px;
    padding: 16px;
    background: #f8fafc;
    border-radius: var(--r-md);
    border: 1px solid var(--border);
    animation: fade-in 0.3s ease;
}

.hash-result .result-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.hash-result .result-item {
    text-align: center;
}

.hash-result .result-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    display: block;
}

.hash-result .result-value {
    font-size: 18px;
    font-weight: 800;
    color: var(--text-primary);
    display: block;
    margin-top: 4px;
}

.security-stats {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--r-xl);
    padding: 20px;
    box-shadow: var(--shadow-sm);
}

.security-stats h3 {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.security-stats h3 i {
    color: var(--violet);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.stat-card {
    background: #f8fafc;
    padding: 14px 16px;
    border-radius: var(--r-md);
    text-align: center;
    border: 1px solid var(--border);
}

.stat-card .stat-number {
    font-size: 28px;
    font-weight: 800;
    color: var(--violet);
}

.stat-card .stat-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    display: block;
    margin-top: 4px;
}

.stat-skeleton {
    height: 70px;
    background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--r-md);
    border: 1px solid var(--border);
}

.matrix-loading {
    text-align: center;
    padding: 20px;
    color: var(--text-muted);
    font-size: 13px;
}

.matrix-loading i {
    color: var(--cyan);
    margin-right: 8px;
}

/* ============================================================
   RESPONSIVE - SECCIÓN SEGURIDAD
   ============================================================ */

@media (max-width: 1024px) {
    .matrix-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 768px) {
    .matrix-grid {
        grid-template-columns: 1fr;
    }
    
    .hash-form {
        flex-direction: column;
        align-items: stretch;
    }
    
    .hash-result .result-grid {
        grid-template-columns: 1fr 1fr;
    }
    
    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 480px) {
    .hash-result .result-grid {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
}


/* ============================================================
   GESTIÓN DE FIRMAS PQC
   ============================================================ */

.migration-section {
    margin-top: 12px;
}

.migration-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}

.btn-sign-all {
    padding: 8px 20px;
    background: linear-gradient(135deg, #059669, #047857);
    border: none;
    border-radius: var(--r-sm);
    color: #fff;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all var(--t-mid);
    box-shadow: 0 2px 8px rgba(5,150,105,0.3);
}

.btn-sign-all:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(5,150,105,0.4);
}

.btn-sign-all:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-sign-single {
    padding: 4px 14px;
    background: linear-gradient(135deg, #0891b2, #0e7490);
    border: none;
    border-radius: var(--r-sm);
    color: #fff;
    font-weight: 600;
    font-size: 11px;
    cursor: pointer;
    transition: all var(--t-fast);
    white-space: nowrap;
}

.btn-sign-single:hover {
    opacity: 0.85;
}

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

.migration-progress {
    margin-top: 12px;
    padding: 12px 16px;
    background: #f8fafc;
    border-radius: var(--r-md);
    border: 1px solid var(--border);
    display: none;
}

.migration-progress.active {
    display: block;
    animation: fade-in 0.3s ease;
}

.migration-progress .progress-bar {
    height: 6px;
    background: #e2e8f0;
    border-radius: 3px;
    overflow: hidden;
    margin-top: 8px;
}

.migration-progress .progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #0891b2, #059669);
    border-radius: 3px;
    transition: width 0.5s ease;
    width: 0%;
}

.migration-progress .progress-text {
    font-size: 12px;
    color: var(--text-secondary);
    display: flex;
    justify-content: space-between;
}

@media (max-width: 768px) {
    .migration-stats {
        grid-template-columns: 1fr 1fr;
    }
}

/* ============================================================
   PANEL DESPLEGABLE - GESTIÓN DE FIRMAS PQC
   ============================================================ */

.collapsible-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    padding: 4px 0;
    transition: background var(--t-fast);
    border-radius: var(--r-sm);
    user-select: none;
}

.collapsible-header:hover {
    background: #f8fafc;
}

.collapsible-header .section-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.collapse-icon {
    font-size: 14px;
    color: var(--text-muted);
    transition: transform 0.3s ease;
    margin-left: 8px;
}

.collapse-icon.open {
    transform: rotate(180deg);
}

.collapsible-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease, padding 0.3s ease;
    padding: 0 4px;
}

.collapsible-content.open {
    max-height: 2000px;
    padding: 12px 4px 4px 4px;
}

.migration-section .section-header {
    margin-bottom: 0;
}

.migration-section .btn-sign-all {
    flex-shrink: 0;
}

/* ============================================================
   RESPONSIVE - PANEL DESPLEGABLE
   ============================================================ */

@media (max-width: 768px) {
    .collapsible-header {
        flex-wrap: wrap;
        gap: 8px;
    }
    .collapsible-header .section-title {
        flex: 1;
        min-width: 0;
    }
    .migration-section .btn-sign-all {
        width: 100%;
        justify-content: center;
    }
}
