/* =========================================================
   Auth pages (login / change password)
   ========================================================= */

.auth-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}

.auth-card {
  width: 100%;
  max-width: 360px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 0 32px var(--panel-glow);
}

.auth-title {
  font-size: 1.4rem;
  color: var(--text);
  margin-bottom: 4px;
}

.auth-subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 24px;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.auth-label {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 12px;
}

.auth-input {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  font-size: 0.95rem;
  font-family: inherit;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.auth-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.auth-submit {
  margin-top: 20px;
  padding: 10px;
  font-size: 0.95rem;
  cursor: pointer;
}

.btn-primary {
  background: var(--accent);
  color: #0d1117;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  font-weight: 600;
  transition: background var(--transition), border-color var(--transition);
}

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

.auth-flash {
  padding: 10px 12px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  font-size: 0.9rem;
}

.auth-flash-error {
  background: var(--red-dim);
  color: var(--red);
  border: 1px solid var(--red);
}

.auth-flash-success {
  background: var(--green-dim);
  color: var(--green);
  border: 1px solid var(--green);
}

.auth-flash-info {
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid var(--accent);
}

.auth-back {
  display: inline-block;
  margin-top: 20px;
  color: var(--text-muted);
  font-size: 0.9rem;
}
.auth-back:hover {
  color: var(--accent);
}

/* Header chip showing the signed-in user. Appears in the dashboard header
   alongside the sign-out button. */
.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  margin-right: 8px;
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  font-size: 0.8rem;
  font-weight: 500;
}

.balance-chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  margin-right: 8px;
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.8rem;
  font-family: "SFMono-Regular", Consolas, monospace;
}

/* New-backtest modal — extends the existing .modal-overlay/.modal-box. */
.run-modal-box {
  max-width: 640px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
}

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

.run-form-grid {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 8px 12px;
  align-items: center;
}

.run-form-grid .auth-label {
  margin-top: 0;
}

.rf-params {
  border-top: 1px solid var(--border);
  padding-top: 12px;
  margin-top: 4px;
}

.rf-estimate {
  white-space: pre-line;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 0.85rem;
  min-height: 36px;
}

.run-form-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.rf-status {
  min-height: 1.4em;
  font-size: 0.9rem;
  padding: 6px 0;
}

.rf-status-info    { color: var(--text-muted); }
.rf-status-success { color: var(--green); }
.rf-status-error   { color: var(--red); }

/* Phase 4 — Share-run modal */
.share-modal-box {
  max-width: 560px;
  width: 90%;
  max-height: 85vh;
  overflow-y: auto;
}

.share-existing {
  margin-bottom: 16px;
}

.share-list {
  list-style: none;
  padding: 0;
  margin: 8px 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.share-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}
.share-row:last-child { border-bottom: none; }
.share-list li.muted {
  padding: 10px 12px;
  color: var(--text-muted);
  font-style: italic;
}

.share-add-form {
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.share-add-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 6px;
}

.share-add-row select,
.share-add-row .auth-input {
  flex: 1;
  min-width: 0;
}

/* Small indicator next to the strategy name when the viewer doesn't own
   the run (i.e. it was shared with them, or they're admin viewing
   someone else's). */
.shared-badge {
  display: inline-block;
  margin-left: 6px;
  color: var(--accent);
  font-size: 0.85em;
  cursor: help;
  opacity: 0.85;
}
.shared-badge:hover { opacity: 1; }

/* =====================================================================
   MFA + security-settings additions (Phase 7)
   ===================================================================== */

.auth-card-wide { max-width: 560px; }

.auth-section {
  padding: 22px 0;
  border-top: 1px solid var(--border, #30363d);
}
.auth-section:first-of-type { border-top: none; }
.auth-section-title {
  font-size: 1.02rem;
  font-weight: 700;
  margin: 0 0 8px;
  color: var(--text, #f0f6fc);
}
.auth-section-sub {
  color: var(--text-muted, #8b949e);
  font-size: 0.92rem;
  line-height: 1.5;
  margin: 0 0 14px;
}

.auth-status {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.auth-status-on  { background: rgba(63, 185, 80, 0.16); color: #3fb950; }
.auth-status-off { background: rgba(139, 148, 158, 0.18); color: #8b949e; }

.auth-form-inline {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.auth-back-hint {
  margin: 18px 0 0;
  color: var(--text-muted, #8b949e);
  font-size: 0.86rem;
  line-height: 1.5;
}

.auth-steps {
  list-style: decimal;
  padding-left: 20px;
  margin: 0 0 18px;
  color: var(--text, #f0f6fc);
}
.auth-steps > li {
  margin: 12px 0;
  line-height: 1.55;
}

.auth-qr-wrap {
  display: flex;
  align-items: center;
  gap: 18px;
  margin: 14px 0 4px;
  flex-wrap: wrap;
}
.auth-qr {
  width: 196px;
  height: 196px;
  border: 1px solid var(--border, #30363d);
  border-radius: 8px;
  background: #f0f6fc;
  padding: 8px;
}
.auth-qr-secret {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.auth-secret {
  display: inline-block;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border, #30363d);
  border-radius: 6px;
  word-break: break-all;
  color: var(--text, #f0f6fc);
  font-size: 0.85rem;
}

.auth-recovery-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 18px 0 22px;
}
.auth-recovery-code {
  display: inline-block;
  text-align: center;
  padding: 10px 6px;
  background: rgba(88, 166, 255, 0.08);
  border: 1px solid rgba(88, 166, 255, 0.30);
  border-radius: 6px;
  font-size: 0.98rem;
  letter-spacing: 0.06em;
  color: var(--accent-soft, #8ec2ff);
}

.auth-flash-warning {
  background: rgba(210, 153, 34, 0.12);
  border-color: rgba(210, 153, 34, 0.45);
  color: #f0d076;
}

.btn-danger {
  background: rgba(248, 81, 73, 0.16);
  color: #ff7771;
  border: 1px solid rgba(248, 81, 73, 0.45);
}
.btn-danger:hover {
  background: rgba(248, 81, 73, 0.26);
  color: #ffb1ad;
}
