:root {
  --bg: #0f1115;
  --panel: #171a21;
  --border: #2a2e38;
  --text: #e6e8eb;
  --muted: #9aa1ad;
  --accent: #4f8cff;
  --call: #1f9d55;
  --put: #d64545;
  --neutral: #8a8f99;
  --warn-bg: #2a2410;
  --warn-border: #6b5a1a;
}

* { box-sizing: border-box; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  margin: 0;
  padding: 2rem 1rem;
}

.page {
  max-width: 640px;
  margin: 0 auto;
}

.page-narrow {
  max-width: 380px;
}

h1 {
  font-size: 1.5rem;
  margin-bottom: 0.25rem;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.logout-form {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0;
}

.account-email {
  color: var(--muted);
  font-size: 0.8rem;
}

.change-password-link {
  display: inline-block;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.8rem;
  text-decoration: none;
  padding: 0.35rem 0.75rem;
  border-radius: 8px;
}

.change-password-link:hover {
  border-color: var(--accent);
  color: var(--text);
}

.btn-link {
  display: inline-block;
  background: var(--accent);
  color: white;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.5rem 1rem;
  border-radius: 8px;
}

.btn-link:hover {
  opacity: 0.9;
}

.logout-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
}

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

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

.auth-switch a {
  color: var(--accent);
}

.billing-back {
  text-align: center;
  margin-top: 1rem;
}

.subtitle {
  color: var(--muted);
  margin-top: 0;
  margin-bottom: 1.25rem;
}

.disclaimer {
  background: var(--warn-bg);
  border: 1px solid var(--warn-border);
  color: #e8dca0;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}

.disclaimer.small {
  font-size: 0.8rem;
  margin-top: 1rem;
  margin-bottom: 0;
}

.analyzing-indicator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.75rem;
  color: var(--muted);
  font-size: 0.85rem;
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.error {
  background: #3a1a1a;
  border: 1px solid #7a3a3a;
  color: #ffb3b3;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  margin-bottom: 1.25rem;
}

.success {
  background: #16301f;
  border: 1px solid #2a6b3f;
  color: #a6e8bd;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  margin-bottom: 1.25rem;
}

.form {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.85rem;
  color: var(--muted);
  flex: 1;
}

.field input, .field select {
  background: #11131a;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.5rem;
  border-radius: 6px;
  font-size: 0.9rem;
}

.password-wrap {
  position: relative;
}

.password-wrap input {
  width: 100%;
  padding-right: 2.25rem;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 0.5rem;
  transform: translateY(-50%);
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.password-toggle svg {
  width: 18px;
  height: 18px;
}

.password-toggle .icon-eye-off {
  display: none;
}

.password-toggle.is-showing .icon-eye {
  display: none;
}

.password-toggle.is-showing .icon-eye-off {
  display: block;
}

.row {
  display: flex;
  gap: 1rem;
}

.filter-row {
  flex-wrap: wrap;
  align-items: flex-end;
}

.filter-row .field {
  min-width: 160px;
}

.filter-actions {
  align-items: center;
  flex-wrap: wrap;
}

.paste-zone {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  min-height: 140px;
  border: 2px dashed var(--border);
  border-radius: 8px;
  padding: 1rem;
  cursor: pointer;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
  transition: border-color 0.15s;
}

.paste-zone:focus,
.paste-zone:hover {
  border-color: var(--accent);
  outline: none;
}

.fallback-link {
  color: var(--accent);
  font-size: 0.8rem;
  cursor: pointer;
  text-decoration: underline;
  align-self: flex-start;
}

#preview {
  max-width: 100%;
  max-height: 240px;
  border-radius: 8px;
  border: 1px solid var(--border);
  object-fit: contain;
}

button {
  background: var(--accent);
  color: white;
  border: none;
  padding: 0.65rem 1rem;
  border-radius: 8px;
  font-size: 0.95rem;
  cursor: pointer;
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.result {
  margin-top: 1.5rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem;
}

.condition-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.condition-badge {
  font-weight: 700;
  font-size: 0.95rem;
  padding: 0.2rem 0.65rem;
  border-radius: 6px;
  color: white;
  letter-spacing: 0.02em;
}

.condition-choppy .condition-badge { background: var(--neutral); }
.condition-tradeable .condition-badge { background: var(--accent); }

.condition-reasoning {
  margin: 0 0 1rem 0;
  padding-left: 1.2rem;
  color: var(--muted);
  font-size: 0.85rem;
}

.condition-reasoning li {
  margin-bottom: 0.25rem;
}

.trigger-box {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  background: #11131a;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
}

.trigger-text {
  font-size: 0.9rem;
  line-height: 1.4;
}

.signal-badge {
  font-weight: 700;
  font-size: 1.1rem;
  padding: 0.25rem 0.75rem;
  border-radius: 6px;
  color: white;
  white-space: nowrap;
}

.signal-call .signal-badge { background: var(--call); }
.signal-put .signal-badge { background: var(--put); }
.signal-no_signal .signal-badge { background: var(--neutral); }

.confidence {
  color: var(--muted);
  font-size: 0.85rem;
}

.result h3 {
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 0.4rem;
}

.result ul {
  margin: 0 0 1rem 0;
  padding-left: 1.2rem;
}

.result li {
  margin-bottom: 0.25rem;
}

.notice {
  background: #16233a;
  border: 1px solid #2e4a74;
  color: #bcd4f5;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  margin-bottom: 1.25rem;
  font-size: 0.85rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

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

.notice a.btn-link {
  color: white;
}

.inline-form {
  margin: 0;
  display: inline;
}

.plan-card {
  background: #16233a;
  border: 1px solid #2e4a74;
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
}

.plan-card p {
  margin: 0 0 0.75rem 0;
}

.plan-card .form {
  margin: 0;
}

.plan-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.plan-grid .plan-card {
  margin-bottom: 0;
  text-align: center;
}

.plan-price {
  color: var(--neutral, #8a8f99);
  font-size: 0.95rem;
}

.plan-cap {
  color: var(--muted);
  font-size: 0.8rem;
}

.plan-usage {
  color: var(--muted);
  font-size: 0.8rem;
}

.plan-card-active {
  border-color: var(--call);
}

.plan-badge {
  display: inline-block;
  background: #16301f;
  color: #a6e8bd;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
}

.link-btn {
  background: none;
  border: none;
  color: var(--accent);
  text-decoration: underline;
  padding: 0;
  font-size: 0.85rem;
  cursor: pointer;
}

.checkbox-field {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.checkbox-field input {
  margin-top: 0.2rem;
}

.checkbox-field a {
  color: var(--accent);
}

.site-footer {
  margin-top: 1.5rem;
  text-align: center;
  font-size: 0.8rem;
  color: var(--muted);
  display: flex;
  justify-content: center;
  gap: 0.5rem;
}

.site-footer a {
  color: var(--muted);
  text-decoration: underline;
}

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

.legal-content {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.5rem;
  font-size: 0.9rem;
  line-height: 1.6;
}

.legal-content h2 {
  font-size: 1.05rem;
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
}

.legal-content h2:first-child {
  margin-top: 0;
}

.legal-content p {
  color: var(--muted);
  margin: 0 0 0.75rem 0;
}

.legal-content ul {
  color: var(--muted);
  padding-left: 1.2rem;
}

.page-wide {
  max-width: 820px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 9px;
  flex-shrink: 0;
}

.brand h1 {
  margin: 0;
}

.brand-centered {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.4rem;
  margin-bottom: 1.25rem;
}

.brand-centered .brand-mark {
  width: 44px;
  height: 44px;
}

.brand-centered h1 {
  margin: 0;
}

.tagline {
  color: var(--muted);
  font-size: 0.8rem;
  margin: 0.1rem 0 0;
}

.how-it-works {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin: 1.75rem 0 2rem;
}

.step {
  position: relative;
  flex: 1 1 180px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.1rem 1.1rem 1rem;
}

.step-num {
  position: absolute;
  top: 0.9rem;
  right: 1rem;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--border);
}

.step-icon {
  width: 30px;
  height: 30px;
  color: var(--accent);
  margin-bottom: 0.6rem;
}

.step-icon svg {
  width: 100%;
  height: 100%;
}

.step h3 {
  font-size: 0.95rem;
  margin: 0 0 0.35rem;
}

.step p {
  font-size: 0.8rem;
  color: var(--muted);
  margin: 0;
  line-height: 1.45;
}

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

.feature-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.1rem 1.1rem 1rem;
}

.feature-card h3 {
  font-size: 0.95rem;
  margin: 0 0 0.35rem;
}

.feature-card p {
  font-size: 0.8rem;
  color: var(--muted);
  margin: 0;
  line-height: 1.45;
}

.step-arrow {
  display: flex;
  align-items: center;
  color: var(--border);
  padding: 0 0.1rem;
}

.step-arrow svg {
  width: 18px;
  height: 18px;
}

.section-heading {
  font-size: 1.05rem;
  margin: 0 0 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.section-heading .step-num-badge {
  background: var(--accent);
  color: white;
  font-size: 0.7rem;
  font-weight: 700;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.result-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 0 0 0.5rem;
}

.condition-badge {
  font-size: 1.05rem;
  padding: 0.3rem 0.85rem;
}

.signal-badge {
  font-size: 1.3rem;
  padding: 0.35rem 0.9rem;
}

.trigger-box {
  flex-direction: column;
  gap: 0.5rem;
}

@media (max-width: 640px) {
  .how-it-works {
    flex-direction: column;
  }

  .step-arrow {
    display: none;
  }
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.9rem 1rem;
}

.stat-value {
  font-size: 1.6rem;
  font-weight: 700;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 0.15rem;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  font-size: 0.85rem;
}

.admin-table th,
.admin-table td {
  text-align: left;
  padding: 0.6rem 0.8rem;
  border-bottom: 1px solid var(--border);
}

.admin-table th {
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.admin-table tr:last-child td {
  border-bottom: none;
}

.status-pill {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  margin-left: 0.4rem;
}

.status-active { background: #16301f; color: #a6e8bd; }
.status-past_due, .status-unpaid { background: var(--warn-bg); color: #e8dca0; }
.status-canceled { background: #3a1a1a; color: #ffb3b3; }
.status-trialing { background: #16233a; color: #bcd4f5; }

