:root {
  --navy: #0f1b2d;
  --navy-soft: #1a2a40;
  --accent: #e8590c;
  --accent-soft: #fff4ed;
  --bg: #eceef2;
  --white: #ffffff;
  --border: #d8dde6;
  --muted: #6b7280;
  --muted-2: #9aa3b2;
  --text: #111827;
  --sidebar-width: 260px;
  --future-bg: #fef3c7;
  --future-text: #92400e;
  --points: #15803d;
  --shadow: 0 1px 2px rgba(15, 27, 45, 0.04);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
}

button,
a {
  font: inherit;
}

body {
  min-height: 100vh;
}

.app {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--white);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 20px 16px 14px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 16px;
}

.brand-mark {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
}

.brand-wordmark {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--navy);
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0 8px 18px;
  color: var(--muted);
  text-decoration: none;
  font-size: 12px;
}

.back-link:hover {
  color: var(--navy);
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.nav-gap {
  height: 14px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 10px;
  border: 0;
  background: transparent;
  border-radius: 8px;
  color: var(--navy-soft);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
}

.nav-item:hover {
  background: #f5f7fa;
}

.nav-item.active {
  font-weight: 700;
  color: var(--navy);
  background: #f3f5f8;
}

.nav-item.active .nav-icon {
  color: var(--accent);
  stroke: var(--accent);
}

.nav-icon {
  width: 18px;
  height: 18px;
  color: var(--muted);
  stroke: currentColor;
  fill: none;
  stroke-width: 1.6;
  flex-shrink: 0;
}

.nav-label {
  flex: 1;
}

.future-pill {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: var(--future-bg);
  color: var(--future-text);
  border-radius: 999px;
  padding: 2px 6px;
  line-height: 1.4;
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.user-chip-wrap {
  position: relative;
}

.user-chip {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--white);
  cursor: pointer;
  text-align: left;
  overflow: hidden;
}

.user-chip:hover {
  background: #f8fafc;
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #9a3412);
  color: white;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

.user-meta {
  min-width: 0;
  flex: 1;
}

.user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--navy);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-email {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chevron {
  width: 14px;
  height: 14px;
  color: var(--muted-2);
  flex-shrink: 0;
}

.user-menu {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% + 8px);
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(15, 27, 45, 0.12);
  padding: 6px;
  display: none;
  z-index: 20;
}

.user-menu.open {
  display: block;
}

.user-menu button {
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  color: var(--navy);
  cursor: pointer;
}

.user-menu button:hover {
  background: #f3f5f8;
}

.user-menu .muted {
  color: var(--muted);
  font-size: 11px;
  padding: 6px 12px 8px;
}

.legal-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin: 14px 8px 8px;
}

.legal-links a {
  color: var(--muted);
  text-decoration: none;
  font-size: 11px;
}

.legal-links a:hover {
  text-decoration: underline;
}

.recaptcha-note {
  margin: 0 8px;
  font-size: 10px;
  line-height: 1.4;
  color: var(--muted-2);
}

.auth-status {
  margin: 10px 8px 0;
  font-size: 10px;
  color: var(--muted);
  line-height: 1.35;
}

.auth-status.ok {
  color: #166534;
}

.auth-status.err {
  color: #b91c1c;
}

/* Main */
.main {
  flex: 1;
  min-width: 0;
  padding: 24px 28px 48px;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 22px;
}

.filter-chip {
  border: 1px solid var(--border);
  background: var(--white);
  color: var(--navy-soft);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}

.filter-chip:hover {
  border-color: #c5ccd8;
}

.filter-chip.active {
  background: var(--navy);
  border-color: var(--navy);
  color: white;
}

.feed {
  width: min(600px, 100%);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.engage-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px 18px 16px;
  box-shadow: var(--shadow);
}

.engage-card[hidden] {
  display: none !important;
}

.card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.type-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--navy);
}

.type-label svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.7;
}

.card-timing {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.card-title {
  margin: 0 0 14px;
  font-size: 18px;
  line-height: 1.3;
  letter-spacing: -0.02em;
  color: var(--navy);
}

.embed-slot {
  width: 100%;
  min-height: 80px;
}

.embed-slot > * {
  max-width: 100%;
}

.points {
  margin-top: 14px;
  font-size: 13px;
  font-weight: 700;
  color: var(--points);
}

.empty-state {
  display: none;
  text-align: center;
  color: var(--muted);
  padding: 40px 16px;
  font-size: 14px;
}

.empty-state.show {
  display: block;
}

.nav-item.nav-locked {
  opacity: 0.55;
}

.nav-item.nav-locked .nav-label::after {
  content: "";
}

.signin-chip {
  width: 100%;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: white;
  font-size: 14px;
  font-weight: 700;
  padding: 12px 14px;
  cursor: pointer;
}

.signin-chip:hover {
  background: #d14e0a;
}

.signin-chip[hidden],
.user-chip-wrap[hidden],
.gate-view[hidden],
.signin-view[hidden],
.engage-view[hidden],
.account-view[hidden] {
  display: none !important;
}

/* Signed-out gate + sign-in */
.gate-view,
.signin-view,
.account-view {
  min-height: calc(100vh - 48px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.gate-card,
.signin-card {
  width: min(440px, 100%);
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px 26px 24px;
  box-shadow: 0 10px 30px rgba(15, 27, 45, 0.06);
}

.gate-brand,
.signin-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.gate-mark {
  width: 48px;
  height: 48px;
}

.gate-kicker {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.gate-title,
.signin-title {
  margin: 2px 0 0;
  font-size: 24px;
  letter-spacing: -0.03em;
  color: var(--navy);
}

.gate-copy,
.signin-copy {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.btn-primary {
  width: 100%;
  border: 0;
  border-radius: 10px;
  background: var(--accent);
  color: white;
  font-size: 15px;
  font-weight: 700;
  padding: 12px 16px;
  cursor: pointer;
}

.btn-primary:hover {
  background: #d14e0a;
}

.btn-primary:disabled {
  opacity: 0.7;
  cursor: wait;
}

.btn-ghost {
  width: 100%;
  margin-top: 8px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  padding: 10px;
  cursor: pointer;
}

.btn-ghost:hover {
  color: var(--navy);
}

.signin-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--navy-soft);
}

.field em {
  font-style: normal;
  font-weight: 500;
  color: var(--muted-2);
}

.field input {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 11px 12px;
  font-size: 14px;
  font-weight: 500;
  color: var(--navy);
  background: #fff;
}

.field input:focus {
  outline: 2px solid rgba(232, 89, 12, 0.25);
  border-color: var(--accent);
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.form-error {
  margin: 0;
  color: #b91c1c;
  font-size: 13px;
  font-weight: 600;
}

@media (max-width: 860px) {
  .app {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .main {
    padding: 18px 16px 40px;
  }

  .field-row {
    grid-template-columns: 1fr;
  }
}
