/**
 * account-settings.css — the account panel popover (account-panel.js), the
 * profile modal (profile-modal.js), and the settings modal (settings-modal.js).
 * Light builder chrome, standard --pb-* tokens; z-index handled by the
 * popover/modal primitives. 640px = the canonical phone breakpoint.
 */

/* ═══ Shared avatar (chip / panel / profile / settings) ═══ */
.pb-ap-avatar {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--pb-accent), var(--pb-accent-section));
  color: #fff;
  font-size: 12px;
  font-weight: 650;
  overflow: hidden;
  user-select: none;
}
.pb-account-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}
/* The toolbar chip's small avatar also hosts <img> now */
.pb-auth-chip-avatar .pb-account-avatar-img {
  border-radius: 50%;
}

/* ═══ Account panel popover ═══ */
.pb-account-panel {
  padding: var(--pb-space-4);
}
.pb-ap-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 6px 10px;
  border-bottom: 1px solid var(--pb-border);
  margin-bottom: 5px;
}
.pb-ap-id {
  min-width: 0;
}
.pb-ap-name {
  margin: 0;
  font-size: var(--pb-font-md);
  font-weight: 600;
  color: var(--pb-text-bright);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pb-ap-meta {
  margin: 2px 0 0;
  font-size: var(--pb-font-sm);
  color: var(--pb-text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pb-ap-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  border-radius: var(--pb-radius-md);
  padding: 8px 10px;
  color: var(--pb-text);
  font: inherit;
  font-size: var(--pb-font-md);
  cursor: pointer;
  transition: background var(--pb-transition);
}
.pb-ap-item:hover,
.pb-ap-item:focus-visible {
  background: var(--pb-bg-hover);
  outline: none;
  box-shadow: none;
}
.pb-ap-item svg {
  flex: none;
  color: var(--pb-text-dim);
}
.pb-ap-divider {
  height: 1px;
  margin: 6px 4px;
  background: var(--pb-border);
}
.pb-ap-danger,
.pb-ap-danger svg {
  color: var(--pb-danger);
}
.pb-ap-danger:hover,
.pb-ap-danger:focus-visible {
  background: var(--pb-danger-muted);
}

/* ═══ Profile modal ═══ */
.pb-profile-body {
  display: flex;
  flex-direction: column;
  gap: var(--pb-space-6);
}
.pb-profile-avatar-row {
  display: flex;
  align-items: center;
  gap: var(--pb-space-6);
}
.pb-profile-avatar-btn {
  position: relative;
  flex: none;
  width: 68px;
  height: 68px;
  border: 0;
  padding: 0;
  border-radius: 50%;
  cursor: pointer;
  background: none;
}
.pb-profile-avatar {
  width: 100%;
  height: 100%;
  font-size: 22px;
}
.pb-profile-avatar-edit {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--pb-accent);
  color: var(--pb-on-accent);
  box-shadow: 0 2px 8px var(--pb-accent-glow);
}
.pb-profile-hint {
  margin: 0;
  font-size: var(--pb-font-sm);
  color: var(--pb-text-dim);
  line-height: 1.5;
}
.pb-profile-error {
  margin: 0;
  font-size: var(--pb-font-base);
  color: var(--pb-danger);
}

/* ═══ Settings modal (rail + panes) ═══ */
.pb-settings-modal-overlay .pb-modal {
  width: min(880px, calc(100vw - 32px));
  height: min(600px, calc(100dvh - 48px));
  max-width: none;
  display: flex;
  flex-direction: column;
}
.pb-settings-modal-overlay .pb-modal-body {
  flex: 1;
  min-height: 0;
  display: flex;
  padding: 0;
  overflow: hidden;
}
.pb-set-rail {
  flex: none;
  width: 200px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 14px 10px;
  border-right: 1px solid var(--pb-border);
  overflow-y: auto;
}
.pb-set-rail-btn {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  border: 0;
  background: transparent;
  border-radius: var(--pb-radius-md);
  padding: 8px 11px;
  color: var(--pb-text);
  font: inherit;
  font-size: var(--pb-font-md);
  text-align: left;
  cursor: pointer;
  transition: background var(--pb-transition), color var(--pb-transition);
}
.pb-set-rail-btn:hover {
  background: var(--pb-bg-hover);
}
.pb-set-rail-btn.pb-set-rail-active {
  background: var(--pb-bg-hover);
  color: var(--pb-text-bright);
  font-weight: 600;
}
.pb-set-rail-btn svg {
  flex: none;
  color: var(--pb-text-dim);
}
.pb-set-rail-btn.pb-set-rail-active svg {
  color: var(--pb-accent);
}
.pb-set-panes {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  padding: 18px 24px 26px;
}
.pb-set-pane[hidden] { display: none; }
@keyframes pb-set-pane-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}
.pb-set-pane {
  animation: pb-set-pane-in 0.3s ease;
}
.pb-set-title {
  margin: 6px 0 2px;
  font-size: var(--pb-font-xl);
  font-weight: 650;
  color: var(--pb-text-bright);
}
.pb-set-sub {
  margin: 0 0 18px;
  font-size: var(--pb-font-base);
  color: var(--pb-text-dim);
  line-height: 1.5;
}
.pb-set-card {
  border: 1px solid var(--pb-border);
  border-radius: var(--pb-radius-lg);
  background: var(--pb-surface-2);
  padding: 4px 0;
  margin-bottom: var(--pb-space-6);
}
.pb-set-row {
  display: flex;
  align-items: center;
  gap: var(--pb-space-6);
  padding: 12px 16px;
}
.pb-set-row + .pb-set-row {
  border-top: 1px solid var(--pb-border);
}
.pb-set-row-main {
  flex: 1;
  min-width: 0;
}
.pb-set-row-label {
  margin: 0;
  font-size: var(--pb-font-md);
  font-weight: 600;
  color: var(--pb-text-bright);
}
.pb-set-row-hint {
  margin: 2px 0 0;
  font-size: var(--pb-font-sm);
  color: var(--pb-text-dim);
  line-height: 1.45;
}
.pb-set-row .pb-field {
  margin: 0;
}
.pb-set-row-control {
  flex: none;
  display: flex;
  align-items: center;
  gap: var(--pb-space-3);
}
.pb-set-row-control .pb-field-input {
  width: 200px;
}

/* Toggle switch (settings rows) */
.pb-set-toggle {
  position: relative;
  width: 38px;
  height: 22px;
  flex: none;
}
.pb-set-toggle input {
  position: absolute;
  opacity: 0;
  inset: 0;
  margin: 0;
  cursor: pointer;
}
.pb-set-toggle-track {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: var(--pb-surface-3);
  border: 1px solid var(--pb-border);
  transition: background var(--pb-transition-slow), border-color var(--pb-transition-slow);
  pointer-events: none;
}
.pb-set-toggle-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  transition: transform var(--pb-transition-spring);
  pointer-events: none;
}
.pb-set-toggle input:checked ~ .pb-set-toggle-track {
  background: var(--pb-accent);
  border-color: var(--pb-accent);
}
.pb-set-toggle input:checked ~ .pb-set-toggle-thumb {
  transform: translateX(16px);
}
.pb-set-toggle input:focus-visible ~ .pb-set-toggle-track {
  box-shadow: 0 0 0 3px var(--pb-accent-glow);
}

/* Account pane: profile card + passkeys */
.pb-set-profile {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 16px;
  margin-bottom: var(--pb-space-6);
  border: 1px solid var(--pb-border);
  border-radius: var(--pb-radius-lg);
  background: var(--pb-surface-2);
}
.pb-set-profile .pb-ap-avatar {
  width: 52px;
  height: 52px;
  font-size: 17px;
}
.pb-set-profile-info {
  flex: 1;
  min-width: 0;
}
.pb-set-profile-name {
  margin: 0;
  font-size: var(--pb-font-lg);
  font-weight: 650;
  color: var(--pb-text-bright);
}
.pb-set-profile-email {
  margin: 2px 0 0;
  font-size: var(--pb-font-base);
  color: var(--pb-text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pb-set-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--pb-space-6);
  margin: 0 0 10px;
}
.pb-set-section-head h3 {
  margin: 0;
  font-size: var(--pb-font-md);
  font-weight: 650;
  color: var(--pb-text-bright);
}
.pb-set-passkey-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.pb-set-passkey-row {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 13px 15px;
  border: 1px solid var(--pb-border);
  border-radius: var(--pb-radius-lg);
  background: var(--pb-surface-2);
}
.pb-set-passkey-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: none;
  border-radius: 50%;
  background: var(--pb-accent-muted);
  color: var(--pb-accent);
}
.pb-set-passkey-main {
  flex: 1;
  min-width: 0;
}
.pb-set-passkey-label {
  font-size: var(--pb-font-md);
  font-weight: 600;
  color: var(--pb-text-bright);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pb-set-passkey-meta {
  font-size: var(--pb-font-sm);
  color: var(--pb-text-dim);
  margin-top: 2px;
}
.pb-set-passkey-empty {
  text-align: center;
  padding: 26px 14px;
  color: var(--pb-text-dim);
  font-size: var(--pb-font-base);
  border: 1px dashed var(--pb-border);
  border-radius: var(--pb-radius-lg);
}
.pb-set-note {
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid var(--pb-border);
  border-radius: var(--pb-radius-lg);
  font-size: var(--pb-font-base);
  line-height: 1.55;
  color: var(--pb-text-dim);
  background: var(--pb-surface-2);
}
.pb-set-note b {
  color: var(--pb-text);
}
.pb-set-inline-error {
  margin: 6px 0 0;
  font-size: var(--pb-font-base);
  color: var(--pb-danger);
}
.pb-set-form {
  display: flex;
  flex-direction: column;
  gap: var(--pb-space-5);
  padding: 12px 16px 16px;
}
.pb-set-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--pb-space-4);
}

/* ═══ ≤640px (canonical phone breakpoint) ═══ */
@media (max-width: 640px) {
  .pb-settings-modal-overlay .pb-modal {
    width: calc(100vw - 16px);
    height: calc(100dvh - 32px);
  }
  .pb-settings-modal-overlay .pb-modal-body {
    flex-direction: column;
  }
  .pb-set-rail {
    flex-direction: row;
    width: auto;
    overflow-x: auto;
    overflow-y: hidden;
    border-right: 0;
    border-bottom: 1px solid var(--pb-border);
    padding: 8px 10px;
  }
  .pb-set-rail-btn {
    flex: none;
    width: auto;
  }
  .pb-set-row {
    flex-wrap: wrap;
  }
  .pb-set-row-control .pb-field-input {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .pb-set-pane {
    animation: none;
  }
  .pb-set-toggle-thumb {
    transition-duration: 0.01ms;
  }
}
