/* dolabra brand tokens — mirrors intranet/global.css palette (dark, lowercase, blue accent) */
:root {
  --bg: #000;
  --bg-elev-1: #0d0d0f;
  --bg-elev-2: #16161a;
  --blue: #4a90d9;
  --blue-dim: rgba(74, 144, 217, 0.15);
  --blue-text: #7eb6ef;
  --text: #e8e8ea;
  --text-dim: #9a9aa3;
  --text-muted: #6b6b75;
  --text-bright: #fff;
  --rule: #2a2a32;
  --rule-faint: #1c1c22;
  --green: #3d9a6a;
  --green-dim: rgba(61, 154, 106, 0.18);
  --amber: #c4922a;
  --amber-dim: rgba(196, 146, 42, 0.18);
  --red: #c45c5c;
  --red-dim: rgba(196, 92, 92, 0.18);
  --radius: 10px;
  --radius-sm: 6px;
  --max: 1280px;
  --font: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --mono: "IBM Plex Mono", "SF Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  min-height: 100vh;
}

.nav {
  position: sticky;
  top: 0;
  z-index: 20;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: rgba(0, 0, 0, 0.92);
  border-bottom: 1px solid var(--rule-faint);
  backdrop-filter: blur(8px);
}
.nav-left { display: flex; align-items: center; gap: 20px; min-width: 0; }
.nav-brand {
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text-bright);
  font-size: 13px;
  text-transform: lowercase;
  white-space: nowrap;
}
.nav-brand span { color: var(--blue-text); }
.nav-docs { display: flex; align-items: center; gap: 14px; }
.nav-docs a {
  font-size: 11px;
  text-transform: lowercase;
  color: var(--text-dim);
  text-decoration: none;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.nav-docs a:hover { color: var(--blue-text); }
.nav-meta { display: flex; align-items: center; gap: 12px; color: var(--text-dim); font-size: 12px; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--bg-elev-2);
  border: 1px solid var(--rule);
  font-size: 11px;
  text-transform: lowercase;
}
.pill .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); box-shadow: 0 0 8px var(--green); }
.pill.err .dot { background: var(--red); box-shadow: 0 0 8px var(--red); }

main { max-width: var(--max); margin: 0 auto; padding: 28px 24px 64px; }

.hero { margin-bottom: 24px; }
.section-label { color: var(--blue-text); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; margin: 0 0 8px; }
.section-heading { margin: 0 0 8px; font-size: 28px; font-weight: 550; color: var(--text-bright); letter-spacing: -0.02em; text-transform: lowercase; }
.section-heading.sub { font-size: 20px; margin-top: 8px; }
.section-body { margin: 0; color: var(--text-dim); max-width: 62ch; }

.ops-links { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin: 12px 0 0; }
.ops-links__label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); }
.ops-links__note { font-size: 11px; color: var(--text-muted); }

.kpi-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 24px 0 24px; }
.kpi-row--bots { grid-template-columns: repeat(2, 1fr); margin: 0 0 16px; }
@media (max-width: 900px) { .kpi-row { grid-template-columns: repeat(2, 1fr); } }
.kpi { background: var(--bg-elev-1); border: 1px solid var(--rule-faint); border-radius: var(--radius); padding: 16px 18px; }
.kpi-label { color: var(--text-muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 8px; }
.kpi-value { font-size: 26px; font-weight: 550; color: var(--text-bright); font-variant-numeric: tabular-nums; }
.kpi-value.amber { color: #e0c48a; }
.kpi-value.red { color: #e09090; }
.kpi-sub { margin-top: 4px; font-size: 12px; color: var(--text-dim); }

.grid-2 { display: grid; grid-template-columns: 1.5fr 1fr; gap: 16px; margin-bottom: 16px; }
.grid-2b { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
@media (max-width: 960px) { .grid-2, .grid-2b { grid-template-columns: 1fr; } }

/* --- tenant (partner-facing) instances: internal surfaces are hidden.
   The server already omits the data (route gates + scoped payloads); these
   rules only remove the empty chrome. --- */
body.tenant .internal-only { display: none !important; }
body.tenant .col-modal, body.tenant .col-controls { display: none; }
body.tenant .grid-2 { grid-template-columns: 1fr; }  /* failures spans full width */

.panel { background: var(--bg-elev-1); border: 1px solid var(--rule-faint); border-radius: var(--radius); overflow: hidden; }
.panel-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--rule-faint); }
.panel-title { margin: 0; font-size: 13px; font-weight: 550; text-transform: lowercase; color: var(--text-bright); }
.panel-title a { color: inherit; text-decoration: none; }
.panel-title a:hover { color: var(--blue-text); }
.name-link { color: inherit; text-decoration: none; }
.name-link:hover { color: var(--blue-text); }
.panel-hint { font-size: 11px; color: var(--text-muted); }
.panel-body { padding: 12px 16px 16px; }
.panel-body.scroll-x { overflow-x: auto; padding-top: 4px; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); font-weight: 500; padding: 8px 6px; border-bottom: 1px solid var(--rule); }
td { padding: 12px 6px; border-bottom: 1px solid var(--rule-faint); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
.mono { font-family: var(--mono); font-size: 12px; }
.muted { color: var(--text-muted); }
.bright { font-weight: 550; color: var(--text-bright); }

.status { display: inline-flex; align-items: center; gap: 6px; padding: 3px 8px; border-radius: var(--radius-sm); font-size: 11px; text-transform: lowercase; }
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-up { background: var(--green-dim); color: #6fcf97; }
.status-needs { background: var(--amber-dim); color: #e0c48a; }
.status-unknown { background: var(--blue-dim); color: var(--blue-text); }
.status-down { background: var(--red-dim); color: #e09090; }
.status-paused { background: var(--amber-dim); color: #e0c48a; }

.tag { display: inline-block; padding: 2px 7px; border-radius: 999px; border: 1px solid var(--rule); font-size: 10px; text-transform: lowercase; color: var(--text-dim); }
.tag.partner { color: var(--blue-text); border-color: rgba(74, 144, 217, 0.4); }

.actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.btn-link {
  display: inline-flex; align-items: center;
  font-size: 11px; text-transform: lowercase;
  border-radius: var(--radius-sm); border: 1px solid var(--rule);
  background: var(--bg-elev-2); color: var(--blue-text);
  padding: 5px 9px; text-decoration: none;
  transition: border-color 0.12s, color 0.12s;
}
.btn-link:hover { border-color: var(--blue); color: var(--text-bright); }
button {
  font-family: inherit; font-size: 11px; text-transform: lowercase;
  border-radius: var(--radius-sm); border: 1px solid var(--rule);
  background: var(--bg-elev-2); color: var(--text);
  padding: 6px 10px; cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
button:hover { border-color: var(--blue); color: var(--text-bright); }
button.primary { border-color: rgba(74, 144, 217, 0.5); background: var(--blue-dim); color: var(--blue-text); }
button.warn { border-color: rgba(196, 146, 42, 0.45); color: #e0c48a; background: var(--amber-dim); }
button.danger { border-color: rgba(196, 92, 92, 0.45); color: #e09090; background: var(--red-dim); }
button:disabled { opacity: 0.4; cursor: not-allowed; }

.needs-group { margin-bottom: 14px; }
.needs-group:last-child { margin-bottom: 0; }
.needs-group__head {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--blue-text); margin: 4px 0 6px;
}

.spark { display: block; width: 100%; height: 120px; }
.legend { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 10px; font-size: 11px; color: var(--text-muted); }
.legend i { display: inline-block; width: 14px; height: 3px; border-radius: 2px; margin-right: 6px; vertical-align: 3px; }

/* --- redesign v2: cost cells, ingenium chips, trend charts --- */
.cost { font-family: var(--mono); font-size: 12px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.cost .sep { color: var(--text-muted); padding: 0 2px; }
.cost.none { color: var(--text-muted); }      /* "-" = no identity mapped / no data */
.cost.zero { color: var(--text-dim); }        /* mapped, zero spend */
.shared-row td { background: rgba(74, 144, 217, 0.04); border-top: 1px solid var(--rule); font-size: 12px; }
.fail-chip { display: inline-block; min-width: 20px; text-align: center; padding: 2px 8px; border-radius: 999px; font-family: var(--mono); font-size: 11px; background: var(--red-dim); color: #e09090; }
.ok-chip { display: inline-block; min-width: 20px; text-align: center; padding: 2px 8px; border-radius: 999px; font-family: var(--mono); font-size: 11px; color: var(--text-muted); border: 1px solid var(--rule-faint); }
.err-row { background: var(--red-dim); border-radius: var(--radius-sm); padding: 10px 12px; font-size: 12px; color: #e09090; margin: 8px 0; }
.err-row .mono { color: #e8b0b0; overflow-wrap: anywhere; }
.sec-rule { margin: 34px 0 18px; border: 0; border-top: 1px solid var(--rule-faint); }
.trend-svg { display: block; width: 100%; height: auto; }

.toast {
  position: fixed; bottom: 24px; right: 24px;
  background: var(--bg-elev-2); border: 1px solid var(--rule); border-radius: var(--radius);
  padding: 12px 16px; max-width: 380px; box-shadow: 0 12px 40px rgba(0,0,0,0.5);
  display: none; z-index: 50;
}
.toast.show { display: block; }
.toast strong { display: block; font-size: 12px; color: var(--text-bright); margin-bottom: 4px; text-transform: lowercase; }
.toast span { font-size: 12px; color: var(--text-dim); overflow-wrap: anywhere; }

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.72);
  display: none; align-items: center; justify-content: center; z-index: 60; padding: 24px;
}
.modal-backdrop.show { display: flex; }
.modal { background: var(--bg-elev-1); border: 1px solid var(--rule); border-radius: var(--radius); padding: 22px 24px; width: min(440px, 100%); }
.modal h3 { margin: 0 0 8px; font-size: 16px; text-transform: lowercase; color: var(--text-bright); }
.modal p { margin: 0 0 16px; color: var(--text-dim); font-size: 13px; }
.modal input {
  width: 100%; margin-bottom: 16px; background: var(--bg);
  border: 1px solid var(--rule); border-radius: var(--radius-sm);
  color: var(--text); padding: 8px 10px; font-family: var(--mono); font-size: 13px;
}
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; }

.gate {
  max-width: 460px; margin: 12vh auto 0; text-align: center;
  background: var(--bg-elev-1); border: 1px solid var(--rule-faint);
  border-radius: var(--radius); padding: 40px 32px;
}
.gate h1 { font-size: 20px; text-transform: lowercase; color: var(--text-bright); margin: 0 0 8px; }
.gate p { color: var(--text-dim); font-size: 13px; margin: 0 0 20px; }

.foot { margin-top: 32px; padding-top: 16px; border-top: 1px solid var(--rule-faint); color: var(--text-muted); font-size: 11px; }
.hidden { display: none !important; }
