/* ═══════════════════════════════════════════════════════════════════════════
   OERP Enterprise Database Reference & Architecture Diagram
   Light Theme - Microsoft Fluent & Enterprise SaaS Design System
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
	color-scheme: light;
	--bg: #f8fafc;
	--bg-subtle: #f1f5f9;
	--panel: #ffffff;
	--panel-hover: #f8fafc;
	--line: #e2e8f0;
	--line-subtle: #f1f5f9;
	--line-dark: #cbd5e1;
	--text: #0f172a;
	--text-secondary: #334155;
	--muted: #64748b;
	--muted-light: #94a3b8;
	
	/* Brand & Accents */
	--accent: #0f6cbd;         /* Fluent Blue */
	--accent-dark: #0b5cab;    /* Fluent Blue Hover */
	--accent-light: #eff6ff;   /* Soft Blue Canvas */
	--accent-subtle: #dbeafe;  /* Soft Blue Border */
	
	/* Semantic Colors */
	--warning: #d97706;
	--warning-bg: #fffbeb;
	--warning-border: #fde68a;
	--success: #059669;
	--success-bg: #ecfdf5;
	--success-border: #a7f3d0;
	--danger: #dc2626;
	--danger-bg: #fef2f2;
	--danger-border: #fecaca;
	--info: #0284c7;
	--info-bg: #f0f9ff;
	
	/* Shadows */
	--shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.04);
	--shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.06), 0 1px 2px -1px rgba(0, 0, 0, 0.04);
	--shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
	--shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
	--shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
}

* {
	box-sizing: border-box;
}

[hidden] {
	display: none !important;
}

body {
	margin: 0;
	background: var(--bg);
	color: var(--text);
	font: 14px/1.5 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Inter', Roboto, sans-serif;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}

a {
	color: var(--accent);
	text-decoration: none;
	transition: color 0.12s ease;
}

a:hover {
	color: var(--accent-dark);
	text-decoration: underline;
}

/* ─── Top Navigation Header ───────────────────────────────────────────── */
.site-header {
	position: sticky;
	top: 0;
	z-index: 100;
	min-height: 64px;
	display: flex;
	gap: 20px;
	align-items: center;
	padding: 10px max(24px, calc((100% - 1440px) / 2));
	border-bottom: 1px solid var(--line);
	background: #ffffff;
	box-shadow: var(--shadow-xs);
}

::selection {
	background: #c7e0f4;
	color: #0f172a;
}

svg {
	pointer-events: none;
	user-select: none;
}

button,
.tab,
.filter-chip,
.page-btn,
.btn,
.brand,
.brand-icon,
.search-icon,
.search-kbd,
th {
	user-select: none;
}

.brand {
	display: flex;
	align-items: center;
	gap: 12px;
	color: var(--text);
	text-decoration: none;
	white-space: nowrap;
}

.brand:hover {
	text-decoration: none;
}

.brand-icon {
	width: 32px;
	height: 32px;
	border-radius: 8px;
	background: linear-gradient(135deg, #0f6cbd 0%, #0284c7 100%);
	display: flex;
	align-items: center;
	justify-content: center;
	color: #ffffff;
	box-shadow: 0 2px 6px rgba(15, 108, 189, 0.3);
}

.brand-text {
	display: flex;
	flex-direction: column;
	line-height: 1.2;
}

.brand-title {
	font-size: 16px;
	font-weight: 800;
	letter-spacing: -0.2px;
	color: #0f172a;
}

.brand-sub {
	font-size: 11px;
	font-weight: 600;
	color: var(--accent);
	letter-spacing: 0.3px;
	text-transform: uppercase;
}

/* Search bar */
.search {
	display: flex;
	align-items: center;
	gap: 10px;
	width: min(560px, 100%);
	padding: 7px 14px;
	border: 1px solid var(--line-dark);
	border-radius: 8px;
	background: #ffffff;
	color: var(--muted);
	transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
	box-shadow: var(--shadow-xs);
}

.search:focus-within {
	border-color: var(--accent);
	background: #ffffff;
	box-shadow: 0 0 0 3px rgba(15, 108, 189, 0.12);
}

.search-icon {
	color: var(--muted);
	display: flex;
	align-items: center;
	flex-shrink: 0;
}

.search input {
	width: 100%;
	border: 0;
	outline: 0;
	background: transparent;
	color: var(--text);
	font: inherit;
	font-size: 13.5px;
}

.search input::placeholder {
	color: var(--muted-light);
}

.search-kbd {
	font-size: 11px;
	font-family: inherit;
	font-weight: 600;
	background: var(--bg-subtle);
	color: var(--muted);
	border: 1px solid var(--line);
	border-radius: 5px;
	padding: 2px 6px;
	flex-shrink: 0;
	box-shadow: 0 1px 1px rgba(0,0,0,0.05);
}

/* Tab Switcher */
.tab-nav {
	display: flex;
	gap: 4px;
	margin-left: auto;
	flex-shrink: 0;
	background: var(--bg-subtle);
	padding: 3px;
	border-radius: 8px;
	border: 1px solid var(--line);
}

.tab {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	padding: 6px 16px;
	border: none;
	border-radius: 6px;
	background: transparent;
	color: var(--muted);
	cursor: pointer;
	font: inherit;
	font-size: 13px;
	font-weight: 600;
	transition: all 0.15s ease;
}

.tab:hover {
	color: var(--text);
	background: rgba(255, 255, 255, 0.6);
}

.tab.active {
	background: #ffffff;
	color: var(--accent);
	box-shadow: var(--shadow-xs);
}

.tab-icon {
	display: inline-flex;
	align-items: center;
	opacity: 0.85;
}

/* ─── Main Content Container ─────────────────────────────────────────── */
main {
	width: min(1440px, calc(100% - 48px));
	margin: 0 auto;
	padding-bottom: 64px;
}

/* ─── Hero / Executive Banner ────────────────────────────────────────── */
.hero {
	padding: 36px 0 28px;
	border-bottom: 1px solid var(--line);
}

.hero-header {
	display: flex;
	justify-content: space-between;
	align-items: flex-start;
	gap: 20px;
	flex-wrap: wrap;
}

.hero-main {
	max-width: 840px;
}

.eyebrow-pill {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 3px 10px;
	background: var(--success-bg);
	border: 1px solid var(--success-border);
	border-radius: 999px;
	color: #065f46;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.5px;
	text-transform: uppercase;
	margin-bottom: 10px;
}

.pulse-dot {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: #10b981;
	box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.25);
	animation: pulse 2s infinite ease-in-out;
}

@keyframes pulse {
	0%, 100% { transform: scale(1); opacity: 1; }
	50% { transform: scale(1.2); opacity: 0.7; }
}

.hero h1 {
	margin: 0 0 8px;
	font-size: 28px;
	font-weight: 800;
	color: #0f172a;
	letter-spacing: -0.4px;
}

.hero-desc {
	margin: 0;
	color: var(--muted);
	font-size: 14.5px;
	line-height: 1.5;
}

/* Executive KPI Stat Cards */
.hero-stats {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
	gap: 12px;
	margin-top: 24px;
}

.kpi-card {
	background: var(--panel);
	border: 1px solid var(--line);
	border-radius: 10px;
	padding: 14px 18px;
	box-shadow: var(--shadow-sm);
	display: flex;
	flex-direction: column;
	gap: 3px;
	position: relative;
	overflow: hidden;
	transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.kpi-card::before {
	content: "";
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	height: 3px;
	background: var(--line);
}

.kpi-card:hover {
	transform: translateY(-1px);
	box-shadow: var(--shadow-md);
	border-color: #cbd5e1;
}

.kpi-card.kpi-blue::before { background: #0f6cbd; }
.kpi-card.kpi-indigo::before { background: #6366f1; }
.kpi-card.kpi-emerald::before { background: #10b981; }
.kpi-card.kpi-amber::before { background: #f59e0b; }

.kpi-num {
	font-size: 24px;
	font-weight: 800;
	color: #0f172a;
	letter-spacing: -0.5px;
	line-height: 1.1;
}

.kpi-label {
	font-size: 12.5px;
	font-weight: 600;
	color: #334155;
}

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

.hero-summary-bar {
	margin-top: 14px;
	font-size: 12.5px;
	color: var(--muted);
	display: flex;
	align-items: center;
	gap: 6px;
}

/* ─── Filter Section ─────────────────────────────────────────────────── */
.filter-section {
	display: flex;
	flex-direction: column;
	gap: 14px;
	padding: 20px 0 16px;
	border-bottom: 1px solid var(--line);
}

.filters {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.filter {
	border: 1px solid var(--line);
	border-radius: 999px;
	padding: 6px 14px;
	background: #ffffff;
	color: #334155;
	cursor: pointer;
	font: inherit;
	font-size: 13px;
	font-weight: 500;
	box-shadow: var(--shadow-xs);
	transition: all 0.15s ease;
}

.filter:hover {
	border-color: var(--accent);
	color: var(--accent);
	background: var(--accent-light);
}

.filter.active {
	border-color: var(--accent);
	background: var(--accent);
	color: #ffffff;
	font-weight: 600;
	box-shadow: 0 2px 6px rgba(15, 108, 189, 0.28);
}

.filter-controls {
	display: flex;
	align-items: center;
	gap: 16px;
	flex-wrap: wrap;
	padding-top: 4px;
}

.filter-group {
	display: flex;
	align-items: center;
	gap: 8px;
	color: #475569;
	font-size: 13px;
	font-weight: 500;
}

.filter-group select {
	padding: 6px 12px;
	border: 1px solid var(--line-dark);
	border-radius: 6px;
	background: #ffffff;
	color: var(--text);
	font: inherit;
	font-size: 13px;
	font-weight: 500;
	cursor: pointer;
	outline: none;
	box-shadow: var(--shadow-xs);
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.filter-group select:focus {
	border-color: var(--accent);
	box-shadow: 0 0 0 2px rgba(15, 108, 189, 0.15);
}

.btn-reset-filters {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 6px 14px;
	border: 1px solid var(--line);
	border-radius: 6px;
	background: #ffffff;
	color: #64748b;
	font: inherit;
	font-size: 12.5px;
	font-weight: 600;
	cursor: pointer;
	margin-left: auto;
	box-shadow: var(--shadow-xs);
	transition: all 0.15s ease;
}

.btn-reset-filters:hover {
	border-color: #ef4444;
	color: #dc2626;
	background: #fef2f2;
}

/* ─── Table Section ──────────────────────────────────────────────────── */
.section-heading {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin: 18px 0 12px;
}

.section-heading h2 {
	margin: 0;
	font-size: 19px;
	font-weight: 700;
	color: #0f172a;
}

.section-heading span {
	color: var(--muted);
	font-size: 13px;
	font-weight: 500;
	background: var(--bg-subtle);
	padding: 3px 10px;
	border-radius: 999px;
	border: 1px solid var(--line);
}

.table-scroll {
	overflow-x: auto;
	border: 1px solid var(--line);
	border-radius: 10px;
	background: var(--panel);
	box-shadow: var(--shadow-sm);
}

table {
	width: 100%;
	border-collapse: separate;
	border-spacing: 0;
	min-width: 960px;
	font-size: 13.5px;
}

th,
td {
	padding: 12px 16px;
	border-bottom: 1px solid var(--line);
	text-align: left;
	vertical-align: middle;
}

th {
	color: #475569;
	font-size: 11.5px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	white-space: nowrap;
	background: #f8fafc;
	position: sticky;
	top: 0;
	z-index: 5;
	border-bottom: 1px solid var(--line-dark);
}

tbody tr:last-child td {
	border-bottom: 0;
}

tbody tr:hover {
	background: #f0f7ff;
}

/* Table column typography */
.table-name-cell a {
	color: var(--accent);
	font-weight: 700;
	font-size: 14px;
}

.table-name-cell a:hover {
	color: var(--accent-dark);
}

.table-schema-sub {
	color: var(--muted);
	font-size: 11px;
	font-family: Consolas, monospace;
	margin-top: 1px;
}

.entity-cell {
	font-weight: 600;
	color: #1e293b;
}

.muted {
	color: var(--muted);
}

.number {
	text-align: right;
	font-variant-numeric: tabular-nums;
	font-weight: 600;
	color: #334155;
}

/* Module Badges */
.tag {
	display: inline-flex;
	align-items: center;
	padding: 3px 9px;
	border-radius: 999px;
	background: #f1f5f9;
	color: #334155;
	font-size: 11.5px;
	font-weight: 600;
	border: 1px solid #e2e8f0;
	white-space: nowrap;
}

.tag-module-employee { background: #eff6ff; color: #1d4ed8; border-color: #dbeafe; }
.tag-module-master { background: #f5f3ff; color: #6d28d9; border-color: #ede9fe; }
.tag-module-asset { background: #fef3c7; color: #92400e; border-color: #fde68a; }
.tag-module-user { background: #ecfdf5; color: #047857; border-color: #a7f3d0; }
.tag-module-salary { background: #f0fdf4; color: #15803d; border-color: #bbf7d0; }
.tag-module-setting { background: #f8fafc; color: #475569; border-color: #cbd5e1; }
.tag-module-recruitment { background: #fff1f2; color: #be123c; border-color: #fecdd3; }
.tag-module-request { background: #fff7ed; color: #c2410c; border-color: #ffedd5; }
.tag-module-training { background: #eef2ff; color: #4338ca; border-color: #e0e7ff; }
.tag-module-internalsocial { background: #fdf2f8; color: #be185d; border-color: #fce7f3; }

.review {
	color: #d97706;
	font-weight: 600;
}

.review.reviewed {
	color: #059669;
	font-weight: 600;
}

/* ─── Pagination ─────────────────────────────────────────────────────── */
.pagination {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-top: 16px;
	padding: 10px 4px;
	gap: 12px;
	flex-wrap: wrap;
	font-size: 13px;
	color: var(--muted);
}

.pagination-info {
	font-size: 13px;
	font-weight: 500;
	color: #475569;
}

.pagination-controls {
	display: flex;
	align-items: center;
	gap: 4px;
}

.page-btn {
	min-width: 34px;
	height: 34px;
	padding: 0 8px;
	border: 1px solid var(--line);
	background: var(--panel);
	color: #334155;
	border-radius: 6px;
	cursor: pointer;
	font: inherit;
	font-size: 13px;
	font-weight: 600;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	box-shadow: var(--shadow-xs);
	transition: all 0.15s ease;
}

.page-btn:hover:not(:disabled) {
	background: var(--bg-subtle);
	border-color: var(--accent);
	color: var(--accent);
}

.page-btn.active {
	background: var(--accent);
	border-color: var(--accent);
	color: #ffffff;
	box-shadow: 0 2px 4px rgba(15, 108, 189, 0.25);
}

.page-btn:disabled {
	opacity: 0.4;
	cursor: not-allowed;
	box-shadow: none;
}

.page-numbers {
	display: flex;
	align-items: center;
	gap: 4px;
}

.page-ellipsis {
	padding: 0 6px;
	color: var(--muted);
	user-select: none;
}

.pagination-size {
	display: flex;
	align-items: center;
	gap: 8px;
	font-weight: 500;
	color: #475569;
}

#page-size-select {
	background: var(--panel);
	border: 1px solid var(--line);
	border-radius: 6px;
	color: var(--text);
	padding: 5px 10px;
	font: inherit;
	font-size: 13px;
	font-weight: 500;
	cursor: pointer;
	box-shadow: var(--shadow-xs);
	outline: none;
	transition: border-color 0.15s ease;
}

#page-size-select:focus {
	border-color: var(--accent);
}

/* ─── Detail View ────────────────────────────────────────────────────── */
.detail-header {
	display: flex;
	justify-content: space-between;
	align-items: flex-start;
	gap: 24px;
	margin: 28px 0 18px;
	padding-bottom: 20px;
	border-bottom: 1px solid var(--line);
}

.breadcrumb {
	display: flex;
	align-items: center;
	gap: 6px;
	color: var(--muted);
	font-size: 13px;
	font-weight: 500;
	margin-bottom: 8px;
}

.breadcrumb a {
	color: var(--accent);
	font-weight: 600;
	text-decoration: none;
}

.breadcrumb a:hover {
	text-decoration: underline;
	color: var(--accent-dark);
}

.breadcrumb-sep {
	color: #cbd5e1;
}

.detail-header h2 {
	margin: 0 0 6px;
	font-size: 26px;
	font-weight: 800;
	color: #0f172a;
	display: flex;
	align-items: center;
	gap: 12px;
	flex-wrap: wrap;
}

.detail-header h2 .entity-badge {
	font-size: 14px;
	font-weight: 600;
	color: var(--muted);
	background: var(--bg-subtle);
	padding: 2px 10px;
	border-radius: 6px;
	border: 1px solid var(--line);
}

.detail-desc {
	margin: 0;
	color: #475569;
	font-size: 14px;
	max-width: 820px;
	line-height: 1.5;
}

.stats {
	display: flex;
	gap: 10px;
	flex-wrap: wrap;
	white-space: nowrap;
}

.stat-chip {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 6px 14px;
	background: var(--panel);
	border: 1px solid var(--line);
	border-radius: 8px;
	color: #0f6cbd;
	font-size: 12.5px;
	font-weight: 700;
	box-shadow: var(--shadow-xs);
}

.definition {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
	gap: 12px;
	margin: 18px 0 28px;
}

.definition div {
	padding: 12px 16px;
	background: var(--panel);
	border: 1px solid var(--line);
	border-radius: 8px;
	box-shadow: var(--shadow-xs);
	font-size: 13.5px;
	color: var(--text);
	font-weight: 600;
}

.definition b {
	display: block;
	color: var(--muted);
	font-size: 11px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	margin-bottom: 3px;
}

.subsection {
	margin-top: 32px;
}

.subsection h3 {
	margin: 0 0 12px;
	font-size: 17px;
	font-weight: 700;
	color: #0f172a;
}

/* Columns table details */
.badge-pk {
	display: inline-flex;
	align-items: center;
	gap: 3px;
	padding: 1px 6px;
	border-radius: 4px;
	background: #fef3c7;
	border: 1px solid #fde68a;
	color: #b45309;
	font-size: 10.5px;
	font-weight: 700;
	margin-left: 6px;
}

.datatype-chip {
	display: inline-block;
	padding: 2px 7px;
	border-radius: 4px;
	background: #f1f5f9;
	border: 1px solid #e2e8f0;
	color: #334155;
	font-family: Consolas, monospace;
	font-size: 11.5px;
}

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

.fk:hover {
	text-decoration: underline;
}

.rel-list {
	display: flex;
	flex-direction: column;
	gap: 5px;
	max-height: 180px;
	overflow-y: auto;
}

.rel-item {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-size: 12px;
	white-space: nowrap;
	padding: 2px 6px;
	border-radius: 4px;
	background: #f8fafc;
	border: 1px solid #e2e8f0;
}

.rel-arrow {
	color: var(--accent);
	font-weight: 800;
	font-size: 13px;
	flex-shrink: 0;
}

.rel-arrow-in {
	color: #7c3aed;
}

.tag-sm {
	font-size: 10px;
	padding: 1px 5px;
	border-radius: 3px;
	background: #e2e8f0;
	color: #475569;
	font-weight: 600;
}

.col-fk-out {
	color: var(--accent);
	font-size: 11.5px;
	display: block;
	margin-top: 2px;
	font-weight: 500;
}

.col-fk-in {
	color: #7c3aed;
	font-size: 11.5px;
	display: block;
	margin-top: 2px;
	font-weight: 500;
}

/* ─── Diagram Controls & Canvas ──────────────────────────────────────── */
.diagram-controls {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 16px;
	padding: 16px 0 14px;
	border-bottom: 1px solid var(--line);
	flex-wrap: wrap;
}

.diagram-controls-left {
	display: flex;
	align-items: center;
	gap: 12px;
}

.diagram-controls-right {
	display: flex;
	align-items: center;
	gap: 12px;
	flex-wrap: wrap;
}

.diagram-controls label {
	color: #475569;
	font-size: 13px;
	font-weight: 600;
}

#diagram-module {
	background: #ffffff;
	border: 1px solid var(--line-dark);
	border-radius: 6px;
	color: var(--text);
	padding: 6px 12px;
	font: inherit;
	font-size: 13px;
	font-weight: 500;
	cursor: pointer;
	box-shadow: var(--shadow-xs);
	outline: none;
	transition: border-color 0.15s ease;
}

#diagram-module:focus {
	border-color: var(--accent);
	box-shadow: 0 0 0 2px rgba(15, 108, 189, 0.15);
}

.diagram-table-count {
	color: var(--muted);
	font-size: 12px;
	font-weight: 600;
	background: var(--bg-subtle);
	padding: 3px 9px;
	border-radius: 999px;
	border: 1px solid var(--line);
}

.diagram-mouse-hint {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 5px 10px;
	background: #f8fafc;
	border-radius: 6px;
	color: #64748b;
	font-size: 11.5px;
	border: 1px solid #e2e8f0;
	user-select: none;
	line-height: 1.2;
}

.diagram-mouse-hint svg {
	color: #94a3b8;
	flex-shrink: 0;
}

.diagram-mouse-hint b {
	color: #334155;
	background: #edebe9;
	padding: 1px 4px;
	border-radius: 3px;
	font-weight: 600;
}

@media (max-width: 1024px) {
	.diagram-mouse-hint span {
		display: none;
	}
}

.diagram-check {
	display: flex;
	align-items: center;
	gap: 7px;
	color: #334155;
	font-size: 12.5px;
	font-weight: 500;
	cursor: pointer;
	user-select: none;
}

.diagram-check input[type="checkbox"] {
	accent-color: var(--accent);
	width: 15px;
	height: 15px;
	cursor: pointer;
}

.diagram-fit-btn {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 6px 13px;
	border: 1px solid var(--line);
	border-radius: 4px;
	background: #ffffff;
	color: #334155;
	cursor: pointer;
	font: inherit;
	font-size: 12.5px;
	font-weight: 600;
	box-shadow: var(--shadow-xs);
	transition: all 0.15s ease;
	white-space: nowrap;
}

.diagram-fit-btn:hover {
	background: var(--bg-subtle);
	color: var(--accent);
	border-color: var(--accent);
}

.diagram-fullscreen-btn.is-active {
	background: #eff6ff;
	color: var(--accent);
	border-color: #bfdbfe;
}

/* ─── Fullscreen Mode for Diagram ─────────────────────────────────────── */
#diagram-tab.is-fullscreen {
	position: fixed;
	inset: 0;
	width: 100vw;
	height: 100vh;
	max-width: 100vw;
	max-height: 100vh;
	background: #ffffff;
	z-index: 9999;
	display: flex;
	flex-direction: column;
	padding: 14px 20px;
	box-sizing: border-box;
	margin: 0;
}

#diagram-tab.is-fullscreen .diagram-controls {
	padding-top: 0;
	margin-top: 0;
	flex-shrink: 0;
}

#diagram-tab.is-fullscreen .diagram-canvas-wrap {
	flex: 1;
	height: 100% !important;
	min-height: 0;
	margin-top: 10px;
	border-radius: 8px;
}

/* ─── Cytoscape Canvas & Blueprint Grid ──────────────────────────────── */
.diagram-canvas-wrap {
	position: relative;
	width: 100%;
	height: calc(100vh - 210px);
	min-height: 580px;
	border: 1px solid var(--line);
	border-radius: 8px;
	background-color: #fafbfc;
	background-image: radial-gradient(#cbd5e1 1.2px, transparent 1.2px);
	background-size: 20px 20px;
	margin-top: 14px;
	overflow: hidden;
	box-shadow: var(--shadow-sm);
}

/* ─── Diagram Mode Page Optimization ─────────────────────────────────── */
.tab-diagram .hero {
	display: none !important;
}

@media (min-height: 600px) {
	body.tab-diagram {
		overflow-y: hidden;
	}
}

body.tab-diagram main {
	width: calc(100% - 32px);
	max-width: 100%;
	padding-bottom: 0;
	margin: 0 auto;
}

body.tab-diagram .diagram-controls {
	padding: 10px 0 10px;
	margin-top: 2px;
}

body.tab-diagram .diagram-canvas-wrap {
	margin-top: 10px;
	height: calc(100vh - 138px);
	min-height: 480px;
}

#cy-container {
	width: 100%;
	height: 100%;
}

/* Diagram Loading */
.diagram-loading {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 12px;
	padding: 20px 0;
	color: var(--muted);
	font-size: 14px;
	font-weight: 500;
}

.diagram-spinner {
	width: 22px;
	height: 22px;
	border: 2.5px solid var(--line);
	border-top-color: var(--accent);
	border-radius: 50%;
	animation: spin 0.7s linear infinite;
}

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

/* ─── Node Side Inspector Drawer (Fluent UI Style) ────────────────────── */
.node-panel {
	position: absolute;
	top: 0;
	right: 0;
	bottom: 0;
	width: 390px;
	max-width: 92vw;
	background: #ffffff;
	border-left: 1px solid var(--line);
	display: flex;
	flex-direction: column;
	z-index: 50;
	transform: translateX(100%);
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	transition: transform 0.22s cubic-bezier(0.1, 0.9, 0.2, 1), opacity 0.18s ease, visibility 0.22s;
	box-shadow: -4px 0 24px rgba(0, 0, 0, 0.08);
}

.node-panel.open {
	transform: translateX(0);
	opacity: 1;
	visibility: visible;
	pointer-events: auto;
}

.node-panel-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 12px 16px;
	flex-shrink: 0;
	border-bottom: 1px solid var(--line);
	background: #fafbfc;
}

.node-panel-meta {
	display: flex;
	align-items: center;
	gap: 6px;
	flex-wrap: wrap;
}

.node-panel-module {
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.5px;
	text-transform: uppercase;
	color: var(--accent);
	background: #eff6ff;
	border: 1px solid #dbeafe;
	padding: 2px 7px;
	border-radius: 4px;
}

.node-panel-schema {
	font-size: 11px;
	color: #64748b;
	font-family: Consolas, monospace;
	background: #f1f5f9;
	border: 1px solid #e2e8f0;
	padding: 2px 6px;
	border-radius: 4px;
}

.node-panel-close {
	border: none;
	background: transparent;
	color: #64748b;
	cursor: pointer;
	padding: 0;
	width: 28px;
	height: 28px;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 4px;
	flex-shrink: 0;
	transition: background 0.12s, color 0.12s;
}

.node-panel-close:hover {
	background: #f1f5f9;
	color: #0f172a;
}

.node-panel-title {
	padding: 14px 18px 4px;
	font-size: 16px;
	font-weight: 700;
	color: #1e293b;
	word-break: break-all;
	flex-shrink: 0;
	letter-spacing: -0.2px;
}

.node-panel-entity {
	padding: 0 18px 12px;
	font-size: 12px;
	color: #64748b;
	font-weight: 500;
	flex-shrink: 0;
	border-bottom: 1px solid #f1f5f9;
}

.node-panel-body {
	overflow-y: auto;
	flex: 1;
	padding: 0;
}

.node-panel-body table {
	width: 100%;
	border-collapse: collapse;
	font-size: 12px;
	min-width: 0;
}

.node-panel-body th {
	color: #64748b;
	font-size: 10.5px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	padding: 8px 14px;
	text-align: left;
	background: #f3f2f1;
	border-bottom: 1px solid var(--line);
	position: sticky;
	top: 0;
	z-index: 2;
}

.node-panel-body td {
	padding: 7px 14px;
	border-bottom: 1px solid #f1f5f9;
	vertical-align: middle;
	color: #1e293b;
}

.node-panel-body tr:hover td {
	background: #f8fbff;
}

.node-panel-body tr:last-child td {
	border-bottom: none;
}

.node-panel-body .col-pk {
	color: #0f172a;
	font-weight: 600;
}

.badge-pk-mini {
	background: #fef3c7;
	color: #92400e;
	border: 1px solid #fde68a;
	border-radius: 3px;
	font-size: 10px;
	padding: 1px 4px;
	font-weight: 700;
	margin-left: 5px;
	display: inline-block;
	vertical-align: middle;
	line-height: 1.2;
}

.node-panel-body .col-fk {
	color: var(--accent);
	font-size: 11px;
	display: block;
	margin-top: 2px;
	font-weight: 500;
}

.node-panel-body .col-type {
	color: #475569;
	font-size: 11px;
	font-family: Consolas, monospace;
	background: #f1f5f9;
	padding: 1.5px 5px;
	border-radius: 3px;
	display: inline-block;
}

.node-panel-body .col-null {
	color: var(--success);
	font-size: 12px;
	text-align: center;
	font-weight: 700;
}

.node-panel-footer {
	padding: 12px 16px;
	border-top: 1px solid var(--line);
	background: #fafbfc;
	flex-shrink: 0;
}

.node-panel-link {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	padding: 8px 14px;
	background: var(--accent);
	color: #ffffff !important;
	border-radius: 4px;
	font-size: 13px;
	font-weight: 600;
	box-shadow: 0 1px 2px rgba(15, 108, 189, 0.2);
	transition: background 0.15s ease;
	text-decoration: none;
}

.node-panel-link:hover {
	background: var(--accent-dark);
	text-decoration: none;
}

/* ─── Empty & Error States ───────────────────────────────────────────── */
.empty {
	padding: 48px 24px;
	border: 1px dashed var(--line-dark);
	border-radius: 8px;
	color: var(--muted);
	text-align: center;
	font-size: 14px;
	background: #ffffff;
}

.error {
	margin: 28px auto;
	max-width: 800px;
	padding: 24px 28px;
	border: 1px solid var(--danger-border);
	background: var(--danger-bg);
	border-radius: 10px;
	color: #991b1b;
	font-size: 14px;
	line-height: 1.6;
	box-shadow: var(--shadow-sm);
}

.error h3 {
	margin: 0 0 10px;
	color: #b91c1c;
	font-size: 17px;
	font-weight: 700;
}

.error code {
	background: #ffffff;
	padding: 3px 8px;
	border-radius: 4px;
	border: 1px solid #fca5a5;
	color: #991b1b;
	font-family: Consolas, monospace;
	font-weight: 600;
}

.error ul {
	margin: 12px 0 0 20px;
	padding: 0;
}

.error li {
	margin-bottom: 6px;
}

/* ─── Responsive Media Queries ───────────────────────────────────────── */
@media (max-width: 860px) {
	.site-header {
		padding: 10px 16px;
		gap: 12px;
	}
	
	.brand-sub {
		display: none;
	}
	
	main {
		width: calc(100% - 32px);
	}
	
	.hero-stats {
		grid-template-columns: repeat(2, 1fr);
	}
	
	.detail-header {
		flex-direction: column;
	}
	
	.stats {
		margin-top: 8px;
	}
}

@media (max-width: 540px) {
	.hero-stats {
		grid-template-columns: 1fr;
	}
}
