:root {
  --bg: #f3efe5;
  --bg-strong: #efe6d3;
  --panel: rgba(255, 252, 245, 0.82);
  --panel-strong: #fffaf0;
  --ink: #13212b;
  --muted: #5d6c74;
  --line: rgba(19, 33, 43, 0.12);
  --accent: #0d6f67;
  --accent-soft: rgba(13, 111, 103, 0.12);
  --warm: #b85d2c;
  --good: #1a7f53;
  --warn: #a56a14;
  --bad: #a52d2d;
  --shadow: 0 18px 50px rgba(33, 42, 48, 0.08);
  --radius: 22px;
  --font-sans: "IBM Plex Sans", "Avenir Next", "Helvetica Neue", sans-serif;
  --font-mono: "JetBrains Mono", "SFMono-Regular", monospace;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(184, 93, 44, 0.14), transparent 26%),
    radial-gradient(circle at bottom right, rgba(13, 111, 103, 0.16), transparent 24%),
    linear-gradient(135deg, #f6f1e5, #ece8df);
}

button,
input,
textarea,
select {
  font: inherit;
}

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 320px 1fr;
}

.shell.auth-only {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
}

.shell.auth-only .sidebar {
  width: min(420px, 100%);
  padding: 0;
  border: 0;
  background: transparent;
  backdrop-filter: none;
}

.shell.auth-only .brand,
.shell.auth-only .nav,
.shell.auth-only .content {
  display: none !important;
}

.shell.auth-only #login-card {
  padding: 24px;
}

.sidebar {
  padding: 24px;
  border-right: 1px solid var(--line);
  background: rgba(255, 250, 240, 0.58);
  backdrop-filter: blur(16px);
}

.content {
  padding: 24px;
  display: grid;
  gap: 20px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}

.brand-mark {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--accent), #0f4f71);
  color: white;
  font-weight: 700;
  font-size: 1.3rem;
  box-shadow: var(--shadow);
}

.brand-title {
  font-size: 1.15rem;
  font-weight: 700;
}

.brand-subtitle {
  color: var(--muted);
  font-size: 0.9rem;
}

.panel {
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}

.stack {
  display: grid;
  gap: 14px;
}

.panel-title {
  font-weight: 700;
  font-size: 1.02rem;
}

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

.hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  background:
    linear-gradient(125deg, rgba(13, 111, 103, 0.1), rgba(15, 79, 113, 0.1)),
    var(--panel-strong);
}

.hero h1 {
  margin: 6px 0 8px;
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 700;
}

.hero-meta {
  display: grid;
  gap: 10px;
}

.hero-chip,
.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 0.82rem;
  font-weight: 700;
}

.hero-chip {
  justify-content: center;
}

.hero-chip.online,
.badge.good {
  background: rgba(26, 127, 83, 0.12);
  color: var(--good);
}

.hero-chip.offline,
.badge.bad {
  background: rgba(165, 45, 45, 0.12);
  color: var(--bad);
}

.hero-chip.subtle,
.badge.warn {
  background: rgba(165, 106, 20, 0.12);
  color: var(--warn);
}

.nav {
  margin-top: 18px;
  display: grid;
  gap: 8px;
}

.nav-item {
  border: 0;
  background: transparent;
  color: var(--muted);
  text-align: left;
  padding: 12px 14px;
  border-radius: 14px;
  cursor: pointer;
  transition: 180ms ease;
}

.nav-item.active,
.nav-item:hover {
  background: var(--accent-soft);
  color: var(--ink);
}

.row {
  display: flex;
  align-items: center;
}

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

.gap {
  gap: 10px;
}

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

.field span,
.checkbox span {
  font-size: 0.84rem;
  color: var(--muted);
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.8);
  padding: 12px 14px;
  color: var(--ink);
}

textarea {
  resize: vertical;
}

.button {
  border: 0;
  border-radius: 14px;
  padding: 11px 14px;
  cursor: pointer;
  transition: transform 160ms ease, opacity 160ms ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button.primary {
  background: linear-gradient(135deg, var(--accent), #0f4f71);
  color: white;
}

.button.ghost {
  background: rgba(19, 33, 43, 0.08);
  color: var(--ink);
}

.button.danger {
  background: rgba(165, 45, 45, 0.12);
  color: var(--bad);
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 0.86rem;
}

.strong {
  font-weight: 700;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 14px;
}

.metric-card {
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 20px;
  padding: 18px;
  box-shadow: var(--shadow);
}

.metric-label {
  color: var(--muted);
  font-size: 0.86rem;
}

.metric-value {
  font-size: 1.8rem;
  font-weight: 700;
  margin: 8px 0 4px;
}

.metric-detail {
  color: var(--muted);
  font-size: 0.84rem;
}

.grid {
  display: grid;
  gap: 20px;
}

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

.table-wrap {
  overflow: auto;
}

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

th,
td {
  text-align: left;
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

td code,
.gateway-endpoints code,
.code-block {
  font-family: var(--font-mono);
}

.align-right {
  text-align: right;
}

.empty,
.empty-row {
  color: var(--muted);
  padding: 18px 0;
}

.view {
  display: none;
}

.view.active {
  display: grid;
  gap: 20px;
}

.gateway-card {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.45);
}

.gateway-meta,
.gateway-endpoints {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.85rem;
}

.code-block {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  padding: 14px;
  border-radius: 16px;
  background: #18242d;
  color: #eff6f8;
}

.code-block.tall {
  max-height: 320px;
  overflow: auto;
}

.flash {
  border-radius: 16px;
  padding: 14px 16px;
  font-weight: 600;
}

.flash.success {
  background: rgba(26, 127, 83, 0.12);
  color: var(--good);
}

.flash.error {
  background: rgba(165, 45, 45, 0.12);
  color: var(--bad);
}

.warning-banner {
  background: rgba(165, 106, 20, 0.12);
  color: var(--warn);
  font-weight: 700;
}

.user-summary {
  display: grid;
  gap: 6px;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid var(--line);
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(10, 18, 24, 0.42);
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 20;
  backdrop-filter: blur(8px);
}

.modal-card {
  width: min(560px, 100%);
  background: var(--panel-strong);
  border: 1px solid rgba(255, 255, 255, 0.62);
  border-radius: 24px;
  box-shadow: var(--shadow);
  padding: 22px;
  display: grid;
  gap: 16px;
}

.domain-error {
  margin-top: 6px;
}

.hidden {
  display: none !important;
}

@media (max-width: 1180px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

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

@media (max-width: 760px) {
  .content,
  .sidebar {
    padding: 16px;
  }

  .summary-grid,
  .grid.two-up,
  .grid.split {
    grid-template-columns: 1fr;
  }

  .hero {
    flex-direction: column;
  }
}
