:root {
    --navy: #0c3d67;
    --navy2: #082c4b;
    --blue: #1264a3;
    --gold: #e4b94f;
    --canvas: #f3f6f9;
    --line: #dfe6ed;
    --ink: #17263a;
    --muted: #6c7a8b
}

* {
    box-sizing: border-box
}

body {
    margin: 0;
    background: var(--canvas);
    color: var(--ink);
    font-family: Inter, "Segoe UI", Arial, sans-serif
}

.app-shell {
    min-height: 100vh
}

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 250px;
    padding: 24px 16px;
    color: #fff;
    background: linear-gradient(175deg, var(--navy), var(--navy2));
    display: flex;
    flex-direction: column;
    z-index: 30
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 10px 22px;
    border-bottom: 1px solid #ffffff20;
    color: white;
    text-decoration: none
}

.brand-mark {
    width: 42px;
    height: 42px;
    border: 2px solid var(--gold);
    border-radius: 12px;
    display: grid;
    place-items: center;
    color: var(--gold);
    font-size: 25px;
    font-weight: 800
}

.brand strong,
.brand small,
.sidebar-footer strong,
.sidebar-footer small {
    display: block
}

.brand strong {
    letter-spacing: .12em
}

.brand small,
.sidebar-footer small {
    color: #a9c4d7;
    font-size: 11px
}

.sidebar .nav {
    padding-right: 4px
}

.sidebar .nav-section {
    margin: 12px 8px 6px;
    padding: 8px 10px 4px;
    border-top: 1px solid rgba(255, 255, 255, .12);
    font-size: 10px;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: #a9c4d7;
    font-weight: 700
}

.sidebar .nav-section-admin {
    color: #f8d77a;
    border-top-color: rgba(248, 215, 122, .38);
    margin-top: 18px;
    padding-top: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    list-style: none;
    cursor: pointer;
}

.sidebar .nav-section-admin::-webkit-details-marker {
    display: none;
}

.sidebar .nav-section-group {
    margin: 0;
}

.sidebar .nav-section-group summary {
    list-style: none;
}

.sidebar .nav-subsection-group {
    margin: 4px 0 0 8px;
    padding-left: 6px;
    border-left: 1px solid rgba(248, 215, 122, .22);
}

.sidebar .nav-subsection-group summary {
    list-style: none;
    cursor: pointer;
}

.sidebar .nav-subsection-group .nav-link-subsection {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin: 0;
    padding: 8px 10px;
    border-radius: 8px 8px 8px 0;
    background: rgba(255, 255, 255, .03);
    border: 1px solid rgba(228, 185, 79, .1);
}

.sidebar .nav-link-child {
    margin: 4px 0 0 12px;
    padding: 7px 10px;
    border-left: 2px solid rgba(228, 185, 79, .28);
    font-size: 12.5px;
    color: #f7f3d2;
    background: rgba(255, 255, 255, .02);
    border-radius: 7px 0 0 7px;
    text-decoration: none;
    display: block;
}

.sidebar .nav-link-child:hover,
.sidebar .nav-link-child.active {
    background: rgba(228, 185, 79, .12);
    border-left-color: var(--gold);
    color: #fff;
    transform: none;
}

.sidebar .nav-caret {
    font-size: 12px;
    transition: transform .2s ease;
    color: #f8d77a;
}

.sidebar .nav-section-group[open] .nav-caret,
.sidebar .nav-subsection-group[open] .nav-caret {
    transform: rotate(180deg);
}

.sidebar .nav-link {
    color: #bdd1e0;
    padding: 12px 13px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    transition: .2s ease
}

.sidebar .nav-link-admin {
    background: rgba(228, 185, 79, .09);
    border: 1px solid rgba(228, 185, 79, .18);
    color: #fff4ce;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .02);
}

.sidebar .nav-link-admin:hover,
.sidebar .nav-link-admin.active {
    background: linear-gradient(90deg, rgba(228, 185, 79, .26), rgba(255, 255, 255, .09));
    color: #fff;
    transform: translateX(2px);
}

.sidebar .nav-link:hover,
.sidebar .nav-link.active {
    color: #fff;
    background: rgba(255, 255, 255, .12)
}

.sidebar .nav-link.active {
    box-shadow: inset 3px 0 var(--gold);
    background: linear-gradient(90deg, rgba(255, 255, 255, .18), rgba(255, 255, 255, .06))
}

.sidebar .nav-section+.nav-link {
    margin-top: 4px
}

.sidebar .nav-section:has(+ .nav-link) {
    color: #f5d78a;
}

.sidebar .nav-link[href$="#disciplinas"],
.sidebar .nav-link[href$="#disponibilidade"] {
    background: rgba(228, 185, 79, .12);
    border: 1px solid rgba(228, 185, 79, .24);
    font-weight: 700;
    color: #fff8df;
}

.sidebar .nav-link[href$="#disciplinas"]:hover,
.sidebar .nav-link[href$="#disponibilidade"]:hover,
.sidebar .nav-link[href$="#disciplinas"].active,
.sidebar .nav-link[href$="#disponibilidade"].active {
    background: linear-gradient(90deg, rgba(228, 185, 79, .22), rgba(255, 255, 255, .09));
    box-shadow: inset 3px 0 var(--gold);
}

.sidebar-footer {
    margin-top: auto;
    padding: 16px 9px 0;
    border-top: 1px solid #ffffff20;
    display: flex;
    gap: 10px;
    align-items: center;
    font-size: 12px
}

.avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--gold);
    color: #163551;
    font-weight: 800
}

.content {
    margin-left: 250px;
    padding: 0 32px 32px
}

.topbar {
    height: 82px;
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px
}

.topbar h1 {
    font-size: 21px;
    margin: 2px 0 0
}

.topbar small {
    font-size: 10px;
    letter-spacing: .1em
}

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

.topbar-semester-form {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #fff;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .7);
}

.topbar-semester-form label {
    white-space: nowrap;
    font-weight: 600;
}

.topbar-semester-select {
    min-width: 110px;
    max-width: 140px;
    height: 32px;
    padding: 0.25rem 2rem 0.25rem 0.8rem;
    border: 1px solid #dfe6ed;
    border-radius: 999px;
    background-color: #f8fafc;
    font-size: 12px;
    font-weight: 600;
    color: var(--ink);
    cursor: pointer;
}

.topbar-semester-select:focus {
    box-shadow: 0 0 0 0.2rem rgba(18, 100, 163, 0.12);
    border-color: rgba(18, 100, 163, 0.4);
}

.topbar-credit {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .02em;
    color: #697788;
    white-space: nowrap;
}

.topbar-logout {
    border-radius: 999px;
    min-width: 72px;
    font-weight: 600;
}

.page-head {
    display: flex;
    justify-content: space-between;
    align-items: end;
    gap: 20px;
    padding: 28px 0 20px
}

.page-head h2 {
    font-size: 30px;
    font-weight: 750;
    letter-spacing: -.03em;
    margin: 0
}

.page-head p {
    color: var(--muted);
    margin: 6px 0 0
}

.card-soft {
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: 0 5px 18px #1522360a
}

.stat-card {
    min-height: 118px
}

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

.stat-number {
    font-size: 31px;
    font-weight: 750
}

.stat-note {
    font-size: 10px;
    color: #8a96a4
}

.section-title {
    font-size: 17px;
    font-weight: 750
}

.badge-soft-blue {
    background: #e7f2fa;
    color: #145f97
}

.badge-soft-green {
    background: #e5f5ec;
    color: #147247
}

.badge-soft-yellow {
    background: #fff2d7;
    color: #8c5c0e
}

.badge-soft-red {
    background: #fde9e8;
    color: #a43630
}

.table>:not(caption)>*>* {
    padding: .85rem .9rem
}

.table thead th {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: #758395;
    background: #f8fafc
}

.table td {
    font-size: 12px
}

.filter-card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 14px
}

.audit-code {
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    font-weight: 700;
    color: var(--blue)
}

.empty {
    padding: 32px;
    text-align: center;
    color: var(--muted)
}

.admin-table-card {
    overflow: hidden;
}

.admin-matrix-table th {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: #708399;
    background: #f8fafc;
    border-bottom: 1px solid var(--line);
}

.admin-matrix-table td {
    vertical-align: middle;
    padding-top: 14px;
    padding-bottom: 14px;
}

.matrix-course-name {
    font-weight: 700;
    color: var(--ink);
}

.matrix-code-pill {
    display: inline-flex;
    align-items: center;
    padding: 5px 8px;
    border-radius: 999px;
    background: #eaf3ff;
    color: #0d5ea7;
    font-size: 11px;
    letter-spacing: .04em;
}

.matrix-name-cell {
    font-weight: 600;
    color: var(--ink);
}

.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 5px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .02em;
    border: 1px solid transparent;
}

.status-badge.atual,
.status-badge.atualizada {
    background: #e8f2ff;
    color: #145ca4;
    border-color: rgba(20, 92, 164, 0.18);
}

.status-badge.ativa,
.status-badge.ativada {
    background: #eafaf0;
    color: #167a46;
    border-color: rgba(22, 122, 70, 0.18);
}

.status-badge.inativa {
    background: #fff1f1;
    color: #a63d3d;
    border-color: rgba(166, 61, 61, 0.18);
}

.table-actions {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    justify-content: flex-end;
}

.admin-form-card {
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid var(--line);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.04);
}

.admin-form-header {
    background: linear-gradient(90deg, var(--navy), var(--blue));
    color: #fff;
    border-bottom: 0;
    padding: 1rem 1.25rem;
}

.admin-form-header h5 {
    font-weight: 700;
}

.matrix-card {
    border: 1px solid var(--line);
    border-radius: 14px;
    background: linear-gradient(180deg, #f8fbff 0%, #f5f7fb 100%);
    padding: 14px 14px 12px;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.03);
}

.matrix-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.matrix-header strong {
    font-size: 15px;
    color: var(--ink);
    display: block;
}

.matrix-code {
    font-size: 12px;
    color: var(--muted);
    margin-top: 4px;
}

.matrix-edit-btn {
    white-space: nowrap;
    border-radius: 999px;
    font-weight: 600;
}

.matrix-structure {
    margin-top: 14px;
}

.matrix-summary,
.syllabus-summary {
    list-style: none;
    cursor: pointer;
    user-select: none;
}

.matrix-summary::-webkit-details-marker,
.syllabus-summary::-webkit-details-marker {
    display: none;
}

.matrix-summary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #0b5ed7;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.02em;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(13, 110, 253, 0.08);
}

.matrix-summary::before,
.syllabus-summary::before {
    content: '▸';
    display: inline-block;
    transition: transform 0.2s ease;
    font-size: 12px;
}

.matrix-structure[open] .matrix-summary::before,
.syllabus-details[open] .syllabus-summary::before {
    transform: rotate(90deg);
}

.matrix-subjects {
    display: grid;
    gap: 10px;
    margin-top: 12px;
}

.subject-item {
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.72);
    padding: 10px 12px;
}

.subject-main {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.subject-name {
    font-weight: 700;
    color: var(--ink);
}

.subject-code {
    font-size: 12px;
    color: var(--muted);
    margin-top: 3px;
}

.syllabus-details {
    font-size: 12px;
    flex-shrink: 0;
}

.syllabus-summary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #0d6efd;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 999px;
    background: rgba(13, 110, 253, 0.06);
}

.syllabus-block {
    margin-top: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    background: #f6f9fc;
    border: 1px solid #e2e8f0;
    color: var(--muted);
    line-height: 1.5;
}

.empty-matrix {
    margin-top: 12px;
    font-size: 12px;
    color: var(--muted);
}

.admin-panel-stat {
    border-radius: 16px;
}

.admin-panel-card {
    border-radius: 16px;
}

.admin-panel-btn {
    border-radius: 10px;
    font-weight: 600;
    padding: 0.7rem 0.9rem;
}

@media(max-width:991px) {
    .sidebar {
        transform: translateX(-105%);
        transition: .2s
    }

    .sidebar.open {
        transform: translateX(0)
    }

    .content {
        margin-left: 0;
        padding: 0 16px 24px
    }

    .page-head {
        align-items: flex-start;
        flex-direction: column
    }

    .topbar {
        height: 72px
    }
}