/* ===========================================================
   Signal — design tokens (Supabase-inspired dark/green system)
   =========================================================== */
:root {
  --bg: #1c1c1c;
  --bg-alt: #131313;
  --bg-raise: #1f1f1f;
  --surface: #242424;
  --surface-hover: #2a2a2a;
  --border: #2e2e2e;
  --border-strong: #3a3a3a;
  --text: #ededed;
  --text-muted: #999999;
  --text-dim: #6b6b6b;
  --accent: #3ecf8e;
  --accent-dim: #2a9d6c;
  --accent-soft: rgba(62, 207, 142, 0.12);
  --danger: #e05252;

  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;

  --container: 1180px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; touch-action: pan-x pan-y; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img, svg { display: block; max-width: 100%; }

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

.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 32px;
}

/* -------------------- Buttons -------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  font-family: var(--font-body);
}

.btn-primary {
  background: var(--accent);
  color: #08150f;
}
.btn-primary:hover { background: #4fe0a0; }

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

.btn-block { width: 100%; }

.btn-sm { padding: 7px 14px; font-size: 12.5px; }

/* -------------------- Navbar -------------------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(28, 28, 28, 0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.brand-mark {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: var(--accent);
  position: relative;
  flex-shrink: 0;
}
.brand-mark::after {
  content: "";
  position: absolute;
  inset: 6px;
  border-radius: 2px;
  background: #0d1a14;
}
.nav-links {
  display: flex;
  gap: 28px;
  font-size: 14px;
  color: var(--text-muted);
}
.nav-links a:hover { color: var(--text); }
.nav-actions { display: flex; align-items: center; gap: 12px; }

/* -------------------- Hero -------------------- */
.hero {
  padding: 96px 0 72px;
  text-align: center;
  border-bottom: 1px solid var(--border);
  background:
    radial-gradient(ellipse 60% 50% at 50% 0%, rgba(62, 207, 142, 0.10), transparent);
}
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid rgba(62, 207, 142, 0.25);
  padding: 5px 12px;
  border-radius: 100px;
  margin-bottom: 28px;
}
.hero h1 {
  font-size: 56px;
  line-height: 1.08;
  letter-spacing: -0.03em;
  font-weight: 600;
  max-width: 780px;
  margin: 0 auto 20px;
}
.hero p.lead {
  font-size: 18px;
  color: var(--text-muted);
  max-width: 560px;
  margin: 0 auto 36px;
}
.hero-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 64px;
}
.hero .btn-primary, .hero .btn-ghost { padding: 12px 22px; font-size: 15px; }

/* -------------------- Product frame (mock dashboard preview) -------------------- */
.frame {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-alt);
  overflow: hidden;
  box-shadow: 0 40px 100px -30px rgba(0, 0, 0, 0.6);
}
.frame-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-raise);
}
.frame-bar span {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--border-strong);
}
.frame-body { padding: 28px; text-align: left; }

.mini-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: 22px;
}
.mini-stat { background: var(--bg-alt); padding: 16px 18px; }
.mini-stat .label { font-size: 12px; color: var(--text-dim); font-family: var(--font-mono); }
.mini-stat .value { font-size: 22px; font-weight: 600; margin-top: 6px; font-family: var(--font-mono); }
.mini-stat .delta { font-size: 12px; color: var(--accent); margin-top: 4px; font-family: var(--font-mono); }

.chart-shell {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px 18px 4px;
  background: var(--bg-alt);
}
.chart-shell .chart-title { font-size: 13px; color: var(--text-muted); margin-bottom: 12px; }

/* -------------------- Section headers -------------------- */
.section { padding: 88px 0; border-bottom: 1px solid var(--border); }
.section-tight { padding: 72px 0; }
.kicker {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--accent);
  margin-bottom: 14px;
}
.section h2 {
  font-size: 34px;
  letter-spacing: -0.02em;
  font-weight: 600;
  max-width: 560px;
  margin: 0 0 14px;
}
.section p.section-lead {
  color: var(--text-muted);
  max-width: 520px;
  font-size: 16px;
  margin: 0 0 48px;
}

/* -------------------- Feature grid -------------------- */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.feature-card {
  background: var(--bg-alt);
  padding: 30px 28px;
}
.feature-icon {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 18px;
}
.feature-icon svg { width: 17px; height: 17px; stroke: var(--accent); }
.feature-card h3 { font-size: 16px; margin: 0 0 8px; font-weight: 600; }
.feature-card p { font-size: 14px; color: var(--text-muted); margin: 0; }

/* -------------------- Pricing -------------------- */
.pricing-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}
.plan {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 26px;
  background: var(--bg-alt);
  display: flex;
  flex-direction: column;
}
.plan.featured {
  border-color: var(--accent);
  background: linear-gradient(180deg, rgba(62, 207, 142, 0.06), transparent 40%), var(--bg-alt);
  position: relative;
}
.plan-tag {
  position: absolute;
  top: -12px;
  left: 26px;
  background: var(--accent);
  color: #08150f;
  font-size: 11.5px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 100px;
}
.plan-name { font-size: 15px; font-weight: 600; margin-bottom: 6px; }
.plan-desc { font-size: 13.5px; color: var(--text-muted); margin-bottom: 22px; min-height: 40px; }
.plan-price {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 4px;
  font-family: var(--font-mono);
}
.plan-price .amount { font-size: 36px; font-weight: 600; letter-spacing: -0.02em; }
.plan-price .cycle { font-size: 13px; color: var(--text-dim); }
.plan-billing { font-size: 12.5px; color: var(--text-dim); margin-bottom: 24px; }
.plan .btn { margin-bottom: 26px; }
.plan-features { list-style: none; margin: 0; padding: 0; font-size: 13.5px; }
.plan-features li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 0;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
}
.plan-features li:first-child { border-top: none; }
.plan-features li svg { width: 14px; height: 14px; stroke: var(--accent); flex-shrink: 0; margin-top: 3px; }

/* -------------------- CTA band -------------------- */
.cta-band {
  padding: 80px 0;
  text-align: center;
}
.cta-band h2 { font-size: 30px; margin-bottom: 14px; }
.cta-band p { color: var(--text-muted); margin-bottom: 30px; }

/* -------------------- Footer -------------------- */
footer {
  padding: 40px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text-dim);
}
footer .brand { font-size: 13px; color: var(--text-muted); }
footer .foot-links { display: flex; gap: 22px; }
footer .foot-links a:hover { color: var(--text); }

/* -------------------- Auth page -------------------- */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse 60% 50% at 50% 0%, rgba(62, 207, 142, 0.10), transparent),
    var(--bg);
  padding: 24px;
}
.auth-card {
  width: 100%;
  max-width: 380px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-alt);
  padding: 32px 30px 28px;
}
.auth-card .brand { justify-content: center; margin-bottom: 26px; }
.auth-card h1 { font-size: 19px; font-weight: 600; text-align: center; margin: 0 0 6px; }
.auth-card p.sub { text-align: center; color: var(--text-muted); font-size: 13.5px; margin: 0 0 26px; }

.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 7px;
}
.field input {
  width: 100%;
  background: var(--bg-raise);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  color: var(--text);
  font-size: 14px;
  font-family: var(--font-body);
  outline: none;
  transition: border-color 0.15s ease;
}
.field input:focus { border-color: var(--accent); }

.auth-error {
  display: none;
  font-size: 13px;
  color: var(--danger);
  background: rgba(224, 82, 82, 0.1);
  border: 1px solid rgba(224, 82, 82, 0.25);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  margin-bottom: 16px;
}
.auth-error.show { display: block; }

.auth-foot {
  text-align: center;
  font-size: 12.5px;
  color: var(--text-dim);
  margin-top: 20px;
}
.auth-foot a { color: var(--accent); }

/* -------------------- Dashboard shell -------------------- */
.dash {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}
.dash-side {
  border-right: 1px solid var(--border);
  background: var(--bg-alt);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
}
.dash-side .brand { padding: 6px 8px 22px; font-size: 14px; }
.dash-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.dash-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  color: var(--text-muted);
}
.dash-nav a svg { width: 15px; height: 15px; stroke: currentColor; }
.dash-nav a:hover { background: var(--surface); color: var(--text); }
.dash-nav a.active { background: var(--accent-soft); color: var(--accent); }
.dash-side-foot {
  border-top: 1px solid var(--border);
  padding-top: 14px;
  margin-top: 10px;
  font-size: 12.5px;
  color: var(--text-dim);
}
.dash-side-foot .who { color: var(--text-muted); font-size: 13px; margin-bottom: 8px; }
.dash-side-foot button {
  background: none;
  border: 1px solid var(--border-strong);
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  font-size: 12.5px;
  cursor: pointer;
  width: 100%;
}
.dash-side-foot button:hover { color: var(--text); border-color: var(--text-dim); }

.dash-main { padding: 28px 36px 60px; }
.dash-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
  gap: 16px;
  flex-wrap: wrap;
}
.dash-top h1 { font-size: 20px; font-weight: 600; margin: 0; }
.date-control {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}
.date-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.date-field label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
}
.date-control input[type="date"] {
  color-scheme: dark;
  background: var(--bg-raise);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 7px 12px;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 13px;
  outline: none;
}
.date-control input[type="date"]:focus { border-color: var(--accent); }
.date-control input[type="date"]::-webkit-calendar-picker-indicator { filter: invert(0.75); cursor: pointer; }

/* -------------------- Live "online now" module -------------------- */
.live-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-alt);
  padding: 14px 20px;
  margin-bottom: 22px;
}
.live-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
  position: relative;
  flex-shrink: 0;
}
.live-dot::after {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 1px solid var(--accent);
  animation: live-pulse 2.2s ease-out infinite;
}
@keyframes live-pulse {
  0% { transform: scale(0.5); opacity: 0.9; }
  100% { transform: scale(2.1); opacity: 0; }
}
.live-label {
  font-size: 13px;
  color: var(--text-muted);
}
.live-value {
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
}
.live-sub {
  font-size: 12px;
  color: var(--text-dim);
  margin-left: auto;
  font-family: var(--font-mono);
}

.stat-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 22px;
}
.stat-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-alt);
  padding: 18px 20px;
}
.stat-card .label { font-size: 12.5px; color: var(--text-dim); font-family: var(--font-mono); }
.stat-card .value { font-size: 26px; font-weight: 600; margin-top: 8px; font-family: var(--font-mono); }
.stat-card .delta { font-size: 12px; margin-top: 6px; font-family: var(--font-mono); }
.delta.up { color: var(--accent); }
.delta.down { color: var(--danger); }

.dash-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}
.panel {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-alt);
  padding: 20px 22px;
}
.panel-title {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 4px;
}
.panel-sub { font-size: 12.5px; color: var(--text-dim); margin-bottom: 18px; }

table.top-pages { width: 100%; border-collapse: collapse; font-size: 13px; }
table.top-pages th {
  text-align: left;
  font-weight: 500;
  color: var(--text-dim);
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
table.top-pages td {
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
}
table.top-pages tr:last-child td { border-bottom: none; }
table.top-pages td.path { color: var(--text); font-family: var(--font-mono); font-size: 12.5px; }
table.top-pages td.num { font-family: var(--font-mono); text-align: right; color: var(--text); }

.source-list { display: flex; flex-direction: column; gap: 14px; }
.source-row { display: flex; align-items: center; justify-content: space-between; font-size: 13px; }
.source-row .bar-bg {
  flex: 1;
  height: 6px;
  background: var(--border);
  border-radius: 4px;
  margin: 0 12px;
  overflow: hidden;
}
.source-row .bar-fill { height: 100%; background: var(--accent); border-radius: 4px; }
.source-row .name { width: 92px; color: var(--text-muted); }
.source-row .pct { width: 36px; text-align: right; font-family: var(--font-mono); color: var(--text); }

.geo-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-bottom: 16px;
}
.geo-list .name { width: 160px; }
.geo-list .num { width: 84px; text-align: right; font-family: var(--font-mono); color: var(--text); font-size: 13px; font-weight: 600; }
.geo-list .flag { margin-right: 6px; }
.geo-list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-dim);
  padding-bottom: 8px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--border);
}
.geo-list-head .gh-name { width: 160px; }
.geo-list-head .gh-mid { flex: 1; text-align: center; }
.geo-list-head .gh-num { width: 84px; text-align: right; }
.geo-list-head .gh-pct { width: 36px; text-align: right; }

/* -------------------- Responsive -------------------- */
@media (max-width: 900px) {
  .feature-grid, .pricing-grid, .geo-grid { grid-template-columns: 1fr; }
  .mini-stats { grid-template-columns: repeat(2, 1fr); }
  .hero h1 { font-size: 38px; }
  .nav-links { display: none; }
  .dash { grid-template-columns: 1fr; }
  .dash-side { display: none; }
  .stat-row { grid-template-columns: repeat(2, 1fr); }
  .dash-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; animation: none !important; }
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* -------------------- Settings modal -------------------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 100;
}
.modal-overlay.open { display: flex; }

.modal-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px 26px 22px;
  box-shadow: 0 40px 100px -30px rgba(0, 0, 0, 0.7);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.modal-title { font-size: 16px; font-weight: 600; }
.modal-close {
  background: none;
  border: 1px solid var(--border-strong);
  color: var(--text-muted);
  width: 26px;
  height: 26px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
}
.modal-close:hover { color: var(--text); border-color: var(--text-dim); }

.modal-role {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-raise);
  padding: 14px 16px;
  margin-bottom: 18px;
}
.role-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid rgba(62, 207, 142, 0.25);
  padding: 3px 10px;
  border-radius: 100px;
  margin-bottom: 8px;
}
.modal-role p { margin: 0; font-size: 13px; color: var(--text-muted); line-height: 1.5; }
.modal-role strong { color: var(--text); font-weight: 600; }

.modal-fields { display: flex; flex-direction: column; }
.modal-field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 0;
  border-top: 1px solid var(--border);
  font-size: 13.5px;
}
.modal-field:first-child { border-top: none; }
.mf-label { color: var(--text-dim); }
.mf-value { color: var(--text); font-weight: 500; }
.mf-value.mono { font-family: var(--font-mono); font-size: 13px; }

.modal-note {
  font-size: 11.5px;
  color: var(--text-dim);
  line-height: 1.5;
  margin: 16px 0 0;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
