@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;700;800&display=swap');

/* =========================================
   Дизайн СИСТЕМА (Токены & Переменные)
   ========================================= */
:root {
    /* Светлая тема (Light Mode) - Минимализм, контраст, эффектность */
    --bg-body: #e2e8f0; /* Плотный серый (Slate-200), чтобы белые карточки горели на нем */
    --bg-card: #ffffff;
    --bg-overlay: rgba(255, 255, 255, 0.95);

    --text-main: #020617; /* Экстремально темный сине-черный для макс. контраста */
    --text-muted: #475569; /* Плотный серый (Slate-600) вместо бледного */

    --primary-color: #2563eb; /* Яркий, насыщенный синий */
    --primary-hover: #1d4ed8;

    --border-color: transparent; /* Убираем контуры полностью */

    /* Современные, объемные тени для "парящих" карточек */
    --shadow-sm: 0 4px 15px rgba(15, 23, 42, 0.04);
    --shadow-md: 0 10px 30px rgba(15, 23, 42, 0.06);
    --shadow-lg: 0 20px 40px rgba(15, 23, 42, 0.08);

    --badge-low: #dcfce7;
    --badge-low-text: #14532d;
    --badge-medium: #fef08a;
    --badge-medium-text: #713f12;
    --badge-high: #ffedd5;
    --badge-high-text: #7c2d12;
    --badge-critical: #fee2e2;
    --badge-critical-text: #7f1d1d;
}

[data-theme="dark"] {
    /* Темная тема (Dark Mode) - Единый стиль, High-Tech IDE */
    --bg-body: #060b14; /* Глубокий, почти черный с легким синим оттенком (Midnight) */
    --bg-card: #0b1324; /* Карточки: чуть светлее, гармонируют с радиальным свечением */
    --bg-overlay: rgba(6, 11, 20, 0.95);

    --text-main: #f0f6fc; /* Холодный, чистый белый */
    --text-muted: #8b949e;

    --primary-color: #2563eb;
    --primary-hover: #3b82f6;

    --border-color: #1a2436; /* Строгий синевато-серый бордер */

    /* Резкие тени для темной темы */
    --shadow-sm: 0 1px 0 rgba(0, 0, 0, 0.6);
    --shadow-md: 0 2px 0 rgba(0, 0, 0, 0.8);
    --shadow-lg: 0 4px 0 rgba(0, 0, 0, 0.8);

    --badge-low: #14532d;
    --badge-low-text: #dcfce7;
    --badge-medium: #713f12;
    --badge-medium-text: #fef08a;
    --badge-high: #7c2d12;
    --badge-high-text: #ffedd5;
    --badge-critical: #7f1d1d;
    --badge-critical-text: #fee2e2;
}

/* =========================================
   Глобальная Типографика (Hardcore Tech)
   ========================================= */
body, .font-sans {
    font-family: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif !important;
}

code, pre, .font-mono, .tech-code, 
input[name="code"], #inputCode,
.stat-value, .finance-value, .finance-price, .price-card .price, .plan-price {
    font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace !important;
    letter-spacing: -0.02em;
}

/* =========================================
   Основа (Темная тема по умолчанию)
   ========================================= */
.rounded-xl,
.rounded-2xl,
.rounded-3xl {
    border-radius: 8px !important;
}

.rounded-lg,
.rounded-md {
    border-radius: 6px !important;
}

.shadow-lg,
.shadow-md,
.shadow-sm {
    box-shadow: var(--shadow-sm) !important;
}

/* =========================================
   Базовые стили
   ========================================= */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.4;
    /* Более плотный текст */
    transition: background-color 0.15s ease, color 0.15s ease;
    padding-bottom: 70px;
}

a {
    text-decoration: none;
    color: inherit;
}

/* =========================================
   Сетка и Лейаут
   ========================================= */
.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 12px;
}

.diagnostic-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    /* Уменьшено на ~20% */
    margin-top: 16px;
}

@media (min-width: 1024px) {
    body {
        padding-bottom: 0;
    }

    .diagnostic-grid {
        grid-template-columns: 1fr 1.5fr;
        gap: 20px;
        align-items: flex-start;
    }
}

/* =========================================
   Шапка (Header)
   ========================================= */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

.brand-logo {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--text-main);
    text-transform: uppercase;
    letter-spacing: -0.5px;
}

.theme-toggle {
    background: none;
    border: 1px solid var(--border-color);
    cursor: pointer;
    color: var(--text-main);
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 48px;
    /* Жесткое правило 48px */
    min-height: 48px;
    /* Жесткое правило 48px */
    border-radius: 6px;
    transition: background-color 0.15s ease;
}

.theme-toggle:hover {
    background-color: var(--bg-body);
}

.theme-toggle svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

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

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

:root:not([data-theme="dark"]) .icon-moon {
    display: block;
}

:root:not([data-theme="dark"]) .icon-sun {
    display: none;
}

/* =========================================
   Карточки
   ========================================= */
.card {
    background-color: var(--bg-card);
    border-radius: 8px;
    /* Брутальный малый радиус */
    padding: 16px;
    /* Плотный интерфейс */
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    transition: background-color 0.15s ease, border-color 0.15s ease;
    margin-bottom: 16px;
}

.plan-price {
    font-size: 1.5rem;
    font-weight: 800;
    margin: 16px 0;
}

.card-title {
    font-size: 1.15rem;
    font-weight: 800;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 2px 6px;
    /* Компактные бейджи */
    border-radius: 4px;
    /* Убраны мыльные овалы */
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-low {
    background: var(--badge-low);
    color: var(--badge-low-text);
    border: 1px solid rgba(20, 83, 45, 0.2);
}

.badge-medium {
    background: var(--badge-medium);
    color: var(--badge-medium-text);
    border: 1px solid rgba(113, 63, 18, 0.2);
}

.badge-high {
    background: var(--badge-high);
    color: var(--badge-high-text);
    border: 1px solid rgba(124, 45, 18, 0.2);
}

.badge-critical {
    background: var(--badge-critical);
    color: var(--badge-critical-text);
    border: 1px solid rgba(127, 29, 29, 0.2);
}

.card-subtitle {
    font-weight: 700;
    margin-bottom: 8px;
    font-size: 0.95rem;
    text-transform: uppercase;
}

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

/* =========================================
   Формы и Кнопки
   ========================================= */
.search-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    /* Плотность */
    margin-top: 16px;
}

.form-group label {
    display: block;
    font-size: 0.75rem;
    font-weight: 700;
    margin-bottom: 4px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.input-field,
input[type="text"] {
    width: 100%;
    min-height: 48px;
    /* Жесткое правило 48px */
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: 6px !important;
    /* Строгий радиус */
    font-size: 15px;
    background-color: var(--bg-body);
    color: var(--text-main);
    transition: border-color 0.15s, box-shadow 0.15s;
    /* Техничный вид ввода */
}

.input-field:focus,
input[type="text"]:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: inset 0 0 0 1px var(--primary-color);
    /* Строгий фокус без внешнего размытия */
}

.btn-primary,
button[type="submit"] {
    width: 100%;
    min-height: 48px;
    /* Жесткое правило 48px */
    padding: 12px 16px;
    background-color: var(--primary-color);
    color: #ffffff;
    border: none;
    border-radius: 6px !important;
    /* Строгий радиус */
    font-size: 0.95rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: background-color 0.15s, transform 0.1s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-primary:hover,
button[type="submit"]:hover {
    background-color: var(--primary-hover);
}

.btn-primary:active,
button[type="submit"]:active {
    transform: translateY(1px);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* =========================================
   Пейвол (Paywall)
   ========================================= */
.paywall-wrapper {
    position: relative;
    overflow: hidden;
}

.paywall-blurred-content {
    filter: blur(4px);
    /* Меньше размытия */
    user-select: none;
    opacity: 0.7;
    pointer-events: none;
    transition: filter 0.2s ease, opacity 0.2s ease;
}

.paywall-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-overlay);
    backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    z-index: 10;
    border-radius: 8px;
}

.paywall-box {
    background-color: var(--bg-card);
    padding: 20px;
    border-radius: 8px;
    /* Технично */
    text-align: center;
    max-width: 320px;
    width: 100%;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
}

.unlocked-content-animation {
    animation: fadeIn 0.3s ease forwards;
}

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* =========================================
   Markdown Типографика (.markdown-body)
   ========================================= */
.markdown-body {
    font-size: 0.9rem;
    line-height: 1.4;
    /* Оптимизировано для тех отчетов */
    color: var(--text-main);
    overflow-wrap: break-word;
    word-wrap: break-word;
}

.markdown-body p {
    margin-bottom: 0.8em;
    text-align: left !important;
}

.markdown-body strong {
    font-weight: 700;
    color: var(--text-main);
}

.markdown-body img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    border: 1px solid var(--border-color);
}

.markdown-body pre,
.markdown-body code {
    white-space: pre-wrap;
    overflow-wrap: break-word;
    overflow-x: auto;
    max-width: 100%;
    background: var(--bg-body);
    padding: 2px 6px;
    border-radius: 4px;
    color: var(--text-main);
    font-size: 0.85em;
    border: 1px solid var(--border-color);
}

.markdown-body pre {
    padding: 12px;
    margin-bottom: 1em;
}

.markdown-body table {
    width: 100%;
    overflow-x: auto;
    border-collapse: collapse;
    margin-bottom: 1em;
    display: block;
}

.markdown-body th,
.markdown-body td {
    border: 1px solid var(--border-color);
    padding: 6px 10px;
    font-size: 0.85rem;
}

.markdown-body th {
    background-color: var(--bg-body);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.markdown-body h2,
.markdown-body h3,
.markdown-body h4 {
    color: var(--text-main);
    margin-top: 1.2em;
    margin-bottom: 0.6em;
    font-weight: 800;
    line-height: 1.2;
}

.markdown-body h2 {
    font-size: 1.1rem;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0.2em;
    text-transform: uppercase;
}

.markdown-body h3 {
    font-size: 1rem;
    text-transform: uppercase;
}

.markdown-body h4 {
    font-size: 0.9rem;
}

.markdown-body ul,
.markdown-body ol {
    margin-bottom: 1em;
    padding-left: 20px;
}

.markdown-body ul li,
.markdown-body ol li {
    margin-bottom: 4px;
    line-height: 1.4;
}

.markdown-body blockquote {
    border-left: 4px solid var(--primary-color);
    padding: 8px 16px;
    margin: 12px 0;
    background: var(--bg-body);
    border-radius: 0 4px 4px 0;
    font-style: normal;
    /* Брутально - без курсива */
    color: var(--text-main);
    font-weight: 600;
}

/* Спецблок для советов СТО */
.sto-tips {
    margin-top: 20px;
    padding: 16px;
    background-color: var(--bg-body);
    border: 1px solid var(--primary-color);
    border-left: 4px solid var(--primary-color);
    border-radius: 4px;
}

.sto-tips h3 {
    font-size: 0.95rem;
    color: var(--primary-color);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: none;
    padding-bottom: 0;
    margin-top: 0;
    text-transform: uppercase;
    font-weight: 800;
}

.sto-tips h3::before {
    content: '';
    display: block;
    width: 18px;
    height: 18px;
    background-color: var(--primary-color);
    mask-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 1L3 5v6c0 5.55 3.84 10.74 9 12 5.16-1.26 9-6.45 9-12V5l-9-4zm0 10.99h7c-.53 4.12-3.28 7.79-7 8.94V12H5V6.3l7-3.11v8.8z"/></svg>');
    -webkit-mask-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 1L3 5v6c0 5.55 3.84 10.74 9 12 5.16-1.26 9-6.45 9-12V5l-9-4zm0 10.99h7c-.53 4.12-3.28 7.79-7 8.94V12H5V6.3l7-3.11v8.8z"/></svg>');
}

.sto-tips p {
    color: var(--text-main);
    margin-bottom: 0;
    font-size: 0.85rem;
}

/* =========================================
   Мобильная Навигация (Bottom Tab Bar)
   ========================================= */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: var(--bg-card);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-around;
    padding: 0;
    padding-bottom: env(safe-area-inset-bottom);
    z-index: 100;
    box-shadow: 0 -1px 0 rgba(0, 0, 0, 0.1);
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    gap: 4px;
    width: 25%;
    min-height: 56px;
    /* Уверенная тач-зона, больше 48px */
    transition: color 0.15s, background-color 0.15s;
}

.nav-item:active {
    background-color: var(--bg-body);
}

.nav-item.active {
    color: var(--primary-color);
}

.nav-item svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

@media (min-width: 1024px) {
    .bottom-nav {
        display: none;
    }
}

/* =========================================
   Custom Blocks (Phase 3 & UI Refine)
   ========================================= */
.report-content {
    max-width: 800px;
    margin: 0 auto;
    line-height: 1.4;
    font-size: 14px;
}

.custom-accordion {
    border: 1px solid var(--border-color);
    border-radius: 6px;
    /* Убрано мыло */
    margin-top: 12px;
    background-color: var(--bg-card);
    transition: border-color 0.15s;
}

.custom-accordion:focus-within {
    border-color: var(--primary-color);
}

.custom-accordion summary {
    background: var(--bg-body);
    padding: 0 16px;
    min-height: 48px;
    /* Жесткое правило 48px */
    font-size: 0.9rem;
    font-weight: 700;
    text-transform: uppercase;
    cursor: pointer;
    list-style: none;
    outline: none;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    transition: background-color 0.15s ease;
}

.custom-accordion summary::-webkit-details-marker {
    display: none;
}

.custom-accordion summary::after {
    content: '+';
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--text-muted);
    transition: transform 0.15s ease;
    margin-left: auto;
}

.custom-accordion[open] summary::after {
    content: '−';
    color: var(--primary-color);
}

.custom-accordion[open] summary {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    border-bottom: 1px solid var(--border-color);
}

.accordion-body {
    padding: 16px;
    border-top: none;
}

/* DIY Stats */
.diy-stats {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
    background: var(--bg-body);
    padding: 12px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.stat-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.stat-label {
    font-size: 0.75rem;
    font-weight: 800;
    color: var(--text-muted);
    width: 120px;
    flex-shrink: 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.progress-bar {
    flex-grow: 1;
    height: 4px;
    /* Технично, тонко */
    background: var(--border-color);
    border-radius: 0px;
    /* Резкие края */
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #10b981, #f59e0b, #ef4444);
    transition: width 1s ease-in-out;
}

.stat-value {
    font-size: 0.85rem;
    font-weight: 800;
    text-align: right;
    min-width: 60px;
}

/* Finance Stats */
.finance-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.finance-item {
    background: var(--bg-body);
    padding: 12px;
    border-radius: 6px;
    text-align: center;
    border: 1px solid var(--border-color);
    border-top: 3px solid var(--border-color);
}

.finance-item.parts {
    border-top-color: #2563eb;
}

.finance-item.labor {
    border-top-color: #d97706;
}

.finance-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.finance-value {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--text-main);
}

.promo-pro-block {
    background: var(--bg-body);
    border: 1px dashed var(--primary-color);
    padding: 16px;
    border-radius: 6px;
    margin-top: 16px;
    text-align: center;
}

.discount-text {
    color: #10b981;
    font-weight: 800;
    font-size: 0.95rem;
    margin: 8px 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.finance-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 12px;
}

.finance-card {
    background: var(--bg-body);
    border: 1px solid var(--border-color);
    padding: 12px;
    border-radius: 6px;
    border-top: 3px solid var(--primary-color);
    text-align: center;
}

.finance-card.parts-card {
    border-top-color: #2563eb;
}

.finance-card.labor-card {
    border-top-color: #d97706;
}

.finance-card h4 {
    margin: 0 0 8px 0;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.finance-card .finance-price {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--text-main);
}

.icon-sm {
    width: 14px;
    height: 14px;
    stroke-width: 2.5;
}

/* =========================================
   Стили для Новой Главной (Landing Page)
   ========================================= */
.usp-grid,
.pricing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
    margin-top: 16px;
}

.usp-card,
.price-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    /* Техничный радиус */
    padding: 16px;
    color: var(--text-main);
    transition: transform 0.15s ease, border-color 0.15s ease;
    box-shadow: var(--shadow-sm);
}

.usp-card:hover,
.price-card:hover {
    border-color: var(--primary-color);
}

.price-card.pro-card {
    border: 2px solid var(--primary-color);
    background: var(--bg-body);
    position: relative;
}

.price-card .price {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--text-main);
    margin: 8px 0;
}

/* =========================================
   Глобальное переопределение для Светлой темы
   ========================================= */
html:not([data-theme="dark"]) body, 
html:not([data-theme="dark"]) .bg-surface,
html:not([data-theme="dark"]) .bg-gray-50,
html:not([data-theme="dark"]) .bg-\[\#f8fafc\] {
    background-color: var(--bg-body) !important;
    color: var(--text-main) !important;
}

html:not([data-theme="dark"]) .bg-white {
    background-color: var(--bg-card) !important;
    color: var(--text-main) !important;
}

html:not([data-theme="dark"]) .border-gray-50,
html:not([data-theme="dark"]) .border-gray-100,
html:not([data-theme="dark"]) .border-gray-200,
html:not([data-theme="dark"]) .border-slate-200 {
    border-color: var(--border-color) !important;
}

html:not([data-theme="dark"]) .text-gray-900,
html:not([data-theme="dark"]) .text-gray-800,
html:not([data-theme="dark"]) .text-slate-900 {
    color: var(--text-main) !important;
}

html:not([data-theme="dark"]) .text-gray-600,
html:not([data-theme="dark"]) .text-gray-500,
html:not([data-theme="dark"]) .text-slate-500 {
    color: var(--text-muted) !important;
}

/* =========================================
   Глобальное переопределение для Темной темы
   ========================================= */
[data-theme="dark"] body,
[data-theme="dark"] .bg-surface,
[data-theme="dark"] .dark\:bg-slate-900,
[data-theme="dark"] .bg-slate-900 {
    background-color: var(--bg-body) !important;
    color: var(--text-main) !important;
}

[data-theme="dark"] .bg-white,
[data-theme="dark"] .bg-\[\#f8fafc\],
[data-theme="dark"] .dark\:bg-slate-800,
[data-theme="dark"] .bg-slate-800,
[data-theme="dark"] .dark\:bg-slate-800\/60,
[data-theme="dark"] .dark\:bg-slate-800\/50,
[data-theme="dark"] .dark\:bg-slate-700\/50,
[data-theme="dark"] .dark\:bg-slate-900\/40 {
    background-color: var(--bg-card) !important;
    color: var(--text-main) !important;
}

[data-theme="dark"] .dark\:border-slate-700,
[data-theme="dark"] .dark\:border-slate-700\/80,
[data-theme="dark"] .dark\:border-slate-800,
[data-theme="dark"] .dark\:border-slate-600,
[data-theme="dark"] .dark\:border-slate-600\/80 {
    border-color: var(--border-color) !important;
}

[data-theme="dark"] .bg-gray-50 {
    background-color: var(--bg-body) !important;
    border-color: var(--border-color) !important;
    color: var(--text-main) !important;
}

[data-theme="dark"] .bg-gray-100 {
    background-color: var(--bg-card) !important;
    color: var(--text-main) !important;
}

[data-theme="dark"] .hover\:bg-gray-50:hover,
[data-theme="dark"] .hover\:bg-gray-100:hover,
[data-theme="dark"] .hover\:bg-gray-200:hover {
    background-color: var(--border-color) !important;
}

[data-theme="dark"] .bg-blue-50,
[data-theme="dark"] .bg-blue-50\/50 {
    background-color: rgba(37, 99, 235, 0.1) !important;
    border-color: rgba(37, 99, 235, 0.3) !important;
}

[data-theme="dark"] .bg-orange-50 {
    background-color: rgba(217, 119, 6, 0.1) !important;
    border-color: rgba(217, 119, 6, 0.3) !important;
}

/* Заголовки и тексты */
[data-theme="dark"] h1,
[data-theme="dark"] h2,
[data-theme="dark"] h3,
[data-theme="dark"] h4,
[data-theme="dark"] h5,
[data-theme="dark"] h6,
[data-theme="dark"] strong,
[data-theme="dark"] b,
[data-theme="dark"] summary,
[data-theme="dark"] .text-gray-900,
[data-theme="dark"] .text-gray-800,
[data-theme="dark"] .text-gray-700 {
    color: var(--text-main) !important;
}

[data-theme="dark"] .text-gray-600,
[data-theme="dark"] .text-gray-500,
[data-theme="dark"] .text-gray-400 {
    color: var(--text-muted) !important;
}

/* Tailwind Typography & Markdown Overrides */
[data-theme="dark"] .prose,
[data-theme="dark"] .prose p,
[data-theme="dark"] .prose li,
[data-theme="dark"] .prose span,
[data-theme="dark"] .prose table,
[data-theme="dark"] .prose td,
[data-theme="dark"] .prose th,
[data-theme="dark"] .markdown-body,
[data-theme="dark"] .markdown-body p,
[data-theme="dark"] .markdown-body li {
    color: var(--text-main) !important;
}

[data-theme="dark"] .prose h1,
[data-theme="dark"] .prose h2,
[data-theme="dark"] .prose h3,
[data-theme="dark"] .prose h4,
[data-theme="dark"] .prose strong,
[data-theme="dark"] .prose b,
[data-theme="dark"] .markdown-body h1,
[data-theme="dark"] .markdown-body h2,
[data-theme="dark"] .markdown-body h3,
[data-theme="dark"] .markdown-body strong,
[data-theme="dark"] .markdown-body b {
    color: #ffffff !important;
}

[data-theme="dark"] .prose a,
[data-theme="dark"] .markdown-body a {
    color: var(--primary-hover) !important;
}

[data-theme="dark"] .prose code,
[data-theme="dark"] .markdown-body code {
    color: #e4e4e7 !important;
    background-color: var(--bg-body) !important;
    border-color: var(--border-color) !important;
}

/* Границы и разделители */
[data-theme="dark"] .border-gray-50,
[data-theme="dark"] .border-gray-100,
[data-theme="dark"] .border-gray-200,
[data-theme="dark"] .border-gray-300,
[data-theme="dark"] .border-gray-400,
[data-theme="dark"] .divide-y>*+*,
[data-theme="dark"] .divide-gray-100>*+*,
[data-theme="dark"] hr,
[data-theme="dark"] .h-px.bg-gray-100,
[data-theme="dark"] .h-px.bg-gray-200 {
    border-color: var(--border-color) !important;
    background-color: var(--border-color) !important;
}

/* Элементы форм */
[data-theme="dark"] input,
[data-theme="dark"] select,
[data-theme="dark"] textarea {
    background-color: var(--bg-body) !important;
    color: var(--text-main) !important;
    border-color: var(--border-color) !important;
}

[data-theme="dark"] input::placeholder,
[data-theme="dark"] textarea::placeholder {
    color: var(--text-muted) !important;
}

/* Пейволл */
[data-theme="dark"] #paywall-overlay {
    background-color: rgba(9, 9, 11, 0.85) !important;
}

[data-theme="dark"] #paywall-overlay .bg-white {
    background-color: var(--bg-card) !important;
    border-color: var(--border-color) !important;
}

/* ==========================================================================
   Утилиты и вынесенные стили из HTML/JS (Аудит)
   ========================================================================== */
.yandex-pixel {
    position: absolute;
    left: -9999px;
}

.lucide-blue {
    color: var(--primary-color);
}

.pe-none {
    pointer-events: none !important;
}

.pe-auto {
    pointer-events: auto !important;
}

.bg-dots-pattern {
    background-image: radial-gradient(var(--border-color) 1px, transparent 1px);
    background-size: 16px 16px;
}

input.bg-transparent-noborder,
[data-theme="dark"] input.bg-transparent-noborder {
    background-color: transparent !important;
    border: none !important;
}

.ai-error-container {
    font-family: monospace;
    padding: 16px;
    color: #7f1d1d;
    background: #fee2e2;
    border-radius: 6px;
    border: 1px solid #f87171;
    margin: 16px;
}

.ai-error-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
    text-transform: uppercase;
    font-weight: 800;
}

.ai-error-icon {
    width: 18px;
    height: 18px;
}


::-webkit-details-marker {
    display: none;
}

.paywall-blur-container {
    filter: blur(4px);
    user-select: none;
    pointer-events: none;
    position: relative;
}

body {
    /* Базовый цвет оставляем */
    background-color: var(--bg-body);
    /* Добавляем мягкое свечение основного цвета (primary) сверху по центру */
    background-image: radial-gradient(circle at 50% 0%, rgba(37, 99, 235, 0.08) 0%, transparent 60%);
    background-attachment: fixed;
}

[data-theme="dark"] body {
    /* В темной теме свечение смотрится еще круче и технологичнее */
    background-image: radial-gradient(circle at 50% 0%, rgba(59, 130, 246, 0.12) 0%, transparent 70%);
}

/* =========================================
   Кнопки хидера (Унификация Гараж и Главная)
   ========================================= */
.btn-header {
    background-color: rgba(37, 99, 235, 0.1);
    color: var(--primary-color);
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid rgba(37, 99, 235, 0.2);
    transition: all 0.2s ease;
    min-height: 40px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

[data-theme="dark"] .btn-header {
    background-color: rgba(37, 99, 235, 0.15);
    color: #60a5fa;
    border-color: rgba(37, 99, 235, 0.3);
}

.btn-header:hover {
    background-color: var(--primary-color);
    color: #ffffff !important;
    border-color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

[data-theme="dark"] .btn-header:hover {
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.5);
}

/* =========================================
   Diagnostic Search Widget (Refactored)
   ========================================= */
.diagnostic-widget {
    background-color: var(--bg-card);
    padding: 24px;
    border: 1.5px solid #0077FF;
    border-radius: 16px;
    box-shadow: 0 8px 25px rgba(0, 119, 255, 0.15);
    width: 100%;
    position: relative;
    overflow: hidden;
    margin-top: 16px;
}

[data-theme="dark"] .diagnostic-widget {
    box-shadow: 0 8px 30px rgba(0, 119, 255, 0.25);
}

.diagnostic-form {
    margin: 0 !important;
    display: block !important; /* override flex from .search-form if it was leaking */
}

.diagnostic-input-group {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    margin-bottom: 16px;
}

@media (min-width: 640px) {
    .diagnostic-input-group {
        grid-template-columns: repeat(3, 1fr);
    }
}

.diagnostic-input {
    width: 100%;
    background-color: #f1f5f9; /* Slate-100 для контраста на белом виджете */
    border: 1px solid var(--border-color);
    color: var(--text-main);
    border-radius: 12px !important;
    padding: 12px 16px !important;
    font-size: 15px;
    min-height: 48px !important;
    transition: all 0.2s ease;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
}

.diagnostic-input:focus {
    outline: none !important;
    border-color: #0077FF !important;
    box-shadow: 0 0 0 3px rgba(0, 119, 255, 0.15) !important;
}

[data-theme="dark"] .diagnostic-input {
    background-color: var(--bg-body) !important;
}

[data-theme="dark"] .diagnostic-input:focus {
    box-shadow: 0 0 0 3px rgba(0, 119, 255, 0.3) !important;
}

.diagnostic-input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.uppercase-input {
    text-transform: uppercase !important;
}

.diagnostic-error {
    color: #ef4444;
    font-size: 0.875rem;
    margin: 0 0 12px 8px;
    font-weight: 500;
}

.diagnostic-btn {
    position: relative;
    overflow: hidden;
    width: 100%;
    background-color: #0077FF;
    color: #ffffff;
    font-weight: 700;
    border-radius: 12px !important;
    padding: 14px;
    font-size: 1.05rem;
    border: 1px solid rgba(96, 165, 250, 0.5); /* blue-400/50 */
    box-shadow: 0 4px 15px rgba(0, 119, 255, 0.3);
    transition: all 0.2s;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    min-height: 54px !important;
    text-transform: none !important; /* override the global uppercase */
}

.diagnostic-btn:hover {
    background-color: #2563eb; /* blue-600 */
    box-shadow: 0 6px 20px rgba(0, 119, 255, 0.4);
    transform: translateY(-2px);
}

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

.diagnostic-btn-shimmer {
    position: absolute;
    inset: 0;
    transform: translateX(-100%);
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.25), transparent);
}

.diagnostic-btn-icon,
.diagnostic-btn-text {
    position: relative;
    z-index: 10;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.15));
}