/* Stemma Management UI */
.btn-stemma-action {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  flex-shrink: 0;
}

.btn-stemma-action.primary {
  background: #4f46e5;
  color: white;
  box-shadow: 0 4px 10px rgba(79, 70, 229, 0.15);
}

.btn-stemma-action.primary:hover {
  background: #4338ca;
  transform: translateY(-1px);
  box-shadow: 0 6px 15px rgba(79, 70, 229, 0.25);
}

.btn-stemma-action.upload-label {
  background: #f1f5f9;
  color: #64748b;
}

.btn-stemma-action.upload-label:hover {
  background: #e2e8f0;
  color: #334155;
  transform: translateY(-1px);
}

/* Profile Header & Identity */

.profile-avatar-container {
  position: absolute;
  bottom: -72px;
  left: 40px;
  padding: 6px;
  background: var(--surface-color);
  border-radius: 50%;
  z-index: 15;
}

.principal-relationship-slot--profile {
  position: relative;
  z-index: 16;
  min-height: 28px;
  min-width: 0;
  max-width: none;
  width: calc(100% - 248px);
  margin: 0 20px 12px 228px;
  display: flex;
  align-items: flex-start;
}

.principal-relationship-list--profile {
  justify-content: flex-start;
  width: 100%;
}

.principal-relationship--profile .principal-relationship__label {
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
}

.profile-container {
  opacity: 0;
  transition: opacity 0.4s ease-in-out;
  position: relative;
}

.profile-container.ready {
  opacity: 1;
}

#profile-skeleton-overlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  background: white;
  overflow-y: auto;
  overflow-x: hidden;
}

#profile-skeleton-overlay.hidden {
  display: none;
}

@media (max-width: 768px) {
  #profile-skeleton-overlay,
  .tribute-modal-content {
    -ms-overflow-style: none;
    scrollbar-width: none;
  }

  #profile-skeleton-overlay::-webkit-scrollbar,
  .tribute-modal-content::-webkit-scrollbar {
    width: 0;
    height: 0;
    display: none;
  }
}

.profile-container--boot {
  opacity: 1;
}

.profile-avatar--skeleton {
  display: block;
  border: 4px solid var(--surface-color);
  background: rgba(226, 232, 240, 0.82);
}

.boot-profile-shell {
  max-width: 1000px;
  min-height: 100%;
  margin: 0 auto;
  background: white;
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.06);
}

.boot-profile-header {
  position: relative;
  height: 220px;
  overflow: visible;
}

.boot-profile-cover {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 50%, #6366f1 100%);
}

.boot-profile-nav {
  position: absolute;
  top: 15px;
  left: 15px;
  display: flex;
  gap: 16px;
  z-index: 2;
}

.boot-profile-avatar-wrap {
  position: absolute;
  left: 40px;
  bottom: -72px;
  padding: 6px;
  border-radius: 50%;
  background: var(--surface-color);
  z-index: 2;
}

.boot-profile-avatar {
  display: block;
  width: 168px;
  height: 168px;
  border-radius: 50%;
  border: 4px solid var(--surface-color);
  background: rgba(226, 232, 240, 0.82);
}

.boot-profile-title-wrap {
  position: relative;
  min-height: 50px;
  margin-top: -20px;
  z-index: 1;
}

.boot-profile-title {
  margin-left: 228px;
  padding: 24px 20px 20px 0;
  box-sizing: border-box;
}

.boot-profile-title-flex {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.boot-profile-title-copy {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

.boot-profile-title-meta {
  height: 12px;
}

.boot-profile-title-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.boot-profile-title-action {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: rgba(226, 232, 240, 0.78);
}

.boot-profile-tribute-shell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 0.5rem 2rem 0;
}

.boot-profile-tribute-button {
  width: 148px;
  height: 28px;
  border-radius: 999px;
  background: rgba(226, 232, 240, 0.82);
}

.boot-profile-content {
  padding: 1.5rem 2rem 2rem;
}

.boot-profile-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 2rem;
}

.boot-profile-col {
  min-width: 0;
}

.boot-profile-card {
  background: white;
  border-radius: 16px;
  padding: 1.5rem;
  margin-bottom: 2rem;
  box-shadow:
    0 1px 3px rgba(0, 0, 0, 0.04),
    0 4px 12px rgba(0, 0, 0, 0.03);
}

.boot-profile-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 1rem;
}

.boot-profile-card-action {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: rgba(226, 232, 240, 0.78);
  flex-shrink: 0;
}

.boot-profile-photo-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(88px, 1fr));
  gap: 10px;
}

.boot-profile-photo {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 12px;
  background: rgba(226, 232, 240, 0.78);
}

.boot-profile-detail-list {
  margin-top: 0.25rem;
}

.boot-profile-detail-row {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 16px;
  align-items: center;
  min-height: 56px;
  border-bottom: 1px solid #f8fafc;
}

.boot-profile-detail-row:last-child {
  border-bottom: none;
}

.boot-profile-detail-label {
  display: block;
  width: 82px;
  height: 10px;
  border-radius: 999px;
  background: rgba(226, 232, 240, 0.76);
}

.boot-profile-detail-value {
  display: block;
  justify-self: end;
  width: min(62%, 220px);
  height: 14px;
  border-radius: 999px;
  background: rgba(226, 232, 240, 0.82);
}

.boot-profile-family-list {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.boot-profile-family-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.boot-profile-family-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 8px 0;
}

.boot-profile-family-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(226, 232, 240, 0.82);
  flex-shrink: 0;
}

.boot-profile-family-copy {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.profile-avatar {
  box-sizing: border-box;
  width: 168px;
  height: 168px;
  border-radius: 50%;
  background-color: var(--bg-color);
  border: 4px solid var(--surface-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 64px;
  font-weight: 700;
  color: var(--text-secondary);
  background-size: cover;
  background-position: center;
  box-shadow: var(--shadow-md);
}

.profile-title-wrapper {
  position: relative;
  width: 100%;
  min-height: 50px;
  background: transparent;
  margin-top: -20px; /* Ridotto: ora sta subito sotto la copertina invece che sopra */
  margin-bottom: 0;
  z-index: 10;
}

/* Modern, Circular & Minimal profile nav buttons */
.profile-nav-buttons {
  z-index: 1005;
  gap: 16px;
}

#back-to-tree,
#center-in-tree,
#help-tour-btn {
  width: 44px;
  height: 44px;
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  border-radius: 50%;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

#back-to-tree:hover,
#center-in-tree:hover,
#help-tour-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.1);
}

#back-to-tree span,
#center-in-tree span,
#help-tour-btn span {
  font-size: 22px;
}

.profile-title {
  margin-left: 228px;
  padding: 24px 20px 20px 0; /* Aumentato il padding-top da 16px a 24px per abbassare il testo */
  box-sizing: border-box;
}

.profile-title-flex {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 12px;
}

.profile-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}

.profile-title h1 {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  line-height: 1.15 !important;
  margin: 0 !important;
  margin-bottom: 2px !important;
  padding: 0 !important;
  font-size: 2.25rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.04em;
  word-break: break-word;
}

.profile-alt-names {
  margin: 2px 0 4px !important;
  font-size: 0.88rem;
  line-height: 1.35;
  font-weight: 500;
  color: #64748b;
}

/* Profile Name Edit Modal (Dialog) */
.name-edit-dialog {
  padding: 0;
  margin: 0;
  border: none;
  background: transparent;
  width: 100vw;
  height: 100vh;
  max-width: none;
  max-height: none;
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 2000;
}

.name-edit-dialog[open] {
  display: flex;
  align-items: center;
  justify-content: center;
}

.name-edit-dialog::backdrop {
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.name-edit-card {
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 20px;
  padding: 24px 32px;
  width: 90%;
  max-width: 500px;
  max-height: 88dvh;
  overflow-y: auto;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.15);
  animation: dialogScaleIn 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.name-edit-alt-names {
  border-top: 1px solid rgba(148, 163, 184, 0.25);
  padding-top: 14px;
}

.name-edit-alt-names .profile-events-card {
  padding: 0;
  background: transparent;
  border: none;
  box-shadow: none;
}

.name-edit-alt-names .profile-events-card h3 {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #64748b;
  margin-bottom: 4px;
}

@keyframes dialogScaleIn {
  from {
    opacity: 0;
    transform: scale(0.96) translateY(10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.name-edit-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
}

.name-edit-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 480px) {
  .name-edit-card {
    padding: 20px;
    width: 85%;
    gap: 16px;
  }
  .name-edit-grid {
    gap: 12px;
  }
}

.name-edit-field {
  display: flex;
  flex-direction: column;
  gap: 4px; /* Reduced gap between label and input */
}

.name-edit-field label {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #94a3b8;
  padding-left: 2px;
}

.name-edit-input {
  font: inherit;
  font-size: 1.35rem !important; /* Smaller, more balanced */
  font-weight: 700 !important;
  color: var(--text-primary) !important;
  background: transparent !important;
  border: none !important;
  border-bottom: 2px solid #f1f5f9 !important;
  padding: 6px 2px !important;
  width: 100%;
  outline: none !important;
  transition: all 0.2s;
  border-radius: 0 !important;
  box-shadow: none !important;
  text-align: left; /* Standard alignment */
}

.name-edit-input:focus {
  border-color: var(--primary-color) !important;
}

.name-edit-input.small-input {
  font-size: 1rem !important;
  font-weight: 500 !important;
  color: #64748b !important;
}

.name-edit-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 12px;
  align-items: center;
}

.name-save-btn,
.name-cancel-btn {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
}

.name-save-btn {
  background: #10b981;
  color: white;
}

.name-cancel-btn {
  background: #f1f5f9;
  color: #64748b;
}

.name-save-btn:hover {
  background: #059669;
  transform: translateY(-1px);
}
.name-cancel-btn:hover {
  background: #e2e8f0;
  transform: translateY(-1px);
}

/* Mobile logic for name edit */
@media (max-width: 900px) {
  .name-edit-container {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .name-edit-field {
    width: 100%;
  }

  .name-edit-input {
    font-size: 1.1rem !important;
    padding: 12px 14px !important;
  }

  .name-edit-actions {
    justify-content: center;
    width: 100%;
    margin-top: 5px;
    height: auto;
  }
}

.profile-title p {
  margin: 0 !important; /* Azzera il margine superiore precedente di 6px */
  color: var(--text-secondary);
  font-size: 1.05rem; /* Misura premium per desktop */
  font-weight: 500;
}

/* Content Grid */
.profile-content {
  padding: 2rem;
}

.profile-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 2rem;
}

.info-card {
  background: white;
  border: none;
  border-radius: 16px;
  padding: 1.5rem;
  margin-bottom: 2rem;
  box-shadow:
    0 1px 3px rgba(0, 0, 0, 0.04),
    0 4px 12px rgba(0, 0, 0, 0.03);
}

.info-card h3 {
  margin-top: 0;
  color: #334155;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.75rem;
  margin-bottom: 1.25rem;
  font-size: 0.85rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

#profile-details-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

#profile-details-list li {
  padding: 12px 0 !important;
  margin: 0 !important;
  border-bottom: 1px solid #f8fafc;
  display: grid !important;
  /* Solo 2 colonne: Label fissa (140px) e Valore flessibile (1fr) fino al bordo */
  grid-template-columns: 140px 1fr !important;
  align-items: center !important;
  min-height: 56px !important;
  box-sizing: border-box !important;
}

#profile-details-list li:last-child {
  border-bottom: none;
}

.detail-label {
  color: #475569;
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.detail-value {
  display: flex !important;
  align-items: center !important;
  justify-content: flex-end !important;
  text-align: right !important;
  width: 100%;
  height: 32px !important; /* Altezza fissa rigorosa per il blocco centrale */
  line-height: 32px !important;
  margin: 0 !important;
  padding: 0 !important;
  color: #1e293b;
  font-weight: 700;
  font-size: 0.95rem;
  gap: 8px;
  min-width: 0;
  min-height: 32px;
  height: auto !important;
  line-height: 1.25 !important;
  flex-wrap: wrap;
}

.profile-provenance-badge {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  min-height: 24px;
  padding: 0;
  border: 1px solid #cbd5e1;
  border-radius: 50%;
  background: #f8fafc;
  color: #475569;
  font: inherit;
  line-height: 1;
  cursor: pointer;
}

.profile-provenance-badge .material-symbols-outlined {
  font-size: 15px;
}

.profile-provenance-badge::after {
  content: attr(data-tooltip);
  position: absolute;
  right: 0;
  bottom: calc(100% + 7px);
  z-index: 60;
  width: max-content;
  max-width: min(260px, 80vw);
  padding: 6px 8px;
  border-radius: 6px;
  background: #0f172a;
  color: #fff;
  box-shadow: 0 5px 16px rgba(15, 23, 42, 0.2);
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.3;
  text-align: left;
  white-space: normal;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transform: translateY(3px);
  transition:
    opacity 0.15s ease,
    transform 0.15s ease,
    visibility 0.15s ease;
}

.profile-provenance-badge.status-verified {
  border-color: #4ade80;
  background: #dcfce7;
  color: #166534;
}

.profile-provenance-badge.status-attested {
  border-color: #86efac;
  background: #f0fdf4;
  color: #166534;
}

.profile-provenance-badge.status-contested {
  border-color: #fca5a5;
  background: #fef2f2;
  color: #991b1b;
}

.profile-provenance-badge.status-corroborated {
  border-color: #c4b5fd;
  background: #f5f3ff;
  color: #5b21b6;
}

.profile-provenance-badge.status-testified {
  border-color: #ddd6fe;
  background: #faf5ff;
  color: #6d28d9;
}

.profile-provenance-badge.status-candidate {
  border-color: #fde68a;
  background: #fffbeb;
  color: #92400e;
}

.person-evidence-badge.is-database-only {
  cursor: default;
}

.profile-provenance-badge:hover,
.profile-provenance-badge:focus-visible {
  filter: brightness(0.97);
  outline: 2px solid rgba(79, 70, 229, 0.2);
  outline-offset: 1px;
}

.profile-provenance-badge:hover::after,
.profile-provenance-badge:focus-visible::after {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

button.profile-provenance-badge::after {
  display: none;
}

.evidence-popover {
  --evidence-panel: var(--surface-color, #fff);
  --evidence-ink: var(--text-primary, #0f172a);
  --evidence-muted: var(--text-secondary, #64748b);
  --evidence-rule: var(--border-color, #e2e8f0);
  --evidence-soft: color-mix(in srgb, var(--evidence-muted) 7%, var(--evidence-panel));
  --evidence-accent: var(--primary-color, #4f46e5);
  --evidence-positive: #166534;
  --evidence-caution: #92400e;
  --evidence-negative: #b91c1c;
  position: fixed;
  z-index: 5000;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  width: min(388px, calc(100vw - 20px));
  max-height: min(70vh, 590px, var(--evidence-available-height, 100vh));
  max-height: min(70dvh, 590px, var(--evidence-available-height, 100dvh));
  overflow: hidden;
  border: 1px solid var(--evidence-rule);
  border-radius: 14px;
  background: var(--evidence-panel);
  color: var(--evidence-ink);
  box-shadow: 0 12px 34px #0f172a29, 0 2px 6px #0f172a12;
  font-size: 0.875rem;
  line-height: 1.45;
}

.evidence-popover.is-compact {
  width: min(306px, calc(100vw - 20px));
}

body.dark-mode .evidence-popover {
  --evidence-accent: #a5b4fc;
  --evidence-positive: #86efac;
  --evidence-caution: #fcd34d;
  --evidence-negative: #fca5a5;
}

.evidence-popover-heading {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px 8px 14px;
  border-bottom: 1px solid var(--evidence-rule);
}

.evidence-popover-title {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 0.975rem;
  font-weight: 700;
  line-height: 1.3;
}

.evidence-popover-title::first-letter {
  text-transform: uppercase;
}

.evidence-popover .evidence-popover-close {
  display: grid;
  flex: 0 0 34px;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: var(--evidence-soft);
  color: var(--evidence-muted);
  font-size: 1.25rem;
  line-height: 1;
}

.evidence-popover .evidence-popover-close:hover {
  color: var(--evidence-ink);
  background: color-mix(in srgb, var(--evidence-muted) 13%, var(--evidence-panel));
}

.evidence-popover-body {
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 12px 14px;
  scrollbar-color: var(--evidence-rule) transparent;
  scrollbar-width: thin;
}

.evidence-popover-section {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.evidence-popover-section + .evidence-popover-section {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--evidence-rule);
}

.evidence-popover-overview,
.evidence-popover-assessment-lead {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px 8px;
}

.evidence-popover :is(p, h3, h4, blockquote, ul, dl) {
  margin: 0;
}

.evidence-popover h3 {
  font-size: 0.94rem;
  font-weight: 700;
}

.evidence-popover-status {
  --evidence-status-ink: var(--evidence-muted);
  display: inline-flex;
  align-items: center;
  justify-self: start;
  max-width: 100%;
  padding: 2px 8px;
  border-radius: 6px;
  background: color-mix(in srgb, var(--evidence-status-ink) 10%, var(--evidence-panel));
  color: var(--evidence-status-ink);
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.45;
}

.evidence-popover-status:is(.status-verified, .status-attested) {
  --evidence-status-ink: var(--evidence-positive);
}

.evidence-popover-status:is(.status-corroborated, .status-testified) {
  --evidence-status-ink: var(--evidence-accent);
}

.evidence-popover-status.status-candidate {
  --evidence-status-ink: var(--evidence-caution);
}

.evidence-popover-status.status-contested {
  --evidence-status-ink: var(--evidence-negative);
}

.evidence-popover-meta {
  color: var(--evidence-muted);
  font-size: 0.8125rem;
  overflow-wrap: anywhere;
}

.evidence-popover-source {
  display: grid;
  gap: 8px;
  min-width: 0;
  padding: 10px 11px;
  border: 1px solid var(--evidence-rule);
  border-radius: 10px;
  overflow-wrap: anywhere;
}

.evidence-popover-source h4 {
  font-size: 0.875rem;
  font-weight: 700;
  line-height: 1.4;
}

.evidence-popover blockquote {
  padding: 7px 9px;
  border-inline-start: 2px solid var(--evidence-rule);
  border-radius: 0 6px 6px 0;
  background: var(--evidence-soft);
  color: var(--evidence-muted);
  font-size: 0.8125rem;
}

.evidence-popover :is(.evidence-popover-document, .evidence-popover-footer button) {
  display: inline-flex;
  align-items: center;
  justify-self: start;
  gap: 6px;
  width: fit-content;
  min-height: 30px;
  padding: 4px 9px;
  border: 1px solid color-mix(in srgb, var(--evidence-accent) 25%, var(--evidence-panel));
  border-radius: 7px;
  background: color-mix(in srgb, var(--evidence-accent) 7%, var(--evidence-panel));
  color: var(--evidence-accent);
  font: inherit;
  font-size: 0.79rem;
  font-weight: 650;
  text-decoration: none;
}

.evidence-popover :is(.evidence-popover-document, .evidence-popover-footer button):hover {
  background: color-mix(in srgb, var(--evidence-accent) 14%, var(--evidence-panel));
}

.evidence-popover :is(button, summary) {
  cursor: pointer;
}

.evidence-popover :is(button, a, summary):focus-visible {
  outline: 2px solid var(--evidence-accent);
  outline-offset: 2px;
}

.evidence-popover details > summary {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 4px 2px;
  border-radius: 4px;
  font-size: 0.8125rem;
  font-weight: 650;
  list-style: none;
}

.evidence-popover details > summary::-webkit-details-marker {
  display: none;
}

.evidence-popover details > summary::before {
  content: '';
  width: 5px;
  height: 5px;
  flex: 0 0 5px;
  border: solid var(--evidence-muted);
  border-width: 0 1.5px 1.5px 0;
  transform: rotate(-45deg);
}

.evidence-popover details[open] > summary::before {
  transform: rotate(45deg);
}

.evidence-popover-source-assessments {
  padding-top: 4px;
  border-top: 1px solid var(--evidence-rule);
}

.evidence-popover-assessment {
  margin-top: 7px;
}

.evidence-popover-assessment + .evidence-popover-assessment {
  padding-top: 8px;
  border-top: 1px solid var(--evidence-rule);
}

.evidence-popover-assessment-lead {
  margin-bottom: 7px;
  font-size: 0.8125rem;
}

.evidence-popover-confidence {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.evidence-popover-confidence > div {
  min-width: 0;
  padding: 5px 7px;
  border-radius: 6px;
  background: var(--evidence-soft);
}

.evidence-popover-confidence dt {
  color: var(--evidence-muted);
  font-size: 0.72rem;
}

.evidence-popover-confidence dd {
  margin: 1px 0 0;
  font-size: 0.82rem;
  font-weight: 700;
}

.evidence-popover-confidence dd::first-letter {
  text-transform: uppercase;
}

.evidence-popover-confidence .level-high {
  color: var(--evidence-positive);
}

.evidence-popover-confidence .level-medium {
  color: var(--evidence-caution);
}

.evidence-popover-confidence .level-low {
  color: var(--evidence-negative);
}

.evidence-popover-history ul {
  display: grid;
  gap: 6px;
  padding: 4px 0 0;
  list-style: none;
}

.evidence-popover-history li {
  padding: 6px 8px;
  border-radius: 6px;
  background: var(--evidence-soft);
  overflow-wrap: anywhere;
}

.evidence-popover-footer {
  flex: none;
  padding: 8px 14px;
  border-top: 1px solid var(--evidence-rule);
}

.profile-place-badge {
  position: relative;
  display: inline-grid;
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(13, 148, 136, 0.3);
  border-radius: 50%;
  color: #0f766e;
  background: rgba(240, 253, 250, 0.92);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.7);
  cursor: help;
}

.profile-place-badge > .material-symbols-outlined {
  font-size: 14px;
  font-variation-settings: 'FILL' 1;
}

.profile-place-badge:hover,
.profile-place-badge:focus-visible,
.profile-place-badge.is-open {
  border-color: rgba(13, 148, 136, 0.58);
  outline: 2px solid rgba(13, 148, 136, 0.13);
  outline-offset: 1px;
  color: #047857;
  background: #ecfdf5;
}

.profile-place-tooltip {
  position: absolute;
  right: -4px;
  bottom: calc(100% + 10px);
  z-index: 80;
  display: grid;
  width: max-content;
  min-width: 220px;
  max-width: min(320px, 82vw);
  gap: 4px;
  padding: 12px 14px;
  border: 1px solid rgba(15, 118, 110, 0.18);
  border-radius: 14px;
  color: #0f172a;
  text-align: left;
  white-space: normal;
  background: rgba(255, 255, 255, 0.98);
  box-shadow:
    0 18px 44px rgba(15, 23, 42, 0.18),
    0 3px 10px rgba(15, 118, 110, 0.08);
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transform: translateY(4px) scale(0.98);
  transform-origin: bottom right;
  transition:
    opacity 0.16s ease,
    visibility 0.16s ease,
    transform 0.16s ease;
}

.profile-place-tooltip::after {
  content: '';
  position: absolute;
  right: 10px;
  bottom: -6px;
  width: 11px;
  height: 11px;
  border-right: 1px solid rgba(15, 118, 110, 0.18);
  border-bottom: 1px solid rgba(15, 118, 110, 0.18);
  background: #fff;
  transform: rotate(45deg);
}

.profile-place-badge:hover .profile-place-tooltip,
.profile-place-badge:focus-visible .profile-place-tooltip,
.profile-place-badge.is-open .profile-place-tooltip {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.profile-place-tooltip-eyebrow {
  color: #0f766e;
  font-size: 0.62rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  line-height: 1.2;
  text-transform: uppercase;
}

.profile-place-tooltip-title {
  color: #0f172a;
  font-size: 0.82rem;
  font-weight: 800;
  line-height: 1.35;
}

.profile-place-tooltip-history {
  color: #475569;
  font-size: 0.72rem;
  font-weight: 650;
  line-height: 1.3;
}

.profile-place-tooltip-meta {
  margin-top: 2px;
  color: #047857;
  font-size: 0.64rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  line-height: 1.3;
  text-transform: uppercase;
}

.profile-place-tooltip-coordinates {
  color: #94a3b8;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.61rem;
  font-weight: 650;
  line-height: 1.25;
}

.place-text-link {
  color: inherit;
  cursor: pointer;
  text-decoration: underline dotted 1.5px rgba(15, 118, 110, 0.45);
  text-underline-offset: 3px;
  transition:
    color 0.18s ease,
    text-decoration-color 0.18s ease;
}

.place-text-link:hover,
.place-text-link:focus-visible {
  color: #0f766e;
  text-decoration-color: #0f766e;
  text-decoration-style: solid;
  outline: none;
}

.inline-edit-row .inline-edit-input,
.inline-edit-row .inline-edit-select {
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  appearance: none !important;
  height: 32px !important;
  line-height: 32px !important;
  padding: 0 !important; /* ZERO padding per non spingere il testo a sinistra */
  background: transparent !important; /* Sfondo invisibile */
  border: none !important; /* Niente scatola */
  border-bottom: 1px solid rgba(148, 163, 184, 0.4) !important; /* Solo linea inferiore discreta */
  border-radius: 0 !important;
  color: #1e293b !important;
  font-family: inherit !important;
  font-size: 0.95rem !important;
  font-weight: 700 !important; /* Stesso peso del testo statico */
  text-align: right !important; /* Tutto rigorosamente a destra */
  box-sizing: border-box !important;
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease !important;
  width: 100%;
}

/* Focus State Premium (Solo linea sotto colorata) */
.inline-edit-row .inline-edit-input:focus,
.inline-edit-row .inline-edit-select:focus {
  border-bottom: 2px solid #4f46e5 !important; /* Colore primary */
  outline: none !important;
}

/* Freccia Discreta per le Select */
.inline-edit-row .inline-edit-select {
  padding-right: 16px !important; /* Piccolo spazio solo per la freccia */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2394a3b8'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 0 center !important;
  background-size: 14px !important;
  cursor: pointer !important;
  text-align-last: right !important; /* Forza il testo a destra anche nel dropdown */
}

/* UCCIDE GLI SPIN BUTTONS DEI CAMPI NUMERICI (GG/AAAA) CAUSA DI DILATAZIONI */
input[type='number']::-webkit-inner-spin-button,
input[type='number']::-webkit-outer-spin-button {
  -webkit-appearance: none !important;
  appearance: none !important;
  margin: 0 !important;
}

input[type='number'] {
  -moz-appearance: textfield !important;
  appearance: textfield !important;
}

.inline-date-group {
  display: flex !important;
  justify-content: flex-end !important;
  align-items: center !important;
  gap: 8px !important;
  width: 100% !important;
}

/* Calibrazione larghezze per evitare salti */
#edit-birth-prefix,
#edit-death-prefix,
#edit-marr-prefix {
  width: 75px !important;
  color: #64748b !important;
  font-weight: 500 !important;
  flex-shrink: 0;
}
#edit-birth-day,
#edit-death-day,
#edit-marr-day {
  width: 35px !important;
  text-align: center !important;
  flex-shrink: 0;
}
#edit-birth-month,
#edit-death-month,
#edit-marr-month {
  width: 60px !important;
  flex-shrink: 0;
}
#edit-birth-year,
#edit-death-year,
#edit-marr-year {
  width: 55px !important;
  padding-right: 0 !important; /* L'anno tocca perfettamente il margine destro */
  background-image: none !important; /* Niente freccia sull'anno se Ã¨ input text */
  flex-shrink: 0;
}

.detail-actions {
  display: none !important;
}

/* Family List Styles */
.family-group {
  margin-bottom: 1.5rem;
}

.family-group h4 {
  margin: 0 0 0.5rem 0;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #334155;
}

.family-member-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 8px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
  flex-wrap: wrap;
}

.family-edit-card {
  flex-basis: 100%;
  min-width: 0;
}

.family-edit-card .inline-date-group {
  justify-content: flex-start !important;
}

.family-edit-card .inline-edit-input,
.family-edit-card .inline-edit-select {
  text-align: left !important;
}

.family-member-item:hover {
  background: #f8fafc;
  border-radius: 10px;
}

.fm-info {
  flex: 1;
  min-width: 0;
}

.fm-name {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.fm-name .profile-provenance-badge {
  width: 22px;
  height: 22px;
  min-height: 22px;
}

.fm-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.fm-info div:first-child {
  font-weight: 700;
  color: var(--text-primary);
  font-size: 0.95rem;
}

.fm-info div:last-child {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 500;
}

/* Add Relative Button */
.btn-add-relative {
  background: transparent;
  border: 1px dashed #cbd5e1;
  color: #4f46e5;
  border-radius: 6px;
  padding: 6px 12px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-add-relative:hover {
  background: #e0e7ff;
  border-color: #4f46e5;
}

/* Family Disconnect Button */
.fm-disconnect-btn {
  font-size: 18px !important;
  color: #94a3b8;
  cursor: pointer;
  margin-left: auto;
  padding: 4px;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.fm-disconnect-btn:hover {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.1);
  transform: scale(1.1);
}

/* Family Add Actions */
.fm-add-actions {
  margin-top: 12px;
  display: flex;
  gap: 12px;
  justify-content: center;
  padding: 8px 0;
}

.btn-add-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px dashed #cbd5e1;
  background: white;
  color: #64748b;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-add-icon:hover {
  border: 1px solid #6366f1;
  color: #6366f1;
  background: #f5f3ff;
  transform: translateY(-2px);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.btn-add-icon .material-symbols-outlined {
  font-size: 20px;
}

/* Photos Section */
/* =========================================
   FIX GALLERIA FOTO - FORZA ALLINEAMENTO A SINISTRA
   ========================================= */
.photos-grid {
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)) !important;
  gap: 10px !important;
  justify-content: flex-start !important; /* Forza l'impacchettamento della griglia a sinistra */
  justify-items: start !important; /* ALLINEAMENTO FORCE START */
  align-items: start !important;
  width: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
  text-align: left !important; /* Annulla eventuali text-align: right ereditati */
}

.photo-item {
  width: 100% !important;
  height: auto !important;
  aspect-ratio: 1 / 1 !important;
  border-radius: 10px !important;
  object-fit: cover !important;
  background-color: #f8fafc !important;
  cursor: pointer !important;
  border: none !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06) !important;
  transition:
    transform 0.2s,
    box-shadow 0.2s !important;
  display: block !important;
  margin: 0 !important; /* Impedisce a margini automatici di spingere la foto */
}

.photo-item:hover {
  transform: scale(1.04);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.profile-document-stack {
  position: relative;
  isolation: isolate;
  appearance: none;
  padding: 0 !important;
  overflow: visible;
  background: transparent !important;
  border: 0 !important;
}

.profile-document-stack::before,
.profile-document-stack::after {
  content: '';
  position: absolute;
  inset: 4px;
  z-index: 0;
  border-radius: 10px;
  background: #e2e8f0;
  border: 1px solid rgba(71, 85, 105, 0.2);
  pointer-events: none;
}

.profile-document-stack::before {
  transform: translate(7px, -5px) rotate(2.5deg);
}

.profile-document-stack::after {
  z-index: 1;
  transform: translate(4px, -2px) rotate(1deg);
  background: #f8fafc;
}

.profile-document-stack-cover {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 10px;
  object-fit: cover;
  background: #f8fafc;
}

.profile-document-stack-badge {
  position: absolute;
  right: 6px;
  bottom: 6px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  min-width: 30px;
  min-height: 25px;
  padding: 3px 6px;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 9px;
  background: rgba(15, 23, 42, 0.84);
  box-shadow: 0 3px 10px rgba(15, 23, 42, 0.25);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1;
  pointer-events: none;
}

.profile-document-stack-badge .material-symbols-outlined {
  font-size: 16px;
}

.profile-document-stack:focus-visible {
  outline: 3px solid rgba(99, 102, 241, 0.45) !important;
  outline-offset: 4px;
}

.photo-item.model-placeholder {
  display: flex !important;
  align-items: stretch;
  justify-content: stretch;
  background: linear-gradient(135deg, #f8fafc 0%, #edf2f7 100%) !important;
  color: #4f46e5 !important;
  border: 1px solid rgba(79, 70, 229, 0.1) !important;
  position: relative;
  overflow: hidden;
}

.photo-item-model {
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
  background:
    radial-gradient(
      circle at top left,
      rgba(15, 118, 110, 0.14),
      transparent 36%
    ),
    linear-gradient(145deg, #f8fafc 0%, #e2e8f0 100%);
}

.photo-item.model-placeholder .model-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.86);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  pointer-events: none;
}

.no-photos {
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-style: italic;
  grid-column: 1 / -1;
  text-align: center;
  padding: 1rem 0;
}

/* Photos & Info headers */
.photos-header,
.info-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.photos-header h3,
.info-header h3 {
  margin: 0;
}

/* Mobile Profile Optimization */
@media (max-width: 900px) {
  .profile-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .profile-content {
    padding: 1rem;
  }

  .profile-avatar-container {
    left: 50%;
    transform: translateX(-50%);
    bottom: -60px;
  }

  .profile-title-wrapper {
    margin-top: 0;
  }

  .profile-title {
    margin-left: 0;
    padding: 75px 1rem 1rem 1rem;
    text-align: center;
  }

  .principal-relationship-slot--profile {
    position: static;
    left: auto;
    transform: none;
    bottom: auto;
    width: min(92vw, 520px);
    max-width: min(92vw, 520px);
    margin: 72px auto 4px;
    justify-content: center;
    align-items: center;
    min-height: auto;
  }

  .principal-relationship-list--profile {
    justify-content: center;
  }

  .profile-title-flex {
    justify-content: center;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
  }

  .principal-relationship-slot--profile:not(.hidden)
    + .profile-title-wrapper
    .profile-title {
    padding-top: 12px;
  }

  .profile-actions {
    margin-top: 8px;
    flex-shrink: 0;
    justify-content: center;
    width: 100%;
  }

  .profile-title h1 {
    font-size: 1.6rem;
    flex: 0 1 auto;
    justify-content: center;
    text-align: center;
  }

  .boot-profile-header {
    height: 140px;
  }

  .boot-profile-avatar-wrap {
    left: 50%;
    transform: translateX(-50%);
    bottom: -60px;
  }

  .boot-profile-avatar {
    width: 148px;
    height: 148px;
  }

  .boot-profile-title {
    margin-left: 0;
    padding: 75px 1rem 1rem 1rem;
    text-align: center;
  }

  .boot-profile-title-flex {
    flex-direction: column;
    align-items: center;
    gap: 10px;
  }

  .boot-profile-title-copy {
    align-items: center;
  }

  .boot-profile-content {
    padding: 1rem;
  }

  .boot-profile-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .boot-profile-card {
    padding: 1.25rem;
    margin-bottom: 1.5rem;
  }

  .boot-profile-detail-row {
    grid-template-columns: 108px 1fr;
    gap: 12px;
    min-height: 50px;
  }

  .boot-profile-detail-label {
    width: 68px;
  }

  .boot-profile-detail-value {
    width: min(68%, 180px);
  }

  .boot-profile-tribute-shell {
    padding: 0.35rem 1rem 0;
    gap: 10px;
  }
}

@media (min-width: 900px) {
  #lightbox-image-area {
    background: transparent;
  }
}

/* ===== Contributions & Stories Section ===== */
.contrib-items-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.contrib-item-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1e3a8a;
  font-size: 0.78rem;
  font-weight: 600;
}

#contrib-structured-slot {
  margin-bottom: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  background: #f5f7ff;
  border: 1.5px solid #818cf8;
  box-shadow: 0 2px 10px rgba(99, 102, 241, 0.08);
}

.contrib-structured-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.contrib-structured-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  background: #e0e7ff;
  color: #3730a3;
  font-size: 0.72rem;
  font-weight: 700;
}

.contrib-structured-cancel {
  border: none;
  background: transparent;
  color: #64748b;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  padding: 2px 4px;
  text-decoration: underline;
}

.contrib-structured-cancel:hover {
  color: #1e293b;
}

.contrib-structured-help {
  margin: 4px 0 0;
  font-size: 0.76rem;
  color: #475569;
  line-height: 1.4;
}

.contrib-place-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.contrib-place-chip {
  border: 1px solid #c7d2fe;
  background: #ffffff;
  color: #312e81;
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
}

.contrib-place-chip:hover {
  background: #eef2ff;
  border-color: #818cf8;
}

.contrib-place-suggestions.is-dark .contrib-place-chip {
  background: #1e293b;
  border-color: #475569;
  color: #e2e8f0;
}

.contrib-msg-secondary {
  min-height: 58px;
  background: #f8fafc;
}

.contrib-structured-residence-dates {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

@media (max-width: 480px) {
  .contrib-structured-residence-dates {
    grid-template-columns: 1fr;
  }
}

#contributions-stories-card {
  margin: 0 0 2rem;
}

.contrib-post {
  position: relative;
  padding: 1rem;
  margin-bottom: 0.75rem;
  border-radius: 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  transition:
    opacity 0.3s,
    border-color 0.3s;
}

.contrib-post.pending,
.contrib-post.status-pending {
  opacity: 0.5;
  border-style: dashed;
  border-color: #cbd5e1;
}

.contrib-post.pending:hover,
.contrib-post.status-pending:hover {
  opacity: 0.85;
}

.contrib-post.approved,
.contrib-post.status-approved {
  opacity: 1;
  border-color: #e2e8f0;
}

.contrib-post.status-changes_requested {
  border-color: #f59e0b;
  background: #fffbeb;
}

.contrib-post.status-rejected {
  border-color: #fecaca;
  background: #fff7f7;
  opacity: 0.86;
}

.contrib-post-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
}

.contrib-author-name {
  font-weight: 700;
  font-size: 0.85rem;
  color: #1e293b;
}

.contrib-date-label {
  font-size: 0.75rem;
  color: #94a3b8;
}

.contrib-pending-badge {
  font-size: 0.65rem;
  font-weight: 600;
  color: #d97706;
  background: #fef3c7;
  padding: 2px 8px;
  border-radius: 9999px;
  letter-spacing: 0.02em;
}

.contrib-status-badge {
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 700;
}

.contrib-status-badge.status-pending {
  background: #fef3c7;
  color: #b45309;
}

.contrib-status-badge.status-changes_requested {
  background: #ffedd5;
  color: #c2410c;
}

.contrib-status-badge.status-rejected {
  background: #fee2e2;
  color: #b91c1c;
}

.contrib-review-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 8px 0 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #fff;
  color: #7c2d12;
  font-size: 0.78rem;
  line-height: 1.45;
}

.contrib-review-note strong {
  display: block;
  margin-bottom: 2px;
}

.contrib-review-note .material-symbols-outlined {
  font-size: 18px;
}

.contrib-review-note.status-rejected {
  color: #991b1b;
}

.contrib-message {
  font-size: 0.875rem;
  color: #334155;
  line-height: 1.5;
  margin: 0 0 0.5rem 0;
  white-space: pre-wrap;
}

.contrib-photos-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.contrib-photo-frame {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  padding: 0;
  border: 0;
  border-radius: 8px;
  overflow: hidden;
  background: #f8fafc;
  cursor: pointer;
}

.contrib-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 0;
  cursor: inherit;
  transition: transform 0.2s;
  display: block;
}

.contrib-photo:hover {
  transform: scale(1.01);
}

/* --- Social Interactions (Likes/Dislikes) --- */
.contribution-comments {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border-color, #e2e8f0);
}

.contribution-comments[hidden],
.contribution-comments [hidden] {
  display: none;
}

.contribution-comment-form,
.contribution-editor-message-label,
#contrib-msg {
  position: relative;
}

.contribution-comment-form {
  display: grid;
  gap: 6px;
}

.contribution-comment-form textarea {
  width: 100%;
  box-sizing: border-box;
  min-height: 38px;
  resize: none;
  overflow-y: hidden;
  padding: 8px 10px;
  border: 1px solid var(--border-color, #cbd5e1);
  border-radius: 8px;
  background: var(--bg-color, #fff);
  color: inherit;
  font: inherit;
  font-size: 0.9rem;
  line-height: 20px;
}

.contribution-comment-form.is-expanded textarea {
  min-height: 78px;
  resize: vertical;
  overflow-y: auto;
}

.contribution-comment-form > button {
  justify-self: end;
}

.contribution-comments-status,
.contribution-comment-form small,
.contribution-comment-context,
.contribution-comment time {
  color: var(--text-secondary, #64748b);
  font-size: 0.75rem;
}

.contribution-comment {
  margin-block: 12px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  overflow-wrap: anywhere;
}

.contribution-comment.is-reply {
  margin-block: 4px 0;
}

.contribution-comment:last-child {
  margin-bottom: 0;
}

.contribution-comment-replies {
  margin-top: 8px;
  margin-left: 12px;
  padding-left: 12px;
  border-left: 2px solid var(--border-color, #e2e8f0);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.contribution-comment-replies:empty {
  display: none;
}

@media (max-width: 480px) {
  .contribution-comment-replies {
    margin-left: 6px;
    padding-left: 10px;
  }
}

.contribution-comment-meta,
.contribution-comment-reply-target,
.contribution-comment-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
}

.contribution-comment-meta {
  margin-bottom: 2px;
  font-size: 0.85rem;
}

.contribution-comment-author {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.contribution-comment-badge {
  display: inline-flex;
  flex-shrink: 0;
  color: #1d9bf0;
}

.contribution-comment-message {
  white-space: pre-wrap;
  line-height: 1.4;
  font-size: 0.875rem;
}

.contribution-comment-actions {
  margin-top: 3px;
  gap: 4px;
}

.contribution-comment-actions button,
.contribution-comment-reply-target button {
  border: 0;
  background: transparent;
  color: var(--primary-color, #2563eb);
  cursor: pointer;
  padding: 4px 0;
  font: inherit;
  font-size: 0.8rem;
}

.contribution-comment-actions button {
  min-height: 28px;
  padding: 4px 8px;
  border-radius: 6px;
  color: var(--text-secondary, #64748b);
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 20px;
  transition:
    background-color 0.15s,
    color 0.15s;
}

.contribution-comment-edit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  padding: 4px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-secondary, #64748b);
  cursor: pointer;
}

.contribution-comment-edit:hover {
  color: var(--primary-color, #2563eb);
  background: rgba(59, 130, 246, 0.08);
}

.contribution-comment-edit:focus-visible {
  outline: 2px solid var(--primary-color, #2563eb);
  outline-offset: 1px;
}

.contribution-comment-edit:disabled {
  opacity: 0.5;
  cursor: default;
}

.contribution-comment-actions button:hover {
  background: rgba(59, 130, 246, 0.08);
  color: var(--primary-color, #2563eb);
}

.contribution-comment-actions .contribution-comment-delete:hover {
  background: rgba(220, 38, 38, 0.08);
  color: #b91c1c;
}

.contribution-comment-actions button:focus-visible {
  outline: 2px solid var(--primary-color, #2563eb);
  outline-offset: 1px;
}

.contribution-comment-actions button:disabled {
  opacity: 0.5;
  cursor: wait;
}

.contribution-comments .mention-dropdown {
  max-width: 100%;
  box-sizing: border-box;
  z-index: 20;
}

.contrib-message .mention-link,
.contribution-comment-message .mention-link {
  color: var(--primary-color, #2563eb);
  font-weight: 600;
  text-decoration: none;
}

.contrib-social-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(0, 0, 0, 0.05);
}

.interaction-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: transparent;
  border: none;
  color: #64748b;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 10px;
  min-width: 60px;
  border-radius: 20px;
  transition:
    background-color 0.2s cubic-bezier(0.4, 0, 0.2, 1),
    color 0.2s cubic-bezier(0.4, 0, 0.2, 1),
    border-color 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  border: 1px solid transparent;
}

.interaction-count {
  min-width: 1.5ch;
  text-align: center;
  display: inline-block;
}

.interaction-btn:hover {
  background: #f1f5f9;
  color: #334155;
  border-color: #e2e8f0;
}

.interaction-btn.active.like {
  color: #16a34a;
  background: rgba(22, 163, 74, 0.05);
  border-color: rgba(22, 163, 74, 0.1);
}

.interaction-btn.active.dislike {
  color: #4f46e5;
  background: rgba(79, 70, 229, 0.05);
  border-color: rgba(79, 70, 229, 0.1);
}

.interaction-btn .material-symbols-outlined {
  font-size: 18px;
  font-variation-settings:
    'FILL' 0,
    'wght' 400,
    'GRAD' 0,
    'opsz' 20;
}

.interaction-btn.active .material-symbols-outlined {
  font-variation-settings:
    'FILL' 1,
    'wght' 500,
    'GRAD' 0,
    'opsz' 20;
}

/* Tooltip for names */
.interaction-names-tooltip {
  position: absolute;
  bottom: 110%;
  left: 50%;
  transform: translateX(-50%) translateY(5px);
  background: #0f172a;
  color: white;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.72rem;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1000;
  box-shadow:
    0 10px 15px -3px rgba(0, 0, 0, 0.1),
    0 4px 6px -2px rgba(0, 0, 0, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.interaction-btn:hover .interaction-names-tooltip {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.interaction-names-tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: #0f172a;
}

/* Admin action buttons â€” visible on hover */
.contrib-actions {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  gap: 6px;
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
}

.contrib-post:hover .contrib-actions {
  opacity: 1;
  pointer-events: auto;
}

.contrib-post.is-editing .contrib-actions {
  opacity: 1;
  pointer-events: auto;
}

.contrib-edit-btn,
.contrib-approve-btn,
.contrib-review-btn,
.contrib-delete-btn {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  padding: 0;
}

.contrib-edit-btn {
  background: rgba(59, 130, 246, 0.1);
  color: #2563eb;
}

.contrib-edit-btn:hover {
  background: #2563eb;
  color: white;
  transform: scale(1.1);
}

.contrib-approve-btn {
  background: rgba(22, 163, 74, 0.1);
  color: #16a34a;
}

.contrib-approve-btn:hover {
  background: #16a34a;
  color: white;
  transform: scale(1.1);
}

.contrib-review-btn {
  background: rgba(245, 158, 11, 0.12);
  color: #b45309;
}

.contrib-review-btn:hover {
  background: #f59e0b;
  color: white;
  transform: scale(1.1);
}

.contrib-delete-btn {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
}

.contrib-delete-btn:hover {
  background: #ef4444;
  color: white;
  transform: scale(1.1);
}

.contrib-edit-btn .material-symbols-outlined,
.contrib-approve-btn .material-symbols-outlined,
.contrib-review-btn .material-symbols-outlined,
.contrib-delete-btn .material-symbols-outlined {
  font-size: 18px;
}

.contrib-inline-editor {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0 0 0.75rem 0;
}

.contrib-inline-textarea {
  width: 100%;
  min-height: 108px;
  resize: vertical;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  padding: 12px 14px;
  font: inherit;
  line-height: 1.5;
  color: #1e293b;
  background: #fff;
  box-sizing: border-box;
}

.contrib-inline-textarea:focus {
  outline: none;
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.contrib-inline-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.contrib-inline-btn {
  min-width: 92px;
}

/* --- Mentions Autocomplete --- */
.mention-dropdown {
  position: absolute;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  box-shadow:
    0 4px 6px -1px rgba(0, 0, 0, 0.1),
    0 2px 4px -1px rgba(0, 0, 0, 0.06);
  max-height: 200px;
  overflow-y: auto;
  width: 100%;
  max-width: 300px;
  z-index: 1000;
  margin-top: 4px;
}

.mention-item,
.mention-item-empty {
  padding: 8px 12px;
  cursor: pointer;
  font-size: 0.9rem;
  color: #1e293b;
  transition: background 0.15s;
}

.mention-item-empty {
  color: #94a3b8;
  font-style: italic;
  cursor: default;
}

.mention-item:hover,
.mention-item.active {
  background: #f1f5f9;
}

.mention-item-dates {
  font-size: 0.75rem;
  color: #64748b;
}

/* Relative positioning for the bio edit area to anchor the dropdown */
#bio-edit-area {
  position: relative;
}

/* === WYSIWYG Contenteditable Editor === */
.wysiwyg-editor {
  position: relative;
  min-height: 120px;
  max-height: 400px;
  overflow-y: auto;
  padding: 12px 14px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: white;
  font-size: 0.9rem;
  line-height: 1.6;
  color: #334155;
  outline: none;
  cursor: text;
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
  word-wrap: break-word;
  white-space: pre-wrap;
}

.wysiwyg-editor:focus {
  border-color: var(--primary-color, #3b82f6);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.wysiwyg-editor:empty::before {
  content: 'Scrivi qui le note biografiche...';
  color: #94a3b8;
  pointer-events: none;
}

/* Formatting inside the WYSIWYG editor */
.wysiwyg-editor strong,
.wysiwyg-editor b {
  font-weight: 700;
}

.wysiwyg-editor em,
.wysiwyg-editor i {
  font-style: italic;
}

.wysiwyg-editor u {
  text-decoration: underline;
}

.wysiwyg-editor h1 {
  font-size: 1.4rem;
  font-weight: 700;
  margin: 8px 0 4px;
  color: #1e293b;
}

.wysiwyg-editor h2 {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 6px 0 4px;
  color: #334155;
}

.wysiwyg-editor blockquote {
  border: none;
  padding-left: 1.5rem;
  margin: 1rem 0 1rem 0.5rem;
  color: #64748b;
  font-style: italic;
  background: transparent;
  position: relative;
}

.wysiwyg-editor blockquote::before {
  content: '"';
  font-size: 2.5rem;
  color: #cbd5e1;
  position: absolute;
  left: -0.2rem;
  top: -0.2rem;
  font-family: Georgia, serif;
  line-height: 1;
  opacity: 0.6;
}

.wysiwyg-editor blockquote > div,
.wysiwyg-editor blockquote > p {
  margin: 0;
  padding: 0;
}

.wysiwyg-editor ul,
.wysiwyg-editor ol {
  margin: 6px 0;
  padding-left: 24px;
}

.wysiwyg-editor li {
  margin-bottom: 2px;
}

.wysiwyg-editor hr {
  border: none;
  height: 1px;
  background: linear-gradient(to right, transparent, #cbd5e1, transparent);
  margin: 12px 0;
}

.wysiwyg-editor a {
  color: var(--primary-color, #3b82f6);
  text-decoration: none;
  border-bottom: 1px solid rgba(59, 130, 246, 0.3);
}

.wysiwyg-editor img {
  max-width: 100%;
  border-radius: 8px;
  margin: 8px 0;
  display: block;
}

/* Mention tags in the editor */
.mention-tag {
  display: inline-block;
  background: rgba(59, 130, 246, 0.1);
  color: #3b82f6;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.85em;
  cursor: default;
  user-select: all;
  white-space: nowrap;
  vertical-align: baseline;
  line-height: 1;
}

/* --- Stemma Description Link styling --- */
#stemma-detail-desc .mention-link {
  color: var(--primary-color, #3b82f6);
  font-weight: 500;
  text-decoration: none;
}

#stemma-detail-desc .mention-link:hover {
  text-decoration: underline;
}

/* === Floating Formatting Toolbar === */
.formatting-toolbar.floating-toolbar {
  position: absolute;
  z-index: 9999;
  display: none;
  align-items: center;
  gap: 2px;
  padding: 5px 8px;
  background: #1e293b;
  border: none;
  border-radius: 8px;
  box-shadow:
    0 4px 16px rgba(0, 0, 0, 0.2),
    0 1px 4px rgba(0, 0, 0, 0.1);
  flex-wrap: nowrap;
  opacity: 0;
  transition: opacity 0.15s ease;
  pointer-events: auto;
}

/* Small arrow/triangle at the bottom */
.formatting-toolbar.floating-toolbar::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 12px;
  height: 12px;
  background: #1e293b;
  border-radius: 0 0 2px 0;
  transform: translateX(-50%) rotate(45deg);
}

.formatting-toolbar-btn {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: #94a3b8;
  cursor: pointer;
  padding: 0;
  transition: all 0.15s ease;
}

.formatting-toolbar-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #f1f5f9;
}

.formatting-toolbar-btn:active {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(0.95);
}

.formatting-toolbar-btn .material-symbols-outlined {
  font-size: 18px;
}

.formatting-toolbar-sep {
  width: 1px;
  height: 20px;
  background: rgba(255, 255, 255, 0.15);
  margin: 0 3px;
  flex-shrink: 0;
}

/* === Rendered Formatted Content === */
.formatted-inline-img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  margin: 8px 0;
  display: block;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.formatted-link {
  color: var(--primary-color, #3b82f6);
  text-decoration: none;
  font-weight: 500;
  border-bottom: 1px solid rgba(59, 130, 246, 0.3);
  transition: border-color 0.2s;
}

.formatted-link:hover {
  border-bottom-color: var(--primary-color, #3b82f6);
}

.formatted-hr {
  border: none;
  height: 1px;
  background: linear-gradient(to right, transparent, #cbd5e1, transparent);
  margin: 12px 0;
}

.formatted-list {
  margin: 6px 0;
  padding-left: 20px;
  list-style-type: disc;
}

.formatted-list li {
  margin-bottom: 4px;
  line-height: 1.5;
}

/* Mobile adjustments for floating toolbar */
@media (max-width: 480px) {
  .formatting-toolbar.floating-toolbar {
    gap: 1px;
    padding: 4px 5px;
  }

  .formatting-toolbar-btn {
    width: 26px;
    height: 26px;
  }

  .formatting-toolbar-btn .material-symbols-outlined {
    font-size: 16px;
  }
}

/* ===== Contribution Upload Dropzone ===== */
.contrib-dropzone {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  border: 2px dashed #cbd5e1;
  border-radius: 12px;
  background: #f8fafc;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.contrib-dropzone:hover {
  border-color: #4f46e5;
  background: rgba(79, 70, 229, 0.04);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.1);
}

.dropzone-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  pointer-events: none;
}

/* ===== Contribution Image Previews ===== */
.contrib-previews-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.contrib-document-catalog {
  margin: 0 0 14px;
  padding: 12px;
  border: 1px solid #dbeafe;
  border-radius: 12px;
  background: #f8fbff;
}

.contrib-document-catalog.hidden {
  display: none;
}

.contrib-document-catalog-header,
.contrib-document-group-header,
.contrib-document-file-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.contrib-document-catalog-header {
  justify-content: space-between;
  margin-bottom: 6px;
}

.contrib-document-catalog-title {
  margin: 0;
  color: #1e3a8a;
  font-size: 0.88rem;
  font-weight: 700;
}

.contrib-document-catalog-help {
  margin: 0 0 10px;
  color: #64748b;
  font-size: 0.78rem;
  line-height: 1.4;
}

.contrib-document-add-btn {
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: #eff6ff;
  color: #1d4ed8;
  padding: 6px 9px;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
}

.contrib-document-groups {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
}

.contrib-document-group-header input,
.contrib-document-file-row select {
  min-width: 0;
  flex: 1;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  color: #334155;
  padding: 7px 8px;
  font-size: 0.78rem;
}

.contrib-document-remove-btn {
  flex: 0 0 auto;
  border: 0;
  background: transparent;
  color: #dc2626;
  cursor: pointer;
  padding: 4px;
}

.contrib-document-files {
  display: grid;
  gap: 7px;
}

.contrib-document-file-name {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  color: #475569;
  font-size: 0.76rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.contrib-document-page {
  flex: 0 0 auto;
  min-width: 58px;
  color: #64748b;
  font-size: 0.72rem;
  text-align: right;
}

.contrib-challenge-slot {
  min-height: 66px;
  margin-bottom: 10px;
  padding: 10px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #f8fafc;
}

.contrib-challenge-slot.hidden {
  display: none;
}

.contrib-challenge-help {
  margin: 0 0 12px 0;
  font-size: 0.82rem;
  line-height: 1.45;
  color: #64748b;
}

.contrib-challenge-help.is-ready {
  color: #15803d;
}

.contrib-challenge-help.is-error {
  color: #b91c1c;
}

.preview-thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  border-radius: 10px;
  background-size: cover;
  background-position: center;
  background-color: #e2e8f0;
  border: 2px solid #e2e8f0;
  overflow: hidden;
  transition:
    transform 0.2s,
    border-color 0.2s,
    box-shadow 0.2s;
  cursor: default;
}

.preview-thumb:hover {
  transform: scale(1.04);
  border-color: #4f46e5;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.15);
}

.remove-preview {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  background: rgba(239, 68, 68, 0.9);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transition:
    opacity 0.2s,
    transform 0.15s;
  z-index: 2;
}

.preview-thumb:hover .remove-preview {
  opacity: 1;
}

.remove-preview:hover {
  transform: scale(1.15);
  background: #dc2626;
}

.add-more-preview {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 10px;
  border: 2px dashed #cbd5e1;
  background: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  color: #94a3b8;
}

.add-more-preview:hover {
  border-color: #4f46e5;
  background: rgba(79, 70, 229, 0.04);
  color: #4f46e5;
  transform: scale(1.04);
}

.add-more-preview .material-symbols-outlined {
  font-size: 28px;
}

/* Restricted Profile View (Viewer/Guest) - SELECTIVE BLUR */
body.restricted-view .profile-content,
body.restricted-view .profile-cover,
body.restricted-view .profile-avatar-container,
body.restricted-view .profile-title-wrapper {
  filter: blur(40px);
  pointer-events: none;
  user-select: none;
}

body.restricted-view .profile-nav-buttons {
  filter: none;
  pointer-events: auto;
  z-index: 10001;
}

.privacy-blur {
  filter: blur(12px);
  pointer-events: none;
  user-select: none;
  opacity: 0.6;
  transition: filter 0.3s ease;
}

/* The restricted message should be over the blurred container, not the whole body */
/* --- Restricted Access Message (OSCURATO PER PRIVACY) --- */
body.restricted-view::after {
  content: 'OSCURATO PER PRIVACY';
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  padding: 30px 40px;
  border-radius: 20px;
  font-weight: 900;
  font-size: 1.8rem;
  color: #1e293b;
  letter-spacing: 0.1em;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
  z-index: 100000; /* Absolute top-layer */
  border: 1px solid rgba(0, 0, 0, 0.1);
  pointer-events: none;
  text-align: center;
  width: 80%;
  max-width: 450px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-transform: uppercase;
}

@media (max-width: 600px) {
  body.restricted-view::after {
    font-size: 1.25rem;
    padding: 20px 25px;
    width: 85%;
  }
}

body.restricted-view header,
body.restricted-view #site-footer {
  filter: none;
  opacity: 1;
  pointer-events: auto;
}

/* Hide all controls and action buttons on restricted (privacy) view */
body.restricted-view #controls,
body.restricted-view .header-top-actions,
body.restricted-view #help-tour-btn,
body.restricted-view .help-tooltip-label,
body.restricted-view .contribute-nudge,
body.restricted-view .tour-overlay,
body.restricted-view .tour-spotlight,
body.restricted-view .tour-tooltip,
body.restricted-view #guided-contribution-dialog {
  display: none !important;
}

/* Force the back and center buttons to be sharp and interactive */
body.restricted-view #back-to-tree,
body.restricted-view #center-in-tree {
  filter: none;
  pointer-events: auto;
  z-index: 10000;
  opacity: 1;
}

body.restricted-view #back-to-tree,
body.restricted-view #center-in-tree {
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

/* Profile Edit Actions (Premium Floating/Header attached) */
.info-edit-actions {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

.info-save-btn,
.info-cancel-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  background: #f1f5f9;
}

.info-save-btn {
  color: #16a34a;
}

.info-save-btn:hover {
  background: #16a34a;
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(22, 163, 74, 0.2);
}

.info-cancel-btn {
  color: #ef4444;
}

.info-cancel-btn:hover {
  background: #ef4444;
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(239, 68, 68, 0.2);
}

/* Stemma Edit Layout within Grid */
.stemma-tags-container {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  margin: 0;
  align-items: center;
}

/* =========================================
   STEMMA SEARCH OVERLAY (Premium Layout)
   ========================================= */

/* Riga Stemmi in Edit */
.stemma-edit-wrapper.is-edit {
  align-items: center !important;
  height: auto !important;
  min-height: 56px !important;
}

.stemma-edit-wrapper.is-edit .detail-value {
  grid-column: 2 / -1 !important;
  position: relative !important;
  height: auto !important;
  overflow: visible !important;
}

/* Barra di ricerca full width */
#edit-stemmi-search {
  width: 100% !important;
  text-align: left !important;
  padding: 0 12px !important;
}

/* Posizionamento Assoluto per l'Autocomplete Stemmi */
.custom-autocomplete-results {
  position: absolute !important;
  top: 100% !important; /* Appare sotto la barra di ricerca */
  left: 0 !important;
  width: 100% !important; /* Tutta la larghezza */
  background: #ffffff !important;
  border: 1px solid rgba(0, 0, 0, 0.1) !important;
  border-radius: 8px !important;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1) !important;
  z-index: 2000 !important; /* Sopra tutto il resto del profilo */
  max-height: 250px !important; /* Blocca l'altezza massima */
  overflow-y: auto !important;
  display: flex !important;
  flex-direction: column !important;
}

/* =========================================
   FIX MOBILE - INLINE EDITING RESPONSIVE
   ========================================= */
@media (max-width: 900px) {
  .profile-title-wrapper {
    margin-top: 0 !important; /* Rimuove il margine negativo che spingeva il testo sotto l'avatar */
  }

  .profile-title {
    margin-left: 0;
    padding: 72px 1rem 0.5rem 1rem !important; /* Ridotto da 85px per compattare */
    text-align: center;
  }

  .profile-title-flex {
    display: flex !important;
    flex-direction: column !important; /* Forza lo stack per evitare sovrapposizioni */
    justify-content: center;
    align-items: center;
    gap: 4px; /* Spazio controllato tra nome e pulsanti */
    margin-bottom: 6px !important; /* Spazio dai pulsanti alle date */
  }

  .profile-title h1 {
    font-size: 1.8rem !important;
    line-height: 1.2 !important;
    margin-bottom: 0 !important;
    padding-top: 0 !important;
    overflow: visible !important;
  }

  .profile-actions {
    display: flex;
    justify-content: center;
    gap: 8px;
  }

  .profile-title p {
    font-size: 0.9rem !important;
    margin-top: 0 !important; /* Lo spazio Ã¨ gestito dal margin-bottom di .profile-title-flex */
    margin-bottom: 0 !important;
  }

  /* 1. Nome Edit: rimpicciolisci e centra come il testo statico */
  .name-edit-input {
    font-size: 1.6rem !important; /* Match esatto con la modalitÃ  view su mobile */
    text-align: center !important;
  }

  .name-edit-container {
    justify-content: center !important;
    flex-wrap: wrap !important; /* Se non c'Ã¨ spazio, manda i tasti a capo invece di tagliarli */
    gap: 8px !important;
  }

  /* 2. Stringi la griglia "Informazioni" */
  #profile-details-list li {
    grid-template-columns: 90px 1fr !important; /* Riduciamo la colonna etichette (es. "NASCITA") */
    padding: 10px 0 !important;
  }

  .detail-label {
    font-size: 0.75rem !important; /* Etichette leggermente piÃ¹ piccole */
  }

  /* 3. Compattamento Estremo per le Date */
  .inline-date-group {
    gap: 4px !important; /* Meno spazio tra i dropdown */
  }

  #edit-birth-prefix,
  #edit-death-prefix,
  #edit-marr-prefix {
    width: 50px !important; /* Stringi prefisso */
    font-size: 0.75rem !important;
    padding: 0 !important;
  }
  #edit-birth-day,
  #edit-death-day,
  #edit-marr-day {
    width: 25px !important;
  }
  #edit-birth-month,
  #edit-death-month,
  #edit-marr-month {
    width: 48px !important;
    padding-right: 12px !important; /* Spazio ridotto per la freccina SVG */
    background-size: 10px !important; /* Freccia piÃ¹ piccola */
  }
  #edit-birth-year,
  #edit-death-year,
  #edit-marr-year {
    width: 40px !important;
  }

  /* 4. Font generale degli input ridotto per i form mobile */
  .inline-edit-row .inline-edit-input,
  .inline-edit-row .inline-edit-select {
    font-size: 0.85rem !important;
  }

  /* 5. Fix Stemmi su Mobile */
  .stemma-edit-wrapper.is-edit {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    padding: 12px 0 !important;
  }

  .stemma-edit-wrapper.is-edit .detail-label {
    margin-bottom: 8px !important;
  }

  .stemma-edit-wrapper.is-edit .detail-value,
  .stemma-edit-wrapper.is-edit .stemma-edit-value {
    justify-content: flex-start !important;
    flex-wrap: wrap !important;
  }

  .stemma-tags-container {
    flex-wrap: wrap !important;
    gap: 8px !important;
  }
}

/* --- TRIBUTES SECTION --- */
.tributes-container {
  position: relative;
  overflow: visible;
  background: transparent;
  border: 0;
  box-shadow: none;
  padding: 0;
  margin: 14px 0 22px;
}

.tributes-container--wide {
  margin-top: 0;
}

.tributes-grid {
  margin-top: 0;
}

.tributes-empty-state {
  margin: 0.4rem 0 0;
  color: #64748b;
  font-size: 0.95rem;
  text-align: center;
}

.tributes-actions {
  display: flex;
  justify-content: center;
  margin-top: 1rem;
}

.tributes-grid--symbols {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 16px;
}

.tributes-grid--floating {
  align-items: center;
  overflow: visible;
}

.tribute-card {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 0;
  border-radius: 999px;
  width: 74px;
  height: 74px;
  padding: 0;
  appearance: none;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  box-shadow: none;
  overflow: visible;
}

.tribute-card--symbol:hover,
.tribute-card--symbol:focus-visible,
.tribute-card--symbol.is-active {
  transform: translateY(-6px) scale(1.14);
  outline: none;
  z-index: 40;
}

.tribute-icon {
  font-size: 36px;
  margin: 0;
  display: inline-block;
  animation: gentlePos 3s infinite ease-in-out;
  filter: drop-shadow(0 10px 16px rgba(190, 24, 93, 0.12));
}

.tribute-card--symbol .tribute-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.tribute-detail {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 12px);
  transform: translate(-50%, 10px) scale(0.96);
  display: grid;
  gap: 6px;
  min-width: 220px;
  max-width: min(320px, 70vw);
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.97);
  border: 1px solid #fbcfe8;
  box-shadow: 0 18px 35px rgba(15, 23, 42, 0.14);
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.22s ease,
    transform 0.22s ease;
  z-index: 45;
  text-align: left;
}

.tribute-detail::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 100%;
  width: 14px;
  height: 14px;
  background: rgba(255, 255, 255, 0.97);
  border-right: 1px solid #fbcfe8;
  border-bottom: 1px solid #fbcfe8;
  transform: translate(-50%, -7px) rotate(45deg);
}

.tribute-card--symbol:hover .tribute-detail,
.tribute-card--symbol:focus-visible .tribute-detail,
.tribute-card--symbol.is-active .tribute-detail {
  opacity: 1;
  transform: translate(-50%, 0) scale(1);
}

.tribute-detail-author {
  display: block;
  color: #9f1239;
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.tribute-detail-message {
  display: block;
  color: #334155;
  font-size: 0.94rem;
  line-height: 1.55;
  white-space: normal;
}

.tribute-detail-timer {
  display: inline-flex;
  align-items: center;
  justify-self: start;
  gap: 4px;
  color: #64748b;
  font-size: 0.77rem;
  font-weight: 600;
}

/* --- TRIBUTE ICON SPECIFIC ANIMATIONS --- */

.tribute-icon.icon-candle {
  animation: flickerGlow 1.5s infinite alternate;
}

.tribute-icon.icon-rose {
  transform-origin: bottom center;
  animation: swayRose 4s infinite ease-in-out;
}

.tribute-icon.icon-bouquet {
  animation: breatheBouquet 5s infinite ease-in-out;
}

.tribute-icon.icon-tree {
  transform-origin: bottom center;
  animation: swingTree 6s infinite ease-in-out;
}

.tribute-icon.icon-live-plant {
  transform-origin: bottom center;
  animation: swayRose 4.8s infinite ease-in-out;
}

.tribute-icon.icon-subscription {
  animation: floatDove 4s infinite ease-in-out;
}

@keyframes flickerGlow {
  0% {
    transform: scale(1) translateY(0);
    filter: drop-shadow(0 0 4px rgba(255, 165, 0, 0.4));
    opacity: 1;
  }
  50% {
    transform: scale(1.02, 1.05) translateY(-1px);
    filter: drop-shadow(0 0 12px rgba(255, 140, 0, 0.8));
    opacity: 0.95;
  }
  100% {
    transform: scale(0.98, 0.98) translateY(1px);
    filter: drop-shadow(0 0 8px rgba(255, 165, 0, 0.6));
    opacity: 1;
  }
}

@keyframes swayRose {
  0%,
  100% {
    transform: rotate(-5deg) translateY(0);
  }
  50% {
    transform: rotate(5deg) translateY(-2px);
  }
}

@keyframes breatheBouquet {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.08) translateY(-3px);
  }
}

@keyframes swingTree {
  0%,
  100% {
    transform: rotate(0deg);
  }
  25% {
    transform: rotate(4deg);
  }
  75% {
    transform: rotate(-4deg);
  }
}

@keyframes floatDove {
  0%,
  100% {
    transform: translateY(0) scale(1);
  }
  50% {
    transform: translateY(-8px) scale(1.05);
  }
}

@keyframes gentlePos {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-3px);
  }
}

@keyframes fadeInScale {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.tribute-card.fade-in {
  animation: fadeInScale 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.profile-tribute-badge {
  background: linear-gradient(135deg, #fce7f3, #fecdd3);
  border: 1px solid #fda4af;
  color: #be185d;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: bold;
  cursor: pointer;
  margin-left: 0;
  transition: all 0.3s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  animation: gentlePulse 2s infinite;
}
.profile-tribute-badge:hover {
  background: #fbcfe8;
  transform: scale(1.05);
}
@keyframes gentlePulse {
  0% {
    box-shadow: 0 0 0 0 rgba(225, 29, 72, 0.4);
  }
  70% {
    box-shadow: 0 0 0 6px rgba(225, 29, 72, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(225, 29, 72, 0);
  }
}

/* Modale Tributes Sidebar Modal styles */
.tribute-modal-dialog {
  width: min(92vw, 620px);
  max-width: 620px;
  max-height: 92vh;
  margin: auto;
  inset: 0;
  overflow: hidden;
  border-radius: 24px;
}

.tribute-modal-content {
  width: 100%;
  max-width: none;
  box-sizing: border-box;
  max-height: 88vh;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
  border-radius: 24px;
  background: #fff;
}

.tribute-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}

.tribute-modal-title {
  margin: 0;
  font-family: 'Playfair Display', serif;
  font-size: 2rem;
  line-height: 1.12;
  color: #be185d;
  letter-spacing: -0.02em;
}

.tribute-modal-intro {
  margin: 0 0 18px 0;
  max-width: 62ch;
  color: #475569;
  font-size: 0.95rem;
  line-height: 1.64;
}

.tribute-modal-section {
  margin-bottom: 18px;
}

.tribute-flow-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.tribute-flow-tab {
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  color: #475569;
  border-radius: 999px;
  padding: 11px 14px;
  font-size: 0.9rem;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.18s ease;
}

.tribute-flow-tab.is-active {
  border-color: #f472b6;
  background: #fff1f2;
  color: #be185d;
  box-shadow: 0 8px 22px rgba(244, 114, 182, 0.12);
}

.tribute-flow-panel.hidden {
  display: none;
}

.tribute-modal-label {
  display: block;
  margin-bottom: 10px;
  color: #1f2937;
  font-size: 0.85rem;
  font-weight: 800;
  letter-spacing: 0.01em;
}

.tribute-modal-label--secondary {
  margin-top: 4px;
}

.tribute-form-stack {
  margin-bottom: 16px;
}

.tribute-modal-input {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  padding: 12px 14px;
  font-family: inherit;
  font-size: 0.96rem;
  line-height: 1.45;
  box-sizing: border-box;
  background: #fff;
  transition:
    border-color 0.18s ease,
    box-shadow 0.18s ease;
}

.tribute-modal-input:focus {
  outline: none;
  border-color: #f472b6;
  box-shadow: 0 0 0 4px rgba(244, 114, 182, 0.12);
}

.tribute-modal-textarea {
  min-height: 66px;
  resize: vertical;
}

.tribute-tier-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 0;
}
.tribute-tier-card {
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  background: #f8fafc;
  padding: 16px 12px 14px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 150px;
}
.tribute-tier-card:hover {
  border-color: #cbd5e1;
  background: #f1f5f9;
}
.tribute-tier-card.selected {
  border-color: #ec4899;
  background: #fff1f2;
}
.tribute-tier-icon {
  font-size: 30px;
  margin-bottom: 8px;
}
.tribute-tier-name {
  font-weight: 700;
  color: #334155;
  margin-bottom: 6px;
  line-height: 1.35;
  font-size: 0.95rem;
}
.tribute-tier-price {
  font-size: 0.88rem;
  color: #64748b;
}
.tribute-tier-price--strong {
  color: #e11d48;
  font-weight: 800;
}

.tribute-tier-hint {
  margin-top: 6px;
  color: #64748b;
  font-size: 0.76rem;
  line-height: 1.4;
}

.tribute-mode-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.tribute-mode-card {
  border-radius: 12px;
  padding: 13px 14px 12px;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 78px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.tribute-mode-title {
  display: block;
  font-weight: 800;
  color: #334155;
  margin-bottom: 4px;
  font-size: 0.92rem;
}

.tribute-mode-description {
  display: block;
  font-size: 0.8rem;
  color: #64748b;
  line-height: 1.45;
}

.tribute-iban-box {
  background: #f0fdf4;
  border: 1px dashed #bbf7d0;
  padding: 12px;
  border-radius: 8px;
  margin-top: 12px;
  font-size: 13px;
  color: #166534;
  text-align: center;
}

.tribute-iban-box.hidden {
  display: none;
}

.tribute-direct-donation {
  margin-top: 4px;
  padding: 16px 18px;
  border-radius: 16px;
  background: linear-gradient(180deg, #f8fafc 0%, #f0fdf4 100%);
  border: 1px solid #dbeafe;
}

.tribute-direct-donation--standalone {
  margin-top: 0;
}

.tribute-direct-donation__intro {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.tribute-direct-donation__intro--stacked {
  align-items: flex-start;
}

.tribute-direct-donation__title {
  margin: 0 0 6px 0;
  font-size: 1rem;
  font-weight: 800;
  color: #14532d;
}

.tribute-direct-donation__text {
  margin: 0;
  color: #475569;
  font-size: 0.92rem;
  line-height: 1.62;
}

.tribute-donation-cta {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 24px;
  align-items: center;
  gap: 12px;
  width: 100%;
  margin-top: 16px;
  padding: 12px 14px;
  border: 1px solid #f472b6;
  border-radius: 16px;
  background: linear-gradient(135deg, #be185d, #e11d48);
  color: #fff;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(190, 24, 93, 0.22);
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    filter 0.18s ease;
}

.tribute-donation-cta:hover {
  transform: translateY(-1px);
  filter: brightness(1.04);
  box-shadow: 0 13px 28px rgba(190, 24, 93, 0.3);
}

.tribute-donation-cta:focus-visible {
  outline: 3px solid rgba(244, 114, 182, 0.35);
  outline-offset: 3px;
}

.tribute-donation-cta__icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.16);
  font-variation-settings: 'FILL' 1;
}

.tribute-donation-cta__copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 2px;
}

.tribute-donation-cta__copy strong {
  font-size: 0.94rem;
}

.tribute-donation-cta__copy small {
  color: #fff1f2;
  font-size: 0.74rem;
  line-height: 1.35;
}

.tribute-donation-cta__arrow {
  transition: transform 0.18s ease;
}

.tribute-donation-cta:hover .tribute-donation-cta__arrow {
  transform: translateX(3px);
}

.tribute-bank-toggle {
  flex-shrink: 0;
  border: 1px solid #86efac;
  background: #ffffff;
  color: #166534;
  border-radius: 999px;
  padding: 10px 14px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    border-color 0.18s ease;
  white-space: nowrap;
}

.tribute-bank-toggle:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(22, 101, 52, 0.12);
  border-color: #4ade80;
}

.tribute-iban-box--enhanced {
  margin-top: 12px;
  padding: 14px;
  text-align: left;
  background: rgba(255, 255, 255, 0.82);
  border: 1px dashed #86efac;
}

.tribute-bank-header strong {
  display: block;
  font-size: 0.98rem;
  color: #14532d;
}

.tribute-bank-header p {
  margin: 4px 0 0 0;
  color: #166534;
  font-size: 0.83rem;
  line-height: 1.5;
}

.tribute-bank-grid {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.tribute-bank-line {
  display: grid;
  grid-template-columns: 92px 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 9px 10px;
  border-radius: 12px;
  background: rgba(240, 253, 244, 0.88);
}

.tribute-bank-label {
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #166534;
}

.tribute-bank-value {
  min-width: 0;
  color: #14532d;
  font-weight: 700;
  line-height: 1.45;
  word-break: break-word;
}

.tribute-bank-copy {
  border: 1px solid #bbf7d0;
  background: #fff;
  color: #15803d;
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition:
    background 0.18s ease,
    transform 0.18s ease;
}

.tribute-bank-copy:hover {
  background: #f0fdf4;
  transform: translateY(-1px);
}

.tribute-bank-note {
  margin: 12px 0 0 0;
  color: #166534;
  font-size: 0.8rem;
  line-height: 1.5;
}

.tribute-modal-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  margin-top: 18px;
  padding-top: 6px;
}

.tribute-submit-btn {
  min-width: 210px;
}

.tribute-modal-content::-webkit-scrollbar {
  display: none;
}

.tribute-modal-content::-webkit-scrollbar-thumb {
  background: transparent;
}

@media (max-width: 1100px) {
  .tribute-modal-dialog {
    width: min(94vw, 580px);
    max-width: 580px;
  }

  .tribute-modal-content {
    max-width: 560px;
  }

  .tribute-tier-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
.tribute-timer {
  position: absolute;
  top: -2px;
  right: -4px;
  font-size: 11px;
  color: #94a3b8;
  font-weight: 500;
  font-family:
    ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono',
    'Courier New', monospace;
  opacity: 0.8;
  padding: 2px 4px;
  border-radius: 999px;
  background: transparent;
  border: 0;
}

@media (max-width: 900px) {
  .tribute-modal-title {
    font-size: 1.6rem;
  }

  .tribute-modal-intro {
    font-size: 0.92rem;
    line-height: 1.6;
  }

  .tributes-container {
    margin: 10px 0 18px;
  }

  .tributes-grid--symbols {
    gap: 12px;
    justify-content: center;
  }

  .tribute-card {
    width: 64px;
    height: 64px;
  }

  .tribute-detail {
    bottom: calc(100% + 10px);
    min-width: 200px;
    max-width: min(260px, 78vw);
    padding: 12px 14px;
  }

  .tribute-direct-donation__intro {
    flex-direction: column;
    align-items: stretch;
  }

  .tribute-mode-grid {
    grid-template-columns: 1fr;
  }

  .tribute-flow-tabs {
    grid-template-columns: 1fr;
  }

  .tribute-bank-toggle {
    width: 100%;
  }

  .tribute-bank-line {
    grid-template-columns: 1fr;
  }

  .tribute-bank-copy {
    justify-self: start;
  }

  .tribute-modal-actions {
    justify-content: stretch;
  }

  .tribute-submit-btn {
    width: 100%;
  }
}

@media (max-width: 640px) {
  .tribute-modal-dialog {
    width: min(96vw, 96vw);
    max-width: none;
  }

  .tribute-modal-content {
    padding: 18px !important;
    max-width: none;
    border-radius: 18px;
    scrollbar-width: none;
  }

  .tribute-modal-content::-webkit-scrollbar {
    width: 0;
    height: 0;
    display: none;
  }

  .tribute-modal-header {
    margin-bottom: 14px;
    gap: 12px;
  }

  .tribute-modal-title {
    font-size: 1.34rem;
    line-height: 1.18;
  }

  .tribute-modal-intro {
    margin-bottom: 18px;
    font-size: 0.89rem;
    line-height: 1.58;
  }

  .tribute-modal-section {
    margin-bottom: 18px;
  }

  .tribute-flow-tabs {
    gap: 8px;
    margin-bottom: 14px;
  }

  .tribute-flow-tab {
    padding: 10px 12px;
    font-size: 0.84rem;
  }

  .tribute-tier-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .tribute-tier-card {
    padding: 14px 10px 13px;
    min-height: 148px;
  }

  .tribute-tier-icon {
    font-size: 28px;
    margin-bottom: 8px;
  }

  .tribute-tier-name {
    font-size: 0.92rem;
    margin-bottom: 6px;
  }

  .tribute-tier-price {
    font-size: 0.92rem;
  }

  .tribute-tier-hint {
    font-size: 0.76rem;
    margin-top: 6px;
  }

  .tribute-mode-card {
    padding: 12px 12px 11px;
    min-height: 0;
  }

  .tribute-mode-title {
    font-size: 0.9rem;
    margin-bottom: 4px;
  }

  .tribute-mode-description {
    font-size: 0.79rem;
    line-height: 1.45;
  }

  .tribute-modal-label {
    margin-bottom: 8px;
    font-size: 0.82rem;
  }

  .tribute-modal-input {
    padding: 11px 12px;
    font-size: 0.92rem;
  }

  .tribute-modal-textarea {
    min-height: 72px;
  }

  .tribute-direct-donation {
    margin-top: 4px;
    padding: 15px 14px;
  }

  .tribute-direct-donation__title {
    font-size: 0.97rem;
    margin-bottom: 5px;
  }

  .tribute-direct-donation__text {
    font-size: 0.88rem;
    line-height: 1.58;
  }

  .tribute-bank-toggle {
    padding: 11px 12px;
    font-size: 0.82rem;
  }

  .tribute-iban-box--enhanced {
    padding: 14px 12px;
  }

  .tribute-bank-grid {
    gap: 8px;
    margin-top: 12px;
  }

  .tribute-bank-line {
    gap: 6px;
    padding: 10px;
  }

  .tribute-bank-label {
    font-size: 0.72rem;
  }

  .tribute-bank-value {
    font-size: 0.88rem;
    line-height: 1.45;
  }

  .tribute-bank-copy {
    width: 100%;
    justify-self: stretch;
    text-align: center;
  }

  .tribute-bank-note {
    margin-top: 12px;
    font-size: 0.79rem;
  }

  .tribute-modal-actions {
    margin-top: 20px;
  }

  .tribute-submit-btn {
    min-width: 0;
  }
}
.tribute-wallet-summary,
.points-wallet-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  margin: 12px 0 18px;
  border: 1px solid #fde68a;
  border-radius: 16px;
  background: #fffbeb;
  color: #92400e;
}

.tribute-donation-input-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 10px 0;
}

.points-wallet-dialog {
  width: min(94vw, 720px);
  max-height: min(90vh, 780px);
  box-sizing: border-box;
  padding: 0;
  border: 0;
  border-radius: 28px;
  overflow: hidden;
  background: #f8fafc;
  color: #172033;
  box-shadow: 0 32px 90px rgba(15, 23, 42, 0.3);
  scrollbar-width: none;
}

.points-wallet-dialog::-webkit-scrollbar,
.wallet-body::-webkit-scrollbar {
  display: none;
}

.points-wallet-dialog::backdrop {
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(8px);
}

.wallet-shell {
  min-height: 520px;
  max-height: min(90vh, 780px);
  display: flex;
  flex-direction: column;
}

.wallet-hero {
  position: relative;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  gap: 14px;
  min-height: 218px;
  box-sizing: border-box;
  padding: 24px 28px 20px;
  color: #fff;
  background:
    radial-gradient(
      circle at 82% 0%,
      rgba(250, 204, 21, 0.28),
      transparent 35%
    ),
    linear-gradient(135deg, #153c2b 0%, #0b2920 58%, #071b16 100%);
}

.wallet-hero::after {
  content: '';
  position: absolute;
  width: 260px;
  height: 260px;
  right: -110px;
  bottom: -170px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 50%;
  box-shadow:
    0 0 0 38px rgba(255, 255, 255, 0.025),
    0 0 0 76px rgba(255, 255, 255, 0.018);
  pointer-events: none;
}

.wallet-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.wallet-brand > span:last-child {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.wallet-brand small {
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #fde047;
}
.wallet-brand strong {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.38rem;
  color: #ffffff;
}
.wallet-brand-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(253, 224, 71, 0.45);
  border-radius: 14px;
  background: rgba(253, 224, 71, 0.15);
  color: #fde047;
}

.wallet-close {
  position: absolute;
  z-index: 2;
  top: 20px;
  right: 20px;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  cursor: pointer;
  transition: all 0.2s ease;
}
.wallet-close:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: scale(1.05);
}

.wallet-hero-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: stretch;
}

.wallet-balance-box {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  background: rgba(0, 0, 0, 0.24);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 18px;
  padding: 16px 18px;
  backdrop-filter: blur(8px);
}

.wallet-balance-sub {
  color: #a7f3d0;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.wallet-balance-num {
  font-size: clamp(1.8rem, 4vw, 2.3rem);
  line-height: 1.1;
  letter-spacing: -0.03em;
  color: #ffffff;
  font-weight: 850;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

.wallet-balance-hint {
  display: flex;
  align-items: center;
  gap: 5px;
  color: #fde047;
  font-size: 0.78rem;
  font-weight: 600;
  margin-top: 2px;
}

.wallet-honor-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  background: rgba(0, 0, 0, 0.35);
  border: 1.5px solid rgba(250, 204, 21, 0.45);
  border-radius: 18px;
  padding: 14px 18px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(8px);
}

.wallet-honor-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.wallet-honor-icon {
  font-size: 32px;
  line-height: 1;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.4));
  flex-shrink: 0;
}

.wallet-honor-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.wallet-honor-tag {
  font-size: 0.68rem;
  color: #fde047;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 800;
}

.wallet-honor-name {
  font-size: 1.06rem;
  color: #ffffff;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wallet-milestone-box {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding-top: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.wallet-milestone-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.74rem;
  color: #cbd5e1;
}

.wallet-milestone-track {
  height: 7px;
  background: rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  overflow: hidden;
}

.wallet-milestone-fill {
  height: 100%;
  background: linear-gradient(90deg, #facc15, #34d399);
  border-radius: 999px;
  transition: width 0.4s ease;
  box-shadow: 0 0 8px rgba(250, 204, 21, 0.5);
}

.wallet-max-tier-note {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: #34d399;
  font-weight: 700;
  padding-top: 4px;
}

.wallet-tabs {
  flex-shrink: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  padding: 0 20px;
  border-bottom: 2px solid #e2e8f0;
  background: #ffffff;
}
.wallet-tabs button {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  padding: 14px 8px;
  border: 0;
  border-bottom: 3px solid transparent;
  background: transparent;
  color: #475569;
  font-weight: 750;
  font-size: 0.88rem;
  cursor: pointer;
  transition: all 0.18s ease;
}
.wallet-tabs button:hover {
  color: #15803d;
  background: rgba(22, 163, 74, 0.04);
}
.wallet-tabs button.is-active {
  border-bottom-color: #15803d;
  color: #15803d;
  background: #f0fdf4;
}
.wallet-tabs .material-symbols-outlined {
  font-size: 19px;
}

.wallet-body {
  flex: 1 1 auto;
  max-height: 440px;
  padding: 24px 28px 32px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
  background: #f8fafc;
}

.wallet-body::-webkit-scrollbar {
  width: 6px;
  display: block;
}

.wallet-body::-webkit-scrollbar-track {
  background: transparent;
}

.wallet-body::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 999px;
}

.wallet-body::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

.wallet-section-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.wallet-section-heading > span:first-child {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.wallet-section-heading small {
  color: #047857;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.wallet-section-heading strong {
  font-size: 1.15rem;
  font-weight: 800;
  color: #0f172a;
}
.wallet-count {
  min-width: 28px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #dcfce7;
  color: #15803d;
  text-align: center;
  font-size: 0.75rem;
  font-weight: 800;
}

.wallet-rewards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
  padding-bottom: 16px;
}

.wallet-reward-card {
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  border-radius: 16px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.05);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.wallet-reward-card:hover {
  transform: translateY(-2px);
  border-color: #10b981;
  box-shadow: 0 10px 24px rgba(16, 185, 129, 0.14);
}

.wallet-reward-card.is-available {
  border-color: #86efac;
  background: linear-gradient(180deg, #ffffff 0%, #f0fdf4 100%);
}

.wallet-reward-badge-available {
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 0.72rem;
  padding: 3px 9px;
  border-radius: 12px;
  background: #dcfce7;
  color: #166534;
  font-weight: 700;
  border: 1px solid #86efac;
}

.wallet-reward-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.wallet-reward-icon {
  font-size: 28px;
  line-height: 1;
}

.wallet-reward-title {
  font-size: 1rem;
  font-weight: 800;
  color: #0f172a;
  margin: 0;
}

.wallet-reward-desc {
  font-size: 0.85rem;
  color: #334155;
  line-height: 1.45;
  margin: 0;
}

.wallet-reward-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid #e2e8f0;
  padding-top: 10px;
  margin-top: 4px;
}

.wallet-reward-points {
  font-size: 0.92rem;
  font-weight: 800;
  color: #92400e;
  background: #fef3c7;
  border: 1px solid #fde68a;
  padding: 4px 10px;
  border-radius: 8px;
}

.wallet-reward-missing {
  font-size: 0.78rem;
  color: #64748b;
  font-weight: 600;
}

.btn-use-reward {
  padding: 6px 14px;
  border-radius: 8px;
  background: #16a34a;
  color: #ffffff;
  border: none;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(22, 163, 74, 0.35);
  transition: all 0.18s ease;
}

.btn-use-reward:hover {
  background: #15803d;
  transform: scale(1.04);
}

.wallet-credit-box {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 16px;
  background: #ffffff;
  border-radius: 14px;
  border: 1.5px solid #cbd5e1;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}

.wallet-credit-box-title {
  color: #0f172a;
  font-size: 0.95rem;
  font-weight: 800;
}

.wallet-credit-box-desc {
  margin: 3px 0 0;
  font-size: 0.84rem;
  color: #334155;
  line-height: 1.45;
}

.wallet-transaction {
  display: grid;
  grid-template-columns: 42px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 14px 0;
  border-top: 1px solid #e8edf3;
}
.wallet-transaction-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
}
.wallet-transaction-icon.is-credit {
  background: #dcfce7;
  color: #15803d;
}
.wallet-transaction-icon.is-debit {
  background: #ffe4e6;
  color: #be123c;
}
.wallet-transaction-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.wallet-transaction-copy strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.wallet-transaction-copy small {
  margin-top: 3px;
  color: #94a3b8;
}
.wallet-transaction-amount {
  white-space: nowrap;
}
.wallet-transaction-amount.is-credit {
  color: #15803d;
}
.wallet-transaction-amount.is-debit {
  color: #be123c;
}

.wallet-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 38px 20px;
  border: 1px dashed #cbd5e1;
  border-radius: 18px;
  color: #64748b;
  text-align: center;
}
.wallet-empty > .material-symbols-outlined {
  margin-bottom: 10px;
  font-size: 34px;
  color: #b38716;
}
.wallet-empty p {
  margin: 5px 0 0;
  font-size: 0.84rem;
}

.wallet-credit-card {
  display: grid;
  grid-template-columns: 50px 1fr;
  gap: 12px 16px;
  padding: 22px;
  border: 1px solid #dbe4df;
  border-radius: 20px;
  background: linear-gradient(145deg, #fff 0%, #f5faf7 100%);
}
.wallet-credit-icon {
  display: grid;
  place-items: center;
  width: 50px;
  height: 50px;
  border-radius: 16px;
  background: #e8f5ed;
  color: #15803d;
  font-size: 28px;
}
.wallet-credit-card p {
  margin: 4px 0 0;
  color: #64748b;
  font-size: 0.82rem;
  line-height: 1.45;
}
.wallet-credit-card > label {
  grid-column: 1 / -1;
  margin-top: 8px;
  font-size: 0.78rem;
  font-weight: 800;
}
.wallet-amount-field {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  border: 1px solid #cbd5e1;
  border-radius: 14px;
  background: #fff;
  overflow: hidden;
}
.wallet-amount-field span {
  padding-left: 16px;
  color: #64748b;
  font-weight: 800;
}
.wallet-amount-field input {
  width: 100%;
  padding: 14px 16px 14px 8px;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 1.12rem;
  font-weight: 800;
}
.wallet-conversion {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  padding: 12px 14px;
  border-radius: 12px;
  background: #fffbeb;
  color: #92400e;
}
.wallet-credit-card > button {
  grid-column: 1 / -1;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  padding: 14px;
  border: 0;
  border-radius: 14px;
  background: #166534;
  color: #fff;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(22, 101, 52, 0.2);
}
.wallet-credit-card > button:hover {
  background: #14532d;
}
.wallet-credit-card > button:disabled {
  opacity: 0.7;
  cursor: wait;
}
.wallet-secure-note {
  grid-column: 1 / -1;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 5px;
  color: #64748b;
  text-align: center;
}
.wallet-secure-note .material-symbols-outlined {
  font-size: 15px;
  color: #15803d;
}
.wallet-button-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@media (max-width: 620px) {
  .points-wallet-dialog {
    width: calc(100vw - 24px);
    max-width: calc(100vw - 24px);
    max-height: calc(100dvh - 32px);
    margin: auto;
    border-radius: 22px;
    overflow-x: hidden;
    overflow-y: auto;
    scrollbar-width: none;
  }
  .points-wallet-dialog::-webkit-scrollbar {
    display: none;
  }
  .wallet-shell {
    min-height: 0;
  }
  .wallet-hero {
    gap: 14px;
    min-height: 0;
    padding: 18px;
  }
  .wallet-hero-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .wallet-brand-icon {
    width: 36px;
    height: 36px;
    border-radius: 12px;
  }
  .wallet-brand strong {
    font-size: 1.15rem;
  }
  .wallet-brand small {
    font-size: 0.56rem;
  }
  .wallet-close {
    top: 14px;
    right: 14px;
    width: 34px;
    height: 34px;
  }
  .wallet-balance {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: end;
    gap: 2px 12px;
  }
  .wallet-balance > span {
    align-self: center;
  }
  .wallet-balance > strong {
    grid-column: 2;
    grid-row: 1 / span 2;
    margin: 0;
    font-size: 2rem;
    white-space: nowrap;
  }
  .wallet-balance > small {
    grid-column: 1;
  }
  .wallet-benefit {
    max-width: none;
    margin-top: 0;
    padding: 9px 11px;
    border-radius: 13px;
  }
  .wallet-benefit strong {
    font-size: 0.78rem;
  }
  .wallet-benefit small {
    font-size: 0.65rem;
  }
  .wallet-tabs {
    position: static;
    padding: 0 8px;
  }
  .wallet-tabs button {
    gap: 5px;
    padding: 12px 6px;
    font-size: 0.76rem;
  }
  .wallet-body {
    max-height: none;
    padding: 18px 16px 22px;
    overflow: visible;
  }
  .wallet-section-heading {
    margin-bottom: 10px;
  }
  .wallet-section-heading strong {
    font-size: 1rem;
  }
  .wallet-transaction {
    grid-template-columns: 34px minmax(0, 1fr) auto;
    gap: 9px;
    padding: 11px 0;
  }
  .wallet-transaction-icon {
    width: 32px;
    height: 32px;
    border-radius: 10px;
  }
  .wallet-transaction-copy strong {
    font-size: 0.82rem;
  }
  .wallet-transaction-copy small,
  .wallet-transaction-amount {
    font-size: 0.7rem;
  }
  .wallet-transaction-amount {
    grid-column: auto;
  }
  .wallet-credit-card {
    grid-template-columns: 40px 1fr;
    gap: 10px 12px;
    padding: 16px;
  }
  .wallet-credit-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    font-size: 23px;
  }
}

/* QR Card Centering on Mobile & Desktop */
#generated-qr-card,
.qr-card {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  text-align: center !important;
}

#generated-qr-card h3,
#generated-qr-card p,
.qr-card h3,
.qr-card p {
  text-align: center !important;
  width: 100% !important;
}

#qrcode-container,
.qr-container {
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
  margin: 0 auto !important;
  text-align: center !important;
  width: 100% !important;
  background: transparent !important;
}

#qrcode-container a,
#qrcode-container img,
#qrcode-container canvas {
  margin: 0 auto !important;
  display: block !important;
}

.social-share-toolbar {
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
  gap: 8px !important;
  flex-wrap: wrap !important;
  margin: 12px auto 0 !important;
  width: 100% !important;
}

/* Auth / Registration CTA inside Contribution Card */
.contrib-auth-cta {
  margin: 12px 0 16px;
  padding: 12px 14px;
  background: linear-gradient(
    135deg,
    rgba(248, 250, 252, 0.98),
    rgba(241, 245, 249, 0.95)
  );
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
}

.contrib-auth-cta.hidden {
  display: none !important;
}

.contrib-auth-cta-text {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  color: #334155;
  margin-bottom: 10px;
}

.contrib-auth-cta-text .runtime-gold-icon {
  color: #d97706;
  font-size: 18px;
}

.contrib-oauth-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.btn-contrib-oauth {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #1e293b;
  transition: all 0.18s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.btn-contrib-oauth:hover {
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.08);
}

.btn-contrib-facebook {
  background: #1877f2;
  color: #ffffff;
  border-color: #1877f2;
}
.btn-contrib-facebook:hover {
  background: #0d6efd;
}

.btn-contrib-login {
  background: #0f172a;
  color: #ffffff;
  border-color: #0f172a;
}
.btn-contrib-login:hover {
  background: #1e293b;
}

.contrib-auth-or {
  margin-top: 10px;
  font-size: 0.76rem;
  color: #64748b;
  text-align: center;
  border-top: 1px dashed #cbd5e1;
  padding-top: 6px;
}

/* ==========================================================================
   Micro-contributions: Nuvoletta & Missing Field Nudges
   ========================================================================== */

.empty-field-val {
  display: flex !important;
  align-items: center !important;
  justify-content: flex-end !important;
  min-height: 30px;
  line-height: 1 !important;
}

.field-nudge-wrapper {
  display: inline-flex;
  align-items: center;
}

.btn-field-add-hint {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 26px;
  padding: 2px 8px;
  background: #fff;
  color: #b45309;
  border: 1px solid #fdba74;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 650;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(154, 52, 18, 0.08);
  transition:
    background 0.18s ease,
    border-color 0.18s ease;
  font-family: inherit;
}

.btn-field-add-hint:hover,
.btn-field-add-hint:focus-visible {
  background: #ffedd5;
  border-color: #f97316;
  outline: 2px solid rgba(249, 115, 22, 0.22);
  outline-offset: 2px;
}

.btn-field-add-hint .nudge-btn-icon {
  font-size: 14px;
  line-height: 1;
}

.btn-field-add-hint .nudge-btn-text {
  font-size: 0.72rem;
  letter-spacing: 0;
}

/* ==========================================================================
   FAMILY MEMBER SUGGESTIONS (Parents, Spouse, Children)
   ========================================================================== */

.family-member-hint-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 10px;
  cursor: pointer;
  background: rgba(254, 243, 199, 0.32);
  border: 1px dashed rgba(245, 158, 11, 0.45);
  margin-top: 5px;
  margin-bottom: 7px;
  transition:
    background 0.18s ease,
    border-color 0.18s ease,
    transform 0.15s ease,
    box-shadow 0.15s ease;
}

.family-member-hint-item:hover {
  background: rgba(254, 243, 199, 0.6);
  border-color: #f59e0b;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.1);
}

.family-member-hint-item.family-hint-add-child {
  background: rgba(240, 249, 255, 0.55);
  border-color: rgba(56, 189, 248, 0.45);
}

.family-member-hint-item.family-hint-add-child:hover {
  background: rgba(240, 249, 255, 0.85);
  border-color: #0284c7;
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.1);
}

.fm-avatar-hint {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #fef3c7;
  color: #b45309;
  border: 1.5px dashed #f59e0b;
  flex-shrink: 0;
  transition: transform 0.18s ease;
}

.family-member-hint-item:hover .fm-avatar-hint {
  transform: scale(1.05);
}

.fm-avatar-hint .nudge-avatar-icon {
  font-size: 20px;
}

.fm-avatar-add-more {
  background: #e0f2fe;
  color: #0369a1;
  border-color: #38bdf8;
}

.family-member-hint-item .fm-info {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.fm-hint-title-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 8px;
  line-height: 1.25;
}

.fm-hint-role-name {
  font-size: 0.88rem;
  font-weight: 600;
  color: #1e293b;
}

.fm-hint-badge {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(245, 158, 11, 0.18);
  color: #b45309;
}

.fm-hint-desc {
  font-size: 0.78rem;
  color: #64748b;
  line-height: 1.35;
  margin: 0;
  overflow-wrap: break-word;
  word-break: normal;
}

.family-hint-add-child .fm-hint-desc {
  color: #0369a1;
}

.fm-hint-actions {
  margin-left: auto;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  padding-left: 8px;
}

.fm-hint-action-btn {
  white-space: nowrap;
}

@media (max-width: 580px) {
  .family-member-hint-item {
    flex-wrap: wrap;
    gap: 10px;
  }

  .family-member-hint-item .fm-hint-actions {
    width: 100%;
    justify-content: flex-end;
    padding-left: 0;
    margin-top: 2px;
  }
}

/* Dark mode overrides */
body.dark-mode .family-member-hint-item {
  background: rgba(245, 158, 11, 0.08);
  border-color: rgba(245, 158, 11, 0.28);
}

body.dark-mode .family-member-hint-item:hover {
  background: rgba(245, 158, 11, 0.16);
  border-color: rgba(245, 158, 11, 0.5);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

body.dark-mode .family-member-hint-item.family-hint-add-child {
  background: rgba(56, 189, 248, 0.08);
  border-color: rgba(56, 189, 248, 0.28);
}

body.dark-mode .family-member-hint-item.family-hint-add-child:hover {
  background: rgba(56, 189, 248, 0.16);
  border-color: rgba(56, 189, 248, 0.5);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

body.dark-mode .fm-avatar-hint {
  background: rgba(245, 158, 11, 0.18);
  color: #fcd34d;
  border-color: rgba(245, 158, 11, 0.45);
}

body.dark-mode .fm-avatar-add-more {
  background: rgba(56, 189, 248, 0.18);
  color: #7dd3fc;
  border-color: rgba(56, 189, 248, 0.45);
}

body.dark-mode .fm-hint-role-name {
  color: #f1f5f9;
}

body.dark-mode .fm-hint-desc {
  color: #94a3b8;
}

body.dark-mode .family-hint-add-child .fm-hint-desc {
  color: #7dd3fc;
}

/* ==========================================================================
   BRANCH COMPLETENESS & GENTLE GAMIFICATION STYLES
   ========================================================================== */

.branch-health-widget {
  margin-top: 16px;
  margin-bottom: 2rem;
  overflow: hidden;
  border: 1px solid #dbe4f0;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.09);
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

.branch-health-widget.is-guiding {
  border-color: #f59e0b;
  box-shadow:
    0 0 0 4px rgba(245, 158, 11, 0.16),
    0 10px 28px rgba(15, 23, 42, 0.12);
}

.branch-health-summary {
  padding: 16px;
  background: #17213a;
}

.branch-health-header,
.branch-health-title-row,
.branch-health-nudge,
.branch-health-nudge-copy,
.branch-health-actions,
.contribution-hub-context {
  display: flex;
  align-items: center;
}

.branch-health-header {
  gap: 14px;
}

.branch-health-heading {
  min-width: 0;
  flex: 1;
}

.branch-health-title-row {
  justify-content: space-between;
  gap: 8px;
}

.branch-health-title-row h3 {
  margin: 0;
  color: #f8fafc;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0;
}

.branch-health-heading p {
  margin: 3px 0 0;
  color: #cbd5e1;
  font-size: 0.78rem;
  line-height: 1.35;
}

.branch-health-status {
  flex: 0 0 auto;
  padding: 3px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  color: #e2e8f0;
  font-size: 0.69rem;
}

.radial-completeness-badge {
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.3));
}

.branch-health-nudge {
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(96, 165, 250, 0.4);
  border-radius: 6px;
  background: rgba(30, 64, 175, 0.22);
}

.branch-health-nudge-copy {
  min-width: 0;
  gap: 8px;
}

.branch-health-nudge-copy > .material-symbols-outlined {
  flex: 0 0 auto;
  color: #93c5fd;
  font-size: 20px;
}

.branch-health-nudge-copy > div {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.branch-health-eyebrow {
  color: #93c5fd;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.branch-health-field {
  overflow: hidden;
  color: #fff;
  font-size: 0.84rem;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-nudge-action {
  display: inline-flex;
  min-height: 34px;
  flex: 0 0 auto;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border: 0;
  border-radius: 6px;
  background: #2563eb;
  color: #fff;
  font: inherit;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
}

.btn-nudge-action .material-symbols-outlined {
  font-size: 17px;
}

.btn-nudge-action:hover,
.btn-nudge-action:focus-visible {
  background: #1d4ed8;
  outline: 2px solid rgba(147, 197, 253, 0.55);
  outline-offset: 2px;
}

.branch-health-celebration {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding: 9px 12px;
  border: 1px solid rgba(52, 211, 153, 0.35);
  border-radius: 6px;
  background: rgba(16, 185, 129, 0.14);
  color: #a7f3d0;
  font-size: 0.8rem;
}

.branch-health-actions {
  justify-content: flex-end;
  gap: 8px;
  margin-top: 10px;
}

.btn-health-wa,
.btn-health-copy {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  border-radius: 6px;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 650;
  text-decoration: none;
  cursor: pointer;
}

.btn-health-wa {
  border: 1px solid rgba(74, 222, 128, 0.45);
  background: rgba(34, 197, 94, 0.14);
  color: #bbf7d0;
}

.btn-health-copy {
  border: 1px solid rgba(203, 213, 225, 0.35);
  background: rgba(255, 255, 255, 0.08);
  color: #e2e8f0;
}

.btn-health-wa .material-symbols-outlined,
.btn-health-copy .material-symbols-outlined {
  font-size: 16px;
}

.btn-health-wa:hover,
.btn-health-wa:focus-visible {
  background: rgba(34, 197, 94, 0.24);
}

.btn-health-copy:hover,
.btn-health-copy:focus-visible {
  background: rgba(255, 255, 255, 0.15);
}

.contribution-hub-body {
  padding: 16px;
}

.contribution-hub-context {
  gap: 10px;
  margin-bottom: 16px;
  padding-bottom: 13px;
  border-bottom: 1px solid #e2e8f0;
}

.contribution-hub-context > .material-symbols-outlined {
  color: #2563eb;
  font-size: 24px;
}

.contribution-hub-context > div {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 2px;
}

.contribution-hub-context strong {
  color: #1e293b;
  font-size: 0.84rem;
}

.contribution-hub-context span:not(.material-symbols-outlined) {
  color: #64748b;
  font-size: 0.7rem;
  line-height: 1.35;
}

.contribution-hub-composer {
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.contribution-hub-composer .guided-tour-contrib-target > h3 {
  display: none;
}

.contribution-hub-composer #contrib-submit-btn {
  border-color: #1d4ed8;
  background: #2563eb;
  color: #fff;
}

@media (max-width: 640px) {
  .branch-health-title-row,
  .branch-health-nudge {
    align-items: flex-start;
    flex-direction: column;
  }

  .branch-health-status {
    align-self: flex-start;
  }

  .btn-nudge-action {
    width: 100%;
    justify-content: center;
  }

  .branch-health-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .btn-health-wa,
  .btn-health-copy {
    justify-content: center;
    text-align: center;
  }
}
.profile-events-card {
  padding: 20px;
  border: 1px solid var(--border-color, #dbe3eb);
  border-radius: 16px;
  background: var(--card-bg, #fff);
  color: var(--text-color, #243447);
  margin-bottom: 20px;
}
.profile-events-list {
  padding-left: 22px;
}
.profile-event {
  padding: 12px 0;
  overflow-wrap: anywhere;
}
.profile-event p {
  margin: 6px 0;
}
.profile-event small {
  color: var(--text-secondary, #586779);
}
.profile-event-withdrawn {
  opacity: 0.65;
}
.profile-event-editor {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}
.profile-event-editor label {
  display: grid;
  gap: 5px;
}
.profile-research-advanced {
  border: 1px solid var(--border-color, #dbe3eb);
  border-radius: 10px;
  min-width: 0;
}
.profile-research-advanced > summary {
  padding: 12px;
  cursor: pointer;
  font-weight: 600;
}
.profile-research-advanced > summary:focus-visible {
  outline: 2px solid var(--primary-color, #2563eb);
  outline-offset: 2px;
}
.profile-research-advanced-fields {
  display: grid;
  gap: 12px;
  padding: 0 12px 12px;
  min-width: 0;
}
.profile-event-editor label[hidden] {
  display: none;
}
.profile-event-editor input,
.profile-event-editor textarea,
.profile-event-editor select {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  padding: 9px;
  border: 1px solid var(--border-color, #bdc9d5);
  border-radius: 8px;
  color: inherit;
  background: var(--card-bg, #fff);
}
.profile-event-editor textarea {
  min-height: 90px;
  resize: vertical;
}
.profile-event-citation-editor {
  display: grid;
  gap: 8px;
  margin: 12px 0;
}
.profile-event-editor fieldset {
  min-width: 0;
}
.profile-household-member-editor {
  border-top: 1px solid var(--border-color, #dbe3eb);
  padding: 12px 0;
  display: grid;
  gap: 8px;
  min-width: 0;
}
#profile-info-card > .profile-research-field {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr);
  align-items: center;
  padding: 12px 0;
  margin: 0;
  border-bottom: 1px solid #f8fafc;
  min-height: 56px;
  box-sizing: border-box;
  min-width: 0;
}
#profile-info-card > .profile-research-field:last-child {
  border-bottom: 0;
}
.profile-research-field > .detail-label {
  cursor: help;
}
.profile-research-content {
  display: none;
  grid-column: 1 / -1;
  min-width: 0;
  padding-top: 12px;
}
.profile-research-field.is-expanded > .profile-research-content,
#profile-genealogical-events.has-records > .profile-research-content,
#profile-info-card:has(#profile-details-list.editing)
  .profile-research-content {
  display: block;
}
#profile-genealogical-events.has-records > .detail-value > .profile-research-summary {
  display: none;
}
.profile-residence-entries {
  display: grid;
  gap: 12px;
}
.profile-residence-entry {
  display: grid;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--border-color, #dbe3eb);
  border-radius: 10px;
  background: rgba(248, 250, 252, 0.7);
}
.profile-residence-range-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.profile-residence-add-another,
.profile-residence-remove-row {
  justify-self: start;
}
.profile-residence-civic-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.profile-residence-civic-suggestions:empty {
  display: none;
}
.profile-residence-civic-chip {
  font-size: 0.78rem;
  padding: 4px 10px;
  border-radius: 999px;
}
#profile-genealogical-events .profile-events-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}
#profile-genealogical-events .profile-event {
  padding: 8px 12px;
  border-left: 3px solid rgba(99, 102, 241, 0.35);
  background: rgba(248, 250, 252, 0.8);
  border-radius: 6px;
}
#profile-genealogical-events .profile-event p {
  margin: 2px 0;
}
#profile-info-card:not(:has(#profile-details-list.editing))
  [data-research-edit],
#profile-info-card:has(#profile-details-list.editing)
  .profile-research-contribute,
#profile-info-card:has(#profile-details-list.editing)
  .profile-research-summary {
  display: none !important;
}
.profile-research-summary {
  background: transparent;
  border: 0;
  color: inherit;
  font: inherit;
  font-size: 0.8rem;
  cursor: pointer;
  text-decoration: underline dotted;
  padding: 0;
}
@media (max-width: 900px) {
  #profile-info-card > .profile-research-field {
    grid-template-columns: 90px minmax(0, 1fr);
    padding: 10px 0;
  }
}
@media (max-width: 520px) {
  .profile-residence-range-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}
#profile-alternate-names,
#profile-relationship-types,
#profile-vital-records,
#profile-genealogical-events,
#profile-households {
  scroll-margin-top: 90px;
}
.profile-record-participant-list {
  margin: 6px 0;
  padding-left: 18px;
}
.profile-record-participant {
  padding: 8px 0;
  border-bottom: 1px solid var(--border-color, #dbe3eb);
}
.profile-record-appearances h4 {
  margin: 14px 0 6px;
}
.fm-link-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 6px 8px 4px;
  font-size: 0.82rem;
}
.fm-link-badge {
  display: inline-flex;
  align-items: center;
  margin: 4px 0 2px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(99, 102, 241, 0.1);
  color: #4338ca;
  font-size: 0.78rem;
  font-weight: 600;
}
.fm-union-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}
.fm-link-control {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: #475569;
}
.fm-link-control-label {
  white-space: nowrap;
}
.fm-link-select {
  font-size: 0.8rem;
  padding: 3px 6px;
}
.fm-union-summary {
  color: #475569;
  font-size: 0.82rem;
}
.profile-vital-records-drawer {
  padding: 14px 18px;
}
.profile-vital-records-drawer-summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.88rem;
  color: #334155;
  list-style-position: inside;
}
.profile-vital-records-drawer-body {
  margin-top: 12px;
}
.profile-vital-records-drawer-body > #profile-vital-records > h3,
.profile-vital-records-drawer-body > #profile-vital-records > p {
  display: none;
}
.profile-records-ai-panel {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border-color, #dbe3eb);
}
.profile-records-ai-panel > h4 {
  margin: 0 0 4px;
  font-size: 0.85rem;
  color: #1e293b;
}
.profile-records-ai-hint,
.profile-records-ai-empty,
.profile-records-ai-status {
  margin: 0 0 8px;
  font-size: 0.8rem;
  color: #64748b;
}
.profile-records-ai-autocomplete {
  margin-bottom: 10px;
}
.profile-records-ai-doc,
.profile-records-ai-panel .archival-fact {
  margin: 8px 0;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border-color, #dbe3eb);
  background: rgba(248, 250, 252, 0.8);
}
.archival-fact-source {
  margin: 0 0 4px;
  font-size: 0.76rem;
  font-weight: 600;
  color: #475569;
}

.profile-event-history article {
  padding: 12px 0;
  border-bottom: 1px solid var(--border-color, #dbe3eb);
}

/* Stato della persona nell'intestazione del profilo */
.person-evidence-badge {
  margin-left: 8px;
  vertical-align: middle;
  cursor: help;
}

/* Sezione DNA del profilo (solo amministratori) */
.profile-dna-card {
  --dna-person: #2f7d5b;
  --dna-couple: #3b6fb6;
  --dna-background: #a7b1bc;
  --dna-none: #d9a441;
}
.profile-dna-block {
  margin-top: 18px;
}
.profile-dna-block > h4 {
  margin: 0 0 6px;
}
.profile-dna-help {
  color: var(--text-secondary, #586779);
  font-size: 0.92em;
  margin: 4px 0 10px;
}
.profile-dna-list {
  padding-left: 20px;
  margin: 6px 0;
}
.profile-dna-list > li {
  margin: 6px 0;
  overflow-wrap: anywhere;
}
.profile-dna-list > li.is-failed {
  color: var(--danger-color, #b3261e);
}
.profile-dna-person {
  border: 0;
  background: none;
  padding: 0;
  color: var(--link-color, #1f5fa8);
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}
.profile-dna-download {
  margin-left: 8px;
}
.profile-dna-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  list-style: none;
  padding: 0;
  margin: 0 0 8px;
  font-size: 0.88em;
}
.profile-dna-legend li {
  display: flex;
  align-items: center;
  gap: 6px;
}
.profile-dna-swatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  display: inline-block;
}
.profile-dna-swatch.is-person,
.profile-dna-segment.is-person {
  background: var(--dna-person);
}
.profile-dna-swatch.is-couple,
.profile-dna-segment.is-couple {
  background: var(--dna-couple);
}
.profile-dna-swatch.is-background,
.profile-dna-segment.is-background {
  background: var(--dna-background);
}
.profile-dna-swatch.is-none,
.profile-dna-segment.is-none {
  background: var(--dna-none);
}
.profile-dna-chromosomes {
  position: relative;
  display: grid;
  gap: 4px;
}
.profile-dna-chrom-row {
  display: grid;
  grid-template-columns: 2.2em 1fr;
  align-items: center;
}
.profile-dna-chrom-label {
  font-size: 0.8em;
  color: var(--text-secondary, #586779);
  text-align: right;
  padding-right: 6px;
}
.profile-dna-chrom {
  position: relative;
  height: calc(10px * var(--lanes, 1) + 4px);
  min-height: 14px;
  border-radius: 7px;
  background: var(--border-color, #e3e9ef);
}
.profile-dna-segment {
  position: absolute;
  top: calc(2px + 10px * var(--lane, 0));
  height: 9px;
  min-width: 3px;
  border: 0;
  border-radius: 3px;
  padding: 0;
  cursor: pointer;
}
.profile-dna-segment:hover,
.profile-dna-segment:focus-visible {
  outline: 2px solid var(--text-color, #243447);
  outline-offset: 1px;
  z-index: 1;
}
.profile-dna-tooltip {
  position: absolute;
  z-index: 5;
  max-width: min(420px, 100%);
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--card-bg, #fff);
  color: var(--text-color, #243447);
  border: 1px solid var(--border-color, #dbe3eb);
  box-shadow: 0 8px 24px rgba(20, 30, 45, 0.18);
  font-size: 0.86em;
  line-height: 1.4;
  pointer-events: none;
}
.profile-dna-tooltip[hidden] {
  display: none;
}
.profile-dna-meter {
  height: 8px;
  border-radius: 4px;
  background: var(--border-color, #e3e9ef);
  overflow: hidden;
  max-width: 360px;
}
.profile-dna-meter > span {
  display: block;
  height: 100%;
  background: var(--dna-person);
}
.profile-dna-status {
  min-height: 1.2em;
}
.profile-dna-notice {
  padding: 10px 12px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--dna-person) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--dna-person) 40%, transparent);
}
