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

/* .btn-primary объявляет display: inline-flex, который перебивает браузерное
   правило для атрибута hidden — из-за этого кнопка «Войти по email» на
   /auth/magic/ была видна всегда, даже при успешном входе.
   Правило намеренно УЗКОЕ (только кнопки): глобальный [hidden] с !important
   ломает компоненты, которые показывают себя через inline-display (например
   панель истории в сайдбаре). */
.btn-primary[hidden],
.btn-secondary[hidden] {
    display: none !important;
}

:root {
    --primary: #0891b2;
    --primary-hover: #0e7490;
    --accent: #0891b2;          /* alias на primary — используется в .pricing-card-btn и др. */
    --success: #10b981;
    --error: #ef4444;
    --bg: #f8fafc;
    --card-bg: #ffffff;
    --text: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --radius: 12px;
    --gradient-start: #0891b2;
    --gradient-end: #10b981;
    --body-gradient: linear-gradient(135deg, #e0f2fe 0%, #ccfbf1 50%, #d1fae5 100%);
}

/* Dark Theme */
[data-theme="dark"] {
    --primary: #22d3ee;
    --primary-hover: #67e8f9;
    --accent: #22d3ee;
    --success: #34d399;
    --error: #f87171;
    --bg: #0f172a;
    --card-bg: #1e293b;
    --text: #f1f5f9;
    --text-muted: #94a3b8;
    --border: #334155;
    --gradient-start: #22d3ee;
    --gradient-end: #34d399;
    --body-gradient: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0f172a 100%);
}

[data-theme="dark"] body {
    background: var(--body-gradient);
}

[data-theme="dark"] .hero h1 {
    color: var(--text);
}

[data-theme="dark"] .error-message {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(248, 113, 113, 0.3);
}

[data-theme="dark"] .result-content .math-block {
    background: var(--bg);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: linear-gradient(135deg, #e0f2fe 0%, #ccfbf1 50%, #d1fae5 100%);
    background-attachment: fixed;
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    padding-top: 70px;
}

/* Site Header */
.site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 70px;
    background: var(--card-bg);
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    z-index: 1000;
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    height: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text);
    text-decoration: none;
    background: linear-gradient(135deg, var(--gradient-start) 0%, var(--gradient-end) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.main-nav {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
    margin-left: auto;  /* desktop: прижимает nav и всё правее к правому краю */
}

.main-nav a {
    color: var(--text-muted);
    text-decoration: none;
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.main-nav a:hover {
    color: var(--primary);
    background: rgba(8, 145, 178, 0.1);
}

.main-nav a.active {
    color: var(--primary);
    background: rgba(8, 145, 178, 0.1);
}

.nav-pricing-link {
    color: var(--primary) !important;
    background: rgba(8, 145, 178, 0.08);
    border: 1px solid rgba(8, 145, 178, 0.25);
    font-weight: 600 !important;
}

.nav-pricing-link:hover {
    background: rgba(8, 145, 178, 0.15) !important;
}

.nav-pricing-link.active {
    background: var(--primary) !important;
    color: #fff !important;
    border-color: var(--primary);
}

/* Dropdown Menu */
.nav-dropdown {
    position: relative;
}

.nav-dropdown-btn {
    color: var(--text-muted);
    background: none;
    border: none;
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: inherit;
}

.nav-dropdown-btn:hover {
    color: var(--primary);
    background: rgba(8, 145, 178, 0.1);
}

.dropdown-arrow {
    font-size: 0.7rem;
    transition: transform 0.2s ease;
}

.nav-dropdown:hover .dropdown-arrow {
    transform: rotate(180deg);
}

.nav-dropdown-content {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 220px;
    background: var(--card-bg);
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    padding: 8px 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.2s ease;
    z-index: 1000;
}

.nav-dropdown:hover .nav-dropdown-content {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.nav-dropdown-content a {
    display: block;
    padding: 10px 16px;
    color: var(--text);
    text-decoration: none;
    font-size: 0.9rem;
    transition: background 0.2s ease;
    border-radius: 0;
}

.nav-dropdown-content a:hover {
    background: rgba(8, 145, 178, 0.1);
    color: var(--primary);
}

.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 36px;
    height: 36px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
}

.nav-toggle span {
    display: block;
    width: 100%;
    height: 2px;
    background: var(--text);
    border-radius: 2px;
    transition: all 0.3s ease;
}

@media (max-width: 900px) {
    .main-nav {
        position: fixed;
        top: 70px;
        left: 0;
        right: 0;
        background: var(--card-bg);
        flex-direction: column;
        padding: 16px;
        box-shadow: 0 4px 20px rgba(0,0,0,0.1);
        transform: translateY(-100%);
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
        margin-left: 0;  /* сбросить desktop margin-left:auto */
    }

    /* На мобильном main-nav fixed → прижимаем auth+burger к правому краю */
    #authContainer {
        margin-left: auto;
    }

    .header-container {
        gap: 8px;  /* плотнее группа auth+burger */
    }

    .main-nav.open {
        transform: translateY(0);
        opacity: 1;
        visibility: visible;
    }

    .main-nav a {
        padding: 12px 16px;
        border-radius: 8px;
    }

    .nav-dropdown {
        width: 100%;
    }

    .nav-dropdown-btn {
        width: 100%;
        padding: 12px 16px;
        justify-content: space-between;
    }

    .nav-dropdown-content {
        position: static;
        box-shadow: none;
        background: rgba(8, 145, 178, 0.05);
        border-radius: 8px;
        margin-top: 4px;
        max-height: 0;
        overflow: hidden;
        opacity: 1;
        visibility: visible;
        transform: none;
        transition: max-height 0.3s ease;
    }

    .nav-dropdown.open .nav-dropdown-content {
        max-height: 500px;
    }

    .nav-dropdown.open .dropdown-arrow {
        transform: rotate(180deg);
    }

    .nav-dropdown:not(.open):hover .nav-dropdown-content {
        max-height: 0;
    }

    .nav-dropdown:not(.open):hover .dropdown-arrow {
        transform: none;
    }

    .nav-toggle {
        display: flex;
    }

    .nav-toggle.active span:nth-child(1) {
        transform: rotate(45deg) translate(5px, 5px);
    }

    .nav-toggle.active span:nth-child(2) {
        opacity: 0;
    }

    .nav-toggle.active span:nth-child(3) {
        transform: rotate(-45deg) translate(5px, -5px);
    }
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    overflow-x: hidden;
}

/* Hero */
.hero {
    text-align: center;
    padding: 8px 0;
}

.hero h1 {
    font-size: 2rem;
    margin-bottom: 0;
    color: #1a1a1a;
}

.subtitle {
    font-size: 1.1rem;
    color: var(--text-muted);
    max-width: 600px;
    margin: 0 auto;
}

.hero-socials {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 12px;
    margin-bottom: 16px;
}

.hero-socials-links {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.hero-socials-label {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.hero-social-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    text-decoration: none;
    transition: opacity 0.2s, transform 0.2s;
}

.hero-social-link:hover {
    opacity: 0.85;
    transform: translateY(-1px);
}

.hero-social-tg {
    background: #2AABEE;
    color: #fff;
}

.hero-social-bot {
    background: linear-gradient(135deg, #0891b2, #10b981);
    color: #fff;
}

.hero-social-vk {
    background: #0077FF;
    color: #fff;
}

.hero-social-rustore {
    background: #0077FF;
    color: #fff;
    background: linear-gradient(135deg, #00C853, #009624);
}

/* Bot QR Section */
.bot-qr-section {
    margin-bottom: 16px;
}

.bot-qr-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 30px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    display: flex;
    align-items: center;
    gap: 30px;
    border: 1px solid rgba(8, 145, 178, 0.15);
}

.bot-qr-image img {
    border-radius: 12px;
    border: 2px solid var(--border);
    display: block;
}

.bot-qr-content h3 {
    font-size: 1.3rem;
    margin-bottom: 10px;
    background: linear-gradient(135deg, var(--gradient-start) 0%, var(--gradient-end) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.bot-qr-content p {
    color: var(--text-muted);
    margin-bottom: 16px;
    line-height: 1.6;
}

.btn-bot {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: #2AABEE;
    color: #fff;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.btn-bot:hover {
    background: #229ED9;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(42, 171, 238, 0.4);
}

@media (max-width: 600px) {
    .bot-qr-card {
        flex-direction: column;
        text-align: center;
        padding: 24px;
    }

    .bot-qr-image img {
        width: 160px;
        height: 160px;
    }

    .btn-bot,
    .btn-rustore {
        width: 100%;
        justify-content: center;
    }
}

/* App Promo Section */
.app-promo-section {
    margin-bottom: 16px;
}

.app-promo-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 30px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    display: flex;
    align-items: center;
    gap: 24px;
    border: 1px solid rgba(0, 200, 83, 0.2);
}

.app-promo-icon {
    flex-shrink: 0;
}

.app-promo-icon svg {
    display: block;
}

.app-promo-content h3 {
    font-size: 1.3rem;
    margin-bottom: 10px;
    background: linear-gradient(135deg, #00C853, #009624);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.app-promo-content p {
    color: var(--text-muted);
    margin-bottom: 16px;
    line-height: 1.6;
}

.btn-rustore {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: linear-gradient(135deg, #00C853, #009624);
    color: #fff;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.btn-rustore:hover {
    background: linear-gradient(135deg, #00E676, #00C853);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 200, 83, 0.4);
}

.app-promo-buttons {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.btn-google-play {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: linear-gradient(135deg, #414141, #2b2b2b);
    color: #fff;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.btn-google-play:hover {
    background: linear-gradient(135deg, #555, #414141);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

@media (max-width: 600px) {
    .app-promo-card {
        flex-direction: column;
        text-align: center;
        padding: 24px;
    }

    .app-promo-buttons {
        flex-direction: column;
    }

    .app-promo-buttons .btn-google-play,
    .app-promo-buttons .btn-rustore {
        width: 100%;
        justify-content: center;
    }
}

/* Upload Section */
.upload-section {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 30px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin-bottom: 16px;
}

.photo-guidelines {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 30px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin-bottom: 24px;
}

.photo-guidelines-title {
    font-size: 1.25rem;
    margin-bottom: 12px;
    color: var(--text);
    text-align: center;
}

.guidelines-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.guidelines-list li {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.guideline-icon {
    flex-shrink: 0;
    font-size: 1.1rem;
    width: 24px;
    text-align: center;
}

.sample-photo {
    margin-bottom: 16px;
    text-align: center;
}

.sample-photo img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius);
}

.upload-area {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 50px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.upload-area:hover,
.upload-area.dragover {
    border-color: var(--primary);
    background: linear-gradient(135deg, rgba(8, 145, 178, 0.05) 0%, rgba(16, 185, 129, 0.05) 100%);
}

.upload-icon {
    margin-bottom: 16px;
}

.upload-icon svg {
    transition: transform 0.3s ease;
}

.upload-area:hover .upload-icon svg {
    transform: scale(1.1);
}

.upload-text {
    font-size: 1.1rem;
    color: var(--text);
    margin-bottom: 8px;
}

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

/* Preview */
.preview-container {
    margin-top: 20px;
    text-align: center;
}

.preview-wrapper {
    position: relative;
    display: inline-block;
}

.preview-container img {
    max-width: 100%;
    max-height: 400px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    display: block;
}

.btn-remove {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    padding: 0;
    background: var(--error);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    transition: transform 0.15s ease, background 0.15s ease;
}

.btn-remove:hover {
    background: #dc2626;
    transform: scale(1.1);
}

/* User Comment Field */
.user-comment-container {
    margin-top: 20px;
}

.user-comment {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--card-bg);
    color: var(--text);
    font-family: inherit;
    font-size: 0.95rem;
    resize: vertical;
    min-height: 60px;
    max-height: 200px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.user-comment:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(8, 145, 178, 0.1);
}

.user-comment::placeholder {
    color: var(--text-muted);
}

/* Solve Button */
.btn-solve {
    width: 100%;
    margin-top: 20px;
    padding: 16px 32px;
    background: linear-gradient(135deg, #0891b2 0%, #0d9488 50%, #10b981 100%);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(8, 145, 178, 0.35);
}

.btn-solve:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(8, 145, 178, 0.5);
    background: linear-gradient(135deg, #0e7490 0%, #0f766e 50%, #059669 100%);
}

.btn-solve:disabled {
    background: linear-gradient(135deg, rgba(8, 145, 178, 0.4) 0%, rgba(13, 148, 136, 0.4) 50%, rgba(16, 185, 129, 0.4) 100%);
    cursor: not-allowed;
    box-shadow: none;
    opacity: 0.7;
}

/* Блок F (F1): пометка уровня модели над решением (script.js renderQualityBadge) */
.quality-badge {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    margin: -8px 0 16px;
    padding: 4px 12px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--bg);
    color: var(--text-muted);
    font-size: 0.85rem;
    line-height: 1.4;
}

.quality-badge[hidden] {
    display: none;
}

.quality-badge--premium {
    border-color: var(--success);
    background: rgba(16, 185, 129, 0.08);
    color: #047857; /* темнее --success: контраст текста на светлом фоне ≥ 4.5:1 */
    font-weight: 500;
}

[data-theme="dark"] .quality-badge--premium {
    color: var(--success);
}

.quality-badge--premium::before {
    content: '\2713';
    font-weight: 700;
}

.quality-badge a {
    color: var(--primary);
    text-decoration: underline;
}

/* Result Section */
.result-section {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 30px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

.result-section h2 {
    margin-bottom: 20px;
    background: linear-gradient(135deg, var(--gradient-start) 0%, var(--gradient-end) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.result-content {
    font-size: 1rem;
    line-height: 1.8;
    overflow-x: auto;
    scrollbar-width: none;
    overflow-wrap: break-word;
    word-wrap: break-word;
}

.result-content::-webkit-scrollbar {
    display: none;
}

.result-content p {
    margin-bottom: 12px;
}

.result-content h3,
.result-content h4 {
    margin-top: 20px;
    margin-bottom: 10px;
    color: var(--text);
}

.result-content .math-block {
    margin: 16px 0;
    padding: 12px;
    background: #f8fafc;
    border-radius: 8px;
    overflow-x: auto;
    scrollbar-width: none;
    text-align: center;
}

.result-content .math-block::-webkit-scrollbar {
    display: none;
}

/* MathJax inline formulas */
.result-content mjx-container {
    display: inline-block !important;
}

/* Loading */
.loading {
    text-align: center;
    padding: 40px;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px;
}

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

/* Examples */
.examples {
    margin-bottom: 24px;
}

.examples h2 {
    text-align: center;
    margin-bottom: 24px;
}

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

.example-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.example-header {
    margin-bottom: 12px;
}

.example-subject {
    display: inline-block;
    background: linear-gradient(135deg, var(--gradient-start) 0%, var(--gradient-end) 100%);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
}

.example-task {
    font-size: 0.95rem;
    color: var(--text);
    margin-bottom: 12px;
    line-height: 1.5;
}

.example-solution {
    border-top: 1px solid var(--border);
    padding-top: 12px;
}

.example-solution summary {
    cursor: pointer;
    color: var(--primary);
    font-weight: 500;
    font-size: 0.9rem;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 6px;
}

.example-solution summary::-webkit-details-marker {
    display: none;
}

.example-solution summary::before {
    content: '▶';
    font-size: 0.7rem;
    transition: transform 0.2s ease;
}

.example-solution[open] summary::before {
    transform: rotate(90deg);
}

.example-content {
    margin-top: 12px;
    padding: 12px;
    background: var(--bg);
    border-radius: 8px;
    font-size: 0.9rem;
    line-height: 1.6;
}

.example-content p {
    margin-bottom: 6px;
}

.example-content p:last-child {
    margin-bottom: 0;
}

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

/* Benefits */
.benefits {
    margin-bottom: 24px;
}

.benefits h2 {
    text-align: center;
    margin-bottom: 20px;
}

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

.benefit-card {
    background: var(--card-bg);
    padding: 24px;
    border-radius: var(--radius);
    text-align: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.benefit-icon {
    font-size: 2.5rem;
    margin-bottom: 12px;
}

.benefit-card h3 {
    margin-bottom: 8px;
    font-size: 1.1rem;
}

.benefit-card p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Subjects */
.subjects {
    margin-bottom: 24px;
}

.subjects h2 {
    margin-bottom: 20px;
    text-align: center;
}

.subjects-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 30px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.subjects-card > p {
    color: var(--text-muted);
    margin-bottom: 20px;
    text-align: justify;
}

.subjects-heading {
    font-size: 1rem;
    color: var(--text-muted);
    margin: 20px 0 12px;
    font-weight: 600;
    text-align: center;
}

.subjects-heading:first-of-type {
    margin-top: 10px;
}

.subjects-list {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
}

.subject-tag {
    background: linear-gradient(135deg, rgba(8, 145, 178, 0.1) 0%, rgba(16, 185, 129, 0.1) 100%);
    color: #0e7490;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
    border: 1px solid rgba(8, 145, 178, 0.2);
    transition: all 0.2s ease;
    text-decoration: none;
}

.subject-tag:hover {
    background: linear-gradient(135deg, rgba(8, 145, 178, 0.2) 0%, rgba(16, 185, 129, 0.2) 100%);
    transform: translateY(-1px);
}

.subjects-note {
    color: var(--text-muted);
    font-size: 0.9rem;
    text-align: justify;
}

/* Formulas and Terms Section */
.formulas-terms {
    margin-bottom: 24px;
}

.formulas-terms h2 {
    text-align: center;
    margin-bottom: 8px;
}

.formulas-terms-subtitle {
    text-align: center;
    color: var(--text-muted);
    margin-bottom: 24px;
}

.formulas-terms-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.formula-term-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 24px;
    text-decoration: none;
    color: var(--text);
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.formula-term-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(8, 145, 178, 0.15);
}

.formula-term-icon {
    font-size: 2.5rem;
    margin-bottom: 12px;
}

.formula-term-card h3 {
    font-size: 1.1rem;
    margin-bottom: 8px;
    background: linear-gradient(135deg, var(--gradient-start) 0%, var(--gradient-end) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.formula-term-card p {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.4;
}

@media (max-width: 900px) {
    .formulas-terms-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .formulas-terms-grid {
        grid-template-columns: 1fr;
    }

    .formula-term-card {
        padding: 20px;
    }

    .formula-term-icon {
        font-size: 2rem;
    }
}

/* FAQ */
.faq {
    margin-bottom: 24px;
}

.faq h2 {
    text-align: center;
    margin-bottom: 24px;
}

.faq-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.faq-item {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.faq-item summary {
    padding: 20px;
    cursor: pointer;
    font-weight: 600;
    list-style: none;
}

.faq-item summary::-webkit-details-marker {
    display: none;
}

.faq-item summary::before {
    content: '+';
    margin-right: 12px;
    font-size: 1.2rem;
    color: var(--gradient-start);
}

.faq-item[open] summary::before {
    content: '−';
}

.faq-item p {
    padding: 0 20px 20px;
    color: var(--text-muted);
}

/* Условия подписки внутри <details> на /pricing/ — список с обычным цветом и отступами */
.pricing-conditions {
    margin: 32px 0 16px;
}
.pricing-conditions summary {
    font-size: 1.3rem;
}
.pricing-conditions ul {
    padding: 0 20px 20px 44px;
    color: var(--text);
    line-height: 1.6;
}
.pricing-conditions ul li {
    margin-bottom: 8px;
}

/* Description */
.description {
    margin-bottom: 24px;
}

.description h2 {
    margin-bottom: 20px;
    text-align: center;
}

.description-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 30px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.description-card p {
    color: var(--text-muted);
    margin-bottom: 12px;
    text-align: justify;
}

.description-card p:last-child {
    margin-bottom: 0;
}

/* Breadcrumbs */
.breadcrumbs {
    padding: 8px 0 0;
    margin-bottom: 0;
    font-size: 0.9rem;
    color: var(--text-muted);
}

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

.breadcrumbs a:hover {
    text-decoration: underline;
}

.breadcrumbs span {
    margin: 0 8px;
}

/* Class Selector */
.class-selector {
    text-align: center;
    margin-bottom: 20px;
}

.class-selector label {
    margin-right: 12px;
    color: var(--text);
    font-weight: 500;
}

.class-select {
    padding: 10px 16px;
    font-size: 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--card-bg);
    color: var(--text);
    cursor: pointer;
    min-width: 180px;
}

.class-select:focus {
    outline: none;
    border-color: var(--primary);
}

/* Subject Info */
.subject-info {
    margin-bottom: 24px;
}

.subject-info h2 {
    text-align: center;
    margin-bottom: 20px;
}

.subject-info-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 30px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.subject-info-card > p {
    color: var(--text-muted);
    margin-bottom: 20px;
    text-align: center;
}

.topic-groups {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.topic-group h4 {
    color: var(--text);
    margin-bottom: 12px;
    font-size: 1rem;
}

.topic-group ul {
    list-style: none;
    padding: 0;
}

.topic-group li {
    color: var(--text-muted);
    padding: 6px 0;
    padding-left: 20px;
    position: relative;
    font-size: 0.9rem;
}

.topic-group li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: var(--success);
}

/* Formulas CTA */
.formulas-cta {
    margin-bottom: 24px;
}

.formulas-cta-card {
    background: linear-gradient(135deg, rgba(8, 145, 178, 0.08) 0%, rgba(16, 185, 129, 0.08) 100%);
    border: 1px solid rgba(8, 145, 178, 0.2);
    border-radius: var(--radius);
    padding: 32px;
    display: flex;
    align-items: center;
    gap: 24px;
}

.formulas-cta-icon {
    font-size: 3rem;
    flex-shrink: 0;
}

.formulas-cta-content h3 {
    font-size: 1.25rem;
    margin-bottom: 8px;
    background: linear-gradient(135deg, var(--gradient-start) 0%, var(--gradient-end) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.formulas-cta-content p {
    color: var(--text-muted);
    margin-bottom: 16px;
    line-height: 1.6;
}

.btn-formulas {
    display: inline-block;
    padding: 12px 24px;
    background: linear-gradient(135deg, var(--gradient-start) 0%, var(--gradient-end) 100%);
    color: #fff;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-formulas:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(8, 145, 178, 0.3);
}

@media (max-width: 600px) {
    .formulas-cta-card {
        flex-direction: column;
        text-align: center;
        padding: 24px;
    }

    .formulas-cta-icon {
        font-size: 2.5rem;
    }

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

/* Other Subjects */
.other-subjects {
    margin-bottom: 24px;
}

.other-subjects h2 {
    text-align: center;
    margin-bottom: 20px;
}

.subjects-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
}

.subject-link {
    display: inline-block;
    padding: 10px 20px;
    background: var(--card-bg);
    color: var(--text);
    text-decoration: none;
    border-radius: 8px;
    font-size: 0.95rem;
    border: 1px solid var(--border);
    transition: all 0.2s ease;
}

.subject-link:hover {
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

@media (max-width: 768px) {
    .topic-groups {
        grid-template-columns: 1fr;
    }
}

/* Formula Pages */
.formulas-section,
.terms-section {
    margin-bottom: 20px;
}

.formulas-section h2,
.terms-section h2 {
    margin-bottom: 16px;
    font-size: 1.3rem;
    color: var(--text);
    text-align: center;
}

.formula-card,
.terms-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.formula-item {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
    scrollbar-width: none;
}

.formula-item::-webkit-scrollbar {
    display: none;
}

.term-item {
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
    text-align: justify;
}

.formula-item:last-child,
.term-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.formula-item:first-child,
.term-item:first-child {
    padding-top: 0;
}

.formula-name {
    font-weight: 600;
    color: var(--text);
    margin-right: 8px;
}

.term-name {
    font-weight: 600;
    color: var(--text);
}

.formula-math {
    color: var(--text);
    font-size: 1.1rem;
    min-width: 0;
}

.term-definition {
    color: var(--text-muted);
}

/* CTA Section */
.cta-section {
    text-align: center;
    margin: 40px 0;
    padding: 40px;
    background: linear-gradient(135deg, rgba(8, 145, 178, 0.1) 0%, rgba(16, 185, 129, 0.1) 100%);
    border-radius: var(--radius);
}

.cta-section h2 {
    margin-bottom: 12px;
}

.cta-section p {
    color: var(--text-muted);
    margin-bottom: 20px;
}

.cta-section .btn-solve {
    display: inline-block;
    width: auto;
    text-decoration: none;
    text-align: center;
}

@media (max-width: 600px) {
    .formula-card,
    .terms-card {
        padding: 16px;
    }

    .formula-item {
        flex-direction: column;
        gap: 4px;
    }

    .formula-name {
        margin-right: 0;
    }
}

/* Static Pages (Privacy Policy, etc.) */
.static-page {
    padding: 20px 0 40px;
    line-height: 1.7;
}

.static-page h1 {
    font-size: 1.8rem;
    margin-bottom: 8px;
}

.static-page-updated {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 32px;
}

.static-page h2 {
    font-size: 1.3rem;
    margin-top: 32px;
    margin-bottom: 12px;
    color: var(--text-color);
}

.static-page h3 {
    font-size: 1.1rem;
    margin-top: 20px;
    margin-bottom: 8px;
    color: var(--text-color);
}

.static-page p {
    margin-bottom: 12px;
    color: var(--text-secondary);
}

.static-page ul {
    margin: 0 0 12px 20px;
    color: var(--text-secondary);
}

.static-page ul li {
    margin-bottom: 6px;
}

.static-page a {
    color: var(--accent);
    text-decoration: none;
}

.static-page a:hover {
    text-decoration: underline;
}

/* Repetitor Page */
.rep-section {
    margin-bottom: 24px;
}

.rep-section > h2 {
    text-align: center;
    margin-bottom: 20px;
    font-size: 1.4rem;
}

.rep-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 30px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.rep-card h3 {
    font-size: 1.15rem;
    margin-top: 20px;
    margin-bottom: 12px;
    color: var(--text);
}

.rep-card h3:first-child {
    margin-top: 0;
}

/* Intro */
.rep-intro-card {
    background: linear-gradient(135deg, rgba(8,145,178,0.06) 0%, rgba(16,185,129,0.06) 100%);
    border: 1px solid rgba(8,145,178,0.15);
}

.repetitor-intro {
    display: flex;
    gap: 28px;
    align-items: flex-start;
}

.repetitor-photo {
    width: 200px;
    height: auto;
    border-radius: 16px;
    flex-shrink: 0;
    object-fit: cover;
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

.rep-intro-text p {
    color: var(--text-secondary, var(--text-muted));
    line-height: 1.7;
    margin-bottom: 10px;
}

.rep-stats {
    display: flex;
    gap: 20px;
    margin-top: 18px;
}

.rep-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px 18px;
    background: var(--card-bg);
    border-radius: 10px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.rep-stat-value {
    font-weight: 700;
    font-size: 1.1rem;
    background: linear-gradient(135deg, var(--gradient-start) 0%, var(--gradient-end) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.rep-stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 2px;
}

/* Subjects grid */
.rep-subjects-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.rep-subject-card {
    text-align: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.rep-subject-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

.rep-subject-icon {
    font-size: 2.5rem;
    margin-bottom: 8px;
}

.rep-subject-card h3 {
    margin-top: 0;
    font-size: 1.2rem;
    margin-bottom: 14px;
    background: linear-gradient(135deg, var(--gradient-start) 0%, var(--gradient-end) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.rep-subject-card ul {
    text-align: left;
    list-style: none;
    padding: 0;
    margin: 0;
}

.rep-subject-card ul li {
    padding: 6px 0;
    border-bottom: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.92rem;
}

.rep-subject-card ul li:last-child {
    border-bottom: none;
}

/* Price */
.rep-price-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 30px;
}

.rep-price-block h3 {
    margin-top: 0;
    margin-bottom: 16px;
}

.rep-price-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.95rem;
}

.rep-price-item:last-child {
    border-bottom: none;
}

.rep-price {
    font-weight: 700;
    color: var(--text);
    white-space: nowrap;
    margin-left: 12px;
}

.rep-price-note {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 20px;
    margin-bottom: 0;
}

/* Help grid */
.rep-help-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.rep-help-card {
    text-align: center;
    padding: 20px 16px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.rep-help-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

.rep-help-icon {
    font-size: 1.8rem;
    margin-bottom: 8px;
}

.rep-help-card span {
    font-size: 0.95rem;
    color: var(--text-muted);
    line-height: 1.4;
}

/* Approach */
.rep-approach-card {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.rep-approach-item {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    padding: 16px;
    border-radius: 10px;
    background: linear-gradient(135deg, rgba(8,145,178,0.04) 0%, rgba(16,185,129,0.04) 100%);
}

.rep-approach-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.rep-approach-item p {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.5;
}

/* Lists inside cards */
.rep-list {
    margin: 0 0 16px 0;
    padding-left: 20px;
    color: var(--text-muted);
}

.rep-list li {
    margin-bottom: 8px;
    line-height: 1.6;
}

.rep-list-medals {
    list-style: none;
    padding-left: 0;
}

.rep-list-medals li {
    padding-left: 28px;
    position: relative;
}

.rep-list-medals li::before {
    content: attr(data-medal);
    position: absolute;
    left: 0;
    top: 0;
}

/* CTA / Contact */
.rep-cta-card {
    background: linear-gradient(135deg, rgba(8,145,178,0.08) 0%, rgba(16,185,129,0.08) 100%);
    border: 1px solid rgba(8,145,178,0.2);
    text-align: center;
}

.rep-cta-card h2 {
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 1.4rem;
    background: linear-gradient(135deg, var(--gradient-start) 0%, var(--gradient-end) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.rep-cta-card p {
    color: var(--text-muted);
    margin-bottom: 20px;
}

.rep-contacts {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.rep-contact-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 10px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.rep-contact-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.rep-contact-tg {
    background: #2AABEE;
    color: #fff;
}

.rep-contact-email {
    background: var(--card-bg);
    color: var(--text);
    border: 1px solid var(--border);
}

.rep-contact-vk {
    background: #0077FF;
    color: #fff;
}

/* Format grid */
.rep-format-grid {
    grid-template-columns: repeat(3, 1fr);
}

/* Responsive */
@media (max-width: 900px) {
    .rep-price-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .rep-approach-card {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    .repetitor-intro {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .repetitor-photo {
        width: 180px;
    }

    .rep-stats {
        justify-content: center;
        flex-wrap: wrap;
    }

    .rep-stat {
        padding: 8px 14px;
    }

    .rep-subjects-grid {
        grid-template-columns: 1fr;
    }

    .rep-price-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .rep-price-item {
        font-size: 0.88rem;
        gap: 8px;
    }

    .rep-price-item span:first-child {
        min-width: 0;
        word-break: break-word;
    }

    .rep-help-grid,
    .rep-format-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .rep-approach-card {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .rep-card {
        padding: 18px;
        overflow-wrap: break-word;
        word-wrap: break-word;
    }

    .rep-list {
        padding-left: 16px;
    }

    .rep-list li {
        font-size: 0.9rem;
    }

    .rep-list-medals li {
        padding-left: 24px;
        font-size: 0.9rem;
    }

    .rep-contact-btn {
        width: 100%;
        justify-content: center;
    }

    .rep-section > h2 {
        font-size: 1.2rem;
    }
}

/* Footer */
.footer {
    text-align: center;
    padding: 30px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.footer-socials {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.footer-social-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 8px;
    background: var(--card-bg);
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.2s, background 0.2s;
}

.footer-social-link:hover {
    color: var(--accent);
    background: var(--hover-bg);
}

.footer-link {
    color: var(--text-muted);
    text-decoration: none;
}

.footer-link:hover {
    color: var(--accent);
    text-decoration: underline;
}

.footer-legal {
    margin-top: 16px;
    font-size: 0.85rem;
    line-height: 1.7;
}

.footer-legal-info,
.footer-legal-links,
.footer-copyright {
    margin: 6px 0;
}

.footer-legal-info a {
    color: var(--text-muted);
    text-decoration: none;
}

.footer-legal-info a:hover {
    color: var(--accent);
}

.footer-legal-links a {
    margin: 0 2px;
}

.footer-copyright {
    color: var(--text-muted);
    opacity: 0.8;
    margin-top: 12px;
}

/* Pricing page */
.pricing-intro {
    text-align: center;
    font-size: 1.05rem;
    color: var(--text-muted);
    max-width: 700px;
    margin: 0 auto 32px;
}

.pricing-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
    margin: 32px auto;
    max-width: 760px;
}

@media (max-width: 600px) {
    .pricing-grid {
        grid-template-columns: 1fr;
        max-width: 420px;
    }
}

.pricing-card {
    position: relative;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 28px 22px;
    display: flex;
    flex-direction: column;
    transition: transform 0.2s, box-shadow 0.2s;
}

.pricing-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.08);
}

.pricing-card-featured {
    border-color: var(--accent);
    border-width: 2px;
}

.pricing-card-badge {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--accent);
    color: #fff;
    padding: 4px 14px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

.pricing-card-header {
    text-align: center;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 18px;
}

.pricing-card-title {
    font-size: 1.4rem;
    font-weight: 700;
    margin: 0 0 12px;
    color: var(--text);
}

.pricing-card-price {
    display: flex;
    justify-content: center;
    align-items: baseline;
    gap: 4px;
    margin: 8px 0 4px;
}

.pricing-amount {
    font-size: 2.4rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1;
}

.pricing-currency {
    font-size: 1.4rem;
    color: var(--text-muted);
}

.pricing-card-period {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin: 0;
}

.pricing-asterisk {
    color: var(--accent, #0891b2);
    font-weight: 600;
}

.pricing-footnote {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin: 16px 0 0;
    line-height: 1.5;
    padding: 0 4px;
}

.pricing-card-features {
    list-style: none;
    padding: 0;
    margin: 0 0 24px;
    flex-grow: 1;
}

.pricing-card-features li {
    padding: 8px 0;
    font-size: 0.95rem;
    color: var(--text);
    border-bottom: 1px dashed var(--border-color);
    position: relative;
    padding-left: 24px;
}

.pricing-card-features li::before {
    content: "✓";
    position: absolute;
    left: 0;
    top: 8px;
    color: var(--accent);
    font-weight: 700;
}

.pricing-card-features li:last-child {
    border-bottom: none;
}

.pricing-card-btn {
    background: var(--accent);
    color: #fff;
    border: none;
    padding: 12px 20px;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.1s;
    width: 100%;
}

.pricing-card-btn:hover {
    opacity: 0.9;
}

.pricing-card-btn:active {
    transform: scale(0.98);
}

.pricing-card-note {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    margin: auto 0 0;
}

.pricing-footer-note {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
}

/* Error */
.error-message {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: var(--error);
    padding: 16px;
    border-radius: var(--radius);
    margin-top: 20px;
}

/* Responsive */
@media (max-width: 900px) {
    .benefits-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .hero {
        padding: 4px 0;
    }

    .hero h1 {
        font-size: 1.5rem;
    }

    .upload-section {
        margin-bottom: 12px;
    }

    .bot-qr-section,
    .app-promo-section {
        margin-bottom: 12px;
    }

    .examples,
    .benefits,
    .subjects,
    .formulas-terms,
    .faq,
    .description,
    .subject-info,
    .formulas-cta,
    .other-subjects,
    .photo-guidelines {
        margin-bottom: 16px;
    }

    .photo-guidelines-title {
        font-size: 1.15rem;
    }

    .guidelines-list li {
        font-size: 0.9rem;
    }

    .upload-area {
        padding: 30px 15px;
    }

    .upload-icon {
        font-size: 2.5rem;
    }

    .benefits-grid {
        grid-template-columns: 1fr;
    }

    .result-actions {
        flex-direction: column;
        gap: 16px;
    }

    .feedback-buttons {
        justify-content: center;
    }
}

/* Theme Toggle Button */
.theme-toggle {
    position: fixed;
    top: 90px;
    right: 20px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    background: var(--card-bg);
    box-shadow: 0 2px 10px rgba(0,0,0,0.15);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 1000;
    color: var(--text);
}

.theme-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}

.theme-toggle .icon-sun {
    display: block;
}

.theme-toggle .icon-moon {
    display: none;
}

[data-theme="dark"] .theme-toggle .icon-sun {
    display: none;
}

[data-theme="dark"] .theme-toggle .icon-moon {
    display: block;
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--text);
    color: var(--card-bg);
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    box-shadow: 0 4px 20px rgba(0,0,0,0.25);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 1001;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* Result Action Buttons */
.result-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
}

.btn-action {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--card-bg);
    color: var(--text);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-action:hover {
    background: var(--bg);
    border-color: var(--primary);
    color: var(--primary);
}

.btn-action svg {
    flex-shrink: 0;
}

.action-buttons-left {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.btn-pdf:hover {
    border-color: var(--error);
    color: var(--error);
}

.feedback-buttons {
    display: flex;
    align-items: center;
    gap: 12px;
}

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

.btn-feedback {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--card-bg);
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-feedback:hover {
    transform: scale(1.1);
}

.btn-helpful:hover {
    border-color: var(--success);
    color: var(--success);
    background: rgba(16, 185, 129, 0.1);
}

.btn-not-helpful:hover {
    border-color: var(--error);
    color: var(--error);
    background: rgba(239, 68, 68, 0.1);
}

.btn-feedback.active {
    transform: scale(1.1);
}

.btn-helpful.active {
    border-color: var(--success);
    color: white;
    background: var(--success);
}

.btn-not-helpful.active {
    border-color: var(--error);
    color: white;
    background: var(--error);
}

.feedback-thanks {
    margin-top: 16px;
    padding: 12px;
    background: linear-gradient(135deg, rgba(8, 145, 178, 0.1) 0%, rgba(16, 185, 129, 0.1) 100%);
    border-radius: 8px;
    text-align: center;
    color: var(--primary);
    font-weight: 500;
}

/* History Button */
.history-toggle {
    position: fixed;
    top: 150px;
    right: 20px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    background: var(--card-bg);
    box-shadow: 0 2px 10px rgba(0,0,0,0.15);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 999;
    color: var(--text);
}

.history-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}

.history-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--primary);
    color: white;
    font-size: 0.7rem;
    font-weight: 600;
    min-width: 20px;
    height: 20px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
}

/* History Panel */
.history-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1001;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.history-overlay:not([hidden]) {
    opacity: 1;
}

.history-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 380px;
    max-width: 90vw;
    height: 100vh;
    background: var(--card-bg);
    box-shadow: -4px 0 20px rgba(0,0,0,0.15);
    z-index: 1002;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.3s ease;
}

.history-panel:not([hidden]) {
    transform: translateX(0);
}

.history-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    border-bottom: 1px solid var(--border);
}

.history-header h3 {
    margin: 0;
    font-size: 1.2rem;
    color: var(--text);
}

.history-close {
    width: 36px;
    height: 36px;
    border: none;
    background: none;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.history-close:hover {
    background: var(--bg);
    color: var(--text);
}

.history-actions {
    padding: 12px 20px;
    border-bottom: 1px solid var(--border);
}

.btn-clear-history {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--error);
    background: transparent;
    color: var(--error);
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-clear-history:hover {
    background: var(--error);
    color: white;
}

.history-list {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.history-empty {
    text-align: center;
    color: var(--text-muted);
    padding: 40px 20px;
}

.history-item {
    background: var(--bg);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.history-item:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.history-item-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 10px;
}

.history-item-image {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 8px;
    flex-shrink: 0;
}

.history-item-info {
    flex: 1;
    min-width: 0;
}

.history-item-date {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.history-item-preview {
    font-size: 0.9rem;
    color: var(--text);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.history-item-delete {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    border: none;
    background: var(--card-bg);
    color: var(--text-muted);
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.2s ease;
}

.history-item:hover .history-item-delete {
    opacity: 1;
}

.history-item-delete:hover {
    background: var(--error);
    color: white;
}

/* Tips List */
.tips-list {
    list-style: none;
    padding: 0;
    counter-reset: tips-counter;
}

.tips-list li {
    counter-increment: tips-counter;
    padding: 14px 14px 14px 48px;
    position: relative;
    border-bottom: 1px solid var(--border);
    color: var(--text-muted);
    text-align: justify;
    line-height: 1.6;
    font-size: 0.95rem;
}

.tips-list li:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.tips-list li::before {
    content: counter(tips-counter);
    position: absolute;
    left: 0;
    top: 14px;
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--gradient-start) 0%, var(--gradient-end) 100%);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.85rem;
}

.tips-list li strong {
    color: var(--text);
}

/* Exam Tips Section */
.exam-structure {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-top: 20px;
}

.exam-block {
    background: var(--bg);
    border-radius: 10px;
    padding: 20px;
    border: 1px solid var(--border);
}

.exam-block h4 {
    color: var(--text);
    margin-bottom: 10px;
    font-size: 1rem;
}

.exam-block ul {
    list-style: none;
    padding: 0;
}

.exam-block li {
    color: var(--text-muted);
    padding: 4px 0;
    padding-left: 20px;
    position: relative;
    font-size: 0.9rem;
}

.exam-block li::before {
    content: '→';
    position: absolute;
    left: 0;
    color: var(--primary);
}

@media (max-width: 600px) {
    .exam-structure {
        grid-template-columns: 1fr;
    }
}

/* 404 Error Page */
.error-page {
    min-height: 80vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem;
}

.error-code {
    font-size: 8rem;
    font-weight: 800;
    background: linear-gradient(135deg, #0891b2 0%, #10b981 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1;
    margin-bottom: 1rem;
}

.error-title {
    font-size: 1.75rem;
    color: var(--text);
    margin-bottom: 1rem;
}

.error-description {
    font-size: 1.1rem;
    color: var(--text-muted);
    margin-bottom: 2rem;
    max-width: 400px;
}

.btn-home {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 2rem;
    background: linear-gradient(135deg, #0891b2 0%, #10b981 100%);
    color: white;
    text-decoration: none;
    border-radius: 12px;
    font-weight: 600;
    font-size: 1.1rem;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-home:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(8, 145, 178, 0.3);
}

.btn-home svg {
    width: 20px;
    height: 20px;
}

@media (max-width: 480px) {
    .error-code {
        font-size: 5rem;
    }

    .error-title {
        font-size: 1.4rem;
    }
}

/* Telegram Bot Modal */
.tg-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    padding: 16px;
}

.tg-modal-overlay.show {
    opacity: 1;
}

.tg-modal {
    background: var(--card-bg);
    border-radius: 16px;
    max-width: 420px;
    width: 100%;
    position: relative;
    transform: scale(0.9) translateY(20px);
    transition: transform 0.3s ease;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

.tg-modal-overlay.show .tg-modal {
    transform: scale(1) translateY(0);
}

.tg-modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(0, 0, 0, 0.08);
    border-radius: 50%;
    font-size: 1.25rem;
    line-height: 1;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 1;
}

.tg-modal-close:hover {
    background: rgba(0, 0, 0, 0.15);
    color: var(--text);
}

[data-theme="dark"] .tg-modal-close {
    background: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .tg-modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.tg-modal-body {
    padding: 32px 24px 24px;
    text-align: center;
}

.tg-modal-icon {
    font-size: 3rem;
    margin-bottom: 16px;
}

.tg-modal-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 10px;
}

.tg-modal-text {
    font-size: 0.95rem;
    color: var(--text-muted);
    line-height: 1.55;
    margin-bottom: 24px;
}

.app-modal-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.tg-modal-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
}

.app-modal-btn-gp {
    background: #01875f;
}

.app-modal-btn-gp:hover {
    background: #017a55;
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(1, 135, 95, 0.4);
}

.app-modal-btn-rustore {
    background: #0077FF;
}

.app-modal-btn-rustore:hover {
    background: #006ae6;
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(0, 119, 255, 0.4);
}

.app-modal-btn-tg {
    background: #2AABEE !important;
    color: #fff !important;
}

.app-modal-btn-tg:hover {
    background: #229ed9 !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(42, 171, 238, 0.4);
}

.tg-modal-btn svg {
    width: 20px;
    height: 20px;
}

.tg-modal-skip {
    display: block;
    margin-top: 14px;
    font-size: 0.85rem;
    color: var(--text-muted);
    cursor: pointer;
    background: none;
    border: none;
    text-decoration: underline;
    text-underline-offset: 2px;
    transition: color 0.2s;
}

.tg-modal-skip:hover {
    color: var(--text);
}

/* ========================================
   Share Solution (button + modal + viewer)
   ======================================== */
.btn-share:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.share-url-input {
    width: 100%;
    margin: 4px 0 16px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg);
    color: var(--text);
    font-size: 0.9rem;
    text-align: center;
}

.share-modal-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.share-copy-btn,
.share-native-btn {
    background: var(--primary);
}

.share-copy-btn:hover,
.share-native-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(8, 145, 178, 0.35);
}

/* Viewer page (/s/{id}/) */
.share-view {
    margin-top: 8px;
}

.share-teaser {
    max-width: 560px;
    margin: 24px auto;
    padding: 32px 24px;
    text-align: center;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.share-teaser-icon {
    font-size: 2.5rem;
    margin-bottom: 12px;
}

.share-teaser-text {
    font-size: 1.05rem;
    color: var(--text);
    margin-bottom: 20px;
}

.share-teaser-cta {
    display: inline-block;
    width: auto;
    text-decoration: none;
    text-align: center;
}

/* ========================================
   Auth Modal
   ======================================== */
.auth-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    padding: 16px;
}

.auth-modal-overlay.show {
    opacity: 1;
}

.auth-modal {
    background: var(--card-bg);
    border-radius: 16px;
    max-width: 380px;
    width: 100%;
    max-height: 92vh;
    overflow-y: auto;
    position: relative;
    transform: scale(0.9) translateY(20px);
    transition: transform 0.3s ease;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.auth-modal-overlay.show .auth-modal {
    transform: scale(1) translateY(0);
}

.auth-modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(0, 0, 0, 0.08);
    border-radius: 50%;
    font-size: 1.25rem;
    line-height: 1;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 1;
}

.auth-modal-close:hover {
    background: rgba(0, 0, 0, 0.15);
    color: var(--text);
}

[data-theme="dark"] .auth-modal-close {
    background: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .auth-modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.auth-modal-body {
    padding: 52px 18px 16px;
}

.auth-modal-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 2px;
    text-align: center;
    line-height: 1.3;
}

.auth-modal-subtitle {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-bottom: 10px;
    text-align: center;
    line-height: 1.35;
}

.auth-modal-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 10px;
    border-bottom: 2px solid var(--border);
}

.auth-tab {
    flex: 1;
    padding: 6px 12px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
}

.auth-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.auth-tab-content {
    display: none;
}

.auth-tab-content.active {
    display: block;
}

/* OAuth buttons */
.auth-oauth-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
}

.auth-oauth-icons {
    display: flex;
    gap: 8px;
    margin-bottom: 4px;
}

.auth-vkid-container {
    margin-bottom: 2px;
}

.auth-vkid-container:empty {
    display: none;
}

.auth-oauth-icons .auth-oauth-btn,
.auth-oauth-icons .auth-oauth-btn.yandex,
.auth-oauth-icons .auth-oauth-btn.vk {
    flex: 1;
    height: 42px;
    padding: 0;
    border-radius: 10px;
    justify-content: center;
    gap: 0;
    background: #fff;
    color: #1f1f1f;
    border: 1px solid #e0e0e0;
}

.auth-oauth-icons .auth-oauth-btn:hover {
    background: #f8f9fa;
    transform: none;
    box-shadow: none;
}

.auth-oauth-icons .auth-oauth-btn svg {
    width: 22px;
    height: 22px;
}

[data-theme="dark"] .auth-oauth-icons .auth-oauth-btn,
[data-theme="dark"] .auth-oauth-icons .auth-oauth-btn.yandex,
[data-theme="dark"] .auth-oauth-icons .auth-oauth-btn.vk {
    background: #2a2a2a;
    color: #e8eaed;
    border-color: #404040;
}

[data-theme="dark"] .auth-oauth-icons .auth-oauth-btn:hover {
    background: #333;
}

.auth-oauth-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 16px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.auth-oauth-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.auth-oauth-btn svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.auth-oauth-btn.vk {
    background: #0077FF;
    color: #fff;
    border-color: #0077FF;
}

.auth-oauth-btn.vk:hover {
    background: #0066dd;
}

.auth-oauth-btn.yandex {
    background: #FC3F1D;
    color: #fff;
    border-color: #FC3F1D;
}

.auth-oauth-btn.yandex:hover {
    background: #e0361a;
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 8px 0;
    color: var(--text-muted);
    font-size: 0.78rem;
}

/* Уведомление об отключении Google OAuth (ФЗ-406) */
.auth-modal-notice {
    margin-top: 10px;
    padding: 8px 10px;
    background: #fff8e1;
    border: 1px solid #ffe0a8;
    border-left: 4px solid #f5a623;
    border-radius: 6px;
    font-size: 0.78rem;
    color: #5a4a1c;
    line-height: 1.35;
    display: block;
}

.auth-modal-notice strong {
    display: block;
    margin-bottom: 2px;
}

.auth-modal-notice a {
    color: var(--primary);
    text-decoration: underline;
}

[data-theme="dark"] .auth-modal-notice {
    background: rgba(240, 195, 60, 0.12);
    border-color: rgba(245, 166, 35, 0.45);
    color: #f5c23c;
}

[data-theme="dark"] .auth-modal-notice a {
    color: var(--primary);
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

/* Email form */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.auth-input {
    width: 100%;
    padding: 8px 12px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--card-bg);
    color: var(--text);
    font-size: 0.9rem;
    font-family: inherit;
    transition: border-color 0.2s;
    box-sizing: border-box;
    min-height: 38px;
}

.auth-input:focus {
    outline: none;
    border-color: var(--primary);
}

.auth-input::placeholder {
    color: var(--text-muted);
}

.auth-hint {
    color: var(--text-muted);
    font-size: 0.74rem;
    margin: -2px 0 2px;
    line-height: 1.3;
}

.form-hint {
    display: block;
    color: var(--text-muted);
    font-size: 0.78rem;
    margin-top: 4px;
    line-height: 1.4;
}

.auth-submit-btn {
    width: 100%;
    padding: 9px 18px;
    margin-top: 2px;
    border-radius: var(--radius);
    border: none;
    background: var(--primary);
    color: #fff;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    min-height: 38px;
}

.auth-submit-btn:hover {
    background: var(--primary-hover);
}

.auth-submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.auth-submit-btn.is-loading {
    opacity: 0.85;
    cursor: progress;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: btn-spinner-rotate 0.8s linear infinite;
    flex-shrink: 0;
}

@keyframes btn-spinner-rotate {
    to { transform: rotate(360deg); }
}

.auth-error {
    color: var(--error);
    font-size: 0.85rem;
    text-align: center;
    min-height: 1.2em;
}

.auth-link {
    color: var(--primary);
    cursor: pointer;
    text-decoration: none;
    font-size: 0.85rem;
}

.auth-link:hover {
    text-decoration: underline;
}

.auth-footer {
    text-align: center;
    margin-top: 6px;
    font-size: 0.82rem;
    color: var(--text-muted);
    display: flex;
    justify-content: center;
    gap: 14px;
    flex-wrap: wrap;
}

/* Passwordless (magic link + OTP) шаги в auth-модалке */
.auth-step[hidden] {
    display: none;
}

.auth-code-sent {
    font-size: 0.9rem;
    color: var(--text-muted);
    text-align: center;
    margin-bottom: 4px;
}

.auth-code-sent strong {
    color: var(--text);
    word-break: break-all;
}

.auth-code-input {
    text-align: center;
    letter-spacing: 0.4em;
    font-size: 1.15rem;
    font-weight: 600;
}

.auth-link.is-disabled {
    color: var(--text-muted);
    cursor: default;
    pointer-events: none;
    text-decoration: none;
}

/* Compact further on short or narrow viewports */
@media (max-width: 640px), (max-height: 720px) {
    .auth-modal-body {
        padding: 52px 14px 14px;
    }
    .auth-modal-title {
        font-size: 1.02rem;
    }
    .auth-modal-subtitle {
        font-size: 0.78rem;
        margin-bottom: 8px;
    }
    .auth-modal-tabs {
        margin-bottom: 8px;
    }
    .auth-tab {
        padding: 5px 10px;
        font-size: 0.85rem;
    }
    .auth-oauth-icons {
        margin-bottom: 4px;
    }
    .auth-oauth-icons .auth-oauth-btn,
    .auth-oauth-icons .auth-oauth-btn.yandex,
    .auth-oauth-icons .auth-oauth-btn.vk {
        height: 40px;
    }
    .auth-divider {
        margin: 6px 0;
        font-size: 0.74rem;
    }
    .auth-form {
        gap: 5px;
    }
    .auth-input {
        padding: 8px 12px;
        font-size: 0.88rem;
        min-height: 40px;
    }
    .auth-submit-btn {
        padding: 9px 18px;
        font-size: 0.88rem;
        min-height: 40px;
    }
    .auth-modal-notice {
        margin-top: 8px;
        padding: 7px 9px;
        font-size: 0.74rem;
    }
    .auth-footer {
        margin-top: 5px;
        font-size: 0.78rem;
    }
}

/* User avatar in header */
.user-avatar-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid var(--primary);
    cursor: pointer;
    overflow: hidden;
    padding: 0;
    background: var(--primary);
    color: #fff;
    font-size: 0.9rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.user-avatar-btn img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-avatar-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.auth-login-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius);
    border: 1px solid var(--primary);
    background: transparent;
    color: var(--primary);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    white-space: nowrap;
    flex-shrink: 0;
}

.auth-login-btn:hover {
    background: var(--primary);
    color: #fff;
}

.auth-login-btn svg {
    width: 18px;
    height: 18px;
}

/* Rate limit warning */
.rate-limit-warning {
    background: rgba(234, 179, 8, 0.1);
    border: 1px solid rgba(234, 179, 8, 0.3);
    border-radius: var(--radius);
    padding: 12px 16px;
    margin-top: 12px;
    font-size: 0.85rem;
    color: var(--text);
    text-align: center;
}

.rate-limit-warning strong {
    color: #eab308;
}

/* ========================================
   Checkout Modal (Phase 2 — Robokassa)
   ======================================== */
.checkout-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.checkout-modal-overlay.show {
    opacity: 1;
}

.checkout-modal {
    background: var(--card-bg);
    border-radius: 16px;
    max-width: 440px;
    width: 100%;
    padding: 28px 24px 22px;
    position: relative;
    transform: scale(0.92) translateY(16px);
    transition: transform 0.3s ease;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    box-sizing: border-box;
}

.checkout-modal-overlay.show .checkout-modal {
    transform: scale(1) translateY(0);
}

.checkout-modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(0, 0, 0, 0.08);
    border-radius: 50%;
    font-size: 1.25rem;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.checkout-modal-close:hover {
    background: rgba(0, 0, 0, 0.15);
    color: var(--text);
}

[data-theme="dark"] .checkout-modal-close {
    background: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .checkout-modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.checkout-modal h3 {
    margin: 0 0 16px;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text);
    text-align: center;
}

.checkout-summary {
    background: var(--bg);
    border-radius: 12px;
    padding: 14px 16px;
    margin-bottom: 14px;
    border: 1px solid var(--border);
}

.checkout-row {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    font-size: 0.9rem;
}

.checkout-row span {
    color: var(--text-muted);
}

.checkout-row strong {
    color: var(--text);
}

.checkout-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 14px 0 2px;
}

.checkout-field label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
}

.checkout-field input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border, #d1d5db);
    border-radius: 8px;
    font-size: 0.95rem;
    background: var(--card-bg, #fff);
    color: var(--text);
}

.checkout-field input:focus {
    outline: none;
    border-color: var(--primary);
}

.checkout-field small {
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* Предупреждение для iPhone-юзеров в чекаут-модалке: на iOS нет Сбер-
   приложения, оплата через SberPay в Robokassa-форме виснет. Подсказка
   направляет выбрать «Банковской картой» вместо SberPay. */
.checkout-ios-warn {
    background: #fff8e1;
    border: 1px solid #f0c33c;
    color: #6d4c00;
    border-radius: 10px;
    padding: 10px 12px;
    margin: 12px 0;
    font-size: 0.88rem;
    line-height: 1.4;
}
[data-theme="dark"] .checkout-ios-warn {
    background: rgba(240, 195, 60, 0.12);
    border-color: rgba(240, 195, 60, 0.45);
    color: #e8d28a;
}

.checkout-consent {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 12px 0 6px;
    font-size: 0.82rem;
    line-height: 1.45;
    color: var(--text-muted);
    cursor: pointer;
}

.checkout-consent input[type="checkbox"] {
    margin: 2px 0 0;
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary);
}

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

.checkout-consent a:hover {
    text-decoration: underline;
}

.checkout-error {
    color: var(--error, #dc2626);
    font-size: 0.85rem;
    text-align: center;
    min-height: 1.2em;
    margin: 8px 0 4px;
}

.checkout-error a {
    color: var(--primary);
}

.checkout-pay-btn {
    width: 100%;
    padding: 12px 20px;
    margin-top: 6px;
    border-radius: var(--radius);
    border: none;
    background: var(--primary);
    color: #fff;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.checkout-pay-btn:hover:not(:disabled) {
    background: var(--primary-hover);
}

.checkout-pay-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

/* ========================================
   Account page (/account/)
   ======================================== */
.account-page {
    max-width: 800px;
    margin: 0 auto;
}

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

.account-content {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.account-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 22px 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.account-card h2 {
    margin: 0 0 16px;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text);
}

.sub-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 0;
    font-size: 0.95rem;
    border-bottom: 1px solid var(--border);
}

.sub-row:last-child {
    border-bottom: none;
}

.sub-row > span {
    color: var(--text-muted);
}

.sub-row strong {
    color: var(--text);
    font-weight: 600;
}

.sub-hint {
    margin: 8px 0 0;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
}

.badge-active {
    background: rgba(34, 197, 94, 0.12);
    color: #16a34a;
}

.badge-cancelled {
    background: rgba(234, 179, 8, 0.12);
    color: #b45309;
}

.badge-warning {
    background: rgba(239, 68, 68, 0.12);
    color: #dc2626;
}

.badge-muted {
    background: rgba(0, 0, 0, 0.06);
    color: var(--text-muted);
}

[data-theme="dark"] .badge-muted {
    background: rgba(255, 255, 255, 0.08);
}

.usage-row {
    display: flex;
    justify-content: space-between;
    margin-top: 16px;
    margin-bottom: 6px;
    font-size: 0.92rem;
}

.usage-row > span {
    color: var(--text-muted);
}

.usage-bar {
    height: 8px;
    background: var(--border);
    border-radius: 999px;
    overflow: hidden;
}

.usage-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--primary-hover, var(--primary)));
    border-radius: 999px;
    transition: width 0.3s ease;
}

.usage-hint {
    margin-top: 8px;
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.account-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 18px;
}

.btn-primary,
.btn-secondary,
.btn-danger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
    font-family: inherit;
    border: 1px solid transparent;
}

/* Banner на /account/ при запланированной смене тарифа (pending_plan_code) */
.sub-pending-change-banner {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 12px 16px;
    margin: 0 0 16px;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 8px;
    color: #92400e;
}
.sub-pending-change-banner .banner-icon {
    font-size: 22px;
    line-height: 1;
}
.sub-pending-change-banner .banner-title {
    display: block;
    margin-bottom: 4px;
}
.sub-pending-change-banner p {
    margin: 0;
    font-size: 14px;
    line-height: 1.45;
    color: inherit;
}
[data-theme="dark"] .sub-pending-change-banner {
    background: rgba(252, 211, 77, 0.12);
    border-color: rgba(252, 211, 77, 0.3);
    color: #fcd34d;
}

.sub-bonus-note {
    font-size: 12px;
    color: var(--text-muted, #6b7280);
    margin: -4px 0 8px;
    line-height: 1.4;
}
[data-theme="dark"] .sub-bonus-note {
    color: var(--text-muted, #9ca3af);
}

/* Incident banner — OpenRouter инциденты */
.incident-banner {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 12px 16px;
    margin: 0 0 16px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    color: #991b1b;
    position: relative;
}
.incident-banner[hidden] { display: none; }
.incident-banner .banner-icon {
    font-size: 22px;
    line-height: 1;
}
.incident-banner .banner-text { flex: 1; }
.incident-banner .banner-title {
    display: block;
    font-weight: 600;
    margin-bottom: 4px;
}
.incident-banner p {
    margin: 0;
    font-size: 14px;
    line-height: 1.45;
    color: inherit;
}
.incident-banner-close {
    background: transparent;
    border: 0;
    color: inherit;
    opacity: 0.6;
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
    padding: 2px 6px;
    border-radius: 4px;
}
.incident-banner-close:hover { opacity: 1; background: rgba(0,0,0,0.05); }
[data-theme="dark"] .incident-banner {
    background: rgba(248, 113, 113, 0.12);
    border-color: rgba(248, 113, 113, 0.3);
    color: #fca5a5;
}

/* /history/ — страница истории решений на аккаунте */
.history-page-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}
.history-page-hint {
    margin: 0;
    color: var(--text-muted, #6b7280);
    font-size: 14px;
    line-height: 1.4;
}
.history-page-item {
    display: grid;
    grid-template-columns: 56px 1fr auto;
    align-items: center;
    gap: 12px;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
.history-page-item:hover {
    background: var(--bg-soft, rgba(0, 0, 0, 0.03));
    border-color: var(--primary);
}
.history-page-thumb {
    width: 56px;
    height: 56px;
    object-fit: cover;
    border-radius: 6px;
    background: #f0f0f0;
}
.history-page-thumb-empty {
    background: var(--border);
    opacity: 0.4;
}
.history-page-meta {
    min-width: 0;
}
.history-page-date {
    font-size: 12px;
    color: var(--text-muted, #6b7280);
    margin-bottom: 4px;
}
.history-page-preview {
    font-size: 14px;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-height: 1.35;
}
.history-page-delete {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--text-muted, #6b7280);
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    transition: background 0.15s, color 0.15s;
}
.history-page-delete:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error, #ef4444);
}
.history-pagination {
    margin-top: 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px 16px;
    align-items: center;
    justify-content: space-between;
    border-top: 1px solid var(--border);
    padding-top: 12px;
}
.history-pagination-info {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    font-size: 13px;
    color: var(--text-muted, #6b7280);
}
.history-page-size-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.history-page-size-select {
    padding: 4px 8px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--card-bg);
    color: var(--text);
    font-family: inherit;
    font-size: 13px;
    cursor: pointer;
}
.history-pagination-pages {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}
.history-pagination-btn {
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    border: 1px solid var(--border);
    background: var(--card-bg);
    color: var(--text);
    border-radius: 6px;
    font-family: inherit;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.history-pagination-btn:hover:not(:disabled):not(.is-active) {
    background: var(--bg-soft, rgba(0, 0, 0, 0.04));
    border-color: var(--primary);
}
.history-pagination-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}
.history-pagination-btn.is-active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
    cursor: default;
}
.history-pagination-ellipsis {
    padding: 0 6px;
    color: var(--text-muted, #6b7280);
    font-size: 13px;
}

/* Profile dropdown (опускается из аватарки в шапке) */
.profile-menu-link,
.profile-menu-logout {
    display: block;
    width: 100%;
    box-sizing: border-box;
    padding: 10px;
    margin-bottom: 8px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: transparent;
    text-align: center;
    text-decoration: none;
    font-family: inherit;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.profile-menu-link {
    color: var(--text);
}
.profile-menu-link:hover {
    background: var(--bg-soft, rgba(0, 0, 0, 0.04));
    border-color: var(--primary);
}
.profile-menu-logout {
    color: var(--error);
    margin-bottom: 0;
}
.profile-menu-logout:hover {
    background: rgba(239, 68, 68, 0.08);
}
.history-empty-page {
    padding: 24px 0;
    text-align: center;
    color: var(--text-muted, #6b7280);
}
.history-detail-card {
    position: relative;
}
.history-detail-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 22px;
    line-height: 1;
}
.history-detail-close:hover {
    background: rgba(0, 0, 0, 0.06);
    color: var(--text);
}

/* a.btn-primary — повышенная специфичность чтобы перебить .static-page a */
.btn-primary,
a.btn-primary {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
    text-decoration: none;
}

.btn-primary:hover,
a.btn-primary:hover {
    background: var(--primary-hover, var(--primary));
    color: #fff;
}

.btn-secondary,
a.btn-secondary {
    background: transparent;
    color: var(--text);
    border-color: var(--border);
    text-decoration: none;
}

a.btn-secondary:hover {
    background: var(--bg);
    color: var(--text);
}

.btn-danger {
    background: transparent;
    color: #dc2626;
    border-color: #fca5a5;
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.08);
}

[data-theme="dark"] .btn-danger {
    color: #f87171;
    border-color: #7f1d1d;
}

[data-theme="dark"] .btn-danger:hover {
    background: rgba(239, 68, 68, 0.12);
}

/* Payments table */
.payments-table-wrap {
    overflow-x: auto;
}

.payments-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.payments-table th,
.payments-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

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

.payments-table tbody tr:last-child td {
    border-bottom: none;
}

.payment-status {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.82rem;
}

.payment-status-paid {
    background: rgba(34, 197, 94, 0.12);
    color: #16a34a;
}

.payment-status-pending {
    background: rgba(234, 179, 8, 0.12);
    color: #b45309;
}

.payment-status-failed {
    background: rgba(239, 68, 68, 0.12);
    color: #dc2626;
}

.payment-status-refunded {
    background: rgba(99, 102, 241, 0.12);
    color: #4f46e5;
}

.payments-empty {
    color: var(--text-muted);
    text-align: center;
    padding: 16px 0;
    margin: 0;
}

/* ========================================
   Plan-limit toast (Phase 5)
   ======================================== */
.plan-limit-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    max-width: 420px;
    width: calc(100% - 32px);
    padding: 16px 20px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.18);
    opacity: 0;
    z-index: 3000;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.plan-limit-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.plan-limit-toast strong {
    display: block;
    font-size: 1rem;
    color: var(--text);
    margin-bottom: 4px;
}

.plan-limit-toast p {
    margin: 0 0 12px;
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.plan-limit-toast-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.plan-limit-toast-btn {
    flex: 1;
    padding: 9px 16px;
    border-radius: var(--radius);
    background: var(--primary);
    color: #fff;
    font-size: 0.88rem;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    transition: background 0.2s;
}

.plan-limit-toast-btn:hover {
    background: var(--primary-hover, var(--primary));
}

.plan-limit-toast-close {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
    border-radius: 50%;
    transition: background 0.2s;
}

.plan-limit-toast-close:hover {
    background: rgba(0, 0, 0, 0.06);
    color: var(--text);
}

[data-theme="dark"] .plan-limit-toast-close:hover {
    background: rgba(255, 255, 255, 0.08);
}

/* === Change-password modal on /account/ === */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 4000;
    padding: 16px;
}

.modal-overlay[hidden] { display: none; }

.modal-content {
    background: var(--card-bg, #fff);
    color: var(--text, #000);
    border-radius: 12px;
    padding: 24px;
    max-width: 460px;
    width: 100%;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
    position: relative;
}

.modal-content--narrow { max-width: 400px; }

.modal-content h3 {
    margin: 0 0 8px;
    font-size: 1.25rem;
    font-weight: 600;
}

.modal-hint {
    color: var(--text-muted, #666);
    font-size: 0.9rem;
    margin: 0 0 16px;
}

.modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    border: none;
    background: transparent;
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
    color: var(--text-muted, #666);
    width: 32px;
    height: 32px;
    border-radius: 50%;
}

.modal-close:hover { background: rgba(0, 0, 0, 0.06); }

.modal-content .form-field {
    display: block;
    margin-bottom: 12px;
}

.modal-content .form-field span {
    display: block;
    font-size: 0.85rem;
    color: var(--text-muted, #666);
    margin-bottom: 4px;
}

.modal-content .form-field input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border, #d0d0d0);
    border-radius: 8px;
    font-size: 1rem;
    background: var(--input-bg, #fff);
    color: var(--text, #000);
    box-sizing: border-box;
}

.modal-content .form-field input:focus {
    outline: none;
    border-color: var(--primary, #6366f1);
}

.modal-content .form-error {
    color: var(--danger, #d12626);
    font-size: 0.9rem;
    margin: 6px 0 10px;
}

.modal-content .btn-primary {
    width: 100%;
    margin-top: 4px;
}

[data-theme="dark"] .modal-close:hover { background: rgba(255, 255, 255, 0.08); }

/* === Profile page (/profile/) === */
.profile-row {
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.profile-row[hidden] { display: none; }

.profile-row:last-child { border-bottom: none; }

.profile-row-label {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.profile-row-value {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    font-size: 0.95rem;
    color: var(--text);
    font-weight: 500;
}

.profile-name-text { word-break: break-word; }

.btn-link {
    background: none;
    border: none;
    color: var(--primary, #6366f1);
    cursor: pointer;
    padding: 0;
    font-size: 0.9rem;
    text-decoration: underline;
}

.btn-link:hover { opacity: 0.8; }

.btn-small {
    padding: 6px 12px !important;
    font-size: 0.9rem !important;
}

.profile-name-form {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 4px;
}

.profile-name-form[hidden] { display: none; }

.profile-name-form input {
    flex: 1 1 200px;
    padding: 8px 12px;
    border: 1px solid var(--border, #d0d0d0);
    border-radius: 8px;
    font-size: 0.95rem;
    background: var(--input-bg, #fff);
    color: var(--text, #000);
}

.profile-name-form input:focus {
    outline: none;
    border-color: var(--primary, #6366f1);
}

.profile-danger-card h2 {
    color: var(--danger, #d12626);
}

/* ===== /reset-password/ — экран завершения сброса пароля ===== */
.reset-password {
    max-width: 420px;
    margin: 8px 0 32px;
}

.reset-password-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.reset-password-intro {
    margin: 0 0 18px;
    color: var(--text-muted);
    font-size: 0.92rem;
    line-height: 1.5;
}

.reset-password-field {
    margin-bottom: 14px;
}

.reset-password-field label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
}

.reset-password-error {
    color: var(--error);
    font-size: 0.85rem;
    margin: 4px 0 14px;
    line-height: 1.4;
}

.reset-password-error:empty {
    margin: 0;
}

.reset-password #resetPasswordSubmit,
.reset-password #resetPasswordSuccess .btn-primary {
    width: 100%;
}

.reset-password-success-msg {
    margin: 0 0 16px;
    color: var(--success);
    font-weight: 600;
    line-height: 1.5;
}

/* ===== /auth-migration/ — миграция Google → email/пароль (ФЗ-406) ===== */
.auth-migration-page {
    max-width: 640px;
    margin: 8px 0 40px;
}

.auth-migration-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    margin-bottom: 32px;
}

.auth-migration-lead {
    margin: 0 0 14px;
    font-size: 1rem;
    line-height: 1.55;
    color: var(--text);
}

.auth-migration-card p {
    margin: 0 0 12px;
    color: var(--text-muted);
    line-height: 1.55;
}

.auth-migration-card p:last-of-type {
    margin-bottom: 0;
}

.auth-migration-card h2 {
    font-size: 1.05rem;
    margin: 20px 0 10px;
    color: var(--text);
}

.auth-migration-steps {
    margin: 0 0 18px 22px;
    padding: 0;
    color: var(--text-muted);
    line-height: 1.55;
}

.auth-migration-steps li {
    margin-bottom: 6px;
}

.auth-migration-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 8px;
}

.auth-migration-field {
    display: flex;
    flex-direction: column;
}

.auth-migration-field label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
}

.auth-migration-field .auth-hint {
    margin: 6px 0 0;
}

.auth-migration-success {
    margin-top: 16px;
    padding: 14px 16px;
    background: rgba(16, 185, 129, 0.08);
    border: 1px solid rgba(16, 185, 129, 0.35);
    border-radius: var(--radius);
    color: var(--success);
    font-weight: 500;
    line-height: 1.5;
}

[data-theme="dark"] .auth-migration-success {
    background: rgba(52, 211, 153, 0.1);
    border-color: rgba(52, 211, 153, 0.35);
}

.auth-migration-faq {
    margin-top: 8px;
}

.auth-migration-faq h2 {
    text-align: left;
    font-size: 1.3rem;
    margin-bottom: 16px;
}

/* На мобильных карточка занимает всю ширину контейнера. */
@media (max-width: 600px) {
    .auth-migration-card {
        padding: 18px;
    }
}
