:root {
    --bg: #f4f6f9;
    --surface: #ffffff;
    --border-soft: #e6e9ee;
    --text-primary: #14171f;
    --text-muted: #8b93a1;
    --blue-600: #2f6fed;
    --blue-500: #3b82f6;
    --blue-50: #eaf1ff;
    --success: #2fb380;
    --danger: #e0564c;
    --radius-lg: 18px;
    --radius-md: 12px;
    --shadow-card: 0 2px 10px rgba(20, 23, 31, 0.06);
    color-scheme: light;
}

html[data-theme="dark"] {
    --bg: #0f1117;
    --surface: #191c24;
    --border-soft: #2a2e38;
    --text-primary: #eef1f6;
    --text-muted: #8e94a3;
    --blue-600: #4f86ff;
    --blue-500: #5b8fff;
    --blue-50: #1b2740;
    --success: #35c98d;
    --danger: #ef6a60;
    --shadow-card: 0 2px 14px rgba(0, 0, 0, 0.35);
    color-scheme: dark;
}

html[data-theme="dark"] body {
    background-image: url('/assets/background-night');
}

html[data-theme="dark"] .header-logo img,
html[data-theme="dark"] .brand-logo {
    filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.5)) brightness(1.05);
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
}

body {
    background-color: var(--bg);
    background-image: url('/assets/background');
    background-repeat: no-repeat;
    background-position: center center;
    background-size: cover;
    background-attachment: fixed;
    color: var(--text-primary);
    font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
    font-weight: 700;
    letter-spacing: -0.01em;
    margin: 0;
}

a {
    color: inherit;
    text-decoration: none;
}

.screen {
    max-width: 480px;
    margin: 0 auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ---------- Login screen ---------- */

.login-screen {
    justify-content: center;
    padding: 32px 24px;
    position: relative;
}

.brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    margin-bottom: 36px;
    animation: brandFadeIn 0.5s ease both;
}

@keyframes brandFadeIn {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.brand-emblem {
    width: 60px;
    height: 60px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    font-weight: 700;
    color: #ffffff;
    background: linear-gradient(135deg, var(--blue-500), var(--blue-600));
    box-shadow: 0 8px 20px rgba(47, 111, 237, 0.28);
}

.brand-logo {
    width: 64px;
    height: 64px;
    object-fit: contain;
    user-select: none;
    -webkit-user-drag: none;
    pointer-events: none;
    filter: drop-shadow(0 6px 14px rgba(47, 111, 237, 0.2));
}

.brand-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    text-align: center;
}

.brand-subtitle {
    font-size: 13px;
    color: var(--text-muted);
    text-align: center;
}

.login-card {
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: 22px;
    padding: 26px 22px;
    box-shadow: 0 12px 32px rgba(20, 23, 31, 0.09);
    animation: brandFadeIn 0.5s ease 0.08s both;
}

.field {
    margin-bottom: 16px;
}

.field label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 7px;
}

.field input {
    width: 100%;
    background: var(--bg);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-md);
    padding: 13px 14px;
    font-size: 16px; /* >=16px — не даёт Safari на iOS зумить страницу при фокусе */
    color: var(--text-primary);
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field input:focus {
    border-color: var(--blue-500);
    background: var(--surface);
    box-shadow: 0 0 0 3px var(--blue-50);
}

.btn-primary {
    width: 100%;
    background: var(--blue-600);
    color: #ffffff;
    font-weight: 600;
    font-size: 15px;
    padding: 13px 14px;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    margin-top: 4px;
    transition: filter 0.15s ease, transform 0.1s ease;
}

.btn-primary:hover {
    filter: brightness(1.06);
}

.btn-primary:active {
    transform: scale(0.98);
}

.btn-secondary {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--bg);
    color: var(--text-primary);
    font-weight: 600;
    font-size: 14px;
    padding: 12px 14px;
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-md);
    cursor: pointer;
    margin-top: 12px;
    text-decoration: none;
    box-sizing: border-box;
    transition: border-color 0.15s ease, background 0.15s ease, transform 0.1s ease;
}

.btn-secondary:hover {
    border-color: var(--blue-500);
    background: var(--blue-50);
}

.btn-secondary:active {
    transform: scale(0.98);
}

.form-error {
    background: #fdeceb;
    border: 1px solid #f6c9c4;
    color: var(--danger);
    font-size: 13px;
    border-radius: var(--radius-md);
    padding: 10px 12px;
    margin-bottom: 16px;
}

.form-success {
    background: #e7f8f0;
    border: 1px solid #b9e8d2;
    color: var(--success);
    font-size: 13px;
    border-radius: var(--radius-md);
    padding: 10px 12px;
    margin-bottom: 16px;
}

.login-footnote {
    margin-top: 20px;
    text-align: center;
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.6;
}

/* ---------- Dashboard shell ---------- */

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 20px 8px;
}

.topbar-greeting h1 {
    font-size: 19px;
    color: var(--text-primary);
}

.topbar-greeting p {
    margin: 4px 0 0;
    font-size: 13px;
    color: var(--text-muted);
}

.content {
    flex: 1;
    padding: 8px 16px 90px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

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

.tabbar {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 480px;
    display: flex;
    justify-content: space-around;
    background: var(--surface);
    border-top: 1px solid var(--border-soft);
    padding: 8px 4px 12px;
    z-index: 40;
}

.tabbar a {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    font-size: 11px;
    color: var(--text-muted);
    padding: 4px 8px;
    border-radius: 10px;
    transition: color 0.15s ease;
}

.tabbar a svg {
    stroke: currentColor;
}

.tabbar a.active {
    color: var(--blue-600);
    font-weight: 600;
}

/* ---------- Dashboard header logo ---------- */

.header-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 20px 4px;
}

.header-logo img {
    width: 32px;
    height: 32px;
    object-fit: contain;
    user-select: none;
    -webkit-user-drag: none;
    pointer-events: none;
}

.header-logo span {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
}

/* ---------- Dashboard cards ---------- */

.card-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.card-title-row h3 {
    font-size: 15px;
}

.block-icon-title {
    display: flex;
    align-items: center;
    gap: 9px;
}

.block-icon {
    width: 30px;
    height: 30px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.block-icon.grade { background: #eaf1ff; color: var(--blue-600); }
.block-icon.schedule { background: #eef2ff; color: #6366f1; }
.block-icon.notif { background: #fdeceb; color: var(--danger); }

.avg-grade-row {
    display: flex;
    align-items: baseline;
    gap: 10px;
}

.avg-grade-value {
    font-size: 38px;
    font-weight: 800;
    color: var(--blue-600);
    line-height: 1;
}

/* Цветовая шкала отметок (пункт 8): 1-3 плохо, 4-5 ниже среднего, 6-7 средне, 8-10 хорошо */
.grade-bad  { color: #e0564c; }
.grade-low  { color: #ec9a3c; }
.grade-mid  { color: #d4b106; }
.grade-good { color: #2fb380; }

span.grade-bad, .mark-chip.grade-bad  { background: #fdeceb; color: #e0564c; }
span.grade-low, .mark-chip.grade-low  { background: #fef3e6; color: #b9711f; }
span.grade-mid, .mark-chip.grade-mid  { background: #fdf8e0; color: #92790a; }
span.grade-good, .mark-chip.grade-good { background: #e7f8f0; color: #2fb380; }

.avg-grade-label {
    font-size: 13px;
    color: var(--success);
    font-weight: 600;
    margin-top: 6px;
}

.lesson-row {
    display: flex;
    gap: 10px;
    padding: 9px 0;
    border-top: 1px solid var(--border-soft);
}

.lesson-row:first-child {
    border-top: none;
}

.lesson-num {
    width: 20px;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 600;
    flex-shrink: 0;
}

.lesson-time {
    font-size: 12px;
    color: var(--text-muted);
}

.lesson-name {
    font-size: 14px;
    font-weight: 600;
}

.lesson-room {
    font-size: 12px;
    color: var(--text-muted);
}

.link-more {
    font-size: 13px;
    color: var(--blue-600);
    font-weight: 600;
    display: inline-block;
    margin-top: 10px;
}

.notif-badge {
    background: var(--danger);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    border-radius: 999px;
    padding: 2px 7px;
}

/* ---------- Schedule: view toggle ---------- */

.view-toggle {
    display: flex;
    gap: 6px;
    padding: 0 16px 10px;
}

.view-toggle a {
    flex: 1;
    text-align: center;
    padding: 9px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--surface);
    border: 1px solid var(--border-soft);
}

.view-toggle a.active {
    background: var(--blue-600);
    color: #fff;
    border-color: var(--blue-600);
}

.day-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 2px 14px 14px;
}

.nav-arrow {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--blue-600);
    background: var(--blue-50);
    transition: background 0.15s ease, transform 0.12s ease;
}

.nav-arrow:active {
    transform: scale(0.9);
    background: #dbe6ff;
}

.day-nav-title {
    flex: 1;
    min-width: 0;
    text-align: center;
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -0.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ---------- Schedule: day view ---------- */

.lesson-card {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    padding: 14px 16px;
    box-shadow: var(--shadow-card);
    cursor: pointer;
}

.lesson-card-num {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--blue-600);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 2px;
}

.lesson-card-time {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 2px;
}

.lesson-card-title {
    font-size: 15px;
    font-weight: 700;
}

.lesson-card-room {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ---------- Schedule: week grid ---------- */

.week-grid-wrap {
    padding: 0 6px 8px;
    width: 100%;
    box-sizing: border-box;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.week-grid {
    width: 100%;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.week-grid-row {
    display: grid;
    grid-template-columns: 34px repeat(6, 1fr);
    gap: 5px;
    align-items: stretch;
    flex: 1;
}

.week-grid-header {
    flex: 0 0 auto;
}

.week-head-cell {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 700;
    text-align: center;
    line-height: 1.4;
    padding: 2px 0 6px;
}

.week-head-cell.today {
    color: var(--blue-600);
}

.time-col {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    display: flex;
    align-items: flex-start;
    justify-content: flex-end;
    padding-right: 4px;
    padding-top: 2px;
    white-space: nowrap;
}

.week-cell {
    border-radius: 10px;
    padding: 8px 4px;
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    height: 100%;
    min-height: 62px;
    cursor: pointer;
    line-height: 1.25;
    overflow: hidden;
    word-break: break-word;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 3px;
    transition: transform 0.12s ease;
}

.week-cell:active {
    transform: scale(0.95);
}

.week-cell .room {
    font-weight: 600;
    opacity: 0.9;
    font-size: 10px;
}

.legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding: 10px 16px 90px;
    font-size: 12px;
    color: var(--text-muted);
    flex: 0 0 auto;
}

.legend-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 5px;
}

/* ---------- Lesson detail modal ---------- */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(20, 23, 31, 0);
    z-index: 50;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.25s ease, background 0.25s ease, visibility 0s linear 0.25s;
}

.modal-overlay.open {
    background: rgba(20, 23, 31, 0.45);
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transition: opacity 0.25s ease, background 0.25s ease, visibility 0s linear 0s;
}

.modal-sheet {
    background: var(--surface);
    border-radius: 20px 20px 0 0;
    padding: 22px 20px 28px;
    width: 100%;
    max-width: 480px;
    box-shadow: 0 -8px 24px rgba(0,0,0,0.15);
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

.modal-overlay.open .modal-sheet {
    transform: translateY(0);
}

.modal-sheet h3 {
    font-size: 17px;
    margin-bottom: 4px;
}

.modal-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-top: 1px solid var(--border-soft);
    font-size: 13px;
}

.modal-row:first-of-type {
    border-top: none;
    margin-top: 10px;
}

.modal-row .label {
    color: var(--text-muted);
}

.modal-close {
    display: block;
    text-align: center;
    margin-top: 16px;
    color: var(--blue-600);
    font-weight: 600;
    font-size: 14px;
}

/* ---------- Notifications ---------- */

.notif-tabs {
    display: flex;
    gap: 6px;
    padding: 0 16px 14px;
    overflow-x: auto;
}

.notif-tab {
    white-space: nowrap;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: 999px;
    padding: 8px 14px;
    transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease, transform 0.12s ease;
}

.notif-tab:active {
    transform: scale(0.96);
}

.notif-tab.active {
    background: var(--blue-600);
    color: #fff;
    border-color: var(--blue-600);
}

.notif-item {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    padding: 14px 16px;
    box-shadow: var(--shadow-card);
    margin-bottom: 10px;
    opacity: 0;
    animation: notifFadeIn 0.35s ease forwards;
}

@keyframes notifFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.notif-icon {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--blue-50);
    color: var(--blue-600);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 2px;
}

.notif-icon.important {
    background: #fdeceb;
}

.notif-icon.notif-icon-add {
    background: #e7f8f0;
    color: var(--success);
}

.notif-icon.notif-icon-remove {
    background: #fdeceb;
    color: var(--danger);
}

.notif-icon.notif-icon-edit {
    background: #fef3e6;
    color: #b9711f;
}

.notif-icon.notif-icon-schedule {
    background: #eef2ff;
    color: #6366f1;
}

.notif-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--danger);
}

.notif-body {
    flex: 1;
    min-width: 0;
}

.notif-title {
    font-size: 14px;
    font-weight: 700;
    line-height: 1.35;
}

.notif-text {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 2px;
}

.notif-sender {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 6px;
}

.notif-time {
    font-size: 12px;
    color: var(--text-muted);
    flex-shrink: 0;
}

.notif-side {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
    flex-shrink: 0;
}

.notif-delete-btn {
    width: 26px;
    height: 26px;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.notif-delete-btn:hover,
.notif-delete-btn:active {
    background: #fdeceb;
    color: var(--danger);
}

/* ---------- Dashboard: tools entry card ---------- */

.tools-entry-card {
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.tools-entry-card:active {
    transform: scale(0.98);
}

.tools-entry-icon {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--blue-500), var(--blue-600));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* ---------- Tools page ---------- */

.tool-card {
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    padding: 16px;
    box-shadow: var(--shadow-card);
    margin-bottom: 10px;
    text-decoration: none;
    color: inherit;
    opacity: 0;
    animation: toolFadeIn 0.35s ease forwards;
    transition: transform 0.12s ease, border-color 0.12s ease;
}

.tool-card:active {
    transform: scale(0.98);
    border-color: var(--blue-500);
}

@keyframes toolFadeIn {
    from { opacity: 0; transform: translateY(10px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.tool-icon {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    background: var(--blue-50);
    color: var(--blue-600);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.tool-body {
    flex: 1;
    min-width: 0;
}

.tool-title {
    font-size: 15px;
    font-weight: 700;
}

.tool-desc {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 3px;
    line-height: 1.4;
}

.tool-arrow {
    color: var(--text-muted);
    font-size: 16px;
    flex-shrink: 0;
}

/* ---------- Marks: subject picker ---------- */

.subject-check-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    border-top: 1px solid var(--border-soft);
    font-size: 14px;
}

.subject-check-row:first-child {
    border-top: none;
}

.subject-check-row input {
    width: 18px;
    height: 18px;
    accent-color: var(--blue-600);
}

/* ---------- Marks: matrix (табель) ---------- */

.matrix-hint {
    font-size: 12px;
    color: var(--text-muted);
    padding: 0 16px 12px;
    line-height: 1.5;
}

.matrix-wrap {
    overflow-x: auto;
    padding: 0 16px 16px;
    -webkit-overflow-scrolling: touch;
}

.matrix-table {
    border-collapse: collapse;
    font-size: 12px;
}

.matrix-table th, .matrix-table td {
    border: 1px solid var(--border-soft);
    padding: 4px;
    text-align: center;
}

.matrix-table th {
    background: var(--bg);
    color: var(--text-muted);
    font-weight: 600;
    white-space: nowrap;
    position: sticky;
    top: 0;
}

.matrix-name-col {
    text-align: left !important;
    white-space: nowrap;
    background: var(--surface);
    position: sticky;
    left: 0;
    z-index: 2;
    font-weight: 600;
}

.matrix-table th.matrix-name-col {
    z-index: 3;
    background: var(--bg);
}

.matrix-cell-input {
    width: 30px;
    border: none;
    text-align: center;
    font-size: 12px;
    background: transparent;
    padding: 4px 0;
}

.matrix-cell-input:focus {
    outline: 2px solid var(--blue-500);
    border-radius: 4px;
    background: var(--blue-50);
}

/* ---------- Оценки / Посещаемость ---------- */

.marks-tab-switch {
    display: flex;
    gap: 8px;
    padding: 0 16px 10px;
}

.marks-tab-switch a {
    flex: 1;
    text-align: center;
    padding: 10px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 700;
    color: var(--text-muted);
    background: var(--surface);
    border: 1px solid var(--border-soft);
    transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease, transform 0.12s ease;
}

.marks-tab-switch a:active {
    transform: scale(0.97);
}

.marks-tab-switch a.active {
    background: var(--blue-600);
    color: #fff;
    border-color: var(--blue-600);
}

.section-label {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-muted);
    padding: 6px 2px 0;
}

.toast-banner {
    margin: 0 16px 12px;
    background: #e7f8f0;
    color: var(--success);
    font-size: 13px;
    font-weight: 600;
    border-radius: var(--radius-md);
    padding: 11px 14px;
    text-align: center;
    animation: toastIn 0.3s ease both;
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.toast-banner.hide {
    opacity: 0;
    transform: translateY(-6px);
}

@keyframes toastIn {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ---- Оценки ---- */

.mark-subject-card {
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    padding: 14px 16px;
    box-shadow: var(--shadow-card);
    opacity: 0;
    animation: toolFadeIn 0.35s ease forwards;
}

.mark-subject-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}

.mark-subject-name {
    font-size: 14px;
    font-weight: 700;
    flex: 1;
    min-width: 0;
}

.mark-subject-avg {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    background: var(--bg);
    border: 1px solid var(--border-soft);
    border-radius: 10px;
    padding: 6px 12px;
    flex-shrink: 0;
}

.mark-chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.mark-chip {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    background: var(--blue-50);
    color: var(--blue-600);
}

.mark-chip.low {
    background: #fdeceb;
    color: var(--danger);
}

.mark-chip.mid {
    background: #fff4e5;
    color: #b9711f;
}

.mark-chip.high {
    background: #e7f8f0;
    color: var(--success);
}

.mark-summary-card {
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    padding: 16px;
    box-shadow: var(--shadow-card);
    margin-top: 4px;
}

.mark-summary-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13px;
    color: var(--text-muted);
    padding: 7px 0;
    border-bottom: 1px solid var(--border-soft);
}

.mark-summary-row:last-child {
    border-bottom: none;
}

.mark-summary-row .value {
    font-weight: 700;
    color: var(--text-primary);
    font-size: 14px;
}

.mark-summary-row .value.muted {
    color: var(--text-muted);
}

.mark-summary-row.main {
    font-size: 15px;
    font-weight: 700;
    color: var(--success);
}

.mark-summary-row.main .value {
    color: var(--success);
    font-size: 22px;
}

/* ---- Посещаемость ---- */

.attendance-ok-card {
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    padding: 32px 20px;
    text-align: center;
    opacity: 0;
    animation: toolFadeIn 0.4s ease forwards;
}

.attendance-ok-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #34c98a, var(--success));
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 14px;
    box-shadow: 0 6px 16px rgba(47, 179, 128, 0.3);
    animation: attendancePop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) 0.1s both;
}

@keyframes attendancePop {
    from { transform: scale(0.4); opacity: 0; }
    to   { transform: scale(1); opacity: 1; }
}

.attendance-ok-title {
    font-size: 17px;
    font-weight: 700;
    margin-bottom: 4px;
}

.attendance-ok-text {
    font-size: 13px;
    color: var(--text-muted);
}

.attendance-donut-card {
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    padding: 22px 18px;
    display: flex;
    align-items: center;
    gap: 18px;
    opacity: 0;
    animation: toolFadeIn 0.4s ease forwards;
}

.attendance-donut {
    width: 116px;
    height: 116px;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: donutGrow 0.7s cubic-bezier(0.34, 1.2, 0.64, 1) both;
}

@keyframes donutGrow {
    from { transform: scale(0.75) rotate(-90deg); opacity: 0; }
    to   { transform: scale(1) rotate(-90deg); opacity: 1; }
}

.attendance-donut-hole {
    width: 74px;
    height: 74px;
    border-radius: 50%;
    background: var(--surface);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transform: rotate(90deg);
}

.attendance-donut-pct {
    font-size: 18px;
    font-weight: 700;
}

.attendance-donut-label {
    font-size: 10px;
    color: var(--text-muted);
}

.attendance-legend {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.attendance-legend-item {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 12px;
}

.attendance-legend-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    flex-shrink: 0;
}

.attendance-legend-label {
    flex: 1;
    min-width: 0;
    color: var(--text-primary);
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.attendance-legend-value {
    color: var(--text-muted);
    flex-shrink: 0;
}

.attendance-period-row {
    display: flex;
    gap: 12px;
}

.attendance-period-card {
    flex: 1;
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    padding: 14px;
    opacity: 0;
    animation: toolFadeIn 0.4s ease 0.1s forwards;
}

.attendance-period-title {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 4px;
}

.attendance-period-value {
    font-size: 22px;
    font-weight: 700;
    color: var(--danger);
}

.attendance-period-sub {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

.attendance-subject-card {
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    padding: 14px 16px;
    opacity: 0;
    animation: toolFadeIn 0.35s ease forwards;
}

.attendance-subject-top {
    display: flex;
    align-items: center;
    gap: 10px;
}

.attendance-subject-icon {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    background: var(--blue-50);
    color: var(--blue-600);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.attendance-subject-name {
    flex: 1;
    min-width: 0;
    font-size: 14px;
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.attendance-subject-hours {
    font-size: 13px;
    font-weight: 700;
    color: var(--danger);
    flex-shrink: 0;
}

.attendance-subject-stats {
    display: flex;
    gap: 14px;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 8px;
}

.attendance-subject-stats b {
    color: var(--text-primary);
}

.attendance-reason-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

.reason-chip {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--bg);
    border: 1px solid var(--border-soft);
    border-radius: 999px;
    padding: 4px 10px;
}

.missed-lesson-row {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-md);
    padding: 10px 14px;
    opacity: 0;
    animation: toolFadeIn 0.3s ease forwards;
}

.missed-lesson-date {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    width: 40px;
    flex-shrink: 0;
}

.missed-lesson-body {
    flex: 1;
    min-width: 0;
}

.missed-lesson-subject {
    font-size: 13px;
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.missed-lesson-topic {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 1px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.missed-lesson-reason {
    font-size: 11px;
    font-weight: 700;
    color: var(--danger);
    background: #fdeceb;
    border-radius: 999px;
    padding: 4px 10px;
    flex-shrink: 0;
}

/* ---------- Back-link (пункт 14) ---------- */

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 13px;
    font-weight: 600;
    color: var(--blue-600);
    padding: 14px 16px 0;
}

.back-link svg {
    flex-shrink: 0;
}

/* ---------- Dashboard: доп. элементы ---------- */

.trend-switch {
    display: flex;
    gap: 6px;
    margin-top: 14px;
    margin-bottom: 8px;
}

.trend-switch-btn {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--bg);
    border: 1px solid var(--border-soft);
    border-radius: 999px;
    padding: 6px 14px;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.trend-switch-btn.active {
    background: var(--blue-600);
    color: #fff;
    border-color: var(--blue-600);
}

.trend-chart-wrap {
    margin-top: 4px;
}

#trend-svg {
    width: 100%;
    height: 90px;
    display: block;
}

.trend-labels {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    color: var(--text-muted);
    padding-top: 2px;
}

.lesson-type-tag {
    align-self: center;
    font-size: 10px;
    font-weight: 700;
    border-radius: 999px;
    padding: 4px 9px;
    white-space: nowrap;
    flex-shrink: 0;
}

/* ---------- Nav badge (колокольчик, пункт 12) ---------- */

.tabbar-icon-wrap {
    position: relative;
    display: inline-flex;
}

.tabbar-badge {
    position: absolute;
    top: -6px;
    right: -9px;
    background: var(--danger);
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    line-height: 1;
    border-radius: 999px;
    padding: 3px 5px;
    min-width: 14px;
    text-align: center;
    box-shadow: 0 0 0 2px var(--surface);
}

/* ---------- Marks: выбор предмета (пункт 9) ---------- */

.subject-radio-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 14px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-soft);
    margin-bottom: 8px;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease, transform 0.1s ease;
    opacity: 0;
    animation: toolFadeIn 0.3s ease forwards;
}

.subject-radio-card:active {
    transform: scale(0.98);
}

.subject-radio-card input {
    display: none;
}

.subject-radio-card .subject-radio-icon {
    width: 36px;
    height: 36px;
    border-radius: 11px;
    background: var(--blue-50);
    color: var(--blue-600);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s ease, color 0.15s ease, transform 0.2s cubic-bezier(.34,1.56,.64,1);
}

.subject-radio-card .subject-radio-name {
    flex: 1;
    min-width: 0;
    font-size: 14px;
    font-weight: 600;
}

.subject-radio-card .subject-radio-check {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid var(--border-soft);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.subject-radio-card .subject-radio-check::after {
    content: '';
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #fff;
    transform: scale(0);
    transition: transform 0.15s cubic-bezier(.34,1.56,.64,1);
}

.subject-radio-card:has(input:checked) {
    border-color: var(--blue-600);
    background: var(--blue-50);
}

.subject-radio-card:has(input:checked) .subject-radio-icon {
    background: var(--blue-600);
    color: #fff;
    transform: scale(1.08);
}

.subject-radio-card:has(input:checked) .subject-radio-check {
    border-color: var(--blue-600);
    background: var(--blue-600);
}

.subject-radio-card:has(input:checked) .subject-radio-check::after {
    transform: scale(1);
}

/* ---------- Marks: табель (редизайн, пункт 9) ---------- */

.matrix-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 0 16px 12px;
    font-size: 11px;
    color: var(--text-muted);
}

.matrix-wrap {
    overflow: auto;
    max-height: 65vh;
    padding: 0 16px 16px;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-md);
    margin: 0 16px 16px;
    width: calc(100% - 32px);
    box-sizing: border-box;
}

.matrix-table {
    border-collapse: separate;
    border-spacing: 0;
    font-size: 12px;
    width: max-content;
}

.matrix-table th, .matrix-table td {
    border-bottom: 1px solid var(--border-soft);
    border-right: 1px solid var(--border-soft);
    padding: 0;
    text-align: center;
}

.matrix-table th {
    background: var(--bg);
    color: var(--text-muted);
    font-weight: 700;
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 2;
    padding: 8px 6px;
}

.matrix-date-col {
    min-width: 46px;
}

.matrix-name-col {
    text-align: left !important;
    white-space: nowrap;
    background: var(--surface);
    position: sticky;
    left: 0;
    z-index: 3;
    font-weight: 600;
    padding: 8px 10px !important;
    box-shadow: 2px 0 6px rgba(20, 23, 31, 0.06);
}

.matrix-table th.matrix-name-col {
    z-index: 4;
    background: var(--bg);
}

.matrix-cell-select {
    width: 44px;
    height: 40px;
    border: none;
    text-align: center;
    text-align-last: center;
    font-size: 12px;
    font-weight: 700;
    background: transparent;
    color: var(--text-primary);
    appearance: none;
    -webkit-appearance: none;
}

.matrix-cell-select:focus {
    outline: 2px solid var(--blue-500);
    border-radius: 4px;
    background: var(--blue-50);
}

.matrix-type-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    margin-left: 4px;
}

/* ---------- Инструменты: рассылка уведомлений (пункт 12) ---------- */

.compose-field {
    margin-bottom: 14px;
}

.compose-field label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.compose-field input[type="text"],
.compose-field select,
.compose-field textarea {
    width: 100%;
    padding: 11px 12px;
    border-radius: 10px;
    border: 1px solid var(--border-soft);
    font-size: 14px;
    font-family: inherit;
    background: var(--surface);
    box-sizing: border-box;
}

.compose-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.richtext-toolbar {
    display: flex;
    gap: 6px;
    padding: 6px;
    background: var(--bg);
    border: 1px solid var(--border-soft);
    border-bottom: none;
    border-radius: 10px 10px 0 0;
}

.richtext-toolbar button {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid var(--border-soft);
    background: var(--surface);
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

.richtext-toolbar button:active {
    background: var(--blue-50);
}

.richtext-editable {
    min-height: 140px;
    padding: 12px;
    border: 1px solid var(--border-soft);
    border-radius: 0 0 10px 10px;
    font-size: 14px;
    line-height: 1.5;
    background: var(--surface);
}

.richtext-editable img {
    max-width: 100%;
    border-radius: 8px;
    margin: 6px 0;
}

.richtext-editable:focus {
    outline: none;
    border-color: var(--blue-500);
}

.broadcast-result {
    background: #e7f8f0;
    color: var(--success);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 14px;
}

/* ---------- Инструменты: отработка лекций (пункт 13) ---------- */

.rework-subject-card {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    padding: 14px 16px;
    box-shadow: var(--shadow-card);
    text-decoration: none;
    color: inherit;
    margin-bottom: 10px;
    opacity: 0;
    animation: toolFadeIn 0.35s ease forwards;
    transition: transform 0.12s ease;
}

.rework-subject-card:active {
    transform: scale(0.98);
}

.rework-subject-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: #fef3e6;
    color: #b9711f;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.rework-subject-name {
    flex: 1;
    min-width: 0;
    font-size: 14px;
    font-weight: 700;
}

.rework-subject-count {
    font-size: 12px;
    font-weight: 700;
    color: var(--danger);
    background: #fdeceb;
    border-radius: 999px;
    padding: 4px 10px;
    flex-shrink: 0;
}

.rework-row {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    margin-bottom: 8px;
    opacity: 0;
    animation: toolFadeIn 0.3s ease forwards;
    transition: opacity 0.25s ease;
}

.rework-row.is-done {
    opacity: 0.55;
}

.rework-row-body {
    flex: 1;
    min-width: 0;
}

.rework-row-name {
    font-size: 13px;
    font-weight: 700;
}

.rework-row.is-done .rework-row-name,
.rework-row.is-done .rework-row-topic {
    text-decoration: line-through;
}

.rework-row-topic {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 1px;
}

.rework-row-date {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

.rework-checkbox-btn {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 2px solid var(--border-soft);
    background: var(--surface);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.rework-checkbox-btn.checked {
    background: var(--success);
    border-color: var(--success);
    color: #fff;
}

/* ---------- Пропущенные лекции (details, пункт 7) ---------- */

.missed-lectures-block {
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    overflow: hidden;
}

.missed-lectures-block summary {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    cursor: pointer;
    list-style: none;
    font-weight: 700;
    font-size: 14px;
}

.missed-lectures-block summary::-webkit-details-marker {
    display: none;
}

.missed-lectures-icon {
    width: 34px;
    height: 34px;
    border-radius: 11px;
    background: #fef3e6;
    color: #b9711f;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.missed-lectures-count {
    margin-left: auto;
    font-size: 12px;
    font-weight: 700;
    color: var(--danger);
    background: #fdeceb;
    border-radius: 999px;
    padding: 4px 10px;
}

.missed-lectures-chevron {
    transition: transform 0.2s ease;
    color: var(--text-muted);
}

.missed-lectures-block[open] .missed-lectures-chevron {
    transform: rotate(180deg);
}

.missed-lectures-body {
    padding: 0 16px 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* ---------- Раздел "Ещё": общие компоненты ---------- */

.more-theme-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    padding: 14px 16px;
    box-shadow: var(--shadow-card);
    margin-bottom: 16px;
}

.more-theme-row-label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 700;
}

.toggle-switch-input {
    display: none;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 46px;
    height: 27px;
    flex-shrink: 0;
}

.toggle-switch-track {
    position: absolute;
    inset: 0;
    background: var(--border-soft);
    border-radius: 999px;
    cursor: pointer;
    transition: background 0.25s ease;
}

.toggle-switch-track::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 21px;
    height: 21px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.25);
    transition: transform 0.25s cubic-bezier(.34,1.56,.64,1);
}

.toggle-switch-input:checked + .toggle-switch-track {
    background: var(--blue-600);
}

.toggle-switch-input:checked + .toggle-switch-track::after {
    transform: translateX(19px);
}

.toggle-switch-input:disabled + .toggle-switch-track {
    opacity: 0.45;
    cursor: not-allowed;
}

.more-section-card {
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    padding: 16px;
    box-shadow: var(--shadow-card);
    margin-bottom: 10px;
    text-decoration: none;
    color: inherit;
    opacity: 0;
    animation: toolFadeIn 0.35s ease forwards;
    transition: transform 0.12s ease;
}

.more-section-card:active {
    transform: scale(0.98);
}

.more-section-icon {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    background: var(--blue-50);
    color: var(--blue-600);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.more-section-body {
    flex: 1;
    min-width: 0;
}

.more-section-title {
    font-size: 15px;
    font-weight: 700;
}

.more-section-desc {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.more-section-status {
    font-size: 11px;
    font-weight: 700;
    border-radius: 999px;
    padding: 3px 9px;
    flex-shrink: 0;
}

.more-section-status.ok { background: #e7f8f0; color: var(--success); }
.more-section-status.warn { background: #fef3e6; color: #b9711f; }

/* ---------- Telegram linking ---------- */

.telegram-status-card {
    text-align: center;
    padding: 30px 20px;
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
}

.telegram-status-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 14px;
    color: #fff;
}

.telegram-status-icon.linked { background: linear-gradient(135deg, #34c98a, var(--success)); }
.telegram-status-icon.unlinked { background: linear-gradient(135deg, #94a0b4, #6b7484); }

.telegram-link-box {
    margin-top: 16px;
    padding: 16px;
    background: var(--bg);
    border-radius: var(--radius-md);
    text-align: center;
}

.telegram-link-box a.btn-primary {
    display: block;
    text-decoration: none;
    text-align: center;
}

.telegram-link-countdown {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 10px;
}

/* ---------- Security ---------- */

.session-row {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    margin-bottom: 8px;
}

.session-row.current {
    border-color: var(--blue-500);
    background: var(--blue-50);
}

.session-icon {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: var(--bg);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.session-body {
    flex: 1;
    min-width: 0;
}

.session-device {
    font-size: 13px;
    font-weight: 700;
}

.session-meta {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 1px;
}

.session-current-tag {
    font-size: 10px;
    font-weight: 700;
    color: var(--blue-600);
    background: #dbe6ff;
    border-radius: 999px;
    padding: 3px 8px;
    flex-shrink: 0;
}

.session-revoke-btn {
    font-size: 11px;
    font-weight: 700;
    color: var(--danger);
    background: #fdeceb;
    border: none;
    border-radius: 999px;
    padding: 6px 10px;
    cursor: pointer;
    flex-shrink: 0;
}

/* ---------- Subscriptions ---------- */

.sub-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 13px 0;
    border-top: 1px solid var(--border-soft);
}

.sub-row:first-child {
    border-top: none;
}

.sub-row-text {
    flex: 1;
    min-width: 0;
}

.sub-row-title {
    font-size: 14px;
    font-weight: 600;
}

.sub-row-desc {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.sub-locked-note {
    font-size: 12px;
    color: var(--text-muted);
    background: var(--bg);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    margin-bottom: 12px;
}

/* ---------- Admin: управление дисциплинами ---------- */

.subject-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 0;
    border-top: 1px solid var(--border-soft);
    font-size: 14px;
    font-weight: 600;
}

.subject-toggle-row:first-child {
    border-top: none;
}

.subject-toggle-row.is-hidden-row {
    color: var(--text-muted);
    text-decoration: line-through;
}

/* ---------- Альбомная ориентация: чуть шире экран, кнопки/таблицы растягиваются ---------- */

@media (orientation: landscape) and (max-height: 500px) {
    .screen {
        max-width: 720px;
    }

    .tabbar {
        max-width: 720px;
        padding: 6px 4px 8px;
    }

    .tabbar a {
        font-size: 10px;
    }

    .content {
        padding-left: 24px;
        padding-right: 24px;
    }

    .btn-primary, .btn-secondary {
        max-width: 480px;
        margin-left: auto;
        margin-right: auto;
    }

    .week-grid-wrap, .matrix-wrap, .journal-wrap {
        max-height: 72vh;
    }

    .compose-row {
        grid-template-columns: 1fr 1fr 1fr;
    }
}

/* ---------- Календарь событий ---------- */

.cal-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    padding: 4px 0 8px;
}

.cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.cal-cell {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    font-size: 13px;
    font-weight: 600;
    border-radius: 10px;
    background: var(--surface);
    border: 1px solid var(--border-soft);
    color: var(--text-primary);
}

.cal-cell.empty {
    background: transparent;
    border: none;
}

.cal-cell.today {
    border-color: var(--blue-600);
    color: var(--blue-600);
    font-weight: 800;
}

.cal-cell.has-event {
    cursor: pointer;
    transition: transform 0.12s ease, background 0.15s ease;
}

.cal-cell.has-event:active {
    transform: scale(0.9);
    background: var(--blue-50);
}

.cal-dot {
    position: absolute;
    bottom: 4px;
    left: 50%;
    transform: translateX(-50%);
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--danger);
}

.cal-legend {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 14px;
}

.cal-event-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 0;
    border-top: 1px solid var(--border-soft);
    font-size: 14px;
    animation: toolFadeIn 0.3s ease both;
}

.cal-event-row:first-child {
    border-top: none;
}

.cal-event-icon {
    font-size: 18px;
    flex-shrink: 0;
}

/* ---------- Журнал группы ---------- */

.journal-summary-card {
    display: flex;
    gap: 12px;
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    padding: 16px;
    margin-bottom: 12px;
}

.journal-summary-item {
    flex: 1;
}

.journal-summary-label {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 4px;
}

.journal-summary-value {
    font-size: 24px;
    font-weight: 800;
}

.journal-reason-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
}

.journal-wrap {
    overflow: auto;
    max-height: 60vh;
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-md);
    -webkit-overflow-scrolling: touch;
}

.journal-table {
    border-collapse: separate;
    border-spacing: 0;
    font-size: 13px;
    width: 100%;
}

.journal-table th, .journal-table td {
    border-bottom: 1px solid var(--border-soft);
    padding: 10px 12px;
    text-align: center;
    white-space: nowrap;
}

.journal-table th {
    background: var(--bg);
    color: var(--text-muted);
    font-weight: 700;
    font-size: 11px;
    position: sticky;
    top: 0;
    z-index: 2;
}

.journal-name-col {
    text-align: left !important;
    position: sticky;
    left: 0;
    background: var(--surface);
    font-weight: 600;
    z-index: 1;
    box-shadow: 2px 0 6px rgba(20, 23, 31, 0.06);
}

.journal-table th.journal-name-col {
    background: var(--bg);
    z-index: 3;
}

/* ---------- Отображение сгенерированного пригласительного кода ---------- */

.invite-code-display {
    margin-top: 16px;
    padding: 14px;
    background: var(--bg);
    border-radius: var(--radius-md);
    font-size: 18px;
    font-weight: 800;
    letter-spacing: 2px;
    text-align: center;
    font-family: monospace;
    color: var(--blue-600);
}
