:root {
  --ink: #1a2332;
  --muted: #5b6b7c;
  --line: #e4eaf0;
  --bg: #f6f8fa;
  --side: #ffffff;
  --active: #e8f4ff;
  --active-text: #0b5cab;
  --accent: #0f766e;
  --sandbox: #b45309;
  --sandbox-bg: #fff7ed;
  --font: "Outfit", system-ui, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
}

.shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--side);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  position: relative;
  padding: 0.75rem 0 1rem;
}

.account-switcher {
  margin: 0.35rem 0.75rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: calc(100% - 1.5rem);
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  font: inherit;
  cursor: pointer;
  text-align: left;
}

.account-switcher:hover {
  background: #fafbfc;
}

.env-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--sandbox);
  flex-shrink: 0;
}

body.env-live .env-dot {
  background: var(--accent);
}

.account-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
  flex: 1;
  min-width: 0;
}

.account-text strong {
  font-size: 0.95rem;
}

.account-text span {
  font-size: 0.8rem;
  color: var(--muted);
}

.chevron {
  color: var(--muted);
}

.account-menu {
  position: absolute;
  top: 4.1rem;
  left: 0.75rem;
  right: 0.75rem;
  z-index: 30;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 16px 40px rgba(26, 35, 50, 0.14);
  padding: 0.85rem;
}

.account-menu-head {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 0.75rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.account-menu-head strong {
  display: block;
  color: var(--ink);
}

.avatar {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 8px;
  background: #0b1f33;
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 0.75rem;
}

.menu-primary {
  width: 100%;
  padding: 0.65rem;
  border-radius: 8px;
  border: 1.5px solid var(--ink);
  background: #fff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 0.5rem;
}

.menu-primary:hover {
  background: #f5f7f9;
}

.menu-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.menu-list button,
.menu-list a {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.55rem 0.4rem;
  border: none;
  background: none;
  font: inherit;
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
  border-radius: 6px;
}

.menu-list button:hover,
.menu-list a:hover {
  background: var(--bg);
}

.side-nav {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0 0.55rem;
  flex: 1;
  overflow: auto;
}

.nav-section {
  margin: 1rem 0.65rem 0.35rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.65rem;
  border-radius: 8px;
  color: var(--ink);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  border: none;
  background: none;
  width: 100%;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
}

.nav-item:hover {
  background: #f3f5f7;
}

.nav-item.active {
  background: var(--active);
  color: var(--active-text);
}

.nav-item .icon {
  width: 1.25rem;
  text-align: center;
  opacity: 0.75;
  font-size: 0.85rem;
}

.nav-parent {
  justify-content: flex-start;
}

.nav-parent .parent-chevron {
  margin-left: auto;
  color: var(--muted);
  font-size: 0.75rem;
}

.nav-children {
  display: none;
  flex-direction: column;
  padding: 0.15rem 0 0.35rem 2.1rem;
  gap: 0.1rem;
}

.nav-children.open {
  display: flex;
}

.nav-children a {
  padding: 0.4rem 0.55rem;
  border-radius: 6px;
  color: var(--ink);
  text-decoration: none;
  font-size: 0.9rem;
}

.nav-children a:hover,
.nav-children a.active {
  background: var(--active);
  color: var(--active-text);
}

.nav-footer {
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1.5rem;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.sandbox-banner {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.4rem 0.75rem;
  border-radius: 8px;
  background: var(--sandbox-bg);
  color: var(--sandbox);
  font-size: 0.9rem;
}

.sandbox-banner[hidden] {
  display: none !important;
}

body.env-live .sandbox-banner {
  background: #ecfdf5;
  color: var(--accent);
}

.plan-select {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.plan-select select {
  font: inherit;
  padding: 0.35rem 0.5rem;
  border-radius: 6px;
  border: 1px solid var(--line);
}

.content {
  padding: 1.5rem 1.75rem 2.5rem;
  max-width: 960px;
}

.content h1 {
  margin: 0 0 0.5rem;
  font-size: 1.65rem;
  letter-spacing: -0.02em;
}

.content .lede {
  margin: 0 0 1.25rem;
  color: var(--muted);
}

.panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1.15rem 1.25rem;
  margin-bottom: 1rem;
}

.panel h2 {
  margin: 0 0 0.65rem;
  font-size: 1.05rem;
}

.metric-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.85rem;
}

.metric {
  padding: 1rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.metric .label {
  font-size: 0.8rem;
  color: var(--muted);
}

.metric .value {
  font-size: 1.45rem;
  font-weight: 700;
  margin-top: 0.25rem;
}

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

table.data th,
table.data td {
  text-align: left;
  padding: 0.55rem 0.4rem;
  border-bottom: 1px solid var(--line);
}

table.data th {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.8rem;
}

.code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.85rem;
  background: #0b1f33;
  color: #d7e6f5;
  padding: 0.9rem 1rem;
  border-radius: 10px;
  overflow: auto;
  white-space: pre-wrap;
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.pill {
  display: inline-flex;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: rgba(15, 118, 110, 0.1);
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 600;
}

.btn {
  display: inline-flex;
  align-items: center;
  padding: 0.5rem 0.85rem;
  border-radius: 8px;
  border: none;
  background: var(--ink);
  color: #fff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.btn:hover { opacity: 0.92; }

.btn-outline {
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
}

.search-row {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.85rem;
}

.search-row input {
  flex: 1;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
}

.auth-boot {
  min-height: 100vh;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-weight: 500;
}

.lang-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.65rem;
}

.lang-tab {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--muted);
}

.lang-tab.active {
  background: var(--active);
  border-color: #c5ddf7;
  color: var(--active-text);
}

.code-pane {
  display: none;
  position: relative;
}

.code-pane.active {
  display: block;
}

.copy-btn {
  position: absolute;
  top: 0.55rem;
  right: 0.55rem;
  z-index: 1;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border-radius: 6px;
  padding: 0.25rem 0.55rem;
  font: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
}

.copy-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

.code-pane .code {
  margin: 0;
  padding-top: 2.4rem;
}

@media (max-width: 800px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: none;
    border-bottom: 1px solid var(--line);
  }

  .metric-row {
    grid-template-columns: 1fr;
  }
}
