/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 10px 18px;
  font-size: var(--text-small);
  font-weight: 600;
  cursor: pointer;
  transition: transform var(--transition), opacity var(--transition), background var(--transition);
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: default; transform: none; }

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { opacity: 0.92; }

.btn-secondary { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.btn-secondary:hover:not(:disabled) { background: var(--surface-3); }

.btn-ghost { background: transparent; color: var(--text-soft); }
.btn-ghost:hover:not(:disabled) { color: var(--text); background: var(--surface-2); }

.btn-danger { background: var(--bad-soft); color: var(--bad); }
.btn-danger:hover:not(:disabled) { background: var(--bad); color: #fff; }

.btn-sm { padding: 6px 12px; font-size: var(--text-label); }
.btn-block { width: 100%; }

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

.card-flat {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-4);
}

.card-title { font-size: var(--text-h2); margin-bottom: var(--space-1); }
.card-sub { color: var(--text-soft); font-size: var(--text-small); }

/* ---- Status ---- */
.dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; display: inline-block; }
.dot.good { background: var(--good); box-shadow: 0 0 0 3px var(--good-soft); }
.dot.warn { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-soft); }
.dot.bad { background: var(--bad); box-shadow: 0 0 0 3px var(--bad-soft); }
.dot.idle { background: var(--text-faint); }

.status-line {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-small);
  font-weight: 600;
}
.status-line.good { color: var(--good); }
.status-line.warn { color: var(--warn); }
.status-line.bad { color: var(--bad); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: var(--text-label);
  font-weight: 600;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.badge.good { background: var(--good-soft); color: var(--good); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.neutral { background: var(--surface-3); color: var(--text-soft); }
.badge.accent { background: var(--accent-soft); color: var(--accent); }

/* ---- Status/stat cards (dashboard) ---- */
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-4) var(--space-5);
}
.stat-card .label { font-family: var(--font-mono); font-size: var(--text-label); text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-faint); }
.stat-card .value { font-size: 1.5rem; font-weight: 700; margin-top: 6px; font-variant-numeric: tabular-nums; }
.stat-card .sub { font-size: var(--text-small); color: var(--text-soft); margin-top: 4px; }

/* ---- Forms ---- */
label { display: block; font-size: var(--text-small); font-weight: 600; margin-bottom: 6px; color: var(--text-soft); }

input[type="text"], input[type="email"], input[type="password"], textarea, select {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: var(--text-body);
  font-family: inherit;
  transition: border-color var(--transition);
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
}
textarea { resize: vertical; min-height: 90px; }

.field { margin-bottom: var(--space-4); }
.checkbox-row { display: flex; align-items: center; gap: var(--space-2); font-size: var(--text-small); color: var(--text); margin-bottom: var(--space-2); }
.checkbox-row input { width: auto; }

/* ---- Table-ish list ---- */
.list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border);
}
.list-row:last-child { border-bottom: none; }

/* ---- Toggle switch (theme/subscription state) ---- */
.switch-group { display: flex; gap: var(--space-1); background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 3px; }
.switch-group button {
  border: none;
  background: transparent;
  color: var(--text-soft);
  font-size: var(--text-label);
  padding: 6px 12px;
  border-radius: 5px;
  cursor: pointer;
  font-family: var(--font-mono);
}
.switch-group button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-card); }

hr.rule { border: none; border-top: 1px solid var(--border); margin: var(--space-5) 0; }

/* Shared "gradient hero card" look — used by dashboard.js's top card as well
   as (with its own landing-page-specific overrides) public/pages/landing.js. */
.landing-hero { background: var(--gradient-hero); }

/* ---- Onboarding ---- */
.onboarding { max-width: 640px; margin: 0 auto; padding: var(--space-7) var(--space-5); }
.onboarding-progress { display: flex; gap: var(--space-2); margin-bottom: var(--space-6); }
.onboarding-progress .seg { flex: 1; height: 4px; border-radius: 2px; background: var(--surface-3); }
.onboarding-progress .seg.done { background: var(--accent); }
.connector-download {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}
.connector-download-title { font-size: 1rem; margin-bottom: 4px; }
.connector-download-help { margin-top: var(--space-2); }
.pairing-code {
  font-family: var(--font-mono);
  font-size: 1.6rem;
  letter-spacing: 0.08em;
  text-align: center;
  padding: var(--space-5);
  background: var(--surface-2);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  margin: var(--space-4) 0;
}

@media (max-width: 620px) {
  .connector-download { align-items: stretch; flex-direction: column; }
  .connector-download .btn { width: 100%; }
}

.disclosure {
  margin: var(--space-3) 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: var(--space-3) var(--space-4);
}
.disclosure summary {
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--text-soft);
  user-select: none;
}
.disclosure[open] summary { margin-bottom: var(--space-2); color: var(--text); }
.disclosure p:last-child { margin-bottom: 0; }

.token-secret {
  padding: var(--space-4);
  border: 1px solid var(--warn);
  border-radius: var(--radius-sm);
  background: var(--warn-soft);
}
.token-secret code {
  display: block;
  margin: var(--space-3) 0;
  padding: var(--space-3);
  overflow-wrap: anywhere;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
  user-select: all;
}

.code-inline,
.code-block {
  display: block;
  overflow-wrap: anywhere;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
  user-select: all;
  font-family: var(--font-mono, monospace);
}
.code-inline {
  padding: var(--space-2) var(--space-3);
  font-size: 0.85rem;
}
.code-block {
  padding: var(--space-3);
  font-size: 0.85rem;
  white-space: pre-wrap;
  max-height: 260px;
  overflow-y: auto;
}

/* ---- Project reindex progress ---- */
.reindex-progress {
  margin-top: var(--space-3);
  padding: var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.reindex-progress-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-2);
  color: var(--text-soft);
  font-size: var(--text-small);
}
.reindex-progress-count { font-family: var(--font-mono); white-space: nowrap; }
.reindex-progress-track {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-3);
}
.reindex-progress-bar {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 220ms ease;
}
.reindex-progress.done .reindex-progress-bar { background: var(--good); }
.reindex-progress.error { border-color: var(--bad); }
.reindex-progress.error .reindex-progress-head { color: var(--bad); }

.reindex-wait-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: var(--space-5);
  background: rgba(7, 10, 16, 0.72);
}
.reindex-wait-dialog {
  width: min(100%, 480px);
  padding: var(--space-5);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-card);
}
.reindex-wait-dialog h2 { margin-bottom: var(--space-2); font-size: var(--text-h2); }
.reindex-wait-dialog p { margin-bottom: var(--space-5); color: var(--text-soft); }
.reindex-wait-dialog .row { justify-content: flex-end; }
