/* ── Profile header card ──────────────────────────────────────── */
.profile-header-card {
  display: flex;
  align-items: flex-start;
  gap: 24px;
  background: var(--c-bg-card);
  border: 0.5px solid var(--c-border);
  border-radius: var(--r-xl);
  padding: 28px 28px 24px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

/* ── Profile avatar ───────────────────────────────────────────── */
.profile-avatar-block {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  flex-shrink: 0;
}

.profile-avatar-wrap {
  position: relative;
  flex-shrink: 0;
  /* Width/height come from the inner stack */
}

/* Stacking container — all children occupy the same 88x88 space */
.avatar-display-stack {
  position: relative;
  width: 88px;
  height: 88px;
  border-radius: 50%;
  flex-shrink: 0;
}

.profile-photo,
.profile-initials-avatar {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  object-fit: cover;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 600;
  color: #fff;
  letter-spacing: -1px;
  user-select: none;
  transition: opacity 150ms;
}

/* Preview image overlays the current avatar absolutely */
.avatar-preview-overlay {
  position: absolute !important;
  inset: 0;
  width: 88px !important;
  height: 88px !important;
  object-fit: cover;
  border-radius: 50%;
  z-index: 2;
}
.avatar-preview-overlay[hidden] { display: none; }

/* Hover overlay sits on top of the whole stack */
.avatar-hover-overlay {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  cursor: pointer;
  color: transparent;
  font-size: 11px;
  font-weight: 500;
  transition: background 180ms, color 180ms;
  z-index: 3;
}
.avatar-hover-overlay i { font-size: 20px; }

.profile-avatar-wrap:hover .avatar-hover-overlay,
.profile-avatar-wrap.drag-over .avatar-hover-overlay {
  background: rgba(0, 0, 0, 0.52);
  color: #fff;
}

/* Drag-over highlight — outline the stack, not the children */
.profile-avatar-wrap.drag-over .avatar-display-stack {
  outline: 3px solid var(--c-blue);
  outline-offset: 2px;
  border-radius: 50%;
}

/* Upload confirm / cancel buttons row */
.avatar-upload-controls {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}
.avatar-upload-controls[hidden] { display: none; }

/* Remove photo link */
.btn-link-danger {
  background: none;
  border: none;
  color: var(--c-red);
  cursor: pointer;
  font-size: 12px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  text-decoration: none;
}
.btn-link-danger:hover { text-decoration: underline; }

/* Avatar error message */
.avatar-error-msg {
  color: var(--c-red);
  font-size: 12px;
  margin-top: 6px;
  max-width: 200px;
}

.profile-identity {
  flex: 1;
  min-width: 200px;
}

.profile-name {
  font-size: 22px;
  font-weight: 500;
  margin: 0 0 6px;
  color: var(--c-text-primary);
}

.profile-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--c-text-secondary);
  margin-bottom: 8px;
}

.profile-meta-sep {
  color: var(--c-border-strong);
}

.profile-bio {
  font-size: 13px;
  color: var(--c-text-secondary);
  max-width: 440px;
  line-height: 1.5;
  margin: 0;
}

.profile-stats-strip {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  margin-left: auto;
}

.profile-stat {
  text-align: center;
  min-width: 64px;
}

.ps-value {
  display: block;
  font-size: 26px;
  font-weight: 500;
  line-height: 1;
  color: var(--c-navy);
}

.ps-value.stat-green {
  color: var(--c-green);
}

.ps-value.stat-amber {
  color: var(--c-amber);
}

.ps-label {
  display: block;
  font-size: 11px;
  color: var(--c-text-muted);
  margin-top: 4px;
  white-space: nowrap;
}

/* ── 2×2 grid ─────────────────────────────────────────────────── */
.profile-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

@media (max-width: 900px) {
  .profile-grid {
    grid-template-columns: 1fr;
  }
}

.profile-section {
  background: var(--c-bg-card);
  border: 0.5px solid var(--c-border);
  border-radius: var(--r-lg);
  padding: 20px 22px;
}

.section-heading {
  font-size: 14px;
  font-weight: 500;
  margin: 0 0 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--c-border);
  color: var(--c-text-primary);
}

.subsection-heading {
  font-size: 13px;
  font-weight: 500;
  margin: 16px 0 10px;
  color: var(--c-text-primary);
}

.section-desc {
  font-size: 13px;
  color: var(--c-text-muted);
  margin-bottom: 14px;
}

.section-divider {
  border: none;
  border-top: 1px solid var(--c-border);
  margin: 20px 0;
}

/* ── Read-only definition list ────────────────────────────────── */
.profile-dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 16px;
  font-size: 13px;
  margin: 0;
}

.profile-dl dt {
  color: var(--c-text-muted);
  white-space: nowrap;
}

.profile-dl dd {
  margin: 0;
  font-weight: 500;
}

/* ── Skill chips ──────────────────────────────────────────────── */
.skill-chip {
  display: inline-block;
  padding: 2px 9px;
  background: var(--c-navy-light);
  color: var(--c-navy);
  border: 1px solid var(--c-navy-border);
  border-radius: 999px;
  font-size: 11px;
  margin: 2px 2px 2px 0;
}

/* ── Signature area ───────────────────────────────────────────── */
.sig-textarea {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  resize: vertical;
}

.sig-preview {
  background: var(--c-bg-hover);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  padding: 12px 14px;
  margin-top: 8px;
  margin-bottom: 12px;
}

.sig-preview-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--c-text-muted);
  margin: 0 0 6px;
}

.sig-preview-body {
  font-size: 13px;
  white-space: pre-wrap;
  color: var(--c-text-secondary);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  margin: 0;
}

/* ── Notification toggles ─────────────────────────────────────── */
.notif-list {
  display: flex;
  flex-direction: column;
}

.notif-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 0.5px solid var(--c-border);
  cursor: pointer;
}

.notif-row:last-child {
  border-bottom: none;
}

.notif-info {
  flex: 1;
}

.notif-title {
  display: block;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--c-text-primary);
}

.notif-desc {
  display: block;
  font-size: 12px;
  color: var(--c-text-muted);
  margin-top: 2px;
}

.toggle-checkbox {
  appearance: none;
  -webkit-appearance: none;
  width: 40px;
  height: 22px;
  border-radius: 999px;
  background: var(--c-border-strong);
  border: 2px solid var(--c-border-strong);
  cursor: pointer;
  position: relative;
  transition: background 200ms, border-color 200ms;
  flex-shrink: 0;
  margin: 0;
}

.toggle-checkbox::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  top: 1px;
  left: 1px;
  transition: left 200ms;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.toggle-checkbox:checked {
  background: var(--c-green);
  border-color: var(--c-green);
}

.toggle-checkbox:checked::after {
  left: 19px;
}

/* ── Security section ─────────────────────────────────────────── */
.security-info-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 0.5px solid var(--c-border);
  font-size: 13px;
}

.security-info-row:last-of-type {
  border-bottom: none;
}

.security-info-row i {
  font-size: 18px;
  color: var(--c-text-muted);
  flex-shrink: 0;
}

.sec-label {
  display: block;
  font-size: 11px;
  color: var(--c-text-muted);
}

.sec-value {
  display: block;
  font-weight: 500;
  color: var(--c-text-primary);
}

.sec-value.status-green {
  color: var(--c-green);
}

.sec-value.status-red {
  color: var(--c-red);
}

/* ── Password strength bar ────────────────────────────────────── */
.pw-strength-bar {
  height: 4px;
  border-radius: 999px;
  background: var(--c-border);
  overflow: hidden;
  margin: 6px 0 4px;
}

.pw-strength-fill {
  height: 100%;
  border-radius: 999px;
  width: 0;
  transition: width 200ms, background 200ms;
}

.pw-match-hint {
  font-size: 11.5px;
}

.pw-match-ok {
  color: var(--c-green);
}

.pw-match-fail {
  color: var(--c-red);
}

/* ── Quick links strip ────────────────────────────────────────── */
.profile-quick-links {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.pql-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--r-md);
  background: var(--c-bg-card);
  border: 1px solid var(--c-border);
  font-size: 13px;
  color: var(--c-text-primary);
  text-decoration: none;
  transition: background 120ms;
}

.pql-btn:hover {
  background: var(--c-navy-light);
  color: var(--c-navy);
  border-color: var(--c-navy-border);
  text-decoration: none;
}

.pql-btn i {
  font-size: 15px;
}

.form-required {
  color: var(--c-red);
}

/* ── Topbar profile button (extension to topbar) ──────────────── */
.topbar-profile-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--c-text-primary);
  padding: 4px 8px;
  border-radius: var(--r-md);
  transition: background 120ms;
  border: none;
  background: transparent;
  cursor: pointer;
  font: inherit;
}

.topbar-profile-btn:hover {
  background: var(--c-bg-hover);
  text-decoration: none;
}

.topbar-avatar-photo {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  object-fit: cover;
}

.topbar-avatar-initials {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  background: var(--c-navy);
  flex-shrink: 0;
}

.topbar-agent-name {
  font-size: 13px;
  font-weight: 500;
}

@media (max-width: 768px) {
  .topbar-agent-name {
    display: none;
  }
}
