/* Console: profile pages (identity/pages.tsx /profile, script public/profile.js). Shared building blocks are in
   console.css; everything here is scoped to .cx-pf. Overrides of shared rules are marked "override". */

/* override: the shared head starts 22px down; c-main's own top padding would double it. */
.c-main:has(> .cx-pf) { --c-main-pt: 0px; padding-bottom: 24px; }
.cx-pf .cx-head { margin-bottom: 18px; }
.cx-pf .cx-tabs { margin-top: 16px; }

/* The big avatar in the head: the picture, or initials on the chosen color. */
.cx-pf-av { width: 56px; height: 56px; flex: none; display: grid; place-items: center; overflow: hidden; border-radius: 6px; background: var(--av, var(--c-accent)); color: #fff; font: 800 20px/1 var(--font-display); letter-spacing: -.01em; user-select: none; }
.cx-pf-av img { width: 100%; height: 100%; object-fit: cover; display: block; }

.cx-pf-sections { max-width: 1100px; }
.cx-pf .cx-section { padding: 14px 0; align-items: start; }
.cx-pf .cx-section:first-child { padding-top: 2px; }
.cx-pf .cx-section-l b { font-size: 13.5px; }
.cx-pf .cx-section-l span { display: block; line-height: 1.45; }
.cx-section-r { min-width: 0; }

/* ---- Choices: make "you can pick one" obvious (override of the shared cx-choice look) ---- */
.cx-pf-choice > label { transition: background .12s, color .12s, box-shadow .12s; }
.cx-pf-choice > label:hover { background: color-mix(in srgb, var(--c-ink) 6%, transparent); color: var(--c-ink); box-shadow: inset 0 -2px 0 color-mix(in srgb, var(--c-ink) 30%, transparent); }
.cx-pf-choice > label:has(input:checked) { background: color-mix(in srgb, var(--c-accent) 14%, transparent); color: var(--c-ink); box-shadow: inset 0 -2px 0 var(--c-accent); }
.cx-pf-choice > label:has(input:focus-visible) { outline: 2px solid var(--c-accent); outline-offset: -2px; z-index: 1; }
.cx-pf-choice.is-inline > label { color: var(--c-ink-2); font-size: 13px; }
.cx-pf-choice.is-inline > label:has(input:checked) { color: var(--c-ink); }
.cx-pf-choice.is-inline svg { opacity: .8; }
.cx-pf-choice small { display: block; margin-top: 1px; }

/* ---- Account: picture ---- */
.cx-pf-pic { display: flex; align-items: center; gap: 12px 22px; flex-wrap: wrap; margin: 0; }
.cx-pf-swatches { display: none; gap: 6px; flex-wrap: wrap; }
.cx-pf-pic:has(input[name=source][value=initials]:checked) .cx-pf-swatches { display: flex; }
.cx-pf-sw { position: relative; display: block; width: 22px; height: 22px; border-radius: 3px; background: var(--sw); cursor: pointer; transition: transform .12s; }
.cx-pf-sw:hover { transform: translateY(-1px); box-shadow: 0 0 0 1px color-mix(in srgb, var(--c-ink) 40%, transparent); }
.cx-pf-sw input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; }
.cx-pf-sw:has(input:checked) { outline: 2px solid var(--c-ink); outline-offset: 2px; }
.cx-pf-sw:has(input:focus-visible) { outline: 2px solid var(--c-accent); outline-offset: 2px; }

/* ---- Account: password (a <details> that opens in place) ---- */
.cx-pf-why { margin: 6px 0 0; color: var(--c-ink-2); font-size: 13px; }
.cx-pf-pw > summary { list-style: none; width: fit-content; }
.cx-pf-pw > summary::-webkit-details-marker { display: none; }
.cx-pf-pw[open] > summary { display: none; }
.cx-pf-pw form { margin: 0; }
.cx-pf-pw-foot { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.cx-pf-check { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 600; color: var(--c-ink-2); cursor: pointer; }
.cx-pf-pw-foot .cx-btn[type=submit][aria-disabled='true'] { opacity: .5; cursor: not-allowed; }

/* ---- Account: lists ---- */
.cx-pf-tags { display: flex; flex-wrap: wrap; gap: 4px 0; padding-top: 1px; }
a.cx-pf-tag { color: var(--c-ink); text-decoration: none; height: 22px; }
a.cx-pf-tag span { color: var(--c-ink-3); font-weight: 500; }
a.cx-pf-tag:hover { border-color: var(--c-accent); color: var(--c-accent); }
a.cx-pf-tag:focus-visible { outline: 2px solid var(--c-accent); outline-offset: 2px; }

/* ---- The savebar: pinned to the bottom of the window while there are changes (override: sticky → fixed) ---- */
.cx-pf-savebar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 4; margin: 0; padding: 10px 36px; min-height: 50px; border-top: 1px solid var(--cx-line); background: color-mix(in srgb, var(--c-ink) 3%, var(--c-bg)); }
.cx-pf-status { margin-right: 4px; }
.cx-pf-status.is-error { color: var(--c-danger); font-weight: 600; }
.cx-pf-status.is-ok { color: var(--c-ok); font-weight: 600; }
.cx-pf-sections:has(> .cx-pf-savebar:not([hidden])) { padding-bottom: 56px; }

/* ---- AI chat ---- */
.cx-pf-lrow { cursor: pointer; min-height: 42px; }
.cx-pf-lrow:hover .cx-lrow-t { color: var(--c-ink); }
.cx-pf .cx-lrow-t { font-size: 13px; }
.cx-pf .cx-section-r > .cx-pf-lrow:first-child { margin-top: -10px; }

/* ---- Appearance ---- */
.cx-pf-theme-group + .cx-pf-theme-group { margin-top: 12px; }
.cx-pf-theme-mode { display: block; margin-bottom: 7px; font-size: 10.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--c-ink-3); }
.cx-pf-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 10px 8px; max-width: 846px; }
.cx-pf-tile { position: relative; display: block; min-width: 0; cursor: pointer; }
.cx-pf-tile input { position: absolute; opacity: 0; pointer-events: none; }
.cx-pf-tile-prev { position: relative; display: block; height: 38px; border: 1px solid var(--cx-line-2); border-radius: 3px; background: var(--tb); transition: border-color .12s; }
.cx-pf-tile-prev::after { content: ''; position: absolute; left: 6px; bottom: 6px; width: 40%; height: 4px; background: var(--ta); }
.cx-pf-tile:hover .cx-pf-tile-prev { border-color: color-mix(in srgb, var(--c-ink) 45%, transparent); }
.cx-pf-tile:has(input:checked) .cx-pf-tile-prev { outline: 2px solid var(--c-ink); outline-offset: 2px; }
.cx-pf-tile:has(input:focus-visible) .cx-pf-tile-prev { outline: 2px solid var(--c-accent); outline-offset: 2px; }
.cx-pf-tile-name { display: block; margin-top: 5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 10.5px; color: var(--c-ink-3); }
.cx-pf-tile:has(input:checked) .cx-pf-tile-name { color: var(--c-ink); font-weight: 600; }
.cx-pf-lang { width: 260px; max-width: 100%; }
.cx-pf-switch { display: inline-flex; align-items: center; gap: 12px; min-height: 32px; cursor: pointer; }

/* ---- Connected accounts ---- */
.cx-pf-accounts { max-width: 1100px; }
.cx-pf-lead { margin: -4px 0 12px; }
.cx-pf-mono { font: 12px var(--font-mono); }

@media (max-width: 900px) {
  /* Keep the three picture options on one line on a phone (override: shared cx-choice stacks). */
  .cx-pf-pic .cx-choice.is-inline { grid-auto-flow: column; }
  .cx-pf-pic .cx-choice.is-inline > label { border-bottom: 0; border-right: 1px solid var(--cx-line-2); padding: 0 11px; }
  .cx-pf-pic .cx-choice.is-inline > label:last-child { border-right: 0; }
  .cx-pf .cx-section { gap: 8px; }
  .cx-pf .cx-section-r > .cx-pf-lrow:first-child { margin-top: 0; }
  .cx-pf-savebar { padding: 10px 16px; flex-wrap: wrap; }
  .cx-pf-tiles { grid-template-columns: repeat(auto-fill, minmax(60px, 1fr)); }
  /* AI chat > Your AI: a link that leaves the page, so a full tap target on a phone. */
  .cx-pf-connect { height: 40px; }
}

/* app.js turns every select into a custom dropdown (c-goo); square it off to match the cx inputs (override). */
.cx-pf .cx-field .c-goo.is-field { display: flex; width: 100%; min-width: 0; }
.cx-pf .c-goo.is-field .c-goo-btn, .cx-pf .c-goo.is-language .c-goo-btn { width: 100%; max-width: none; height: 34px; padding: 0 8px 0 11px; justify-content: space-between; gap: 10px; border: 1px solid var(--cx-line-2); border-radius: var(--cx-r); background: var(--c-surface); color: var(--c-ink); font: 400 13px var(--font-body); }
.cx-pf .c-goo.is-field .c-goo-btn:hover, .cx-pf .c-goo.is-language .c-goo-btn:hover { border-color: color-mix(in srgb, var(--c-ink) 35%, var(--cx-line-2)); background: var(--c-surface); }
.cx-pf .c-goo.is-field.is-open .c-goo-btn, .cx-pf .c-goo.is-language.is-open .c-goo-btn { border-color: var(--c-accent); box-shadow: 0 0 0 1px var(--c-accent); }
.cx-pf .c-goo.is-field .c-goo-chev { width: 18px; height: 18px; border-radius: 3px; }
.cx-pf .c-goo.is-language { display: flex; width: 260px; max-width: 100%; }
.cx-pf .c-goo.is-language .c-language-flag { width: 20px; height: auto; border-radius: 2px; }
.cx-pf .c-goo.is-language .c-goo-label { margin-right: auto; }
