:root {
	--bg-canvas: #090d16;
	--bg-surface: #101726;
	--bg-elevated: #182238;
	--bg-hover: #1e2b45;
	--text-primary: #f1f5f9;
	--text-muted: #94a3b8;
	--text-subtle: #64748b;
	--border-default: #1e293b;
	--border-strong: #334155;
	--border-focus: #6366f1;
	--brand-50: #eef2ff;
	--brand-500: #6366f1;
	--brand-600: #4f46e5;
	--brand-700: #4338ca;
	--brand-fg: #818cf8;
	--brand-bg-subtle: rgba(99, 102, 241, 0.15);
	--accent-gold: #f59e0b;
	--accent-gold-bg: rgba(245, 158, 11, 0.15);
	--success-fg: #10b981;
	--success-bg: rgba(16, 185, 129, 0.15);
	--warning-fg: #f59e0b;
	--warning-bg: rgba(245, 158, 11, 0.15);
	--danger-fg: #ef4444;
	--danger-bg: rgba(239, 68, 68, 0.15);
	--info-fg: #38bdf8;
	--info-bg: rgba(56, 189, 248, 0.15);
	--font-sans: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	--font-mono: "JetBrains Mono", "SF Mono", Menlo, Consolas, monospace;
	--radius-sm: 4px;
	--radius-md: 6px;
	--radius-lg: 8px;
	--radius-xl: 12px;
	--shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.2);
	--shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
	--shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -4px rgba(0, 0, 0, 0.4);
	--shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.5);
	--ring-focus: 0 0 0 2px rgba(99, 102, 241, 0.35);
}

.light-theme {
	--bg-canvas: #f8fafc;
	--bg-surface: #ffffff;
	--bg-elevated: #f1f5f9;
	--bg-hover: #e2e8f0;
	--text-primary: #0f172a;
	--text-muted: #475569;
	--text-subtle: #94a3b8;
	--border-default: #e2e8f0;
	--border-strong: #cbd5e1;
	--brand-fg: #4f46e5;
	--brand-bg-subtle: #eef2ff;
	--success-bg: #ecfdf5;
	--warning-bg: #fffbeb;
	--danger-bg: #fef2f2;
	--info-bg: #f0f9ff;
}

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

body {
	background: var(--bg-canvas);
	color: var(--text-primary);
	font-family: var(--font-sans);
	font-size: 13.5px;
	line-height: 1.45;
	-webkit-font-smoothing: antialiased;
}

/* Base Primitives */
button, input, select, textarea {
	font-family: inherit;
	font-size: inherit;
	color: inherit;
}

button {
	cursor: pointer;
	border: none;
	background: none;
}

.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	height: 32px;
	padding: 0 12px;
	font-size: 13px;
	font-weight: 500;
	border-radius: var(--radius-md);
	transition: all 120ms ease;
	white-space: nowrap;
}

.btn-primary {
	background: var(--brand-600);
	color: #ffffff;
}
.btn-primary:hover {
	background: var(--brand-700);
}
.btn-primary:active {
	transform: scale(0.98);
}

.btn-gold {
	background: #d97706;
	color: #ffffff;
	font-weight: 600;
}
.btn-gold:hover {
	background: #b45309;
}

.btn-secondary {
	background: var(--bg-surface);
	color: var(--text-primary);
	border: 1px solid var(--border-default);
}
.btn-secondary:hover {
	background: var(--bg-hover);
	border-color: var(--border-strong);
}

.btn-ghost {
	color: var(--text-muted);
}
.btn-ghost:hover {
	background: var(--bg-hover);
	color: var(--text-primary);
}

.btn-danger {
	background: var(--danger-bg);
	color: var(--danger-fg);
	border: 1px solid rgba(239, 68, 68, 0.3);
}
.btn-danger:hover {
	background: rgba(239, 68, 68, 0.25);
}

.btn-sm {
	height: 26px;
	padding: 0 8px;
	font-size: 12px;
}

.badge {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	padding: 2px 7px;
	border-radius: var(--radius-sm);
	font-size: 11px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.03em;
}

.badge-brand { background: var(--brand-bg-subtle); color: var(--brand-fg); }
.badge-success { background: var(--success-bg); color: var(--success-fg); }
.badge-warning { background: var(--warning-bg); color: var(--warning-fg); }
.badge-danger { background: var(--danger-bg); color: var(--danger-fg); }
.badge-info { background: var(--info-bg); color: var(--info-fg); }
.badge-neutral { background: var(--bg-elevated); color: var(--text-muted); border: 1px solid var(--border-default); }

.card {
	background: var(--bg-surface);
	border: 1px solid var(--border-default);
	border-radius: var(--radius-lg);
	padding: 16px;
}

.input, .select, .textarea {
	width: 100%;
	height: 32px;
	padding: 0 10px;
	background: var(--bg-surface);
	border: 1px solid var(--border-default);
	border-radius: var(--radius-md);
	color: var(--text-primary);
}
.input:focus, .select:focus, .textarea:focus {
	outline: none;
	border-color: var(--brand-fg);
	box-shadow: var(--ring-focus);
}
.textarea {
	height: auto;
	padding: 8px 10px;
	resize: vertical;
}

/* Layout App Shell */
.app-container {
	display: flex;
	flex-direction: column;
	min-height: 100vh;
}

/* Top Header Bar */
.topbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 0 18px;
	height: 52px;
	background: var(--bg-surface);
	border-bottom: 1px solid var(--border-default);
	position: sticky;
	top: 0;
	z-index: 40;
}

.brand-section {
	display: flex;
	align-items: center;
	gap: 10px;
}

.logo-badge {
	width: 30px;
	height: 30px;
	border-radius: 6px;
	background: linear-gradient(135deg, #4f46e5, #9333ea);
	display: grid;
	place-items: center;
	font-weight: 800;
	color: #fff;
	font-size: 13px;
	box-shadow: 0 2px 6px rgba(79, 70, 229, 0.4);
}

.app-title-wrap {
	display: flex;
	flex-direction: column;
}

.app-title {
	font-size: 14px;
	font-weight: 700;
	letter-spacing: -0.01em;
	display: flex;
	align-items: center;
	gap: 8px;
}

.app-subtitle {
	font-size: 11px;
	color: var(--text-muted);
}

.topbar-actions {
	display: flex;
	align-items: center;
	gap: 10px;
}

/* Top Navigation Tabs */
.nav-tabs-bar {
	display: flex;
	align-items: center;
	gap: 4px;
	padding: 0 18px;
	height: 42px;
	background: var(--bg-surface);
	border-bottom: 1px solid var(--border-default);
	overflow-x: auto;
}

.nav-tab {
	display: flex;
	align-items: center;
	gap: 6px;
	padding: 6px 12px;
	height: 32px;
	font-size: 13px;
	font-weight: 500;
	color: var(--text-muted);
	border-radius: var(--radius-md);
	transition: all 120ms ease;
}
.nav-tab:hover {
	color: var(--text-primary);
	background: var(--bg-hover);
}
.nav-tab.active {
	color: var(--brand-fg);
	background: var(--brand-bg-subtle);
	font-weight: 600;
}

/* Main Content Area */
.main-viewport {
	flex: 1;
	padding: 20px 18px 40px;
	max-width: 1440px;
	margin: 0 auto;
	width: 100%;
}

/* KPI Banner Strip */
.kpi-strip {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
	gap: 12px;
	margin-bottom: 20px;
}

.kpi-card {
	background: var(--bg-surface);
	border: 1px solid var(--border-default);
	border-radius: var(--radius-lg);
	padding: 12px 14px;
	display: flex;
	flex-direction: column;
	gap: 4px;
	transition: border-color 150ms ease;
}
.kpi-card:hover {
	border-color: var(--border-strong);
}

.kpi-label {
	font-size: 11px;
	color: var(--text-muted);
	text-transform: uppercase;
	font-weight: 600;
	letter-spacing: 0.04em;
	display: flex;
	align-items: center;
	justify-content: space-between;
}

.kpi-value {
	font-size: 22px;
	font-weight: 700;
	font-family: var(--font-mono);
	letter-spacing: -0.02em;
}

.kpi-sub {
	font-size: 11px;
	color: var(--text-subtle);
}

/* Swarm Command Visualizer */
.agent-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
	gap: 14px;
	margin-bottom: 20px;
}

.agent-card {
	background: var(--bg-surface);
	border: 1px solid var(--border-default);
	border-radius: var(--radius-lg);
	padding: 14px;
	display: flex;
	flex-direction: column;
	gap: 10px;
	position: relative;
	overflow: hidden;
}

.agent-card::before {
	content: "";
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	height: 3px;
	background: var(--brand-500);
}
.agent-card.scout::before { background: #38bdf8; }
.agent-card.analyst::before { background: #818cf8; }
.agent-card.copywriter::before { background: #f59e0b; }
.agent-card.closer::before { background: #ec4899; }
.agent-card.cashier::before { background: #10b981; }
.agent-card.sentinel::before { background: #a855f7; }

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

.agent-title {
	font-size: 13.5px;
	font-weight: 600;
	display: flex;
	align-items: center;
	gap: 6px;
}

.agent-status-indicator {
	display: flex;
	align-items: center;
	gap: 5px;
	font-size: 11px;
	font-family: var(--font-mono);
	color: var(--success-fg);
}

.status-dot {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: var(--success-fg);
	box-shadow: 0 0 6px var(--success-fg);
}

.agent-desc {
	font-size: 12px;
	color: var(--text-muted);
}

.agent-metrics {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding-top: 8px;
	border-top: 1px solid var(--border-default);
	font-size: 11px;
	color: var(--text-subtle);
}

/* Split Pane Layout */
.split-layout {
	display: grid;
	grid-template-columns: 1fr 380px;
	gap: 18px;
}
@media (max-width: 1024px) {
	.split-layout {
		grid-template-columns: 1fr;
	}
}

/* Console Terminal Log */
.terminal-window {
	background: #050811;
	border: 1px solid #1a2333;
	border-radius: var(--radius-lg);
	overflow: hidden;
	display: flex;
	flex-direction: column;
	font-family: var(--font-mono);
}

.terminal-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 8px 12px;
	background: #0b111e;
	border-bottom: 1px solid #1a2333;
	font-size: 11px;
	color: var(--text-muted);
}

.terminal-dots {
	display: flex;
	gap: 5px;
}
.terminal-dot {
	width: 9px;
	height: 9px;
	border-radius: 50%;
}
.dot-red { background: #ef4444; }
.dot-yellow { background: #f59e0b; }
.dot-green { background: #10b981; }

.terminal-body {
	padding: 12px;
	font-size: 12px;
	line-height: 1.6;
	max-height: 380px;
	overflow-y: auto;
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.log-entry {
	display: flex;
	gap: 8px;
	word-break: break-word;
}
.log-time {
	color: #64748b;
	white-space: nowrap;
	font-size: 11px;
}
.log-agent {
	color: #818cf8;
	font-weight: 600;
	white-space: nowrap;
}
.log-action {
	color: #38bdf8;
	font-weight: 500;
}
.log-msg {
	color: #cbd5e1;
}

/* Code Snippet Box */
.code-container {
	background: #050811;
	border: 1px solid #1e293b;
	border-radius: var(--radius-lg);
	overflow: hidden;
	margin: 10px 0;
}

.code-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 8px 12px;
	background: #0d1527;
	border-bottom: 1px solid #1e293b;
	font-family: var(--font-mono);
	font-size: 12px;
	color: var(--text-muted);
}

.code-pre {
	padding: 14px;
	font-family: var(--font-mono);
	font-size: 12px;
	line-height: 1.55;
	overflow-x: auto;
	color: #e2e8f0;
	background: #050811;
	white-space: pre-wrap;
}

/* Lead CRM & Pipeline Table */
.pipeline-filter-bar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	margin-bottom: 14px;
	flex-wrap: wrap;
}

.filter-group {
	display: flex;
	align-items: center;
	gap: 6px;
	flex-wrap: wrap;
}

.lead-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 13px;
}

.lead-table th {
	padding: 10px 12px;
	background: var(--bg-surface);
	border-bottom: 1px solid var(--border-default);
	color: var(--text-muted);
	font-size: 11px;
	text-transform: uppercase;
	font-weight: 600;
	letter-spacing: 0.04em;
	text-align: left;
}

.lead-table td {
	padding: 12px;
	border-bottom: 1px solid var(--border-default);
	vertical-align: middle;
}

.lead-table tr:hover td {
	background: var(--bg-hover);
}

.fit-meter {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-family: var(--font-mono);
	font-weight: 700;
	font-size: 12px;
}

.score-high { color: var(--success-fg); }
.score-med { color: var(--warning-fg); }
.score-low { color: var(--text-muted); }

/* Asset Matrix Cards */
.asset-matrix-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
	gap: 16px;
	margin-bottom: 24px;
}

.asset-card {
	background: var(--bg-surface);
	border: 1px solid var(--border-default);
	border-radius: var(--radius-lg);
	padding: 16px;
	display: flex;
	flex-direction: column;
	gap: 12px;
}

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

.asset-title {
	font-size: 14px;
	font-weight: 600;
	display: flex;
	align-items: center;
	gap: 8px;
}

.asset-link-box {
	background: var(--bg-elevated);
	border: 1px solid var(--border-default);
	padding: 8px 10px;
	border-radius: var(--radius-md);
	font-family: var(--font-mono);
	font-size: 11.5px;
	color: var(--brand-fg);
	word-break: break-all;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
}

/* Modal Overlay */
.modal-overlay {
	position: fixed;
	inset: 0;
	background: rgba(4, 7, 15, 0.75);
	backdrop-filter: blur(4px);
	display: grid;
	place-items: center;
	z-index: 100;
	padding: 16px;
}

.modal-content {
	background: var(--bg-surface);
	border: 1px solid var(--border-strong);
	border-radius: var(--radius-xl);
	width: 100%;
	max-width: 620px;
	max-height: 90vh;
	overflow-y: auto;
	box-shadow: var(--shadow-xl);
	display: flex;
	flex-direction: column;
}

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

.modal-title {
	font-size: 16px;
	font-weight: 700;
}

.modal-body {
	padding: 20px;
	display: flex;
	flex-direction: column;
	gap: 14px;
}

.modal-footer {
	padding: 14px 20px;
	border-top: 1px solid var(--border-default);
	display: flex;
	align-items: center;
	justify-content: flex-end;
	gap: 10px;
	background: var(--bg-elevated);
}

/* 7-Day Roadmap Timeline */
.timeline-container {
	display: flex;
	flex-direction: column;
	gap: 16px;
}

.timeline-step {
	background: var(--bg-surface);
	border: 1px solid var(--border-default);
	border-radius: var(--radius-lg);
	padding: 16px;
	display: grid;
	grid-template-columns: 80px 1fr;
	gap: 16px;
}
@media (max-width: 640px) {
	.timeline-step {
		grid-template-columns: 1fr;
	}
}

.day-badge {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	background: var(--brand-bg-subtle);
	border: 1px solid rgba(99, 102, 241, 0.3);
	border-radius: var(--radius-md);
	padding: 8px;
	height: fit-content;
}
.day-num {
	font-size: 18px;
	font-weight: 800;
	color: var(--brand-fg);
	font-family: var(--font-mono);
}
.day-label {
	font-size: 10px;
	text-transform: uppercase;
	color: var(--text-muted);
	font-weight: 700;
}

.step-content {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.step-title {
	font-size: 15px;
	font-weight: 600;
	color: var(--text-primary);
}

.step-desc {
	font-size: 13px;
	color: var(--text-muted);
	line-height: 1.5;
}

.step-checklist {
	display: flex;
	flex-direction: column;
	gap: 6px;
	margin-top: 4px;
}

.checklist-item {
	display: flex;
	align-items: flex-start;
	gap: 8px;
	font-size: 12.5px;
	color: var(--text-primary);
}

.custom-checkbox {
	accent-color: var(--brand-600);
	margin-top: 3px;
}

/* Toast Notification */
.toast-bar {
	position: fixed;
	bottom: 20px;
	right: 20px;
	background: var(--bg-elevated);
	border: 1px solid var(--border-strong);
	border-radius: var(--radius-lg);
	padding: 12px 18px;
	display: flex;
	align-items: center;
	gap: 10px;
	box-shadow: var(--shadow-lg);
	z-index: 999;
	font-size: 13px;
	animation: slideUp 200ms ease;
}

@keyframes slideUp {
	from { transform: translateY(20px); opacity: 0; }
	to { transform: translateY(0); opacity: 1; }
}
