/* Copyright 2026 davenonymous
 *
 * The admin pages: sidebar shell, key figures, server tiles, the server
 * page's tabs (manage, players, chat, console, maps, cvars, plugins and
 * extensions), charts, tables (Tabulator, restyled), dialogs, toasts and the
 * sign-in gate. Colours come from
 * theme.css; the chart series colours below are validated for the dark
 * surface (blue, orange, aqua, yellow, in this order).
 */

:root {
	--sidebar-width: 248px;
	--series-1: #3987e5;
	--series-2: #d95926;
	--series-3: #199e70;
	--series-4: #c98500;
	--chart-grid: rgba(236, 227, 203, 0.07);
	--chart-axis: rgba(236, 227, 203, 0.18);
}

/* --------------------------------------------------------------------- shell */

.admin-body { background-attachment: fixed; }
.admin-shell { display: grid; grid-template-columns: var(--sidebar-width) minmax(0, 1fr); min-height: 100vh; }

.sidebar {
	position: sticky; top: 0; height: 100vh; z-index: 40;
	display: flex; flex-direction: column; gap: 8px;
	padding: 18px 14px 14px;
	background:
		linear-gradient(180deg, rgba(42, 35, 30, 0.95), rgba(26, 22, 19, 0.98)),
		var(--texture-metal);
	background-size: auto, 256px 256px;
	border-right: 1px solid #0d0a08;
	box-shadow: 1px 0 0 var(--edge-soft) inset, 8px 0 24px rgba(0, 0, 0, 0.35);
}
.sidebar__brand { display: flex; align-items: center; gap: 12px; padding: 4px 6px 14px; color: var(--text); text-decoration: none; border-bottom: 1px solid rgba(0, 0, 0, 0.4); box-shadow: 0 1px 0 var(--edge-soft); }
.sidebar__brand:hover { color: var(--text); }
.sidebar__brand img { flex: none; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.6)); }
.sidebar__brand > span { display: grid; min-width: 0; }
.sidebar__site { font-family: var(--font-display); font-size: 1.02rem; letter-spacing: 0.04em; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar__label { font-size: 0.72rem; letter-spacing: 0.18em; text-transform: uppercase; color: var(--accent-bright); }
.sidebar__nav { display: grid; gap: 2px; align-content: start; flex: 1; padding-top: 8px; overflow-y: auto; }
.sidebar__group { margin: 18px 10px 6px; font-size: 0.7rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--text-dim); }
.sidebar__link {
	position: relative; display: flex; align-items: center; gap: 12px;
	padding: 10px 12px; border-radius: var(--radius);
	color: var(--text-muted); text-decoration: none; font-size: 0.98rem; letter-spacing: 0.03em;
	transition: background-color 120ms ease, color 120ms ease;
}
.sidebar__link .icon { width: 1.2em; height: 1.2em; }
.sidebar__link:hover { color: var(--text); background: rgba(236, 227, 203, 0.05); }
.sidebar__link.is-active { color: var(--text); background: linear-gradient(90deg, var(--accent-soft), rgba(207, 106, 50, 0.04)); box-shadow: 0 0 0 1px rgba(207, 106, 50, 0.22) inset; }
.sidebar__link.is-active::before { content: ""; position: absolute; left: -14px; top: 8px; bottom: 8px; width: 4px; border-radius: 0 3px 3px 0; background: var(--accent); }
.sidebar__link.is-active .icon { color: var(--accent-bright); }
.sidebar__count { margin-left: auto; font-size: 0.78rem; color: var(--text-dim); font-variant-numeric: tabular-nums; }
.sidebar__user {
	display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: var(--radius);
	background: rgba(0, 0, 0, 0.3); border: 1px solid var(--edge-soft);
}
.sidebar__avatar { width: 40px; height: 40px; flex: none; border-radius: var(--radius-s); object-fit: cover; background: var(--surface-3); display: grid; place-items: center; color: var(--text-dim); }
.sidebar__who { display: grid; min-width: 0; flex: 1; }
.sidebar__name { color: var(--text); text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar__name:hover { color: var(--gold); }
.sidebar__access { font-size: 0.75rem; color: var(--text-dim); }
.sidebar__server { padding-block: 8px; gap: 10px; font-size: 0.92rem; }
.sidebar__server .status-dot { margin-inline: 4px 2px; }
.sidebar__server-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar__server.is-foreign { opacity: 0.6; }
.sidebar-scrim { position: fixed; inset: 0; z-index: 35; background: rgba(0, 0, 0, 0.55); }

.admin-main { min-width: 0; display: flex; flex-direction: column; }
.admin-topbar {
	position: sticky; top: 0; z-index: 30;
	display: flex; align-items: center; gap: 14px; min-height: 68px; padding: 10px clamp(16px, 2.5vw, 32px);
	background: rgba(21, 17, 15, 0.82); backdrop-filter: blur(10px);
	border-bottom: 1px solid rgba(0, 0, 0, 0.5); box-shadow: 0 1px 0 var(--edge-soft);
}
.admin-topbar__menu { display: none; }
.admin-topbar__titles { display: grid; min-width: 0; }
.admin-topbar__crumb { font-size: 0.72rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--text-dim); }
.admin-topbar__title { font-family: var(--font-display); font-size: 1.55rem; letter-spacing: 0.04em; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.admin-topbar__actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.admin-content { width: 100%; max-width: 1680px; padding: clamp(16px, 2.5vw, 32px); display: grid; gap: clamp(16px, 2vw, 24px); align-content: start; }

@media (max-width: 960px) {
	.admin-shell { grid-template-columns: minmax(0, 1fr); }
	.sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: min(86vw, var(--sidebar-width)); transform: translateX(-102%); transition: transform 200ms ease; }
	.sidebar.is-open { transform: none; }
	.admin-topbar__menu { display: inline-flex; }
}

/* -------------------------------------------------------------- key figures */

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr)); gap: 12px; }
.kpi {
	display: grid; gap: 6px; padding: 14px 16px; min-width: 0;
	background: linear-gradient(180deg, var(--surface-2), var(--surface-1));
	border: 1px solid var(--edge-soft); border-radius: var(--radius-l); box-shadow: var(--shadow);
}
.kpi__label { display: flex; align-items: center; gap: 8px; font-size: 0.74rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-muted); }
.kpi__label .icon { color: var(--accent-bright); }
.kpi__value { font-family: var(--font-display); font-size: 1.9rem; line-height: 1.05; letter-spacing: 0.03em; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi__value small { font-family: var(--font-ui); font-size: 0.95rem; color: var(--text-dim); letter-spacing: 0; }
.kpi__value--small { font-family: var(--font-mono); font-size: 1rem; line-height: 1.9; }
.kpi__value.is-warn { color: var(--gold); }
.kpi__value.is-bad { color: var(--red-bright); }

/* ------------------------------------------------------------ server tiles */

.admin-section { display: grid; gap: 12px; }
.admin-section__head { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
.admin-section__title { font-family: var(--font-display); font-size: 1.4rem; letter-spacing: 0.04em; text-transform: uppercase; }
.admin-section__note { color: var(--text-dim); font-size: 0.9rem; }

.server-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); gap: 14px; }
.server-tile {
	display: grid; gap: 12px; padding: 16px; color: var(--text); text-decoration: none;
	background: linear-gradient(180deg, var(--surface-2), var(--surface-1));
	border: 1px solid var(--edge-soft); border-radius: var(--radius-l); box-shadow: var(--shadow);
	transition: border-color 120ms ease, transform 120ms ease;
}
.server-tile:hover { color: var(--text); border-color: rgba(207, 106, 50, 0.45); transform: translateY(-1px); }
.server-tile__top { display: flex; align-items: flex-start; gap: 10px; min-width: 0; }
.server-tile__name { font-family: var(--font-display); font-size: 1.1rem; line-height: 1.2; letter-spacing: 0.04em; text-transform: uppercase; overflow-wrap: anywhere; flex: 1; }
.server-tile__map { color: var(--text-muted); font-size: 0.9rem; display: flex; gap: 6px; align-items: center; }
.server-tile__bar { height: 8px; border-radius: 999px; background: rgba(0, 0, 0, 0.4); overflow: hidden; box-shadow: 0 0 0 1px var(--edge-soft) inset; }
.server-tile__fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--accent), var(--gold)); }
.server-tile__stats { display: flex; justify-content: space-between; gap: 10px; font-size: 0.85rem; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.server-tile__stats strong { color: var(--text); font-weight: normal; }
.server-tile--offline { opacity: 0.7; }

/* ------------------------------------------------------------- server page */

.server-head { display: flex; align-items: center; justify-content: space-between; gap: 12px 24px; flex-wrap: wrap; }
.server-head h2 { font-family: var(--font-display); font-size: clamp(1.5rem, 2.5vw, 2rem); letter-spacing: 0.04em; text-transform: uppercase; text-shadow: 0 2px 0 rgba(0, 0, 0, 0.6); }
.server-head__meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; color: var(--text-muted); }
.server-head__meta .sep { color: var(--text-dim); }
.server-head__hostname { color: var(--text-dim); }
.server-head__access .badge { font-size: 0.82rem; }

.server-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: clamp(16px, 2vw, 24px); align-items: start; }
@media (min-width: 1280px) { .server-layout { grid-template-columns: minmax(460px, 560px) minmax(0, 1fr); } }

/* ------------------------------------------------------------------ charts */

.chart-panel .panel__head { flex-wrap: wrap; }
.chart-panel .panel__head .icon { color: var(--accent-bright); width: 1.3em; height: 1.3em; }
.segmented { display: inline-flex; margin-left: auto; padding: 3px; gap: 2px; border-radius: var(--radius); background: rgba(0, 0, 0, 0.35); border: 1px solid var(--edge-soft); }
.segmented button {
	min-width: 48px; padding: 5px 12px; border: 0; border-radius: var(--radius-s); cursor: pointer;
	font: inherit; font-size: 0.85rem; letter-spacing: 0.04em; color: var(--text-muted); background: transparent;
}
.segmented button:hover { color: var(--text); }
.segmented button[aria-pressed="true"] { color: var(--text-on-accent); background: linear-gradient(180deg, var(--accent-bright), var(--accent)); box-shadow: var(--shadow-s); }

.chart-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 18px 24px; }
.chart-grid .chart { height: 168px; }
.chart-figure { margin: 0; min-width: 0; }
.chart-figure figcaption { margin-bottom: 6px; font-size: 0.78rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-muted); }
.chart { position: relative; height: 190px; min-width: 0; }
.chart--tall { height: 320px; }
.chart svg { display: block; width: 100%; height: 100%; overflow: visible; font-family: var(--font-ui); }
.chart .axis path, .chart .axis line { stroke: var(--chart-axis); }
.chart .axis text { fill: var(--text-dim); font-size: 11px; }
.chart .grid line { stroke: var(--chart-grid); }
.chart .grid path { display: none; }
.chart .line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .area { opacity: 0.16; }
.chart .reference { stroke: var(--text-dim); stroke-dasharray: 4 4; stroke-width: 1; }
.chart .reference-label { fill: var(--text-dim); font-size: 11px; }
.chart .end-label { font-size: 12px; fill: var(--text-muted); }
.chart .crosshair { stroke: var(--text-muted); stroke-width: 1; }
.chart .focus-dot { stroke: var(--surface-1); stroke-width: 2; }
.chart__empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--text-dim); font-style: italic; }
.chart-tooltip {
	position: absolute; z-index: 5; pointer-events: none; min-width: 140px;
	padding: 8px 10px; border-radius: var(--radius); font-size: 0.85rem;
	background: rgba(21, 17, 15, 0.94); border: 1px solid var(--edge); box-shadow: var(--shadow-s);
}
.chart-tooltip__time { color: var(--text-dim); font-size: 0.78rem; margin-bottom: 4px; }
.chart-tooltip__row { display: grid; grid-template-columns: 10px 1fr auto; align-items: center; gap: 8px; }
.chart-tooltip__swatch { width: 10px; height: 3px; border-radius: 2px; }
.chart-tooltip__row strong { font-weight: normal; color: var(--text); font-variant-numeric: tabular-nums; }
.chart-tooltip__row span { color: var(--text-muted); }
.chart-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 8px; font-size: 0.85rem; color: var(--text-muted); }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend i { width: 14px; height: 3px; border-radius: 2px; }
.chart-table { margin-top: 6px; font-size: 0.82rem; color: var(--text-muted); }
.chart-table summary { cursor: pointer; color: var(--text-dim); }
.chart-table table { width: 100%; border-collapse: collapse; margin-top: 6px; font-variant-numeric: tabular-nums; }
.chart-table th, .chart-table td { padding: 2px 8px; text-align: right; border-bottom: 1px solid var(--edge-soft); }
.chart-table th:first-child, .chart-table td:first-child { text-align: left; }

/* -------------------------------------------------------------- data tabs */

.data-panel { overflow: hidden; }
.tabs { display: flex; gap: 2px; padding: 0 12px; border-bottom: 1px solid rgba(0, 0, 0, 0.45); box-shadow: 0 1px 0 var(--edge-soft); overflow-x: auto; }
.tab {
	display: inline-flex; align-items: center; gap: 8px; padding: 14px 16px 12px; flex: none;
	font: inherit; font-size: 0.95rem; letter-spacing: 0.05em; text-transform: uppercase;
	color: var(--text-muted); background: none; border: 0; border-bottom: 3px solid transparent; cursor: pointer;
}
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }
.tab[aria-selected="true"] .icon { color: var(--accent-bright); }
.tab__count { font-size: 0.75rem; padding: 0 7px; border-radius: 999px; background: rgba(236, 227, 203, 0.08); color: var(--text-muted); letter-spacing: 0; }
.tab__count:empty { display: none; }
.tab-pane { padding: 14px 16px 16px; }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-bottom: 12px; }
.search { position: relative; display: flex; align-items: center; flex: 1 1 260px; max-width: 420px; }
.search .icon { position: absolute; left: 12px; color: var(--text-dim); pointer-events: none; }
.search input, .select select {
	width: 100%; min-height: 38px; font: inherit; font-size: 0.95rem; color: var(--text);
	background: rgba(0, 0, 0, 0.35); border: 1px solid var(--edge); border-radius: var(--radius-s);
}
.search input { padding: 6px 12px 6px 36px; }
.search input:focus, .select select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.select { display: inline-flex; align-items: center; gap: 8px; font-size: 0.85rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; }
.select select { width: auto; padding: 6px 10px; text-transform: none; letter-spacing: 0; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 0.9rem; color: var(--text-muted); cursor: pointer; }
.check input { accent-color: var(--accent); width: 16px; height: 16px; }
.check code { font-family: var(--font-mono); font-size: 0.85em; color: var(--text); }
.toolbar__count { margin-left: auto; font-size: 0.85rem; color: var(--text-dim); font-variant-numeric: tabular-nums; }
.table__state { padding: 28px; text-align: center; color: var(--text-dim); font-style: italic; }

/* --------------------------------------------------------------- Tabulator */

.data-panel .tabulator {
	font-size: 0.9rem; background: transparent; border: 1px solid var(--edge-soft); border-radius: var(--radius);
	color: var(--text);
}
.data-panel .tabulator .tabulator-header { background: var(--surface-3); color: var(--text-muted); border-bottom: 1px solid rgba(0, 0, 0, 0.5); font-weight: normal; }
.data-panel .tabulator .tabulator-header .tabulator-col { background: transparent; border-right: 1px solid rgba(0, 0, 0, 0.25); }
.data-panel .tabulator .tabulator-header .tabulator-col .tabulator-col-content { padding: 9px 12px; }
.data-panel .tabulator .tabulator-header .tabulator-col .tabulator-col-title { font-size: 0.75rem; letter-spacing: 0.1em; text-transform: uppercase; }
.data-panel .tabulator .tabulator-header .tabulator-col.tabulator-sortable:hover { background: rgba(236, 227, 203, 0.05); }
.data-panel .tabulator .tabulator-header .tabulator-col .tabulator-col-content .tabulator-col-sorter .tabulator-arrow { border-bottom-color: var(--text-dim); }
.data-panel .tabulator .tabulator-header .tabulator-col[aria-sort="ascending"] .tabulator-col-content .tabulator-col-sorter .tabulator-arrow { border-bottom-color: var(--accent-bright); }
.data-panel .tabulator .tabulator-header .tabulator-col[aria-sort="descending"] .tabulator-col-content .tabulator-col-sorter .tabulator-arrow { border-top-color: var(--accent-bright); }
.data-panel .tabulator .tabulator-tableholder { background: transparent; }
.data-panel .tabulator .tabulator-tableholder .tabulator-table { background: transparent; color: var(--text); }
.data-panel .tabulator-row { background: transparent; border-bottom: 1px solid rgba(0, 0, 0, 0.28); min-height: 36px; }
.data-panel .tabulator-row.tabulator-row-even { background: rgba(0, 0, 0, 0.14); }
.data-panel .tabulator-row.tabulator-selectable:hover, .data-panel .tabulator-row:hover { background: rgba(207, 106, 50, 0.08); }
.data-panel .tabulator-row .tabulator-cell { border-right: 0; padding: 8px 12px; }
.data-panel .tabulator .tabulator-tableholder .tabulator-placeholder .tabulator-placeholder-contents { color: var(--text-dim); font-size: 1rem; font-weight: normal; font-style: italic; }
.data-panel .tabulator .tabulator-col-resize-handle:hover { background: var(--accent-soft); }

.cell-mono { font-family: var(--font-mono); font-size: 0.86em; }
.cell-value { font-family: var(--font-mono); font-size: 0.86em; color: var(--gold); }
.cell-muted { color: var(--text-muted); }
.cell-flags { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; }
.tabulator-cell .cell-flags:has(> span:first-child:not(.flag)) { flex-wrap: nowrap; }
.flag { padding: 0 6px; border-radius: 3px; font-size: 0.72rem; line-height: 1.6; letter-spacing: 0.03em; color: var(--text-muted); background: rgba(236, 227, 203, 0.07); border: 1px solid var(--edge-soft); }
.flag--cheat, .flag--protected { color: var(--red-bright); border-color: rgba(184, 56, 59, 0.4); }
.flag--replicated, .flag--notify { color: var(--blu-bright); border-color: rgba(88, 133, 162, 0.4); }
.team-pill { display: inline-block; min-width: 42px; padding: 0 8px; border-radius: 3px; font-size: 0.75rem; text-align: center; letter-spacing: 0.06em; color: #fff; background: var(--surface-4); }
.team-pill--red { background: var(--red); }
.team-pill--blue { background: var(--blu); }
.class-icon { width: 22px; height: 22px; vertical-align: middle; }
.cell-link { color: var(--text); text-decoration: none; }
.cell-link:hover { color: var(--gold); }

/* --------------------------------------------------------------------- gate */

.gate { min-height: calc(100vh - var(--topbar-height) - 120px); display: grid; place-items: center; padding: 48px 16px; }
.gate__card { width: min(100%, 520px); padding: clamp(28px, 5vw, 48px); display: grid; justify-items: center; gap: 16px; text-align: center; }
.gate__emblem { filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.6)); }
.gate__avatar { border-radius: var(--radius); box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.5), 0 0 0 4px var(--edge); }
.gate__title { font-family: var(--font-display); font-size: 2rem; letter-spacing: 0.04em; text-transform: uppercase; }
.gate__text { margin: 0; color: var(--text-muted); line-height: 1.6; }
.gate__text code { font-family: var(--font-mono); font-size: 0.9em; color: var(--text); }
.gate__problem { margin: 0; padding: 10px 14px; border-radius: var(--radius); color: var(--text); background: var(--red-soft); border: 1px solid rgba(184, 56, 59, 0.45); }
.gate__back { color: var(--text-muted); font-size: 0.92rem; }
.gate__actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }

.notice { display: flex; align-items: center; gap: 14px; color: var(--text-muted); }
.notice p { margin: 0; }
.notice .icon { width: 1.6em; height: 1.6em; color: var(--gold); flex: none; }

/* ---------------------------------------------------------- server tabs */

.page-tabs {
	position: sticky; top: 68px; z-index: 20;
	display: flex; gap: 2px; overflow-x: auto; scrollbar-width: thin;
	margin-inline: calc(-1 * clamp(16px, 2.5vw, 32px)); padding: 0 clamp(16px, 2.5vw, 32px);
	background: rgba(21, 17, 15, 0.86); backdrop-filter: blur(10px);
	border-bottom: 1px solid rgba(0, 0, 0, 0.5); box-shadow: 0 1px 0 var(--edge-soft);
}
.page-tab {
	display: inline-flex; align-items: center; gap: 8px; flex: none; padding: 13px 14px 11px;
	color: var(--text-muted); text-decoration: none; font-size: 0.92rem; letter-spacing: 0.05em; text-transform: uppercase;
	border-bottom: 3px solid transparent; transition: color 120ms ease, border-color 120ms ease;
}
.page-tab:hover { color: var(--text); }
.page-tab.is-active { color: var(--text); border-bottom-color: var(--accent); }
.page-tab.is-active .icon { color: var(--accent-bright); }
.tab-panes { display: grid; grid-template-columns: minmax(0, 1fr); }
.pane { display: grid; grid-template-columns: minmax(0, 1fr); gap: clamp(16px, 2vw, 24px); align-content: start; min-width: 0; }
.pane > * { min-width: 0; }
.pane__hint { margin: 0; color: var(--text-dim); font-size: 0.85rem; }
.panel__note { margin-left: auto; color: var(--text-dim); font-size: 0.85rem; }
.panel__head:has(.panel__note) { flex-wrap: wrap; }
.panel__text { margin: 0; color: var(--text-muted); font-size: 0.92rem; line-height: 1.5; }
.panel__head > .icon { color: var(--accent-bright); width: 1.3em; height: 1.3em; }

/* --------------------------------------------------------------- controls */

.input {
	width: 100%; min-height: 38px; padding: 6px 12px; font: inherit; font-size: 0.95rem; color: var(--text);
	background: rgba(0, 0, 0, 0.35); border: 1px solid var(--edge); border-radius: var(--radius-s);
}
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input:disabled { opacity: 0.5; cursor: not-allowed; }
textarea.input { resize: vertical; line-height: 1.45; }
select.input { padding-right: 28px; }
.input--narrow { width: 88px; flex: none; }
.field { display: grid; gap: 6px; min-width: 0; }
.field__label { font-size: 0.74rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-muted); }
.field__help { font-size: 0.82rem; color: var(--text-dim); }
.stack { display: grid; gap: 16px; align-content: start; }
.inline-form { display: flex; align-items: center; gap: 8px; min-width: 0; }
.inline-form .input { min-width: 0; }
.toolbar .inline-form { margin-left: 0; }
.toolbar .inline-form .input { width: 200px; min-height: 32px; }
.unit { color: var(--text-dim); font-size: 0.88rem; }
.button-row { display: flex; flex-wrap: wrap; gap: 8px; }
.link-button {
	display: inline-flex; align-items: center; gap: 6px; justify-self: start; padding: 0; border: 0; background: none; cursor: pointer;
	font: inherit; font-size: 0.9rem; color: var(--gold);
}
.link-button .icon { transform: rotate(-90deg); }
.link-button:hover { color: #f3cc6a; }
.btn--danger { --btn-bg: linear-gradient(180deg, var(--red-bright), var(--red)); --btn-fg: #fff; text-shadow: 0 1px 0 rgba(0, 0, 0, 0.35); }
.btn--ghost.btn--danger { --btn-bg: transparent; --btn-fg: var(--red-bright); border-color: rgba(184, 56, 59, 0.5); }
.btn.is-busy { opacity: 0.7; pointer-events: none; cursor: progress; }
.btn.is-busy .icon { animation: spin 900ms linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.segmented--left { margin-left: 0; flex-wrap: wrap; max-width: 100%; }
.switch {
	appearance: none; flex: none; position: relative; width: 44px; height: 24px; margin: 0; cursor: pointer;
	border-radius: 999px; background: var(--surface-4); border: 1px solid var(--edge); transition: background-color 150ms ease;
}
.switch::after {
	content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%;
	background: var(--text-muted); box-shadow: var(--shadow-s); transition: transform 150ms ease, background-color 150ms ease;
}
.switch:checked { background: var(--accent); border-color: rgba(0, 0, 0, 0.4); }
.switch:checked::after { transform: translateX(20px); background: var(--text-on-accent); }
.switch:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.switch:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---------------------------------------------------------------- connect */

.connect-grid { display: grid; gap: 10px; }
.connect-row { display: grid; grid-template-columns: 96px minmax(0, 1fr) auto auto; align-items: center; gap: 10px 14px; }
.connect-row__label { font-size: 0.78rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-muted); }
.connect-row__address { font-family: var(--font-mono); font-size: 0.95rem; color: var(--gold); overflow-wrap: anywhere; }
@media (max-width: 640px) {
	.connect-row { grid-template-columns: minmax(0, 1fr) auto; }
	.connect-row__label { grid-column: 1 / -1; }
}

/* ----------------------------------------------------------------- manage */

.manage-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: clamp(16px, 2vw, 24px); align-items: start; }
.manage-grid > * { min-width: 0; }
.manage-grid__wide { grid-column: 1 / -1; }
@media (min-width: 1100px) { .manage-grid__double { grid-column: span 2; } }
.manage-facts { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; margin: 0; }
.manage-facts > div { padding: 10px 12px; border-radius: var(--radius); background: rgba(0, 0, 0, 0.25); border: 1px solid var(--edge-soft); min-width: 0; }
.manage-facts dt { font-size: 0.72rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-dim); }
.manage-facts dd { margin: 2px 0 0; }
.manage-value { font-family: var(--font-mono); font-weight: normal; font-size: 0.95rem; overflow-wrap: anywhere; }
.danger-zone {
	display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px;
	padding: 12px 14px; border-radius: var(--radius); background: var(--red-soft); border: 1px solid rgba(184, 56, 59, 0.35);
}
.danger-zone > div { flex: 1 1 200px; display: grid; gap: 2px; }

.config-list { display: grid; gap: 2px; max-height: 420px; overflow-y: auto; padding-right: 4px; }
.config-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto auto; align-items: center; gap: 12px; padding: 7px 10px; border-radius: var(--radius-s); }
.config-row:nth-child(even) { background: rgba(0, 0, 0, 0.14); }
.config-row:hover { background: rgba(207, 106, 50, 0.08); }
.config-row > .icon { color: var(--text-dim); }
.config-row__name { font-family: var(--font-mono); font-size: 0.9rem; overflow-wrap: anywhere; }
.config-row__size { color: var(--text-dim); font-size: 0.82rem; font-variant-numeric: tabular-nums; }

.settings { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 20px 28px; }
.settings__group { margin: 0; padding: 0; border: 0; display: grid; gap: 4px; align-content: start; min-width: 0; }
.settings__group legend { margin-bottom: 8px; font-family: var(--font-display); font-size: 1.05rem; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-muted); }
.setting { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); align-items: center; gap: 8px 16px; padding: 10px 12px; border-radius: var(--radius); border: 1px solid transparent; }
.setting:nth-of-type(odd) { background: rgba(0, 0, 0, 0.14); }
.setting.is-changed { border-color: rgba(227, 179, 62, 0.35); background: var(--gold-soft); }
.setting__label { display: grid; gap: 1px; min-width: 0; }
.setting__label label { color: var(--text); }
.setting__cvar { font-family: var(--font-mono); font-size: 0.78rem; color: var(--text-dim); }
.setting__help { font-size: 0.8rem; color: var(--text-dim); line-height: 1.35; }
.setting__control { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-width: 0; }
.setting__control .input { flex: 1 1 140px; min-height: 34px; }
@media (max-width: 560px) { .setting { grid-template-columns: minmax(0, 1fr); } }

/* ---------------------------------------------------------------- players */

.row-actions { display: inline-flex; gap: 2px; justify-content: flex-end; }
.row-actions .btn--icon { min-height: 30px; width: 30px; border-color: transparent; }
.row-actions .btn--icon:hover { border-color: var(--edge); }
.flag--sdr { color: var(--gold); border-color: rgba(227, 179, 62, 0.35); }
.cell-bad { color: var(--red-bright); }
.ban-form { display: grid; grid-template-columns: minmax(200px, 1.4fr) minmax(140px, 0.6fr) minmax(200px, 1.6fr) auto; align-items: end; gap: 12px; }
@media (max-width: 960px) { .ban-form { grid-template-columns: 1fr 1fr; } .ban-form__reason { grid-column: 1 / -1; } }
@media (max-width: 560px) { .ban-form { grid-template-columns: 1fr; } }

.menu {
	position: absolute; z-index: 80; min-width: 220px; padding: 6px; display: grid; gap: 2px;
	background: var(--surface-2); border: 1px solid var(--edge); border-radius: var(--radius); box-shadow: var(--shadow);
}
.menu__item {
	display: grid; gap: 1px; padding: 8px 10px; text-align: left; cursor: pointer;
	font: inherit; font-size: 0.92rem; color: var(--text); background: transparent; border: 0; border-radius: var(--radius-s);
}
.menu__item small { color: var(--text-dim); font-size: 0.78rem; }
.menu__item:hover, .menu__item:focus-visible { background: var(--accent-soft); outline: none; }

/* ------------------------------------------------------------------- chat */

.chat-panel { display: grid; grid-template-rows: minmax(0, 1fr) auto; height: min(70vh, 720px); min-height: 360px; overflow: hidden; }
.chat-log { overflow-y: auto; padding: 14px 18px; display: grid; align-content: start; gap: 3px; font-size: 0.95rem; background: rgba(0, 0, 0, 0.22); }
.chat-log__empty { margin: auto; color: var(--text-dim); font-style: italic; text-align: center; }
.chat-line { display: grid; grid-template-columns: 70px auto auto minmax(0, 1fr); align-items: baseline; gap: 8px; padding: 3px 6px; border-radius: var(--radius-s); }
.chat-line:not(:has(.chat-line__badge)) { grid-template-columns: 70px auto minmax(0, 1fr); }
.chat-line:hover { background: rgba(236, 227, 203, 0.04); }
.chat-line__time { color: var(--text-dim); font-family: var(--font-mono); font-size: 0.76rem; }
.chat-line__name { font-weight: bold; white-space: nowrap; }
.chat-line__name::after { content: ":"; color: var(--text-dim); font-weight: normal; }
.chat-line__text { overflow-wrap: anywhere; }
.chat-line--red .chat-line__name { color: var(--red-bright); }
.chat-line--blue .chat-line__name { color: var(--blu-bright); }
.chat-line--none .chat-line__name { color: var(--text-muted); }
.chat-line__badge { padding: 0 6px; border-radius: 3px; font-size: 0.7rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted); background: rgba(236, 227, 203, 0.07); border: 1px solid var(--edge-soft); }
.chat-line--admin { background: var(--accent-soft); }
.chat-line--admin .chat-line__name { color: var(--accent-bright); }
.chat-line--admin .chat-line__badge { color: var(--accent-bright); border-color: rgba(207, 106, 50, 0.35); }
.chat-line.is-failed { opacity: 0.55; text-decoration: line-through; }
.chat-compose { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; padding: 12px; border-top: 1px solid rgba(0, 0, 0, 0.45); box-shadow: 0 -1px 0 var(--edge-soft); }
.chat-compose .select select { min-height: 40px; }
@media (max-width: 640px) { .chat-compose { grid-template-columns: 1fr auto; } .chat-compose .select { grid-column: 1 / -1; } }

/* --------------------------------------------------------------- terminal */

.terminal {
	--term-bg: #0d0b0a; --term-fg: #d9d2bf; --term-dim: #7f766a; --term-prompt: #e3b33e; --term-ok: #9fd16a; --term-bad: #ff7b72;
	display: grid; grid-template-rows: auto minmax(0, 1fr) auto; grid-template-columns: minmax(0, 1fr); height: min(72vh, 760px); min-height: 380px; min-width: 0;
	background: var(--term-bg); border: 1px solid #000; border-radius: var(--radius-l); overflow: hidden;
	box-shadow: 0 0 0 1px var(--edge-soft), var(--shadow);
	font-family: var(--font-mono); font-size: 0.88rem; color: var(--term-fg);
}
.terminal__bar { display: flex; align-items: center; gap: 14px; padding: 8px 12px; background: linear-gradient(180deg, #2b2420, #1b1714); border-bottom: 1px solid #000; font-family: var(--font-ui); }
.terminal__lights { display: inline-flex; gap: 6px; }
.terminal__lights i { width: 11px; height: 11px; border-radius: 50%; background: #5a4c42; }
.terminal__lights i:first-child { background: var(--red); }
.terminal__lights i:nth-child(2) { background: var(--gold); }
.terminal__lights i:last-child { background: var(--good); }
.terminal__title { flex: 1; min-width: 0; color: var(--text-muted); font-size: 0.85rem; letter-spacing: 0.04em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.terminal__toggle { font-size: 0.85rem; }
.terminal__screen { overflow-y: auto; padding: 12px 16px; line-height: 1.45; cursor: text; }
.terminal__screen:focus-visible { outline: none; box-shadow: inset 0 0 0 1px var(--accent); }
.term-entry { margin-bottom: 10px; }
.term-command { color: var(--term-prompt); white-space: pre-wrap; overflow-wrap: anywhere; }
.term-caret { color: var(--term-dim); margin-right: 8px; }
.term-output { margin: 2px 0 0; padding: 0 0 0 16px; border-left: 2px solid #2a231f; white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; color: var(--term-fg); }
.term-output.is-waiting { color: var(--term-dim); animation: pulse 1.2s ease-in-out infinite; }
.term-output.is-error { color: var(--term-bad); border-left-color: rgba(255, 123, 114, 0.4); }
.term-output.is-empty { color: var(--term-dim); font-style: italic; }
@keyframes pulse { 50% { opacity: 0.4; } }
.term-note { color: var(--term-dim); font-style: italic; margin-bottom: 8px; }
.term-note.is-error { color: var(--term-bad); }
.term-log { color: #a89f8e; white-space: pre-wrap; overflow-wrap: anywhere; }
.term-log__time { color: #5d554c; margin-right: 10px; }
.terminal__prompt { position: relative; display: flex; align-items: center; gap: 10px; padding: 10px 12px 10px 16px; background: #15110f; border-top: 1px solid #2a231f; }
.terminal__caret { color: var(--term-prompt); font-weight: bold; }
.terminal__input { flex: 1; min-width: 0; padding: 6px 0; border: 0; outline: none; background: transparent; color: var(--term-fg); font: inherit; caret-color: var(--term-prompt); }
.terminal__input::placeholder { color: #4d453e; }
.terminal__input:disabled { cursor: not-allowed; }
.terminal__suggestions {
	position: absolute; left: 36px; bottom: calc(100% + 4px); z-index: 5; margin: 0; padding: 4px; list-style: none; min-width: min(420px, 80%);
	background: #1d1815; border: 1px solid #3b322b; border-radius: var(--radius); box-shadow: var(--shadow);
}
.terminal__suggestion { display: flex; justify-content: space-between; gap: 18px; padding: 5px 10px; border-radius: var(--radius-s); cursor: pointer; }
.terminal__suggestion small { color: var(--term-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 50%; }
.terminal__suggestion.is-selected, .terminal__suggestion:hover { background: rgba(227, 179, 62, 0.14); color: var(--term-prompt); }

/* ------------------------------------------------------------------- maps */

.upload { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; }
@media (max-width: 900px) { .upload { grid-template-columns: minmax(0, 1fr); } }
.dropzone {
	display: grid; justify-items: center; align-content: center; gap: 6px; min-height: 170px; padding: 20px; text-align: center; cursor: pointer;
	border: 2px dashed var(--edge); border-radius: var(--radius-l); background: rgba(0, 0, 0, 0.22);
	transition: border-color 120ms ease, background-color 120ms ease;
}
.dropzone:hover, .dropzone.is-over { border-color: var(--accent); background: var(--accent-soft); }
.dropzone:focus-within { border-color: var(--gold); }
.dropzone.is-disabled { opacity: 0.5; cursor: not-allowed; pointer-events: none; }
.dropzone__icon { width: 2.4em; height: 2.4em; color: var(--accent-bright); }
.dropzone__text strong { color: var(--text); }
.dropzone__text { color: var(--text-muted); }
.dropzone__hint { color: var(--text-dim); font-size: 0.82rem; max-width: 46ch; }
.upload__side { display: grid; gap: 12px; align-content: start; min-width: 0; }
.upload__jobs { display: grid; gap: 8px; }
.upload-job { display: grid; gap: 8px; padding: 12px 14px; border-radius: var(--radius); background: rgba(0, 0, 0, 0.28); border: 1px solid var(--edge-soft); }
.upload-job.is-done { border-color: rgba(126, 163, 77, 0.45); }
.upload-job.is-failed { border-color: rgba(184, 56, 59, 0.5); }
.upload-job__head { display: flex; align-items: center; gap: 10px; min-width: 0; }
.upload-job__head strong { font-family: var(--font-mono); font-weight: normal; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-job__size { color: var(--text-dim); font-size: 0.82rem; }
.upload-job__state { margin-left: auto; font-size: 0.78rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-muted); }
.upload-job.is-done .upload-job__state { color: #a6cf6f; }
.upload-job.is-failed .upload-job__state, .upload-job__error { color: var(--red-bright); }
.upload-job__error { margin: 0; font-size: 0.88rem; }
.upload-job .btn--icon { min-height: 26px; width: 26px; }
.progress { display: grid; grid-template-columns: 76px minmax(0, 1fr) 70px; align-items: center; gap: 10px; font-size: 0.8rem; }
.progress__label { color: var(--text-muted); letter-spacing: 0.08em; text-transform: uppercase; }
.progress__track { height: 8px; border-radius: 999px; background: rgba(0, 0, 0, 0.45); overflow: hidden; box-shadow: 0 0 0 1px var(--edge-soft) inset; }
.progress__fill { display: block; width: 0; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--accent), var(--gold)); transition: width 200ms ease; }
.upload-job.is-done .progress__fill { background: var(--good); }
.upload-job.is-failed .progress__fill { background: var(--red); }
.progress__value { text-align: right; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.upload-past { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; padding: 6px 2px; font-size: 0.85rem; color: var(--text-muted); border-top: 1px solid var(--edge-soft); }
.upload-past strong { font-family: var(--font-mono); font-weight: normal; color: var(--text); }
.upload-past time { margin-left: auto; color: var(--text-dim); }
.upload-past.is-failed strong { color: var(--red-bright); }
.upload-past__error { flex-basis: 100%; color: var(--red-bright); font-size: 0.8rem; }

.maps-toolbar { margin-bottom: 0; }
.map-sections { display: grid; gap: 26px; }
.map-section { display: grid; gap: 12px; }
.map-section__title { display: flex; align-items: center; gap: 10px; font-family: var(--font-display); font-size: 1.2rem; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-muted); }
.map-section__count { font-family: var(--font-ui); font-size: 0.78rem; padding: 0 8px; border-radius: 999px; background: rgba(236, 227, 203, 0.08); letter-spacing: 0; }
.map-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); gap: 14px; }
.map-tile {
	display: grid; grid-template-rows: auto 1fr; overflow: hidden; min-width: 0;
	background: linear-gradient(180deg, var(--surface-2), var(--surface-1));
	border: 1px solid var(--edge-soft); border-radius: var(--radius-l); box-shadow: var(--shadow);
	transition: border-color 120ms ease, transform 120ms ease;
}
.map-tile:hover { border-color: rgba(207, 106, 50, 0.4); transform: translateY(-1px); }
.map-tile.is-current { border-color: rgba(126, 163, 77, 0.6); box-shadow: 0 0 0 1px rgba(126, 163, 77, 0.35), var(--shadow); }
.map-tile__art {
	position: relative; aspect-ratio: 16 / 10; display: grid; place-items: center; overflow: hidden;
	background:
		radial-gradient(circle at 30% 20%, rgba(207, 106, 50, 0.16), transparent 60%),
		repeating-linear-gradient(45deg, rgba(236, 227, 203, 0.03) 0 8px, transparent 8px 16px),
		#120f0d;
	border-bottom: 1px solid rgba(0, 0, 0, 0.5);
}
.map-tile__image { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; padding: 6px; z-index: 1; }
.map-tile__mode { font-family: var(--font-display); font-size: 2.2rem; letter-spacing: 0.06em; text-transform: uppercase; color: rgba(236, 227, 203, 0.14); }
.map-tile__body { display: grid; gap: 8px; padding: 10px 12px 12px; align-content: start; }
.map-tile__name { font-family: var(--font-mono); font-size: 0.92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.map-tile__badges { display: flex; gap: 6px; min-height: 0; }
.map-tile__badges:empty { display: none; }
.map-tile__facts { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 0.8rem; color: var(--text-dim); }
.map-tile__facts span { display: inline-flex; align-items: center; gap: 4px; }
.map-tile__facts .is-warn { color: var(--gold); }
.map-tile__actions { display: flex; gap: 6px; margin-top: 2px; }
.map-tile__actions .btn { flex: 1; }

/* ---------------------------------------------------------------- plugins */

.split { display: grid; grid-template-columns: minmax(0, 1fr); gap: clamp(16px, 2vw, 24px); align-items: start; }
@media (min-width: 1200px) { .split.is-open { grid-template-columns: minmax(0, 1fr) minmax(380px, 460px); } }
.drawer { position: sticky; top: 130px; max-height: calc(100vh - 150px); overflow-y: auto; padding: 18px; display: grid; gap: 14px; align-content: start; }
.drawer__loading { padding: 24px 0; }
.drawer__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.drawer__head > div { display: grid; gap: 6px; justify-items: start; }
.drawer__title { font-family: var(--font-display); font-size: 1.35rem; letter-spacing: 0.04em; text-transform: uppercase; overflow-wrap: anywhere; }
.drawer__description { margin: 0; color: var(--text-muted); }
.drawer__error { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: var(--radius); background: var(--red-soft); border: 1px solid rgba(184, 56, 59, 0.45); font-size: 0.9rem; }
.drawer__error .icon { color: var(--red-bright); margin-top: 3px; }
.drawer__section { display: flex; align-items: center; gap: 8px; margin-top: 6px; padding-top: 12px; border-top: 1px solid var(--edge-soft); font-family: var(--font-display); font-size: 1.05rem; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-muted); }
.drawer__list { display: grid; gap: 8px; }
.drawer__item { display: grid; gap: 6px; padding: 10px 12px; border-radius: var(--radius); background: rgba(0, 0, 0, 0.22); border: 1px solid var(--edge-soft); }
.drawer__item.is-changed { border-color: rgba(227, 179, 62, 0.4); }
.drawer__item-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.drawer__name { font-family: var(--font-mono); font-size: 0.9rem; color: var(--gold); overflow-wrap: anywhere; }
.drawer__help { margin: 0; color: var(--text-dim); font-size: 0.84rem; line-height: 1.4; }
.drawer__item .input { min-height: 32px; font-family: var(--font-mono); font-size: 0.88rem; }
.drawer__output { margin: 0; padding: 8px 10px; max-height: 220px; overflow: auto; border-radius: var(--radius-s); background: #0d0b0a; color: #d9d2bf; font-family: var(--font-mono); font-size: 0.82rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.drawer__output.is-error { color: #ff7b72; }
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 16px; margin: 0; font-size: 0.9rem; }
.facts dt { font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-dim); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.facts code { font-family: var(--font-mono); font-size: 0.88em; }
.data-panel .tabulator-row { cursor: default; }
[data-table="plugins"] .tabulator-row { cursor: pointer; }
.table-more { display: flex; justify-content: center; padding-top: 12px; }

/* ----------------------------------------------------------------- dialog */

.dialog {
	width: min(100% - 32px, 480px); padding: 0; color: var(--text);
	background: linear-gradient(180deg, var(--surface-3), var(--surface-2));
	border: 1px solid var(--edge); border-radius: var(--radius-l); box-shadow: 0 24px 60px rgba(0, 0, 0, 0.65);
}
.dialog::backdrop { background: rgba(10, 8, 7, 0.7); backdrop-filter: blur(3px); }
.dialog[open] { animation: dialog-in 140ms ease-out; }
@keyframes dialog-in { from { opacity: 0; transform: translateY(8px) scale(0.98); } }
.dialog__form { display: grid; }
.dialog__head { padding: 18px 20px 0; }
.dialog__title { font-family: var(--font-display); font-size: 1.35rem; letter-spacing: 0.04em; text-transform: uppercase; overflow-wrap: anywhere; }
.dialog__body { display: grid; gap: 14px; padding: 14px 20px 6px; }
.dialog__body:empty { display: none; }
.dialog__text { margin: 0; color: var(--text-muted); line-height: 1.55; }
.dialog__actions { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 20px 18px; }

/* ----------------------------------------------------------------- toasts */

.toasts { position: fixed; right: 16px; top: 80px; z-index: 90; display: grid; gap: 8px; width: min(100% - 32px, 400px); pointer-events: none; }
.toast {
	display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: start; gap: 10px; padding: 12px 12px 12px 14px;
	background: var(--surface-3); border: 1px solid var(--edge); border-left: 4px solid var(--good); border-radius: var(--radius);
	box-shadow: var(--shadow); pointer-events: auto; animation: toast-in 160ms ease-out; transition: opacity 300ms ease, transform 300ms ease;
}
.toast > .icon { margin-top: 3px; color: #a6cf6f; }
.toast--bad { border-left-color: var(--red-bright); }
.toast--bad > .icon { color: var(--red-bright); }
.toast__text { overflow-wrap: anywhere; line-height: 1.45; }
.toast__close { padding: 2px; border: 0; background: none; color: var(--text-dim); cursor: pointer; border-radius: var(--radius-s); }
.toast__close:hover { color: var(--text); }
.toast.is-leaving { opacity: 0; transform: translateY(6px); }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } }

/* A control without the admin flag stays hoverable, so its title says why. */
.btn[aria-disabled="true"][title] { pointer-events: auto; cursor: not-allowed; }

/* ------------------------------------------------- our plugins: the match */

.match-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr); gap: 16px 24px; align-items: start; }
@media (max-width: 900px) { .match-grid { grid-template-columns: minmax(0, 1fr); } }
.match-teams { display: grid; gap: 8px; }
.match-team { display: grid; grid-template-columns: 46px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--radius); border-left: 4px solid; }
.match-team--red { background: var(--red-soft); border-color: var(--red); }
.match-team--blue { background: var(--blu-soft); border-color: var(--blu); }
.match-team__side { font-family: var(--font-display); letter-spacing: 0.06em; color: var(--text-muted); }
.match-team__name { font-weight: normal; font-size: 1.05rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.match-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin: 0; }
.match-fact { padding: 10px 12px; border-radius: var(--radius); background: rgba(0, 0, 0, 0.25); border: 1px solid var(--edge-soft); min-width: 0; }
.match-fact dt { font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-dim); }
.match-fact dd { margin: 2px 0 0; font-family: var(--font-display); font-size: 1.35rem; letter-spacing: 0.03em; font-variant-numeric: tabular-nums; }
.match-fact small { display: block; color: var(--gold); font-size: 0.78rem; }

/* ------------------------------------------- our plugins: the recorder */

.notice-line { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 0.9rem; color: var(--text-muted); }
.notice-line.is-warn { color: var(--gold); }
.stv-status { display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; border-radius: var(--radius); background: rgba(0, 0, 0, 0.25); border: 1px solid var(--edge-soft); }
.stv-status.is-recording { border-color: rgba(224, 88, 91, 0.45); background: var(--red-soft); }
.stv-status__text { display: grid; gap: 2px; min-width: 0; font-size: 0.9rem; color: var(--text-muted); }
.stv-status__text strong { color: var(--text); font-weight: normal; }
.stv-status__text code { font-family: var(--font-mono); font-size: 0.85rem; color: var(--gold); overflow-wrap: anywhere; }
.rec-dot { flex: none; width: 12px; height: 12px; margin-top: 4px; border-radius: 50%; background: var(--red-bright); box-shadow: 0 0 0 4px rgba(224, 88, 91, 0.2); animation: pulse 1.4s ease-in-out infinite; }
.rec-dot.is-idle { background: var(--text-dim); box-shadow: none; animation: none; }
.stv-wait { display: grid; gap: 8px; padding: 10px 12px; border-radius: var(--radius); background: var(--gold-soft); border: 1px solid rgba(227, 179, 62, 0.35); font-size: 0.9rem; }
.demo-list { display: grid; gap: 4px; }
.demo-list__title { margin: 4px 0 4px; font-size: 0.74rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-muted); font-weight: normal; }
.demo-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 2px 10px; padding: 6px 8px; border-radius: var(--radius-s); }
.demo-row__facts { grid-column: 1; grid-row: 2; }
.demo-row__state, .demo-row__action { grid-row: 1 / span 2; }
.demo-row:nth-child(odd) { background: rgba(0, 0, 0, 0.14); }
.demo-row__name { font-family: var(--font-mono); font-size: 0.82rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.demo-row__facts { color: var(--text-dim); font-size: 0.78rem; white-space: nowrap; }

/* --------------------------------------------- our plugins: discord-stv */

.discord-panel .panel__body { display: grid; gap: 16px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
	display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 0.86rem;
	background: rgba(236, 227, 203, 0.07); border: 1px solid var(--edge-soft);
}
.chip .icon { width: 1em; height: 1em; color: #8c9eff; }
.chip.is-linked { border-color: rgba(126, 163, 77, 0.4); }
.chip small { color: var(--text-dim); }
.chip__remove { display: inline-grid; place-items: center; margin-right: -4px; padding: 1px; border: 0; border-radius: 50%; background: none; color: var(--text-dim); cursor: pointer; }
.chip__remove:hover { color: var(--red-bright); background: var(--red-soft); }
.chip__remove:disabled { display: none; }
.discord-players { display: grid; gap: 2px; }
.discord-row { display: grid; grid-template-columns: minmax(160px, 0.8fr) minmax(0, 2fr) auto; align-items: center; gap: 8px 14px; padding: 8px 10px; border-radius: var(--radius-s); }
.discord-row:nth-child(even) { background: rgba(0, 0, 0, 0.14); }
.discord-row__player { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-width: 0; }
.discord-row__player strong { font-weight: normal; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 640px) { .discord-row { grid-template-columns: minmax(0, 1fr) auto; } .discord-row .chips { grid-column: 1 / -1; grid-row: 2; } }
