/* shadowrealm's UI palette is the dark variant of the uikit design tokens
 * defined in uikit/assets/css/input.css. Keeping the var names + oklch values
 * identical means the look matches every other Plexxis service that builds on
 * the same uikit, even though shadowrealm doesn't pull in the tailwind layer.
 *
 * The legacy --bg / --text / --panel / etc. names are aliases the rest of this
 * file already uses; they now resolve to the uikit tokens. */

/* font-display: optional + a <link rel="preload"> in layout.templ together
 * eliminate the cross-page font-swap flash. With "optional" the browser only
 * uses Geist if it's already in the disk cache by first paint; the preload
 * ensures it gets there on the very first request, so every subsequent
 * navigation has it ready and we never fall back. */
@font-face {
	font-family: "Geist";
	src: url("/assets/fonts/geist/geist-variable.woff2") format("woff2-variations");
	font-weight: 100 900;
	font-display: optional;
}
@font-face {
	font-family: "Geist Mono";
	src: url("/assets/fonts/geist/geist-mono-variable.woff2") format("woff2-variations");
	font-weight: 100 900;
	font-display: optional;
}

:root {
	/* --- uikit dark tokens (verbatim from uikit/assets/css/input.css .dark) --- */
	--background: oklch(0.145 0 0);
	--foreground: oklch(0.985 0 0);
	--card: oklch(0.205 0 0);
	--card-foreground: oklch(0.985 0 0);
	--popover: oklch(0.205 0 0);
	--popover-foreground: oklch(0.985 0 0);
	--primary: oklch(0.922 0 0);
	--primary-foreground: oklch(0.205 0 0);
	--secondary: oklch(0.269 0 0);
	--secondary-foreground: oklch(0.985 0 0);
	--muted-token: oklch(0.269 0 0);
	--muted-foreground: oklch(0.708 0 0);
	--accent-token: oklch(0.269 0 0);
	--accent-foreground: oklch(0.985 0 0);
	--destructive: oklch(0.704 0.191 22.216);
	--border-token: oklch(1 0 0 / 10%);
	--input: oklch(1 0 0 / 15%);
	--ring: oklch(0.556 0 0);
	--chart-1: oklch(0.488 0.243 264.376);
	--chart-2: oklch(0.696 0.17 162.48);
	--chart-3: oklch(0.769 0.188 70.08);
	--chart-4: oklch(0.627 0.265 303.9);
	--chart-5: oklch(0.645 0.246 16.439);

	/* --- shadowrealm aliases on top of the uikit tokens --- */
	--bg: var(--background);
	--panel: var(--card);
	--panel-2: var(--secondary);
	--panel-3: oklch(0.32 0 0);
	--border: var(--border-token);
	--border-strong: oklch(1 0 0 / 18%);
	--text: var(--foreground);
	--muted: var(--muted-foreground);
	--muted-2: oklch(0.55 0 0);
	--accent: var(--primary);
	--accent-foreground: var(--primary-foreground);
	--success: var(--chart-2);
	--failed: var(--destructive);
	--running: var(--chart-3);
	--warn: var(--chart-3);
	--info: oklch(0.74 0.13 240);
	--purple: var(--chart-4);
	--sidebar-w: 240px;
	--radius: 0.625rem;
}

* { box-sizing: border-box; }

html, body {
	margin: 0;
	padding: 0;
	background: var(--bg);
	color: var(--text);
	font-family: "Geist", ui-sans-serif, system-ui, sans-serif,
		"Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
	font-feature-settings: "rlig" 1, "calt" 1;
	font-size: 14px;
	line-height: 1.45;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}

code, pre, kbd, samp, .mono {
	font-family: "Geist Mono", ui-monospace, SFMono-Regular, "SF Mono",
		Consolas, "Liberation Mono", Menlo, monospace;
}

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

.app {
	display: flex;
	min-height: 100vh;
	gap: 12px;
	padding: 12px;
}

/* ---------------- sidebar ---------------- */

/* The sidebar is a floating rounded card, matching the rest of the Plexxis
 * services' uikit layout (see screenshot). The outer .app provides the gap
 * between sidebar and content; the sidebar itself stays sticky so long pages
 * scroll without losing the nav. */
.sidebar {
	width: var(--sidebar-w);
	flex-shrink: 0;
	background: var(--panel);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	display: flex;
	flex-direction: column;
	position: sticky;
	top: 12px;
	height: calc(100vh - 24px);
	overflow-y: auto;
}

.sidebar-brand {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 18px 20px 16px;
	border-bottom: 1px solid var(--border);
}
.sidebar-brand .logo { display: inline-flex; align-items: center; }
.sidebar-brand .logo svg { display: block; }
.sidebar-brand .name { font-weight: 600; font-size: 15px; letter-spacing: 0.2px; }
.sidebar-brand .version { color: var(--muted); font-size: 12px; }
.dc-badge {
	display: flex;
	align-items: center;
	gap: 6px;
	margin: 10px 20px 4px;
	padding: 4px 10px;
	font-size: 12px;
	font-weight: 600;
	letter-spacing: 0.3px;
	color: var(--muted);
	background: var(--panel, rgba(127, 127, 127, 0.08));
	border: 1px solid var(--border);
	border-radius: 6px;
	width: fit-content;
}
.dc-badge .icon { display: inline-flex; align-items: center; }
.dc-badge .icon svg { display: block; }

.status-dot {
	display: inline-block;
	width: 9px;
	height: 9px;
	margin-right: 8px;
	border-radius: 50%;
	vertical-align: middle;
	background: #9ca3af; /* unknown — grey */
	box-shadow: 0 0 0 2px rgba(156, 163, 175, 0.25);
}
.status-dot.online {
	background: #22c55e;
	box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.25);
}
.status-dot.offline {
	background: #ef4444;
	box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.25);
}

/* Cross-DC sync column on the Datacenters page. */
.dc-sync { white-space: nowrap; }
.sync-badge {
	display: inline-block;
	font-size: 12px;
	font-variant-numeric: tabular-nums;
	color: #6b7280; /* idle — muted grey */
}
.sync-badge.active {
	color: #2563eb;
	font-weight: 600;
}
.sync-badge.active::before {
	content: "";
	display: inline-block;
	width: 7px;
	height: 7px;
	margin-right: 6px;
	border-radius: 50%;
	vertical-align: middle;
	background: #2563eb;
	animation: sync-pulse 1.2s ease-in-out infinite;
}
.sync-badge.ok { color: #16a34a; }
.sync-badge.failing { color: #dc2626; font-weight: 600; }

@keyframes sync-pulse {
	0%, 100% { opacity: 1; }
	50% { opacity: 0.3; }
}

.sync-bar {
	display: inline-block;
	width: 70px;
	height: 4px;
	margin-left: 8px;
	border-radius: 2px;
	background: rgba(37, 99, 235, 0.18);
	vertical-align: middle;
	overflow: hidden;
}
.sync-bar-fill {
	display: block;
	height: 100%;
	border-radius: 2px;
	background: #2563eb;
	transition: width 0.6s ease;
}

/* --- HyperMesh world map ----------------------------------------------------- */
.hypermesh-panel { padding: 0; overflow: hidden; }
.hypermesh-stage {
	position: relative;
	/* Fill the panel width and a fixed slice of viewport height. The map covers
	   the box (cropping a little off the top/bottom rather than letterboxing
	   with grey side bars) and never distorts — the SVG below uses the matching
	   preserveAspectRatio="xMidYMid slice". */
	width: 100%;
	height: 60vh;
	overflow: hidden;
	background:
		url("/static/world.svg") center / cover no-repeat,
		radial-gradient(120% 120% at 50% 0%, #142033 0%, #0b1220 70%);
	border-radius: 10px;
}
#hypermesh-map {
	display: block;
	width: 100%;
	height: 100%;
}
.hypermesh-empty {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	color: #9aa7bd;
	font-size: 14px;
}
/* The author rule above would otherwise beat the UA [hidden]{display:none},
   leaving the overlay permanently visible — restore it explicitly. */
.hypermesh-empty[hidden] { display: none; }

.hypermesh-grat { stroke: rgba(120, 150, 200, 0.12); stroke-width: 1; }
.hypermesh-grat.hypermesh-equator { stroke: rgba(120, 150, 200, 0.22); }

.hypermesh-link { stroke: rgba(140, 170, 220, 0.28); stroke-width: 1.1; fill: none; }
.hypermesh-link.dim { stroke: rgba(140, 170, 220, 0.08); stroke-dasharray: 3 5; }

.hypermesh-node-halo { fill: currentColor; opacity: 0.18; }
.hypermesh-node-dot { fill: currentColor; stroke: #0b1220; stroke-width: 1.5; }
.hypermesh-node-label {
	fill: #cdd7e6;
	font-size: 13px;
	font-weight: 600;
	paint-order: stroke;
	stroke: #0b1220;
	stroke-width: 3px;
}
.hypermesh-node.online { color: #22c55e; }
.hypermesh-node.offline { color: #ef4444; }
.hypermesh-node.unknown { color: #9ca3af; }
.hypermesh-node.self .hypermesh-node-halo { opacity: 0.28; }
.hypermesh-node.self .hypermesh-node-dot { stroke: #e5edf7; stroke-width: 2; }

.hypermesh-flow-line {
	stroke: #38bdf8;
	stroke-width: 2;
	fill: none;
	stroke-dasharray: 6 8;
	opacity: 0.9;
	filter: url(#hypermesh-glow);
	animation: hypermesh-dash 0.8s linear infinite;
}
.hypermesh-flow-dot { fill: #e0f2fe; filter: url(#hypermesh-glow); }
@keyframes hypermesh-dash { to { stroke-dashoffset: -28; } }

/* Active-transfers HUD — corner panel listing in-flight syncs, so transfer
   text never overlaps the DC labels on the map. */
.hypermesh-hud {
	position: absolute;
	top: 12px;
	left: 12px;
	max-width: 260px;
	padding: 9px 11px;
	border-radius: 8px;
	background: rgba(11, 18, 32, 0.82);
	border: 1px solid rgba(120, 150, 200, 0.18);
	backdrop-filter: blur(2px);
	font-size: 12px;
	color: #cbd5e1;
	pointer-events: none;
}
.hypermesh-hud-title {
	font-size: 11px;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	color: #7f9bbf;
	margin-bottom: 6px;
}
.hypermesh-xfer {
	display: flex;
	align-items: baseline;
	gap: 8px;
	padding: 2px 0;
	white-space: nowrap;
}
.hypermesh-xfer-route { color: #38bdf8; font-weight: 600; font-variant-numeric: tabular-nums; }
.hypermesh-xfer-detail { color: #cbd5e1; font-variant-numeric: tabular-nums; }

.hypermesh-legend {
	display: flex;
	flex-wrap: wrap;
	gap: 18px;
	padding: 12px 16px;
	font-size: 13px;
	color: #cbd5e1;
	background: #0b1220;
	border-top: 1px solid rgba(120, 150, 200, 0.12);
}
.hypermesh-legend-item { display: inline-flex; align-items: center; gap: 7px; }
.hypermesh-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; }
.hypermesh-dot.online { background: #22c55e; }
.hypermesh-dot.offline { background: #ef4444; }
.hypermesh-dot.unknown { background: #9ca3af; }
.hypermesh-flow-key {
	display: inline-block;
	width: 18px;
	height: 3px;
	border-radius: 2px;
	background: #38bdf8;
}

@media (prefers-reduced-motion: reduce) {
	.hypermesh-flow-line { animation: none; }
	.hypermesh-flow-dot { display: none; }
}

.sidebar-section {
	margin-top: 18px;
	padding: 0 20px;
}
.sidebar-section .label {
	font-size: 11px;
	text-transform: uppercase;
	letter-spacing: 0.8px;
	color: var(--muted-2);
	margin-bottom: 6px;
}

.sidebar-nav {
	display: flex;
	flex-direction: column;
	gap: 1px;
}
.sidebar-nav .nav-link {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 8px 10px;
	margin: 0 -10px;
	border-radius: 6px;
	color: var(--muted);
	font-size: 13.5px;
}
.sidebar-nav .nav-link:hover { background: var(--panel-2); color: var(--text); text-decoration: none; }
.sidebar-nav .nav-link.active { background: var(--panel-2); color: var(--text); }
.sidebar-nav .nav-link .icon {
	width: 16px;
	height: 16px;
	flex-shrink: 0;
	color: var(--muted);
	display: inline-flex;
	align-items: center;
	justify-content: center;
}
.sidebar-nav .nav-link.active .icon { color: var(--accent); }

.sidebar-foot {
	margin-top: auto;
	padding: 16px 20px;
	border-top: 1px solid var(--border);
	color: var(--muted-2);
	font-size: 12px;
}

.lock-banner {
	display: inline-block;
	padding: 4px 8px;
	background: color-mix(in oklch, var(--warn) 12%, transparent);
	border: 1px solid color-mix(in oklch, var(--warn) 60%, transparent);
	color: var(--warn);
	border-radius: 4px;
	font-size: 11px;
	font-weight: 600;
	letter-spacing: 0.4px;
}

/* ---------------- main column ---------------- */

.content {
	flex: 1;
	min-width: 0;
	padding: 12px 24px 48px;
}

.breadcrumb {
	display: flex;
	align-items: center;
	gap: 8px;
	color: var(--muted);
	font-size: 13px;
	margin-bottom: 18px;
}
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--text); text-decoration: none; }
.breadcrumb .sep { color: var(--muted-2); }
.breadcrumb .current { color: var(--text); }

.page-title {
	margin: 0 0 22px;
	font-size: 24px;
	font-weight: 600;
	letter-spacing: -0.2px;
}

.page-meta {
	display: flex;
	flex-wrap: wrap;
	gap: 14px 20px;
	margin: -10px 0 22px;
	color: var(--muted);
	font-size: 12.5px;
}
.page-meta b { color: var(--text); margin-right: 4px; font-weight: 500; }

/* ---------------- panel ---------------- */

.panel-grid {
	display: grid;
	gap: 20px;
	margin-bottom: 20px;
}
.panel-grid.cols-2 { grid-template-columns: 1.4fr 1fr; }
@media (max-width: 1100px) { .panel-grid.cols-2 { grid-template-columns: 1fr; } }

.panel {
	background: var(--panel);
	border: 1px solid var(--border);
	border-radius: 10px;
	overflow: hidden;
}
.content > .panel + .panel { margin-top: 20px; }
.panel-header {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 16px;
	padding: 18px 20px 14px;
}
.panel-header h2 {
	margin: 0 0 4px;
	font-size: 15px;
	font-weight: 600;
	letter-spacing: 0.1px;
}
.panel-header .desc {
	margin: 0;
	color: var(--muted);
	font-size: 13px;
}
.panel-header .actions {
	display: flex;
	gap: 8px;
	flex-shrink: 0;
}
.panel-body { padding: 0 20px 18px; }
.panel-body.flush { padding: 0; }
.panel-body.flush > table.data { border: none; border-radius: 0; }

/* ---------------- table ---------------- */

table.data {
	width: 100%;
	border-collapse: collapse;
	background: transparent;
}
table.data th, table.data td {
	padding: 12px 20px;
	text-align: left;
	border-bottom: 1px solid var(--border);
	vertical-align: middle;
}
table.data thead th {
	background: transparent;
	font-size: 11px;
	text-transform: uppercase;
	letter-spacing: 0.6px;
	color: var(--muted);
	font-weight: 500;
	border-bottom: 1px solid var(--border-strong);
}
table.data tbody tr:last-child td { border-bottom: none; }
table.data tbody tr:hover { background: var(--panel-2); }
table.data td.muted, table.data td .muted { color: var(--muted); }

.empty-row td {
	color: var(--muted);
	text-align: center;
	padding: 28px 20px;
}

/* ---------------- search ---------------- */

.search {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 14px 20px;
	border-bottom: 1px solid var(--border);
}
.search input[type="search"] {
	flex: 1;
	max-width: 360px;
	background: var(--panel-2);
	color: var(--text);
	border: 1px solid var(--border);
	border-radius: 6px;
	padding: 7px 12px;
	font: inherit;
	outline: none;
}
.search input[type="search"]:focus { border-color: var(--accent); }
.search input[type="search"]::placeholder { color: var(--muted); }
#customer-search-count { font-size: 12px; color: var(--muted); }

/* ---------------- sortable table headers ---------------- */

table.sortable th[data-sort-key] {
	cursor: pointer;
	user-select: none;
	white-space: nowrap;
}
table.sortable th[data-sort-key]:hover { color: var(--text); }
table.sortable th[data-sort-key]:focus-visible {
	outline: none;
	color: var(--text);
	box-shadow: inset 0 -2px 0 var(--ring);
}
table.sortable th[data-sort-key]::after {
	content: " ↕";
	display: inline-block;
	margin-left: 4px;
	font-size: 10px;
	opacity: 0.35;
}
table.sortable th[data-sort-key].asc::after  { content: " ↑"; opacity: 1; color: var(--text); }
table.sortable th[data-sort-key].desc::after { content: " ↓"; opacity: 1; color: var(--text); }

/* ---------------- filter dropdown ---------------- */

.filter-wrap {
	position: relative;
	margin-left: auto;
}
#filter-btn { display: inline-flex; align-items: center; gap: 6px; }
#filter-btn.active { border-color: var(--ring); color: var(--text); }
.filter-count {
	display: inline-block;
	min-width: 18px;
	padding: 0 6px;
	border-radius: 999px;
	background: var(--accent);
	color: var(--accent-foreground);
	font-size: 11px;
	font-weight: 600;
	line-height: 16px;
	text-align: center;
}

/* The popover lives inside .panel which sets overflow: hidden, so absolute
 * positioning would clip the dropdown when the table is short (test-lock
 * mode shows a single customer). position: fixed sidesteps the clip; the JS
 * sets top/right from the button's getBoundingClientRect on each open. */
.filter-popover {
	position: fixed;
	min-width: 220px;
	background: var(--panel);
	border: 1px solid var(--border-strong);
	border-radius: 8px;
	box-shadow: 0 18px 40px rgba(0, 0, 0, 0.55);
	padding: 12px 14px;
	z-index: 30;
	display: flex;
	flex-direction: column;
	gap: 14px;
}
.filter-popover[hidden] { display: none; }
.filter-group { display: flex; flex-direction: column; gap: 6px; }
.filter-group-label {
	font-size: 11px;
	color: var(--muted);
	text-transform: uppercase;
	letter-spacing: 0.5px;
}
.filter-opt {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	font-size: 13px;
	cursor: pointer;
	color: var(--text);
}
.filter-opt input[type="checkbox"] {
	accent-color: var(--accent);
	width: 14px;
	height: 14px;
	margin: 0;
}
.filter-actions {
	display: flex;
	justify-content: flex-end;
	gap: 8px;
	border-top: 1px solid var(--border);
	padding-top: 10px;
}

/* ---------------- badges + dots ---------------- */

.badge {
	display: inline-block;
	padding: 2px 8px;
	border-radius: 999px;
	font-size: 11px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	border: 1px solid transparent;
}
.badge.success { background: color-mix(in oklch, var(--success) 12%, transparent); color: var(--success); border-color: color-mix(in oklch, var(--success) 40%, transparent); }
.badge.failed  { background: color-mix(in oklch, var(--failed)  12%, transparent); color: var(--failed);  border-color: color-mix(in oklch, var(--failed)  40%, transparent); }
.badge.running { background: color-mix(in oklch, var(--running) 12%, transparent); color: var(--running); border-color: color-mix(in oklch, var(--running) 40%, transparent); }
.badge.skipped { background: color-mix(in oklch, var(--muted)   12%, transparent); color: var(--muted);   border-color: var(--border-strong); }
.badge.unknown { background: color-mix(in oklch, var(--muted)   12%, transparent); color: var(--muted);   border-color: var(--border-strong); }
.badge.dr      { background: color-mix(in oklch, var(--warn)    12%, transparent); color: var(--warn);    border-color: color-mix(in oklch, var(--warn)    50%, transparent); }

.dot {
	display: inline-block;
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: var(--muted-2);
	vertical-align: middle;
}
.dot.success { background: var(--success); }
.dot.failed  { background: var(--failed); }
.dot.running { background: var(--running); }
.dot.info    { background: var(--info); }

/* ---------------- buttons ---------------- */

.btn {
	background: var(--panel-2);
	color: var(--text);
	border: 1px solid var(--border-strong);
	border-radius: calc(var(--radius) - 4px);
	padding: 6px 14px;
	font: inherit;
	cursor: pointer;
	transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
}
.btn:hover:not(:disabled) { background: var(--panel-3); border-color: var(--ring); }
.btn:focus-visible { outline: none; border-color: var(--ring); box-shadow: 0 0 0 3px color-mix(in oklch, var(--ring) 40%, transparent); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.primary { background: var(--primary); color: var(--primary-foreground); border-color: var(--primary); }
.btn.primary:hover:not(:disabled) { background: color-mix(in oklch, var(--primary) 92%, var(--background)); border-color: var(--primary); }
.btn.ghost { background: transparent; border-color: var(--border-strong); color: var(--text); }
.btn.ghost:hover:not(:disabled) { background: var(--accent-token); }
.btn.warn { background: color-mix(in oklch, var(--warn) 12%, transparent); color: var(--warn); border-color: color-mix(in oklch, var(--warn) 50%, transparent); }
.btn.warn:hover:not(:disabled) { background: color-mix(in oklch, var(--warn) 20%, transparent); }
.btn.danger {
	background: color-mix(in oklch, var(--destructive) 12%, transparent);
	color: var(--destructive);
	border-color: color-mix(in oklch, var(--destructive) 55%, transparent);
}
.btn.danger:hover:not(:disabled) {
	background: var(--destructive);
	color: var(--destructive-foreground, oklch(0.985 0 0));
	border-color: var(--destructive);
}
.btn.success {
	background: color-mix(in oklch, var(--success) 14%, transparent);
	color: var(--success);
	border-color: color-mix(in oklch, var(--success) 55%, transparent);
	text-decoration: none;
}
.btn.success:hover:not(:disabled) {
	background: var(--success);
	color: oklch(0.205 0 0);
	border-color: var(--success);
}
.btn .erp-suffix { font-weight: 400; opacity: 0.85; }
.btn.sm { padding: 4px 10px; font-size: 12.5px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-row form { margin: 0; }

/* ---------------- mode pill (sync / dry-run / activate) ---------------- */

.mode-pill {
	display: inline-block;
	padding: 1px 7px;
	border-radius: 999px;
	font-size: 10.5px;
	font-weight: 600;
	letter-spacing: 0.4px;
	text-transform: uppercase;
	border: 1px solid transparent;
	white-space: nowrap;
}
.mode-pill.sync     { background: color-mix(in oklch, var(--purple)  12%, transparent); color: var(--purple);  border-color: color-mix(in oklch, var(--purple)  45%, transparent); }
.mode-pill.dry      { background: color-mix(in oklch, var(--running) 12%, transparent); color: var(--running); border-color: color-mix(in oklch, var(--running) 50%, transparent); }
.mode-pill.activate { background: color-mix(in oklch, var(--failed)  12%, transparent); color: var(--failed);  border-color: color-mix(in oklch, var(--failed)  50%, transparent); }
.mode-pill.freeze   { background: color-mix(in oklch, #4cb6ff           12%, transparent); color: #4cb6ff;        border-color: color-mix(in oklch, #4cb6ff           50%, transparent); }

.page-desc {
	color: var(--muted);
	max-width: 70ch;
	margin: -6px 0 18px;
}

/* ---------------- show-logs modal ---------------- */

.logs-modal {
	position: fixed;
	inset: 0;
	z-index: 100;
	display: flex;
	align-items: center;
	justify-content: center;
}
.logs-modal[hidden] { display: none; }
.logs-modal-backdrop {
	position: absolute;
	inset: 0;
	background: rgba(8, 10, 14, 0.65);
	backdrop-filter: blur(2px);
}
.logs-modal-card {
	position: relative;
	width: min(92vw, 1100px);
	max-height: 85vh;
	display: flex;
	flex-direction: column;
	background: var(--panel);
	border: 1px solid var(--border);
	border-radius: 10px;
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55);
	overflow: hidden;
}
.logs-modal-head {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 16px;
	padding: 16px 20px;
	border-bottom: 1px solid var(--border);
}
.logs-modal-head h2 { margin: 0 0 2px 0; font-size: 16px; }
.logs-modal-head .desc { margin: 0; color: var(--muted); font-size: 12.5px; }
.logs-modal-actions {
	display: flex;
	align-items: center;
	gap: 12px;
}
.logs-follow {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-size: 12.5px;
	color: var(--muted);
}
.logs-pre {
	margin: 0;
	padding: 14px 18px;
	overflow: auto;
	flex: 1 1 auto;
	background: var(--panel-2);
	color: var(--text);
	font-size: 12.5px;
	line-height: 1.45;
	white-space: pre-wrap;
	word-break: break-all;
}
.logs-pre .log-line { display: block; }
.logs-pre .muted { color: var(--muted); }

/* ---------------- shared confirm modal ---------------- */

.confirm-modal {
	position: fixed;
	inset: 0;
	z-index: 110;
	display: flex;
	align-items: center;
	justify-content: center;
}
.confirm-modal[hidden] { display: none; }
.confirm-modal-backdrop {
	position: absolute;
	inset: 0;
	background: rgba(8, 10, 14, 0.65);
	backdrop-filter: blur(2px);
}
.confirm-modal-card {
	position: relative;
	width: min(92vw, 460px);
	background: var(--panel);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	box-shadow: 0 24px 70px rgba(0, 0, 0, 0.6);
	padding: 22px 24px 18px;
}
.confirm-modal-head h2 {
	margin: 0 0 6px;
	font-size: 16px;
	font-weight: 600;
	letter-spacing: -0.1px;
}
.confirm-modal-head .desc {
	margin: 0;
	color: var(--muted);
	font-size: 13.5px;
	line-height: 1.5;
}
.confirm-modal-actions {
	display: flex;
	justify-content: flex-end;
	gap: 8px;
	margin-top: 18px;
}

/* ---------------- activate-DR confirmation panel ---------------- */

.danger-panel {
	border-color: color-mix(in oklch, var(--destructive) 60%, transparent) !important;
	background: color-mix(in oklch, var(--destructive) 6%, transparent);
}
.danger-panel h2 { color: var(--failed); }
.danger-panel .probe-detail {
	font-size: 12.5px;
	background: var(--panel-2);
	border: 1px solid var(--border);
	border-radius: 6px;
	padding: 8px 12px;
	margin: 12px 0;
	white-space: pre-wrap;
	word-break: break-all;
}

/* ---------------- key/value list ---------------- */

dl.kv {
	display: grid;
	grid-template-columns: max-content 1fr;
	gap: 8px 20px;
	margin: 0;
}
dl.kv dt { color: var(--muted); font-size: 13px; }
dl.kv dd { margin: 0; }

/* ---------------- stat cards ---------------- */

.cards {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
	gap: 16px;
	margin-bottom: 20px;
}
.card {
	background: var(--panel);
	border: 1px solid var(--border);
	border-radius: 10px;
	padding: 16px 18px;
}
.card .label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.6px; }
.card .value { font-size: 22px; font-weight: 600; margin-top: 6px; letter-spacing: -0.3px; }
.card .subtitle { font-size: 12px; margin-top: 4px; color: var(--muted); }

/* ---------------- progress ---------------- */

.progress-wrap { padding: 4px 20px 18px; }
.progress-head {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	gap: 12px;
	margin-bottom: 8px;
	font-size: 13px;
}
.progress-label { color: var(--text); }
.progress-pct { color: var(--muted); font-variant-numeric: tabular-nums; }
.progress-track {
	height: 6px;
	border-radius: 999px;
	background: var(--panel-3);
	overflow: hidden;
}
.progress-bar {
	height: 100%;
	background: var(--accent);
	transition: width 0.4s ease;
}

.steps {
	display: flex;
	gap: 10px;
	list-style: none;
	padding: 0;
	margin: 14px 0 0;
	flex-wrap: wrap;
}
.steps li {
	display: flex;
	flex-direction: column;
	gap: 2px;
	padding: 8px 12px;
	border-radius: 6px;
	background: var(--panel-2);
	border: 1px solid var(--border);
	font-size: 12px;
	min-width: 150px;
}
.steps li .step-name {
	text-transform: uppercase;
	letter-spacing: 0.5px;
	font-weight: 600;
	color: var(--muted);
}
.steps li .step-note { color: var(--muted); }
.steps li[data-state="running"] { border-color: var(--running); }
.steps li[data-state="running"] .step-name { color: var(--running); }
.steps li[data-state="done"] { border-color: var(--success); }
.steps li[data-state="done"] .step-name { color: var(--success); }
.steps li[data-state="failed"] { border-color: var(--failed); }
.steps li[data-state="failed"] .step-name { color: var(--failed); }
.steps li[data-state="skipped"] .step-name { color: var(--muted); }

/* ---------------- misc ---------------- */

.muted { color: var(--muted); }
.err { color: var(--failed); white-space: pre-wrap; }
.back { display: inline-block; color: var(--muted); font-size: 13px; }
.back:hover { color: var(--text); text-decoration: none; }
.title-sub { color: var(--muted); font-weight: 400; margin-left: 6px; font-size: 16px; }

.page-meta-lead {
	margin: -8px 0 22px;
	color: var(--muted);
	font-size: 13.5px;
	max-width: 70ch;
}
.page-meta-lead .restart-tag { vertical-align: middle; }

/* ---------------- DR mode banner ---------------- */

.dr-banner {
	display: grid;
	grid-template-columns: auto 1fr auto;
	align-items: center;
	gap: 12px;
	padding: 12px 16px;
	margin-bottom: 18px;
	background: color-mix(in oklch, var(--warn) 10%, transparent);
	border: 1px solid color-mix(in oklch, var(--warn) 45%, transparent);
	border-radius: 8px;
	color: var(--warn);
	font-size: 13.5px;
}
.dr-banner-icon { font-size: 16px; }
.dr-banner > span { text-align: center; }

/* ---------------- notice banner ---------------- */

.notice-banner {
	padding: 10px 16px;
	margin-bottom: 18px;
	background: color-mix(in oklch, var(--accent) 10%, transparent);
	border: 1px solid color-mix(in oklch, var(--accent) 40%, transparent);
	border-radius: 8px;
	color: var(--text);
	font-size: 13.5px;
}

/* ---------------- flash banners ---------------- */

.flash {
	border: 1px solid transparent;
	border-radius: 8px;
	padding: 10px 14px;
	margin-bottom: 18px;
	font-size: 13.5px;
}
.flash-ok {
	background: color-mix(in oklch, var(--success) 12%, transparent);
	border-color: color-mix(in oklch, var(--success) 50%, transparent);
	color: var(--success);
}
.flash-err {
	background: color-mix(in oklch, var(--failed) 12%, transparent);
	border-color: color-mix(in oklch, var(--failed) 55%, transparent);
	color: var(--failed);
}

/* ---------------- admin form ---------------- */

.admin-form > .panel { margin-bottom: 18px; }

.field-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
	gap: 18px 24px;
}

.field {
	display: flex;
	flex-direction: column;
	gap: 6px;
	font-size: 13px;
}
.field-label {
	color: var(--muted);
	font-size: 11.5px;
	text-transform: uppercase;
	letter-spacing: 0.6px;
	display: inline-flex;
	align-items: center;
	gap: 8px;
}
.field-label.inline {
	text-transform: none;
	letter-spacing: 0;
	font-size: 13.5px;
	color: var(--text);
}
.field-input {
	background: var(--panel-2);
	color: var(--text);
	border: 1px solid var(--border-strong);
	border-radius: 6px;
	padding: 7px 10px;
	font: inherit;
	outline: none;
	width: 100%;
}
.field-input:focus { border-color: var(--ring); box-shadow: 0 0 0 3px color-mix(in oklch, var(--ring) 30%, transparent); }
.field-input[readonly] { color: var(--muted); cursor: not-allowed; }
.field-hint { color: var(--muted); font-size: 12px; }

.field-row {
	flex-direction: row;
	align-items: center;
	gap: 10px;
	flex-wrap: wrap;
}
.field-row .field-hint { flex-basis: 100%; padding-left: 26px; }
.field-checkbox {
	width: 16px;
	height: 16px;
	accent-color: var(--accent);
	margin: 0;
}

.restart-tag {
	display: inline-block;
	font-size: 9.5px;
	font-weight: 600;
	letter-spacing: 0.5px;
	text-transform: uppercase;
	padding: 1px 6px;
	border-radius: 999px;
	background: color-mix(in oklch, var(--warn) 12%, transparent);
	color: var(--warn);
	border: 1px solid color-mix(in oklch, var(--warn) 45%, transparent);
}

.admin-actions {
	display: flex;
	gap: 10px;
	justify-content: flex-end;
	margin-top: 8px;
}

/* ---------------- api docs ---------------- */

.apidocs-toc {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: -4px 0 18px;
}
.apidocs-toc-link {
	font-size: 12px;
	padding: 4px 10px;
	border-radius: 999px;
	background: var(--panel-2);
	border: 1px solid var(--border-strong);
	color: var(--muted);
}
.apidocs-toc-link:hover { color: var(--text); border-color: var(--ring); text-decoration: none; }

.apidocs-group { margin-bottom: 18px; scroll-margin-top: 16px; }
.apidocs-group .panel-body { padding-bottom: 22px; }

.endpoints { display: flex; flex-direction: column; gap: 10px; }

.endpoint {
	border: 1px solid var(--border);
	border-radius: 8px;
	background: var(--panel-2);
	overflow: hidden;
	scroll-margin-top: 16px;
}
.endpoint[open] { border-color: var(--border-strong); }

.endpoint-summary {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 10px 14px;
	cursor: pointer;
	list-style: none;
	user-select: none;
}
.endpoint-summary::-webkit-details-marker { display: none; }
.endpoint-summary::after {
	content: "▸";
	margin-left: auto;
	color: var(--muted-2);
	transition: transform 120ms ease;
}
.endpoint[open] .endpoint-summary::after { transform: rotate(90deg); }
.endpoint-summary:hover { background: var(--panel-3); }

.method {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 56px;
	padding: 3px 8px;
	border-radius: 6px;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.6px;
	border: 1px solid transparent;
	text-transform: uppercase;
}
.method-get    { background: color-mix(in oklch, var(--info)    14%, transparent); color: var(--info);    border-color: color-mix(in oklch, var(--info)    50%, transparent); }
.method-post   { background: color-mix(in oklch, var(--running) 14%, transparent); color: var(--running); border-color: color-mix(in oklch, var(--running) 55%, transparent); }
.method-put    { background: color-mix(in oklch, var(--purple)  14%, transparent); color: var(--purple);  border-color: color-mix(in oklch, var(--purple)  55%, transparent); }
.method-delete { background: color-mix(in oklch, var(--failed)  14%, transparent); color: var(--failed);  border-color: color-mix(in oklch, var(--failed)  55%, transparent); }

.endpoint-path { font-size: 13px; color: var(--text); }
.endpoint-tagline {
	color: var(--muted);
	font-size: 12.5px;
	margin-left: 8px;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.endpoint-body {
	border-top: 1px solid var(--border);
	padding: 14px 16px 18px;
	background: var(--panel);
}
.endpoint-desc {
	margin: 0 0 12px;
	font-size: 13.5px;
	color: var(--text);
}

.endpoint-section { margin-top: 14px; }
.endpoint-section:first-child { margin-top: 0; }
.endpoint-section-label {
	font-size: 11px;
	text-transform: uppercase;
	letter-spacing: 0.7px;
	color: var(--muted);
	margin-bottom: 6px;
}

table.params {
	width: 100%;
	border-collapse: collapse;
	font-size: 12.5px;
}
table.params th {
	text-align: left;
	font-weight: 500;
	font-size: 10.5px;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	color: var(--muted);
	padding: 6px 10px;
	border-bottom: 1px solid var(--border-strong);
}
table.params td {
	padding: 8px 10px;
	border-bottom: 1px solid var(--border);
	vertical-align: top;
}
table.params tr:last-child td { border-bottom: none; }

.in-pill {
	display: inline-block;
	padding: 1px 7px;
	border-radius: 999px;
	font-size: 10.5px;
	font-weight: 600;
	letter-spacing: 0.4px;
	text-transform: uppercase;
	border: 1px solid transparent;
}
.in-path  { background: color-mix(in oklch, var(--accent)  18%, transparent); color: var(--text); border-color: var(--border-strong); }
.in-query { background: color-mix(in oklch, var(--info)    14%, transparent); color: var(--info); border-color: color-mix(in oklch, var(--info) 40%, transparent); }
.req-yes { color: var(--warn); font-weight: 600; }
.req-no  { color: var(--muted); }

pre.example {
	margin: 0;
	padding: 12px 14px;
	background: var(--panel-2);
	border: 1px solid var(--border);
	border-radius: 6px;
	color: var(--text);
	font-size: 12.5px;
	line-height: 1.5;
	overflow-x: auto;
	white-space: pre;
}

/* ---- Login page ---- */

body.login-page {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 100vh;
	background: var(--bg);
}

.login-card {
	width: 100%;
	max-width: 360px;
	background: var(--panel);
	border: 1px solid var(--border-strong);
	border-radius: var(--radius);
	padding: 36px 32px 32px;
}

.login-brand {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 12px;
	margin-bottom: 32px;
}

.login-brand svg {
	width: 44px;
	height: 44px;
}

.login-name {
	font-size: 20px;
	font-weight: 600;
	letter-spacing: -0.3px;
}

.login-error {
	background: color-mix(in oklch, var(--failed) 15%, transparent);
	border: 1px solid color-mix(in oklch, var(--failed) 40%, transparent);
	color: var(--failed);
	border-radius: 6px;
	padding: 8px 12px;
	font-size: 13px;
	margin: 0 0 16px;
}

.login-form {
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.login-form label {
	font-size: 13px;
	font-weight: 500;
	color: var(--muted-foreground);
	margin-top: 10px;
}

.login-form label:first-of-type { margin-top: 0; }

.login-form input {
	background: var(--input);
	border: 1px solid var(--border-strong);
	border-radius: 6px;
	color: var(--text);
	font-family: inherit;
	font-size: 14px;
	padding: 8px 11px;
	outline: none;
	width: 100%;
}

.login-form input:focus {
	border-color: var(--ring);
	box-shadow: 0 0 0 2px color-mix(in oklch, var(--ring) 25%, transparent);
}

.login-btn {
	margin-top: 20px;
	width: 100%;
	padding: 9px 16px;
	background: var(--primary);
	color: var(--primary-foreground);
	border: none;
	border-radius: 6px;
	font-family: inherit;
	font-size: 14px;
	font-weight: 500;
	cursor: pointer;
}

.login-btn:hover { opacity: 0.9; }
.login-btn:active { opacity: 0.8; }

.login-btn-google {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	text-decoration: none;
	background: var(--panel-2);
	color: var(--text);
	border: 1px solid var(--border-strong);
	border-radius: 6px;
	font-family: inherit;
	font-size: 14px;
	font-weight: 500;
	padding: 9px 16px;
	margin-top: 0;
	cursor: pointer;
}
.login-btn-google:hover { background: var(--panel-3); }

.login-divider {
	display: flex;
	align-items: center;
	gap: 12px;
	margin: 18px 0 4px;
	color: var(--muted);
	font-size: 12px;
}
.login-divider::before,
.login-divider::after {
	content: "";
	flex: 1;
	height: 1px;
	background: var(--border-strong);
}

/* ---- Sidebar user / logout ---- */

.sidebar-user {
	display: flex;
	align-items: center;
	gap: 5px;
	font-size: 11px;
	color: var(--muted);
	margin-top: 10px;
	margin-bottom: 6px;
	opacity: 0.75;
	min-width: 0;
}

.sidebar-avatar {
	flex-shrink: 0;
	width: 20px;
	height: 20px;
	border-radius: 50%;
	object-fit: cover;
}

.sidebar-user-email {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.logout-form { margin-top: 10px; }

.logout-btn {
	background: none;
	border: 1px solid var(--border-strong);
	border-radius: 6px;
	color: var(--muted);
	cursor: pointer;
	font-family: inherit;
	font-size: 12px;
	padding: 5px 10px;
	width: 100%;
}

.logout-btn:hover {
	background: var(--panel-2);
	color: var(--text);
}
