:root {
    --bg-app: #030712;
    --bg-card: rgba(17, 24, 39, 0.7);
    --bg-input: #1f2937;
    --border: rgba(255, 255, 255, 0.1);
    --border-hover: rgba(255, 255, 255, 0.2);

    --text-main: #f9fafb;
    --text-muted: #9ca3af;

    --primary: #3b82f6;
    /* Blue 500 */
    --secondary: #10b981;
    /* Emerald 500 */
    --tertiary: #a855f7;
    /* Purple 500 */

    --font-sans: 'Space Grotesk', system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

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

body {
    font-family: var(--font-sans);
    background: var(--bg-app);
    color: var(--text-main);
    background-image: radial-gradient(circle at top right, rgba(59, 130, 246, 0.05), transparent 40%),
        radial-gradient(circle at bottom left, rgba(168, 85, 247, 0.05), transparent 40%);
    min-height: 100vh;
    display: flex;
}

/* Utilities */
.glass {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: 16px;
}

.space-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.mb-2 {
    margin-bottom: 0.5rem;
}

.mb-4 {
    margin-bottom: 1rem;
}

.mt-4 {
    margin-top: 1rem;
}

.mt-8 {
    margin-top: 2rem;
}

.full-width {
    width: 100%;
}

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

.flex-fill {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

/* Layout */
.app-layout {
    display: flex;
    width: 100%;
    max-width: 1600px;
    margin: 0 auto;
}

.sidebar {
    width: 320px;
    border-right: 1px solid var(--border);
    padding: 2rem;
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: sticky;
    top: 0;
    border-radius: 0;
    border-top: none;
    border-bottom: none;
    border-left: none;
}

.dashboard {
    flex-grow: 1;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    height: 100vh;
}

@media (max-width: 900px) {
    .app-layout {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }

    .dashboard {
        height: auto;
        overflow: visible;
    }
}

/* Sidebar Branding & Form */
.brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--primary);
    margin-bottom: 2.5rem;
}

.brand h1 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: -0.02em;
}

.section-title {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

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

.help-text {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.4rem;
    line-height: 1.4;
}

.inp {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-family: var(--font-mono);
    outline: none;
    transition: border-color 0.2s;
    font-size: 0.9rem;
}

.inp:focus {
    border-color: var(--primary);
}

.input-group {
    display: flex;
    gap: 0.5rem;
}

.input-group .inp:first-child {
    flex: 1;
}

.input-group .select {
    flex: 1.2;
    font-family: var(--font-sans);
}

.slider {
    -webkit-appearance: none;
    width: 100%;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    outline: none;
    margin-top: 0.5rem;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    transition: transform 0.1s;
}

.slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 2rem 0;
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 2rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-family: var(--font-sans);
    font-weight: 500;
    border: none;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s;
    padding: 0.75rem 1.2rem;
    font-size: 0.95rem;
}

.btn.outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-main);
}

.btn.outline:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--border-hover);
}

.icon-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
    transition: color 0.2s;
    display: flex;
}

.icon-btn:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.05);
}

/* Dashboard */
.top-nav {
    margin-bottom: 2rem;
}

.top-nav h2 {
    font-size: 1.5rem;
    font-weight: 600;
}

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

.card {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
}

.card-icon {
    margin-bottom: 1rem;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.03);
    display: flex;
    align-items: center;
    justify-content: center;
}

.metric-val {
    font-size: 2.5rem;
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--text-main);
    line-height: 1.1;
    margin-bottom: 0.5rem;
}

.hero-card .metric-val {
    color: var(--primary);
    text-shadow: 0 0 20px rgba(59, 130, 246, 0.3);
}

.metric-label {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-main);
}

.metric-sub {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* Timeline */
.timeline-container {
    height: 60px;
    position: relative;
    margin: 2rem 0;
    width: 100%;
    overflow: hidden;
}

.timeline-axis {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--border);
    transform: translateY(-50%);
}

.timeline-ticks {
    position: absolute;
    inset: 0;
    width: 100%;
}

.tick {
    position: absolute;
    top: 15px;
    bottom: 15px;
    width: 4px;
    border-radius: 2px;
    background: var(--primary);
    box-shadow: 0 0 8px rgba(59, 130, 246, 0.5);
    opacity: 0;
    animation: fadeTick 0.5s forwards;
}

@keyframes fadeTick {
    to {
        opacity: 1;
    }
}

/* Code box */
.code-snippet-box {
    background: #000;
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
}

.snippet-header {
    background: #111;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
}

.code-snippet-box pre {
    padding: 1.5rem;
    overflow-x: auto;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: #e2e8f0;
    line-height: 1.5;
}

.hl-keyword {
    color: #c678dd;
}

.hl-func {
    color: #61afef;
}

.hl-str {
    color: #98c379;
}

.hl-num {
    color: #d19a66;
}

.hl-comment {
    color: #5c6370;
    font-style: italic;
}