:root {
	--font-ar: "Tajawal", "Cairo", system-ui, -apple-system, sans-serif;
	--font-en: "Outfit", system-ui, -apple-system, sans-serif;
	--font-main: var(--font-ar);

	/* Palette - Default: Academic Emerald / Indigo */
	--bg-app: #0d1117;
	--bg-panel: #161b22;
	--bg-card: rgba(22, 27, 34, 0.85);
	--border-subtle: rgba(255, 255, 255, 0.1);
	--border-focus: #38bdf8;
	--text-primary: #f0f6fc;
	--text-secondary: #8b949e;
	--text-muted: #6e7681;
	
	/* A4 Dimensions (Standard 210mm x 297mm at 96-120 DPI screen scaling) */
	--a4-portrait-w: 794px;
	--a4-portrait-h: 1123px;
	--a4-landscape-w: 1123px;
	--a4-landscape-h: 794px;

	--radius-sm: 6px;
	--radius-md: 12px;
	--radius-lg: 18px;
	--radius-full: 9999px;

	--shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.25);
	--shadow-md: 0 8px 24px rgba(0, 0, 0, 0.35);
	--shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.5);
	--shadow-glow: 0 0 25px rgba(56, 189, 248, 0.25);
}

[dir="ltr"] {
	--font-main: var(--font-en);
}

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

body {
	background-color: var(--bg-app);
	color: var(--text-primary);
	font-family: var(--font-main);
	min-height: 100vh;
	line-height: 1.5;
	-webkit-font-smoothing: antialiased;
	overflow-x: hidden;
}

/* Base scrollbar */
::-webkit-scrollbar {
	width: 7px;
	height: 7px;
}
::-webkit-scrollbar-track {
	background: rgba(0, 0, 0, 0.2);
}
::-webkit-scrollbar-thumb {
	background: rgba(255, 255, 255, 0.2);
	border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
	background: rgba(255, 255, 255, 0.35);
}

/* Background Ambient Lighting */
.bg-ambient {
	position: fixed;
	inset: 0;
	pointer-events: none;
	z-index: 0;
	background: 
		radial-gradient(circle at 15% 15%, rgba(56, 189, 248, 0.08) 0%, transparent 40%),
		radial-gradient(circle at 85% 20%, rgba(168, 85, 247, 0.09) 0%, transparent 40%),
		radial-gradient(circle at 50% 85%, rgba(16, 185, 129, 0.07) 0%, transparent 50%);
}

.app-wrapper {
	position: relative;
	z-index: 1;
	min-height: 100vh;
	display: flex;
	flex-direction: column;
}

/* Top Navbar */
.top-nav {
	height: 64px;
	background: rgba(13, 17, 23, 0.85);
	backdrop-filter: blur(14px);
	border-bottom: 1px solid var(--border-subtle);
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 0 1.5rem;
	position: sticky;
	top: 0;
	z-index: 100;
}

.nav-brand {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	cursor: pointer;
	text-decoration: none;
}

.brand-icon {
	width: 38px;
	height: 38px;
	border-radius: 10px;
	background: linear-gradient(135deg, #38bdf8 0%, #6366f1 50%, #ec4899 100%);
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 4px 15px rgba(99, 102, 241, 0.35);
	color: #fff;
	font-weight: 900;
	font-size: 1.15rem;
}

.brand-title-group h1 {
	font-size: 1.15rem;
	font-weight: 800;
	color: #ffffff;
	letter-spacing: -0.01em;
	display: flex;
	align-items: center;
	gap: 0.4rem;
}

.brand-badge {
	font-size: 0.65rem;
	font-weight: 700;
	background: linear-gradient(135deg, #10b981, #06b6d4);
	color: #042f2e;
	padding: 2px 6px;
	border-radius: 999px;
	text-transform: uppercase;
}

.brand-sub {
	font-size: 0.75rem;
	color: var(--text-secondary);
}

.nav-actions {
	display: flex;
	align-items: center;
	gap: 0.65rem;
}

.nav-pill {
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
	padding: 0.4rem 0.75rem;
	border-radius: var(--radius-full);
	background: rgba(255, 255, 255, 0.05);
	border: 1px solid var(--border-subtle);
	color: var(--text-primary);
	font-size: 0.825rem;
	font-family: inherit;
	cursor: pointer;
	transition: all 0.18s ease;
}
.nav-pill:hover {
	background: rgba(255, 255, 255, 0.1);
	border-color: rgba(255, 255, 255, 0.2);
}

.nav-pill.active {
	background: rgba(56, 189, 248, 0.15);
	border-color: #38bdf8;
	color: #38bdf8;
	font-weight: 600;
}

/* Primary buttons */
.btn-primary {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	background: linear-gradient(135deg, #2563eb, #7c3aed);
	color: white;
	padding: 0.55rem 1.15rem;
	border-radius: var(--radius-md);
	border: none;
	font-size: 0.9rem;
	font-weight: 700;
	font-family: inherit;
	cursor: pointer;
	box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
	transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.btn-primary:hover:not(:disabled) {
	transform: translateY(-1px);
	box-shadow: 0 6px 20px rgba(37, 99, 235, 0.5);
	filter: brightness(1.1);
}
.btn-primary:active:not(:disabled) {
	transform: translateY(0);
}
.btn-primary:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

.btn-secondary {
	display: inline-flex;
	align-items: center;
	gap: 0.45rem;
	background: rgba(255, 255, 255, 0.07);
	color: var(--text-primary);
	padding: 0.5rem 0.95rem;
	border-radius: var(--radius-md);
	border: 1px solid var(--border-subtle);
	font-size: 0.85rem;
	font-weight: 600;
	font-family: inherit;
	cursor: pointer;
	transition: all 0.18s ease;
}
.btn-secondary:hover {
	background: rgba(255, 255, 255, 0.12);
	border-color: rgba(255, 255, 255, 0.25);
}

.btn-accent {
	background: linear-gradient(135deg, #10b981, #059669);
	color: white;
	box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35);
}
.btn-accent:hover:not(:disabled) {
	box-shadow: 0 6px 20px rgba(16, 185, 129, 0.5);
}

/* Layout container */
.main-layout {
	flex: 1;
	display: flex;
	flex-direction: column;
	max-width: 1600px;
	width: 100%;
	margin: 0 auto;
	padding: 1.25rem 1.5rem 3rem;
}

/* Hero & Input Section (when in upload/edit mode) */
.input-hero-card {
	background: linear-gradient(145deg, rgba(30, 41, 59, 0.7), rgba(15, 23, 42, 0.85));
	border: 1px solid var(--border-subtle);
	border-radius: var(--radius-lg);
	padding: 1.75rem;
	box-shadow: var(--shadow-md);
	backdrop-filter: blur(12px);
	margin-bottom: 1.5rem;
	position: relative;
	overflow: hidden;
}

.input-hero-card::before {
	content: "";
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	height: 3px;
	background: linear-gradient(90deg, #38bdf8, #818cf8, #ec4899, #10b981);
}

.hero-header {
	display: flex;
	justify-content: space-between;
	align-items: flex-start;
	flex-wrap: wrap;
	gap: 1rem;
	margin-bottom: 1.5rem;
}

.hero-title-area h2 {
	font-size: 1.45rem;
	font-weight: 800;
	color: #fff;
	margin-bottom: 0.35rem;
	display: flex;
	align-items: center;
	gap: 0.5rem;
}

.hero-title-area p {
	color: var(--text-secondary);
	font-size: 0.92rem;
	max-width: 700px;
}

/* Upload zone & tabs */
.upload-grid {
	display: grid;
	grid-template-columns: 1.15fr 1fr;
	gap: 1.5rem;
}

@media (max-width: 950px) {
	.upload-grid {
		grid-template-columns: 1fr;
	}
}

.dropzone {
	border: 2px dashed rgba(56, 189, 248, 0.4);
	border-radius: var(--radius-md);
	background: rgba(56, 189, 248, 0.03);
	padding: 1.75rem 1.25rem;
	text-align: center;
	cursor: pointer;
	transition: all 0.25s ease;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	position: relative;
	min-height: 220px;
}

.dropzone:hover,
.dropzone.drag-active {
	border-color: #38bdf8;
	background: rgba(56, 189, 248, 0.08);
	transform: scale(1.005);
}

.drop-icon-wrapper {
	width: 58px;
	height: 58px;
	border-radius: var(--radius-full);
	background: rgba(56, 189, 248, 0.15);
	color: #38bdf8;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 1.6rem;
	margin-bottom: 0.85rem;
	box-shadow: var(--shadow-glow);
}

.drop-primary-txt {
	font-weight: 700;
	font-size: 1rem;
	color: #fff;
	margin-bottom: 0.35rem;
}

.drop-sub-txt {
	font-size: 0.8rem;
	color: var(--text-secondary);
}

.file-loaded-banner {
	background: rgba(16, 185, 129, 0.12);
	border: 1px solid rgba(16, 185, 129, 0.3);
	border-radius: var(--radius-md);
	padding: 0.75rem 1rem;
	display: flex;
	align-items: center;
	justify-content: space-between;
	width: 100%;
	margin-top: 0.75rem;
}

.file-info {
	display: flex;
	align-items: center;
	gap: 0.6rem;
}

.file-icon {
	color: #10b981;
	font-size: 1.25rem;
}

.file-name {
	font-weight: 700;
	font-size: 0.88rem;
	color: #fff;
}

.file-size {
	font-size: 0.75rem;
	color: var(--text-secondary);
}

/* Sample preloaded files */
.samples-wrapper {
	background: rgba(15, 23, 42, 0.6);
	border: 1px solid var(--border-subtle);
	border-radius: var(--radius-md);
	padding: 1rem;
	display: flex;
	flex-direction: column;
	gap: 0.65rem;
}

.samples-title {
	font-size: 0.825rem;
	font-weight: 700;
	color: var(--text-secondary);
	text-transform: uppercase;
	letter-spacing: 0.05em;
	display: flex;
	align-items: center;
	gap: 0.35rem;
}

.sample-chip {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 0.55rem 0.85rem;
	background: rgba(255, 255, 255, 0.04);
	border: 1px solid rgba(255, 255, 255, 0.07);
	border-radius: var(--radius-sm);
	cursor: pointer;
	transition: all 0.15s ease;
	text-align: inherit;
}

.sample-chip:hover {
	background: rgba(56, 189, 248, 0.1);
	border-color: rgba(56, 189, 248, 0.3);
	transform: translateX(-2px);
}
[dir="ltr"] .sample-chip:hover {
	transform: translateX(2px);
}

.sample-name {
	font-size: 0.85rem;
	font-weight: 600;
	color: var(--text-primary);
	display: flex;
	align-items: center;
	gap: 0.45rem;
}

.sample-tag {
	font-size: 0.7rem;
	padding: 2px 6px;
	border-radius: 4px;
	background: rgba(255, 255, 255, 0.08);
	color: var(--text-secondary);
}

/* Generation Configuration Bar */
.config-bar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 1rem;
	margin-top: 1.25rem;
	padding-top: 1.25rem;
	border-top: 1px solid var(--border-subtle);
}

.config-group {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	flex-wrap: wrap;
}

.config-label {
	font-size: 0.825rem;
	font-weight: 700;
	color: var(--text-secondary);
}

.select-styled {
	background: rgba(15, 23, 42, 0.9);
	border: 1px solid var(--border-subtle);
	color: #fff;
	padding: 0.45rem 0.85rem;
	border-radius: var(--radius-sm);
	font-family: inherit;
	font-size: 0.85rem;
	cursor: pointer;
	outline: none;
}
.select-styled:focus {
	border-color: #38bdf8;
}

/* Loading / AI Thinking state */
.ai-processing-card {
	background: linear-gradient(135deg, rgba(30, 58, 138, 0.4), rgba(88, 28, 135, 0.4));
	border: 1px solid rgba(129, 140, 248, 0.4);
	border-radius: var(--radius-lg);
	padding: 2.5rem;
	text-align: center;
	box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
	margin: 2rem auto;
	max-width: 650px;
}

.spinner-pulse {
	width: 60px;
	height: 60px;
	margin: 0 auto 1.5rem;
	position: relative;
}
.spinner-pulse::before,
.spinner-pulse::after {
	content: "";
	position: absolute;
	inset: 0;
	border-radius: 50%;
	border: 3px solid #38bdf8;
	animation: pulseRing 1.8s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;
}
.spinner-pulse::after {
	animation-delay: 0.6s;
	border-color: #ec4899;
}

@keyframes pulseRing {
	0% { transform: scale(0.6); opacity: 1; }
	100% { transform: scale(1.6); opacity: 0; }
}

.processing-title {
	font-size: 1.25rem;
	font-weight: 800;
	margin-bottom: 0.5rem;
	color: #fff;
}
.processing-step {
	font-size: 0.875rem;
	color: #93c5fd;
	margin-bottom: 1.25rem;
}

.progress-bar-track {
	height: 6px;
	background: rgba(255, 255, 255, 0.1);
	border-radius: 99px;
	overflow: hidden;
	margin: 0 auto;
	max-width: 320px;
}
.progress-bar-fill {
	height: 100%;
	background: linear-gradient(90deg, #38bdf8, #818cf8, #ec4899);
	width: 40%;
	animation: progressIndeterminate 1.6s infinite ease-in-out;
}
@keyframes progressIndeterminate {
	0% { transform: translateX(-100%); width: 30%; }
	50% { transform: translateX(50%); width: 60%; }
	100% { transform: translateX(250%); width: 30%; }
}

/* =========================================================================
   A4 CANVAS & WORKSPACE AREA
   ========================================================================= */
.workspace-controls-bar {
	background: rgba(22, 27, 34, 0.95);
	backdrop-filter: blur(10px);
	border: 1px solid var(--border-subtle);
	border-radius: var(--radius-md);
	padding: 0.65rem 1rem;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	margin-bottom: 1.25rem;
	position: sticky;
	top: 72px;
	z-index: 50;
	box-shadow: var(--shadow-sm);
}

.controls-left,
.controls-right {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	flex-wrap: wrap;
}

.a4-viewport-container {
	display: flex;
	justify-content: center;
	align-items: flex-start;
	padding: 1.5rem 0.5rem 3rem;
	overflow-x: auto;
	min-height: 800px;
}

/* Theme Palettes applied to A4 Sheet */
.a4-sheet {
	background: #ffffff;
	color: #0f172a;
	box-shadow: 0 25px 60px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(0, 0, 0, 0.1);
	position: relative;
	transition: transform 0.2s ease, width 0.3s ease, height 0.3s ease;
	transform-origin: top center;
	overflow: hidden;
	display: flex;
	flex-direction: column;
	padding: 22px 24px 18px;
	box-sizing: border-box;
}

.a4-sheet.portrait {
	width: var(--a4-portrait-w);
	min-height: var(--a4-portrait-h);
	height: var(--a4-portrait-h);
}

.a4-sheet.landscape {
	width: var(--a4-landscape-w);
	min-height: var(--a4-landscape-h);
	height: var(--a4-landscape-h);
}

/* Sheet Theme Variables */
/* 1. Academic Royal (Default) */
.theme-academic-emerald {
	--paper-bg: #f8fafc;
	--sheet-border: #cbd5e1;
	--primary-accent: #0f766e;
	--primary-glow: rgba(15, 118, 110, 0.12);
	--hub-bg: linear-gradient(135deg, #0f766e 0%, #115e59 100%);
	--hub-text: #ffffff;
	--branch-1: #0284c7; /* Cyan/Blue */
	--branch-2: #7c3aed; /* Purple */
	--branch-3: #d97706; /* Amber */
	--branch-4: #059669; /* Emerald */
	--branch-5: #e11d48; /* Rose */
	--branch-6: #4f46e5; /* Indigo */
}

/* 2. Cyber Neon Modern */
.theme-cyber-neon {
	--paper-bg: #0f172a;
	--sheet-border: #334155;
	--primary-accent: #38bdf8;
	--primary-glow: rgba(56, 189, 248, 0.2);
	--hub-bg: linear-gradient(135deg, #1e1b4b 0%, #312e81 100%);
	--hub-text: #38bdf8;
	--branch-1: #38bdf8;
	--branch-2: #c084fc;
	--branch-3: #fbbf24;
	--branch-4: #34d399;
	--branch-5: #f43f5e;
	--branch-6: #818cf8;
}

/* 3. Clinical Medical */
.theme-medical-coral {
	--paper-bg: #fffbf9;
	--sheet-border: #fed7aa;
	--primary-accent: #e11d48;
	--primary-glow: rgba(225, 29, 72, 0.12);
	--hub-bg: linear-gradient(135deg, #be123c 0%, #881337 100%);
	--hub-text: #ffffff;
	--branch-1: #0284c7;
	--branch-2: #e11d48;
	--branch-3: #0d9488;
	--branch-4: #d97706;
	--branch-5: #7c3aed;
	--branch-6: #475569;
}

/* 4. Engineering Amber & Slate */
.theme-engineering-amber {
	--paper-bg: #fafaf9;
	--sheet-border: #e7e5e4;
	--primary-accent: #d97706;
	--primary-glow: rgba(217, 119, 6, 0.15);
	--hub-bg: linear-gradient(135deg, #1c1917 0%, #292524 100%);
	--hub-text: #fbbf24;
	--branch-1: #2563eb;
	--branch-2: #d97706;
	--branch-3: #059669;
	--branch-4: #dc2626;
	--branch-5: #6366f1;
	--branch-6: #0891b2;
}

/* 5. Minimalist Paper Mono */
.theme-minimalist-mono {
	--paper-bg: #ffffff;
	--sheet-border: #e2e8f0;
	--primary-accent: #0f172a;
	--primary-glow: rgba(15, 23, 42, 0.08);
	--hub-bg: #0f172a;
	--hub-text: #ffffff;
	--branch-1: #1e293b;
	--branch-2: #334155;
	--branch-3: #475569;
	--branch-4: #64748b;
	--branch-5: #0f172a;
	--branch-6: #334155;
}

.a4-sheet {
	background-color: var(--paper-bg);
}

/* Header inside A4 Sheet */
.sheet-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	border-bottom: 2px solid rgba(0, 0, 0, 0.08);
	padding-bottom: 8px;
	margin-bottom: 12px;
}

.theme-cyber-neon .sheet-header {
	border-bottom-color: rgba(255, 255, 255, 0.1);
}

.sheet-meta-left {
	display: flex;
	align-items: center;
	gap: 8px;
}

.academic-badge {
	font-size: 0.68rem;
	font-weight: 800;
	padding: 2px 8px;
	border-radius: 4px;
	background: var(--primary-accent);
	color: #fff;
	text-transform: uppercase;
	letter-spacing: 0.03em;
}

.sheet-tagline {
	font-size: 0.72rem;
	color: #64748b;
	font-weight: 600;
}

.sheet-meta-right {
	display: flex;
	align-items: center;
	gap: 12px;
	font-size: 0.7rem;
	color: #64748b;
	font-weight: 500;
}

/* =========================================================================
   MIND MAP LAYOUT & VISUAL BRANCHES
   ========================================================================= */

/* Central Hub Anchor */
.mindmap-core {
	display: flex;
	flex-direction: column;
	height: 100%;
	position: relative;
}

.central-hub {
	background: var(--hub-bg);
	color: var(--hub-text);
	border-radius: 16px;
	padding: 10px 18px;
	text-align: center;
	box-shadow: 0 6px 18px rgba(0, 0, 0, 0.2);
	position: relative;
	z-index: 10;
	margin: 0 auto 12px;
	max-width: 82%;
	border: 2px solid rgba(255, 255, 255, 0.25);
	cursor: pointer;
	transition: transform 0.2s ease;
}

.central-hub:hover {
	transform: scale(1.015);
}

.hub-eyebrow {
	font-size: 0.68rem;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	opacity: 0.85;
	margin-bottom: 2px;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 4px;
}

.hub-title {
	font-size: 1.18rem;
	font-weight: 900;
	line-height: 1.25;
	margin-bottom: 2px;
}

.hub-summary {
	font-size: 0.75rem;
	opacity: 0.9;
	font-weight: 500;
	max-width: 580px;
	margin: 0 auto;
}

/* SVG Connectors Layer */
.connectors-svg {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	pointer-events: none;
	z-index: 2;
}

.branch-connector-line {
	fill: none;
	stroke-linecap: round;
	stroke-dasharray: 4 2;
	animation: dashFlow 20s linear infinite;
}

@keyframes dashFlow {
	to {
		stroke-dashoffset: -200;
	}
}

/* Branches Grid (2 Columns / 3 Columns auto-arranged) */
.branches-grid {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 10px;
	flex: 1;
	z-index: 5;
	position: relative;
	align-content: stretch;
}

.a4-sheet.landscape .branches-grid {
	grid-template-columns: repeat(3, 1fr);
	gap: 10px;
}

/* Individual Branch Card */
.branch-card {
	background: #ffffff;
	border-radius: 12px;
	border: 1.5px solid #e2e8f0;
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
	display: flex;
	flex-direction: column;
	padding: 9px 11px;
	position: relative;
	transition: all 0.2s ease;
	overflow: hidden;
}

.theme-cyber-neon .branch-card {
	background: #1e293b;
	border-color: #334155;
	color: #f1f5f9;
}

.branch-card::before {
	content: "";
	position: absolute;
	top: 0;
	right: 0;
	bottom: 0;
	width: 4px;
	background: var(--branch-accent, #3b82f6);
}
[dir="ltr"] .branch-card::before {
	right: auto;
	left: 0;
}

.branch-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 6px;
	margin-bottom: 7px;
	padding-bottom: 5px;
	border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}
.theme-cyber-neon .branch-header {
	border-bottom-color: rgba(255, 255, 255, 0.08);
}

.branch-title-group {
	display: flex;
	align-items: center;
	gap: 6px;
	flex: 1;
	min-width: 0;
}

.branch-badge-icon {
	width: 22px;
	height: 22px;
	border-radius: 6px;
	background: var(--branch-accent, #3b82f6);
	color: #fff;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 0.75rem;
	font-weight: 800;
	flex-shrink: 0;
}

.branch-title {
	font-size: 0.88rem;
	font-weight: 800;
	color: var(--branch-accent, #1e293b);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.theme-cyber-neon .branch-title {
	color: #fff;
}

.branch-number {
	font-size: 0.65rem;
	font-weight: 800;
	color: #94a3b8;
	padding: 1px 5px;
	background: rgba(0, 0, 0, 0.04);
	border-radius: 4px;
}

/* Branch Content Elements / Semantic Modules */
.branch-content {
	display: flex;
	flex-direction: column;
	gap: 6px;
	flex: 1;
	justify-content: space-between;
}

/* 1. Definition Box */
.node-definition {
	background: rgba(59, 130, 246, 0.06);
	border: 1px dashed var(--branch-accent, #3b82f6);
	border-radius: 6px;
	padding: 5px 8px;
	font-size: 0.74rem;
	line-height: 1.35;
	color: #1e293b;
}
.theme-cyber-neon .node-definition {
	background: rgba(56, 189, 248, 0.08);
	color: #e2e8f0;
}
.node-definition strong {
	color: var(--branch-accent, #1e40af);
}
.theme-cyber-neon .node-definition strong {
	color: #38bdf8;
}

/* 2. Key Points / Bullet Items */
.node-bullets {
	list-style: none;
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.bullet-item {
	display: flex;
	align-items: flex-start;
	gap: 5px;
	font-size: 0.72rem;
	line-height: 1.3;
	color: #334155;
}
.theme-cyber-neon .bullet-item {
	color: #cbd5e1;
}

.bullet-dot {
	width: 5px;
	height: 5px;
	border-radius: 50%;
	background: var(--branch-accent, #3b82f6);
	margin-top: 5px;
	flex-shrink: 0;
}

/* 3. Steps / Process Flow */
.node-steps {
	display: flex;
	flex-direction: column;
	gap: 3px;
	background: rgba(0, 0, 0, 0.02);
	border-radius: 6px;
	padding: 4px 6px;
}

.step-row {
	display: flex;
	align-items: center;
	gap: 6px;
	font-size: 0.71rem;
}

.step-num {
	width: 16px;
	height: 16px;
	border-radius: 50%;
	background: var(--branch-accent, #3b82f6);
	color: #fff;
	font-size: 0.62rem;
	font-weight: 800;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
}

.step-text {
	flex: 1;
	line-height: 1.25;
	color: #334155;
}
.theme-cyber-neon .step-text {
	color: #cbd5e1;
}

/* 4. Comparison Table / Cards */
.node-comparison {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 4px;
	font-size: 0.68rem;
}

.comp-box {
	background: rgba(0, 0, 0, 0.03);
	border-radius: 5px;
	padding: 4px;
	text-align: center;
}
.theme-cyber-neon .comp-box {
	background: rgba(255, 255, 255, 0.05);
}

.comp-label {
	font-weight: 800;
	font-size: 0.66rem;
	color: var(--branch-accent, #2563eb);
	margin-bottom: 2px;
}

.comp-desc {
	line-height: 1.2;
	color: #475569;
}
.theme-cyber-neon .comp-desc {
	color: #94a3b8;
}

/* 5. Warning / Critical Exam Tip */
.node-warning {
	background: #fff1f2;
	border-inline-start: 3px solid #f43f5e;
	border-radius: 4px;
	padding: 4px 7px;
	font-size: 0.7rem;
	line-height: 1.3;
	color: #9f1239;
	display: flex;
	align-items: flex-start;
	gap: 5px;
}
.theme-cyber-neon .node-warning {
	background: rgba(244, 63, 94, 0.15);
	color: #fda4af;
}

/* 6. Example Pill */
.node-example {
	background: #f0fdf4;
	border: 1px solid #bbf7d0;
	border-radius: 4px;
	padding: 3px 6px;
	font-size: 0.69rem;
	color: #166534;
	display: flex;
	align-items: center;
	gap: 4px;
}
.theme-cyber-neon .node-example {
	background: rgba(34, 197, 94, 0.12);
	border-color: rgba(34, 197, 94, 0.25);
	color: #86efac;
}

/* 7. Formula / Metric Highlight */
.node-formula {
	background: #f8fafc;
	border: 1px solid #e2e8f0;
	border-radius: 5px;
	padding: 3px 7px;
	font-size: 0.72rem;
	font-family: monospace;
	font-weight: 700;
	color: #0f172a;
	text-align: center;
}
.theme-cyber-neon .node-formula {
	background: #090d16;
	border-color: #334155;
	color: #38bdf8;
}

/* Sheet Footer */
.sheet-footer {
	margin-top: 10px;
	padding-top: 6px;
	border-top: 1px solid rgba(0, 0, 0, 0.08);
	display: flex;
	align-items: center;
	justify-content: space-between;
	font-size: 0.67rem;
	color: #94a3b8;
	font-weight: 600;
}
.theme-cyber-neon .sheet-footer {
	border-top-color: rgba(255, 255, 255, 0.08);
}

.sheet-footer-qr {
	display: flex;
	align-items: center;
	gap: 4px;
	font-weight: 700;
	color: var(--primary-accent);
}

/* =========================================================================
   IN-PLACE EDITING OVERLAYS & MODALS
   ========================================================================= */
.editable-active {
	outline: 2px dashed #38bdf8 !important;
	outline-offset: 2px;
	background: rgba(56, 189, 248, 0.08) !important;
	border-radius: 4px;
	cursor: text;
}

.edit-modal-backdrop {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.75);
	backdrop-filter: blur(8px);
	z-index: 200;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 1.5rem;
}

.edit-modal-card {
	background: #161b22;
	border: 1px solid var(--border-subtle);
	border-radius: var(--radius-lg);
	width: 100%;
	max-width: 680px;
	max-height: 90vh;
	overflow-y: auto;
	padding: 1.5rem;
	box-shadow: var(--shadow-lg);
	display: flex;
	flex-direction: column;
	gap: 1.2rem;
}

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

.modal-title {
	font-size: 1.15rem;
	font-weight: 800;
	color: #fff;
	display: flex;
	align-items: center;
	gap: 0.5rem;
}

.modal-close {
	background: transparent;
	border: none;
	color: var(--text-secondary);
	font-size: 1.25rem;
	cursor: pointer;
	padding: 4px;
}
.modal-close:hover {
	color: #fff;
}

.form-group {
	display: flex;
	flex-direction: column;
	gap: 0.4rem;
}

.form-group label {
	font-size: 0.825rem;
	font-weight: 700;
	color: var(--text-secondary);
}

.form-input,
.form-textarea {
	background: #0d1117;
	border: 1px solid var(--border-subtle);
	border-radius: var(--radius-sm);
	color: #fff;
	padding: 0.6rem 0.8rem;
	font-family: inherit;
	font-size: 0.88rem;
	outline: none;
	transition: border-color 0.15s ease;
}
.form-input:focus,
.form-textarea:focus {
	border-color: #38bdf8;
}

.color-picker-row {
	display: flex;
	gap: 0.5rem;
	flex-wrap: wrap;
}

.color-circle {
	width: 28px;
	height: 28px;
	border-radius: 50%;
	cursor: pointer;
	border: 2px solid transparent;
	transition: transform 0.15s ease;
}
.color-circle:hover {
	transform: scale(1.15);
}
.color-circle.selected {
	border-color: #fff;
	transform: scale(1.15);
}

/* =========================================================================
   PRINT MEDIA RULES (TRUE A4 VECTOR EXPORT)
   ========================================================================= */
@page {
	size: A4 portrait;
	margin: 0;
}

@media print {
	html, body {
		background: #ffffff !important;
		color: #000000 !important;
		margin: 0 !important;
		padding: 0 !important;
		-webkit-print-color-adjust: exact !important;
		print-color-adjust: exact !important;
	}

	.top-nav,
	.input-hero-card,
	.workspace-controls-bar,
	.bg-ambient,
	.edit-modal-backdrop,
	.non-printable {
		display: none !important;
	}

	.app-wrapper,
	.main-layout,
	.a4-viewport-container {
		padding: 0 !important;
		margin: 0 !important;
		min-height: auto !important;
		display: block !important;
		width: 100% !important;
	}

	.a4-sheet {
		box-shadow: none !important;
		border: none !important;
		margin: 0 auto !important;
		page-break-after: avoid;
		page-break-inside: avoid;
		transform: none !important;
		width: 100% !important;
		height: 100vh !important;
		max-height: 100vh !important;
		padding: 15mm 15mm 10mm !important;
	}
}
