/* ==========================================================================
   Meldrix — design tokens
   ========================================================================== */
:root {
  --bg: #070a10;
  --bg-soft: #0a0e16;
  --card: #0d121c;
  --card-hover: #101725;
  --border: #1e293b;
  --border-soft: #16202e;
  --text: #e7eef8;
  --muted: #8b98ab;
  --faint: #5c6a7d;
  --accent: #10b981;
  --accent-hover: #34d399;
  --accent-ink: #04120c;
  --accent-soft: rgba(16, 185, 129, 0.12);
  --danger: #f87171;
  --danger-soft: rgba(248, 113, 113, 0.1);
  --warn: #fbbf24;
  --warn-soft: rgba(251, 191, 36, 0.1);
  --blue: #60a5fa;
  --blue-soft: rgba(96, 165, 250, 0.1);
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --radius: 12px;
  --shadow: 0 24px 60px -24px rgba(0, 0, 0, 0.8);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 88px;
  overflow-x: clip;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}

::selection {
  background: rgba(16, 185, 129, 0.28);
  color: #fff;
}

a {
  color: inherit;
  text-decoration: none;
}

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

button {
  cursor: pointer;
}

h1, h2, h3, p {
  margin: 0;
}

[hidden] {
  display: none !important;
}

.mono {
  font-family: var(--mono);
  font-size: 0.94em;
}

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

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

/* ==========================================================================
   Brand + navigation
   ========================================================================== */
.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.brand-mark {
  width: 26px;
  height: 26px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
}

.mark-svg {
  display: block;
  width: 100%;
  height: 100%;
}

.brand-mark-sm {
  width: 20px;
  height: 20px;
}

.brand-name {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.015em;
}

.brand-slash {
  color: var(--faint);
  font-family: var(--mono);
  font-size: 12px;
}

.brand-sub {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid var(--border-soft);
  background: rgba(7, 10, 16, 0.82);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.nav-inner {
  width: min(1200px, calc(100% - 48px));
  margin-inline: auto;
  height: 62px;
  display: flex;
  align-items: center;
  gap: 28px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 22px;
  margin-left: 12px;
  font-size: 13.5px;
  color: var(--muted);
}

.nav-links a {
  transition: color 0.15s ease;
}

.nav-links a:hover {
  color: var(--text);
}

.nav-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 14px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 28px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(13, 18, 28, 0.7);
  color: var(--muted);
  font-size: 11.5px;
  font-family: var(--mono);
  white-space: nowrap;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--faint);
  box-shadow: 0 0 0 3px rgba(92, 106, 125, 0.12);
  transition: background 0.2s ease, box-shadow 0.2s ease;
}

.status-pill.is-ok .status-dot {
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.14);
  animation: pulse 2.4s ease-in-out infinite;
}

.status-pill.is-ok {
  color: #b6e9d7;
  border-color: rgba(16, 185, 129, 0.28);
}

.status-pill.is-down {
  color: #fecaca;
  border-color: rgba(248, 113, 113, 0.3);
}

.status-pill.is-down .status-dot {
  background: var(--danger);
  box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.14);
}

.status-latency {
  color: var(--faint);
  padding-left: 2px;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

/* ==========================================================================
   Buttons + inputs
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-size: 13.5px;
  font-weight: 500;
  letter-spacing: -0.005em;
  white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.1s ease;
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
  font-weight: 600;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.03);
  border-color: #2a3a52;
}

.btn-danger {
  background: var(--danger-soft);
  border-color: rgba(248, 113, 113, 0.35);
  color: #fca5a5;
  font-weight: 600;
}

.btn-danger:hover {
  background: rgba(248, 113, 113, 0.18);
}

.btn-sm {
  height: 32px;
  padding: 0 12px;
  font-size: 12.5px;
  border-radius: 7px;
}

.btn-block {
  width: 100%;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.btn-google {
  width: 100%;
  height: 42px;
  background: #e9eef6;
  border-color: #e9eef6;
  color: #0b1220;
  font-weight: 600;
  gap: 10px;
}

.btn-google:hover {
  background: #fff;
  border-color: #fff;
}

.btn-google svg {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
}

.field {
  display: block;
}

.field-label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.input {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #070b12;
  color: var(--text);
  font-size: 13.5px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.input::placeholder {
  color: #4b5869;
}

.input:focus {
  border-color: rgba(16, 185, 129, 0.6);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.12);
}

.input-sm {
  height: 32px;
  font-size: 12.5px;
  padding: 0 10px;
}

.select {
  height: 32px;
  padding: 0 30px 0 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background-color: #070b12;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%238b98ab' stroke-width='1.4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  color: var(--text);
  font-size: 12.5px;
  outline: none;
  appearance: none;
}

.select:focus {
  border-color: rgba(16, 185, 129, 0.6);
}

/* ==========================================================================
   Landing — hero
   ========================================================================== */
.landing {
  position: relative;
}

.landing::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 720px;
  background-image:
    linear-gradient(to right, rgba(30, 41, 59, 0.22) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(30, 41, 59, 0.22) 1px, transparent 1px);
  background-size: 64px 64px;
  -webkit-mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, #000 30%, transparent 78%);
  mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, #000 30%, transparent 78%);
  pointer-events: none;
  z-index: 0;
}

.landing main,
.landing .nav,
.landing .footer {
  position: relative;
  z-index: 1;
}

.hero {
  width: min(1200px, calc(100% - 48px));
  margin-inline: auto;
  padding: 84px 0 52px;
  display: grid;
  grid-template-columns: 1.02fr 0.98fr;
  gap: 64px;
  align-items: center;
}

.hero > *,
.endpoint-grid > *,
.auth > * {
  min-width: 0;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.eyebrow-sep {
  color: var(--faint);
}

.hero h1 {
  margin-top: 18px;
  font-size: clamp(2.6rem, 4.6vw, 3.7rem);
  line-height: 1.04;
  letter-spacing: -0.045em;
  font-weight: 600;
}

.lede {
  margin-top: 20px;
  max-width: 480px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.65;
}

.hero-cta {
  margin-top: 30px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.hero-meta {
  margin-top: 26px;
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  color: var(--faint);
  font-size: 12px;
  font-family: var(--mono);
}

.hero-meta span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.meta-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
}

/* Code windows */
.code-window {
  max-width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #080c13;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.code-head {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 38px;
  padding: 0 14px;
  border-bottom: 1px solid var(--border-soft);
  background: rgba(255, 255, 255, 0.018);
}

.code-dots {
  display: inline-flex;
  gap: 5px;
}

.code-dots i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #263242;
}

.code-title {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
}

.code-dim {
  color: var(--faint);
}

.code-time {
  margin-left: auto;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 10.5px;
}

.copy-btn {
  margin-left: auto;
  height: 22px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10.5px;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.copy-btn:hover {
  color: var(--text);
  border-color: #33445c;
}

.code-body {
  margin: 0;
  padding: 18px 18px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  font-family: var(--mono);
  font-size: 12.25px;
  line-height: 1.8;
  color: #c8d5e6;
  tab-size: 2;
}

.code-json {
  font-size: 11.75px;
  line-height: 1.85;
}

.tok-cmd { color: #e7eef8; }
.tok-flag { color: #8b98ab; }
.tok-str { color: #a7f3d0; }
.tok-key { color: #93c5fd; }
.tok-bool { color: #fbbf24; }
.tok-com { color: #5c6a7d; }

.code-response {
  margin-top: 14px;
  box-shadow: 0 16px 40px -24px rgba(0, 0, 0, 0.9);
}

/* ==========================================================================
   Landing — strip, features, docs
   ========================================================================== */
.strip {
  width: min(1200px, calc(100% - 48px));
  margin: 18px auto 0;
  padding: 20px 0;
  border-top: 1px solid var(--border-soft);
  border-bottom: 1px solid var(--border-soft);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
}

.strip-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-left: 16px;
  border-left: 1px solid var(--border-soft);
}

.strip-item:first-child {
  border-left: 0;
  padding-left: 0;
}

.strip-k {
  color: var(--faint);
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.strip-v {
  font-size: 13px;
  color: var(--text);
}

.section {
  width: min(1200px, calc(100% - 48px));
  margin-inline: auto;
  padding: 72px 0 0;
}

.features {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 36px;
}

.feature {
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.feature-index {
  color: var(--accent);
  font-size: 10.5px;
  letter-spacing: 0.08em;
}

.feature h3 {
  margin-top: 10px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.feature p {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.65;
}

.section-head {
  max-width: 620px;
  margin-bottom: 28px;
}

.section-head h2 {
  margin-top: 10px;
  font-size: clamp(1.5rem, 2.6vw, 1.9rem);
  font-weight: 600;
  letter-spacing: -0.03em;
}

.section-head p {
  margin-top: 10px;
  color: var(--muted);
  font-size: 14px;
}

.endpoint-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.endpoint-card {
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.016), transparent 40%), var(--card);
}

.endpoint-top {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.method {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 7px;
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
}

.method-post {
  background: var(--accent-soft);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.method-get {
  background: var(--blue-soft);
  color: #93c5fd;
  border: 1px solid rgba(96, 165, 250, 0.25);
}

.endpoint-path {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text);
}

.endpoint-desc {
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
}

.param-table {
  width: 100%;
  margin-top: 16px;
  border-collapse: collapse;
  font-size: 12.5px;
}

.param-table th {
  padding: 6px 8px;
  border-bottom: 1px solid var(--border-soft);
  color: var(--faint);
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  text-align: left;
}

.param-table td {
  padding: 9px 8px;
  border-bottom: 1px solid rgba(30, 41, 59, 0.45);
  vertical-align: top;
  color: #c3cfdf;
}

.param-table tr:last-child td {
  border-bottom: 0;
}

.param-table td:first-child {
  color: #a7f3d0;
  white-space: nowrap;
}

.param-table td:nth-child(2) {
  white-space: nowrap;
}

/* Auth section */
.auth {
  display: grid;
  grid-template-columns: 1.08fr 0.92fr;
  gap: 64px;
  align-items: center;
}

.auth-copy h2 {
  margin-top: 10px;
  font-size: clamp(1.5rem, 2.6vw, 1.9rem);
  font-weight: 600;
  letter-spacing: -0.03em;
}

.auth-copy > p {
  margin-top: 12px;
  max-width: 500px;
  color: var(--muted);
  font-size: 14px;
}

.check-list {
  margin: 22px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 10px;
}

.check-list li {
  position: relative;
  padding-left: 22px;
  color: #c3cfdf;
  font-size: 13.5px;
}

.check-list li::before {
  content: "→";
  position: absolute;
  left: 0;
  top: 0;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 12px;
}

.auth-card {
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--card);
  box-shadow: var(--shadow);
}

.auth-card .code-window {
  box-shadow: none;
}

.auth-note {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 14px 0;
  padding: 10px 12px;
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.015);
  color: var(--muted);
  font-size: 12px;
}

.lock-icon {
  color: var(--accent);
  font-size: 9px;
}

/* Errors */
.errors {
  padding-bottom: 80px;
}

.error-table-wrap {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--card);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.error-table {
  width: 100%;
  min-width: 560px;
  border-collapse: collapse;
  font-size: 13px;
}

.error-table th {
  padding: 11px 18px;
  background: rgba(255, 255, 255, 0.015);
  border-bottom: 1px solid var(--border-soft);
  color: var(--faint);
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  text-align: left;
}

.error-table td {
  padding: 11px 18px;
  border-bottom: 1px solid var(--border-soft);
  color: #c3cfdf;
}

.error-table tr:last-child td {
  border-bottom: 0;
}

.error-table td:nth-child(2) {
  color: #a7f3d0;
}

/* ==========================================================================
   Badges
   ========================================================================== */
.badge {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 7px;
  border-radius: 5px;
  border: 1px solid transparent;
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.badge-ok {
  background: var(--accent-soft);
  border-color: rgba(16, 185, 129, 0.25);
  color: #6ee7b7;
}

.badge-warn {
  background: var(--warn-soft);
  border-color: rgba(251, 191, 36, 0.25);
  color: #fcd34d;
}

.badge-err {
  background: var(--danger-soft);
  border-color: rgba(248, 113, 113, 0.25);
  color: #fca5a5;
}

.badge-muted {
  background: rgba(139, 152, 171, 0.08);
  border-color: rgba(139, 152, 171, 0.18);
  color: var(--muted);
}

.badge-blue {
  background: var(--blue-soft);
  border-color: rgba(96, 165, 250, 0.22);
  color: #93c5fd;
}

/* ==========================================================================
   Footer
   ========================================================================== */
.footer {
  border-top: 1px solid var(--border-soft);
  margin-top: 0;
}

.footer-inner {
  width: min(1200px, calc(100% - 48px));
  margin-inline: auto;
  padding: 26px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--muted);
}

.footer-sep {
  color: var(--faint);
}

.footer-links {
  display: flex;
  gap: 20px;
  color: var(--muted);
  font-size: 12.5px;
}

.footer-links a:hover {
  color: var(--text);
}

/* ==========================================================================
   Auth page
   ========================================================================== */
.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 40px 20px;
  position: relative;
}

.auth-page::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(to right, rgba(30, 41, 59, 0.16) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(30, 41, 59, 0.16) 1px, transparent 1px);
  background-size: 56px 56px;
  -webkit-mask-image: radial-gradient(ellipse 70% 55% at 50% 35%, #000 20%, transparent 80%);
  mask-image: radial-gradient(ellipse 70% 55% at 50% 35%, #000 20%, transparent 80%);
  pointer-events: none;
}

.auth-shell {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 410px;
}

.auth-brand {
  justify-content: center;
  width: 100%;
  margin-bottom: 26px;
}

.login-card {
  padding: 28px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--card);
  box-shadow: var(--shadow);
}

.login-head {
  text-align: center;
  margin-bottom: 22px;
}

.login-head h1 {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.025em;
}

.login-head p {
  margin-top: 7px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.55;
}

.alert {
  margin-bottom: 14px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-size: 12.5px;
  line-height: 1.5;
}

.alert-err {
  background: var(--danger-soft);
  border-color: rgba(248, 113, 113, 0.25);
  color: #fca5a5;
}

.alert-warn {
  background: var(--warn-soft);
  border-color: rgba(251, 191, 36, 0.22);
  color: #fcd34d;
  margin: 14px 0 0;
}

.alert-ok {
  background: var(--accent-soft);
  border-color: rgba(16, 185, 129, 0.22);
  color: #6ee7b7;
}

.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  color: var(--faint);
  font-size: 10.5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border-soft);
}

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

.input-wrap {
  position: relative;
  display: block;
}

.input-wrap .input {
  padding-right: 54px;
}

.reveal {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  height: 30px;
  padding: 0 8px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--faint);
  font-size: 11px;
  font-family: var(--mono);
}

.reveal:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
}

.login-foot {
  margin-top: 20px;
  text-align: center;
  color: var(--faint);
  font-size: 12px;
}

.login-foot a {
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.login-foot a:hover {
  color: var(--text);
}

.auth-legal {
  margin-top: 18px;
  text-align: center;
  color: #4b5869;
  font-size: 10.5px;
  line-height: 1.6;
}

/* ==========================================================================
   Dashboard
   ========================================================================== */
.app-page {
  background: var(--bg);
  min-height: 100vh;
}

.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: var(--bg);
  color: var(--muted);
  font-size: 13px;
  font-family: var(--mono);
}

.spinner {
  width: 22px;
  height: 22px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  border-bottom: 1px solid var(--border-soft);
  background: rgba(7, 10, 16, 0.86);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.topbar-inner {
  width: min(1240px, calc(100% - 40px));
  margin-inline: auto;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 20px;
}

.topbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 14px;
}

.topbar-user {
  color: var(--muted);
  font-size: 12px;
  font-family: var(--mono);
  max-width: 230px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10.5px;
}

.live-pill i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 2s ease-in-out infinite;
}

.live-pill.is-paused i {
  background: var(--faint);
  animation: none;
}

.shell {
  width: min(1240px, calc(100% - 40px));
  margin-inline: auto;
  padding: 28px 0 60px;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.page-head h1 {
  font-size: 23px;
  font-weight: 600;
  letter-spacing: -0.03em;
}

.page-head p {
  margin-top: 3px;
  font-size: 13px;
}

.page-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.updated {
  color: var(--faint);
  font-family: var(--mono);
  font-size: 10.5px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.kpi {
  padding: 17px 18px 15px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  min-width: 0;
}

.kpi-label {
  display: block;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 500;
}

.kpi-value {
  display: block;
  margin-top: 8px;
  font-size: 29px;
  line-height: 1.1;
  font-weight: 600;
  letter-spacing: -0.035em;
  font-variant-numeric: tabular-nums;
}

.kpi-sub {
  display: block;
  margin-top: 6px;
  color: var(--faint);
  font-size: 10.5px;
  font-family: var(--mono);
}

.panel {
  margin-top: 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--card);
  overflow: hidden;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 17px 20px 0;
  flex-wrap: wrap;
}

.chart-panel .panel-head {
  padding-bottom: 14px;
}

.panel-head h2 {
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: -0.015em;
}

.panel-sub {
  margin-top: 2px;
  color: var(--faint);
  font-size: 11.5px;
}

.panel-meta {
  color: var(--muted);
  font-size: 11px;
}

.chart {
  height: 118px;
  margin: 0 20px;
  display: flex;
  align-items: flex-end;
  gap: 3px;
}

.chart .bar {
  flex: 1;
  min-height: 2px;
  border-radius: 2px 2px 0 0;
  background: rgba(16, 185, 129, 0.16);
  border-top: 1px solid rgba(16, 185, 129, 0.35);
  transition: background 0.15s ease;
}

.chart .bar:hover {
  background: rgba(16, 185, 129, 0.45);
}

.chart .bar.is-zero {
  background: rgba(30, 41, 59, 0.4);
  border-top-color: transparent;
}

.chart-axis {
  display: flex;
  justify-content: space-between;
  padding: 8px 20px 16px;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 9.5px;
}

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

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

.data-table th {
  padding: 9px 20px;
  border-top: 1px solid var(--border-soft);
  border-bottom: 1px solid var(--border-soft);
  background: rgba(255, 255, 255, 0.012);
  color: var(--faint);
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-align: left;
  white-space: nowrap;
}

.data-table td {
  padding: 11px 20px;
  border-bottom: 1px solid var(--border-soft);
  color: #c3cfdf;
  vertical-align: middle;
}

.data-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.017);
}

.data-table tbody tr:last-child td {
  border-bottom: 0;
}

.data-table .key-name {
  color: var(--text);
  font-weight: 500;
}

.key-prefix {
  display: inline-block;
  padding: 2px 6px;
  border: 1px solid var(--border-soft);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.02);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  white-space: nowrap;
}

.cell-mono {
  font-family: var(--mono);
  font-size: 11.5px;
}

.cell-time {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  white-space: nowrap;
}

.cell-video {
  color: #a7f3d0;
  font-family: var(--mono);
  font-size: 11.5px;
  white-space: nowrap;
}

.cell-dim {
  color: var(--faint);
}

.latency {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.switch {
  position: relative;
  width: 34px;
  height: 19px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #1a2433;
  transition: background 0.16s ease, border-color 0.16s ease;
  vertical-align: middle;
}

.switch-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #93a3b8;
  transition: transform 0.16s ease, background 0.16s ease;
}

.switch.on {
  background: rgba(16, 185, 129, 0.25);
  border-color: rgba(16, 185, 129, 0.55);
}

.switch.on .switch-knob {
  transform: translateX(15px);
  background: var(--accent);
}

.row-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: flex-end;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--faint);
  font-size: 14px;
  line-height: 1;
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.icon-btn:hover {
  color: #fca5a5;
  background: var(--danger-soft);
  border-color: rgba(248, 113, 113, 0.2);
}

.status-text {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--muted);
}

.log-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.log-controls .input {
  width: 190px;
}

.toggle-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 11.5px;
  font-family: var(--mono);
  cursor: pointer;
  user-select: none;
}

.toggle-inline input {
  accent-color: var(--accent);
  width: 13px;
  height: 13px;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 20px;
  border-top: 1px solid var(--border-soft);
  font-family: var(--mono);
  font-size: 10.5px;
}

.pagination-btns {
  display: flex;
  gap: 8px;
}

.empty {
  padding: 38px 20px;
  text-align: center;
  color: var(--faint);
  font-size: 12.5px;
}

.empty strong {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-weight: 500;
}

.app-footer {
  margin-top: 34px;
  padding-top: 18px;
  border-top: 1px solid var(--border-soft);
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 10px;
}

/* ==========================================================================
   Modal + toast
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(2, 5, 9, 0.72);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: fade-in 0.15s ease;
}

.modal {
  position: relative;
  width: 100%;
  max-width: 460px;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--card);
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.9);
  animation: modal-in 0.18s ease;
}

.modal-sm {
  max-width: 400px;
}

.modal h2 {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.modal-sub {
  margin-top: 6px;
  margin-bottom: 18px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.55;
}

.modal-actions {
  margin-top: 20px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--faint);
  font-size: 18px;
  line-height: 1;
}

.modal-close:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
}

.secret-box {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #070b12;
}

.secret-box code {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
  font-family: var(--mono);
  font-size: 12px;
  color: #a7f3d0;
  line-height: 1.5;
}

.toast-stack {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: min(360px, calc(100vw - 40px));
}

.toast {
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-left: 2px solid var(--accent);
  border-radius: 8px;
  background: #0d121c;
  color: var(--text);
  font-size: 12.5px;
  box-shadow: 0 16px 40px -16px rgba(0, 0, 0, 0.8);
  animation: toast-in 0.18s ease;
}

.toast.is-error {
  border-left-color: var(--danger);
}

@keyframes fade-in {
  from { opacity: 0; }
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(6px) scale(0.99); }
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(6px); }
}

/* ==========================================================================
   Dynamic base URL, docs page, try-it
   ========================================================================== */
.base-url-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 18px;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--card);
  min-width: 0;
}

.base-url-bar .strip-k {
  flex: 0 0 auto;
}

.base-url-bar code {
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  white-space: nowrap;
  padding: 1px 0;
  color: #a7f3d0;
  font-family: var(--mono);
  font-size: 12px;
}

.base-url-bar .copy-btn {
  flex: 0 0 auto;
  margin-left: 0;
}

.table-scroll {
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table-scroll .param-table {
  min-width: 480px;
  margin-top: 16px;
}

.inline-link {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.inline-link:hover {
  color: var(--accent-hover);
}

.nav-links a.is-active {
  color: var(--text);
}

.docs-main {
  position: relative;
  z-index: 1;
  width: min(1000px, calc(100% - 48px));
  margin-inline: auto;
  padding-bottom: 76px;
}

.docs-hero {
  padding: 62px 0 6px;
}

.docs-hero h1 {
  margin-top: 14px;
  font-size: clamp(2.1rem, 4.2vw, 2.9rem);
  line-height: 1.08;
  letter-spacing: -0.04em;
  font-weight: 600;
}

.docs-hero .lede {
  max-width: 620px;
  margin-top: 16px;
}

.docs-section {
  padding-top: 52px;
}

.docs-section .section-head {
  margin-bottom: 22px;
}

.endpoint-block {
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--card);
}

.endpoint-block .endpoint-top {
  gap: 10px;
}

.endpoint-block .endpoint-desc {
  margin-top: 10px;
}

.endpoint-full {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  margin-top: 14px;
  padding: 8px 10px;
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  background: #070b12;
}

.endpoint-full code {
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  white-space: nowrap;
  color: #a7f3d0;
  font-family: var(--mono);
  font-size: 11.5px;
}

.endpoint-full .copy-btn {
  flex: 0 0 auto;
  margin-left: 0;
}

.docs-code {
  margin-top: 14px;
  box-shadow: none;
}

.docs-note {
  margin-top: 18px;
  color: var(--faint);
  font-size: 12px;
}

.tryit-panel {
  margin-top: 0;
}

.tryit-panel .panel-meta {
  min-width: 0;
  overflow-wrap: anywhere;
}

.tryit-body {
  display: grid;
  grid-template-columns: 290px minmax(0, 1fr);
  gap: 20px;
  padding: 8px 20px 20px;
}

.tryit-form {
  display: grid;
  gap: 12px;
  align-content: start;
}

.tryit-output {
  min-width: 0;
}

.tryit-status {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 20px;
  margin-bottom: 8px;
}

.tryit-response {
  margin: 0;
  min-height: 190px;
  max-height: 380px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #070b12;
  font-size: 11.5px;
}

.tryit-response code {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.table-wrap {
  -webkit-overflow-scrolling: touch;
}

.data-table {
  min-width: 620px;
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1024px) {
  .hero {
    grid-template-columns: 1fr;
    gap: 44px;
    padding-top: 64px;
  }

  .hero-code {
    max-width: 640px;
  }

  .auth {
    grid-template-columns: 1fr;
    gap: 36px;
  }

  .auth-card {
    max-width: 560px;
  }

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

  .nav-links {
    display: none;
  }
}

@media (max-width: 900px) {
  .tryit-body {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 820px) {
  .features {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .endpoint-grid {
    grid-template-columns: 1fr;
  }

  .strip {
    grid-template-columns: repeat(2, 1fr);
    gap: 18px;
  }

  .strip-item:nth-child(3) {
    border-left: 0;
    padding-left: 0;
  }
}

@media (max-width: 640px) {
  .nav-inner,
  .hero,
  .strip,
  .section,
  .docs-main,
  .footer-inner,
  .topbar-inner,
  .shell {
    width: calc(100% - 32px);
  }

  .nav-inner {
    gap: 12px;
  }

  .brand-sub,
  .brand-slash {
    display: none;
  }

  .status-pill {
    display: none;
  }

  .hero {
    padding-top: 48px;
  }

  .hero h1 {
    font-size: 2.45rem;
  }

  .section {
    padding-top: 56px;
  }

  .docs-hero {
    padding-top: 42px;
  }

  .docs-hero h1 {
    font-size: 1.95rem;
  }

  .docs-section {
    padding-top: 44px;
  }

  .endpoint-block {
    padding: 16px;
  }

  .tryit-body {
    padding: 8px 14px 16px;
  }

  .section-head h2,
  .auth-copy h2 {
    font-size: 1.45rem;
  }

  .kpi-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .kpi {
    padding: 14px;
  }

  .kpi-value {
    font-size: 24px;
  }

  .page-head {
    align-items: flex-start;
  }

  .topbar-user {
    display: none;
  }

  .log-controls {
    width: 100%;
  }

  .log-controls .input {
    flex: 1;
    width: auto;
    min-width: 140px;
  }

  .panel-head {
    padding: 15px 16px 0;
  }

  .data-table th,
  .data-table td {
    padding-inline: 14px;
  }

  .chart {
    margin-inline: 16px;
  }

  .chart-axis {
    padding-inline: 16px;
  }

  .footer-links {
    gap: 14px;
  }

  .toast-stack {
    right: 12px;
    bottom: 12px;
  }
}

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

  .hero-cta .btn {
    width: 100%;
  }
}
