/* ═══════════════════════════════════════════════════════════════════════════
   settings.css — the Settings page + the avatar-menu identity header.

   Every class is `st-` (page) or `avm-` (menu header) prefixed, same reasoning
   as home-v2.css and profile.css: main.css is one flat 4k-line global namespace
   and short modifier names collide silently.

   Loaded last, after home-v2.css, so it can reuse the `hv-` section header and
   the `--hv-a-*` accent tokens.

   ⚠ Never give a `.page` element a top-level `display` rule here. main.css sets
   `.page { display:none }` / `.page.active { display:block }` at the same
   (0,1,0) specificity and this file loads later, so a bare rule would pin the
   page visible on every route. Scope to a descendant instead. (This is the bug
   home-v2.css and profile.css both carry a warning about.)

   Nothing hardcodes purple — every colour derives from --accent via color-mix,
   so the cosmetics system keeps applying.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ═══════════════════════════════════════════════════════════════════════════
   AVATAR MENU — identity header
   The menu shell itself (.av-menu, .av-menu-item, .av-menu-sep) stays in
   main.css; this is only the header block and the two new item affordances.
   ═══════════════════════════════════════════════════════════════════════════ */

/* The menu got wider to fit the stat row. main.css sets min-width:170px. */
.av-menu { min-width: 272px; }

.avm-head {
  display: block; padding: 14px 13px 13px; border-radius: 10px;
  position: relative; overflow: hidden; cursor: pointer; text-decoration: none;
  background: linear-gradient(150deg, rgba(255,255,255,.055), rgba(255,255,255,.015));
  border: 1px solid var(--border); transition: border-color .16s;
}
.avm-head::before {
  content: ''; position: absolute; inset: 0; z-index: 0;
  background: radial-gradient(ellipse 70% 120% at 12% 0%, var(--hv-a-26), transparent 66%);
}
.avm-head:hover { border-color: var(--hv-a-42); }
.avm-head > * { position: relative; z-index: 1; }

.avm-head-top { display: flex; align-items: center; gap: 11px; }
.avm-av {
  width: 44px; height: 44px; border-radius: 50%; overflow: hidden; flex: none;
  background: var(--accent-dim); display: grid; place-items: center;
}
.avm-av img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avm-ph { font-family: var(--font-display); font-size: 18px; font-weight: 800; color: var(--accent); }

.avm-who { min-width: 0; flex: 1; }
.avm-name {
  font-family: var(--font-display); font-size: 16px; font-weight: 800;
  letter-spacing: -.02em; line-height: 1.15; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
/* The title renders through main.css's .sp-title tier classes, so it keeps its
   gold / purple / gradient treatment. Clipping is on the wrapper, not the span —
   -webkit-background-clip:text and overflow:hidden on the same element kills the
   gradient fill. */
.avm-title {
  font-size: 11px; font-weight: 600; margin-top: 1px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%;
}
.avm-title:empty { display: none; }
.avm-title-none { color: var(--text-3); }

.avm-go { flex: none; color: var(--text-3); transition: .16s; display: flex; }
.avm-go svg { width: 15px; height: 15px; display: block; }
.avm-head:hover .avm-go { color: var(--accent); transform: translateX(2px); }

/* Rank / XP / tier. One state for everyone — it reads the same at tier 1 and at
   max, which is why this won over a progress bar (almost everyone maxes the pass). */
.avm-stats {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; margin-top: 12px;
  border-radius: 8px; overflow: hidden; background: var(--border);
}
.avm-stats:empty { display: none; }
.avm-st { background: rgba(10,10,15,.55); padding: 8px 4px; text-align: center; }
.avm-n {
  font-family: var(--font-display); font-size: 17px; font-weight: 800;
  letter-spacing: -.03em; line-height: 1.1; color: var(--text);
}
.avm-n.acc { color: var(--accent); }
.avm-l {
  font-size: 9.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--text-3); margin-top: 2px;
}

/* The one thing worth stealing from the progress-bar variant: what's next.
   Hidden entirely at max tier rather than showing a full bar with nothing to say. */
.avm-next {
  font-size: 10.5px; color: var(--text-3); margin-top: 8px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.avm-next b { color: var(--text-2); font-weight: 700; }

/* menu item affordances */
.av-mi-ico { width: 17px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.av-mi-ico svg { width: 15px; height: 15px; display: block; }
.av-mi-dot {
  margin-left: auto; min-width: 17px; height: 17px; padding: 0 5px; border-radius: 9px;
  background: var(--accent); color: #fff; font-size: 10.5px; font-weight: 800;
  display: grid; place-items: center;
}
.av-mi-dot.hidden { display: none; }
.av-menu-out { color: rgba(255,120,132,.8); }
.av-menu-out:hover { background: rgba(248,113,113,.10) !important; color: #ff9aa4 !important; }

/* ═══════════════════════════════════════════════════════════════════════════
   SETTINGS PAGE
   ═══════════════════════════════════════════════════════════════════════════ */

#page-settings .page-inner { max-width: 920px; }

.st-head { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.st-title { font-family: var(--font-display); font-size: 30px; font-weight: 800; letter-spacing: -.03em; line-height: 1; }
.st-sub { font-size: 13px; color: var(--text-3); font-weight: 600; padding-bottom: 3px; }
.st-sub b { color: var(--accent); }

/* sticky anchor nav */
.st-nav {
  position: sticky; top: var(--topbar-h); z-index: 40; display: flex; gap: 4px;
  overflow-x: auto; scrollbar-width: none; padding: 10px 0; margin-bottom: 10px;
  background: linear-gradient(180deg, var(--bg) 72%, transparent);
}
.st-nav::-webkit-scrollbar { display: none; }
.st-nav a {
  display: flex; align-items: center; gap: 7px; flex: none; padding: 8px 14px;
  border-radius: 9px; font-size: 13px; font-weight: 650; color: var(--text-2);
  cursor: pointer; transition: .15s; background: rgba(255,255,255,.04);
  border: 1px solid var(--border); white-space: nowrap; text-decoration: none;
}
.st-nav a:hover { background: var(--surface-hover); color: var(--text); }
.st-nav a.on { color: #fff; background: var(--accent-dim); border-color: var(--hv-a-55); }
.st-nav-n { font-size: 11px; color: var(--text-3); font-weight: 700; }
.st-nav-n:empty { display: none; }
.st-nav a.on .st-nav-n { color: var(--accent); }

/* sections + panels */
.st-sec { scroll-margin-top: 120px; }
.st-sec + .st-sec { margin-top: 40px; }
.st-panel { background: var(--hv-panel); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; }
.st-panel + .st-panel { margin-top: 14px; }
.st-loading { padding: 34px 20px; text-align: center; color: var(--text-3); font-size: 13px; }

.st-row {
  display: flex; align-items: center; gap: 16px; padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,.055);
}
.st-row:first-child { border-top: none; }
.st-row-lbl { flex: 1; min-width: 0; }
.st-row-t { font-size: 14px; font-weight: 650; color: var(--text); }
.st-row-d { font-size: 12.5px; color: var(--text-3); margin-top: 2px; line-height: 1.45; }
.st-row-d b { color: var(--text-2); font-weight: 650; }
.st-row-val { font-size: 13.5px; color: var(--text-2); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.st-row-act { flex: none; }

/* buttons */
.st-btn {
  display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 14px;
  border-radius: 9px; font-size: 12.5px; font-weight: 700; color: var(--text-2);
  cursor: pointer; transition: .15s; background: rgba(255,255,255,.05);
  border: 1px solid var(--border); text-decoration: none; white-space: nowrap;
}
.st-btn:hover { background: var(--surface-hover); color: var(--text); border-color: var(--border-strong); }
.st-btn[disabled] { opacity: .55; cursor: default; }
.st-btn svg { width: 13px; height: 13px; stroke: currentColor; fill: none; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.st-btn.primary {
  color: #fff; border-color: transparent;
  background: linear-gradient(135deg, var(--hv-a-hi), var(--hv-a-lo));
  box-shadow: 0 4px 14px var(--hv-a-32), inset 0 1px 0 rgba(255,255,255,.22);
}
.st-btn.primary:hover { transform: translateY(-1px); box-shadow: 0 7px 20px var(--hv-a-42), inset 0 1px 0 rgba(255,255,255,.22); }
.st-btn.danger { color: #fca5a5; background: rgba(248,113,113,.09); border-color: rgba(248,113,113,.28); }
.st-btn.danger:hover { background: rgba(248,113,113,.16); color: #fecaca; border-color: rgba(248,113,113,.45); }

/* toggle */
.st-tog {
  width: 42px; height: 24px; border-radius: 13px; background: rgba(255,255,255,.11);
  border: 1px solid var(--border-strong); position: relative; cursor: pointer;
  transition: .18s; flex: none;
}
.st-tog::after {
  content: ''; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px;
  border-radius: 50%; background: var(--text-2); transition: .18s;
}
.st-tog.on { background: var(--hv-a-55); border-color: var(--hv-a-75); }
.st-tog.on::after { transform: translateX(18px); background: #fff; }
.st-tog.busy { opacity: .55; pointer-events: none; }

/* status pills */
.st-pill {
  display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 800;
  letter-spacing: .04em; padding: 3px 9px; border-radius: 6px; text-transform: uppercase;
}
.st-pill.ok   { background: rgba(74,222,128,.13); color: #86efac; border: 1px solid rgba(74,222,128,.28); }
.st-pill.wait { background: rgba(245,181,24,.12); color: var(--hv-amber-2); border: 1px solid rgba(245,181,24,.3); }
.st-pill.off  { background: rgba(255,255,255,.05); color: var(--text-3); border: 1px solid var(--border); }
.st-pill.acc  { background: var(--accent-dim); color: var(--accent); border: 1px solid var(--hv-a-42); }
.st-pill.bad  { background: rgba(248,113,113,.12); color: #fca5a5; border: 1px solid rgba(248,113,113,.3); }

/* ── ACCOUNT: avatar drop tile ── */
.st-av-row { display: flex; align-items: center; gap: 22px; padding: 22px 20px; }
.st-av-drop { position: relative; width: 96px; height: 96px; border-radius: 50%; flex: none; cursor: pointer; }
.st-av-drop img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block; }
.st-av-ph {
  width: 100%; height: 100%; border-radius: 50%; background: var(--accent-dim);
  display: grid; place-items: center; font-family: var(--font-display);
  font-size: 36px; font-weight: 800; color: var(--accent);
}
.st-av-over {
  position: absolute; inset: 0; border-radius: 50%; display: grid; place-items: center;
  align-content: center; gap: 2px; background: rgba(8,8,12,.72); opacity: 0; transition: .16s;
  font-size: 10.5px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: #fff;
}
.st-av-over svg { width: 19px; height: 19px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.st-av-drop:hover .st-av-over, .st-av-drop.drag .st-av-over { opacity: 1; }
.st-av-drop.drag { outline: 2px dashed var(--accent); outline-offset: 4px; }
.st-av-copy { flex: 1; min-width: 0; }
.st-av-name { font-family: var(--font-display); font-size: 20px; font-weight: 800; letter-spacing: -.025em; }
.st-av-hint { font-size: 12.5px; color: var(--text-3); margin-top: 5px; line-height: 1.5; }
.st-av-hint b { color: var(--text-2); font-weight: 650; }
@media (max-width: 520px) {
  .st-av-row { flex-direction: column; text-align: center; gap: 14px; }
}

/* ── APPEARANCE ── */
.st-cosm { padding: 18px 20px; border-top: 1px solid rgba(255,255,255,.055); }
.st-cosm:first-child { border-top: none; }
.st-cosm-h { display: flex; align-items: baseline; gap: 10px; margin-bottom: 13px; }
.st-cosm-t { font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--text-2); }
.st-cosm-n { font-size: 11.5px; color: var(--text-3); font-weight: 600; margin-left: auto; text-align: right; }
.st-opts { display: flex; flex-wrap: wrap; gap: 9px; }

.st-sw {
  width: 38px; height: 38px; border-radius: 10px; cursor: pointer; position: relative;
  border: 2px solid transparent; transition: .15s; padding: 0;
}
.st-sw:hover { transform: translateY(-2px); }
.st-sw.on { border-color: #fff; box-shadow: 0 0 0 3px rgba(255,255,255,.14); }
.st-sw.locked { cursor: default; opacity: .32; filter: grayscale(.7); }
.st-sw.locked:hover { transform: none; }
.st-sw-lk { position: absolute; inset: 0; display: grid; place-items: center; font-size: 13px; }
/* the "no accent" swatch */
.st-sw-default { background: linear-gradient(135deg, #9564ff, #6d3fd4); }

.st-opt {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 13px; border-radius: 9px;
  font-size: 12.5px; font-weight: 650; color: var(--text-2); cursor: pointer; transition: .15s;
  background: rgba(255,255,255,.04); border: 1px solid var(--border); max-width: 100%;
}
.st-opt:hover { background: var(--surface-hover); color: var(--text); transform: translateY(-1px); }
.st-opt.on { color: #fff; background: var(--accent-dim); border-color: var(--hv-a-55); }
/* the label itself — the tier tag beside it must never be the thing that clips */
.st-opt-nm { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-opt.locked { cursor: default; opacity: .45; background: rgba(255,255,255,.02); }
.st-opt.locked:hover { transform: none; background: rgba(255,255,255,.02); color: var(--text-2); }
.st-opt-tier {
  font-size: 10px; font-weight: 800; letter-spacing: .04em; color: var(--text-3);
  padding-left: 8px; border-left: 1px solid var(--border); text-transform: uppercase; flex: none;
}
.st-opt.on .st-opt-tier { color: var(--accent); border-color: var(--hv-a-32); }
/* live preview dots reuse main.css's .av-frame-* classes verbatim */
.st-frame-prev {
  width: 17px; height: 17px; border-radius: 50%; flex: none;
  background: linear-gradient(140deg, #3b3b52, #252533);
}
.st-note { margin-top: 11px; font-size: 11.5px; color: var(--text-3); line-height: 1.5; }
.st-note b { color: var(--text-2); font-weight: 650; }
.st-note a { color: var(--accent); font-weight: 700; text-decoration: none; border-bottom: 1px solid var(--hv-a-42); }

/* ── CONNECTIONS ── */
.st-conn { padding: 20px; }
.st-conn-head { display: flex; align-items: center; gap: 13px; margin-bottom: 16px; }
.st-conn-ico {
  width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center;
  font-size: 20px; background: rgba(255,255,255,.05); border: 1px solid var(--border); flex: none;
}
.st-conn-who { flex: 1; min-width: 0; }
.st-conn-t { font-size: 14.5px; font-weight: 700; display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.st-conn-d { font-size: 12.5px; color: var(--text-3); margin-top: 2px; }
.st-conn-d b { color: var(--text-2); font-weight: 650; }
.st-conn-stats {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--border);
  border-radius: 10px; overflow: hidden; margin-bottom: 14px;
}
.st-conn-st { background: rgba(10,10,15,.5); padding: 12px 6px; text-align: center; }
.st-conn-n { font-family: var(--font-display); font-size: 20px; font-weight: 800; letter-spacing: -.03em; line-height: 1.1; }
.st-conn-l { font-size: 9.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--text-3); margin-top: 3px; }
.st-conn-acts { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.st-conn-err {
  font-size: 12px; color: #fca5a5; background: rgba(248,113,113,.08);
  border: 1px solid rgba(248,113,113,.24); border-radius: 9px; padding: 9px 12px; margin-bottom: 12px;
}
.st-conn-recent { margin-bottom: 14px; }
.st-conn-recent-t { font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); margin-bottom: 8px; }
.st-conn-recent-row { display: flex; align-items: center; gap: 10px; font-size: 12.5px; padding: 5px 0; color: var(--text-2); }
.st-conn-recent-pts { font-weight: 800; color: var(--accent); min-width: 26px; }
.st-conn-recent-nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 560px) { .st-conn-stats { grid-template-columns: repeat(2, 1fr); } }

/* the RA link form */
.st-field { margin-bottom: 12px; }
.st-label { display: block; font-size: 11px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; color: var(--text-3); margin-bottom: 6px; }
.st-input {
  width: 100%; height: 38px; padding: 0 12px; border-radius: 9px; font: inherit; font-size: 13.5px;
  color: var(--text); background: rgba(0,0,0,.28); border: 1px solid var(--border-strong); outline: none;
}
.st-input:focus { border-color: var(--hv-a-55); }

/* ── REQUESTS ── */
.st-req { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-top: 1px solid rgba(255,255,255,.055); font-size: 13.5px; }
.st-req-ico { width: 26px; text-align: center; flex: none; font-size: 15px; }
.st-req-t { flex: 1; min-width: 0; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-req-t span { color: var(--text-3); font-weight: 500; }
.st-empty { padding: 26px 20px; text-align: center; font-size: 13px; color: var(--text-3); border-top: 1px solid rgba(255,255,255,.055); }
.st-empty a { color: var(--accent); font-weight: 700; text-decoration: none; border-bottom: 1px solid var(--hv-a-42); cursor: pointer; }

@media (max-width: 620px) {
  .st-title { font-size: 24px; }
  .st-row { flex-wrap: wrap; gap: 10px; }
  .st-row-act { width: 100%; }
  .st-row-act .st-btn { width: 100%; justify-content: center; }
}
