/* IDXTech Lab Console — dark ops-console identity, deliberately single-theme.
   An operations console commits to dark; every color below is explicit. */

:root {
  --ink: #0d1214;
  --panel: #151b1e;
  --panel-raised: #1c2327;
  --panel-hover: #212a2e;
  --line: #262e32;
  --line-soft: #1e2529;
  --text: #e6edef;
  --text-dim: #93a1a6;
  --text-faint: #5b666b;

  --accent: #35c9c0;
  --accent-dim: #1f7a75;
  --accent-ink: #06201e;

  --good: #4caf6d;
  --good-dim: #1f3f2a;
  --warn: #e0a526;
  --warn-dim: #4a3a17;
  --bad: #e5484d;
  --bad-dim: #4a1f21;

  --radius: 10px;
  --radius-sm: 6px;

  --font-ui: -apple-system, "Segoe UI", "Helvetica Neue", ui-sans-serif, system-ui, sans-serif;
  --font-mono: ui-monospace, "Cascadia Mono", "SF Mono", "JetBrains Mono", "Roboto Mono", monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--ink);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
  overflow-x: hidden;
}

a {
  color: var(--accent);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

button {
  font-family: inherit;
  cursor: pointer;
}

button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

h1,
h2,
h3 {
  margin: 0;
  text-wrap: balance;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.hidden {
  display: none !important;
}

/* ---------- Login ---------- */

#login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 30% 20%, #10171a 0%, var(--ink) 60%);
}

.login-card {
  width: min(380px, calc(100vw - 48px));
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 32px;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--accent-ink);
  border: 1px solid var(--accent-dim);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 15px;
  flex-shrink: 0;
}

.brand-text .brand-name {
  font-size: 15px;
  font-weight: 600;
}
.brand-text .brand-sub {
  font-size: 12px;
  color: var(--text-dim);
}

.field {
  margin-bottom: 16px;
}
.field label {
  display: block;
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.field input {
  width: 100%;
  background: var(--panel-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
}
.field input:focus {
  border-color: var(--accent-dim);
}
.field .hint {
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-faint);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--line);
  background: var(--panel-raised);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 500;
  transition: background 120ms ease, border-color 120ms ease;
}
.btn:hover {
  background: var(--panel-hover);
}
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
}
.btn-primary:hover {
  background: #45d4cb;
}
.btn-danger {
  border-color: var(--bad-dim);
  color: var(--bad);
}
.btn-danger:hover {
  background: var(--bad-dim);
}
.btn-block {
  width: 100%;
}

.login-error {
  margin-top: 12px;
  font-size: 13px;
  color: var(--bad);
  min-height: 18px;
}

.login-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--text-faint);
  margin: 18px 0 16px;
}
.login-divider::before,
.login-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

/* ---------- App shell ---------- */

#app {
  display: grid;
  grid-template-columns: 232px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--panel);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px 20px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 16px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.nav-label {
  font-size: 11px;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 8px 10px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-size: 13.5px;
  font-weight: 500;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}
.nav-item svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: 0.85;
}
.nav-item:hover {
  background: var(--panel-raised);
  color: var(--text);
}
.nav-item.active {
  background: var(--panel-raised);
  color: var(--text);
  box-shadow: inset 2px 0 0 var(--accent);
}

.sidebar-footer {
  border-top: 1px solid var(--line);
  padding-top: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent-dim);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}
.user-chip .who {
  min-width: 0;
}
.user-chip .name {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-chip .role {
  font-size: 11.5px;
  color: var(--text-faint);
}

.icon-btn {
  border: none;
  background: none;
  color: var(--text-faint);
  padding: 6px;
  border-radius: var(--radius-sm);
  display: flex;
}
.icon-btn:hover {
  color: var(--text);
  background: var(--panel-raised);
}
.icon-btn svg {
  width: 16px;
  height: 16px;
}

main {
  padding: 28px 36px 60px;
  max-width: 1180px;
}

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.page-head h1 {
  font-size: 21px;
}
.page-sub {
  font-size: 13px;
  color: var(--text-dim);
  margin-top: 4px;
}

.checked-at {
  font-size: 12px;
  color: var(--text-faint);
  margin-top: 2px;
}

/* ---------- Sections / grids ---------- */

section.view {
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.section-title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
  margin-bottom: 12px;
}

.grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}

.grid-2 {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}

/* Service status card: severity communicated by a left stripe, not a rainbow icon */
.service-card {
  position: relative;
  padding-left: 18px;
  overflow: hidden;
}
.service-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--text-faint);
}
.service-card[data-status="up"]::before {
  background: var(--good);
}
.service-card[data-status="down"]::before {
  background: var(--bad);
}
.service-card[data-status="checking"]::before {
  background: var(--text-faint);
}

.service-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.service-name {
  font-size: 14px;
  font-weight: 600;
}
.status-pill {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.status-pill.up {
  background: var(--good-dim);
  color: var(--good);
}
.status-pill.down {
  background: var(--bad-dim);
  color: var(--bad);
}
.status-pill.checking {
  background: var(--panel-raised);
  color: var(--text-faint);
}

.service-kind {
  font-size: 12px;
  color: var(--text-faint);
  margin-top: 2px;
}
.service-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12.5px;
  margin-top: 10px;
}

/* Stat tiles */
.stat-card .stat-value {
  font-family: var(--font-mono);
  font-size: 26px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.stat-card .stat-label {
  font-size: 12.5px;
  color: var(--text-dim);
  margin-top: 4px;
}
.stat-card.accent .stat-value {
  color: var(--accent);
}
.stat-card.good .stat-value {
  color: var(--good);
}

/* Node / server cards */
.node-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.node-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.node-name {
  font-size: 14px;
  font-weight: 600;
}
.node-meta {
  font-size: 12px;
  color: var(--text-faint);
  font-family: var(--font-mono);
}

.gauge-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.gauge-label-row {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-dim);
}
.gauge-label-row .val {
  font-family: var(--font-mono);
  color: var(--text);
}
.gauge-track {
  height: 6px;
  border-radius: 999px;
  background: var(--panel-raised);
  overflow: hidden;
}
.gauge-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
  transition: width 300ms ease;
}
.gauge-fill.warn {
  background: var(--warn);
}
.gauge-fill.bad {
  background: var(--bad);
}

/* Fleet comparison — ticker-board bars */
.fleet-bar-row {
  display: grid;
  grid-template-columns: 110px 1fr 90px;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line-soft);
}
.fleet-bar-row:last-child {
  border-bottom: none;
}
.fleet-bar-name {
  font-size: 13px;
  font-weight: 500;
}
.fleet-bar-track {
  height: 8px;
  border-radius: 999px;
  background: var(--panel-raised);
  overflow: hidden;
}
.fleet-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
}
.fleet-bar-fill.warn {
  background: var(--warn);
}
.fleet-bar-fill.bad {
  background: var(--bad);
}
.fleet-bar-value {
  font-family: var(--font-mono);
  font-size: 12.5px;
  text-align: right;
  color: var(--text-dim);
}

/* ---------- Tables ---------- */

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
table {
  width: 100%;
  border-collapse: collapse;
  min-width: 640px;
}
thead th {
  text-align: left;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-faint);
  font-weight: 600;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  position: sticky;
  top: 0;
}
tbody td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 13px;
  vertical-align: middle;
}
tbody tr:last-child td {
  border-bottom: none;
}
tbody tr:hover {
  background: var(--panel-raised);
}

.user-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}
.user-cell .name-block .u-name {
  font-weight: 500;
}
.user-cell .name-block .u-full {
  font-size: 12px;
  color: var(--text-faint);
}

.row-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}
.row-actions button {
  border: 1px solid var(--line);
  background: var(--panel-raised);
  color: var(--text-dim);
  border-radius: var(--radius-sm);
  padding: 5px 9px;
  font-size: 12px;
}
.row-actions button:hover {
  color: var(--text);
  background: var(--panel-hover);
}
.row-actions button.danger:hover {
  color: var(--bad);
  border-color: var(--bad-dim);
  background: var(--bad-dim);
}

/* ---------- Modal ---------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(4, 6, 7, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 20px;
}
.modal {
  width: min(420px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
}
.modal h2 {
  font-size: 17px;
}
.modal .modal-sub {
  font-size: 13px;
  color: var(--text-dim);
  margin-top: 4px;
  margin-bottom: 18px;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
}
.modal-error {
  font-size: 13px;
  color: var(--bad);
  margin-top: 4px;
  min-height: 16px;
}

.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--panel-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 13px;
  z-index: 60;
  max-width: 360px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}
.toast.error {
  border-color: var(--bad-dim);
  color: var(--bad);
}
.toast.success {
  border-color: var(--good-dim);
  color: var(--good);
}

.empty-state {
  color: var(--text-faint);
  font-size: 13px;
  padding: 30px 0;
  text-align: center;
}

.section-header-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.pw-reveal {
  font-family: var(--font-mono);
  background: var(--panel-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 13px;
  margin-top: 8px;
  word-break: break-all;
}

@media (max-width: 860px) {
  #app {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: static;
    height: auto;
    flex-direction: row;
    align-items: center;
    overflow-x: auto;
  }
  .sidebar-nav {
    flex-direction: row;
  }
  .sidebar-footer {
    display: none;
  }
  main {
    padding: 20px;
  }
}
