:root {
  --bg: #07121c;
  --panel: rgba(10, 24, 37, 0.82);
  --panel-2: rgba(13, 32, 49, 0.92);
  --line: rgba(132, 175, 212, 0.25);
  --text: #eaf6ff;
  --muted: #98b4ca;
  --good: #34d399;
  --warn: #fbbf24;
  --bad: #f87171;
  --accent: #3dd9c4;
  --accent-2: #4fa2ff;
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  background: radial-gradient(circle at 20% 10%, #143250 0%, #07121c 40%, #040a11 100%);
  color: var(--text);
  font-family: "Space Grotesk", sans-serif;
  scroll-behavior: smooth;
}

.bg-orb {
  position: fixed;
  filter: blur(70px);
  opacity: 0.18;
  pointer-events: none;
  z-index: 0;
}
.orb-a {
  width: 320px;
  height: 320px;
  border-radius: 50%;
  top: -80px;
  right: -60px;
  background: #3dd9c4;
}
.orb-b {
  width: 380px;
  height: 380px;
  border-radius: 50%;
  bottom: -100px;
  left: -80px;
  background: #4fa2ff;
}

.shell {
  width: min(1240px, 92vw);
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

.stack-lg { display: grid; gap: 18px; padding-bottom: 28px; }
.mt { margin-top: 14px; }
.section-fill { width: 100%; }

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  padding: 20px 0 12px;
}
.brand-wrap { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #03111c;
  font-weight: 700;
}
h1 { margin: 0; font-size: 1.08rem; letter-spacing: .06em; }
h2 { margin: 0; font-size: 1.02rem; }
h3 { margin: 0 0 10px; font-size: .95rem; color: #d7ecff; }
.muted { color: var(--muted); }
.tiny { font-size: .78rem; }
.mono { font-family: "JetBrains Mono", monospace; }

.topbar-actions { display: flex; gap: 10px; align-items: center; }

.section-nav {
  display: flex;
  gap: 8px;
  overflow: auto;
  padding: 0 0 8px;
  margin-bottom: 6px;
}
.section-link {
  text-decoration: none;
  color: #c9e2f5;
  border: 1px solid rgba(132,175,212,.35);
  background: rgba(8, 20, 33, .7);
  border-radius: 999px;
  padding: 7px 12px;
  font-size: .8rem;
  white-space: nowrap;
}
.section-link:hover {
  border-color: rgba(61,217,196,.6);
  color: #e9fbff;
}

#statusSection, #moneySection, #pipelineSection, #modelsSection, #controlSection {
  scroll-margin-top: 10px;
}

.grid { display: grid; gap: 12px; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
.grid-5 { grid-template-columns: repeat(5, minmax(0,1fr)); }

.panel {
  background: linear-gradient(180deg, var(--panel) 0%, var(--panel-2) 100%);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  box-shadow: var(--shadow);
}
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 10px;
  gap: 12px;
}

.card {
  background: rgba(9, 22, 33, .82);
  border: 1px solid rgba(132, 175, 212, .2);
  border-radius: 12px;
  padding: 12px;
}
.card .k {
  color: var(--muted);
  font-size: .78rem;
  margin-bottom: 6px;
}
.card .v {
  font-weight: 700;
  font-size: 1.2rem;
}
.card .sub {
  margin-top: 4px;
  color: #b8d3e8;
  font-size: .8rem;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: .75rem;
  border: 1px solid transparent;
}
.status-pill::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
}
.status-good { color: #8ef4ca; border-color: rgba(52,211,153,.38); }
.status-good::before { background: var(--good); }
.status-warn { color: #ffe29f; border-color: rgba(251,191,36,.38); }
.status-warn::before { background: var(--warn); }
.status-bad { color: #ffb5b5; border-color: rgba(248,113,113,.38); }
.status-bad::before { background: var(--bad); }

.table-wrap {
  overflow: auto;
  border: 1px solid rgba(132,175,212,.18);
  border-radius: 10px;
  background: rgba(7, 18, 28, .65);
}
table {
  width: 100%;
  border-collapse: collapse;
  min-width: 560px;
  font-size: .82rem;
}
th, td {
  padding: 8px 9px;
  border-bottom: 1px solid rgba(132,175,212,.14);
  text-align: left;
  white-space: nowrap;
}
th { color: #a7c6de; font-weight: 500; }
tr:last-child td { border-bottom: 0; }

.pipeline {
  display: grid;
  grid-template-columns: repeat(6, minmax(0,1fr));
  gap: 8px;
}
.step {
  border: 1px dashed rgba(132,175,212,.28);
  border-radius: 10px;
  padding: 9px;
  background: rgba(6,16,26,.8);
}
.step .t { font-size: .75rem; color: #a5c3da; }
.step .x { margin-top: 4px; font-weight: 600; font-size: .82rem; }

.text-card {
  line-height: 1.55;
  color: #d4e9f8;
  background: rgba(8,20,33,.75);
  border: 1px solid rgba(132,175,212,.2);
  border-radius: 10px;
  padding: 12px;
}

.controls {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: end;
}
.input-wrap {
  display: grid;
  gap: 4px;
  min-width: 240px;
}
input {
  background: #06121d;
  border: 1px solid rgba(132,175,212,.3);
  color: var(--text);
  border-radius: 8px;
  padding: 10px;
  outline: none;
}
input:focus { border-color: var(--accent); }

.btn {
  border: 1px solid rgba(61,217,196,.5);
  background: linear-gradient(135deg, rgba(61,217,196,.2), rgba(79,162,255,.2));
  color: var(--text);
  border-radius: 10px;
  padding: 10px 14px;
  font-weight: 600;
  cursor: pointer;
}
.btn:hover { transform: translateY(-1px); }
.btn-outline {
  background: rgba(9,22,33,.7);
  border-color: rgba(132,175,212,.4);
}
.btn-outline.danger { border-color: rgba(248,113,113,.5); color: #ffd2d2; }

.log {
  margin-top: 12px;
  background: #04101a;
  border: 1px solid rgba(132,175,212,.2);
  border-radius: 10px;
  padding: 10px;
  color: #bcd8ed;
  min-height: 64px;
  font-family: "JetBrains Mono", monospace;
  font-size: .78rem;
  white-space: pre-wrap;
}

.pos { color: #8ef4ca; }
.neg { color: #ffb5b5; }

@media (max-width: 1100px) {
  .grid-5 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .grid-4 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .grid-3 { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .pipeline { grid-template-columns: repeat(2, minmax(0,1fr)); }
}

@media (max-width: 700px) {
  .topbar { flex-direction: column; align-items: flex-start; }
  .topbar-actions { width: 100%; justify-content: space-between; }
  .grid-4, .grid-5 { grid-template-columns: 1fr; }
}
