:root {
    --bg: #f4f6f8;
    --panel: #ffffff;
    --ink: #1c2430;
    --muted: #67707c;
    --line: #d9e0e7;
    --accent: #2563eb;
    --accent-ink: #ffffff;
    --ok: #0f9d58;
    --warn: #b45309;
    --err: #b91c1c;
    --radius: 10px;
    --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 4px 12px rgba(16, 24, 40, .05);
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--ink);
    font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.topbar {
    display: flex;
    align-items: center;
    gap: 24px;
    flex-wrap: wrap;
    padding: 12px 20px;
    background: var(--panel);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 10;
}

.brand {
    font-weight: 700;
    font-size: 17px;
    color: var(--ink);
}

.brand:hover {
    text-decoration: none;
}

.nav {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    flex: 1;
}

.nav a {
    padding: 7px 12px;
    border-radius: 8px;
    color: var(--muted);
    font-weight: 500;
}

.nav a:hover {
    background: #eef2f7;
    text-decoration: none;
}

.nav a.active {
    background: #e6edfd;
    color: var(--accent);
}

.logout {
    display: flex;
    align-items: center;
    gap: 12px;
}

.who {
    color: var(--muted);
    font-size: 14px;
}

.container {
    max-width: 1080px;
    margin: 0 auto;
    padding: 24px 20px 64px;
}

.footer {
    display: flex;
    justify-content: space-between;
    max-width: 1080px;
    margin: 0 auto;
    padding: 16px 20px 32px;
    color: var(--muted);
    font-size: 13px;
}

h1 {
    font-size: 24px;
    margin: 0 0 4px;
}

h2 {
    font-size: 18px;
    margin: 28px 0 12px;
}

h3 {
    font-size: 16px;
    margin: 0 0 10px;
}

.page-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}

.subtitle {
    color: var(--muted);
    margin: 0;
    font-size: 14px;
}

.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 18px;
    margin-bottom: 18px;
}

.grid {
    display: grid;
    gap: 16px;
}

.grid-2 {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.grid-3 {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.grid-4 {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.stat {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow);
}

.stat .label {
    color: var(--muted);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.stat .value {
    font-size: 26px;
    font-weight: 700;
    margin-top: 6px;
}

.form-row {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.field label {
    font-size: 13px;
    font-weight: 600;
    color: #374151;
}

.field .hint {
    font-size: 12px;
    color: var(--muted);
}

.field .err {
    font-size: 12px;
    color: var(--err);
}

.field.full {
    grid-column: 1 / -1;
}

input[type=text],
input[type=password],
input[type=email],
input[type=tel],
input[type=date],
input[type=number],
select,
textarea {
    width: 100%;
    padding: 9px 11px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--ink);
    font: inherit;
}

input:focus,
select:focus,
textarea:focus {
    outline: 2px solid #bfd3fb;
    border-color: var(--accent);
}

textarea {
    min-height: 78px;
    resize: vertical;
}

input.invalid {
    border-color: var(--err);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 16px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: var(--accent);
    color: var(--accent-ink);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

.btn:hover {
    filter: brightness(1.05);
    text-decoration: none;
}

.btn:disabled {
    opacity: .6;
    cursor: default;
}

.btn-ghost {
    background: transparent;
    color: var(--muted);
    border-color: var(--line);
}

.btn-ghost:hover {
    background: #eef2f7;
}

.btn-danger {
    background: var(--err);
}

.btn-sm {
    padding: 6px 11px;
    font-size: 13px;
}

.btn-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    margin-top: 4px;
}

.alert {
    padding: 12px 14px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-weight: 500;
}

.alert-ok {
    background: #e8f6ee;
    color: #0b6b3d;
    border: 1px solid #bfe4cf;
}

.alert-error {
    background: #fdeaea;
    color: var(--err);
    border: 1px solid #f5c6c6;
}

.alert-warn {
    background: #fdf3e3;
    color: var(--warn);
    border: 1px solid #f0dcb6;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    text-align: left;
    padding: 10px 8px;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
}

th {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--muted);
    font-weight: 600;
}

tr:last-child td {
    border-bottom: none;
}

td.num,
th.num {
    text-align: right;
    white-space: nowrap;
}

.badge {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    background: #eef2f7;
    color: var(--muted);
}

.badge-ok {
    background: #e8f6ee;
    color: #0b6b3d;
}

.badge-off {
    background: #f1f3f5;
    color: #6b7280;
}

.badge-err {
    background: #fdeaea;
    color: var(--err);
}

.muted {
    color: var(--muted);
}

.small {
    font-size: 13px;
}

.mono {
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}

.spacer {
    flex: 1;
}

.inline-form {
    display: inline;
}

.card-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 14px;
}

.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.login-card {
    width: 100%;
    max-width: 380px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: var(--shadow);
    padding: 26px;
}

.login-card h1 {
    font-size: 21px;
    margin-bottom: 6px;
}

.login-card .subtitle {
    margin-bottom: 20px;
}

.login-card .btn {
    width: 100%;
    margin-top: 6px;
}

.list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.list-item {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
}

.list-item .title {
    font-weight: 600;
}

.list-item .meta {
    color: var(--muted);
    font-size: 13px;
}

.empty {
    padding: 22px;
    text-align: center;
    color: var(--muted);
    background: var(--panel);
    border: 1px dashed var(--line);
    border-radius: var(--radius);
}

.calendar-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.calendar-grid {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--panel);
    box-shadow: var(--shadow);
    margin-bottom: 18px;
}

.calendar-weekdays,
.calendar-week {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
}

.calendar-weekdays {
    background: #eef2f7;
    border-bottom: 1px solid var(--line);
}

.calendar-weekdays div {
    padding: 8px 10px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--muted);
}

.calendar-week {
    border-bottom: 1px solid var(--line);
}

.calendar-week:last-child {
    border-bottom: none;
}

.calendar-day {
    min-height: 112px;
    padding: 6px 7px;
    border-right: 1px solid var(--line);
    background: var(--panel);
}

.calendar-day:last-child {
    border-right: none;
}

.calendar-day.out {
    background: #f8fafc;
}

.calendar-day.today {
    box-shadow: inset 0 0 0 2px #bfd3fb;
}

.calendar-day-head {
    font-size: 12px;
    color: var(--muted);
    margin-bottom: 5px;
}

.calendar-day.today .calendar-day-head {
    color: var(--accent);
    font-weight: 700;
}

.lesson-card {
    border: 1px solid var(--line);
    border-left: 3px solid var(--accent);
    border-radius: 8px;
    padding: 6px 8px;
    margin-bottom: 6px;
    background: #f8fbff;
    font-size: 13px;
}

.lesson-head {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.lesson-time {
    font-weight: 700;
    font-size: 12px;
}

.lesson-main {
    margin-top: 3px;
}

.lesson-main .title {
    font-weight: 600;
    font-size: 13px;
}

.lesson-main .meta {
    color: var(--muted);
    font-size: 12px;
}

.lesson-actions {
    margin-top: 4px;
}

.lesson-actions summary {
    font-size: 12px;
}

.lesson-form {
    display: grid;
    gap: 6px;
    margin-top: 6px;
}

.lesson-form input,
.lesson-form select {
    padding: 5px 7px;
    font-size: 12px;
}

.weekday-picker {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.weekday-picker label {
    display: flex;
    align-items: center;
    gap: 4px;
    font-weight: 500;
}

.checkline {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    font-size: 14px;
}
.password-once {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.password-once .password-value {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: .08em;
    margin: 6px 0;
    word-break: break-all;
}

.password-once .hint {
    font-size: 12px;
    color: var(--muted);
}
details {
    margin-top: 8px;
}

summary {
    cursor: pointer;
    font-weight: 600;
    color: var(--accent);
}

@media (max-width: 640px) {
    .container {
        padding: 16px 14px 48px;
    }

    .topbar {
        gap: 10px;
        padding: 10px 14px;
    }

    .who {
        display: none;
    }

    th,
    td {
        padding: 9px 6px;
    }

    h1 {
        font-size: 21px;
    }
.calendar-grid {
    overflow-x: auto;
}

.calendar-weekdays,
.calendar-week {
    min-width: 720px;
}
}
/* Горизонтальная прокрутка широких таблиц на смартфонах. */
.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

@media (max-width: 640px) {
    .table-wrap table {
        min-width: 560px;
    }

    .stat .value {
        font-size: 20px;
    }

    .grid-4 {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    }

    .nav {
        gap: 4px;
    }

    .nav a {
        padding: 6px 9px;
        font-size: 14px;
    }

    .topbar {
        position: static;
    }

    .btn-row .btn {
        flex: 1 1 auto;
    }

    .page-head {
        margin-bottom: 14px;
    }

    h2 {
        margin: 22px 0 10px;
    }
}