/* The account menu's header row and the Account page.
   Its own file rather than more of styles.css, which is past 2,000 lines.
   Every colour is a token from styles.css, so both themes come for free. */

/* ---- A person's avatar: photo, or initials on a tone ----
   The tones are the company avatars' eight (styles.css, avatarTone in
   shared-ui.js), so an account gets a colour of its own in both themes. */
.person-avatar {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  border-radius: 50%; overflow: hidden;
  background: var(--avatar-bg, var(--accent2-soft)); color: var(--avatar-fg, var(--accent2-dark));
  font-family: 'Space Grotesk', sans-serif; font-weight: 700;
}
.person-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }

.profile-avatar.person-avatar { border-color: transparent; }
.profile-avatar.person-avatar:hover { background: var(--avatar-bg, var(--accent2-soft)); filter: brightness(0.94); }
/* A photo fills the whole circle: the initials' 1px border would shrink it to 28px. */
.profile-avatar.has-photo { border-width: 0; box-shadow: 0 0 0 1px var(--border); }

/* ---- Account menu header ---- */
.account-menu-head { display: flex; align-items: center; gap: 12px; padding: 8px 10px 10px; }
.account-menu-photo { width: 42px; height: 42px; font-size: 15px; }
.account-menu-who { min-width: 0; }
.account-menu-head .account-menu-label {
  text-transform: none; letter-spacing: 0; padding: 0;
  font-size: 14px; font-weight: 700; color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 180px;
}
.account-menu-email {
  font-size: 12px; color: var(--muted); margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 180px;
}
.account-menu-email:empty { display: none; }

/* ---- Page layout: side menu + sections ---- */
.settings-layout {
  display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 32px; align-items: start;
}
.settings-nav {
  display: flex; flex-direction: column; gap: 2px;
  position: sticky; top: 88px;
}
.settings-nav .subtab-btn {
  display: flex; align-items: center; gap: 10px; width: 100%;
  margin: 0; padding: 10px 12px; border: none; border-radius: 8px;
  text-align: left; font-size: 14px; font-weight: 600; color: var(--muted-strong);
  position: relative;
}
.settings-nav .subtab-btn svg { width: 17px; height: 17px; flex: none; }
.settings-nav .subtab-btn:hover { background: var(--surface-soft); color: var(--ink); opacity: 1; }
.settings-nav .subtab-btn.active { background: var(--neutral-bg); color: var(--ink); }
.settings-nav .subtab-btn.active::before {
  content: ''; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px;
  border-radius: 3px; background: var(--accent);
}
.settings-panels { min-width: 0; }
.settings-panels .card { margin-bottom: 20px; }
.settings-panels h2 { margin-bottom: 12px; }

/* ---- Shared bits ---- */
.account-hint { font-size: 13px; color: var(--muted); line-height: 1.55; margin: 0 0 12px; }
.account-note { margin: 14px 0 0; }
.account-status { font-size: 13px; color: var(--muted); }
.account-status:empty { display: none; }
.account-photo-side .account-status { display: block; margin-top: 6px; }
.account-error { font-size: 13px; color: var(--danger); margin: 10px 0 0; }
.account-error:empty { display: none; }
.account-form { margin-top: 18px; }
.account-form .form-grid { margin-bottom: 8px; }
.account-form-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 14px; }
.account-form-actions button { margin: 0; }
.account-card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 4px; }
.account-card-head h2 { margin: 0; }
.account-card-head button { margin: 0; padding: 8px 14px; }

/* A download is a link, dressed as the ghost button beside it. */
.account-button-link {
  display: inline-flex; align-items: center; margin-top: 4px; padding: 10px 20px;
  border-radius: var(--radius-sm); font-family: 'Space Grotesk', 'Inter', sans-serif;
  font-size: 13.5px; font-weight: 600; text-decoration: none;
}
.account-button-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---- Profile ---- */
.account-photo-row { display: flex; align-items: center; gap: 22px; }
.account-photo-large { width: 96px; height: 96px; font-size: 32px; box-shadow: 0 0 0 4px var(--surface), 0 0 0 5px var(--border); }
.account-photo-side { min-width: 0; }
.account-photo-actions { display: flex; align-items: center; gap: 14px; margin-bottom: 8px; }
.account-photo-actions button { margin: 0; }
.account-photo-actions .btn-link { font-size: 13.5px; color: var(--muted-strong); }
.account-photo-actions .btn-ghost { padding: 8px 16px; }

.account-facts { margin: 0; }
.account-facts > div {
  display: grid; grid-template-columns: 160px minmax(0, 1fr); gap: 12px;
  padding: 11px 0; border-top: 1px solid var(--border);
}
.account-facts > div:first-child { border-top: none; padding-top: 0; }
.account-facts dt { font-size: 13px; color: var(--muted); }
.account-facts dd { margin: 0; font-size: 14px; color: var(--ink); overflow-wrap: anywhere; }
.account-facts dd .btn-link { margin-left: 8px; font-size: 13px; }

/* ---- Where you're signed in ---- */
.account-session {
  display: flex; align-items: center; gap: 14px; padding: 13px 0; border-top: 1px solid var(--border);
}
.account-session:first-child { border-top: none; }
.account-session-icon {
  width: 38px; height: 38px; flex: none; border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--neutral-bg); color: var(--muted-strong);
}
.account-session.is-current .account-session-icon { background: var(--accent-soft); color: var(--accent-dark); }
.account-session-icon svg { width: 19px; height: 19px; }
.account-session-main { flex: 1; min-width: 0; }
.account-session-device { font-size: 14px; font-weight: 600; color: var(--ink); }
.account-session-meta { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.account-session-badge {
  flex: none; font-size: 11.5px; font-weight: 700; padding: 4px 10px; border-radius: var(--radius-pill);
  background: var(--accent-soft); color: var(--accent-dark); border: 1px solid var(--accent-border);
}
.account-session button { margin: 0; padding: 7px 14px; flex: none; }

/* ---- Browser extension ---- */
.account-steps { margin: 4px 0 18px; padding: 0; list-style: none; counter-reset: step; }
.account-steps li {
  counter-increment: step; position: relative; padding: 5px 0 5px 36px;
  font-size: 14px; color: var(--text); line-height: 1.5;
}
.account-steps li::before {
  content: counter(step); position: absolute; left: 0; top: 4px;
  width: 24px; height: 24px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--neutral-bg); color: var(--ink); font-size: 12.5px; font-weight: 700;
}
.account-key { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.account-key button { margin: 0; }
.account-key-value {
  flex: 1; min-width: 0; font-size: 12.5px; line-height: 1.45; word-break: break-all;
  background: var(--surface-soft); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 10px 12px; color: var(--ink); user-select: all;
}
.account-key + .account-status { display: block; margin-top: 8px; }

/* ---- Plan ---- */
.plan-card { border-top: 3px solid var(--accent); }
.plan-eyebrow { font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.plan-name { font-family: 'Space Grotesk', sans-serif; font-size: 32px; font-weight: 700; color: var(--ink); margin: 4px 0 2px; }
.plan-lead { font-size: 15px; color: var(--text); margin: 0 0 14px; }
.plan-features { list-style: none; margin: 0; padding: 0; }
.plan-features li { position: relative; padding: 5px 0 5px 28px; font-size: 14px; color: var(--text); }
.plan-features li::before {
  content: ''; position: absolute; left: 2px; top: 9px; width: 14px; height: 8px;
  border-left: 2.5px solid var(--accent); border-bottom: 2.5px solid var(--accent);
  transform: rotate(-45deg);
}

/* ---- Your data ---- */
.account-danger-card { border-color: var(--danger-border); }
.account-danger-card h2 { color: var(--danger); }
.settings-panels .card > button { margin-top: 4px; }

/* ---- Dialogs ---- */
.account-dialog { max-width: 460px; }
.account-dialog-lead { font-size: 13.5px; color: var(--text); margin: 0 0 8px; line-height: 1.55; }
.account-dialog-note {
  font-size: 13px; color: var(--text); margin: 0 0 10px; line-height: 1.55; padding: 10px 12px;
  border-radius: var(--radius-sm); background: var(--surface-soft); border: 1px solid var(--border);
}
.account-dialog-note[hidden] { display: none; }
.account-dialog-list { margin: 0 0 14px; padding-left: 20px; font-size: 13.5px; color: var(--text); line-height: 1.7; }
.account-dialog form { margin-top: 18px; }
.account-dialog .field { margin-bottom: 12px; }
.account-dialog form button { margin-top: 12px; }
.account-dialog form .btn-ghost { margin-left: 10px; }

/* ---- Photo crop ---- */
.avatar-crop-card { max-width: 520px; }
.avatar-crop-body { display: flex; align-items: center; gap: 24px; margin: 6px 0 14px; }
.avatar-crop-stage {
  position: relative; width: 280px; height: 280px; flex: none;
  border-radius: 12px; overflow: hidden; background: var(--neutral-bg);
  cursor: grab; touch-action: none; user-select: none;
}
.avatar-crop-stage:active { cursor: grabbing; }
.avatar-crop-stage:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.avatar-crop-stage canvas { display: block; width: 280px; height: 280px; }
.avatar-crop-ring {
  position: absolute; inset: 0; border-radius: 50%; pointer-events: none;
  box-shadow: 0 0 0 999px rgba(15, 23, 42, 0.55);
  outline: 2px solid rgba(255, 255, 255, 0.85); outline-offset: -2px;
}
.avatar-crop-previews { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.avatar-crop-preview { border-radius: 50%; background: var(--neutral-bg); box-shadow: 0 0 0 1px var(--border); }
.avatar-crop-zoom { display: flex; align-items: center; gap: 12px; }
.avatar-crop-zoom label { margin: 0; }
.avatar-crop-zoom input[type="range"] {
  flex: 1; padding: 0; border: none; background: none; accent-color: var(--accent);
}
.avatar-crop-zoom input[type="range"]:focus { outline: 2px solid var(--accent); outline-offset: 4px; }

/* ---- Phones: the side menu becomes a row of section tabs ---- */
@media (max-width: 760px) {
  .settings-layout { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .settings-nav {
    position: static; flex-direction: row; overflow-x: auto; gap: 6px;
    padding-bottom: 4px; scrollbar-width: none;
  }
  .settings-nav::-webkit-scrollbar { display: none; }
  .settings-nav .subtab-btn {
    width: auto; flex: none; white-space: nowrap; min-height: 44px;
    padding: 10px 14px; background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-pill);
  }
  .settings-nav .subtab-btn.active { background: var(--ink); color: var(--on-ink); border-color: var(--ink); }
  .settings-nav .subtab-btn.active::before { display: none; }
  .account-photo-row { flex-direction: column; align-items: flex-start; gap: 14px; }
  .account-facts > div { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .account-session { flex-wrap: wrap; }
  .avatar-crop-body { flex-direction: column; }
  .avatar-crop-previews { flex-direction: row; }
}
