:root {
  --bg-void: #020408;
  --bg-deep: #06090f;
  --bg-surface: #0b1018;
  --bg-card: #0d1420;
  --bg-elevated: #111827;

  --accent-cyan: #00d4ff;
  --accent-cyan-dim: #00a8cc;
  --accent-emerald: #00ff88;
  --accent-amber: #ffaa00;
  --accent-violet: #a78bfa;
  --accent-danger: #ef4444;

  --border-subtle: rgba(0, 212, 255, 0.12);
  --border-glow: rgba(0, 212, 255, 0.35);

  --text-primary: #e8edf5;
  --text-secondary: #8892a4;
  --text-muted: #5b667a;

  --font-sans: "Space Grotesk", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  background: var(--bg-void);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

body {
  background: var(--bg-void);
  color: var(--text-primary);
  font-family: var(--font-sans);
  overflow-x: hidden;
  line-height: 1.55;
  min-height: 100vh;
}

.grid-bg {
  background-image:
    linear-gradient(rgba(0, 212, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 212, 255, 0.03) 1px, transparent 1px);
  background-size: 60px 60px;
}

.scanline {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: linear-gradient(transparent, rgba(0, 212, 255, 0.08), transparent);
  animation: scanline 8s linear infinite;
  pointer-events: none;
  z-index: 90;
}
@keyframes scanline {
  0% { transform: translateY(-100%); }
  100% { transform: translateY(100vh); }
}

.section-label {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent-cyan);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.65rem;
}
.section-label::before {
  content: "";
  display: block;
  width: 1.5rem;
  height: 1px;
  background: var(--accent-cyan);
  opacity: 0.65;
  flex-shrink: 0;
}

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--bg-void); }
::-webkit-scrollbar-thumb { background: rgba(0, 212, 255, 0.3); border-radius: 3px; }

.container {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 0.9rem;
}

@media (min-width: 640px) {
  .container { padding: 0 1.4rem; }
}

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

/* Navbar */
.navbar {
  position: sticky;
  top: 0;
  z-index: 60;
  background: rgba(2, 4, 8, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
}

.navbar-inner {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.55rem;
  padding: 0.5rem 0;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  text-decoration: none;
  color: var(--text-primary);
  min-width: 170px;
  flex: 1 1 175px;
}

.brand-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border-glow);
  background: rgba(0, 212, 255, 0.09);
  color: var(--accent-cyan);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.brand-text-wrap { min-width: 0; overflow: hidden; }
.brand-title {
  font-family: var(--font-mono);
  font-size: 0.84rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.brand-title span { color: var(--accent-cyan); }
.brand-sub {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  color: var(--text-secondary);
  display: none;
}
@media (min-width: 720px) { .brand-sub { display: block; } }

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
  justify-content: flex-end;
  max-width: 100%;
  flex: 0 1 auto;
}

#user-pill {
  max-width: 210px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
@media (min-width: 640px) {
  #user-pill { max-width: none; }
}

.live-pill {
  display: none;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.65rem;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-secondary);
}
@media (min-width: 820px) { .live-pill { display: inline-flex; } }

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-emerald);
  box-shadow: 0 0 8px rgba(0, 255, 136, 0.7);
  flex-shrink: 0;
}
.pulse-dot.amber { background: var(--accent-amber); box-shadow: 0 0 8px rgba(255, 170, 0, 0.7); }

/* Buttons & Inputs */
button, a, input, select, textarea {
  touch-action: manipulation;
  font-family: inherit;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.42rem;
  min-height: 40px;
  padding: 0.48rem 0.9rem;
  border-radius: 9px;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid rgba(0, 212, 255, 0.42);
  background: rgba(0, 212, 255, 0.14);
  color: var(--accent-cyan);
  text-decoration: none;
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.15s ease;
  white-space: nowrap;
}
.btn:hover { background: rgba(0, 212, 255, 0.24); border-color: rgba(0, 212, 255, 0.75); }
.btn:disabled { opacity: 0.55; cursor: wait; }

.btn-emerald {
  border-color: rgba(0, 255, 136, 0.4);
  background: rgba(0, 255, 136, 0.12);
  color: var(--accent-emerald);
}
.btn-emerald:hover { background: rgba(0, 255, 136, 0.22); }

.btn-amber {
  border-color: rgba(255, 170, 0, 0.42);
  background: rgba(255, 170, 0, 0.12);
  color: var(--accent-amber);
}
.btn-amber:hover { background: rgba(255, 170, 0, 0.22); }

.btn-danger {
  border-color: rgba(239, 68, 68, 0.45);
  background: rgba(239, 68, 68, 0.12);
  color: #fca5a5;
}
.btn-danger:hover { background: rgba(239, 68, 68, 0.22); }

.btn-ghost {
  border-color: var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-primary);
}
.btn-ghost:hover { background: var(--bg-elevated); border-color: var(--border-glow); }

.btn-sm { min-height: 34px; padding: 0.32rem 0.68rem; font-size: 0.72rem; }

.input, .select, .textarea {
  width: 100%;
  min-height: 42px;
  padding: 0.6rem 0.78rem;
  border-radius: 9px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-size: 0.88rem;
  outline: none;
  transition: border-color 0.18s ease;
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent-cyan); }
.textarea { min-height: 92px; resize: vertical; line-height: 1.5; }

/* Hero */
.hero {
  padding: 1.4rem 0 1.15rem;
}

.hero-kicker {
  display: inline-flex;
  align-items: center;
  gap: 0.48rem;
  padding: 0.28rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  background: rgba(0, 212, 255, 0.06);
  font-family: var(--font-mono);
  font-size: 0.69rem;
  letter-spacing: 0.08em;
  color: var(--accent-cyan);
  margin-bottom: 0.75rem;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.hero-title {
  font-size: clamp(1.5rem, 4.4vw, 2.55rem);
  font-weight: 700;
  line-height: 1.15;
  margin-bottom: 0.55rem;
}

.gradient-text {
  background: linear-gradient(135deg, #00d4ff 0%, #00ff88 55%, #00d4ff 100%);
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: shimmer 5s linear infinite;
}

@keyframes shimmer { to { background-position: 200% center; } }

.hero-desc {
  color: var(--text-secondary);
  font-size: 0.94rem;
  max-width: 74ch;
  margin-bottom: 1.15rem;
}

/* KPI Strip */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
}
@media (min-width: 768px) {
  .kpi-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.85rem; }
}

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 0.85rem 0.95rem;
  min-width: 0;
}
.kpi-label {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
  margin-bottom: 0.25rem;
}
.kpi-value {
  font-family: var(--font-mono);
  font-size: clamp(1.1rem, 2.6vw, 1.45rem);
  font-weight: 700;
  color: var(--text-primary);
}
.kpi-sub {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
  overflow-wrap: anywhere;
}

/* Tab Bar */
.tabs-wrap {
  position: relative;
  z-index: 40;
  background: rgba(2, 4, 8, 0.92);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
  margin: 0.85rem 0 1.2rem;
}
@media (min-width: 768px) {
  .tabs-wrap { position: sticky; top: 58px; }
}

.tabs-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0.55rem 0;
}

.tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.38rem;
  min-height: 36px;
  padding: 0.38rem 0.72rem;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.16s ease;
}
.tab-btn:hover { color: var(--text-primary); background: var(--bg-surface); }
.tab-btn.active {
  color: var(--accent-cyan);
  background: rgba(0, 212, 255, 0.1);
  border-color: var(--border-glow);
}

/* Panels & Cards */
.panel { display: none; padding-bottom: 2.5rem; }
.panel.active { display: block; }

.layout-split {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  align-items: start;
}
@media (min-width: 920px) {
  .layout-split { grid-template-columns: minmax(0, 1.45fr) minmax(0, 0.85fr); }
}

.grid-cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.9rem;
}
@media (min-width: 680px) {
  .grid-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 1020px) {
  .grid-cards.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 1.05rem;
  min-width: 0;
  overflow-wrap: anywhere;
  transition: border-color 0.2s ease, background 0.2s ease;
}
.card:hover { border-color: rgba(0, 212, 255, 0.28); }

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-bottom: 0.65rem;
}

.card-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.35;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.54rem;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 600;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-secondary);
  max-width: 100%;
}
.badge-cyan { color: var(--accent-cyan); border-color: rgba(0, 212, 255, 0.3); background: rgba(0, 212, 255, 0.08); }
.badge-emerald { color: var(--accent-emerald); border-color: rgba(0, 255, 136, 0.3); background: rgba(0, 255, 136, 0.08); }
.badge-amber { color: var(--accent-amber); border-color: rgba(255, 170, 0, 0.32); background: rgba(255, 170, 0, 0.09); }
.badge-violet { color: var(--accent-violet); border-color: rgba(167, 139, 250, 0.32); background: rgba(167, 139, 250, 0.09); }
.badge-danger { color: #fca5a5; border-color: rgba(239, 68, 68, 0.35); background: rgba(239, 68, 68, 0.1); }

/* Threads & Replies */
.stack { display: flex; flex-direction: column; gap: 0.85rem; }
.row { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; flex-wrap: wrap; }

.thread-body {
  color: #cbd5e1;
  font-size: 0.9rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  margin-bottom: 0.75rem;
}

.replies-list {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  border-left: 2px solid rgba(0, 212, 255, 0.22);
  padding-left: 0.8rem;
  margin: 0.65rem 0;
}

.reply-item {
  background: var(--bg-surface);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 9px;
  padding: 0.65rem 0.78rem;
}

.reply-text {
  color: #cbd5e1;
  font-size: 0.84rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  margin-top: 0.35rem;
}

.subdomain-url {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--accent-cyan);
  text-decoration: none;
  overflow-wrap: anywhere;
}
.subdomain-url:hover { text-decoration: underline; }

.mono-block {
  background: var(--bg-deep);
  border: 1px solid var(--border-subtle);
  border-radius: 9px;
  padding: 0.8rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: #cbd5e1;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 360px;
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 120;
  background: rgba(2, 4, 8, 0.82);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal-backdrop.open { display: flex; }

.modal-box {
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--bg-card);
  border: 1px solid var(--border-glow);
  border-radius: 14px;
  padding: 1.2rem;
}
.modal-box.wide { max-width: 820px; }

.toast {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 150;
  max-width: min(380px, calc(100vw - 2rem));
  padding: 0.75rem 1rem;
  border-radius: 10px;
  border: 1px solid var(--border-glow);
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
  display: none;
}
.toast.show { display: block; }

.hidden { display: none !important; }

.footer {
  border-top: 1px solid var(--border-subtle);
  padding: 1.25rem 0 2rem;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--text-muted);
}
