:root {
  --bg: #f6f2e8;
  --bg-alt: #efe4d0;
  --panel: rgba(255, 252, 246, 0.88);
  --panel-strong: rgba(255, 249, 240, 0.98);
  --panel-dark: #17313b;
  --text: #1f2328;
  --muted: #5f6b75;
  --accent: #b65c2c;
  --accent-soft: rgba(182, 92, 44, 0.12);
  --accent-2: #1e7a67;
  --accent-2-soft: rgba(30, 122, 103, 0.12);
  --danger: #c24139;
  --border: rgba(38, 52, 58, 0.12);
  --shadow: 0 24px 80px rgba(72, 52, 28, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: "Space Grotesk", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(182, 92, 44, 0.16), transparent 28%),
    radial-gradient(circle at top right, rgba(30, 122, 103, 0.16), transparent 22%),
    linear-gradient(180deg, var(--bg) 0%, #fbf8f2 38%, var(--bg-alt) 100%);
}

.bg-mesh {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.45;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.14) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.12) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.5), transparent 80%);
}

.bg-orb {
  position: fixed;
  width: 320px;
  height: 320px;
  border-radius: 999px;
  filter: blur(88px);
  opacity: 0.35;
  pointer-events: none;
}

.bg-orb-a {
  background: rgba(182, 92, 44, 0.35);
  top: -80px;
  left: -110px;
}

.bg-orb-b {
  background: rgba(30, 122, 103, 0.28);
  right: -90px;
  bottom: 40px;
}

.shell {
  position: relative;
  z-index: 1;
  max-width: 1440px;
  margin: 0 auto;
  padding: 24px;
}

.shell-grid {
  grid-template-columns: minmax(300px, 340px) minmax(0, 1fr);
  align-items: start;
}

.control-rail,
.main-stage,
.tab-panel,
.stack,
.grid {
  display: grid;
  gap: 16px;
}

.control-rail,
.main-stage {
  min-width: 0;
}

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

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

.card,
.stat-card {
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.card {
  border-radius: 24px;
  padding: 20px;
  overflow: hidden;
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
  padding: 28px;
  background:
    linear-gradient(135deg, rgba(255, 247, 238, 0.96), rgba(248, 242, 231, 0.92)),
    linear-gradient(120deg, rgba(182, 92, 44, 0.09), rgba(30, 122, 103, 0.09));
}

.hero-copy {
  max-width: 760px;
}

.hero h1 {
  margin: 6px 0 10px;
  font-size: clamp(2rem, 4vw, 3.6rem);
  line-height: 1;
  letter-spacing: -0.04em;
}

.hero-meta,
.hero-actions,
.tabs,
.row,
.quick-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.hero-actions {
  min-width: 220px;
  justify-content: flex-end;
}

.stats-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 16px 0;
}

.stat-card {
  border-radius: 22px;
  padding: 18px;
  transform: translateY(0);
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 30px 84px rgba(72, 52, 28, 0.16);
}

.stat-label,
.field-label,
.eyebrow,
.kicker,
.stat-subtle,
.subtle {
  color: var(--muted);
}

.stat-label,
.eyebrow,
.kicker {
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.76rem;
}

.stat-value {
  display: block;
  margin-top: 10px;
  font-size: 1.7rem;
  line-height: 1;
}

.stat-subtle {
  display: block;
  margin-top: 8px;
  font-size: 0.9rem;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid rgba(38, 52, 58, 0.12);
  background: rgba(255, 255, 255, 0.58);
  font-size: 0.9rem;
}

.pill-accent {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: rgba(182, 92, 44, 0.18);
}

.section-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
  margin-bottom: 14px;
}

.section-head h2,
h2,
h3 {
  margin: 0;
}

.tabs {
  padding: 10px;
  background: rgba(255, 252, 246, 0.72);
  position: sticky;
  top: 14px;
  z-index: 2;
}

.tab-btn {
  width: auto;
  min-width: 130px;
}

.tab-btn.active {
  background: var(--accent-soft);
  border-color: rgba(182, 92, 44, 0.3);
  color: var(--accent);
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: grid;
}

.kv,
.mini-kv {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.kv {
  padding: 8px 0;
  border-bottom: 1px solid rgba(38, 52, 58, 0.08);
}

.mini-kv {
  align-items: center;
}

input,
textarea,
select,
button {
  width: 100%;
  padding: 11px 13px;
  border-radius: 14px;
  border: 1px solid rgba(38, 52, 58, 0.14);
  background: rgba(255, 255, 255, 0.72);
  color: var(--text);
  font: inherit;
}

textarea {
  min-height: 110px;
  resize: vertical;
}

input:focus,
textarea:focus,
select:focus,
button:focus {
  outline: 2px solid rgba(182, 92, 44, 0.16);
  outline-offset: 1px;
}

.btn {
  cursor: pointer;
  transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease;
}

.btn:hover {
  transform: translateY(-1px);
  border-color: rgba(182, 92, 44, 0.32);
  box-shadow: 0 14px 30px rgba(72, 52, 28, 0.08);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), #d68642);
  color: #fff9f2;
  border-color: transparent;
  font-weight: 700;
}

.row {
  align-items: center;
}

.row-space {
  justify-content: space-between;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.checkbox-row input {
  width: auto;
}

.top-gap {
  margin-top: 12px;
}

.no-margin {
  margin: 0;
}

.log,
.result,
code,
.data-table {
  font-family: "IBM Plex Mono", monospace;
}

code {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.log,
.result {
  margin: 0;
  padding: 12px;
  border-radius: 16px;
  border: 1px solid rgba(38, 52, 58, 0.08);
  background: rgba(16, 35, 42, 0.9);
  color: #d5f6ef;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.compact-log {
  max-height: 220px;
}

.mini-kv code,
.kv code,
.kv strong,
.mini-kv strong {
  max-width: 62%;
  text-align: right;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.result {
  color: #fff4e8;
}

.log-card {
  min-height: 220px;
}

.table-wrap {
  overflow: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.data-table th,
.data-table td {
  padding: 13px 10px;
  border-bottom: 1px solid rgba(38, 52, 58, 0.08);
  text-align: left;
  vertical-align: top;
}

.data-table th {
  color: var(--muted);
  font-weight: 500;
}

.table-empty {
  text-align: center;
  color: var(--muted);
}

.btn-small {
  min-width: 110px;
  padding: 8px 10px;
}

.hidden {
  display: none !important;
}

.auth-locked .main-stage,
.auth-locked .control-rail > .card:not(:first-child) {
  display: none;
}

.auth-locked .shell-grid {
  grid-template-columns: minmax(0, 560px);
  justify-content: start;
}

.auth-locked .control-rail {
  max-width: 560px;
}

.embed-mode .shell {
  max-width: 100%;
  padding: 14px;
}

.embed-mode .hero {
  padding: 18px;
}

.embed-mode .tabs {
  top: 8px;
}

@media (max-width: 1180px) {
  .shell-grid,
  .grid.three,
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .control-rail {
    grid-column: 1 / -1;
  }
}

@media (max-width: 860px) {
  .shell,
  .embed-mode .shell {
    padding: 14px;
  }

  .hero {
    flex-direction: column;
  }

  .hero-actions {
    justify-content: stretch;
    width: 100%;
  }

  .shell-grid,
  .grid.two,
  .grid.three,
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .tabs {
    position: static;
  }
}
