/* comfoo.js additions on top of the admin console styles (report.css tokens + app.css layout). */

.topbar {
	justify-content: space-between;
	gap: 16px;
}

.topbar-actions {
	display: flex;
	align-items: center;
	gap: 8px;
}

.topbar-actions form {
	margin: 0;
}

.lead {
	margin: 0 0 20px;
	max-width: 760px;
}

/* Stat tiles */
.stats {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 16px;
}

.stat {
	display: flex;
	flex-direction: column;
	gap: 2px;
	padding: 16px 20px;
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	box-shadow: var(--shadow);
}

.stat-value {
	font-size: 24px;
	font-weight: 700;
	line-height: 1.2;
}

.stat-label {
	font-size: 12px;
	color: var(--muted);
}

.stat-bad .stat-value {
	color: var(--red);
}

/* Per-node sync dots in the routes table */
.node-dots {
	display: inline-flex;
	gap: 3px;
	margin-left: 6px;
	vertical-align: middle;
}

.node-dot {
	width: 8px;
	height: 8px;
	border-radius: 50%;
}

.dot-ok { background: var(--green); }
.dot-bad { background: var(--red); }
.dot-unknown { background: var(--border-strong); }

.empty-state {
	padding: 48px 24px;
	text-align: center;
}

.empty-state h2 {
	font-size: 16px;
	margin-bottom: 6px;
}

.empty-state p {
	margin: 0 0 16px;
}

/* Forms */
.card-form {
	max-width: 760px;
}

.input small {
	font-size: 12px;
}

.input code,
.muted code,
.block-list code {
	font-size: 12px;
	background: var(--bg);
}

.suffix-input {
	display: flex;
	align-items: stretch;
}

.suffix-input input {
	flex: 1 1 auto;
	min-width: 0;
	border-top-right-radius: 0;
	border-bottom-right-radius: 0;
}

.suffix-input .suffix {
	display: inline-flex;
	align-items: center;
	padding: 0 12px;
	border: 1px solid var(--border-strong);
	border-left: 0;
	border-radius: 0 6px 6px 0;
	background: var(--bg);
	color: var(--muted);
	font-weight: 600;
}

input[readonly] {
	background: var(--bg);
	color: var(--muted);
}

.has-error input {
	border-color: var(--red);
}

.dc-preview {
	padding: 12px 14px;
	border-radius: 6px;
	background: var(--bg);
	border: 1px solid var(--border);
}

.dc-preview.dc-denver {
	background: var(--blue-soft);
	border-color: #b9d6fb;
}

.dc-preview.dc-dallas {
	background: var(--purple-soft);
	border-color: #d9c6f7;
}

.dc-preview.dc-invalid {
	background: var(--amber-soft);
	border-color: #f5d9a8;
	color: var(--amber);
}

.blocks summary {
	cursor: pointer;
	color: var(--muted);
	font-weight: 600;
	font-size: 13px;
}

.block-list {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin: 8px 0 0;
}

.inline-form {
	display: inline-flex;
	align-items: center;
	gap: 4px;
}

.inline-form input {
	height: 30px;
	width: 140px;
	font-size: 13px;
}

/* Detail pages */
.detail-grid {
	align-items: start;
}

.facts {
	display: grid;
	grid-template-columns: 140px 1fr;
	gap: 10px 16px;
	margin: 0 0 8px;
}

.facts dt {
	color: var(--muted);
	font-size: 13px;
}

.facts dd {
	margin: 0;
}

.facts + .form-actions {
	margin-top: 16px;
}

.form-actions form {
	margin: 0;
}

.node-head {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 12px;
}

.table-compact td {
	padding: 10px 0;
}

.table-compact td + td {
	padding-left: 12px;
}

.log {
	margin: 0;
	padding: 12px 14px;
	max-height: 360px;
	overflow: auto;
	background: var(--navy);
	color: #dfe4ee;
	border-radius: 6px;
	font: 12px/1.5 var(--mono);
	white-space: pre-wrap;
	word-break: break-word;
}

.log-bad {
	background: #2a1015;
	color: #ffd5d9;
}

.detail summary {
	cursor: pointer;
	font-size: 12px;
	color: var(--muted);
}

.detail .log {
	margin-top: 6px;
	max-width: 520px;
}

@media (max-width: 900px) {
	.stats {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.topbar {
		height: auto;
		min-height: 64px;
		flex-wrap: wrap;
		padding-block: 12px;
	}

	.facts {
		grid-template-columns: 1fr;
		gap: 2px;
	}

	.facts dd {
		margin-bottom: 8px;
	}
}

/* Dashboard. Series colours are validated for colour-vision deficiency (dataviz palette slots 1-2). */
:root {
	--series-denver: #2a78d6;
	--series-dallas: #eb6834;
	--grid: #eceef3;
}

.small-note {
	margin: 10px 0 0;
	font-size: 13px;
}

.stat-link {
	color: inherit;
	text-decoration: none !important;
	transition: border-color 0.15s;
}

.stat-link:hover {
	border-color: var(--blue);
}

.stat-value .swatch {
	margin-right: 8px;
	vertical-align: middle;
}

.swatch {
	display: inline-block;
	width: 10px;
	height: 10px;
	border-radius: 3px;
	flex-shrink: 0;
}

.swatch-denver { background: var(--series-denver); }
.swatch-dallas { background: var(--series-dallas); }

.dash-grid {
	grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
	align-items: start;
}

.chart-head {
	display: flex;
	justify-content: space-between;
	align-items: flex-start;
	gap: 12px;
	flex-wrap: wrap;
}

.legend {
	display: flex;
	gap: 14px;
	font-size: 13px;
	color: var(--muted);
}

.legend > span {
	display: inline-flex;
	align-items: center;
	gap: 6px;
}

.chart {
	overflow-x: auto;
}

.chart svg {
	display: block;
	width: 100%;
	height: auto;
}

.grid-line {
	stroke: var(--grid);
	stroke-width: 1;
}

.axis-text {
	fill: var(--muted);
	font: 11px var(--font);
}

.seg-denver { fill: var(--series-denver); }
.seg-dallas { fill: var(--series-dallas); }

.col .hit {
	fill: transparent;
}

.col:hover .hit {
	fill: rgba(18, 28, 45, 0.04);
}

.chart-tip {
	position: fixed;
	z-index: 2;
	padding: 6px 10px;
	background: var(--navy);
	color: #fff;
	border-radius: 6px;
	font-size: 12px;
	white-space: nowrap;
	pointer-events: none;
	transform: translate(-50%, calc(-100% - 8px));
	box-shadow: 0 4px 12px rgba(18, 28, 45, 0.2);
}

.split-bar {
	display: block;
	width: 100%;
	height: 12px;
	border-radius: 4px;
}

.split-empty {
	background: var(--bg);
}

.split-legend {
	list-style: none;
	margin: 12px 0 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.split-legend li,
.node-list li {
	display: flex;
	align-items: center;
	gap: 8px;
}

.split-legend .strong {
	margin-left: auto;
}

.split-legend .muted {
	width: 40px;
	text-align: right;
}

.sub-head {
	margin: 22px 0 10px;
	padding-top: 16px;
	border-top: 1px solid var(--border);
	font-size: 13px;
	font-weight: 700;
}

.node-list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.node-list .muted {
	margin-left: auto;
}

.text-strong {
	color: var(--text);
}

.card-pad {
	padding: 20px 24px 0;
	margin-bottom: 12px;
}

p.card-pad {
	padding-bottom: 16px;
	margin: 0;
}

.dash-bottom {
	align-items: start;
}

@media (max-width: 900px) {
	/* minmax(0, …) lets columns shrink below their content so the chart scrolls inside its card. */
	.dash-grid,
	.dash-bottom {
		grid-template-columns: minmax(0, 1fr);
	}

	/* Keep axis text legible: below ~560px the chart scrolls sideways instead of shrinking. */
	.chart svg {
		min-width: 560px;
	}
}

/* Connectivity check results inside a form error */
.probe-list {
	list-style: none;
	margin: 10px 0 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 4px;
	font-weight: 400;
	color: var(--text);
}

.probe-mark {
	display: inline-block;
	width: 16px;
	font-weight: 700;
}
