/* Design tokens ported from Design.md (mobile app design system) */
:root {
  --bg: oklch(0.13 0.005 250);
  --bg-2: oklch(0.16 0.005 250);
  --bg-3: oklch(0.18 0.005 250);
  --bg-4: oklch(0.20 0.005 250);
  --fg: oklch(0.97 0.005 80);
  --fg-2: oklch(0.75 0.01 80);
  --fg-3: oklch(0.45 0.05 250);
  --fg-4: oklch(0.32 0.01 250);
  --accent: oklch(0.78 0.18 55);
  --accent-fg: oklch(0.13 0.005 250);
  --line: oklch(0.20 0.006 250);
  --warn: oklch(0.55 0.14 25);
  --go: oklch(0.78 0.16 145);
  --busy: oklch(0.50 0.15 280);
}

* { box-sizing: border-box; }

body {
  background: var(--bg);
  color: var(--fg);
  font-family: 'Inter', system-ui, sans-serif;
  margin: 0;
}

code, .mono { font-family: 'JetBrains Mono', monospace; }

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

header.top {
  border-bottom: 1px solid var(--line);
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

header.top .word span.crew { color: var(--fg); font-weight: 700; }
header.top .word span.coms { color: var(--accent); font-weight: 700; }

main { max-width: 960px; margin: 0 auto; padding: 24px; }

/* Landing page only (server.js passes wide:true) — everything else (crew/admin
   pages) stays at the narrower default above. */
main.wide { max-width: 1120px; }

nav.site-nav { display: flex; gap: 20px; align-items: center; }
nav.site-nav > a:not(.btn) { color: var(--fg-2); text-decoration: none; font-size: 14px; }
nav.site-nav > a:not(.btn):hover { color: var(--fg); }

@media (max-width: 600px) {
  header.top { padding: 12px 16px; }
  main { padding: 16px; }
  nav.site-nav { gap: 10px; font-size: 14px; }
  .user-name { display: none; }
  .nav-text-link { display: none; }
}

.nav-dropdown summary { list-style: none; }
.nav-dropdown summary::-webkit-details-marker { display: none; }
.nav-dropdown summary::marker { content: ''; }

.dropdown-item {
  display: block;
  padding: 10px 14px;
  color: var(--fg);
  text-decoration: none;
}
.dropdown-item:hover { background: var(--bg-3); }

/* Instant tooltip — no native browser hover delay. Usage: <span class="tooltip" data-tooltip="...">...</span> */
.tooltip { position: relative; }
.tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-4);
  color: var(--fg);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 12px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.05s;
  z-index: 20;
}
.tooltip:hover::after,
.tooltip:focus::after,
.tooltip:focus-within::after { opacity: 1; }

.beta-badge {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--accent);
  background: color-mix(in oklch, var(--accent) 20%, var(--bg-2));
  border: 1px solid var(--accent);
  border-radius: 999px;
  padding: 2px 8px;
  cursor: help;
  font-family: inherit;
}

.card {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
  overflow-x: auto;
}

table { width: 100%; min-width: max-content; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--line); }
th { color: var(--fg-3); font-weight: 500; }

.btn {
  display: inline-block;
  background: var(--accent);
  color: var(--accent-fg);
  border: none;
  border-radius: 8px;
  padding: 10px 18px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}

.btn.secondary {
  background: var(--bg-3);
  color: var(--fg);
  border: 1px solid var(--line);
}

.btn.danger { background: var(--warn); color: var(--fg); }

input, select, textarea {
  background: var(--bg-4);
  border: 1px solid var(--line);
  color: var(--fg);
  border-radius: 6px;
  padding: 8px 10px;
  font: inherit;
}

textarea { resize: vertical; }

.badge {
  font-size: 12px;
  font-family: 'JetBrains Mono', monospace;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--bg-3);
  color: var(--fg-2);
}

.badge.premium { background: color-mix(in oklch, var(--accent) 25%, var(--bg-2)); color: var(--accent); }

.pricing-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

@media (max-width: 900px) {
  .pricing-grid { grid-template-columns: repeat(2, 1fr); }
}

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

.tier-card {
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
}

.tier-card:hover { background: var(--bg-3); }

.tier-card.current { outline: 2px solid var(--fg-3); outline-offset: -1px; }

.pill-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  font: inherit;
  color: var(--fg);
  background: var(--bg-3);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 16px 6px 6px;
  cursor: pointer;
}
.pill-btn:hover { background: var(--bg-4); }
.pill-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.pill-plus {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-fg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

/* Feedback tab — fixed to the left edge on every page. Starts fully visible
   (readable) so first-time visitors know what it is, then retracts to a
   small peeking edge after a delay (see partials/feedback-tab.ejs). Fully
   opens a slide-in panel on click regardless of which state it's in. */
.feedback-tab {
  position: fixed;
  top: 50%;
  left: 0;
  transform: translate(0, -50%);
  transition: transform 0.3s ease;
  z-index: 999;
}
.feedback-tab.peek { transform: translate(-65%, -50%); }

.feedback-tab-btn {
  writing-mode: vertical-rl;
  background: var(--accent);
  color: var(--accent-fg);
  border: none;
  border-radius: 0 8px 8px 0;
  padding: 14px 8px;
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.5px;
  cursor: pointer;
}

.feedback-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 998;
}
.feedback-backdrop.open { opacity: 1; pointer-events: auto; }

.feedback-panel {
  position: fixed;
  top: 0;
  left: 0;
  height: 100%;
  width: min(320px, 100vw);
  background: var(--bg-2);
  border-right: 1px solid var(--line);
  padding: 20px;
  overflow-y: auto;
  transform: translateX(-100%);
  transition: transform 0.3s ease;
  z-index: 1000;
}
.feedback-panel.open { transform: translateX(0); }

.feedback-close {
  background: none;
  border: none;
  color: var(--fg-2);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  padding: 4px;
}

/* Landing page (views/marketing/home.ejs) */

.eyebrow {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--accent);
  text-transform: uppercase;
  margin: 0 0 8px;
}

.pill-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  color: var(--fg-2);
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 14px;
}
.pill-badge .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--go); flex-shrink: 0; }

.checklist {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  justify-content: center;
  color: var(--fg-3);
  font-size: 13px;
  margin-top: 20px;
}
.checklist span { color: var(--go); }

.hero-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 40px;
  text-align: left;
}
.hero-grid > * { min-width: 0; }
.hero-grid .checklist { justify-content: flex-start; }
@media (max-width: 800px) {
  .hero-grid { grid-template-columns: 1fr; text-align: center; }
  .hero-grid .checklist { justify-content: center; }
  .hero-phone { justify-self: center; }
}

.hero-phone { justify-self: end; }

/* Device frame around a raw screenshot — bezel + notch, no design asset needed. */
.phone-frame {
  width: 100%;
  max-width: 260px;
  margin: 0 auto;
  background: var(--bg-4);
  border: 1px solid var(--line);
  border-radius: 36px;
  padding: 10px;
  box-shadow: 0 20px 60px -20px rgba(0, 0, 0, 0.6);
  position: relative;
}
.phone-frame::before {
  content: '';
  position: absolute;
  top: 22px;
  left: 50%;
  transform: translateX(-50%);
  width: 56px;
  height: 6px;
  border-radius: 999px;
  background: var(--bg-3);
  z-index: 1;
}
.phone-frame img {
  display: block;
  width: 100%;
  border-radius: 26px;
  border: 1px solid var(--line);
}

.feature-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
@media (max-width: 640px) { .feature-grid { grid-template-columns: 1fr; } }

.feature-icon {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: color-mix(in oklch, var(--accent) 16%, var(--bg-2));
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  margin-bottom: 12px;
}

.steps-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
@media (max-width: 700px) { .steps-grid { grid-template-columns: 1fr; } }

.step { border-top: 2px solid var(--line); padding-top: 14px; }
.step .step-no { font-family: 'JetBrains Mono', monospace; font-size: 12px; font-weight: 700; color: var(--accent); }

.pricing-grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
@media (max-width: 900px) { .pricing-grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 500px) { .pricing-grid-4 { grid-template-columns: 1fr; } }

.tier-popular {
  position: absolute;
  top: -11px;
  left: 16px;
  background: var(--accent);
  color: var(--accent-fg);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 999px;
}

.cta-banner {
  text-align: center;
  padding: 48px 24px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: linear-gradient(135deg, color-mix(in oklch, var(--accent) 18%, var(--bg-2)), var(--bg-2));
}

.footer-grid { display: grid; grid-template-columns: 1.4fr repeat(3, 1fr); gap: 24px; }
@media (max-width: 700px) { .footer-grid { grid-template-columns: repeat(2, 1fr); } }
.footer-grid h4 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--fg-3); margin: 0 0 10px; }
.footer-grid a { display: block; color: var(--fg-2); text-decoration: none; font-size: 14px; margin-bottom: 8px; }
.footer-grid a:hover { color: var(--fg); }

/* Full-page loading overlay — blocks clicks on everything behind it and shows
   a spinner + status text. Usage: a hidden <div class="loading-overlay" id="...">
   with a <p class="loading-overlay-text">, toggled via a "visible" class. */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(13, 14, 18, 0.65); /* --bg at ~65% alpha, works over any page content */
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 14px;
  z-index: 2000;
}
.loading-overlay.visible { display: flex; }

.loading-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: loading-spin 0.7s linear infinite;
}
@keyframes loading-spin { to { transform: rotate(360deg); } }

.loading-overlay-text { color: var(--fg); font-size: 14px; font-weight: 500; }
