:root {
    font-family: system-ui, sans-serif;
    color: #17352e;
    background: #f6f4ed;
    --ink: #17352e;
    --dark: #102e26;
    --edge: #deddd1;
    --muted: #556860;
    --paper: #fffdf8;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
a { color: #145c49; }
h1, h2, h3 { line-height: 1.3; }
h1 { margin-block: 0 .4rem; font-size: clamp(1.6rem, 3vw, 2.5rem); }
p { line-height: 1.7; }
.sidebar {
    background: var(--dark);
    color: #fffdf4;
    position: fixed;
    inset-block: 0;
    inset-inline-start: 0;
    width: 16rem;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.8rem;
}
.brand { display: flex; align-items: center; gap: .8rem; font-size: 1.4rem; font-weight: 750; }
.brand span { color: #eac783; font-size: 2rem; }
.brand small { display: block; opacity: .8; font-size: .8rem; }
.sidebar nav { display: grid; gap: .4rem; }
.sidebar a { color: inherit; text-decoration: none; padding: .8rem; border-radius: .6rem; }
.sidebar a[aria-current], .sidebar a:hover { background: #285244; }
.signout { margin-top: auto; }
.workspace { margin-inline-start: 16rem; padding: clamp(1rem, 4vw, 3rem); max-width: 95rem; }
.page-head { margin-block-end: 1.5rem; }
.page-head p { margin-block-start: 0; color: var(--muted); }
.panel, .card, fieldset {
    background: var(--paper);
    border: 1px solid var(--edge);
    border-radius: .9rem;
    padding: clamp(.9rem, 2.8vw, 1.5rem);
    margin-block-end: 1rem;
}
.auth { min-height: 100vh; display: grid; align-content: center; justify-items: center; padding: 1rem; background: #e5e8dd; }
.login { width: min(100%, 28rem); }
.login .brand { margin-bottom: 2rem; }
.login .brand span { color: #9b6821; }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr)); gap: 1rem; }
label { display: grid; gap: .4rem; margin-block-end: .8rem; font-weight: 650; }
input:not([type=checkbox]):not([type=radio]), select, textarea {
    font: inherit;
    color: inherit;
    width: 100%;
    min-height: 2.75rem;
    background: #fff;
    border: 1px solid #a7b3ab;
    border-radius: .5rem;
    padding: .55rem .7rem;
}
textarea { min-height: 7rem; }
.check { display: inline-flex; align-items: center; gap: .45rem; margin-inline-end: 1rem; }
button, .button, .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.75rem;
    padding: .55rem .9rem;
    border: 1px solid var(--edge);
    border-radius: .55rem;
    font: inherit;
    font-weight: 700;
    color: var(--ink);
    background: var(--paper);
    text-decoration: none;
    cursor: pointer;
}
.primary, .btn-primary { background: #17604b; color: white; border-color: #17604b; }
.danger { color: #902c22; }
:focus-visible { outline: 3px solid #bd7b1b; outline-offset: 3px; }
.notice, .errors { max-width: 65rem; padding: .85rem 1rem; border-radius: .6rem; background: #def0df; }
.errors { background: #ffe5dc; color: #761d17; }
table { border-collapse: collapse; width: 100%; background: var(--paper); }
td, th { padding: .75rem; border-bottom: 1px solid var(--edge); text-align: start; }
.table-wrap { overflow-x: auto; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; }
.actions form { margin: 0; }
@media (max-width: 760px) {
    .sidebar { position: static; width: auto; padding: .8rem 1rem; gap: .5rem; }
    .sidebar nav { display: flex; flex-wrap: wrap; }
    .workspace { margin-inline-start: 0; }
    .signout { margin: 0; }
}

.page-header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .8rem; margin-block-end: 1.5rem; }
.page-header p, .muted { color: var(--muted); }
.filters { display: flex; align-items: end; flex-wrap: wrap; gap: .8rem; }
.filters label { flex: 1 1 10rem; margin: 0; }
.field-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr)); gap: 1rem; }
.stack input:not([type=checkbox]), .stack select, .stack textarea { margin-block-end: .8rem; }
.checklist { display: flex; flex-wrap: wrap; gap: .5rem; }
.checklist .check { margin: 0; padding: .4rem .55rem; border: 1px solid var(--edge); border-radius: .45rem; }
.badge { display: inline-block; padding: .2rem .5rem; border-radius: 1rem; background: #e3eee7; font-size: .85rem; }
.inline { display: inline; }
summary { cursor: pointer; min-height: 2rem; }
details[open] > summary { margin-bottom: 1rem; }

.notification-label { display: none; }

@media (max-width: 600px) {
    .responsive-table table, .responsive-table tbody, .responsive-table tr { display: block; }
    .responsive-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
    .responsive-table tbody tr { border-block-end: 1px solid var(--edge); padding-block: .6rem; }
    .responsive-table tbody tr:last-child { border-block-end: 0; }
    .responsive-table td { display: block; padding: .25rem 0; border: 0; overflow-wrap: anywhere; }
    .lesson-table td:nth-child(2), .notification-history td:nth-child(2) { font-weight: 700; }
    .lesson-table td:nth-child(4), .lesson-table td:nth-child(5) { display: none; }
    .lesson-table td:nth-child(6) { display: flex; flex-wrap: wrap; gap: .4rem; }
    .notification-label { display: inline; color: var(--muted); margin-inline-end: .4rem; }
    .notification-history td:last-child form { margin-block-start: .3rem; }
    .notification-history td:last-child:empty { display: none; }
}

.lesson-nav { margin-block-end: 1rem; }
.ck-editor { margin-block-end: .8rem; }
.ck-editor .ck-content { min-height: 15rem; }
.ck-editor button { min-height: auto; }

#delete-category { max-width: min(34rem, calc(100% - 2rem)); margin: auto; }
#delete-category::backdrop { background: #102e2680; }

.select2-container { min-width: 0; }
.select2-container--default .select2-selection--single { min-height: 2.75rem; border-color: #a7b3ab; border-radius: .5rem; }
.select2-container--default .select2-selection--single .select2-selection__rendered { line-height: 2.65rem; color: var(--ink); }
.select2-container--default .select2-selection--single .select2-selection__arrow { height: 2.65rem; }
