:root {
	--accent: #0d6efd;
	--accent-light: #e8f0fe;
	--sidebar-bg: #f8f9fa;
	--border-color: #dee2e6;
	--item-bg: #fff;
	--item-hover: #f1f3f5;
	--edit-bg: #fffbe6;
	--edit-border: #ffc107;
}

body {
	background: #f0f2f5;
	font-size: 14px;
	margin: 0;
	padding: 0;
}

#app-wrapper {
	/*margin: 16px;*/
	background: #fff;
	border-radius: 12px;
	box-shadow: 0 2px 16px rgba(0, 0, 0, .08);
	overflow: hidden;
	border: 1px solid var(--border-color);
	min-height: calc(100vh - 160px);
}

/* ── Header ── */
#app-header {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 14px 20px;
	background: #fff;
	border-bottom: 1px solid var(--border-color);
	flex-wrap: wrap;
}

#app-header h1 {
	font-size: 20px;
	font-weight: 600;
	letter-spacing: -.3px;
	margin: 0;
	margin-right: auto;
	color: #212529;
}

#app-header .subtitle {
	font-size: 12px;
	color: #6c757d;
	margin-left: 8px;
	font-weight: 400;
}

/* ── Tabs ── */
.nav-tabs {
	border-bottom: 1px solid var(--border-color);
	padding: 0 20px;
	background: #fff;
}

.nav-tabs .nav-link {
	font-size: 13px;
	color: #6c757d;
	border: none;
	border-bottom: 2px solid transparent;
	padding: 10px 14px;
	border-radius: 0;
	transition: color .15s;
}

.nav-tabs .nav-link:hover {
	color: #212529;
	background: transparent;
}

.nav-tabs .nav-link.active {
	color: var(--accent);
	border-bottom-color: var(--accent);
	font-weight: 500;
}

.nav-tabs .nav-link .tab-count {
	background: #e9ecef;
	color: #495057;
	font-size: 10px;
	padding: 1px 6px;
	border-radius: 10px;
	margin-left: 5px;
	font-weight: 500;
}

.nav-tabs .nav-link.active .tab-count {
	background: var(--accent-light);
	color: var(--accent);
}

/* ── Main content ── */
#tab-content {
	padding: 20px;
	background: #fff;
	min-height: 440px;
}

/* ── Form sidebar ── */
.form-sidebar {
	background: var(--sidebar-bg);
	border: 1px solid var(--border-color);
	border-radius: 8px;
	padding: 16px;
}

.form-sidebar .sidebar-title {
	font-size: 11px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: .07em;
	color: #6c757d;
	margin-bottom: 14px;
}

.form-label {
	font-size: 12px;
	color: #495057;
	font-weight: 500;
	margin-bottom: 4px;
}

.form-control, .form-select {
	font-size: 13px;
	border-color: var(--border-color);
	border-radius: 6px;
}

.form-control:focus, .form-select:focus {
	border-color: var(--accent);
	box-shadow: 0 0 0 3px rgba(13, 110, 253, .12);
}

select[multiple] {
	height: 90px;
}

/* ── Col label ── */
.col-label {
	font-size: 11px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: .07em;
	color: #6c757d;
	margin-bottom: 10px;
}

.item-list {
	min-height: 48px;
}

/* ── Item row (view mode) ── */
.item-row {
	display: flex;
	align-items: flex-start;
	gap: 8px;
	background: var(--item-bg);
	border: 1px solid var(--border-color);
	border-radius: 7px;
	padding: 8px 10px;
	margin-bottom: 6px;
	transition: background .1s, box-shadow .1s;
}

.item-row:not(.editing):hover {
	background: var(--item-hover);
	box-shadow: 0 1px 4px rgba(0, 0, 0, .05);
}

.item-row.sortable-ghost {
	opacity: .35;
	background: var(--accent-light);
}

.item-row.sortable-chosen {
	box-shadow: 0 2px 10px rgba(13, 110, 253, .18);
}

/* ── Item row (edit mode) ── */
.item-row.editing {
	background: var(--edit-bg);
	border-color: var(--edit-border);
	box-shadow: 0 0 0 3px rgba(255, 193, 7, .15);
	flex-wrap: wrap;
}

.drag-handle {
	color: #adb5bd;
	cursor: grab;
	font-size: 15px;
	line-height: 1;
	padding: 2px 2px 0;
	flex-shrink: 0;
}

.drag-handle:active {
	cursor: grabbing;
}

.editing .drag-handle {
	cursor: default;
	color: #dee2e6;
}

.item-body {
	flex: 1;
	min-width: 0;
}

.item-name {
	font-size: 13px;
	font-weight: 500;
	color: #212529;
}

.item-desc {
	font-size: 11px;
	color: #888;
	margin-top: 2px;
	font-style: italic;
}

.item-meta {
	font-size: 11px;
	color: #6c757d;
	margin-top: 3px;
}

/* ── Edit form inside item ── */
.edit-form {
	flex: 0 0 100%;
	display: flex;
	flex-direction: column;
	gap: 7px;
	padding-top: 2px;
}

.edit-form .form-control, .edit-form .form-select {
	font-size: 12px;
	padding: 4px 7px;
}

.edit-form select[multiple] {
	height: 75px;
}

.edit-form .ef-label {
	font-size: 11px;
	color: #6c757d;
	margin-bottom: 2px;
	display: block;
}

.pill {
	display: inline-block;
	background: var(--accent-light);
	color: var(--accent);
	font-size: 10px;
	font-weight: 500;
	padding: 1px 7px;
	border-radius: 10px;
	margin: 1px 2px 1px 0;
}

.pill-neutral {
	background: #e9ecef;
	color: #495057;
}

/* ── Action buttons ── */
.item-actions {
	display: flex;
	gap: 3px;
	flex-shrink: 0;
	padding-top: 1px;
}

.btn-icon {
	background: none;
	border: none;
	padding: 3px 5px;
	cursor: pointer;
	border-radius: 4px;
	font-size: 13px;
	line-height: 1;
	transition: color .1s, background .1s;
}

.btn-icon.edit {
	color: #6c757d;
}

.btn-icon.edit:hover {
	color: var(--accent);
	background: var(--accent-light);
}

.btn-icon.del {
	color: #adb5bd;
}

.btn-icon.del:hover {
	color: #dc3545;
	background: #fff0f0;
}

/* ── Tree nesting ── */
.tree-children {
	margin-left: 22px;
	margin-top: 4px;
	padding-left: 10px;
	border-left: 2px solid #e9ecef;
	min-height: 10px;
}
/* Zone de dépôt mise en évidence pendant le survol */
.drop-zone-active {
	background: #e8f4fd;
	border-radius: 6px;
	outline: 2px dashed #90c8f0;
	outline-offset: 2px;
}
/* Indication visuelle sur les conteneurs vides */
.tree-drop-hint {
	font-size: 10px;
	color: #adb5bd;
	text-align: center;
	padding: 4px 0;
	pointer-events: none;
	user-select: none;
}

/* ── Empty state ── */
.empty-state {
	text-align: center;
	padding: 32px 16px;
	color: #adb5bd;
	font-size: 13px;
	border: 1.5px dashed #dee2e6;
	border-radius: 8px;
}

.empty-state i {
	font-size: 28px;
	display: block;
	margin-bottom: 8px;
}

/* ── JSON preview ── */
#json-preview {
	background: #1e1e2e;
	color: #cdd6f4;
	border-radius: 8px;
	padding: 16px;
	font-family: 'Cascadia Code', 'Fira Code', monospace;
	font-size: 12px;
	max-height: 480px;
	overflow: auto;
	white-space: pre;
	line-height: 1.6;
}

/* ── Stats bar ── */
.stats-bar {
	display: flex;
	gap: 16px;
	flex-wrap: wrap;
	padding: 10px 20px;
	background: var(--sidebar-bg);
	border-top: 1px solid var(--border-color);
	border-bottom: 1px solid var(--border-color);
	font-size: 12px;
	color: #6c757d;
}

.stat-item strong {
	color: #212529;
	font-weight: 600;
}

.toast-container {
	position: fixed;
	bottom: 24px;
	right: 24px;
	z-index: 9999;
}

.btn-sm {
	font-size: 12px;
}

.btn-outline-secondary {
	border-color: var(--border-color);
}