/* ============================================================
   Central-Intel — Dark theme, brand palette
   Primary Blue #1EA0AF · Action Teal #1ABBA6 · Success Green #108981
   Pipeline Purple #885CF6 · Neutral Gray #485563
   ============================================================ */

:root {
  --bg:           #0d0d0d;
  --surface:      #141414;
  --surface2:     #1c1c1c;
  --border:       #2a2a2a;
  --primary:      #1EA0AF;   /* Primary Blue */
  --primary-dark: #167888;   /* Primary Blue, darkened for hover/dim */
  --teal:         #1ABBA6;   /* Action Teal */
  --purple:       #885CF6;   /* Pipeline Purple */
  --neutral-gray: #485563;   /* Neutral Gray */
  --text:         #e5e7eb;
  --muted:        #6b7280;
  --danger:       #ef4444;
  --success:      #108981;   /* Success Green */
  --radius:       8px;
  --font:         'Inter', system-ui, -apple-system, sans-serif;
}

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

html {
  scroll-behavior: smooth;
  background: var(--bg);  /* dark base — body is transparent so canvas shows through */
}

body {
  background: transparent;
  isolation: isolate;  /* traps canvas z-index:-1 inside body stacking context, below all body content */
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- Layout helpers ---- */
.container { max-width: 1100px; margin: 0 auto; padding: 0 24px; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.gap-sm { gap: 8px; }
.gap-md { gap: 16px; }
.gap-lg { gap: 24px; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: opacity .15s, background .15s;
}
.btn:hover { opacity: .88; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: 6px 14px; font-size: 13px; }

/* ---- Forms ---- */
.form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
label { font-size: 13px; color: var(--muted); font-weight: 500; }
input[type="email"],
input[type="password"],
input[type="text"] {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 10px 14px;
  font-size: 15px;
  width: 100%;
  outline: none;
  transition: border-color .15s;
}
input:focus { border-color: var(--primary); }

.form-error {
  color: var(--danger);
  font-size: 13px;
  min-height: 18px;
}

/* ---- Cards ---- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

/* ---- Badges ---- */
.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.badge-primary { background: rgba(30,160,175,.15); color: var(--primary); }
.badge-teal    { background: rgba(26,187,166,.15);  color: var(--teal); }
.badge-green   { background: rgba(16,137,129,.15);  color: var(--success); }
.badge-purple  { background: rgba(136,92,246,.15);  color: var(--purple); }
.badge-gray    { background: rgba(107,114,128,.15); color: var(--muted); }

/* ==============================================================
   NAV
   ============================================================== */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(13,13,13,.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}
.nav-logo {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.02em;
}
.nav-logo span { color: var(--primary); }
.nav-links {
  display: flex;
  align-items: center;
  gap: 28px;
  list-style: none;
}
.nav-links a { color: var(--muted); font-size: 14px; font-weight: 500; }
.nav-links a:hover { color: var(--text); text-decoration: none; }
.nav-actions { display: flex; align-items: center; gap: 10px; }

/* ==============================================================
   HERO
   ============================================================== */
.hero {
  padding: 100px 0 80px;
  text-align: center;
}
.hero-eyebrow {
  display: inline-block;
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
  letter-spacing: .1em;
  text-transform: uppercase;
  margin-bottom: 20px;
}
.hero h1 {
  font-size: clamp(2.2rem, 5vw, 3.6rem);
  font-weight: 800;
  letter-spacing: -.04em;
  line-height: 1.1;
  margin-bottom: 20px;
}
.hero h1 em { font-style: normal; color: var(--primary); }
.hero-sub {
  font-size: 1.1rem;
  color: var(--muted);
  max-width: 560px;
  margin: 0 auto 36px;
}
.hero-ctas { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; }

/* ==============================================================
   SECTION headings
   ============================================================== */
.section { padding: 72px 0; }
.section-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--primary);
  margin-bottom: 12px;
}
.section-title {
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  font-weight: 700;
  letter-spacing: -.03em;
  margin-bottom: 12px;
}
.section-sub { color: var(--muted); max-width: 540px; margin-bottom: 48px; }

/* ==============================================================
   FEATURES GRID
   ============================================================== */
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
}
.feature-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 24px;
  transition: border-color .2s;
}
.feature-card:hover { border-color: var(--primary-dark); }
.feature-icon { font-size: 26px; margin-bottom: 14px; }
.feature-card h3 { font-size: 16px; font-weight: 700; margin-bottom: 8px; }
.feature-card p { font-size: 14px; color: var(--muted); line-height: 1.6; }

/* ==============================================================
   HOW IT WORKS
   ============================================================== */
.steps { display: flex; flex-direction: column; gap: 24px; max-width: 600px; }
.step { display: flex; gap: 20px; align-items: flex-start; }
.step-num {
  flex-shrink: 0;
  width: 36px; height: 36px;
  border-radius: 50%;
  background: rgba(30,160,175,.15);
  color: var(--primary);
  font-size: 14px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.step-body h4 { font-size: 15px; font-weight: 700; margin-bottom: 4px; }
.step-body p  { font-size: 14px; color: var(--muted); }

/* ==============================================================
   PRICING
   ============================================================== */
.pricing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
}
.pricing-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px 28px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: relative;
}
.pricing-card.featured { border-color: var(--primary); }
.pricing-tag {
  position: absolute;
  top: -12px; left: 50%; transform: translateX(-50%);
  background: var(--primary);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 14px;
  border-radius: 999px;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.pricing-card h3 { font-size: 18px; font-weight: 700; }
.pricing-price { font-size: 2rem; font-weight: 800; letter-spacing: -.04em; }
.pricing-price span { font-size: 14px; font-weight: 400; color: var(--muted); }
.pricing-desc { font-size: 14px; color: var(--muted); }
.pricing-features { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.pricing-features li { font-size: 14px; display: flex; gap: 8px; }
.pricing-features li::before { content: "✓"; color: var(--primary); font-weight: 700; }
.pricing-card .btn { margin-top: auto; }

/* ==============================================================
   ABOUT
   ============================================================== */
.about-inner {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  align-items: center;
}
@media (max-width: 680px) { .about-inner { grid-template-columns: 1fr; } }
.about-text p { color: var(--muted); margin-bottom: 16px; font-size: 15px; }

/* ==============================================================
   FOOTER
   ============================================================== */
.footer {
  border-top: 1px solid var(--border);
  padding: 40px 0;
}
.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}
.footer-links { display: flex; gap: 20px; }
.footer-links a { font-size: 13px; color: var(--muted); }
.footer-links a:hover { color: var(--text); text-decoration: none; }
.footer-copy { font-size: 13px; color: var(--muted); }

/* ==============================================================
   AUTH PAGES (login / signup)
   ============================================================== */
.auth-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px 36px;
  width: 100%;
  max-width: 420px;
}
.auth-logo {
  font-size: 20px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 28px;
  letter-spacing: -.02em;
}
.auth-logo span { color: var(--primary); }
.auth-card h2 { font-size: 20px; font-weight: 700; margin-bottom: 6px; }
.auth-card p.sub { color: var(--muted); font-size: 14px; margin-bottom: 28px; }
.auth-submit { width: 100%; margin-top: 8px; justify-content: center; }
.auth-footer { text-align: center; margin-top: 20px; font-size: 14px; color: var(--muted); }

/* ==============================================================
   DASHBOARD
   ============================================================== */
.dash-nav {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.dash-nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}
.dash-logo { font-size: 16px; font-weight: 700; letter-spacing: -.02em; }
.dash-logo span { color: var(--primary); }
.dash-user { display: flex; align-items: center; gap: 12px; }
.dash-user-email { font-size: 13px; color: var(--muted); }

.dash-main { padding: 40px 0; }
.dash-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
  margin-bottom: 20px;
}

.card-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--muted);
  margin-bottom: 16px;
}

/* API key card */
.key-display {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-family: monospace;
  font-size: 15px;
  margin-bottom: 14px;
}
.key-hint { flex: 1; color: var(--text); }
.key-actions { display: flex; gap: 8px; }

/* Device status */
.device-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.device-id { font-family: monospace; font-size: 14px; }
.online-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 6px var(--success);
  display: inline-block;
  margin-right: 6px;
}
.offline-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--muted);
  display: inline-block;
  margin-right: 6px;
}
.last-seen { font-size: 13px; color: var(--muted); }

/* Quick start */
.quickstart pre {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  font-size: 13px;
  overflow-x: auto;
  white-space: pre;
  color: var(--text);
  margin-bottom: 12px;
}

/* Modal */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.7);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  z-index: 200;
}
.modal-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  max-width: 480px;
  width: 90%;
}
.modal-box h3 { font-size: 18px; font-weight: 700; margin-bottom: 8px; }
.modal-box p.sub { color: var(--muted); font-size: 14px; margin-bottom: 20px; }
.modal-key {
  background: var(--surface2);
  border: 1px solid var(--primary);
  border-radius: var(--radius);
  padding: 12px 16px;
  font-family: monospace;
  font-size: 15px;
  word-break: break-all;
  margin-bottom: 16px;
  color: var(--primary);
}
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }
.hidden { display: none !important; }

/* Spinner */
@keyframes spin { to { transform: rotate(360deg); } }
.spinner {
  width: 18px; height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  display: inline-block;
}

/* Loading state */
.loading-placeholder {
  height: 18px;
  background: var(--surface2);
  border-radius: 4px;
  animation: pulse 1.4s ease infinite;
}
@keyframes pulse { 0%,100%{opacity:.4} 50%{opacity:.8} }

/* ---- Hamburger menu (mobile) ---- */
.nav-hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  flex-direction: column;
  gap: 5px;
}
.nav-hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.2s, opacity 0.2s;
}

/* Responsive nav */
@media (max-width: 600px) {
  .nav-hamburger { display: flex; }

  .nav-links {
    display: none;
    position: fixed;
    top: 61px;
    left: 0;
    right: 0;
    background: rgba(13,13,13,.97);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    padding: 8px 24px;
    gap: 0;
    z-index: 99;
  }
  .nav-inner.nav-open .nav-links { display: flex; }

  .nav-links li {
    border-bottom: 1px solid var(--border);
  }
  .nav-links li:last-child { border-bottom: none; }
  .nav-links a {
    display: block;
    padding: 14px 0;
    font-size: 15px;
  }

  /* Animate hamburger → X */
  .nav-inner.nav-open .nav-hamburger span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
  }
  .nav-inner.nav-open .nav-hamburger span:nth-child(2) {
    opacity: 0;
  }
  .nav-inner.nav-open .nav-hamburger span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
  }

  .auth-card { padding: 28px 20px; }
}

/* ==============================================================
   AUTH PROVIDERS (OAuth buttons, divider)
   ============================================================== */
.auth-providers { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }
.auth-provider-btn { width: 100%; justify-content: center; gap: 10px; }
.btn-google  { border-color: #4285f4; }
.btn-google:hover  { background: rgba(66,133,244,.08); }
.btn-github  { border-color: #6e5494; }
.btn-github:hover  { background: rgba(110,84,148,.08); }
.btn-apple   { border-color: #555; }
.btn-apple:hover   { background: rgba(255,255,255,.05); }
.auth-divider { display:flex; align-items:center; gap:12px; margin:18px 0; color:var(--muted); font-size:13px; }
.auth-divider::before, .auth-divider::after { content:''; flex:1; height:1px; background:var(--border); }

/* ── huske.js — background canvas ── */
#bg-canvas {
  position: fixed; top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: -1; pointer-events: none;
}
/* HuskE canvas is positioned dynamically by huske.js */
#huske-canvas {
  cursor: pointer;
  border-radius: 12px;
  transition: filter .2s;
  flex-shrink: 0;
  display: block;
}
#huske-canvas:hover { filter: brightness(1.2); }
