:root {
    --app-primary: #0040b0;
    --app-accent: #ffcc33;
    --app-danger: #ff3333;
    --app-success: #0f766e;
    --app-surface: #ffffff;
    --app-page: #f4f7fb;
    --app-muted: #64748b;
    color-scheme: light;
}

body {
    background: var(--app-page);
}

.theme-ubb-parvularia {
    --app-primary: #0040b0;
    --app-accent: #ffcc33;
    --app-danger: #ff3333;
    --app-success: #0f766e;
    --app-page: #f4f7fb;
}

.theme-ubb-claro {
    --app-primary: #0040b0;
    --app-accent: #d3dbde;
    --app-danger: #ff3333;
    --app-success: #1967a8;
    --app-page: #f8fafc;
}

.theme-ubb-contraste {
    --app-primary: #002f80;
    --app-accent: #ffcc33;
    --app-danger: #c91f1f;
    --app-success: #0f766e;
    --app-page: #eef3f8;
}

.btn-primary {
    --bs-btn-bg: var(--app-primary);
    --bs-btn-border-color: var(--app-primary);
    --bs-btn-hover-bg: #00358f;
    --bs-btn-hover-border-color: #00358f;
}

.btn-outline-primary {
    --bs-btn-color: var(--app-primary);
    --bs-btn-border-color: var(--app-primary);
    --bs-btn-hover-bg: var(--app-primary);
    --bs-btn-hover-border-color: var(--app-primary);
}

.app-navbar {
    z-index: 1020;
}

.brand-mark {
    align-items: center;
    background: var(--app-primary);
    border-radius: 8px;
    color: #fff;
    display: inline-flex;
    height: 32px;
    justify-content: center;
    width: 32px;
}

.app-nav-toggle {
    align-items: center;
    gap: .45rem;
    min-height: 40px;
    text-decoration: none;
}

.dropdown-item .bi,
.app-nav-toggle .bi {
    color: var(--app-primary);
    width: 1.1rem;
}

.action-title {
    align-items: center;
    display: flex;
    gap: .5rem;
}

.action-title .bi {
    color: var(--app-primary);
}

.help-popover {
    border: 0;
    color: #64748b;
    padding: 0;
}

.help-popover:hover,
.help-popover:focus {
    color: #0f766e;
}

.card {
    border-radius: 8px;
}

.auth-shell {
    min-height: calc(100vh - 140px);
}

.permissions-grid {
    display: grid;
    gap: 1rem;
}

.table .btn {
    white-space: nowrap;
}

.roles-checklist {
    display: grid;
    gap: .75rem;
}

.instrument-order {
    width: 76px;
}

.sumativa-grade {
    width: 132px;
}

.sumativa-table td {
    vertical-align: top;
}

.indicator-swatch {
    background: var(--indicator-color);
    border: 1px solid rgba(15, 23, 42, .14);
    border-radius: 999px;
    display: inline-flex;
    height: 24px;
    width: 24px;
}

.indicator-chip {
    align-items: center;
    border-left: 4px solid var(--indicator-color);
    background: color-mix(in srgb, var(--indicator-color) 10%, #fff);
    border-radius: 6px;
    display: inline-flex;
    font-size: .82rem;
    gap: .35rem;
    max-width: 280px;
    padding: .3rem .5rem;
}

.indicator-evaluation {
    border: 1px solid rgba(15, 23, 42, .12);
    border-left: 6px solid var(--indicator-color);
    border-radius: 8px;
    overflow: hidden;
}

.indicator-evaluation-header {
    align-items: center;
    background: color-mix(in srgb, var(--indicator-color) 12%, #fff);
    display: flex;
    gap: .75rem;
    padding: .8rem 1rem;
}

.indicator-code {
    background: var(--indicator-color);
    border-radius: 6px;
    color: #fff;
    font-weight: 700;
    min-width: 42px;
    padding: .25rem .5rem;
    text-align: center;
}

.dashboard-hero {
    align-items: center;
    background: linear-gradient(135deg, var(--app-primary), #1d64c8 62%, var(--app-success));
    border-radius: 8px;
    color: #fff;
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.25rem;
}

.metric-card {
    background: #fff;
    border: 1px solid rgba(15, 23, 42, .12);
    border-radius: 8px;
    display: grid;
    gap: .35rem;
    min-height: 128px;
    padding: 1rem;
}

.metric-card .bi {
    color: var(--app-primary);
    font-size: 1.4rem;
}

.metric-card span,
.chart-row-label span {
    color: var(--app-muted);
    font-size: .85rem;
}

.metric-card strong {
    font-size: 1.9rem;
    line-height: 1;
}

.dashboard-progress .progress-bar,
.chart-track span {
    background: var(--app-primary);
}

.chart-row {
    align-items: center;
    display: grid;
    gap: .75rem;
    grid-template-columns: minmax(150px, 1.35fr) minmax(120px, 2fr) 54px;
}

.chart-row-label {
    display: grid;
}

.chart-track {
    background: #e2e8f0;
    border-radius: 999px;
    height: 12px;
    overflow: hidden;
}

.chart-track span {
    border-radius: inherit;
    display: block;
    height: 100%;
}

.logo-preview {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    display: block;
    max-height: 96px;
    max-width: 180px;
    object-fit: contain;
    padding: .4rem;
}

.signature-preview {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    display: block;
    max-height: 76px;
    max-width: 220px;
    object-fit: contain;
    padding: .4rem;
}

.searchable-native {
    height: 1px !important;
    opacity: 0 !important;
    position: absolute !important;
    width: 1px !important;
}

.searchable-select {
    position: relative;
}

.searchable-select-button {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.searchable-select-menu {
    max-height: 320px;
    min-width: 100%;
    overflow: hidden;
    width: max-content;
}

.searchable-select-options {
    max-height: 240px;
    overflow-y: auto;
}

.searchable-select-option {
    max-width: 520px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.notification-count {
    align-items: center;
    background: var(--app-danger);
    border-radius: 999px;
    color: #fff;
    display: inline-flex;
    font-size: .72rem;
    height: 1.2rem;
    justify-content: center;
    min-width: 1.2rem;
    padding: 0 .3rem;
}

.notification-menu {
    min-width: 320px;
}

.notification-item {
    display: grid;
    gap: .15rem;
    white-space: normal;
}

.notification-item span,
.notification-item small {
    color: var(--app-muted);
    font-size: .8rem;
}

.report-preview-frame {
    background: #f8fafc;
    border: 0;
    display: block;
    height: min(78vh, 920px);
    min-height: 620px;
    width: 100%;
}

.template-list {
    display: grid;
    gap: .65rem;
}

.template-row {
    align-items: center;
    display: grid;
    gap: .5rem;
    grid-template-columns: 32px minmax(140px, 1fr) 120px 150px 64px;
}

.template-row-wide {
    grid-template-columns: minmax(180px, 1fr) 120px 36px;
}

.template-row-wide:has(.form-check) {
    grid-template-columns: 32px minmax(180px, 1fr) 36px;
}

@media (max-width: 767.98px) {
    .dashboard-hero {
        align-items: flex-start;
        flex-direction: column;
    }

    .chart-row {
        grid-template-columns: 1fr;
    }

    .report-preview-frame {
        height: 74vh;
        min-height: 520px;
    }
}
