/* ============================================================
   GitHub Repo Analyzer — Design System v2
   Theme: Orange Light + Creative Professional
   Palette: Orange 500 (primary) / Warm White surfaces
   Font: Inter (body) + JetBrains Mono (code)
   Style: Light Glassmorphism + Creative Gradient Blobs
   Spacing: 4px base unit
   ============================================================ */

/* --- Design Tokens --- */
:root {
    /* Primary — Orange spectrum */
    --orange-50: #fff7ed;
    --orange-100: #ffedd5;
    --orange-200: #fed7aa;
    --orange-300: #fdba74;
    --orange-400: #fb923c;
    --orange-500: #f97316;
    --orange-600: #ea580c;
    --orange-700: #c2410c;
    --orange-800: #9a3412;
    --orange-900: #7c2d12;

    /* Surfaces */
    --surface-bg: #fffaf5;
    --surface-white: #ffffff;
    --surface-warm: #fff7ed;
    --surface-card: rgba(255, 255, 255, 0.85);
    --surface-sidebar: rgba(255, 255, 255, 0.9);
    --surface-hover: #fff7ed;
    --surface-active: #ffedd5;

    /* Glass */
    --glass-bg: rgba(255, 255, 255, 0.78);
    --glass-border: rgba(249, 115, 22, 0.12);
    --glass-border-hover: rgba(249, 115, 22, 0.25);
    --glass-blur: 16px;

    /* Text — warm stone palette */
    --text-primary: #1c1917;
    --text-secondary: #57534e;
    --text-tertiary: #a8a29e;
    --text-muted: #d6d3d1;
    --text-inverse: #ffffff;

    /* Semantic */
    --color-success: #16a34a;
    --color-success-bg: #f0fdf4;
    --color-success-text: #15803d;
    --color-error: #dc2626;
    --color-error-bg: #fef2f2;
    --color-error-text: #b91c1c;
    --color-warning: #f59e0b;
    --color-warning-bg: #fffbeb;
    --color-warning-text: #b45309;
    --color-info: #3b82f6;
    --color-info-bg: #eff6ff;
    --color-info-text: #1d4ed8;

    /* Status */
    --status-done: #16a34a;
    --status-analyzing: #3b82f6;
    --status-pending: #f59e0b;
    --status-error: #dc2626;

    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #f97316 0%, #ea580c 50%, #c2410c 100%);
    --gradient-soft: linear-gradient(135deg, #fb923c 0%, #f97316 100%);
    --gradient-warm: linear-gradient(135deg, #f97316 0%, #fb923c 50%, #fdba74 100%);
    --gradient-card-hover: linear-gradient(180deg, rgba(249,115,22,0.03) 0%, rgba(249,115,22,0.01) 100%);

    /* Typography */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

    /* Type scale */
    --text-xs: 0.75rem;
    --text-sm: 0.875rem;
    --text-base: 1rem;
    --text-lg: 1.125rem;
    --text-xl: 1.25rem;
    --text-2xl: 1.5rem;
    --text-3xl: 1.875rem;
    --text-4xl: 2.25rem;
    --text-5xl: 3rem;

    /* Spacing */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-8: 32px;
    --space-10: 40px;
    --space-12: 48px;
    --space-16: 64px;
    --space-20: 80px;

    /* Radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-2xl: 32px;
    --radius-full: 9999px;

    /* Shadows */
    --shadow-xs: 0 1px 2px rgba(0,0,0,0.04);
    --shadow-sm: 0 1px 3px rgba(249,115,22,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 12px rgba(249,115,22,0.08), 0 2px 4px rgba(0,0,0,0.04);
    --shadow-lg: 0 8px 24px rgba(249,115,22,0.1), 0 4px 8px rgba(0,0,0,0.04);
    --shadow-xl: 0 16px 48px rgba(249,115,22,0.12), 0 8px 16px rgba(0,0,0,0.06);
    --shadow-card: 0 0 0 1px rgba(249,115,22,0.06), 0 2px 8px rgba(0,0,0,0.04);

    /* Animations */
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-in: cubic-bezier(0.4, 0, 1, 1);
    --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
    --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --duration-fast: 150ms;
    --duration-normal: 250ms;
    --duration-slow: 400ms;

    /* Layout */
    --sidebar-width: 264px;
    --max-content-width: 1280px;
}

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

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    background: var(--surface-bg);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
}

/* --- Background Ambient --- */
.bg-ambient {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.bg-blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.15;
    animation: blob-float 25s ease-in-out infinite;
}

.bg-blob-1 {
    width: 600px; height: 600px;
    background: var(--orange-400);
    top: -150px; right: -100px;
    animation-delay: 0s;
}

.bg-blob-2 {
    width: 500px; height: 500px;
    background: var(--orange-200);
    bottom: -100px; left: -150px;
    animation-delay: -8s;
}

.bg-blob-3 {
    width: 350px; height: 350px;
    background: var(--orange-300);
    top: 50%; left: 45%;
    animation-delay: -16s;
    opacity: 0.08;
}

@keyframes blob-float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    25% { transform: translate(40px, -25px) scale(1.06); }
    50% { transform: translate(-20px, 30px) scale(0.94); }
    75% { transform: translate(-30px, -15px) scale(1.04); }
}

.bg-dots {
    position: absolute;
    inset: 0;
    background-image: radial-gradient(rgba(249,115,22,0.08) 1px, transparent 1px);
    background-size: 32px 32px;
}

/* --- App Shell --- */
.app-shell {
    position: relative;
    z-index: 1;
    display: flex;
    min-height: 100vh;
    min-height: 100dvh;
}

/* --- Sidebar --- */
.sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: var(--sidebar-width);
    background: var(--surface-sidebar);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border-right: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    padding: var(--space-5);
    z-index: 100;
    transition: transform var(--duration-slow) var(--ease-out);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-2);
    margin-bottom: var(--space-6);
}

.brand-logo {
    width: 40px; height: 40px;
    flex-shrink: 0;
    filter: drop-shadow(0 2px 8px rgba(249,115,22,0.2));
}

.brand-logo svg {
    width: 100%; height: 100%;
}

.brand-text {
    display: flex;
    flex-direction: column;
}

.brand-name {
    font-size: var(--text-base);
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    line-height: 1.2;
}

.brand-tagline {
    font-size: 10px;
    font-weight: 500;
    color: var(--orange-500);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.sidebar-nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: var(--text-sm);
    font-weight: 500;
    transition: all var(--duration-fast) var(--ease-out);
    cursor: pointer;
    position: relative;
    -webkit-tap-highlight-color: transparent;
}

.nav-item:hover {
    color: var(--orange-600);
    background: var(--orange-50);
}

.nav-item.active {
    color: var(--orange-600);
    background: var(--orange-50);
    font-weight: 600;
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: var(--space-1);
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 22px;
    background: var(--gradient-primary);
    border-radius: var(--radius-full);
}

.nav-icon {
    width: 20px; height: 20px;
    flex-shrink: 0;
}

.nav-badge {
    margin-left: auto;
    background: var(--gradient-primary);
    color: white;
    font-size: 11px;
    font-weight: 700;
    min-width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-full);
    padding: 0 6px;
}

.sidebar-footer {
    padding-top: var(--space-4);
    border-top: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.sidebar-footer-card {
    background: var(--orange-50);
    border-radius: var(--radius-md);
    padding: var(--space-3) var(--space-4);
}

.telegram-status {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-xs);
    color: var(--text-secondary);
    font-weight: 500;
}

.status-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
    transition: all var(--duration-normal) var(--ease-out);
}

.status-dot.active {
    background: var(--color-success);
    box-shadow: 0 0 8px rgba(22,163,74,0.4);
}

.sidebar-version {
    font-size: 10px;
    color: var(--text-muted);
    text-align: center;
}

/* --- Main Content --- */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: var(--space-6) var(--space-8) var(--space-16);
    max-width: var(--max-content-width);
    min-width: 0;
}

/* --- Mobile Header Only --- */
.mobile-header-only {
    display: none;
    margin-bottom: var(--space-4);
}

.topbar-menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px; height: 44px;
    border: none;
    background: var(--surface-card);
    backdrop-filter: blur(8px);
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: var(--radius-md);
    transition: all var(--duration-fast) var(--ease-out);
    box-shadow: var(--shadow-sm);
    flex-shrink: 0;
}

.topbar-menu-btn:hover {
    color: var(--orange-500);
    background: var(--orange-50);
}

.topbar-menu-btn svg {
    width: 22px; height: 22px;
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-5);
    font-size: var(--text-sm);
    font-weight: 600;
    font-family: var(--font-sans);
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-out);
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
    position: relative;
    overflow: hidden;
}

.btn:active {
    transform: scale(0.97);
}

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

.btn-lg {
    padding: var(--space-3) var(--space-6);
    font-size: var(--text-base);
    border-radius: var(--radius-lg);
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
    box-shadow: 0 2px 8px rgba(249,115,22,0.25), 0 1px 2px rgba(249,115,22,0.15);
}

.btn-primary:hover {
    box-shadow: 0 4px 16px rgba(249,115,22,0.35), 0 2px 4px rgba(249,115,22,0.2);
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: translateY(0) scale(0.98);
}

.btn-secondary {
    background: var(--surface-white);
    color: var(--text-secondary);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-xs);
}

.btn-secondary:hover {
    color: var(--text-primary);
    border-color: var(--orange-200);
    background: var(--orange-50);
}

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

.btn-ghost:hover {
    color: var(--orange-600);
    background: var(--orange-50);
}

.btn-icon {
    width: 18px; height: 18px;
    flex-shrink: 0;
}

.btn-lg .btn-icon {
    width: 20px; height: 20px;
}

/* --- Quick Actions Bar --- */
.quick-actions {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-bottom: var(--space-6);
}

/* --- Stats Row --- */
.stats-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-4);
    margin-bottom: var(--space-8);
}

.stat-card {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-5) var(--space-6);
    background: var(--surface-white);
    border-radius: var(--radius-lg);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-sm);
    transition: all var(--duration-normal) var(--ease-out);
}

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

.stat-icon {
    width: 48px; height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon svg {
    width: 24px; height: 24px;
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: var(--text-2xl);
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    line-height: 1.2;
}

.stat-label {
    font-size: var(--text-xs);
    font-weight: 500;
    color: var(--text-tertiary);
}

/* --- Section Header --- */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-5);
    flex-wrap: wrap;
    gap: var(--space-3);
}

.section-header-left {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    flex-wrap: wrap;
}

.section-title {
    font-size: var(--text-xl);
    font-weight: 700;
    letter-spacing: -0.02em;
}

.result-count {
    font-size: var(--text-sm);
    color: var(--text-tertiary);
}

/* --- Status Filter --- */
.status-filter {
    display: flex;
    gap: var(--space-1);
    background: var(--orange-50);
    border-radius: var(--radius-md);
    padding: 3px;
}

.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-1) var(--space-3);
    font-size: var(--text-xs);
    font-weight: 600;
    font-family: var(--font-sans);
    color: var(--text-tertiary);
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-out);
    -webkit-tap-highlight-color: transparent;
}

.filter-chip:hover {
    color: var(--text-secondary);
}

.filter-chip.active {
    color: var(--orange-700);
    background: var(--surface-white);
    box-shadow: var(--shadow-xs);
}

.chip-dot {
    width: 6px; height: 6px;
    border-radius: 50%;
}

.chip-dot.done { background: var(--status-done); }
.chip-dot.analyzing { background: var(--status-analyzing); animation: pulse-dot 1.5s ease-in-out infinite; }
.chip-dot.error { background: var(--status-error); }
.chip-dot.pending { background: var(--status-pending); }

@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* --- Repo Cards Grid --- */
.repo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: var(--space-4);
}

/* Card */
.repo-card {
    padding: var(--space-5);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    background: var(--surface-white);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    transition: all var(--duration-normal) var(--ease-out);
    position: relative;
    overflow: hidden;
}

.repo-card::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: var(--gradient-warm);
    opacity: 0;
    transition: opacity var(--duration-normal) var(--ease-out);
}

.repo-card:hover {
    border-color: var(--orange-200);
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.repo-card:hover::after {
    opacity: 1;
}

.repo-card > * {
    position: relative;
    z-index: 1;
}

.repo-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-3);
}

.repo-card-name {
    font-size: var(--text-base);
    font-weight: 700;
    letter-spacing: -0.01em;
    word-break: break-word;
    line-height: 1.3;
}

/* Status Badges */
.repo-card-status {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    padding: var(--space-1) var(--space-3);
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    font-weight: 600;
    flex-shrink: 0;
}

.status-done {
    background: var(--color-success-bg);
    color: var(--color-success-text);
}

.status-analyzing {
    background: var(--color-info-bg);
    color: var(--color-info-text);
}

.status-pending {
    background: var(--color-warning-bg);
    color: var(--color-warning-text);
}

.status-error {
    background: var(--color-error-bg);
    color: var(--color-error-text);
}

.repo-card-desc {
    font-size: var(--text-sm);
    color: var(--text-tertiary);
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 3.2em;
}

.repo-card-meta {
    display: flex;
    gap: var(--space-4);
    flex-wrap: wrap;
    align-items: center;
}

.repo-card-meta-item {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    font-size: var(--text-xs);
    color: var(--text-tertiary);
}

.repo-card-meta-item svg {
    width: 14px; height: 14px;
}

/* Star Rating */
.star-rating {
    display: flex;
    gap: 1px;
}

.star-rating svg {
    width: 16px; height: 16px;
}

.star-filled { color: #f59e0b; }
.star-empty { color: #d6d3d1; }

.repo-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: var(--space-3);
    border-top: 1px solid var(--orange-50);
}

.repo-card-date {
    font-size: var(--text-xs);
    color: var(--text-muted);
}

.repo-card-source {
    font-size: 10px;
    font-weight: 600;
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-sm);
    background: var(--orange-50);
    color: var(--orange-600);
}

.repo-card-clickable {
    cursor: pointer;
}

.btn-delete-card {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px; height: 30px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all var(--duration-fast) var(--ease-out);
    flex-shrink: 0;
}

.btn-delete-card:hover {
    color: var(--color-error);
    background: var(--color-error-bg);
    border-color: #fecaca;
}

.btn-delete-card svg {
    width: 16px; height: 16px;
}

/* --- Skeleton --- */
.skeleton-card {
    padding: var(--space-5);
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    background: var(--surface-white);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    pointer-events: none;
}

.skeleton {
    background: linear-gradient(90deg, #f5f0eb 25%, #ffedd5 50%, #f5f0eb 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.8s ease-in-out infinite;
    border-radius: var(--radius-sm);
}

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

.skeleton-title { height: 20px; width: 70%; }
.skeleton-desc { height: 14px; width: 90%; }
.skeleton-desc-short { height: 14px; width: 50%; }
.skeleton-meta { height: 12px; width: 60%; }

/* --- Empty State --- */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: var(--space-16) var(--space-6);
}

.empty-illustration {
    width: 200px; height: 160px;
    margin-bottom: var(--space-8);
}

.empty-illustration svg {
    width: 100%; height: 100%;
}

.empty-title {
    font-size: var(--text-2xl);
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-bottom: var(--space-3);
}

.empty-desc {
    font-size: var(--text-base);
    color: var(--text-tertiary);
    margin-bottom: var(--space-8);
    max-width: 480px;
    line-height: 1.7;
}

/* --- Modal --- */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(28,25,23,0.4);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 200;
    align-items: center;
    justify-content: center;
    padding: var(--space-4);
}

.modal-overlay.active {
    display: flex;
    animation: overlay-enter var(--duration-fast) var(--ease-out);
}

@keyframes overlay-enter {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal {
    width: 100%;
    max-width: 560px;
    background: var(--surface-white);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    animation: modal-enter var(--duration-normal) var(--spring);
    overflow: hidden;
}

@keyframes modal-enter {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-header {
    display: flex;
    align-items: flex-start;
    gap: var(--space-4);
    padding: var(--space-6) var(--space-6) 0;
}

.modal-header-icon {
    width: 44px; height: 44px;
    border-radius: var(--radius-md);
    background: var(--orange-50);
    color: var(--orange-500);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.modal-header-icon svg {
    width: 22px; height: 22px;
}

.modal-title {
    font-size: var(--text-xl);
    font-weight: 700;
    letter-spacing: -0.02em;
}

.modal-subtitle {
    font-size: var(--text-sm);
    color: var(--text-tertiary);
    margin-top: var(--space-1);
}

.modal-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px; height: 36px;
    border: none;
    background: transparent;
    color: var(--text-tertiary);
    cursor: pointer;
    border-radius: var(--radius-md);
    transition: all var(--duration-fast) var(--ease-out);
    margin-left: auto;
    flex-shrink: 0;
}

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

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

.modal-body {
    padding: var(--space-6);
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-3);
    margin-top: var(--space-6);
}

/* --- Forms --- */
.form-group {
    margin-bottom: var(--space-4);
}

.form-label {
    display: block;
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-2);
}

.required {
    color: var(--orange-500);
}

.form-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.form-input-icon {
    position: absolute;
    left: var(--space-4);
    width: 20px; height: 20px;
    color: var(--text-tertiary);
    pointer-events: none;
}

.form-input-icon + .form-input {
    padding-left: var(--space-12);
}

.form-input {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    font-size: var(--text-sm);
    font-family: var(--font-sans);
    color: var(--text-primary);
    background: var(--surface-white);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    outline: none;
    transition: all var(--duration-fast) var(--ease-out);
    box-shadow: var(--shadow-xs);
}

.form-input-lg {
    padding: var(--space-4);
    font-size: var(--text-base);
}

.form-input:focus {
    border-color: var(--orange-400);
    box-shadow: 0 0 0 3px rgba(249,115,22,0.1);
}

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

.form-input.error {
    border-color: var(--color-error);
    box-shadow: 0 0 0 3px rgba(220,38,38,0.1);
}

.form-helper {
    display: block;
    font-size: var(--text-xs);
    color: var(--text-tertiary);
    margin-top: var(--space-1);
}

.form-error {
    display: block;
    font-size: var(--text-xs);
    color: var(--color-error-text);
    margin-top: var(--space-1);
    min-height: 1.2em;
    font-weight: 500;
}

.form-feedback {
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--color-success-text);
}

/* Test Result Box */
.test-result {
    margin-top: var(--space-4);
    padding: var(--space-4);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    font-weight: 500;
    line-height: 1.6;
    animation: page-enter var(--duration-fast) var(--ease-out);
}

.test-result.success {
    background: var(--color-success-bg);
    color: var(--color-success-text);
    border: 1px solid #bbf7d0;
}

.test-result.error {
    background: var(--color-error-bg);
    color: var(--color-error-text);
    border: 1px solid #fecaca;
}

.test-result.warning {
    background: var(--color-warning-bg);
    color: var(--color-warning-text);
    border: 1px solid #fde68a;
}

.form-row-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-4);
    align-items: flex-start;
}

.form-row-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: var(--space-4);
}

.form-actions {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    margin-top: var(--space-2);
}

.flex-1 { flex: 1; }

.input-toggle-password {
    position: absolute;
    right: var(--space-2);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px; height: 36px;
    border: none;
    background: transparent;
    color: var(--text-tertiary);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: color var(--duration-fast) var(--ease-out);
}

.input-toggle-password:hover {
    color: var(--text-secondary);
}

.input-toggle-password svg {
    width: 18px; height: 18px;
}

/* Toggle Switch */
.toggle-wrapper {
    display: flex;
    align-items: center;
}

.toggle {
    position: relative;
    display: inline-flex;
    align-items: center;
    cursor: pointer;
}

.toggle input {
    position: absolute;
    opacity: 0;
    width: 0; height: 0;
}

.toggle-slider {
    width: 48px; height: 28px;
    background: var(--text-muted);
    border-radius: var(--radius-full);
    transition: all var(--duration-fast) var(--ease-out);
}

.toggle-slider::after {
    content: '';
    position: absolute;
    top: 3px; left: 3px;
    width: 22px; height: 22px;
    background: white;
    border-radius: 50%;
    transition: transform var(--duration-fast) var(--spring);
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

.toggle input:checked + .toggle-slider {
    background: var(--gradient-primary);
}

.toggle input:checked + .toggle-slider::after {
    transform: translateX(20px);
}

.toggle input:focus-visible + .toggle-slider {
    box-shadow: 0 0 0 3px rgba(249,115,22,0.2);
}

/* --- Settings Page --- */
.settings-hero {
    margin-bottom: var(--space-8);
}

.settings-page-title {
    font-size: var(--text-3xl);
    font-weight: 900;
    letter-spacing: -0.03em;
    margin-bottom: var(--space-2);
}

.settings-page-desc {
    font-size: var(--text-base);
    color: var(--text-tertiary);
}

.settings-container {
    display: flex;
    flex-direction: column;
    gap: var(--space-6);
    max-width: 800px;
}

.settings-card {
    background: var(--surface-white);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--glass-border);
    overflow: hidden;
    position: relative;
}

.settings-card-accent {
    height: 4px;
    background: var(--gradient-primary);
}

.settings-card-accent.telegram-accent {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
}

.settings-card-body {
    padding: var(--space-6);
}

.settings-card-header {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    margin-bottom: var(--space-6);
    padding-bottom: var(--space-5);
    border-bottom: 1px solid var(--orange-50);
}

.settings-card-icon {
    width: 44px; height: 44px;
    border-radius: var(--radius-md);
    background: var(--orange-50);
    color: var(--orange-500);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.settings-card-icon svg {
    width: 22px; height: 22px;
}

.settings-card-title-group {
    flex: 1;
}

.settings-card-title {
    font-size: var(--text-lg);
    font-weight: 700;
    letter-spacing: -0.01em;
    margin-bottom: var(--space-1);
}

.settings-card-desc {
    font-size: var(--text-xs);
    color: var(--text-tertiary);
}

.settings-badge {
    font-size: var(--text-xs);
    font-weight: 600;
    padding: var(--space-1) var(--space-3);
    border-radius: var(--radius-full);
    background: var(--orange-50);
    color: var(--orange-600);
    flex-shrink: 0;
}

.settings-badge.connected {
    background: var(--color-success-bg);
    color: var(--color-success-text);
}

.settings-form {
    margin-top: 0;
}

.telegram-info {
    margin-top: var(--space-4);
    padding: var(--space-4);
    background: var(--orange-50);
    border-radius: var(--radius-md);
}

.info-row {
    display: flex;
    gap: var(--space-3);
    margin-bottom: var(--space-2);
    font-size: var(--text-sm);
}

.info-row:last-child {
    margin-bottom: 0;
}

.info-label {
    color: var(--text-tertiary);
    min-width: 90px;
}

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

/* --- Report Detail --- */
.report-container {
    max-width: 900px;
    animation: page-enter var(--duration-slow) var(--ease-out);
}

.report-hero {
    background: var(--surface-white);
    border-radius: var(--radius-xl);
    padding: var(--space-8);
    margin-bottom: var(--space-6);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--glass-border);
    position: relative;
    overflow: hidden;
}

.report-hero::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: var(--gradient-primary);
}

.report-hero-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-4);
    margin-bottom: var(--space-6);
    flex-wrap: wrap;
}

.report-hero-name {
    font-size: var(--text-3xl);
    font-weight: 900;
    letter-spacing: -0.03em;
    word-break: break-word;
    line-height: 1.2;
}

.report-hero-link {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    font-size: var(--text-sm);
    color: var(--orange-500);
    text-decoration: none;
    font-weight: 500;
    margin-top: var(--space-1);
    transition: color var(--duration-fast) var(--ease-out);
}

.report-hero-link:hover {
    color: var(--orange-700);
}

.report-hero-link svg {
    width: 16px; height: 16px;
}

.report-score-display {
    display: flex;
    align-items: center;
    gap: var(--space-5);
    background: var(--orange-50);
    padding: var(--space-4) var(--space-5);
    border-radius: var(--radius-lg);
    flex-shrink: 0;
}

.report-score-big {
    font-size: var(--text-5xl);
    font-weight: 900;
    letter-spacing: -0.04em;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1;
}

.report-score-label {
    font-size: var(--text-xs);
    color: var(--text-tertiary);
    font-weight: 500;
}

.report-meta-row {
    display: flex;
    gap: var(--space-5);
    flex-wrap: wrap;
    margin-bottom: var(--space-6);
    padding-bottom: var(--space-5);
    border-bottom: 1px solid var(--orange-50);
}

.report-meta-item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

.report-meta-item svg {
    width: 18px; height: 18px;
    color: var(--text-tertiary);
}

/* Report Sections */
.report-section {
    background: var(--surface-white);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    margin-bottom: var(--space-4);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--glass-border);
}

.report-section-header {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-bottom: var(--space-4);
}

.report-section-icon {
    width: 24px; height: 24px;
    color: var(--orange-500);
    flex-shrink: 0;
}

.report-section-title {
    font-size: var(--text-lg);
    font-weight: 700;
    letter-spacing: -0.01em;
}

.report-section-content {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    line-height: 1.8;
}

/* Tech Tags */
.tech-tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
}

.tech-tag {
    padding: var(--space-1) var(--space-4);
    font-size: var(--text-xs);
    font-weight: 600;
    border-radius: var(--radius-full);
    background: var(--orange-50);
    color: var(--orange-700);
    border: 1px solid var(--orange-100);
}

.tech-tag.language {
    background: #fef3c7;
    color: #92400e;
    border-color: #fde68a;
}

.tech-tag.framework {
    background: #dbeafe;
    color: #1e40af;
    border-color: #bfdbfe;
}

.tech-tag.tool {
    background: #f0fdf4;
    color: #166534;
    border-color: #bbf7d0;
}

/* Pros/Cons/Recs */
.report-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.report-list-item {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    font-size: var(--text-sm);
    color: var(--text-secondary);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
    background: var(--orange-50);
    border: 1px solid var(--orange-50);
}

.report-list-item svg {
    width: 18px; height: 18px;
    flex-shrink: 0;
    margin-top: 1px;
}

.report-list-item.pro { background: #f0fdf4; border-color: #bbf7d0; }
.report-list-item.pro svg { color: var(--color-success); }
.report-list-item.con { background: #fef2f2; border-color: #fecaca; }
.report-list-item.con svg { color: var(--color-error); }
.report-list-item.rec { background: #eff6ff; border-color: #bfdbfe; }
.report-list-item.rec svg { color: var(--color-info); }

/* Section Number */
.section-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px; height: 28px;
    border-radius: var(--radius-full);
    background: var(--gradient-primary);
    color: white;
    font-size: var(--text-sm);
    font-weight: 800;
    flex-shrink: 0;
}

/* Similar Repos Grid */
.similar-repos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: var(--space-3);
}

.similar-repo-card {
    display: block;
    padding: var(--space-4);
    background: var(--orange-50);
    border: 1px solid var(--orange-100);
    border-radius: var(--radius-md);
    text-decoration: none;
    transition: all var(--duration-fast) var(--ease-out);
}

.similar-repo-card:hover {
    border-color: var(--orange-300);
    background: var(--orange-100);
    transform: translateY(-1px);
}

.similar-repo-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
    margin-bottom: var(--space-2);
}

.similar-repo-name {
    font-size: var(--text-sm);
    font-weight: 700;
    color: var(--text-primary);
}

.similar-repo-stars {
    display: flex;
    align-items: center;
    gap: 3px;
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.similar-repo-desc {
    font-size: var(--text-xs);
    color: var(--text-tertiary);
    line-height: 1.5;
    margin-bottom: var(--space-1);
}

.similar-repo-compare {
    font-size: var(--text-xs);
    color: var(--orange-700);
    font-weight: 500;
    line-height: 1.5;
    padding-top: var(--space-2);
    border-top: 1px solid var(--orange-100);
}

/* Report loading */
.report-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-16) var(--space-6);
    text-align: center;
}

.spinner {
    width: 48px; height: 48px;
    border: 3px solid var(--orange-100);
    border-top-color: var(--orange-500);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: var(--space-5);
}

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

.report-loading-text {
    font-size: var(--text-base);
    color: var(--text-secondary);
    font-weight: 500;
}

.report-loading-sub {
    font-size: var(--text-sm);
    color: var(--text-tertiary);
    margin-top: var(--space-2);
}

/* Report Error */
.report-error {
    text-align: center;
    padding: var(--space-16) var(--space-6);
}

.report-error svg {
    width: 80px; height: 80px;
    color: var(--orange-200);
    margin-bottom: var(--space-6);
}

.report-error-title {
    font-size: var(--text-xl);
    font-weight: 700;
    margin-bottom: var(--space-3);
}

.report-error-text {
    font-size: var(--text-sm);
    color: var(--text-tertiary);
    margin-bottom: var(--space-6);
    max-width: 500px;
    margin-inline: auto;
}

.report-error-text code {
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    background: var(--orange-50);
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    color: var(--orange-700);
}

/* --- Toast --- */
.toast-container {
    position: fixed;
    bottom: var(--space-6);
    right: var(--space-6);
    z-index: 500;
    display: flex;
    flex-direction: column-reverse;
    gap: var(--space-2);
}

.toast {
    padding: var(--space-3) var(--space-5);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: var(--space-3);
    animation: toast-enter var(--duration-normal) var(--spring);
    max-width: 420px;
    box-shadow: var(--shadow-lg);
    background: var(--surface-white);
    border: 1px solid var(--glass-border);
}

.toast-success {
    border-color: #bbf7d0;
    color: var(--color-success-text);
}

.toast-error {
    border-color: #fecaca;
    color: var(--color-error-text);
}

.toast-info {
    border-color: var(--orange-200);
    color: var(--orange-700);
}

@keyframes toast-enter {
    from { opacity: 0; transform: translateX(40px); }
    to { opacity: 1; transform: translateX(0); }
}

/* --- Polling bar --- */
.polling-bar {
    height: 3px;
    background: var(--gradient-warm);
    position: fixed;
    top: 0;
    left: 0;
    z-index: 600;
    animation: polling-slide 2s var(--ease-in-out) infinite;
    border-radius: 0 2px 2px 0;
}

@keyframes polling-slide {
    0% { width: 0%; left: 0; }
    50% { width: 50%; left: 25%; }
    100% { width: 0%; left: 100%; }
}

/* --- Page Transition --- */
.page {
    display: none;
}

.page.active {
    display: block;
    animation: page-enter var(--duration-slow) var(--ease-out);
}

@keyframes page-enter {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- Scrollbar --- */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--orange-200); border-radius: var(--radius-full); }
::-webkit-scrollbar-thumb:hover { background: var(--orange-300); }

/* --- Focus --- */
:focus-visible {
    outline: 2px solid var(--orange-500);
    outline-offset: 2px;
    border-radius: 3px;
}

.form-input:focus-visible { outline: none; }

/* --- Selection --- */
::selection {
    background: rgba(249,115,22,0.15);
    color: var(--text-primary);
}

/* --- Sidebar Overlay (mobile) --- */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(28,25,23,0.3);
    backdrop-filter: blur(2px);
    z-index: 99;
}

.sidebar-overlay.active {
    display: block;
    animation: overlay-enter var(--duration-fast) var(--ease-out);
}

/* --- Responsive --- */
@media (max-width: 1024px) {
    .repo-grid {
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    }

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

    .section-header-left {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        flex: 1;
        margin-left: 0;
        padding: var(--space-4);
        padding-top: var(--space-2);
        min-width: 0;
        max-width: none;
    }

    .mobile-header-only {
        display: block;
    }

    .topbar-menu-btn {
        display: flex;
    }

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

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

    .section-header { flex-direction: column; align-items: flex-start; }

    .status-filter {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        width: 100%;
    }

    .filter-chip { flex-shrink: 0; }

    .report-hero-header { flex-direction: column; }
    .report-score-display { width: 100%; justify-content: center; }

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

    .modal {
        margin: var(--space-4);
        max-height: calc(100dvh - 32px);
        overflow-y: auto;
    }

    .modal-header {
        padding: var(--space-4) var(--space-4) 0;
    }

    .modal-body {
        padding: var(--space-4);
    }

    .toast-container {
        left: var(--space-4);
        right: var(--space-4);
        bottom: var(--space-4);
    }

    .toast { max-width: 100%; }

    .settings-container { gap: var(--space-4); }
}

/* --- Reduced Motion --- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    .bg-blob { animation: none; }
}
