/* User profile and security settings */
.app-header > .profile {
  min-width: 0;
  padding: 0;
  border: 0;
  color: inherit;
  background: transparent;
  text-align: right;
}

.app-header > .profile:focus-visible {
  outline: 3px solid rgba(14, 132, 255, .2);
  outline-offset: 4px;
  border-radius: 15px;
}

.profile > span {
  overflow: hidden;
}

.profile > span > img,
.profile-avatar-large > img,
.profile-photo-preview > img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.profile-screen {
  background: var(--modern-canvas, #f5f6f8) !important;
}

.profile-screen .focused-header {
  position: sticky;
  top: -20px;
  z-index: 4;
  padding: 12px 0 10px;
  background: rgba(245, 246, 248, .92);
  -webkit-backdrop-filter: blur(18px) saturate(145%);
  backdrop-filter: blur(18px) saturate(145%);
}

.profile-screen .focused-header > strong {
  color: var(--ink, #18212d);
}

.profile-hero {
  padding: 22px 18px 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  border: 1px solid var(--modern-border, #dce1e7);
  border-radius: 24px;
  background:
    radial-gradient(circle at 18% 12%, rgba(14, 132, 255, .12), transparent 34%),
    linear-gradient(145deg, #fff, #f8fafc);
  box-shadow: 0 10px 28px rgba(20, 30, 43, .07);
  text-align: center;
}

.profile-avatar-wrap {
  position: relative;
}

.profile-avatar-large {
  width: 86px;
  height: 86px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 4px solid #fff;
  border-radius: 50%;
  color: var(--modern-secondary, #2b5484);
  background: #eef4fb;
  box-shadow: 0 0 0 1px var(--modern-border-strong, #c8cfd8), 0 10px 24px rgba(20, 30, 43, .12);
}

.profile-avatar-large > svg {
  width: 34px;
  height: 34px;
  stroke-width: 1.65;
}

.profile-photo-edit {
  width: 34px;
  height: 34px;
  position: absolute;
  left: -5px;
  bottom: -2px;
  display: grid;
  place-items: center;
  border: 3px solid #fff;
  border-radius: 50%;
  color: #fff;
  background: var(--modern-primary, #0056f5);
  box-shadow: 0 5px 13px rgba(0, 86, 245, .24);
}

.profile-photo-edit svg {
  width: 15px;
  height: 15px;
}

.profile-hero h1 {
  margin: 16px 0 1px;
}

.profile-hero > p {
  margin: 0;
  color: var(--muted, #68727e);
  direction: ltr;
}

.profile-identity-badges {
  margin-top: 13px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 7px;
}

.profile-identity-badges > span {
  min-height: 28px;
  padding: 4px 9px;
  display: flex;
  align-items: center;
  gap: 5px;
  border: 1px solid #d5e2f0;
  border-radius: 999px;
  color: var(--modern-secondary, #2b5484);
  background: #f1f6fc;
}

.profile-identity-badges svg {
  width: 13px;
  height: 13px;
}

.profile-section {
  margin-top: 25px;
}

.profile-section > header {
  margin: 0 3px 9px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
}

.profile-section > header h2 {
  margin: 0;
}

.profile-section > header small {
  color: var(--muted, #68727e);
}

.profile-menu-card,
.profile-biometric-card {
  overflow: hidden;
  border: 1px solid var(--modern-border, #dce1e7);
  border-radius: 19px;
  background: #fff;
  box-shadow: 0 7px 20px rgba(20, 30, 43, .045);
}

.profile-menu-row {
  width: 100%;
  min-height: 70px;
  padding: 10px 13px;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 17px;
  align-items: center;
  gap: 11px;
  border: 0;
  border-bottom: 1px solid var(--modern-border, #dce1e7);
  background: #fff;
  text-align: right;
}

.profile-menu-row:last-child {
  border-bottom: 0;
}

.profile-menu-row:active {
  background: #f7f9fb;
}

.profile-row-icon,
.profile-device-icon {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  color: var(--modern-secondary, #2b5484);
  background: #eef3f8;
}

.profile-row-icon svg,
.profile-device-icon svg {
  width: 19px;
  height: 19px;
}

.profile-menu-row > span:nth-child(2) {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.profile-menu-row > span:nth-child(2) small {
  overflow: hidden;
  color: var(--muted, #68727e);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-menu-row > svg {
  width: 16px;
  height: 16px;
  color: #87919d;
}

.profile-biometric-card {
  margin-bottom: 9px;
  padding: 14px;
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
}

.profile-biometric-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 15px;
  color: #fff;
  background: linear-gradient(145deg, var(--modern-primary, #0056f5), var(--modern-primary-bright, #0e84ff));
}

.profile-biometric-mark svg {
  width: 23px;
  height: 23px;
}

.profile-biometric-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.profile-biometric-copy small {
  color: var(--muted, #68727e);
}

.profile-switch {
  width: 48px;
  height: 28px;
  position: relative;
  display: block;
  flex: 0 0 auto;
}

.profile-switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.profile-switch i {
  position: absolute;
  inset: 0;
  border: 1px solid #c8cfd8;
  border-radius: 999px;
  background: #e6e9ed;
  transition: background .2s ease, border-color .2s ease;
}

.profile-switch i::after {
  content: "";
  width: 22px;
  height: 22px;
  position: absolute;
  top: 2px;
  right: 2px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 7px rgba(20, 30, 43, .22);
  transition: transform .2s ease;
}

.profile-switch input:checked + i {
  border-color: var(--modern-primary, #0056f5);
  background: var(--modern-primary, #0056f5);
}

.profile-switch input:checked + i::after {
  transform: translateX(-20px);
}

.profile-switch input:focus-visible + i {
  outline: 3px solid rgba(14, 132, 255, .22);
  outline-offset: 2px;
}

.profile-logout-button {
  width: 100%;
  min-height: 56px;
  margin-top: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid #e4c8c8;
  border-radius: 16px;
  color: #a02f2f;
  background: #fff7f7;
}

.profile-logout-button svg {
  width: 19px;
  height: 19px;
  transform: rotate(180deg);
}

.profile-version {
  margin: 13px 0 0;
  color: var(--muted, #68727e);
  text-align: center;
}

.profile-sheet-form .field {
  margin-bottom: 12px;
}

.profile-sheet-form .field input[readonly] {
  color: #7d8792;
}

.profile-form-error {
  margin: 0 2px 8px !important;
  color: #a02f2f !important;
}

.profile-photo-preview {
  width: 94px;
  height: 94px;
  margin: 2px auto 19px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--modern-border-strong, #c8cfd8);
  border-radius: 50%;
  color: var(--modern-secondary, #2b5484);
  background: #eef4fb;
}

.profile-photo-preview svg {
  width: 35px;
  height: 35px;
}

.profile-photo-actions {
  display: grid;
  gap: 8px;
}

.profile-photo-actions button {
  min-height: 52px;
  border: 1px solid var(--modern-border, #dce1e7);
  border-radius: 14px;
  background: #fff;
}

.profile-photo-actions button:first-child {
  color: #fff;
  border-color: var(--modern-primary, #0056f5);
  background: var(--modern-primary, #0056f5);
}

.profile-photo-actions button:disabled {
  opacity: .42;
  cursor: default;
}

.profile-device-summary {
  margin: 0 0 11px !important;
  color: var(--muted, #68727e);
}

.profile-device-list {
  overflow: hidden;
  border: 1px solid var(--modern-border, #dce1e7);
  border-radius: 17px;
}

.profile-device-row {
  min-height: 80px;
  padding: 11px;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--modern-border, #dce1e7);
}

.profile-device-row:last-child {
  border-bottom: 0;
}

.profile-device-row > span:nth-child(2) {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.profile-device-row small {
  color: var(--muted, #68727e);
}

.profile-device-row > b {
  padding: 5px 8px;
  border-radius: 999px;
  color: #25704a;
  background: #eaf7f0;
  white-space: nowrap;
}

.profile-device-row > button {
  min-height: 34px;
  padding: 0 9px;
  border: 1px solid #e4c8c8;
  border-radius: 10px;
  color: #a02f2f;
  background: #fff8f8;
}

.profile-device-all {
  margin-top: 12px !important;
}

.profile-logout-note {
  margin: 0 0 18px !important;
  padding: 12px;
  border-radius: 14px;
  color: var(--muted, #68727e) !important;
  background: #f4f6f8;
}

.profile-logout-confirm {
  color: #fff !important;
  border-color: #9f3030 !important;
  background: #9f3030 !important;
}

@media (max-width: 767px) {
  .profile-screen .focused-header {
    top: -20px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .profile-switch i,
  .profile-switch i::after {
    transition: none;
  }
}

/* The visible selection border distinguishes the crop from the dimmed photo. */
.profile-crop-stage {
  position: relative;
  direction: ltr;
  margin: 16px auto;
  overflow: hidden;
  max-width: 100%;
  background: #20242a;
}
.profile-crop-stage > img {
  display: block;
  width: 100%;
  height: 100%;
  user-select: none;
}
.profile-crop-stage > .profile-crop-frame {
  position: absolute;
  min-height: 0;
  padding: 0;
  border: 2px solid white;
  border-radius: 0;
  background: transparent;
  box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .55);
  transition: none;
  cursor: move;
  touch-action: none;
}
.profile-crop-frame:focus-visible {
  outline: 3px solid var(--modern-primary, #0056f5);
  outline-offset: -5px;
}
.profile-crop-size {
  display: grid;
  gap: 8px;
  margin: 16px 0;
}
.profile-crop-size input {
  width: 100%;
  min-height: 48px;
  accent-color: var(--modern-primary, #0056f5);
}
