/* PBX Stress Tester — design tokens, layout, components. Logical properties keep Arabic (RTL) right. */

:root {
  --sbw: 236px;
  --radius: 12px;
  --radius-sm: 8px;
  --font: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, "Noto Sans Arabic", sans-serif;
  --mono: "Cascadia Mono", Consolas, ui-monospace, "SF Mono", Menlo, monospace;
}
:root,
[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0c0f14;
  --bg-2: #10141b;
  --surface: #151a22;
  --surface-2: #1a202a;
  --surface-3: #222a36;
  --border: #232b37;
  --border-2: #313b4a;
  --text: #e7eaf0;
  --text-2: #a3adbf;
  --text-3: #6f7a8e;
  --accent: #4f7cff;
  --accent-2: #3d68e8;
  --accent-soft: rgba(79, 124, 255, 0.14);
  --ok: #2fbf71;
  --ok-soft: rgba(47, 191, 113, 0.14);
  --warn: #f5a524;
  --warn-soft: rgba(245, 165, 36, 0.14);
  --bad: #ef5350;
  --bad-soft: rgba(239, 83, 80, 0.14);
  --info: #38bdf8;
  --info-soft: rgba(56, 189, 248, 0.13);
  --grid: #1d2430;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.45), 0 12px 32px -22px rgba(0, 0, 0, 0.8);
}
[data-theme="light"] {
  color-scheme: light;
  --bg: #f2f4f8;
  --bg-2: #ffffff;
  --surface: #ffffff;
  --surface-2: #f6f8fb;
  --surface-3: #eceff5;
  --border: #e1e6ee;
  --border-2: #c9d2e0;
  --text: #0f1729;
  --text-2: #4b5568;
  --text-3: #8691a4;
  --accent: #3b66e0;
  --accent-2: #2f56c6;
  --accent-soft: rgba(59, 102, 224, 0.1);
  --ok: #17994f;
  --ok-soft: rgba(23, 153, 79, 0.12);
  --warn: #c47d08;
  --warn-soft: rgba(196, 125, 8, 0.13);
  --bad: #d93b3b;
  --bad-soft: rgba(217, 59, 59, 0.11);
  --info: #0a86c7;
  --info-soft: rgba(10, 134, 199, 0.11);
  --grid: #e8ecf3;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 14px 34px -28px rgba(16, 24, 40, 0.4);
}

* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  height: 100%;
}
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
}
a {
  color: var(--accent);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}
h1,
h2,
h3,
p {
  margin-top: 0;
}
h1,
h2,
h3 {
  font-weight: 650;
}
button,
input,
select {
  font-family: inherit;
}
::selection {
  background: var(--accent-soft);
}
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border-2) transparent;
}
.num {
  font-variant-numeric: tabular-nums;
  unicode-bidi: isolate;
}
.hidden {
  display: none !important;
}
.muted {
  color: var(--text-2);
}
.good {
  color: var(--ok);
}
.warn {
  color: var(--warn);
}
.bad {
  color: var(--bad);
}
.ic {
  flex: none;
  vertical-align: -3px;
}
.card,
.btn,
.input,
.chip,
.sidebar,
.topbar {
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}

/* ---------- shell ---------- */
.app {
  display: grid;
  grid-template-columns: var(--sbw) minmax(0, 1fr);
  min-height: 100vh;
}
.app.bare {
  display: block;
}
.app.sb-collapsed {
  --sbw: 68px;
}
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-2);
  border-inline-end: 1px solid var(--border);
  z-index: 30;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 14px 12px;
  color: var(--text);
  font-size: 15px;
  white-space: nowrap;
}
.brand:hover {
  text-decoration: none;
}
.brand-text b {
  color: var(--accent);
}
.brand-text span {
  color: var(--text-2);
  font-weight: 500;
}
.nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px 10px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
}
.nav-item:hover {
  background: var(--surface-2);
  color: var(--text);
  text-decoration: none;
}
.nav-item.active {
  background: var(--accent-soft);
  color: var(--accent);
}
.nav-cta {
  margin: 6px 0;
  color: var(--accent);
  border: 1px solid var(--border-2);
}
.nav-cta:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.nav-cta.active {
  border-color: var(--accent);
}
.nav-badge {
  margin-inline-start: auto;
  background: var(--surface-3);
  color: var(--text-2);
  font-size: 11.5px;
  padding: 0 7px;
  border-radius: 999px;
  line-height: 18px;
}
.nav-badge:empty {
  display: none;
}
.sb-foot {
  margin-top: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-top: 1px solid var(--border);
}
.conn {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--text-2);
  padding: 0 4px;
  white-space: nowrap;
}
.sb-tools {
  display: flex;
  gap: 4px;
  justify-content: space-between;
}
.version {
  font-size: 11.5px;
  color: var(--text-3);
  padding: 0 4px;
}
[dir="rtl"] .app:not(.sb-collapsed) #sb-btn .ic,
.app.sb-collapsed #sb-btn .ic {
  transform: rotate(180deg);
}

.main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: 58px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 24px;
  background: color-mix(in srgb, var(--bg) 84%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar h1 {
  font-size: 18px;
  font-weight: 700;
}
.topbar-right {
  margin-inline-start: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}
.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
  font-size: 13px;
}
.live-pill:hover {
  text-decoration: none;
  filter: brightness(1.1);
}
.live-pill .ic {
  animation: pulse 1.4s ease-in-out infinite;
}
@keyframes pulse {
  50% {
    opacity: 0.3;
  }
}
#banner {
  padding: 10px 24px 0;
}
#banner:empty {
  display: none;
}
.content {
  padding: 24px;
  width: 100%;
  max-width: 1560px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ---------- generic ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
}
.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.card-head h3 {
  font-size: 15px;
}
.sec-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 6px 0 -6px;
}
.sec-head h3 {
  font-size: 12.5px;
  color: var(--text-2);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.page-head h2 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 2px;
}
.page-head p {
  margin: 0;
  color: var(--text-2);
}
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.grid-2c {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.note {
  color: var(--text-2);
  font-size: 13.5px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-2);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  font-size: 13.5px;
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover {
  background: var(--surface-3);
  border-color: var(--text-3);
  text-decoration: none;
}
.btn:active {
  transform: translateY(1px);
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}
.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn.primary:hover {
  background: var(--accent-2);
  border-color: var(--accent-2);
}
.btn.danger {
  background: var(--bad);
  border-color: var(--bad);
  color: #fff;
}
.btn.danger:hover {
  filter: brightness(1.08);
}
.btn.ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-2);
}
.btn.ghost:hover {
  background: var(--surface-2);
  color: var(--text);
}
.btn.danger-text:hover {
  color: var(--bad);
}
.btn.sm {
  padding: 5px 10px;
  font-size: 13px;
}
.btn.lg {
  padding: 11px 20px;
  font-size: 15px;
}
.btn.block {
  width: 100%;
}
.iconbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
}
.iconbtn:hover {
  background: var(--surface-3);
  color: var(--text);
}
/* one that cannot be used now; why it cannot is the tooltip of the span around it */
.iconbtn:disabled {
  opacity: 0.4;
  cursor: default;
  pointer-events: none;
}
.row-why {
  display: inline-flex;
}
.iconbtn.wide {
  width: auto;
  padding: 0 10px;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 700;
  white-space: nowrap;
}
.pill::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}
.pill.ok {
  background: var(--ok-soft);
  color: var(--ok);
}
.pill.busy {
  background: var(--accent-soft);
  color: var(--accent);
}
.pill.busy::before {
  animation: pulse 1.2s infinite;
}
.pill.info {
  background: var(--info-soft);
  color: var(--info);
}
.pill.warn {
  background: var(--warn-soft);
  color: var(--warn);
}
.pill.bad {
  background: var(--bad-soft);
  color: var(--bad);
}
.pill.off {
  background: var(--surface-3);
  color: var(--text-2);
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 12px;
  background: var(--surface-3);
  color: var(--text-2);
  font-weight: 700;
  white-space: nowrap;
}
.badge.warn {
  background: var(--warn-soft);
  color: var(--warn);
}
.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--text-3);
  flex: none;
  display: inline-block;
}
.dot.on {
  background: var(--ok);
  box-shadow: 0 0 0 3px var(--ok-soft);
}
.dot.run {
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.dot.off {
  background: var(--text-3);
}

.alert {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
}
.alert .ic {
  margin-top: 2px;
}
.alert.info {
  background: var(--info-soft);
}
.alert.info .ic {
  color: var(--info);
}
.alert.ok {
  background: var(--ok-soft);
}
.alert.ok .ic {
  color: var(--ok);
}
.alert.warn {
  background: var(--warn-soft);
}
.alert.warn .ic {
  color: var(--warn);
}
.alert.bad {
  background: var(--bad-soft);
}
.alert.bad .ic {
  color: var(--bad);
}

/* ---------- forms ---------- */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}
.field:last-child {
  margin-bottom: 0;
}
.field > label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
}
.input {
  width: 100%;
  padding: 8px 11px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-2);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  outline: none;
}
.input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.input.lg {
  font-size: 16px;
  font-weight: 600;
  padding: 9px 12px;
}
.input.sm {
  width: 110px;
  padding: 5px 9px;
  font-size: 13px;
}
.input:disabled {
  opacity: 0.5;
}
#f-calls {
  width: 150px;
}
select.input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238691a4' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 16px;
  padding-inline-end: 30px;
  cursor: pointer;
}
[dir="rtl"] select.input {
  background-position: left 10px center;
}
.hint {
  font-size: 12.5px;
  color: var(--text-3);
}
.chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.chip {
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--border-2);
  background: var(--surface-2);
  color: var(--text-2);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.chip:hover {
  color: var(--text);
  border-color: var(--text-3);
}
.chip.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}
.seg {
  display: inline-flex;
  align-self: flex-start;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 3px;
  gap: 2px;
}
.seg-btn {
  border: 0;
  background: transparent;
  color: var(--text-2);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 7px;
  cursor: pointer;
  display: inline-flex;
  gap: 6px;
  align-items: center;
}
.seg-btn:hover {
  color: var(--text);
}
.seg-btn.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}
.seg-n {
  font-size: 11.5px;
  color: var(--text-3);
  background: var(--surface-3);
  border-radius: 999px;
  padding: 0 6px;
  line-height: 16px;
}
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.toolbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}
.switch-row {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  padding: 4px 0;
}
.switch {
  position: relative;
  width: 40px;
  height: 22px;
  flex: none;
}
.switch input {
  position: absolute;
  opacity: 0;
  inset: 0;
  margin: 0;
  cursor: pointer;
  z-index: 1;
}
.switch i {
  position: absolute;
  inset: 0;
  background: var(--surface-3);
  border-radius: 999px;
}
.switch i::after {
  content: "";
  position: absolute;
  top: 3px;
  inset-inline-start: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}
.switch input:checked + i {
  background: var(--accent);
}
.switch input:checked + i::after {
  transform: translateX(18px);
}
[dir="rtl"] .switch input:checked + i::after {
  transform: translateX(-18px);
}
.switch-text {
  font-size: 13.5px;
  font-weight: 600;
  display: flex;
  flex-direction: column;
  flex: 1;
}
.switch-text small {
  font-weight: 400;
  color: var(--text-3);
  font-size: 12.5px;
}

/* ---------- new test ---------- */
.newtest {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 16px;
  align-items: start;
}
.newtest-main {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}
.newtest-side {
  position: sticky;
  top: 74px;
}
.sec .step-head {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 14px;
}
.sec h3 {
  font-size: 15.5px;
}
.sec .sec-head p {
  margin: 1px 0 0;
  font-size: 13px;
}
.step {
  flex: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
}
.summary {
  padding: 0;
  overflow: hidden;
}
.sum-title {
  padding: 14px 18px 10px;
  font-size: 15px;
  border-bottom: 1px solid var(--border);
}
.sum-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 18px;
  font-size: 13.5px;
  border-bottom: 1px solid var(--border);
}
.sum-row > span {
  color: var(--text-2);
}
.sum-row > div {
  text-align: end;
  font-weight: 600;
}
.cap {
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
}
.cap-bar {
  height: 6px;
  border-radius: 999px;
  background: var(--surface-3);
  overflow: hidden;
  margin-bottom: 8px;
}
.cap-bar span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--ok);
  transition: width 0.2s;
}
.cap.warn .cap-bar span {
  background: var(--warn);
}
.cap.bad .cap-bar span {
  background: var(--bad);
}
.cap-text {
  font-size: 13px;
  color: var(--text-2);
}
.checkrow {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin-top: 10px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
}
.checkrow input {
  margin-top: 3px;
  accent-color: var(--accent);
  width: 15px;
  height: 15px;
  flex: none;
}
.sum-actions {
  padding: 12px 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.summary .alert {
  margin: 10px 18px 0;
  border-radius: var(--radius-sm);
}
.saver {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.pick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.pick {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  text-align: start;
  font: inherit;
  color: var(--text);
  background: var(--surface-2);
  border: 1.5px solid var(--border-2);
  border-radius: var(--radius-sm);
  padding: 11px 12px;
  cursor: pointer;
}
.pick:hover {
  border-color: var(--text-3);
  background: var(--surface-3);
}
.pick.sel {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.pick-check {
  flex: none;
  width: 18px;
  height: 18px;
  border-radius: 5px;
  border: 1.5px solid var(--border-2);
  background: var(--surface);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: transparent;
  margin-top: 1px;
}
.pick.sel .pick-check {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.pick-body {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.pick-name {
  font-weight: 700;
  font-size: 14px;
}
.pick-meta {
  font-size: 12.5px;
  color: var(--text-2);
}
.pick-cap {
  font-size: 12.5px;
  color: var(--text-3);
}
.pick.off {
  opacity: 0.55;
  cursor: not-allowed;
}

/* ---------- what an agent is doing: free, busy, reserved, away ---------- */
.pick-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.pick-counts {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--text-2);
}
.pick-count {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.pick-count i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-3);
}
.pick-count b {
  color: var(--text);
}
.pick-count.free i {
  background: var(--ok);
}
.pick-count.busy i {
  background: var(--accent);
}
.pick-count.reserved i {
  background: var(--warn);
}
.pick-state {
  margin-inline-start: auto;
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
  font-size: 12.5px;
  font-weight: 700;
  white-space: nowrap;
}
.pick-state small {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-2);
}
.pick-state.free {
  color: var(--ok);
}
.pick-state.offline {
  color: var(--text-3);
  font-weight: 600;
}
.pick-state.busy b {
  color: var(--accent);
}
.pick-state.reserved b {
  color: var(--warn);
}
.pick.st-busy {
  border-inline-start: 3px solid var(--accent);
}
.pick.st-reserved {
  border-inline-start: 3px solid var(--warn);
}
.chipstatic.free {
  color: var(--ok);
}
.chipstatic.busy {
  background: var(--accent-soft);
  color: var(--accent);
}
.chipstatic.reserved {
  background: var(--warn-soft);
  color: var(--warn);
}
#ag-bar {
  margin-bottom: -4px;
}

/* ---------- run view ---------- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 13px 16px;
  min-width: 0;
}
.kpi-l {
  font-size: 12.5px;
  color: var(--text-2);
  font-weight: 600;
}
.kpi-v {
  font-size: 24px;
  font-weight: 700;
  margin: 2px 0;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.kpi-s {
  font-size: 12.5px;
  color: var(--text-3);
}
.kpi.good {
  border-inline-start: 3px solid var(--ok);
}
.kpi.warn {
  border-inline-start: 3px solid var(--warn);
}
.kpi.warn .kpi-v {
  color: var(--warn);
}
.kpi.bad {
  border-inline-start: 3px solid var(--bad);
}
.kpi.na .kpi-v {
  color: var(--text-3);
}
.run-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.run-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.run-title {
  font-size: 16px;
  font-weight: 700;
}
.run-sub {
  font-size: 13px;
  color: var(--text-2);
  margin-top: 1px;
}
.run-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.run-clock {
  font-size: 15px;
  font-weight: 600;
  display: flex;
  gap: 4px;
  align-items: baseline;
}
.progress {
  width: 200px;
  height: 6px;
  border-radius: 999px;
  background: var(--surface-3);
  overflow: hidden;
}
.progress-fill {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
  transition: width 0.5s linear;
}
.progress-fill.stopping {
  background: var(--warn);
}
.chart {
  position: relative;
  width: 100%;
}
.chart-svg {
  display: block;
  width: 100%;
  overflow: visible;
}
.chart-svg text {
  font-size: 11px;
  fill: var(--text-3);
  font-family: var(--font);
}
.chart-svg .ax-empty {
  fill: var(--text-2);
  font-size: 13px;
}
.chart-svg .grid {
  stroke: var(--grid);
  stroke-width: 1;
}
.chart-svg .hover-line {
  stroke: var(--border-2);
  stroke-width: 1;
  stroke-dasharray: 3 3;
}
/* the chart is drawn left-to-right in both languages, so the tip is placed physically */
.tip {
  position: absolute;
  left: 0;
  top: 0;
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: 8px;
  padding: 8px 10px;
  box-shadow: var(--shadow);
  pointer-events: none;
  font-size: 12.5px;
  min-width: 150px;
  z-index: 5;
  direction: ltr;
}
.tip-t {
  font-weight: 700;
  margin-bottom: 4px;
  color: var(--text-2);
}
.tip-row {
  display: flex;
  align-items: center;
  gap: 6px;
}
.tip-row i {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  display: inline-block;
}
.tip-row span {
  color: var(--text-2);
  flex: 1;
}
.legend {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 12.5px;
  color: var(--text-2);
}
.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.legend-item i {
  width: 10px;
  height: 3px;
  border-radius: 2px;
  display: inline-block;
}
.legend-item b {
  color: var(--text);
  font-weight: 600;
}
.tablewrap {
  overflow-x: auto;
}
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
.data th {
  text-align: start;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-3);
  font-weight: 700;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.data th.num,
.data td.num {
  text-align: end;
}
.data td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.data tr:last-child td {
  border-bottom: 0;
}
.data td.cell-clip {
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.data td.cell-act {
  width: 1%;
  white-space: nowrap;
}
.iconbtn.danger-text {
  color: var(--text-3);
}
.iconbtn.danger-text:hover {
  color: var(--bad);
}
.data.clickable tbody tr {
  cursor: pointer;
}
.data.clickable tbody tr:hover {
  background: var(--surface-2);
}
.data .sub {
  font-size: 12px;
  color: var(--text-3);
}
.nowrap {
  white-space: nowrap;
}
.small {
  font-size: 12.5px;
}
.verdict {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.verdict .ic {
  flex: none;
  margin-top: 2px;
}
.verdict.good {
  background: var(--ok-soft);
}
.verdict.good .ic {
  color: var(--ok);
}
.verdict.warn {
  background: var(--warn-soft);
}
.verdict.warn .ic {
  color: var(--warn);
}
.verdict.bad {
  background: var(--bad-soft);
}
.verdict.bad .ic {
  color: var(--bad);
}
.verdict.na {
  background: var(--info-soft);
}
.verdict.na .ic {
  color: var(--info);
}
.verdict > div {
  flex: 1;
  min-width: 0;
}
.verdict-head {
  font-size: 16px;
  font-weight: 700;
}
.vgrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 8px 18px;
  margin-top: 10px;
}
.vrow {
  display: flex;
  flex-direction: column;
  gap: 1px;
  font-size: 13.5px;
}
.vrow > span {
  color: var(--text-2);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.errlist {
  margin-top: 10px;
  color: var(--bad);
  font-size: 13px;
}

/* ---------- empty states, dashboard ---------- */
#dash-empty,
#dash-run,
#run-body,
#run-detail {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.run-strip {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 14px;
}
.run-strip-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-3);
  white-space: nowrap;
}
.run-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  flex: 1;
}
.run-chips .slot {
  display: flex;
}
.run-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 11px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-2);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  text-align: start;
}
.run-chip:hover {
  border-color: var(--text-3);
  background: var(--surface-3);
}
.run-chip.sel {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.run-chip .ic {
  color: var(--accent);
}
.run-chip.waiting .ic {
  color: var(--warn);
  animation: pulse 1.6s ease-in-out infinite;
}
.run-chip-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.run-chip-name {
  font-weight: 700;
}
.run-chip-meta {
  font-size: 11.5px;
  color: var(--text-3);
  white-space: nowrap;
}
.run-chip > b {
  font-size: 13px;
  color: var(--text-2);
}
.run-chip.waiting > b {
  color: var(--warn);
  font-size: 12px;
}
/* a test that has not started yet: what it waits for */
.wait-card {
  border-inline-start: 3px solid var(--warn);
}
.wait-in {
  display: flex;
  gap: 12px;
}
.wait-in > .ic {
  flex: none;
  color: var(--warn);
  margin-top: 2px;
}
.wait-in > div {
  flex: 1;
  min-width: 0;
}
.wait-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 14px;
}
.wait-in .note {
  margin-top: 8px;
}
.wait-in.never > .ic {
  color: var(--text-2);
}
.wait-card.never {
  border-inline-start-color: var(--text-3);
}
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
  padding: 48px 24px;
  color: var(--text-2);
}
.empty h3 {
  color: var(--text);
  font-size: 17px;
  margin: 6px 0 0;
}
.empty p {
  margin: 0 0 10px;
  max-width: 460px;
}
.empty > .ic {
  color: var(--text-3);
}
.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 54px 24px;
  gap: 8px;
}
.hero-ic {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  background: var(--accent-soft);
  color: var(--accent);
  display: grid;
  place-items: center;
  margin-bottom: 4px;
}
.hero h2 {
  font-size: 24px;
}
.hero p {
  margin: 0;
  max-width: 560px;
  color: var(--text-2);
  font-size: 15px;
}
.hero-actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
  flex-wrap: wrap;
  justify-content: center;
}
.empty-inline {
  padding: 18px;
  text-align: center;
  color: var(--text-3);
  font-size: 13.5px;
}
.mini-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}
.mini {
  padding: 13px 16px;
}
.mini-head {
  display: flex;
  align-items: center;
  gap: 8px;
}
.mini-head .pill {
  margin-inline-start: auto;
}
.mini-rows {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 13px;
  color: var(--text-2);
  margin-top: 8px;
}
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13.5px;
  font-weight: 600;
}

/* ---------- tests ---------- */
.tests-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 14px;
}
.tests-grid > .empty {
  grid-column: 1 / -1;
}
.test-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.test-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.test-name {
  font-size: 15.5px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.test-target {
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
}
.test-meta {
  font-size: 13px;
  color: var(--text-2);
}
.test-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 6px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  font-size: 12.5px;
  flex-wrap: wrap;
}
.row-actions {
  display: flex;
  gap: 2px;
}
.chipstatic {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--surface-3);
  font-size: 12px;
  font-weight: 600;
}
.chipstatic.off {
  color: var(--bad);
  text-decoration: line-through;
}
.just-started {
  box-shadow: 0 0 0 2px var(--accent-soft);
}

/* ---------- devices ---------- */
.dev-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
  gap: 14px;
}
.device {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.device.offline {
  opacity: 0.7;
}
.dev-head {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
}
.dev-name {
  font-weight: 700;
  font-size: 15px;
}
.dev-role {
  font-size: 12.5px;
  color: var(--text-3);
}
.dev-right {
  margin-inline-start: auto;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.specs {
  font-size: 13px;
  color: var(--text-2);
}
.bars {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.bar {
  display: grid;
  grid-template-columns: 46px 1fr auto;
  align-items: center;
  gap: 10px;
  font-size: 12.5px;
}
.bar-label {
  color: var(--text-2);
  font-weight: 600;
}
.bar-track {
  height: 7px;
  border-radius: 999px;
  background: var(--surface-3);
  overflow: hidden;
}
.bar-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
  transition: width 0.4s;
}
.bar.warn .bar-fill {
  background: var(--warn);
}
.bar-text {
  color: var(--text-2);
  white-space: nowrap;
  min-width: 150px;
  text-align: end;
}
.nics {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.nic {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
}
.nic.active {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.nic-head {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.nic-name {
  font-weight: 600;
  font-size: 13px;
}
.nic-ips {
  margin-inline-start: auto;
  font-size: 12.5px;
  color: var(--text-2);
}
.nic .bar {
  grid-template-columns: 1fr auto;
  margin-top: 6px;
}
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11.5px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--text-2);
  white-space: nowrap;
}
.tag.hot {
  background: var(--accent);
  color: #fff;
}
.dev-foot {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 12.5px;
  color: var(--text-2);
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

/* ---------- schedule ---------- */
.sch-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 14px;
}
.sch-grid > .empty {
  grid-column: 1 / -1;
}
.sch-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sch-card.off > :not(.sch-head) {
  opacity: 0.6;
}
.sch-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}
.sch-when {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.sch-time {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.1;
}
.sch-days {
  font-size: 12.5px;
  color: var(--text-2);
}
.sch-test {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 14px;
}
.sch-card .test-meta .sub {
  font-size: 12px;
  color: var(--warn);
}
.sch-rows {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}
.sch-row {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr);
  gap: 10px;
  align-items: baseline;
}
.sch-row > span {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-3);
}
.sch-row > div {
  font-size: 13.5px;
}
.sch-waiting {
  font-size: 12.5px;
  color: var(--text-2);
  margin-top: 3px;
}
.sch-card .alert {
  margin-top: 2px;
}

/* ---------- toasts, modal ---------- */
.toasts {
  position: fixed;
  bottom: 18px;
  inset-inline-end: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 100;
  max-width: 380px;
}
.toast {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 11px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border-2);
  box-shadow: var(--shadow);
  font-size: 13.5px;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s, transform 0.2s;
}
.toast.in {
  opacity: 1;
  transform: none;
}
.toast.ok .ic {
  color: var(--ok);
}
.toast.bad .ic {
  color: var(--bad);
}
.toast.warn .ic {
  color: var(--warn);
}
.toast.info .ic {
  color: var(--info);
}
.toast-msg {
  flex: 1;
}
.toast-x {
  border: 0;
  background: none;
  color: var(--text-3);
  cursor: pointer;
  padding: 0;
  margin-top: 2px;
}
.modal-bg {
  position: fixed;
  inset: 0;
  background: rgba(5, 8, 14, 0.6);
  display: grid;
  place-items: center;
  z-index: 90;
  opacity: 0;
  transition: opacity 0.2s;
  padding: 20px;
}
.modal-bg.in {
  opacity: 1;
}
.modal {
  width: 100%;
  max-width: 520px;
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: 14px;
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.7);
  transform: translateY(6px);
  transition: transform 0.2s;
}
.modal-bg.in .modal {
  transform: none;
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.modal-head h3 {
  font-size: 16px;
}
.modal-body {
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.modal-body p {
  margin: 0;
  color: var(--text-2);
}
.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
}
.steps {
  margin: 0;
  padding-inline-start: 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--text-2);
  font-size: 13.5px;
}
.codebox {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 8px 8px 12px;
  direction: ltr;
  text-align: left;
}
.codebox code {
  flex: 1;
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-all;
}

/* ---------- connection screen ---------- */
.conn-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: radial-gradient(1100px 520px at 50% -10%, var(--accent-soft), transparent 60%), var(--bg);
}
.conn-card {
  width: 100%;
  max-width: 470px;
  padding: 34px 30px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-start;
}
.conn-card h1 {
  font-size: 14px;
  color: var(--text-2);
  font-weight: 600;
  margin-top: 8px;
}
.conn-card h2 {
  font-size: 22px;
}
.conn-card p {
  margin: 0 0 8px;
}
#conn-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}
.conn-card .alert {
  width: 100%;
}

/* ---------- narrow screens ---------- */
.only-mobile {
  display: none !important;
}
.backdrop {
  display: none;
}
@media (min-width: 921px) {
  .app.sb-collapsed .nav-text,
  .app.sb-collapsed .brand-text,
  .app.sb-collapsed .nav-badge,
  .app.sb-collapsed .conn,
  .app.sb-collapsed .version {
    display: none;
  }
  .app.sb-collapsed .nav-item,
  .app.sb-collapsed .brand {
    justify-content: center;
    padding-inline: 0;
  }
}
@media (max-width: 1200px) {
  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 1100px) {
  .grid-2 {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 1000px) {
  .newtest {
    grid-template-columns: 1fr;
  }
  .newtest-side {
    position: static;
  }
}
@media (max-width: 920px) {
  .app:not(.bare) {
    grid-template-columns: 1fr;
  }
  #sb-btn {
    display: none;
  }
  .sidebar {
    position: fixed;
    inset-block: 0;
    inset-inline-start: 0;
    width: 250px;
    transform: translateX(-100%);
    transition: transform 0.2s;
  }
  [dir="rtl"] .sidebar {
    transform: translateX(100%);
  }
  .app.mobile-open .sidebar {
    transform: none;
  }
  .app.mobile-open .backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(5, 8, 14, 0.5);
    z-index: 25;
  }
  .only-mobile {
    display: inline-flex !important;
  }
  .content {
    padding: 14px;
  }
  .topbar {
    padding: 0 14px;
  }
  #banner {
    padding: 10px 14px 0;
  }
  .kpi-v {
    font-size: 20px;
  }
}
@media (max-width: 640px) {
  .grid-2c {
    grid-template-columns: 1fr;
  }
  .dev-grid {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 520px) {
  .kpi-grid {
    grid-template-columns: 1fr;
  }
  #top-new span {
    display: none;
  }
  .progress {
    width: 120px;
  }
  .switch-row {
    flex-wrap: wrap;
  }
  .switch-row .input {
    margin-inline-start: 52px;
  }
}

/* ---------- modules (what a test sends) ---------- */
.module-pick {
  margin-bottom: 4px;
}
.mod-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 12px;
}
.mod {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  text-align: start;
  font: inherit;
  color: var(--text);
  background: var(--surface-2);
  border: 1.5px solid var(--border-2);
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.mod:hover {
  border-color: var(--text-3);
  background: var(--surface-3);
}
.mod.sel {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.mod-ic {
  flex: none;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--surface);
  color: var(--accent);
}
.mod-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  padding-inline-end: 22px;
}
.mod-body b {
  font-size: 15px;
}
.mod-body span {
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-2);
}
.mod-check {
  position: absolute;
  top: 12px;
  inset-inline-end: 12px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: none;
  place-items: center;
}
.mod.sel .mod-check {
  display: grid;
}
.tag.reg {
  background: var(--accent-soft);
  color: var(--accent);
}

/* ---------- agents table ---------- */
#ag-table table {
  min-width: 980px;
}
#ag-table td {
  vertical-align: middle;
}
#ag-table td .sub {
  font-size: 12px;
  color: var(--text-3);
  white-space: nowrap;
}
#ag-table .tag {
  white-space: nowrap;
}
#ag-notes .alert {
  margin-top: 12px;
}
.modal .device {
  border: 0;
  box-shadow: none;
  background: transparent;
  padding: 4px 0 0;
}
details.more {
  margin: 10px 0 4px;
}
details.more > summary {
  cursor: pointer;
  font-size: 13px;
  color: var(--text-2);
}
details.more[open] > summary {
  margin-bottom: 12px;
}
#ag-table td > .num,
#ag-table td > span:first-child {
  white-space: nowrap;
}
#ag-table td.cell-state {
  max-width: 210px;
}
#ag-table td.cell-state .sub {
  white-space: normal;
  line-height: 1.35;
}
#styles {
  margin-bottom: 16px;
}
textarea.input {
  min-height: 78px;
  line-height: 1.5;
  resize: vertical;
}
