@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 400 800;
    font-display: swap;
    src: url('/fonts/inter-cyrillic-ext.woff2') format('woff2');
    unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 400 800;
    font-display: swap;
    src: url('/fonts/inter-cyrillic.woff2') format('woff2');
    unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 400 800;
    font-display: swap;
    src: url('/fonts/inter-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
    --primary: #1b4965;
    --primary-light: #5fa8d3;
    --accent: #e07a5f;
    --bg: #f7f9fb;
    --card: #ffffff;
    --text: #22323f;
    --muted: #6b7c8c;
    --border: #dde5ec;
    --radius: 12px;
    --shadow-sm: 0 1px 2px rgba(20,40,60,0.06);
    --shadow-md: 0 4px 14px rgba(20,40,60,0.08);
    --shadow-lg: 0 12px 32px rgba(20,40,60,0.14);
    --ease: cubic-bezier(0.22, 1, 0.36, 1);
    --report: #6d3fc0;
    --report-light: #f3edfb;
    --report-border: #e3d6f5;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { letter-spacing: -0.01em; }

.site-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 32px;
    background: var(--card);
    border-bottom: 1px solid var(--border);
}

.brand {
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--primary);
    text-decoration: none;
}

.brand span { color: var(--accent); }

.brand-logo { display: block; height: 32px; width: auto; max-width: 100%; }

.site-header nav a {
    margin-left: 24px;
    text-decoration: none;
    color: var(--text);
    font-weight: 500;
}

.site-header nav a:hover { color: var(--primary); }

.container {
    max-width: 860px;
    margin: 0 auto;
    padding: 40px 20px 80px;
}

.site-footer {
    text-align: center;
    padding: 24px;
    color: var(--muted);
    font-size: 0.85rem;
}

h1 { color: var(--primary); }

.hero {
    text-align: center;
    padding: 40px 0;
}

.hero p { color: var(--muted); font-size: 1.05rem; }

.cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 32px;
}

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    text-decoration: none;
    color: var(--text);
    transition: box-shadow 0.15s, transform 0.15s;
}

.card:hover { box-shadow: 0 4px 16px rgba(27,73,101,0.12); transform: translateY(-2px); }

.card h2 { margin-top: 0; color: var(--primary); }

label {
    display: block;
    font-weight: 600;
    margin: 18px 0 6px;
}

select, textarea,
input[type=text], input[type=email], input[type=password],
input[type=number], input[type=file], input[type=search] {
    width: 100%;
    padding: 11px 14px;
    border: 1.5px solid var(--border);
    border-radius: 9px;
    font-size: 1rem;
    font-family: inherit;
    color: var(--text);
    background: var(--card);
    transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}

select:hover, textarea:hover,
input[type=text]:hover, input[type=email]:hover, input[type=password]:hover,
input[type=number]:hover, input[type=file]:hover, input[type=search]:hover {
    border-color: #c3d4e0;
}

select:focus, textarea:focus,
input[type=text]:focus, input[type=email]:focus, input[type=password]:focus,
input[type=number]:focus, input[type=search]:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(95,168,211,0.25);
}

textarea { min-height: 220px; resize: vertical; }

.btn {
    display: inline-block;
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 12px 24px;
    border-radius: 9px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 20px;
    box-shadow: var(--shadow-sm);
    transition: background 0.15s var(--ease), box-shadow 0.15s var(--ease), transform 0.1s var(--ease);
}

.btn:hover { background: #163a52; box-shadow: var(--shadow-md); transform: translateY(-1px); }
.btn:active { transform: translateY(0); box-shadow: var(--shadow-sm); }

.btn:disabled { background: var(--muted); cursor: not-allowed; box-shadow: none; transform: none; }

.btn.record { background: var(--accent); }
.btn.record:hover { background: #c96548; }
.btn.record.active { background: #d64545; }
.btn.record.active:hover { background: #c23c3c; }

.word-count { color: var(--muted); font-size: 0.85rem; text-align: right; margin-top: 4px; }

.result {
    display: none;
    margin-top: 32px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow-sm);
}

.score-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 18px;
}

.overall-band-wrap { text-align: center; }

.overall-band {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary);
}

.overall-band-sub { font-size: 1.2rem; color: var(--muted); font-weight: 400; }

.overall-band-label {
    color: var(--muted);
    font-size: 0.85rem;
}

.stat-pill {
    text-align: center;
    padding: 6px 16px;
    border-left: 1px solid var(--border);
}

.stat-pill .value { font-size: 1.3rem; font-weight: 700; color: var(--accent); }
.stat-pill .label { font-size: 0.8rem; color: var(--muted); }

.accordion { margin: 20px 0; }

.criterion-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    margin-bottom: 10px;
    overflow: hidden;
    transition: box-shadow 0.15s var(--ease);
}

.criterion-card:hover { box-shadow: var(--shadow-sm); }

.criterion-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    cursor: pointer;
    user-select: none;
}

.criterion-header .left { display: flex; align-items: center; gap: 10px; font-weight: 600; }

.dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.dot.c0 { background: #5fa8d3; }
.dot.c1 { background: #57a773; }
.dot.c2 { background: #e9a13b; }
.dot.c3 { background: #d1495b; }

.criterion-header .right { display: flex; align-items: center; gap: 10px; }
.criterion-header .band { font-weight: 700; color: var(--accent); font-size: 1.05rem; }
.criterion-header .chevron { transition: transform 0.15s; color: var(--muted); }
.criterion-card.open .chevron { transform: rotate(180deg); }

.criterion-body {
    display: none;
    padding: 0 16px 16px;
}

.criterion-card.open .criterion-body { display: block; }

.sub-scores-label { font-size: 0.8rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; margin-bottom: 8px; }

.sub-score-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px dashed var(--border);
    font-size: 0.92rem;
}

.sub-score-row:last-child { border-bottom: none; }
.sub-score-row .val { font-weight: 600; }

.criterion-desc {
    font-size: 0.85rem;
    color: var(--muted);
    margin: 12px 0;
    padding-top: 10px;
    border-top: 1px solid var(--border);
}

.criterion .feedback { font-size: 0.9rem; color: var(--text); }

.summary { margin-top: 18px; }
.summary h3 { margin-bottom: 6px; }

.detailed-feedback { margin-top: 36px; }
.detailed-feedback h3 { margin-bottom: 4px; }

.tabs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin: 16px 0;
}

.tab-btn {
    padding: 9px 18px;
    border: 1px solid var(--border);
    background: var(--card);
    border-radius: 999px;
    cursor: pointer;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--muted);
    transition: background 0.15s var(--ease), color 0.15s var(--ease), border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}

.tab-btn:hover { border-color: var(--report-border); color: var(--report); }
.tab-btn.active { background: var(--report); color: #fff; border-color: var(--report); box-shadow: 0 3px 10px rgba(109,63,192,0.3); }

.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fadeIn 0.2s var(--ease); }

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

.feedback-columns {
    display: grid;
    grid-template-columns: 1.3fr 1fr;
    gap: 18px;
    align-items: start;
}

.feedback-col-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    flex-wrap: wrap;
    gap: 8px;
}

.feedback-col-title { font-weight: 700; font-size: 0.95rem; color: var(--text); }

.view-toggle {
    display: flex;
    background: var(--bg);
    border-radius: 999px;
    padding: 3px;
    gap: 2px;
}

.view-toggle-btn {
    border: none;
    background: none;
    padding: 5px 14px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--muted);
    cursor: pointer;
    transition: background 0.15s var(--ease), color 0.15s var(--ease);
}

.view-toggle-btn.active { background: var(--card); color: var(--report); box-shadow: var(--shadow-sm); }

.highlighted-text {
    background: var(--bg);
    border-radius: 10px;
    padding: 16px;
    line-height: 2;
    font-size: 0.92rem;
    max-height: 420px;
    overflow-y: auto;
}

.err-mark {
    background: var(--report-light);
    box-shadow: inset 0 -1.5px 0 var(--report);
    cursor: default;
    border-radius: 4px;
    padding: 1px 3px;
    position: relative;
}

.err-mark sup {
    color: var(--report);
    font-weight: 700;
    font-size: 0.65em;
    margin-left: 1px;
}

.highlighted-text.plain-view .err-mark {
    background: none;
    box-shadow: none;
    padding: 0;
}

.highlighted-text.plain-view .err-mark sup { display: none; }

.error-list { display: flex; flex-direction: column; gap: 10px; max-height: 420px; overflow-y: auto; }

.error-item {
    background: var(--bg);
    border-radius: 10px;
    padding: 14px 16px;
    font-size: 0.88rem;
}

.error-item-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }

.error-num {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--report);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.error-label-tag {
    background: var(--report-light);
    color: var(--report);
    font-size: 0.72rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 999px;
}

.error-diff { line-height: 1.6; margin-bottom: 6px; }
.error-diff del { color: #b3261e; background: #fbe4e2; text-decoration: line-through; border-radius: 2px; padding: 0 1px; }
.error-diff ins { color: #1a7a4c; background: #e2f5e9; text-decoration: none; border-radius: 2px; padding: 0 1px; }

.error-item .explain { color: var(--muted); font-size: 0.83rem; }

.no-errors { color: var(--muted); font-style: italic; padding: 12px 0; }

@media (max-width: 700px) {
    .feedback-columns { grid-template-columns: 1fr; }
}

.error-msg {
    display: none;
    background: #fde8e8;
    color: #a33;
    padding: 12px 16px;
    border-radius: 8px;
    margin-top: 16px;
}

.loading { display: none; text-align: center; padding: 20px; color: var(--muted); }

.transcript-box {
    background: var(--bg);
    border-radius: 8px;
    padding: 14px;
    margin-top: 16px;
    font-style: italic;
    color: var(--muted);
}

@media (max-width: 640px) {
    .cards, .criteria-grid { grid-template-columns: 1fr; }
    .site-header { flex-direction: column; gap: 10px; }
}

/* Task 1 picker */
.task-picker-toggle {
    background: none;
    border: 1px dashed var(--border);
    border-radius: 8px;
    padding: 10px 14px;
    color: var(--primary);
    font-weight: 600;
    cursor: pointer;
    margin-top: 8px;
}

.task-picker {
    display: none;
    margin-top: 14px;
    max-height: 360px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px;
    background: var(--bg);
}

.task-picker.open { display: block; }

.task-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}

.task-card:hover { border-color: var(--primary-light); box-shadow: var(--shadow-sm); }
.task-card .task-title { font-weight: 600; font-size: 0.92rem; }
.task-card .task-type-tag { font-size: 0.75rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; }

/* Chart rendering */
.chart-preview { margin: 16px 0; }

.chart-wrap {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 14px;
    margin-bottom: 12px;
}

.chart-title { font-weight: 600; font-size: 0.9rem; text-align: center; margin-bottom: 8px; }

.chart-svg { width: 100%; height: auto; }
.grid-line { stroke: var(--border); stroke-width: 1; }
.axis-label { font-size: 8px; fill: var(--muted); }
.axis-title { font-size: 8px; fill: var(--muted); }
.legend-text { font-size: 8px; fill: var(--text); }
.line-series { fill: none; stroke-width: 2; }
.pie-label { font-size: 9px; fill: var(--text); font-weight: 600; }

.pie-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
}

.pie-cell { text-align: center; }
.pie-cell-title { font-size: 0.8rem; font-weight: 600; margin-bottom: 4px; }
.pie-svg { width: 100%; max-width: 160px; }

.pie-legend { text-align: left; font-size: 0.75rem; margin-top: 6px; }
.pie-legend-item { display: flex; align-items: center; gap: 6px; margin-bottom: 2px; }
.swatch { width: 9px; height: 9px; border-radius: 2px; display: inline-block; flex-shrink: 0; }

.data-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; margin-bottom: 10px; }
.data-table th, .data-table td { border: 1px solid var(--border); padding: 6px 10px; text-align: right; }
.data-table th:first-child, .data-table td:first-child { text-align: left; }
.data-table th { background: var(--bg); }
.table-caption { font-size: 0.8rem; font-weight: 600; margin: 8px 0 4px; }

.process-stage-label { font-weight: 600; font-size: 0.85rem; margin: 10px 0 6px; color: var(--primary); }
.process-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-bottom: 8px; }
.process-box {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 8px 10px;
    font-size: 0.8rem;
    flex: 1 1 100px;
    min-width: 90px;
}
.step-num {
    display: inline-block;
    background: var(--primary);
    color: #fff;
    border-radius: 50%;
    width: 16px;
    height: 16px;
    text-align: center;
    line-height: 16px;
    font-size: 0.7rem;
    margin-right: 6px;
}
.process-arrow { color: var(--muted); font-size: 1rem; }

.floorplan-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.floorplan-title { font-weight: 600; font-size: 0.8rem; margin-bottom: 6px; text-align: center; }
.floorplan-box { border: 1px solid var(--border); border-radius: 6px; padding: 8px; background: var(--bg); }
.floorplan-room {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 5px 8px;
    font-size: 0.75rem;
    margin-bottom: 4px;
}

/* Access gate / paywall */
.access-status-line {
    text-align: center;
    color: var(--muted);
    font-size: 0.85rem;
    margin-bottom: 16px;
}

.access-gate {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
}

.access-gate h3 { margin-top: 0; color: var(--primary); }
.access-gate-note { color: var(--muted); font-size: 0.9rem; }

.profile-header-row { display: flex; align-items: center; gap: 16px; margin-bottom: 12px; }
.profile-current-avatar { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; box-shadow: var(--shadow-sm); flex-shrink: 0; }

.avatar-picker { display: flex; flex-wrap: wrap; gap: 14px; }
.avatar-picker-form { margin: 0; }
.avatar-picker-item {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    padding: 0;
    border: 3px solid transparent;
    cursor: pointer;
    background: none;
    overflow: hidden;
    transition: border-color 0.15s var(--ease), transform 0.15s var(--ease);
}
.avatar-picker-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar-picker-item:hover { transform: scale(1.05); }
.avatar-picker-item.selected { border-color: var(--primary); }
.access-gate input[type=email], .access-gate input[type=text], .access-gate input[type=file] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    margin-bottom: 10px;
}

.access-gate .task-picker-toggle { margin-left: 10px; }

.paywall-card {
    background: var(--bg);
    border-radius: 8px;
    padding: 14px 18px;
    margin: 14px 0;
    text-align: center;
}

.paywall-card-number {
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: var(--primary);
    margin-top: 4px;
}

/* ---------- Auth pages (split panel) ---------- */
.auth-page {
    display: flex;
    min-height: 100vh;
    background: var(--card);
}

.auth-panel-left {
    flex: 1 1 45%;
    background: linear-gradient(160deg, var(--primary) 0%, #0f2d40 100%);
    color: #fff;
    padding: 48px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 24px;
}

.auth-brand {
    font-weight: 700;
    font-size: 1.3rem;
    display: inline-flex;
    background: #fff;
    padding: 10px 18px;
    border-radius: 10px;
}

.auth-brand .brand-logo { height: 32px; }

.auth-headline {
    font-size: 1.9rem;
    font-weight: 700;
    line-height: 1.3;
}

.auth-headline .accent { color: #f6c453; }

.auth-stat-row {
    display: flex;
    align-items: center;
    gap: 16px;
}

.auth-stat-box {
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 10px;
    padding: 14px 20px;
    text-align: center;
}

.auth-stat-box .label { font-size: 0.7rem; letter-spacing: 0.08em; text-transform: uppercase; opacity: 0.7; }
.auth-stat-box .value { font-size: 1.6rem; font-weight: 700; }
.auth-stat-arrow { color: rgba(255,255,255,0.6); font-size: 1.2rem; }

.auth-footnote { font-size: 0.85rem; opacity: 0.75; }

.auth-panel-right {
    flex: 1 1 55%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px;
    position: relative;
}

.auth-form-card { width: 100%; max-width: 400px; }
.auth-form-card h1 { margin-bottom: 4px; }
.auth-form-card .subtitle { color: var(--muted); margin-bottom: 12px; }

.spam-notice {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    background: #fff8e6;
    border: 1px solid #f3dfa0;
    border-radius: var(--radius);
    padding: 14px 16px;
    margin-bottom: 24px;
    font-size: 13.5px;
    line-height: 1.5;
}
.spam-notice-icon { font-size: 18px; line-height: 1; flex-shrink: 0; }
.spam-notice-title { display: block; color: var(--text); margin-bottom: 2px; }
.spam-notice span { color: var(--muted); }
.spam-notice span strong { color: var(--text); }

.locale-switcher { display: flex; gap: 2px; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 3px; }
.locale-switcher .locale-opt { padding: 4px 9px; border-radius: 6px; font-size: 12px; font-weight: 600; color: var(--muted); text-decoration: none; letter-spacing: 0.02em; }
.locale-switcher .locale-opt:hover { color: var(--text); }
.locale-switcher .locale-opt.active { background: var(--card); color: var(--primary); box-shadow: var(--shadow-sm); }

.auth-locale-switcher { position: absolute; top: 24px; right: 24px; }
.dash-topbar .locale-switcher { margin-right: 14px; }
.dash-topbar-right { display: flex; align-items: center; }

.auth-form-card label { margin-top: 14px; }
.auth-form-card label:first-of-type { margin-top: 0; }

.auth-name-row { display: flex; gap: 12px; }
.auth-name-row > div { flex: 1; }

.auth-role-row { display: flex; gap: 10px; margin-top: 6px; }
.auth-role-option {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    margin-top: 0 !important;
    transition: border-color 0.15s var(--ease), background 0.15s var(--ease);
}
.auth-role-option:has(input:checked) { border-color: var(--primary); background: var(--bg); color: var(--primary); }
.auth-role-option input { margin: 0; }
.auth-role-note { margin: 6px 0 0; font-size: 0.78rem; color: var(--muted); }

.auth-form-card .btn { width: 100%; }

.auth-forgot-link { text-align: right; margin-top: 8px; }
.auth-forgot-link a { font-size: 0.85rem; color: var(--muted); text-decoration: none; }
.auth-forgot-link a:hover { color: var(--primary); text-decoration: underline; }

.auth-switch { text-align: center; margin-top: 20px; color: var(--muted); font-size: 0.9rem; }

@media (max-width: 800px) {
    .auth-page { flex-direction: column; }
    .auth-panel-left { flex: none; padding: 32px; }
}

@media (max-width: 480px) {
    .auth-panel-left { padding: 24px 20px; }
    .auth-panel-right { padding: 24px 20px; }
    .auth-headline { font-size: 1.5rem; }
    .auth-stat-row { flex-wrap: wrap; }
    .auth-name-row { flex-direction: column; gap: 0; }
}

/* ---------- Dashboard shell ---------- */
.dash-layout { display: flex; min-height: 100vh; }

.dash-sidebar {
    width: 240px;
    flex-shrink: 0;
    background: var(--card);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 24px 16px;
}

.dash-sidebar .brand { display: block; margin-bottom: 28px; padding: 0 8px; font-size: 1.15rem; }

.dash-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    border-radius: 9px;
    color: var(--text);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.93rem;
    margin-bottom: 3px;
    transition: background 0.15s var(--ease), color 0.15s var(--ease);
}

.nav-icon-badge {
    width: 28px;
    height: 28px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    opacity: 0.88;
    transition: opacity 0.15s var(--ease), transform 0.15s var(--ease);
}

.dash-nav a:hover { background: var(--bg); }
.dash-nav a:hover .nav-icon-badge { opacity: 1; transform: scale(1.05); }
.dash-nav a.active { background: var(--primary); color: #fff; box-shadow: var(--shadow-sm); }
.dash-nav a.active .nav-icon-badge { opacity: 1; box-shadow: 0 2px 6px rgba(0,0,0,0.2); }

.nav-divider { height: 1px; background: var(--border); margin: 10px 8px; }

.nav-section-label {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
    padding: 0 14px;
    margin-bottom: 6px;
}

.nav-coach-initials {
    background: linear-gradient(135deg, var(--accent), #c96548);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 8px;
    font-weight: 800;
}

.nav-coach-badge { margin-left: auto; width: 8px; height: 8px; border-radius: 50%; background: #d1495b; flex-shrink: 0; }

.nav-badge {
    margin-left: auto;
    background: linear-gradient(135deg, #7c4dff, #6d3fc0);
    color: #fff;
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    padding: 2px 6px;
    border-radius: 999px;
    line-height: 1.4;
}
.nav-coach-link.active .nav-badge { background: rgba(255,255,255,0.25); }
.dash-nav .label { display: inline; }

.dash-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 28px;
    border-bottom: 1px solid var(--border);
    background: var(--card);
}

.dash-topbar-title { font-weight: 700; color: var(--text); font-size: 1.05rem; }

.dash-user { display: flex; align-items: center; gap: 12px; }
.dash-user-link { display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; padding: 4px 6px; border-radius: 8px; transition: background 0.15s var(--ease); }
.dash-user-link:hover, .dash-user-link.active { background: var(--bg); }
.dash-user-name { font-size: 0.9rem; font-weight: 500; }

.dash-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), #c96548);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    flex-shrink: 0;
    box-shadow: var(--shadow-sm);
    object-fit: cover;
}

.dash-logout-btn {
    background: none;
    border: none;
    color: var(--muted);
    cursor: pointer;
    font-size: 0.85rem;
    padding: 6px 4px;
    transition: color 0.15s var(--ease);
}

.dash-logout-btn:hover { color: var(--primary); }

.dash-main { flex: 1; min-width: 0; }
.dash-content { max-width: 900px; margin: 0 auto; padding: 32px 28px; }

.promo-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, #eaf2f8, #f5eefb);
    border: 1px solid #cfe3f0;
    border-radius: var(--radius);
    padding: 16px 22px;
    margin-bottom: 28px;
    flex-wrap: wrap;
    gap: 12px;
    box-shadow: var(--shadow-sm);
}

.promo-banner .msg { font-weight: 600; color: var(--primary); }
.promo-banner .msg .sub { font-weight: 400; color: var(--muted); font-size: 0.85rem; display: block; }

.promo-ad {
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 28px;
    background: linear-gradient(120deg, var(--primary) 0%, #2c5f82 45%, var(--report) 100%);
    border-radius: 18px;
    padding: 30px 34px;
    margin-bottom: 28px;
    color: #fff;
    box-shadow: 0 10px 30px rgba(27, 73, 101, 0.28);
}

.promo-ad::before, .promo-ad::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
}

.promo-ad::before { width: 260px; height: 260px; top: -120px; right: -60px; }
.promo-ad::after { width: 160px; height: 160px; bottom: -90px; right: 160px; background: rgba(255, 255, 255, 0.06); }

.promo-ad-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 5px 12px;
    border-radius: 999px;
    margin-bottom: 14px;
}

.promo-ad-main { position: relative; z-index: 1; max-width: 560px; }

.promo-ad-headline { font-size: 1.55rem; font-weight: 800; line-height: 1.25; margin: 0 0 6px; }
.promo-ad-headline .price { color: #ffd76a; }

.promo-ad-trials { font-size: 0.85rem; color: rgba(255, 255, 255, 0.75); margin: 0 0 16px; }

.promo-ad-features { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 7px; }

.promo-ad-features li { display: flex; align-items: center; gap: 9px; font-size: 0.92rem; color: rgba(255, 255, 255, 0.94); }
.promo-ad-features li .check {
    display: flex; align-items: center; justify-content: center;
    width: 18px; height: 18px; border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    font-size: 0.7rem; flex-shrink: 0;
}

.promo-ad-cta {
    position: relative; z-index: 1;
    display: flex; flex-direction: column; align-items: center; gap: 10px;
    flex-shrink: 0;
}

.promo-ad-cta a.btn {
    margin: 0;
    background: #fff;
    color: var(--primary);
    padding: 14px 30px;
    font-size: 1.02rem;
    border-radius: 12px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
    white-space: nowrap;
    transition: transform 0.15s var(--ease), box-shadow 0.15s var(--ease);
}

.promo-ad-cta a.btn:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(0, 0, 0, 0.22); }
.promo-ad-cta .note { font-size: 0.72rem; color: rgba(255, 255, 255, 0.65); }

@media (max-width: 640px) {
    .promo-ad { flex-direction: column; align-items: flex-start; text-align: left; padding: 26px 22px; }
    .promo-ad-cta { align-items: flex-start; width: 100%; }
    .promo-ad-cta a.btn { width: 100%; text-align: center; }
}


.dash-menu-btn { display: none; }

@media (max-width: 768px) {
    .dash-layout { flex-direction: column; }

    .dash-menu-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 36px;
        height: 36px;
        border: none;
        background: transparent;
        color: var(--text);
        border-radius: 8px;
        cursor: pointer;
        flex-shrink: 0;
    }
    .dash-menu-btn:active { background: var(--bg); }

    .dash-topbar-left { display: flex; align-items: center; gap: 10px; }

    .dash-sidebar-backdrop {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(15, 25, 35, 0.45);
        z-index: 199;
        opacity: 0;
        transition: opacity 0.2s var(--ease);
    }
    .dash-sidebar-backdrop.open { display: block; opacity: 1; }

    .dash-sidebar {
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        width: 260px;
        max-width: 82vw;
        z-index: 200;
        transform: translateX(-100%);
        transition: transform 0.25s var(--ease);
        box-shadow: 4px 0 24px rgba(20,40,60,0.15);
        overflow-y: auto;
        padding-top: calc(24px + env(safe-area-inset-top));
    }
    .dash-sidebar.open { transform: translateX(0); }

    .dash-sidebar .brand { display: block; }

    body.sidebar-open { overflow: hidden; }

    .dash-main { padding-bottom: 0; }

    .dash-topbar { padding: 12px 16px; }
    .dash-user-name { display: none; }
    .dash-content { padding: 20px 16px; }
}

.activity-list { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }

.activity-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 18px;
    border-bottom: 1px solid var(--border);
    text-decoration: none;
    color: var(--text);
}

.activity-row:last-child { border-bottom: none; }
.activity-row:hover { background: var(--bg); }
.activity-row .type-tag { font-size: 0.75rem; color: var(--muted); text-transform: uppercase; }
.activity-row .band-tag { font-weight: 700; color: var(--accent); }

.empty-state { color: var(--muted); padding: 24px; text-align: center; }

.reports-table { width: 100%; border-collapse: collapse; }
.reports-table th, .reports-table td { padding: 10px 14px; border-bottom: 1px solid var(--border); text-align: left; font-size: 0.9rem; }
.reports-table th { color: var(--muted); font-size: 0.78rem; text-transform: uppercase; }

/* ---------- Task library ---------- */
.lib-tabs {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 24px;
    overflow-x: auto;
}

.lib-tab {
    padding: 10px 18px;
    border: none;
    background: none;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--muted);
    cursor: pointer;
    border-bottom: 2.5px solid transparent;
    white-space: nowrap;
    transition: color 0.15s var(--ease), border-color 0.15s var(--ease);
}

.lib-tab:hover { color: var(--text); }
.lib-tab.active { color: var(--report); border-color: var(--report); }

.lib-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
}

.lib-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    position: relative;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.2s var(--ease), transform 0.2s var(--ease);
}

.lib-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }

.lib-card-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    margin-bottom: 12px;
    font-size: 1rem;
}

.lib-card-title { font-weight: 700; font-size: 0.95rem; margin-bottom: 6px; line-height: 1.3; }

.lib-card-tag {
    display: inline-block;
    background: var(--report-light);
    color: var(--report);
    font-size: 0.72rem;
    font-weight: 600;
    padding: 2px 10px;
    border-radius: 999px;
    margin-bottom: 14px;
}

.lib-card-footer { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; }
.lib-card-status { font-size: 0.8rem; color: var(--muted); }

.lib-card-start {
    display: inline-block;
    background: var(--card);
    border: 1.5px solid var(--report);
    color: var(--report);
    padding: 7px 16px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.85rem;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.15s var(--ease), color 0.15s var(--ease);
}

.lib-card-start:hover { background: var(--report); color: #fff; }

.lib-card-status-active { color: var(--report); font-weight: 600; }

.lib-card-actions { display: flex; align-items: center; gap: 8px; }

.lib-card-restart {
    background: none;
    border: none;
    color: var(--muted);
    padding: 7px 4px;
    font-weight: 600;
    font-size: 0.8rem;
    cursor: pointer;
    text-decoration: underline;
}

.lib-card-restart:hover { color: var(--text); }

.lib-card-delete {
    position: absolute;
    top: 12px;
    right: 12px;
    background: none;
    border: none;
    color: var(--muted);
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    padding: 4px;
}

.lib-card-delete:hover { color: #b3261e; }

.lib-add-card {
    border: 1.5px dashed var(--border);
    border-radius: var(--radius);
    padding: 18px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    color: var(--muted);
    min-height: 150px;
    background: none;
    text-align: center;
    transition: border-color 0.15s var(--ease), color 0.15s var(--ease);
}

.lib-add-card:hover { border-color: var(--report); color: var(--report); }
.lib-add-card .plus-circle {
    width: 36px; height: 36px; border-radius: 50%;
    background: var(--bg); display: flex; align-items: center; justify-content: center;
    font-size: 1.3rem; font-weight: 400;
}

.lib-empty {
    grid-column: 1 / -1;
    text-align: center;
    color: var(--muted);
    padding: 40px 20px;
}

/* Modal */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(20,30,45,0.45);
    z-index: 200;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-overlay.open { display: flex; }

.modal-box {
    background: var(--card);
    border-radius: var(--radius);
    padding: 28px;
    max-width: 480px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    position: relative;
}

.modal-close {
    position: absolute;
    top: 16px; right: 16px;
    background: none; border: none;
    font-size: 1.3rem; color: var(--muted); cursor: pointer;
}

.modal-box h2 { margin-top: 0; text-align: center; }

.support-fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-lg);
    cursor: pointer;
    z-index: 150;
    transition: transform 0.15s var(--ease);
}
.support-fab:hover { transform: scale(1.06); }

.support-fab-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #d1495b;
    border: 2px solid #fff;
}

.support-subtitle { color: var(--muted); margin-top: -8px; text-align: center; font-size: 0.9rem; }

.support-modal .modal-box textarea { min-height: 80px; resize: vertical; margin-top: 6px; }

.support-thread {
    max-height: 260px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 16px 0;
    padding-right: 4px;
}

.support-msg-you, .support-msg-reply {
    max-width: 88%;
    padding: 8px 12px;
    font-size: 0.88rem;
    line-height: 1.4;
    word-wrap: break-word;
}

.support-msg-you {
    align-self: flex-end;
    background: var(--primary);
    color: #fff;
    border-radius: 12px 12px 2px 12px;
}

.support-msg-reply {
    align-self: flex-start;
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 12px 12px 12px 2px;
}

.support-msg-pending {
    align-self: flex-start;
    color: var(--muted);
    font-size: 0.78rem;
    font-style: italic;
    padding: 0 4px;
}

.support-msg-time {
    display: block;
    font-size: 0.68rem;
    opacity: 0.75;
    margin-top: 3px;
}

.support-empty { color: var(--muted); font-size: 0.9rem; text-align: center; padding: 16px 0; }

/* ---------- Exam page ---------- */
.exam-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.exam-back {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 12px;
    cursor: pointer;
    color: var(--text);
    text-decoration: none;
}

.exam-title { font-weight: 700; font-size: 1.1rem; }
.exam-timer {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 8px 16px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.exam-timer.low { color: #b3261e; border-color: #f3c6c2; background: #fdeeed; }

.exam-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    align-items: start;
}

.exam-col-title { font-weight: 700; margin-bottom: 10px; }

.exam-task-panel {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    max-height: 65vh;
    overflow-y: auto;
    box-shadow: var(--shadow-sm);
}

.exam-answer-panel { display: flex; flex-direction: column; }
.exam-answer-panel textarea { min-height: 55vh; }

.exam-help-btn {
    background: linear-gradient(135deg, var(--report), #b23fa0);
    color: #fff;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.82rem;
    cursor: pointer;
    margin-bottom: 10px;
    align-self: flex-end;
}

.exam-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 10px;
}

.exam-wordcount { color: var(--muted); font-size: 0.85rem; }

@media (max-width: 800px) {
    .exam-columns { grid-template-columns: 1fr; }
    .exam-task-panel { max-height: none; }
}

/* ---------- Full-screen exam page (no dashboard sidebar) ---------- */
.fullscreen-body { margin: 0; background: var(--bg); height: 100vh; overflow: hidden; }

.fullscreen-gate {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 40px 20px;
    gap: 22px;
    text-align: center;
}

.btn-secondary-link { color: var(--muted); text-decoration: none; font-weight: 600; }
.btn-secondary-link:hover { color: var(--primary); }

.exam-fs { display: flex; flex-direction: column; height: 100vh; }

.exam-fs-topbar {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 12px 24px;
    background: var(--card);
    border-bottom: 1px solid var(--border);
}

.exam-fs-topbar .exam-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.exam-fs-body {
    flex: 1 1 auto;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1px;
    background: var(--border);
    overflow: hidden;
    min-height: 0;
}

.exam-fs-col { display: flex; flex-direction: column; min-height: 0; background: var(--card); overflow: hidden; }

.exam-fs-col-title {
    flex: 0 0 auto;
    padding: 10px 28px;
    font-weight: 700;
    font-size: 0.8rem;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: var(--muted);
    background: var(--bg);
    border-bottom: 1px solid var(--border);
}

.exam-fs-panel { flex: 1 1 auto; overflow-y: auto; padding: 26px 32px; }

.exam-fs .exam-part-nav {
    flex: 0 0 auto;
    margin-top: 0;
    border-radius: 0;
    border-left: 0;
    border-right: 0;
    border-bottom: 0;
    box-shadow: 0 -2px 8px rgba(20,40,60,0.06);
    position: static;
}

.fullscreen-result { max-width: 860px; margin: 40px auto; padding: 0 20px 60px; }

.exam-fs .loading,
.exam-fs .error-msg {
    position: fixed;
    left: 50%;
    bottom: 100px;
    transform: translateX(-50%);
    z-index: 50;
    box-shadow: var(--shadow-lg);
    margin-top: 0;
}
.exam-fs .loading[style*="block"] { display: block; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 20px; }

.passage-illustration {
    width: 100%;
    max-height: 220px;
    object-fit: cover;
    border-radius: var(--radius);
    margin-bottom: 22px;
    display: block;
    box-shadow: var(--shadow-sm);
}

@media (max-width: 900px) {
    .fullscreen-body { height: auto; overflow: visible; }
    .exam-fs { height: auto; }
    .exam-fs-body { grid-template-columns: 1fr; }
    .exam-fs-panel { max-height: 60vh; }
    .exam-fs-topbar { flex-wrap: wrap; }
}

/* ---------- Reading / Listening exam ---------- */
.passage-banner {
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    border-radius: 11px 11px 0 0;
    margin: -20px -20px 20px;
    padding: 14px 20px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--muted);
}

.exam-fs-panel .passage-banner { margin: -26px -32px 20px; padding: 14px 32px; border-radius: 0; }

.reading-passage p { margin: 0 0 20px; line-height: 1.75; }
.reading-passage p:last-child { margin-bottom: 0; }
.reading-passage .para-letter { font-weight: 700; color: var(--report); margin-right: 6px; }

.question-group { margin-bottom: 36px; }
.question-group:last-child { margin-bottom: 0; }
.question-group-range { font-weight: 700; color: var(--report); font-size: 0.98rem; margin-bottom: 6px; }
.question-group-instructions { font-size: 0.87rem; color: var(--muted); margin-bottom: 18px; line-height: 1.6; }

.heading-bank { background: var(--bg); border: 1px solid var(--border); border-radius: 12px; padding: 16px 20px; margin-bottom: 20px; font-size: 0.87rem; }
.heading-bank-title { font-weight: 700; color: var(--text); margin-bottom: 10px; }
.heading-bank ol { margin: 0; padding-left: 0; list-style: none; }
.heading-bank li { margin-bottom: 8px; line-height: 1.5; }
.heading-bank li:last-child { margin-bottom: 0; }
.heading-bank li strong { color: var(--report); margin-right: 4px; }

.q-row { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 22px; }
.q-row:last-child { margin-bottom: 0; }
.q-num { flex-shrink: 0; width: 28px; height: 28px; border-radius: 50%; background: var(--report-light); color: var(--report); font-size: 0.82rem; font-weight: 700; display: flex; align-items: center; justify-content: center; margin-top: 1px; }
.q-body { flex: 1; min-width: 0; }
.q-text { font-size: 0.94rem; margin-bottom: 10px; line-height: 1.5; }
.q-select {
    width: 100%;
    max-width: 320px;
    padding: 11px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 0.9rem;
    background: var(--card);
    color: var(--text);
    cursor: pointer;
    transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.q-select:hover { border-color: var(--primary-light); }
.q-select:focus { outline: none; border-color: var(--report); box-shadow: 0 0 0 3px var(--report-light); }

.q-mc-options { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.q-mc-option { display: flex; align-items: center; gap: 9px; font-size: 0.9rem; cursor: pointer; line-height: 1.4; }
.q-mc-option input { accent-color: var(--report); width: 16px; height: 16px; flex-shrink: 0; }

.q-fill-inline { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 8px; font-size: 0.94rem; line-height: 2; }
.q-fill-inline input { border: none; border-bottom: 2px solid var(--report-border); background: transparent; padding: 3px 6px; font-size: 0.94rem; width: 150px; color: var(--text); transition: border-color 0.15s var(--ease); }
.q-fill-inline input:focus { outline: none; border-bottom-color: var(--report); }

.multi-select-group { background: var(--bg); border: 1px solid var(--border); border-radius: 12px; padding: 18px 20px; }
.multi-select-title { font-size: 0.87rem; font-weight: 600; color: var(--text); margin-bottom: 14px; }
.multi-select-group .q-mc-option { margin-bottom: 10px; }
.multi-select-group .q-mc-option:last-child { margin-bottom: 0; }

.exam-part-nav {
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 18px;
    margin-top: 20px;
    position: sticky;
    bottom: 12px;
    box-shadow: var(--shadow-md);
}

.exam-part-nav-tabs { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.part-tab { display: flex; align-items: center; gap: 6px; padding: 7px 16px; border-radius: 999px; border: 1px solid var(--border); background: var(--bg); cursor: pointer; font-weight: 600; font-size: 0.85rem; color: var(--text); transition: background 0.15s var(--ease), border-color 0.15s var(--ease); }
.part-tab:hover { border-color: var(--primary-light); }
.part-tab.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.part-tab .count { font-size: 0.72rem; font-weight: 400; color: var(--muted); }
.part-tab.active .count { color: rgba(255,255,255,0.75); }

.q-pill-row { display: flex; gap: 6px; flex-wrap: wrap; padding-top: 10px; border-top: 1px solid var(--border); }
.q-pill { width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 0.75rem; font-weight: 600; background: var(--bg); border: 1px solid var(--border); color: var(--muted); cursor: pointer; transition: background 0.15s var(--ease), border-color 0.15s var(--ease); }
.q-pill:hover { border-color: var(--primary-light); }
.q-pill.answered { background: var(--report-light); border-color: var(--report-border); color: var(--report); }

.reading-result-summary { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }
.reading-review-item { padding: 14px 18px; border-radius: 10px; margin-bottom: 10px; border: 1px solid var(--border); }
.reading-review-item.correct { background: #f0f9f2; border-color: #cfe8d4; }
.reading-review-item.incorrect { background: #fdeeed; border-color: #f3c6c2; }
.reading-review-num { font-weight: 700; margin-right: 8px; }
.reading-review-answer { font-size: 0.87rem; color: var(--muted); margin-top: 6px; line-height: 1.5; }
.listening-solution { font-size: 0.85rem; color: var(--text); background: var(--report-light); border: 1px solid var(--report-border); border-radius: 8px; padding: 10px 12px; margin-top: 10px; line-height: 1.55; }
.listening-solution strong { color: var(--report); }

@media (max-width: 800px) {
    .exam-part-nav { position: static; }
}

/* ---------- Listening exam ---------- */
.listening-audio-note-bar {
    background: var(--report-light);
    color: var(--report);
    border: 1px solid var(--report-border);
    border-radius: var(--radius);
    padding: 12px 18px;
    margin-bottom: 20px;
    font-size: 0.83rem;
    line-height: 1.4;
}

.listening-task-panel { max-height: none; overflow: visible; }

.listening-part-section { margin-bottom: 44px; }
.listening-part-section:last-child { margin-bottom: 0; }
.listening-part-intro { font-size: 0.87rem; color: var(--muted); margin: -14px 0 20px; line-height: 1.5; }

.listening-segment { margin-bottom: 28px; }
.listening-segment-audio {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 16px;
    margin-bottom: 18px;
    position: sticky;
    top: 0;
    z-index: 5;
    box-shadow: var(--shadow-sm);
}
.listening-segment-audio audio { width: 100%; }

.lf-form, .lf-flowchart {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 18px 20px;
    margin-bottom: 20px;
    font-size: 0.92rem;
    line-height: 2;
}
.lf-form-title { font-weight: 700; margin-bottom: 10px; color: var(--text); }

.lf-table-wrap { overflow-x: auto; margin-bottom: 20px; border: 1px solid var(--border); border-radius: 12px; }
.lf-table { width: 100%; border-collapse: collapse; font-size: 0.87rem; }
.lf-table th, .lf-table td { padding: 12px 14px; border-bottom: 1px solid var(--border); text-align: left; line-height: 1.6; }
.lf-table th { background: var(--bg); font-weight: 700; white-space: nowrap; }
.lf-table tr:last-child td { border-bottom: none; }

.q-fill-blank-inline {
    border: none;
    border-bottom: 2px solid var(--report-border);
    background: var(--card);
    padding: 2px 6px;
    font-size: 0.92rem;
    width: 130px;
    color: var(--text);
    transition: border-color 0.15s var(--ease);
}
.q-fill-blank-inline:focus { outline: none; border-bottom-color: var(--report); }

.lf-flowchart-stage { margin-bottom: 4px; }
.lf-flowchart-heading { font-weight: 700; color: var(--report); margin-bottom: 6px; }
.lf-flowchart-lines { margin: 0 0 10px; padding-left: 20px; }
.lf-flowchart-lines li { margin-bottom: 4px; }
.lf-flowchart-arrow { text-align: center; color: var(--muted); font-size: 1.1rem; margin: 2px 0; }

.lf-diagram-image { display: block; max-width: 100%; height: auto; border: 1px solid var(--border); border-radius: 12px; margin-bottom: 16px; background: #fff; }

.lf-diagram { background: var(--bg); border: 1px solid var(--border); border-radius: 12px; padding: 16px 20px; margin-bottom: 20px; }
.lf-diagram-row { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px dashed var(--border); flex-wrap: wrap; }
.lf-diagram-row:last-child { border-bottom: none; }
.lf-diagram-floor { flex-shrink: 0; width: 90px; font-weight: 700; font-size: 0.82rem; color: var(--muted); }
.lf-diagram-cells { display: flex; gap: 8px; flex-wrap: wrap; }
.lf-diagram-cell { background: var(--card); border: 1px solid var(--border); border-radius: 8px; padding: 6px 12px; font-size: 0.82rem; }

@media (max-width: 800px) {
    .listening-segment-audio { position: static; }
}

/* ---------- Speaking guided flow ---------- */
.flow-progress {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 32px;
}

.flow-dot {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--bg);
    color: var(--muted);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.flow-dot.done, .flow-dot.current { background: var(--report); color: #fff; }
.flow-line { width: 40px; height: 2px; background: var(--border); flex-shrink: 0; }
.flow-line.done { background: var(--report); }

.flow-card {
    max-width: 560px;
    margin: 0 auto;
    text-align: center;
}

.flow-question-box {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    text-align: left;
    margin-bottom: 32px;
    box-shadow: var(--shadow-sm);
}

.flow-question-box .qnum { font-weight: 700; margin-bottom: 6px; color: var(--muted); font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.03em; }
.flow-part-label { display: inline-block; background: var(--report-light); color: var(--report); font-weight: 700; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.03em; padding: 3px 10px; border-radius: 999px; margin-bottom: 8px; }
.flow-question-box .qtext { font-size: 1.02rem; white-space: pre-line; }

.mic-btn {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: #eef2fb;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    margin: 0 auto 16px;
    transition: background 0.2s var(--ease), transform 0.2s var(--ease);
    box-shadow: var(--shadow-sm);
}

.mic-btn:hover { transform: scale(1.04); }
.mic-btn.recording {
    background: linear-gradient(135deg, var(--report-light), var(--primary-light));
    animation: pulse 1.4s infinite;
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(109,63,192,0.25); }
    50% { box-shadow: 0 0 0 14px rgba(109,63,192,0); }
}

.flow-hint { color: var(--text); font-weight: 500; margin-bottom: 6px; }
.flow-status { color: var(--muted); margin-bottom: 6px; }

.flow-timer {
    display: inline-block;
    background: var(--bg);
    border-radius: 999px;
    padding: 6px 16px;
    font-weight: 700;
    margin-bottom: 24px;
}

.flow-secondary-btn {
    background: linear-gradient(135deg, var(--report), #b23fa0);
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.88rem;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
}

.flow-instructions {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    text-align: left;
    margin-bottom: 20px;
}

.flow-instructions li { margin-bottom: 8px; }

.flow-mic-check {
    background: var(--report-light);
    border-radius: var(--radius);
    padding: 20px;
    text-align: left;
    margin-bottom: 24px;
}

.flow-mic-check-title { font-weight: 700; margin-bottom: 4px; }
.flow-mic-check-sub { color: var(--muted); font-size: 0.88rem; margin-bottom: 12px; }

.flow-processing {
    text-align: center;
    padding: 60px 20px;
}

.flow-processing h2 { color: var(--report); }

.processing-icon {
    width: 90px;
    height: 90px;
    margin: 30px auto;
    position: relative;
}

.processing-icon .center {
    position: absolute;
    inset: 20px;
    background: var(--report-light);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--report);
    font-size: 1.6rem;
    animation: spin-slow 3s linear infinite;
}

@keyframes spin-slow {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.progress-bar-track {
    background: var(--bg);
    border-radius: 999px;
    height: 8px;
    max-width: 340px;
    margin: 20px auto 0;
    overflow: hidden;
}

.progress-bar-fill {
    background: var(--report);
    height: 100%;
    border-radius: 999px;
    transition: width 0.3s var(--ease);
    width: 0%;
}
.reports-table tr:hover { background: var(--bg); cursor: pointer; }

/* ---------- IELTS Coach ---------- */
.coach-layout {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 20px;
    height: calc(100vh - 140px);
    min-height: 560px;
}

.coach-sidebar {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 22px 18px;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.coach-sidebar-header { text-align: center; margin-bottom: 22px; }
.coach-avatar-lg {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 12px;
    box-shadow: 0 6px 16px rgba(109,63,192,0.3);
    flex-shrink: 0;
}
.coach-avatar-lg img { width: 100%; height: 100%; object-fit: cover; }

.nav-coach-icon { width: 20px; height: 20px; border-radius: 50%; flex-shrink: 0; object-fit: cover; }
.coach-sidebar-header h3 { margin: 0 0 4px; font-size: 1.05rem; }
.coach-sidebar-header p { margin: 0; font-size: 0.82rem; color: var(--muted); }
.coach-credential { margin-top: 6px !important; font-size: 0.72rem !important; opacity: 0.75; }

.coach-stats { display: flex; flex-direction: column; gap: 4px; margin-bottom: 20px; }
.coach-stat-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 8px;
    border-radius: 10px;
    transition: background 0.15s var(--ease);
}
.coach-stat-card:hover { background: var(--bg); }
.coach-stat-icon {
    width: 32px;
    height: 32px;
    border-radius: 9px;
    color: #fff;
    font-weight: 700;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.coach-stat-info { flex: 1; min-width: 0; }
.coach-stat-label { font-size: 0.85rem; font-weight: 600; }
.coach-stat-sub { font-size: 0.72rem; color: var(--muted); }
.coach-stat-band { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.coach-stat-band-value { font-size: 1rem; font-weight: 800; color: var(--report); }
.coach-stat-band-empty { font-size: 1rem; font-weight: 800; color: var(--border); }
.coach-stat-trend { font-size: 0.85rem; font-weight: 800; }
.coach-stat-trend.up { color: #2e9c5b; }
.coach-stat-trend.down { color: #d1495b; }

.coach-recommended { margin-bottom: 18px; }

.coach-recommend-card {
    background: var(--report-light);
    border: 1px solid var(--report-border);
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 8px;
}
.coach-recommend-title { font-weight: 700; font-size: 0.85rem; margin-bottom: 4px; color: var(--text); }
.coach-recommend-note { font-size: 0.76rem; color: var(--muted); line-height: 1.4; margin-bottom: 10px; }
.coach-recommend-empty, .coach-recommend-locked { font-size: 0.8rem; color: var(--muted); line-height: 1.4; margin-bottom: 10px; }

.coach-recommend-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.coach-recommend-start {
    display: inline-block;
    background: var(--report);
    color: #fff;
    text-decoration: none;
    font-size: 0.78rem;
    font-weight: 600;
    padding: 7px 12px;
    border-radius: 8px;
}
.coach-recommend-start:hover { background: #5a2fa8; }
.coach-recommend-refresh, .coach-recommend-generate {
    background: transparent;
    border: 1px solid var(--report-border);
    color: var(--report);
    font-size: 0.78rem;
    font-weight: 600;
    padding: 7px 12px;
    border-radius: 8px;
    cursor: pointer;
}
.coach-recommend-refresh:hover, .coach-recommend-generate:hover { background: rgba(109, 63, 192, 0.08); }
.coach-recommend-refresh:disabled, .coach-recommend-generate:disabled { opacity: 0.6; cursor: not-allowed; }
.coach-recommend-generate { width: 100%; }

.coach-suggestions { margin-bottom: 16px; }
.coach-suggestions-title { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); margin-bottom: 10px; padding: 0 4px; }
.coach-suggestion-chip {
    display: block;
    width: 100%;
    text-align: left;
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 9px 12px;
    border-radius: 10px;
    font-size: 0.8rem;
    line-height: 1.4;
    margin-bottom: 8px;
    cursor: pointer;
    transition: border-color 0.15s var(--ease), background 0.15s var(--ease);
}
.coach-suggestion-chip:hover { background: var(--report-light); border-color: var(--report-border); color: var(--report); }

.coach-clear-btn {
    margin-top: auto;
    background: none;
    border: none;
    color: var(--muted);
    font-size: 0.78rem;
    padding: 10px 4px;
    cursor: pointer;
    text-align: left;
    transition: color 0.15s var(--ease);
}
.coach-clear-btn:hover { color: #d1495b; }

.coach-main {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.coach-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.coach-welcome { max-width: 440px; margin: auto; text-align: center; }
.coach-welcome h2 { font-size: 1.2rem; margin: 0 0 10px; }
.coach-welcome p { color: var(--muted); font-size: 0.9rem; line-height: 1.6; margin: 0; }

.coach-msg-row { display: flex; align-items: flex-end; gap: 8px; }
.coach-msg-row.user { justify-content: flex-end; }
.coach-msg-row.assistant { justify-content: flex-start; }

.coach-msg-avatar { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; flex-shrink: 0; box-shadow: 0 2px 6px rgba(20,40,60,0.15); }

.coach-bubble {
    max-width: 72%;
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 0.92rem;
    line-height: 1.6;
}
.coach-bubble p { margin: 0 0 8px; }
.coach-bubble p:last-child { margin-bottom: 0; }
.coach-bubble ul { margin: 4px 0 8px; padding-left: 20px; }
.coach-bubble ul:last-child { margin-bottom: 0; }
.coach-bubble li { margin-bottom: 4px; }

.coach-msg-row.user .coach-bubble {
    background: linear-gradient(135deg, var(--report), #5a2fa8);
    color: #fff;
    border-bottom-right-radius: 4px;
}
.coach-msg-row.assistant .coach-bubble {
    background: var(--bg);
    border: 1px solid var(--border);
    border-bottom-left-radius: 4px;
}

.coach-typing { display: flex; align-items: center; gap: 4px; padding: 16px; }
.coach-typing span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--muted);
    opacity: 0.5;
    animation: coach-typing-bounce 1.1s infinite ease-in-out;
}
.coach-typing span:nth-child(2) { animation-delay: 0.15s; }
.coach-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes coach-typing-bounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
    30% { transform: translateY(-4px); opacity: 1; }
}

.coach-input-bar {
    padding: 10px 16px 6px;
    border-top: 1px solid var(--border);
}
.coach-input-wrap {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 4px 4px 4px 16px;
    transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.coach-input-wrap:focus-within { border-color: var(--report); box-shadow: 0 0 0 3px var(--report-light); background: var(--card); }

.coach-input-bar textarea {
    flex: 1;
    resize: none;
    border: none;
    background: transparent;
    padding: 8px 0;
    font-family: inherit;
    font-size: 0.9rem;
    min-height: auto;
    max-height: 120px;
    line-height: 1.4;
    overflow: hidden;
    direction: ltr;
    text-align: left;
}
.coach-input-bar textarea:focus { outline: none; }

.coach-messages { direction: ltr; }

.coach-send-btn {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: none;
    background: var(--report);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    margin: 3px;
    transition: background 0.15s var(--ease), opacity 0.15s var(--ease), transform 0.1s var(--ease);
}
.coach-send-btn svg { width: 15px; height: 15px; }
.coach-send-btn:hover:not(:disabled) { background: #5a2fa8; }
.coach-send-btn:active:not(:disabled) { transform: scale(0.94); }
.coach-send-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.coach-input-hint { font-size: 0.68rem; color: var(--muted); text-align: center; padding: 6px 20px 10px; opacity: 0.8; }

@media (max-width: 900px) {
    .coach-layout { grid-template-columns: 1fr; height: auto; }
    .coach-sidebar { order: 2; overflow-y: visible; }
    .coach-main { order: 1; height: 70vh; min-height: 480px; }
    .coach-bubble { max-width: 88%; }
}

/* ---------- Full mock exam ---------- */
.mock-hero { max-width: 640px; margin-bottom: 28px; }
.mock-hero-title { font-size: 1.6rem; margin: 0 0 6px; color: var(--primary); }
.mock-hero-headline { font-size: 1.05rem; font-weight: 600; margin: 0 0 10px; }
.mock-hero-intro { color: var(--muted); line-height: 1.55; margin: 0; }

.mock-steps {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-bottom: 24px;
}
.mock-step {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
}
.mock-step-icon {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 0.95rem;
    margin-bottom: 12px;
}
.mock-step-title { font-weight: 700; margin-bottom: 4px; }
.mock-step-desc { font-size: 0.85rem; color: var(--muted); line-height: 1.4; }

.mock-trials-notice {
    background: #fff8e8;
    border: 1px solid #f0dca0;
    color: #7a5f16;
    border-radius: var(--radius);
    padding: 14px 16px;
    font-size: 0.88rem;
    line-height: 1.5;
    margin-bottom: 20px;
    max-width: 640px;
}

.mock-resume-notice { color: var(--muted); margin-bottom: 12px; }

.mock-start-btn { display: inline-block; text-decoration: none; }

.mock-choose-heading { font-size: 1.2rem; margin: 8px 0 4px; color: var(--text); }
.mock-choose-subheading { color: var(--muted); font-size: 0.9rem; margin: 0 0 18px; }

.mock-continue-bar {
    margin-top: 22px;
    padding: 18px;
    background: var(--report-light);
    border: 1px solid var(--report-border);
    border-radius: var(--radius);
    text-align: center;
}
.mock-continue-bar p { margin: 0 0 12px; font-weight: 600; color: var(--report); }
.mock-continue-bar .btn { display: inline-block; text-decoration: none; background: var(--report); }
.mock-continue-bar .btn:hover { background: #5a2fa8; }

.mock-report-sections {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-top: 24px;
}
.mock-report-section { text-align: center; }
.mock-report-section .mock-step-icon { margin: 0 auto 8px; font-size: 1.1rem; }
.mock-report-section-label { font-weight: 600; margin-bottom: 4px; }
.mock-report-section-link { font-size: 0.82rem; }

.mock-report-writing-links {
    display: flex;
    gap: 18px;
    justify-content: center;
    margin-top: 16px;
    font-size: 0.85rem;
}

.mock-exam-card {
    background: linear-gradient(135deg, var(--primary), #163a52);
    color: #fff;
    border-radius: var(--radius);
    padding: 22px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-md);
}
.mock-exam-card-title { font-weight: 800; font-size: 1.1rem; margin: 0 0 4px; }
.mock-exam-card-desc { font-size: 0.85rem; color: rgba(255,255,255,0.8); margin: 0; }
.mock-exam-card .btn { background: #fff; color: var(--primary); flex-shrink: 0; text-decoration: none; }
.mock-exam-card .btn:hover { background: #e8eef2; transform: translateY(-1px); }

@media (max-width: 768px) {
    .mock-steps, .mock-report-sections { grid-template-columns: repeat(2, 1fr); }
    .mock-exam-card { flex-direction: column; align-items: flex-start; }
}
