:root {
    --app-bg: #edf1f5;
    --app-surface: #ffffff;
    --app-surface-soft: #f6f8fb;
    --app-border: #d7dee7;
    --app-border-strong: #b4c1cf;
    --app-text: #1f2f42;
    --app-muted: #66788d;
    --app-accent: #244c78;
    --app-accent-soft: #e6edf5;
    --app-accent-strong: #183a5d;
    --app-sky: #7f98b8;
    --app-sky-soft: #dfe8f2;
    --app-sidebar: #24384f;
    --app-sidebar-strong: #1b2c40;
    --app-shadow: 0 14px 30px rgba(22, 41, 64, 0.08);
}

.calendar-mode-line {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
    margin: 8px 0 6px;
}

.calendar-mode-label {
    color: var(--app-muted);
    margin-right: 2px;
}

@media (max-width: 1100px) {
    .calendar-mode-line {
        flex-wrap: wrap;
    }
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--app-bg);
    color: var(--app-text);
    font-family: "Segoe UI", Tahoma, Arial, Helvetica, sans-serif;
}

a {
    color: var(--app-accent);
}

.app-shell {
    min-height: 100vh;
    display: flex;
    background:
        radial-gradient(circle at top right, rgba(127, 152, 184, 0.14), transparent 28%),
        linear-gradient(180deg, #edf1f5 0%, #f5f7fa 100%);
}

.app-sidebar {
    width: 272px;
    background: linear-gradient(180deg, var(--app-sidebar) 0%, var(--app-sidebar-strong) 100%);
    color: #ffffff;
    padding: 22px 18px;
    display: flex;
    flex-direction: column;
    gap: 26px;
    box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.06);
    transition: width 0.22s ease, padding 0.22s ease, gap 0.22s ease;
    overflow: hidden;
    position: relative;
}

.app-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.app-brand-copy {
    min-width: 0;
}

.app-brand strong,
.app-brand span {
    display: block;
}

.app-brand strong {
    font-size: 17px;
}

.app-brand span {
    margin-top: 4px;
    color: rgba(222, 236, 252, 0.74);
    font-size: 13px;
}

.app-brand-mark,
.auth-mark {
    width: 40px;
    height: 40px;
    display: inline-grid;
    place-items: center;
    border-radius: 6px;
    background: linear-gradient(180deg, #516b89 0%, #314b69 100%);
    color: #ffffff;
    font-weight: 700;
    text-transform: lowercase;
    box-shadow: 0 8px 18px rgba(22, 41, 64, 0.18);
}

.app-brand-logo,
.auth-logo {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: #ffffff;
    box-shadow: 0 8px 18px rgba(22, 41, 64, 0.18);
}

.app-nav {
    display: grid;
    gap: 8px;
}

.app-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #e8f2ff;
    text-decoration: none;
    padding: 11px 12px;
    border-radius: 6px;
    border: 1px solid transparent;
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.nav-label {
    min-width: 0;
}

.mobile-menu-toggle,
.desktop-sidebar-toggle,
.mobile-menu-close,
.mobile-menu-backdrop {
    display: none;
}

.app-nav a:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(183, 201, 223, 0.2);
    transform: translateX(2px);
}

.nav-icon {
    width: 28px;
    height: 28px;
    display: inline-grid;
    place-items: center;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
}

.sidebar-footer {
    margin-top: auto;
    overflow: hidden;
}

.app-sidebar .app-nav {
    max-height: calc(100vh - 180px);
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 4px;
}

.sidebar-logout {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #dcecff;
    text-decoration: none;
    padding: 11px 12px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
}

.sidebar-context {
    margin-bottom: 14px;
    padding: 12px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.06);
}

.sidebar-context-label {
    display: block;
    margin-bottom: 6px;
    color: rgba(222, 236, 252, 0.74);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.sidebar-context strong,
.sidebar-context span {
    display: block;
}

.sidebar-context span {
    margin-top: 4px;
    color: rgba(222, 236, 252, 0.74);
    font-size: 13px;
}

.app-main {
    flex: 1;
    min-width: 0;
    padding: 26px;
}

.desktop-sidebar-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    width: 32px;
    height: 32px;
    min-height: 32px;
    padding: 0;
    border: 1px solid #cfd9e6;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.98);
    color: #203d60;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(31, 63, 102, 0.10);
    position: absolute;
    right: 10px;
    top: 56px;
    z-index: 3;
}

.desktop-sidebar-toggle:hover {
    background: #ffffff;
    border-color: #9fb6d2;
}

.desktop-sidebar-toggle .nav-icon {
    width: 18px;
    height: 18px;
    color: #203d60;
    background: transparent;
}

.desktop-sidebar-toggle [data-desktop-sidebar-toggle-label] {
    display: none;
}

body.sidebar-collapsed .app-sidebar {
    width: 88px;
    padding: 18px 12px;
    gap: 18px;
}

body.sidebar-collapsed .desktop-sidebar-toggle {
    right: 10px;
}

body.sidebar-collapsed .app-brand {
    justify-content: center;
}

body.sidebar-collapsed .app-brand-copy,
body.sidebar-collapsed .nav-label,
body.sidebar-collapsed .sidebar-context {
    display: none !important;
}

body.sidebar-collapsed .app-sidebar .app-nav {
    padding-right: 0;
    overflow-x: hidden;
}

body.sidebar-collapsed .app-nav a,
body.sidebar-collapsed .app-nav-group > summary,
body.sidebar-collapsed .sidebar-logout {
    justify-content: center;
    padding-left: 10px;
    padding-right: 10px;
    gap: 0;
    width: 100%;
    box-sizing: border-box;
    min-height: 40px;
}

body.sidebar-collapsed .app-nav a:hover {
    transform: none;
}

body.sidebar-collapsed .app-nav-group-links {
    display: none;
}

body.sidebar-collapsed .app-nav-group[open] {
    background: transparent;
}

body.sidebar-collapsed .app-nav-group > summary::after {
    display: none;
}

body.sidebar-collapsed .nav-icon {
    width: 34px;
    height: 34px;
}

body.sidebar-collapsed .app-nav,
body.sidebar-collapsed .app-nav-group,
body.sidebar-collapsed .app-sidebar,
body.sidebar-collapsed .sidebar-footer {
    overflow-x: hidden;
}

body.sidebar-collapsed .sidebar-logout {
    overflow: hidden;
}

.app-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 18px;
    margin-bottom: 22px;
}

.app-header-main {
    min-width: 0;
    display: grid;
    gap: 8px;
}

.app-content {
    background: rgba(255, 255, 255, 0.42);
    border: 1px solid rgba(212, 223, 236, 0.8);
    border-radius: 6px;
    padding: 22px;
    backdrop-filter: blur(8px);
}

.app-footer {
    margin-top: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 16px 18px;
    border: 1px solid rgba(212, 223, 236, 0.9);
    border-radius: 12px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.84) 0%, rgba(244, 248, 252, 0.96) 100%);
    box-shadow: var(--app-shadow);
}

.app-footer-brand-link {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    color: inherit;
    text-decoration: none;
}

.app-footer-logo {
    width: 64px;
    height: 64px;
    object-fit: contain;
    border-radius: 10px;
    background: #ffffff;
    border: 1px solid rgba(180, 193, 207, 0.65);
    box-shadow: 0 8px 18px rgba(22, 41, 64, 0.1);
    padding: 6px;
}

.app-footer-brand-text {
    display: grid;
    gap: 4px;
}

.app-footer-brand-text strong,
.app-footer-meta strong {
    color: var(--app-accent-strong);
    font-size: 14px;
}

.app-footer-brand-text span,
.app-footer-meta span {
    color: var(--app-muted);
    font-size: 13px;
}

.app-footer-meta {
    text-align: right;
    display: grid;
    gap: 4px;
}

.eyebrow {
    margin: 0 0 6px;
    color: var(--app-accent);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.header-title {
    margin: 0;
    font-size: 23px;
    line-height: 1.2;
}

.header-context {
    margin: 8px 0 0;
    color: var(--app-muted);
    font-size: 14px;
}

.header-context-exit {
    margin-top: 14px;
}

.header-context-exit .button-secondary {
    min-height: 40px;
}

.header-user {
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
}

.header-user strong,
.header-user span {
    display: block;
}

.header-user span {
    margin-top: 4px;
    color: var(--app-muted);
    font-size: 13px;
}
.header-entity-logo {
    display: block;
    width: 46px;
    height: 46px;
    object-fit: contain;
    border-radius: 8px;
    border: 1px solid var(--app-border);
    background: #ffffff;
    padding: 3px;
    margin-bottom: 6px;
}

.user-avatar {
    width: 34px;
    height: 34px;
    display: inline-grid;
    place-items: center;
    border-radius: 6px;
    background: var(--app-accent-soft);
    color: var(--app-accent-strong);
    font-weight: 700;
    text-transform: uppercase;
}
.profile-switcher-float {
    margin-top: 8px;
    padding: 12px;
    border: 1px solid var(--app-border);
    border-radius: 10px;
    background: linear-gradient(180deg, #ffffff 0%, #f7fafc 100%);
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 320px;
    max-width: 92vw;
    z-index: 70;
    box-shadow: var(--app-shadow);
}
.profile-switcher-form + .profile-switcher-form {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed var(--app-border);
}
.profile-switcher-label {
    display: block;
    margin-bottom: 6px;
    color: #3f4b5a;
    font-size: 12px;
    font-weight: 600;
}
.profile-switcher-row {
    display: flex;
    gap: 8px;
    align-items: center;
}
.profile-switcher-select {
    min-width: 220px;
}
.profile-switcher-trigger {
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid var(--app-border);
    border-radius: 8px;
    background: #ffffff;
    box-shadow: var(--app-shadow);
    padding: 8px 10px;
    cursor: pointer;
}
.profile-switcher-summary strong {
    font-size: 13px;
}
.profile-switcher-summary span {
    margin-top: 2px;
    font-size: 12px;
}
.profile-switcher-entity-name {
    margin: 0 0 8px;
    color: var(--app-muted);
    font-size: 12px;
}

.header-academic-chip {
    margin-top: 2px;
    display: inline-grid;
    grid-template-columns: 32px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    border: 1px solid var(--app-border);
    border-radius: 8px;
    padding: 8px 10px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
    max-width: 520px;
    width: 100%;
}

.header-academic-chip img {
    width: 32px !important;
    height: 32px !important;
    min-width: 32px;
    min-height: 32px;
    max-width: 32px !important;
    max-height: 32px !important;
    object-fit: contain;
    border-radius: 6px;
    border: 1px solid var(--app-border);
    background: #fff;
    display: block;
}

.header-academic-fallback {
    width: 32px;
    height: 32px;
    display: inline-grid;
    place-items: center;
    border-radius: 6px;
    border: 1px solid var(--app-border);
    background: #f1f6fc;
    color: var(--app-accent);
    font-size: 12px;
    font-weight: 700;
}

.header-academic-meta {
    display: grid;
    gap: 2px;
    margin: 0;
}

.header-academic-title {
    font-size: 12px;
    line-height: 1.2;
    margin: 0;
    color: #21344a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.header-academic-year {
    font-style: normal;
    color: #3e5f83;
    font-size: 12px;
}

@media (max-width: 1100px) {
    .app-header {
        gap: 12px;
    }

    .header-academic-chip {
        max-width: 100%;
    }
}

.materias-filter-row {
    margin: 12px 0 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.materias-filter-button {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 0 12px;
    border: 1px solid var(--app-border);
    border-radius: 6px;
    text-decoration: none;
    color: var(--app-accent);
    background: #fff;
    font-size: 13px;
    font-weight: 600;
}

.materias-filter-button.is-active {
    background: var(--app-accent);
    border-color: var(--app-accent);
    color: #fff;
}

.docente-workflow-card {
    margin-bottom: 12px;
}

.docente-workflow-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.docente-workflow-actions .button-secondary.is-active {
    background: var(--app-accent);
    border-color: var(--app-accent);
    color: #ffffff;
    font-weight: 700;
    box-shadow: 0 8px 18px rgba(36, 76, 120, 0.22);
}

.app-nav-group {
    border-radius: 6px;
    border: 1px solid transparent;
    background: transparent;
}

.app-nav-group > summary {
    list-style: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    color: #e8f2ff;
    text-decoration: none;
    padding: 11px 12px;
    border-radius: 6px;
}

.app-nav-group > summary::-webkit-details-marker {
    display: none;
}

.app-nav-group:hover > summary {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(183, 201, 223, 0.2);
}

.app-nav-group.is-active > summary {
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(183, 201, 223, 0.24);
}

.app-nav-group-links {
    margin-top: 4px;
    display: grid;
    gap: 6px;
    padding: 0 6px 8px 40px;
}

.app-nav-group-links a {
    padding: 8px 10px;
    border-radius: 6px;
    font-size: 13px;
    color: #dcecff;
    border: 1px solid transparent;
}

.app-nav-group-links a.is-active {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(183, 201, 223, 0.24);
}

.page-title {
    margin: 0 0 10px;
    font-size: 24px;
}

.page-subtitle {
    margin: 0 0 24px;
    color: var(--app-muted);
}

.hero-panel {
    display: grid;
    grid-template-columns: 1.6fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
    padding: 20px 22px;
    border: 1px solid var(--app-border);
    border-radius: 6px;
    background:
        linear-gradient(135deg, rgba(36, 76, 120, 0.96) 0%, rgba(63, 94, 129, 0.92) 100%);
    color: #ffffff;
    box-shadow: var(--app-shadow);
}

.hero-panel .eyebrow,
.hero-panel .hero-copy {
    color: rgba(255, 255, 255, 0.84);
}

.hero-title {
    margin: 0 0 10px;
    font-size: 24px;
    line-height: 1.25;
}

.hero-copy {
    margin: 0;
    max-width: 62ch;
    font-size: 14px;
}

.hero-panel-compact {
    grid-template-columns: 1fr;
}

.hero-chip-group {
    display: flex;
    flex-wrap: wrap;
    align-content: start;
    gap: 10px;
}

.hero-chip {
    padding: 8px 11px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    font-size: 12px;
}

.stats-grid,
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

.stats-grid {
    margin-bottom: 18px;
}

.stat-card,
.card {
    background: var(--app-surface);
    border: 1px solid var(--app-border);
    border-radius: 6px;
    padding: 18px;
    box-shadow: var(--app-shadow);
}

.card-link {
    display: block;
    text-decoration: none;
}

.card-feature,
.stat-card {
    position: relative;
    overflow: hidden;
}

.card h2 {
    margin: 0 0 8px;
    font-size: 17px;
}

.card p {
    margin: 0;
    color: var(--app-muted);
}

.card-icon,
.stat-icon {
    width: 38px;
    height: 38px;
    display: inline-grid;
    place-items: center;
    margin-bottom: 14px;
    border-radius: 6px;
    background: var(--app-accent-soft);
    color: var(--app-accent-strong);
}

.icon-svg {
    width: 16px;
    height: 16px;
    display: block;
}

.nav-icon .icon-svg {
    width: 15px;
    height: 15px;
}

.card-icon .icon-svg,
.stat-icon .icon-svg {
    width: 18px;
    height: 18px;
}

.stat-card strong,
.stat-card span {
    display: block;
}

.stat-card strong {
    font-size: 24px;
}

.stat-card span:last-child {
    margin-top: 6px;
    color: var(--app-muted);
}

.banner {
    margin-bottom: 18px;
    padding: 13px 15px;
    border: 1px solid var(--app-border);
    border-radius: 6px;
    background: #ffffff;
    box-shadow: var(--app-shadow);
}

.banner-success {
    background: #eff9ff;
    border-color: #c3e7fb;
}

.banner-error {
    background: #fff1f2;
    border-color: #fecdd3;
}

.top-news-strip {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: stretch;
    gap: 0;
    margin-bottom: 16px;
    border: 1px solid #c7d7ea;
    border-radius: 6px;
    overflow: hidden;
    background: #ffffff;
    box-shadow: var(--app-shadow);
}

.top-news-label {
    display: grid;
    place-items: center;
    padding: 10px 14px;
    background: #123d73;
    color: #ffffff;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .04em;
    white-space: nowrap;
}

.top-news-items {
    display: flex;
    align-items: center;
    gap: 0;
    overflow-x: auto;
}

.top-news-item {
    min-width: 260px;
    padding: 9px 14px;
    color: #153456;
    text-decoration: none;
    border-right: 1px solid #d8e2ef;
}

.top-news-item:hover {
    background: #f4f8fd;
}

.top-news-item span,
.top-news-item em {
    display: block;
    line-height: 1.25;
}

.top-news-item span {
    color: #a11322;
    font-size: 13px;
}

.top-news-item em {
    margin-top: 2px;
    color: #425b78;
    font-size: 12px;
    font-style: normal;
}

.split-layout {
    display: grid;
    grid-template-columns: minmax(280px, 380px) 1fr;
    gap: 16px;
    align-items: start;
}

.form-group-title {
    margin-top: 4px;
    padding-top: 8px;
    border-top: 1px solid var(--app-border);
    color: var(--app-accent-strong);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.section-card h2 {
    margin-bottom: 16px;
    font-size: 19px;
}

.section-head {
    display: flex;
    justify-content: space-between;
    align-items: start;
    gap: 14px;
    margin-bottom: 16px;
}

.section-head h2,
.section-head h3 {
    margin: 0 0 6px;
}

.grid-two,
.grid-three {
    display: grid;
    gap: 14px;
}

.grid-two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-three {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid-full {
    grid-column: 1 / -1;
}

.stack-form {
    display: grid;
    gap: 14px;
}

.compact-form {
    margin-bottom: 16px;
}

.stack-form label {
    display: grid;
    gap: 6px;
}

.stack-form input,
.stack-form select,
.stack-form textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--app-border-strong);
    border-radius: 6px;
    font: inherit;
    background: var(--app-surface-soft);
    color: var(--app-text);
}

.stack-form input:focus,
.stack-form select:focus,
.stack-form textarea:focus {
    outline: none;
    border-color: var(--app-sky);
    box-shadow: 0 0 0 3px rgba(88, 183, 242, 0.18);
}

.inline-check {
    display: flex !important;
    align-items: center;
    gap: 10px;
}

.inline-check input {
    width: auto;
}

.button-primary {
    padding: 11px 16px;
    border: 0;
    border-radius: 6px;
    background: linear-gradient(180deg, var(--app-accent) 0%, var(--app-accent-strong) 100%);
    color: #ffffff;
    cursor: pointer;
    font-weight: 700;
    box-shadow: 0 8px 18px rgba(22, 41, 64, 0.16);
}

.button-secondary {
    padding: 11px 16px;
    border: 1px solid var(--app-border-strong);
    border-radius: 6px;
    background: #ffffff;
    color: var(--app-accent-strong);
    cursor: pointer;
    font-weight: 700;
}

.card-filter {
    margin-bottom: 16px;
}

.tabs-shell {
    display: grid;
    gap: 16px;
}

.tabs-header {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.tab-button {
    padding: 11px 16px;
    border: 1px solid var(--app-border-strong);
    border-radius: 999px;
    background: #f8fafc;
    color: var(--app-accent-strong);
    cursor: pointer;
    font: inherit;
    font-weight: 700;
}

.tab-button.is-active {
    background: linear-gradient(180deg, var(--app-accent) 0%, var(--app-accent-strong) 100%);
    border-color: transparent;
    color: #ffffff;
    box-shadow: 0 8px 18px rgba(22, 41, 64, 0.16);
}

.tab-panel {
    width: 100%;
}

.button-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.button-link,
.button-link:hover,
.button-link:focus,
.button-link:active,
a.button-primary,
a.button-primary:hover,
a.button-primary:focus,
a.button-primary:active,
a.button-secondary,
a.button-secondary:hover,
a.button-secondary:focus,
a.button-secondary:active {
    text-decoration: none;
}

.tab-button,
.tab-button:hover,
.tab-button:focus,
.tab-button:active,
.icon-action-button,
.icon-action-button:hover,
.icon-action-button:focus,
.icon-action-button:active {
    text-decoration: none;
}

.context-banner-card {
    margin-bottom: 16px;
}

.context-banner {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
}

.context-banner h2 {
    margin: 0;
}

.context-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: end;
    align-items: center;
}

.inline-action-form {
    display: inline-flex;
}

.table-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.icon-action-button {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid var(--app-border-strong);
    border-radius: 8px;
    background: #ffffff;
    color: var(--app-accent-strong);
    cursor: pointer;
    text-decoration: none;
    box-shadow: 0 4px 10px rgba(22, 41, 64, 0.06);
}

.icon-action-button:hover {
    background: var(--app-surface-soft);
    border-color: var(--app-sky);
}

.icon-action-button .icon-svg {
    width: 16px;
    height: 16px;
}

.icon-action-button.is-current {
    background: var(--app-accent-soft);
    color: var(--app-accent-strong);
}

.table-pill-muted {
    background: #eef2f7;
    color: #556476;
}

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

.inline-filter-form label {
    flex: 1;
    display: grid;
    gap: 6px;
}

.inline-filter-form select {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--app-border-strong);
    border-radius: 6px;
    font: inherit;
    background: var(--app-surface-soft);
    color: var(--app-text);
}

.materias-switcher {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}

.materia-switch-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 10px 12px;
    border: 1px solid var(--app-border-strong);
    border-radius: 10px;
    background: #ffffff;
    color: var(--app-accent-strong);
    text-decoration: none;
    font-weight: 700;
    text-align: center;
    transition: transform 0.14s ease, box-shadow 0.14s ease, border-color 0.14s ease, background-color 0.14s ease;
}

.materia-switch-button:hover {
    border-color: var(--app-sky);
    background: #f7fbfe;
    transform: translateY(-1px);
}

.materia-switch-button.is-active {
    border-color: transparent;
    background: linear-gradient(180deg, var(--app-accent) 0%, var(--app-accent-strong) 100%);
    color: #ffffff;
    box-shadow: 0 10px 18px rgba(23, 103, 168, 0.2);
}

@media (max-width: 1300px) {
    .materias-switcher {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 900px) {
    .materias-switcher {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 560px) {
    .materias-switcher {
        grid-template-columns: 1fr;
    }
}

.table-wrap {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 12px 8px;
    border-bottom: 1px solid var(--app-border);
    text-align: left;
    vertical-align: top;
}

.table th {
    color: var(--app-muted);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.table-pill {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 999px;
    background: var(--app-accent-soft);
    color: var(--app-accent-strong);
    font-size: 11px;
    font-weight: 700;
}

.table select {
    min-width: 180px;
}

.table-compact th,
.table-compact td {
    padding-top: 10px;
    padding-bottom: 10px;
}

.entity-cell {
    display: flex;
    align-items: center;
    gap: 12px;
}

.admin-badge {
    display: flex;
    align-items: start;
    gap: 10px;
}

.admin-badge-icon {
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: var(--app-accent-soft);
    color: var(--app-accent-strong);
    flex: 0 0 30px;
}

.entity-logo {
    width: 46px;
    height: 46px;
    flex: 0 0 46px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid var(--app-border);
    background: #ffffff;
}

.entity-logo-fallback {
    display: inline-grid;
    place-items: center;
    background: var(--app-accent-soft);
    color: var(--app-accent-strong);
    font-weight: 700;
}

.cell-subtext {
    margin-top: 4px;
    color: var(--app-muted);
    font-size: 12px;
}

.field-help,
.empty-note {
    color: var(--app-muted);
    font-size: 12px;
}

.section-separator {
    height: 1px;
    margin: 22px 0;
    background: var(--app-border);
}

.inset-card {
    padding: 16px;
    background: var(--app-surface-soft);
}

.logo-preview-card {
    display: grid;
    gap: 10px;
    align-content: start;
    padding: 14px;
    border: 1px solid var(--app-border);
    border-radius: 6px;
    background: var(--app-surface-soft);
}

.app-logo-preview {
    width: 72px;
    height: 72px;
    object-fit: cover;
    border-radius: 10px;
    border: 1px solid var(--app-border);
    background: #ffffff;
}

.status-dot {
    width: 10px;
    height: 10px;
    display: inline-block;
    margin-right: 8px;
    border-radius: 999px;
}

.status-on {
    background: #38b56f;
}

.status-off {
    background: #9aa8b5;
}

.auth-page {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1.2fr minmax(320px, 440px);
    gap: 24px;
    align-items: center;
    padding: 28px;
    background:
        radial-gradient(circle at top left, rgba(88, 183, 242, 0.2), transparent 28%),
        linear-gradient(180deg, #edf4fb 0%, #f6f9fc 100%);
}

.auth-showcase {
    padding: 28px;
}

.auth-showcase h1 {
    margin: 0 0 14px;
    font-size: 42px;
    line-height: 1.12;
    color: var(--app-text);
}

.auth-showcase p:last-child {
    max-width: 54ch;
    color: var(--app-muted);
    font-size: 18px;
}

.auth-showcase-eas {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    gap: 10px;
}

.auth-showcase-eas-logo-wrap {
    width: 116px;
    height: 116px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.82);
    border: 1px solid rgba(36, 76, 120, 0.12);
    box-shadow: 0 10px 24px rgba(22, 41, 64, 0.12);
    display: grid;
    place-items: center;
    padding: 10px;
    margin-bottom: 8px;
}

.auth-showcase-eas-logo {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.auth-showcase-eas h1 {
    margin: 0;
    font-size: 42px;
    line-height: 1.08;
    color: var(--app-text);
}

.auth-showcase-eas-subtitle,
.auth-showcase-eas-university {
    margin: 0;
    color: var(--app-muted);
    font-size: 20px;
}

.auth-showcase-eas-footer {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid rgba(36, 76, 120, 0.18);
}

.auth-showcase-eas-footer p {
    margin: 0;
    color: var(--app-accent-strong);
    font-size: 14px;
    font-weight: 600;
}

.auth-box {
    width: 100%;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid var(--app-border);
    border-radius: 6px;
    padding: 28px;
    box-shadow: var(--app-shadow);
    backdrop-filter: blur(8px);
}

.auth-box-head {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 18px;
}

.auth-box h1 {
    margin: 0 0 4px;
}

.auth-box p {
    margin: 0;
    color: var(--app-muted);
}

.auth-box form {
    display: grid;
    gap: 14px;
}

.auth-box label {
    display: grid;
    gap: 6px;
}

.auth-box input {
    width: 100%;
    padding: 11px 10px;
    border: 1px solid var(--app-border-strong);
    border-radius: 8px;
    background: var(--app-surface-soft);
}

.auth-box input:focus {
    outline: none;
    border-color: var(--app-sky);
    box-shadow: 0 0 0 3px rgba(88, 183, 242, 0.18);
}

.auth-box button {
    padding: 11px 14px;
    border: 0;
    border-radius: 8px;
    background: linear-gradient(180deg, var(--app-accent) 0%, var(--app-accent-strong) 100%);
    color: #ffffff;
    cursor: pointer;
    font-weight: 700;
}

.alert {
    margin-bottom: 14px;
    padding: 10px 12px;
    border-radius: 8px;
    background: #eef6ff;
    border: 1px solid #c6def8;
}

.alert-error {
    background: #fff1f2;
    border-color: #fecdd3;
}

.alert-warning {
    background: var(--app-warning-soft);
    border-color: #ffd38a;
    color: #6f4a08;
}

.confirm-checkbox {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-weight: 700;
}

.confirm-checkbox input {
    width: auto;
    margin-top: 3px;
}

@media (max-width: 800px) {
    .app-shell {
        flex-direction: column;
    }

    .app-sidebar {
        width: 100%;
    }

    .split-layout {
        grid-template-columns: 1fr;
    }

    .grid-two,
    .grid-three {
        grid-template-columns: 1fr;
    }

    .app-header,
    .hero-panel,
    .auth-page {
        grid-template-columns: 1fr;
    }

    .app-header {
        align-items: start;
    }

    .inline-filter-form {
        flex-direction: column;
        align-items: stretch;
    }

    .context-banner {
        flex-direction: column;
        align-items: start;
    }

    .context-actions {
        justify-content: start;
    }

    .auth-showcase {
        padding: 0;
    }

    .auth-showcase h1 {
        font-size: 28px;
    }

    .auth-showcase-eas h1 {
        font-size: 34px;
    }

    .auth-showcase-eas-subtitle,
    .auth-showcase-eas-university {
        font-size: 17px;
    }
}

/* Modern institutional theme, progressive layer */
:root {
    --app-bg: #f3f6fa;
    --app-surface: #ffffff;
    --app-surface-soft: #f8fafc;
    --app-border: #dce4ee;
    --app-border-strong: #b7c5d6;
    --app-text: #162235;
    --app-muted: #627086;
    --app-accent: #1767a8;
    --app-accent-soft: #e8f3fb;
    --app-accent-strong: #0f4778;
    --app-sky: #36a3d9;
    --app-sky-soft: #dff4fb;
    --app-success: #168056;
    --app-success-soft: #e7f6ef;
    --app-warning: #b97814;
    --app-warning-soft: #fff4df;
    --app-sidebar: #10243c;
    --app-sidebar-strong: #0b1829;
    --app-shadow: 0 18px 42px rgba(18, 34, 53, 0.09);
    --app-shadow-soft: 0 8px 20px rgba(18, 34, 53, 0.06);
}

body {
    background: var(--app-bg);
    font-family: Inter, "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, Arial, sans-serif;
    letter-spacing: 0;
}

.app-shell {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.78) 0%, rgba(243, 246, 250, 0.94) 46%, #eef3f8 100%);
}

.app-sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    width: 286px;
    padding: 20px 16px;
    background: linear-gradient(180deg, #10243c 0%, #102f4f 52%, #0b1829 100%);
    border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.app-brand {
    min-height: 58px;
    padding: 8px;
    border-radius: 8px;
}

.app-brand strong {
    font-size: 16px;
    letter-spacing: 0;
}

.app-brand span {
    color: rgba(233, 243, 255, 0.72);
}

.app-brand-mark,
.app-brand-logo,
.auth-mark,
.auth-logo {
    border-radius: 8px;
}

.app-brand-mark,
.auth-mark {
    background: linear-gradient(135deg, #36a3d9 0%, #1767a8 58%, #168056 100%);
}

.app-nav a,
.sidebar-logout {
    min-height: 44px;
    border-radius: 8px;
    color: rgba(241, 247, 255, 0.9);
}

.app-nav a:hover,
.app-nav a.is-active {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(179, 218, 246, 0.26);
    color: #ffffff;
    transform: translateX(3px);
}

.app-nav a.is-active .nav-icon {
    background: #ffffff;
    color: var(--app-accent-strong);
}

.nav-icon {
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
}

.sidebar-context {
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.08);
}

.app-main {
    padding: 24px;
}

.app-header {
    min-height: 76px;
    padding: 4px 2px;
}

.header-title {
    font-size: 26px;
    letter-spacing: 0;
}

.header-user,
.app-content,
.card,
.stat-card,
.banner,
.auth-box {
    border-radius: 8px;
    box-shadow: var(--app-shadow-soft);
}

.header-user {
    min-width: 230px;
}

.user-avatar,
.card-icon,
.stat-icon,
.icon-action-button,
.admin-badge-icon {
    border-radius: 8px;
}

.app-content {
    background: rgba(255, 255, 255, 0.74);
    border-color: rgba(220, 228, 238, 0.92);
}

.hero-panel {
    border: 0;
    border-radius: 8px;
    background:
        linear-gradient(135deg, #0f4778 0%, #1767a8 48%, #168056 120%);
    box-shadow: 0 20px 42px rgba(15, 71, 120, 0.22);
}

.hero-title {
    font-size: 26px;
    letter-spacing: 0;
}

.hero-chip {
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.16);
}

.card,
.stat-card {
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.card-link:hover,
.stat-card:hover {
    border-color: #b9dcef;
    box-shadow: var(--app-shadow);
    transform: translateY(-2px);
}

.materias-quick-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
}

.materia-quick-card {
    padding: 14px;
    background: #f3f8ff;
    border-color: #b7d2ee;
}

.materia-quick-card h3 {
    margin: 8px 0 4px;
    font-size: 17px;
    line-height: 1.3;
    color: var(--app-primary);
}

.materia-quick-card p {
    margin: 0;
    color: var(--app-muted);
    font-size: 14px;
}

.compact-actions-grid {
    margin-top: 14px;
}

.stat-card strong {
    font-size: 28px;
}

.button-primary,
.button-secondary,
.tab-button,
.icon-action-button,
.auth-box button {
    transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

.button-primary:hover,
.button-secondary:hover,
.tab-button:hover,
.icon-action-button:hover,
.auth-box button:hover {
    transform: translateY(-1px);
}

.button-primary,
.auth-box button,
.tab-button.is-active {
    background: linear-gradient(180deg, #1767a8 0%, #0f4778 100%);
    box-shadow: 0 10px 22px rgba(23, 103, 168, 0.2);
}

.button-secondary {
    background: #ffffff;
    border-color: #cad7e6;
}

.stack-form input,
.stack-form select,
.stack-form textarea,
.inline-filter-form select,
.auth-box input {
    min-height: 42px;
    border-radius: 8px;
    background: #ffffff;
}

.stack-form input:focus,
.stack-form select:focus,
.stack-form textarea:focus,
.inline-filter-form select:focus,
.auth-box input:focus {
    border-color: var(--app-sky);
    box-shadow: 0 0 0 4px rgba(54, 163, 217, 0.14);
}

.table {
    border-collapse: separate;
    border-spacing: 0;
}

.table th {
    background: #f8fafc;
    color: #536276;
}

.table tbody tr {
    transition: background 0.14s ease;
}

.table tbody tr:hover {
    background: #f7fbfe;
}

.table-pill {
    background: var(--app-accent-soft);
}

.table-pill-muted {
    background: #eef3f7;
}

.module-matrix-table th,
.module-matrix-table td {
    vertical-align: middle;
}

.module-matrix-table td:not(:first-child),
.module-matrix-table th:not(:first-child) {
    text-align: center;
}

.module-matrix-table td {
    padding-top: 10px;
    padding-bottom: 10px;
}

.stack-form .module-matrix-table input[type='checkbox'] {
    width: 16px !important;
    height: 16px !important;
    min-height: 16px !important;
    max-width: 16px;
    margin: 0;
    padding: 0 !important;
    display: inline-block;
    accent-color: #1b65c2;
    cursor: pointer;
    box-shadow: none !important;
    transform: none !important;
    vertical-align: middle;
}

.stack-form .module-matrix-check {
    -webkit-appearance: checkbox !important;
    appearance: auto !important;
    inline-size: 16px !important;
    block-size: 16px !important;
    width: 16px !important;
    height: 16px !important;
    min-width: 16px !important;
    min-height: 16px !important;
    max-width: 16px !important;
    max-height: 16px !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    border-radius: 2px;
}

.stack-form .module-matrix-table td:first-child {
    font-weight: 700;
    color: #1f334a;
}

.module-matrix-table tbody tr:nth-child(odd) {
    background: #fbfdff;
}

.module-matrix-table thead th {
    font-size: 0.86rem;
    letter-spacing: 0;
}

.module-matrix-table td:not(:first-child) label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.status-on {
    background: var(--app-success);
}

.banner-success {
    background: var(--app-success-soft);
    border-color: #b9e7d1;
}

.banner-error {
    background: #fff1f2;
    border-color: #fecdd3;
}

[data-ajax-region] {
    transition: opacity 0.16s ease, transform 0.16s ease;
}

body.is-loading [data-ajax-region] {
    opacity: 0.55;
    transform: translateY(2px);
    pointer-events: none;
}

.ajax-progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 50;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, #36a3d9, #168056, #36a3d9);
    background-size: 200% 100%;
    opacity: 0;
    transform: scaleX(0.2);
    transform-origin: left;
    transition: opacity 0.16s ease, transform 0.24s ease;
    animation: ajax-bar 1s linear infinite;
}

body.is-loading .ajax-progress-bar {
    opacity: 1;
    transform: scaleX(1);
}

@keyframes ajax-bar {
    from { background-position: 0 0; }
    to { background-position: 200% 0; }
}

@media (max-width: 800px) {
    .app-sidebar {
        position: static;
        height: auto;
        width: 100%;
    }

    .app-main {
        padding: 16px;
    }

    .app-content {
        padding: 16px;
    }

    .header-user {
        width: 100%;
    }
}

.table-pill-success {
    background: var(--app-success-soft);
    color: var(--app-success);
}

.table-pill-warning {
    background: var(--app-warning-soft);
    color: var(--app-warning);
}

.attendance-layout {
    grid-template-columns: minmax(280px, 420px) 1fr;
}

.attendance-class-list {
    display: grid;
    gap: 10px;
}

.attendance-class-item {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 12px;
    border: 1px solid var(--app-border);
    border-radius: 8px;
    background: #ffffff;
    color: var(--app-text);
    text-decoration: none;
}

.attendance-class-item:hover,
.attendance-class-item.is-active {
    border-color: var(--app-sky);
    background: #f7fbfe;
}

.attendance-class-item strong,
.attendance-class-item small {
    display: block;
}

.attendance-class-item small {
    margin-top: 4px;
    color: var(--app-muted);
}

.attendance-class-item em {
    align-self: start;
    white-space: nowrap;
    font-style: normal;
    font-size: 12px;
    font-weight: 700;
    color: var(--app-accent-strong);
}

.attendance-form {
    gap: 16px;
}

.attendance-no-activity,
.attendance-student-notes,
.attendance-student-note {
    display: grid;
    gap: 12px;
}

.attendance-table input,
.attendance-table select {
    width: 100%;
    min-width: 150px;
    padding: 9px 10px;
    border: 1px solid var(--app-border-strong);
    border-radius: 8px;
    background: #ffffff;
    color: var(--app-text);
    font: inherit;
}

@media (max-width: 800px) {
    .attendance-layout {
        grid-template-columns: 1fr;
    }
}

.attendance-workspace {
    display: grid;
    gap: 14px;
}

.attendance-daybar,
.attendance-commandbar,
.attendance-roster-head,
.attendance-savebar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.attendance-daybar h2,
.attendance-commandbar h2,
.attendance-roster-head h3 {
    margin: 0;
}

.attendance-daybar {
    padding: 16px 18px;
    background: var(--app-surface);
    border: 1px solid var(--app-border);
    border-radius: 6px;
}

.attendance-date-form {
    display: flex;
    align-items: end;
    gap: 10px;
    flex-wrap: wrap;
}

.attendance-date-form input {
    min-width: 168px;
    background: #ffffff;
    border: 1px solid #c9d6e2;
    border-radius: 10px;
    box-shadow: 0 1px 2px rgba(17, 24, 39, 0.06);
    padding: 10px 12px;
    font-weight: 700;
}

.attendance-date-form input:focus {
    border-color: #1d4ed8;
    box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.15);
}

.attendance-class-strip {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 10px;
}

.attendance-class-chip {
    display: grid;
    gap: 4px;
    min-height: 94px;
    padding: 12px;
    text-decoration: none;
    color: var(--app-text);
    background: var(--app-surface);
    border: 1px solid var(--app-border);
    border-radius: 6px;
}

.attendance-class-chip:hover,
.attendance-class-chip.is-active {
    border-color: var(--app-accent);
    background: #f7fbfe;
}

.attendance-class-chip.is-now {
    border-color: #2e7d55;
    background: #eef7f2;
    box-shadow: inset 0 0 0 1px rgba(46, 125, 85, 0.2);
}

.attendance-class-chip strong {
    font-size: 20px;
}

.attendance-class-chip span,
.attendance-class-chip small,
.attendance-class-chip em {
    overflow-wrap: anywhere;
}

.attendance-class-chip span {
    font-weight: 700;
}

.attendance-class-chip small {
    color: var(--app-muted);
}

.attendance-class-chip em {
    justify-self: start;
    padding: 4px 8px;
    border-radius: 999px;
    background: var(--app-accent-soft);
    color: var(--app-accent);
    font-size: 12px;
    font-style: normal;
    font-weight: 700;
}

.attendance-class-chip.is-now em {
    background: #2e7d55;
    color: #ffffff;
}

.attendance-chip-status {
    border: 1px solid transparent;
}

.attendance-chip-status.is-pending {
    background: #eef2ff;
    color: #2a4f8f;
    border-color: #d4def7;
}

.attendance-chip-status.is-done {
    background: #e9f8ef;
    color: #1f7a49;
    border-color: #c9e9d7;
}

.attendance-chip-status.is-no-class {
    background: #fff5e8;
    color: #9a640d;
    border-color: #f2ddbb;
}

.attendance-chip-status.is-now {
    background: #1f7a49;
    color: #ffffff;
    border-color: transparent;
}

.attendance-fast-form {
    display: grid;
    gap: 14px;
}

.attendance-offline-notice {
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid transparent;
    font-weight: 700;
    font-size: 13px;
}

.attendance-offline-notice.is-offline {
    background: #fff4e5;
    border-color: #f2d2a3;
    color: #7e4a00;
}

.attendance-offline-notice.is-syncing {
    background: #e9f3ff;
    border-color: #c3daf9;
    color: #1c4f88;
}

.attendance-offline-notice.is-ready {
    background: #e9f8ef;
    border-color: #c9e9d7;
    color: #1f7a49;
}

.attendance-commandbar {
    position: sticky;
    top: 10px;
    z-index: 5;
    padding: 16px 18px;
    background: var(--app-surface);
    border: 1px solid var(--app-border);
    border-radius: 6px;
    box-shadow: 0 10px 26px rgba(22, 41, 64, 0.08);
}

.attendance-commandbar p {
    margin: 4px 0 0;
    color: var(--app-muted);
}

.attendance-command-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 10px;
}

.attendance-command-actions .button-primary,
.attendance-command-actions .button-secondary,
.attendance-continuous-slots .button-secondary {
    min-height: 36px;
    padding: 7px 12px;
    border-radius: 9px;
}

.attendance-no-class-toggle {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 42px;
    padding: 0 12px;
    border: 1px solid var(--app-border);
    border-radius: 6px;
    background: var(--app-surface-soft);
    font-weight: 700;
}

.attendance-no-class-toggle input {
    width: 18px;
    height: 18px;
}

.attendance-no-class-panel {
    display: grid;
    grid-template-columns: minmax(220px, 320px) 1fr;
    gap: 12px;
    padding: 14px;
    background: var(--app-warning-soft);
    border: 1px solid rgba(180, 123, 36, 0.24);
    border-radius: 6px;
}

.attendance-continuous-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 12px 14px;
    background: #eef7f2;
    border: 1px solid rgba(46, 125, 85, 0.22);
    border-radius: 6px;
}

.attendance-continuous-banner strong,
.attendance-continuous-banner span {
    display: block;
}

.attendance-continuous-banner span {
    margin-top: 3px;
    color: var(--app-muted);
}

.attendance-continuous-slots {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 6px;
}

.attendance-continuous-slots span {
    margin: 0;
    padding: 5px 8px;
    border: 1px solid rgba(46, 125, 85, 0.22);
    border-radius: 999px;
    background: #ffffff;
    color: #2e7d55;
    font-size: 12px;
    font-weight: 700;
}

.attendance-continuous-slots .is-current {
    background: #2e7d55;
    color: #ffffff;
}

.attendance-docente-field {
    max-width: 360px;
}

.attendance-roster-head {
    padding: 12px 14px;
    background: #f8fbfd;
    border: 1px solid var(--app-border);
    border-radius: 6px;
}

.attendance-roster-head p {
    margin: 4px 0 0;
    color: var(--app-muted);
}

.attendance-legend {
    display: grid;
    grid-template-columns: repeat(4, auto auto);
    align-items: center;
    gap: 6px 8px;
    color: var(--app-muted);
    font-size: 12px;
}

.attendance-mini-state {
    width: 24px;
    height: 24px;
    display: inline-grid;
    place-items: center;
    border-radius: 50%;
    color: #ffffff;
    font-weight: 800;
    font-size: 12px;
}

.attendance-roster {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

.attendance-student-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
    padding: 12px;
    background: var(--app-surface);
    border: 1px solid var(--app-border);
    border-radius: 6px;
}

.attendance-student-main {
    min-width: 0;
}

.attendance-student-main strong,
.attendance-student-main small {
    display: block;
    overflow-wrap: anywhere;
}

.attendance-student-main strong {
    font-size: 15px;
}

.attendance-student-main small {
    margin-top: 3px;
    color: var(--app-muted);
    font-size: 12px;
}

.attendance-state-options {
    display: grid;
    grid-template-columns: repeat(4, minmax(84px, 1fr));
    gap: 6px;
}

.attendance-state-option {
    cursor: pointer;
}

.attendance-state-option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.attendance-state-option span {
    min-height: 34px;
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 8px;
    border: 1px solid transparent;
    border-radius: 9px;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.1;
    white-space: nowrap;
}

.attendance-state-option input:focus-visible + span {
    outline: 3px solid rgba(36, 76, 120, 0.22);
    outline-offset: 2px;
}

.attendance-state-option input:not(:checked) + span {
    opacity: 1;
    filter: none;
}

.attendance-state-option input:checked + span {
    box-shadow: 0 0 0 2px rgba(36, 76, 120, 0.2);
}

.attendance-state-presente span {
    background: #e9f8ef;
    color: #1f7a49;
    border-color: #cae9d8;
}

.attendance-state-ausente span {
    background: #ffebee;
    color: #a53b44;
    border-color: #f4c8cf;
}

.attendance-state-tarde span {
    background: #fff5e8;
    color: #9a640d;
    border-color: #f0dcb9;
}

.attendance-state-justificado span {
    background: #ebf2ff;
    color: #355e9b;
    border-color: #d2dff7;
}

.attendance-mini-state-presente {
    background: #2e7d55;
}

.attendance-mini-state-ausente {
    background: #b13f3f;
}

.attendance-mini-state-tarde {
    background: #b87925;
}

.attendance-mini-state-justificado {
    background: #476b9e;
}

.attendance-state-presente input:checked + span {
    background: #1f7a49;
    color: #ffffff;
    border-color: #1f7a49;
}

.attendance-state-ausente input:checked + span {
    background: #a53b44;
    color: #ffffff;
    border-color: #a53b44;
}

.attendance-state-tarde input:checked + span {
    background: #9a640d;
    color: #ffffff;
    border-color: #9a640d;
}

.attendance-state-justificado input:checked + span {
    background: #355e9b;
    color: #ffffff;
    border-color: #355e9b;
}

.attendance-quick-note {
    grid-column: 1 / -1;
    width: 100%;
    min-height: 36px;
    padding: 8px 10px;
    border: 1px solid var(--app-border);
    border-radius: 6px;
}

.attendance-material-check {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 36px;
    padding: 8px 10px;
    border: 1px solid var(--app-border);
    border-radius: 8px;
    background: #ffffff;
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--app-muted);
}

.attendance-material-check input {
    width: auto;
}

.attendance-material-switch {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.attendance-material-switch input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.material-switch-track {
    position: relative;
    display: inline-grid;
    grid-template-columns: 1fr 1fr;
    min-width: 146px;
    min-height: 34px;
    padding: 3px;
    border: 1px solid var(--app-border);
    border-radius: 999px;
    background: #f4f7fb;
    overflow: hidden;
}

.material-switch-track::before {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: calc(50% - 3px);
    height: calc(100% - 6px);
    border-radius: 999px;
    background: #1f7a49;
    transition: transform 0.16s ease, background-color 0.16s ease;
}

.attendance-material-switch input:checked + .material-switch-track::before {
    transform: translateX(100%);
    background: #a53b44;
}

.material-switch-option {
    position: relative;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    color: #5b6d84;
    user-select: none;
}

.attendance-material-switch input:not(:checked) + .material-switch-track .is-yes {
    color: #ffffff;
}

.attendance-material-switch input:checked + .material-switch-track .is-no {
    color: #ffffff;
}

.attendance-extra-area {
    display: grid;
    gap: 10px;
    margin-top: 8px;
}

.attendance-extra-panel {
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
    border: 1px solid #d7e2ee;
    border-radius: 10px;
    box-shadow: 0 6px 14px rgba(15, 23, 42, 0.06);
}

.attendance-extra-panel summary {
    cursor: pointer;
    padding: 13px 14px;
    font-weight: 800;
    color: #0f2a44;
}

.attendance-extra-panel[open] {
    padding-bottom: 14px;
}

.attendance-extra-panel[open] > :not(summary) {
    margin: 0 14px 12px;
}

.attendance-extra-panel label {
    display: grid;
    gap: 8px;
    font-weight: 600;
    color: #23384f;
}

.attendance-extra-panel input[type="text"],
.attendance-extra-panel input[type="date"],
.attendance-extra-panel select,
.attendance-extra-panel textarea {
    width: 100%;
    min-height: 42px;
    padding: 10px 12px;
    border: 1px solid #c8d5e3;
    border-radius: 8px;
    background: #ffffff;
    color: #162235;
    font: inherit;
    line-height: 1.35;
}

.attendance-extra-panel textarea {
    min-height: 96px;
    resize: vertical;
}

.attendance-extra-panel input:focus,
.attendance-extra-panel select:focus,
.attendance-extra-panel textarea:focus {
    outline: none;
    border-color: var(--app-sky);
    box-shadow: 0 0 0 4px rgba(54, 163, 217, 0.14);
}

.attendance-student-note {
    display: grid;
    gap: 10px;
    padding: 12px;
    background: var(--app-surface-soft);
    border: 1px solid var(--app-border);
    border-radius: 6px;
}

.attendance-extra-panel .context-actions {
    margin-top: 8px;
}

.attendance-savebar {
    position: sticky;
    bottom: 0;
    z-index: 4;
    justify-content: flex-end;
    padding: 12px 0 0;
    background: linear-gradient(180deg, rgba(245, 247, 250, 0), var(--app-bg) 36%);
}

.attendance-savebar .button-primary {
    min-height: 38px;
    padding: 8px 14px;
    border-radius: 9px;
}

.attendance-empty-state {
    min-height: 220px;
    display: grid;
    align-content: center;
}

.attendance-form-is-no-class [data-attendance-active-section] {
    display: none;
}

.attendance-fast-form:not(.attendance-form-is-no-class) .attendance-no-class-panel {
    display: none;
}

/* Compact app-like refinement layer */
:root {
    --app-shell-gap: 10px;
}

body {
    font-size: 14px;
}

.app-sidebar {
    width: 248px;
    padding: 16px 12px;
    gap: 16px;
}

.app-brand {
    min-height: 52px;
    padding: 6px;
    gap: 10px;
}

.app-brand strong {
    font-size: 14px;
    font-weight: 700;
}

.app-brand span {
    margin-top: 2px;
    font-size: 11px;
    letter-spacing: 0.01em;
}

.app-brand-mark,
.app-brand-logo,
.auth-mark,
.auth-logo {
    width: 34px;
    height: 34px;
}

.app-sidebar .app-nav {
    max-height: calc(100vh - 160px);
}

.app-nav {
    gap: 6px;
}

.app-nav a,
.sidebar-logout {
    min-height: 36px;
    padding: 7px 9px;
    gap: 8px;
    font-size: 12.5px;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.nav-icon {
    width: 22px;
    height: 22px;
    border-radius: 6px;
}

.nav-icon .icon-svg {
    width: 12px;
    height: 12px;
}

.sidebar-context {
    margin-bottom: 10px;
    padding: 10px;
}

.sidebar-context-label {
    font-size: 10px;
}

.sidebar-context span {
    font-size: 11px;
}

.app-main {
    padding: 16px;
}

.app-header {
    min-height: 60px;
    margin-bottom: 14px;
}

.eyebrow {
    margin-bottom: 4px;
    font-size: 10px;
}

.header-title {
    font-size: 21px;
}

.header-context {
    font-size: 12.5px;
}

.header-user {
    min-width: 200px;
    padding: 8px 10px;
    gap: 9px;
}

.header-user strong {
    font-size: 13px;
}

.header-user span {
    font-size: 11px;
}

.user-avatar {
    width: 30px;
    height: 30px;
    font-size: 12px;
}

.app-content {
    padding: 16px;
}

.card,
.stat-card,
.banner,
.auth-box {
    border-radius: 7px;
}

.card,
.stat-card {
    padding: 14px;
}

.table th,
.table td {
    padding: 9px 7px;
}

.button-primary,
.button-secondary,
.tab-button,
.auth-box button {
    min-height: 34px;
    padding: 7px 12px;
    border-radius: 7px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.01em;
}

.icon-action-button {
    width: 32px;
    height: 32px;
}

.icon-action-button .icon-svg {
    width: 14px;
    height: 14px;
}

.stack-form input,
.stack-form select,
.stack-form textarea,
.inline-filter-form select,
.auth-box input {
    min-height: 36px;
    padding: 8px 10px;
    font-size: 13px;
}

.table-pill {
    padding: 5px 8px;
    font-size: 10.5px;
}

@media (max-width: 800px) {
    .attendance-daybar,
    .attendance-commandbar,
    .attendance-roster-head {
        align-items: stretch;
        flex-direction: column;
    }

    .attendance-date-form,
    .attendance-command-actions {
        width: 100%;
    }

    .attendance-date-form input,
    .attendance-command-actions .button-primary {
        flex: 1;
    }

    .attendance-no-class-panel {
        grid-template-columns: 1fr;
    }

    .attendance-continuous-banner {
        align-items: stretch;
        flex-direction: column;
    }

    .attendance-continuous-slots {
        justify-content: flex-start;
    }

    .attendance-legend {
        grid-template-columns: repeat(2, auto auto);
        align-self: start;
    }

    .attendance-roster {
        grid-template-columns: 1fr;
    }

    .attendance-student-card {
        grid-template-columns: 1fr;
    }

    .attendance-state-options {
        grid-template-columns: repeat(4, minmax(42px, 1fr));
    }

    .attendance-state-option span {
        width: 100%;
    }
}

/* UX/UI refinement layer: consistency, readability and focus */
:root {
    --ui-focus-ring: 0 0 0 3px rgba(23, 63, 144, 0.18);
}

.app-nav a,
.button-primary,
.button-secondary,
.tab-button,
.icon-action-button,
.attendance-class-chip,
.attendance-state-option span {
    transition: background-color 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease, transform 0.12s ease;
}

.app-nav a {
    position: relative;
}

.app-nav a.is-active::before {
    content: "";
    position: absolute;
    left: -8px;
    top: 8px;
    bottom: 8px;
    width: 3px;
    border-radius: 999px;
    background: #1a4297;
}

.app-content {
    box-shadow: 0 8px 24px rgba(17, 40, 61, 0.06);
}

.card-link.card-feature:hover {
    border-color: #c6d6eb;
    background: #fbfdff;
}

.table th {
    position: sticky;
    top: 0;
    z-index: 1;
}

.table tbody tr:nth-child(even) {
    background: #fbfcfe;
}

.button-primary:hover,
.button-secondary:hover,
.tab-button:hover,
.icon-action-button:hover {
    transform: translateY(-1px);
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
.attendance-state-option input:focus-visible + span {
    outline: none;
    box-shadow: var(--ui-focus-ring);
}

.context-actions {
    gap: 8px;
}

.header-title {
    letter-spacing: 0;
}

/* Data-dense tables refinement */
.table-wrap {
    border-radius: 12px;
}

.table {
    font-size: 13px;
}

.table th,
.table td {
    padding: 8px 8px;
}

.table th {
    font-size: 11px;
    letter-spacing: 0.02em;
}

/* Docente: acciones rápidas consistentes (sobrescribe capas previas) */
.docente-workflow-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.docente-workflow-actions a.button-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 136px;
}

.docente-workflow-actions a.button-secondary.is-active {
    background: linear-gradient(180deg, #1767a8 0%, #0f4778 100%) !important;
    border-color: #0f4778 !important;
    color: #ffffff !important;
    box-shadow: 0 10px 22px rgba(23, 103, 168, 0.2) !important;
}

.table td {
    line-height: 1.35;
}

.table td .cell-subtext {
    margin-top: 2px;
    font-size: 11px;
}

.table-pill {
    min-height: 22px;
    padding: 3px 8px;
    font-size: 10px;
}

.table-actions {
    gap: 5px;
}

.table-compact th,
.table-compact td {
    padding-top: 7px;
    padding-bottom: 7px;
}

.calif-input-number {
    min-width: 76px;
    width: 76px;
    text-align: center;
}

@media (max-width: 800px) {
    .table {
        font-size: 12px;
    }

    .table th,
    .table td {
        padding: 8px 6px;
    }
}

/* Form UX refinement */
.stack-form {
    gap: 12px;
}

.stack-form label,
.inline-filter-form label {
    font-weight: 600;
    color: #23384f;
}

.stack-form input,
.stack-form select,
.stack-form textarea,
.inline-filter-form select,
.auth-box input {
    background: #ffffff;
    border-color: #c8d5e3;
}

.stack-form input::placeholder,
.stack-form textarea::placeholder {
    color: #7c8ea3;
}

.stack-form textarea {
    resize: vertical;
    min-height: 78px;
    line-height: 1.35;
}

.field-help,
.empty-note,
.cell-subtext {
    color: #6a7f96;
}

.section-head {
    margin-bottom: 12px;
}

.section-head h2,
.section-head h3 {
    color: #132f4d;
}

.button-primary,
.button-secondary {
    white-space: nowrap;
}

/* Entry dashboard refresh */
.dashboard-entry-hero {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 10px;
    padding: 14px 16px;
    border: 1px solid #d5e0ec;
    border-radius: 12px;
    background: linear-gradient(180deg, #ffffff 0%, #f6f9fd 100%);
}

.dashboard-entry-hero h2 {
    margin: 0;
    color: #122c47;
    font-size: 22px;
}

.dashboard-entry-hero p {
    margin: 6px 0 0;
    color: #5f7288;
}

.dashboard-entry-hero-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.dashboard-quick-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 8px;
}

.dashboard-quick-grid .button-secondary {
    width: 100%;
    justify-content: center;
}

.dashboard-kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 10px;
}

.dashboard-kpi-grid .section-card h3 {
    margin: 0;
    font-size: 14px;
    color: #48617d;
    font-weight: 700;
}

.dashboard-kpi-value {
    margin: 6px 0 2px;
    font-size: 32px;
    line-height: 1;
    font-weight: 800;
    color: #102b48;
}

.dashboard-entry-hero .eyebrow,
.dashboard-entry-hero h2,
.dashboard-entry-hero p,
.dashboard-kpi-grid h3,
.dashboard-kpi-value,
.dashboard-quick-grid .button-secondary {
    letter-spacing: 0;
}

.dashboard-top-stats .stat-card {
    min-height: 108px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: flex-start;
    text-align: left;
    gap: 8px;
    padding: 14px 15px;
    border: 0;
    box-shadow: 0 1px 0 #dbe4ef, 0 8px 20px rgba(16, 43, 72, 0.04);
}

.dashboard-top-stat-head {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.dashboard-top-stats .dashboard-top-stat-title {
    font-size: 11px;
    line-height: 1.2;
    font-weight: 600;
    color: #5a6f88;
    letter-spacing: 0;
}

.dashboard-top-stats .stat-icon {
    width: 20px;
    height: 20px;
    margin: 0;
    border-radius: 0;
    background: transparent;
    color: #35597f;
}

.dashboard-top-stats .stat-card strong {
    font-size: 34px;
    line-height: 1;
    font-weight: 650;
    margin: 0;
    color: #16385f;
}

.dashboard-entry-hero h2,
.dashboard-kpi-grid .section-card h3,
.section-card h2 {
    font-family: inherit;
    font-weight: 650;
}

.dashboard-entry-hero h2 {
    font-size: 18px;
    font-weight: 700;
}

.dashboard-entry-hero p {
    font-size: 14px;
    line-height: 1.35;
}

.dashboard-entry-hero .eyebrow {
    font-size: 11px;
    font-weight: 700;
}

.dashboard-kpi-grid .section-card h3 {
    font-size: 13px;
    font-weight: 600;
}

.dashboard-kpi-value {
    font-size: 30px;
    font-weight: 700;
}

.dashboard-kpi-grid .section-card {
    padding: 12px 14px;
}

.dashboard-kpi-grid .cell-subtext {
    font-size: 12px;
}

.dashboard-quick-grid {
    gap: 7px;
}

.dashboard-quick-grid .button-secondary {
    min-height: 34px;
}

.dashboard-top-stats {
    margin-bottom: 10px;
}

.dashboard-top-stats .stat-card {
    min-height: 100px;
    padding: 12px;
}

.dashboard-top-stats .stat-card strong {
    font-size: 34px;
}

.table .td-number {
    text-align: right;
}

.table .td-number .table-pill,
.table .td-number .metric-pill {
    margin-left: auto;
}

.metric-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 70px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
}

.metric-pill.is-good {
    background: #e8f7ef;
    color: #1f7a49;
}

.metric-pill.is-mid {
    background: #fff5e5;
    color: #9a640d;
}

.metric-pill.is-low {
    background: #ffebee;
    color: #a63b45;
}

@media (max-width: 800px) {
    .dashboard-kpi-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .dashboard-entry-hero {
        flex-direction: column;
        align-items: stretch;
    }

    .dashboard-entry-hero-actions {
        justify-content: flex-start;
    }
}

/* Reference-inspired professional app skin */
:root {
    --app-bg: #f4f7fa;
    --app-surface: #ffffff;
    --app-surface-soft: #f7f9fc;
    --app-border: #dbe3ec;
    --app-border-strong: #c6d2df;
    --app-text: #11283d;
    --app-muted: #5f7186;
    --app-accent: #173f90;
    --app-accent-soft: #eaf0ff;
    --app-accent-strong: #0f2f73;
    --app-shadow-soft: 0 6px 18px rgba(17, 40, 61, 0.05);
}

body {
    background: linear-gradient(180deg, #f7f9fc 0%, #f2f5f9 100%);
    color: var(--app-text);
}

.app-shell {
    background: transparent;
}

.app-sidebar {
    width: 286px;
    background: #f8fafd;
    color: var(--app-text);
    border-right: 1px solid var(--app-border);
    box-shadow: none;
}

.app-brand {
    border: 1px solid var(--app-border);
    background: #ffffff;
}

.app-brand strong {
    color: #163559;
}

.app-brand span {
    color: var(--app-muted);
}

.app-nav {
    gap: 5px;
}

.app-nav a {
    min-height: 40px;
    padding: 8px 10px;
    color: #314964;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 600;
}

.app-nav a:hover {
    background: #eef3fb;
    border-color: #d5e0f0;
    color: #1d3656;
    transform: none;
}

.app-nav a.is-active {
    background: linear-gradient(180deg, #1a4297 0%, #163a88 100%);
    border-color: transparent;
    color: #ffffff;
    box-shadow: 0 8px 18px rgba(23, 63, 144, 0.24);
}

.nav-icon {
    width: 24px;
    height: 24px;
    border-radius: 8px;
    background: #edf3fb;
    color: #3a5474;
}

.nav-icon--panel { background: #eaf1ff; color: #244ea6; }
.nav-icon--perfil { background: #eef6ff; color: #2f6fb1; }
.nav-icon--cursos { background: #eef7ff; color: #2563eb; }
.nav-icon--espacios { background: #effcf5; color: #15803d; }
.nav-icon--horarios { background: #f5f3ff; color: #7c3aed; }
.nav-icon--alumnos { background: #fff7ed; color: #ea580c; }
.nav-icon--docentes { background: #f0fdfa; color: #0f766e; }
.nav-icon--asistencias { background: #ecfeff; color: #0891b2; }
.nav-icon--calificaciones { background: #fff1f2; color: #e11d48; }
.nav-icon--reportes { background: #eff6ff; color: #1d4ed8; }
.nav-icon--correcciones { background: #fff7ed; color: #c2410c; }
.nav-icon--tickets { background: #fefce8; color: #a16207; }
.nav-icon--evolucion { background: #f0fdf4; color: #16a34a; }
.nav-icon--ia { background: #faf5ff; color: #9333ea; }
.nav-icon--entidades { background: #ecfdf5; color: #047857; }
.nav-icon--usuarios { background: #f8fafc; color: #475569; }
.nav-icon--configuracion { background: #f1f5f9; color: #334155; }

.app-nav a.is-active .nav-icon {
    background: rgba(255, 255, 255, 0.18);
    color: #ffffff;
}

.app-nav-group > summary {
    color: #314964;
    border: 1px solid transparent;
}

.app-nav-group > summary:hover {
    background: #eef3fb;
    border-color: #d5e0f0;
    color: #1d3656;
}

.app-nav-group-links a {
    color: #3d5672;
    background: #ffffff;
    border: 1px solid #dde6f0;
}

.app-nav-group-links a:hover {
    background: #f2f7ff;
    border-color: #c8d8ec;
    color: #1d3656;
}

.app-nav-group-links a.is-active {
    background: linear-gradient(180deg, #1a4297 0%, #163a88 100%);
    border-color: transparent;
    color: #ffffff;
}

.sidebar-context {
    border-color: var(--app-border);
    background: #ffffff;
}

.sidebar-context-label {
    color: #62758d;
}

.sidebar-context span {
    color: var(--app-muted);
}

.sidebar-logout {
    background: #ffffff;
    border: 1px solid var(--app-border);
    color: #314964;
}

.app-main {
    padding: 18px;
}

.app-header {
    margin-bottom: 16px;
}

.header-title {
    font-size: 20px;
    color: #0f2740;
}

.header-user {
    background: #ffffff;
    border-color: var(--app-border);
    box-shadow: none;
}

.app-content {
    background: #ffffff;
    border-color: var(--app-border);
    border-radius: 14px;
    box-shadow: var(--app-shadow-soft);
}

.card,
.stat-card,
.banner,
.auth-box,
.attendance-student-card,
.attendance-class-item,
.attendance-daybar,
.attendance-commandbar,
.attendance-roster-head,
.attendance-extra-panel,
.logo-preview-card {
    border-radius: 14px;
    border-color: var(--app-border);
    box-shadow: none;
}

.stats-grid,
.card-grid {
    gap: 12px;
}

.card,
.stat-card {
    padding: 16px;
}

.card h2 {
    font-size: 16px;
    color: #385573;
}

.stat-card strong {
    font-size: 40px;
    line-height: 1;
    letter-spacing: -0.02em;
    color: #0c2542;
}

.card-icon,
.stat-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    margin-bottom: 10px;
}

.table-wrap {
    border: 1px solid var(--app-border);
    border-radius: 14px;
    background: #ffffff;
}

.table th {
    padding: 11px 10px;
    background: #f8fbff;
    color: #617792;
}

.table td {
    padding: 11px 10px;
}

.table tbody tr:hover {
    background: #f7fbff;
}

.table-pill {
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 10.5px;
    font-weight: 700;
}

.button-primary,
.button-secondary,
.tab-button {
    min-height: 36px;
    padding: 7px 12px;
    border-radius: 10px;
    font-size: 12px;
}

.button-primary,
.tab-button.is-active {
    background: linear-gradient(180deg, #1a4297 0%, #163a88 100%);
    box-shadow: 0 8px 18px rgba(23, 63, 144, 0.2);
}

.button-secondary {
    border-color: var(--app-border-strong);
    background: #ffffff;
}

.table-actions {
    gap: 6px;
}

.icon-action-button {
    width: 30px;
    height: 30px;
    border-radius: 10px;
    border-color: #d2dbe7;
    box-shadow: none;
}

.icon-action-button .icon-svg {
    width: 13px;
    height: 13px;
}

.icon-action-button:hover {
    border-color: #98b3d1;
    background: #f2f7ff;
}

@media (max-width: 800px) {
    body.sidebar-open {
        overflow: hidden;
    }

    .desktop-sidebar-toggle {
        display: none !important;
    }

    .app-sidebar {
        position: fixed;
        z-index: 30;
        top: 0;
        left: 0;
        height: 100vh;
        width: min(84vw, 320px);
        border-right: 1px solid var(--app-border);
        border-bottom: 0;
        transform: translateX(-100%);
        transition: transform 0.2s ease;
    }

    body.sidebar-open .app-sidebar {
        transform: translateX(0);
    }

    .mobile-menu-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 20;
        border: 0;
        background: rgba(14, 25, 38, 0.38);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.2s ease;
    }

    body.sidebar-open .mobile-menu-backdrop {
        opacity: 1;
        pointer-events: auto;
    }

    .mobile-menu-toggle {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        min-height: 34px;
        padding: 6px 10px;
        border: 1px solid var(--app-border);
        border-radius: 9px;
        background: #ffffff;
        color: #203d60;
        font: inherit;
        font-weight: 700;
        cursor: pointer;
    }

    .mobile-menu-close {
        display: inline-flex;
        align-self: flex-end;
        align-items: center;
        justify-content: center;
        width: 32px;
        height: 32px;
        padding: 0;
        border: 1px solid var(--app-border);
        border-radius: 9px;
        background: #ffffff;
        color: #203d60;
        cursor: pointer;
    }

    .mobile-menu-close .icon-svg {
        width: 14px;
        height: 14px;
    }

    .mobile-menu-toggle .nav-icon {
        width: 20px;
        height: 20px;
    }

    .mobile-menu-toggle .nav-icon .icon-svg {
        width: 12px;
        height: 12px;
    }
}

/* === Global UI Coherence Pass (May 2026) === */
:root {
    --ui-radius-sm: 8px;
    --ui-radius-md: 10px;
    --ui-radius-lg: 12px;
    --ui-control-h: 40px;
    --ui-focus-ring: 0 0 0 3px rgba(31, 79, 151, 0.16);
}

.app-content {
    border-radius: var(--ui-radius-lg);
    padding: 24px;
}

.card,
.stat-card,
.banner,
.section-card {
    border-radius: var(--ui-radius-md);
}

.section-card h2,
.card h2 {
    letter-spacing: 0;
}

.hero-panel {
    border-radius: var(--ui-radius-md);
}

.inline-filter-form {
    gap: 10px;
    align-items: end;
}

.inline-filter-form label {
    font-size: 12px;
    color: #29486f;
    font-weight: 600;
}

.stack-form input,
.stack-form select,
.stack-form textarea,
.inline-filter-form select,
.inline-filter-form input,
.auth-box input,
select,
input[type="text"],
input[type="email"],
input[type="date"],
input[type="number"],
textarea {
    min-height: var(--ui-control-h);
    border-radius: var(--ui-radius-sm);
    border: 1px solid #c9d5e5;
    background: #fcfdff;
    color: #203a5d;
    font-size: 14px;
    letter-spacing: 0;
}

.stack-form textarea,
textarea {
    min-height: 90px;
}

.stack-form input:focus,
.stack-form select:focus,
.stack-form textarea:focus,
.inline-filter-form input:focus,
.inline-filter-form select:focus,
.auth-box input:focus,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: none;
    border-color: #2b62ad;
    box-shadow: var(--ui-focus-ring);
}

.button-primary,
.button-secondary,
.tab-button {
    min-height: var(--ui-control-h);
    border-radius: var(--ui-radius-sm);
    font-weight: 700;
    letter-spacing: 0;
    transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease, transform .12s ease;
}

.button-primary:hover,
.button-secondary:hover,
.tab-button:hover {
    transform: translateY(-1px);
}

.button-primary:focus-visible,
.button-secondary:focus-visible,
.tab-button:focus-visible {
    outline: none;
    box-shadow: var(--ui-focus-ring);
}

.tabs-header {
    gap: 8px;
}

.tab-button {
    border: 1px solid #c6d4e7;
    background: #fff;
    color: #21446f;
}

.tab-button.is-active {
    border-color: #1f4f97;
}

.table-wrap {
    border-radius: var(--ui-radius-sm);
    overflow: auto;
}

.table {
    border-collapse: separate;
    border-spacing: 0;
}

.table th {
    background: #f2f6fb;
    color: #3d5c81;
    font-size: 12px;
    letter-spacing: 0;
}

.table td {
    font-size: 14px;
}

.table tbody tr:hover {
    background: #f7faff;
}

.table-pill {
    border-radius: 999px;
    font-weight: 700;
    font-size: 12px;
}

.table-actions {
    gap: 8px;
}

.icon-action-button {
    width: 32px;
    height: 32px;
    border-radius: var(--ui-radius-sm);
}

.banner-success,
.banner-error {
    border-radius: var(--ui-radius-sm);
}

/* Final mobile header override to beat earlier layered rules */
@media (max-width: 800px) {
    .app-header {
        display: grid;
        grid-template-columns: 1fr auto;
        grid-template-areas:
            "menu user"
            "main main";
        align-items: start;
        gap: 8px;
        margin-bottom: 12px;
    }

    .mobile-menu-toggle {
        grid-area: menu;
        width: fit-content;
        min-height: 40px;
        padding: 8px 12px;
    }

    .app-header-main {
        grid-area: main;
        gap: 6px;
        width: 100%;
    }

    .header-title {
        font-size: 19px;
        line-height: 1.1;
    }

    .header-context {
        margin-top: 4px;
        font-size: 12px;
        line-height: 1.35;
    }

    .header-context-exit {
        margin-top: 8px;
    }

    .header-context-exit .button-secondary {
        width: 100%;
        justify-content: center;
    }

    .header-academic-chip {
        max-width: none;
        width: 100%;
        padding: 8px 10px;
        gap: 8px;
    }

    .header-academic-chip img,
    .header-academic-fallback {
        width: 28px !important;
        height: 28px !important;
        min-width: 28px;
        min-height: 28px;
    }

    .header-academic-title,
    .header-academic-year {
        font-size: 11px;
        white-space: normal;
    }

    .header-user {
        grid-area: user;
        width: auto;
        min-width: 0;
        justify-self: end;
        align-self: start;
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .profile-switcher-trigger {
        width: min(100vw - 140px, 340px);
        max-width: 100%;
        justify-content: space-between;
        padding: 7px 8px;
    }

    .profile-switcher-summary {
        min-width: 0;
    }

    .profile-switcher-summary strong,
    .profile-switcher-summary span {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .profile-switcher-float {
        position: static;
        inset: auto;
        top: auto;
        right: auto;
        min-width: 0;
        width: 100%;
        max-width: none;
        margin-top: 0;
    }

    .profile-switcher-row {
        flex-direction: column;
        align-items: stretch;
    }

    .profile-switcher-select,
    .profile-switcher-row .button-secondary {
        width: 100%;
        min-width: 0;
    }

    .profile-switcher-form + .profile-switcher-form {
        margin-top: 8px;
    }

    .app-content {
        padding: 14px;
    }

    .header-user strong,
    .header-user span {
        font-size: 12px;
    }

    .header-user span {
        margin-top: 2px;
    }

    .app-footer {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        padding: 12px 14px;
    }

    .app-footer-brand-link {
        width: 100%;
        align-items: center;
        gap: 10px;
    }

    .app-footer-logo {
        width: 40px !important;
        height: 40px !important;
        max-width: 40px !important;
        max-height: 40px !important;
        padding: 4px;
        flex: 0 0 auto;
    }

    .app-footer-brand-text strong,
    .app-footer-meta strong {
        font-size: 13px;
    }

    .app-footer-brand-text span,
    .app-footer-meta span {
        font-size: 12px;
    }

    .app-footer-meta {
        width: 100%;
        text-align: left;
    }
}

@media (max-width: 420px) {
    .header-title {
        font-size: 18px;
    }

    .app-header {
        grid-template-columns: 1fr;
        grid-template-areas:
            "menu"
            "user"
            "main";
    }

    .header-academic-chip {
        grid-template-columns: 28px minmax(0, 1fr);
    }

    .header-user {
        justify-self: stretch;
        gap: 6px;
    }

    .profile-switcher-trigger {
        width: 100%;
        padding: 8px 9px;
    }

    .header-academic-title,
    .header-academic-year {
        font-size: 10px;
        line-height: 1.2;
    }

    .app-footer {
        padding: 10px 12px;
    }

    .app-footer-brand-link {
        gap: 8px;
    }

    .app-footer-logo {
        width: 34px !important;
        height: 34px !important;
        max-width: 34px !important;
        max-height: 34px !important;
    }
}
