/* Oasis Mission Control
 *
 * Dark surface only, by request. Colors are the validated dark steps from the
 * house data-viz palette: page plane #0d0d0d, card surface #1a1a19, primary ink
 * #ffffff, secondary #c3c2b7, muted #898781, hairline #2c2c2a. Status steps
 * (good/warning/serious/critical) are reserved and always ship beside a text
 * label, so state is never carried by color alone.
 *
 * No inline styles anywhere: the CSP is default-src 'self' with style-src
 * 'self', which refuses style="..." attributes. Widths that must vary are set
 * through CSSOM (el.style.width), which the CSP does allow.
 */

:root {
  color-scheme: dark;

  --plane: #0d0d0d;
  --surface: #1a1a19;
  --surface-2: #201f1e;
  --ink: #ffffff;
  --ink-2: #c3c2b7;
  --ink-muted: #898781;
  --line: #2c2c2a;
  --line-strong: #383835;
  --ring: rgba(255, 255, 255, 0.1);

  --good: #0ca30c;
  --warning: #fab219;
  --serious: #ec835a;
  --critical: #d03b3b;

  --series-1: #3987e5;
  --series-2: #d95926;
  --series-3: #199e70;

  --radius: 14px;
  --radius-sm: 9px;
  --pad: 20px;

  --sans: system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  background: var(--plane);
  color: var(--ink);
  font: 400 15px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
p,
dl,
dd,
dt,
ol,
ul {
  margin: 0;
  padding: 0;
}

ol,
ul {
  list-style: none;
}

code {
  font-family: var(--mono);
  font-size: 0.82em;
}

/* ── sign in ─────────────────────────────────────────────────────────── */

.gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(900px 460px at 50% 0%, rgba(57, 135, 229, 0.16), transparent 70%),
    var(--plane);
}

.gate-card {
  width: 100%;
  max-width: 384px;
  padding: 32px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
}

.gate-eyebrow {
  color: var(--series-1);
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.gate-title {
  margin-top: 6px;
  font-size: 26px;
  font-weight: 620;
  letter-spacing: -0.01em;
}

.gate-sub {
  margin-top: 8px;
  color: var(--ink-muted);
  font-size: 13.5px;
}

.gate-form {
  margin-top: 26px;
  display: grid;
  gap: 14px;
}

.field {
  display: grid;
  gap: 7px;
}

.field-label {
  color: var(--ink-2);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.field-input {
  width: 100%;
  padding: 11px 13px;
  color: var(--ink);
  background: var(--plane);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  font: 400 15px var(--sans);
}

.field-input:focus-visible {
  outline: 2px solid var(--series-1);
  outline-offset: 1px;
}

.btn {
  padding: 11px 16px;
  color: #04121f;
  background: var(--series-1);
  border: 0;
  border-radius: var(--radius-sm);
  font: 620 14.5px var(--sans);
  cursor: pointer;
}

.btn:hover {
  filter: brightness(1.08);
}

.btn:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.btn[disabled] {
  opacity: 0.55;
  cursor: progress;
}

.btn-ghost {
  color: var(--ink-2);
  background: transparent;
  border: 1px solid var(--line-strong);
  font-weight: 550;
  font-size: 13px;
  padding: 8px 13px;
}

.btn-ghost:hover {
  color: var(--ink);
  background: var(--surface-2);
  filter: none;
}

.gate-error {
  padding: 9px 12px;
  color: var(--critical);
  background: rgba(208, 59, 59, 0.12);
  border: 1px solid rgba(208, 59, 59, 0.4);
  border-radius: var(--radius-sm);
  font-size: 13.5px;
}

.gate-foot {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  color: var(--ink-muted);
  font-size: 12px;
}

/* ── shell ───────────────────────────────────────────────────────────── */

.shell {
  display: grid;
  grid-template-columns: 252px minmax(0, 1fr);
  min-height: 100vh;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 22px 16px;
  background: var(--surface);
  border-right: 1px solid var(--line);
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 6px 16px;
  border-bottom: 1px solid var(--line);
}

.brand-mark {
  width: 30px;
  height: 30px;
  flex: none;
  border-radius: 9px;
  background: linear-gradient(150deg, var(--series-1), #1c5cab 70%);
  box-shadow: inset 0 0 0 1px var(--ring);
}

.brand-text {
  display: grid;
  line-height: 1.25;
}

.brand-text strong {
  font-size: 15px;
  font-weight: 650;
  letter-spacing: 0.01em;
}

.brand-text em {
  color: var(--ink-muted);
  font-size: 11.5px;
  font-style: normal;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.nav-list {
  display: grid;
  gap: 2px;
  align-content: start;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.nav-group {
  margin: 14px 8px 5px;
  color: var(--ink-muted);
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  color: var(--ink-2);
  background: transparent;
  border: 0;
  border-radius: var(--radius-sm);
  font: 550 14px var(--sans);
  text-align: left;
  cursor: pointer;
}

.nav-item:hover {
  color: var(--ink);
  background: var(--surface-2);
}

.nav-item.is-current {
  color: var(--ink);
  background: rgba(57, 135, 229, 0.14);
  box-shadow: inset 0 0 0 1px rgba(57, 135, 229, 0.34);
}

.nav-glyph {
  width: 17px;
  color: var(--ink-muted);
  font-size: 13px;
  text-align: center;
}

.nav-item.is-current .nav-glyph {
  color: var(--series-1);
}

.nav-count {
  margin-left: auto;
  padding: 1px 7px;
  color: var(--ink-muted);
  background: var(--plane);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.nav-foot {
  display: grid;
  gap: 6px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.nav-foot-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--ink-muted);
  font-size: 11.5px;
}

.nav-foot-row b {
  color: var(--ink-2);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.nav-foot .btn-ghost {
  margin-top: 8px;
  width: 100%;
}

/* ── main ────────────────────────────────────────────────────────────── */

.main {
  min-width: 0;
  padding: 26px 30px 56px;
  background:
    radial-gradient(1100px 420px at 22% -8%, rgba(57, 135, 229, 0.1), transparent 68%),
    var(--plane);
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.page-title {
  font-size: 22px;
  font-weight: 620;
  letter-spacing: -0.01em;
}

.page-sub {
  margin-top: 4px;
  color: var(--ink-muted);
  font-size: 13px;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.stamp {
  color: var(--ink-muted);
  font-size: 12px;
}

.stamp b {
  color: var(--ink-2);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.banner {
  margin-top: 18px;
  padding: 10px 13px;
  color: var(--warning);
  background: rgba(250, 178, 25, 0.1);
  border: 1px solid rgba(250, 178, 25, 0.34);
  border-radius: var(--radius-sm);
  font-size: 13px;
}

.view {
  display: grid;
  gap: 18px;
  margin-top: 22px;
}

/* ── cards ───────────────────────────────────────────────────────────── */

.cards {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(268px, 1fr));
}

.cards-3 {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.cards-4 {
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}

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

.card-tight {
  padding: 16px 18px;
}

.card-eyebrow {
  color: var(--ink-muted);
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.card-value {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 10px;
  font-size: 25px;
  font-weight: 600;
  letter-spacing: -0.015em;
  text-transform: capitalize;
}

.card-num {
  font-variant-numeric: tabular-nums;
  text-transform: none;
}

.card-note {
  margin-top: 12px;
  color: var(--ink-muted);
  font-size: 11.5px;
  line-height: 1.45;
}

.kv {
  display: grid;
  gap: 9px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.kv-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.kv div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.kv-3 div {
  display: grid;
  gap: 3px;
}

.kv dt {
  color: var(--ink-muted);
  font-size: 12px;
}

.kv dd {
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.kv-3 dd {
  font-size: 18px;
  text-align: left;
}

/* status dot: always paired with a text label, never meaning on its own */
.dot {
  width: 10px;
  height: 10px;
  flex: none;
  border-radius: 50%;
  background: var(--ink-muted);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.06);
}

.dot.is-good {
  background: var(--good);
}

.dot.is-working {
  background: var(--series-1);
}

.dot.is-warning {
  background: var(--warning);
}

.dot.is-critical {
  background: var(--critical);
}

/* meter: 4px rounded end, anchored left, 2px surface gap inside the track */
.meter-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 14px;
}

.meter {
  position: relative;
  flex: 1;
  height: 10px;
  background: var(--plane);
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
}

.meter-fill {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #1c5cab, var(--series-1));
  border-radius: 4px;
}

.meter-pct {
  display: flex;
  align-items: baseline;
  gap: 2px;
  font-variant-numeric: tabular-nums;
}

.meter-pct b {
  font-size: 24px;
  font-weight: 620;
}

.meter-pct span {
  color: var(--ink-muted);
  font-size: 12px;
}

.tier-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.tier {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 11px;
  background: var(--plane);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.tier-body {
  display: grid;
  min-width: 0;
  line-height: 1.35;
}

.tier-body b {
  font-size: 13.5px;
  font-weight: 600;
}

.tier-meta {
  color: var(--ink-muted);
  font-size: 11.5px;
}

.tier-latency {
  margin-left: auto;
  color: var(--ink-2);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ── panels ──────────────────────────────────────────────────────────── */

.split {
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
}

.panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 13px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--line);
}

.panel-head h2 {
  font-size: 15px;
  font-weight: 620;
}

.panel-head p {
  color: var(--ink-muted);
  font-size: 11.5px;
}

.empty {
  padding: 22px 4px;
  color: var(--ink-muted);
  font-size: 13px;
  text-align: center;
}

/* feed */
.feed {
  display: grid;
}

.feed-row {
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr) auto;
  gap: 11px;
  align-items: start;
  padding: 12px 2px;
  border-bottom: 1px solid var(--line);
}

.feed-row:last-child {
  border-bottom: 0;
}

.feed-dot {
  width: 8px;
  height: 8px;
  margin-top: 6px;
  border-radius: 50%;
  background: var(--ink-muted);
}

.feed-dot.is-good {
  background: var(--good);
}

.feed-dot.is-working {
  background: var(--series-1);
}

.feed-dot.is-critical {
  background: var(--critical);
}

.feed-body {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.feed-top {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.feed-agent {
  font-size: 13.5px;
  font-weight: 620;
}

.feed-label {
  color: var(--ink-2);
  font-size: 12.5px;
}

.feed-detail {
  color: var(--ink-muted);
  font-size: 12.5px;
  overflow-wrap: anywhere;
}

.feed-time {
  color: var(--ink-muted);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.chip {
  padding: 1px 8px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--ink-2);
  font-size: 10.5px;
  font-weight: 620;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}

.chip.is-good {
  color: var(--good);
  border-color: rgba(12, 163, 12, 0.45);
  background: rgba(12, 163, 12, 0.1);
}

.chip.is-working {
  color: var(--series-1);
  border-color: rgba(57, 135, 229, 0.45);
  background: rgba(57, 135, 229, 0.12);
}

.chip.is-critical {
  color: var(--critical);
  border-color: rgba(208, 59, 59, 0.45);
  background: rgba(208, 59, 59, 0.12);
}

.chip.is-idle {
  color: var(--ink-muted);
}

/* commits */
.commit-row {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr) auto;
  gap: 11px;
  align-items: start;
  padding: 12px 2px;
  border-bottom: 1px solid var(--line);
}

.commit-row:last-child {
  border-bottom: 0;
}

.commit-repo {
  padding: 1px 8px;
  color: var(--series-3);
  background: rgba(25, 158, 112, 0.1);
  border: 1px solid rgba(25, 158, 112, 0.34);
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 620;
  letter-spacing: 0.04em;
  text-align: center;
}

.commit-body {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.commit-subject {
  font-size: 13px;
  overflow-wrap: anywhere;
}

.commit-meta {
  display: flex;
  gap: 9px;
  color: var(--ink-muted);
  font-size: 11.5px;
}

.commit-meta b {
  color: var(--ink-2);
  font-weight: 600;
}

.commit-time {
  color: var(--ink-muted);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* agents */
.agent-grid {
  display: grid;
  gap: 14px;
  margin-top: 16px;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.agent {
  padding: 15px;
  background: var(--plane);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.agent-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.agent-emoji {
  font-size: 17px;
}

.agent-id {
  display: grid;
  min-width: 0;
  line-height: 1.3;
}

.agent-id b {
  font-size: 14px;
  font-weight: 620;
}

.agent-model {
  color: var(--ink-muted);
  overflow-wrap: anywhere;
}

.agent-head .chip {
  margin-left: auto;
}

.agent-desc {
  margin-top: 10px;
  color: var(--ink-muted);
  font-size: 12px;
  line-height: 1.45;
}

.agent-kv {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 14px;
  margin-top: 13px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.agent-kv div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.agent-kv dt {
  color: var(--ink-muted);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.agent-kv dd {
  font-size: 12.5px;
  font-weight: 550;
  overflow-wrap: anywhere;
}

/* tables */
.table-wrap {
  margin-top: 14px;
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.table th {
  padding: 0 12px 10px 0;
  color: var(--ink-muted);
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: 0.1em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
  border-bottom: 1px solid var(--line);
}

.table td {
  padding: 11px 12px 11px 0;
  border-bottom: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
  vertical-align: top;
}

.table tr:last-child td {
  border-bottom: 0;
}

.table td.num {
  text-align: right;
  padding-right: 22px;
}

/* bars */
.bars {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.bar-row {
  display: grid;
  grid-template-columns: minmax(120px, 190px) minmax(0, 1fr) 96px;
  gap: 12px;
  align-items: center;
}

.bar-label {
  color: var(--ink-2);
  font-size: 12.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-track {
  height: 12px;
  background: var(--plane);
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
}

.bar-fill {
  display: block;
  height: 100%;
  width: 0;
  min-width: 3px;
  background: var(--series-1);
  border-radius: 4px;
}

.bar-value {
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

/* ── narrow screens ──────────────────────────────────────────────────── */

@media (max-width: 1080px) {
  .split {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 860px) {
  .shell {
    grid-template-columns: minmax(0, 1fr);
  }

  .nav {
    position: static;
    height: auto;
  }

  .nav-list {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    display: grid;
  }

  .nav-group {
    grid-column: 1 / -1;
  }

  .main {
    padding: 20px 16px 44px;
  }
}
