:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --secondary: #64748b;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --background: #f8fafc;
    --panel-bg: #ffffff;
    --border: #e2e8f0;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--background);
    color: var(--text-main);
    line-height: 1.5;
    height: 100vh;
    overflow: hidden;
}

.app-container {
    display: flex;
    height: 100vh;
}

/* Narrative Panel */
.narrative-panel {
    width: 400px;
    background: var(--panel-bg);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 2rem;
    z-index: 10;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: -0.025em;
}

.badge-demo {
    font-size: 0.75rem;
    background: #e0e7ff;
    color: var(--primary);
    padding: 0.25rem 0.5rem;
    border-radius: 9999px;
    font-weight: 600;
}

.steps-nav {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 2rem;
}

.step-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem;
    border-radius: 0.5rem;
    color: var(--text-muted);
    font-size: 0.875rem;
    transition: all 0.2s;
}

.step-item.active {
    background: #f1f5f9;
    color: var(--text-main);
    font-weight: 500;
}

.step-number {
    width: 1.5rem;
    height: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--border);
    border-radius: 50%;
    font-size: 0.75rem;
}

.step-item.active .step-number {
    background: var(--primary);
    color: white;
}

.narrative-content {
    flex: 1;
    overflow-y: auto;
    margin-bottom: 2rem;
}

.narrative-content h2 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
}

.narrative-content p {
    color: var(--text-muted);
    font-size: 0.9375rem;
    margin-bottom: 1rem;
}

.investor-quote {
    background: #f8fafc;
    border-left: 4px solid var(--primary);
    padding: 1rem;
    border-radius: 0 0.5rem 0.5rem 0;
    margin: 1.5rem 0;
    font-style: italic;
    font-size: 0.875rem;
}

.narrative-footer {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

/* Live Data Panel */
.live-data-panel {
    flex: 1;
    padding: 3rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
}

#data-view-container {
    width: 100%;
    max-width: 900px;
}

.empty-state {
    text-align: center;
    margin-top: 10rem;
    color: var(--text-muted);
}

/* Components */
.card {
    background: white;
    border-radius: 1rem;
    padding: 1.5rem;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
}

.card-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 1rem;
    display: flex;
    justify-content: space-between;
}

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

.stat-item .label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.stat-item .value {
    font-size: 1.125rem;
    font-weight: 600;
}

/* Badges */
.badge {
    padding: 0.25rem 0.625rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-success { background: #dcfce7; color: #166534; }
.badge-warning { background: #fef9c3; color: #854d0e; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-info { background: #e0f2fe; color: #075985; }

/* Buttons */
.btn {
    padding: 0.625rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

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

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

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

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

.btn-secondary:hover:not(:disabled) {
    background: #f8fafc;
}

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

.btn-ghost:hover:not(:disabled) {
    color: var(--text-main);
    background: #f1f5f9;
}

/* Comparison Cards */
.comparison-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-top: 1rem;
}

.diff-card {
    padding: 1rem;
    border-radius: 0.5rem;
    background: #f8fafc;
    border: 1px solid var(--border);
}

.diff-card.before { border-left: 4px solid var(--secondary); }
.diff-card.after { border-left: 4px solid var(--primary); }

/* Timeline */
.timeline {
    position: relative;
    padding-left: 2rem;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 0.5rem;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border);
}

.timeline-event {
    position: relative;
    margin-bottom: 1.5rem;
}

.timeline-dot {
    position: absolute;
    left: -1.75rem;
    top: 0.25rem;
    width: 0.75rem;
    height: 0.75rem;
    background: var(--primary);
    border-radius: 50%;
    border: 2px solid white;
}

.timeline-time {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.timeline-title {
    font-size: 0.875rem;
    font-weight: 600;
    margin: 0.125rem 0;
}

.timeline-desc {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

/* Confidence Meter */
.confidence-container {
    margin-top: 0.5rem;
}

.confidence-bar-bg {
    height: 0.5rem;
    background: var(--border);
    border-radius: 9999px;
    overflow: hidden;
}

.confidence-bar-fill {
    height: 100%;
    background: var(--primary);
    transition: width 0.5s ease-out;
}

/* Inputs */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}

.input-control {
    width: 100%;
    padding: 0.625rem;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    font-family: inherit;
}

.input-control:focus {
    outline: 2px solid var(--primary);
    outline-offset: -1px;
}

/* Toast Notification */
.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 9999;
}

.toast {
    background: #1e293b;
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 0.5rem;
    box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.toast-icon {
    width: 1.25rem;
    height: 1.25rem;
    background: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: bold;
}

.toast-content {
    font-size: 0.875rem;
}
