:root {
	color-scheme: light dark;
	--bg: #0d1117;
	--bg-subtle: #161b22;
	--bg-card: #1c2128;
	--bg-hover: #22272e;
	--border: #30363d;
	--border-subtle: #21262d;
	--fg: #f0f6fc;
	--fg-muted: #8b949e;
	--fg-subtle: #6e7681;
	--accent: #2f81f7;
	--accent-glow: rgba(47, 129, 247, 0.18);
	--accent-subtle: #1f3b58;
	--success: #238636;
	--success-fg: #3fb950;
	--success-bg: rgba(63, 185, 80, 0.15);
	--warning: #d29922;
	--warning-bg: rgba(210, 153, 34, 0.15);
	--danger: #f85149;
	--danger-bg: rgba(248, 81, 73, 0.15);
	--purple: #a371f7;
	--purple-bg: rgba(163, 113, 247, 0.15);
	--radius-sm: 6px;
	--radius: 10px;
	--radius-lg: 14px;
	--space: 1rem;
	--font: "Vazirmatn", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	--font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

* {
	box-sizing: border-box;
}

body {
	margin: 0;
	background: var(--bg);
	color: var(--fg);
	font-family: var(--font);
	line-height: 1.6;
	-webkit-font-smoothing: antialiased;
	direction: rtl;
	text-align: right;
}

/* Container Shell */
.shell {
	max-width: 74rem;
	margin: 0 auto;
	padding: 1.5rem 1rem 4rem;
}

/* Header & Brand */
.header-bar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	padding: 1rem 1.25rem;
	background: var(--bg-card);
	border: 1px solid var(--border);
	border-radius: var(--radius-lg);
	margin-bottom: 1.5rem;
	box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
}

.brand-wrapper {
	display: flex;
	align-items: center;
	gap: 0.85rem;
}

.brand-icon {
	width: 2.5rem;
	height: 2.5rem;
	background: linear-gradient(135deg, #2f81f7 0%, #a371f7 100%);
	border-radius: var(--radius);
	display: flex;
	align-items: center;
	justify-content: center;
	color: white;
	box-shadow: 0 0 16px rgba(163, 113, 247, 0.4);
}

.brand-title {
	font-size: 1.25rem;
	font-weight: 700;
	letter-spacing: -0.01em;
	margin: 0;
	display: flex;
	align-items: center;
	gap: 0.5rem;
}

.brand-tag {
	font-size: 0.72rem;
	font-weight: 600;
	padding: 0.15rem 0.45rem;
	background: var(--accent-subtle);
	color: var(--accent);
	border-radius: 999px;
	border: 1px solid rgba(47, 129, 247, 0.3);
}

.brand-desc {
	margin: 0;
	font-size: 0.82rem;
	color: var(--fg-muted);
}

/* Hero Readiness Card */
.hero-card {
	background: linear-gradient(180deg, #161b22 0%, #1c2128 100%);
	border: 1px solid var(--border);
	border-radius: var(--radius-lg);
	padding: 1.5rem;
	margin-bottom: 1.5rem;
	position: relative;
	overflow: hidden;
}

.hero-card::before {
	content: "";
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	height: 3px;
	background: linear-gradient(90deg, #2f81f7, #a371f7, #3fb950);
}

.hero-grid {
	display: grid;
	grid-template-columns: 1fr;
	gap: 1.5rem;
}

@media (min-width: 48rem) {
	.hero-grid {
		grid-template-columns: 1.8fr 1fr;
		align-items: center;
	}
}

.hero-title {
	font-size: 1.45rem;
	font-weight: 700;
	margin: 0 0 0.5rem;
	color: #ffffff;
}

.hero-text {
	color: var(--fg-muted);
	font-size: 0.9rem;
	margin: 0 0 1rem;
	line-height: 1.7;
}

/* Score Dial & Progress */
.score-box {
	display: flex;
	align-items: center;
	gap: 1.25rem;
	background: var(--bg-subtle);
	padding: 1.1rem;
	border: 1px solid var(--border-subtle);
	border-radius: var(--radius);
}

.score-number {
	font-size: 2.2rem;
	font-weight: 800;
	color: var(--success-fg);
	font-family: var(--font-mono);
	line-height: 1;
}

.score-label {
	font-size: 0.85rem;
	font-weight: 600;
	color: var(--fg);
	margin-bottom: 0.25rem;
}

.score-sub {
	font-size: 0.75rem;
	color: var(--fg-muted);
}

.progress-bar-bg {
	width: 100%;
	height: 8px;
	background: var(--bg);
	border-radius: 999px;
	overflow: hidden;
	margin-top: 0.5rem;
	border: 1px solid var(--border-subtle);
}

.progress-bar-fill {
	height: 100%;
	background: linear-gradient(90deg, #2f81f7, #3fb950);
	border-radius: 999px;
	transition: width 0.3s ease;
}

/* Phase Navigation Bar */
.nav-tabs {
	display: flex;
	gap: 0.4rem;
	overflow-x: auto;
	padding: 0.35rem;
	background: var(--bg-subtle);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	margin-bottom: 1.5rem;
	scrollbar-width: thin;
}

.nav-tab-btn {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	padding: 0.65rem 1rem;
	background: transparent;
	color: var(--fg-muted);
	border: none;
	border-radius: var(--radius-sm);
	font-family: var(--font);
	font-size: 0.875rem;
	font-weight: 500;
	cursor: pointer;
	white-space: nowrap;
	transition: all 0.15s ease;
}

.nav-tab-btn:hover {
	color: var(--fg);
	background: var(--bg-hover);
}

.nav-tab-btn.active {
	color: #ffffff;
	background: var(--accent);
	font-weight: 600;
	box-shadow: 0 2px 8px rgba(47, 129, 247, 0.35);
}

.tab-badge {
	font-size: 0.72rem;
	padding: 0.1rem 0.4rem;
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.15);
}

/* Standard Button */
.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.45rem;
	padding: 0.5rem 0.95rem;
	border: 1px solid transparent;
	border-radius: var(--radius);
	background: var(--accent);
	color: #fff;
	font-family: var(--font);
	font-size: 0.875rem;
	font-weight: 500;
	cursor: pointer;
	transition: all 0.15s ease;
	line-height: 1.4;
}

.btn:hover {
	filter: brightness(1.1);
	transform: translateY(-1px);
}

.btn:active {
	transform: translateY(0);
}

.btn-secondary {
	background: var(--bg-subtle);
	color: var(--fg);
	border-color: var(--border);
}

.btn-secondary:hover {
	background: var(--bg-hover);
	border-color: var(--fg-muted);
}

.btn-sm {
	padding: 0.35rem 0.65rem;
	font-size: 0.8rem;
	border-radius: var(--radius-sm);
}

.btn-danger {
	background: var(--danger-bg);
	color: var(--danger);
	border-color: rgba(248, 81, 73, 0.3);
}

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

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

/* Cards & Layout */
.card {
	padding: 1.25rem;
	border: 1px solid var(--border);
	border-radius: var(--radius);
	background: var(--bg-card);
}

.card-title-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.75rem;
	margin-bottom: 1rem;
	padding-bottom: 0.75rem;
	border-bottom: 1px solid var(--border-subtle);
}

.card-title {
	font-size: 1.05rem;
	font-weight: 600;
	margin: 0;
	display: flex;
	align-items: center;
	gap: 0.5rem;
}

.grid-2 {
	display: grid;
	grid-template-columns: 1fr;
	gap: 1.25rem;
}

@media (min-width: 52rem) {
	.grid-2 {
		grid-template-columns: 1fr 1fr;
	}
}

.grid-3 {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(min(18rem, 100%), 1fr));
	gap: 1rem;
}

/* Step Wizard Cards */
.step-guide-card {
	background: var(--bg-card);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	padding: 1.25rem;
	position: relative;
	transition: border-color 0.2s;
}

.step-guide-card:hover {
	border-color: var(--accent);
}

.step-num-badge {
	width: 2rem;
	height: 2rem;
	border-radius: 50%;
	background: var(--accent-subtle);
	color: var(--accent);
	display: flex;
	align-items: center;
	justify-content: center;
	font-weight: 700;
	font-size: 0.9rem;
	flex-shrink: 0;
}

/* Task Item */
.task-item {
	display: flex;
	align-items: flex-start;
	gap: 0.85rem;
	padding: 0.85rem 1rem;
	background: var(--bg-subtle);
	border: 1px solid var(--border-subtle);
	border-radius: var(--radius);
	transition: all 0.15s ease;
	margin-bottom: 0.65rem;
}

.task-item:hover {
	background: var(--bg-hover);
	border-color: var(--border);
}

.task-item.is-done {
	opacity: 0.68;
	background: rgba(22, 27, 34, 0.6);
}

.task-checkbox {
	width: 1.25rem;
	height: 1.25rem;
	margin-top: 0.2rem;
	cursor: pointer;
	accent-color: var(--accent);
	flex-shrink: 0;
}

.task-body {
	flex: 1;
}

.task-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.5rem;
	margin-bottom: 0.25rem;
	flex-wrap: wrap;
}

.task-title {
	font-size: 0.92rem;
	font-weight: 600;
	margin: 0;
	color: var(--fg);
}

.task-title.done-text {
	text-decoration: line-through;
	color: var(--fg-muted);
}

.task-desc {
	font-size: 0.82rem;
	color: var(--fg-muted);
	margin: 0 0 0.5rem;
	line-height: 1.5;
}

.task-meta {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	font-size: 0.75rem;
	flex-wrap: wrap;
}

/* Badges */
.badge {
	display: inline-flex;
	align-items: center;
	gap: 0.25rem;
	padding: 0.15rem 0.5rem;
	border-radius: 999px;
	font-size: 0.75rem;
	font-weight: 500;
	border: 1px solid transparent;
}

.badge-high {
	background: var(--danger-bg);
	color: var(--danger);
	border-color: rgba(248, 81, 73, 0.3);
}

.badge-medium {
	background: var(--warning-bg);
	color: var(--warning);
	border-color: rgba(210, 153, 34, 0.3);
}

.badge-low {
	background: var(--accent-subtle);
	color: var(--accent);
	border-color: rgba(47, 129, 247, 0.3);
}

.badge-done {
	background: var(--success-bg);
	color: var(--success-fg);
	border-color: rgba(63, 185, 80, 0.3);
}

.badge-in_progress {
	background: var(--warning-bg);
	color: var(--warning);
	border-color: rgba(210, 153, 34, 0.3);
}

.badge-todo {
	background: var(--bg-card);
	color: var(--fg-muted);
	border-color: var(--border);
}

.badge-purple {
	background: var(--purple-bg);
	color: var(--purple);
	border-color: rgba(163, 113, 247, 0.3);
}

/* Inputs and Forms */
.input, .select, .textarea {
	width: 100%;
	padding: 0.55rem 0.75rem;
	border: 1px solid var(--border);
	border-radius: var(--radius);
	background: var(--bg-subtle);
	color: var(--fg);
	font-family: var(--font);
	font-size: 0.875rem;
	transition: border-color 0.15s;
}

.input:focus, .select:focus, .textarea:focus {
	outline: none;
	border-color: var(--accent);
	box-shadow: 0 0 0 3px var(--accent-glow);
}

.field {
	display: grid;
	gap: 0.35rem;
	margin-bottom: 0.85rem;
}

.field > label {
	font-size: 0.82rem;
	font-weight: 500;
	color: var(--fg-muted);
}

/* Code Display Box */
.code-box {
	background: #090c10;
	border: 1px solid var(--border);
	border-radius: var(--radius);
	overflow: hidden;
	margin: 0.85rem 0;
	position: relative;
}

.code-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 0.45rem 0.85rem;
	background: var(--bg-subtle);
	border-bottom: 1px solid var(--border-subtle);
	font-size: 0.78rem;
	color: var(--fg-muted);
	font-family: var(--font-mono);
	direction: ltr;
}

.code-pre {
	margin: 0;
	padding: 0.85rem;
	overflow-x: auto;
	font-family: var(--font-mono);
	font-size: 0.8125rem;
	line-height: 1.5;
	color: #e6edf3;
	direction: ltr;
	text-align: left;
	scrollbar-width: thin;
}

/* Schema Entity Card */
.entity-card {
	background: var(--bg-subtle);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	padding: 1rem;
	margin-bottom: 1rem;
}

.entity-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.5rem;
	margin-bottom: 0.75rem;
}

.field-pill-list {
	display: flex;
	flex-wrap: wrap;
	gap: 0.4rem;
	margin: 0.5rem 0;
}

.field-pill {
	display: inline-flex;
	align-items: center;
	gap: 0.3rem;
	padding: 0.2rem 0.55rem;
	background: var(--bg-card);
	border: 1px solid var(--border-subtle);
	border-radius: var(--radius-sm);
	font-family: var(--font-mono);
	font-size: 0.75rem;
	color: var(--fg);
	direction: ltr;
}

/* API Endpoint Item */
.endpoint-item {
	background: var(--bg-subtle);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	padding: 1rem;
	margin-bottom: 0.85rem;
}

.method-tag {
	display: inline-block;
	padding: 0.2rem 0.55rem;
	border-radius: var(--radius-sm);
	font-family: var(--font-mono);
	font-size: 0.75rem;
	font-weight: 700;
	text-transform: uppercase;
	direction: ltr;
}

.method-get { background: rgba(47, 129, 247, 0.2); color: #58a6ff; border: 1px solid rgba(47, 129, 247, 0.4); }
.method-post { background: rgba(63, 185, 80, 0.2); color: #3fb950; border: 1px solid rgba(63, 185, 80, 0.4); }
.method-put { background: rgba(210, 153, 34, 0.2); color: #d29922; border: 1px solid rgba(210, 153, 34, 0.4); }
.method-delete { background: rgba(248, 81, 73, 0.2); color: #f85149; border: 1px solid rgba(248, 81, 73, 0.4); }

/* Modal Backdrop */
.modal-overlay {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: rgba(0, 0, 0, 0.75);
	backdrop-filter: blur(4px);
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 1rem;
	z-index: 1000;
}

.modal-card {
	background: var(--bg-card);
	border: 1px solid var(--border);
	border-radius: var(--radius-lg);
	padding: 1.5rem;
	width: 100%;
	max-width: 34rem;
	max-height: 90vh;
	overflow-y: auto;
	box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6);
}

/* Utilities */
.stack { display: grid; gap: 1rem; }
.row { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.space-between { justify-content: space-between; }
.text-muted { color: var(--fg-muted); }
.text-success { color: var(--success-fg); }
.font-mono { font-family: var(--font-mono); direction: ltr; }

/* Alert strip */
.alert {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.75rem;
	padding: 0.75rem 1rem;
	border: 1px solid var(--border);
	border-radius: var(--radius);
	background: var(--bg-subtle);
	margin-bottom: 1rem;
}

.alert-error {
	border-color: rgba(248, 81, 73, 0.4);
	background: var(--danger-bg);
	color: var(--danger);
}

.alert-success {
	border-color: rgba(63, 185, 80, 0.4);
	background: var(--success-bg);
	color: var(--success-fg);
}

/* Loading & Empty */
.loading {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 0.6rem;
	padding: 2.5rem;
	color: var(--fg-muted);
}

.spinner {
	width: 1.25rem;
	height: 1.25rem;
	border: 2px solid var(--border);
	border-top-color: var(--accent);
	border-radius: 50%;
	animation: spin 0.7s linear infinite;
}

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

.empty-state {
	padding: 2.5rem 1.5rem;
	text-align: center;
	color: var(--fg-muted);
}
