/* ============================================================
   EvalPortales — Material Design 3 + paleta institucional
   ============================================================ */

:root {
    /* Paleta extraída de los logos institucionales */
    --md-sys-color-primary: #1a3a6e;
    --md-sys-color-on-primary: #ffffff;
    --md-sys-color-primary-container: #d9e2ff;
    --md-sys-color-on-primary-container: #001844;

    --md-sys-color-secondary: #c8203a;
    --md-sys-color-on-secondary: #ffffff;
    --md-sys-color-secondary-container: #ffdad7;
    --md-sys-color-on-secondary-container: #410008;

    --md-sys-color-surface: #ffffff;
    --md-sys-color-surface-dim: #f4f5f9;
    --md-sys-color-surface-variant: #e1e2ec;
    --md-sys-color-on-surface: #1a1c1f;
    --md-sys-color-on-surface-variant: #44474f;

    --md-sys-color-outline: #c6c6d0;
    --md-sys-color-outline-variant: #e1e2ec;

    --md-sys-color-error: #b3261e;
    --md-sys-color-on-error: #ffffff;
    --md-sys-color-error-container: #f9dedc;
    --md-sys-color-on-error-container: #410e0b;

    /* Elevación Material 3 */
    --md-elev-1: 0 1px 2px rgba(0, 0, 0, .06), 0 1px 3px rgba(0, 0, 0, .08);
    --md-elev-2: 0 2px 4px rgba(0, 0, 0, .06), 0 4px 12px rgba(0, 0, 0, .08);
    --md-elev-3: 0 4px 8px rgba(0, 0, 0, .08), 0 8px 24px rgba(0, 0, 0, .12);

    /* 8pt grid */
    --sp-1: 4px;
    --sp-2: 8px;
    --sp-3: 12px;
    --sp-4: 16px;
    --sp-5: 24px;
    --sp-6: 32px;
    --sp-7: 48px;
    --sp-8: 64px;

    /* Radios */
    --r-xs: 4px;
    --r-sm: 8px;
    --r-md: 12px;
    --r-lg: 16px;
    --r-xl: 28px;

    /* Tipografía */
    --font-family: 'Roboto', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-family);
    font-size: 16px;
    line-height: 1.5;
    color: var(--md-sys-color-on-surface);
    background: var(--md-sys-color-surface-dim);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* === Escala tipográfica Material 3 (display / headline / title / body) === */
.display-md {
    font-size: 2.25rem; font-weight: 400; letter-spacing: -0.5px; line-height: 1.15;
}
.headline-md {
    font-size: 1.75rem; font-weight: 400; letter-spacing: 0; line-height: 1.2;
}
.title-lg {
    font-size: 1.375rem; font-weight: 500; letter-spacing: 0; line-height: 1.3;
}
.title-md {
    font-size: 1rem; font-weight: 500; letter-spacing: 0.15px; line-height: 1.4;
}
.body-md {
    font-size: 0.875rem; font-weight: 400; letter-spacing: 0.25px; line-height: 1.5;
    color: var(--md-sys-color-on-surface-variant);
}
.label-md {
    font-size: 0.75rem; font-weight: 500; letter-spacing: 0.5px; line-height: 1.3;
    text-transform: uppercase;
    color: var(--md-sys-color-on-surface-variant);
}

/* === Topbar === */
.topbar {
    display: flex;
    align-items: center;
    gap: var(--sp-4);
    padding: var(--sp-3) var(--sp-5);
    background: var(--md-sys-color-surface);
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
    box-shadow: var(--md-elev-1);
    position: sticky;
    top: 0;
    z-index: 10;
}
.topbar__brand {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    flex: 1;
    min-width: 0;
}
.topbar__brand img {
    width: 36px;
    height: 36px;
    object-fit: contain;
}
.topbar__title {
    font-size: 1.0625rem;
    font-weight: 500;
    color: var(--md-sys-color-on-surface);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.topbar__actions {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
}

/* === Layout principal === */
.page {
    max-width: 1100px;
    margin: 0 auto;
    padding: var(--sp-6) var(--sp-5);
}

.page--narrow {
    max-width: 480px;
}

/* === Cards Material 3 (filled / outlined / elevated) === */
.card {
    background: var(--md-sys-color-surface);
    border-radius: var(--r-lg);
    padding: var(--sp-6);
    box-shadow: var(--md-elev-1);
}
.card--elevated { box-shadow: var(--md-elev-2); }
.card--outlined {
    box-shadow: none;
    border: 1px solid var(--md-sys-color-outline-variant);
}

.card__header {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    margin-bottom: var(--sp-4);
}

/* === Pantalla de login (centrada, sin topbar) === */
.auth-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--sp-5);
    background:
        radial-gradient(at 20% 0%, rgba(26, 58, 110, 0.06) 0, transparent 50%),
        radial-gradient(at 80% 100%, rgba(200, 32, 58, 0.04) 0, transparent 50%),
        var(--md-sys-color-surface-dim);
}
.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--md-sys-color-surface);
    border-radius: var(--r-xl);
    padding: var(--sp-7) var(--sp-6) var(--sp-6);
    box-shadow: var(--md-elev-3);
    text-align: center;
}
.auth-card__logo {
    width: 140px;
    height: 140px;
    margin: 0 auto var(--sp-5);
    object-fit: contain;
}
.auth-card__title {
    margin: 0 0 var(--sp-2);
}
.auth-card__subtitle {
    margin: 0 0 var(--sp-6);
}
.auth-card__hint {
    margin: var(--sp-5) 0 0;
    font-size: 0.8125rem;
    color: var(--md-sys-color-on-surface-variant);
}
.auth-card__hint strong {
    color: var(--md-sys-color-primary);
    font-weight: 500;
}

/* === Botones Material 3 === */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--sp-2);
    padding: 0 var(--sp-5);
    height: 40px;
    border-radius: 20px;
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 500;
    letter-spacing: 0.1px;
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: background-color 150ms ease, box-shadow 150ms ease, color 150ms ease;
    user-select: none;
}
.btn:focus-visible {
    outline: 2px solid var(--md-sys-color-primary);
    outline-offset: 2px;
}

.btn--filled {
    background: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
}
.btn--filled:hover {
    background: #15305a;
    box-shadow: var(--md-elev-1);
}

.btn--outlined {
    background: transparent;
    color: var(--md-sys-color-primary);
    border: 1px solid var(--md-sys-color-outline);
}
.btn--outlined:hover {
    background: rgba(26, 58, 110, 0.06);
}

.btn--text {
    background: transparent;
    color: var(--md-sys-color-primary);
    padding: 0 var(--sp-3);
}
.btn--text:hover { background: rgba(26, 58, 110, 0.06); }

.btn--google {
    width: 100%;
    height: 48px;
    background: var(--md-sys-color-surface);
    color: var(--md-sys-color-on-surface);
    border: 1px solid var(--md-sys-color-outline);
    font-weight: 500;
    border-radius: 24px;
}
.btn--google:hover {
    background: var(--md-sys-color-surface-dim);
    box-shadow: var(--md-elev-1);
}
.btn--google svg { width: 20px; height: 20px; flex-shrink: 0; }

/* === Avatar / chip de usuario === */
.user-chip {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-2);
    padding: var(--sp-1) var(--sp-3) var(--sp-1) var(--sp-1);
    background: var(--md-sys-color-surface-variant);
    border-radius: 999px;
    font-size: 0.8125rem;
    color: var(--md-sys-color-on-surface-variant);
}
.user-chip__avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 500;
    flex-shrink: 0;
}

.role-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.4px;
}
.role-badge--admin {
    background: var(--md-sys-color-secondary-container);
    color: var(--md-sys-color-on-secondary-container);
}
.role-badge--evaluador {
    background: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
}

/* === Alerts === */
.alert {
    display: flex;
    align-items: flex-start;
    gap: var(--sp-2);
    padding: var(--sp-3) var(--sp-4);
    border-radius: var(--r-md);
    background: var(--md-sys-color-error-container);
    color: var(--md-sys-color-on-error-container);
    font-size: 0.875rem;
    margin-bottom: var(--sp-5);
    text-align: left;
}

/* === Grid de tarjetas para dashboards === */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--sp-4);
}

/* === Dashboard cards (home admin) === */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: var(--sp-4);
    margin-top: var(--sp-6);
}
.dash-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: var(--sp-2);
    padding: var(--sp-5);
    background: var(--md-sys-color-surface);
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: var(--r-lg);
    text-decoration: none;
    color: inherit;
    transition: border-color 150ms ease, box-shadow 150ms ease, transform 150ms ease;
}
.dash-card:hover {
    border-color: var(--md-sys-color-primary);
    box-shadow: var(--md-elev-2);
    transform: translateY(-1px);
}
.dash-card:focus-visible {
    outline: 2px solid var(--md-sys-color-primary);
    outline-offset: 2px;
}
.dash-card__icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    background: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--sp-2);
}
.dash-card__icon .material-symbols-outlined {
    font-size: 28px;
}
.dash-card__title {
    margin: 0;
    font-size: 1.0625rem;
    font-weight: 500;
    color: var(--md-sys-color-on-surface);
}
.dash-card__desc {
    margin: 0;
    font-size: 0.875rem;
    color: var(--md-sys-color-on-surface-variant);
    line-height: 1.45;
}
.dash-card__badge {
    position: absolute;
    top: var(--sp-3);
    right: var(--sp-3);
    font-size: 0.6875rem;
    font-weight: 500;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    color: var(--md-sys-color-on-surface-variant);
    background: var(--md-sys-color-surface-dim);
    padding: 2px 8px;
    border-radius: 999px;
}
.dash-card--secondary .dash-card__icon {
    background: var(--md-sys-color-secondary-container);
    color: var(--md-sys-color-on-secondary-container);
}

/* Material Symbols base */
.material-symbols-outlined {
    font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
    vertical-align: middle;
    user-select: none;
}

/* === Footer minimal === */
.app-footer {
    text-align: center;
    padding: var(--sp-6) var(--sp-4);
    font-size: 0.75rem;
    color: var(--md-sys-color-on-surface-variant);
}

/* === Page header (título + acciones a la derecha) === */
.page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: var(--sp-4);
    margin-bottom: var(--sp-5);
    flex-wrap: wrap;
}
.page-header__title { margin: 0; }
.page-header__subtitle {
    margin: var(--sp-1) 0 0;
    color: var(--md-sys-color-on-surface-variant);
    font-size: 0.875rem;
}
.breadcrumb {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    font-size: 0.8125rem;
    color: var(--md-sys-color-on-surface-variant);
    margin-bottom: var(--sp-3);
}
.breadcrumb a {
    color: var(--md-sys-color-primary);
    text-decoration: none;
}
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb__sep { opacity: 0.5; }

/* === Toast / flash === */
.toast {
    padding: var(--sp-3) var(--sp-4);
    border-radius: var(--r-md);
    margin-bottom: var(--sp-5);
    font-size: 0.875rem;
    background: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
}

/* === Tabla Material 3 === */
.table-card {
    background: var(--md-sys-color-surface);
    border-radius: var(--r-lg);
    box-shadow: var(--md-elev-1);
    overflow: hidden;
}
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}
.table thead th {
    padding: var(--sp-3) var(--sp-4);
    text-align: left;
    font-weight: 500;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: var(--md-sys-color-on-surface-variant);
    background: var(--md-sys-color-surface-dim);
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
}
.table tbody td {
    padding: var(--sp-3) var(--sp-4);
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
    vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: rgba(26, 58, 110, 0.03); }
.table__name { font-weight: 500; color: var(--md-sys-color-on-surface); }
.table__desc {
    color: var(--md-sys-color-on-surface-variant);
    font-size: 0.8125rem;
    max-width: 360px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.table__actions {
    text-align: right;
    white-space: nowrap;
}
.table__actions form { display: inline-block; margin-left: var(--sp-1); }

.empty-state {
    padding: var(--sp-8) var(--sp-5);
    text-align: center;
    color: var(--md-sys-color-on-surface-variant);
}
.empty-state h3 { margin: 0 0 var(--sp-2); color: var(--md-sys-color-on-surface); font-weight: 500; }

/* === Status chip === */
.chip {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.4px;
}
.chip--active {
    background: #d3f0d6;
    color: #0f4d18;
}
.chip--inactive {
    background: var(--md-sys-color-surface-variant);
    color: var(--md-sys-color-on-surface-variant);
}
.chip--type-cerrada {
    background: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
}
.chip--type-abierta {
    background: var(--md-sys-color-secondary-container);
    color: var(--md-sys-color-on-secondary-container);
}
.chip--estado-pendiente {
    background: var(--md-sys-color-surface-variant);
    color: var(--md-sys-color-on-surface-variant);
}
.chip--estado-en_proceso {
    background: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
}
.chip--estado-completada {
    background: #d3f0d6;
    color: #0f4d18;
}
.chip--estado-cancelada {
    background: var(--md-sys-color-error-container);
    color: var(--md-sys-color-on-error-container);
}

/* === Form fields outlined Material 3 === */
.field {
    position: relative;
    margin-bottom: var(--sp-5);
}
.field__input,
.field__textarea {
    width: 100%;
    padding: 16px 14px 8px;
    font: inherit;
    font-size: 1rem;
    color: var(--md-sys-color-on-surface);
    background: transparent;
    border: 1px solid var(--md-sys-color-outline);
    border-radius: var(--r-xs);
    outline: none;
    transition: border-color 150ms ease;
}
.field__textarea {
    min-height: 96px;
    resize: vertical;
    line-height: 1.5;
}
.field__input:focus,
.field__textarea:focus {
    border-color: var(--md-sys-color-primary);
    border-width: 2px;
    padding-top: 15px;
    padding-bottom: 7px;
    padding-left: 13px;
}
.field__label {
    position: absolute;
    top: 14px;
    left: 12px;
    padding: 0 4px;
    font-size: 1rem;
    color: var(--md-sys-color-on-surface-variant);
    background: var(--md-sys-color-surface);
    pointer-events: none;
    transition: 150ms ease;
}
.field__input:focus + .field__label,
.field__input:not(:placeholder-shown) + .field__label,
.field__textarea:focus + .field__label,
.field__textarea:not(:placeholder-shown) + .field__label {
    top: -8px;
    font-size: 0.75rem;
    color: var(--md-sys-color-primary);
}
.field--invalid .field__input,
.field--invalid .field__textarea { border-color: var(--md-sys-color-error); }
.field--invalid .field__label { color: var(--md-sys-color-error); }
.field__error {
    margin: var(--sp-1) 0 0 var(--sp-3);
    font-size: 0.75rem;
    color: var(--md-sys-color-error);
}

/* === Select outlined Material 3 === */
.field__select {
    width: 100%;
    padding: 16px 36px 8px 14px;
    font: inherit;
    font-size: 1rem;
    color: var(--md-sys-color-on-surface);
    background: var(--md-sys-color-surface);
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24'><path fill='%2344474f' d='M7 10l5 5 5-5z'/></svg>");
    background-repeat: no-repeat;
    background-position: right 10px center;
    border: 1px solid var(--md-sys-color-outline);
    border-radius: var(--r-xs);
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    outline: none;
    transition: border-color 150ms ease;
}
.field__select:focus {
    border-color: var(--md-sys-color-primary);
    border-width: 2px;
    padding-top: 15px;
    padding-bottom: 7px;
    padding-left: 13px;
}
.field__select:has(option:checked:not([value=""])) + .field__label,
.field__select:focus + .field__label {
    top: -8px;
    font-size: 0.75rem;
    color: var(--md-sys-color-primary);
}

/* Number input compacto */
.field__input--small {
    width: 120px;
}

/* === Segmented buttons (Material 3) === */
.segmented {
    display: inline-flex;
    border: 1px solid var(--md-sys-color-outline);
    border-radius: 999px;
    overflow: hidden;
    background: var(--md-sys-color-surface);
}
.segmented__option {
    position: relative;
}
.segmented__option input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}
.segmented__option label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 var(--sp-5);
    height: 40px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--md-sys-color-on-surface-variant);
    cursor: pointer;
    transition: background-color 150ms ease, color 150ms ease;
    border-right: 1px solid var(--md-sys-color-outline-variant);
    min-width: 120px;
}
.segmented__option:last-child label { border-right: none; }
.segmented__option input[type="radio"]:checked + label {
    background: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
    font-weight: 600;
}
.segmented__option label:hover {
    background: rgba(26, 58, 110, 0.04);
}

.field__group-label {
    display: block;
    margin-bottom: var(--sp-2);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--md-sys-color-on-surface);
}

/* Filter bar (lista con filtro arriba) */
.filter-bar {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    margin-bottom: var(--sp-4);
    flex-wrap: wrap;
}
.filter-bar__field {
    min-width: 240px;
}

/* === Switch Material 3 === */
.switch {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-3);
    cursor: pointer;
    user-select: none;
}
.switch__input {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
.switch__track {
    position: relative;
    width: 44px;
    height: 24px;
    background: var(--md-sys-color-surface-variant);
    border: 2px solid var(--md-sys-color-outline);
    border-radius: 999px;
    transition: 150ms ease;
}
.switch__thumb {
    position: absolute;
    top: 50%;
    left: 4px;
    width: 12px;
    height: 12px;
    background: var(--md-sys-color-outline);
    border-radius: 50%;
    transform: translateY(-50%);
    transition: 150ms ease;
}
.switch__input:checked ~ .switch .switch__track {
    background: var(--md-sys-color-primary);
    border-color: var(--md-sys-color-primary);
}
.switch__input:checked ~ .switch .switch__track .switch__thumb {
    background: var(--md-sys-color-on-primary);
    width: 16px;
    height: 16px;
    left: 22px;
}
.switch__label { font-size: 0.9375rem; }

/* === Form layout === */
.form-actions {
    display: flex;
    gap: var(--sp-3);
    justify-content: flex-end;
    margin-top: var(--sp-6);
    padding-top: var(--sp-5);
    border-top: 1px solid var(--md-sys-color-outline-variant);
}

/* === Section divider === */
.section-title {
    margin: var(--sp-7) 0 var(--sp-3);
    font-size: 1.0625rem;
    font-weight: 500;
    color: var(--md-sys-color-on-surface);
}

/* === Toast de error === */
.toast--error {
    background: var(--md-sys-color-error-container);
    color: var(--md-sys-color-on-error-container);
}

/* === Competencia group (constructor de instrumentos) === */
.competencia-card {
    background: var(--md-sys-color-surface);
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: var(--r-lg);
    margin-bottom: var(--sp-4);
    overflow: hidden;
}
.competencia-card__header {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    padding: var(--sp-4) var(--sp-5);
    background: var(--md-sys-color-surface-dim);
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
}
.competencia-card__title {
    margin: 0;
    font-size: 1rem;
    font-weight: 500;
    color: var(--md-sys-color-on-surface);
    flex: 1;
}
.competencia-card__count {
    font-size: 0.75rem;
    color: var(--md-sys-color-on-surface-variant);
    background: var(--md-sys-color-surface);
    padding: 2px 10px;
    border-radius: 999px;
}
.competencia-card__body {
    padding: var(--sp-4) var(--sp-5);
}
.competencia-card__subheading {
    margin: 0 0 var(--sp-2);
    font-size: 0.6875rem;
    font-weight: 500;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    color: var(--md-sys-color-on-surface-variant);
}
.competencia-card__subheading + .question-row { margin-top: 0; }
.competencia-card__divider {
    height: 1px;
    background: var(--md-sys-color-outline-variant);
    margin: var(--sp-4) 0;
}

/* === Expansion panel (details/summary Material 3) === */
.expansion {
    border: 1px dashed var(--md-sys-color-outline);
    border-radius: var(--r-md);
    background: rgba(26, 58, 110, 0.02);
    transition: background-color 150ms ease;
}
.expansion[open] {
    background: var(--md-sys-color-surface);
    border-style: solid;
    border-color: var(--md-sys-color-primary);
}
.expansion__summary {
    list-style: none;
    cursor: pointer;
    padding: var(--sp-3) var(--sp-4);
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--md-sys-color-primary);
    user-select: none;
}
.expansion__summary::-webkit-details-marker { display: none; }
.expansion__summary::before {
    content: "+";
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
    font-size: 1.125rem;
    font-weight: 500;
    line-height: 1;
    transition: transform 150ms ease;
}
.expansion[open] .expansion__summary::before {
    content: "−";
    transform: rotate(0deg);
}
.expansion__summary:hover {
    background: rgba(26, 58, 110, 0.04);
    border-radius: var(--r-md) var(--r-md) 0 0;
}
.expansion__body {
    padding: var(--sp-4);
    border-top: 1px solid var(--md-sys-color-outline-variant);
}
.expansion--prominent {
    border-style: solid;
    border-color: var(--md-sys-color-outline-variant);
    background: var(--md-sys-color-surface);
    margin-top: var(--sp-5);
}

/* Form embebido (inline-creator) usa un layout más compacto */
.inline-form .field { margin-bottom: var(--sp-3); }
.inline-form .form-actions {
    margin-top: var(--sp-4);
    padding-top: var(--sp-3);
}

/* === Listas de preguntas dentro del instrumento === */
.competency-group { margin-bottom: var(--sp-5); }
.competency-group__title {
    margin: 0 0 var(--sp-2);
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: var(--md-sys-color-primary);
}
.question-row {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    padding: var(--sp-3) var(--sp-4);
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: var(--r-md);
    margin-bottom: var(--sp-2);
    background: var(--md-sys-color-surface);
}
.question-row__text {
    flex: 1;
    min-width: 0;
    font-size: 0.875rem;
    color: var(--md-sys-color-on-surface);
}
.question-row__meta {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
}

/* Pequeño icon button */
.icon-btn {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: transparent;
    border: none;
    color: var(--md-sys-color-on-surface-variant);
    cursor: pointer;
    transition: background-color 150ms ease;
    font-size: 1.125rem;
}
.icon-btn:hover { background: rgba(0, 0, 0, 0.06); }
.icon-btn--danger:hover {
    background: var(--md-sys-color-error-container);
    color: var(--md-sys-color-on-error-container);
}

/* === Utilidades === */
.mt-0 { margin-top: 0; }
.mt-2 { margin-top: var(--sp-2); }
.mt-4 { margin-top: var(--sp-4); }
.mt-6 { margin-top: var(--sp-6); }
.text-center { text-align: center; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.gap-2 { gap: var(--sp-2); }
.gap-4 { gap: var(--sp-4); }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }

/* === Cuestionario (evaluador) === */
.pregunta {
    border-top: 1px solid var(--md-sys-color-outline-variant);
    padding: var(--sp-4) 0;
}
.pregunta:first-of-type { border-top: none; padding-top: var(--sp-3); }
.pregunta__head {
    display: flex;
    gap: var(--sp-3);
    align-items: baseline;
    margin-bottom: var(--sp-3);
}
.pregunta__num {
    flex-shrink: 0;
    font-weight: 500;
    color: var(--md-sys-color-primary);
    font-variant-numeric: tabular-nums;
    min-width: 2.5rem;
}
.pregunta__texto {
    margin: 0;
    font-size: 1rem;
    line-height: 1.5;
    color: var(--md-sys-color-on-surface);
}

.likert {
    display: flex;
    gap: var(--sp-3);
    flex-wrap: wrap;
    padding-left: 3rem;
}
.likert__opt {
    flex: 1 1 0;
    min-width: 120px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--sp-2);
    padding: var(--sp-3);
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: 12px;
    cursor: pointer;
    transition: border-color 150ms ease, background-color 150ms ease, transform 100ms ease;
    text-align: center;
    position: relative;
}
.likert__opt:hover {
    border-color: var(--md-sys-color-primary);
    background: rgba(26, 58, 110, 0.04);
}
.likert__opt input[type="radio"] {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0,0,0,0);
    border: 0;
}
.likert__circle {
    width: 36px; height: 36px;
    border-radius: 50%;
    border: 2px solid var(--md-sys-color-outline);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 500;
    font-size: 1rem;
    color: var(--md-sys-color-on-surface-variant);
    background: var(--md-sys-color-surface);
}
.likert__label {
    font-size: 0.8125rem;
    color: var(--md-sys-color-on-surface-variant);
    line-height: 1.2;
}
.likert__opt input[type="radio"]:checked ~ .likert__circle {
    background: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
    border-color: var(--md-sys-color-primary);
}
.likert__opt:has(input[type="radio"]:checked) {
    border-color: var(--md-sys-color-primary);
    background: rgba(26, 58, 110, 0.08);
}
.likert__opt:has(input[type="radio"]:checked) .likert__label {
    color: var(--md-sys-color-primary);
    font-weight: 500;
}

.field__input--textarea {
    min-height: 90px;
    resize: vertical;
    font-family: inherit;
    line-height: 1.4;
}

/* === Mis evaluaciones (cards) === */
.eval-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-3);
    padding: var(--sp-3) var(--sp-4);
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: 12px;
    margin-top: var(--sp-3);
}
.eval-card--muted { opacity: 0.85; background: var(--md-sys-color-surface-variant); }
.eval-card__body { min-width: 0; flex: 1; }
.eval-card__title {
    margin: 0 0 var(--sp-1) 0;
    font-size: 1.0625rem;
    font-weight: 500;
}
.eval-card__meta {
    margin: 0;
    font-size: 0.875rem;
    color: var(--md-sys-color-on-surface-variant);
}

.body-sm { font-size: 0.8125rem; line-height: 1.4; }

/* === Chips de estadística (import CSV) === */
.stat-chip {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-2);
    padding: var(--sp-2) var(--sp-3);
    border-radius: 999px;
    background: var(--md-sys-color-surface-variant);
    color: var(--md-sys-color-on-surface-variant);
    font-size: 0.875rem;
    font-weight: 500;
}
.stat-chip__num {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--md-sys-color-on-surface);
}
.stat-chip--ok { background: rgba(76, 175, 80, 0.15); }
.stat-chip--ok .stat-chip__num { color: #2e7d32; }
.stat-chip--info { background: rgba(33, 150, 243, 0.15); }
.stat-chip--info .stat-chip__num { color: #1565c0; }
.stat-chip--err { background: var(--md-sys-color-error-container); color: var(--md-sys-color-on-error-container); }
.stat-chip--err .stat-chip__num { color: var(--md-sys-color-error); }

@media (max-width: 700px) {
    .likert { padding-left: 0; gap: var(--sp-2); }
    .likert__opt { min-width: 64px; padding: var(--sp-2); }
    .likert__label { display: none; }
    .eval-card { flex-direction: column; align-items: stretch; }
}

@media (max-width: 600px) {
    .auth-card { padding: var(--sp-6) var(--sp-4); }
    .auth-card__logo { width: 112px; height: 112px; }
    .page { padding: var(--sp-5) var(--sp-4); }
    .topbar { padding: var(--sp-3) var(--sp-4); }
}
