:root {
  --bg0: #070a10;
  --bg1: #0d121b;
  --panel: #121925;
  --panel-border: rgba(148, 163, 184, 0.14);
  --text: #e8eef7;
  --muted: #8b97ab;
  --accent: #f59e0b;
  --cyan: #22d3ee;
  --ok: #22c55e;
  --warn: #f59e0b;
  --fail: #ef4444;
  --font-display: "Syne", "Segoe UI", sans-serif;
  --font-ui: "IBM Plex Sans", "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;
}

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

html,
body {
  margin: 0;
  min-height: 100%;
  background-color: var(--bg0);
}

body {
  font-family: var(--font-ui);
  color: var(--text);
  background-color: var(--bg0);
  background-image:
    radial-gradient(900px 420px at 85% -5%, rgba(245, 158, 11, 0.12), transparent 55%),
    radial-gradient(700px 380px at 5% 15%, rgba(34, 211, 238, 0.08), transparent 50%),
    linear-gradient(180deg, #0b1018 0%, var(--bg0) 55%, #05070c 100%);
  background-attachment: fixed;
}

.grid-veil {
  pointer-events: none;
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(148, 163, 184, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.04) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse at center, black 30%, transparent 85%);
  z-index: 0;
  animation: grid-pulse 14s ease-in-out infinite;
}

@keyframes grid-pulse {
  0%,
  100% {
    opacity: 0.45;
  }
  50% {
    opacity: 0.75;
  }
}

[hidden] {
  display: none !important;
}

.gate-view {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: grid;
  place-content: center;
  padding: 2rem 1rem;
  animation: rise 0.55s ease-out both;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.gate-card {
  width: min(420px, 100%);
  background: color-mix(in srgb, var(--panel) 92%, transparent);
  border: 1px solid var(--panel-border);
  border-radius: 18px;
  padding: 2rem 1.5rem 1.5rem;
  text-align: center;
  backdrop-filter: blur(8px);
}

.gate-logo {
  width: 120px;
  height: 120px;
  object-fit: contain;
  filter: drop-shadow(0 0 22px rgba(245, 158, 11, 0.35));
  animation: logo-breathe 3.4s ease-in-out infinite;
}

@keyframes logo-breathe {
  0%,
  100% {
    filter: drop-shadow(0 0 14px rgba(245, 158, 11, 0.28));
  }
  50% {
    filter: drop-shadow(0 0 28px rgba(34, 211, 238, 0.35));
  }
}

.gate-brand,
.page-head h1,
.panel h2 {
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0.2rem 0;
}

.gate-brand {
  font-size: 1.85rem;
}

.gate-sub {
  color: var(--muted);
  margin: 0 0 1.25rem;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.72rem;
  color: var(--muted);
  margin: 0;
}

.eyebrow.accent {
  color: var(--accent);
}

.gate-form,
.inline-row,
.stack {
  display: grid;
  gap: 0.55rem;
  text-align: left;
}

.gate-form label {
  font-size: 0.85rem;
  color: var(--muted);
}

input[type="text"],
input[type="password"],
input[type="search"] {
  width: 100%;
  border: 1px solid var(--panel-border);
  background: #0a0f17;
  color: var(--text);
  border-radius: 10px;
  padding: 0.7rem 0.85rem;
  font: 500 0.95rem var(--font-mono);
}

input:focus {
  outline: 2px solid color-mix(in srgb, var(--cyan) 55%, transparent);
  border-color: transparent;
}

.btn {
  appearance: none;
  border: 1px solid var(--panel-border);
  background: #1a2333;
  color: var(--text);
  border-radius: 10px;
  padding: 0.65rem 1rem;
  font: 600 0.92rem var(--font-ui);
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.btn:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--cyan) 40%, var(--panel-border));
}

.btn.primary {
  background: linear-gradient(180deg, #2dd4bf 0%, #0d9488 100%);
  border-color: transparent;
  color: #042f2e;
}

.btn.ghost {
  background: transparent;
}

.btn.slim {
  padding: 0.45rem 0.8rem;
  font-size: 0.85rem;
}

.btn.icon {
  width: 2.2rem;
  padding: 0;
}

.form-error {
  color: var(--fail);
  font-size: 0.88rem;
}

.muted,
.fineprint {
  color: var(--muted);
  font-size: 0.88rem;
}

.fineprint {
  margin: 0.75rem 0 0;
}

.gate-admin,
.gate-trial {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px dashed var(--panel-border);
}

.gate-trial .fineprint {
  margin: 0 0 0.75rem;
}

#trial-key-out {
  margin-top: 0.75rem;
  color: var(--cyan);
  word-break: break-all;
}

.billing-paypal {
  margin: 0.35rem 0 0.75rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.billing-paypal a {
  color: var(--cyan);
  text-decoration: none;
  margin-left: 0.25rem;
}

.billing-paypal a:hover {
  text-decoration: underline;
}

.live-ok {
  color: var(--ok) !important;
}

.live-warn {
  color: var(--warn) !important;
  max-width: 52rem;
}

.demo-keys {
  margin-top: 1.25rem;
  text-align: left;
  border-top: 1px solid var(--panel-border);
  padding-top: 0.9rem;
}

.demo-keys ul {
  margin: 0.35rem 0 0;
  padding-left: 1.1rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--cyan);
}

.app-view {
  position: relative;
  z-index: 1;
  max-width: 1180px;
  margin: 0 auto;
  padding: 1rem 1.1rem 2.5rem;
  animation: rise 0.45s ease-out both;
}

.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.35rem 0 1rem;
  border-bottom: 1px solid var(--panel-border);
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.topbar-brand img {
  border-radius: 50%;
}

.topbar-brand strong {
  display: block;
  font-size: 0.95rem;
}

.topbar-brand span {
  display: block;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.topbar-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
}

.badge {
  border-radius: 999px;
  padding: 0.25rem 0.65rem;
  font-size: 0.75rem;
  font-weight: 700;
}

.badge.gold {
  background: rgba(245, 158, 11, 0.18);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.35);
}

.page-head {
  padding: 1.35rem 0 1rem;
}

.page-head h1 {
  font-size: clamp(1.6rem, 3vw, 2.15rem);
}

.owner-line {
  margin: 0.25rem 0 0;
  color: var(--muted);
}

.layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  padding: 1.05rem 1.1rem 1.15rem;
}

.panel-kicker {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.panel-kicker > span:first-child {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.68rem;
  color: var(--muted);
}

.lead {
  font-size: 1.15rem;
  font-weight: 600;
  margin: 0.2rem 0;
}

.pill {
  border-radius: 999px;
  padding: 0.18rem 0.55rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.pill.ok {
  background: rgba(34, 197, 94, 0.15);
  color: var(--ok);
}

.pill.warn {
  background: rgba(245, 158, 11, 0.15);
  color: var(--warn);
}

.pill.fail {
  background: rgba(239, 68, 68, 0.15);
  color: var(--fail);
}

.inline-row {
  grid-template-columns: 1fr auto;
  margin-top: 0.75rem;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.conn-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.7rem;
  align-items: start;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--panel-border);
}

.conn-copy strong {
  display: block;
}

.conn-hint {
  margin: 0.25rem 0 0;
  color: var(--fail);
  font-size: 0.88rem;
}

.conn-hint.ok {
  color: var(--ok);
}

.dot {
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 50%;
  margin-top: 0.4rem;
  background: var(--muted);
  box-shadow: 0 0 0 3px rgba(148, 163, 184, 0.12);
}

.dot.ok {
  background: var(--ok);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.18);
}

.dot.warn {
  background: var(--warn);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.18);
}

.dot.fail {
  background: var(--fail);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.18);
}

.mono {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--muted);
}

.tiles {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.85rem;
}

.tile {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  padding: 0.95rem 1rem;
  position: relative;
}

.tile .dot {
  position: absolute;
  top: 1rem;
  right: 1rem;
  margin: 0;
}

.tile-label {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.68rem;
  color: var(--muted);
}

.tile strong {
  display: block;
  margin: 0.35rem 0 0.2rem;
  font-size: 1rem;
}

.tile-num {
  font-family: var(--font-display);
  font-size: 1.8rem !important;
  color: var(--cyan);
}

.tabs {
  display: flex;
  gap: 0.25rem;
}

.tab {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  border-radius: 8px;
  padding: 0.3rem 0.55rem;
  font: 600 0.78rem var(--font-ui);
  cursor: pointer;
}

.tab.active {
  color: var(--text);
  border-color: var(--panel-border);
  background: #0a0f17;
}

.empty-state {
  margin-top: 0.85rem;
  padding: 1.4rem 1rem;
  border: 1px dashed var(--panel-border);
  border-radius: 12px;
  color: var(--muted);
  text-align: center;
}

.table-wrap {
  margin-top: 0.85rem;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

th,
td {
  text-align: left;
  padding: 0.55rem 0.45rem;
  border-bottom: 1px solid var(--panel-border);
  vertical-align: top;
}

th {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--panel-border);
  color: var(--muted);
  font-size: 0.8rem;
}

.toast {
  position: fixed;
  z-index: 20;
  right: 1rem;
  bottom: 1rem;
  background: #152033;
  border: 1px solid var(--panel-border);
  color: var(--text);
  padding: 0.75rem 1rem;
  border-radius: 10px;
  max-width: min(360px, calc(100vw - 2rem));
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  animation: rise 0.25s ease-out both;
}

@media (max-width: 960px) {
  .layout,
  .tiles {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .inline-row {
    grid-template-columns: 1fr;
  }

  .conn-row {
    grid-template-columns: auto 1fr;
  }

  .conn-row .btn {
    grid-column: 2;
  }
}
