:root {
  --bg: #0f1417;
  --bg-soft: #161d21;
  --panel: rgba(18, 24, 28, 0.84);
  --panel-strong: rgba(12, 18, 22, 0.92);
  --border: rgba(255, 255, 255, 0.08);
  --text: #f4f1e8;
  --text-dim: #b5b0a3;
  --accent: #ddc07a;
  --accent-strong: #f2d28a;
  --warn: #ff9558;
  --danger: #ff6d6d;
  --good: #7dd39c;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --sans: "Space Grotesk", system-ui, sans-serif;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top left, rgba(221, 192, 122, 0.16), transparent 26%),
    radial-gradient(circle at 85% 12%, rgba(125, 211, 156, 0.12), transparent 18%),
    linear-gradient(180deg, #12191c 0%, #0d1215 100%);
  color: var(--text);
  font-family: var(--sans);
}

body {
  overflow-x: hidden;
}

.orb {
  position: fixed;
  width: 28rem;
  height: 28rem;
  border-radius: 999px;
  filter: blur(80px);
  pointer-events: none;
  opacity: 0.25;
}

.orb-a {
  top: -6rem;
  left: -6rem;
  background: rgba(221, 192, 122, 0.35);
}

.orb-b {
  right: -8rem;
  bottom: -10rem;
  background: rgba(125, 211, 156, 0.18);
}

.shell {
  position: relative;
  z-index: 1;
  width: min(1400px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 28px 0 48px;
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 28px;
  border: 1px solid var(--border);
  border-radius: 28px;
  background: linear-gradient(180deg, rgba(23, 30, 35, 0.92), rgba(13, 18, 21, 0.94));
  box-shadow: var(--shadow);
}

.hero-aside {
  display: grid;
  gap: 14px;
  min-width: min(480px, 100%);
}

.eyebrow,
.panel-kicker,
.hero-label,
.metric-label,
.metric-note,
.panel-chip,
table th {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-family: var(--mono);
  font-size: 0.74rem;
}

.eyebrow,
.panel-kicker,
.hero-label,
.metric-label {
  color: var(--accent-strong);
}

.hero h1 {
  margin: 10px 0 8px;
  font-size: clamp(2.1rem, 4vw, 4rem);
  line-height: 0.95;
}

.subhead {
  max-width: 54rem;
  margin: 0;
  color: var(--text-dim);
  line-height: 1.5;
}

.hero-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(140px, 1fr));
  gap: 14px;
}

.hero-badge,
.metric-card,
.panel {
  border: 1px solid var(--border);
  background: var(--panel);
  backdrop-filter: blur(18px);
}

.hero-badge {
  padding: 16px 18px;
  border-radius: 22px;
}

.hero-badge strong {
  display: block;
  margin-top: 6px;
  font-size: 1.12rem;
}

.action-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.button {
  border: 1px solid rgba(221, 192, 122, 0.38);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(221, 192, 122, 0.22), rgba(221, 192, 122, 0.08));
  color: var(--text);
  cursor: pointer;
  font-family: var(--mono);
  font-size: 0.76rem;
  letter-spacing: 0.06em;
  padding: 10px 14px;
  text-transform: uppercase;
}

.button.subtle {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--border);
}

.button.danger {
  border-color: rgba(255, 109, 109, 0.35);
  color: var(--danger);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.metric-card {
  min-height: 138px;
  padding: 18px;
  border-radius: 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: var(--shadow);
}

.metric-card.accent {
  background:
    linear-gradient(140deg, rgba(221, 192, 122, 0.18), rgba(18, 24, 28, 0.9) 50%),
    var(--panel);
}

.metric-value {
  font-size: clamp(1.6rem, 3vw, 2.8rem);
  line-height: 1;
}

.metric-note {
  color: var(--text-dim);
}

.board {
  display: grid;
  grid-template-columns: 1.25fr 0.75fr;
  gap: 16px;
  margin-top: 16px;
}

.panel {
  padding: 20px;
  border-radius: 28px;
  box-shadow: var(--shadow);
}

.panel-wide {
  grid-column: 1 / -1;
}

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

.panel-head h2 {
  margin: 4px 0 0;
  font-size: 1.3rem;
}

.panel-chip {
  color: var(--text-dim);
  border: 1px solid var(--border);
  padding: 8px 12px;
  border-radius: 999px;
}

.agent-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
}

.agent-card {
  padding: 14px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
}

.agent-card h3 {
  margin: 0 0 8px;
  font-size: 1rem;
}

.agent-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 9px;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 0.73rem;
}

.chip.good {
  color: var(--good);
}

.chip.warn {
  color: var(--warn);
}

.chip.danger {
  color: var(--danger);
}

.chip.neutral {
  color: var(--text-dim);
}

.agent-timestamps,
.stack-meta {
  color: var(--text-dim);
  font-size: 0.84rem;
  line-height: 1.45;
}

.stack-list {
  display: grid;
  gap: 12px;
}

.stack-item {
  padding: 14px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
}

.stack-item h3,
.stack-item p {
  margin: 0;
}

.stack-item h3 {
  font-size: 0.98rem;
}

.stack-item p {
  margin-top: 7px;
  color: var(--text-dim);
  line-height: 1.45;
  font-size: 0.9rem;
}

.inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.budget-bar {
  height: 8px;
  border-radius: 999px;
  margin-top: 12px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.budget-bar > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--warn));
}

.table-shell {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

table th,
table td {
  text-align: left;
  padding: 11px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  vertical-align: top;
}

table td {
  color: var(--text-dim);
  font-size: 0.94rem;
}

.empty-state {
  padding: 18px;
  border-radius: 16px;
  border: 1px dashed var(--border);
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.02);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 9px;
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 0.72rem;
  border: 1px solid currentColor;
}

.status-pill.success {
  color: var(--good);
}

.status-pill.warn {
  color: var(--warn);
}

.status-pill.error {
  color: var(--danger);
}

.control-form {
  display: grid;
  gap: 14px;
}

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

.field span {
  color: var(--accent-strong);
  font-family: var(--mono);
  font-size: 0.74rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(8, 12, 14, 0.72);
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.88rem;
  padding: 12px 14px;
}

.field textarea {
  min-height: 190px;
  resize: vertical;
}

.result-console,
.json-details pre {
  margin: 14px 0 0;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: rgba(8, 12, 14, 0.82);
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 0.8rem;
  line-height: 1.5;
  overflow-x: auto;
  white-space: pre-wrap;
}

.json-details {
  margin-top: 12px;
}

.json-details summary {
  color: var(--accent-strong);
  cursor: pointer;
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

body:not([data-mode="editable"]) .requires-wrapper {
  display: none;
}

@media (max-width: 1080px) {
  .hero,
  .panel-head {
    flex-direction: column;
  }

  .hero-meta {
    grid-template-columns: 1fr;
    min-width: auto;
  }

  .metrics-grid,
  .board {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 720px) {
  .shell {
    width: min(100vw - 20px, 100%);
    padding-top: 20px;
  }

  .hero,
  .panel {
    padding: 18px;
    border-radius: 22px;
  }

  .metrics-grid,
  .board,
  .hero-meta {
    grid-template-columns: 1fr;
  }
}
