/* =========================================================================================================
   Aegis Administration System — List Editor styles
   Tool aesthetic: dense, hairline borders, neutral cool palette, one accent. IBM Plex Sans/Mono.
   No gradients, no glass, no drop-shadow theatrics. Structure reads like an editor, not a landing page.
   ========================================================================================================= */

:root {
	--bg:        #15171b;   /* near-black, slightly blue */
	--surface:   #1c1f25;   /* panel */
	--surface-2: #23272e;   /* raised row */
	--line:      #2e333c;   /* hairline */
	--line-soft: #262b32;
	--ink:       #e6e9ee;   /* primary text */
	--ink-dim:   #9aa3af;   /* secondary text */
	--ink-faint: #6b7280;   /* tertiary */
	--accent:    #5b9cff;   /* single accent — cool blue, "aegis/shield" */
	--accent-dim:#22324d;
	--danger:    #d96b6b;
	--ok:        #6bbf8a;

	--font-sans: 'IBM Plex Sans', system-ui, sans-serif;
	--font-mono: 'IBM Plex Mono', ui-monospace, monospace;

	--r: 3px;               /* tight radius, not pill */
}

* { box-sizing: border-box; }

html, body {
	margin: 0;
	height: 100%;
}

body {
	background: var(--bg);
	color: var(--ink);
	font-family: var(--font-sans);
	font-size: 14px;
	line-height: 1.45;
	display: flex;
	flex-direction: column;
	min-height: 100vh;
	-webkit-font-smoothing: antialiased;
}

code {
	font-family: var(--font-mono);
	font-size: 0.85em;
	color: var(--ink);
	background: var(--surface-2);
	padding: 1px 5px;
	border-radius: var(--r);
}

/* =========================================================================================================
   Top bar
   ========================================================================================================= */

.topbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	padding: 12px 20px;
	border-bottom: 1px solid var(--line);
	background: var(--surface);
}

.topbar__id {
	display: flex;
	align-items: baseline;
	gap: 12px;
	min-width: 0;
}

.topbar__mark {
	font-family: var(--font-mono);
	font-weight: 600;
	font-size: 13px;
	letter-spacing: 0.18em;
	color: var(--bg);
	background: var(--accent);
	padding: 3px 7px;
	border-radius: var(--r);
}

.topbar__title {
	font-weight: 600;
	white-space: nowrap;
}

.topbar__sub {
	color: var(--ink-faint);
	font-family: var(--font-mono);
	font-size: 12px;
	white-space: nowrap;
}

.topbar__actions {
	display: flex;
	gap: 8px;
	flex-shrink: 0;
}

/* =========================================================================================================
   Buttons
   ========================================================================================================= */

.btn {
	font-family: var(--font-sans);
	font-size: 13px;
	font-weight: 500;
	color: var(--ink);
	background: transparent;
	border: 1px solid var(--line);
	border-radius: var(--r);
	padding: 6px 12px;
	cursor: pointer;
	transition: border-color 0.12s, background 0.12s, color 0.12s;
	white-space: nowrap;
}

.btn:hover { border-color: var(--accent); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.btn--solid {
	background: var(--accent);
	border-color: var(--accent);
	color: var(--bg);
	font-weight: 600;
}
.btn--solid:hover { background: #74acff; border-color: #74acff; }

.btn--ghost { color: var(--ink-dim); }
.btn--ghost:hover { color: var(--ink); }

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

.btn--icon {
	border-color: transparent;
	color: var(--ink-faint);
	padding: 4px 8px;
	font-family: var(--font-mono);
}
.btn--icon:hover { color: var(--danger); border-color: var(--line); }

/* =========================================================================================================
   Workspace — two columns: editor / preview
   ========================================================================================================= */

.workspace {
	flex: 1;
	display: grid;
	grid-template-columns: minmax(0, 1.35fr) minmax(320px, 1fr);
	min-height: 0;
}

.editor {
	display: flex;
	flex-direction: column;
	border-right: 1px solid var(--line);
	min-width: 0;
}

/* tabs */
.tabs {
	display: flex;
	border-bottom: 1px solid var(--line);
	background: var(--surface);
	padding: 0 8px;
	overflow-x: auto;
}

.tab {
	font-family: var(--font-sans);
	font-size: 13px;
	font-weight: 500;
	color: var(--ink-dim);
	background: transparent;
	border: none;
	border-bottom: 2px solid transparent;
	padding: 11px 14px;
	cursor: pointer;
	white-space: nowrap;
	display: flex;
	align-items: center;
	gap: 7px;
}

.tab:hover { color: var(--ink); }
.tab.is-active { color: var(--ink); border-bottom-color: var(--accent); }
.tab:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

.tab__count {
	font-family: var(--font-mono);
	font-size: 11px;
	color: var(--ink-faint);
	background: var(--surface-2);
	border-radius: 10px;
	padding: 0 6px;
	min-width: 18px;
	text-align: center;
}
.tab.is-active .tab__count { color: var(--accent); }

/* panel */
.panel {
	flex: 1;
	display: flex;
	flex-direction: column;
	min-height: 0;
	background: var(--bg);
}

.panel__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	padding: 12px 16px;
	border-bottom: 1px solid var(--line-soft);
}

.panel__hint {
	margin: 0;
	color: var(--ink-faint);
	font-size: 12px;
	font-family: var(--font-mono);
}

.rows {
	overflow-y: auto;
	padding: 8px 12px 16px;
}

/* a single editable row */
.row {
	display: grid;
	gap: 8px;
	align-items: center;
	padding: 7px 4px;
	border-bottom: 1px solid var(--line-soft);
}
.row[data-kind="owners"]    { grid-template-columns: 1fr auto; }
.row[data-kind="staff"]     { grid-template-columns: 1fr 130px auto; }
.row[data-kind="donators"]  { grid-template-columns: 1fr 90px auto; }
.row[data-kind="watchlist"] { grid-template-columns: 1fr 1.2fr auto; }

.row.is-dupe input.name { border-color: var(--danger); }

.field {
	font-family: var(--font-mono);
	font-size: 13px;
	color: var(--ink);
	background: var(--surface);
	border: 1px solid var(--line);
	border-radius: var(--r);
	padding: 6px 9px;
	width: 100%;
}
.field:focus { outline: none; border-color: var(--accent); }
.field::placeholder { color: var(--ink-faint); }

select.field { cursor: pointer; appearance: none; padding-right: 9px; }

.row__warn {
	grid-column: 1 / -1;
	font-size: 11px;
	color: var(--danger);
	font-family: var(--font-mono);
	margin: 2px 0 0;
}

.empty {
	color: var(--ink-dim);
	text-align: center;
	padding: 48px 24px;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 8px;
}
.empty__lead {
	margin: 0;
	font-family: var(--font-mono);
	font-size: 13px;
	color: var(--ink-dim);
}
.empty__paths {
	margin: 0 0 8px;
	font-size: 13px;
	color: var(--ink-faint);
	max-width: 44ch;
	line-height: 1.55;
}
.empty__paths strong { color: var(--ink-dim); font-weight: 600; }

/* =========================================================================================================
   Preview column
   ========================================================================================================= */

.preview {
	display: flex;
	flex-direction: column;
	min-width: 0;
	background: var(--surface);
}

.preview__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 11px 16px;
	border-bottom: 1px solid var(--line);
}

.preview__label {
	font-family: var(--font-mono);
	font-size: 12px;
	color: var(--ink-dim);
}

.preview__meta {
	font-family: var(--font-mono);
	font-size: 11px;
	color: var(--ink-faint);
}

.preview__code {
	flex: 1;
	margin: 0;
	padding: 16px;
	overflow: auto;
	font-family: var(--font-mono);
	font-size: 12.5px;
	line-height: 1.6;
	color: var(--ink-dim);
	white-space: pre;
	tab-size: 2;
}

/* simple token coloring applied via spans in JS */
.tok-h    { color: var(--accent); font-weight: 600; }
.tok-bul  { color: var(--ink-faint); }
.tok-name { color: var(--ink); }
.tok-val  { color: var(--ok); }
.tok-note { color: var(--ink-faint); font-style: italic; }

.preview__notes {
	border-top: 1px solid var(--line);
	padding: 12px 16px;
}

.notes__label {
	display: block;
	font-size: 11px;
	color: var(--ink-faint);
	margin-bottom: 6px;
	font-family: var(--font-mono);
}

.notes__field {
	width: 100%;
	font-family: var(--font-mono);
	font-size: 12.5px;
	color: var(--ink);
	background: var(--bg);
	border: 1px solid var(--line);
	border-radius: var(--r);
	padding: 8px 10px;
	resize: vertical;
}
.notes__field:focus { outline: none; border-color: var(--accent); }

/* =========================================================================================================
   Host bar (footer)
   ========================================================================================================= */

.hostbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	padding: 0 20px;
	border-top: 1px solid var(--line);
	background: var(--surface);
}

.host { flex: 1; min-width: 0; }

.host summary {
	cursor: pointer;
	padding: 11px 0;
	font-size: 12px;
	color: var(--ink-dim);
	font-family: var(--font-mono);
	list-style: none;
	user-select: none;
}
.host summary::-webkit-details-marker { display: none; }
.host summary::before { content: '▸ '; color: var(--accent); }
.host[open] summary::before { content: '▾ '; }

.host__body {
	padding: 0 0 14px;
	font-size: 12.5px;
	color: var(--ink-dim);
	max-width: 70ch;
}
.host__body ul { margin: 8px 0; padding-left: 18px; }
.host__body li { margin: 4px 0; }
.host__warn { color: var(--ink-faint); border-left: 2px solid var(--line); padding-left: 10px; }

.hostbar__build {
	font-family: var(--font-mono);
	font-size: 11px;
	color: var(--ink-faint);
	white-space: nowrap;
	flex-shrink: 0;
}

/* =========================================================================================================
   Dropzone overlay + toast
   ========================================================================================================= */

.dropzone {
	position: fixed;
	inset: 0;
	z-index: 30;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(21, 23, 27, 0.85);
	border: 2px dashed var(--accent);
}
/* The [hidden] attribute must win over display:flex above, or the overlay never disappears. */
.dropzone[hidden] { display: none; }
.dropzone p { font-family: var(--font-mono); color: var(--ink); font-size: 16px; }

.toast[hidden] { display: none; }
.empty[hidden] { display: none; }

.toast {
	position: fixed;
	bottom: 56px;
	left: 50%;
	transform: translateX(-50%);
	z-index: 40;
	background: var(--surface-2);
	border: 1px solid var(--line);
	border-left: 3px solid var(--accent);
	color: var(--ink);
	font-size: 13px;
	padding: 9px 16px;
	border-radius: var(--r);
}

/* =========================================================================================================
   Responsive — stack on narrow screens
   ========================================================================================================= */

@media (max-width: 820px) {
	.workspace { grid-template-columns: 1fr; }
	.editor { border-right: none; border-bottom: 1px solid var(--line); }
	.topbar { flex-wrap: wrap; }
	.topbar__sub { display: none; }
	.row[data-kind="watchlist"] { grid-template-columns: 1fr 1fr auto; }
}

@media (prefers-reduced-motion: reduce) {
	* { transition: none !important; }
}
