/* RBM Monitoring - scoped styles, theme-friendly (inherits fonts/colors from the active theme) */

.rbm { --rbm-border: rgba(128,128,128,.35); --rbm-accent: #2271b1; }

.rbm .rbm-center { text-align: center; }
.rbm .rbm-mt { margin-top: 2rem; }

/* key entry form */
.rbm-keyform { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: center; align-items: center; }
.rbm-keyform input[type="text"] {
	width: min(360px, 90vw); padding: .5em .75em;
	border: 1px solid var(--rbm-border); border-radius: 4px; font: inherit;
}
.rbm-newkey { color: var(--rbm-accent); font-weight: 700; word-break: break-all; }
.rbm-keyhelp { max-width: 560px; margin: 1rem auto; text-align: left; }

/* buttons */
.rbm button, .rbm .rbm-btn {
	font: inherit; cursor: pointer; padding: .5em 1em;
	border: 1px solid var(--rbm-accent); border-radius: 4px;
	background: var(--rbm-accent); color: #fff;
}
.rbm button:disabled { opacity: .45; cursor: default; }
.rbm .rbm-expand {
	display: inline-grid; place-items: center;
	width: 1.6em; height: 1.6em; line-height: 1;
	border: 1px solid currentColor; border-radius: 4px;
	font-weight: 700; opacity: .75;
}
.rbm tr.rbm-row { cursor: pointer; }
.rbm tr.rbm-row:hover .rbm-expand,
.rbm tr.rbm-row:focus-visible .rbm-expand { opacity: 1; }
.rbm tr.rbm-row:focus-visible { outline: 2px solid var(--rbm-accent); outline-offset: -2px; }

/* tables */
.rbm-tablewrap { overflow-x: auto; }
.rbm-table { width: 100%; border-collapse: collapse; margin: 1rem 0; }
.rbm-table th, .rbm-table td { padding: .45em .6em; border-bottom: 1px solid var(--rbm-border); text-align: left; vertical-align: top; }
.rbm-table th[data-sort] { cursor: pointer; user-select: none; white-space: nowrap; }
.rbm-table th[data-sort]::after { content: ' \2195'; opacity: .4; }
.rbm-table th[data-sort][data-dir="asc"]::after { content: ' \2191'; opacity: 1; }
.rbm-table th[data-sort][data-dir="desc"]::after { content: ' \2193'; opacity: 1; }
.rbm-table .rbm-num { text-align: right; white-space: nowrap; }
.rbm-minmax { display: block; font-size: .8em; font-weight: 300; line-height: 1.25; opacity: .8; }
.rbm-workercell { font-weight: 600; }
.rbm-workercell span { display: block; font-size: .85em; font-weight: 400; line-height: 1.35; }

/* worker status colors (same palette as the old page, readable text enforced) */
.rbm-table tr[class*="rbm-status-"] > td { color: #10161d; font-weight: 500; }
.rbm-status-Running > td, .rbm-status-Benchmarking > td { background: rgb(127,191,144); }
.rbm-status-Offline > td { background: rgb(213,142,176); }
.rbm-status-Paused > td, .rbm-status-Waiting > td { background: rgb(247,252,168); }
.rbm-status-TempAlert > td, .rbm-status-Crashing > td { background: rgb(255,158,73); }

/* detail rows */
.rbm-detailrow > td { background: rgba(128,128,128,.08); }
.rbm-details { font-size: .9em; margin: .5rem 0; }
.rbm-console { font-size: .72em; line-height: 1.15; max-height: 320px; overflow: auto; padding: .5em; background: rgba(128,128,128,.1); }

/* summary cards */
.rbm-cards { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); margin: 1rem 0; }
.rbm-card { border: 1px solid var(--rbm-border); border-radius: 6px; overflow: hidden; }
.rbm-card > header { padding: .4em .75em; font-weight: 700; border-bottom: 1px solid var(--rbm-border); background: rgba(128,128,128,.1); }
.rbm-card.rbm-card-accent > header { background: var(--rbm-accent); color: #fff; }
.rbm-card > div { padding: .6em .75em; }

/* public stats */
.rbm-topstats { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: center; margin: 1rem 0; }
.rbm-topcard { width: 280px; padding: .5em; border: 1px solid var(--rbm-border); border-radius: 6px; text-align: left; }

/* filters and pager */
.rbm-md-filter, #rbm-algo-filter {
	width: 100%; max-width: 160px; padding: .25em .4em; font: inherit; font-size: .85em;
	border: 1px solid var(--rbm-border); border-radius: 4px;
}
#rbm-algo-filter { max-width: 280px; margin-bottom: .5rem; }
.rbm-pager { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; margin: .5rem 0 1.5rem; }
.rbm-pager select { font: inherit; padding: .3em; border: 1px solid var(--rbm-border); border-radius: 4px; }

@media (max-width: 640px) {
	.rbm-table { font-size: .85em; }
	.rbm-table th, .rbm-table td { padding: .35em .35em; }
}

/* workers toolbar */
.rbm-tablehead { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.rbm-tablehead h2 { margin: 0; }
#rbm-refresh {
	display: grid; place-items: center;
	width: 2.4rem; height: 2.4rem; padding: 0;
	background: transparent; color: inherit;
	border: 1px solid var(--rbm-border); border-radius: 6px;
}
#rbm-refresh:hover { border-color: var(--rbm-accent); color: var(--rbm-accent); }
#rbm-refresh svg { width: 1.2rem; height: 1.2rem; }
#rbm-refresh.is-loading svg { animation: rbm-spin .8s linear infinite; }
@keyframes rbm-spin { to { transform: rotate(360deg); } }

/* action buttons: proper spacing when they wrap on narrow screens */
.rbm-mt:has(> .rbm-action) { display: flex; flex-wrap: wrap; gap: .75rem; }
/* fallback for browsers without :has() */
.rbm .rbm-action { margin: .375rem .5rem .375rem 0; }
.rbm-mt:has(> .rbm-action) .rbm-action { margin: 0; }
