/* Colours follow the TN9400 server web UIs (e.g. Cold Standby Config Sync): dark slate masthead,
   grey status bar, light-grey sidebar with a light-blue selection, grey page-title bar, flat grey buttons. */
:root {
	--masthead: #474c53;
	--statusbar: #676f6e;
	--sidebar: #f0f0f0;
	--sidebar-edge: #555a60;
	--selected: #bfe2fd;
	--title-bar: #e8e9eb;
	--rule: #c8c8c8;
	--grid: #e3e4e6;
	--bg: #ffffff;
	--text: #111111;
	--text-2: #333333;
	--heading: #666666;
	--muted: #707070;
	--button: #eeeeee;
	--button-hover: #e2e2e2;
	--button-border: #7a7a7a;
	--disabled: #999999;
	--ok: #3aa648;
	--fail-bg: #fdecec;
	--warn-bg: #fdf3e3;
	--ok-bg: #eef7ef;
	--fail: #b42318;
	--font: Arial, Helvetica, "Segoe UI", sans-serif;
	--mono: Consolas, "Cascadia Mono", "SFMono-Regular", Menlo, monospace;
	--row: 24px;
	color-scheme: light;
}

* { box-sizing: border-box; }

/* Elements that set their own display (e.g. the drop overlay's grid) must still hide. */
[hidden] { display: none !important; }

html, body {
	height: 100%;
	margin: 0;
}

body {
	display: flex;
	flex-direction: column;
	background: var(--bg);
	color: var(--text);
	font: 14px/1.35 var(--font);
	overflow: hidden;
}

button, input, select {
	font: inherit;
	color: inherit;
}

button {
	padding: 2px 14px;
	border: 1px solid var(--button-border);
	border-radius: 2px;
	background: var(--button);
	cursor: pointer;
}

button:hover:not(:disabled) { background: var(--button-hover); }
button:disabled { color: var(--disabled); border-color: #b5b5b5; cursor: default; }

input:not([type=checkbox]), select {
	padding: 2px 5px;
	border: 1px solid #a9a9a9;
	border-radius: 2px;
	background: #fff;
}

input[type=checkbox] { accent-color: var(--masthead); }
input.invalid { border-color: var(--fail); }
.muted { color: var(--muted); }

/* ------------------------------------------------------------ masthead + status bar */

.masthead {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	height: 64px;
	padding: 0 16px;
	background: var(--masthead);
	color: #fff;
	flex: none;
}

.masthead h1 { margin: 0; font-size: 26px; font-weight: 400; letter-spacing: .2px; }
.masthead .logo { position: absolute; left: 24px; top: 50%; transform: translateY(-50%); max-height: 40px; }
.masthead-right { position: absolute; right: 16px; top: 50%; transform: translateY(-50%); text-align: right; font-size: 12px; line-height: 1.5; }

.statusbar {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 14px;
	min-height: 28px;
	padding: 3px 16px;
	background: var(--statusbar);
	color: #fff;
	font-size: 13px;
	flex: none;
}

.status { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status.error { color: #ffd2cc; white-space: normal; }

.progress { width: 200px; height: 10px; border: 1px solid rgba(255, 255, 255, .6); border-radius: 5px; overflow: hidden; flex: none; }
.progress > div { height: 100%; width: 0; background: #fff; transition: width .15s; }
.progress.busy > div { width: 35% !important; animation: slide 1.1s ease-in-out infinite; }
@keyframes slide { from { transform: translateX(-100%); } to { transform: translateX(290%); } }

/* ------------------------------------------------------------ sidebar */

.layout { flex: 1; min-height: 0; display: flex; }

.sidebar {
	width: 236px;
	flex: none;
	overflow-y: auto;
	padding: 14px 0;
	background: var(--sidebar);
	border-right: 3px solid var(--sidebar-edge);
}

.nav-group { margin: 0 18px 12px 0; padding-bottom: 12px; border-bottom: 1px solid var(--rule); }
.nav-group h2 { display: flex; align-items: center; gap: 15px; margin: 0 0 4px 17px; font-size: 16px; font-weight: 700; }

.collapse {
	position: relative;
	width: 14px;
	height: 14px;
	padding: 0;
	border: none;
	border-radius: 1px;
	background: var(--sidebar-edge);
}

.collapse:hover:not(:disabled) { background: #33373c; }
.collapse::before, .collapse::after { content: ""; position: absolute; left: 3px; right: 3px; top: 6px; height: 2px; background: #fff; }
.collapse[aria-expanded=false]::after { transform: rotate(90deg); }
.nav-group.collapsed .nav-items { display: none; }

.nav-items > button {
	display: block;
	width: calc(100% + 18px);
	padding: 4px 12px 4px 47px;
	border: none;
	border-radius: 0;
	background: none;
	text-align: left;
	font-size: 16px;
}

.nav-items > button:hover:not(:disabled) { background: #e2e6ea; }
.nav-items > button.active { background: var(--selected); }
.nav-items > button:disabled { color: var(--disabled); }

.nav-items.form { display: flex; flex-direction: column; gap: 6px; padding: 4px 0 0 47px; font-size: 14px; }
.nav-items.form select { width: 100%; font-size: 13px; }


/* ------------------------------------------------------------ content */

.content { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.page-title {
	padding: 17px 21px 15px;
	background: var(--title-bar);
	color: var(--heading);
	font-size: 21px;
	flex: none;
}

.bar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px 18px;
	padding: 8px 20px;
	border-bottom: 1px solid var(--rule);
	flex: none;
}

.field { display: inline-flex; align-items: center; gap: 7px; }
.check { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; }

main { flex: 1; min-height: 0; position: relative; }
.tab { display: none; position: absolute; inset: 0; flex-direction: column; }
.tab.active { display: flex; }
.summary { padding: 5px 20px 7px; color: var(--muted); border-bottom: 1px solid var(--rule); min-height: 28px; font-size: 13px; }

.split { flex: 1; min-height: 0; display: flex; }
.pane { min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.pane.list { width: 620px; flex: none; }
.pane.list.narrow { width: 560px; }
.pane.detail { flex: 1; }
.splitter { width: 5px; flex: none; background: var(--rule); cursor: col-resize; }
.splitter:hover { background: #a9a9a9; }

.tabs { display: flex; gap: 2px; padding: 6px 8px 0; border-bottom: 1px solid var(--rule); background: var(--title-bar); flex: none; }
.tabs button { margin-bottom: -1px; padding: 4px 14px; border: 1px solid transparent; border-bottom: none; border-radius: 2px 2px 0 0; background: transparent; color: var(--text-2); }
.tabs button:hover:not(:disabled) { background: #dcdee1; }
.tabs button.active { border-color: var(--rule); background: var(--bg); color: var(--text); }
.tabs .list-toggle { margin-left: auto; margin-bottom: 4px; padding: 2px 10px; border: 1px solid var(--rule); border-radius: 2px; font-size: 12px; }
.split.list-hidden > .pane.list, .split.list-hidden > .splitter { display: none; }

.header { padding: 6px 12px; border-bottom: 1px solid var(--grid); color: var(--text-2); font-size: 13px; flex: none; }
.subtab { display: none; flex: 1; min-height: 0; }
.detail-lines { margin: 0; padding: 6px 12px; max-height: 120px; overflow: auto; border-bottom: 1px solid var(--grid); background: #fafafa; font: 12px/1.45 var(--mono); white-space: pre; flex: none; }
.subtab.active { display: flex; flex-direction: column; }
.scroll { overflow: auto; }
.fill { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.diagram { align-self: flex-start; }
.diagram svg { display: block; }

/* ------------------------------------------------------------ virtual table */

.vt { flex: 1; min-height: 0; display: flex; flex-direction: column; font-size: 13px; }
.vt-head, .vt-row { display: grid; white-space: nowrap; }
.vt-head { background: var(--title-bar); border-bottom: 1px solid var(--rule); color: var(--text-2); font-weight: 700; flex: none; overflow: hidden; }
.vt-head > div { padding: 5px 6px; border-right: 1px solid var(--rule); cursor: pointer; overflow: hidden; text-overflow: ellipsis; user-select: none; }
.vt-head > div:hover { background: #dcdee1; }
.vt-head > div.sorted::after { content: " \25B2"; font-size: 9px; color: var(--muted); }
.vt-head > div.sorted.desc::after { content: " \25BC"; }
.vt-body { flex: 1; overflow: auto; position: relative; outline: none; }
.vt-spacer { position: relative; }
.vt-row { position: absolute; left: 0; height: var(--row); line-height: var(--row); border-bottom: 1px solid var(--grid); cursor: default; }
.vt-row > div { padding: 0 6px; overflow: hidden; text-overflow: ellipsis; }
.vt-row.fail { background: var(--fail-bg); }
.vt-row.warn { background: var(--warn-bg); }
.vt-row.ok { background: var(--ok-bg); }
.vt-row.emerg { background: #fbd9d6; font-weight: 700; }
.vt-row:hover { background: #e8f3fd; }
.vt-row.selected { background: var(--selected); }
.vt-empty { padding: 12px; color: var(--muted); }

/* ------------------------------------------------------------ log lines */

.lines-wrap { display: none; }
.lines-wrap.active { display: flex; }
.line-tools { display: flex; align-items: center; gap: 10px; padding: 5px 10px; border-bottom: 1px solid var(--grid); font-size: 13px; flex: none; }
.lines { flex: 1; overflow: auto; font: 12px/1.45 var(--mono); padding: 4px 0; outline: none; }
.lines div { padding: 0 10px; white-space: pre; cursor: default; }
.lines div.warn { color: var(--fail); }
.lines div.sel { background: var(--selected); }

/* ------------------------------------------------------------ diagrams */

.diagram text { font-family: var(--font); }
.diagram .mono { font-family: var(--mono); }
.diagram .row-hit { fill: transparent; }
.diagram .row-hit:hover { fill: rgba(91, 173, 235, .14); }

/* ------------------------------------------------------------ charts */

.charts { flex: 1; padding: 12px 20px; }
.card { background: #fff; border: 1px solid var(--rule); border-radius: 2px; padding: 10px 12px 8px; margin-bottom: 12px; }
.card h3 { margin: 0; color: var(--muted); font-size: 16px; font-weight: 400; }
.card .sub { color: var(--muted); margin: 2px 0 4px; font-size: 13px; }
.legend { display: flex; flex-wrap: wrap; gap: 2px 18px; margin: 4px 0 6px; font-size: 13px; }
.key { display: inline-flex; align-items: center; gap: 6px; }
.key i { width: 16px; height: 3px; border-radius: 2px; display: inline-block; }
.chart svg { display: block; width: 100%; }
.stats { border-collapse: collapse; margin: 6px 0 12px; background: #fff; font-size: 13px; }
.stats th, .stats td { padding: 4px 12px; border-bottom: 1px solid var(--rule); text-align: right; }
.stats th { color: var(--text-2); background: var(--title-bar); }
.stats th:first-child, .stats td:first-child { text-align: left; }
h2.section { margin: 18px 0 8px; padding-top: 12px; border-top: 1px solid var(--rule); color: var(--muted); font-size: 16px; font-weight: 400; }

/* ------------------------------------------------------------ visualization */

.viz-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(440px, 1fr)); gap: 12px; align-items: start; }
.viz-grid .card { margin: 0; min-width: 0; }
.viz-grid .card.wide { grid-column: 1 / -1; }
.viz .empty { padding: 10px 0; margin: 0; }
.key i.swatch, .donut-table i.swatch { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.viz svg .pick { cursor: pointer; }

.tiles { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 12px; }
.tile { flex: 1 1 150px; background: #fff; border: 1px solid var(--rule); border-radius: 2px; padding: 8px 12px; text-align: center; }
.tile-label { color: var(--muted); font-size: 13px; }
.tile-value { font-size: 24px; color: var(--text); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile-note { color: var(--muted); font-size: 12px; }

.hbars { display: grid; grid-template-columns: minmax(0, 44%) 1fr auto; gap: 2px 10px; margin-top: 6px; font-size: 13px; }
.hbar { display: contents; }
.hbar > span { padding: 3px 0; }
.hbar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-track { display: flex; align-items: center; }
.hbar-track i { display: block; height: 12px; border-radius: 0 4px 4px 0; }
.hbar-value { text-align: right; color: var(--text-2); font-variant-numeric: tabular-nums; }
.hbar:hover > span { background: #f3f3f1; }
.hbar.pick > span { cursor: pointer; }

.donut-wrap { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; margin-top: 6px; }
.donut { flex: none; }
.donut path { transition: opacity .12s; }
.donut-table { border-collapse: collapse; font-size: 13px; flex: 1; min-width: 200px; table-layout: fixed; }
.donut-table td { padding: 3px 6px; border-bottom: 1px solid var(--grid); }
.donut-table td:first-child { width: 22px; }
.donut-table td.num { text-align: right; width: 64px; font-variant-numeric: tabular-nums; }
.donut-table .donut-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.donut-table tr:hover td { background: #f3f3f1; }

/* ------------------------------------------------------------ overlays */

.tooltip {
	position: fixed;
	z-index: 10;
	max-width: 720px;
	padding: 6px 9px;
	background: #fff;
	border: 1px solid var(--button-border);
	border-radius: 2px;
	box-shadow: 0 3px 10px rgba(0, 0, 0, .15);
	font: 12px/1.4 var(--mono);
	white-space: pre-wrap;
	pointer-events: none;
}

.drop-hint {
	position: fixed;
	inset: 0;
	z-index: 20;
	display: grid;
	place-items: center;
	background: rgba(71, 76, 83, .18);
	border: 3px dashed var(--masthead);
	font-size: 20px;
	color: var(--masthead);
	text-align: center;
}

@media (max-width: 1100px) {
	.sidebar { width: 200px; }
	.masthead h1 { font-size: 21px; }
}

@media (max-width: 900px) {
	.layout { flex-direction: column; }
	.sidebar { width: auto; max-height: 30vh; border-right: none; border-bottom: 3px solid var(--sidebar-edge); }
	.split { flex-direction: column; }
	.pane.list, .pane.list.narrow { width: auto; height: 40%; }
	.splitter { display: none; }
}
