/* ============================================================
   Desglose del cálculo de la puntuación (modal).
   Un solo color de acento (el naranja del sitio) sobre grises:
   el color se reserva para lo que hay que mirar, no decora.
   ============================================================ */

.cbk-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(0,0,0,0.78);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1.4rem 1rem;
    backdrop-filter: blur(3px);
}
.cbk-overlay.open { display: flex; }
html.light-theme .cbk-overlay,
body.light-theme .cbk-overlay { background: rgba(0,0,0,0.5); }

.cbk-window {
    background: #171717;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 4px;
    width: 100%;
    max-width: 860px;
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 18px 48px rgba(0,0,0,0.55);
    animation: cbkIn 0.16s ease-out both;
}
html.light-theme .cbk-window,
body.light-theme .cbk-window {
    background: #fff;
    border-color: rgba(0,0,0,0.14);
    box-shadow: 0 18px 48px rgba(0,0,0,0.16);
}
@keyframes cbkIn {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: none; }
}

/* ── Cabecera ── */
.cbk-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.95rem 1.2rem;
    border-bottom: 1px solid rgba(255,255,255,0.09);
    flex-shrink: 0;
}
html.light-theme .cbk-head,
body.light-theme .cbk-head { border-bottom-color: rgba(0,0,0,0.1); }
.cbk-head h2 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.3px;
    color: #fff;
}
html.light-theme .cbk-head h2,
body.light-theme .cbk-head h2 { color: #111; }
.cbk-sub {
    margin: 0.15rem 0 0;
    font-size: 0.73rem;
    color: rgba(255,255,255,0.4);
}
html.light-theme .cbk-sub,
body.light-theme .cbk-sub { color: rgba(0,0,0,0.48); }

.cbk-close {
    background: none;
    border: 1px solid transparent;
    border-radius: 3px;
    color: rgba(255,255,255,0.45);
    font-size: 1rem;
    cursor: pointer;
    padding: 4px 9px;
    flex-shrink: 0;
    transition: color 0.15s, background 0.15s, border-color 0.15s;
}
.cbk-close:hover { color: #fff; background: rgba(255,255,255,0.07); border-color: rgba(255,255,255,0.12); }
html.light-theme .cbk-close,
body.light-theme .cbk-close { color: rgba(0,0,0,0.45); }
html.light-theme .cbk-close:hover,
body.light-theme .cbk-close:hover { color: #111; background: rgba(0,0,0,0.05); }

/* ── Pestañas por modelo ── */
.cbk-tabs {
    display: flex;
    gap: 0;
    overflow-x: auto;
    border-bottom: 1px solid rgba(255,255,255,0.09);
    flex-shrink: 0;
}
html.light-theme .cbk-tabs,
body.light-theme .cbk-tabs { border-bottom-color: rgba(0,0,0,0.1); }
.cbk-tab {
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    padding: 0.6rem 1rem;
    font-family: inherit;
    font-size: 0.76rem;
    font-weight: 600;
    color: rgba(255,255,255,0.45);
    cursor: pointer;
    white-space: nowrap;
    transition: color 0.15s, border-color 0.15s;
}
.cbk-tab:hover { color: rgba(255,255,255,0.85); }
.cbk-tab.active { color: var(--primary-color); border-bottom-color: var(--primary-color); }
html.light-theme .cbk-tab,
body.light-theme .cbk-tab { color: rgba(0,0,0,0.45); }
html.light-theme .cbk-tab:hover,
body.light-theme .cbk-tab:hover { color: #111; }
html.light-theme .cbk-tab.active,
body.light-theme .cbk-tab.active { color: var(--primary-color); }

/* ── Cuerpo ── */
.cbk-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 1.1rem 1.2rem 1.4rem;
}
.cbk-body::-webkit-scrollbar { width: 8px; }
.cbk-body::-webkit-scrollbar-track { background: transparent; }
.cbk-body::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.16); }
html.light-theme .cbk-body::-webkit-scrollbar-thumb,
body.light-theme .cbk-body::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.18); }

.cbk-panel { display: none; }
.cbk-panel.active { display: block; }

/* ── Nota global ── */
.cbk-total {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.2rem;
    padding: 0.9rem 1.1rem;
    border: 1px solid rgba(255,255,255,0.1);
    border-left: 3px solid var(--primary-color);
    border-radius: 3px;
    background: rgba(255,255,255,0.02);
}
html.light-theme .cbk-total,
body.light-theme .cbk-total { border-color: rgba(0,0,0,0.12); border-left-color: var(--primary-color); background: rgba(0,0,0,0.015); }
.cbk-total-label {
    display: block;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: rgba(255,255,255,0.4);
}
html.light-theme .cbk-total-label,
body.light-theme .cbk-total-label { color: rgba(0,0,0,0.45); }
.cbk-total-help {
    margin: 0.3rem 0 0;
    font-size: 0.74rem;
    line-height: 1.5;
    color: rgba(255,255,255,0.55);
    max-width: 46ch;
}
html.light-theme .cbk-total-help,
body.light-theme .cbk-total-help { color: rgba(0,0,0,0.55); }
.cbk-total-score {
    font-size: 2rem;
    font-weight: 800;
    color: var(--primary-color);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.cbk-total-score small {
    font-size: 0.8rem;
    font-weight: 600;
    color: rgba(255,255,255,0.3);
    margin-left: 2px;
}
html.light-theme .cbk-total-score small,
body.light-theme .cbk-total-score small { color: rgba(0,0,0,0.35); }

/* ── Tabla de categorías ── */
.cbk-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}
.cbk-table thead th {
    padding: 0.45rem 0.6rem;
    font-size: 0.63rem;
    font-weight: 700;
    letter-spacing: 0.9px;
    text-transform: uppercase;
    color: rgba(255,255,255,0.32);
    text-align: left;
    border-bottom: 1px solid rgba(255,255,255,0.09);
}
.cbk-table thead .cbk-th-num { text-align: right; }
html.light-theme .cbk-table thead th,
body.light-theme .cbk-table thead th { color: rgba(0,0,0,0.4); border-bottom-color: rgba(0,0,0,0.1); }

.cbk-row {
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
html.light-theme .cbk-row,
body.light-theme .cbk-row { border-bottom-color: rgba(0,0,0,0.06); }
.cbk-row td { padding: 0.55rem 0.6rem; vertical-align: middle; }

/* Ojo: el td se queda como celda de tabla. Poniéndole display:flex se sale
   del modelo de tabla y los bordes del pie dejan de abarcar toda la fila. */
.cbk-cat {
    font-weight: 600;
    color: rgba(255,255,255,0.82);
}
html.light-theme .cbk-cat,
body.light-theme .cbk-cat { color: rgba(0,0,0,0.82); }

.cbk-num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cbk-score { font-weight: 700; color: rgba(255,255,255,0.9); }
html.light-theme .cbk-score,
body.light-theme .cbk-score { color: rgba(0,0,0,0.85); }

/* Una sola barra, un solo color: la longitud es el dato, no el tono */
.cbk-bar {
    display: inline-block;
    vertical-align: middle;
    width: 64px;
    height: 4px;
    margin-left: 0.5rem;
    background: rgba(255,255,255,0.09);
    overflow: hidden;
}
html.light-theme .cbk-bar,
body.light-theme .cbk-bar { background: rgba(0,0,0,0.09); }
.cbk-bar i { display: block; height: 100%; background: rgba(255,107,53,0.7); }

.cbk-contrib { font-weight: 700; color: rgba(255,255,255,0.75); }
html.light-theme .cbk-contrib,
body.light-theme .cbk-contrib { color: rgba(0,0,0,0.72); }

.cbk-table tfoot td {
    padding: 0.6rem;
    border-top: 2px solid rgba(255,255,255,0.12);
    font-weight: 700;
    font-size: 0.78rem;
    color: rgba(255,255,255,0.6);
}
html.light-theme .cbk-table tfoot td,
body.light-theme .cbk-table tfoot td { border-top-color: rgba(0,0,0,0.16); color: rgba(0,0,0,0.6); }
.cbk-grand { color: var(--primary-color); font-size: 0.95rem; }

.cbk-note {
    margin: 0.8rem 0 0;
    font-size: 0.7rem;
    line-height: 1.55;
    color: rgba(255,255,255,0.3);
}
html.light-theme .cbk-note,
body.light-theme .cbk-note { color: rgba(0,0,0,0.4); }

@media (max-width: 700px) {
    .cbk-overlay { padding: 0.5rem; }
    .cbk-window { max-height: 95vh; }
    .cbk-total { flex-direction: column; align-items: flex-start; gap: 0.6rem; }
    .cbk-bar { display: none; }
}
