:root {
  --bg: #0b0d10;
  --bg2: #12151a;
  --card: #12161c;
  --card-border: rgba(255, 255, 255, 0.075);
  --text: #e6e9ef;
  --muted: #8b93a7;
  --accent: #5b8def;
  --accent2: #5b8def;
  --ok: #3ecf8e;
  --warn: #e0a54b;
  --danger: #e06c75;
  --radius: 10px;
  --shadow: 0 1px 0 rgba(255,255,255,0.03), 0 10px 28px rgba(0, 0, 0, 0.28);
  --mono: "JetBrains Mono", "Fira Code", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sans: "Segoe UI", Inter, system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --nav-h: 56px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--sans);
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  min-height: 100dvh;
  line-height: 1.5;
  padding-left: var(--safe-left);
  padding-right: var(--safe-right);
  padding-bottom: var(--safe-bottom);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.container {
  width: min(1100px, calc(100% - 2rem));
  margin: 0 auto;
}

.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  background: rgba(7, 11, 20, 0.82);
  border-bottom: 1px solid var(--card-border);
  padding-top: var(--safe-top);
}
.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--nav-h);
  padding: 0.65rem 0;
  gap: 0.75rem;
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.2px;
  color: var(--text);
  text-decoration: none;
  min-width: 0;
  z-index: 60;
}
.brand:hover { text-decoration: none; }
.brand span:last-child { white-space: nowrap; }
.logo {
  width: 36px; height: 36px; border-radius: 10px;
  display: grid; place-items: center; flex-shrink: 0;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #041018; font-weight: 800; font-size: 0.85rem;
}

.nav-toggle {
  display: none;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 1px solid var(--card-border);
  background: rgba(255,255,255,0.04);
  color: var(--text);
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 60;
  padding: 0;
  flex-shrink: 0;
}
.nav-toggle:hover { background: rgba(255,255,255,0.08); }
.nav-toggle-bars {
  width: 18px;
  height: 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.nav-toggle-bars span {
  display: block;
  height: 2px;
  border-radius: 2px;
  background: var(--text);
  transition: transform .2s ease, opacity .2s ease;
}
body.nav-open .nav-toggle-bars span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
body.nav-open .nav-toggle-bars span:nth-child(2) { opacity: 0; }
body.nav-open .nav-toggle-bars span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

.nav-links {
  display: flex;
  gap: 0.4rem;
  align-items: center;
  flex-wrap: wrap;
}
.nav-links a {
  color: var(--muted);
  padding: 0.5rem 0.85rem;
  border-radius: 999px;
  text-decoration: none;
  font-size: 0.95rem;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
}
.nav-links a:hover,
.nav-links a.active {
  color: var(--text);
  background: rgba(255,255,255,0.05);
  text-decoration: none;
}
.nav-links .btn { min-height: 40px; }

.nav-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 40;
}
body.nav-open .nav-overlay { display: block; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  border: 0;
  border-radius: 8px;
  padding: 0.6rem 0.95rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: .15s ease;
  font: inherit;
  min-height: 44px;
  -webkit-tap-highlight-color: transparent;
}
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary {
  background: var(--accent);
  color: #0b0d10;
  box-shadow: none;
}
.btn-primary:hover { filter: brightness(1.08); text-decoration: none; }
.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--card-border);
}
.btn-ghost:hover { background: rgba(255,255,255,0.05); text-decoration: none; }
.btn-block { width: 100%; }
.btn-google {
  background: #fff;
  color: #1f2937;
  border: 1px solid #e5e7eb;
  box-shadow: 0 4px 14px rgba(0,0,0,0.12);
}
.btn-google:hover { background: #f8fafc; text-decoration: none; transform: translateY(-1px); }
.btn-google svg { width: 18px; height: 18px; flex-shrink: 0; }

.hero { padding: 3.5rem 0 2rem; }
.hero-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 2rem;
  align-items: center;
}
.eyebrow {
  display: inline-flex;
  gap: 0.45rem;
  align-items: center;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: transparent;
  border: 1px solid var(--card-border);
  border-radius: 6px;
  padding: 0.28rem 0.6rem;
  max-width: 100%;
}
h1 {
  font-size: clamp(1.85rem, 5.2vw, 3.1rem);
  line-height: 1.12;
  margin: 1rem 0 0.8rem;
  letter-spacing: -0.03em;
}
.lead {
  color: var(--muted);
  font-size: 1.05rem;
  max-width: 52ch;
}
.hero-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 1.5rem;
}
.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin-top: 2rem;
}
.stat {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  padding: 0.95rem 1rem;
}
.stat b { display: block; font-size: 1.15rem; word-break: break-word; }
.stat span { color: var(--muted); font-size: 0.85rem; }

.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  box-shadow: none;
  padding: 1.05rem 1.1rem;
}
.card h3 { margin: 0 0 0.6rem; font-size: 1rem; }
.code, pre, code { font-family: var(--mono); }
pre {
  margin: 0;
  background: #060a12;
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 1rem;
  overflow: auto;
  font-size: 0.82rem;
  line-height: 1.5;
  color: #d7e2ff;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
}
.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border-radius: 999px;
  padding: 0.2rem 0.6rem;
  font-size: 0.78rem;
  font-weight: 600;
}
.pill-ok { background: rgba(52,211,153,0.12); color: var(--ok); }
.pill-warn { background: rgba(251,191,36,0.12); color: var(--warn); }

.section { padding: 2rem 0 2.5rem; }
.section h2 {
  font-size: clamp(1.35rem, 3.5vw, 1.55rem);
  margin: 0 0 0.4rem;
  letter-spacing: -0.02em;
}
.section p.sub { color: var(--muted); margin: 0 0 1.4rem; }

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}
.feature {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  padding: 1.15rem;
}
.feature h3 { margin: 0 0 0.45rem; font-size: 1.05rem; }
.feature p { margin: 0; color: var(--muted); font-size: 0.95rem; }

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--card-border);
  border-radius: 14px;
  background: var(--card);
  max-width: 100%;
}
table { width: 100%; border-collapse: collapse; min-width: 480px; }
th, td {
  text-align: left;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--card-border);
  font-size: 0.92rem;
  vertical-align: middle;
}
th { color: var(--muted); font-weight: 600; white-space: nowrap; }
td code { color: #b9c7e6; word-break: break-all; }

.footer {
  border-top: 1px solid var(--card-border);
  margin-top: 2rem;
  padding: 1.5rem 0 calc(2rem + var(--safe-bottom));
  color: var(--muted);
  font-size: 0.9rem;
}

.auth-wrap {
  width: min(480px, 100%);
  margin: 0 auto;
}
.form-row { display: grid; gap: 0.4rem; margin-bottom: 0.9rem; }
label { color: var(--muted); font-size: 0.88rem; }
input, select, textarea {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--card-border);
  background: #0a1220;
  color: var(--text);
  padding: 0.85rem 0.9rem;
  font: inherit;
  min-height: 48px;
  appearance: none;
  -webkit-appearance: none;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: rgba(34, 211, 238, 0.45);
  box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.12);
}
textarea {
  min-height: 110px;
  resize: vertical;
  font-family: var(--mono);
  font-size: 0.9rem;
}
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.out {
  min-height: 180px;
  white-space: pre-wrap;
  word-break: break-word;
  background: #060a12;
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 1rem;
  font-family: var(--mono);
  font-size: 0.86rem;
}
.kv {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 0.4rem 0.8rem;
  font-size: 0.94rem;
}
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-word; }

.copy-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  min-width: 0;
}
.copy-row code {
  flex: 1;
  min-width: 0;
  background: #060a12;
  border: 1px solid var(--card-border);
  border-radius: 10px;
  padding: 0.7rem 0.85rem;
  overflow: auto;
  white-space: nowrap;
  font-size: 0.82rem;
}
.card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.4rem;
}
.card-head h3 { margin: 0; }

.progress-wrap {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  padding: 0.9rem 1rem;
}
.progress-label {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
}
.progress-bar {
  height: 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: var(--accent);
  transition: width .3s ease;
}

.alert {
  border-radius: 12px;
  padding: 0.85rem 1rem;
  margin: 0.75rem 0;
  border: 1px solid var(--card-border);
  background: rgba(255,255,255,0.03);
  word-break: break-word;
}
.alert-ok { border-color: rgba(52,211,153,0.3); color: var(--ok); }
.alert-danger { border-color: rgba(248,113,113,0.3); color: var(--danger); }

.divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--muted);
  font-size: 0.85rem;
  margin: 1.1rem 0;
}
.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--card-border);
}

.stack-gap { display: grid; gap: 1rem; }
.mt-1 { margin-top: 1rem; }
.mt-2 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 1rem; }
.mb-2 { margin-bottom: 1.5rem; }

@media (max-width: 900px) {
  .hero { padding: 2.25rem 0 1.25rem; }
  .hero-grid,
  .grid-3,
  .two-col { grid-template-columns: 1fr; }
  .stats { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 1fr; }
  .section { padding: 1.5rem 0 2rem; }
  .card { padding: 1.1rem; }
  .hero-actions .btn { flex: 1 1 auto; }
  .container { width: min(1100px, calc(100% - 1.25rem)); }

  .nav-toggle { display: inline-flex; }
  .nav-links {
    position: fixed;
    top: 0;
    right: 0;
    width: min(320px, 86vw);
    height: 100dvh;
    height: 100vh;
    margin: 0;
    padding: calc(var(--nav-h) + var(--safe-top) + 0.75rem) 1rem calc(1.25rem + var(--safe-bottom));
    background: rgba(8, 12, 22, 0.98);
    border-left: 1px solid var(--card-border);
    box-shadow: -20px 0 50px rgba(0,0,0,0.35);
    flex-direction: column;
    align-items: stretch;
    gap: 0.35rem;
    transform: translateX(105%);
    transition: transform .22s ease;
    z-index: 55;
    overflow-y: auto;
  }
  body.nav-open .nav-links { transform: translateX(0); }
  .nav-links a,
  .nav-links .btn {
    width: 100%;
    justify-content: flex-start;
    border-radius: 12px;
    min-height: 48px;
    padding: 0.85rem 1rem;
  }
  .nav-links .btn-primary,
  .nav-links .btn-ghost {
    justify-content: center;
    margin-top: 0.35rem;
  }
}

@media (max-width: 640px) {
  h1 { font-size: clamp(1.7rem, 8vw, 2.2rem); }
  .lead { font-size: 0.98rem; }
  .copy-row { flex-direction: column; align-items: stretch; }
  .copy-row .btn { width: 100%; }
  table { min-width: 420px; }
  th, td { padding: 0.75rem 0.8rem; font-size: 0.86rem; }
  .card-head .btn { width: 100%; }
  pre { font-size: 0.78rem; padding: 0.85rem; }
  .stat b { font-size: 1.05rem; }
  .brand span:last-child { max-width: 42vw; overflow: hidden; text-overflow: ellipsis; }
}

@media (max-width: 380px) {
  .hero-actions { flex-direction: column; }
  .hero-actions .btn { width: 100%; }
}

/* ── Dashboard shell (profile / relay console) ─────────────────────────── */
.dash-body {
  background: #0a0c0f;
}
.dash {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
  min-height: 100dvh;
}
.dash-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  padding: 1rem 0.85rem 0.9rem;
  border-right: 1px solid var(--card-border);
  background: #0e1116;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  z-index: 40;
}
.dash-brand {
  padding: 0.35rem 0.4rem;
  gap: 0.75rem;
}
.dash-brand strong {
  display: block;
  font-size: 0.98rem;
  line-height: 1.2;
}
.dash-brand small {
  display: block;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 500;
}
.dash-nav {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex: 1;
  overflow: auto;
}
.dash-nav a {
  color: var(--muted);
  text-decoration: none;
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  font-weight: 560;
  font-size: 0.9rem;
  min-height: 38px;
  display: flex;
  align-items: center;
  border: 1px solid transparent;
}
.dash-nav a:hover,
.dash-nav a.active {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
  text-decoration: none;
}
.dash-nav a.active {
  background: rgba(91, 141, 239, 0.12);
  border-color: rgba(91, 141, 239, 0.28);
  color: #d7e4ff;
}
.dash-side-foot {
  display: grid;
  gap: 0.75rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--card-border);
}
.dash-user {
  display: flex;
  gap: 0.7rem;
  align-items: center;
  min-width: 0;
}
.dash-avatar {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  font-weight: 700;
  font-size: 0.72rem;
  color: #0b0d10;
  background: #8fa8d8;
}
.dash-user b {
  display: block;
  font-size: 0.9rem;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dash-user span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dash-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.dash-top {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1.1rem;
  border-bottom: 1px solid var(--card-border);
  background: rgba(11, 13, 16, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.dash-title {
  flex: 1;
  min-width: 0;
}
.dash-title h1 {
  margin: 0;
  font-size: clamp(1.2rem, 2.4vw, 1.55rem);
  letter-spacing: -0.02em;
  line-height: 1.2;
}
.dash-title .sub {
  margin: 0.2rem 0 0;
  font-size: 0.88rem;
}
.dash-top-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.dash-menu { display: none; }
.dash-content {
  padding: 1.25rem;
  width: min(1200px, 100%);
  margin: 0 auto;
}
.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.9rem;
}
.metric-card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  padding: 0.9rem 0.95rem;
  box-shadow: none;
  min-width: 0;
}
.metric-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  color: var(--muted);
  font-size: 0.86rem;
  margin-bottom: 0.55rem;
}
.metric-card b {
  display: block;
  font-size: 1.45rem;
  letter-spacing: -0.02em;
  line-height: 1.15;
  word-break: break-word;
}
.metric-model {
  font-size: 0.95rem !important;
  font-family: var(--mono);
  color: #c5d4f5;
}
.metric-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.7rem;
  color: var(--muted);
  font-size: 0.8rem;
}
.metric-icon {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}
.metric-icon {
  border: 1px solid var(--card-border);
  background: rgba(255,255,255,0.03) !important;
  color: var(--muted) !important;
  border-radius: 7px !important;
  font-weight: 700 !important;
}
.metric-icon.cyan,
.metric-icon.violet,
.metric-icon.green,
.metric-icon.amber { background: rgba(255,255,255,0.03); color: var(--muted); }

.dash-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 1rem;
  align-items: start;
}
.card-sub {
  margin: 0.2rem 0 0;
  color: var(--muted);
  font-size: 0.86rem;
}
.field-label {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  margin: 0 0 0.35rem;
}

.key-reveal {
  margin-top: 0.9rem;
  border: 1px solid rgba(224, 165, 75, 0.35);
  background: #141820;
  border-radius: 10px;
  padding: 0.95rem;
}
.key-reveal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
}
.key-reveal-head h4 {
  margin: 0.4rem 0 0;
  font-size: 1rem;
}
.key-box {
  margin-top: 0.75rem;
  display: grid;
  gap: 0.65rem;
}
.key-box code {
  display: block;
  font-family: var(--mono);
  font-size: 0.9rem;
  line-height: 1.45;
  word-break: break-all;
  white-space: pre-wrap;
  background: #050a12;
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 0.9rem 1rem;
  color: #f0e2bf;
}
.key-box-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.snippet-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0.9rem 0 0.55rem;
}
.snippet-tabs button {
  border: 1px solid var(--card-border);
  background: transparent;
  color: var(--muted);
  border-radius: 6px;
  padding: 0.35rem 0.7rem;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  min-height: 32px;
}
.snippet-tabs button.active,
.snippet-tabs button:hover {
  color: var(--text);
  border-color: rgba(91, 141, 239, 0.4);
  background: rgba(91, 141, 239, 0.1);
}
.snippet-panel {
  position: relative;
}
.snippet-panel pre {
  margin: 0;
  max-height: 260px;
}
.snippet-panel .btn,
.snippet-panel .btn-sm {
  position: absolute;
  top: 0.55rem;
  right: 0.55rem;
}
.btn-sm {
  min-height: 34px;
  padding: 0.4rem 0.75rem;
  font-size: 0.82rem;
}

.endpoint-grid {
  display: grid;
  gap: 0.45rem;
}
.endpoint-item {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: center;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--card-border);
  border-radius: 12px;
  background: rgba(255,255,255,0.02);
  font-size: 0.86rem;
}
.endpoint-item span { color: var(--muted); }
.endpoint-item code { color: #b9c7e6; font-size: 0.8rem; }

.model-list {
  display: grid;
  gap: 0.45rem;
}
.model-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--card-border);
  border-radius: 12px;
  background: rgba(255,255,255,0.02);
}
.model-item > div {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
}
.model-item code {
  color: #b9c7e6;
  font-size: 0.84rem;
  word-break: break-all;
}

.dash-table { min-width: 560px; }
.td-actions { white-space: nowrap; text-align: right; }
.empty-row {
  color: var(--muted);
  text-align: center;
  padding: 1.2rem 1rem !important;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(2, 6, 14, 0.72);
  display: grid;
  place-items: center;
  padding: 1rem;
}
.modal-backdrop[hidden] { display: none !important; }
.modal {
  width: min(440px, 100%);
  margin: 0;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

@media (max-width: 1100px) {
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .dash-grid { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .dash { grid-template-columns: 1fr; }
  .dash-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: min(300px, 86vw);
    transform: translateX(-105%);
    transition: transform .22s ease;
    box-shadow: 20px 0 50px rgba(0,0,0,0.35);
  }
  body.dash-open .dash-sidebar { transform: translateX(0); }
  .dash-menu { display: inline-flex; }
  .dash-top-actions .btn-ghost { display: none; }
  .dash-content { padding: 1rem 0.9rem 1.5rem; }
}
@media (max-width: 640px) {
  .metric-grid { grid-template-columns: 1fr; }
  .dash-title h1 { font-size: 1.2rem; }
  .key-box-actions .btn { flex: 1 1 auto; }
  .modal-actions { flex-direction: column-reverse; }
  .modal-actions .btn { width: 100%; }
  .endpoint-item { flex-direction: column; align-items: flex-start; }
}


/* ── Ops polish ─────────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  left: 50%;
  bottom: 1.25rem;
  transform: translateX(-50%);
  z-index: 120;
  max-width: min(520px, calc(100vw - 1.5rem));
  background: #171b22;
  border: 1px solid var(--card-border);
  color: var(--text);
  border-radius: 8px;
  padding: 0.7rem 0.95rem;
  font-size: 0.88rem;
  box-shadow: 0 12px 30px rgba(0,0,0,0.4);
}
.toast-ok { border-color: rgba(62, 207, 142, 0.35); }
.toast-err { border-color: rgba(224, 108, 117, 0.4); color: #ffd7db; }
.toast[hidden] { display: none !important; }

.key-actions {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  justify-content: flex-end;
}
.key-actions .btn-sm {
  min-height: 30px;
  padding: 0.28rem 0.55rem;
  border-radius: 6px;
  font-size: 0.78rem;
}
.btn-danger-text { color: #f0a0a7 !important; }
.btn-danger-text:hover { background: rgba(224, 108, 117, 0.1) !important; }
.status-cell {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--muted);
  font-size: 0.86rem;
}
.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
  background: #5c6475;
}
.status-dot.status-ok { background: var(--ok); box-shadow: 0 0 0 3px rgba(62,207,142,0.12); }
.status-dot.status-off { background: #5c6475; }
.mono-soft {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--muted);
}
.key-prefix {
  font-size: 0.82rem;
  color: #b9c7e6;
}
.dash-content .card-head {
  margin-bottom: 0.75rem;
}
.dash-content .card-head h3 {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 650;
  letter-spacing: -0.01em;
}
.dash .pill {
  border-radius: 5px;
  font-size: 0.72rem;
  padding: 0.18rem 0.45rem;
  font-weight: 650;
  letter-spacing: 0.01em;
}
.dash .table-wrap {
  border-radius: 8px;
  border-color: var(--card-border);
}
.dash table th {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #6f788c;
  font-weight: 650;
}
.dash table td {
  font-size: 0.86rem;
  padding: 0.7rem 0.75rem;
}
.dash .progress-bar {
  height: 6px;
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
}
.dash .progress-fill {
  border-radius: 999px;
}
.dash .copy-row {
  border-radius: 8px;
}
.metric-icon {
  width: 28px !important;
  height: 28px !important;
  font-size: 0.62rem !important;
}


/* Playground helpers */
.pg-banner {
  margin: 0 0 1rem;
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
  border: 1px solid var(--card-border);
  background: #12161c;
  color: var(--muted);
  font-size: 0.88rem;
}
.pg-banner-ok {
  border-color: rgba(62, 207, 142, 0.35);
  color: #c8f0db;
}
.pg-banner-warn {
  border-color: rgba(224, 165, 75, 0.4);
  color: #f0e2bf;
}
.pg-key-row {
  display: flex;
  gap: 0.45rem;
  align-items: center;
}
.pg-key-row input { flex: 1; min-width: 0; }
.pg-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 0.25rem;
}
.field-hint {
  margin: 0.4rem 0 0;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.4;
}
