/* === Reset & Base === */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    --text: #1e293b;
    --text-muted: #64748b;
    --bg: #f8fafc;
    --bg-card: #ffffff;
    --border: #e2e8f0;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-lg: 0 4px 12px rgba(0,0,0,0.1);
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --transition: 0.2s ease;
}

/* === Dark theme === */
[data-dark] {
    --text: #e2e8f0;
    --text-muted: #94a3b8;
    --bg: #0f172a;
    --bg-card: #1e293b;
    --bg-secondary: #1e293b;
    --bg-muted: #1e293b;
    --border: #334155;
    --shadow: 0 1px 3px rgba(0,0,0,0.4);
    --shadow-lg: 0 4px 12px rgba(0,0,0,0.4);
}

body {
    font-family: var(--font);
    color: var(--text);
    background: var(--bg);
    line-height: 1.6;
    min-height: 100vh;
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* === Typography === */
h1 { font-size: 1.75rem; font-weight: 700; margin-bottom: 1rem; }
h2 { font-size: 1.35rem; font-weight: 600; margin-bottom: 0.75rem; }
h3 { font-size: 1.1rem; font-weight: 600; margin-bottom: 0.5rem; }

/* === Buttons === */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
    text-decoration: none;
}

.btn-secondary {
    background: var(--border);
    color: var(--text);
}

.btn-secondary:hover {
    background: #cbd5e1;
    text-decoration: none;
}

.btn-small {
    padding: 0.3rem 0.7rem;
    font-size: 0.85rem;
}

.btn-large {
    padding: 0.9rem 2rem;
    font-size: 1.1rem;
}

.btn-full {
    width: 100%;
}

/* === Forms === */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.35rem;
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--text);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.6rem 0.8rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-family: var(--font);
    transition: border-color var(--transition);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
}

.form-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.form-check label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.form-check input[type="checkbox"] {
    width: auto;
}

.range-labels {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.range-labels input[type="range"] {
    flex: 1;
}

/* === Flash messages === */
.flash {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.flash-success {
    background: #d1fae5;
    color: #065f46;
}

.flash-error {
    background: #fee2e2;
    color: #991b1b;
}

/* === Tables === */
.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.data-table th,
.data-table td {
    padding: 0.65rem 0.8rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.data-table th {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.data-table code {
    font-size: 0.85rem;
    background: #f1f5f9;
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
}

/* === Cards === */
.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow);
    text-align: center;
}

.stat-icon {
    font-size: 1.5rem;
    display: block;
    margin-bottom: 0.3rem;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    display: block;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

/* === Public zone (login/register) === */
.public-zone {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
}

.public-container {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.public-header {
    margin-bottom: 2rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
}

.logo-icon {
    font-size: 1.75rem;
}

.logo-text {
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
}

.auth-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 2rem;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
}

.auth-card h1 {
    text-align: center;
}

.auth-form {
    margin-top: 1.25rem;
}

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

.public-footer {
    margin-top: 2rem;
    color: rgba(255,255,255,0.6);
    font-size: 0.85rem;
    text-align: center;
}
.public-footer__links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem 1.25rem;
    margin-bottom: 0.75rem;
}
.public-footer__links a {
    color: rgba(255,255,255,0.55);
    text-decoration: none;
    transition: color 0.15s;
}
.public-footer__links a:hover { color: #fff; }

/* === Legal pages === */
.legal-page {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem 1.5rem 4rem;
    color: var(--text, #1a1a2e);
}
.legal-page h1 { margin-bottom: 0.25rem; }
.legal-page__date { color: #888; font-size: 0.85rem; margin-bottom: 2rem; }
.legal-page__placeholder {
    background: #f5f5f5;
    border: 1px dashed #ccc;
    border-radius: 8px;
    padding: 2rem;
    color: #888;
    font-style: italic;
}
.legal-page h2 { margin-top: 2rem; }
.legal-page h3 { margin-top: 1.25rem; }
.legal-page ul { padding-left: 1.5rem; line-height: 1.7; }
.legal-page li { margin-bottom: .35rem; }
.legal-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .9rem;
    margin: 1rem 0;
}
.legal-table th, .legal-table td {
    border: 1px solid var(--color-border, #e5e7eb);
    padding: .5rem .75rem;
    text-align: left;
    vertical-align: top;
}
.legal-table th {
    background: var(--color-bg-subtle, #f8fafc);
    font-weight: 600;
}
.legal-table code {
    font-size: .85em;
    background: var(--color-bg-subtle, #f0f4f8);
    padding: .1em .35em;
    border-radius: .25rem;
}

/* === Cookie consent banner === */
.cookie-banner {
    position: fixed;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 1rem;
    background: #1a1a2e;
    color: #fff;
    padding: 0.875rem 1.25rem;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    z-index: 9999;
    max-width: calc(100vw - 2rem);
    width: max-content;
}
.cookie-banner[hidden] { display: none; }
.cookie-banner__text { margin: 0; font-size: 0.9rem; }
.cookie-banner__text a { color: #a5b4fc; }
.cookie-banner__btn { white-space: nowrap; padding: 0.4rem 1rem; font-size: 0.875rem; }

/* === Checkbox in forms === */
.form-group--checkbox {
    margin-top: 0.25rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.form-group--checkbox input[type="checkbox"] {
    width: auto;
    flex-shrink: 0;
    padding: 0;
}

.form-group--checkbox > label {
    display: inline;
    margin-bottom: 0;
    flex: 1;
    min-width: 0;
}

.form-group--checkbox .form-hint,
.form-group--checkbox .form-errors {
    width: 100%;
    margin-top: 0.35rem;
}

/* === Range slider with visible value === */
.range-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.range-group input[type="range"] {
    flex: 1;
}

.range-value {
    min-width: 2rem;
    text-align: center;
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--primary);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.1rem 0.4rem;
}
.checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-muted, #555);
    line-height: 1.4;
}
.checkbox-label input[type="checkbox"] { margin-top: 0.2rem; flex-shrink: 0; }
.checkbox-label a { color: var(--primary, #6366f1); }

/* === Zone containers (sticky footer) === */
.parent-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.parent-container .parent-content {
    flex: 1;
}

/* === Headers === */
.child-header,
.parent-header,
.admin-header {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 0.75rem 1.5rem;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.child-header .logo-text,
.parent-header .logo-text,
.admin-header .logo-text {
    color: var(--primary);
}

.child-nav,
.parent-nav,
.admin-nav {
    display: flex;
    gap: 0.25rem;
    flex: 1;
}

.nav-link {
    padding: 0.4rem 0.8rem;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    color: var(--text-muted);
    transition: all var(--transition);
}

.nav-link:hover {
    background: var(--bg);
    color: var(--text);
    text-decoration: none;
}

.nav-link.active {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
    font-weight: 500;
}

.child-user-info,
.parent-user-info,
.admin-user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.9rem;
}

.user-name {
    color: var(--text);
    font-weight: 500;
}

.logout-link {
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* === Content area === */
.child-content,
.parent-content,
.admin-content {
    padding: 1.5rem;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

/* === Dashboard === */
.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.dashboard-action {
    text-align: center;
    margin: 2rem 0;
}

.dashboard-links {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
}

.admin-link-card {
    display: block;
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow);
    transition: all var(--transition);
    text-decoration: none;
    color: var(--text);
}

.admin-link-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
    text-decoration: none;
}

.admin-link-card p {
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* === Admin dashboard extras === */
.stat-card--danger    { border-left: 4px solid var(--color-danger, #ef4444); }
.stat-card--warning   { border-left: 4px solid #f59e0b; }
.stat-card--highlight { border-left: 4px solid var(--color-primary, #6366f1); }

.text-danger  { color: #dc2626; }

.chart-card {
    background: var(--bg-card, #fff);
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: var(--radius, 8px);
    padding: 1rem 1.25rem;
    min-width: 0;
}

.chart-canvas-wrap {
    position: relative;
    width: 100%;
}

.chart-canvas-wrap canvas {
    display: block;
}

.chart-card__title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted, #6b7280);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.75rem;
}

.admin-charts-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 2rem;
}

.admin-charts-row--single {
    grid-template-columns: 1fr;
}

@media (max-width: 900px) {
    .admin-charts-row { grid-template-columns: 1fr; }
}

.pool-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 2rem;
    align-content: flex-start;
}

.pool-grid--compact {
    align-self: start;
}

.pool-grade-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    min-width: 70px;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.pool-grade-card--warn {
    border-color: #f59e0b;
    background: #fffbeb;
}

.pool-grade { font-size: 0.75rem; color: var(--text-muted); }
.pool-count { font-size: 1.1rem; font-weight: 700; }
.pool-status { font-size: 0.8rem; }

/* === Children grid === */
.children-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.child-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow);
}

.child-card-actions {
    margin-top: 0.75rem;
}

/* === Task page === */
.task-page {
    max-width: 600px;
    margin: 0 auto;
}

.task-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow-lg);
    position: relative;
}

.task-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.task-badge--olympiad {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #fff;
}

.task-question {
    font-size: 1.15rem;
    margin-bottom: 1.5rem;
    line-height: 1.7;
}

.task-input {
    font-size: 1.25rem !important;
    text-align: center;
    padding: 0.8rem !important;
}

.task-form .btn {
    width: 100%;
    margin-top: 0.5rem;
}

.lives-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    margin-bottom: 0.5rem;
    font-size: 1.2rem;
}

.lives-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-left: 0.25rem;
}

.lives-warning {
    text-align: center;
    font-size: 0.85rem;
    color: #b45309;
    margin-bottom: 0.75rem;
}

.life--lost {
    opacity: 0.25;
    filter: grayscale(1);
}

.lives-explanation {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    background: #fef3c7;
    border: 1px solid #fcd34d;
    border-radius: var(--radius-sm);
    padding: 0.75rem 1rem;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    line-height: 1.5;
}

.lives-explanation__icon {
    font-size: 1.1rem;
    flex-shrink: 0;
    margin-top: 0.1rem;
}

.task-hint {
    margin-top: 1.25rem;
    padding: 1rem;
    background: #fef3c7;
    border-radius: var(--radius-sm);
}

.task-hint--ai {
    background: linear-gradient(135deg, #ede9fe, #fce7f3);
    border: 1px solid #c4b5fd;
}

.ai-badge {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 600;
    color: #7c3aed;
    background: #ede9fe;
    border: 1px solid #c4b5fd;
    border-radius: 999px;
    padding: 0.1rem 0.5rem;
    margin-bottom: 0.5rem;
}

.hint-trigger {
    display: inline-block;
    margin-top: 1rem;
    font-size: 0.9rem;
    color: var(--text-muted);
    cursor: pointer;
    text-decoration: none;
}

.hint-trigger:hover {
    color: var(--color-primary);
}

.hint-info {
    margin-top: 1rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    text-align: center;
}

.task-empty {
    text-align: center;
    padding: 3rem 1rem;
}

.task-empty p {
    margin-bottom: 1.5rem;
    color: var(--text-muted);
}

.task-empty-icon {
    font-size: 3rem;
    margin-bottom: 0.5rem;
}

/* Loading */
.task-loading {
    text-align: center;
    padding: 4rem 1rem;
}

.task-loading p {
    margin-top: 1.5rem;
    font-size: 1.1rem;
    color: var(--text-muted);
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--color-border, #e2e8f0);
    border-top-color: var(--color-primary, #6366f1);
    border-radius: 50%;
    margin: 0 auto;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.spinner--sm {
    width: 20px; height: 20px;
    border-width: 3px;
    display: inline-block;
    vertical-align: middle;
    margin: 0 8px 0 0;
}

.btn--loading {
    opacity: .7;
    cursor: wait;
}

.task-next {
    margin-top: 1.5rem;
    text-align: center;
}

.task-show-answer {
    margin-top: 1rem;
}
.show-answer-details summary {
    cursor: pointer;
    color: var(--primary, #6366f1);
    font-size: 0.9rem;
    list-style: none;
}
.show-answer-details summary::-webkit-details-marker { display: none; }
.show-answer-content {
    margin-top: 0.75rem;
    padding: 0.75rem 1rem;
    background: #f0f4ff;
    border-radius: 8px;
    border-left: 3px solid var(--primary, #6366f1);
}
.show-answer-value { margin: 0 0 0.5rem; font-size: 1rem; }

.task-skip-form { margin-top: 0.75rem; text-align: center; }
.task-skip-btn {
    font-size: 0.8rem;
    color: #888;
    padding: 0.3rem 0.75rem;
}
.task-skip-btn:hover { color: #555; }

.task-report-inline {
    text-align: right;
    margin-top: 0.5rem;
}

.task-report-inline__toggle {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.78rem;
    color: var(--text-muted, #9ca3af);
    padding: 0;
    text-decoration: underline;
    text-underline-offset: 2px;
    transition: color 0.15s;
}
.task-report-inline__toggle:hover { color: var(--color-danger, #ef4444); }

.task-report-inline__buttons {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.35rem;
    flex-wrap: wrap;
}
.task-report-inline__buttons[hidden] { display: none; }

.btn-xs {
    padding: 0.15rem 0.5rem;
    font-size: 0.75rem;
}

.feedback-thanks {
    color: var(--color-success, #059669);
    font-size: .85rem;
}

.btn-sm { padding: .25rem .6rem; font-size: .8rem; }

.btn-ghost {
    background: transparent;
    border: 1px solid currentColor;
    color: var(--text-muted, #6b7280);
}

.btn-ghost:hover { background: var(--bg-muted, #f3f4f6); }

.badge {
    display: inline-block;
    padding: .15rem .4rem;
    border-radius: 4px;
    font-size: .75rem;
    font-weight: 600;
}

.badge--unclear  { background: #fef3c7; color: #92400e; }
.badge--error    { background: #fee2e2; color: #991b1b; }
.badge--other    { background: #e0e7ff; color: #3730a3; }
.badge--admin    { background: #fde68a; color: #92400e; }
.badge--parent   { background: #dbeafe; color: #1e40af; }
.badge--child    { background: #d1fae5; color: #065f46; }
.badge--success  { background: #d1fae5; color: #065f46; }
.badge--danger   { background: #fee2e2; color: #991b1b; }

.info-grid { display: grid; grid-template-columns: max-content 1fr; gap: .4rem 1rem; }
.info-grid dt { font-weight: 600; color: var(--color-text-muted, #6b7280); }

.card { background: var(--bg-card, #fff); border: 1px solid var(--border-color, #e5e7eb); border-radius: var(--radius, 8px); overflow: hidden; }
.card-body { padding: 1rem 1.25rem; }
.card-actions { padding: .75rem 1.25rem; border-top: 1px solid var(--border-color, #e5e7eb); display: flex; gap: .5rem; flex-wrap: wrap; }

.table-toolbar { display: flex; align-items: center; gap: .75rem; margin-bottom: 1rem; flex-wrap: wrap; }
.search-form { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.table-count { margin-left: auto; color: var(--color-text-muted, #6b7280); font-size: .9rem; }

.pagination { display: flex; align-items: center; gap: 1rem; margin-top: 1.5rem; }
.row--blocked td { opacity: .6; }

.review-form summary { cursor: pointer; }
.review-form-body {
    margin-top: .5rem;
    padding: .75rem;
    background: var(--bg-secondary, #f9fafb);
    border-radius: var(--radius-sm, 6px);
    border: 1px solid var(--border, #e5e7eb);
}

.btn-group { display: flex; gap: .5rem; }

.daily-limit-reached {
    padding: 1rem;
    background: #dbeafe;
    border-radius: var(--radius-sm, 8px);
    color: #1e40af;
    text-align: center;
    margin-bottom: 1rem;
}

/* Feedback */
.task-feedback {
    margin-top: 1.25rem;
    padding: 1rem;
    border-radius: var(--radius-sm);
    text-align: center;
}

.task-feedback.correct {
    background: #d1fae5;
    color: #065f46;
}

.task-feedback.incorrect {
    background: #fef3c7;
    color: #92400e;
    margin-bottom: 1.25rem;
}

.task-feedback .feedback-message {
    font-size: 1.1rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

/* === Achievements === */
.dashboard-achievements { margin-top: 1.5rem; }
.dashboard-achievements h2 { display: flex; align-items: center; gap: 0.5rem; }
.achievements-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--primary);
    color: #fff;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.1rem 0.5rem;
    min-width: 1.4rem;
}

.achievements-list {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 0.75rem;
}

.achievement-badge {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    background: var(--bg-card);
    border-radius: 20px;
    padding: 0.4rem 0.8rem;
    box-shadow: var(--shadow);
    font-size: 0.85rem;
    cursor: default;
    transition: transform 0.15s;
}
.achievement-badge:hover { transform: translateY(-2px); }

.achievement-icon { font-size: 1.1rem; }

/* === Weekly comparison === */
.weekly-comparison {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    background: var(--bg-card);
    border-radius: 12px;
    padding: 0.75rem 1rem;
    box-shadow: var(--shadow);
    margin-top: 1rem;
    font-size: 0.9rem;
}
.weekly-comparison__icon { font-size: 1.3rem; flex-shrink: 0; }
.weekly-comparison__text { line-height: 1.4; }
[data-dark] .weekly-comparison { background: var(--bg-card); }

/* === Settings page === */
.setting-description {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.page {
    max-width: 900px;
}

.admin-content .page {
    max-width: none;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.page-header h1 {
    margin: 0;
}

.table-actions {
    white-space: nowrap;
    display: flex;
    gap: 0.4rem;
    align-items: center;
}

.table-empty {
    text-align: center;
    color: var(--text-muted);
    font-style: italic;
    padding: 1.5rem !important;
}

.form-inline {
    display: inline;
    margin: 0;
    padding: 0;
}

.form-hint {
    font-size: 0.85rem;
    color: var(--color-text-muted, #6b7280);
    margin-top: 0.25rem;
}

.form-hint--locked {
    color: var(--color-warning, #d97706);
}

.form-hint--locked a {
    color: var(--color-primary, #6366f1);
    text-decoration: underline;
}

.form-hint--legal {
    color: var(--color-text-muted, #6b7280);
}

.form-hint--legal a {
    color: var(--color-primary, #6366f1);
    text-decoration: underline;
}

.form-group--consent {
    margin-top: 1rem;
    padding: .75rem;
    background: var(--color-bg-subtle, #f8fafc);
    border: 1px solid var(--color-border, #e5e7eb);
    border-radius: .5rem;
}

.form-group--consent .form-check-label {
    display: flex;
    gap: .5rem;
    align-items: flex-start;
    font-size: .9rem;
    line-height: 1.4;
    cursor: pointer;
}

.form-group--consent input[type="checkbox"] {
    margin-top: .2rem;
    flex-shrink: 0;
    width: 1rem;
    height: 1rem;
    accent-color: var(--color-primary, #6366f1);
}

.rudeness-preview {
    margin-top: .75rem;
    display: flex;
    flex-direction: column;
    gap: .4rem;
}

.rudeness-preview__item {
    display: flex;
    align-items: flex-start;
    gap: .5rem;
    padding: .5rem .75rem;
    border-radius: var(--radius-sm, 6px);
    font-size: .9rem;
    background: var(--bg-secondary, #f9fafb);
    border-left: 3px solid transparent;
}

.rudeness-preview__item--correct { border-left-color: #22c55e; }
.rudeness-preview__item--wrong   { border-left-color: #ef4444; }

.rudeness-preview__icon {
    font-weight: 700;
    flex-shrink: 0;
}

.rudeness-preview__item--correct .rudeness-preview__icon { color: #16a34a; }
.rudeness-preview__item--wrong   .rudeness-preview__icon { color: #dc2626; }

.btn-danger {
    background: #ef4444;
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
    text-decoration: none;
}

.required {
    color: #ef4444;
}

.hint {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 400;
}

/* === Age-Adaptive Themes === */

/* Playful (grades 1-4) */
body[data-theme="playful"] {
    --primary: #ec4899;
    --primary-hover: #db2777;
    --radius: 20px;
    --radius-sm: 14px;
    background: linear-gradient(135deg, #fce4ec 0%, #e8eaf6 50%, #e0f7fa 100%);
    font-size: 1.1rem;
}

[data-theme="playful"] .btn {
    border-radius: 20px;
    font-size: 1.05rem;
    padding: 0.75rem 1.5rem;
}

[data-theme="playful"] .btn-primary {
    background: linear-gradient(135deg, #ec4899, #8b5cf6);
}

[data-theme="playful"] .btn-primary:hover {
    transform: scale(1.03);
}

[data-theme="playful"] .stat-icon {
    font-size: 2rem;
}

[data-theme="playful"] .task-input {
    font-size: 1.5rem !important;
    border-radius: 20px !important;
}

[data-theme="playful"] .task-card {
    border-radius: 24px;
}

/* Cool (grades 5-7) — dark theme */
body[data-theme="cool"] {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --bg-card: #1e293b;
    --text: #e2e8f0;
    --text-muted: #94a3b8;
    --border: #334155;
    background: #0f172a;
    color: #e2e8f0;
}

[data-theme="cool"] .child-header {
    background: #1e293b;
    border-color: #334155;
}

[data-theme="cool"] .nav-link:hover {
    background: #334155;
}

[data-theme="cool"] .btn-primary {
    background: linear-gradient(135deg, #6366f1, #06b6d4);
}

[data-theme="cool"] .task-card,
[data-theme="cool"] .stat-card {
    background: #1e293b;
    border: 1px solid #334155;
}

[data-theme="cool"] .form-group input,
[data-theme="cool"] .form-group select {
    background: #0f172a;
    border-color: #334155;
    color: #e2e8f0;
}

[data-theme="cool"] .task-hint {
    background: #334155;
    color: #fbbf24;
}

/* Mature (grades 8-11) — minimal */
body[data-theme="mature"] {
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --radius: 8px;
    --radius-sm: 6px;
    background: #fafafa;
    font-size: 0.95rem;
}

[data-theme="mature"] .stat-card {
    border: 1px solid var(--border);
    box-shadow: none;
}

[data-theme="mature"] .btn {
    border-radius: 6px;
}

/* === Responsive === */
@media (max-width: 768px) {
    .child-header,
    .parent-header,
    .admin-header {
        flex-wrap: wrap;
        gap: 0.75rem;
    }

    .child-nav,
    .parent-nav,
    .admin-nav {
        order: 3;
        width: 100%;
    }

    .child-content,
    .parent-content,
    .admin-content {
        padding: 1rem;
    }

    .dashboard-stats {
        grid-template-columns: repeat(2, 1fr);
    }

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

    .auth-card {
        padding: 1.5rem;
    }
}

/* === Animations === */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.flash,
.task-feedback {
    animation: fadeIn 0.3s ease;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

[data-theme="playful"] .btn-large {
    animation: pulse 2s infinite;
}

/* === Confetti === */
.confetti-piece {
    position: fixed;
    width: 10px;
    height: 10px;
    top: -10px;
    border-radius: 2px;
    animation: confetti-fall 3s ease-in forwards;
    pointer-events: none;
    z-index: 9999;
}

@keyframes confetti-fall {
    0% { transform: translateY(0) rotate(0deg); opacity: 1; }
    100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

/* === Progress bar === */
.xp-progress {
    background: var(--border);
    border-radius: 99px;
    height: 10px;
    overflow: hidden;
    margin: 0.5rem 0;
}

.xp-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), #06b6d4);
    border-radius: 99px;
    width: 0%;
    transition: width 0.8s ease;
}

/* === Achievement toasts === */
.achievement-popup {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.achievement-toast {
    background: #1e293b;
    color: white;
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    animation: slideInRight 0.4s ease;
    font-size: 0.9rem;
}

@keyframes slideInRight {
    from { transform: translateX(120%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes slideOutRight {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(120%); opacity: 0; }
}

/* === Task next button area === */
.task-next {
    margin-top: 1.5rem;
    text-align: center;
}

/* === Task empty state === */
.task-empty-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

/* === XP award animation === */
.xp-award {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--success);
    animation: popIn 0.4s ease;
}

@keyframes popIn {
    0% { transform: scale(0.5); opacity: 0; }
    70% { transform: scale(1.2); }
    100% { transform: scale(1); opacity: 1; }
}

/* === Stats page: section headings === */
.stats-page h2 {
    margin: 0 0 0.75rem;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* === Stats Hero Cards === */
.stats-hero {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.hero-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: var(--shadow-sm);
}

.hero-card__icon {
    font-size: 2rem;
    line-height: 1;
}

.hero-card__icon--fire { animation: pulse 2s ease-in-out infinite; }
.hero-card--active .hero-card__icon--fire { animation: pulse 1s ease-in-out infinite; }

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}

.hero-card__body {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.hero-card__value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.1;
}

.hero-card__label {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
}

/* Level progress bar */
.level-bar {
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    margin-top: 0.5rem;
    overflow: hidden;
}

.level-bar__fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), #a78bfa);
    border-radius: 3px;
    transition: width 0.6s ease;
}

.level-bar__hint {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
}

/* Accuracy Ring (SVG) */
.hero-card--accuracy {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.5rem;
}

.accuracy-ring {
    width: 80px;
    height: 80px;
}

.accuracy-ring__bg {
    stroke: var(--border);
}

.accuracy-ring__fill {
    transition: stroke-dasharray 0.8s ease;
}

.accuracy-ring__fill--green { stroke: #22c55e; }
.accuracy-ring__fill--yellow { stroke: #eab308; }
.accuracy-ring__fill--red { stroke: #ef4444; }

.accuracy-ring__text {
    font-size: 0.45rem;
    font-weight: 700;
    fill: var(--text);
    font-family: inherit;
}

/* === Stats Middle Row (totals + comparison) === */
.stats-middle-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stats-totals,
.stats-comparison {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    box-shadow: var(--shadow-sm);
}

.totals-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.total-item {
    display: flex;
    flex-direction: column;
}

.total-item__value {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text);
}

.total-item__label {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.total-item--best {
    border-top: 1px solid var(--border);
    padding-top: 0.5rem;
    grid-column: 1 / -1;
}

/* Comparison table */
.comparison-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.comparison-table th {
    text-align: left;
    font-weight: 500;
    color: var(--text-muted);
    padding: 0.35rem 0.5rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.75rem;
}

.comparison-table td {
    padding: 0.4rem 0.5rem;
    border-bottom: 1px solid rgba(0,0,0,0.04);
}

.comparison-label {
    color: var(--text-secondary);
    font-weight: 500;
}

.comparison-value {
    font-weight: 600;
    color: var(--text);
}

.comparison-value--muted {
    color: var(--text-muted);
    font-weight: 400;
}

.comparison-delta {
    font-weight: 600;
    font-size: 0.8rem;
}

.delta--up { color: #22c55e; }
.delta--down { color: #ef4444; }
.delta--same { color: var(--text-muted); }

/* === Stats Chart Section === */
.stats-chart-section {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-sm);
}

/* === Heatmap === */
.stats-heatmap-section {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-sm);
}

.heatmap-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 3px;
    margin-bottom: 4px;
    text-align: center;
    font-size: 0.65rem;
    color: var(--text-muted);
    font-weight: 500;
}

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

.heatmap-cell {
    aspect-ratio: 1;
    border-radius: 3px;
    min-height: 16px;
}

.heatmap-cell--empty { background: transparent; }
.heatmap-cell--0 { background: var(--border); }
.heatmap-cell--1 { background: #bbf7d0; }
.heatmap-cell--2 { background: #4ade80; }
.heatmap-cell--3 { background: #16a34a; }
.heatmap-cell--4 { background: #166534; }

.heatmap-legend {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 0.75rem;
    justify-content: flex-end;
}

.heatmap-legend .heatmap-cell {
    width: 14px;
    height: 14px;
    min-height: auto;
}

.heatmap-legend__label {
    font-size: 0.65rem;
    color: var(--text-muted);
}

/* === Achievements Section === */
.stats-achievements-section {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-sm);
}

.achievements-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 0.75rem;
}

.achievement-badge {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 0.75rem 0.5rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    transition: transform var(--transition);
}

.achievement-badge:hover {
    transform: translateY(-2px);
}

.achievement-badge--earned {
    background: rgba(99, 102, 241, 0.05);
    border-color: var(--primary);
}

.achievement-badge--locked {
    opacity: 0.45;
    filter: grayscale(1);
}

.achievement-badge__icon {
    font-size: 1.75rem;
    line-height: 1;
    margin-bottom: 0.35rem;
}

.achievement-badge__name {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text);
    line-height: 1.2;
}

.achievement-badge__date {
    font-size: 0.65rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
}

.achievement-badge__desc {
    font-size: 0.65rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
    line-height: 1.3;
}

/* === Stats Table (collapsible) === */
.stats-table-section {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-sm);
}

.stats-table-toggle {
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.stats-table-toggle::-webkit-details-marker { display: none; }

.stats-table-toggle::after {
    content: '\25B6';
    font-size: 0.7rem;
    color: var(--text-muted);
    transition: transform 0.2s;
}

details[open] .stats-table-toggle::after {
    transform: rotate(90deg);
}

.stats-table-toggle h2 {
    margin: 0;
}

.stats-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    font-size: 0.85rem;
}

.stats-table th {
    text-align: left;
    font-weight: 500;
    color: var(--text-muted);
    padding: 0.5rem;
    border-bottom: 2px solid var(--border);
}

.stats-table td {
    padding: 0.4rem 0.5rem;
    border-bottom: 1px solid rgba(0,0,0,0.04);
}

/* === Stats Responsive === */
@media (max-width: 900px) {
    .stats-hero {
        grid-template-columns: repeat(2, 1fr);
    }
    .stats-middle-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 500px) {
    .stats-hero {
        grid-template-columns: 1fr;
    }
    .achievements-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* === Pricing / Subscription === */
.subscription-page h1 {
    margin-bottom: 1.5rem;
}

.current-plan {
    background: var(--bg-card);
    border: 1px solid var(--primary);
    border-radius: var(--radius-lg);
    padding: 1rem 1.5rem;
    margin-bottom: 1.5rem;
}

.plan-expires {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.pricing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.5rem;
}

.pricing-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    transition: transform var(--transition), box-shadow var(--transition);
}

.pricing-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow);
}

.pricing-card--active {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.pricing-card__name {
    font-size: 1.25rem;
    font-weight: 700;
    text-transform: capitalize;
    margin: 0 0 0.5rem;
}

.pricing-card__limit {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.pricing-card__price {
    margin-bottom: 0.5rem;
}

.price-amount {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text);
}

.price-period {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.pricing-card__yearly {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.yearly-save {
    color: var(--success);
    font-weight: 500;
}

.pricing-card__features {
    list-style: none;
    padding: 0;
    margin: 0 0 1.5rem;
    flex: 1;
}

.pricing-card__features li {
    padding: 0.3rem 0;
    font-size: 0.85rem;
}

.feature--yes { color: var(--text); }
.feature--no { color: var(--text-muted); text-decoration: line-through; }

.pricing-card__actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.btn-block {
    width: 100%;
    text-align: center;
}

.pricing-card__current {
    text-align: center;
    padding: 0.6rem;
    background: rgba(99, 102, 241, 0.08);
    border-radius: var(--radius);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--primary);
}

/* Subscription success */
.subscription-success {
    display: flex;
    justify-content: center;
    padding-top: 3rem;
}

.success-card {
    text-align: center;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 3rem;
    max-width: 400px;
    box-shadow: var(--shadow);
}

.success-icon {
    font-size: 3rem;
    color: var(--success);
    margin-bottom: 1rem;
}

.success-icon--pending {
    color: var(--text-muted);
}

.success-icon--fail {
    color: var(--danger, #e74c3c);
}

.success-card__actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 1.5rem;
}

.success-card__detail {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

.success-card__detail--error {
    color: var(--danger, #e74c3c);
}


/* About page */
.about-page {
    max-width: 700px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

.about-content {
    line-height: 1.7;
}

.about-content h2 {
    margin-top: 2rem;
}

.about-content ul {
    padding-left: 1.5rem;
}

.about-content li {
    margin-bottom: 0.5rem;
}

.about-cta {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}

/* Pricing page */
.pricing-page {
    max-width: 960px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

.pricing-page h1 {
    text-align: center;
}

.pricing-subtitle {
    text-align: center;
    color: var(--text-muted);
    margin-bottom: 2rem;
}


/* === Onboarding Wizard === */
.onboarding-wizard {
    max-width: 540px;
    margin: 3rem auto;
    padding: 0 1rem;
}

.onboarding-steps {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin-bottom: 2rem;
}

.onboarding-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .25rem;
    font-size: .8rem;
    color: var(--text-muted);
}

.onboarding-step .step-dot {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: .85rem;
}

.onboarding-step.active .step-dot,
.onboarding-step.done .step-dot {
    background: var(--primary);
    color: #fff;
}

.step-connector {
    flex: 1;
    height: 2px;
    background: var(--border);
    margin-bottom: 1.25rem;
    min-width: 2rem;
}

.onboarding-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 2.5rem 2rem;
}

.onboarding-welcome {
    text-align: center;
}

.welcome-icon {
    font-size: 3.5rem;
    margin-bottom: 1rem;
}

.onboarding-welcome h1,
.onboarding-welcome h2 {
    margin-bottom: .75rem;
}

.onboarding-welcome p {
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.onboarding-actions {
    display: flex;
    flex-direction: column;
    gap: .75rem;
    margin-top: 1.5rem;
    align-items: flex-start;
}

.onboarding-card h2 {
    margin-bottom: .5rem;
}

.onboarding-card p {
    color: var(--text-muted);
    margin-bottom: 1rem;
}

/* === Solution animation === */
.solution-step {
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    margin-bottom: .5rem;
}

.solution-step.visible {
    opacity: 1;
    transform: translateY(0);
}

/* === Admin tasks filter === */
.filter-form { margin-bottom: 1.25rem; }

.filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: .75rem;
    align-items: flex-end;
    background: var(--bg-card);
    padding: 1rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: .25rem;
    min-width: 130px;
}

.filter-group label { font-size: .8rem; color: var(--text-muted); font-weight: 500; }

.filter-actions { display: flex; gap: .5rem; align-items: flex-end; margin-left: auto; }

.form-control-sm { padding: .3rem .5rem; font-size: .85rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg); color: var(--text); }

/* Sortable table headers */
.sort-link { color: var(--text); text-decoration: none; white-space: nowrap; font-weight: 600; }
.sort-link:hover { color: var(--primary); }
.sort-link.sort-active { color: var(--primary); }
.sort-hint { opacity: .3; }

/* Table cells */
.task-question-cell { max-width: 280px; }
.text-center { text-align: center; }
.text-nowrap { white-space: nowrap; }
.text-success { color: #059669; }
.text-warning { color: #d97706; }
.text-danger  { color: #dc2626; }
.text-muted   { color: var(--text-muted); }
.table-count  { font-size: .8rem; margin-top: .5rem; }

.badge--grade { background: #e0e7ff; color: #3730a3; font-size: .75rem; padding: .15rem .4rem; border-radius: 4px; }

.accuracy-badge { font-size: .8rem; font-weight: 600; padding: .1rem .35rem; border-radius: 4px; }
.accuracy-good { background: #d1fae5; color: #065f46; }
.accuracy-ok   { background: #fef3c7; color: #92400e; }
.accuracy-bad  { background: #fee2e2; color: #991b1b; }

.type-badge { font-size: .75rem; background: var(--bg-secondary, #f1f5f9); padding: .1rem .35rem; border-radius: 3px; }

/* Settings card */
.settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    align-items: start;
}

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

.settings-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    max-width: 640px;
}

.settings-card h2 { margin-bottom: .25rem; font-size: 1.1rem; }
.settings-card--danger { border-color: #fca5a5; }
.danger-details summary { cursor: pointer; display: inline-flex; align-items: center; gap: .4rem; margin-top: .75rem; }
.danger-details summary::-webkit-details-marker { display: none; }
.danger-details__body { margin-top: 1.25rem; padding-top: 1.25rem; border-top: 1px solid #fca5a5; }
.btn-danger { background: #dc2626; color: #fff; border: none; }
.btn-danger:hover { background: #b91c1c; }
.form-help { display: block; font-size: .8rem; color: var(--text-muted); margin-top: .15rem; }

/* === Settings page === */
.settings-info-rows { display: flex; flex-direction: column; gap: .75rem; }

.settings-info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: .5rem 0;
    border-bottom: 1px solid var(--border);
}
.settings-info-row:last-child { border-bottom: none; }

.settings-info-label { color: var(--text-muted); font-size: .9rem; }
.settings-info-value { font-weight: 500; }

.settings-toggle-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

/* Toggle switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
    cursor: pointer;
}

.toggle-switch input { opacity: 0; width: 0; height: 0; }

.toggle-slider {
    position: absolute;
    inset: 0;
    background: var(--border);
    border-radius: 24px;
    transition: .2s;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    left: 3px;
    bottom: 3px;
    background: #fff;
    border-radius: 50%;
    transition: .2s;
}

.toggle-switch input:checked + .toggle-slider { background: var(--primary); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(20px); }

/* === Feature lock overlay === */
.feature-locked {
    position: relative;
    min-height: 80px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 2px dashed var(--border);
}

.feature-locked__overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .75rem;
    background: color-mix(in srgb, var(--bg-card) 85%, transparent);
    backdrop-filter: blur(4px);
    z-index: 2;
    padding: 1.5rem;
    text-align: center;
}

.feature-locked__badge {
    font-size: .85rem;
    font-weight: 600;
    background: #fef3c7;
    color: #92400e;
    padding: .3rem .75rem;
    border-radius: 20px;
    border: 1px solid #fcd34d;
}

/* ── Shared section header (used by pricing, landing) ── */
.section-header { text-align: center; margin-bottom: 2.5rem; }
.section-header h2 { font-size: 1.75rem; margin-bottom: .5rem; }
.section-header p { color: var(--text-muted); font-size: 1rem; }

/* ══════════════════════════════════════════════════════════
   Landing page redesign — brand tokens & components
   ══════════════════════════════════════════════════════════ */

.landing {
    --brand: #7D63B3;
    --brand-dark: #2D087A;
    --brand-accent: #B63BE6;
    --brand-light: #EDE5F7;
    --brand-glow: rgba(125, 99, 179, .25);
}

/* Animations */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(24px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* JS adds .animate-hidden, observer adds .is-visible */
.animate-hidden {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity .6s ease, transform .6s ease;
}

.animate-hidden.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* Hero is above the fold — animate on load via keyframes */
.landing-hero__content > * {
    opacity: 0;
    animation: fadeInUp .6s ease forwards;
}
.landing-hero__content > *:nth-child(1) { animation-delay: .1s; }
.landing-hero__content > *:nth-child(2) { animation-delay: .25s; }
.landing-hero__content > *:nth-child(3) { animation-delay: .4s; }
.landing-hero__content > *:nth-child(4) { animation-delay: .55s; }

/* Legal pages — белый фон, обычный поток */
.public-zone:has(.legal-page) {
    background: #fff;
    display: block;
}
.public-zone:has(.legal-page) .public-container {
    display: block;
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 1.5rem 3rem;
}
.public-zone:has(.legal-page) .public-content {
    display: block;
}

.legal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 0;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid #e5e7eb;
}

.legal-header .logo {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.legal-header .logo-img {
    height: 44px;
}

.legal-header__nav {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.legal-header__nav a {
    color: #4b5563;
    text-decoration: none;
    font-size: .9rem;
    transition: color .2s;
}

.legal-header__nav a:hover { color: #7c3aed; }

.legal-header__nav .landing-btn-sm {
    background: #7c3aed;
    color: #fff;
    padding: .35rem .9rem;
    border-radius: 6px;
    font-size: .85rem;
}

/* Override public-zone defaults when landing is active */
.public-zone:has(.landing) {
    background: none;
    display: block;
}
.public-zone:has(.landing) .public-container {
    display: block;
    max-width: none;
    padding: 0;
}
.public-zone:has(.landing) .public-content {
    display: block;
}

/* ── Landing header (fixed) ── */
.landing-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: rgba(45, 8, 122, .85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: .75rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.landing-header .logo {
    color: #fff;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: .5rem;
    font-weight: 700;
    font-size: 1.1rem;
}

.landing-header__nav {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.landing-header__nav a {
    color: rgba(255,255,255,.8);
    text-decoration: none;
    font-size: .9rem;
    transition: color .2s;
}

.landing-header__nav a:hover {
    color: #fff;
}

/* ── Landing buttons ── */
.landing-btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: .75rem 2rem;
    font-size: 1.05rem;
    font-weight: 700;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    text-decoration: none;
    background: var(--brand-accent);
    color: #fff;
    transition: transform .15s, box-shadow .15s;
}

.landing-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(182, 59, 230, .35);
}

.landing-btn-outline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: .75rem 2rem;
    font-size: 1.05rem;
    font-weight: 600;
    border: 2px solid rgba(255,255,255,.4);
    border-radius: 8px;
    cursor: pointer;
    text-decoration: none;
    background: transparent;
    color: #fff;
    transition: border-color .2s, background .2s;
}

.landing-btn-outline:hover {
    border-color: #fff;
    background: rgba(255,255,255,.1);
}

.landing-btn-sm {
    padding: .45rem 1.25rem;
    font-size: .9rem;
    font-weight: 600;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    text-decoration: none;
    background: rgba(255,255,255,.15);
    color: #fff;
    transition: background .2s;
}

.landing-btn-sm:hover {
    background: rgba(255,255,255,.25);
}

.landing-btn-white {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: .75rem 2rem;
    font-size: 1.05rem;
    font-weight: 700;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    text-decoration: none;
    background: #fff;
    color: var(--brand-dark);
    transition: transform .15s, box-shadow .15s;
}

.landing-btn-white:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(255,255,255,.3);
}

.landing-btn-ghost-white {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: .75rem 2rem;
    font-size: 1.05rem;
    font-weight: 600;
    border: 2px solid rgba(255,255,255,.4);
    border-radius: 8px;
    cursor: pointer;
    text-decoration: none;
    background: transparent;
    color: #fff;
    transition: border-color .2s;
}

.landing-btn-ghost-white:hover {
    border-color: #fff;
}

/* ── Hero section ── */
.landing-hero {
    background: linear-gradient(160deg, var(--brand-dark) 0%, var(--brand) 100%);
    padding: 8rem 2rem 5rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.landing-hero::before {
    content: '';
    position: absolute;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(182,59,230,.2) 0%, transparent 70%);
    top: -150px;
    right: -100px;
    border-radius: 50%;
    pointer-events: none;
}

.landing-hero__content {
    max-width: 720px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

.landing-hero h1 {
    font-size: clamp(2rem, 5vw, 3.25rem);
    font-weight: 800;
    color: #fff;
    line-height: 1.15;
    margin: 0 0 1.25rem;
}

.landing-hero__accent {
    background: linear-gradient(90deg, #e0b0ff, var(--brand-accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.landing-hero__sub {
    font-size: 1.15rem;
    color: rgba(255,255,255,.85);
    max-width: 560px;
    margin: 0 auto 2rem;
    line-height: 1.6;
}

.landing-hero__actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.landing-hero__note {
    font-size: .8rem;
    color: rgba(255,255,255,.55);
}

/* ── Features section ── */
.landing-features {
    padding: 5rem 2rem;
    max-width: 960px;
    margin: 0 auto;
}

.landing-features__title {
    text-align: center;
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 2.5rem;
}

.landing-features__grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

.landing-feature-card {
    background: var(--bg-card, #fff);
    border: 1px solid var(--border, #e5e7eb);
    border-radius: 12px;
    padding: 2rem 1.5rem;
    text-align: center;
    transition: transform .2s, box-shadow .2s;
}

.landing-feature-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px var(--brand-glow);
}

.landing-feature-card__icon {
    font-size: 2.25rem;
    margin-bottom: .75rem;
}

.landing-feature-card h3 {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0 0 .5rem;
}

.landing-feature-card p {
    font-size: .9rem;
    color: var(--text-muted, #6b7280);
    line-height: 1.55;
    margin: 0;
}

/* ── How it works section ── */
.landing-how {
    padding: 5rem 2rem;
    background: var(--bg-card, #f9fafb);
}

.landing-how__inner {
    max-width: 960px;
    margin: 0 auto;
}

.landing-how__title {
    text-align: center;
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 3rem;
}

.landing-how__steps {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    position: relative;
}

/* Connecting line between steps (desktop) */
.landing-how__steps::after {
    content: '';
    position: absolute;
    top: 28px;
    left: calc(16.67% + 28px);
    right: calc(16.67% + 28px);
    height: 2px;
    background: linear-gradient(90deg, var(--brand), var(--brand-accent));
    z-index: 0;
}

.landing-step {
    text-align: center;
    position: relative;
    z-index: 1;
}

.landing-step__number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--brand), var(--brand-accent));
    color: #fff;
    font-size: 1.35rem;
    font-weight: 800;
    margin-bottom: 1rem;
}

.landing-step h3 {
    font-size: 1.05rem;
    font-weight: 700;
    margin: 0 0 .5rem;
}

.landing-step p {
    font-size: .9rem;
    color: var(--text-muted, #6b7280);
    line-height: 1.5;
    margin: 0;
}

/* ── CTA section ── */
.landing-cta {
    background: linear-gradient(135deg, var(--brand-dark) 0%, var(--brand) 50%, var(--brand-accent) 100%);
    text-align: center;
    padding: 5rem 2rem;
}

.landing-cta__inner {
    max-width: 600px;
    margin: 0 auto;
}

.landing-cta h2 {
    color: #fff;
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: .75rem;
}

.landing-cta p {
    color: rgba(255,255,255,.8);
    font-size: 1.05rem;
    margin-bottom: 2rem;
}

.landing-cta__actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* ── Landing footer ── */
.landing-footer {
    background: #2D087A;
    color: rgba(255,255,255,.7);
    padding: 3rem 2rem 1.5rem;
}

.landing-footer__grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 2rem;
    max-width: 960px;
    margin: 0 auto;
}

.landing-footer__brand p {
    font-size: .9rem;
    line-height: 1.6;
    margin: .5rem 0 0;
    color: rgba(255,255,255,.55);
}

.landing-footer h4 {
    color: #fff;
    font-size: .9rem;
    font-weight: 700;
    margin-bottom: .75rem;
    text-transform: uppercase;
    letter-spacing: .03em;
}

.landing-footer ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: .4rem;
}

.landing-footer ul a {
    color: rgba(255,255,255,.6);
    text-decoration: none;
    font-size: .85rem;
    transition: color .2s;
}

.landing-footer ul a:hover {
    color: #fff;
}

.landing-footer__bottom {
    max-width: 960px;
    margin: 2rem auto 0;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255,255,255,.1);
    text-align: center;
    font-size: .8rem;
    color: rgba(255,255,255,.4);
}

/* ── Landing pricing section ── */
.landing-pricing {
    padding: 5rem 2rem;
    max-width: 960px;
    margin: 0 auto;
}

.landing-pricing__title {
    text-align: center;
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: .5rem;
}

.landing-pricing__sub {
    text-align: center;
    color: var(--text-muted, #6b7280);
    margin-bottom: 2.5rem;
}

/* ── Landing responsive ── */
@media (max-width: 768px) {
    .landing-header__nav { display: none; }
    .landing-hero { padding: 6rem 1.5rem 3rem; }
    .landing-hero h1 { font-size: 1.75rem; }
    .landing-features__grid { grid-template-columns: 1fr; }
    .landing-how__steps { grid-template-columns: 1fr; gap: 1.5rem; }
    .landing-how__steps::after { display: none; }
    .landing-footer__grid { grid-template-columns: 1fr; gap: 1.5rem; }
    .landing-cta h2 { font-size: 1.5rem; }
}

@media (max-width: 480px) {
    .landing-hero__actions { flex-direction: column; }
    .landing-btn-primary,
    .landing-btn-outline,
    .landing-btn-white,
    .landing-btn-ghost-white { width: 100%; }
    .landing-cta__actions { flex-direction: column; }
}

/* ── Pricing cards redesign ── */
.pricing-grid--3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    align-items: start;
}

.pricing-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.75rem 1.5rem;
    position: relative;
}

.pricing-card--popular {
    border-color: var(--primary);
    border-width: 2px;
    box-shadow: 0 4px 20px rgba(99,102,241,.15);
}

.pricing-card--current {
    border-color: #059669;
    border-width: 2px;
}

.pricing-card__popular-badge {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary);
    color: #fff;
    font-size: .75rem;
    font-weight: 700;
    padding: .2rem .75rem;
    border-radius: 20px;
    white-space: nowrap;
}

.pricing-card__header { margin-bottom: 1rem; }
.pricing-card__name { font-size: 1.35rem; font-weight: 700; margin-bottom: .25rem; }
.pricing-card__tasks { font-size: .85rem; color: var(--text-muted); }

.pricing-card__price-section {
    margin-bottom: 1.25rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--border);
}

.price-amount { font-size: 2rem; font-weight: 800; }
.price-period { font-size: .85rem; color: var(--text-muted); margin-left: .25rem; }
.price-yearly-total { font-size: .8rem; color: var(--text-muted); margin-top: .25rem; }
.price-yearly-note  { font-size: .8rem; color: var(--text-muted); margin-top: .35rem; }
.price-yearly-save  { font-size: .8rem; color: #059669; font-weight: 600; margin-top: .35rem; }
.yearly-save { background: #d1fae5; color: #065f46; padding: .1rem .35rem; border-radius: 4px; font-size: .75rem; font-weight: 700; margin-left: .25rem; }

.pricing-card__features {
    list-style: none;
    margin-bottom: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: .5rem;
}

.pricing-card__features li { font-size: .9rem; }
.feature--yes { color: var(--text); }
.feature--no  { color: var(--text-muted); }

.pricing-card__current-label {
    text-align: center;
    padding: .65rem;
    background: #d1fae5;
    color: #065f46;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: .9rem;
}

.current-plan-badge {
    display: inline-block;
    background: #ede9fe;
    color: #5b21b6;
    padding: .3rem .9rem;
    border-radius: 20px;
    font-size: .85rem;
    margin-top: .5rem;
}

/* Billing period toggle */
.billing-toggle {
    display: flex;
    justify-content: center;
    gap: .25rem;
    margin-bottom: 2rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 30px;
    width: fit-content;
    margin-left: auto;
    margin-right: auto;
    padding: .25rem;
}

.billing-toggle__btn {
    padding: .45rem 1.25rem;
    border-radius: 25px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: .9rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: .4rem;
    transition: .15s;
}

.billing-toggle__btn--active {
    background: var(--primary);
    color: #fff;
}

.billing-save-badge {
    background: #d1fae5;
    color: #065f46;
    font-size: .7rem;
    font-weight: 700;
    padding: .1rem .35rem;
    border-radius: 4px;
}

.billing-toggle__btn--active .billing-save-badge {
    background: rgba(255,255,255,.25);
    color: #fff;
}

.subscription-footer {
    margin-top: 2rem;
    text-align: center;
    color: var(--text-muted);
    font-size: .85rem;
}

.subscription-footer p { margin-bottom: .35rem; }

/* Comparison table */
.comparison-table-wrapper {
    margin-top: 3rem;
    overflow-x: auto;
}

.comparison-table-wrapper h2 { text-align: center; margin-bottom: 1.25rem; }

.comparison-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .9rem;
}

.comparison-table th,
.comparison-table td {
    padding: .65rem 1rem;
    border-bottom: 1px solid var(--border);
    text-align: center;
}

.comparison-table th:first-child,
.comparison-table td:first-child { text-align: left; }

.comparison-table thead th { font-weight: 700; background: var(--bg-card); }

/* FAQ */
.pricing-faq { margin-top: 3rem; max-width: 640px; margin-left: auto; margin-right: auto; }
.pricing-faq h2 { text-align: center; margin-bottom: 1.25rem; }

.faq-list { display: flex; flex-direction: column; gap: .5rem; }

.faq-item {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.faq-item summary {
    cursor: pointer;
    padding: .85rem 1rem;
    font-weight: 500;
    background: var(--bg-card);
    list-style: none;
}

.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: ' +'; float: right; color: var(--text-muted); }
.faq-item[open] summary::after { content: ' −'; }

.faq-item p {
    padding: .75rem 1rem;
    color: var(--text-muted);
    font-size: .9rem;
    background: var(--bg);
    margin: 0;
}

/* Responsive — pricing */
@media (max-width: 768px) {
    .pricing-grid--3 { grid-template-columns: 1fr; }
}

/* ===================================================================
   PWA / Mobile enhancements (Приоритет 3.1)
   =================================================================== */

/* Swipe hint — показывается после правильного ответа на мобильных */
.swipe-hint {
    display: none;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-top: 0.5rem;
    opacity: 0.7;
    animation: fadeIn 0.5s ease 1s both;
}
@media (hover: none) and (pointer: coarse) {
    .swipe-hint { display: block; }
}

/* Крупнее кнопка submit на мобильных */
@media (max-width: 480px) {
    .task-input {
        font-size: 1.5rem !important;
        padding: 1rem !important;
        border-radius: 0.75rem !important;
    }
    .task-form .btn,
    .task-next .btn {
        padding: 1rem 1.5rem;
        font-size: 1.1rem;
    }
    .task-card {
        padding: 1.25rem;
        /* touch-action: pan-y = не блокируем вертикальный скролл */
        touch-action: pan-y;
    }
    .task-question {
        font-size: 1.25rem;
    }
}

/* Push notification prompt banner */
.push-prompt {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    font-size: 0.875rem;
}
.push-prompt__text { flex: 1; }
.push-prompt__close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 1.1rem;
    padding: 0.25rem;
    line-height: 1;
}

/* ===================================================================
   3.2 Расширение контента — SR reminder + Weekly Challenge
   =================================================================== */

/* SR reminder */
.sr-reminder {
    display: flex;
    align-items: center;
    gap: .75rem;
    background: #fef9c3;
    border: 1px solid #fde047;
    border-radius: var(--radius);
    padding: .75rem 1rem;
    margin-bottom: 1rem;
    font-size: .875rem;
}
[data-dark] .sr-reminder {
    background: #422006;
    border-color: #92400e;
}
.sr-reminder__icon { font-size: 1.5rem; flex-shrink: 0; }
.sr-reminder__text { display: flex; flex-direction: column; gap: .1rem; }
.sr-reminder__text strong { font-size: .9rem; }
.sr-reminder__text span { color: var(--text-muted); font-size: .8rem; }

/* Weekly Challenge */
.weekly-challenge {
    background: var(--bg-card);
    border: 2px solid var(--color-primary, #6366f1);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
}
.weekly-challenge--done {
    border-color: #22c55e;
    background: #f0fdf4;
}
[data-dark] .weekly-challenge--done { background: #052e16; }

.weekly-challenge__header {
    display: flex;
    align-items: flex-start;
    gap: .75rem;
    margin-bottom: .75rem;
}
.weekly-challenge__icon { font-size: 1.75rem; flex-shrink: 0; }
.weekly-challenge__title { font-weight: 700; font-size: .95rem; }
.weekly-challenge__desc  { font-size: .8rem; color: var(--text-muted); margin-top: .15rem; }
.weekly-challenge__xp {
    margin-left: auto;
    font-size: .8rem;
    font-weight: 700;
    color: var(--color-primary, #6366f1);
    white-space: nowrap;
    flex-shrink: 0;
}
.weekly-challenge__badge {
    margin-left: auto;
    font-size: .8rem;
    font-weight: 700;
    color: #16a34a;
    white-space: nowrap;
    flex-shrink: 0;
}
.weekly-challenge__progress {
    display: flex;
    align-items: center;
    gap: .75rem;
    margin-bottom: .5rem;
}
.weekly-challenge__bar {
    flex: 1;
    height: 8px;
    background: var(--bg-subtle, #e2e8f0);
    border-radius: 4px;
    overflow: hidden;
}
.weekly-challenge__fill {
    height: 100%;
    background: var(--color-primary, #6366f1);
    border-radius: 4px;
    transition: width .4s ease;
}
.weekly-challenge__count {
    font-size: .8rem;
    font-weight: 600;
    color: var(--text-muted);
    white-space: nowrap;
}
.weekly-challenge__period {
    font-size: .75rem;
    color: var(--text-muted);
}

/* ===================================================================
   Тёмная тема — расширенное покрытие компонентов
   =================================================================== */

/* --- Формы --- */
[data-dark] .form-group input,
[data-dark] .form-group select,
[data-dark] .form-group textarea {
    background: #0f172a;
    border-color: #334155;
    color: #e2e8f0;
}

[data-dark] .form-group input::placeholder,
[data-dark] .form-group textarea::placeholder {
    color: #64748b;
}

/* --- Flash-сообщения --- */
[data-dark] .flash-success {
    background: #052e16;
    color: #6ee7b7;
}

[data-dark] .flash-error {
    background: #450a0a;
    color: #fca5a5;
}

/* --- Таблицы --- */
[data-dark] .data-table code {
    background: #334155;
    color: #e2e8f0;
}

[data-dark] .data-table tr:hover td {
    background: #1e293b;
}

/* --- Кнопки --- */
[data-dark] .btn-secondary {
    background: #334155;
    color: #e2e8f0;
}

[data-dark] .btn-secondary:hover {
    background: #475569;
}

[data-dark] .btn-ghost {
    color: #94a3b8;
}

[data-dark] .btn-ghost:hover {
    background: #1e293b;
}

/* --- Бейджи обратной связи --- */
[data-dark] .badge--unclear {
    background: #422006;
    color: #fcd34d;
}

[data-dark] .badge--error {
    background: #450a0a;
    color: #fca5a5;
}

[data-dark] .badge--other {
    background: #1e1b4b;
    color: #a5b4fc;
}

/* --- Задача --- */
[data-dark] .task-hint {
    background: #422006;
    color: #fcd34d;
}

[data-dark] .task-feedback.correct {
    background: #052e16;
    color: #6ee7b7;
}

[data-dark] .task-feedback.incorrect {
    background: #422006;
    color: #fcd34d;
}

[data-dark] .daily-limit-reached {
    background: #1e3a5f;
    color: #93c5fd;
}

/* --- Пул (pool-grade-card warn) --- */
[data-dark] .pool-grade-card--warn {
    border-color: #92400e;
    background: #422006;
}

/* --- review-form --- */
[data-dark] .review-form-body {
    background: #1e293b;
    border-color: #334155;
}

/* --- Онбординг --- */
[data-dark] .onboarding-wizard {
    background: transparent;
}

[data-dark] .onboarding-card {
    background: #1e293b;
    border: 1px solid #334155;
}

[data-dark] .onboarding-step .step-dot {
    background: #334155;
    color: #94a3b8;
}

[data-dark] .onboarding-step.active .step-dot {
    background: var(--primary);
    color: white;
}

[data-dark] .onboarding-step.done .step-dot {
    background: #10b981;
    color: white;
}

[data-dark] .step-connector {
    background: #334155;
}

/* --- Pricing cards --- */
[data-dark] .pricing-card {
    background: #1e293b;
    border-color: #334155;
}

[data-dark] .pricing-card--popular {
    border-color: var(--primary);
}

[data-dark] .billing-toggle {
    background: #1e293b;
    border: 1px solid #334155;
}

[data-dark] .billing-toggle__btn {
    color: #94a3b8;
}

[data-dark] .billing-toggle__btn--active {
    background: var(--primary);
    color: white;
}

[data-dark] .billing-save-badge {
    background: #1a3d1a;
    color: #6ee7b7;
}

/* --- Подписка --- */
[data-dark] .pricing-card__features li.feature--no {
    color: #475569;
}

[data-dark] .current-plan-badge {
    background: #1e293b;
    border: 1px solid #334155;
    color: #94a3b8;
}

/* --- Лендинг (dark mode) --- */
[data-dark] .landing-feature-card {
    background: #1e293b;
    border-color: #334155;
}

[data-dark] .landing-features {
    background: none;
}

[data-dark] .landing-how {
    background: #0f172a;
}

/* --- Статистика / дашборд родителя --- */
[data-dark] .chart-container {
    background: #1e293b;
    border-color: #334155;
}

[data-dark] .parent-stat-card {
    background: #1e293b;
}

/* --- Меню настроек --- */
[data-dark] .settings-section {
    background: #1e293b;
    border-color: #334155;
}

/* --- Спиннер --- */
[data-dark] .spinner {
    border-color: #334155;
    border-top-color: var(--primary);
}

/* --- push prompt --- */
[data-dark] .push-prompt {
    background: #1e293b;
    border-color: #334155;
}

/* --- Еженедельный челлендж --- */
[data-dark] .weekly-challenge__bar {
    background: #334155;
}

/* --- Достижения --- */
[data-dark] .achievement-badge {
    background: #1e293b;
    border: 1px solid #334155;
}

/* ═══════════════════════════════════════════════════════════════
   DASHBOARD — redesigned lower section
   ═══════════════════════════════════════════════════════════════ */

/* XP progress card */
.dash-progress-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    margin-bottom: 1.25rem;
    box-shadow: var(--shadow-sm);
}
.dash-progress-card__top {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: .5rem;
}
.dash-progress-card__label { font-weight: 600; font-size: .875rem; }
.dash-progress-card__nums  { font-size: .8rem; color: var(--text-muted); }

/* Action area */
.dashboard-action { text-align: center; margin: 1.75rem 0 1.25rem; }
.dashboard-action .btn-large { min-width: 200px; font-size: 1.1rem; padding: .85rem 2.5rem; }
.dashboard-action__hint { margin-top: .6rem; color: var(--text-muted); font-size: .85rem; }

/* "Done for today" card */
.daily-done-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 1.5rem;
    text-align: center;
    border: 2px solid #22c55e;
}
.daily-done-card__icon { font-size: 2.5rem; display: block; margin-bottom: .5rem; }
.daily-done-card__text { font-weight: 700; font-size: 1rem; margin: 0; }
.daily-done-card__sub  { color: var(--text-muted); font-size: .875rem; margin: .25rem 0 0; }

/* Side cards row (SR + challenge) */
.dashboard-side-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: .75rem;
    margin-bottom: 1.5rem;
}
.side-card {
    display: flex;
    align-items: flex-start;
    gap: .75rem;
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.1rem;
}
.side-card--sr         { border-color: #f59e0b; }
.side-card--challenge  { border-color: var(--color-primary, #6366f1); }
.side-card--done       { border-color: #22c55e; }
.side-card__icon { font-size: 1.75rem; flex-shrink: 0; line-height: 1; margin-top: .1rem; }
.side-card__body { display: flex; flex-direction: column; gap: .2rem; flex: 1; }
.side-card__body strong { font-size: .9rem; line-height: 1.3; }
.side-card__body span   { font-size: .8rem; color: var(--text-muted); }
.side-card__badge {
    display: inline-block;
    background: #22c55e;
    color: #fff;
    border-radius: 999px;
    padding: .15rem .6rem;
    font-size: .75rem;
    font-weight: 700;
    width: fit-content;
}
.side-card__progress {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin-top: .25rem;
}
.side-card__bar {
    flex: 1;
    height: 6px;
    background: var(--bg-subtle, #e2e8f0);
    border-radius: 3px;
    overflow: hidden;
}
.side-card__fill {
    height: 100%;
    background: var(--color-primary, #6366f1);
    border-radius: 3px;
    transition: width .4s ease;
}
.side-card__progress span { font-size: .75rem; font-weight: 600; color: var(--text-muted); white-space: nowrap; }
.side-card__period { font-size: .75rem !important; color: var(--text-muted); margin-top: .15rem; }

[data-dark] .side-card        { background: #1e293b; border-color: #334155; }
[data-dark] .side-card--sr    { border-color: #b45309; }
[data-dark] .side-card--challenge { border-color: #4f46e5; }
[data-dark] .side-card--done  { border-color: #16a34a; }
[data-dark] .side-card__bar   { background: #334155; }
[data-dark] .daily-done-card  { border-color: #16a34a; }
[data-dark] .dash-progress-card { background: #1e293b; }

/* ═══════════════════════════════════════════════════════════════
   PARENT LAYOUT — footer + subscription badge
   ═══════════════════════════════════════════════════════════════ */

.parent-footer {
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    padding: 1.25rem 1.5rem;
    margin-top: auto;
}
.parent-footer__inner {
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}
.parent-footer__brand { font-weight: 700; color: var(--text-muted); font-size: .875rem; }
.parent-footer__links { display: flex; gap: 1.25rem; flex: 1; }
.parent-footer__links a { font-size: .8rem; color: var(--text-muted); text-decoration: none; }
.parent-footer__links a:hover { color: var(--color-primary); }
.parent-footer__copy { font-size: .75rem; color: var(--text-muted); margin-left: auto; }

/* Subscription badge in parent header */
.subscription-badge {
    display: inline-block;
    font-size: .7rem;
    font-weight: 700;
    padding: .2rem .55rem;
    border-radius: 999px;
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: .03em;
}
.subscription-badge--free    { background: #e2e8f0; color: #475569; }
.subscription-badge--basic   { background: #dbeafe; color: #1d4ed8; }
.subscription-badge--premium { background: linear-gradient(90deg, #8b5cf6, #6366f1); color: #fff; }

/* Logo images */
.logo-img { height: 44px; display: block; width: auto; }
.logo-img--landing { height: 40px; }
.logo-img--dark { display: none; }
[data-dark] .logo-img--dark { display: block; }
[data-dark] .logo-img--light { display: none; }

/* Login page hero */
.login-hero { text-align: center; padding: 48px 24px 32px; }
.login-hero-logo { height: 132px; width: auto; display: inline-block; }

/* Onboarding logo */
.onboarding-logo { height: 80px; width: auto; margin-bottom: 16px; }

/* === Task rating (👍/👎) === */
.task-rating {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.75rem;
    flex-wrap: wrap;
}
.task-rating__label { font-size: 0.9rem; color: var(--text-muted); }
.task-rating__btn { font-size: 1.25rem; padding: 0.2rem 0.5rem; line-height: 1; }
.task-rating__btn:disabled { opacity: 0.4; cursor: default; }

/* === NPS modal === */
.nps-modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    z-index: 900;
    pointer-events: none;
    opacity: 0;
    transition: opacity var(--transition);
}
.nps-modal--visible { opacity: 1; pointer-events: auto; }
.nps-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.4);
}
.nps-modal__dialog {
    position: relative;
    background: var(--bg-card);
    border-radius: var(--radius) var(--radius) 0 0;
    padding: 1.5rem;
    width: 100%;
    max-width: 540px;
    box-shadow: var(--shadow-lg);
    transform: translateY(100%);
    transition: transform 0.3s ease;
}
.nps-modal--visible .nps-modal__dialog { transform: translateY(0); }
.nps-modal__close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    background: none;
    border: none;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    color: var(--text-muted);
}
.nps-modal__title { margin-bottom: 0.25rem; font-size: 1.1rem; }
.nps-modal__subtitle { font-size: 0.875rem; color: var(--text-muted); margin-bottom: 1rem; }
.nps-scores {
    display: flex;
    gap: 0.25rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}
.nps-score { display: flex; flex-direction: column; align-items: center; cursor: pointer; }
.nps-score input { display: none; }
.nps-score span {
    width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 600;
    transition: background var(--transition), color var(--transition);
}
.nps-score input:checked + span { background: var(--primary); color: #fff; border-color: var(--primary); }
.nps-score:hover span { background: var(--bg); border-color: var(--primary); }
.nps-comment {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font: inherit;
    font-size: 0.9rem;
    resize: vertical;
    margin-bottom: 1rem;
    background: var(--bg);
    color: var(--text);
}
.nps-submit { width: 100%; }
.nps-thanks { text-align: center; color: var(--success); font-size: 1rem; padding: 1rem 0; }

/* === Admin score badges === */
.score-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    font-weight: 700;
    font-size: 0.875rem;
}
.score-badge--promoter  { background: #d1fae5; color: #065f46; }
.score-badge--passive   { background: #fef3c7; color: #92400e; }
.score-badge--detractor { background: #fee2e2; color: #991b1b; }

/* Shard capacity widget */
.shard-capacity { display: flex; flex-wrap: wrap; gap: 1rem; margin-bottom: 2rem; }
.shard-card { background: var(--card-bg); border: 1px solid var(--border); border-radius: .75rem; padding: 1rem 1.25rem; min-width: 260px; flex: 1; }
.shard-card--alert { border-color: var(--danger, #ef4444); }
.shard-card__header { display: flex; justify-content: space-between; align-items: center; margin-bottom: .5rem; }
.shard-card__name { font-weight: 600; }
.shard-card__pct { font-size: 1.1rem; font-weight: 700; }
.shard-card__bar { height: 8px; background: var(--border); border-radius: 4px; overflow: hidden; margin-bottom: .5rem; }
.shard-card__bar-fill { height: 100%; background: var(--success, #10b981); border-radius: 4px; transition: width .3s; }
.shard-card__bar-fill--warn { background: var(--warning, #f59e0b); }
.shard-card__bar-fill--alert { background: var(--danger, #ef4444); }
.shard-card__stats { font-size: .85rem; color: var(--text-muted); }

/* === Admin table (payments, etc.) === */
.admin-filters {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    align-items: center;
    margin-bottom: 1.25rem;
}

.admin-table-wrap {
    overflow-x: auto;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .875rem;
}

.admin-table th {
    text-align: left;
    padding: .5rem .75rem;
    background: var(--bg-card);
    border-bottom: 2px solid var(--border);
    color: var(--text-muted);
    font-weight: 600;
    white-space: nowrap;
}

.admin-table td {
    padding: .5rem .75rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.admin-table tbody tr:hover {
    background: var(--bg-card);
}

.admin-table__id    { color: var(--text-muted); font-size: .8rem; }
.admin-table__date  { white-space: nowrap; color: var(--text-muted); font-size: .8rem; }
.admin-table__amount { font-weight: 600; white-space: nowrap; }
.admin-table__failure { font-size: .8rem; }
.admin-table__empty { text-align: center; color: var(--text-muted); padding: 2rem; }
.admin-table__note  { font-size: .8rem; color: var(--text-muted); margin-top: .75rem; }

/* Payment status badges */
.payment-status {
    display: inline-block;
    padding: .2rem .55rem;
    border-radius: 999px;
    font-size: .75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .03em;
}
.payment-status--completed { background: #d1fae5; color: #065f46; }
.payment-status--pending   { background: #fef3c7; color: #92400e; }
.payment-status--failed    { background: #fee2e2; color: #991b1b; }
.payment-status--refunded  { background: #e0e7ff; color: #3730a3; }

/* Provider badges */
.badge--robokassa { background: #dbeafe; color: #1e40af; padding: .2rem .5rem; border-radius: 4px; font-size: .75rem; font-weight: 600; }
.badge--stripe    { background: #ede9fe; color: #5b21b6; padding: .2rem .5rem; border-radius: 4px; font-size: .75rem; font-weight: 600; }

[data-dark] .payment-status--completed { background: #064e3b; color: #6ee7b7; }
[data-dark] .payment-status--pending   { background: #451a03; color: #fcd34d; }
[data-dark] .payment-status--failed    { background: #450a0a; color: #fca5a5; }
[data-dark] .payment-status--refunded  { background: #1e1b4b; color: #a5b4fc; }
[data-dark] .badge--robokassa          { background: #1e3a5f; color: #93c5fd; }
[data-dark] .badge--stripe             { background: #2e1065; color: #c4b5fd; }

.link-subtle { color: inherit; text-decoration: none; }
.link-subtle:hover { text-decoration: underline; }
