/*
 * Settings / Account page — CR-A116-12, full-width identity band layout
 * (round 2) — CR-A116-53.
 *
 * Base card/form rules below are lifted verbatim (selectors + values) from
 * the ratified R1 card's own <style> block (settings-profile-r1.html §1
 * "The Settings page" + §6 "States"). Draws exclusively from tokens.css's
 * custom properties (design-system-v1) — no ad hoc colors, matching every
 * other stylesheet in this app.
 *
 * CR-A116-53 (round 2, ratified live on stage 2026-08-24/25 — DesignSync
 * unreachable this build; class names + grid ratio below are taken
 * verbatim from the CR's own Technical Spec, which transcribes them from
 * the ratified card) replaces the single narrow `.settings-col` column
 * (max-width: 600px, ~45% of a full-width page) with: a full-width
 * `.idband` identity band (portrait/name/email/role/Edit beside the
 * six-character picker), then `.set-grid-a` — the SAME `1fr 320px` split
 * dashboard.css's `.dash-hero` already established (CR-A116-33) — for
 * Password (wide) / Company + Sign out (narrow). `.settings-col` itself is
 * retired; every ancestor is `.settings-page` now.
 *
 * Two card sections are NOT styled here — Notifications (CR-A116-7,
 * descoped from R1, Drew 2026-08-12) and the avatar UPLOAD affordance
 * (CR-A116-9, same ruling). The initials fallback (no character chosen
 * yet) now renders inside `.idband-portrait` instead of the retired
 * `.avatar-lg`/`.avatar-note` — CR-A116-53 closes the R1 "Avatar art is
 * pending" stale note by making the chosen character portrait the one
 * profile avatar, everywhere.
 */

.settings-page { display: flex; flex-direction: column; gap: 20px; }

/* ---------- identity band (CR-A116-53) ---------- */
.idband { display: flex; align-items: center; justify-content: space-between; gap: 28px; flex-wrap: wrap; background: var(--bg); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 24px 28px; }
.idband-who { display: flex; align-items: center; gap: 18px; flex: 1 1 320px; min-width: 280px; }
.idband-who.idband-who-editing { align-items: flex-start; }

/* portrait: same two visual states the retired .avatar-lg (navy/initials)
   and .av-big (blue-soft/character) each already had — merged onto one
   element via the `.has-char` toggle, same convention as the sidebar chip
   (`.sidebar .user-avatar.has-char`, below). */
.idband-portrait { width: 80px; height: 80px; border-radius: 50%; background: var(--navy); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 26px; flex-shrink: 0; overflow: hidden; }
.idband-portrait.has-char { background: var(--blue-soft); border: 2px solid var(--blue); }
.idband-portrait svg { width: 100%; height: 100%; display: block; }

.idband-info { flex: 1; min-width: 0; }
.idband-name { font-size: 19px; font-weight: 800; color: var(--navy); line-height: 1.3; }
.idband-meta { font-size: 13px; color: var(--muted); margin-top: 3px; }
.idband-role { font-size: 11px; font-weight: 800; letter-spacing: .02em; color: var(--blue-deep); background: var(--blue-soft); border: 1px solid #BFDBFE; display: inline-flex; padding: 3px 9px; border-radius: 999px; margin-top: 9px; }
.idband-who .btn-edit { margin-top: 12px; }
.idband-edit-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }

/* character picker, beside the identity block — same av-* internals as
   before (CR-A116-34), just re-homed: no longer its own top-level
   `.av-block` card (retired), nested inside `.idband` instead. */
.idband-pick { flex: 1 1 420px; min-width: 320px; border-left: 1px solid var(--line); padding-left: 28px; }
.idband-pick .av-head { padding: 0 0 10px; border-bottom: none; }
.idband-pick .av-body { padding: 0; }

/* ---------- Dashboard-law split (dashboard.css .dash-hero, CR-A116-33) ---------- */
.set-grid-a { display: grid; grid-template-columns: 1fr 320px; gap: 20px; align-items: start; }
.set-grid-a .col { display: flex; flex-direction: column; gap: 20px; min-width: 0; }

@media (max-width: 960px) {
  .idband { flex-direction: column; align-items: stretch; }
  .idband-pick { border-left: none; padding-left: 0; border-top: 1px solid var(--line); padding-top: 20px; }
  .set-grid-a { grid-template-columns: 1fr; }
}

.s-card { background: var(--bg); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.s-card-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 22px; border-bottom: 1px solid var(--line); }
.s-card-head h3 { margin: 0; font-size: 15px; font-weight: 700; color: var(--ink); }
.s-card-head .edit-flag { font-size: 9px; font-weight: 800; color: var(--blue-deep); background: var(--blue-soft); border: 1px solid #BFDBFE; padding: 2px 7px; border-radius: 999px; text-transform: uppercase; letter-spacing: .04em; }
.s-card-body { padding: 22px; }

/* pixel-round2 §4.2 (ranked #2 — most visible new finding): this rule never
   set font-family, so the <button> fell through to Chromium's UA button
   font (Arial) instead of inheriting the app sans — the same leak every
   other interactive class in this app closes by declaring font-family
   explicitly. Card measures 11.5px/16.675px line-height (the standard
   1.45 ratio) with text-align: start; this rule had drifted to 12.5px with
   no line-height/text-align declared at all — corrected to match. */
.btn-edit { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; height: 36px; padding: 0 14px; border-radius: var(--r-md); background: var(--bg); border: 1.5px solid var(--line); color: var(--ink-soft); font-size: 11.5px; line-height: 1.45; text-align: left; font-family: var(--font); font-weight: 700; cursor: pointer; }
.btn-edit .icon { width: 13px; height: 13px; }

.edit-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.edit-field:last-child { margin-bottom: 0; }
.edit-field label { font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.edit-field input { min-height: 44px; padding: 11px 13px; border: 1.5px solid var(--blue); border-radius: var(--r-md); background: #fff; font-size: 13.5px; color: var(--ink); font-family: var(--font); width: 100%; }
.edit-field input:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }
.edit-field .ro-input { border: 1.5px solid var(--line); background: var(--field); color: var(--ink-soft); }
.field-hint { font-size: 11.5px; color: var(--faint); margin-top: 5px; line-height: 1.5; }
.field-hint b { color: var(--muted); }

.form-foot-row { display: flex; gap: 10px; margin-top: 20px; }
/* pixel-round2 §4.2 (ranked #6): same UA font-family leak as .btn-edit
   above — no font-family was declared, so "Change password" rendered in
   Arial instead of the app sans. */
.pbtn { min-height: 44px; padding: 0 20px; border-radius: var(--r-md); font-size: 13px; font-weight: 700; font-family: var(--font); display: flex; align-items: center; justify-content: center; gap: 6px; cursor: pointer; }
.pbtn.primary { background: var(--blue); color: #fff; border: none; }
.pbtn.primary:disabled { opacity: .6; cursor: default; }
.pbtn.ghost { background: #fff; border: 1.5px solid var(--line); color: var(--ink-soft); }
.pbtn:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.pbtn .spinner { width: 13px; height: 13px; border-radius: 50%; border: 2px solid rgba(255,255,255,.5); border-top-color: #fff; animation: settings-spin .7s linear infinite; }
.pbtn.ghost .spinner { border: 2px solid rgba(0,0,0,.15); border-top-color: var(--ink-soft); }
@keyframes settings-spin { to { transform: rotate(360deg); } }

/* password fields — eye toggle law from login-r1 */
.pw-input-wrap { position: relative; }
.pw-input-wrap input { padding-right: 48px; }
.pw-eye { position: absolute; top: 0; right: 0; width: 44px; height: 100%; min-height: 44px; border: none; background: none; display: flex; align-items: center; justify-content: center; color: var(--muted); cursor: pointer; font-family: inherit; }
.pw-eye:focus-visible { outline: 2px solid var(--blue); outline-offset: -2px; }
.strength-hint { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--muted); margin-top: 6px; }
.strength-hint .icon { width: 13px; height: 13px; color: var(--faint); }

.ro-row { display: flex; justify-content: space-between; padding: 9px 0; font-size: 13.5px; color: var(--ink-soft); border-bottom: 1px solid var(--line-soft); }
.ro-row:last-of-type { border-bottom: none; }
.ro-row .v { font-weight: 600; color: var(--ink); }
.company-note { font-size: 12px; color: var(--muted); margin-top: 14px; line-height: 1.6; }
.company-note b { color: var(--ink-soft); }

.signout-row { display: flex; justify-content: center; padding: 6px 0 0; }
.signout-btn { display: inline-flex; align-items: center; gap: 7px; min-height: 44px; padding: 0 8px; background: none; border: none; color: var(--muted); font-size: 13px; font-weight: 600; cursor: pointer; }
.signout-btn .icon { color: var(--faint); }
.signout-btn:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

/* password change — inline field error state */
.verr-field { display: flex; flex-direction: column; gap: 6px; }
.verr-field label { font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.verr-field input { min-height: 44px; padding: 11px 13px; border: 1.5px solid var(--danger); border-radius: var(--r-md); background: var(--danger-soft); font-size: 13.5px; color: var(--ink); width: 100%; }
.verr-msg { display: flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--danger); font-weight: 600; margin-top: 6px; }
.verr-msg .icon { width: 12px; height: 12px; color: var(--danger); flex-shrink: 0; }

/* success toast — no silent saves, every update confirms */
.toast { display: inline-flex; align-items: center; gap: 10px; background: #ECFDF5; border: 1px solid #A7F3D0; border-radius: var(--r-md); box-shadow: var(--shadow-pop); padding: 12px 16px 12px 14px; }
.toast .t-icon { width: 20px; height: 20px; border-radius: 50%; background: #059669; color: #fff; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.toast .t-icon .icon { width: 11px; height: 11px; }
.toast .t-text { font-size: 12.5px; font-weight: 700; color: #065F46; }
.toast .t-x { width: 20px; height: 20px; color: #059669; flex-shrink: 0; margin-left: 4px; cursor: pointer; }
.settings-toast-host { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 40; }

/* loading skeleton (§6 "Settings page loading") */
.skel { background: linear-gradient(90deg, var(--line-soft) 25%, var(--line) 37%, var(--line-soft) 63%); background-size: 400% 100%; border-radius: var(--r-sm); animation: settings-shimmer 1.6s ease infinite; }
@keyframes settings-shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }
.skel-row { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.skel-row:last-child { margin-bottom: 0; }
.skel.circ { width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0; }
.skel.ln1 { height: 11px; width: 60%; margin-bottom: 8px; }
.skel.ln2 { height: 9px; width: 40%; }

/* save error — with retry (§6 "Save error") */
.danger-box { background: var(--danger-soft); border: 1px solid #FCA5A5; border-radius: var(--r-md); padding: 16px; text-align: center; }
.danger-box .icon { color: var(--danger); width: 20px; height: 20px; margin: 0 auto 8px; }
.danger-box .dt { font-size: 12.5px; font-weight: 700; color: var(--danger); margin-bottom: 3px; }
.danger-box .ds { font-size: 11.5px; color: #991B1B; margin-bottom: 12px; }
/* Self-found systemic sweep (pixel-round2 lane D, not named in the r2
   report): this Account-page .btn-retry never set font-family — same leak
   shape as .btn-edit/.pbtn above; invoices.css's OWN .btn-retry already had
   it, this one was missed. */
.btn-retry { display: inline-flex; align-items: center; gap: 6px; background: #fff; border: 1.5px solid var(--danger); color: var(--danger); font-size: 11.5px; font-weight: 700; font-family: var(--font); padding: 8px 14px; border-radius: var(--r-md); min-height: 44px; cursor: pointer; }
.btn-retry .icon { width: 12px; height: 12px; stroke: var(--danger); }
.btn-retry:focus-visible { outline: 2px solid var(--danger); outline-offset: 2px; }

/* visually-hidden live region for a11y announcements (INV a11y line) */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/*
 * §7 "Choose your character" (CR-A116-34) — lifted verbatim (selectors +
 * values) from the ratified card's own <style> block, same convention as
 * every other rule in this file. Comment header preserved from the card:
 * "Avatar picker — mechanism borrowed verbatim from Onest (Drew,
 * 2026-08-15): a server-enforced vocabulary of exactly six, one `avatar`
 * column on the user's prefs row, and a pressed-state picker. Only the
 * cast is ours."
 */
.av-head { padding: 15px 18px; border-bottom: 1px solid var(--line); }
.av-h { font-size: 15px; font-weight: 700; color: var(--navy); }
.av-s { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.av-body { padding: 18px; }
.av-current { display: flex; align-items: center; gap: 14px; padding-bottom: 16px; margin-bottom: 16px; border-bottom: 1px solid var(--line-soft); }
.av-big { width: 64px; height: 64px; border-radius: 50%; overflow: hidden; background: var(--blue-soft); border: 2px solid var(--blue); flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.av-big svg { width: 100%; height: 100%; }
.av-who .n { font-size: 15px; font-weight: 700; color: var(--ink); }
.av-who .r { font-size: 12.5px; color: var(--muted); margin-top: 1px; }
.av-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; }

/* BF-635: 6 equal columns has a ~432px min-content width (6 * .av-opt's
   ~63px min + 5 * 12px gaps) with no horizontal scroll to reach the
   overflow — below ~440px viewport width, trailing characters (Lena, then
   Milo) become clipped/unreachable even though the copy promises "exactly
   six characters to choose from". Wrap to 3 columns / 2 rows below the
   app's standard narrow-viewport breakpoint (480px, same value every other
   stylesheet in this app uses) so all six stay reachable without scroll. */
@media (max-width: 480px) {
  .av-grid { grid-template-columns: repeat(3, 1fr); }
}
.av-opt { border: 1.5px solid var(--line); border-radius: var(--r-md); background: var(--bg); padding: 10px 6px; display: flex; flex-direction: column; align-items: center; gap: 7px; font-family: var(--font); cursor: pointer; }
.av-opt.on { border-color: var(--blue); background: var(--blue-soft); }
.av-opt:disabled { opacity: .6; cursor: default; }
.av-opt:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.av-face { width: 48px; height: 48px; border-radius: 50%; overflow: hidden; background: var(--field); display: flex; align-items: center; justify-content: center; }
.av-opt.on .av-face { background: #fff; }
.av-face svg { width: 100%; height: 100%; }
.av-nm { font-size: 11.5px; font-weight: 700; color: var(--ink-soft); }
.av-opt.on .av-nm { color: var(--blue-deep); }
.av-note { margin-top: 16px; background: var(--field); border: 1px solid var(--line); border-radius: var(--r-md); padding: 11px 13px; font-size: 12px; color: var(--muted); line-height: 1.6; }
.av-note b { color: var(--ink-soft); }

/* Sidebar chip — reflects the chosen character once known this session
   (CR-A116-34, `updateSidebarAvatar()` in account.js). `.user-avatar`
   itself (size/circle/background) is shell.css's; settings.css loads on
   every page (index.html's global <link> list), so this rule reaches the
   sidebar from any view without touching shell.css. */
.sidebar .user-avatar.has-char { background: var(--blue-soft); overflow: hidden; }
.sidebar .user-avatar svg { width: 100%; height: 100%; display: block; }
