:root {
    --bg: #f4f7fb;
    --card: #ffffff;
    --text: #1c2430;
    --muted: #5a6678;
    --brand: #3fa896;
    --brand-dark: #2a7f71;
    --border: #dde5ef;
    --danger: #b42318;
    --success: #027a48;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Segoe UI", Tahoma, sans-serif;
    color: var(--text);
    background: radial-gradient(circle at top right, #e7f4f2, var(--bg));
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 16px;
}

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

.site-header,
.site-footer {
    background: #fff;
    border-bottom: 1px solid var(--border);
}

.site-footer {
    margin-top: 40px;
    border-top: 1px solid var(--border);
    border-bottom: none;
    padding: 12px 0;
}

.footer-municipality-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: var(--text);
}

.footer-municipality-logo {
    width: 40px;
    height: 40px;
    object-fit: contain;
    display: block;
}

.footer-links {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.footer-counter {
    min-width: 170px;
    text-align: center;
}

.footer-counter-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--muted);
    margin-bottom: 2px;
}

.footer-counter-values {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 0.8rem;
    line-height: 1.2;
}

.footer-facebook-link {
    width: 40px;
    height: 40px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #1877f2;
    color: #fff;
    text-decoration: none;
}

.footer-facebook-link svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.contacts-facebook-link {
    width: auto;
    border-radius: 999px;
    gap: 8px;
    padding: 0 12px;
}

nav {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

nav a,
.brand {
    text-decoration: none;
    color: var(--text);
    font-weight: 600;
    padding: 14px 4px;
}

.main-nav {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-user-greeting {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--muted);
    white-space: nowrap;
    max-width: min(44vw, 520px);
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav-hamburger {
    position: relative;
}

.nav-hamburger > summary {
    list-style: none;
    cursor: pointer;
    color: #fff;
    font-weight: 600;
    padding: 9px 12px;
    user-select: none;
    border: 1px solid var(--brand);
    border-radius: 10px;
    background: var(--brand);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    line-height: 1;
}

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

.nav-hamburger-icon {
    font-size: 1.15rem;
}

.nav-hamburger-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    min-width: 250px;
    max-height: min(72vh, 620px);
    overflow: auto;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 10px 24px rgba(16, 24, 40, 0.12);
    padding: 6px;
    z-index: 1200;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-hamburger-menu a {
    font-weight: 600;
    color: var(--text);
    text-decoration: none;
    padding: 8px 10px;
    border-radius: 8px;
}

.nav-hamburger-menu a:hover {
    background: #f2f4f7;
}

.nav-lang-switch {
    display: flex;
    gap: 6px;
    padding: 4px 6px 8px;
    border-bottom: 1px dashed var(--border);
    margin-bottom: 4px;
}

.nav-lang-switch a {
    padding: 5px 8px;
    border-radius: 7px;
    background: #f2f4f7;
    font-size: 0.82rem;
}

.brand {
    color: var(--brand);
    font-size: 1.1rem;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.brand span {
    white-space: nowrap;
}

.brand-logo {
    width: 40px;
    height: 40px;
    border-radius: 4px;
    object-fit: cover;
    display: block;
}

main {
    padding: 24px 0;
}

h1,
h2,
h3 {
    margin-top: 0;
}

.hero {
    background: linear-gradient(140deg, #ecfdf8, #e9f2ff);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 24px;
    margin-bottom: 24px;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 14px;
}

.grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 14px;
    margin-bottom: 16px;
}

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px;
    margin-bottom: 14px;
}

.form-card label {
    display: block;
    margin-top: 8px;
    margin-bottom: 4px;
    color: var(--muted);
    font-size: 0.9rem;
}

input,
select,
textarea,
button {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 10px;
    font: inherit;
}

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

.btn,
button {
    cursor: pointer;
    background: var(--brand);
    color: #fff;
    border: 1px solid var(--brand);
    margin-top: 10px;
}

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

.auth-wrap {
    display: flex;
    justify-content: center;
}

.auth-wrap .form-card {
    max-width: 450px;
    width: 100%;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 10px;
    margin-bottom: 14px;
}

.stat-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px;
    text-align: center;
}

.stat-card strong {
    font-size: 1.5rem;
    display: block;
}

.lesson-stat-present,
.lesson-stat-excused {
    background: #ecfdf3;
    border-color: #abefc6;
    color: #027a48;
}

.lesson-stat-absent {
    background: #fef3f2;
    border-color: #fecdca;
    color: #b42318;
}

.lesson-stat-late {
    background: #fffaeb;
    border-color: #fedf89;
    color: #b54708;
}

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

#admin-page {
    display: flex;
    flex-direction: column;
}

#admin-page .compact-admin-tools {
    order: -100;
}

table {
    border-collapse: collapse;
    width: 100%;
    background: #fff;
}

th,
td {
    border: 1px solid var(--border);
    padding: 8px;
    text-align: left;
    font-size: 0.92rem;
}

.alert {
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 12px;
}

.alert-success {
    background: #ecfdf3;
    border: 1px solid #abefc6;
    color: var(--success);
}

.alert-error {
    background: #fef3f2;
    border: 1px solid #fecdca;
    color: var(--danger);
}

.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
}

.photo-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
    margin: 0;
    overflow: hidden;
}

.photo-card img {
    width: 100%;
    height: 140px;
    object-fit: cover;
}

.photo-card figcaption {
    padding: 8px;
    font-size: 0.9rem;
}

.team-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 14px;
}

.team-card {
    text-align: center;
}

.team-photo {
    width: 130px;
    height: 170px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--border);
    margin: 0 auto 10px;
    display: block;
    background: #f2f4f7;
}

.team-photo-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    font-size: 0.9rem;
}

.team-name {
    margin-bottom: 6px;
}

.team-specialization {
    margin: 0;
    color: var(--muted);
}

@media (max-width: 760px) {
    nav a,
    .brand,
    .nav-hamburger > summary {
        padding: 8px 2px;
    }

    .nav-hamburger > summary {
        padding: 8px 10px;
    }

    .nav-hamburger-menu {
        min-width: min(84vw, 290px);
    }

    .nav-user-greeting {
        max-width: 44vw;
        font-size: 0.82rem;
    }
}
.inline-form {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    margin-bottom: 6px;
}

.inline-form input,
.inline-form select,
.inline-form button {
    width: auto;
    min-width: 110px;
}

.danger {
    background: #b42318 !important;
    border-color: #b42318 !important;
}

.btn-edit {
    background: #facc15 !important;
    border-color: #eab308 !important;
    color: #1f2937 !important;
}

.btn-delete {
    background: #b42318 !important;
    border-color: #b42318 !important;
    color: #fff !important;
}
.accordion-item {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 8px;
    margin-bottom: 8px;
    background: #fff;
}

.accordion-item summary {
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    gap: 8px;
    align-items: center;
    font-weight: 600;
}

.accordion-item summary span {
    color: var(--muted);
    font-weight: 400;
    font-size: 0.9rem;
}

.accordion-form {
    margin-top: 10px;
}

.accordion-form input,
.accordion-form select,
.accordion-form button {
    min-width: 180px;
}

.btn-secondary {
    background: #ffffff !important;
    color: var(--text) !important;
    border: 1px solid var(--border) !important;
}

.btn-link {
    display: inline-block;
    padding: 6px 10px;
    border-radius: 6px;
    text-decoration: none;
    background: var(--brand);
    color: #fff;
    font-size: 0.88rem;
}

.warning {
    background: #facc15 !important;
    color: #1f2937 !important;
    border: 1px solid #eab308 !important;
}

.student-edit-open {
    padding: 4px 8px;
    font-size: 0.78rem;
}

.student-title {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 0;
}

.student-passport-thumb {
    width: 52px;
    height: 64px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid var(--border);
}

.student-photo-open {
    border: 0;
    padding: 0;
    background: transparent;
    cursor: zoom-in;
    line-height: 0;
}

.student-photo-modal {
    position: fixed;
    inset: 0;
    display: none;
    z-index: 2200;
}

.student-photo-modal.open {
    display: block;
}

.student-photo-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(16, 24, 40, 0.82);
}

.student-photo-dialog {
    position: relative;
    width: min(96vw, 1100px);
    height: min(92vh, 900px);
    margin: 4vh auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

.student-photo-dialog img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 8px;
    background: #fff;
}

.student-photo-close {
    position: absolute;
    top: 8px;
    right: 8px;
}

.modal-close-x {
    width: 34px !important;
    min-width: 34px !important;
    height: 34px;
    margin-top: 0 !important;
    padding: 0 !important;
    border-radius: 8px !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 700;
    line-height: 1;
}

.badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
}

.badge-present { background: #ecfdf3; color: #027a48; }
.badge-absent { background: #fef3f2; color: #b42318; }
.badge-late { background: #fff6ed; color: #b54708; }
.badge-excused { background: #eef4ff; color: #175cd3; }
.badge-muted { background: #f2f4f7; color: #344054; }

.lesson-status-select {
    border-width: 1px;
    border-style: solid;
}

.lesson-status-select.badge-present {
    border-color: #abefc6;
}

.lesson-status-select.badge-absent {
    border-color: #fecdca;
}

.lesson-status-select.badge-late {
    border-color: #fedf89;
}

.lesson-status-select.badge-excused {
    border-color: #c7d7fe;
}

.lesson-status-select.badge-muted {
    border-color: #d0d5dd;
}
.news-image {
    width: 100%;
    max-height: 220px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 8px;
}

.home-news-card {
    display: flex;
    flex-direction: column;
}

.home-news-summary {
    margin-bottom: 0;
}

.home-news-footer {
    margin-top: auto;
    padding-top: 10px;
}

.home-news-footer p {
    margin: 0 0 8px;
}

.home-news-footer small {
    display: block;
}

.feedback-praise {
    background: #ecfdf3 !important;
}

.feedback-note {
    background: #fef3f2 !important;
}

.news-images-admin {
    display: grid;
    gap: 8px;
}

.news-image-admin-item {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.news-gallery-link {
    display: block;
}

.news-modal {
    position: fixed;
    inset: 0;
    display: none;
    z-index: 2000;
}

.news-modal.open {
    display: block;
}

.news-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(16, 24, 40, 0.82);
}

.news-modal-content {
    position: relative;
    width: min(92vw, 1200px);
    height: min(90vh, 900px);
    margin: 5vh auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

.news-modal-content img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 8px;
    background: #fff;
}

.news-modal-close,
.news-modal-nav {
    position: absolute;
    z-index: 2;
    width: auto;
    min-width: 96px;
    margin-top: 0;
}

.news-modal-close {
    top: 8px;
    right: 8px;
}

.news-modal-close.modal-close-x {
    width: 34px !important;
    min-width: 34px !important;
    height: 34px;
    padding: 0 !important;
}

.news-modal-nav.prev {
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
}

.news-modal-nav.next {
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
}

.student-edit-modal {
    position: fixed;
    inset: 0;
    display: none;
    z-index: 2100;
}

.student-edit-modal.open {
    display: block;
}

.student-edit-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(16, 24, 40, 0.68);
}

.student-edit-dialog {
    position: relative;
    z-index: 1;
    width: min(900px, 94vw);
    max-height: 90vh;
    overflow: auto;
    margin: 5vh auto;
}

.admin-form-open {
    margin: 2px 6px 2px 0;
}

.admin-form-dialog form {
    display: block;
}

.compact-admin-tools .grid-2 {
    display: block;
}

.compact-subsection {
    margin-bottom: 14px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fafcff;
}

.compact-subsection h3 {
    margin: 0 0 10px 0;
    font-size: 1rem;
    color: var(--brand-dark);
}

.compact-subgrid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 12px;
}

.admin-quick-actions {
    margin-top: 12px;
    margin-bottom: 14px;
}

.admin-quick-actions-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 10px;
    margin-top: 10px;
}

.admin-form-open.admin-quick-action {
    display: block;
    text-align: center;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #f8fbff;
    color: var(--brand-dark);
}

.admin-form-open.admin-quick-action:hover {
    background: #eef6ff;
}

.library-tree-wrap {
    overflow-x: auto;
}

.library-tree {
    list-style: none;
    margin: 0;
    padding-left: 16px;
}

.library-tree > li {
    margin: 8px 0;
}

.library-folder-details {
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #f9fbff;
    padding: 8px;
}

.library-folder-details > summary {
    cursor: pointer;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    list-style: none;
}

.library-folder-details > summary::-webkit-details-marker {
    display: none;
}

.library-node {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #f9fbff;
}

.library-folder-label {
    font-weight: 700;
    color: var(--brand-dark);
}

.library-file-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    padding: 6px 0;
}

.library-node-meta {
    color: var(--muted);
    font-size: 0.86rem;
}

.library-folder-content {
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px dashed var(--border);
}

.library-inline-form {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin: 8px 0;
}

.library-inline-form input,
.library-inline-form select,
.library-inline-form button {
    width: auto;
    min-width: 140px;
}

.library-file-item {
    border-bottom: 1px solid #edf1f7;
    padding-bottom: 8px;
    margin-bottom: 8px;
}

.library-file-item:last-child {
    border-bottom: 0;
    margin-bottom: 0;
    padding-bottom: 0;
}

.library-tree-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.library-tree-actions button {
    width: auto;
    min-width: 130px;
    margin-top: 0;
}

.notification-unread {
    background: #eef6ff;
    border-left: 3px solid #2a7f71;
    padding: 8px;
    margin-bottom: 8px;
}

.progress-row {
    margin-bottom: 12px;
}

.progress-row span {
    display: block;
    margin-bottom: 4px;
    font-size: 0.92rem;
}

.progress-bar {
    width: 100%;
    height: 10px;
    border-radius: 999px;
    background: #e8eef6;
    overflow: hidden;
}

.progress-bar i {
    display: block;
    height: 100%;
    background: var(--brand);
}

.progress-bar.danger i {
    background: #d92d20;
}

.progress-bar.warn i {
    background: #f79009;
}

.progress-bar.info i {
    background: #175cd3;
}

.progress-bar.muted i {
    background: #667085;
}

.risk-box {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 12px;
}

.risk-box.risk-low {
    background: #ecfdf3;
    border-color: #abefc6;
}

.risk-box.risk-medium {
    background: #fff8eb;
    border-color: #fec84b;
}

.risk-box.risk-high {
    background: #fef3f2;
    border-color: #fecdca;
}

.calendar-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.calendar-nav-actions {
    display: flex;
    gap: 8px;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 8px;
}

.calendar-grid-head {
    margin-bottom: 8px;
}

.calendar-head-cell {
    text-align: center;
    font-weight: 700;
    font-size: 0.88rem;
    color: var(--muted);
}

.calendar-grid-body.calendar-grid-month .calendar-cell {
    min-height: 150px;
}

.calendar-grid-body.calendar-grid-week .calendar-cell {
    min-height: 220px;
}

.calendar-cell {
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.calendar-cell-outside {
    background: #f8fafc;
    opacity: 0.8;
}

.calendar-cell-today {
    border-color: var(--brand);
    box-shadow: inset 0 0 0 1px rgba(19, 111, 99, 0.22);
}

.calendar-cell-date {
    font-size: 0.86rem;
    font-weight: 700;
    color: #344054;
}

.calendar-cell-items {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.calendar-item {
    display: block;
    font-size: 0.82rem;
    line-height: 1.25;
    border-radius: 8px;
    padding: 5px 7px;
    border: 1px solid transparent;
    background: #f2f4f7;
    color: #111827;
    text-decoration: none;
}

.calendar-item strong {
    margin-right: 4px;
}

.calendar-item-lesson {
    background: #eef4ff;
    border-color: #c7d7fe;
}

.calendar-item-test {
    background: #fff8eb;
    border-color: #fedf89;
}

.calendar-item-event {
    background: #ecfdf3;
    border-color: #abefc6;
}

.calendar-more {
    color: var(--muted);
    font-size: 0.78rem;
}

.calendar-item-draggable {
    cursor: grab;
}

.calendar-item-draggable.dragging {
    opacity: 0.55;
    cursor: grabbing;
}

.calendar-cell.drag-over {
    outline: 2px dashed var(--brand);
    outline-offset: -3px;
}

.doc-preview-render {
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
    padding: 16px;
    line-height: 1.55;
}

.doc-preview-render h2 {
    margin-top: 0;
}

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

    .calendar-grid-head {
        display: none;
    }
}
