main.settings.profile-page {
  display: block;
  max-width: 1000px;
  margin-inline: auto;
  padding: 16px;
}

main.settings.profile-page > .card {
  margin-block: 16px;
}

.photo-section {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  align-items: center;
}

.photo-preview {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid var(--border);
  background: var(--panel);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow);
  position: relative;
}

.photo-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.photo-zoom-controls {
  /* Make the control the same height as your crop canvas */
  height: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.photo-zoom-slider {
  /* This makes it vertical */
  writing-mode: vertical-lr;
  direction: rtl; /* so "low" is at the bottom */

  -webkit-appearance: none;
  appearance: none;

  /* Thickness of the slider track */
  width: 12px;
  max-width: 12px;
  height: 100%;

  padding: 0;
  margin: 0;
  background: transparent;
  cursor: pointer;
  touch-action: none;
}

.photo-zoom-slider:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.photo-zoom-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.4);
  background: #fff;
}

.photo-zoom-slider::-webkit-slider-runnable-track {
  width: 100%;
  background: var(--border, #ccc);
  border-radius: 999px;
}

.photo-zoom-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.4);
  background: #fff;
}

.photo-zoom-slider::-moz-range-track {
  width: 100%;
  background: var(--border, #ccc);
  border-radius: 999px;
}

.photo-crop-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  cursor: grab;
}

.photo-crop-canvas.dragging {
  cursor: grabbing;
}

.photo-actions {
  flex: 1 1 240px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.photo-actions .inline-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

#removePhotoBtn {
  border-radius: 14px;
  padding: 8px 12px;
}

.photo-edit-controls {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.status-message {
  font-size: 0.9rem;
}

.status-ok {
  color: #22c55e;
  font-weight: 600;
}

.status-error {
  color: #dc2626;
  font-style: italic;
  font-weight: 600;
}

.hidden {
  display: none !important;
}

.profile-form {
  display: grid;
  gap: 16px;
}

.profile-display {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.profile-display.hidden {
  display: none !important;
}

.profile-summary {
  display: grid;
  gap: 12px;
}

.profile-summary-row {
  display: grid;
  grid-template-columns: minmax(0, 160px) minmax(0, 1fr);
  column-gap: 16px;
  align-items: flex-start;
}

.profile-country-row {
  align-items: center;
}

.profile-summary dt,
.profile-stats dt {
  font-weight: 700;
  color: var(--ink);
}

.profile-summary dt {
  text-align: right;
}

.profile-summary dd,
.profile-stats dd {
  margin: 0;
  color: var(--ink);
}

.profile-summary dd {
  min-height: 1.5em;
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: flex-start;
}

.profile-stats {
  display: grid;
  gap: 12px;
}

.profile-stats > div {
  display: grid;
  gap: 4px;
}

.profile-country-value {
  display: flex;
  align-items: center;
  gap: 12px;
}

.display-actions {
  display: flex;
  justify-content: flex-end;
}

.profile-stats {
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.milestones {
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.milestone-hint {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted, rgba(255, 255, 255, 0.65));
}

.milestone-table {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.milestone-table th,
.milestone-table td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.milestone-table tbody tr:last-child td {
  border-bottom: none;
}

.milestone-table .empty {
  text-align: center;
  color: var(--muted, rgba(255, 255, 255, 0.65));
}

.profile-form .form-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.profile-form .field-group {
  display: grid;
  gap: 6px;
}

.profile-form label {
  font-weight: 700;
  color: var(--ink);
}

.profile-form input[type="text"],
.profile-form input[type="search"],
.profile-form select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
  color: var(--ink);
  font: inherit;
  box-shadow: var(--shadow);
}

.profile-form input[type="text"]:focus,
.profile-form input[type="search"]:focus,
.profile-form select:focus {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

.country-selection {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.country-select-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.country-display {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--ink);
  box-shadow: var(--shadow);
  width: fit-content;
}

.country-flag {
  width: 32px;
  height: 24px;
  border-radius: 6px;
  object-fit: cover;
}

.country-label {
  font-weight: 600;
}

.country-hint {
  font-size: 0.9rem;
  color: var(--muted, rgba(255, 255, 255, 0.65));
}

.settings-link-card .card-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

@media (max-width: 600px) {
  .photo-section {
    flex-direction: column;
    align-items: flex-start;
  }

  .photo-preview {
    width: 140px;
    height: 140px;
  }

  .photo-actions {
    flex: 0 1 auto;
    width: 100%;
  }

  .country-select-row {
    width: 100%;
  }

  .country-select-row select {
    flex: 1 1 220px;
  }

  .profile-summary-row {
    grid-template-columns: minmax(0, 120px) minmax(0, 1fr);
  }

  .profile-summary dt {
    text-align: left;
  }
}
