:root {
    --bg: #f5f7fb;
    --card: #ffffff;
    --ink: #0f172a;
    --muted: #64748b;
    --line: #e2e8f0;
    /* --brand y --accent se sobreescriben inline desde brand_config() en index.php */
    --brand: #1e40af;
    --brand-ink: #ffffff;
    --accent: #06b6d4;
    --danger: #dc2626;
    --warn: #f59e0b;
    --shadow: 0 6px 24px rgba(15, 23, 42, .06);
    --radius: 14px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--ink); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif; line-height: 1.45; }

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 28px;
    background: #fff;
    border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 14px; }
.brand-mark {
    width: 42px; height: 42px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--brand), var(--accent));
    color: #fff;
    display: grid; place-items: center;
    font-weight: 700; font-size: 22px;
}
.brand h1 { font-size: 18px; margin: 0; }
.brand p { margin: 0; color: var(--muted); font-size: 13px; }
.badge {
    background: #eef2ff; color: var(--brand);
    padding: 4px 10px; border-radius: 999px;
    font-size: 12px; font-weight: 600;
}

/* ===== Co-branding (Mentora + Tecnovo) ===== */
.topbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}
.cobrand {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    padding: 6px 10px;
    border-radius: 10px;
    transition: background .2s;
    color: var(--ink);
}
.cobrand:hover { background: #f1f5f9; }
.cobrand-label {
    font-size: 11px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .04em;
    font-weight: 600;
}
.brand-logo {
    display: block;
    height: 24px;
    width: auto;
}
.cobrand-logo { height: 22px; }
.powered-logo { height: 18px; }
.footer-logo { height: 28px; }

@media (max-width: 640px) {
    .cobrand-label { display: none; }
}

/* Sello "Powered by" en la card de resultados */
.powered-by {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 18px;
    padding: 6px 12px;
    background: #f8fafc;
    border: 1px solid var(--line);
    border-radius: 999px;
    text-decoration: none;
    color: var(--muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .04em;
    font-weight: 600;
    transition: border-color .2s, color .2s;
}
.powered-by:hover {
    border-color: var(--brand);
    color: var(--ink);
}

.layout {
    max-width: 980px;
    margin: 24px auto;
    padding: 0 20px;
    display: grid;
    gap: 18px;
}

.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 22px 24px;
}
.card.secondary { background: #fbfdff; }
.card h2 { font-size: 16px; margin: 0 0 14px; color: var(--ink); }
.card h3 { font-size: 14px; margin: 18px 0 8px; }

.field { display: block; margin-bottom: 12px; }
.field span {
    display: block;
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 6px;
    font-weight: 500;
}
input[type=number], select, textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    font-size: 14px;
    font-family: inherit;
    color: var(--ink);
    transition: border-color .2s, box-shadow .2s;
}
textarea { resize: vertical; min-height: 60px; }
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}
.row { display: grid; grid-template-columns: 2fr 1fr; gap: 14px; }
@media (max-width: 640px) { .row { grid-template-columns: 1fr; } }

button {
    cursor: pointer;
    border: none;
    border-radius: 10px;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 600;
    transition: transform .05s, opacity .2s, background .2s;
}
button:disabled { opacity: .45; cursor: not-allowed; }
button:not(:disabled):active { transform: translateY(1px); }
button.primary { background: var(--brand); color: var(--brand-ink); }
button.primary:hover:not(:disabled) { background: #1d4ed8; }
button.ghost { background: #f1f5f9; color: var(--ink); }
button.big { padding: 12px 22px; font-size: 15px; }

.recorder-controls { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.recorder-status {
    display: flex; align-items: center; gap: 14px;
    margin-bottom: 14px;
}
.meter {
    flex: 1;
    height: 8px;
    background: #eef2f7;
    border-radius: 999px;
    overflow: hidden;
}
#meter-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--accent), var(--brand));
    transition: width .1s;
}
.timer { font-variant-numeric: tabular-nums; font-size: 14px; color: var(--muted); }
.timer #timer { color: var(--ink); font-weight: 600; }

#audio-playback { width: 100%; margin: 8px 0 14px; }

.transcript label {
    font-size: 13px; color: var(--muted); display: block; margin-bottom: 6px;
}
.transcript-box {
    min-height: 80px;
    border: 1px dashed var(--line);
    border-radius: 10px;
    padding: 10px 12px;
    background: #fbfbfd;
    font-size: 14px;
    white-space: pre-wrap;
}
.transcript-box:empty::before {
    content: attr(data-placeholder);
    color: #94a3b8;
}

.provider-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 14px;
    align-items: end;
}
@media (max-width: 640px) { .provider-row { grid-template-columns: 1fr; } }
.provider-field { margin-bottom: 0; }

.loading { display: flex; align-items: center; gap: 10px; margin-top: 14px; color: var(--muted); }
.spinner {
    width: 16px; height: 16px;
    border: 2px solid #cbd5e1;
    border-top-color: var(--brand);
    border-radius: 50%;
    animation: spin .9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.error {
    margin-top: 14px;
    padding: 10px 14px;
    background: #fee2e2;
    color: #991b1b;
    border-radius: 10px;
    font-size: 13px;
    border: 1px solid #fecaca;
}

.score-summary {
    display: grid;
    grid-template-columns: auto 1fr 1fr;
    gap: 18px;
    align-items: center;
    margin: 14px 0 8px;
    padding: 18px;
    background: linear-gradient(135deg, #eff6ff, #f5f3ff);
    border-radius: 12px;
    border: 1px solid #e0e7ff;
}
@media (max-width: 720px) { .score-summary { grid-template-columns: 1fr; } }
.score-big { font-size: 44px; font-weight: 700; color: var(--brand); line-height: 1; }
.score-big small { font-size: 18px; color: var(--muted); margin-left: 4px; font-weight: 500; }
.score-level .lbl { display: block; font-size: 12px; color: var(--muted); }
.score-level strong { font-size: 18px; color: var(--ink); }
.score-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; font-size: 13px; }
.score-meta .lbl { color: var(--muted); margin-right: 6px; }

table { width: 100%; border-collapse: collapse; font-size: 14px; margin-top: 8px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.criteria-table td:nth-child(2), .criteria-table th:nth-child(2),
.criteria-table td:nth-child(3), .criteria-table th:nth-child(3) { white-space: nowrap; width: 1%; }
.rubric-table .total { font-weight: 600; }
.rubric-table .total td { border-top: 2px solid var(--ink); }

.pill {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    background: #e2e8f0;
    color: var(--ink);
}
.pill.excelente, .pill.logro-esperado { background: #dcfce7; color: #166534; }
.pill.bueno { background: #e0f2fe; color: #075985; }
.pill.en-proceso { background: #fef3c7; color: #92400e; }
.pill.inicial, .pill.en-inicio { background: #fee2e2; color: #991b1b; }

.feedback-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    margin-top: 18px;
}
@media (max-width: 720px) { .feedback-grid { grid-template-columns: 1fr; } }
.feedback-block {
    background: #fbfdff;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 14px;
}
.feedback-block ul { margin: 0; padding-left: 18px; font-size: 13.5px; }
.feedback-block li { margin-bottom: 6px; }

.feedback-general {
    margin-top: 16px;
    padding: 14px 16px;
    background: #f0fdfa;
    border-left: 4px solid var(--accent);
    border-radius: 10px;
}
.feedback-general p { margin: 0; font-size: 14px; }

.small { color: var(--muted); font-size: 12px; }

.footer {
    border-top: 1px solid var(--line);
    background: #fff;
    margin-top: 30px;
    padding: 20px;
    color: var(--muted);
}
.footer-inner {
    max-width: 980px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
}
.footer-product small { font-size: 12px; }
.footer-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--ink);
    padding: 8px 12px;
    border-radius: 10px;
    transition: background .2s;
}
.footer-brand:hover { background: #f1f5f9; }
.footer-brand-text { display: flex; flex-direction: column; line-height: 1.3; }
.footer-brand-text small { font-size: 12px; }
.footer-brand-text .muted { color: var(--muted); font-size: 11px; }
@media (max-width: 640px) {
    .footer-inner { flex-direction: column; text-align: center; }
}
