/* ===== CSS Variables (Apple-style) ===== */
:root {
    --bg-primary: #000000;
    --bg-secondary: #1c1c1e;
    --bg-tertiary: #2c2c2e;
    --bg-elevated: #3a3a3c;
    --text-primary: #ffffff;
    --text-secondary: #ebebf5cc;
    --text-tertiary: #ebebf599;
    --accent-blue: #0a84ff;
    --accent-blue-hover: #409cff;
    --accent-green: #30d158;
    --accent-orange: #ff9f0a;
    --accent-red: #ff453a;
    --accent-purple: #bf5af2;
    --separator: #38383a;
    --glass-bg: rgba(28, 28, 30, 0.8);
    --glass-blur: 20px;
    --radius-sm: 10px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-xl: 24px;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s ease;
    --transition-slow: 0.4s ease;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    opacity: 0;
    animation: fadeInPage 0.4s ease-out forwards;
}

@keyframes fadeInPage {
    from { opacity: 0; }
    to { opacity: 1; }
}

a {
    color: var(--accent-blue);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--accent-blue-hover);
}

/* ===== Glass Effect ===== */
.glass {
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
}

/* ===== Navigation ===== */
.nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    border-bottom: 1px solid var(--separator);
    transition: background var(--transition-normal);
}

.nav.scrolled {
    background: var(--glass-bg);
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.nav-logo i {
    font-size: 24px;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-link {
    padding: 8px 16px;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

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

.nav-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.nav .nav-actions .btn {
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.2;
    gap: 6px;
}

.nav .nav-actions .btn i {
    font-size: 12px;
}

.btn-nav {
    padding: 8px 14px;
    font-size: 13px;
}

/* Hamburger button */
.nav-hamburger {
    display: none;
    width: 36px;
    height: 36px;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 20px;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: background var(--transition-fast);
}

.nav-hamburger:hover {
    background: var(--bg-tertiary);
}

/* Mobile nav overlay */
.mobile-nav-overlay {
    display: none;
    position: fixed;
    top: 52px;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 998;
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.mobile-nav-overlay.active {
    opacity: 1;
}

.mobile-nav {
    display: none;
    position: fixed;
    top: 52px;
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--separator);
    z-index: 999;
    padding: 16px;
    transform: translateY(-100%);
    transition: transform var(--transition-normal);
}

.mobile-nav.active {
    transform: translateY(0);
}

.mobile-nav .nav-link {
    display: block;
    padding: 12px 16px;
    font-size: 16px;
}

.mobile-nav .nav-actions {
    flex-direction: column;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--separator);
}

.mobile-nav .nav-actions .btn {
    width: 100%;
    justify-content: center;
}

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 999px;
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

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

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

.btn-primary:hover:not(:disabled) {
    background: var(--accent-blue-hover);
    color: white;
    transform: scale(1.02);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--bg-elevated);
    color: var(--text-primary);
}

.btn-ghost {
    background: transparent;
    color: var(--accent-blue);
}

.btn-ghost:hover:not(:disabled) {
    background: rgba(10, 132, 255, 0.1);
}

.btn-danger {
    background: var(--accent-red);
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background: #ff6961;
    color: white;
}

.btn-lg {
    padding: 14px 28px;
    font-size: 16px;
}

.btn-xl {
    padding: 18px 36px;
    font-size: 18px;
}

.btn.copied {
    background: var(--accent-green) !important;
    color: white !important;
}

.full-width {
    width: 100%;
}

.pricing-grid.full-width {
    max-width: 100%;
}

.hidden {
    display: none;
}

.muted-intro {
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.highlight-green {
    color: var(--accent-green);
}

.text-red {
    color: var(--accent-red);
}

.alert-error {
    background: rgba(255, 69, 58, 0.15);
    border: 1px solid var(--accent-red);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    margin-bottom: 20px;
    font-size: 14px;
    color: var(--accent-red);
}

.button-group {
    display: flex;
    gap: 8px;
}

.generation-note {
    margin-top: 16px;
    color: var(--text-secondary);
}

.centered-footer {
    justify-content: center;
}

/* ===== Landing Page ===== */
.hero:not(.hero-fold) {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 120px 24px 80px;
    position: relative;
    overflow: hidden;
}

.hero-gradient {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 1200px;
    height: 800px;
    background: radial-gradient(ellipse at center, rgba(10, 132, 255, 0.15) 0%, rgba(191, 90, 242, 0.1) 40%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

.hero-content {
    position: relative;
    z-index: 1;
    max-width: 800px;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(10, 132, 255, 0.15);
    border: 1px solid rgba(10, 132, 255, 0.3);
    border-radius: 999px;
    font-size: 13px;
    font-weight: 500;
    color: var(--accent-blue);
    margin-bottom: 32px;
    animation: fadeInUp 0.6s ease-out;
}

.hero h1 {
    font-size: 72px;
    font-weight: 800;
    letter-spacing: -2px;
    line-height: 1.05;
    margin-bottom: 24px;
    animation: fadeInUp 0.6s ease-out 0.1s both;
}

.hero h1 .gradient-text {
    background: linear-gradient(135deg, var(--accent-blue) 0%, var(--accent-purple) 50%, var(--accent-orange) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero p {
    font-size: 22px;
    color: var(--text-secondary);
    margin-bottom: 40px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    animation: fadeInUp 0.6s ease-out 0.2s both;
}

.hero-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
    animation: fadeInUp 0.6s ease-out 0.3s both;
}

.hero-stats {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 48px;
    margin-top: 80px;
    padding-top: 40px;
    border-top: 1px solid var(--separator);
    animation: fadeInUp 0.6s ease-out 0.4s both;
}

.hero-stat {
    text-align: center;
}

.hero-stat-value {
    font-size: 36px;
    font-weight: 700;
    color: var(--text-primary);
}

.hero-stat-label {
    font-size: 14px;
    color: var(--text-tertiary);
    margin-top: 4px;
}

/* ===== Features Section ===== */
.section {
    padding: 120px 24px;
    max-width: 1200px;
    margin: 0 auto;
}

.section-header {
    text-align: center;
    margin-bottom: 80px;
}

.section-tag {
    display: inline-block;
    padding: 6px 12px;
    background: var(--bg-tertiary);
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--accent-blue);
    margin-bottom: 20px;
}

.section h2 {
    font-size: 48px;
    font-weight: 700;
    letter-spacing: -1px;
    margin-bottom: 16px;
}

.section-description {
    font-size: 18px;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 24px;
}

.feature-card {
    background: var(--bg-secondary);
    border: 1px solid var(--separator);
    border-radius: var(--radius-lg);
    padding: 32px;
    transition: all var(--transition-normal);
}

.feature-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: rgba(10, 132, 255, 0.3);
}

.feature-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(10, 132, 255, 0.15);
    color: var(--accent-blue);
    border-radius: var(--radius-md);
    font-size: 20px;
    margin-bottom: 20px;
}

.feature-card h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
}

.feature-card p {
    font-size: 14px;
    color: var(--text-secondary);
}

/* ===== Pricing Section ===== */
.pricing-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    max-width: 1000px;
    margin: 0 auto;
}

.pricing-card {
    background: var(--bg-secondary);
    border: 1px solid var(--separator);
    border-radius: var(--radius-xl);
    padding: 40px 32px;
    text-align: center;
    position: relative;
    transition: all var(--transition-normal);
}

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

.pricing-card.featured {
    border-color: var(--accent-blue);
    background: linear-gradient(180deg, rgba(10, 132, 255, 0.1) 0%, var(--bg-secondary) 100%);
}

.pricing-card.featured::before {
    content: 'Популярный';
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    padding: 4px 12px;
    background: var(--accent-blue);
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    color: white;
}

.pricing-name {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
}

.pricing-price {
    font-size: 48px;
    font-weight: 700;
    margin: 16px 0;
}

.pricing-price span {
    font-size: 16px;
    font-weight: 500;
    color: var(--text-tertiary);
}

.pricing-features {
    list-style: none;
    margin: 24px 0;
    text-align: left;
}

.pricing-features li {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
    font-size: 14px;
    color: var(--text-secondary);
}

.pricing-features li i {
    color: var(--accent-green);
    font-size: 12px;
}

.pricing-credits {
    display: inline-block;
    padding: 8px 16px;
    background: rgba(48, 209, 88, 0.15);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    color: var(--accent-green);
    margin-bottom: 24px;
}

/* ===== Dashboard ===== */
.dashboard {
    padding: 80px 24px 40px;
    max-width: 1200px;
    margin: 0 auto;
}

.dashboard-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 40px;
}

.dashboard-header h1 {
    font-size: 32px;
    font-weight: 700;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 32px;
}

/* ===== Sidebar ===== */
.sidebar {
    position: sticky;
    top: 80px;
    height: fit-content;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.sidebar-link:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

.sidebar-link.active {
    color: var(--accent-blue);
    background: rgba(10, 132, 255, 0.15);
}

.sidebar-link i {
    width: 20px;
    text-align: center;
}

.balance-card {
    background: var(--bg-secondary);
    border: 1px solid var(--separator);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-top: 24px;
    text-align: center;
}

.balance-label {
    font-size: 13px;
    color: var(--text-tertiary);
    margin-bottom: 8px;
}

.balance-value {
    font-size: 36px;
    font-weight: 700;
    color: var(--accent-green);
}

.balance-value.low {
    color: var(--accent-orange);
}

/* ===== Main Content ===== */
.main-content {
    min-width: 0;
}

.card {
    background: var(--bg-secondary);
    border: 1px solid var(--separator);
    border-radius: var(--radius-lg);
    padding: 32px;
    margin-bottom: 24px;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.card-title {
    font-size: 18px;
    font-weight: 600;
}

/* ===== Form Elements ===== */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 14px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--separator);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 15px;
    font-family: inherit;
    transition: all var(--transition-fast);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(10, 132, 255, 0.2);
}

.form-input.error,
.form-select.error,
.form-textarea.error {
    border-color: var(--accent-red);
    box-shadow: 0 0 0 3px rgba(255, 69, 58, 0.2);
}

.form-error-message {
    font-size: 12px;
    color: var(--accent-red);
    margin-top: 6px;
    display: none;
}

.form-error-message.visible {
    display: block;
}

.form-textarea {
    min-height: 120px;
    resize: vertical;
}

.form-select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23ebebf599' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 40px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* ===== Text List ===== */
.text-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.text-list--rich {
    gap: 14px;
}

.text-item {
    display: flex;
    align-items: stretch;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 20px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    transition: all var(--transition-fast);
}

.text-item--card {
    align-items: flex-start;
}

.text-item--refined {
    border-color: rgba(191, 90, 242, 0.25);
    background: linear-gradient(135deg, rgba(191, 90, 242, 0.06), var(--bg-tertiary));
}

.text-item:hover {
    background: var(--bg-elevated);
    border-color: rgba(255, 255, 255, 0.08);
}

.text-item-body {
    flex: 1;
    min-width: 0;
    cursor: pointer;
    text-align: left;
}

.text-item-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
}

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

.text-item-title {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
    line-height: 1.35;
    word-break: break-word;
}

.text-item-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.text-item-excerpt {
    font-size: 13px;
    line-height: 1.55;
    color: var(--text-secondary);
    margin: 0 0 10px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.text-item-relation {
    font-size: 12px;
    color: var(--text-tertiary);
    margin: 0 0 8px;
}

.text-item-relation .text-link {
    color: var(--accent-blue);
    text-decoration: none;
}

.text-item-relation .text-link:hover {
    text-decoration: underline;
}

.text-item-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 14px;
    font-size: 12px;
    color: var(--text-tertiary);
}

.text-item-meta i {
    margin-right: 4px;
    opacity: 0.75;
}

.text-item-verdict {
    color: var(--text-secondary);
}

.text-item-actions {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 6px;
    flex-shrink: 0;
    align-self: center;
}

@media (max-width: 768px) {
    .text-item--card {
        flex-direction: column;
    }
    .text-item-actions {
        align-self: flex-end;
    }
}

.filters-bar--texts {
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
}

.filters-bar--texts .form-input[type="search"] {
    flex: 1 1 200px;
    min-width: 160px;
}

.filter-checkbox {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-secondary);
    white-space: nowrap;
}

.page-subtitle {
    margin: 6px 0 0;
    font-size: 14px;
}

.neuro-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 999px;
    letter-spacing: 0.02em;
}

.neuro-pill--ai.neuro-bad { background: rgba(255, 69, 58, 0.18); color: var(--accent-red); }
.neuro-pill--ai.neuro-mid { background: rgba(255, 159, 10, 0.18); color: var(--accent-orange); }
.neuro-pill--ai.neuro-good { background: rgba(48, 209, 88, 0.15); color: var(--accent-green); }
.neuro-pill--human.neuro-good { background: rgba(48, 209, 88, 0.12); color: var(--accent-green); }
.neuro-pill--human.neuro-mid { background: rgba(255, 159, 10, 0.12); color: var(--accent-orange); }
.neuro-pill--human.neuro-bad { background: rgba(255, 69, 58, 0.12); color: var(--accent-red); }
.neuro-pill--none {
    background: var(--bg-elevated);
    color: var(--text-tertiary);
    font-weight: 500;
}

.version-badge--refined {
    background: rgba(191, 90, 242, 0.18);
    color: var(--accent-purple);
}

.version-badge--has-child {
    background: rgba(10, 132, 255, 0.15);
    color: var(--accent-blue);
}

.job-type-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 6px;
    background: var(--bg-elevated);
    color: var(--text-secondary);
    margin-right: 8px;
}

.btn-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    border: 1px solid var(--separator);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-icon:hover {
    background: var(--accent-blue);
    border-color: var(--accent-blue);
    color: white;
}

.btn-icon.btn-danger-icon:hover {
    background: var(--accent-red);
    border-color: var(--accent-red);
}

/* ===== Result Box ===== */
.result-box {
    background: var(--bg-tertiary);
    border: 1px solid var(--separator);
    border-radius: var(--radius-md);
    padding: 24px;
    min-height: 200px;
    max-height: 500px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-size: 15px;
    line-height: 1.7;
}

.result-box::-webkit-scrollbar {
    width: 8px;
}

.result-box::-webkit-scrollbar-track {
    background: transparent;
}

.result-box::-webkit-scrollbar-thumb {
    background: var(--bg-elevated);
    border-radius: 4px;
}

/* ===== Stats Grid ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-top: 24px;
}

.stat-card {
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    padding: 20px;
    text-align: center;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--accent-blue);
}

.stat-label {
    font-size: 13px;
    color: var(--text-tertiary);
    margin-top: 4px;
}

/* ===== Auth Forms ===== */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 80px 24px 40px;
}

.auth-card {
    width: 100%;
    max-width: 400px;
    background: var(--bg-secondary);
    border: 1px solid var(--separator);
    border-radius: var(--radius-xl);
    padding: 40px;
}

.auth-header {
    text-align: center;
    margin-bottom: 32px;
}

.auth-header h1 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 8px;
}

.auth-header p {
    font-size: 14px;
    color: var(--text-secondary);
}

.auth-footer {
    text-align: center;
    margin-top: 24px;
    font-size: 14px;
    color: var(--text-secondary);
}

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

.loading.active {
    display: block;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--bg-tertiary);
    border-top-color: var(--accent-blue);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 16px;
}

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

/* ===== Skeleton Loading ===== */
.skeleton {
    background: linear-gradient(90deg, var(--bg-tertiary) 25%, var(--bg-elevated) 50%, var(--bg-tertiary) 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
    border-radius: var(--radius-sm);
}

@keyframes skeleton-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-text {
    height: 16px;
    margin-bottom: 10px;
    width: 100%;
}

.skeleton-text:last-child {
    width: 60%;
}

.skeleton-title {
    height: 24px;
    width: 70%;
    margin-bottom: 16px;
}

.skeleton-card {
    height: 80px;
    margin-bottom: 12px;
    border-radius: var(--radius-md);
}

/* ===== Empty State ===== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-illustration {
    width: 88px;
    height: 88px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at 30% 20%, rgba(10, 132, 255, 0.35), rgba(191, 90, 242, 0.16) 45%, rgba(44, 44, 46, 0.75) 100%);
    border: 1px solid rgba(10, 132, 255, 0.25);
    border-radius: 28px;
    box-shadow: 0 16px 40px rgba(10, 132, 255, 0.12);
    margin-bottom: 16px;
}

.empty-illustration i {
    font-size: 34px;
    color: var(--text-primary);
}

.empty-state h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 14px;
    color: var(--text-secondary);
}

/* ===== Toast ===== */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast {
    padding: 16px 24px;
    background: var(--bg-secondary);
    border: 1px solid var(--separator);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 12px;
    transform: translateX(120%);
    opacity: 0;
    transition: all var(--transition-normal);
    pointer-events: auto;
    min-width: 280px;
}

.toast.show {
    transform: translateX(0);
    opacity: 1;
}

.toast.success {
    border-color: var(--accent-green);
}

.toast.error {
    border-color: var(--accent-red);
}

.toast.info {
    border-color: var(--accent-blue);
}

/* ===== Modal ===== */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 3000;
    align-items: center;
    justify-content: center;
    padding: 24px;
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.modal-overlay.active {
    display: flex;
    opacity: 1;
}

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--separator);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 600px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    transform: scale(0.95);
    transition: transform var(--transition-normal);
}

.modal-overlay.active .modal {
    transform: scale(1);
}

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

.modal-header h2 {
    font-size: 18px;
    font-weight: 600;
}

.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border: none;
    border-radius: 50%;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.modal-close:hover {
    background: var(--bg-elevated);
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-size: 15px;
    line-height: 1.7;
    flex: 1;
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid var(--separator);
}

/* Confirm modal */
.confirm-modal {
    max-width: 400px;
}

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

.confirm-modal .modal-body i {
    font-size: 48px;
    color: var(--accent-red);
    margin-bottom: 16px;
}

.confirm-modal .modal-body h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
}

.confirm-modal .modal-body p {
    font-size: 14px;
    color: var(--text-secondary);
}

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

.animate-in {
    animation: fadeInUp 0.5s ease-out forwards;
}

/* ===== Footer ===== */
.footer {
    padding: 40px 24px;
    text-align: center;
    border-top: 1px solid var(--separator);
    color: var(--text-tertiary);
    font-size: 13px;
}

/* ===== Responsive ===== */
@media (max-width: 1024px) {
    .pricing-grid {
        grid-template-columns: 1fr;
        max-width: 400px;
    }

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

    .sidebar {
        position: static;
    }

    .sidebar-nav {
        flex-direction: row;
        flex-wrap: wrap;
    }

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

@media (max-width: 768px) {
    .hero h1 {
        font-size: 42px;
    }

    .hero p {
        font-size: 18px;
    }

    .hero-stats {
        flex-direction: column;
        gap: 24px;
    }

    .section h2 {
        font-size: 32px;
    }

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

    .nav-links {
        display: none;
    }

    .nav-actions .btn:not(.btn-primary) {
        display: none;
    }

    .nav-hamburger {
        display: flex;
    }

    .mobile-nav.active,
    .mobile-nav-overlay.active {
        display: block;
    }

    .dashboard-header {
        flex-direction: column;
        gap: 16px;
        align-items: flex-start;
    }

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

    .modal {
        max-height: 90vh;
    }

    .toast-container {
        left: 16px;
        right: 16px;
        bottom: 16px;
    }

    .toast {
        min-width: 0;
    }

    .input-row {
        flex-direction: column;
    }

    .wizard-steps {
        flex-wrap: wrap;
    }
}

/* ===== v2: Wizard ===== */
.breadcrumbs {
    font-size: 13px;
    color: var(--text-tertiary);
    margin-bottom: 8px;
}
.breadcrumbs a { color: var(--text-secondary); }
.breadcrumbs span { margin: 0 6px; }

.wizard-steps {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
}
.wizard-step {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid var(--separator);
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all var(--transition-fast);
}
.wizard-step.active {
    border-color: var(--accent-blue);
    color: var(--text-primary);
    background: rgba(10, 132, 255, 0.12);
}
.wizard-panel.hidden { display: none; }
.wizard-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 20px;
}

.source-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
}
.source-tab {
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--separator);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
}
.source-tab.active {
    background: var(--accent-blue);
    border-color: var(--accent-blue);
    color: #fff;
}
.source-panel.hidden { display: none; }

.input-row {
    display: flex;
    gap: 12px;
}
.input-row .form-input { flex: 1; }
.form-hint { font-size: 12px; color: var(--text-tertiary); margin-top: 6px; }
.char-counter { font-size: 12px; color: var(--text-tertiary); text-align: right; margin-top: 4px; }

.preset-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}
.chip {
    padding: 6px 14px;
    border-radius: 20px;
    border: 1px solid var(--separator);
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 13px;
}
.chip:hover, .chip.active {
    border-color: var(--accent-blue);
    color: var(--accent-blue);
}

.topic-suggestions {
    display: grid;
    gap: 12px;
    margin: 20px 0;
}
.topic-card {
    padding: 16px;
    border: 1px solid var(--separator);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: border-color var(--transition-fast);
}
.topic-card:hover { border-color: var(--accent-blue); }
.topic-card.selected {
    border-color: var(--accent-green);
    background: rgba(48, 209, 88, 0.08);
}
.topic-card h4 { font-size: 15px; margin-bottom: 6px; }
.topic-card p { font-size: 13px; color: var(--text-tertiary); }
.topic-card .topic-keywords { font-size: 12px; color: var(--accent-blue); margin-top: 8px; }
.topic-card input[type="checkbox"] { margin-right: 8px; }

/* Job queue */
.job-list { display: flex; flex-direction: column; gap: 8px; }
.job-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-radius: var(--radius-md);
    background: var(--bg-tertiary);
    gap: 12px;
}
.job-list.compact .job-item { padding: 10px 12px; font-size: 14px; }
.job-status-badge {
    font-size: 11px;
    text-transform: uppercase;
    padding: 3px 8px;
    border-radius: 6px;
    font-weight: 600;
    margin-right: 10px;
}
.status-pending .job-status-badge, .job-status-badge.status-pending { background: rgba(255, 159, 10, 0.2); color: var(--accent-orange); }
.status-processing .job-status-badge, .job-status-badge.status-processing { background: rgba(10, 132, 255, 0.2); color: var(--accent-blue); }
.status-completed .job-status-badge, .job-status-badge.status-completed { background: rgba(48, 209, 88, 0.2); color: var(--accent-green); }
.status-failed .job-status-badge, .job-status-badge.status-failed { background: rgba(255, 69, 58, 0.2); color: var(--accent-red); }
.job-item-title { font-weight: 500; }
.job-item-meta { font-size: 12px; color: var(--text-tertiary); margin-top: 4px; }
.sidebar-badge {
    margin-left: auto;
    background: var(--accent-orange);
    color: #000;
    font-size: 11px;
    padding: 2px 7px;
    border-radius: 10px;
    font-weight: 700;
}

.progress-bar {
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 12px;
}
.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-blue), var(--accent-purple));
    width: 0%;
    transition: width 0.5s ease;
    animation: progressPulse 2s ease infinite;
}
@keyframes progressPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Neuro */
.neuro-block {
    display: flex;
    gap: 24px;
    align-items: center;
    padding: 20px;
    margin-bottom: 20px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
}
.neuro-ring {
    position: relative;
    width: 100px;
    height: 100px;
    flex-shrink: 0;
}
.neuro-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.neuro-ring-bg { fill: none; stroke: var(--bg-elevated); stroke-width: 8; }
.neuro-ring-fill {
    fill: none;
    stroke: var(--accent-green);
    stroke-width: 8;
    stroke-linecap: round;
    stroke-dasharray: 264;
    stroke-dashoffset: 264;
    transition: stroke-dashoffset 0.8s ease, stroke 0.3s;
}
.neuro-ring-fill.low { stroke: var(--accent-red); }
.neuro-ring-fill.mid { stroke: var(--accent-orange); }
.neuro-ring-value {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 700;
}
.neuro-verdict { font-weight: 600; margin-bottom: 8px; }
.neuro-stats { font-size: 13px; color: var(--text-tertiary); }

.neuro-badge {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 6px;
    margin-left: 8px;
    font-weight: 600;
}
.neuro-badge.neuro-good { background: rgba(48, 209, 88, 0.2); color: var(--accent-green); }
.neuro-badge.neuro-mid { background: rgba(255, 159, 10, 0.2); color: var(--accent-orange); }
.neuro-badge.neuro-bad { background: rgba(255, 69, 58, 0.2); color: var(--accent-red); }
.version-badge {
    font-size: 10px;
    padding: 2px 6px;
    background: var(--bg-elevated);
    border-radius: 4px;
    margin-left: 6px;
}

.alert {
    padding: 14px 18px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
}
.alert-info {
    background: rgba(10, 132, 255, 0.12);
    border: 1px solid rgba(10, 132, 255, 0.3);
}
.alert a { margin-left: auto; white-space: nowrap; }

.stats-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}
.stat-card-highlight {
    border: 1px solid rgba(48, 209, 88, 0.3);
    background: rgba(48, 209, 88, 0.06);
}
.quick-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }

.filters-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding-bottom: 20px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--separator);
}
.form-select-sm, .form-input-sm {
    padding: 8px 12px;
    font-size: 14px;
    min-width: 140px;
}

.code-block {
    background: var(--bg-tertiary);
    padding: 16px;
    border-radius: var(--radius-md);
    overflow-x: auto;
    font-size: 13px;
    line-height: 1.5;
}
.code-block code { color: var(--text-secondary); }
.credits-list { list-style: none; padding: 0; }
.credits-list li { padding: 8px 0; border-bottom: 1px solid var(--separator); color: var(--text-secondary); }
.api-key-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 0;
    border-bottom: 1px solid var(--separator);
}
.key-display {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-top: 8px;
}
.key-display code {
    flex: 1;
    padding: 12px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    word-break: break-all;
    font-size: 13px;
}
.new-key-block {
    margin: 16px 0;
    padding: 16px;
    background: rgba(48, 209, 88, 0.08);
    border: 1px solid rgba(48, 209, 88, 0.3);
    border-radius: var(--radius-md);
}
.btn-sm { padding: 8px 14px; font-size: 13px; }
.hidden { display: none !important; }
.modal-text-content {
    max-height: 50vh;
    overflow-y: auto;
    line-height: 1.6;
    white-space: pre-wrap;
    font-size: 14px;
    color: var(--text-secondary);
}
