:root {
    --green: #0a9f4e;
    --green-dark: #078040;
    --green-soft: #e8f7ef;
    --bg: #f4f6f5;
    --surface: #ffffff;
    --text: #1a1f1c;
    --text-muted: #5c6b62;
    --border: #e2e8e4;
    --danger: #d64545;
    --shadow: 0 4px 20px rgba(10, 30, 20, 0.06);
    --radius: 10px;
    --control-height: 36px;
    --control-radius: 8px;
    --space: 12px;
    --panel-padding: 16px;
    --header-height: 56px;
    --sidebar-w: 216px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    overflow: hidden;
}
body {
    font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100dvh;
    max-height: 100dvh;
    display: flex;
    flex-direction: column;
}


header {
    position: sticky;
    top: 0;
    z-index: 100;
    height: var(--header-height);
    flex-shrink: 0;
    background: linear-gradient(135deg, var(--green) 0%, var(--green-dark) 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.12);
}

#title {
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

header svg {
    cursor: pointer;
    transition: opacity 0.2s;
}
header svg:hover {
    opacity: 0.8;
}

#logout {
    width: 32px;
    height: 32px;
}


main {
    flex: 1;
    display: flex;
    min-height: 0;
    overflow: hidden;
}

#sidebar_left {
    width: var(--sidebar-w);
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 14px 10px;
    overflow-y: auto;
    flex-shrink: 0;
}


#content {
    flex: 1;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

#content > .page-header,
#content > .page-toolbar,
#content > .schedule-toolbar,
#content > .filters,
#content > .att-legend,
#content > .page-bar,
#content > .dash-subtitle {
    flex-shrink: 0;
}


#content > .table-wrap,
#content > .calendar-root,
#content > #calendar-root,
#content > .schedule-board,
#content > .att-work,
#content > .lessons-att-list,
#content > .scroll-panel,
#content > .dashboard-scroll,
#content > .entity-form-page,
#content > .form-page-scroll,
#content > .cur-editor {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
}

#sidebar_right {
    width: 260px;
    background: var(--surface);
    border-left: 1px solid var(--border);
    padding: 20px 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex-shrink: 0;
}


nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 8px;
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.15s ease;
}

nav a:hover {
    background: var(--green-soft);
    color: var(--green-dark);
}

nav a.active {
    background: var(--green);
    color: white;
}


.card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    padding: 20px;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space);
    flex-wrap: wrap;
    margin: 0;
}

.page-header h1 {
    font-size: 1.25rem;
    font-weight: 650;
    color: var(--text);
}


.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0;
    align-items: flex-end;
}

.filters label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    font-size: .78rem;
    color: var(--text-muted);
    font-weight: 500;
}

select,
    input:not([type]),
input[type="text"],
input[type="date"],
input[type="search"],
input[type="email"],
input[type="tel"],
input[type="password"],
input[type="number"],
input[type="time"],
input[type="url"],
textarea {
    padding: 7px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.95rem;
    background: var(--surface);
    color: var(--text);
    min-width: 0;
    max-width: 100%;
    height: var(--control-height);
    line-height: 1.25;
    transition: border-color 0.15s;
    box-sizing: border-box;
    font-family: inherit;
}

    select:not([multiple]) {
    appearance: none;
    -webkit-appearance: none;
    padding-right: 38px;
    background-image: linear-gradient(45deg, transparent 50%, var(--text-muted) 50%), linear-gradient(135deg, var(--text-muted) 50%, transparent 50%);
    background-position: calc(100% - 16px) center, calc(100% - 11px) center;
    background-size: 5px 5px, 5px 5px;
    background-repeat: no-repeat;
}

input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    box-sizing: border-box;
    width: 18px !important;
    min-width: 18px !important;
    max-width: 18px !important;
    height: 18px !important;
    margin: 0;
    padding: 0 !important;
    border: 1px solid #b9c7bf;
    border-radius: 5px;
    background: var(--surface);
    display: inline-grid;
    place-content: center;
    vertical-align: middle;
    cursor: pointer;
    flex: 0 0 18px;
}
input[type="checkbox"]::before { content:""; width:9px; height:5px; border-left:2px solid white; border-bottom:2px solid white; transform:rotate(-45deg) scale(0); margin-top:-2px; transition:transform .1s ease; }
input[type="checkbox"]:checked { background:var(--green); border-color:var(--green); }
input[type="checkbox"]:checked::before { transform:rotate(-45deg) scale(1); }
input[type="checkbox"]:focus-visible { outline:none; box-shadow:0 0 0 3px rgba(10,159,78,.16); }
    input:disabled, select:disabled, textarea:disabled { background-color:#eef2ef; color:#7b8981; cursor:not-allowed; opacity:1; }

textarea {
    height: auto;
    min-height: 80px;
    resize: vertical;
}

    select:focus, input:focus, textarea:focus {
    outline: none;
    border-color: var(--green);
    box-shadow: 0 0 0 3px rgba(10, 159, 78, 0.15);
}

button, .btn, .btn-secondary, .btn-danger, .btn-back {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 7px 12px;
    height: var(--control-height);
    flex-shrink: 0;
    border: 1px solid transparent;
    border-radius: var(--control-radius);
    font: inherit;
    font-size: .875rem;
    font-weight: 600;
    line-height: 1.2;
    text-decoration: none;
    cursor: pointer;
    transition: background .15s, border-color .15s, color .15s;
    background: var(--green);
    color: white;
}

    button:hover, .btn:hover {
    background: var(--green-dark);
}

.btn-secondary, .btn-back {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover, .btn-back:hover {
    background: var(--bg);
}


.table-wrap {
    overflow: auto;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--surface);
    box-shadow: var(--shadow);
}

table,
table.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92rem;
    table-layout: fixed;
}

col.col-actions,
th.col-actions,
td.col-actions {
    width: 172px;
    min-width: 0;
    text-align: right;
    white-space: nowrap;
}

thead {
    background: var(--green-soft);
}

th {
    text-align: left;
    padding: 9px 12px;
    font-weight: 600;
    color: var(--green-dark);
    white-space: nowrap;
}

td {
    padding: 9px 12px;
    border-top: 1px solid var(--border);
    color: var(--text);
}

    tr:hover td {
    background: #fafcfb;
}


.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
    margin-top: 8px;
}

.stat-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    transition: transform 0.15s, box-shadow 0.15s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 28px rgba(10, 30, 20, 0.1);
}

.stat-card .label {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.stat-card .value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--green);
}


.empty, .error, .loading {
    padding: 40px 20px;
    text-align: center;
    color: var(--text-muted);
    font-size: 1rem;
}

.error {
    color: var(--danger);
}


.login-page {
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(145deg, #0a9f4e 0%, #065c2e 100%);
}

.login-card {
    background: white;
    border-radius: 16px;
    padding: 40px 36px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}

.login-card h1 {
    font-size: 1.6rem;
    margin-bottom: 8px;
    color: var(--text);
}

.login-card .subtitle {
    color: var(--text-muted);
    margin-bottom: 28px;
    font-size: 0.95rem;
}

.login-card label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.login-card input {
    width: 100%;
    margin-bottom: 18px;
}

.login-card button {
    width: 100%;
    padding: 12px;
    font-size: 1rem;
    margin-top: 8px;
}

.login-error {
    background: #fdecea;
    color: var(--danger);
    padding: 10px 14px;
    border-radius: 8px;
    margin-bottom: 18px;
    font-size: 0.9rem;
}


.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 600;
    background: var(--green-soft);
    color: var(--green-dark);
}

.badge-muted {
    background: #eee;
    color: var(--text-muted);
}
.badge-status-work {
    background: #e6f6ea;
    color: #1b7a3d;
}
.badge-status-leave {
    background: #fff4d6;
    color: #9a6b00;
}
.badge-status-fired {
    background: #fde8e8;
    color: #b53a3a;
}


@media (max-width: 900px) {

    #sidebar_right { display: none; }
    #content { padding: 20px 16px; }
}

footer {
    display: none;
}


.view-switch {
    display: inline-flex;
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}
.view-switch .view-btn {
    border: none;
    border-radius: 0;
    background: var(--surface);
    color: var(--text-muted);
    padding: 8px 14px;
}
.view-switch .view-btn.active {
    background: var(--green);
    color: white;
}

.calendar-root,
#calendar-root {
    min-height: 0;
    overflow: auto;
}


.modal {
    position: fixed;
    inset: 0;
    z-index: 1300;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.modal.hidden {
    display: none;
}
.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 30, 20, 0.45);
    backdrop-filter: blur(2px);
}
.modal-card {
    --dialog-padding: 20px;
    position: relative;
    width: 100%;
    max-width: 600px;
    max-height: calc(100dvh - 32px);
    overflow: auto;
    overscroll-behavior: contain;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 24px 64px rgba(0,0,0,.2);
    padding: var(--dialog-padding);
}
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space);
    margin-bottom: 16px;
}
.modal-header h2 {
    font-size: 1.15rem;
    font-weight: 650;
    overflow-wrap: anywhere;
}
.modal-close {
    width: 32px;
    height: 32px;
    padding: 0;
    background: transparent;
    color: var(--text-muted);
    font-size: 1.5rem;
    line-height: 1;
}
.modal-close:hover {
    color: var(--text);
    background: var(--bg);
}
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}
.form-grid label {
    display: flex;
    flex-direction: column;
    gap: 5px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
}
.form-grid label input:not([type="checkbox"]),
.form-grid label select {
    min-width: 0;
    width: 100%;
}
.modal-actions {
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
    align-items: center;
}


.orders-modal-card {
    width: min(1120px, calc(100vw - 32px));
    max-width: none;
}


.modal-card:not(.lesson-modal-card):not(.document-modal) > .modal-header {
    position: sticky;
    top: calc(-1 * var(--dialog-padding));
    z-index: 5;
    margin: calc(-1 * var(--dialog-padding)) calc(-1 * var(--dialog-padding)) 16px;
    padding: 14px var(--dialog-padding);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}
.modal-card:not(.lesson-modal-card):not(.document-modal) .modal-actions {
    position: sticky;
    bottom: calc(-1 * var(--dialog-padding));
    z-index: 5;
    margin: 16px calc(-1 * var(--dialog-padding)) calc(-1 * var(--dialog-padding));
    padding: 12px var(--dialog-padding);
    background: var(--surface);
}

.tuition-rates-wrap {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
}

#tuition-rates-table {
    width: 100%;
    min-width: 990px;
    table-layout: fixed;
}

#tuition-rates-table th {
    white-space: normal;
    line-height: 1.2;
}

#tuition-rates-table th:nth-child(1),
#tuition-rates-table th:nth-child(2),
#tuition-rates-table th:nth-child(3) {
    width: 64px;
}

#tuition-rates-table th:nth-child(4) { width: 280px; }
#tuition-rates-table th:nth-child(5) { width: 130px; }
#tuition-rates-table th:nth-child(6),
#tuition-rates-table th:nth-child(7) { width: 125px; }
#tuition-rates-table th:nth-child(8) { width: 52px; }

#tuition-rates-table td {
    padding: 8px;
    vertical-align: top;
}

#tuition-rates-table input {
    max-width: 100%;
}
.btn-danger {
    background: var(--danger);
    color: white;
}
.btn-danger:hover {
    background: #b53a3a;
}
.form-error {
    margin-top: 12px;
    padding: 10px 12px;
    background: #fdecea;
    color: var(--danger);
    border-radius: 8px;
    font-size: 0.9rem;
}
.form-error.hidden {
    display: none;
}

@media (max-width: 700px) {
    .form-grid {
        grid-template-columns: 1fr;
    }

    .modal {
        align-items: stretch;
        padding: 8px;
    }

    .orders-modal-card {
        width: 100%;
        max-height: calc(100dvh - 16px);
        border-radius: 12px;
    }

    .orders-modal-card .form-grid > [style*="grid-column"] {
        grid-column: 1 !important;
    }

    .orders-modal-card .modal-actions {
        flex-wrap: wrap;
    }
}

.btn-sm {
    height: 30px;
    padding: 4px 9px;
    font-size: .8rem;
}

.contract-modal { width: min(760px, calc(100vw - 32px)); max-width: none; }
.contract-modal .form-grid, .diploma-modal .form-grid { margin-top: 16px; }
.contract-modal select, .contract-modal input, .diploma-modal select, .diploma-modal input { min-width: 0; width: 100%; }
.contract-payments { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); }
.contract-payments .section-heading { display:flex; justify-content:space-between; align-items:center; margin-bottom:10px; }
.contract-payments h3 { font-size:1rem; }
.payment-list { display:flex; flex-direction:column; gap:8px; }
.payment-list .form-grid { grid-template-columns:90px 1fr 1fr auto; align-items:end; padding:10px; background:var(--bg); border-radius:8px; }
.diploma-modal { width:min(720px, calc(100vw - 32px)); max-width:none; overflow-x:hidden; }
.diploma-table-wrap { overflow-x:auto; }
.diploma-table { width:100%; min-width:0; table-layout:fixed !important; }
.diploma-table th, .diploma-table td { min-width:0; overflow-wrap:anywhere; word-break:break-word; white-space:normal; }
.diploma-table .col-actions { width:300px; min-width:280px; max-width:320px; white-space:nowrap; }
.row-actions { display:flex; align-items:center; justify-content:flex-end; gap:6px; flex-wrap:nowrap; }
.row-actions .btn-sm { margin:0; flex:0 0 auto; }
.row-actions .remove { width:32px; min-width:32px; padding:4px; font-size:1rem; }
.mobile-menu-toggle { display:none; width:36px; min-width:36px; height:36px; padding:0; background:rgba(255,255,255,.14); font-size:1.15rem; }
    body:has(.modal:not(.hidden)) { overflow:hidden; }
@media (max-width:1050px) { .diploma-table th:nth-child(4), .diploma-table td:nth-child(4) { display:none; } }
@media (max-width:760px) { .diploma-table th:nth-child(5), .diploma-table td:nth-child(5) { display:none; } }
@media (max-width:900px) { .mobile-menu-toggle { display:inline-flex; }  }
@media (max-width:700px) { .contract-modal,.diploma-modal { width:100%; max-height:calc(100dvh - 16px); } .payment-list .form-grid { grid-template-columns:1fr 1fr; } }


.page-subtitle { margin-top: 4px; color: var(--text-muted); font-size: .92rem; }
.document-modal { width: min(900px, calc(100vw - 32px)); max-width: none; max-height: calc(100dvh - 32px); padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.document-modal .modal-header { margin: 0; padding: 20px 24px 16px; border-bottom: 1px solid var(--border); background: #fcfefd; flex-shrink: 0; }
.document-modal .modal-header p { margin-top: 4px; color: var(--text-muted); font-size: .86rem; }
.document-modal > .document-section, .document-modal > .form-error { margin-left: 24px; margin-right: 24px; }
.document-modal { overflow-y: auto; }
.document-section { padding: 18px 0; border-bottom: 1px solid var(--border); }
.document-section h3 { color: var(--green-dark); font-size: 1rem; margin: 0 0 12px; }
.section-hint { color: var(--text-muted); font-size: .85rem; margin: -5px 0 12px; }
.section-heading { display: flex; align-items: start; justify-content: space-between; gap: 16px; }
.document-actions { position: sticky; bottom: 0; padding: 14px 24px; margin: 0; background: var(--surface); border-top: 1px solid var(--border); box-shadow: 0 -8px 18px rgba(10,30,20,.05); }
.payment-list { display: flex; flex-direction: column; gap: 8px; }
.payment-list .form-grid { grid-template-columns: 100px 1fr 1fr auto; align-items: end; padding: 10px; background: var(--bg); border-radius: 10px; }
.payment-list .form-grid button { margin-bottom: 0; }
.contract-filter { padding: 10px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.contract-table td { vertical-align: middle; }
.journal-contract { color:var(--green-dark); font-weight:700; text-decoration:none; white-space:nowrap; }
.journal-contract:hover { text-decoration:underline; }
.text-warning { color:#9a5b00; font-weight:600; white-space:nowrap; }
@media (max-width: 700px) { .document-modal { width: 100%; max-height: 100dvh; border-radius: 0; } .document-modal > .document-section, .document-modal > .form-error { margin-left: 16px; margin-right: 16px; } .document-modal .modal-header { padding: 16px; } .document-actions { padding: 9px 12px; flex-wrap: wrap; } .payment-list .form-grid { grid-template-columns: 1fr 1fr; } }


.att-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 12px;
    margin: 0;
    font-size: .8rem;
    color: var(--text-muted);
}
.att-legend b {
    color: var(--green-dark);
    margin-right: 4px;
}
.att-table-wrap {
    overflow-x: auto;
}
.att-table {
    border-collapse: collapse;
    min-width: 100%;
}
.att-table th, .att-table td {
    text-align: center;
    padding: 6px 8px;
    white-space: nowrap;
}
.att-table th.sticky-col,
.att-table td.sticky-col {
    text-align: left;
    position: sticky;
    left: 0;
    background: var(--surface);
    z-index: 1;
    min-width: 180px;
    font-weight: 600;
}
.att-table th.sticky-col {
    background: var(--green-soft);
}
.att-select {
    min-width: 48px;
    padding: 4px 6px;
    border-radius: 6px;
    border: 1px solid var(--border);
    font-weight: 700;
    text-align: center;
    cursor: pointer;
}
.att-select.has-value {
    background: var(--green-soft);
    border-color: var(--green);
    color: var(--green-dark);
}
.att-select.saved {
    box-shadow: 0 0 0 3px rgba(10, 159, 78, 0.25);
}
.att-select:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}


.dash-subtitle {
    color: var(--text-muted);
    margin: 0;
}
.dash-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 20px;
}
@media (max-width: 900px) {
    .dash-row { grid-template-columns: 1fr; }
}
.dash-panel-title {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 14px;
    color: var(--text);
}
.att-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 12px;
    margin-bottom: 14px;
}
.att-stat-item {
    text-align: center;
    padding: 10px;
    background: var(--bg);
    border-radius: 10px;
}
.asi-value {
    font-size: 1.5rem;
    font-weight: 800;
}
.asi-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 2px;
}
.asi-count {
    font-size: 0.72rem;
    color: var(--text-muted);
}
.att-bar-wrap {
    height: 12px;
    background: var(--bg);
    border-radius: 8px;
    overflow: hidden;
    display: flex;
}
.att-bar-seg {
    height: 100%;
    transition: width 0.3s;
}
.att-bar-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 10px;
    font-size: 0.8rem;
    color: var(--text-muted);
}
.att-bar-legend i {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 2px;
    margin-right: 5px;
}
.dash-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.dash-list li {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}
.dash-list li:last-child {
    border-bottom: none;
    padding-bottom: 0;
}
.dl-main {
    font-weight: 600;
    font-size: 0.95rem;
}
.dl-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
}
.quick-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
.qa-btn {
    display: block;
    text-align: center;
    padding: 12px 10px;
    background: var(--green-soft);
    color: var(--green-dark);
    border-radius: 10px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: background 0.15s;
}
.qa-btn:hover {
    background: var(--green);
    color: white;
}


.lessons-att-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.lesson-att-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}
.lesson-att-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    background: var(--green-soft);
    border-bottom: 1px solid var(--border);
}
.lah-title {
    font-weight: 700;
    font-size: 1.05rem;
}
.lah-meta {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 4px;
}
.att-lesson-table {
    width: 100%;
}
.att-lesson-table th,
.att-lesson-table td {
    padding: 8px 16px;
    text-align: left;
}
.att-lesson-table th {
    background: transparent;
    color: var(--text-muted);
    font-size: 0.8rem;
}

.dash-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}
.dash-panel-head .dash-panel-title {
    margin-bottom: 0;
}
.range-select {
    min-width: 120px;
    height: var(--control-height);
    padding: 7px 10px;
}
tr.room-busy td {
    background: #f3fbf6;
}

.page-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    justify-content: flex-end;
    margin: 0;
    font-size: .8rem;
    color: var(--text-muted);
}
.page-bar button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}
.page-jump { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.page-jump input { width: 58px; min-width: 0; height: 30px; padding: 4px 6px; text-align: center; }
.page-count { margin-right: auto; white-space: nowrap; }
.filter-active { color: var(--green-dark); }
.filter-reset[hidden] { display: none; }
.data-table .table-state { padding: 32px 16px; text-align: center; white-space: normal; }
.table-state p { margin: 8px 0 12px; color: var(--text-muted); }
@media (max-width: 600px) {
    .table-state-content { position: sticky; left: 16px; width: calc(100vw - 72px); }
}
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }

.grades-box {
    max-height: 320px;
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
}
.grades-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}
.grades-table th,
.grades-table td {
    padding: 8px 10px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}
.grades-table th {
    background: var(--green-soft);
    color: var(--green-dark);
    position: sticky;
    top: 0;
}
.grades-table select,
.grades-table input[type="text"] {
    min-width: 0;
    width: 100%;
    height: 36px;
}
.grades-table input[type="checkbox"] {
    width: 18px;
    height: 18px;
    min-width: 0;
}


.att-select {
    min-width: 160px !important;
    width: auto;
    max-width: 240px;
    height: 36px;
    font-weight: 500;
    text-align: left;
    padding: 4px 10px;
}

.positions-block {
    margin-top: 14px;
}
.positions-label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 8px;
}
.positions-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg);
}
.pos-check {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.92rem;
    color: var(--text);
    cursor: pointer;
    font-weight: 500;
}
.pos-check input {
    width: 16px;
    height: 16px;
    min-width: 0;
    accent-color: var(--green);
}


.perm-gated {
    display: none !important;
}


.att-work {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 0;
    overflow: hidden;
}
.att-lessons-panel,
.att-marks-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: auto;
    min-height: 0;
}
.att-lessons-panel {
    flex: 0 0 auto;
    max-height: 40%;
}
.att-marks-panel {
    flex: 1;
}
.att-panel-title {
    padding: 10px 14px;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--green-dark);
    background: var(--green-soft);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 1;
}
.att-lessons-table,
.att-marks-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92rem;
    table-layout: fixed;
}
.att-lessons-table th,
.att-lessons-table td,
.att-marks-table th,
.att-marks-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}
.att-lessons-table th,
.att-marks-table th {
    background: var(--surface);
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 1;
}
.att-lessons-table tr {
    cursor: pointer;
}
.att-lessons-table tr:hover td {
    background: var(--green-soft);
}
.att-lessons-table tr.active td {
    background: #d8f3e4;
    font-weight: 600;
}
.att-marks-table select.att-select {
    min-width: 180px !important;
    width: 100%;
    max-width: 280px;
    height: 36px;
    font-weight: 500;
    text-align: left;
}
.att-hint {
    padding: 16px;
    color: var(--text-muted);
    text-align: center;
}


.schedule-board,
#calendar-root.schedule-board {
    display: flex;
    flex-direction: column;
    min-height: 0;
    flex: 1 1 auto;
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.schedule-board-header {
    display: grid;
    grid-template-columns: 80px minmax(100px, 1fr) minmax(180px, 2fr) 90px minmax(150px, 1.4fr);
    gap: 8px;
    padding: 10px 12px;
    background: var(--green-soft);
    color: var(--green-dark);
    font-weight: 700;
    font-size: 0.85rem;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.schedule-list {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    display: flex;
    flex-direction: column;
}

.schedule-row {
    display: grid;
    grid-template-columns: 80px minmax(100px, 1fr) minmax(180px, 2fr) 90px minmax(150px, 1.4fr);
    gap: 8px;
    padding: 10px 12px;
    align-items: center;
    flex-shrink: 0;
    border-bottom: 1px solid var(--border);
    font-size: .875rem;
    transition: background .12s;
}
.schedule-row.editable {
    cursor: pointer;
}
.schedule-row.editable:hover {
    background: var(--green-soft);
}

.schedule-col {
    min-width: 0;
    word-break: break-word;
}

.schedule-time {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 2px;
    color: var(--text);
    font-weight: 600;
    min-width: 0;
}
.schedule-time-start {
    font-size: .9rem;
    line-height: 1.2;
    font-weight: 650;
}
.schedule-time-end {
    font-size: .8rem;
    color: var(--text-muted);
    font-weight: 500;
}

.schedule-subject {
    font-weight: 600;
    color: var(--text);
}

.schedule-teacher-surname {
    font-weight: 600;
    font-size: .875rem;
}
.schedule-teacher-name {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.schedule-day-sep {
    padding: 10px 14px;
    background: #eef6f1;
    color: var(--green-dark);
    font-weight: 700;
    font-size: 0.9rem;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 1;
}

.schedule-empty {
    padding: 28px 16px;
    text-align: center;
    color: var(--text-muted);
    font-size: 1rem;
}

@media (max-width: 900px) {
    .schedule-board-header {
        display: none;
    }
    .schedule-row {
        grid-template-columns: 90px 1fr;
        grid-template-rows: auto auto auto;
        gap: 6px 12px;
    }
    .schedule-time {
        grid-row: 1 / span 4;
    }
    .schedule-row .schedule-col:nth-child(2) { grid-column: 2; }
    .schedule-row .schedule-col:nth-child(3) { grid-column: 2; }
    .schedule-row .schedule-col:nth-child(4),
    .schedule-row .schedule-col:nth-child(5) {
        grid-column: 2;
        display: inline;
    }
}


.schedule-toolbar,
.page-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: flex-start;
    gap: 8px;
    flex-shrink: 0;
}
.schedule-toolbar .toolbar-left,
.schedule-toolbar .toolbar-right {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 8px 12px;
}
.schedule-toolbar .period-nav {
    display: flex;
    align-items: end;
    gap: 6px;
}
.schedule-toolbar .period-label {
    box-sizing: border-box;
    width: 17.5rem;
    min-width: 17.5rem;
    max-width: 17.5rem;
    padding: 6px 8px;
    font-size: .875rem;
    font-weight: 600;
    color: var(--text);
    background: transparent;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.schedule-toolbar .toolbar-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
}
.schedule-toolbar .toolbar-field select {
    width: max-content;
    min-width: 8rem;
    max-width: min(100%, 28rem);
    field-sizing: content;
}
.schedule-toolbar .view-switch .view-btn {
    height: 36px;
    padding: 6px 12px;
}
.schedule-toolbar .btn-secondary,
.schedule-toolbar .btn {
    height: 36px;
}

.schedule-cabinet-num {
    font-size: .9rem;
    font-weight: 600;
}
.schedule-cabinet-floor {
    font-size: 0.8rem;
    color: var(--text-muted);
}


.page-header:empty {
    display: none;
}


.cal-picker-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
}
.btn-calendar {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 36px;
    min-width: 36px;
    padding: 0 !important;
}
.btn-calendar svg {
    display: block;
    pointer-events: none;
}
.cal-popover {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    z-index: 50;
    width: 272px;
    max-width: min(272px, calc(100vw - 24px));
    box-sizing: border-box;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.14);
    padding: 10px;
    overflow: hidden;
}
.cal-popover.hidden {
    display: none !important;
}
.cal-popover-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    margin-bottom: 8px;
}
.cal-month-label {
    font-weight: 700;
    font-size: 0.92rem;
    color: var(--text);
    text-align: center;
    flex: 1;
    min-width: 0;
    white-space: nowrap;
}
.btn-cal-nav {
    width: 30px !important;
    min-width: 30px !important;
    max-width: 30px !important;
    height: 30px !important;
    padding: 0 !important;
    flex-shrink: 0;
}
.cal-weekdays {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 2px;
    margin-bottom: 4px;
    text-align: center;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
}
.cal-weekdays span {
    min-width: 0;
    overflow: hidden;
}
.cal-days {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 2px;
    width: 100%;
    box-sizing: border-box;
}

.cal-day {
    box-sizing: border-box;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    height: 32px !important;
    min-height: 32px !important;
    max-height: 32px !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    background: transparent;
    border-radius: 8px;
    font-size: 0.85rem !important;
    line-height: 32px !important;
    color: var(--text);
    cursor: pointer;
    font-weight: 500;
    text-align: center;
    display: block;
    overflow: hidden;
}
.cal-day:hover:not(.empty) {
    background: var(--green-soft);
    color: var(--green-dark);
}
.cal-day.empty {
    cursor: default;
    pointer-events: none;
    background: transparent !important;

    display: block;
    height: 32px !important;
    min-height: 32px !important;
    max-height: 32px !important;
}
.cal-day.is-today {
    box-shadow: inset 0 0 0 1.5px var(--green);
}
.cal-day.is-selected {
    background: var(--green) !important;
    color: #fff !important;
    font-weight: 700;
}
.cal-day.is-selected:hover {
    background: var(--green-dark) !important;
    color: #fff !important;
}

.schedule-toolbar .period-label:hover {
    background: var(--green-soft);
    color: var(--green-dark);
}


.lesson-modal-card {
    width: min(560px, calc(100vw - 24px));
    max-width: none;
    max-height: calc(100dvh - 32px);
    padding: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.lesson-modal-header {
    margin: 0;
    padding: 18px 20px 14px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    gap: 12px;
}
.lesson-modal-header h2 {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 650;
    letter-spacing: -0.01em;
}
.modal-subtitle {
    margin: 4px 0 0;
    font-size: 0.82rem;
    color: var(--text-muted);
    font-weight: 450;
}
.lesson-form {
    display: flex;
    flex-direction: column;
    gap: 0;
    overflow-y: auto;
    padding: 16px 20px 0;
    flex: 1;
    min-height: 0;
}
.lesson-kind {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    padding: 4px;
    background: #f3f6f4;
    border-radius: 10px;
    margin-bottom: 16px;
}
.lesson-kind-btn {
    border: none;
    background: transparent;
    border-radius: 8px;
    padding: 7px 10px;
    font: inherit;
    font-size: 0.9rem;
    font-weight: 550;
    color: var(--text-muted);
    cursor: pointer;
    transition: background .12s, color .12s, box-shadow .12s;
}
.lesson-kind-btn:hover {
    color: var(--text);
}
.lesson-kind-btn.active {
    background: var(--surface);
    color: var(--green-dark);
    box-shadow: 0 1px 2px rgba(0,0,0,.06), 0 0 0 1px rgba(10,159,78,.12);
}
.lesson-section {
    margin-bottom: 16px;
}
.lesson-section-title {
    margin: 0 0 8px;
    font-size: 0.72rem;
    font-weight: 650;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--text-muted);
}
.lesson-optional {
    font-weight: 500;
    text-transform: none;
    letter-spacing: 0;
    opacity: .75;
    margin-left: 4px;
}
.lesson-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 12px;
}
.lesson-fields-2 {
    grid-template-columns: 1fr 1fr;
}
.lesson-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-muted);
    min-width: 0;
}
.lesson-field input,
.lesson-field select {
    width: 100%;
    min-width: 0;
    font-size: 0.92rem;
}
.lesson-field-full {
    min-width: 0;
}
.lesson-field.hidden,
#wrap-practice.hidden,
#wrap-subject.hidden {
    display: none !important;
}
.lesson-field-date {
    grid-column: 1;
}
.lesson-field-period {
    grid-column: 2;
}
.lesson-time-pair {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 8px;
    align-items: end;
}
.lesson-time-sep {
    padding-bottom: 11px;
    color: var(--text-muted);
    font-weight: 600;
}
.lesson-related {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 10px 12px;
    background: #f7faf8;
    border: 1px solid var(--border);
    border-radius: 10px;
}
.lesson-related.hidden {
    display: none !important;
}
.related-hint {
    font-size: 0.78rem;
    padding-left: 24px;
}
.lesson-modal-actions {
    position: sticky;
    bottom: 0;
    margin: 8px -20px 0;
    padding: 14px 20px 18px;
    background: var(--surface);
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}
.lesson-actions-spacer {
    flex: 1;
}
.schedule-row.is-practice .schedule-subject {
    color: var(--green-dark);
    font-weight: 550;
}

.check-inline {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    color: var(--text);
    cursor: pointer;
}
.check-inline input {
    width: 16px;
    height: 16px;
    min-width: 0;
    accent-color: var(--green);
}
.lesson-related-label .related-title {
    font-size: 0.85rem;
    color: var(--text-muted);
}
.lesson-related-label.hidden {
    display: none !important;
}

@media (max-width: 480px) {
    .lesson-fields,
    .lesson-fields-2 {
        grid-template-columns: 1fr;
    }
    .lesson-field-date,
    .lesson-field-period {
        grid-column: 1;
    }
    .lesson-time-pair {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    .lesson-time-sep {
        display: none;
    }
}


.related-groups-block {
    margin-top: 12px;
}
.related-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    min-height: 32px;
    margin-bottom: 8px;
}
.related-chips-empty {
    color: var(--text-muted);
    font-size: 0.88rem;
    padding: 4px 0;
}
.related-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px 4px 10px;
    background: var(--green-soft);
    color: var(--green-dark);
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 600;
    max-width: 100%;
}
.related-chip-remove {
    width: 20px !important;
    min-width: 20px !important;
    height: 20px !important;
    padding: 0 !important;
    border: none !important;
    background: transparent !important;
    color: var(--green-dark) !important;
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
    border-radius: 50%;
}
.related-chip-remove:hover {
    background: rgba(0,0,0,0.08) !important;
}
.related-search-wrap {
    position: relative;
}
.related-search-wrap input[type="search"] {
    width: 100%;
    height: var(--control-height);
}
.related-suggest {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 4px);
    z-index: 40;
    max-height: 220px;
    overflow: auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    padding: 4px;
}
.related-suggest.hidden {
    display: none !important;
}
.related-suggest-item {
    display: block;
    width: 100% !important;
    min-width: 0 !important;
    height: auto !important;
    text-align: left;
    padding: 8px 10px !important;
    border: none !important;
    background: transparent !important;
    color: var(--text) !important;
    font-weight: 500;
    border-radius: 8px;
    cursor: pointer;
}
.related-suggest-item:hover {
    background: var(--green-soft) !important;
    color: var(--green-dark) !important;
}
.related-suggest-empty {
    padding: 10px;
    color: var(--text-muted);
    font-size: 0.88rem;
}
.related-hint {
    margin-top: 6px;
    font-size: 0.8rem;
    color: var(--text-muted);
}


.att-status-btns {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.att-status-btn {
    min-width: 36px;
    height: 32px;
    padding: 0 8px;
    border: 1.5px solid #c5c9ce;
    border-radius: 6px;
    background: #fff;
    color: #555;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    transition: background .15s, color .15s, border-color .15s, box-shadow .15s;
}
.att-status-btn:hover:not(:disabled):not(.active) {
    background: #f5f5f5;
    border-color: #999;
}
.att-status-btn.active {
    background: var(--btn-bg, #e8f7ef);
    color: var(--btn-color, #0a9f4e);
    border-color: var(--btn-border, #0a9f4e);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--btn-border, #0a9f4e) 35%, transparent);
}
.att-status-btn.saved {
    animation: att-saved 0.6s ease;
}
.att-status-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}
@keyframes att-saved {
    0% { transform: scale(1); }
    40% { transform: scale(1.12); }
    100% { transform: scale(1); }
}
.att-legend-item {
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
}


.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-bottom: 16px;
}
@media (max-width: 1100px) {
    .dashboard-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
    .dashboard-grid { grid-template-columns: 1fr; }
}
.stat-card {
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 18px;
    box-shadow: var(--shadow);
    transition: transform .15s, box-shadow .15s;
}
.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,0,0,.08);
}
.stat-card .sc-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    background: var(--green-soft);
    flex-shrink: 0;
}
.stat-card.sc-lessons .sc-icon { background: #e8f5e9; }
.stat-card.sc-groups .sc-icon { background: #e3f2fd; }
.stat-card.sc-teachers .sc-icon { background: #fff3e0; }
.stat-card.sc-students .sc-icon { background: #f3e5f5; }
.stat-card .sc-body { min-width: 0; }
.stat-card .label {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
}
.stat-card .value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--green-dark);
    line-height: 1.15;
    margin-top: 2px;
}

.dash-row-3 {
    grid-template-columns: 1.2fr 1fr 1fr;
}
@media (max-width: 1100px) {
    .dash-row-3 { grid-template-columns: 1fr; }
}

.dash-link {
    font-size: 0.82rem;
    color: var(--green);
    text-decoration: none;
    font-weight: 500;
}
.dash-link:hover { text-decoration: underline; }
.dash-muted {
    font-size: 0.82rem;
    color: var(--text-muted);
}

.dash-chip-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 320px;
    overflow: auto;
}
.dash-chip {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--green-soft);
    border-radius: 10px;
    border: 1px solid transparent;
}
.dash-chip-teacher {
    background: #fff8e7;
}
.dash-chip .dc-name {
    font-weight: 600;
    font-size: 0.92rem;
    color: var(--text);
}
.dash-chip .dc-meta {
    font-size: 0.78rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.today-lessons {
    overflow: auto;
    max-height: 420px;
}
.dash-lessons-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}
.dash-lessons-table th {
    text-align: left;
    padding: 8px 12px;
    font-size: 0.78rem;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background: var(--surface);
}
.dash-lessons-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
}
.dash-lessons-table tr.is-now td {
    background: #e8f7ef;
    font-weight: 600;
}
.dash-lessons-table tr.is-past td {
    opacity: 0.55;
}
.dash-lessons-table .dl-time {
    white-space: nowrap;
    width: 110px;
}
.att-bar-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 14px;
    margin-top: 10px;
    font-size: 0.78rem;
    color: var(--text-muted);
}
.att-bar-legend i {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 2px;
    margin-right: 5px;
    vertical-align: middle;
}


.report-toolbar {
    gap: 8px;
}
.report-page-header {
    justify-content: flex-start !important;
}
.report-type-label, .report-type-field { min-width: 0; }
.report-type-select { width: 240px; }
.report-toolbar > .filters {
    display: contents;
}

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

.report-result-wrap,
#report-result {
    padding: 16px 20px 24px;
}
#report-result.report-result,
.table-wrap.report-result {
    padding: 20px 24px;
}
#report-result .empty {
    padding: 24px 8px;
    text-align: center;
}
.report-head,
#report-result .report-head {
    margin-bottom: 12px;
}
#report-result .report-head h3,
.report-head h3 {
    margin: 0 0 4px;
    font-size: 1.15rem;
}
#report-result .report-period,
.report-period {
    color: var(--text-muted);
    font-size: 0.9rem;
}
#report-result h4 {
    margin: 16px 0 8px;
    font-size: 0.95rem;
}
#report-result .data-table,
#report-result .report-table,
.report-table {
    width: 100%;
    margin-top: 4px;
}
.report-table .report-total td {
    font-weight: 600;
    background: var(--green-soft);
}
#report-result > p {
    margin: 0 0 12px;
}
#report-result > p:last-child {
    margin: 12px 0 0;
}
.report-total-line {
    margin: 16px 0 0;
    padding-top: 12px;
    border-top: 1px solid var(--border);
    font-size: 0.95rem;
    color: var(--text);
}

.report-picked {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
    font-size: 0.88rem;
    font-weight: 600;
}
.filters .related-search-wrap {
    min-width: 220px;
}


.form-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
    margin-bottom: 4px;
}


#content > .entity-form-page {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
}
.entity-form-page {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.entity-form-page .form-section {
    margin-bottom: 16px;
}
.entity-form-page .form-section-title {
    margin: 0 0 12px;
    padding-bottom: 8px;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--green-dark);
    border-bottom: 1px solid var(--border);
}
.entity-form-page .form-section-hint {
    margin: -4px 0 12px;
    font-size: 0.85rem;
    color: var(--text-muted);
}
.entity-form-page .form-subsection-title {
    margin: 14px 0 10px;
    font-size: 0.95rem;
    font-weight: 600;
}

.entity-form-page .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}
.entity-form-page .form-grid label.span-2 {
    grid-column: 1 / -1;
}
.entity-form-page .form-grid label {
    min-width: 0;
}
.entity-form-page .form-grid input,
.entity-form-page .form-grid select {
    width: 100%;
    min-width: 0;
}

.input-readonly {
    background: #eef2ef !important;
    color: var(--text-muted) !important;
    cursor: default;
}

.customer-fields.hidden {
    display: none;
}
.customer-fields {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
}

.form-page-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 12px;
    margin-top: 8px;
    padding-top: 18px;
    border-top: 1px solid var(--border);
}

.entity-form-page .form-error {
    margin: 12px 0 0;
}
.entity-form-page .form-error.hidden {
    display: none;
}

@media (max-width: 720px) {
    .entity-form-page .form-grid {
        grid-template-columns: 1fr;
    }
    .entity-form-page .form-grid label.span-2 {
        grid-column: 1;
    }
    .form-page-actions {
        flex-direction: column-reverse;
    }
    .form-page-actions .btn,
    .form-page-actions .btn-secondary {
        width: 100%;
    }
}


.journal-table {
    table-layout: auto;
    width: 100%;
}
.journal-table th {
    font-size: 0.8rem;
    font-weight: 600;
    vertical-align: bottom;
    white-space: normal;
    overflow-wrap: break-word;
    word-break: break-word;
    line-height: 1.25;
    hyphens: auto;
}
.journal-table td {
    font-size: 0.85rem;
    vertical-align: top;
    white-space: normal;
    overflow-wrap: break-word;
}
.journal-table .col-num {
    width: 1%;
    white-space: nowrap;
    text-align: center;
    font-variant-numeric: tabular-nums;
}
.journal-table .journal-docs {
    max-width: 220px;
    white-space: normal;
}


.modal-card.modal-wide {
    max-width: min(96vw, 1100px);
}

.cur-editor {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 0;
    overflow: auto;
    max-width: 100%;
}
.cur-editor-top {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.cur-editor-nav {
    display: flex;
    align-items: center;
    gap: 14px;
}
.cur-editor-nav h1 {
    margin: 0;
    font-size: 1.1rem;
}
.cur-editor-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}
.cur-editor-bottom {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 8px 0 24px;
}

.card-block {
    background: var(--surface, #fff);
    border: 1px solid var(--border, #e5e7eb);
    border-radius: 12px;
    padding: 16px 18px 18px;
}
.card-block h2 {
    margin: 0 0 12px;
    font-size: 1.05rem;
}
.cur-meta-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px 14px;
}
.cur-meta-grid .span-2 { grid-column: span 2; }
@media (max-width: 900px) {
    .cur-meta-grid { grid-template-columns: 1fr 1fr; }
    .cur-meta-grid .span-2 { grid-column: span 2; }
}
@media (max-width: 600px) {
    .cur-meta-grid { grid-template-columns: 1fr; }
    .cur-meta-grid .span-2 { grid-column: span 1; }
}
.cur-table-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 6px;
}
.cur-table-toolbar h2 { margin: 0; }
.cur-table-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.cur-table-hint {
    font-size: 0.85rem;
    color: var(--text-muted, #6b7280);
    margin-bottom: 10px;
}
.cur-table-scroll,
.curriculum-rows-wrap {
    max-height: min(70vh, 720px);
    overflow: auto;
    border: 1px solid var(--border, #e5e7eb);
    border-radius: 8px;
}
.curriculum-rows {
    width: max-content;
    min-width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
    table-layout: fixed;
}
.curriculum-rows th,
.curriculum-rows td {
    border: 1px solid var(--border, #e5e7eb);
    padding: 2px 4px;
    vertical-align: middle;
}
.curriculum-rows thead th {
    background: var(--surface-2, #f3f4f6);
    font-weight: 600;
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 3;
}

.curriculum-rows .sticky-col,
.curriculum-rows .col-index {
    position: sticky;
    left: 0;
    background: var(--surface, #fff);
    z-index: 2;
    width: 70px;
    min-width: 70px;
    max-width: 70px;
}
.curriculum-rows .sticky-col-2 {
    position: sticky;
    left: 70px;
    background: var(--surface, #fff);
    z-index: 2;
    width: 210px;
    min-width: 210px;
}
.curriculum-rows thead .sticky-col,
.curriculum-rows thead .col-index,
.curriculum-rows thead .sticky-col-2 {
    z-index: 4;
    background: var(--surface-2, #f3f4f6);
}

.curriculum-rows .col-hours {
    width: 50px;
    min-width: 50px;
    max-width: 50px;
    text-align: center;
    padding: 2px 2px;
}
.curriculum-rows .col-hours input {
    text-align: center;
    padding: 4px 1px;
}
.curriculum-rows .col-ctrl {
    width: 62px;
    min-width: 62px;
    max-width: 68px;
}

.curriculum-rows .col-actions {
    white-space: nowrap;
    width: 68px;
    min-width: 68px;
    max-width: 68px;
    text-align: center;
    padding: 1px 2px;
}
.curriculum-rows input {
    width: 100%;
    min-width: 0;
    padding: 4px 5px;
    font-size: 0.85rem;
    border: 1px solid transparent;
    background: transparent;
    border-radius: 4px;
    box-sizing: border-box;
}
.curriculum-rows input:focus {
    border-color: var(--accent, #3b82f6);
    background: #fff;
    outline: none;
}
.curriculum-rows tr.row-cycle {
    background: rgba(59, 130, 246, 0.1);
}
.curriculum-rows tr.row-cycle .sticky-col,
.curriculum-rows tr.row-cycle .col-index,
.curriculum-rows tr.row-cycle .sticky-col-2 {
    background: #e8f1fe;
}
.curriculum-rows tr.row-total {
    background: rgba(0,0,0,0.06);
}
.curriculum-rows tr.row-total .sticky-col,
.curriculum-rows tr.row-total .col-index,
.curriculum-rows tr.row-total .sticky-col-2 {
    background: #ececec;
}
.curriculum-rows .btn-icon {
    border: none;
    background: transparent;
    cursor: pointer;
    color: var(--text-muted, #888);
    padding: 1px 2px;
    font-size: 0.78rem;
    line-height: 1.15;
    height: auto;
    min-width: 0;
    box-shadow: none;
}
.curriculum-rows .btn-icon:hover {
    color: #111;
    background: transparent;
}
.curriculum-rows .btn-del-row:hover {
    color: #c00;
    background: transparent;
}
.cur-empty {
    text-align: center;
    color: var(--text-muted, #888);
    padding: 20px !important;
}
.form-ok {
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
    border-radius: 8px;
    padding: 10px 12px;
}


.curriculum-rows .col-kind {
    width: 96px;
    min-width: 96px;
}
.curriculum-rows .kind-select {
    width: 100%;
    font-size: 0.78rem;
    padding: 4px 4px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: #fff;
}
.curriculum-rows tr.row-module {
    background: #f3f8f5;
}
.curriculum-rows tr.row-module .sticky-col,
.curriculum-rows tr.row-module .col-index,
.curriculum-rows tr.row-module .sticky-col-2 {
    background: #f3f8f5;
}
.curriculum-rows tr.row-discipline .sticky-col-2 input {
    font-weight: 400;
}
.curriculum-rows tr.row-cycle .sticky-col-2 input,
.curriculum-rows tr.row-module .sticky-col-2 input {
    font-weight: 600;
}
.curriculum-rows .row-actions {
    display: flex;
    flex-wrap: nowrap;
    gap: 2px;
    justify-content: flex-end;
}
.curriculum-rows .btn-add-module,
.curriculum-rows .btn-add-disc {
    font-size: 0.72rem;
    font-weight: 700;
    min-width: 28px;
}
.cur-editor-bottom { display: none; }

.curriculum-rows tr.row-agg .col-hours input[readonly] {
    background: #eef3f0;
    color: var(--text);
    font-weight: 600;
    cursor: default;
}


.cur-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 12px;
    align-items: center;
    margin: 0 0 12px;
    font-size: 0.85rem;
    color: var(--text-muted);
}
.cur-legend-note { margin-left: 4px; }
.cur-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 92px;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: .02em;
    text-transform: uppercase;
}
.cur-badge-cycle { background: #dceeff; color: #0b4f8a; }
.cur-badge-module { background: #e4f5ea; color: #1b6b3a; }
.cur-badge-discipline { background: #f3eef8; color: #5b3d8a; }
.cur-badge-total { background: #fff0d6; color: #8a5a00; }

.cur-tree-scroll {

    max-height: none;
    overflow: visible;
    padding-right: 0;
}
.cur-tree {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.cur-empty {
    padding: 18px;
    color: var(--text-muted);
    border: 1px dashed var(--border);
    border-radius: 10px;
    text-align: center;
}
.cur-node {
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
    padding: 10px 12px;
}
.cur-node-cycle { border-left: 4px solid #3b82f6; background: #f7fbff; }
.cur-node-module { border-left: 4px solid #22a06b; background: #f6fbf8; margin-left: 18px; }
.cur-node-discipline { border-left: 4px solid #8b5cf6; margin-left: 36px; }
.cur-node-total { border-left: 4px solid #f59e0b; background: #fffbf2; }

.cur-node-main {
    display: grid;
    grid-template-columns: auto 88px minmax(180px, 1fr) 90px auto;
    gap: 8px;
    align-items: center;
}
@media (max-width: 900px) {
    .cur-node-main {
        grid-template-columns: 1fr 1fr;
    }
    .cur-node-discipline, .cur-node-module { margin-left: 12px; }
}
.cur-node-main input,
.cur-subject-input {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 7px 9px;
    font: inherit;
    background: #fff;
}
.cur-index { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.88rem; }
.cur-control { max-width: 100%; }
.cur-node-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    justify-content: flex-end;
}
.cur-name-slot { min-width: 0; }
.cur-subject-wrap { position: relative; }
.cur-subject-bound,
.cur-subject-unbound {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.7rem;
    pointer-events: none;
}
.cur-subject-bound { color: #1b6b3a; }
.cur-subject-unbound { color: #a06700; }
.cur-subject-input { padding-right: 7.5rem; }

.cur-subject-menu {
    position: absolute;
    z-index: 20;
    left: 0;
    right: 0;
    top: calc(100% + 4px);
    max-height: 240px;
    overflow: auto;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,.08);
}
.cur-subject-option {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    border: 0;
    background: transparent;
    text-align: left;
    padding: 8px 10px;
    cursor: pointer;
    font: inherit;
}
.cur-subject-option:hover { background: #f3f5f4; color: var(--text); }
.cur-subject-name { font-weight: 500; }
.cur-subject-code { color: var(--text-muted); font-size: 0.8rem; }
.cur-subject-empty { padding: 10px; color: var(--text-muted); font-size: 0.85rem; }

.cur-node-hours { margin-top: 8px; }
.cur-hours-toggle {
    border: 0;
    background: transparent;
    color: var(--text-muted);
    font: inherit;
    font-size: 0.85rem;
    cursor: pointer;
    padding: 0;
}
.cur-hours-toggle strong { color: var(--text); }
.cur-hours-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(70px, 1fr));
    gap: 8px;
    margin-top: 8px;
}
@media (max-width: 900px) {
    .cur-hours-grid { grid-template-columns: repeat(3, 1fr); }
}
.cur-hour-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.72rem;
    color: var(--text-muted);
}
.cur-hour-field input {
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 5px 6px;
    font: inherit;
}
.cur-node-cycle .cur-hour-field input[readonly],
.cur-node-module .cur-hour-field input[readonly],
.cur-node-total .cur-hour-field input[readonly] {
    background: #eef3f0;
    font-weight: 600;
    color: var(--text);
}

.cur-editor .card-block {
    padding: 10px 12px;
    margin: 0;
}
.cur-editor .card-block h2 {
    margin: 0 0 8px;
    font-size: 0.95rem;
}
.cur-editor .cur-meta-grid {
    gap: 8px 12px;
}
.cur-editor .form-grid label {
    gap: 3px;
    font-size: 0.8rem;
}
.cur-editor .form-grid label input,
.cur-editor .form-grid label select {
    padding: 6px 8px;
    font-size: 0.88rem;
}


.cur-legend { gap: 6px 10px; margin: 0 0 8px; font-size: 0.78rem; }
.cur-badge { min-width: 74px; padding: 2px 6px; font-size: 0.65rem; }
.cur-node { padding: 6px 8px; border-radius: 8px; }
.cur-node-module { margin-left: 12px; }
.cur-node-discipline { margin-left: 24px; }
.cur-node-main {
    grid-template-columns: auto 76px minmax(140px, 1fr) 72px auto;
    gap: 6px;
}
.cur-node-main input,
.cur-subject-input {
    padding: 5px 7px;
    border-radius: 6px;
    font-size: 0.85rem;
}
.cur-index { font-size: 0.8rem; }
.cur-node-actions { gap: 3px; }
.cur-node-actions .btn-secondary.btn-sm {
    padding: 3px 7px;
    font-size: 0.72rem;
}
.cur-subject-input { padding-right: 6.5rem; }
.cur-subject-bound,
.cur-subject-unbound { font-size: 0.65rem; }
.cur-node-hours { margin-top: 4px; }
.cur-hours-toggle { font-size: 0.78rem; }
.cur-hours-grid {
    grid-template-columns: repeat(7, minmax(58px, 1fr));
    gap: 6px;
    margin-top: 6px;
}
.cur-hour-field { font-size: 0.65rem; gap: 2px; }
.cur-hour-field input { padding: 3px 5px; font-size: 0.8rem; }
.cur-editor-top { gap: 8px; margin-bottom: 0; }
.cur-table-toolbar { margin-bottom: 6px; gap: 8px; }
.cur-table-toolbar h2 { font-size: 0.95rem; }

.cur-hours-grid { display: none; }
.cur-hours-grid.is-open { display: grid; }

.cur-hours-toggle {
    background: transparent !important;
    color: var(--text-muted) !important;
    border: 0 !important;
    height: auto !important;
    padding: 2px 0 !important;
    font-weight: 500 !important;
    box-shadow: none !important;
}
.cur-hours-toggle:hover {
    background: transparent !important;
    color: var(--text) !important;
}

.cur-node-actions .btn-icon,
.cur-editor .btn-icon {
    background: var(--surface) !important;
    color: var(--text) !important;
    border: 1px solid var(--border) !important;
    height: 28px !important;
    min-width: 28px;
    padding: 0 6px !important;
}
.cur-node-actions .btn-icon:hover,
.cur-editor .btn-icon:hover {
    background: #f2f4f3 !important;
    color: var(--text) !important;
}
.cur-node-actions .btn-secondary.btn-sm {
    background: var(--surface) !important;
    color: var(--text) !important;
    border: 1px solid var(--border) !important;
    height: 28px !important;
}
.cur-node-actions .btn-secondary.btn-sm:hover {
    background: #f2f4f3 !important;
    color: var(--text) !important;
}

.cur-subject-menu {
    background: #fff !important;
    color: var(--text) !important;
}
.cur-subject-option {
    background: #fff !important;
    color: var(--text) !important;
    height: auto !important;
    padding: 8px 10px !important;
    justify-content: space-between !important;
    font-weight: 500 !important;
}
.cur-subject-option:hover {
    background: #f3f5f4 !important;
    color: var(--text) !important;
}
.cur-subject-name { color: var(--text) !important; }
.cur-subject-code { color: var(--text-muted) !important; }

.cur-node {
    min-width: 0;
    overflow: hidden;
}
.cur-node-main {
    min-width: 0;
}
.cur-name-slot,
.cur-subject-wrap,
.cur-node-actions {
    min-width: 0;
}
.cur-node-actions {
    flex-shrink: 0;
}
.cur-node-main-total {
    grid-template-columns: auto minmax(0, 1fr) auto !important;
}
.cur-node-total .cur-name-slot input {
    font-weight: 600;
}
.cur-hours-grid {
    min-width: 0;
}
.cur-hour-field input {
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
}
.cur-subject-menu {
    max-width: 100%;
    box-sizing: border-box;
}

.cur-node-main {
    grid-template-columns: auto 72px minmax(160px, 1.4fr) minmax(140px, 0.9fr) auto !important;
}
.cur-control {
    width: 100%;
    min-width: 0;
    max-width: none;
    box-sizing: border-box;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 5px 28px 5px 7px !important;
    font: inherit;
    font-size: 0.85rem;
    color: var(--text);
    height: 32px;
}
select.cur-control,
select.cur-control:not([multiple]) {
    appearance: none !important;
    -webkit-appearance: none !important;
    background-color: #fff !important;
    background-image: linear-gradient(45deg, transparent 50%, var(--text-muted) 50%),
                      linear-gradient(135deg, var(--text-muted) 50%, transparent 50%) !important;
    background-position: calc(100% - 14px) 13px, calc(100% - 9px) 13px !important;
    background-size: 5px 5px, 5px 5px !important;
    background-repeat: no-repeat !important;
}
.cur-index {
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
}
.cur-total-name {
    font-weight: 600;
    background: #fff8e8 !important;
    cursor: default;
}
.cur-subject-input::-webkit-search-cancel-button,
.cur-subject-input::-webkit-search-decoration {
    -webkit-appearance: none;
    appearance: none;
    display: none;
}
@media (max-width: 900px) {
    .cur-node-main {
        grid-template-columns: auto 1fr !important;
    }
    .cur-control,
    .cur-index,
    .cur-name-slot,
    .cur-node-actions {
        grid-column: 1 / -1;
    }
}

.cur-table-toolbar {
    margin-bottom: 8px;
}
.cur-table-toolbar h2 { display: none; }
.cur-legend { display: none !important; }

.cur-node-main {
    grid-template-columns: auto 72px minmax(160px, 1fr) max-content auto !important;
    align-items: center;
}
.cur-node-main > .cur-badge,
.cur-node-main > .cur-index,
.cur-node-main > .cur-name-slot,
.cur-node-main > .cur-control,
.cur-node-main > .cur-node-actions {
    height: 32px;
}
.cur-badge {
    height: 32px;
    box-sizing: border-box;
}
.cur-name-slot,
.cur-subject-wrap {
    height: 32px;
}
.cur-node-main input,
.cur-subject-input,
select.cur-control {
    height: 32px !important;
    min-height: 32px;
    min-width: 0 !important;
    margin: 0;
}
.cur-node-actions {
    height: 32px;
    align-items: center;
}
.cur-control {
    width: max-content !important;
    max-width: 12rem;
    justify-self: start;
}
select.cur-control {
    width: auto !important;
    min-width: 7.5rem !important;
    max-width: 12rem;
    padding-right: 28px !important;
}

.cur-total-bar {
    margin-top: 10px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-left: 4px solid #f59e0b;
    border-radius: 8px;
    background: #fffbf2;
}
.cur-total-main {
    display: flex;
    align-items: center;
    gap: 12px;
    height: 32px;
}


.diploma-modal.document-modal {
    width: min(760px, calc(100vw - 24px));
    max-height: calc(100dvh - 24px);
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden !important;
}
.diploma-modal-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 8px;
}
.diploma-modal .document-section {
    margin: 12px 24px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
}
.diploma-modal .document-section h3 {
    margin: 0 0 10px;
    font-size: .92rem;
    font-weight: 600;
}
.diploma-modal .form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 12px;
    margin-top: 0;
}
.diploma-modal .form-grid .span-2 { grid-column: 1 / -1; }
.diploma-modal .check-label {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-direction: row;
}
.diploma-modal .check-label input { width: auto; min-width: 0; }
.diploma-modal .document-actions {
    flex-shrink: 0;
    margin-top: 0;
    padding: 12px 24px 16px;
    border-top: 1px solid var(--border);
    background: #fcfefd;
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}
.diploma-modal .table-wrap.compact { max-height: 180px; overflow: auto; margin: 0; }

.page-header .page-title { margin: 0; font-size: 1.25rem; }

.dip-student-wrap { position: relative; }
.dip-student-input { width: 100%; }
.dip-student-bound {
    display: inline-block;
    margin-top: 6px;
    font-size: .82rem;
    color: var(--green-dark);
}
.dip-student-bound.muted { color: var(--text-muted); }
.dip-student-menu {
    position: absolute;
    left: 0; right: 0; top: calc(100% + 4px);
    z-index: 40;
    max-height: 260px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,.12);
}
.dip-student-option {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    padding: 8px 12px;
    border: 0;
    background: transparent;
    text-align: left;
    cursor: pointer;
    color: #1a1a1a;
}
.dip-student-option:hover { background: #f2f4f3; }
.dip-student-name { font-weight: 500; }
.dip-student-group { color: var(--text-muted); font-size: .86rem; white-space: nowrap; }
.dip-student-empty { padding: 10px 12px; color: var(--text-muted); font-size: .9rem; }


td.warn { color: #a15c00; font-weight: 600; }
.contract-modal .section-heading { display:flex; justify-content:space-between; align-items:center; gap:8px; margin:16px 0 8px; flex-wrap:wrap; }
.contract-modal .section-heading h3 { margin:0; font-size:1rem; }
.fact-add { margin-top:8px; padding:10px; background:var(--bg); border-radius:8px; }
.muted { color: var(--muted, #667); font-size: .9rem; }


.ctr-student-wrap { position: relative; }
.ctr-student-input { width: 100%; }
.ctr-student-bound { display: inline-block; margin-top: 6px; font-size: .82rem; color: var(--green-dark); }
.ctr-student-bound.muted { color: var(--text-muted); }
.ctr-student-menu {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 40;
  max-height: 260px; overflow-y: auto; background: #fff;
  border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,.12);
}
.ctr-student-option {
  display: flex; justify-content: space-between; gap: 12px; width: 100%;
  padding: 8px 12px; border: 0; background: transparent; text-align: left; cursor: pointer; color: #1a1a1a;
}
.ctr-student-option:hover { background: #f2f4f3; }
.ctr-student-name { font-weight: 500; }
.ctr-student-group { color: var(--text-muted); font-size: .86rem; white-space: nowrap; }
.ctr-student-empty { padding: 10px 12px; color: var(--text-muted); font-size: .9rem; }
.contract-modal .section-hint { color: var(--text-muted); font-size: .85rem; margin: 0 0 8px; }
.contract-modal .form-grid .span-2 { grid-column: 1 / -1; }


.contract-payments .section-heading { gap: 12px; flex-wrap: wrap; }
.contract-payments .section-heading-left { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.contract-payments .section-heading-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-left: auto; }
.contract-modal .pay-balance { font-size: .85rem; }
.payment-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface);
}
.payment-list .form-grid {
  display: grid;
  grid-template-columns: 72px 1fr auto;
  align-items: end;
  gap: 8px 10px;
  margin: 0;
  padding: 8px 10px;
  background: transparent;
  border-radius: 0;
  border-bottom: 1px solid var(--border);
}
.payment-list .form-grid:last-child,
.payment-list .pay-row:last-child { border-bottom: 0; }
.payment-list .form-grid button { margin: 0; align-self: end; }
.payment-list .pay-row {
  display: grid;
  grid-template-columns: 56px minmax(90px, 1.1fr) minmax(120px, 1fr) auto minmax(120px, 1fr) auto;
  align-items: end;
  gap: 8px 10px;
  margin: 0;
  padding: 8px 10px;
  background: transparent;
  border-bottom: 1px solid var(--border);
}
.payment-list .pay-row.is-paid { background: #f7faf8; }
.payment-list .pay-cell {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  font-size: .82rem;
  color: var(--text-muted);
}
.payment-list .pay-cell input {
  width: 100%;
  min-width: 0;
  margin: 0;
}
.payment-list .pay-paid-wrap {
  flex-direction: row;
  align-items: center;
  gap: 6px;
  padding-bottom: 9px;
  white-space: nowrap;
  color: var(--text);
}
.payment-list .pay-paid-wrap input.pay-paid {
  width: auto;
  min-width: 0;
  margin: 0;
  accent-color: var(--green-dark, #2f6b4f);
}
.payment-list .pay-del {
  width: 32px;
  min-width: 32px;
  padding: 4px;
  margin: 0 0 1px;
  align-self: end;
  font-size: 1.05rem;
  line-height: 1;
}
@media (max-width: 700px) {
  .payment-list .pay-row {
    grid-template-columns: 56px 1fr 1fr;
  }
  .payment-list .pay-del { grid-column: 1 / -1; justify-self: end; }
  .payment-list .form-grid { grid-template-columns: 72px 1fr auto; }
}


.form-toolbar { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.collapsible-section { border: 1px solid var(--border); border-radius: 8px; padding: 0; overflow: hidden; background: var(--surface); }
.collapsible-section > summary.collapsible-summary {
  list-style: none; cursor: pointer; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
  padding: 10px 12px; user-select: none;
}
.collapsible-section > summary::-webkit-details-marker { display: none; }
.collapsible-section > summary::before {
  content: "▸"; color: var(--text-muted); font-size: .85rem; width: 1em;
}
.collapsible-section[open] > summary::before { content: "▾"; }
.collapsible-title { font-weight: 600; font-size: 1rem; color: var(--green-dark, inherit); }
.collapsible-hint { font-size: .85rem; }
.collapsible-body { padding: 0 14px 14px; margin: 0; }
.history-modal-card { width: min(640px, calc(100vw - 32px)); max-height: min(80dvh, 720px); display:flex; flex-direction:column; }
.history-timeline { padding: 8px 20px 20px; overflow-y: auto; display:flex; flex-direction:column; gap: 12px; }
.history-empty { color: var(--text-muted); padding: 24px 0; text-align: center; }
.history-item {
  border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; background: var(--bg, #f7f9f8);
}
.history-item-head { display:flex; justify-content:space-between; gap:12px; flex-wrap:wrap; margin-bottom: 6px; }
.history-item-when { font-size: .85rem; color: var(--text-muted); }
.history-item-actor { font-size: .9rem; font-weight: 500; }
.history-item-summary { font-size: .86rem; color: var(--text-muted); margin-bottom: 8px; }
.history-fields { display:flex; flex-direction:column; gap:6px; }
.history-field { display:grid; grid-template-columns: 140px 1fr; gap: 8px; align-items: start; font-size: .9rem; }
.history-field-label { color: var(--text-muted); }
.history-field-vals { display:flex; flex-wrap:wrap; gap:6px; align-items:center; }
.history-chip {
  display:inline-block; padding: 2px 8px; border-radius: 999px; font-size: .82rem;
  border: 1px solid var(--border); background: var(--surface);
}
.history-chip.old { opacity: .75; text-decoration: line-through; }
.history-chip.new { border-color: #8bb89a; background: #f0f7f2; }
.history-arrow { color: var(--text-muted); font-size: .8rem; }
@media (max-width: 600px) {
  .history-field { grid-template-columns: 1fr; }
}


[hidden], .hidden { display: none !important; }
:focus-visible { outline: 2px solid var(--green-dark); outline-offset: 3px; }
    button:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.book-content { display: flex; flex-direction: column; gap: var(--space); }
.book-content > .table-wrap { min-height: 0; overflow: auto; }
.actions-spacer, .lesson-actions-spacer { flex: 1; }
.form-grid > *, .cur-meta-grid > *, .section-heading > * { min-width: 0; }
.form-grid .span-2 { grid-column: 1 / -1; }
.form-grid textarea { width: 100%; }
.header-brand, .header-account { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-name { font-weight: 700; font-size: 1rem; white-space: nowrap; }
#header-user-name { font-size: .85rem; max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.header-icon { padding: 4px; background: transparent; color: white; }
.header-icon:hover { background: rgba(255,255,255,.15); }
#title { font-size: 1.1rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#content > .filters, #content > .page-toolbar, #content > .form-toolbar, .cur-editor-top {
    padding: 10px 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.filters > label { flex: 0 1 170px; }
.filters > label:has(input[type="search"]) { flex-basis: 220px; }
.filters > label:has(input[type="date"]) { flex-basis: 142px; }
.filters > label > :is(input, select), .filters .related-search-wrap { width: 100%; min-width: 0; }
.filters > label.report-type-label { flex-basis: 240px; }
.toolbar-add { margin-left: auto; }
.schedule-toolbar .toolbar-left, .schedule-toolbar .toolbar-right { gap: 8px; min-width: 0; }
.schedule-toolbar .toolbar-right { margin-left: auto; }
.schedule-toolbar .period-nav > #btn-prev, .schedule-toolbar .period-nav > #btn-next { width: 32px; padding: 0; }
.schedule-toolbar .view-switch { height: var(--control-height); }
.schedule-toolbar .view-switch .view-btn { height: 34px; padding: 6px 10px; }
.schedule-list, .table-wrap, .modal-card, .lesson-form { scrollbar-width: thin; scrollbar-color: #c8d5cd transparent; }
.schedule-board-header { padding-right: 20px; }
.schedule-day-sep { flex-shrink: 0; }
.schedule-col { overflow-wrap: anywhere; }
.schedule-time { font-variant-numeric: tabular-nums; }
.schedule-list[aria-busy="true"] { opacity: .65; }
.table-wrap > table > thead { position: sticky; top: 0; z-index: 2; }
.table-wrap > table > thead th { white-space: normal; overflow-wrap: anywhere; }
.table-wrap > table > tbody > tr > td { overflow-wrap: anywhere; }
.empty, .loading, .schedule-empty { padding: 24px 16px; font-size: .9rem; }
.section-heading { align-items: center; gap: 10px; flex-wrap: wrap; }
.section-heading h3 { font-size: .95rem; }
.login-page { width: 100%; padding: 20px; overflow: auto; }
.login-card { padding: 28px; border-radius: var(--radius); }
@media (max-width: 1100px) {
    .schedule-toolbar .toolbar-right { margin-left: 0; }
}
@media (max-width: 900px) {
    header { padding: 0 12px; gap: 12px; }
    #content { padding: 12px; }
    #header-user-name { max-width: 160px; }
    .schedule-row { grid-template-columns: 68px minmax(0, 1fr); }
    .schedule-cabinet::before { content: 'Кабинет: '; color: var(--text-muted); }
    .schedule-cabinet > div, .schedule-teacher > div { display: inline; margin-right: 4px; }
    .table-wrap > table { min-width: 680px; }
    .cur-node-main { grid-template-columns: auto minmax(0, 1fr) !important; }
    .cur-node-main > :is(.cur-index, .cur-name-slot, .cur-control, .cur-node-actions) { grid-column: 1 / -1; }
}
@media (max-width: 600px) {
    html, body { height: auto; min-height: 100dvh; max-height: none; overflow: auto; }
    main { overflow: visible; }
    #content { overflow: visible; }

    .brand-name, #header-user-name { display: none; }
    #title { flex: 1; }
    .filters > label, .filters > label:has(input), .filters > label.report-type-label { flex: 1 1 140px; }
    .toolbar-add { margin-left: 0; }
    .schedule-toolbar .toolbar-left, .schedule-toolbar .toolbar-right { width: 100%; }
    .schedule-toolbar .toolbar-field { flex: 1 1 125px; }
    .schedule-toolbar .toolbar-field select { width: 100%; }
    .schedule-toolbar .period-nav { width: 100%; gap: 2px; }
    .schedule-toolbar .period-label { flex: 0 0 17.5rem; width: 17.5rem; white-space: nowrap; font-size: .8rem; padding-inline: 2px; }
    .modal-card { --dialog-padding: 16px; max-height: calc(100dvh - 16px); }
    .modal { align-items: center; }
    .form-grid, .entity-form-page .form-grid, .diploma-modal .form-grid { grid-template-columns: minmax(0, 1fr); }
    .form-grid > [style*="grid-column"] { grid-column: 1 / -1 !important; }
    .document-modal .modal-header { padding: 14px 16px; }
    .diploma-modal .document-section { margin: 10px 12px; padding: 12px; }
    .diploma-modal .document-actions { padding: 12px 16px; }
    .cur-editor-nav, .cur-editor-actions, .cur-node-actions { flex-wrap: wrap; }
    .page-bar { justify-content: center; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; }
}


select:not([multiple]) {
    width: max-content;
    min-width: 7rem;
    max-width: 100%;
    field-sizing: content;
}
.filters select,
.page-toolbar select,
.toolbar-field select,
.schedule-toolbar select {
    width: max-content;
    min-width: 8rem;
}

.form-grid label > select,
.lesson-field > select,
.modal-card select.select-block,
.select-block {
    width: 100%;
    min-width: 0;
    field-sizing: fixed;
}


.schedule-pair-block {
    margin: 0;
}
.schedule-pair-sep {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    margin: 0;
    padding: 8px 14px;
    border: 0;
    border-radius: 0;
    border-top: 1px solid var(--border, #d0ddd4);
    border-bottom: 1px solid var(--border, #d0ddd4);
    background: #f3f7f4;
    color: var(--green-dark, #2f4a38);
    font: inherit;
    font-size: 0.82rem;
    font-weight: 650;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    text-align: left;
    cursor: pointer;
}
.schedule-pair-sep:hover {
    background: #e9f1eb;
}
.schedule-pair-sep:focus-visible {
    outline: 2px solid var(--green, #3d7a54);
    outline-offset: -2px;
}
.schedule-pair-sep-chev {
    width: 1.35rem;
    flex: 0 0 auto;
    opacity: 0.85;
    font-size: 1.15rem;
    line-height: 1;
    font-weight: 700;
}
.schedule-pair-sep-label {
    flex: 0 1 auto;
}
.schedule-pair-sep-count {
    flex: 0 0 auto;
    min-width: 1.4rem;
    padding: 0 6px;
    border: 1px solid #c5d5ca;
    border-radius: 0;
    background: #fff;
    color: #4a6354;
    font-size: 0.75rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    text-align: center;
}
.schedule-pair-sep-time {
    margin-left: auto;
    font-weight: 500;
    opacity: 0.7;
    font-variant-numeric: tabular-nums;
    text-transform: none;
    letter-spacing: 0;
}
.schedule-pair-body {
    display: flex;
    flex-direction: column;
}
.schedule-pair-block.is-collapsed .schedule-pair-body {
    display: none;
}
.schedule-day-sep + .schedule-pair-block .schedule-pair-sep {
    border-top: 0;
}


.filters > label:has(select.select-fio),
.filters > label:has(select[id*="teacher" i]),
.filters > label:has(select[id*="student" i]),
.filters > label:has(select[id*="curator" i]),
.filters > label:has(input.select-fio-input),
.filters > label:has(input[type="search"]) {
    flex: 1 1 220px;
    max-width: 300px;
    min-width: 0;
}
.filters select.select-fio,
.filters select[id*="teacher" i],
.filters select[id*="student" i],
.filters select[id*="curator" i],
.filters select[id*="employee" i],
.filters .select-fio-input,
.filters input[type="search"] {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    field-sizing: fixed !important;
    box-sizing: border-box;
    overflow: hidden;
    text-overflow: ellipsis;
}
.schedule-toolbar .toolbar-field-combo {
    flex: 1 1 180px;
    max-width: 260px;
    min-width: 0;
}
.schedule-toolbar .toolbar-combo,
.schedule-toolbar .related-search-wrap {
    width: 100%;
    min-width: 0;
    max-width: 100%;
}
.schedule-toolbar .select-fio-input,
.schedule-toolbar input[type="search"] {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    field-sizing: fixed !important;
    box-sizing: border-box;
}
.schedule-toolbar .toolbar-field select {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    field-sizing: fixed !important;
}
.schedule-toolbar .toolbar-right {
    flex: 1 1 auto;
    flex-wrap: wrap;
    min-width: 0;
    align-items: flex-end;
}


select.select-fio,
#teacher,
#student-filter,
#f-curator,
#f-student,
select[id*="teacher" i],
select[id*="student" i],
select[id*="curator" i],
select[id*="employee" i] {
    width: max-content !important;
    min-width: 12rem !important;
    max-width: none !important;
    field-sizing: content !important;
}

.lesson-field > select.select-fio,
.lesson-field > #f-teacher,
.form-grid label > select.select-fio,
.form-grid label > #f-teacher,
.form-grid label > #f-curator,
.form-grid label > #f-student {
    width: max-content !important;
    min-width: 10rem !important;
    field-sizing: content !important;
}


.toolbar-combo {
    min-width: 12rem;
}
.toolbar-combo .select-fio-input,
.select-fio-input {
    width: max-content;
    min-width: 12rem;
    max-width: min(560px, 90vw);
    field-sizing: content;
}
.toolbar-field-combo {
    min-width: 0;
}
.lesson-field-fio .related-search-wrap,
.lesson-field-full .related-search-wrap {
    width: 100%;
}
.lesson-field-fio .select-fio-input {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}
.lesson-modal-card .related-suggest {
    z-index: 2100;
}

.lesson-form .related-search-wrap {
    overflow: visible;
}
.lesson-field {
    overflow: visible;
}

.schedule-toolbar .toolbar-right {
    overflow: visible;
}
.schedule-toolbar .toolbar-field-combo .related-search-wrap input {
    overflow: visible;
    text-overflow: clip;
}


.dir-layout {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 12px;
    min-height: 0;
    flex: 1 1 auto;
}
.dir-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 8px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: auto;
    max-height: calc(100dvh - 120px);
}
.dir-nav-btn {
    text-align: left;
    border: none;
    background: transparent;
    padding: 8px 10px;
    border-radius: 8px;
    font: inherit;
    font-size: 0.88rem;
    color: var(--text);
    cursor: pointer;
}
.dir-nav-btn:hover { background: var(--green-soft); }
.dir-nav-btn.active {
    background: var(--green-soft);
    color: var(--green-dark);
    font-weight: 600;
}
.dir-main {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
    min-height: 0;
}
.dir-main .table-wrap { flex: 1 1 auto; min-height: 0; }
.dir-row-inactive td { opacity: 0.55; }
.dir-actions { display: flex; gap: 6px; justify-content: flex-end; white-space: nowrap; }
@media (max-width: 900px) {
    .dir-layout { grid-template-columns: 1fr; }
    .dir-nav { flex-direction: row; flex-wrap: wrap; max-height: none; }
}


.filters.filters-combos {
    align-items: flex-end;
    row-gap: 10px;
}
.filters.filters-combos > label.filter-grow {
    flex: 1 1 200px;
    max-width: 320px;
    min-width: 160px;
}
.filters.filters-combos > label.filter-combo {
    flex: 1 1 160px;
    max-width: 240px;
    min-width: 140px;
}
.filters.filters-combos > label:has(input[type="date"]) {
    flex: 0 0 138px;
    max-width: 148px;
}
.filters.filters-combos > label:has(#control-type),
.filters.filters-combos > label:has(select:not(.select-fio)) {
    flex: 0 1 150px;
    max-width: 180px;
}
.filters .related-search-wrap {
    width: 100%;
    min-width: 0;
}
.filters .related-search-wrap input[type="search"] {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    box-sizing: border-box;
}
.form-grid .related-search-wrap {
    width: 100%;
}
.form-grid .related-search-wrap input[type="search"] {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box;
}


#dir-modal .form-grid label.dir-check-label,
.dir-check-label {
    display: flex !important;
    flex-direction: row !important;
    align-items: center;
    gap: 8px;
    width: max-content;
    max-width: 100%;
    grid-column: 1 / -1;
}
#dir-modal .form-grid label.dir-check-label input[type="checkbox"],
.dir-check-label input[type="checkbox"],
.form-grid label > input[type="checkbox"] {
    width: 18px !important;
    min-width: 18px !important;
    max-width: 18px !important;
    height: 18px !important;
    flex: 0 0 18px !important;
    align-self: center;
}

#entity-modal .related-suggest {
    z-index: 2100;
}


.modal .related-suggest,
.modal .ctr-student-menu,
.modal .dip-student-menu,
.modal .cur-subject-menu,
.related-suggest,
.ctr-student-menu,
.dip-student-menu,
.cur-subject-menu {
    z-index: 2200;
}


.report-flex-filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 8px 10px;
    align-items: flex-end;
    width: 100%;
}
.report-flex-filters > label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
}
.report-flex-filters > label.filter-combo {
    max-width: none;
}
.report-flex-filters input,
.report-flex-filters select {
    min-height: var(--control-height);
    width: 100%;
    min-width: 0;
}

.mail-teacher { display:flex; align-items:center; gap:8px; padding:5px 0; }
.mail-teacher input { width:auto; min-height:0; }
#schedule-mail-modal .modal-body { display:grid; gap:10px; }

/* Certificate editor and classroom availability controls. */
.certificate-modal { max-width: 760px; }
.certificate-fields:empty { display: none; }
.certificate-fields:not(:empty) { margin-top: 12px; }
.certificate-section { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }
.certificate-section h3 { margin: 0 0 4px; font-size: .95rem; }
.certificate-section > p { margin: 0 0 12px; font-size: .85rem; }
.certificate-section .related-search-wrap input { width: 100%; }
.certificate-recipients { list-style: none; flex-direction: column; align-items: stretch; max-height: 200px; overflow: auto; padding: 0; }
.certificate-recipients:empty { display: none; }
.certificate-help { font-size: .8rem; color: var(--text-muted); overflow-wrap: anywhere; }
.certificate-help summary { cursor: pointer; }
.certificate-help p { margin: 8px 0 0; line-height: 1.6; }
.room-toolbar .room-range { display: flex; align-items: center; gap: 8px; border: 0; padding: 0; margin: 0; min-width: 0; }
.room-range legend { padding: 0; margin-bottom: 4px; font-size: .78rem; color: var(--text-muted); font-weight: 500; }
.room-range label { flex: 1; min-width: 0; }
.room-range input, .room-range select { width: 100%; min-width: 0; }
.room-toolbar .room-pairs { flex: 1 1 300px; }
.room-toolbar-meta { flex: 1 0 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 8px; border-top: 1px solid var(--border); font-size: .8rem; }
.room-toolbar .room-free-label { flex-direction: row; align-items: center; gap: 8px; cursor: pointer; }
.room-free-label input { width: 17px; height: 17px; margin: 0; accent-color: var(--primary); }
.room-table { table-layout: auto; }
.room-table :is(th, td) { overflow-wrap: normal; word-break: normal; }
.room-table th { white-space: nowrap; }
@media (max-width: 600px) {
    .room-toolbar > label, .room-toolbar .room-range { flex: 1 1 100%; }
    .room-toolbar #room-now { flex: 1 1 100%; }
}
