:root {
    --bg: #f4f6f9;
    --surface: #ffffff;
    --text: #212529;
    --text-secondary: #6c757d;
    --accent: #0056b3;
    --accent-dark: #003d80;
    --border: #dee2e6;
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 24px rgba(0,86,179,0.12);
    --transition: all 0.2s ease-in-out;
}

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

body {
    font-family: 'Manrope', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
}

/* шапка - канонический спек портала: 48px иконка, 22px заголовок, 24px 20px 28px */
.page-header {
    background: var(--accent);
    color: #fff;
    padding: 24px 20px 28px;
}

.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 16px;
    position: relative;
    z-index: 1;
}

.header-icon {
    width: 48px; height: 48px;
    flex-shrink: 0;
    background: rgba(255,255,255,0.16);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.header-icon .material-symbols-rounded { font-size: 26px; color: #fff; }
.header-icon img { width: 34px; height: 34px; object-fit: contain; }

.header-text { flex: 1; min-width: 0; }
.header-text h1 {
    font-size: 22px;
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: -0.3px;
}
.header-text p {
    font-size: 13px;
    opacity: 0.8;
    margin-top: 2px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.header-quicklinks {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.quicklink-icon {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 36px;
    padding: 0 12px;
    border-radius: 6px;
    color: rgba(255,255,255,0.85);
    background: rgba(255,255,255,0.12);
    text-decoration: none;
    font-size: 13px;
    font-weight: 700;
    transition: var(--transition);
}
.quicklink-icon:hover { background: rgba(255,255,255,0.22); color: #fff; }
.quicklink-icon .material-symbols-rounded { font-size: 19px; }
.quicklink-label { white-space: nowrap; }

.logout-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    height: 38px;
    padding: 0 14px;
    border-radius: 6px;
    color: rgba(255,255,255,0.9);
    text-decoration: none;
    background: rgba(255,255,255,0.14);
    font-size: 13px;
    font-weight: 700;
    transition: var(--transition);
}
.logout-btn:hover { background: rgba(255,255,255,0.24); }
.logout-btn .material-symbols-rounded { font-size: 20px; }

/* layout: sidebar + main */
.layout {
    display: flex;
    align-items: flex-start;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    gap: 24px;
    padding: 24px 20px 48px;
    flex: 1;
    box-sizing: border-box;
}

.sidebar {
    width: 230px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
    position: sticky;
    top: 20px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 4px;
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 600;
    transition: var(--transition);
}
.nav-item .material-symbols-rounded { font-size: 20px; }
.nav-item:hover { background: #e9edf3; color: var(--text); }
.nav-item.active {
    background: #e8f0fe;
    color: var(--accent);
}
.nav-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #d93025;
    margin-left: auto;
    flex-shrink: 0;
}

.main { flex: 1; min-width: 0; }

.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 18px;
}
.section-head h2 {
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.3px;
}

/* навигация по неделям */
.week-nav {
    display: flex;
    align-items: center;
    gap: 8px;
}
.week-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 36px;
    min-width: 36px;
    padding: 0 8px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 4px;
    cursor: pointer;
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
    transition: var(--transition);
}
.week-btn:hover { border-color: var(--accent); color: var(--accent); }
.week-btn .material-symbols-rounded { font-size: 20px; }
.week-btn-today { padding: 0 14px; }
.week-label {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-secondary);
    margin-left: 4px;
}

/* недельная сетка */
.week-grid-wrapper {
    overflow-x: auto;
    padding-bottom: 4px;
}

.week-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(150px, 1fr));
    gap: 12px;
    transition: opacity 0.15s ease;
}
.week-grid.dim { opacity: 0.5; pointer-events: none; }

.day-col {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    min-height: 140px;
}
.day-col.today { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), var(--shadow-sm); }

.day-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 6px;
    padding: 10px 12px;
    background: #f1f3f5;
    border-bottom: 1px solid var(--border);
}
.day-col.today .day-head { background: #e8f0fe; }
.day-name { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.3px; overflow-wrap: break-word; }
.day-col.today .day-name { color: var(--accent); }
.day-date { font-size: 11px; color: var(--text-secondary); font-weight: 700; flex-shrink: 0; }

.day-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px;
}

.lesson {
    background: #f8f9fb;
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    border-radius: 4px;
    padding: 8px 10px;
}
.lesson-time {
    display: flex;
    justify-content: space-between;
    gap: 6px;
    margin-bottom: 3px;
}
.lesson-np {
    font-size: 11px;
    font-weight: 800;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.lesson-vr { font-size: 11px; color: var(--text-secondary); font-weight: 600; }
.lesson-subject { font-size: 13px; font-weight: 700; line-height: 1.3; margin-bottom: 4px; overflow-wrap: break-word; word-break: break-word; }
.lesson-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 11.5px;
    color: var(--text-secondary);
}
.lesson-meta span { display: inline-flex; align-items: center; gap: 4px; }
.lesson-meta .material-symbols-rounded { font-size: 14px; }

.day-empty {
    padding: 16px 8px;
    text-align: center;
    font-size: 12px;
    color: var(--text-secondary);
}

.week-error {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 10px;
    background: #fff8e1;
    border: 1px solid #f9ab00;
    border-radius: 6px;
    padding: 16px 18px;
    font-size: 14px;
    color: #856404;
}
.week-error .material-symbols-rounded { color: #f9ab00; }

/* Постоянный нижний бар - поддержка + быстрые ссылки, виден на любой странице ЛК */
.global-footer {
    margin-top: 40px;
    border-top: 1px solid var(--border);
    background: var(--surface);
}
.footer-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 18px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
}
.footer-support {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
}
.footer-support .material-symbols-rounded {
    font-size: 22px;
    color: var(--accent);
}
.footer-support strong {
    display: block;
    font-size: 13px;
    margin-bottom: 1px;
}
.footer-support a {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 600;
}
.footer-support a:hover { color: var(--accent); text-decoration: underline; }

.footer-links {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.footer-links a {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: 4px;
    border: 1px solid var(--border);
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 12.5px;
    font-weight: 600;
}
.footer-links a:hover { border-color: var(--accent); color: var(--accent); }
.footer-links .material-symbols-rounded { font-size: 16px; color: var(--accent); }

@media (max-width: 640px) {
    .footer-inner { flex-direction: column; align-items: flex-start; }
}

.week-loading {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.skeleton-row {
    background: linear-gradient(90deg, #f0f2f5 25%, #e4e8ee 50%, #f0f2f5 75%);
    background-size: 200% 100%;
    animation: shimmer 1.4s infinite;
    border-radius: 4px;
}
@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* карточки профиля */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    box-shadow: var(--shadow-sm);
    padding: 20px;
    margin-bottom: 16px;
}
.card-title { font-size: 15px; font-weight: 800; margin-bottom: 16px; }

.placeholder-block {
    text-align: center;
    padding: 32px 20px;
    max-width: 420px;
    margin: 0 auto;
}
.placeholder-icon {
    font-size: 40px;
    color: var(--text-secondary);
    opacity: 0.5;
    margin-bottom: 12px;
    display: block;
}
.placeholder-block h3 {
    font-size: 16px;
    font-weight: 800;
    margin-bottom: 10px;
}
.placeholder-block p {
    font-size: 13.5px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 10px;
}
.placeholder-note {
    padding-top: 10px;
    border-top: 1px solid var(--border);
}
.placeholder-block a {
    color: var(--accent);
    font-weight: 700;
    text-decoration: none;
}
.placeholder-block a:hover { text-decoration: underline; }
.card-hint {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 14px;
    line-height: 1.5;
}
.card-hint a { color: var(--accent); text-decoration: none; }
.card-hint a:hover { text-decoration: underline; }

.warning-box {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    background: #fff8e1;
    border: 1px solid #f9ab00;
    border-radius: 4px;
    padding: 12px 14px;
    margin-bottom: 18px;
    font-size: 13px;
    line-height: 1.5;
    color: #856404;
}
.warning-box .material-symbols-rounded { color: #f9ab00; font-size: 20px; flex-shrink: 0; margin-top: 1px; }
.nudge-close {
    background: none;
    border: none;
    cursor: pointer;
    color: inherit;
    opacity: 0.6;
    flex-shrink: 0;
    padding: 0;
    display: flex;
}
.nudge-close:hover { opacity: 1; }
.nudge-close .material-symbols-rounded { color: inherit; font-size: 18px; margin-top: 0; }

.link-btn-danger {
    background: none;
    border: none;
    color: #d93025;
    font-size: 12.5px;
    font-weight: 700;
    cursor: pointer;
    text-decoration: underline;
    flex-shrink: 0;
    padding: 0;
}
.link-btn-danger:hover { color: #a50e0e; }

.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 46px;
    padding: 0 20px;
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 4px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    margin-left: 8px;
}
.btn-secondary:hover { background: #f1f3f5; }
.warning-box code {
    background: rgba(0,0,0,0.06);
    padding: 1px 5px;
    border-radius: 4px;
    font-size: 12px;
    font-family: 'Manrope', monospace;
}

.profile-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 0;
}
.profile-row + .profile-row { border-top: 1px solid var(--border); }
.profile-row .material-symbols-rounded { color: var(--accent); font-size: 22px; }
.profile-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--text-secondary);
    font-weight: 700;
}
.profile-value { font-size: 14px; font-weight: 600; margin-top: 1px; }

/* формы */
.field { display: block; margin-bottom: 14px; }
.field-label {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--text-secondary);
    font-weight: 700;
    margin-bottom: 6px;
}
.field input {
    width: 100%;
    height: 46px;
    padding: 0 14px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 15px;
    font-family: inherit;
    background: #fff;
    transition: border-color 0.2s ease;
}
.field input:focus { outline: none; border-color: var(--accent); }

.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 46px;
    padding: 0 28px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 4px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
}
.btn-primary:hover { background: var(--accent-dark); }
.btn-primary:disabled { opacity: 0.6; cursor: default; }

.pw-form { max-width: 380px; }
.pw-message {
    border-radius: 4px;
    padding: 10px 14px;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 14px;
}
.pw-ok { background: #e8f5e9; color: #1b5e20; border: 1px solid #2e7d32; }
.pw-error { background: #fdecea; color: #a50e0e; border: 1px solid #d93025; }
.pw-error a { color: inherit; font-weight: 800; text-decoration: underline; }

/* страница входа */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
}
.login-card {
    width: 100%;
    max-width: 380px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: var(--shadow-md);
    padding: 32px 28px;
    text-align: center;
}
.login-logo {
    display: inline-flex;
    width: 64px; height: 64px;
    background: var(--accent);
    border-radius: 8px;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
}
.login-logo img { width: 40px; height: 40px; object-fit: contain; }
.login-title { font-size: 22px; font-weight: 800; letter-spacing: -0.3px; }
.login-subtitle { font-size: 13px; color: var(--text-secondary); margin: 4px 0 22px; }
.login-form { text-align: left; }
.login-form .btn-primary { width: 100%; margin-top: 4px; }
.login-error {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    text-align: left;
    background: #fdecea;
    border: 1px solid #d93025;
    color: #a50e0e;
    border-radius: 4px;
    padding: 12px 14px;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.5;
    margin-bottom: 16px;
}
.login-error-text { flex: 1; min-width: 0; }
.login-error-text a { color: inherit; font-weight: 800; text-decoration: underline; }
.login-error .material-symbols-rounded { font-size: 20px; flex-shrink: 0; margin-top: 1px; }
.login-forgot {
    display: inline-block;
    margin-top: 18px;
    font-size: 13px;
    font-weight: 600;
    color: var(--accent);
    text-decoration: none;
}
.login-forgot:hover { text-decoration: underline; }

/* адаптив */
@media (max-width: 1100px) {
    .week-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 768px) {
    .layout {
        flex-direction: column;
        gap: 16px;
        padding: 16px 14px 40px;
    }
    .sidebar {
        width: 100%;
        position: static;
        flex-direction: row;
        overflow-x: auto;
        gap: 6px;
        padding-bottom: 2px;
    }
    .nav-item { white-space: nowrap; }
    .week-grid { grid-template-columns: 1fr; }
    .logout-btn .logout-label { display: none; }
    .logout-btn { width: 38px; padding: 0; border-radius: 6px; justify-content: center; }
}

.login-links-row {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 18px;
}
.login-links-row .login-forgot { margin-top: 0; }
.login-links-sep { color: var(--border); font-size: 13px; }