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

/* AnyPager palette — background from the docs site (VitePress dark),
   yellow accent shared with docs (--vp-c-brand-1). The red app icon
   stays the logo mark. */
:root {
  /* Dark is the default; the light override lives at the end of this file.
     color-scheme also themes native controls, scrollbars and form widgets. */
  color-scheme: dark;
  --bg: #1b1b1f;
  --surface: #22222a;
  --card: #28282f;
  --border: rgba(255, 255, 255, 0.1);
  --text: #ffffff;
  --text-muted: #a0a0b0;
  --accent: #ffd800;
  --accent-hover: #e8c500;
  --accent-text: #0a0a0f;
  --green: #00c853;
  --red: #ef4444;
  --yellow: #ffd800;
  --radius: 8px;
}

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
}

::selection {
  background: var(--accent);
  color: var(--accent-text);
}

/* Nav */
nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
  max-width: 800px;
  margin: 0 auto;
}

.logo {
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--text);
  text-decoration: none;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.nav-links > a:not(.btn) {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
}

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

/* Buttons */
.btn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  transition: background 0.2s, border-color 0.2s;
  cursor: pointer;
  /* Visible edge: the surface fill is nearly identical to the card
     background, so borderless buttons read as plain text. */
  border: 1px solid var(--border);
  color: var(--text);
  background: var(--surface);
}

.btn:hover {
  border-color: var(--text-muted);
}

.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
}

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

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

.btn-danger {
  background: var(--red);
  color: #fff;
}

/* Hero */
.hero {
  text-align: center;
  padding: 6rem 2rem 4rem;
  max-width: 800px;
  margin: 0 auto;
}

.hero h1 {
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 0.5rem;
}

.subtitle {
  color: var(--text-muted);
  font-size: 1.1rem;
  margin-bottom: 2rem;
}

.hint {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 0.75rem;
}

/* Terminal */
.terminal {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  margin: 2rem auto;
  max-width: 520px;
  overflow: hidden;
  text-align: left;
}

.terminal-bar {
  display: flex;
  gap: 6px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.dot.red { background: var(--red); }
.dot.yellow { background: var(--yellow); }
.dot.green { background: var(--green); }

.terminal pre {
  padding: 1rem 1.25rem;
  font-family: "SF Mono", "Fira Code", "Consolas", monospace;
  font-size: 0.9rem;
  line-height: 1.8;
  /* Long commands wrap instead of hiding behind a horizontal scroll. */
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.prompt { color: var(--green); }
.output { color: var(--text-muted); }

/* How it works */
.how-it-works {
  padding: 4rem 2rem;
  max-width: 800px;
  margin: 0 auto;
  text-align: center;
}

.how-it-works h2 {
  font-size: 1.5rem;
  margin-bottom: 2rem;
}

.steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 2rem;
}

.step {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.5rem;
  text-align: center;
}

.step-number {
  width: 32px;
  height: 32px;
  background: var(--accent);
  color: var(--accent-text);
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  margin-bottom: 0.75rem;
}

.step h3 {
  font-size: 1rem;
  margin-bottom: 0.5rem;
}

.step code {
  font-family: "SF Mono", "Fira Code", monospace;
  font-size: 0.8rem;
  color: var(--text-muted);
  background: var(--bg);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  /* Wrap inside the chip instead of overflowing the card. */
  display: inline-block;
  max-width: 100%;
  overflow-wrap: anywhere;
}

/* Pricing */
.pricing {
  padding: 4rem 2rem;
  max-width: 800px;
  margin: 0 auto;
  text-align: center;
}

.pricing h2 {
  font-size: 1.5rem;
  margin-bottom: 2rem;
}

.price-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2rem;
  max-width: 440px;
  margin: 0 auto;
}

.price {
  font-size: 3rem;
  font-weight: 800;
}

.price span {
  display: block;
  font-size: 1rem;
  font-weight: 400;
  color: var(--text-muted);
}

.price-card ul {
  list-style: none;
  margin: 1.5rem 0;
  text-align: left;
}

.price-card li {
  padding: 0.4rem 0;
  color: var(--text-muted);
}

.price-card li::before {
  content: "\2713 ";
  color: var(--green);
  margin-right: 0.5rem;
}

/* Footer */
footer {
  padding: 2rem;
  border-top: 1px solid var(--border);
  margin-top: 4rem;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 2rem;
}

.footer-links a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.85rem;
}

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

.footer-copyright {
  margin-top: 1rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* Login page */
.auth-container {
  max-width: 400px;
  margin: 8rem auto;
  padding: 2rem;
  text-align: center;
}

.auth-container h1 {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

.auth-container p {
  color: var(--text-muted);
  margin-bottom: 2rem;
}

.form-group {
  margin-bottom: 1rem;
}

.form-group input {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 1rem;
  outline: none;
}

.form-group input:focus {
  border-color: var(--accent);
}

.form-group .btn {
  width: 100%;
}

/* "or" rule between the magic-link form and the social buttons. */
.auth-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1.5rem 0 1rem;
  color: var(--text-muted);
  font-size: 0.85rem;
}

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

.oauth-buttons {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.btn-oauth {
  width: 100%;
  text-align: center;
}

.workspace-select {
  min-width: 11rem;
  max-width: 15rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  padding: 0.48rem 0.65rem;
  font: inherit;
}

.member-role,
.alert-status {
  display: inline-block;
  margin-left: 0.45rem;
  padding: 0.12rem 0.4rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-muted);
  font-size: 0.72rem;
  text-transform: uppercase;
}

.alert-status.acknowledged { color: #eab308; }
.alert-status.resolved { color: #22c55e; }
.alert-status.info { color: #3b82f6; }

.message {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.message.success {
  background: rgba(34, 197, 94, 0.1);
  color: var(--green);
  border: 1px solid rgba(34, 197, 94, 0.2);
}

.message.error {
  background: rgba(239, 68, 68, 0.1);
  color: var(--red);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

/* Dashboard */
.dashboard {
  max-width: 800px;
  margin: 2rem auto;
  padding: 0 2rem;
}

.dashboard h1 {
  font-size: 1.5rem;
  margin-bottom: 2rem;
}

/* Dashboard tabs */
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.5rem;
}

.tab {
  /* Sits on the tablist's bottom border so the active underline replaces it. */
  margin-bottom: -1px;
  padding: 0.6rem 1rem;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font: inherit;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}

.tab:hover {
  color: var(--text);
}

.tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.section h2 {
  font-size: 1.1rem;
  margin-bottom: 1rem;
}

.device-list {
  list-style: none;
}

.device-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
}

.device-list li:last-child {
  border-bottom: none;
}

.device-name {
  font-weight: 600;
}

.device-type {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-left: 0.5rem;
}

/* Inline list actions: bordered chips so they read as buttons. */
.device-rename,
.device-remove,
.member-remove,
.member-role-btn,
.token-remove,
.invite-revoke,
.group-members,
.group-remove {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.3rem 0.7rem;
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--text-muted);
  transition: border-color 0.2s, color 0.2s;
}

.device-rename:hover,
.member-role-btn:hover,
.group-members:hover {
  color: var(--text);
  border-color: var(--text-muted);
}

.device-remove,
.member-remove,
.token-remove,
.invite-revoke,
.group-remove {
  color: var(--red);
}

.device-remove:hover,
.member-remove:hover,
.token-remove:hover,
.invite-revoke:hover,
.group-remove:hover {
  border-color: var(--red);
}

.pairing-code {
  font-family: "SF Mono", "Fira Code", monospace;
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-align: center;
  padding: 1rem;
  background: var(--bg);
  border-radius: var(--radius);
  margin: 1rem 0;
}

.countdown {
  color: var(--text-muted);
  font-size: 0.85rem;
  text-align: center;
}

.message-list {
  list-style: none;
}

.message-list li {
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
}

.message-list li:last-child {
  border-bottom: none;
}

.message-body {
  margin-bottom: 0.25rem;
}

.message-time {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.status-badge {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 600;
}

.status-badge.active {
  background: rgba(34, 197, 94, 0.1);
  color: var(--green);
}

.status-badge.trialing {
  background: rgba(255, 216, 0, 0.1);
  color: var(--yellow);
}

.status-badge.canceled,
.status-badge.past_due {
  background: rgba(239, 68, 68, 0.1);
  color: var(--red);
}

.empty {
  color: var(--text-muted);
  text-align: center;
  padding: 2rem 0;
}

.flex-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.gap-sm {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.qr-code {
  display: flex;
  justify-content: center;
  margin: 1rem 0 0.5rem;
}

.qr-code img {
  width: 180px;
  height: 180px;
  border-radius: var(--radius);
  background: #fff;
  padding: 8px;
}

.qr-hint {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-bottom: 0.5rem;
}

/* One-time reveal of a freshly generated integration token. */
.token-block {
  font-family: "SF Mono", "Fira Code", monospace;
  font-size: 0.95rem;
  font-weight: 600;
  text-align: center;
  padding: 0.85rem 1rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin: 1rem 0 0.5rem;
  overflow-wrap: anywhere;
}

/* Copy-paste terminal examples. */
.curl-block {
  font-family: "SF Mono", "Fira Code", monospace;
  font-size: 0.8rem;
  line-height: 1.55;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  margin: 0.5rem 0 1rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* Inline forms replacing prompt() dialogs. */
.inline-form {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  margin: 0.75rem 0;
}

.inline-form input[type="text"],
.inline-form input[type="number"],
.inline-form select {
  width: 100%;
  padding: 0.55rem 0.8rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font: inherit;
  outline: none;
}

.inline-form input:focus,
.inline-form select:focus {
  border-color: var(--accent);
}

.inline-form-label {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.checkbox-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.1rem;
}

.checkbox-row label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* ---- Landing redesign (BeeCrow design system) ---- */

.logo {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
}

/* The nav mark is the real app icon (apple-touch-icon.png). */
.logo-mark {
  width: 20px;
  height: 20px;
  border-radius: 5px;
  display: block;
}

.btn-lg {
  padding: 0.9rem 1.75rem;
  font-size: 1rem;
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  border-color: var(--text-muted);
}

.hero {
  position: relative;
  overflow: hidden;
}

.hero-glow {
  position: absolute;
  top: -120px;
  left: 50%;
  transform: translateX(-50%);
  width: 640px;
  height: 420px;
  background: radial-gradient(ellipse at center, rgba(255, 216, 0, 0.14), transparent 70%);
  pointer-events: none;
  z-index: 0;
}

.hero > :not(.hero-glow) {
  position: relative;
  z-index: 1;
}

.eyebrow {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
  background: rgba(255, 216, 0, 0.1);
  border: 1px solid rgba(255, 216, 0, 0.2);
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  margin-bottom: 1.5rem;
}

.hero h1 {
  font-size: 3rem;
  line-height: 1.05;
}

.subtitle {
  max-width: 560px;
  margin-left: auto;
  margin-right: auto;
}

.cta-row {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
}

.terminal-title {
  margin-left: auto;
  color: var(--text-muted);
  font-family: "Fira Code", "SF Mono", monospace;
  font-size: 0.75rem;
}

.terminal pre {
  font-family: "Fira Code", "SF Mono", "Consolas", monospace;
}

.str { color: var(--text); }
.flag { color: var(--accent); font-weight: 600; }

.features {
  max-width: 800px;
  margin: 0 auto;
  padding: 2rem;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
}

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

.feature {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.5rem;
  transition: transform 0.2s, box-shadow 0.2s;
}

.feature:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
}

.feature-icon {
  font-size: 1.5rem;
  margin-bottom: 0.75rem;
}

.feature h3 {
  font-size: 1.05rem;
  margin-bottom: 0.4rem;
}

.feature p {
  color: var(--text-muted);
  font-size: 0.92rem;
}

.feature code,
.how-it-works code,
.subtitle code {
  font-family: "Fira Code", "SF Mono", monospace;
  font-size: 0.85em;
  background: var(--bg);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  color: var(--accent);
}

@media (max-width: 600px) {
  .hero h1 { font-size: 2.2rem; }
  .hero { padding-top: 3.5rem; }
  nav { padding: 1rem 1.25rem; }
  .dashboard { padding: 0 1.25rem; }
}

/* ---- Admin metrics ---- */

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0.75rem;
  margin: 1rem 0;
}

.kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  text-align: center;
}

.kpi-value {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.kpi-label {
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-top: 0.25rem;
}

/* ---- Light theme ----
   Follows the OS via prefers-color-scheme; there is no toggle. Surfaces and
   ink are the BeeCrow design system's light stack. The bee yellow sits at
   ~1.3:1 on a warm off-white, so light mode accents with the brand blue
   (#0057b7, 6.9:1 on white) instead. */
@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;

    --bg: #faf7f2;
    --surface: #ffffff;
    --card: #ffffff;
    --border: rgba(0, 0, 0, 0.08);
    --text: #1a1714;
    --text-muted: #6b6358;

    --accent: #0057b7;
    --accent-hover: #004692;
    --accent-text: #ffffff;

    /* These are text colours (status badges, terminal prompt, messages), so
       they clear 4.5:1 on white — 5.0, 4.8 and 4.9. BeeCrow's own status
       green and --accent-deep sit at 3.3:1 and 2.3:1, which works behind its
       tinted pills but not as body text. */
    --green: #15803d;
    --red: #dc2626;
    --yellow: #a16207;
  }

  /* Chrome that hard-codes the yellow accent and would otherwise clash. */
  .eyebrow {
    background: rgba(0, 87, 183, 0.08);
    border-color: rgba(0, 87, 183, 0.2);
  }

  .hero-glow {
    background: radial-gradient(
      ellipse at center,
      rgba(0, 87, 183, 0.1),
      transparent 70%
    );
  }

  /* The dark theme's drop shadow reads as dirt on a light surface. */
  .feature:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
  }

  /* Hard-coded pill hues; all three drop under 2.5:1 on white. */
  .alert-status.acknowledged { color: #a16207; }
  .alert-status.resolved { color: #15803d; }
  .alert-status.info { color: #0057b7; }
}
