/* ============================================================================
   SETTINGS PAGE — "Refined standalone"
   Loaded ONLY by setup.html (after style.css, for the shared tokens). The
   dashboard never loads this file, so nothing here can affect it. Accent is
   GREEN (var(--green)) to match the app's brand.
   ============================================================================ */

.setup-body { background: var(--bg); }
.setup-wrap { max-width: 940px; margin: 0 auto; padding: 40px 24px 80px; }

/* --- Page header --- */
.setup-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 32px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--border);
}
.setup-eyebrow {
  margin: 0 0 6px;
  font-family: var(--mono);
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--faint);
}
.setup-title { margin: 0; font-size: 1.5rem; font-weight: 700; letter-spacing: -0.01em; }
.setup-title .accent { color: var(--green); }
.setup-sub { margin: 8px 0 0; font-size: 0.9rem; }
.setup-back { margin: 4px 0 0; }
a.backlink { color: var(--green); font-size: 0.85rem; text-decoration: none; }
a.backlink:hover { text-decoration: underline; }

/* Solo cards (logged-out auth + reset) sit centered & narrower */
.setup-card--solo { max-width: 460px; margin: 0 auto; }
.setup-card-brand { display: flex; align-items: center; gap: 0.6rem; font-weight: 600; font-size: 1rem; margin-bottom: 1.1rem; }
.setup-card-brand .accent { color: var(--green); }

/* Full logo lockup at the top of the sign-in / register card */
.auth-brand { display: flex; justify-content: center; margin: 2px 0 18px; }
.auth-logo { display: block; width: 100%; max-width: 260px; height: auto; }

/* --- Two-column layout: sticky nav rail + content --- */
.setup-layout {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  gap: 36px;
  align-items: start;
}
.setup-content { display: flex; flex-direction: column; gap: 40px; }

/* --- In-page tab nav (not sticky: each tab shows one short section, and a
   sticky rail collided with the page header on scroll) --- */
.setup-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  box-shadow: var(--shadow);
}
.setup-nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--r-sm);
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 500;
  text-decoration: none;
  border: 1px solid transparent;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.setup-nav-link:hover { color: var(--text); background: var(--panel-alt); }
.setup-nav-link:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
.setup-nav-link.is-active {
  color: var(--text);
  background: rgba(163, 230, 53, 0.1);
  border-color: rgba(163, 230, 53, 0.32);
}
.setup-nav-ico { font-size: 0.6rem; color: var(--green); line-height: 1; }
.setup-nav-link--danger .setup-nav-ico { color: var(--red); }
.setup-nav-link--danger:hover { color: var(--red); }
.setup-nav-link--danger.is-active {
  background: rgba(255, 90, 106, 0.1);
  border-color: rgba(255, 90, 106, 0.32);
}

/* --- Section grouping --- */
.setup-section { scroll-margin-top: 24px; display: flex; flex-direction: column; gap: 16px; }
.setup-section-head { display: flex; flex-direction: column; gap: 2px; }
.setup-section-title {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faint);
}
.setup-section-title--danger { color: var(--red); }
.setup-section-desc { margin: 0; color: var(--muted); font-size: 0.85rem; }

/* --- Cards --- */
.setup-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  padding: 24px;
  margin-bottom: 0;
  box-shadow: var(--shadow);
}
.setup-card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.setup-card h2 { margin: 0 0 4px; font-size: 1.02rem; font-weight: 650; }
.setup-card-head h2 { margin: 0; }
.setup-card p.sub { margin: 0 0 16px; color: var(--muted); font-size: 0.9rem; line-height: 1.55; }
.setup-card--identity { padding: 18px 20px; }
.setup-card--identity .me-row { margin-bottom: 0; }

/* Danger card */
.setup-card--danger {
  border-color: rgba(255, 90, 106, 0.28);
  background: linear-gradient(0deg, rgba(255, 90, 106, 0.04), rgba(255, 90, 106, 0.04)), var(--panel);
}
.setup-card--danger h2 { color: var(--text); }

/* --- Tags / pills --- */
.setup-tag {
  font-family: var(--mono);
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.18rem 0.5rem;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--panel-alt);
  color: var(--muted);
}
.setup-tag--advanced { color: var(--green); border-color: rgba(163, 230, 53, 0.3); }

.role-pill {
  font-family: var(--mono);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 0.12rem 0.45rem;
  border-radius: 4px;
  background: var(--panel-alt);
  border: 1px solid var(--border);
  color: var(--muted);
}

.status-pill {
  font-family: var(--mono);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 0.1rem 0.45rem;
  margin-left: 6px;
  border-radius: 4px;
  background: var(--panel-alt);
  border: 1px solid var(--border);
  color: var(--muted);
  white-space: nowrap;
}
.status-pill:empty { display: none; }

/* --- Identity badge --- */
.me-row { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.me-row img,
.me-row .me-avatar { width: 44px; height: 44px; border-radius: 10px; border: 1px solid var(--border-strong); }
.me-id-badge {
  width: 44px; height: 44px; border-radius: 10px; flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem; color: var(--green);
  background: linear-gradient(145deg, var(--panel-alt), var(--panel));
  border: 1px solid var(--border-strong);
}
.me-id-text { min-width: 0; }
.me-row .name { font-weight: 600; }
.me-row .id { color: var(--muted); font-size: 0.8rem; margin-top: 3px; }
.setup-logout { margin-left: auto; }

/* --- Fields (labeled inputs) --- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: 0.78rem; font-weight: 600; letter-spacing: 0.01em; color: var(--text); }
.field-label--sub { font-weight: 500; color: var(--muted); }
.field input,
.inline-form input {
  width: 100%;
  padding: 11px 13px;
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.field input::placeholder { color: var(--muted); }
.field input:focus,
.inline-form input:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 2px rgba(163, 230, 53, 0.25);
}

/* --- Buttons --- */
.steam-btn {
  display: inline-flex; align-items: center; gap: 10px;
  background: var(--green); color: #0a0a0c; font-weight: 700;
  border: 0; border-radius: var(--r-sm);
  padding: 12px 20px; cursor: pointer; font-size: 0.95rem;
  transition: filter 0.15s ease, transform 0.05s ease;
}
.steam-btn:hover { filter: brightness(1.06); }
.steam-btn:active { transform: translateY(1px); }

.ghost-btn {
  background: var(--panel-alt); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: var(--r-sm);
  padding: 10px 16px; cursor: pointer; font-size: 0.9rem;
  display: inline-block; text-decoration: none;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.ghost-btn:hover { border-color: var(--green); background: rgba(163, 230, 53, 0.06); }
.ghost-btn--sm { padding: 7px 12px; font-size: 0.82rem; }
.ghost-btn--danger { color: var(--red); border-color: rgba(255, 90, 106, 0.4); }
.ghost-btn--danger:hover { border-color: var(--red); background: rgba(255, 90, 106, 0.08); }

/* --- Auth (logged-out) --- */
.auth-tabs { display: flex; gap: 8px; margin-bottom: 18px; }
.auth-tab {
  flex: 1; padding: 9px 10px; cursor: pointer; font: inherit; font-weight: 500;
  background: transparent; color: var(--muted);
  border: 1px solid var(--border); border-radius: var(--r-sm);
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.auth-tab:hover { color: var(--text); }
.auth-tab.active { color: var(--text); border-color: var(--green); background: rgba(163, 230, 53, 0.08); }
.auth-form { display: flex; flex-direction: column; gap: 12px; }
.auth-form .sub { margin: 0; color: var(--muted); font-size: 0.88rem; }
.auth-altlink { text-align: right; }
.auth-altlink a { color: var(--green); text-decoration: none; }
.auth-altlink a:hover { text-decoration: underline; }
.auth-error { color: var(--red); font-size: 0.85rem; min-height: 1em; margin: 2px 0 0; }

/* --- Security fields --- */
.sec-field { margin-bottom: 20px; display: flex; flex-direction: column; gap: 8px; }
.sec-field:last-child { margin-bottom: 0; }
.sec-field--bordered { margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--border); }
.inline-form { display: flex; gap: 8px; }
.email-note { margin: 4px 0 0; font-size: 0.78rem; color: var(--muted); }

/* --- Invite code box --- */
.code-box {
  font-family: var(--mono); font-size: 1.7rem; letter-spacing: 4px; font-weight: 700;
  background: var(--bg); border: 1px dashed var(--border-strong); border-radius: var(--r-sm);
  padding: 16px 20px; text-align: center; margin: 14px 0 0; color: var(--green);
}

/* --- Steam account cards --- */
.steam-acct {
  background: var(--panel-alt);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  padding: 18px;
  margin-bottom: 16px;
}
.steam-acct:last-of-type { margin-bottom: 16px; }
.steam-acct .acct-setup { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }
.steam-acct .acct-setup .guide { margin-top: 14px; }
.badge.acct-primary { background: var(--green); color: #0a0a0c; border-color: transparent; font-weight: 700; }
.acct-unlink { margin-left: auto; }
#add-steam-btn { margin-top: 4px; }

/* --- Setup guide --- */
.guide { margin: 0; padding-left: 1.3rem; color: var(--text); font-size: 0.88rem; line-height: 1.6; }
.guide li { margin-bottom: 6px; }
.guide li::marker { color: var(--faint); }
.guide code { background: var(--bg); border: 1px solid var(--border); border-radius: 6px; padding: 1px 6px; font-family: var(--mono); font-size: 0.85em; }

/* --- Agent checklist --- */
.checklist { list-style: none; padding: 0; margin: 16px 0 0; border: 1px solid var(--border); border-radius: var(--r-sm); overflow: hidden; }
.checklist li { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-top: 1px solid var(--border); background: var(--bg); }
.checklist li:first-child { border-top: 0; }
.dot { width: 9px; height: 9px; border-radius: 999px; background: var(--faint); flex: 0 0 auto; box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.03); }
.dot.ok { background: var(--green); box-shadow: 0 0 8px var(--green), 0 0 0 3px rgba(163, 230, 53, 0.12); }
.dot.pending { background: var(--orange); box-shadow: 0 0 6px rgba(245, 158, 11, 0.6), 0 0 0 3px rgba(245, 158, 11, 0.12); animation: setup-dot-pulse 1.6s ease-in-out infinite; }
.dot.bad { background: var(--red); box-shadow: 0 0 8px rgba(255, 90, 106, 0.6), 0 0 0 3px rgba(255, 90, 106, 0.12); }
@keyframes setup-dot-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.55; } }
.check-label { flex: 1; font-size: 0.88rem; }
.check-state { color: var(--muted); font-size: 0.78rem; font-family: var(--mono); }

/* --- Per-account wiring state (one agent covers all accounts) --- */
.acct-wiring { display: flex; align-items: center; gap: 10px; }
.acct-wire-state { font-size: 0.86rem; font-weight: 600; color: var(--text); }
.acct-note { margin: 10px 0 0; }

/* --- Per-account blocks (live agent + demo analysis stacked in one card) --- */
.acct-block { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }
.acct-block-head { display: flex; align-items: center; gap: 10px; font-size: 0.72rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--faint); margin-bottom: 9px; }

/* Demo-analysis block: per-code status rows + overall pill + collapsible form */
.demo-pill { display: inline-flex; align-items: center; gap: 7px; margin-left: auto; text-transform: none; letter-spacing: 0; }
.demo-pill-text { font-size: 0.78rem; font-weight: 600; color: var(--text); }
.demo-status { display: flex; flex-direction: column; gap: 7px; }
.demo-stat { display: flex; align-items: center; gap: 10px; font-size: 0.86rem; }
.demo-stat-label { color: var(--text); }
.demo-stat-val { margin-left: auto; font-size: 0.78rem; font-family: var(--mono); color: var(--muted); }
.demo-summary { margin: 10px 0 0; }
.demo-edit { margin-top: 10px; }
.demo-form { margin-top: 12px; display: flex; flex-direction: column; gap: 10px; }
.demo-form .field input:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 2px rgba(163, 230, 53, 0.25); }
.demo-msg { min-height: 1em; }

/* --- Companion-agent: per-PC card above the accounts it powers --- */
.agent-pc-card { border-color: var(--border-strong); background: var(--panel-alt, var(--panel)); }
.agent-pc-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.agent-pc-title { margin: 0; font-size: 1rem; }
.agent-pc-title .accent { color: var(--green); }
.agent-status { display: inline-flex; align-items: center; gap: 8px; }
.agent-status-text { font-size: 0.8rem; font-family: var(--mono); color: var(--muted); }
.agent-pc-actions { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-top: 12px; }
.agent-uninstall-link { background: none; border: 0; padding: 0; cursor: pointer; font: inherit; font-size: 0.82rem; color: var(--red); opacity: 0.8; }
.agent-uninstall-link:hover { opacity: 1; text-decoration: underline; }
.agent-guide { margin-top: 14px; }
.agent-guide > summary { cursor: pointer; font-size: 0.82rem; color: var(--muted); list-style: none; user-select: none; }
.agent-guide > summary::-webkit-details-marker { display: none; }
.agent-guide > summary::before { content: '▸ '; color: var(--faint); }
.agent-guide[open] > summary::before { content: '▾ '; }
.agent-guide .guide { margin-top: 12px; }

/* "Accounts powered by this agent" grouping label + per-account live-agent suffix */
.accounts-head { font-size: 0.72rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--faint); margin-bottom: 10px; }
.acct-block-sub { text-transform: none; letter-spacing: 0; color: var(--faint); font-weight: 400; }

/* --- Demo analysis cards (rendered by setup.js) --- */
.demo-acct { background: var(--panel-alt); border: 1px solid var(--border); border-radius: var(--r-card); padding: 18px; margin-bottom: 14px; }
.demo-acct:last-child { margin-bottom: 0; }
.demo-field input:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 2px rgba(163, 230, 53, 0.25); }
.demo-acct.just-linked { outline: 2px solid var(--green); outline-offset: 3px; border-radius: var(--r-card); animation: just-linked-fade 2.5s ease-out 1; }
@keyframes just-linked-fade { 0% { background: rgba(163, 230, 53, 0.18); } 100% { background: var(--panel-alt); } }

/* --- Responsive: collapse to single column, nav becomes a horizontal strip --- */
@media (max-width: 760px) {
  .setup-layout { grid-template-columns: 1fr; gap: 24px; }
  .setup-nav { position: static; flex-direction: row; overflow-x: auto; gap: 6px; }
  .setup-nav-link { white-space: nowrap; }
  .setup-head { flex-direction: column; }
}
