/* account.css — /account, the signed-in user's own settings.
 *
 * Sits inside the app shell, so it uses the shared tokens rather than the
 * self-contained palette that /login and /invite carry (those render before a
 * session exists and cannot pull the shell in).
 *
 * Two columns on the desktop, one on anything narrow. The left column is the
 * account itself (who you look like, who you are on paper) and the right is the
 * three things you edit; they are separate columns rather than a single stack
 * because the photo card would otherwise push the fields most people came here
 * for below the fold.
 *
 * THIS PAGE OWNS ITS SCROLL. The shell is a fixed-height flex column and
 * `#spa-slot` carries `overflow: hidden`, because the map pages inside it scroll
 * their own panes. A document-flow page therefore has no scroller unless it
 * declares one -- without the `flex/min-height/overflow-y` trio below, anything
 * past the viewport is not "below the fold", it is gone.
 */

/* SQUARE CORNERS, throughout this sheet.
 * A stated preference, scoped to the screens it was asked about (/admin,
 * /account and the navbar's account menu). The rest of the app keeps
 * tokens.css's `--radius: 8px`, so do NOT reach for that variable here -- these
 * files opt out of it deliberately, and a later edit that "restores the token"
 * would quietly undo the decision.
 *
 * The exceptions are shape, not radius: avatars stay circles (50%), because a
 * square avatar is a different thing rather than a squarer one.
 */

.acct-wrap {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 18px 20px 28px;
}

/* Separate from the scroller so the scrollbar sits at the window edge instead
 * of against the 1000px column. */
.acct-inner {
  max-width: 1000px;
  margin: 0 auto;
}

/* The heading is for screen readers only -- see the template. */
.acct-h1 {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.acct-grid {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 14px;
  align-items: start;
}
.acct-col { display: flex; flex-direction: column; gap: 14px }

@media (max-width: 860px) {
  .acct-grid { grid-template-columns: 1fr }
}

/* ── cards ──────────────────────────────────────────────────────── */
.acct-card {
  padding: 16px 18px 16px;
  background: var(--bg1);
  border-radius: 0;
  box-shadow: var(--sh-raised);
}
/* Dark: a shadow on near-black reads as nothing, so elevation becomes a lit
 * edge. Same split the rest of the app uses. */
:root:not(.light) .acct-card,
body:not(.light) .acct-card {
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .05), var(--sh-raised);
}

.acct-card h2 {
  margin: 0 0 4px;
  font-size: var(--fs-md);
  font-weight: 650;
}
.acct-sub {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
  font-size: var(--fs-sm);
  color: var(--t1);
}

/* ── the photo card ─────────────────────────────────────────────── */
.acct-photo { display: flex; flex-direction: column; align-items: center; gap: 12px }
.acct-photo h2 { align-self: flex-start; margin: 0 }

.acct-photo-disc {
  display: grid;
  place-items: center;
  width: 88px;
  height: 88px;
  overflow: hidden;
  color: var(--t2);
  background: var(--bg2);
  border: 1px solid var(--bdr);
  border-radius: 50%;
}
.acct-photo-disc .av-initials { font-size: 34px }

.acct-photo-actions { display: flex; gap: 8px }
/* .acct-centre and #photoError went with the in-card error strip: a rejected
 * file is a toast now, like every other outcome on this page (account-photo.js). */

/* ── forms ──────────────────────────────────────────────────────── */
.acct-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
@media (max-width: 560px) { .acct-row { grid-template-columns: 1fr } }

.acct-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px }
.acct-row .acct-field { margin-bottom: 0 }

.acct-card label {
  font-size: var(--fs-caption);
  color: var(--t2);
}

.acct-card input[type=text],
.acct-card input[type=password] {
  width: 100%;
  padding: 9px 11px;
  font-size: var(--fs-sm);
  color: var(--t0);
  background: var(--bg2);
  border: 1px solid transparent;
  border-radius: 0;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.acct-card input:focus {
  border-color: var(--acc);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--acc) 22%, transparent);
}

.acct-hint {
  display: block;
  margin: 6px 0 0;
  font-size: var(--fs-caption);
  line-height: 1.45;
  color: var(--t2);
}

/* ── buttons ────────────────────────────────────────────────────── */
.acct-btn {
  margin-top: 14px;
  /* Tight to the text. 8x16 around a 12px label put more button than word on
   * screen, which reads as a placeholder rather than a control. */
  padding: 6px 11px;
  font: inherit;
  font-size: var(--fs-caption);
  font-weight: 500;
  color: var(--t1);
  background: var(--bg1);
  border: 1px solid var(--bdr);
  border-radius: 0;
  cursor: pointer;
  transition: color .13s, border-color .13s, filter .13s;
}
.acct-btn:hover           { color: var(--t0); border-color: var(--t2) }
.acct-btn[disabled]       { opacity: .55; cursor: default }

.acct-btn-primary {
  color: #fff;
  background: var(--acc);
  border-color: transparent;
}
.acct-btn-primary:hover   { color: #fff; filter: brightness(1.07) }

.acct-btn-danger {
  margin-top: 0;
  color: var(--err);
  background: transparent;
  border-color: var(--err);
}
.acct-btn-danger:hover    { color: #fff; background: var(--err) }

/* The photo card's buttons sit in a flex row, so the form-field top margin
 * would push them out of line with each other. */
.acct-photo-actions .acct-btn { margin-top: 0 }

/* ── chips ─────────────────────────────────────────────────────── */
/* Only /admin renders these now -- the account page deliberately shows nobody
 * their own permissions (see templates/auth/account.html). Kept in this sheet
 * rather than moved to admin.css because admin.css is written to reuse the
 * account page's object vocabulary, not to fork it. */
.acct-chip {
  display: inline-block;
  padding: 3px 8px;
  font-family: var(--font-badge);
  font-size: var(--fs-micro);
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--acc);
  background: color-mix(in srgb, var(--acc) 14%, transparent);
  border-radius: 0;
}

/* An admin carries every capability, so this list is the tallest thing in the
 * column -- kept dense for that reason. */
.acct-caps { display: flex; flex-wrap: wrap; gap: 4px }
.acct-cap {
  padding: 2px 7px;
  font-size: var(--fs-micro);
  line-height: 1.5;
  color: var(--t1);
  background: var(--bg2);
  border-radius: 0;
}

/* ── preference rows ────────────────────────────────────────────── */
.acct-pref {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-top: 1px solid color-mix(in srgb, var(--bdr) 50%, transparent);
}
.acct-pref:first-of-type { border-top: 0; padding-top: 0 }
.acct-pref-name { display: block; font-size: var(--fs-sm); color: var(--t0) }

/* A segmented control on native radios -- no script, and it keeps keyboard and
 * screen-reader behaviour for free. */
.acct-seg { display: inline-flex; gap: 3px; flex-shrink: 0 }
/* THE HIDDEN RADIO HAS TO BE POSITIONED AGAINST ITS OWN LABEL, and this was the
 * bug that threw the whole page upward when a preference was tapped on a phone.
 *
 * `position: absolute` with no positioned ancestor resolves against the initial
 * containing block -- so these inputs were laid out against the DOCUMENT while
 * the visible chips scrolled inside .acct-wrap. Scroll down to Preferences and
 * the real input is still hundreds of pixels below the fold; tapping the label
 * focuses it, the browser scrolls the focused element into view, and the only
 * thing that can move is `body` -- which is `overflow: hidden` and therefore has
 * no scrollbar and no way back. The navbar slid off the top and stayed there.
 *
 * Anchoring to the label puts the focus box exactly on the chip you pressed, so
 * "scroll it into view" has nothing to do. */
.acct-seg label { position: relative; display: inline-flex }
.acct-seg input {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  pointer-events: none;
}
.acct-seg span {
  display: inline-block;
  padding: 3px 9px;
  font-family: var(--font-badge);
  font-size: var(--fs-micro);
  font-weight: 700;
  letter-spacing: .04em;
  color: var(--t2);
  border: 1px solid var(--bdr);
  border-radius: 0;
  cursor: pointer;
  transition: color .13s, background .13s, border-color .13s;
}
.acct-seg label:hover span          { color: var(--t0); border-color: var(--t2) }
.acct-seg input:checked + span      { color: var(--bg1); background: var(--t0); border-color: var(--t0) }
.acct-seg input:focus-visible + span { outline: 2px solid var(--acc); outline-offset: 2px }

/* ── notes + the identity block ─────────────────────────────────── */
/* NOT for the outcome of a save any more -- those are toasts (shared/toast.js),
 * on both this page and /admin. What is left is the standing warning: text that
 * is true for as long as the page says it, and therefore belongs in the page.
 * One reader today, the admin spend panel's "unpriced calls" line, which is why
 * the -ok variant is gone and -bad stayed. */
.acct-note {
  margin: 12px 0 0;
  padding: 8px 11px;
  font-size: var(--fs-caption);
  line-height: 1.45;
  border-radius: 0;
}
.acct-bad { color: var(--err);
            background: color-mix(in srgb, var(--err) 10%, transparent) }

/* The identity fields. Visibly not a form -- these are shown so people can
 * check them and see who to ask, not so they look editable and then aren't. */
/* Narrow labels: this card sits in the 320px column, so 150px of label left the
 * email nowhere to go. */
.acct-readonly dl {
  display: grid;
  grid-template-columns: 104px 1fr;
  gap: 7px 12px;
  margin: 0;
  font-size: var(--fs-sm);
  overflow-wrap: anywhere;
}
.acct-readonly dt { color: var(--t2) }
.acct-readonly dd { margin: 0; color: var(--t0) }

/* Sign out everywhere lives in the foot of that same card. It was a separate
 * red-outlined box before, which read as a fifth setting; it is not a setting,
 * it is something you do to the account described directly above it. The rule
 * above it does the separating that the outline used to. */
.acct-signout {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid color-mix(in srgb, var(--bdr) 50%, transparent);
}
.acct-signout > span { flex: 1 1 170px }
.acct-signout .acct-btn { margin-top: 0 }
