/**
 * Client portal (templates/client_portal/index.html)
 * Extracted from inline <style> block
 */

        :root {
            --bg: #f4f0f8;
            --card: #ffffff;
            --primary: #8B5A9F;
            --primary-2: #2D1B3D;
            --primary-mid: #5c3d75;
            --primary-light: #f0e8f7;
            --primary-border: #d4b8e8;
            --text: #1a1228;
            --text-secondary: #7a6b8a;
            --text-muted: #9a8caa;
            --border: #e8dff2;
            --success: #16a34a;
            --success-light: #dcfce7;
            --warning: #d97706;
            --warning-light: #fef3c7;
            --danger: #dc2626;
            --radius: 16px;
            --radius-sm: 10px;
            --shadow: 0 1px 3px rgba(45,27,61,.05), 0 2px 8px rgba(45,27,61,.04);
            --shadow-card: 0 1px 3px rgba(45,27,61,.05);
            --safe-top: env(safe-area-inset-top, 0px);
            --safe-bottom: env(safe-area-inset-bottom, 0px);
        }

        * { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

        body {
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
            background: var(--bg);
            color: var(--text);
            min-height: 100vh;
            overscroll-behavior: none;
        }
        /* Отступ под нижний таб-бар нужен только когда виден #app —
           раньше он висел на body всегда, из-за чего экран логина
           (min-height: 100dvh) вместе с этим отступом превышал высоту
           вьюпорта и весь /portal/ начинал скроллиться, обнажая внизу
           светлый фон body под фиолетовым градиентом логина. */
        body.cp-app-mode {
            padding-bottom: calc(var(--safe-bottom) + 68px);
        }

        /* ═══ HEADER ═══════════════════════════════════════════════════════════ */
        .header {
            background: rgba(255,255,255,.9);
            backdrop-filter: blur(16px) saturate(1.4);
            color: var(--text);
            padding: calc(var(--safe-top) + 12px) 16px 12px;
            position: sticky; top: 0; z-index: 90;
            border-bottom: 1px solid rgba(139,90,159,.1);
        }
        .header-inner {
            display: flex; align-items: center; gap: 12px; position: relative;
        }
        .header-logo {
            width: 40px; height: 40px; border-radius: 12px;
            background: linear-gradient(135deg, var(--primary) 0%, var(--primary-2) 100%);
            border: none; padding: 5px; flex-shrink: 0;
            box-shadow: 0 3px 10px rgba(139,90,159,.3);
        }
        .header-texts { flex: 1; min-width: 0; }
        .header-title {
            font-size: 15px; font-weight: 700; line-height: 1.2; color: var(--text);
            white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
        }
        .header-sub { font-size: 11px; color: var(--text-secondary); margin-top: 1px; }

        .child-switcher {
            display: inline-flex; align-items: center; gap: 6px;
            background: var(--primary-light);
            border: 1px solid rgba(139,90,159,.18);
            padding: 7px 12px; border-radius: 999px;
            font-size: 12px; font-weight: 600; color: var(--primary);
            cursor: pointer; transition: background .15s;
            max-width: 180px; min-width: 0;
        }
        .child-switcher.static { cursor: default; }
        .child-switcher:active:not(.static) { background: rgba(139,90,159,.18); }
        #child-switcher-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex: 1; }
        .child-switcher-arrow { opacity: .6; font-size: 9px; flex-shrink: 0; }

        /* ═══ BOTTOM SHEET ══════════════════════════════════════════════════════ */
        .sheet-backdrop {
            position: fixed; inset: 0; background: rgba(0,0,0,.5);
            opacity: 0; pointer-events: none; z-index: 998;
            transition: opacity .25s;
        }
        .sheet-backdrop.open { opacity: 1; pointer-events: auto; }
        .sheet {
            position: fixed; left: 0; right: 0; bottom: 0;
            background: var(--card); border-radius: 24px 24px 0 0;
            padding: 8px 16px calc(20px + var(--safe-bottom));
            box-shadow: 0 -8px 40px rgba(45,27,61,.2); z-index: 999;
            transform: translateY(100%); transition: transform .3s cubic-bezier(.4,0,.2,1);
            max-height: 70vh; overflow-y: auto;
        }
        .sheet-handle {
            width: 36px; height: 4px; background: var(--border);
            border-radius: 999px; margin: 8px auto 16px;
        }
        .sheet.open { transform: translateY(0); }
        .sheet-title { font-size: 13px; font-weight: 600; margin-bottom: 10px;
            color: var(--text-secondary); text-transform: uppercase; letter-spacing: .5px; }

        /* ═══ MONTH DETAIL SHEET ══════════════════════════════════════════════ */
        .mds-header {
            display: flex; align-items: center; gap: 12px; margin-bottom: 18px;
        }
        .mds-icon {
            width: 40px; height: 40px; border-radius: 12px; flex-shrink: 0;
            background: linear-gradient(135deg,#06b6d4,#0891b2);
            display: flex; align-items: center; justify-content: center;
            color: #fff; font-size: 16px;
            box-shadow: 0 3px 10px rgba(6,182,212,.3);
        }
        .mds-title { font-size: 17px; font-weight: 700; color: var(--text); line-height: 1.2; }
        .mds-sub { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
        .mds-totals {
            display: flex; gap: 8px; margin-bottom: 18px;
        }
        .mds-total-pill {
            flex: 1; padding: 10px 8px; border-radius: 12px;
            display: flex; flex-direction: column; align-items: center; gap: 3px;
        }
        .mds-total-pill.ok  { background: rgba(22,163,74,.1); }
        .mds-total-pill.mis { background: rgba(239,68,68,.08); }
        .mds-total-pill.pln { background: rgba(100,116,139,.1); }
        .mds-total-val { font-size: 20px; font-weight: 800; line-height: 1; }
        .mds-total-pill.ok  .mds-total-val { color: #16a34a; }
        .mds-total-pill.mis .mds-total-val { color: #ef4444; }
        .mds-total-pill.pln .mds-total-val { color: #64748b; }
        .mds-total-label { font-size: 11px; font-weight: 500; color: var(--text-secondary); text-align: center; }
        .mds-section-title {
            font-size: 11px; font-weight: 700; color: var(--text-secondary);
            text-transform: uppercase; letter-spacing: .6px; margin-bottom: 10px;
        }
        .mds-dir-row {
            display: flex; align-items: center; gap: 10px;
            padding: 12px 14px; background: var(--bg); border-radius: 12px;
            margin-bottom: 8px;
        }
        .mds-dir-name { flex: 1; font-size: 14px; font-weight: 500; color: var(--text); min-width: 0; }
        .mds-chips { display: flex; gap: 5px; flex-shrink: 0; }

        .month-col-clickable { cursor: pointer; }
        .month-col-clickable:active .month-bar-stack { opacity: .7; }
        .month-col-active .month-label { color: var(--primary); font-weight: 700; }

        .sheet-item {
            display: flex; align-items: center; gap: 12px; padding: 12px;
            border-radius: var(--radius-sm); cursor: pointer; transition: background .1s;
        }
        .sheet-item:active { background: var(--primary-light); }
        .sheet-item.active { background: var(--primary-light); }
        .sheet-item .si-avatar {
            width: 40px; height: 40px; border-radius: 50%;
            background: linear-gradient(135deg, var(--primary), var(--primary-2));
            color: #fff; display: flex; align-items: center; justify-content: center;
            font-weight: 700; font-size: 16px; flex-shrink: 0;
        }
        .sheet-item .si-name { font-size: 15px; font-weight: 600; }
        .sheet-item .si-sub { font-size: 12px; color: var(--text-secondary); }

        /* ═══ BOTTOM TABS ══════════════════════════════════════════════════════ */
        .tabs-wrap {
            position: fixed; bottom: 0; left: 0; right: 0;
            background: rgba(255,255,255,.96); backdrop-filter: blur(16px) saturate(1.5);
            border-top: 1px solid var(--border);
            padding-bottom: var(--safe-bottom); z-index: 100;
            display: flex;
        }
        .tab-btn {
            flex: 1; display: flex; flex-direction: column; align-items: center;
            gap: 3px; padding: 9px 4px 7px; cursor: pointer; border: none;
            background: none; color: var(--text-secondary); font-size: 9.5px;
            font-family: inherit; transition: color .15s; position: relative;
        }
        .tab-btn::before {
            content: ''; position: absolute; top: 0; left: 50%; transform: translateX(-50%);
            width: 0; height: 3px; background: var(--primary);
            border-radius: 0 0 3px 3px; transition: width .2s;
        }
        .tab-btn.active { color: var(--primary); font-weight: 600; }
        .tab-btn.active::before { width: 24px; }
        .tab-icon { font-size: 20px; line-height: 1; display: block; }

        /* Пока открыта клавиатура во вкладке "Помощник" — прячем нижний таб-бар,
           иначе (position:fixed) он "отрывается" и всплывает между инпутом и
           клавиатурой вместо того, чтобы оставаться внизу экрана. Заодно убираем
           нижний отступ body, зарезервированный под таб-бар. */
        body.chat-kb-open { padding-bottom: 0; }
        body.chat-kb-open .tabs-wrap { display: none; }
        /* .chat-wrap: резерв 150px был подобран под ВИДИМЫЙ хедер + таб-бар. При
           открытой клавиатуре таб-бара на экране нет — уменьшаем резерв примерно
           до высоты одного хедера, чтобы инпут дотягивался почти до клавиатуры,
           а не оставлял пустой зазор. Высота всё так же считается от 100dvh —
           этот юнит браузер сам обновляет при появлении клавиатуры. */
        body.chat-kb-open .chat-wrap {
            height: calc(100dvh - var(--safe-top) - 78px);
        }

        /* ═══ CARDS ════════════════════════════════════════════════════════════ */
        .card {
            background: var(--card); border-radius: var(--radius);
            box-shadow: var(--shadow-card); padding: 16px; margin-bottom: 12px;
            border: 1px solid rgba(139,90,159,.06);
        }
        .card-title {
            font-size: 11px; font-weight: 700; color: var(--text-secondary);
            text-transform: uppercase; letter-spacing: .7px; margin-bottom: 12px;
            display: flex; align-items: center; gap: 6px;
        }
        .card-title::before {
            content: ''; display: block; width: 3px; height: 14px;
            background: linear-gradient(var(--primary), var(--primary-2));
            border-radius: 99px;
        }

        /* ── Tariffs ── */
        .tariff-section { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow-card); border: 1px solid rgba(139,90,159,.06); overflow: hidden; }
        .tariff-item {
            display: flex; flex-direction: column; gap: 6px;
            padding: 14px 16px; border-bottom: 1px solid var(--border); font-size: 14px;
        }
        .tariff-item:last-child { border-bottom: none; }
        .tariff-item-row { display: flex; justify-content: space-between; align-items: center; }
        .tariff-name { color: var(--text); font-weight: 600; font-size: 14px; flex: 1; padding-right: 8px; }
        .tariff-bal {
            font-weight: 700; font-size: 13px; color: var(--primary);
            background: rgba(139,90,159,.08); padding: 3px 9px; border-radius: 99px; white-space: nowrap;
        }
        .tariff-bal.low { color: var(--danger); background: rgba(239,68,68,.08); }
        .tariff-right { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
        .tariff-lessons {
            font-size: 11px; font-weight: 700; color: var(--success);
            background: rgba(22,163,74,.1); padding: 3px 8px; border-radius: 99px;
            white-space: nowrap;
        }
        .tariff-dates { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-muted); flex-wrap: wrap; }
        .tariff-dates i { font-size: 11px; color: var(--text-muted); margin-right: 2px; }
        .tariff-date-sep { color: var(--border); }
        .tariff-expire { color: var(--text-muted); }
        .tariff-expire i { color: var(--text-muted); }
        .tariff-expire.soon { color: #f59e0b; font-weight: 600; }
        .tariff-expire.soon i { color: #f59e0b; }
        .tariff-expire.urgent { color: var(--danger); font-weight: 600; }
        .tariff-expire.urgent i { color: var(--danger); }

        /* ── Attendance Stats ── */
        .attend-card {
            background: var(--card); border-radius: var(--radius);
            box-shadow: var(--shadow-card); border: 1px solid rgba(139,90,159,.06);
            overflow: hidden;
        }
        .attend-row {
            padding: 12px 16px; border-bottom: 1px solid var(--border);
        }
        .attend-row:last-child { border-bottom: none; }
        .attend-row-top {
            display: flex; justify-content: space-between; align-items: center; margin-bottom: 7px;
        }
        .attend-name { font-size: 13px; font-weight: 600; color: var(--text); flex: 1; padding-right: 8px; }
        .attend-chips { display: flex; gap: 5px; flex-shrink: 0; }
        .attend-chip {
            font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 99px;
        }
        .attend-chip.ok  { background: rgba(22,163,74,.12); color: #16a34a; }
        .attend-chip.mis { background: rgba(239,68,68,.1);  color: #ef4444; }
        .attend-chip.pln { background: rgba(100,116,139,.12); color: #64748b; }
        .attend-row-foot { font-size: 11px; color: var(--text-muted); margin-top: 5px; }
        .attend-bar-wrap {
            height: 6px; border-radius: 99px; background: #f0edf5; overflow: hidden;
        }
        .attend-bar-fill {
            height: 100%; border-radius: 99px;
            background: linear-gradient(90deg, var(--primary-2), var(--primary));
            transition: width .4s ease;
        }
        .attend-bar-fill.low { background: linear-gradient(90deg, #f59e0b, #ef4444); }

        /* ── Monthly chart ── */
        .month-chart {
            background: var(--card); border-radius: var(--radius);
            box-shadow: var(--shadow-card); border: 1px solid rgba(139,90,159,.06);
            padding: 16px;
        }
        .month-chart-head {
            display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px;
        }
        .month-chart-pct { font-size: 17px; font-weight: 800; color: var(--primary); }
        .month-chart-scroll-wrap {
            position: relative;
        }
        .month-chart-scroll-wrap::after {
            content: '';
            position: absolute; right: 0; top: 0; bottom: 0; width: 32px;
            background: linear-gradient(to right, transparent, var(--card));
            pointer-events: none; border-radius: 0 4px 4px 0;
        }
        .month-chart-scroll-wrap.at-end::after { display: none; }
        .month-chart-bars {
            display: flex; align-items: flex-end; gap: 10px; height: 90px;
            overflow-x: auto; -webkit-overflow-scrolling: touch;
            scrollbar-width: none; scroll-behavior: smooth;
            padding-bottom: 2px;
        }
        .month-chart-bars::-webkit-scrollbar { display: none; }
        .month-col { flex-shrink: 0; width: 44px; display: flex; flex-direction: column; align-items: center; height: 100%; }
        .month-bar-stack {
            flex: 1; width: 20px; display: flex; flex-direction: column;
            justify-content: flex-end; gap: 2px; min-height: 0;
        }
        .month-bar { width: 100%; border-radius: 4px; min-height: 3px; transition: height .4s ease; }
        .month-bar.ok  { background: linear-gradient(180deg, var(--primary), var(--primary-mid)); }
        .month-bar.mis { background: rgba(220,38,38,.6); }
        .month-bar.pln { background: #cbd5e1; }
        .month-label { font-size: 11px; color: var(--text-secondary); font-weight: 600; margin-top: 7px; }
        .month-nums { display: flex; align-items: baseline; justify-content: center; gap: 2px; margin-top: 4px; font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
        .month-nums .mn-ok  { color: var(--primary); }
        .month-nums .mn-mis { color: var(--danger); }
        .month-nums .mn-pln { color: #94a3b8; }
        .month-nums .mn-sep { color: var(--border); }
        .month-chart-foot { text-align: center; font-size: 11px; color: var(--text-muted); margin-top: 8px; }
        .month-legend {
            display: flex; gap: 14px; font-size: 12px; color: var(--text-secondary);
        }
        .month-legend-dot {
            width: 9px; height: 9px; border-radius: 3px; display: inline-block; margin-right: 5px;
        }

        /* ── Current month summary (дашборд) ── */
        .cm-card {
            background: var(--card); border-radius: var(--radius);
            box-shadow: var(--shadow-card); border: 1px solid rgba(139,90,159,.06);
            padding: 16px; display: flex; align-items: center; gap: 18px;
        }
        .cm-pct-wrap { text-align: center; flex-shrink: 0; }
        .cm-pct { font-size: 34px; font-weight: 800; color: var(--primary); line-height: 1; }
        .cm-pct-sub { font-size: 11px; color: var(--text-secondary); margin-top: 4px; }
        .cm-divider-v { width: 1px; align-self: stretch; background: var(--border); }
        .cm-counts { flex: 1; display: flex; flex-direction: column; gap: 10px; }
        .cm-count-row { display: flex; align-items: center; justify-content: space-between; }
        .cm-count-row .cc-label { color: var(--text-secondary); font-size: 13px; display: flex; align-items: center; gap: 8px; }
        .cm-count-row .cc-val { font-weight: 800; font-size: 16px; color: var(--text); }
        .cc-dot { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }
        .cm-empty { padding: 6px 2px; font-size: 14px; color: var(--text-secondary); display: flex; align-items: center; gap: 9px; }

        /* ── Grouped menu list (вкладка «Ещё») ── */
        .menu-list {
            background: var(--card); border-radius: var(--radius);
            box-shadow: var(--shadow-card); border: 1px solid rgba(139,90,159,.06);
            overflow: hidden;
        }
        .menu-row {
            display: flex; align-items: center; gap: 13px; width: 100%;
            padding: 13px 15px; border: none; border-bottom: 1px solid var(--border);
            background: none; font-family: inherit; font-size: 15px; color: var(--text);
            text-align: left; cursor: pointer;
        }
        .menu-row:last-child { border-bottom: none; }
        .menu-row:active { background: var(--primary-light); }
        .mr-icon {
            width: 30px; height: 30px; border-radius: 8px; flex-shrink: 0;
            display: flex; align-items: center; justify-content: center;
            font-size: 13px; color: #fff;
        }
        .mr-label { flex: 1; font-weight: 500; }
        .mr-chevron { color: var(--text-muted); font-size: 13px; flex-shrink: 0; }

        .stat-subtitle {
            font-size: 12px; font-weight: 700; color: var(--text-secondary);
            text-transform: uppercase; letter-spacing: .5px; margin: 18px 0 10px;
        }
        .stat-subtitle:first-child { margin-top: 2px; }

        /* ── Recommendations ── */
        .rec-card {
            background: linear-gradient(135deg, #f9f5ff 0%, #eff6ff 100%);
            border-radius: var(--radius); padding: 16px;
            border: 1px solid rgba(139,90,159,.12);
            box-shadow: var(--shadow-card);
        }
        .rec-text {
            font-size: 14px; line-height: 1.65; color: var(--text);
            white-space: pre-wrap;
        }
        .rec-meta { font-size: 12px; color: var(--text-muted); margin-top: 8px; }
        .rec-expand-btn {
            font-size: 12px; color: var(--primary); background: none; border: none;
            cursor: pointer; padding: 4px 0; font-weight: 600;
        }

        /* ── Schedule ── */
        .month-pills { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px;
            margin-bottom: 14px; scrollbar-width: none; }
        .month-pills::-webkit-scrollbar { display: none; }
        .month-pill {
            flex-shrink: 0; padding: 7px 16px; border-radius: 999px;
            font-size: 13px; font-weight: 500; cursor: pointer; border: none;
            background: var(--card); color: var(--text-secondary);
            box-shadow: 0 1px 3px rgba(0,0,0,.08);
            transition: all .15s;
        }
        .month-pill.active {
            background: linear-gradient(135deg, var(--primary), var(--primary-2));
            color: #fff; box-shadow: 0 2px 8px rgba(139,90,159,.4);
        }
        .lesson-group { margin-bottom: 16px; }
        .lesson-date-label {
            font-size: 11px; font-weight: 700; color: var(--text-secondary);
            text-transform: uppercase; letter-spacing: .7px; margin-bottom: 8px;
            padding: 0 2px;
        }
        .lesson-item {
            display: flex; gap: 14px; align-items: flex-start;
            padding: 14px; background: var(--card);
            border-radius: var(--radius); margin-bottom: 10px;
            box-shadow: var(--shadow-card);
            border: 1px solid rgba(139,90,159,.07);
            position: relative; overflow: hidden;
        }
        .lesson-item::before {
            content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
            background: linear-gradient(var(--primary), var(--primary-2));
        }
        .lesson-item.cancelled::before { background: var(--danger); }
        .lesson-item.cancelled { opacity: .65; }
        .lesson-item.paid::before { background: linear-gradient(#22c55e, #16a34a); }
        .lesson-item.unpaid::before { background: #94a3b8; }
        .lesson-item.debt::before { background: linear-gradient(#ef4444, #dc2626); }
        .lesson-time-col { flex-shrink: 0; padding-left: 4px; }
        .lesson-time {
            display: inline-block; font-size: 14px; font-weight: 800; color: #fff;
            background: linear-gradient(135deg, var(--primary), var(--primary-2));
            padding: 6px 10px; border-radius: 10px; letter-spacing: .3px;
            font-variant-numeric: tabular-nums;
            box-shadow: 0 2px 8px rgba(139,90,159,.3);
        }
        .lesson-item.cancelled .lesson-time {
            background: var(--danger); box-shadow: 0 2px 8px rgba(239,68,68,.3);
        }
        .lesson-item.paid .lesson-time {
            background: linear-gradient(135deg, #22c55e, #16a34a);
            box-shadow: 0 2px 8px rgba(22,163,74,.28);
        }
        .lesson-item.unpaid .lesson-time {
            background: #94a3b8;
            box-shadow: 0 2px 8px rgba(100,116,139,.28);
        }
        .lesson-item.debt .lesson-time {
            background: linear-gradient(135deg, #ef4444, #dc2626);
            box-shadow: 0 2px 8px rgba(220,38,38,.28);
        }
        .pay-badge {
            display: inline-block; border-radius: 6px; padding: 2px 7px;
            font-size: 10px; font-weight: 700; margin-left: 6px;
            vertical-align: middle; letter-spacing: .1px; white-space: nowrap;
        }
        .pay-badge--paid { background: #dcfce7; color: #15803d; }
        .pay-badge--unpaid { background: #f1f5f9; color: #475569; }
        .pay-badge--debt { background: #fee2e2; color: #b91c1c; }
        .pay-badge--on-dark.pay-badge--paid { background: rgba(187,247,208,.95); color: #166534; }
        .pay-badge--on-dark.pay-badge--unpaid { background: rgba(241,245,249,.95); color: #334155; }
        .pay-badge--on-dark.pay-badge--debt { background: rgba(254,202,202,.95); color: #991b1b; }
        .sched-pay-legend {
            display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center;
            font-size: 12px; color: var(--text-secondary);
            margin: 0 2px 12px; font-weight: 600;
        }
        .sched-pay-dot {
            display: inline-block; width: 8px; height: 8px; border-radius: 50%;
            margin-right: 6px; vertical-align: 0;
        }
        .sched-pay-dot--paid { background: #16a34a; }
        .sched-pay-dot--unpaid { background: #94a3b8; }
        .sched-pay-dot--debt { background: #dc2626; }
        .lesson-info { flex: 1; min-width: 0; padding-top: 1px; }
        .lesson-subject { font-size: 14.5px; font-weight: 700; margin-bottom: 6px; line-height: 1.3; color: var(--text); }
        .lesson-meta {
            font-size: 12.5px; color: var(--text-secondary); line-height: 1.5;
            display: flex; align-items: center; gap: 6px;
        }
        .lesson-meta-icon { width: 14px; text-align: center; color: var(--primary); opacity: .7; font-size: 11px; }
        .lesson-route {
            font-size: 12px; color: var(--primary); margin-top: 8px;
            text-decoration: none; display: inline-flex; align-items: center; gap: 5px; font-weight: 600;
            background: var(--primary-light); padding: 6px 12px; border-radius: 999px;
            border: 1px solid rgba(139,90,159,.18);
        }
        .lesson-route:active { background: rgba(139,90,159,.18); }

        /* ── Homework ── */
        .hw-item {
            padding: 14px 16px; background: var(--card); border-radius: var(--radius);
            box-shadow: var(--shadow-card); margin-bottom: 10px;
            border-left: 3px solid var(--warning);
            border: 1px solid var(--warning-light); border-left: 3px solid var(--warning);
        }
        .hw-subject {
            font-size: 11px; font-weight: 700; color: var(--warning);
            text-transform: uppercase; letter-spacing: .5px; margin-bottom: 6px;
        }
        .hw-text { font-size: 14px; line-height: 1.55; margin-bottom: 8px; color: var(--text); }
        .hw-meta { font-size: 12px; color: var(--text-secondary); }
        .hw-file-link {
            display: inline-flex; align-items: center; gap: 5px;
            margin-top: 8px; font-size: 13px; font-weight: 500; color: var(--primary);
            text-decoration: none; background: var(--primary-light);
            padding: 6px 12px; border-radius: 999px;
        }
        .load-more-btn {
            width: 100%; padding: 12px; background: var(--card);
            color: var(--primary); border: 1.5px solid var(--primary-border);
            border-radius: var(--radius); font-size: 14px; font-weight: 600;
            cursor: pointer; font-family: inherit; transition: background .15s;
        }
        .load-more-btn:active { background: var(--primary-light); }

        /* ── Conclusions ── */
        .file-item {
            display: flex; align-items: center; gap: 14px; padding: 14px 16px;
            background: var(--card); border-radius: var(--radius);
            box-shadow: var(--shadow-card); margin-bottom: 8px;
            text-decoration: none; color: var(--text);
            border: 1px solid rgba(139,90,159,.06);
            transition: background .15s;
        }
        .file-item:active { background: var(--primary-light); }
        .file-icon-wrap {
            width: 44px; height: 44px; border-radius: 12px; flex-shrink: 0;
            background: linear-gradient(135deg, var(--primary), var(--primary-2));
            display: flex; align-items: center; justify-content: center;
            font-size: 22px;
        }
        .file-name { font-size: 14px; font-weight: 600; margin-bottom: 2px; }
        button.file-item {
            width: 100%; text-align: left; font-family: inherit; cursor: pointer;
            background: var(--card, #fff);
        }
        .parent-video-player {
            width: 100%; max-height: 70vh; background: #111;
            /* Без скругления и transform: на iPhone кадр становится чёрным. */
            border-radius: 0; transform: none; -webkit-transform: none;
            margin: 0 0 8px; display: block;
        }
        .parent-video-caption {
            font-size: 13px; font-weight: 600; margin: 0 0 12px; color: var(--text);
        }
        .file-meta { font-size: 12px; color: var(--text-secondary); }

        /* ── Assistant ── */
        .chat-wrap {
            display: flex; flex-direction: column;
            height: calc(100dvh - var(--safe-top) - var(--safe-bottom) - 150px);
            min-height: 300px;
        }
        .chat-messages {
            flex: 1; min-height: 0; overflow-y: auto; padding: 4px 0 8px;
            display: flex; flex-direction: column;
        }
        /* spacer толкает сообщения к низу, когда их мало */
        .chat-messages::before { content: ''; flex: 1; }
        .msg { margin-bottom: 10px; }
        .msg-bubble {
            max-width: 85%; padding: 10px 14px; border-radius: 18px;
            font-size: 14px; line-height: 1.55;
        }
        .msg.user { display: flex; justify-content: flex-end; }
        .msg.user .msg-bubble {
            background: linear-gradient(135deg, var(--primary), var(--primary-2));
            color: #fff; border-bottom-right-radius: 5px;
        }
        .msg.bot .msg-bubble {
            background: var(--card); box-shadow: var(--shadow-card);
            border-bottom-left-radius: 5px; color: var(--text);
        }
        .chat-input-row { display: flex; gap: 8px; padding-top: 10px; }
        .chat-input {
            flex: 1; padding: 12px 16px; border: 1.5px solid var(--border);
            border-radius: 999px; font-size: 14px; font-family: inherit;
            background: var(--card); outline: none; transition: border-color .15s;
        }
        .chat-input:focus { border-color: var(--primary); }
        .chat-send-btn {
            width: 44px; height: 44px; border-radius: 50%; border: none;
            background: linear-gradient(135deg, var(--primary), var(--primary-2));
            color: #fff; font-size: 18px; cursor: pointer;
            display: flex; align-items: center; justify-content: center;
            flex-shrink: 0; box-shadow: 0 2px 8px rgba(139,90,159,.4);
        }
        .chat-send-btn:disabled { opacity: .5; box-shadow: none; }

        /* ── Actions ── */
        .actions-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
        .action-btn {
            display: flex; flex-direction: column; align-items: center; gap: 8px;
            padding: 18px 8px; background: var(--card);
            border: 1px solid rgba(139,90,159,.08);
            border-radius: var(--radius); cursor: pointer; font-family: inherit;
            font-size: 13px; font-weight: 500; color: var(--text);
            box-shadow: var(--shadow-card); transition: all .15s;
        }
        .action-btn:active { background: var(--primary-light); border-color: var(--primary-border); transform: scale(.97); }
        .action-btn .ab-icon {
            font-size: 28px;
            background: var(--primary-light); border-radius: 12px;
            width: 48px; height: 48px; display: flex; align-items: center; justify-content: center;
        }

        /* ── Banners ── */
        .banner {
            display: flex; align-items: flex-start; gap: 12px;
            padding: 12px 14px; border-radius: var(--radius);
            margin-bottom: 12px; font-size: 13px; line-height: 1.4;
        }
        .banner.push-banner { background: var(--primary-light); color: var(--primary-mid); border: 1px solid var(--primary-border); }
        .banner.install-banner { background: var(--success-light); color: #166534; border: 1px solid #bbf7d0; }
        .banner-icon { font-size: 22px; flex-shrink: 0; margin-top: 1px; }
        .banner-text { flex: 1; }
        .banner-btn {
            margin-top: 8px; padding: 7px 14px; border-radius: 999px; border: none;
            font-family: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
        }
        .banner.push-banner .banner-btn { background: var(--primary); color: #fff; }
        .banner.install-banner .banner-btn { background: var(--success); color: #fff; }
        .banner-close {
            background: none; border: none; font-size: 18px; cursor: pointer;
            color: inherit; opacity: .4; align-self: flex-start; padding: 2px;
        }

        /* ═══ LOGIN ════════════════════════════════════════════════════════════ */
        /* Раньше центрировалось через justify-content:center на min-height:100vh —
           при открытии клавиатуры видимая область сжимается, браузер одновременно
           (1) пересчитывает вертикальное центрирование под новую высоту и
           (2) сам скроллит страницу, чтобы показать сфокусированное поле — из-за
           этого карточка входа заметно "прыгала". Убираем зависимость положения
           карточки от высоты вьюпорта: закрепляем у верха экрана с отступом —
           тогда при появлении клавиатуры ничего не пересчитывается и не скроллит. */
        .login-screen {
            min-height: 100dvh; display: flex; flex-direction: column;
            align-items: center; justify-content: flex-start;
            background: linear-gradient(160deg, #8B5A9F 0%, #2D1B3D 100%);
            padding: max(48px, 9vh) 20px 24px;
            position: relative; overflow: hidden;
        }
        .login-screen::before {
            content: '';
            position: absolute; width: 350px; height: 350px;
            background: rgba(255,255,255,.05); border-radius: 50%;
            top: -100px; right: -80px;
        }
        .login-screen::after {
            content: '';
            position: absolute; width: 250px; height: 250px;
            background: rgba(255,255,255,.04); border-radius: 50%;
            bottom: -60px; left: -60px;
        }
        .login-brand { text-align: center; margin-bottom: 28px; position: relative; z-index: 1; }
        .login-logo {
            width: 76px; height: 76px; border-radius: 20px; margin-bottom: 14px;
            border: 2px solid rgba(255,255,255,.2);
            box-shadow: 0 8px 32px rgba(0,0,0,.3);
        }
        .login-title { font-size: 20px; font-weight: 700; color: #fff; margin-bottom: 4px; }
        .login-sub { font-size: 13px; color: rgba(255,255,255,.65); }
        .login-card {
            width: 100%; max-width: 380px; background: #fff;
            border-radius: 24px; padding: 28px 24px;
            box-shadow: 0 20px 60px rgba(0,0,0,.3);
            position: relative; z-index: 1;
        }
        .login-card-title { font-size: 17px; font-weight: 700; color: var(--text); margin-bottom: 20px; }
        .field-label { font-size: 12px; font-weight: 700; color: var(--text-secondary); margin-bottom: 6px; text-transform: uppercase; letter-spacing: .4px; }
        .field-input {
            width: 100%; padding: 13px 16px; border: 1.5px solid var(--border);
            border-radius: 12px; font-size: 15px; font-family: inherit; outline: none;
            transition: border-color .15s, box-shadow .15s; background: #fafafa; color: var(--text);
        }
        .field-input:focus { border-color: var(--primary); background: #fff; box-shadow: 0 0 0 3px rgba(139,90,159,.12); }
        .field-hint { font-size: 12px; color: var(--text-secondary); margin-top: 5px; }
        .primary-btn {
            width: 100%; padding: 15px;
            background: linear-gradient(135deg, var(--primary) 0%, var(--primary-2) 100%);
            color: #fff; border: none; border-radius: 12px; font-size: 15px;
            font-weight: 700; font-family: inherit; cursor: pointer; margin-top: 20px;
            transition: opacity .15s, transform .1s;
            box-shadow: 0 4px 16px rgba(139,90,159,.4);
        }
        .primary-btn:active { transform: scale(.98); }
        .primary-btn:disabled { opacity: .5; box-shadow: none; transform: none; }
        .back-link {
            display: block; text-align: center; margin-top: 14px; font-size: 14px;
            color: var(--primary); cursor: pointer; background: none; border: none; font-family: inherit;
        }
        .error-msg { color: var(--danger); font-size: 13px; margin-top: 8px; text-align: center; }
        .field-label--spaced { margin-top: 16px; }
        .password-wrap { position: relative; }
        .field-input--pwd-toggle { padding-right: 48px; }
        .pwd-toggle-btn {
            position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
            background: none; border: none; cursor: pointer; font-size: 19px;
            opacity: .4; line-height: 1;
        }
        .forgot-wrap { text-align: center; margin-top: 16px; }
        .link-btn {
            background: none; border: none; cursor: pointer; font-family: inherit;
        }
        /* Раньше был белый текст (задумывался для фиолетового фона), но
           используется внутри белой .login-card — был невидим (белое на
           белом), из-за чего ссылка "Забыли пароль?" казалась отсутствующей. */
        .link-btn--light {
            color: var(--primary); font-size: 13px; font-weight: 600;
            padding: 4px 8px; border-radius: 6px;
        }
        .link-btn--back {
            color: var(--text-secondary); font-size: 13px;
            margin-bottom: 12px; padding: 0;
            display: flex; align-items: center; gap: 4px;
        }
        .link-btn--back i { font-size: 11px; }
        .reset-hint {
            font-size: 13px; color: var(--text-secondary);
            margin-bottom: 16px; line-height: 1.5;
        }
        .primary-btn--spaced { margin-top: 16px; }
        .reset-success-box {
            background: #d1fae5; border: 1px solid #6ee7b7;
            border-radius: 10px; padding: 12px 14px; margin-top: 12px;
            font-size: 13px; color: #065f46;
            display: flex; align-items: flex-start; gap: 8px;
        }
        .reset-success-box i { margin-top: 1px; color: #059669; }
        .banner-wrap--flush { padding-bottom: 0; }

        /* ═══ UTILITIES ════════════════════════════════════════════════════════ */
        .hidden { display: none !important; }
        .content { padding: 14px 16px; }
        .empty-state {
            text-align: center; padding: 48px 24px;
            color: var(--text-secondary); font-size: 15px;
        }
        .empty-icon { font-size: 52px; margin-bottom: 12px; opacity: .6; }
        .empty-state p { line-height: 1.5; }
        .spinner {
            width: 36px; height: 36px; border: 3px solid var(--border);
            border-top-color: var(--primary); border-radius: 50%;
            animation: spin .65s linear infinite; margin: 40px auto;
        }
        @keyframes spin { to { transform: rotate(360deg); } }
        .loading-wrap { display: flex; justify-content: center; padding: 32px; }
        /* Пока #login-screen/#app скрыты — не оставлять «дыру» в #2D1B3D/чёрный */
        #global-loading:not(.hidden) {
            position: fixed;
            inset: 0;
            z-index: 200;
            display: flex;
            align-items: center;
            justify-content: center;
            background: linear-gradient(160deg, #8B5A9F 0%, #2D1B3D 100%);
            padding: 0;
        }
        #global-loading:not(.hidden) .spinner {
            border-color: rgba(255,255,255,.25);
            border-top-color: #fff;
            margin: 0;
        }

        .section-label {
            font-size: 11px; font-weight: 700; color: var(--text-secondary);
            text-transform: uppercase; letter-spacing: .7px;
            margin: 16px 0 8px; padding: 0 2px;
        }

        /* ═══ ICON BADGE (фирменный элемент) ══════════════════════════════════ */
        .icon-badge {
            width: 42px; height: 42px; border-radius: 12px; flex-shrink: 0;
            background: linear-gradient(135deg, var(--primary) 0%, var(--primary-2) 100%);
            display: inline-flex; align-items: center; justify-content: center;
            box-shadow: 0 4px 12px rgba(139,90,159,.35);
            color: #fff; font-size: 17px;
        }
        .icon-badge.sm {
            width: 32px; height: 32px; border-radius: 9px; font-size: 13px;
            box-shadow: 0 2px 8px rgba(139,90,159,.3);
        }
        .icon-badge.warning {
            background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
            box-shadow: 0 4px 12px rgba(245,158,11,.3);
        }
        .icon-badge.success {
            background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
            box-shadow: 0 4px 12px rgba(34,197,94,.3);
        }
        .icon-badge.danger {
            background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
            box-shadow: 0 4px 12px rgba(239,68,68,.3);
        }
        .icon-badge.info {
            background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
            box-shadow: 0 4px 12px rgba(6,182,212,.3);
        }
        .icon-badge.blue {
            background: linear-gradient(135deg, #4299e1 0%, #3182ce 100%);
            box-shadow: 0 4px 12px rgba(66,153,225,.3);
        }

        /* ═══ SECTION HEADER (заголовок с бейджем) ════════════════════════════ */
        .sec-header {
            display: flex; align-items: center; gap: 10px;
            margin: 20px 0 12px;
        }
        /* первый заголовок секции сразу после начала контента — без верхнего отступа */
        .tab-panel > .sec-header:first-child,
        .tab-panel > div > .sec-header:first-child { margin-top: 4px; }
        .sec-header-texts { flex: 1; }
        .sec-header-title {
            font-size: 15px; font-weight: 700; color: var(--text); line-height: 1.2;
        }
        .sec-header-sub { font-size: 12px; color: var(--text-secondary); margin-top: 1px; }

        /* ═══ HERO CARD (главная карточка дашборда) ════════════════════════════ */
        .hero-card {
            background: linear-gradient(135deg, #8B5A9F 0%, #5E3A75 35%, #2D1B3D 70%, #5E3A75 100%);
            background-size: 220% 220%;
            animation: heroGradient 14s ease infinite;
            border-radius: 20px; padding: 22px;
            color: #fff; position: relative; overflow: hidden;
            box-shadow: 0 6px 20px rgba(45,27,61,.22);
            margin-bottom: 20px;
        }
        @keyframes heroGradient {
            0%   { background-position: 0% 50%; }
            50%  { background-position: 100% 50%; }
            100% { background-position: 0% 50%; }
        }
        @media (prefers-reduced-motion: reduce) {
            .hero-card { animation: none; }
        }
        .hero-card .particle {
            position: absolute; border-radius: 50%;
            background: radial-gradient(circle at 35% 35%, rgba(255,255,255,.45), rgba(255,255,255,.1));
            animation: floatUp 6s ease-in-out infinite;
            pointer-events: none;
        }
        @keyframes floatUp {
            0%,100% { transform: translateY(0) scale(1); opacity: .35; }
            50% { transform: translateY(-26px) scale(1.15); opacity: .6; }
        }
        @keyframes floatWave {
            0%,100% { transform: translate(0,0) scale(1); opacity: .3; }
            33% { transform: translate(14px,-18px) scale(1.1); opacity: .55; }
            66% { transform: translate(-10px,-26px) scale(.95); opacity: .4; }
        }
        @keyframes floatPulse {
            0%,100% { transform: scale(1); opacity: .25; }
            50% { transform: scale(1.6); opacity: .5; }
        }
        .hero-card-label {
            font-size: 11px; font-weight: 600; opacity: .7;
            text-transform: uppercase; letter-spacing: .6px; margin-bottom: 6px;
            position: relative;
        }
        .hero-card-time {
            font-size: 36px; font-weight: 800; line-height: 1;
            margin-bottom: 4px; position: relative; letter-spacing: -1px;
        }
        .hero-card-subject {
            font-size: 16px; font-weight: 600; margin-bottom: 4px; position: relative;
        }
        .hero-card-meta { font-size: 13px; opacity: .75; position: relative; }
        .hero-card-empty {
            text-align: center; padding: 8px 0 4px; position: relative;
        }
        .hero-card-empty-icon { font-size: 28px; margin-bottom: 6px; opacity: .6; }
        .hero-card-empty-text { font-size: 14px; opacity: .8; }
        .hero-card-icon {
            position: absolute; right: 18px; top: 18px; opacity: .25; font-size: 36px;
        }
        /* Декоративное свечение на фоне hero-карточки (главная) — мягкие "боке"-круги,
           в тон вкладке "Расписание". Искры — только мягкий блик (box-shadow), без
           текстовых символов звёзд (раньше ✦★✧ смотрелись как случайные "звёздочки"
           кучкой в одном месте — не давали нужного эффекта). Все искры лежат в пустых
           зонах верхнего/нижнего паддинга карточки (22px), поэтому не задевают текст
           независимо от ширины экрана. */
        .hero-deco { position: absolute; pointer-events: none; }
        .hero-deco--circle-lg { top: -36px; right: 60px; width: 140px; height: 140px; border-radius: 50%; background: rgba(255,255,255,.07); }
        .hero-deco--circle-md { bottom: -36px; right: 0; width: 100px; height: 100px; border-radius: 50%; background: rgba(255,255,255,.06); }
        .hero-deco--spark1, .hero-deco--spark2, .hero-deco--spark3,
        .hero-deco--spark4, .hero-deco--spark5, .hero-deco--spark6 {
            border-radius: 50%; background: #fff;
            box-shadow: 0 0 6px 1px rgba(255,255,255,.5);
        }
        .hero-deco--spark1 { top: 7px;    left: 58px;  width: 3px; height: 3px; }
        .hero-deco--spark2 { top: 12px;   left: 142px; width: 4px; height: 4px; }
        .hero-deco--spark3 { top: 8px;    left: 228px; width: 3px; height: 3px; }
        .hero-deco--spark4 { top: 14px;   right: 18px; width: 5px; height: 5px; }
        .hero-deco--spark5 { bottom: 12px; left: 46px;  width: 3px; height: 3px; }
        .hero-deco--spark6 { bottom: 9px;  right: 76px; width: 4px; height: 4px; }
        /* День — искры почти не видны (солнечный свет); вечер/ночь — ярче + мерцают */
        .hero-card--morning .hero-deco--spark1, .hero-card--morning .hero-deco--spark2, .hero-card--morning .hero-deco--spark3,
        .hero-card--morning .hero-deco--spark4, .hero-card--morning .hero-deco--spark5, .hero-card--morning .hero-deco--spark6,
        .hero-card--day .hero-deco--spark1, .hero-card--day .hero-deco--spark2, .hero-card--day .hero-deco--spark3,
        .hero-card--day .hero-deco--spark4, .hero-card--day .hero-deco--spark5, .hero-card--day .hero-deco--spark6 {
            opacity: .18;
        }
        .hero-card--evening .hero-deco--spark1, .hero-card--evening .hero-deco--spark2, .hero-card--evening .hero-deco--spark3,
        .hero-card--evening .hero-deco--spark4, .hero-card--evening .hero-deco--spark5, .hero-card--evening .hero-deco--spark6,
        .hero-card--night .hero-deco--spark1, .hero-card--night .hero-deco--spark2, .hero-card--night .hero-deco--spark3,
        .hero-card--night .hero-deco--spark4, .hero-card--night .hero-deco--spark5, .hero-card--night .hero-deco--spark6 {
            animation: heroTwinkle 3s ease-in-out infinite;
        }
        .hero-card--night .hero-deco--spark1 { animation-delay: .2s; }
        .hero-card--night .hero-deco--spark2 { animation-delay: .8s; }
        .hero-card--night .hero-deco--spark3 { animation-delay: 1.4s; }
        .hero-card--night .hero-deco--spark4 { animation-delay: .5s; }
        .hero-card--night .hero-deco--spark5 { animation-delay: 1.1s; }
        .hero-card--night .hero-deco--spark6 { animation-delay: 1.7s; }
        .hero-card--evening .hero-deco--spark1 { animation-delay: .1s; }
        .hero-card--evening .hero-deco--spark2 { animation-delay: .7s; }
        .hero-card--evening .hero-deco--spark3 { animation-delay: 1.3s; }
        .hero-card--evening .hero-deco--spark4 { animation-delay: .4s; }
        .hero-card--evening .hero-deco--spark5 { animation-delay: 1s; }
        .hero-card--evening .hero-deco--spark6 { animation-delay: 1.6s; }
        @keyframes heroTwinkle {
            0%, 100% { opacity: .35; transform: scale(1); }
            50%      { opacity: 1;   transform: scale(1.6); }
        }

        /* Бейдж солнце/луна в шапке hero-карточки — с мягким ореолом-свечением, по времени суток */
        .hero-daytime-badge {
            width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0;
            display: flex; align-items: center; justify-content: center;
            background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.25);
            backdrop-filter: blur(6px);
            position: relative; z-index: 1;
        }
        .hero-daytime-badge i { font-size: 16px; color: #fff; }
        .hero-card--morning .hero-daytime-badge, .hero-card--day .hero-daytime-badge {
            background: radial-gradient(circle at 35% 30%, rgba(255,224,138,.55), rgba(255,167,38,.2) 70%);
            border-color: rgba(255,214,102,.55);
            box-shadow: 0 0 16px 3px rgba(255,193,79,.4);
        }
        .hero-card--morning .hero-daytime-badge i, .hero-card--day .hero-daytime-badge i {
            color: #fff6df; text-shadow: 0 0 6px rgba(255,187,64,.8);
        }
        .hero-card--evening .hero-daytime-badge, .hero-card--night .hero-daytime-badge {
            background: radial-gradient(circle at 35% 30%, rgba(226,218,255,.5), rgba(120,100,180,.2) 70%);
            border-color: rgba(210,200,255,.55);
            box-shadow: 0 0 16px 3px rgba(170,150,255,.4);
        }
        .hero-card--evening .hero-daytime-badge i, .hero-card--night .hero-daytime-badge i {
            color: #f2eeff; text-shadow: 0 0 6px rgba(200,185,255,.85);
        }

        /* Объединённая hero: шапка ребёнка */
        .hero-head { display: flex; align-items: center; gap: 12px; position: relative; }
        .hero-avatar {
            width: 44px; height: 44px; border-radius: 13px; flex-shrink: 0;
            background: rgba(255,255,255,.18); backdrop-filter: blur(4px);
            display: flex; align-items: center; justify-content: center;
            color: #fff; font-size: 16px; font-weight: 800;
            border: 1px solid rgba(255,255,255,.22);
        }
        .hero-head-texts { flex: 1; min-width: 0; }
        .hero-head-name {
            font-size: 17px; font-weight: 800; color: #fff; line-height: 1.2;
            white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
        }
        .hero-head-meta { font-size: 12px; color: rgba(255,255,255,.7); margin-top: 2px; }
        .hero-divider { height: 1px; background: rgba(255,255,255,.16); margin: 16px 0; position: relative; }
        .hero-lesson-row { display: flex; align-items: center; gap: 14px; position: relative; }
        .hero-lesson-info { flex: 1; min-width: 0; }
        .hero-lesson-row .hero-card-time {
            font-size: 30px; margin-bottom: 0;
            background: rgba(255,255,255,.14); padding: 8px 12px; border-radius: 12px;
            border: 1px solid rgba(255,255,255,.18);
        }
        .hero-lesson-row .hero-card-subject { margin-bottom: 2px; }
        .hero-empty-inline {
            display: flex; align-items: center; gap: 9px;
            font-size: 14px; font-weight: 600; color: rgba(255,255,255,.85);
            position: relative;
        }
        .hero-route {
            color: rgba(255,255,255,.75); text-decoration: none;
            white-space: nowrap; display: inline-flex; align-items: center; gap: 4px;
        }
        .hero-route:active { opacity: .65; }
        .hero-empty-inline i { font-size: 16px; opacity: .75; }

        /* ═══ CHILD GREETING ══════════════════════════════════════════════════ */
        .child-greeting {
            display: flex; align-items: center; gap: 12px;
            margin: 4px 0 18px; padding: 2px;
        }
        .child-greeting-avatar {
            width: 46px; height: 46px; border-radius: 14px; flex-shrink: 0;
            background: linear-gradient(135deg, var(--primary) 0%, var(--primary-2) 100%);
            display: flex; align-items: center; justify-content: center;
            color: #fff; font-size: 17px; font-weight: 800;
            box-shadow: 0 4px 12px rgba(139,90,159,.35);
        }
        .child-greeting-texts { flex: 1; min-width: 0; }
        .child-greeting-label {
            font-size: 11px; font-weight: 600; color: var(--text-secondary);
            text-transform: uppercase; letter-spacing: .5px;
        }
        .child-greeting-name {
            font-size: 19px; font-weight: 800; color: var(--text); line-height: 1.15; margin-top: 1px;
            white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
        }
        .child-greeting-meta { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }

        /* ═══ STAT CARDS ROW ══════════════════════════════════════════════════ */
        .stat-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 4px; }
        .home-tariffs-label {
            font-size: 11px; font-weight: 700; color: var(--text-secondary);
            text-transform: uppercase; letter-spacing: .5px; margin: 14px 2px 8px;
        }
        .home-tariffs { margin-bottom: 4px; }
        .stat-card {
            background: var(--card); border-radius: var(--radius);
            box-shadow: var(--shadow-card); padding: 14px;
            display: flex; align-items: center; gap: 12px;
            border: 1px solid rgba(139,90,159,.06);
        }
        .stat-card-texts { flex: 1; min-width: 0; }
        .stat-card-value {
            font-size: 18px; font-weight: 800; color: var(--text); line-height: 1.1;
        }
        .stat-card-label { font-size: 11px; color: var(--text-secondary); margin-top: 2px; }

        /* ═══ HOME HOMEWORK ITEM ══════════════════════════════════════════════ */
        .home-hw-item {
            background: var(--card); border-radius: var(--radius);
            box-shadow: var(--shadow-card); padding: 14px 16px;
            display: flex; align-items: center; gap: 12px;
            border: 1px solid rgba(139,90,159,.06);
            cursor: pointer; transition: background .15s;
        }
        .home-hw-item:active { background: var(--primary-light); }
        .home-hw-texts { flex: 1; min-width: 0; }
        .home-hw-subject { font-size: 12px; font-weight: 700; color: var(--warning);
            text-transform: uppercase; letter-spacing: .4px; margin-bottom: 3px; }
        .home-hw-text { font-size: 14px; font-weight: 500; color: var(--text);
            white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
        .new-badge {
            background: linear-gradient(135deg, var(--primary), var(--primary-2));
            color: #fff; font-size: 10px; font-weight: 700;
            padding: 3px 8px; border-radius: 999px; white-space: nowrap;
            flex-shrink: 0;
        }

        /* ═══ QUICK ACTIONS ROW ═══════════════════════════════════════════════ */
        .quick-actions-row {
            display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
        }

        /* ═══ PAYMENT SHEET ════════════════════════════════════════════════════ */
        .pay-amount-btn {
            background: var(--bg); border: 1.5px solid rgba(139,90,159,.2);
            border-radius: 12px; padding: 12px 8px; font-family: inherit;
            font-size: 14px; font-weight: 700; color: var(--text);
            cursor: pointer; transition: all .18s; text-align: center;
        }
        .pay-amount-btn.selected, .pay-amount-btn:active {
            background: linear-gradient(135deg, var(--primary), #5c3d75);
            color: #fff; border-color: transparent;
        }
        .pay-card-top.js-pay-enabled { cursor: pointer; -webkit-tap-highlight-color: transparent; }
        .pay-card-top.js-pay-enabled:active { opacity: .85; }
        .stat-card-topup--off { color: var(--cp-muted, #6b7280); font-weight: 500; }
        .stat-card-topup {
            font-size: 11px; color: var(--primary); font-weight: 600; margin-top: 3px;
            display: flex; align-items: center; gap: 4px;
        }
        .balance-breakdown-row {
            display: none; /* показывается через JS, только если mat_capital_balance > 0 */
            align-items: center; gap: 4px; margin-top: 3px;
            font-size: 11px; font-weight: 600; color: var(--primary);
        }
        .balance-breakdown-row i { font-size: 10px; }
        .balance-breakdown-row span { font-weight: 700; }
        .balance-matcap-row {
            display: none; /* показывается через JS, только если mat_capital_balance > 0 */
            align-items: center; gap: 4px; margin-top: 3px;
            font-size: 11px; font-weight: 600; color: #a855f7;
        }
        .balance-matcap-row i { font-size: 10px; }
        .balance-matcap-row span { font-weight: 700; }
        .quick-action-btn {
            background: var(--card); border-radius: 14px;
            box-shadow: var(--shadow-card); padding: 14px 6px 12px;
            display: flex; flex-direction: column; align-items: center; gap: 8px;
            border: none; cursor: pointer; font-family: inherit;
            font-size: 11px; font-weight: 500; color: var(--text);
            border: 1px solid rgba(139,90,159,.06);
            transition: all .15s;
        }
        .quick-action-btn:active { background: var(--primary-light); transform: scale(.95); }

        /* ═══ HOME SECTION GROUPS ════════════════════════════════════════════ */
        .home-group {
            background: var(--card);
            border-radius: 20px;
            box-shadow: 0 2px 12px rgba(45,27,61,.07);
            border: 1px solid rgba(139,90,159,.09);
            padding: 16px;
            margin-bottom: 14px;
        }
        .home-group > .sec-header:first-child { margin-top: 0; margin-bottom: 14px; }
        .home-group-label {
            font-size: 10px; font-weight: 800; color: var(--text-muted);
            text-transform: uppercase; letter-spacing: .85px;
            margin-bottom: 12px;
            display: flex; align-items: center; gap: 6px;
        }
        .home-group-label i { color: var(--primary); font-size: 10px; }
        /* Элементы внутри группы используют фоновый цвет страницы для контраста */
        .home-group .stat-card {
            background: var(--bg); box-shadow: none;
            border-color: rgba(139,90,159,.1);
        }
        .home-group .home-hw-item {
            background: var(--bg); box-shadow: none;
            border-color: rgba(139,90,159,.1);
        }
        .home-group .quick-action-btn {
            background: var(--bg); box-shadow: none;
            border-color: rgba(139,90,159,.1);
        }
        .home-group .tariff-section {
            border: 1px solid rgba(139,90,159,.1); border-radius: var(--radius);
            overflow: hidden; background: var(--bg);
        }
        .home-group .tariff-item { border-bottom-color: rgba(139,90,159,.08); }
        .home-group .cm-card {
            background: var(--bg); border-radius: var(--radius);
            border: 1px solid rgba(139,90,159,.1);
            box-shadow: none;
        }
        .home-group .rec-card { /* сохраняем оригинальный градиент */ }

        /* ═══ VIEW TOGGLE (список / календарь) ═══════════════════════════════ */
        .view-toggle-wrap { display: flex; gap: 4px; margin-left: auto; flex-shrink: 0; }
        .vt-btn {
            width: 32px; height: 32px; border-radius: 8px; border: none;
            background: var(--vt-bg, var(--bg));
            color: var(--vt-text, var(--text-secondary));
            font-size: 13px; cursor: pointer; transition: all .15s;
            display: flex; align-items: center; justify-content: center;
        }
        .vt-btn.active {
            background: var(--vt-active, linear-gradient(135deg, var(--primary), var(--primary-2)));
            color: var(--vt-active-text, #fff);
            box-shadow: 0 2px 8px rgba(139,90,159,.35);
        }

        /* ═══ CALENDAR ════════════════════════════════════════════════════════ */
        .cal-nav {
            display: flex; align-items: center; justify-content: space-between;
            padding: 4px 0 14px;
        }
        .cal-nav-label { font-size: 16px; font-weight: 700; color: var(--text); }
        .cal-nav-btn {
            width: 36px; height: 36px; border-radius: 10px; border: none;
            background: var(--bg); color: var(--text-secondary);
            font-size: 14px; cursor: pointer; transition: all .15s;
            display: flex; align-items: center; justify-content: center;
        }
        .cal-nav-btn:disabled { opacity: .3; cursor: default; }
        .cal-nav-btn:not(:disabled):active { background: var(--primary-light); }
        .cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
        .cal-dow {
            text-align: center; font-size: 11px; font-weight: 700;
            color: var(--text-secondary); padding: 4px 0 8px;
            letter-spacing: .3px;
        }
        .cal-dow.we { color: var(--primary); }
        .cal-cell {
            min-height: 54px; border-radius: 10px; padding: 5px 2px 4px;
            display: flex; flex-direction: column; align-items: center;
        }
        .cal-cell.has-lessons { background: rgba(139,90,159,.07); cursor: pointer; }
        .cal-cell.has-lessons:active { background: var(--primary-light); }
        .cal-cell.today { background: rgba(139,90,159,.1); }
        .cal-cell.past { opacity: .5; }
        .cal-day-num {
            font-size: 13px; font-weight: 600; color: var(--text);
            width: 26px; height: 26px; display: flex;
            align-items: center; justify-content: center;
            border-radius: 50%; flex-shrink: 0;
            font-variant-numeric: tabular-nums;
        }
        .cal-day-num.today-n {
            background: var(--primary); color: #fff;
            box-shadow: 0 2px 8px rgba(139,90,159,.4);
        }
        .cal-lesson-tag {
            font-size: 9px; font-weight: 700; letter-spacing: .1px;
            background: linear-gradient(135deg, var(--primary), var(--primary-2));
            color: #fff; border-radius: 4px;
            padding: 2px 3px; margin-top: 2px; width: 100%;
            text-align: center; font-variant-numeric: tabular-nums;
            white-space: nowrap; overflow: hidden;
        }
        .cal-lesson-tag.conducted,
        .cal-lesson-tag.paid { background: linear-gradient(135deg, #22c55e, #16a34a); }
        .cal-lesson-tag.unpaid { background: #94a3b8; }
        .cal-lesson-tag.debt { background: linear-gradient(135deg, #ef4444, #dc2626); }
        .cal-lesson-tag.cancelled { background: linear-gradient(135deg, #94a3b8, #64748b); opacity: .75; }
        .cal-more { font-size: 9px; font-weight: 700; color: var(--primary); margin-top: 2px; }

        /* ═══ LESSON DETAIL SHEET ═════════════════════════════════════════════ */
        .lds-header { margin-bottom: 18px; }
        .lds-subject { font-size: 18px; font-weight: 700; color: var(--text); line-height: 1.3; margin-bottom: 4px; }
        .lds-date-str { font-size: 13px; color: var(--text-secondary); }
        .lds-rows { display: flex; flex-direction: column; }
        .lds-row {
            display: flex; align-items: center; gap: 14px;
            padding: 12px 0; border-bottom: 1px solid var(--border);
        }
        .lds-row:last-child { border-bottom: none; }
        .lds-icon-wrap {
            width: 32px; height: 32px; border-radius: 9px;
            background: var(--primary-light); color: var(--primary);
            display: flex; align-items: center; justify-content: center;
            font-size: 13px; flex-shrink: 0;
        }
        .lds-row-val { font-size: 15px; font-weight: 500; color: var(--text); }
        .lds-route-btn {
            display: flex; align-items: center; justify-content: center; gap: 8px;
            width: 100%; margin-top: 18px; padding: 14px; box-sizing: border-box;
            border-radius: 12px; background: var(--primary-light);
            border: 1px solid var(--primary-border);
            color: var(--primary); font-size: 15px; font-weight: 600;
            text-decoration: none;
        }
        .lds-route-btn:active { background: rgba(139,90,159,.18); }
        .lds-day-list .lesson-item { cursor: pointer; }
        .lds-day-list .lesson-item:active { background: var(--primary-light); border-radius: 12px; }

        /* ═══ TAB BAR FA ICONS ════════════════════════════════════════════════ */
        .tab-icon-fa { font-size: 18px; line-height: 1; display: block; }

        /* ═══ INLINE-STYLE MIGRATION UTILITIES ═══════════════════════════════ */
        .sched-hero {
            background: linear-gradient(135deg, #8B5A9F 0%, #5E3A75 40%, #2D1B3D 75%, #5E3A75 100%);
            background-size: 220% 220%;
            animation: heroGradient 14s ease infinite;
            border-radius: 16px; padding: 16px 16px 14px; margin: 4px 0 12px;
            display: flex; align-items: center; gap: 12px;
            box-shadow: 0 4px 18px rgba(139,90,159,.35);
            position: relative; overflow: hidden;
        }
        @media (prefers-reduced-motion: reduce) {
            .sched-hero { animation: none; }
            .sched-hero-deco--lg, .sched-hero-deco--md,
            .sched-hero-deco--spark1, .sched-hero-deco--spark2, .sched-hero-deco--spark3, .sched-hero-deco--spark4 {
                animation: none !important;
            }
        }
        .sched-hero-deco { position: absolute; pointer-events: none; }
        .sched-hero-deco--lg {
            top: -18px; right: 60px; width: 80px; height: 80px; border-radius: 50%;
            background: rgba(255,255,255,.07); animation: schedFloatPulse 7s ease-in-out infinite;
        }
        .sched-hero-deco--md {
            bottom: -22px; right: 20px; width: 60px; height: 60px; border-radius: 50%;
            background: rgba(255,255,255,.06); animation: schedFloatPulse 7s ease-in-out infinite 1.5s;
        }
        .sched-hero-deco--dot1 { top: 6px; right: 110px; width: 6px; height: 6px; border-radius: 50%; background: rgba(255,255,255,.45); }
        .sched-hero-deco--dot2 { top: 14px; right: 130px; width: 3px; height: 3px; border-radius: 50%; background: rgba(255,255,255,.3); }
        .sched-hero-deco--dot3 { bottom: 8px; left: 60px; width: 4px; height: 4px; border-radius: 50%; background: rgba(255,255,255,.35); }
        /* Мягкие светящиеся искры (не текстовые символы) — мерцают вразнобой */
        .sched-hero-deco--spark1, .sched-hero-deco--spark2,
        .sched-hero-deco--spark3, .sched-hero-deco--spark4 {
            border-radius: 50%; background: #fff;
            box-shadow: 0 0 6px 1px rgba(255,255,255,.55);
            animation: heroTwinkle 3s ease-in-out infinite;
        }
        .sched-hero-deco--spark1 { top: 9px;    left: 96px;  width: 3px; height: 3px; animation-delay: 0s; }
        .sched-hero-deco--spark2 { bottom: 8px;  right: 92px; width: 3px; height: 3px; animation-delay: .8s; }
        .sched-hero-deco--spark3 { top: 16px;   left: 150px; width: 2px; height: 2px; animation-delay: 1.5s; }
        .sched-hero-deco--spark4 { bottom: 14px; left: 140px; width: 2px; height: 2px; animation-delay: 2.2s; }
        @keyframes schedFloatPulse {
            0%, 100% { transform: translateY(0) scale(1); opacity: 1; }
            50%      { transform: translateY(-6px) scale(1.08); opacity: .8; }
        }
        .sched-hero-icon {
            width: 36px; height: 36px; border-radius: 10px; flex-shrink: 0;
            background: rgba(255,255,255,.18);
            display: flex; align-items: center; justify-content: center;
            position: relative; z-index: 1;
        }
        .sched-hero-icon i { font-size: 16px; color: #fff; }
        .sched-hero-texts { flex: 1; min-width: 0; position: relative; z-index: 1; }
        .sched-hero-title { font-size: 16px; font-weight: 700; color: #fff; line-height: 1.2; }
        .sched-hero-toggle {
            --vt-bg: rgba(255,255,255,.15); --vt-active: #fff;
            --vt-active-text: #2D1B3D; --vt-text: rgba(255,255,255,.75);
            position: relative; z-index: 1;
        }
        .lesson-item--clickable { cursor: pointer; }
        .cp-chevron-right {
            color: var(--text-muted); font-size: 12px; flex-shrink: 0;
            align-self: center; margin-left: 4px;
        }
        .cp-chevron-right--sec { color: var(--text-secondary); align-self: auto; margin-left: 0; }
        .cp-chevron-right--auto { margin-left: auto; }
        .cp-empty-inline { color: var(--text-muted); font-size: 14px; padding: 8px 0; }
        .cp-spacer-10 { height: 10px; }
        .cp-stats-link {
            margin-left: auto; background: none; border: none;
            color: var(--primary); font-size: 13px; cursor: pointer;
            font-weight: 600; padding: 4px 0; font-family: inherit;
        }
        .cp-stats-link i { font-size: 11px; }
        .status-badge {
            display: inline-block; color: #fff; border-radius: 6px;
            padding: 2px 8px; font-size: 11px; font-weight: 700; margin-left: 8px;
        }
        .status-badge--done { background: linear-gradient(135deg, #22c55e, #16a34a); }
        .status-badge--cancel { background: linear-gradient(135deg, #94a3b8, #64748b); }
        .status-badge--done-sm { font-size: 10px; color: #16a34a; font-weight: 700; margin-left: 4px; background: none; padding: 0; }
        .status-badge--cancel-sm { font-size: 10px; color: #64748b; font-weight: 700; margin-left: 4px; background: none; padding: 0; }
        .lds-subject-row { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; }
        .lds-day-title { font-size: 17px; font-weight: 700; color: var(--text); margin-bottom: 16px; }
        .lds-day-item { cursor: pointer; margin-bottom: 8px; }
        .cp-empty-state--sm { padding: 20px 0; }
        .cp-empty-state--xs { padding: 10px 0; font-size: 13px; }
        .cp-empty-state--md { padding: 16px 0; }
        .cp-empty-icon--success { font-size: 28px; color: var(--success); margin-bottom: 8px; }
        .cp-empty-icon--muted { font-size: 28px; color: var(--text-secondary); margin-bottom: 8px; }
        .cp-empty-icon--border { font-size: 28px; color: var(--border); display: block; margin-bottom: 8px; }
        .cp-empty-icon--chart { font-size: 24px; color: var(--border); display: block; margin-bottom: 6px; }
        .cp-empty-icon--bulb { font-size: 22px; color: var(--border); display: block; margin-bottom: 6px; }
        .cp-loading--sm { padding: 12px 0; }
        .cp-loading--md { padding: 16px 0; }
        .cp-loc-icon { font-size: 10px; opacity: .7; }
        .cp-loc-muted { color: rgba(255,255,255,.65); }
        .msg-bubble--dim { opacity: .5; }
        .msg-bubble--error { color: var(--danger); }
        .assistant-header {
            padding: 4px 0 10px; display: flex; align-items: center; gap: 10px;
            border-bottom: 1px solid rgba(139,90,159,.1); margin-bottom: 4px;
        }
        .assistant-title { font-size: 14px; font-weight: 700; color: var(--text); }
        .assistant-sub { font-size: 11px; color: var(--text-secondary); }
        .msg-wave-icon { margin-right: 4px; }
        .mr-icon--brand { background: linear-gradient(135deg, #8B5A9F, #5c3d75); }
        .mr-icon--green { background: linear-gradient(135deg, #22c55e, #16a34a); }
        .mr-icon--cyan { background: linear-gradient(135deg, #06b6d4, #0891b2); }
        .mr-icon--amber { background: linear-gradient(135deg, #f59e0b, #d97706); }
        .mr-icon--blue { background: linear-gradient(135deg, #4299e1, #3182ce); }
        .mr-icon--slate { background: linear-gradient(135deg, #475569, #1e293b); }
        .mr-icon--danger { background: linear-gradient(135deg, #dc2626, #7f1d1d); }
        .mr-label--danger { color: var(--danger); }
        .cp-section-gap { margin-bottom: 8px; }
        .cp-modal-overlay {
            display: none; position: fixed; inset: 0;
            background: rgba(0,0,0,.55); z-index: 500;
            align-items: center; justify-content: center;
        }
        .cp-modal-box {
            background: #fff; border-radius: 16px; padding: 24px 20px;
            width: 90%; max-width: 360px; box-shadow: 0 8px 32px rgba(0,0,0,.2);
        }
        .cp-modal-title { font-weight: 700; font-size: 17px; margin-bottom: 16px; }
        .cp-modal-input {
            width: 100%; padding: 11px 14px; border: 1.5px solid #dde3f0;
            border-radius: 10px; font-size: 15px; box-sizing: border-box;
            font-family: inherit;
        }
        .cp-modal-input--mb4 { margin-bottom: 4px; }
        .cp-modal-input--mb10 { margin-bottom: 10px; }
        .cp-modal-input--mb6 { margin-bottom: 6px; }
        .cp-modal-forgot { text-align: right; margin-bottom: 10px; }
        .cp-modal-link {
            background: none; border: none; color: var(--primary);
            font-size: 12px; cursor: pointer; padding: 2px 0; font-weight: 600;
            font-family: inherit;
        }
        .cp-modal-error { margin-bottom: 10px; }
        .cp-modal-actions { display: flex; gap: 10px; margin-top: 4px; }
        .cp-modal-btn-cancel {
            flex: 1; padding: 11px; border-radius: 10px;
            border: 1.5px solid #dde3f0; background: #f5f6fa;
            font-size: 15px; cursor: pointer; font-family: inherit;
        }
        .cp-modal-btn-save {
            flex: 2; padding: 11px; border-radius: 10px; border: none;
            background: var(--primary); color: #fff; font-size: 15px;
            font-weight: 600; cursor: pointer; font-family: inherit;
        }
        .cp-page-title {
            font-size: 17px; font-weight: 700; color: var(--text);
            margin-bottom: 20px; display: flex; align-items: center; gap: 10px;
        }
        .cp-page-title--sm { margin-bottom: 6px; }
        .cp-page-title--no-mb { margin-bottom: 0; }
        .menu-list--flush { margin: 0; }
        .cp-hint-center { font-size: 12px; color: var(--text-muted); margin-top: 14px; text-align: center; }
        .call-modal-hero { text-align: center; padding: 4px 0 8px; }
        .call-modal-icon {
            width: 60px; height: 60px; border-radius: 18px; margin: 0 auto 14px;
            background: linear-gradient(135deg, #22c55e, #16a34a);
            display: flex; align-items: center; justify-content: center;
            box-shadow: 0 6px 20px rgba(34,197,94,.35);
        }
        .call-modal-icon i { font-size: 24px; color: #fff; }
        .call-modal-title { font-size: 18px; font-weight: 700; color: var(--text); margin-bottom: 8px; }
        .call-modal-desc { font-size: 14px; color: var(--text-secondary); line-height: 1.55; margin-bottom: 24px; }
        .call-modal-btn {
            width: 100%; padding: 15px; border-radius: 14px; border: none;
            font-size: 15px; font-weight: 700; cursor: pointer; font-family: inherit;
            margin-bottom: 10px;
        }
        .call-modal-btn--primary {
            background: linear-gradient(135deg, #22c55e, #16a34a); color: #fff;
            box-shadow: 0 4px 16px rgba(34,197,94,.35);
        }
        .call-modal-btn--wa {
            background: #25D366; color: #fff;
            box-shadow: 0 4px 16px rgba(37,211,102,.3);
        }
        .call-modal-btn--tg {
            background: #229ED9; color: #fff;
            box-shadow: 0 4px 16px rgba(34,158,217,.3);
        }
        .call-modal-btn--cancel {
            width: 100%; padding: 13px; border-radius: 14px;
            border: 1.5px solid var(--border); background: var(--bg);
            color: var(--text-secondary); font-size: 15px; cursor: pointer;
            font-family: inherit; margin-top: 4px;
        }
        .balance-header { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
        .balance-hint { font-size: 13px; color: var(--text-secondary); margin-bottom: 20px; padding-left: 2px; }
        .tariff-balance-row {
            display: flex; align-items: center; justify-content: space-between; margin-top: 6px;
        }
        .tariff-balance-label { font-size: 12px; color: var(--text-secondary); }
        .tariff-balance-label i { margin-right: 4px; color: #6366f1; }
        .tariff-balance-value { font-size: 14px; font-weight: 700; color: #059669; }
        .rec-card-header { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
        .rec-badge {
            display: inline-flex; align-items: center; gap: 5px;
            background: linear-gradient(135deg, #6366f1, #8b5cf6); color: #fff;
            font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 20px;
            letter-spacing: 0.02em;
        }
        .rec-badge i { font-size: 10px; }
        .rec-date { font-size: 12px; color: var(--muted, #94a3b8); }
        .rec-date i { margin-right: 3px; }
        .rec-meta--mb { margin-bottom: 6px; }
        .rec-card--spaced { margin-bottom: 10px; }
        .rec-list { margin: 0; padding-left: 18px; line-height: 1.7; }
        .cm-pct-denom { font-size: 18px; color: var(--text-muted); }
        .month-legend-dot--primary { background: var(--primary); }
        .month-legend-dot--danger { background: rgba(220,38,38,.65); }
        .month-legend-dot--planned { background: #cbd5e1; }
        .cc-dot--muted { background: var(--text-muted); }
        .cc-dot--primary { background: var(--primary); }
        .cc-dot--danger { background: rgba(220,38,38,.65); }
        .cm-empty-icon { color: var(--text-muted); }
        .icon-badge--fixed { flex-shrink: 0; }
        .cp-empty-state--flush { padding: 0; }
        .call-modal-btn--send {
            background: linear-gradient(135deg, #22c55e, #16a34a); color: #fff;
            box-shadow: 0 4px 14px rgba(34,197,94,.35); margin-bottom: 10px;
            display: flex; align-items: center; justify-content: center; gap: 8px;
            font-size: 16px;
        }
        .call-modal-btn--tg {
            background: linear-gradient(135deg, #229ED9, #1a7ab8); color: #fff;
            box-shadow: 0 4px 14px rgba(34,158,217,.35); margin-bottom: 10px;
            display: flex; align-items: center; justify-content: center; gap: 8px;
            text-decoration: none; font-size: 16px;
        }
        .call-modal-btn--max {
            background: linear-gradient(135deg, #7B61FF, #5B3FD9); color: #fff;
            box-shadow: 0 4px 14px rgba(123,97,255,.35); margin-bottom: 10px;
            display: flex; align-items: center; justify-content: center; gap: 8px;
            text-decoration: none; font-size: 16px;
        }
        .call-modal-btn--max img {
            width: 22px; height: 22px; border-radius: 6px;
            object-fit: cover; flex-shrink: 0; display: block;
        }
        .call-modal-btn--outline {
            border: 1.5px solid var(--border); background: var(--bg);
            color: var(--text); font-size: 15px; font-weight: 600;
        }
        .social-links-row {
            background: var(--card); border-radius: var(--radius);
            box-shadow: var(--shadow-card); border: 1px solid rgba(139,90,159,.06);
            display: flex; align-items: center; justify-content: center; gap: 16px;
            padding: 16px;
        }
        .social-link-btn {
            width: 48px; height: 48px; border-radius: 50%;
            display: flex; align-items: center; justify-content: center;
            color: #fff; font-size: 20px; text-decoration: none;
            transition: transform .15s ease;
        }
        .social-link-btn:active { transform: scale(.92); }
        .social-link-btn--vk { background: linear-gradient(135deg, #4C75A3, #3b5d82); box-shadow: 0 4px 12px rgba(76,117,163,.35); }
        .social-link-btn--tg { background: linear-gradient(135deg, #229ED9, #1a7ab8); box-shadow: 0 4px 12px rgba(34,158,217,.35); }
        .social-link-btn--inst { background: linear-gradient(135deg, #f58529, #dd2a7b, #8134af, #515bd4); box-shadow: 0 4px 12px rgba(221,42,123,.3); }
        .social-link-btn--max {
            background: none; padding: 0; overflow: hidden;
            box-shadow: 0 4px 12px rgba(123,97,255,.35);
        }
        .social-link-btn--max img {
            width: 100%; height: 100%; object-fit: cover; display: block;
        }
        .pay-section-label {
            font-size: 11px; font-weight: 700; color: var(--text-secondary);
            text-transform: uppercase; letter-spacing: .6px; margin-bottom: 10px;
        }
        .pay-section-label--tight { margin-bottom: 8px; }
        .pay-amount-grid {
            display: grid; grid-template-columns: repeat(2, 1fr);
            gap: 8px; margin-bottom: 16px;
        }
        .pay-input-wrap { position: relative; margin-bottom: 20px; }
        .pay-input {
            width: 100%; padding: 12px 44px 12px 14px;
            border: 1.5px solid rgba(139,90,159,.25);
            border-radius: 12px; font-size: 16px; font-weight: 600; color: var(--text);
            background: var(--bg); outline: none; box-sizing: border-box;
            font-family: inherit; transition: .2s;
        }
        .pay-input:focus { border-color: var(--primary); }
        .pay-currency {
            position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
            font-size: 15px; color: var(--text-secondary); font-weight: 600; pointer-events: none;
        }
        .pay-submit-btn {
            width: 100%; padding: 15px; border-radius: 14px; border: none;
            cursor: pointer; font-family: inherit;
            background: linear-gradient(135deg, var(--primary), #5c3d75); color: #fff;
            font-size: 16px; font-weight: 700;
            display: flex; align-items: center; justify-content: center; gap: 8px;
            opacity: .45; transition: .2s;
        }
        .pay-submit-btn:not(:disabled) { opacity: 1; }
        .pay-split-btn {
            width: 100%; margin-top: 10px; padding: 15px; border-radius: 14px; border: none;
            cursor: pointer; font-family: inherit;
            background: linear-gradient(135deg, #22c55e, #16a34a); color: #fff;
            font-size: 16px; font-weight: 700;
            display: flex; align-items: center; justify-content: center; gap: 8px;
            opacity: .45; transition: .2s;
        }
        .pay-split-btn:not(:disabled) { opacity: 1; }
        .pay-split-hint {
            text-align: center; margin-top: 8px; font-size: 12px;
            color: var(--text-secondary);
        }
        .pay-secure-note {
            text-align: center; margin-top: 14px; font-size: 11px;
            color: var(--text-secondary);
            display: flex; align-items: center; justify-content: center; gap: 5px;
        }
        .pay-secure-note i { color: #22c55e; font-size: 12px; }
        /* ═══ СВЕРКА ВЗАИМОРАСЧЕТОВ (форма периода/счёта) ══════════════════════ */
        .stlm-date-row { display: flex; gap: 8px; margin-bottom: 16px; }
        .stlm-date-row .cp-modal-input { flex: 1; min-width: 0; }
        .stlm-account-select { margin-bottom: 20px; appearance: auto; background: #fff; }
        .balance-current strong { color: var(--text); }

        /* ═══ NEWS ═════════════════════════════════════════════════════════════ */
        .tab-icon-wrap { position: relative; display: block; }
        .tab-dot {
            position: absolute; top: -2px; right: -6px;
            width: 8px; height: 8px; border-radius: 50%;
            background: #ef4444; border: 1.5px solid #fff;
        }
        .mr-badge {
            background: #ef4444; color: #fff; font-size: 11px; font-weight: 700;
            min-width: 20px; height: 20px; border-radius: 999px;
            display: flex; align-items: center; justify-content: center;
            padding: 0 6px; flex-shrink: 0;
        }
        .mr-status {
            font-size: 11px; font-weight: 700; line-height: 1.2;
            padding: 4px 8px; border-radius: 999px; flex-shrink: 0;
            background: #f1f5f9; color: #64748b;
        }
        .mr-status[data-status="sent"] { background: #e0f2fe; color: #0369a1; }
        .mr-status[data-status="opened"] { background: #ffedd5; color: #c2410c; }
        .mr-status[data-status="acknowledged"] { background: #dcfce7; color: #15803d; }
        .mr-status[data-status="stale"] { background: #ffedd5; color: #c2410c; }
        .home-news-item {
            background: var(--card); border-radius: var(--radius);
            box-shadow: var(--shadow-card); padding: 14px 16px;
            display: flex; align-items: center; gap: 12px;
            border: 1px solid rgba(139,90,159,.06);
            cursor: pointer; transition: background .15s;
        }
        .home-news-item:active { background: var(--primary-light); }
        .home-news-thumb {
            width: 44px; height: 44px; border-radius: 10px; object-fit: cover; flex-shrink: 0;
        }
        .news-list-item {
            display: flex; align-items: center; gap: 12px;
            padding: 12px 0; border-bottom: 1px solid var(--border);
            cursor: pointer; transition: background .15s;
        }
        .news-list-item:last-child { border-bottom: none; }
        .news-list-item:active { background: var(--primary-light); }
        .news-list-thumb {
            width: 52px; height: 52px; border-radius: 10px; object-fit: cover; flex-shrink: 0;
        }
        .news-list-thumb--placeholder {
            display: flex; align-items: center; justify-content: center;
            background: var(--primary-light); color: var(--primary); font-size: 18px;
        }
        .news-list-texts { flex: 1; min-width: 0; }
        .news-list-date {
            font-size: 11px; color: var(--text-secondary); text-transform: uppercase;
            letter-spacing: .3px; margin-bottom: 3px;
        }
        .news-list-title {
            font-size: 14px; font-weight: 600; color: var(--text);
            display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
            overflow: hidden;
        }
        .news-dot {
            width: 8px; height: 8px; border-radius: 50%; background: #ef4444; flex-shrink: 0;
        }
        .news-back-btn {
            display: flex; align-items: center; gap: 8px; margin-bottom: 16px;
            font-size: 14px; font-weight: 600;
        }
        .news-detail-date {
            font-size: 12px; color: var(--text-secondary); text-transform: uppercase;
            letter-spacing: .4px; margin-bottom: 6px;
        }
        .news-detail-title {
            font-size: 19px; font-weight: 700; color: var(--text); line-height: 1.3;
            margin-bottom: 14px;
        }
        .news-detail-images {
            display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px;
        }
        .news-detail-img { width: 100%; border-radius: 12px; display: block; }
        .news-detail-content {
            font-size: 15px; line-height: 1.6; color: var(--text); white-space: pre-wrap;
        }
    
