/* Service metric badges + their tooltip (assets/js/metrics.js). Services catalog and New Order.
   A badge is a recessed readout with a lamp: GO green, caution amber, fail red, unlit = no verdict. */

/* ---------- Badge ---------- */
.sbp .mb { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border-radius: var(--r-pill); background: var(--panel-2); box-shadow: inset 0 0 0 1px var(--bezel); font-family: var(--font-mono); font-size: var(--op-xs); line-height: 1; white-space: nowrap; color: var(--ink-2); cursor: help; transition: box-shadow var(--t-fast); }
.sbp .mb:hover { box-shadow: inset 0 0 0 1px var(--bezel-2); }
.sbp .mb:focus-visible { outline: 2px solid var(--green); outline-offset: 1px; }
.sbp .mb__lamp { width: 6px; height: 6px; border-radius: 50%; flex: none; background: var(--bezel-2); }
.sbp .mb--good { color: var(--green); }
.sbp .mb--good .mb__lamp { background: var(--green); box-shadow: 0 0 6px var(--green-glow); }
.sbp .mb--avg { color: var(--amber); }
.sbp .mb--avg .mb__lamp { background: var(--amber); box-shadow: 0 0 6px var(--amber-glow); }
.sbp .mb--bad { color: var(--red); }
.sbp .mb--bad .mb__lamp { background: var(--red); box-shadow: 0 0 6px rgba(255, 90, 90, 0.35); }
.sbp .mb--off { color: var(--ink); }
.sbp .mb--none { justify-content: center; min-width: 28px; color: var(--ink-3); background: transparent; box-shadow: inset 0 0 0 1px var(--bezel); }

/* ---------- Tooltip (one shared [popover=manual]) ---------- */
.mtip { position: fixed; inset: auto; margin: 0; padding: 0; border: 0; background: transparent; overflow: visible; width: min(300px, calc(100vw - 16px)); color: var(--ink); z-index: 80; pointer-events: none; }
.mtip:not(:popover-open):not(.is-open) { display: none; }
.mtip__card { position: relative; padding: var(--s-3); background: var(--panel); border: 1px solid var(--bezel-2); border-radius: var(--r); font-family: var(--font-body); font-size: 0.75rem; line-height: 1.45; }
.mtip__card::after { content: ""; position: absolute; left: var(--ax, 50%); bottom: -6px; width: 10px; height: 10px; margin-left: -5px; background: var(--panel); border: solid var(--bezel-2); border-width: 0 1px 1px 0; transform: rotate(45deg); }
.mtip--below .mtip__card::after { bottom: auto; top: -6px; border-width: 1px 0 0 1px; }
.mtip p { margin: 0; }
.mtip strong { font-weight: 700; }

.mt-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-3); padding: 8px 10px; border-radius: var(--r-sm); background: var(--panel-2); }
.mt-head strong { display: inline-flex; align-items: center; gap: 8px; font-size: 0.875rem; color: var(--ink); }
.mt-head strong::before { content: ""; width: 7px; height: 7px; border-radius: 50%; flex: none; background: var(--bezel-2); }
.mt-head span { font-family: var(--font-mono); color: var(--ink-2); text-align: right; }
.mt-head--good strong, .mt-head--good span { color: var(--green); }
.mt-head--good strong::before { background: var(--green); box-shadow: 0 0 6px var(--green-glow); }
.mt-head--avg strong, .mt-head--avg span { color: var(--amber); }
.mt-head--avg strong::before { background: var(--amber); box-shadow: 0 0 6px var(--amber-glow); }
.mt-head--bad strong, .mt-head--bad span { color: var(--red); }
.mt-head--bad strong::before { background: var(--red); box-shadow: 0 0 6px rgba(255, 90, 90, 0.35); }
.mt-def { margin-top: var(--s-2) !important; color: var(--ink-2); }
.mt-sec { display: grid; gap: 6px; margin-top: var(--s-3); padding-top: var(--s-3); border-top: 1px solid var(--bezel); }
.mt-label { color: var(--ink-2); }
.mt-muted { color: var(--ink-2); }
.mt-row { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s-3); }
.mt-row strong, .mt-typ strong { font-family: var(--font-mono); }

/* rank scale: slower .. faster, marker at the percentile */
.mt-scale { position: relative; display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; height: 6px; margin-top: 2px; }
.mt-scale span { border-radius: 3px; opacity: 0.6; }
.mt-scale span:nth-child(1) { background: var(--red); }
.mt-scale span:nth-child(2) { background: var(--amber); }
.mt-scale span:nth-child(3) { background: var(--green); }
.mt-scale i { position: absolute; top: -3px; width: 3px; height: 12px; margin-left: -1.5px; border-radius: 2px; background: var(--ink); }
.mt-ends { display: flex; justify-content: space-between; font-size: 0.6875rem; color: var(--ink-3); }

/* quality */
.mt-typ { display: grid; grid-template-columns: repeat(3, 1fr); }
.mt-typ div { display: grid; }
.mt-typ div:nth-child(2) { text-align: center; }
.mt-typ div:nth-child(3) { text-align: right; }
.mt-typ strong { font-size: 0.875rem; }
.mt-typ span { font-size: 0.6875rem; color: var(--ink-2); }
.mt-geo { display: flex; gap: 2px; height: 8px; border-radius: 4px; overflow: hidden; }
.mt-geo0 { background: var(--green); }
.mt-geo1 { background: var(--amber); }
.mt-geo2 { background: var(--ink-2); }
.mt-geo3 { background: var(--green-2); }
.mt-geo4 { background: var(--bezel-2); }
.mt-geo5 { background: var(--ink-3); }
.mt-dot { display: inline-block; width: 8px; height: 8px; margin-right: 6px; border-radius: 2px; vertical-align: 0; }

/* drop: what stays vs what drops out of 1,000 */
.mt-split { display: flex; gap: 2px; height: 8px; border-radius: 4px; overflow: hidden; }
.mt-keep { background: var(--green); }
.mt-lost { background: var(--red); opacity: 0.75; }
.mt-legend { display: flex; justify-content: space-between; gap: var(--s-2); color: var(--ink-2); }

/* status legend */
.mt-states { gap: var(--s-1); }
.mt-state { display: flex; align-items: center; gap: var(--s-2); padding: 6px 8px; border: 1px solid transparent; border-radius: var(--r-sm); color: var(--ink-2); }
.mt-state .mb { flex: none; cursor: default; }
.mt-state.is-now { border-color: var(--bezel-2); background: var(--panel-2); color: var(--ink); }
.mt-state:not(.is-now) { opacity: 0.6; }

/* popularity steps */
.mt-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.mt-steps span { padding: 6px 4px; text-align: center; border: 1px solid var(--bezel); border-radius: var(--r-sm); color: var(--ink-2); }
.mt-steps .is-now { border-color: var(--green-2); color: var(--green); background: rgba(0, 227, 140, 0.06); }

/* ---------- New Order: the selected service's six readouts ---------- */
.sbp .nord__metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-4) var(--s-3); margin: 0; padding: var(--s-4); border-bottom: var(--line); }
.sbp .nord__metrics[hidden] { display: none; }
.sbp .nord__metric { display: grid; gap: 6px; justify-items: center; text-align: center; min-width: 0; }
.sbp .nord__metric-k { font-family: var(--font-label); font-size: var(--op-micro); letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-2); }

@media (prefers-reduced-motion: reduce) { .sbp .mb { transition: none; } }
