/* === Design tokens === */
:root {
    --bg: #FAF5EC;
    --card: #FFFFFF;
    --accent: #EC5F00;
    --accent-text: #C24A00;       /* WCAG AA вариант --accent для inline-текста (контраст ≥ 5.2:1 на --bg) */
    --accent-soft: #FFE5D2;
    --accent-pale: #FFF1E2;
    --text: #1A1A1A;
    --muted: #6A6A6A;
    --line: #EFE9DC;
    --line-strong: #E6DFCB;
    --green-soft: #D9EFD6;
    --green: #4CAF50;
    --red-soft: #FFE0E0;
    --red: #D04848;
    --yellow-soft: #FFF3D5;
    --yellow: #C48A00;
    --radius-lg: 28px;
    --radius-md: 18px;
    --radius-sm: 12px;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.02);
}

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

/* === A11y: focus-visible (WCAG 2.4.7) === */
*:focus { outline: none; }
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible,
[role="button"]:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 6px;
}

/* === A11y: reduced-motion (WCAG 2.3.3) === */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* === A11y: skip-link (WCAG 2.4.1 Bypass Blocks) === */
.skip-link {
    position: absolute;
    top: -100px;
    left: 12px;
    z-index: 10001;
    background: var(--accent);
    color: #fff;
    padding: 10px 16px;
    border-radius: 12px;
    text-decoration: none;
    font-weight: 600;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    transition: top 0.15s ease;
}
.skip-link:focus,
.skip-link:focus-visible {
    top: 12px;
    outline: 2px solid #fff;
    outline-offset: 2px;
}

/* === Visually hidden (для скринридеров) === */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

html, body { height: 100%; }
body {
    font-family: 'Manrope', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; }
button { font-family: inherit; }

/* === Layout === */
.app {
    display: grid;
    grid-template-columns: 264px 1fr;
    min-height: 100vh;
}

/* === Мобильный top-bar — только на мобильных === */
.mobile-topbar { display: none; }
.burger {
    background: transparent;
    border: none;
    color: var(--text);
    cursor: pointer;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background-color .15s ease;
}
.burger:hover { background: var(--accent-pale); color: var(--accent); }
.sidebar-overlay { display: none; }

/* === Sidebar (desktop) === */
.sidebar {
    padding: 36px 24px;
    display: flex;
    flex-direction: column;
    gap: 32px;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.brand {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 0 16px;
    text-decoration: none;
    color: inherit;
}

.brand-logo {
    width: 56px;
    height: 56px;
    background: var(--accent);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 800;
    font-size: 20px;
}

.brand-name {
    font-weight: 800;
    line-height: 1.1;
    font-size: 17px;
}
.brand-name span { color: var(--accent); display: block; }

.nav { display: flex; flex-direction: column; gap: 4px; flex: 1; min-height: 0; }
.nav-group { display: flex; flex-direction: column; gap: 4px; }
.nav-divider { border: 0; border-top: 1px solid var(--line); margin: 8px 16px; }

.nav a {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 13px 18px;
    border-radius: 14px;
    color: var(--text);
    text-decoration: none;
    font-weight: 500;
    transition: background .15s, color .15s;
}
.nav a:hover { background: rgba(236, 95, 0, 0.06); }
.nav a.active {
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 600;
}
.nav a svg { width: 22px; height: 22px; stroke-width: 1.7; flex-shrink: 0; }

/* === Переключатель вида (testing only — для admin/staff) === */
.view-mode-switch {
    padding: 10px 8px 8px;
    background: var(--bg);
    border-radius: 14px;
    flex-shrink: 0;
}
.view-mode-switch + .sidebar-profile { margin-top: 8px; }
.view-mode-switch-label {
    font-size: 10px;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
    padding: 0 6px;
}
.view-mode-switch-btns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    background: var(--card);
    border-radius: 10px;
    padding: 3px;
}
.view-mode-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 7px 8px;
    border: none;
    background: transparent;
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
    border-radius: 8px;
    cursor: pointer;
    transition: all .12s ease;
}
.view-mode-btn:hover {
    color: var(--text);
    background: rgba(0, 0, 0, 0.03);
}
.view-mode-btn.active {
    background: var(--accent);
    color: #fff;
}
.view-mode-btn svg { flex-shrink: 0; }

/* === Sidebar profile (bottom block) === */
.sidebar-profile {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px;
    margin-top: auto;
    background: var(--bg);
    border-radius: 16px;
    flex-shrink: 0;
}
.sidebar-profile-link {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
    padding: 4px 6px;
    border-radius: 12px;
    color: var(--text);
    text-decoration: none;
    transition: background .15s;
}
.sidebar-profile-link:hover { background: rgba(255, 255, 255, 0.7); }
.sidebar-profile-link.active { background: rgba(255, 255, 255, 0.9); }
.sidebar-profile-avatar {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--accent-soft), #FFC9A6);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 12px;
    flex-shrink: 0;
    overflow: hidden;
    text-transform: uppercase;
}
.sidebar-profile-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.sidebar-profile-name {
    font-weight: 600;
    font-size: 13px;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}
.sidebar-profile-action {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 10px;
    color: var(--muted);
    background: transparent;
    border: none;
    padding: 0;
    cursor: pointer;
    transition: all .15s ease;
    flex-shrink: 0;
    font-family: inherit;
    text-decoration: none;
}
.sidebar-profile-action:hover {
    background: rgba(236, 95, 0, 0.1);
    color: var(--accent);
}
.sidebar-profile-action svg {
    width: 16px;
    height: 16px;
    stroke-width: 1.8;
}
.sidebar-profile-logout-form { margin: 0; display: flex; }

/* === Main === */
.main {
    padding: 32px 48px 48px;
    display: flex;
    flex-direction: column;
    gap: 28px;
    min-width: 0;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}
.page-header .titles h1 {
    font-size: 32px;
    font-weight: 800;
    letter-spacing: -0.5px;
    line-height: 1.1;  /* избавляемся от extra leading сверху, чтобы 16px от back-link выглядел как 16px */
    margin-top: 0;
    margin-bottom: 6px;
}
.page-header .titles p { color: var(--muted); font-size: 16px; }
.page-header .actions { display: flex; gap: 10px; }

/* === Единый back-link (заменяет .breadcrumbs и локальные .back-link) ===
   ТЗ: 16px, цвет --text, стрелка влево, адаптивный текст «куда возвращает».
   Использовать через partial: {% include 'users/new_includes/_back_link.html' with href=... label=... %}
*/
.back-link {
    /* Стрелка сверху, текст «К списку компонентов» снизу — компактный нав-блок. */
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    color: var(--text);
    text-decoration: none;
    font-size: 16px;
    font-weight: 500;
    line-height: 1;
    padding: 8px 10px;
    margin: 0 -10px 16px;
    border-radius: 10px;
    align-self: flex-start;
    white-space: nowrap;
    transition: background-color .12s ease, color .12s ease, transform .12s ease;
}
.back-link:hover {
    background: var(--accent-pale);
    color: var(--accent-text);
}
.back-link:hover .back-link-arrow { transform: translateX(-2px); }
.back-link-arrow {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    transition: transform .12s ease;
}

/* Совместимость со старыми .breadcrumbs — рендерим как back-link */
.breadcrumbs { color: var(--text); font-size: 16px; margin-bottom: 16px; }
.breadcrumbs a { color: var(--text); text-decoration: none; }
.breadcrumbs a:hover { color: var(--accent-text); }

/* === Card === */
.card {
    background: var(--card);
    border-radius: var(--radius-lg);
    padding: 28px;
}

/* === Онбординг-баннер (заполнить профиль и т.п.) === */
.onboarding-banner {
    display: grid;
    grid-template-columns: 64px 1fr auto;
    gap: 18px;
    align-items: center;
    padding: 18px 22px;
    background: linear-gradient(135deg, var(--accent-pale), #FFF8EE);
    border: 1.5px solid var(--accent-soft);
    border-radius: var(--radius-lg);
    text-decoration: none;
    color: inherit;
    transition: all .15s ease;
}
.onboarding-banner:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 22px rgba(236, 95, 0, 0.12);
    border-color: var(--accent);
}
.onboarding-banner-icon {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    background: var(--card);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}
.onboarding-banner-body { min-width: 0; }
.onboarding-banner-title {
    font-size: 17px;
    font-weight: 700;
    margin-bottom: 4px;
    color: var(--text);
}
.onboarding-banner-text {
    color: var(--muted);
    font-size: 13.5px;
    line-height: 1.45;
}
.onboarding-banner-action { flex-shrink: 0; }
@media (max-width: 700px) {
    .onboarding-banner {
        grid-template-columns: 56px 1fr;
        gap: 14px;
    }
    .onboarding-banner-action {
        grid-column: 1 / -1;
        justify-self: stretch;
    }
    .onboarding-banner-action .btn { width: 100%; }
}
.card-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    gap: 12px;
    flex-wrap: wrap;
}
.card-head h2 { font-size: 22px; font-weight: 700; }
.card-head .link { color: var(--accent); text-decoration: none; font-weight: 600; font-size: 14px; }
.card-head .link:hover { text-decoration: underline; }

/* === Buttons === */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 22px;
    border-radius: 14px;
    font-weight: 600;
    font-size: 14px;
    text-decoration: none;
    cursor: pointer;
    border: 1.5px solid transparent;
    background: transparent;
    color: var(--text);
    transition: all .15s;
    white-space: nowrap;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: #d35500; }
.btn-outline { color: var(--text); border-color: var(--accent-soft); }
.btn-outline:hover:not(:disabled) { background: var(--accent-pale); }
.btn-ghost { color: var(--muted); }
.btn-ghost:hover:not(:disabled) { background: var(--accent-pale); color: var(--accent); }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #b73d3d; }
.btn-lg { padding: 14px 28px; font-size: 15px; }
.btn-sm { padding: 8px 14px; font-size: 13px; border-radius: 10px; }

/* === Forms === */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field label { font-size: 13px; color: var(--muted); font-weight: 500; }
.input, .select, .textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid var(--line-strong);
    border-radius: 12px;
    font-family: inherit;
    font-size: 15px;
    background: #fff;
    outline: none;
    transition: border-color .15s;
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent); }
.textarea { resize: vertical; min-height: 100px; }
.help-text { font-size: 12px; color: var(--muted); margin-top: 4px; }
.error-text { font-size: 13px; color: var(--red); margin-top: 4px; }

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* === Table-like list === */
.list { display: flex; flex-direction: column; gap: 10px; }
.list-item {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 16px;
    align-items: center;
    padding: 16px 20px;
    background: var(--card);
    border-radius: 18px;
    border: 1.5px solid transparent;
}
.list-item.warn { background: #FFF8E5; }
.list-item.pending { border-color: var(--accent-soft); }
.list-item .ico {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: var(--accent-pale);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.list-item .ico svg { width: 22px; height: 22px; stroke-width: 1.7; }
.list-item .ico.green { background: var(--green-soft); color: var(--green); }
.list-item .ico.yellow { background: var(--yellow-soft); color: var(--yellow); }
.list-item .ico.red { background: var(--red-soft); color: var(--red); }
.list-item .when { color: var(--accent); font-weight: 600; font-size: 14px; margin-bottom: 2px; }
.list-item .who { font-weight: 600; font-size: 15px; }
.list-item .meta { color: var(--muted); font-size: 13px; margin-top: 2px; }
.list-item .actions { display: flex; gap: 8px; }

/* === Status pills === */
.pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    background: var(--accent-pale);
    color: var(--accent);
}
.pill.green { background: var(--green-soft); color: var(--green); }
.pill.yellow { background: var(--yellow-soft); color: var(--yellow); }
.pill.red { background: var(--red-soft); color: var(--red); }
.pill.muted { background: #F1ECDE; color: var(--muted); }

/* === Empty state === */
.empty {
    color: var(--muted);
    padding: 40px 0;
    text-align: center;
    font-size: 15px;
}
.empty .icon {
    width: 64px;
    height: 64px;
    background: var(--accent-pale);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    color: var(--accent);
}

/* === Modal === */
.modal-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 100;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.modal-backdrop.open { display: flex; }
.modal {
    background: var(--card);
    border-radius: var(--radius-md);
    padding: 28px;
    max-width: 480px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}
.modal h3 { font-size: 22px; font-weight: 700; margin-bottom: 18px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }
.modal .err { color: var(--red); font-size: 14px; padding: 8px 0; }

.preloader {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(255,255,255,0.6);
    z-index: 200;
    align-items: center;
    justify-content: center;
}
.preloader.show { display: flex; }
.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--accent-soft);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes lp-pulse {
    0% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.5); }
    70% { box-shadow: 0 0 0 6px rgba(255, 255, 255, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0); }
}

/* === Calendar === */
.calendar .cal-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
}
.cal-head h3 { font-size: 18px; font-weight: 700; }
.cal-arrows { display: flex; gap: 4px; }
.cal-arrows button {
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    color: var(--muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.cal-arrows button:hover { background: var(--accent-pale); color: var(--accent); }

.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-grid .dow {
    text-align: center;
    font-size: 12px;
    color: var(--muted);
    font-weight: 600;
    padding: 8px 0;
}
.cal-grid .day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 500;
    border-radius: 50%;
    position: relative;
}
.cal-grid .day.past { color: #C4C4C4; }
.cal-grid .day.today {
    background: var(--accent);
    color: #fff;
    font-weight: 700;
}
.cal-grid .day.has-lesson:not(.today)::after {
    content: '';
    position: absolute;
    bottom: 2px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 4px;
    background: var(--accent);
    border-radius: 50%;
}

/* === Schedule picker grid (for booking page) === */
.timegrid-wrap { overflow-x: auto; }
.timegrid {
    display: grid;
    gap: 6px;
    min-width: 720px;
}
.timegrid .col-label, .timegrid .row-label {
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
    text-align: center;
    padding: 6px;
}
.slot {
    padding: 12px 8px;
    background: var(--card);
    border-radius: 10px;
    text-align: center;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border: 1.5px solid transparent;
    transition: all .15s;
    color: var(--text);
}
.slot:hover { border-color: var(--accent-soft); }
.slot.busy { background: #F1ECDE; color: var(--muted); cursor: not-allowed; }
.slot.own { background: var(--accent-soft); color: var(--accent); cursor: not-allowed; }
.slot.blocked { background: transparent; border: 1.5px dashed var(--line); color: var(--muted); cursor: not-allowed; }
.slot.selected { background: var(--accent); color: #fff; border-color: var(--accent); }

/* === Pagination === */
.pagination { display: flex; gap: 6px; justify-content: center; margin-top: 24px; }
.pagination a, .pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    text-decoration: none;
    color: var(--text);
    background: var(--card);
    font-weight: 500;
}
.pagination .current { background: var(--accent); color: #fff; }
.pagination a:hover { background: var(--accent-pale); color: var(--accent); }

/* === Avatar === */
.avatar {
    border-radius: 14px;
    background: linear-gradient(135deg, var(--accent-soft), #FFC9A6);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
    font-weight: 700;
    overflow: hidden;
    flex-shrink: 0;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-sm { width: 44px; height: 44px; font-size: 14px; border-radius: 12px; }
.avatar-md { width: 64px; height: 64px; font-size: 18px; }
.avatar-lg { width: 156px; height: 156px; font-size: 48px; border-radius: 20px; }

/* === Auth pages (login/register) === */
.auth-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1fr 1fr;
}
.auth-side {
    background: var(--accent);
    color: #fff;
    padding: 60px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}
.auth-side .auth-brand { font-size: 24px; font-weight: 800; }
.auth-side .auth-brand span { display: block; opacity: 0.85; }
.auth-side h2 { font-size: 42px; font-weight: 800; line-height: 1.1; letter-spacing: -1px; max-width: 480px; }
.auth-side p { opacity: 0.85; max-width: 460px; margin-top: 16px; }
.auth-form-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}
.auth-form {
    width: 100%;
    max-width: 420px;
}
.auth-form h1 { font-size: 32px; font-weight: 800; letter-spacing: -0.5px; margin-bottom: 10px; }
.auth-form .sub { color: var(--muted); margin-bottom: 28px; }
.auth-form .footer { color: var(--muted); margin-top: 18px; text-align: center; font-size: 14px; }
.auth-form .footer a { color: var(--accent); text-decoration: none; font-weight: 600; }

/* === Public site (price/contacts) === */
.public-wrap { max-width: 1180px; margin: 0 auto; padding: 32px 24px; }
.public-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
    margin-bottom: 40px;
}
.public-nav .links { display: flex; gap: 28px; }
.public-nav a { text-decoration: none; color: var(--text); font-weight: 500; }
.public-nav a:hover { color: var(--accent); }
.public-nav .login-btn { background: var(--accent); color: #fff; padding: 10px 22px; border-radius: 14px; font-weight: 600; }
.public-nav .login-btn:hover { background: #d35500; color: #fff; }

.pricing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 40px;
}
.price-card {
    background: var(--card);
    border-radius: var(--radius-lg);
    padding: 32px;
    display: flex;
    flex-direction: column;
}
.price-card .price-title { font-size: 20px; font-weight: 700; margin-bottom: 12px; }
.price-card .price-amount { font-size: 42px; font-weight: 800; color: var(--accent); margin-bottom: 4px; letter-spacing: -1px; }
.price-card .price-old { color: var(--muted); text-decoration: line-through; font-size: 16px; margin-bottom: 18px; }
.price-card ul { list-style: none; margin: 18px 0; flex: 1; }
.price-card ul li { padding: 8px 0; padding-left: 28px; position: relative; font-size: 14px; }
.price-card ul li::before {
    content: '✓';
    position: absolute;
    left: 0;
    top: 8px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--green-soft);
    color: var(--green);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
}

/* === Recordings === */
.recordings-list { display: flex; flex-direction: column; gap: 14px; }
.recording {
    display: grid;
    grid-template-columns: 92px 1fr auto;
    gap: 18px;
    align-items: center;
}
.recording .thumb {
    width: 92px;
    height: 60px;
    background: linear-gradient(135deg, #FFE5D2, #FFC9A6);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
    position: relative;
    overflow: hidden;
    text-decoration: none;
}
.recording .thumb::after {
    content: '▶';
    font-size: 18px;
    background: #fff;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-left: 2px;
}
.recording .name { font-weight: 600; margin-bottom: 4px; font-size: 15px; }
.recording .meta { color: var(--muted); font-size: 13px; }
.recording .duration { color: var(--muted); font-size: 14px; font-weight: 500; }

/* === Next-lesson card === */
.next-lesson {
    display: grid;
    grid-template-columns: 156px 1fr;
    gap: 24px;
    align-items: center;
}
.next-lesson .when {
    color: var(--accent);
    font-weight: 600;
    font-size: 16px;
    margin-bottom: 10px;
}
.next-lesson .title {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 8px;
    letter-spacing: -0.3px;
}
.next-lesson .topic {
    color: var(--muted);
    margin-bottom: 22px;
    font-size: 15px;
}
.next-lesson .actions { display: flex; gap: 12px; flex-wrap: wrap; }

/* === Grid layouts === */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: 24px;
    align-items: start;
}

/* === Messages (django.contrib.messages) === */
.messages { list-style: none; display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.messages li {
    padding: 14px 18px;
    border-radius: 14px;
    background: var(--card);
    border-left: 4px solid var(--accent);
    font-weight: 500;
}
.messages li.success { border-left-color: var(--green); }
.messages li.error, .messages li.danger { border-left-color: var(--red); }
.messages li.warning { border-left-color: var(--yellow); }

/* === Chat === */
.chat-shell { display: grid; grid-template-columns: 320px 1fr; gap: 0; height: calc(100vh - 80px); }
.chat-sidebar { background: var(--card); border-radius: var(--radius-lg); overflow: hidden; padding: 16px; }
.chat-window { background: var(--card); border-radius: var(--radius-lg); overflow: hidden; display: flex; flex-direction: column; margin-left: 16px; }
.chat-window-head { padding: 18px 24px; border-bottom: 1px solid var(--line); font-weight: 700; }
.chat-messages-box { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 10px; }
.chat-msg { max-width: 70%; padding: 10px 14px; border-radius: 16px; font-size: 14px; }
.chat-msg.own { align-self: flex-end; background: var(--accent); color: #fff; border-bottom-right-radius: 4px; }
.chat-msg.other { align-self: flex-start; background: var(--accent-pale); border-bottom-left-radius: 4px; }
.chat-msg .meta { font-size: 11px; opacity: 0.7; margin-top: 4px; }
.chat-input-bar { padding: 16px; border-top: 1px solid var(--line); display: flex; gap: 10px; }
.chat-list-item {
    display: flex;
    gap: 12px;
    padding: 12px;
    border-radius: 14px;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    margin-bottom: 4px;
}
.chat-list-item:hover, .chat-list-item.active { background: var(--accent-pale); }
.chat-list-item .name { font-weight: 600; }
.chat-list-item .last { color: var(--muted); font-size: 13px; margin-top: 2px; }

/* === Responsive === */
@media (max-width: 1100px) {
    .dashboard-grid { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
    .auth-shell { grid-template-columns: 1fr; }
    .auth-side { display: none; }
}
@media (max-width: 900px) {
    /* Top-bar + бургер + sidebar только на мобиле */
    .app { grid-template-columns: 1fr; }

    .mobile-topbar {
        display: flex;
        align-items: center;
        gap: 8px;
        padding: 12px 16px;
        background: var(--bg);
        position: sticky;
        top: 0;
        z-index: 50;
        border-bottom: 1px solid var(--line);
    }
    .mobile-brand {
        text-decoration: none;
        color: inherit;
        padding: 0;
        gap: 10px;
    }
    .mobile-brand .brand-logo { width: 40px; height: 40px; font-size: 15px; border-radius: 10px; }
    .mobile-brand .brand-name { font-size: 14px; }

    .sidebar-overlay {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.35);
        opacity: 0;
        visibility: hidden;
        z-index: 70;
        transition: opacity .25s ease, visibility .25s ease;
    }
    .sidebar-overlay.open { opacity: 1; visibility: visible; }

    .sidebar {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        bottom: 0 !important;
        right: auto !important;
        width: 280px !important;
        height: 100vh !important;
        z-index: 80 !important;
        background: var(--bg) !important;
        transform: translateX(-100%) !important;
        transition: transform .28s cubic-bezier(.32, .72, 0, 1) !important;
        box-shadow: 6px 0 32px rgba(0, 0, 0, 0.08) !important;
        visibility: hidden;
        padding: 24px !important;
    }
    .sidebar.open {
        transform: translateX(0) !important;
        visibility: visible;
    }
    .sidebar-overlay.open ~ .app .sidebar,
    .sidebar.open { visibility: visible; }

    .main { padding: 20px 16px 32px; }
    .page-header .titles h1 { font-size: 26px; }
    .next-lesson { grid-template-columns: 100px 1fr; }
    .avatar-lg { width: 100px; height: 100px; font-size: 36px; }
    .next-lesson .title { font-size: 22px; }
    .field-row { grid-template-columns: 1fr; }
    .chat-shell { grid-template-columns: 1fr; height: auto; }
    .chat-window { margin-left: 0; margin-top: 16px; }

    /* Скрываем sticky-логотип внутри sidebar — он уже в top-bar */
    .sidebar > .brand { display: none; }
}

/* === Password field с show/hide toggle === */
.password-field {
    position: relative;
}
.password-field .input,
.password-field input[type="password"],
.password-field input[type="text"] {
    padding-right: 44px;
}
.password-toggle {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: transparent;
    border: 0;
    color: var(--muted);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background-color .12s ease, color .12s ease;
}
.password-toggle:hover { background: var(--accent-pale); color: var(--accent-text); }
.password-toggle svg { width: 18px; height: 18px; }

/* === Password strength meter === */
.password-strength {
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--muted);
}
.password-strength-bar {
    flex: 1;
    height: 4px;
    background: var(--line);
    border-radius: 2px;
    overflow: hidden;
}
.password-strength-fill {
    height: 100%;
    width: 0;
    background: var(--red);
    transition: width .2s ease, background-color .2s ease;
    border-radius: 2px;
}
.password-strength[data-score="2"] .password-strength-fill { width: 50%; background: var(--yellow); }
.password-strength[data-score="3"] .password-strength-fill { width: 75%; background: var(--accent); }
.password-strength[data-score="4"] .password-strength-fill { width: 100%; background: var(--green); }

/* === Subscription progress (check.html) === */
.sub-progress {
    width: 140px;
    height: 6px;
    background: var(--line);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 6px;
}
.sub-progress-fill {
    height: 100%;
    background: var(--green);
    border-radius: 3px;
    transition: width .25s ease;
}
.sub-progress.low .sub-progress-fill { background: var(--yellow); }
.sub-progress.critical .sub-progress-fill { background: var(--red); }

/* === Filter chips (общий компонент) === */
.filter-chips {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 16px;
    padding: 4px;
    background: var(--card);
    border-radius: 14px;
}
.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 10px;
    color: var(--muted);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    background: transparent;
    border: 0;
    cursor: pointer;
    transition: background-color .12s ease, color .12s ease;
    font-family: inherit;
}
.filter-chip:hover {
    background: var(--accent-pale);
    color: var(--accent-text);
}
.filter-chip.active {
    background: var(--accent);
    color: #fff;
}
.filter-chip-count {
    font-weight: 700;
    background: rgba(0, 0, 0, 0.08);
    padding: 1px 7px;
    border-radius: 999px;
    font-size: 12px;
    min-width: 20px;
    text-align: center;
}
.filter-chip.active .filter-chip-count {
    background: rgba(255, 255, 255, 0.25);
}

/* === Inline countdown (для next lesson на дашборде) === */
.lesson-countdown {
    display: inline-block;
    font-weight: 600;
    font-size: 13px;
    padding: 4px 10px;
    background: var(--accent-pale);
    color: var(--accent-text);
    border-radius: 999px;
    margin-left: 8px;
}

/* === Empty state — единый паттерн === */
.empty {
    text-align: center;
    padding: 28px 16px;
    color: var(--muted);
}
.empty .icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 14px;
    border-radius: 16px;
    background: var(--accent-pale);
    color: var(--accent-text);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* === Цвет .meta — теперь .accent-text для inline-ссылок на ораньжевом === */
.link-strong { color: var(--accent-text); font-weight: 600; text-decoration: none; }
.link-strong:hover { text-decoration: underline; }

/* === Brand logo (SVG image) === */
.brand-logo-img {
    width: 56px;
    height: 56px;
    object-fit: contain;
    border-radius: 14px;
    flex-shrink: 0;
    display: block;
}
.mobile-brand .brand-logo-img {
    width: 40px;
    height: 40px;
    border-radius: 10px;
}

/* === Avatar fallback (default SVG when no initials) === */
.avatar svg.avatar-fallback {
    width: 60%;
    height: 60%;
    color: var(--accent);
    opacity: 0.65;
}

/* === Snackbar close button === */
.snackbar-close {
    background: transparent;
    border: 0;
    color: rgba(255, 255, 255, 0.8);
    width: 24px;
    height: 24px;
    border-radius: 6px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: 8px;
    transition: background-color .12s ease, color .12s ease;
    flex-shrink: 0;
}
.snackbar-close:hover { background: rgba(255, 255, 255, 0.15); color: #fff; }

/* === Notification icons by type === */
.notif-item {
    display: grid;
    grid-template-columns: 36px 1fr;
    gap: 12px;
    padding: 12px 16px;
    align-items: start;
}
.notif-item-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-pale);
    color: var(--accent-text);
    flex-shrink: 0;
    font-size: 16px;
}
.notif-item-icon.lesson { background: var(--accent-pale); color: var(--accent-text); }
.notif-item-icon.homework { background: #E0F2FE; color: #0369A1; }
.notif-item-icon.chat { background: #F0FDF4; color: #15803D; }
.notif-item-icon.payment { background: var(--yellow-soft); color: var(--yellow); }
.notif-item-icon.system { background: var(--line); color: var(--muted); }
.notif-item-body { min-width: 0; }
.notif-item-title { font-size: 14px; font-weight: 600; color: var(--text); margin: 0 0 4px; }
.notif-item-text { font-size: 13px; color: var(--muted); margin: 0 0 6px; line-height: 1.4; }
.notif-item-meta { font-size: 11px; color: #94a3b8; text-transform: uppercase; letter-spacing: .04em; }

/* === Quick-actions row на дашборде ученика === */
.quick-actions-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
    margin: 16px 0 24px;
}
.quick-action {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    background: var(--card);
    border-radius: 14px;
    border: 1.5px solid transparent;
    text-decoration: none;
    color: inherit;
    transition: background-color .12s ease, border-color .12s ease, transform .12s ease;
    font-weight: 500;
    font-size: 14px;
}
.quick-action:hover {
    border-color: var(--accent-soft);
    transform: translateY(-1px);
}
.quick-action-icon {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    background: var(--accent-pale);
    color: var(--accent-text);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* === Onboarding checklist (multi-step) === */
.onboarding-checklist {
    background: linear-gradient(135deg, var(--accent-pale), #FFF8EE);
    border: 1.5px solid var(--accent-soft);
    border-radius: var(--radius-lg);
    padding: 20px 24px;
    margin-bottom: 24px;
}
.onboarding-checklist-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    gap: 16px;
}
.onboarding-checklist-title { font-weight: 700; font-size: 17px; }
.onboarding-checklist-progress {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}
.onboarding-checklist-bar {
    width: 140px;
    height: 6px;
    background: rgba(0, 0, 0, 0.08);
    border-radius: 3px;
    overflow: hidden;
}
.onboarding-checklist-bar-fill {
    height: 100%;
    background: var(--accent);
    transition: width .25s ease;
}
.onboarding-checklist-count {
    font-size: 13px;
    font-weight: 600;
    color: var(--accent-text);
    white-space: nowrap;
}
.onboarding-checklist-items {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
.onboarding-checklist-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--card);
    border-radius: 12px;
    text-decoration: none;
    color: var(--text);
    transition: transform .12s ease, box-shadow .12s ease;
    font-size: 14px;
}
.onboarding-checklist-item:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}
.onboarding-checklist-item.done {
    color: var(--muted);
    text-decoration: line-through;
    opacity: 0.85;
}
.onboarding-checklist-check {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 1.8px solid var(--line-strong);
    background: var(--card);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: transparent;
    transition: all .12s ease;
}
.onboarding-checklist-item.done .onboarding-checklist-check {
    background: var(--green);
    border-color: var(--green);
    color: #fff;
}
@media (max-width: 700px) {
    .onboarding-checklist-items { grid-template-columns: 1fr; }
    .onboarding-checklist-bar { width: 80px; }
}

/* === Booking: day-chips + time-chips inline === */
.booking-day-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
    margin-bottom: 16px;
}
@media (max-width: 600px) {
    .booking-day-grid { grid-template-columns: repeat(4, 1fr); }
}
.booking-day-chip {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px 6px;
    background: var(--bg);
    border: 1.8px solid transparent;
    border-radius: 12px;
    cursor: pointer;
    transition: all .12s ease;
    font-family: inherit;
    line-height: 1.2;
}
.booking-day-chip:hover:not(:disabled) { background: var(--accent-pale); color: var(--accent-text); }
.booking-day-chip.selected {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}
.booking-day-chip:disabled { opacity: 0.35; cursor: not-allowed; }
.booking-day-weekday { font-size: 11px; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.booking-day-chip.selected .booking-day-weekday { color: rgba(255, 255, 255, 0.85); }
.booking-day-date { font-size: 17px; font-weight: 700; margin-top: 2px; }

.booking-time-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(76px, 1fr));
    gap: 8px;
}
.booking-time-chip {
    padding: 10px 8px;
    background: var(--bg);
    border: 1.8px solid transparent;
    border-radius: 10px;
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    transition: all .12s ease;
}
.booking-time-chip:hover:not(:disabled) { background: var(--accent-pale); color: var(--accent-text); }
.booking-time-chip.selected {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}
.booking-time-chip:disabled { opacity: 0.35; cursor: not-allowed; text-decoration: line-through; }
.booking-time-section-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
    margin: 12px 0 8px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

/* === Schedule cell status icons (внутри ячейки) === */
.schedule-table td.scheduled-lesson::before,
.schedule-table td.confirmed-lesson::before,
.schedule-table td.scheduled-lesson_other::before,
.schedule-table td.confirmed-lesson_other::before {
    content: '';
    display: inline-block;
    width: 14px;
    height: 14px;
    margin-right: 4px;
    vertical-align: middle;
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
}
.schedule-table td.scheduled-lesson::before {
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%234CAF50' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'><polyline points='20 6 9 17 4 12'/></svg>");
}
.schedule-table td.confirmed-lesson::before {
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23C48A00' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'><circle cx='12' cy='12' r='10'/><polyline points='12 6 12 12 16 14'/></svg>");
}
.schedule-table td.scheduled-lesson_other::before,
.schedule-table td.confirmed-lesson_other::before {
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23D04848' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'><line x1='18' y1='6' x2='6' y2='18'/><line x1='6' y1='6' x2='18' y2='18'/></svg>");
}

/* === Week navigation === */
.week-nav-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.week-nav-buttons {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.week-nav-buttons .btn { padding: 8px 12px; }
.week-range-label {
    font-weight: 700;
    font-size: 16px;
    color: var(--text);
    min-width: 220px;
    text-align: center;
}

/* === Timezone display === */
.timezone-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--accent-pale);
    color: var(--accent-text);
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
}

/* === Materials filters (стиль чипсов уровня) === */
.level-chips { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.level-chip {
    padding: 6px 12px;
    border-radius: 999px;
    background: var(--bg);
    border: 1.5px solid transparent;
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
    cursor: pointer;
    font-family: inherit;
    transition: all .12s ease;
}
.level-chip:hover { background: var(--accent-pale); color: var(--accent-text); }
.level-chip.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* === Native dialog reset === */
dialog.modal-dialog {
    border: none;
    background: var(--card);
    border-radius: 22px;
    padding: 28px;
    max-width: 520px;
    width: calc(100% - 32px);
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.18);
    color: var(--text);
}
/* Страховка центрирования: на случай если showModal() не сработал
   и dialog открыт через .open класс или атрибут open */
dialog.modal-dialog[open],
dialog.modal-dialog.open {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    margin: 0;
    z-index: 10000;
    display: block;
}
/* Если нет нативного ::backdrop (открыт классом, а не showModal) —
   рисуем свой через after-element body */
body:has(dialog.modal-dialog.open)::before {
    content: '';
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(2px);
    z-index: 9999;
}
dialog.modal-dialog::backdrop {
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(2px);
}
dialog.modal-dialog h3 { font-size: 20px; font-weight: 700; margin-bottom: 12px; }
dialog.modal-dialog .modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 24px;
    flex-wrap: wrap;
}

/* === Большие модалки <dialog> (для homework create, materials, etc) === */
dialog.modal-dialog.modal-lg { max-width: 720px; }
dialog.modal-dialog.modal-md { max-width: 600px; }
dialog.modal-dialog.modal-sm { max-width: 420px; }

/* Если у dialog есть scrollable content, гарантируем max-height */
dialog.modal-dialog {
    max-height: calc(100vh - 64px);
    overflow-y: auto;
}

/* === Sidebar collapse (свернутая icon-only версия) === */
.app.sidebar-collapsed .sidebar {
    width: 76px;
    padding: 36px 12px;
}
.app.sidebar-collapsed .brand-name,
.app.sidebar-collapsed .nav a span,
.app.sidebar-collapsed .sidebar-profile-name,
.app.sidebar-collapsed .view-mode-switch-label,
.app.sidebar-collapsed .view-mode-btn span,
.app.sidebar-collapsed .nav-divider {
    display: none;
}
.app.sidebar-collapsed .nav a {
    justify-content: center;
    padding: 13px 0;
}
.app.sidebar-collapsed .brand {
    padding: 0;
    justify-content: center;
}
.app.sidebar-collapsed .brand-logo-img {
    width: 44px;
    height: 44px;
}
.app.sidebar-collapsed .sidebar-profile {
    flex-direction: column;
    gap: 8px;
    padding: 6px;
}
.app.sidebar-collapsed .sidebar-profile-link {
    padding: 4px;
    justify-content: center;
}
.app.sidebar-collapsed .view-mode-switch-btns {
    grid-template-columns: 1fr;
}

.app {
    grid-template-columns: 264px 1fr;
    transition: grid-template-columns .18s ease;
}
.app.sidebar-collapsed {
    grid-template-columns: 76px 1fr;
}

/* Toggle висит на правом краю sidebar.
   Sidebar — position: sticky (не создаёт containing block для absolute), поэтому
   используем position: fixed с координатами от ширины sidebar.
   На collapsed sidebar width=76px → left=62px; на expanded width=264px → left=250px. */
.sidebar-toggle {
    position: fixed;
    top: 56px;
    left: calc(264px - 14px);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--card);
    border: 1.5px solid var(--line-strong);
    color: var(--muted);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    transition: background-color .12s ease, color .12s ease, transform .18s ease, left .18s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}
.sidebar-toggle:hover { background: var(--accent-pale); color: var(--accent-text); }
.app.sidebar-collapsed .sidebar-toggle {
    left: calc(76px - 14px);
}
.app.sidebar-collapsed .sidebar-toggle svg { transform: rotate(180deg); }
@media (max-width: 900px) { .sidebar-toggle { display: none; } }

/* === Material type SVG icons === */
.material-type-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* === Recurring schedule preview dates === */
.recurring-preview {
    background: var(--card);
    border-radius: 14px;
    padding: 12px 16px;
    margin-top: 10px;
    border: 1.5px solid var(--accent-soft);
    font-size: 13px;
}
.recurring-preview-label {
    font-size: 11px;
    text-transform: uppercase;
    color: var(--muted);
    font-weight: 700;
    margin-bottom: 6px;
    letter-spacing: 0.4px;
}
.recurring-preview-dates {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.recurring-preview-date {
    background: var(--accent-pale);
    color: var(--accent-text);
    padding: 4px 10px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 12px;
}

/* === Overflow menu (3 точки) === */
.overflow-menu {
    position: relative;
}
.overflow-menu-trigger {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: transparent;
    border: 0;
    color: var(--muted);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background-color .12s ease;
}
.overflow-menu-trigger:hover { background: var(--accent-pale); color: var(--accent-text); }
.overflow-menu-panel {
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 4px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.12);
    padding: 4px;
    min-width: 180px;
    z-index: 100;
    display: none;
}
.overflow-menu-panel.open { display: block; }
.overflow-menu-item {
    width: 100%;
    text-align: left;
    background: transparent;
    border: 0;
    padding: 10px 12px;
    border-radius: 8px;
    font-family: inherit;
    font-size: 14px;
    color: var(--text);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    transition: background-color .1s ease;
}
.overflow-menu-item:hover { background: var(--bg); }
.overflow-menu-item.danger { color: var(--red); }
.overflow-menu-item.danger:hover { background: var(--red-soft); }

/* === Flashcards flip animation === */
.flashcard {
    background: var(--accent-pale);
    color: var(--accent-text);
    padding: 48px 24px;
    border-radius: 18px;
    margin: 16px 0;
    cursor: pointer;
    text-align: center;
    user-select: none;
    perspective: 1000px;
    min-height: 180px;
    position: relative;
}
.flashcard-inner {
    transform-style: preserve-3d;
    transition: transform .5s;
    position: relative;
    min-height: 132px;
}
.flashcard.flipped .flashcard-inner {
    transform: rotateY(180deg);
}
.flashcard-face {
    position: absolute;
    inset: 0;
    backface-visibility: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 12px;
}
.flashcard-face.back { transform: rotateY(180deg); color: var(--text); }
.flashcard-text { font-size: 28px; font-weight: 700; line-height: 1.2; }
.flashcard-hint { font-size: 12px; color: var(--muted); margin-top: 12px; }

/* === Email verification banner === */
.email-verify-banner {
    display: grid;
    grid-template-columns: 40px 1fr auto;
    gap: 14px;
    align-items: center;
    padding: 14px 18px;
    margin-bottom: 16px;
    background: var(--yellow-soft);
    border: 1.5px solid #F5D87D;
    border-radius: 14px;
}
.email-verify-banner-icon {
    width: 40px; height: 40px;
    border-radius: 12px;
    background: #fff;
    color: var(--yellow);
    display: flex; align-items: center; justify-content: center;
}
.email-verify-banner-title { font-weight: 700; font-size: 14px; color: var(--yellow); }
.email-verify-banner-text { color: var(--text); font-size: 13px; margin-top: 2px; line-height: 1.4; }
@media (max-width: 700px) {
    .email-verify-banner { grid-template-columns: 1fr; text-align: left; }
    .email-verify-banner .btn { width: 100%; }
}

/* === In-cabinet checkout packages === */
.checkout-packages {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
}
.checkout-package {
    border: 1.5px solid var(--line-strong);
    border-radius: 16px;
    padding: 18px;
    cursor: pointer;
    transition: all .15s ease;
    background: var(--card);
    text-align: left;
    font-family: inherit;
}
.checkout-package:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(236, 95, 0, 0.1);
}
.checkout-package-title { font-weight: 700; font-size: 15px; }
.checkout-package-price { color: var(--accent-text); font-weight: 800; font-size: 24px; margin-top: 6px; }
.checkout-package-lessons { color: var(--muted); font-size: 13px; margin-top: 4px; }

/* === Длительность урока (chip-row) === */
.duration-bar {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px 12px;
    background: var(--card);
    border-radius: 14px;
    margin-bottom: 16px;
}
.duration-chip {
    padding: 8px 14px;
    border-radius: 10px;
    background: var(--bg);
    border: 1.5px solid transparent;
    color: var(--text);
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    font-family: inherit;
    transition: background-color .12s ease, color .12s ease, border-color .12s ease;
}
.duration-chip:hover { background: var(--accent-pale); color: var(--accent-text); }
.duration-chip.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

/* === Sidebar nav-item для уведомлений (триггер notif panel) === */
.nav-notif-trigger {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 13px 18px;
    border-radius: 14px;
    color: var(--text);
    text-decoration: none;
    font-weight: 500;
    cursor: pointer;
    transition: background .15s, color .15s;
    width: 100%;
    background: transparent;
    border: 0;
    font-family: inherit;
    font-size: inherit;
    text-align: left;
}
.nav-notif-trigger:hover { background: rgba(236, 95, 0, 0.06); }
.nav-notif-trigger svg { width: 22px; height: 22px; stroke-width: 1.7; flex-shrink: 0; }
.nav-notif-trigger[aria-expanded="true"] {
    background: var(--accent-soft);
    color: var(--accent-text);
}

/* === Subscription row (expandable) === */
.sub-row {
    background: var(--card);
    border-radius: 16px;
    margin-bottom: 8px;
    overflow: hidden;
}
.sub-row-head {
    display: grid;
    align-items: center;
    gap: 14px;
    padding: 16px 20px;
    width: 100%;
    background: transparent;
    border: 0;
    cursor: pointer;
    font-family: inherit;
    text-align: left;
    color: inherit;
    transition: background-color .12s ease;
}
.sub-row-head:hover { background: var(--bg); }
.sub-row-chevron {
    color: var(--muted);
    transition: transform .18s ease;
}
.sub-row-head[aria-expanded="true"] .sub-row-chevron { transform: rotate(180deg); }

.sub-row-detail {
    padding: 0 20px 20px;
    background: var(--bg);
    border-top: 1px solid var(--line);
}
.sub-detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 14px 24px;
    padding: 16px 0;
}
.sub-detail-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--muted);
    font-weight: 700;
    margin-bottom: 4px;
}
.sub-detail-value { font-size: 14px; font-weight: 600; color: var(--text); }
.sub-detail-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    padding-top: 12px;
    border-top: 1px solid var(--line);
}

/* === Progress card на дашборде ученика === */
.progress-card {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 18px;
    padding: 20px 24px;
    background: linear-gradient(135deg, var(--card) 0%, var(--accent-pale) 100%);
    border-radius: 18px;
    margin-bottom: 24px;
    border: 1.5px solid var(--accent-soft);
}
.progress-card-item { text-align: center; }
.progress-card-value {
    font-size: 28px;
    font-weight: 800;
    color: var(--accent-text);
    letter-spacing: -0.5px;
    line-height: 1;
}
.progress-card-label {
    font-size: 12px;
    color: var(--muted);
    margin-top: 6px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* === Teacher KPI trend (стрелка ↑↓) === */
.kpi-trend {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 6px;
    margin-left: 6px;
}
.kpi-trend.up { background: var(--green-soft); color: var(--green); }
.kpi-trend.down { background: var(--red-soft); color: var(--red); }
.kpi-trend.flat { background: var(--bg); color: var(--muted); }

/* === Drag-zone для HW file upload === */
.dropzone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 28px 20px;
    border: 2px dashed var(--line-strong);
    border-radius: 14px;
    background: var(--bg);
    cursor: pointer;
    transition: border-color .15s ease, background-color .15s ease;
    text-align: center;
    color: var(--muted);
}
.dropzone:hover, .dropzone.dragover {
    border-color: var(--accent);
    background: var(--accent-pale);
    color: var(--accent-text);
}
.dropzone-icon { font-size: 32px; margin-bottom: 8px; line-height: 1; }
.dropzone-title { font-weight: 600; font-size: 14px; color: var(--text); }
.dropzone-hint { font-size: 12px; margin-top: 4px; }
.dropzone-preview {
    margin-top: 12px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--card);
    border-radius: 10px;
    font-size: 13px;
    color: var(--text);
}
.dropzone-preview-remove {
    background: transparent;
    border: 0;
    color: var(--red);
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    padding: 2px;
}

/* === HW edit hint (показывается пока учитель не проверил) === */
.hw-edit-hint {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--yellow-soft);
    border-radius: 12px;
    margin-bottom: 16px;
    font-size: 13px;
    color: var(--text);
}

/* === Skeleton loader (A7) === */
.skeleton {
    background: linear-gradient(90deg, var(--line) 25%, #f5efe0 50%, var(--line) 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.4s infinite ease-in-out;
    border-radius: 8px;
}
@keyframes skeleton-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}
.skeleton-line { height: 14px; margin-bottom: 8px; }
.skeleton-line.short { width: 40%; }
.skeleton-line.medium { width: 70%; }
.skeleton-block { height: 60px; margin-bottom: 12px; }

/* === Touch target audit (O4) — гарантируем 44x44 для критичных контролов === */
.sidebar-profile-action,
.calendar .cal-arrows button,
.cal-arrows button,
.burger,
.password-toggle,
.notif-icon-btn,
.snackbar-close,
.sidebar-toggle {
    min-width: 44px;
    min-height: 44px;
}
/* Исключения: декоративные иконки внутри карточек могут быть меньше — там клик идёт по родительской карточке */

/* === Profile dropdown — выпадающее меню над аватаром === */
.sidebar-profile { position: relative; }
.profile-dropdown {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 8px;
    right: 8px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 12px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12);
    z-index: 100;
}
.profile-dropdown[hidden] { display: none; }
.profile-dropdown-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--muted);
    font-weight: 700;
    margin-bottom: 8px;
    padding: 0 4px;
}
.profile-dropdown-modes {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    background: var(--bg);
    border-radius: 10px;
    padding: 3px;
}
.profile-dropdown-modes.lang-switcher {
    grid-template-columns: 1fr 1fr 1fr;
}
.profile-dropdown-modes.lang-switcher .lang-btn {
    flex-direction: column;
    gap: 2px;
    padding: 6px 4px;
    font-size: 11px;
    line-height: 1.1;
}
.profile-dropdown-modes.lang-switcher .lang-code {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: var(--muted);
}
.profile-dropdown-modes.lang-switcher .view-mode-btn.active .lang-code {
    color: inherit;
}
.profile-dropdown-divider {
    border: 0;
    border-top: 1px solid var(--line);
    margin: 10px 0;
}

/* === DnD reschedule visual feedback === */
.schedule-table td.dragging {
    opacity: 0.4;
    transform: scale(0.95);
}
.schedule-table td.drop-target {
    background: var(--accent-pale) !important;
    border: 2px dashed var(--accent) !important;
    color: var(--accent-text) !important;
}

/* === Inline recording player (Drive preview iframe) === */
.recording-player-wrap {
    display: flex;
    flex-direction: column;
}
.recording-player {
    width: 100%;
    aspect-ratio: 16 / 9;
    border: 0;
    border-radius: 14px;
    background: #000;
}

/* === E1: Drive thumbnail */
.lesson-row .thumb-drive {
    background-size: cover !important;
    background-position: center !important;
}

/* === Spaced repetition rate-buttons === */
.sr-rate-row {
    display: flex;
    gap: 6px;
    justify-content: center;
    flex-wrap: wrap;
    margin: 16px 0 4px;
}
.sr-rate-row .btn {
    flex: 1;
    min-width: 100px;
    padding: 10px 12px;
}
.sr-rate-row .btn:nth-child(1) { color: var(--red); border-color: var(--red-soft); }
.sr-rate-row .btn:nth-child(2) { color: var(--yellow); border-color: #F5D87D; }

/* === Rich-text toolbar (K8) === */
.rt-toolbar {
    display: inline-flex;
    gap: 4px;
    padding: 4px;
    background: var(--bg);
    border-radius: 10px;
    margin-bottom: 8px;
}
.rt-btn {
    width: 30px;
    height: 30px;
    border: 0;
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    color: var(--muted);
    font-family: inherit;
    font-size: 14px;
    transition: background-color .12s ease, color .12s ease;
}
.rt-btn:hover { background: var(--card); color: var(--text); }
.note-rich {
    min-height: 160px;
    padding: 12px 14px;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.5;
    outline: none;
}
.note-rich:empty::before {
    content: attr(data-placeholder);
    color: var(--muted);
    pointer-events: none;
}
.note-rich ul, .note-rich ol { padding-left: 20px; margin: 6px 0; }
.note-rich:focus { outline: 2px solid var(--accent); outline-offset: 0; border-radius: 12px; }

/* === HW templates picker === */
.hw-templates {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 8px;
    margin-bottom: 12px;
}
.hw-template-btn {
    padding: 12px 14px;
    background: var(--bg);
    border: 1.5px solid transparent;
    border-radius: 12px;
    cursor: pointer;
    text-align: left;
    font-family: inherit;
    transition: all .12s ease;
}
.hw-template-btn:hover {
    border-color: var(--accent);
    background: var(--accent-pale);
}
.hw-template-name { font-weight: 600; font-size: 13px; color: var(--text); }
.hw-template-desc { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* === Student drawer (row peek для my_students) === */
.student-drawer-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.35);
    z-index: 1000;
    opacity: 0;
    animation: drawerBackdropIn .18s ease forwards;
}
@keyframes drawerBackdropIn { to { opacity: 1; } }
.student-drawer-backdrop[hidden] { display: none; }

.student-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 480px;
    max-width: calc(100vw - 32px);
    background: var(--card);
    box-shadow: -20px 0 60px rgba(15, 23, 42, 0.18);
    z-index: 1001;
    transform: translateX(100%);
    transition: transform .26s cubic-bezier(.22, .9, .27, 1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.student-drawer.open { transform: translateX(0); }
.student-drawer[aria-hidden="true"] { pointer-events: none; }
.student-drawer.open[aria-hidden="false"] { pointer-events: auto; }

.student-drawer-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--line);
    flex-shrink: 0;
    background: var(--card);
    position: relative;
}
.student-drawer-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: transparent;
    border: 0;
    color: var(--muted);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background-color .12s ease, color .12s ease;
}
.student-drawer-close:hover { background: var(--bg); color: var(--text); }

.student-drawer-title-wrap {
    display: grid;
    grid-template-columns: 56px 1fr;
    gap: 14px;
    align-items: center;
    padding-right: 44px;
}
.student-drawer-avatar {
    width: 56px;
    height: 56px;
    font-size: 18px;
    font-weight: 700;
    flex-shrink: 0;
}
.student-drawer-name {
    font-size: 20px;
    font-weight: 800;
    line-height: 1.2;
    margin: 0;
    letter-spacing: -0.3px;
}
.student-drawer-meta {
    font-size: 13px;
    color: var(--muted);
    margin-top: 4px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}
.student-drawer-meta .level-pill {
    margin-left: 0;
}

.student-drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 18px 20px;
}
.student-drawer-skeleton { display: flex; flex-direction: column; gap: 14px; }
.student-drawer-content { display: flex; flex-direction: column; gap: 18px; }

.drawer-section {
    background: var(--bg);
    border-radius: 14px;
    padding: 14px 16px;
}
.drawer-section.drawer-primary-action {
    background: linear-gradient(135deg, var(--accent-pale), var(--accent-soft));
    padding: 16px;
}
.drawer-section-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--muted);
    font-weight: 700;
    margin: 0 0 10px;
}

.drawer-next-row {
    display: flex;
    align-items: center;
    gap: 12px;
}
.drawer-next-date {
    font-size: 16px;
    font-weight: 700;
    color: var(--accent-text);
}
.drawer-next-meta { color: var(--muted); font-size: 13px; }

.drawer-sub-progress {
    height: 6px;
    background: var(--card);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 8px;
}
.drawer-sub-progress-fill {
    height: 100%;
    background: var(--green);
    border-radius: 3px;
}
.drawer-sub-progress-fill.low { background: var(--yellow); }
.drawer-sub-progress-fill.critical { background: var(--red); }

.drawer-kpi-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}
.drawer-kpi-cell {
    background: var(--card);
    border-radius: 10px;
    padding: 10px 12px;
    text-align: center;
}
.drawer-kpi-value { font-size: 18px; font-weight: 800; line-height: 1; color: var(--text); }
.drawer-kpi-label { font-size: 11px; color: var(--muted); margin-top: 4px; }

.drawer-note-text {
    white-space: pre-wrap;
    font-size: 14px;
    line-height: 1.5;
    max-height: 120px;
    overflow-y: auto;
    color: var(--text);
}
.drawer-note-meta { font-size: 11px; color: var(--muted); margin-top: 8px; }
.drawer-note-empty { color: var(--muted); font-style: italic; font-size: 13px; }

.drawer-lesson-item {
    display: grid;
    grid-template-columns: 90px 1fr auto;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid var(--line);
    align-items: center;
    font-size: 13px;
}
.drawer-lesson-item:last-child { border-bottom: 0; }
.drawer-lesson-date {
    font-weight: 700;
    color: var(--accent-text);
    font-size: 12px;
}
.drawer-lesson-topic { color: var(--text); }
.drawer-lesson-tags {
    display: inline-flex;
    gap: 4px;
    align-items: center;
}
.drawer-tag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 6px;
    background: var(--bg);
    color: var(--muted);
    font-size: 11px;
}
.drawer-tag.has { background: var(--green-soft); color: var(--green); }
.drawer-tag.hw { background: var(--accent-pale); color: var(--accent-text); }

.student-drawer-footer {
    padding: 14px 20px;
    border-top: 1px solid var(--line);
    background: var(--card);
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}
.student-drawer-footer .btn { flex: 1; min-height: 44px; }

.student-drawer-error {
    padding: 24px 16px;
    text-align: center;
    color: var(--muted);
    background: var(--bg);
    border-radius: 14px;
}

/* Подсветка активной строки в списке */
.students-list-row.is-active-drawer {
    background: var(--accent-pale);
    box-shadow: inset 4px 0 0 var(--accent);
}

/* Mobile */
@media (max-width: 720px) {
    .student-drawer {
        width: 100vw;
        max-width: 100vw;
    }
    .drawer-kpi-grid { grid-template-columns: repeat(2, 1fr); }
}

/* === Notion IA: общий стиль табов — используется в Уроках, ДЗ, Шаблонах, Профиле, Учениках, Календаре === */
/* Алиас .schedule-tabs/.schedule-tab — для обратной совместимости с шаблоном «Календарь» */
.hw-tabs-pills,
.schedule-tabs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 16px;
    padding: 0;
    background: transparent;
}
.hw-tab-pill,
.schedule-tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 18px;
    background: var(--card);
    border: 1px solid transparent;  /* selected: 1px orange (см. .active ниже) */
    border-radius: 14px;
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    text-decoration: none;
    transition: all .15s ease;
}
.hw-tab-pill:hover,
.schedule-tab:hover { border-color: var(--accent-soft); }
.hw-tab-pill.active,
.schedule-tab.active {
    /* Selected state = просто 1px orange-обводка (по скрину Уроки) */
    border: 1px solid var(--accent);
    background: var(--accent-pale);
    color: var(--accent);
}
.hw-tab-pill-count,
.schedule-tab-count {
    background: var(--bg);
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 999px;
}
.hw-tab-pill.active .hw-tab-pill-count,
.schedule-tab.active .schedule-tab-count {
    background: var(--accent);
    color: #fff;
}
.schedule-tab-count.pending {
    background: var(--yellow);
    color: #fff;
}

/* === Табы второго уровня — сегментированный pill-переключатель ===
   Используется ВНУТРИ карточки для разрезов того же раздела (Сегодня / Все, Месяц / Год и т.п.).
   Пример: «Сегодня» / «Все ближайшие» внутри «Предстоящие уроки». */
.hw-subtabs {
    display: inline-flex;
    flex-wrap: nowrap;
    gap: 2px;
    padding: 3px;
    background: var(--bg);
    border-radius: 10px;
    margin-bottom: 14px;
    max-width: 100%;
}
.hw-subtab {
    display: inline-flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 8px;
    border: 0;
    background: transparent;
    padding: 7px 14px;
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
    border-radius: 7px;
    cursor: pointer;
    font-family: inherit;
    text-decoration: none;
    transition: all .12s ease;
    white-space: nowrap;
}
.hw-subtab > span { white-space: nowrap; flex-shrink: 0; }
.hw-subtab:hover { color: var(--text); }
.hw-subtab.active {
    background: var(--card);
    color: var(--accent);
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.hw-subtab-count {
    background: rgba(0,0,0,0.06);
    color: var(--muted);
    padding: 1px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    min-width: 16px;
    text-align: center;
}
.hw-subtab.active .hw-subtab-count {
    background: var(--accent-pale);
    color: var(--accent);
}

/* === Mobile responsive overrides — Notion IA pages === */

/* Tabs: горизонтальный скролл на узких экранах */
@media (max-width: 720px) {
    .hw-tabs-pills,
    .schedule-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        max-width: 100%;
        scrollbar-width: thin;
        padding-bottom: 4px;  /* место для скроллбара */
    }
    .hw-tab-pill,
    .schedule-tab {
        flex-shrink: 0;
        white-space: nowrap;
        padding: 10px 14px;
    }
}

/* Two-column layouts collapse to 1-col на мобилке */
@media (max-width: 720px) {
    .student-detail-grid,
    .lesson-detail-grid,
    .tpl-detail-grid,
    .security-grid {
        grid-template-columns: 1fr;
    }
}

/* Materials & template filters — 1-col на мобилке */
@media (max-width: 700px) {
    .materials-filters,
    .tpl-filters {
        grid-template-columns: 1fr;
    }
}

/* Cards grid responsive (materials, templates) */
@media (max-width: 600px) {
    .materials-grid,
    .tpl-grid {
        grid-template-columns: 1fr;
    }
}

/* === Box-sizing нормализация (безопасно, без !important) === */
.card { box-sizing: border-box; }
.lesson-detail-grid,
.security-grid,
.profile-personal-grid,
.profile-language-grid,
.student-detail-grid,
.tpl-detail-grid { box-sizing: border-box; }

/* Профиль personal collapse → 1-col на узком */
@media (max-width: 900px) {
    .profile-personal-grid { grid-template-columns: 1fr; }
}

/* Form-инпуты внутри card — 100% (только реальные инпуты, не контейнеры) */
.card form .input,
.card form .textarea { width: 100%; box-sizing: border-box; }

/* === Notion IA: cards и панели на всю ширину контейнера, особенно мобилка === */

/* Lesson detail: HW + Materials + Recording в один поток на мобилке, full width */
.lesson-detail-grid > .card { width: 100%; }
.lesson-hw-card,
.lesson-materials-card,
.lesson-recording-card { grid-column: 1 / -1 !important; width: 100%; }

/* Hero card в Cabinet: на мобилке стопка вместо горизонтальной разметки */
@media (max-width: 720px) {
    .hero-grid {
        grid-template-columns: 1fr !important;
        text-align: left !important;
    }
    .hero-card .hero-icon,
    .hero-card .ico-big { margin-bottom: 12px; }
}

/* Profile-personal-grid: всегда одна колонка (по Notion — одна большая карта с аватаром внутри) */
.profile-personal-grid { grid-template-columns: 1fr; }

/* Чтобы card не вышла за рамки viewport на узких экранах */
@media (max-width: 720px) {
    .card { box-sizing: border-box; width: 100%; max-width: 100%; }
    .main { padding-left: 12px; padding-right: 12px; box-sizing: border-box; }
}

/* Lesson detail-grid → 1 колонка везде (по Notion — последовательность секций) */
.lesson-detail-grid { grid-template-columns: 1fr; }

/* === Notion IA: Students list — виджеты === */
.students-widgets {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
    margin-bottom: 18px;
}
.students-widget {
    background: var(--card);
    padding: 16px 20px;
    border-radius: 14px;
    border: 1.5px solid transparent;
}
.students-widget.is-warn { border-color: color-mix(in srgb, var(--accent) 40%, transparent); background: color-mix(in srgb, var(--accent) 6%, var(--card)); }
.students-widget-value { font-size: 28px; font-weight: 800; color: var(--text); line-height: 1; }
.students-widget-label { font-size: 13px; color: var(--muted); margin-top: 6px; }
@media (max-width: 600px) {
    .students-widgets { grid-template-columns: 1fr; }
}

/* === FIX: mobile sidebar grid override (повторное определение .app выше перекрывало @media) === */
@media (max-width: 900px) {
    .app,
    .app.sidebar-collapsed {
        grid-template-columns: 1fr !important;
    }
    /* На мобильных sidebar fixed/overlay, не должен занимать колонку в гриде */
    .sidebar {
        position: fixed;
        top: 0; left: 0; bottom: 0;
        width: 280px;
        max-width: 88vw;
        z-index: 100;
        transform: translateX(-100%);
        transition: transform .2s ease;
    }
    .sidebar.open { transform: translateX(0); box-shadow: 4px 0 20px rgba(0,0,0,0.2); }
    .main { width: 100%; min-width: 0; }
}

/* === Notion IA: Students table === */
.students-table { padding: 0; overflow: hidden; }
.students-table-head {
    display: grid;
    grid-template-columns: 2fr 90px 1.2fr 1.2fr 1.4fr;
    gap: 16px;
    padding: 14px 20px;
    background: var(--bg);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--muted);
    border-bottom: 1px solid var(--line);
}
.students-table-row {
    display: grid;
    grid-template-columns: 2fr 90px 1.2fr 1.2fr 1.4fr;
    gap: 16px;
    padding: 14px 20px;
    align-items: center;
    border-bottom: 1px solid var(--line);
    text-decoration: none;
    color: inherit;
    transition: background-color .12s ease;
}
.students-table-row:last-child { border-bottom: 0; }
.students-table-row:hover { background: var(--bg); }
.students-table-row .cell-student { display: flex; align-items: center; gap: 12px; min-width: 0; }
.students-table-row .cell-name { font-weight: 600; font-size: 14px; }
.students-table-row .cell-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.students-table-row .cell-date { font-variant-numeric: tabular-nums; font-size: 13px; }
.students-table-row .remaining-num { font-weight: 700; font-size: 16px; }
.students-table-row .remaining-num.is-warn { color: var(--accent); }
.muted-text { color: var(--muted); font-size: 13px; }
.level-pill {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 32px; padding: 3px 8px;
    background: var(--accent-soft, #FFE5D4);
    color: var(--accent, #EC5F00);
    border-radius: 6px; font-weight: 700; font-size: 12px;
}

@media (max-width: 800px) {
    .students-table-head { display: none; }
    .students-table-row {
        grid-template-columns: 1fr;
        gap: 6px;
        padding: 14px 16px;
    }
    .students-table-row > div:not(:first-child)::before {
        content: attr(data-label);
        display: block;
        font-size: 11px;
        color: var(--muted);
        text-transform: uppercase;
        margin-bottom: 2px;
    }
}

/* === Notion IA: Student profile mini-tables === */
.stp-table { display: flex; flex-direction: column; }
.stp-table-head {
    display: grid; gap: 12px;
    padding: 10px 14px;
    background: var(--bg);
    border-radius: 10px 10px 0 0;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--muted);
}
.stp-table-row {
    display: grid; gap: 12px;
    padding: 12px 14px;
    align-items: center;
    border-bottom: 1px solid var(--line);
    font-size: 13.5px;
    color: inherit;
    text-decoration: none;
    transition: background-color .12s ease;
}
.stp-table-row:last-child { border-bottom: 0; }
.stp-row-link:hover { background: var(--bg); }
@media (max-width: 720px) {
    .stp-table-head { display: none; }
    .stp-table-row {
        grid-template-columns: 1fr !important;
        gap: 4px;
        padding: 12px 14px;
    }
}

/* === Notion IA: Students list — progress bar в остатке + меню ⋯ === */
.students-table-head { grid-template-columns: 2fr 90px 1.2fr 1.2fr 1.4fr 56px; }
.students-table-row { grid-template-columns: 2fr 90px 1.2fr 1.2fr 1.4fr 56px; }
.students-table-row .cell-student { display: flex; align-items: center; gap: 12px; min-width: 0; color: inherit; text-decoration: none; }
.students-table-row .cell-student:hover .cell-name { color: var(--accent); }

.remaining-line { font-weight: 600; }
.remaining-progress {
    margin-top: 6px;
    height: 6px;
    background: var(--bg);
    border-radius: 999px;
    overflow: hidden;
}
.remaining-progress-bar {
    height: 100%;
    border-radius: 999px;
    transition: width .3s ease;
}
.remaining-progress-bar.is-ok { background: var(--green, #2E9E3A); }
.remaining-progress-bar.is-warn { background: var(--accent, #EC5F00); }
.remaining-progress-bar.is-danger { background: var(--red, #D43F3F); }

.students-table-row.is-inactive { opacity: 0.65; }

.cell-menu { position: relative; display: flex; justify-content: flex-end; }
.st-menu-btn {
    width: 32px; height: 32px;
    border-radius: 8px;
    background: transparent;
    border: 1.5px solid transparent;
    cursor: pointer;
    font-size: 18px;
    color: var(--muted);
    transition: all .12s ease;
}
.st-menu-btn:hover { background: var(--bg); color: var(--text); border-color: var(--line); }
.st-menu {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    min-width: 220px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.08);
    padding: 6px;
    z-index: 50;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.st-menu-item {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 10px;
    border-radius: 8px;
    color: var(--text);
    text-decoration: none;
    font-size: 14px;
    transition: background-color .1s ease;
}
.st-menu-item:hover { background: var(--bg); color: var(--accent); }
.st-menu-item svg { color: var(--muted); flex-shrink: 0; }
.st-menu-item:hover svg { color: var(--accent); }

@media (max-width: 800px) {
    .students-table-head,
    .students-table-row { grid-template-columns: 1fr 56px !important; }
    .students-table-row > div:not(.cell-student):not(.cell-menu) { grid-column: 1; }
    .students-table-row .cell-menu { grid-column: 2; grid-row: 1; }
}

/* FIX: [hidden] should override display:flex on .st-menu */
.st-menu[hidden] { display: none !important; }

/* === Notion IA: Basic info grid (used in lesson detail + past_lessons partial) === */
.basic-info-grid { display: flex; flex-direction: column; }
.basic-info-row { display: grid; grid-template-columns: 160px 1fr; gap: 16px; padding: 10px 0; border-top: 1px solid var(--line); align-items: center; }
.basic-info-row:first-child { border-top: 0; padding-top: 0; }
.basic-info-label { color: var(--muted); font-size: 13px; font-weight: 500; }
.basic-info-value { font-size: 14px; }
.basic-info-person { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; }
.basic-info-person.clickable { padding: 4px 8px; margin: -4px -8px; border-radius: 8px; transition: background-color .15s ease; }
.basic-info-person.clickable:hover { background: var(--bg); }
.person-name { font-weight: 600; }
.person-meta { color: var(--muted); font-size: 12px; margin-top: 2px; }
@media (max-width: 600px) {
    .basic-info-row { grid-template-columns: 1fr; gap: 4px; }
}

/* === FIX: sticky header при скролле + full-width actions на мобилке === */
@media (max-width: 900px) {
    .mobile-topbar {
        position: sticky;
        top: 0;
        z-index: 100;
        background: var(--bg);
        border-bottom: 1px solid var(--line);
        box-shadow: 0 1px 0 var(--line);
    }
    /* Главное: НЕ создавать дополнительный scroll-контекст в .main */
    .main { overflow: visible !important; }
    .app { overflow: visible !important; }
    body { overflow-x: hidden; }
}

@media (max-width: 600px) {
    /* Lessons actions на мобилке — full width в столбик */
    .lessons-row-actions {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
    }
    .lessons-row-actions .btn {
        width: 100%;
        justify-content: center;
        text-align: center;
    }
}

/* === Notion-style lesson actions popup === */
.cell-next-trigger {
    background: transparent; border: 0; padding: 4px 8px; margin: -4px -8px;
    cursor: pointer; text-align: left; font: inherit; color: inherit;
    border-radius: 8px; transition: background-color .12s ease;
    width: 100%;
}
.cell-next-trigger:hover { background: var(--bg); }

.lesson-actions-info {
    display: grid;
    grid-template-columns: 56px 1fr auto;
    gap: 14px;
    align-items: center;
    padding: 14px 16px;
    background: var(--bg);
    border-radius: 14px;
    margin-bottom: 18px;
}
.lesson-actions-avatar {
    width: 56px; height: 56px; border-radius: 14px;
    background: linear-gradient(135deg, var(--accent-soft, #FFE5D4), #FFC9A6);
    color: var(--accent, #EC5F00);
    display: flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: 18px;
}
.lesson-actions-name { font-size: 18px; font-weight: 700; }
.lesson-actions-when { color: var(--muted); margin-top: 4px; font-size: 14px; }
.lesson-actions-when b { color: var(--accent); }

.lesson-actions-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 18px;
}
.lesson-action-card {
    display: flex; align-items: center; gap: 12px;
    padding: 14px 16px;
    background: var(--card);
    border: 1.5px solid var(--line);
    border-radius: 12px;
    text-align: left;
    cursor: pointer;
    font: inherit; color: inherit;
    transition: all .12s ease;
}
.lesson-action-card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.06); }
.lesson-action-icon {
    width: 44px; height: 44px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.lesson-action-icon.ico-accent { background: var(--accent-soft, #FFE5D4); color: var(--accent, #EC5F00); }
.lesson-action-icon.ico-red { background: #FCE0E0; color: #D43F3F; }
.lesson-action-title { font-weight: 700; font-size: 15px; }
.lesson-action-sub { color: var(--muted); font-size: 12px; margin-top: 2px; }

@media (max-width: 600px) {
    .lesson-actions-grid { grid-template-columns: 1fr; }
    .lesson-actions-info { grid-template-columns: 48px 1fr; }
    .lesson-actions-info > :nth-child(3) { grid-column: 1 / -1; }
}

/* ============================================================
   Словарь ученика — vocabulary page
   ============================================================ */
.vocab-widgets {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-bottom: 20px;
}
.vocab-widget {
    background: var(--card);
    border-radius: 18px;
    padding: 16px 18px;
    display: flex;
    align-items: center;
    gap: 14px;
    border: 1.5px solid transparent;
    transition: all .15s ease;
}
.vocab-widget:hover { border-color: var(--accent-soft); }
.vocab-widget-icon {
    width: 48px; height: 48px;
    border-radius: 14px;
    background: var(--bg);
    display: flex; align-items: center; justify-content: center;
    font-size: 26px;
    flex-shrink: 0;
}
.vocab-widget-body { min-width: 0; }
.vocab-widget-label { color: var(--muted); font-size: 13px; font-weight: 500; margin-bottom: 2px; }
.vocab-widget-value { font-size: 26px; font-weight: 800; letter-spacing: -0.5px; line-height: 1.1; }

.vocab-tabs { margin-bottom: 14px; }

.vocab-card-wrap { padding: 18px 20px; }

.vocab-subtabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    background: var(--bg);
    border-radius: 12px;
    padding: 4px;
    gap: 4px;
    margin-bottom: 16px;
}
.vocab-subtab {
    text-align: center;
    padding: 10px 14px;
    border-radius: 9px;
    color: var(--muted);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    transition: all .12s ease;
}
.vocab-subtab:hover { color: var(--text); }
.vocab-subtab.active { background: var(--card); color: var(--text); box-shadow: 0 1px 4px rgba(0,0,0,0.04); }

.vocab-add-bar {
    display: grid;
    grid-template-columns: auto auto 1fr auto;
    gap: 8px;
    align-items: center;
    margin-bottom: 6px;
}
.vocab-direction {
    padding: 8px 10px !important;
    font-size: 13px !important;
    min-width: 92px;
    width: auto;
}
.vocab-add-pair {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}
.vocab-add-btn {
    padding: 10px 12px !important;
    min-width: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.vocab-list-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin: 20px 0 12px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
}
.vocab-list-counter { color: var(--muted); font-size: 13px; font-weight: 500; }
.vocab-bulk-bar {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 10px;
    background: var(--accent-pale);
    border-radius: 10px;
}
.vocab-bulk-count { font-size: 13px; font-weight: 600; color: var(--accent); }
.vocab-checkbox {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--muted);
    cursor: pointer;
    user-select: none;
}
.vocab-checkbox input[type="checkbox"] {
    width: 18px; height: 18px;
    accent-color: var(--accent);
    cursor: pointer;
}
.vocab-check-all { color: var(--text); font-weight: 500; }

.vocab-words {
    list-style: none;
    padding: 0; margin: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.vocab-word {
    display: grid;
    grid-template-columns: 40px 1fr auto auto;
    gap: 12px;
    align-items: center;
    padding: 12px 8px;
    border-radius: 10px;
    transition: background-color .12s ease;
}
.vocab-word + .vocab-word { border-top: 1px solid var(--line); }
.vocab-word:hover { background: var(--bg); }

.vocab-tts {
    width: 36px; height: 36px;
    border-radius: 10px;
    background: var(--accent-pale);
    color: var(--accent);
    border: none;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all .12s ease;
}
.vocab-tts:hover { background: var(--accent); color: #fff; }

.vocab-word-body { min-width: 0; }
.vocab-word-text { font-weight: 600; font-size: 15px; color: var(--text); line-height: 1.3; }
.vocab-word-translation { color: var(--muted); font-size: 13px; margin-top: 2px; line-height: 1.3; }

.vocab-word-actions {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.vocab-word-actions button {
    width: 32px; height: 32px;
    border: none;
    background: transparent;
    border-radius: 8px;
    color: var(--muted);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all .12s ease;
}
.vocab-word-actions button:hover { background: var(--bg); color: var(--text); }
.vocab-toggle:hover { color: var(--green) !important; background: color-mix(in srgb, var(--green) 12%, transparent) !important; }
.vocab-delete:hover { color: var(--red) !important; background: color-mix(in srgb, var(--red) 12%, transparent) !important; }

.vocab-empty {
    text-align: center;
    padding: 36px 16px;
    color: var(--muted);
    font-size: 14px;
}

/* === Группировка по урокам === */
.vocab-lesson-groups { display: flex; flex-direction: column; gap: 10px; }
.vocab-lesson-group {
    background: var(--bg);
    border-radius: 12px;
    padding: 6px 12px;
}
.vocab-lesson-group > summary {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 8px 0;
    font-weight: 600;
    cursor: pointer;
    list-style: none;
}
.vocab-lesson-group > summary::-webkit-details-marker { display: none; }
.vocab-lesson-date { color: var(--accent); }
.vocab-lesson-teacher { color: var(--muted); font-size: 13px; }
.vocab-lesson-count {
    margin-left: auto;
    background: var(--card);
    color: var(--muted);
    border-radius: 999px;
    padding: 2px 10px;
    font-size: 12px;
    font-weight: 600;
}

/* === Flash-cards modal === */
#flashModal { max-width: 480px; }
.flash-progress {
    text-align: center;
    color: var(--muted);
    font-size: 13px;
    margin-bottom: 12px;
    font-weight: 600;
}
.flash-card {
    background: linear-gradient(135deg, var(--card) 0%, var(--bg) 100%);
    border-radius: 18px;
    padding: 48px 24px;
    min-height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    border: 1.5px dashed var(--accent-soft);
    cursor: pointer;
    margin-bottom: 16px;
    transition: transform .15s ease;
}
.flash-card:hover { transform: translateY(-2px); }
.flash-side { font-size: 24px; font-weight: 700; line-height: 1.3; }
.flash-back { color: var(--accent); }
.flash-actions {
    display: grid;
    grid-template-columns: auto 1fr 1fr;
    gap: 8px;
}

/* === Mobile === */
@media (max-width: 900px) {
    .vocab-widgets { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 700px) {
    .vocab-add-bar { grid-template-columns: 1fr; }
    .vocab-add-pair { grid-template-columns: 1fr; }
    .vocab-word { grid-template-columns: 36px 1fr auto; }
    .vocab-word .vocab-checkbox { display: none; }
    .vocab-subtabs { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
    .vocab-widgets { grid-template-columns: 1fr; }
    .vocab-widget-value { font-size: 22px; }
}

/* ============================================================
   Темы (Materials → Topics)
   ============================================================ */
.materials-section-tabs { margin-bottom: 18px; }

.topics-filters {
    grid-template-columns: 1fr 140px 140px 160px auto;
}

.topic-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 14px;
}
.topic-card {
    background: var(--card);
    border-radius: 16px;
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    border: 1.5px solid transparent;
    color: inherit;
    text-decoration: none;
    transition: all .15s ease;
}
.topic-card:hover {
    transform: translateY(-2px);
    border-color: var(--accent-soft);
    box-shadow: 0 8px 20px rgba(0,0,0,0.05);
}
.topic-card-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}
.topic-card-title { font-weight: 700; font-size: 17px; line-height: 1.3; }
.topic-card-desc { color: var(--muted); font-size: 13px; line-height: 1.4; flex: 1; }
.topic-card-meta { display: flex; gap: 6px; flex-wrap: wrap; }
.topic-card-footer {
    border-top: 1px solid var(--line);
    padding-top: 10px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 500;
}

.topic-difficulty {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.diff-low  { background: color-mix(in srgb, var(--green) 14%, #fff); color: var(--green); }
.diff-med  { background: color-mix(in srgb, var(--yellow) 14%, #fff); color: var(--yellow); }
.diff-high { background: color-mix(in srgb, var(--red) 14%, #fff); color: var(--red); }

/* === Topic detail page === */
.back-link {
    color: var(--muted);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 6px;
    display: inline-block;
}
.back-link:hover { color: var(--accent); }

.topic-edit-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
    align-items: start;
}
.topic-edit-grid > section { min-width: 0; }

.topic-word-form {
    display: grid;
    grid-template-columns: 64px 64px 1fr 1fr auto;
    gap: 8px;
    margin-bottom: 12px;
}
.topic-lang-sel {
    padding: 8px !important;
    font-size: 13px !important;
    text-align: center;
}
.topic-word-add {
    padding: 10px 12px !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.topic-word-list {
    list-style: none;
    margin: 0; padding: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.topic-word-row {
    display: grid;
    grid-template-columns: 64px 1fr auto;
    gap: 12px;
    align-items: center;
    padding: 10px 8px;
    border-radius: 10px;
}
.topic-word-row:hover { background: var(--bg); }
.topic-word-row + .topic-word-row { border-top: 1px solid var(--line); }
.topic-word-dir {
    font-size: 10px;
    font-weight: 700;
    color: var(--muted);
    background: var(--bg);
    padding: 4px 6px;
    border-radius: 6px;
    text-align: center;
    letter-spacing: 0.5px;
}
.topic-word-text { font-weight: 600; font-size: 14px; line-height: 1.3; }
.topic-word-tr { color: var(--muted); font-size: 13px; line-height: 1.3; margin-top: 2px; }
.topic-word-del {
    width: 32px; height: 32px;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: var(--muted);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.topic-word-del:hover { background: color-mix(in srgb, var(--red) 12%, transparent); color: var(--red); }

/* === Topic attach list (materials / homework templates) === */
.topic-attach-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 360px;
    overflow-y: auto;
    padding-right: 4px;
}
.topic-attach-row {
    display: grid;
    grid-template-columns: 22px 1fr;
    gap: 10px;
    align-items: flex-start;
    padding: 10px 12px;
    background: var(--bg);
    border-radius: 10px;
    cursor: pointer;
    border: 1.5px solid transparent;
    transition: all .12s ease;
}
.topic-attach-row:hover { border-color: var(--accent-soft); }
.topic-attach-row.is-attached { background: var(--accent-pale); border-color: var(--accent); }
.topic-attach-check { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; margin-top: 2px; }
.topic-attach-body { min-width: 0; }
.topic-attach-title { font-weight: 600; font-size: 14px; line-height: 1.3; }
.topic-attach-meta { margin-top: 4px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

.lesson-topic-picker {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    align-items: center;
    max-width: 540px;
}

@media (max-width: 1000px) {
    .topic-edit-grid { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
    .topics-filters { grid-template-columns: 1fr; }
    .topic-word-form { grid-template-columns: 1fr 1fr; }
    .topic-word-form .topic-word-add { grid-column: 1 / -1; }
    .topic-word-row { grid-template-columns: 50px 1fr auto; }
    .lesson-topic-picker { grid-template-columns: 1fr; }
}

/* ============================================================
 * Brand confirm popup (заменяет нативный confirm()) — sn- prefix
 * Доступен везде где загружен dashboard.css: учитель, ученик, materials.
 * Используется window.brandConfirm() из lesson_panel.js.
 * ============================================================ */
.sn-confirm-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(2px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.sn-confirm-backdrop[hidden] { display: none; }
.sn-confirm-modal {
    background: var(--card, #fff);
    border-radius: 16px;
    padding: 24px 28px;
    max-width: 440px;
    width: 100%;
    box-shadow: 0 18px 48px rgba(15, 23, 42, 0.22);
    animation: snConfirmIn .15s ease-out;
}
@keyframes snConfirmIn {
    from { opacity: 0; transform: translateY(8px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
.sn-confirm-modal h3 {
    margin: 0 0 8px;
    font-size: 18px;
    font-weight: 700;
    color: var(--text, #1a1a2e);
    line-height: 1.3;
}
.sn-confirm-modal p {
    margin: 0 0 20px;
    font-size: 14px;
    line-height: 1.5;
    color: var(--muted, #6b7280);
}
.sn-confirm-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}
.sn-confirm-actions .btn {
    min-width: 96px;
}

/* Floating tooltip для disabled-кнопок («только преподаватель…») */
.sn-disabled-tip {
    position: absolute;
    transform: translate(-50%, 0);
    background: #0f172a;
    color: #fff;
    font-size: 13px;
    font-weight: 500;
    padding: 8px 14px;
    border-radius: 8px;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.25);
    z-index: 10000;
    opacity: 0;
    transition: opacity .15s ease, transform .15s ease;
    pointer-events: none;
    white-space: nowrap;
    max-width: 90vw;
}
.sn-disabled-tip.is-in {
    opacity: 1;
    transform: translate(-50%, 4px);
}
