/* ── Profile Tab ── */
.profile-panel {
  padding: 16px 16px calc(var(--bottom-nav-height, 76px) + env(safe-area-inset-bottom, 0px) + 24px);
}

/* Identity header (tappable → edit sheet) */
.profile-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 6px 2px 18px;
  width: 100%;
  background: transparent;
  border: none;
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.profile-head:active { opacity: 0.85; }

.profile-avatar {
  flex: 0 0 auto;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent, #38bdf8);
  background: color-mix(in oklch, var(--accent, #38bdf8) 16%, transparent);
  border: 1px solid color-mix(in oklch, var(--accent, #38bdf8) 30%, transparent);
}

.profile-avatar svg { width: 30px; height: 30px; display: block; }
.profile-avatar.has-initials {
  font-family: 'Golos Text', system-ui, sans-serif;
  font-weight: 800;
  font-size: 21px;
  letter-spacing: 0.01em;
}
.profile-avatar-img { width: 100%; height: 100%; object-fit: cover; display: block; }

.profile-identity { min-width: 0; flex: 1 1 auto; }

.profile-edit-chevron {
  flex: 0 0 auto;
  font-size: 22px;
  color: var(--ink-3, #8b93a7);
  line-height: 1;
}

.profile-name {
  font-family: 'Golos Text', system-ui, sans-serif;
  font-size: 19px;
  font-weight: 800;
  color: var(--ink, #eef2f8);
  line-height: 1.15;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-sub {
  margin-top: 3px;
  font-size: 13px;
  color: var(--ink-3, #8b93a7);
}

/* Section titles */
.profile-section-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--ink-3, #8b93a7);
  margin: 18px 4px 8px;
}

.profile-summary-card {
  display: grid;
  grid-template-columns: 40px minmax(74px, 0.8fr) 1px minmax(118px, 1.2fr);
  align-items: center;
  gap: 14px;
  min-height: 76px;
  padding: 14px 16px;
  border: 1px solid var(--hair, rgba(255, 255, 255, 0.08));
  border-radius: var(--radius, 18px);
  background: var(--bg-rise, #16161c);
}

.profile-summary-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent, #38bdf8);
  background: color-mix(in oklch, var(--accent, #38bdf8) 12%, transparent);
}

.profile-summary-icon svg {
  display: block;
  width: 22px;
  height: 22px;
}

.profile-summary-metric {
  min-width: 0;
}

.profile-summary-metric-hours {
  display: flex;
  align-items: baseline;
}

.profile-summary-line {
  display: flex;
  align-items: baseline;
  gap: 4px;
  min-width: 0;
  white-space: nowrap;
}

.profile-summary-divider {
  width: 1px;
  height: 42px;
  background: var(--hair, rgba(255, 255, 255, 0.08));
}

.profile-summary-value {
  color: var(--ink, #eef2f8);
  font-family: 'Golos Text', system-ui, sans-serif;
  font-size: 20px;
  font-weight: 800;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.profile-summary-unit {
  color: var(--ink, #eef2f8);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.1;
}

@media (max-width: 359px) {
  .profile-summary-card {
    grid-template-columns: 36px minmax(62px, 0.75fr) 1px minmax(104px, 1.25fr);
    gap: 10px;
    min-height: 70px;
    padding: 12px;
  }

  .profile-summary-icon {
    width: 36px;
    height: 36px;
    border-radius: 11px;
  }

  .profile-summary-icon svg {
    width: 20px;
    height: 20px;
  }

  .profile-summary-value {
    font-size: 17px;
  }

  .profile-summary-unit {
    font-size: 13px;
  }
}

/* Cards group rows */
.profile-card {
  border: 1px solid var(--hair, rgba(255, 255, 255, 0.08));
  border-radius: var(--radius, 18px);
  background: var(--bg-rise, #16161c);
  overflow: hidden;
}

/* A row inside a card */
.profile-row {
  display: flex;
  align-items: center;
  gap: 13px;
  width: 100%;
  padding: 14px 16px;
  background: transparent;
  border: none;
  text-align: left;
  cursor: pointer;
  color: var(--ink, #eef2f8);
  -webkit-tap-highlight-color: transparent;
}

.profile-row + .profile-row {
  border-top: 1px solid var(--hair, rgba(255, 255, 255, 0.08));
}

.profile-row:active { background: rgba(255, 255, 255, 0.04); }

.profile-row-static { cursor: default; }
.profile-row-static:active { background: transparent; }

.profile-row-icon {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent, #38bdf8);
  background: color-mix(in oklch, var(--accent, #38bdf8) 12%, transparent);
}

.profile-row-icon svg { width: 19px; height: 19px; display: block; }

.profile-row-body {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.profile-row-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink, #eef2f8);
  line-height: 1.2;
}

.profile-row-note {
  font-size: 12.5px;
  color: var(--ink-3, #8b93a7);
  line-height: 1.25;
}

.profile-row-value {
  flex: 0 0 auto;
  color: var(--ink, #eef2f8);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.profile-row-chevron {
  flex: 0 0 auto;
  font-size: 22px;
  color: var(--ink-3, #8b93a7);
  line-height: 1;
}

/* Rows for features not migrated yet */
.profile-soon { opacity: 0.62; }

/* Full-width field row in the profile edit sheet — stacks the label above a
   full-width control so a glass dropdown spans the card (no right-edge clip). */
.profile-field-row {
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
}
.profile-field-row .glass-select { width: 100%; }

/* Mini avatars inside a glass-select menu (e.g. recipient picker) */
.glass-select-option.has-avatar {
  display: flex;
  align-items: center;
  gap: 10px;
}
.glass-select-option-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.glass-select-avatar {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: 'Golos Text', system-ui, sans-serif;
  font-weight: 800;
  font-size: 11px;
  letter-spacing: 0.01em;
}
.glass-select-avatar.is-empty {
  background: transparent;
  border: 1px solid var(--hair-strong, rgba(255, 255, 255, 0.18));
  color: var(--ink-3, #8b93a7);
}
.glass-select-avatar.is-empty svg { width: 14px; height: 14px; }

/* Flip the dropdown menu upward when there's no room below (set by JS). */
.glass-select.is-flip-up .glass-select-menu {
  top: auto;
  bottom: calc(100% + 8px);
}

/* Avatar shown in the trigger (selected value) */
.glass-select-value.has-avatar {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: visible;
}
.glass-select-value-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Tappable avatar in the profile edit sheet */
.profile-edit-avatar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 2px 0 10px;
}
.profile-edit-avatar-trigger {
  position: relative;
  flex: 0 0 auto;
  width: 64px;
  height: 64px;
  padding: 0;
  background: transparent;
  border: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.profile-edit-avatar-trigger:active { transform: scale(0.96); }
.profile-edit-avatar-preview {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent, #38bdf8);
  background: color-mix(in oklch, var(--accent, #38bdf8) 16%, transparent);
  border: 1px solid color-mix(in oklch, var(--accent, #38bdf8) 30%, transparent);
  font-family: 'Golos Text', system-ui, sans-serif;
  font-weight: 800;
  font-size: 23px;
}
.profile-edit-avatar-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.profile-edit-avatar-preview svg { width: 32px; height: 32px; }
.profile-edit-avatar-badge {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent, #38bdf8);
  color: #000e1a;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--bg-rise, #16161c);
}
.profile-edit-avatar-badge svg { width: 13px; height: 13px; }
.profile-edit-avatar-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}
.profile-photo-clear { font-size: 13px; }

/* Canonical railway/depot selection. The controls stay data-driven: adding a
   depot pack changes the catalog JSON, not this layout. */
.profile-depot-card { overflow: visible; }
.profile-catalog-select { width: 100%; }
.profile-catalog-select .glass-select-trigger { width: 100%; }
.profile-custom-depot { margin-top: 8px; }
.profile-depot-coverage {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin: 10px 14px 0;
  padding: 11px 12px;
  border-radius: 13px;
  color: var(--ink-2, #c6cbd8);
  background: color-mix(in oklch, var(--accent, #38bdf8) 8%, transparent);
  font: 500 12px/1.45 'Golos Text', system-ui, sans-serif;
}
.profile-depot-coverage-dot {
  flex: 0 0 auto;
  width: 7px;
  height: 7px;
  margin-top: 5px;
  border-radius: 50%;
  background: var(--ink-3, #8b93a7);
  box-shadow: 0 0 0 4px color-mix(in oklch, var(--ink-3, #8b93a7) 14%, transparent);
}
.profile-depot-coverage.is-ready .profile-depot-coverage-dot {
  background: #34d399;
  box-shadow: 0 0 0 4px color-mix(in oklch, #34d399 15%, transparent);
}
.profile-depot-coverage.is-missing .profile-depot-coverage-dot {
  background: #f59e0b;
  box-shadow: 0 0 0 4px color-mix(in oklch, #f59e0b 15%, transparent);
}
.profile-depot-propose {
  width: calc(100% - 28px);
  margin: 10px 14px 2px;
  min-height: 42px;
  border: 1px solid color-mix(in oklch, var(--accent, #38bdf8) 32%, transparent);
  border-radius: 13px;
  color: var(--accent, #38bdf8);
  background: color-mix(in oklch, var(--accent, #38bdf8) 9%, transparent);
  font: 650 13px/1.2 'Golos Text', system-ui, sans-serif;
}
.profile-depot-moderation,
.profile-legacy-depot-note,
.depot-proposal-note {
  color: var(--ink-3, #8b93a7);
  font: 500 11px/1.45 'Golos Text', system-ui, sans-serif;
}
.profile-depot-moderation { margin: 7px 14px 12px; }
.profile-legacy-depot-note { margin: 9px 4px 0; }
.depot-proposal-sheet {
  width: min(100%, 560px);
  max-height: min(92vh, 760px);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
}
.depot-proposal-sheet::-webkit-scrollbar { display: none; }
.depot-proposal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}
.depot-proposal-subtitle {
  margin-top: 4px;
  color: var(--ink-3, #8b93a7);
  font: 500 12px/1.35 'Golos Text', system-ui, sans-serif;
}
.depot-proposal-close {
  display: grid;
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  color: var(--ink-2, #c6cbd8);
  background: color-mix(in oklch, var(--ink-2, #c6cbd8) 10%, transparent);
  font: 400 25px/1 system-ui, sans-serif;
}
.depot-proposal-depot {
  display: grid;
  gap: 3px;
  margin-bottom: 12px;
  padding: 11px 13px;
  border: 1px solid color-mix(in oklch, var(--ink-2, #c6cbd8) 11%, transparent);
  border-radius: 13px;
  background: color-mix(in oklch, var(--ink-2, #c6cbd8) 5%, transparent);
}
.depot-proposal-depot span {
  color: var(--ink-3, #8b93a7);
  font: 550 10px/1.25 'Golos Text', system-ui, sans-serif;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.depot-proposal-depot strong {
  color: var(--ink-1, #f7f8fb);
  font: 650 13px/1.35 'Golos Text', system-ui, sans-serif;
}
.depot-proposal-mode {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 15px;
}
.depot-proposal-mode-btn {
  display: grid;
  align-content: start;
  gap: 4px;
  min-height: 75px;
  padding: 11px 12px;
  border: 1px solid color-mix(in oklch, var(--ink-2, #c6cbd8) 13%, transparent);
  border-radius: 14px;
  color: var(--ink-2, #c6cbd8);
  background: color-mix(in oklch, var(--ink-2, #c6cbd8) 5%, transparent);
  text-align: left;
}
.depot-proposal-mode-btn strong { font: 650 12px/1.25 'Golos Text', system-ui, sans-serif; }
.depot-proposal-mode-btn span { color: var(--ink-3, #8b93a7); font: 500 10px/1.35 'Golos Text', system-ui, sans-serif; }
.depot-proposal-mode-btn.is-active {
  border-color: color-mix(in oklch, var(--accent, #38bdf8) 58%, transparent);
  color: var(--ink-1, #f7f8fb);
  background: color-mix(in oklch, var(--accent, #38bdf8) 13%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in oklch, var(--accent, #38bdf8) 12%, transparent);
}
.depot-proposal-mode-btn.is-active span { color: color-mix(in oklch, var(--accent, #38bdf8) 55%, var(--ink-2, #c6cbd8)); }
.depot-proposal-field {
  display: grid;
  gap: 7px;
  margin-bottom: 13px;
  color: var(--ink-2, #c6cbd8);
  font: 600 12px/1.3 'Golos Text', system-ui, sans-serif;
}
.depot-proposal-field .settings-input {
  width: 100%;
  max-width: none;
  box-sizing: border-box;
}
.depot-proposal-field > span {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}
.depot-proposal-field em {
  color: var(--ink-3, #8b93a7);
  font-size: 10px;
  font-style: normal;
  font-weight: 500;
}
.depot-proposal-notes {
  min-height: 76px;
  resize: vertical;
  padding-top: 12px;
  font-family: inherit;
  line-height: 1.4;
}
.depot-proposal-info {
  display: grid;
  gap: 3px;
  margin: -2px 0 14px;
  padding: 10px 12px;
  border-left: 2px solid color-mix(in oklch, var(--accent, #38bdf8) 55%, transparent);
  color: var(--ink-2, #c6cbd8);
  background: color-mix(in oklch, var(--accent, #38bdf8) 7%, transparent);
  font: 500 11px/1.4 'Golos Text', system-ui, sans-serif;
}
.depot-proposal-info strong { color: var(--ink-1, #f7f8fb); font-weight: 650; }
.depot-proposal-materials-intro {
  margin: -2px 1px 10px;
  color: var(--ink-3, #8b93a7);
  font: 500 11px/1.45 'Golos Text', system-ui, sans-serif;
}
.depot-proposal-upload {
  display: flex;
  width: 100%;
  min-height: 62px;
  align-items: center;
  gap: 11px;
  margin-bottom: 8px;
  padding: 10px 11px;
  border: 1px solid color-mix(in oklch, var(--ink-2, #c6cbd8) 13%, transparent);
  border-radius: 14px;
  color: var(--ink-1, #f7f8fb);
  background: color-mix(in oklch, var(--ink-2, #c6cbd8) 5%, transparent);
  text-align: left;
}
.depot-proposal-upload-icon {
  display: grid;
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 11px;
  color: var(--accent, #38bdf8);
  background: color-mix(in oklch, var(--accent, #38bdf8) 14%, transparent);
  font: 750 11px/1 'Golos Text', system-ui, sans-serif;
}
.depot-proposal-upload-icon.is-regime {
  color: #a78bfa;
  background: color-mix(in oklch, #a78bfa 14%, transparent);
}
.depot-proposal-upload-icon.is-document {
  width: 38px;
  font-size: 8px;
  background: color-mix(in oklch, var(--good, #34d399) 18%, transparent);
  color: var(--good, #34d399);
}
.depot-proposal-document-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.depot-proposal-upload-copy { display: grid; flex: 1 1 auto; min-width: 0; gap: 3px; }
.depot-proposal-upload-copy strong { font: 650 12px/1.25 'Golos Text', system-ui, sans-serif; }
.depot-proposal-upload-copy small { color: var(--ink-3, #8b93a7); font: 500 10px/1.35 'Golos Text', system-ui, sans-serif; }
.depot-proposal-upload-action { flex: 0 0 auto; color: var(--accent, #38bdf8); font: 650 10px/1.2 'Golos Text', system-ui, sans-serif; }
.depot-proposal-files {
  display: grid;
  gap: 6px;
  margin: 4px 0 13px;
}
.depot-proposal-file {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: 11px;
  background: color-mix(in oklch, var(--ink-2, #c6cbd8) 6%, transparent);
}
.depot-proposal-file-kind {
  flex: 0 0 auto;
  color: var(--accent, #38bdf8);
  font: 700 10px/1 'Golos Text', system-ui, sans-serif;
}
.depot-proposal-file-copy { display: grid; flex: 1 1 auto; min-width: 0; gap: 2px; }
.depot-proposal-file-name {
  overflow: hidden;
  color: var(--ink-2, #c6cbd8);
  font: 550 11px/1.25 'Golos Text', system-ui, sans-serif;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.depot-proposal-file-meta { color: var(--ink-3, #8b93a7); font: 500 9px/1.2 'Golos Text', system-ui, sans-serif; }
.depot-proposal-file-remove {
  display: grid;
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 0;
  border-radius: 9px;
  color: var(--ink-3, #8b93a7);
  background: transparent;
  font: 400 18px/1 system-ui, sans-serif;
}
.depot-proposal-note { margin: 2px 2px 12px; }
.depot-proposal-progress {
  margin: -2px 0 12px;
  color: var(--accent, #38bdf8);
  font: 600 11px/1.4 'Golos Text', system-ui, sans-serif;
}
.depot-proposal-actions { padding-top: 2px; }
.depot-proposal-actions .btn-sheet-save { width: 100%; }

@media (max-width: 360px) {
  .depot-proposal-mode { grid-template-columns: 1fr; }
  .depot-proposal-mode-btn { min-height: 58px; }
  .depot-proposal-upload-action { display: none; }
}

/* ── Avatar crop sheet (pan + zoom, circular) ── */
.avatar-crop-stage {
  position: relative;
  width: 100%;
  max-width: 280px;
  margin: 4px auto 0;
  aspect-ratio: 1 / 1;
  border-radius: 14px;
  overflow: hidden;
  background: #000;
  touch-action: none;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
}
.avatar-crop-stage:active { cursor: grabbing; }
.avatar-crop-img {
  position: absolute;
  left: 0;
  top: 0;
  max-width: none;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}
/* Dim everything outside a centred circle (classic crop guide). */
.avatar-crop-mask {
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: 50%;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.55);
  outline: 2px solid rgba(255, 255, 255, 0.5);
  outline-offset: -2px;
}
.avatar-crop-zoom-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 4px 4px;
}
.avatar-crop-zoom { flex: 1 1 auto; accent-color: var(--accent, #38bdf8); }
.avatar-crop-zoom-ico {
  flex: 0 0 auto;
  color: var(--ink-3, #8b93a7);
  font-size: 18px;
  font-weight: 700;
  width: 16px;
  text-align: center;
}
.avatar-crop-hint {
  font-size: 12px;
  color: var(--ink-3, #8b93a7);
  text-align: center;
  margin: 4px 8px 0;
}
.avatar-crop-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 14px;
}
.avatar-crop-actions .btn-sheet-save { flex: 1 1 auto; }

/* Community stats footer */
.profile-footer-stats {
  margin: 22px 4px 4px;
  text-align: center;
  font-size: 12px;
  color: var(--ink-3, #8b93a7);
}
