/* css/modals.css - Estili per Modali, Pannelli e Popover */

body.modal-open {
  overflow: hidden;
}

.user-admin-modal {
  padding: 18px;
  box-sizing: border-box;
}

.user-admin-modal__card {
  display: flex;
  flex-direction: column;
  width: min(760px, 100%);
  max-width: 760px;
  max-height: min(90vh, 900px);
  border: 1px solid rgba(217, 119, 6, 0.14);
  border-radius: 22px;
  overflow: hidden;
}

.user-admin-modal__header {
  flex: 0 0 auto;
  margin: 0;
  padding: 20px 24px 18px;
  background:
    radial-gradient(
      circle at top left,
      rgba(245, 158, 11, 0.13),
      transparent 42%
    ),
    linear-gradient(180deg, #fffdf8 0%, #ffffff 100%);
}

.user-admin-modal__header h2 {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 2px 0 0;
  font-family: var(--font-fancy);
  font-size: 1.45rem;
  color: #0f172a;
}

.user-admin-modal__header h2 .material-symbols-outlined {
  color: #d97706;
}

.user-admin-eyebrow {
  margin: 0;
  color: #b45309;
  font-size: 0.68rem;
  font-weight: 750;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.user-admin-modal__body {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 16px;
  min-height: 0;
  padding: 20px 24px 26px;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-gutter: stable;
  background: #f8fafc;
}

.user-admin-modal__body > * {
  flex-shrink: 0;
}

.identity-review-section,
.user-admin-section {
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
}

.identity-review-section {
  padding: 18px;
}

.user-admin-section {
  overflow: clip;
}

.user-admin-section > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 58px;
  padding: 0 18px;
  color: #1e293b;
  cursor: pointer;
  font-size: 0.93rem;
  font-weight: 700;
  list-style: none;
}

.user-admin-section > summary::-webkit-details-marker {
  display: none;
}

.user-admin-section > summary > span:first-child {
  display: inline-flex;
  align-items: center;
  gap: 9px;
}

.user-admin-section > summary .material-symbols-outlined {
  color: #d97706;
  font-size: 21px;
}

.user-admin-section .section-chevron {
  transition: transform 0.2s ease;
}

.user-admin-section[open] .section-chevron {
  transform: rotate(180deg);
}

.user-admin-section__body {
  padding: 0 18px 18px;
  border-top: 1px solid #f1f5f9;
}

.user-admin-section-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.user-admin-section-title h3 {
  margin: 0;
  color: #0f172a;
  font-family: var(--font-fancy);
  font-size: 1.12rem;
}

.user-admin-section-title p {
  margin: 4px 0 0;
  color: #64748b;
  font-size: 0.82rem;
  line-height: 1.45;
}

.user-admin-count {
  min-width: 28px;
  height: 28px;
  border: 1px solid #fed7aa;
  border-radius: 999px;
  background: #fff7ed;
  color: #c2410c;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 800;
}

.identity-claim-list,
.user-admin-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.identity-claim-card {
  padding: 15px;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  background: #ffffff;
}

.identity-claim-card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.identity-claim-card__account {
  margin: 0;
  color: #0f172a;
  font-size: 0.94rem;
  font-weight: 750;
}

.identity-claim-card__contact {
  margin: 2px 0 0;
  color: #64748b;
  font-size: 0.75rem;
}

.identity-claim-status,
.user-admin-role {
  flex: 0 0 auto;
  padding: 4px 8px;
  border: 1px solid #fde68a;
  border-radius: 999px;
  background: #fffbeb;
  color: #a16207;
  font-size: 0.68rem;
  font-weight: 750;
}

.identity-claim-status.is-needs-info {
  border-color: #bfdbfe;
  background: #eff6ff;
  color: #1d4ed8;
}

.identity-claim-card__submitted {
  margin-top: 12px;
}

.identity-claim-card__facts {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 12px;
  margin-top: 6px;
  color: #475569;
  font-size: 0.76rem;
}

.identity-claim-note {
  margin: 9px 0 0;
  padding: 8px 10px;
  border-left: 3px solid #cbd5e1;
  background: #f8fafc;
  color: #475569;
  font-size: 0.78rem;
  line-height: 1.45;
}

.identity-match-box {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px dashed #cbd5e1;
  border-radius: 11px;
  background: #f8fafc;
  color: #64748b;
}

.identity-match-box.has-candidate {
  border-style: solid;
  border-color: #bbf7d0;
  background: #f0fdf4;
  color: #166534;
}

.identity-match-box .material-symbols-outlined {
  font-size: 21px;
}

.identity-match-box strong {
  display: block;
  color: #1e293b;
  font-size: 0.82rem;
}

.identity-match-box p {
  margin: 3px 0 0;
  font-size: 0.72rem;
  line-height: 1.35;
}

.identity-review-fields,
.user-admin-form__row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.identity-review-fields {
  margin-top: 12px;
}

.identity-review-fields label,
.identity-review-notes {
  color: #475569;
  font-size: 0.72rem;
  font-weight: 650;
}

.identity-review-notes {
  display: block;
  margin-top: 9px;
}

.admin-input {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  margin-top: 4px;
  padding: 9px 11px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  background: #ffffff;
  color: #1e293b;
  box-sizing: border-box;
  font: inherit;
  font-size: 0.86rem;
}

.admin-input:focus {
  border-color: #d97706;
  outline: none;
  box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.12);
}

.admin-input--error {
  border-color: #ef4444;
}

textarea.admin-input {
  resize: vertical;
}

.identity-claim-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
}

.claim-action,
.user-admin-primary {
  min-height: 38px;
  padding: 0 12px;
  border-radius: 9px;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 750;
}

.claim-action {
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #334155;
}

.claim-action:disabled {
  cursor: wait;
  opacity: 0.55;
}

.claim-action--danger {
  border-color: #fecaca;
  color: #b91c1c;
}

.claim-action--approve {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-color: #0f172a;
  background: #0f172a;
  color: #ffffff;
}

.claim-action--approve .material-symbols-outlined {
  font-size: 18px;
}

.user-admin-empty {
  margin: 0;
  padding: 18px 10px;
  color: #64748b;
  text-align: center;
  font-size: 0.82rem;
}

.user-admin-empty--success {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  color: #166534;
}

.user-admin-empty.is-error,
.user-admin-feedback.is-error {
  color: #b91c1c;
}

.user-admin-feedback.is-success {
  color: #15803d;
}

.admin-input--success {
  border-color: #22c55e !important;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.1);
}

.user-admin-card {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid #f1f5f9;
}

.user-admin-card:last-child {
  border-bottom: 0;
}

.user-admin-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #fff7ed;
  color: #c2410c;
  display: grid;
  place-items: center;
  font-family: var(--font-fancy);
  font-weight: 800;
}

.user-admin-card__identity {
  min-width: 0;
}

button.user-admin-card__identity {
  display: block;
  width: 100%;
  padding: 5px 7px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  cursor: pointer;
  font: inherit;
  text-align: left;
  transition:
    background-color 0.18s ease,
    box-shadow 0.18s ease;
}

button.user-admin-card__identity:hover {
  background: #f0fdf4;
}

button.user-admin-card__identity:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.18);
}

.user-admin-card__identity strong,
.user-admin-card__identity span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-admin-card__identity strong {
  color: #1e293b;
  font-size: 0.86rem;
}

.user-admin-card__identity span {
  margin-top: 2px;
  color: #64748b;
  font-size: 0.72rem;
}

.user-admin-card__identity .user-admin-card__meta {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  overflow: visible;
}

.user-admin-card__identity .user-admin-contact {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-admin-link-status {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  min-height: 20px;
  padding: 1px 7px;
  border: 1px solid #e2e8f0;
  border-radius: 999px;
  background: #f8fafc;
  color: #64748b;
  font-size: 0.67rem;
  font-style: normal;
  font-weight: 800;
  line-height: 1;
}

.user-admin-link-status.is-valid {
  border-color: #bbf7d0;
  background: #f0fdf4;
  color: #15803d;
}

.user-admin-link-status.is-invalid {
  border-color: #fecaca;
  background: #fef2f2;
  color: #b91c1c;
}

.user-admin-link-status.is-unavailable {
  border-color: #fde68a;
  background: #fffbeb;
  color: #a16207;
}

.user-admin-card__actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 3px;
}

.edit-association-btn {
  color: #475569;
}

.edit-association-btn:hover,
.edit-association-btn.is-active {
  background: #eff6ff;
  color: #1d4ed8;
}

.user-admin-association-editor {
  display: grid;
  grid-column: 2 / -1;
  grid-template-columns: minmax(130px, 0.7fr) minmax(170px, 1fr) auto;
  align-items: end;
  gap: 9px;
  width: 100%;
  padding: 12px;
  border: 1px solid #dbeafe;
  border-radius: 12px;
  background: #f8fbff;
  box-sizing: border-box;
}

.user-admin-association-editor.hidden {
  display: none;
}

.user-admin-association-editor label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  color: #475569;
  font-size: 0.68rem;
  font-weight: 750;
}

.user-admin-association-editor .admin-input {
  min-width: 0;
  min-height: 38px;
  margin: 0;
}

.user-admin-association-editor .user-admin-feedback {
  grid-column: 1 / 3;
  min-height: 18px;
}

.user-admin-association-actions {
  display: flex;
  grid-column: 3;
  grid-row: 1 / span 2;
  align-self: end;
  gap: 7px;
}

.user-admin-role-select {
  width: min(180px, 100%);
  min-height: 34px;
  margin: 0;
  padding: 5px 30px 5px 9px;
  border-color: #cbd5e1;
  background-color: #ffffff;
  color: #334155;
  font-size: 0.72rem;
  font-weight: 700;
}

.user-admin-role-select:disabled {
  cursor: wait;
  opacity: 0.65;
}

.user-admin-lock {
  color: #cbd5e1;
  font-size: 19px;
}

.user-admin-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 14px;
}

.user-admin-form .admin-input {
  margin-top: 0;
}

.user-admin-feedback {
  min-height: 16px;
  color: #64748b;
  font-size: 0.72rem;
}

.user-admin-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: 100%;
  margin-top: 2px;
  border: 0;
  background: #0f172a;
  color: #ffffff;
}

@media (max-width: 600px) {
  .user-admin-modal {
    align-items: flex-end;
    padding: 0;
  }

  .user-admin-modal__card {
    width: 100%;
    max-height: calc(100dvh - env(safe-area-inset-top, 0px) - 10px);
    border-radius: 22px 22px 0 0;
  }

  .user-admin-modal__header {
    padding: 16px 18px 14px;
  }

  .user-admin-modal__body {
    padding: 14px 12px calc(18px + env(safe-area-inset-bottom, 0px));
  }

  .identity-review-section {
    padding: 14px;
  }

  .identity-review-fields,
  .user-admin-form__row {
    grid-template-columns: 1fr;
  }

  .identity-claim-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .claim-action--approve {
    grid-column: 1 / -1;
    justify-content: center;
  }

  .user-admin-card {
    grid-template-columns: 34px minmax(0, 1fr) auto;
    align-items: start;
    gap: 8px;
  }

  .user-admin-role,
  .user-admin-role-select {
    grid-column: 2;
    justify-self: start;
    width: min(210px, 100%);
  }

  .user-admin-card__actions {
    grid-column: 3;
    grid-row: 1 / span 2;
  }

  .user-admin-card__identity .user-admin-card__meta {
    align-items: flex-start;
    flex-direction: column;
    gap: 5px;
    white-space: normal;
  }

  .user-admin-card__identity .user-admin-contact {
    max-width: 100%;
    white-space: nowrap;
  }

  .user-admin-link-status {
    min-height: 22px;
  }

  .user-admin-association-editor {
    grid-column: 1 / -1;
    grid-template-columns: 1fr;
    gap: 9px;
    margin-top: 3px;
  }

  .user-admin-association-editor .user-admin-feedback,
  .user-admin-association-actions {
    grid-column: 1;
    grid-row: auto;
  }

  .user-admin-association-actions {
    display: grid;
    grid-template-columns: 0.8fr 1.2fr;
    width: 100%;
  }

  .user-admin-association-actions .claim-action {
    width: 100%;
  }

  .user-admin-association-actions .claim-action--approve {
    grid-column: auto;
  }
}

/* Overlay generico per le modali */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}

/* Overlay for popover (no flex centering) */
.popover-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10000;
  background: transparent;
}

.popover-overlay-mobile {
  background: rgba(15, 23, 42, 0.18);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition:
    background-color 0.22s ease,
    opacity 0.22s ease;
  opacity: 0;
}

.popover-overlay-mobile.is-visible {
  opacity: 1;
}

/* Premium Sidebar (Details Panel) */
#details-panel {
  position: absolute;
  top: 15px; /* Margin within main */
  bottom: 15px; /* Margin within main */
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(25px);
  border-radius: 24px;
  border: 1px solid var(--border-color);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.18);
  z-index: 3000;
  display: flex;
  flex-direction: column;
  overflow: hidden; /* Header fixed, content scrolls */
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);

  /* Desktop Default */
  right: 20px;
  width: 380px;
  transform: none;
}

#details-panel.hidden {
  transform: translateX(110%);
  opacity: 0;
  pointer-events: none;
}

@media (max-width: 768px) {
  #details-panel {
    right: auto;
    left: 50%;
    transform: translateX(-50%);
    width: 94%;
    max-width: 480px;
  }

  #details-panel.hidden {
    transform: translate(-50%, 100px);
    opacity: 0;
  }
}

#panel-content {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  padding-top: 40px; /* Space for close button */

  /* Hide scrollbar while keeping scroll functionality */
  -ms-overflow-style: none; /* IE and Edge */
  scrollbar-width: none; /* Firefox */
}

#panel-content::-webkit-scrollbar {
  display: none; /* Chrome, Safari and Opera */
}

#close-panel {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #64748b;
  z-index: 10;
  transition: all 0.2s;
}

#close-panel:hover {
  background: #f1f5f9;
  color: #0f172a;
  transform: scale(1.1);
}

/* Card principale per le modali */
.modal-card {
  background: white;
  border-radius: 16px;
  padding: 24px;
  max-width: 600px;
  width: 90%;
  max-height: 90vh; /* Increased from 80vh for better mobile use */
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  font-family: 'Inter', sans-serif;
  overflow: hidden; /* Header/Footer stay fixed, content scrolls */
}

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

.modal-header h2 {
  margin: 0;
  font-size: 1.2rem;
  color: #1e293b;
}

.modal-close-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #94a3b8;
  padding: 4px;
  transition: color 0.2s;
}

.modal-close-btn:hover {
  color: #64748b;
}

.relationship-path-modal {
  width: min(1180px, 96vw);
  max-width: min(1180px, 96vw);
  max-height: min(88vh, 860px);
  padding: 0;
  border-radius: 24px;
  overflow: hidden;
}

.relationship-path-modal-overlay--shared {
  background: #eef2f6;
  backdrop-filter: none;
}

.relationship-path-modal-overlay--shared .relationship-path-modal {
  width: min(1180px, 100vw);
  max-width: min(1180px, 100vw);
  max-height: 100vh;
  border-radius: 8px;
}

.relationship-path-modal__header {
  padding: 22px 24px 18px;
  margin-bottom: 0;
  border-bottom: 1px solid #e2e8f0;
  background:
    radial-gradient(
      circle at top left,
      rgba(248, 113, 113, 0.16),
      transparent 36%
    ),
    radial-gradient(
      circle at top right,
      rgba(251, 191, 36, 0.12),
      transparent 34%
    ),
    linear-gradient(180deg, #fffdfb 0%, #ffffff 100%);
}

.relationship-path-modal__summary {
  margin: 6px 0 0;
  color: #64748b;
  font-size: 0.95rem;
  line-height: 1.45;
}

.relationship-path-modal__body {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 18px;
  min-height: 0;
  padding: 20px 24px 24px;
  overflow: auto;
}

.relationship-path-comparator {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 14px;
  border-radius: 14px;
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
  border: 1px solid #e2e8f0;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.04);
}

.relationship-path-comparator__field {
  position: relative;
  flex: 1;
  min-width: 190px;
}

.relationship-path-comparator__field-inner {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.relationship-path-comparator__icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 18px;
  line-height: 1;
  width: 18px;
  height: 18px;
  color: #94a3b8;
  pointer-events: none;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
}

.relationship-path-comparator__input {
  width: 100%;
  box-sizing: border-box;
  padding: 8px 14px 8px 38px !important;
  border-radius: 10px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: #0f172a;
  font-size: 0.86rem;
  font-weight: 500;
  outline: none;
  transition:
    border-color 150ms ease,
    box-shadow 150ms ease;
}

.relationship-path-comparator__input:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.relationship-path-comparator__input::placeholder {
  color: #94a3b8;
}

.relationship-path-comparator__swap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: #64748b;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
  transition:
    background 150ms ease,
    color 150ms ease,
    border-color 150ms ease,
    transform 150ms ease;
}

.relationship-path-comparator__swap:hover {
  background: #eff6ff;
  color: #2563eb;
  border-color: #93c5fd;
  transform: scale(1.06);
}

.relationship-path-comparator__swap:active {
  transform: scale(0.95);
}

.relationship-path-comparator__btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 10px;
  background: linear-gradient(180deg, #2563eb 0%, #1d4ed8 100%);
  color: #ffffff;
  border: 1px solid #1d4ed8;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.22);
  transition:
    background 150ms ease,
    box-shadow 150ms ease,
    transform 150ms ease;
  white-space: nowrap;
}

.relationship-path-comparator__btn:hover {
  background: linear-gradient(180deg, #1d4ed8 0%, #1e40af 100%);
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.3);
  transform: translateY(-1px);
}

.relationship-path-comparator__btn:active {
  transform: translateY(0);
}

.relationship-path-comparator__btn .material-symbols-outlined {
  font-size: 17px;
}

.relationship-path-comparator__results {
  position: absolute;
  top: calc(100% + 5px);
  left: 0;
  right: 0;
  max-height: 230px;
  overflow-y: auto;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  z-index: 1000;
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.12);
  padding: 4px;
}

.relationship-path-comparator__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 120ms ease;
}

.relationship-path-comparator__item:hover {
  background: #f1f5f9;
}

.relationship-path-comparator__item-name {
  font-weight: 600;
  font-size: 0.84rem;
  color: #0f172a;
}

.relationship-path-comparator__item-dates {
  font-size: 0.73rem;
  color: #64748b;
}

.relationship-path-modal__meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.relationship-path-modal__badges {
  display: flex;
  min-width: 0;
  flex: 1 1 360px;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.relationship-path-modal__actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.relationship-path-modal__action-btn {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  background: #f8fafc;
  color: #334155;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}

.relationship-path-modal__action-btn .material-symbols-outlined {
  font-size: 18px;
}

.relationship-path-modal__action-symbol {
  font-size: 16px;
  line-height: 1;
}

.relationship-path-modal__share-btn {
  border-color: #16a34a;
  background: #16a34a;
  color: #fff;
}

.relationship-path-modal__action-btn:hover,
.relationship-path-modal__action-btn:focus-visible {
  border-color: #94a3b8;
  outline: none;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.relationship-path-modal__share-btn:hover,
.relationship-path-modal__share-btn:focus-visible {
  border-color: #15803d;
  background: #15803d;
}

.relationship-path-modal__badge {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 8px 12px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.9rem;
}

.relationship-path-modal__badge--blood {
  background: #fff1f2;
  border: 1px solid #fecdd3;
  color: #9f1239;
}

.relationship-path-modal__badge--affinal {
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #b45309;
}

.relationship-path-modal__count {
  color: #475569;
  font-size: 0.9rem;
  font-weight: 600;
}

.relationship-path-modal__print-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid #cbd5e1;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  color: #0f172a;
  border-radius: 999px;
  padding: 10px 14px;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    border-color 160ms ease;
}

.relationship-path-modal__print-btn:hover {
  transform: translateY(-1px);
  border-color: #94a3b8;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.12);
}

.relationship-path-modal__print-btn:disabled {
  opacity: 0.68;
  cursor: wait;
  transform: none;
  box-shadow: none;
}

.relationship-path-modal__print-btn .material-symbols-outlined {
  font-size: 1.1rem;
}

.relationship-path-viewport {
  position: relative;
  overflow: auto;
  padding: 8px 24px 16px;
  min-height: min(62vh, 640px);
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.relationship-path-graph-controls {
  position: sticky;
  top: 0;
  left: 100%;
  z-index: 12;
  display: flex;
  width: max-content;
  justify-content: flex-end;
  pointer-events: none;
}

.relationship-path-modal__graph-expand {
  display: inline-flex;
  min-width: 42px;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 11px;
  border: 1px solid rgba(14, 116, 144, 0.24);
  border-radius: 12px;
  background: rgba(8, 47, 73, 0.94);
  color: #e0f2fe;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.18);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  pointer-events: auto;
}

.relationship-path-modal__graph-expand:hover,
.relationship-path-modal__graph-expand:focus-visible {
  border-color: rgba(56, 189, 248, 0.72);
  outline: none;
  background: #075985;
}

.relationship-path-modal__graph-expand .material-symbols-outlined {
  font-size: 21px;
}

.relationship-path-modal.is-graph-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 10020;
  width: 100vw;
  max-width: none;
  height: 100dvh;
  max-height: none;
  border-radius: 0;
}

.relationship-path-modal.is-graph-fullscreen .relationship-path-modal__header,
.relationship-path-modal.is-graph-fullscreen
  .relationship-path-modal__body
  > :not(.relationship-path-viewport) {
  display: none;
}

.relationship-path-modal.is-graph-fullscreen .relationship-path-modal__body {
  gap: 0;
  padding: 0;
  overflow: hidden;
}

.relationship-path-modal.is-graph-fullscreen .relationship-path-viewport {
  min-height: 0;
  flex: 1 1 auto;
  padding: max(8px, env(safe-area-inset-top))
    max(8px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom))
    max(8px, env(safe-area-inset-left));
  background: #f8fafc;
}

.relationship-path-modal.is-graph-fullscreen .relationship-path-graph-controls {
  position: fixed;
  top: max(10px, env(safe-area-inset-top));
  right: max(10px, env(safe-area-inset-right));
  left: auto;
}

.relationship-path-compact {
  --relationship-path-card-width: 228px;
  --relationship-path-card-min-height: 118px;
  --relationship-path-row-gap: 64px;
  --relationship-path-column-gap: 60px;
  position: relative;
  width: max-content;
  min-width: max-content;
  padding: 22px 28px 28px;
  margin: 0 auto;
}

.relationship-path-compact__grid {
  position: relative;
  display: grid;
  grid-auto-flow: row;
  gap: var(--relationship-path-row-gap) var(--relationship-path-column-gap);
  align-items: stretch;
  min-width: max-content;
  z-index: 2;
}

.relationship-path-compact__node {
  position: relative;
  z-index: 2;
  width: var(--relationship-path-card-width);
  justify-self: center;
}

.relationship-path-compact__svg,
.relationship-path-compact__labels {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.relationship-path-compact__svg {
  z-index: 1;
  overflow: visible;
}

.relationship-path-compact__labels {
  z-index: 3;
}

.relationship-path-compact__edge {
  fill: none;
  stroke-width: 2.5;
  stroke-linecap: square;
  stroke-linejoin: miter;
}

.relationship-path-compact__edge--blood {
  stroke: #fb7185;
}

.relationship-path-compact__edge--affinal {
  stroke: #f59e0b;
}

.relationship-path-compact__edge-label {
  position: absolute;
  transform: translate(-50%, -50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  white-space: nowrap;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
}

.relationship-path-compact__edge-label--blood {
  background: #fff1f2;
  color: #be123c;
  border: 1px solid #fecdd3;
}

.relationship-path-compact__edge-label--affinal {
  background: #fffbeb;
  color: #b45309;
  border: 1px solid #fde68a;
}

.relationship-path-card {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 6px;
  width: 100%;
  min-height: var(--relationship-path-card-min-height);
  min-width: 0;
  padding: 10px 13px;
  border-radius: 18px;
  border: 1px solid #e2e8f0;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.98) 0%,
    rgba(248, 250, 252, 0.98) 100%
  );
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.07);
}

.relationship-path-card--principal {
  border-color: #cbd5e1;
  box-shadow: 0 14px 34px rgba(148, 163, 184, 0.15);
}

.relationship-path-card--target-blood {
  border-color: #fca5a5;
  box-shadow: 0 16px 36px rgba(248, 113, 113, 0.16);
}

.relationship-path-card--target-affinal {
  border-color: #fcd34d;
  box-shadow: 0 16px 36px rgba(245, 158, 11, 0.16);
}

.relationship-path-card--mrca {
  border: 2px solid #eab308 !important;
  box-shadow:
    0 0 20px rgba(234, 179, 8, 0.4),
    0 14px 34px rgba(15, 23, 42, 0.1) !important;
  background: linear-gradient(180deg, #fffbeb 0%, #fef3c7 100%) !important;
}

.relationship-path-card__role--mrca {
  background: linear-gradient(90deg, #eab308, #ca8a04) !important;
  color: #0f172a !important;
  font-weight: 800 !important;
  box-shadow: 0 2px 6px rgba(234, 179, 8, 0.35);
}

.family-moments-top-banner {
  position: relative;
  width: 100%;
  animation: slideDownBanner 0.35s ease-out;
}

@keyframes slideDownBanner {
  from {
    transform: translateY(-100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.family-moment-avatar-wrap {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.relationship-path-card__header {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.relationship-path-card__meta {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 0 1 auto;
}

.relationship-path-card__role {
  align-self: flex-start;
  padding: 3px 8px;
  border-radius: 999px;
  background: #0f172a;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.relationship-path-card__name {
  margin: 0;
  color: #0f172a;
  font-size: 0.98rem;
  line-height: 1.25;
}

.relationship-path-card__dates,
.relationship-path-card__id {
  margin: 0;
  color: #64748b;
  font-size: 0.86rem;
}

.relationship-path-card__id {
  margin-top: 2px;
  padding-top: 4px;
  border-top: 1px solid #e2e8f0;
  word-break: break-word;
}

.relationship-path-loading,
.relationship-path-empty {
  min-height: 220px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: #64748b;
  text-align: center;
}

.relationship-path-loading .material-symbols-outlined,
.relationship-path-empty .material-symbols-outlined {
  font-size: 2rem;
  color: #c2410c;
}

@media (max-width: 900px) {
  .relationship-path-modal-overlay {
    box-sizing: border-box;
    padding: 8px;
  }

  .relationship-path-modal {
    width: min(100%, 680px);
    max-width: min(100%, 680px);
    height: calc(100dvh - 16px);
    max-height: calc(100dvh - 16px);
    border-radius: 20px;
  }

  .relationship-path-modal__header {
    flex: 0 0 auto;
    align-items: flex-start;
    padding: 15px 16px 13px;
  }

  .relationship-path-modal__header h2 {
    font-size: 1.18rem;
  }

  .relationship-path-modal__summary {
    margin-top: 3px;
    font-size: 0.82rem;
    line-height: 1.35;
  }

  .relationship-path-modal__body {
    gap: 12px;
    padding: 12px;
  }

  .relationship-path-comparator {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 42px;
    gap: 8px;
    padding: 10px;
  }

  .relationship-path-comparator__field {
    min-width: 0;
  }

  .relationship-path-comparator__field:first-child {
    grid-column: 1;
    grid-row: 1;
  }

  .relationship-path-comparator__swap {
    width: 42px;
    height: 42px;
    grid-column: 2;
    grid-row: 1 / span 2;
    align-self: center;
  }

  .relationship-path-comparator__swap + .relationship-path-comparator__field {
    grid-column: 1;
    grid-row: 2;
  }

  .relationship-path-comparator__btn {
    min-height: 42px;
    grid-column: 1 / -1;
    grid-row: 3;
    justify-content: center;
  }

  .relationship-path-modal__meta-row {
    align-items: stretch;
    gap: 10px;
  }

  .relationship-path-modal__badges,
  .relationship-path-modal__actions {
    width: 100%;
  }

  .relationship-path-modal__actions {
    display: grid;
    grid-template-columns: repeat(3, 44px) minmax(0, 1fr);
    justify-content: start;
    gap: 8px;
  }

  .relationship-path-modal__actions .relationship-path-modal__action-btn,
  .relationship-path-modal__actions .relationship-path-modal__print-btn {
    width: 44px;
    min-width: 44px;
    height: 44px;
    min-height: 44px;
    padding: 0;
    border-radius: 12px;
  }

  .relationship-path-modal__actions .relationship-path-modal__action-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .relationship-path-modal__count {
    min-width: 0;
    align-self: center;
    justify-self: end;
    text-align: right;
  }

  .relationship-path-viewport {
    min-height: 44vh;
    flex: 1 0 auto;
    padding: 4px 8px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    background: #f8fafc;
  }

  .relationship-path-modal__graph-expand
    .relationship-path-modal__action-label {
    display: none;
  }

  .relationship-path-compact {
    --relationship-path-card-width: 204px;
    --relationship-path-card-min-height: 114px;
    --relationship-path-row-gap: 74px;
    --relationship-path-column-gap: 84px;
    padding: 16px 18px 20px;
  }

  .relationship-path-compact__edge-label {
    font-size: 0.75rem;
  }

  .relationship-path-modal.is-graph-fullscreen {
    width: 100vw;
    height: 100dvh;
    max-width: none;
    max-height: none;
    border-radius: 0;
  }

  .relationship-path-modal.is-graph-fullscreen .relationship-path-viewport {
    border: 0;
    border-radius: 0;
  }
}

/* Gestione Backup (Version History) */
.vh-create-box {
  margin-bottom: 20px;
  padding: 16px;
  border-radius: 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.vh-create-info p {
  margin: 0;
}

.vh-create-title {
  font-weight: 600;
  color: #0f172a;
  margin-bottom: 4px !important;
}

.vh-create-subtitle {
  font-size: 0.85rem;
  color: #64748b;
}

.vh-list {
  overflow-y: auto;
  flex: 1;
  min-height: 100px;
  display: flex;
  flex-direction: column;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE and Edge */
  border-bottom-left-radius: inherit;
  border-bottom-right-radius: inherit;
}

.vh-list::-webkit-scrollbar {
  display: none; /* Chrome, Safari and Opera */
}

.vh-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px;
  border-radius: 8px;
  margin-bottom: 6px;
  border: 1px solid #e2e8f0;
  transition: background 0.15s;
  background: #fff;
}

.vh-item-row:nth-child(even) {
  background: #f8fafc;
}

.vh-item-row:hover {
  background: #f1f5f9;
}

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

.vh-item-label {
  font-size: 0.9rem;
  font-weight: 600;
  color: #334155;
  display: flex;
  align-items: center;
  gap: 6px;
}

.vh-item-meta {
  font-size: 0.75rem;
  color: #64748b;
  margin-top: 2px;
}

.vh-item-actions {
  display: flex;
  gap: 8px;
}

.vh-btn {
  padding: 8px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  background: white;
  cursor: pointer;
  color: #475569;
  display: flex;
  transition: all 0.2s;
}

.vh-btn:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.vh-btn-delete {
  color: #94a3b8;
}

.vh-btn-delete:hover {
  color: #dc2626;
  background: #fef2f2;
  border-color: #fecaca;
}

.vh-btn-restore {
  border: 1px solid #dc2626;
  background: #fef2f2;
  color: #dc2626;
}

.vh-btn-restore:hover {
  background: #fee2e2;
}

.gedcom-launch-btn {
  margin-left: auto;
  padding: 7px 10px;
  gap: 6px;
  align-items: center;
  font-size: 0.78rem;
  font-weight: 700;
  color: #4f46e5;
  border-color: #c7d2fe;
  background: #eef2ff;
}

.gedcom-launch-btn .material-symbols-outlined {
  font-size: 18px;
}

.gedcom-export-overlay {
  z-index: 10020;
}

.gedcom-export-card {
  width: min(720px, calc(100vw - 28px));
  max-width: 720px;
  max-height: min(820px, calc(100vh - 32px));
  padding: 0;
  overflow: hidden;
}

.gedcom-export-card > .modal-header {
  flex: 0 0 auto;
  margin: 0;
  padding: 20px 24px 14px;
}

.gedcom-eyebrow {
  display: block;
  margin-bottom: 3px;
  color: #6366f1;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.gedcom-tabs {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  padding: 0 24px 14px;
  border-bottom: 1px solid #e2e8f0;
}

.gedcom-tab {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid transparent;
  border-radius: 10px;
  color: #64748b;
  background: #f8fafc;
  cursor: pointer;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  transition:
    color 0.15s ease,
    background 0.15s ease,
    border-color 0.15s ease;
}

.gedcom-tab .material-symbols-outlined {
  font-size: 18px;
}

.gedcom-tab:hover {
  color: #4338ca;
  border-color: #c7d2fe;
}

.gedcom-tab.is-active {
  color: #4338ca;
  border-color: #c7d2fe;
  background: #eef2ff;
}

.gedcom-modal-body {
  min-height: 0;
  padding: 18px 24px 22px;
  overflow-y: auto;
}

.gedcom-panel[hidden],
.gedcom-field[hidden],
.gedcom-check[hidden],
.gedcom-import-results[hidden] {
  display: none;
}

.gedcom-intro {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  padding: 14px;
  border: 1px solid #dbeafe;
  border-radius: 12px;
  color: #334155;
  background: #f8fbff;
}

.gedcom-intro p {
  margin: 0;
  font-size: 0.87rem;
  line-height: 1.45;
}

.gedcom-intro-icon {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  color: #4f46e5;
  background: #e0e7ff;
}

.gedcom-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.gedcom-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.gedcom-field > span {
  color: #334155;
  font-size: 0.78rem;
  font-weight: 700;
}

.gedcom-field select,
.gedcom-field input {
  width: 100%;
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 9px;
  color: #0f172a;
  background: #fff;
  font: inherit;
}

.gedcom-field input:disabled,
.gedcom-field select:disabled {
  color: #94a3b8;
  background: #f1f5f9;
}

.gedcom-field small {
  color: #64748b;
  font-size: 0.7rem;
}

.gedcom-check {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 14px;
  color: #334155;
  font-size: 0.82rem;
  font-weight: 600;
}

.gedcom-check input {
  width: 16px;
  height: 16px;
}

.gedcom-preview {
  min-height: 88px;
  margin-top: 18px;
  padding: 14px;
  border: 1px dashed #cbd5e1;
  border-radius: 12px;
  color: #64748b;
  background: #f8fafc;
}

.gedcom-preview > p {
  margin: 0;
  font-size: 0.82rem;
}

.gedcom-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.gedcom-summary-grid > div {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 9px 5px;
  border-radius: 9px;
  color: #475569;
  background: #fff;
}

.gedcom-summary-grid strong {
  color: #312e81;
  font-size: 1.15rem;
}

.gedcom-summary-grid span {
  font-size: 0.67rem;
  text-align: center;
}

.gedcom-ready,
.gedcom-warning {
  margin-top: 10px !important;
  font-weight: 600;
}

.gedcom-ready {
  color: #15803d;
}

.gedcom-warning {
  color: #b45309;
}

.gedcom-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}

.gedcom-secondary-btn,
.gedcom-primary-btn {
  min-height: 38px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.gedcom-primary-btn {
  width: auto;
}

.gedcom-secondary-btn .material-symbols-outlined,
.gedcom-primary-btn .material-symbols-outlined {
  font-size: 18px;
}

.gedcom-dry-run-banner {
  display: flex;
  gap: 11px;
  padding: 13px 14px;
  border: 1px solid #bbf7d0;
  border-radius: 12px;
  color: #166534;
  background: #f0fdf4;
}

.gedcom-dry-run-banner > .material-symbols-outlined {
  margin-top: 1px;
  font-size: 21px;
}

.gedcom-dry-run-banner strong {
  display: block;
  font-size: 0.82rem;
}

.gedcom-dry-run-banner p {
  margin: 2px 0 0;
  color: #3f6212;
  font-size: 0.75rem;
  line-height: 1.4;
}

.gedcom-file-drop {
  min-height: 138px;
  margin-top: 16px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1.5px dashed #a5b4fc;
  border-radius: 14px;
  color: #475569;
  background: #fafaff;
  cursor: pointer;
  text-align: center;
  transition:
    border-color 0.15s ease,
    background 0.15s ease,
    transform 0.15s ease;
}

.gedcom-file-drop:hover,
.gedcom-file-drop.is-dragging {
  border-color: #6366f1;
  background: #eef2ff;
  transform: translateY(-1px);
}

.gedcom-file-drop.has-file {
  border-style: solid;
  border-color: #86efac;
  background: #f0fdf4;
}

.gedcom-file-icon {
  color: #6366f1;
  font-size: 30px;
}

.gedcom-file-drop.has-file .gedcom-file-icon {
  color: #16a34a;
}

.gedcom-file-drop strong {
  max-width: 100%;
  overflow: hidden;
  color: #1e293b;
  font-size: 0.9rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gedcom-file-drop > span:last-child {
  color: #64748b;
  font-size: 0.72rem;
}

.gedcom-import-actions {
  margin-top: 12px;
}

.gedcom-import-summary {
  margin-top: 18px;
}

.gedcom-summary-new strong {
  color: #0369a1;
}

.gedcom-summary-match strong {
  color: #15803d;
}

.gedcom-summary-conflict strong {
  color: #b45309;
}

.gedcom-selection-toolbar {
  margin-top: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.gedcom-selection-toolbar > div:first-child {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.gedcom-selection-toolbar strong {
  color: #334155;
  font-size: 0.78rem;
}

.gedcom-selection-toolbar span {
  color: #64748b;
  font-size: 0.7rem;
}

.gedcom-selection-actions {
  display: flex;
  gap: 6px;
}

.gedcom-selection-actions button {
  padding: 5px 8px;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  color: #475569;
  background: #fff;
  cursor: pointer;
  font-size: 0.7rem;
}

.gedcom-selection-actions button:hover {
  color: #4338ca;
  border-color: #a5b4fc;
  background: #eef2ff;
}

.gedcom-import-records {
  max-height: 280px;
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  overflow-y: auto;
  scrollbar-width: thin;
}

.gedcom-import-record {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 11px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
}

.gedcom-import-record:hover {
  border-color: #c7d2fe;
  background: #fafaff;
}

.gedcom-import-record > input {
  width: 16px;
  height: 16px;
  margin-top: 2px;
  flex: 0 0 auto;
}

.gedcom-import-record-details {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.gedcom-import-record-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.gedcom-import-record-heading strong {
  min-width: 0;
  overflow: hidden;
  color: #1e293b;
  font-size: 0.8rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gedcom-match-badge {
  flex: 0 0 auto;
  padding: 3px 6px;
  border-radius: 999px;
  font-size: 0.62rem;
  font-weight: 800;
}

.gedcom-match-badge.is-new {
  color: #0369a1;
  background: #e0f2fe;
}

.gedcom-match-badge.is-probable {
  color: #15803d;
  background: #dcfce7;
}

.gedcom-match-badge.is-possible {
  color: #b45309;
  background: #fef3c7;
}

.gedcom-import-record-life,
.gedcom-import-candidate,
.gedcom-import-conflict {
  color: #64748b;
  font-size: 0.69rem;
  line-height: 1.35;
}

.gedcom-import-conflict {
  color: #b45309;
  font-weight: 700;
}

.gedcom-resolution-select {
  width: 100%;
  min-height: 34px;
  margin-top: 5px;
  padding: 6px 8px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  color: #334155;
  background: #fff;
  font: inherit;
  font-size: 0.72rem;
}

.gedcom-resolution-select:focus {
  border-color: #818cf8;
  outline: 2px solid rgb(129 140 248 / 18%);
}

.gedcom-resolution-select:disabled {
  color: #94a3b8;
  background: #f1f5f9;
}

.gedcom-resolution-conflicts {
  display: flex;
  flex-direction: column;
  gap: 2px;
  color: #9a3412;
  font-size: 0.67rem;
  line-height: 1.35;
}

.gedcom-resolution-conflicts:empty {
  display: none;
}

.gedcom-import-notes p {
  margin: 10px 0 0;
  color: #64748b;
  font-size: 0.7rem;
}

.gedcom-apply-box {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid #c7d2fe;
  border-radius: 12px;
  background: #f8faff;
}

.gedcom-apply-box .gedcom-next-step {
  margin-top: 12px;
}

.gedcom-apply-status {
  min-height: 0;
  margin-top: 10px;
  color: #475569;
  font-size: 0.74rem;
  font-weight: 600;
}

.gedcom-apply-status:empty {
  display: none;
}

.gedcom-apply-status.is-success {
  color: #15803d;
}

.gedcom-apply-status.is-error {
  color: #b91c1c;
}

.gedcom-next-step {
  margin: 12px 0 0;
  padding-top: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  border-top: 1px solid #e2e8f0;
  color: #64748b;
  font-size: 0.72rem;
}

.gedcom-next-step .material-symbols-outlined {
  font-size: 16px;
}

@media (max-width: 620px) {
  .gedcom-launch-btn span:last-child {
    display: none;
  }

  .gedcom-form-grid {
    grid-template-columns: 1fr;
  }

  .gedcom-export-card > .modal-header,
  .gedcom-modal-body {
    padding-left: 16px;
    padding-right: 16px;
  }

  .gedcom-tabs {
    padding-left: 16px;
    padding-right: 16px;
  }

  .gedcom-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .gedcom-actions {
    flex-direction: column;
  }

  .gedcom-secondary-btn,
  .gedcom-primary-btn {
    width: 100%;
  }

  .gedcom-selection-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }
}

/* Popover (Contributi/Notifiche - Facebook-style Nuvoletta) */
.popover-card {
  background: white;
  border-radius: 16px;
  box-shadow:
    0 10px 40px rgba(0, 0, 0, 0.15),
    0 0 1px rgba(0, 0, 0, 0.1);
  position: absolute;
  z-index: 10001;
  display: flex;
  flex-direction: column;
  border: 1px solid #e2e8f0;
  overflow: visible; /* To see the arrow */
  animation: popoverFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  max-height: 70vh;
  max-width: 400px;
  width: 90%;
  box-sizing: border-box;
  border-radius: 24px;
}

.popover-card-mobile {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  top: auto !important;
  width: 100% !important;
  max-width: none !important;
  max-height: min(78dvh, 720px) !important;
  border-radius: 24px 24px 0 0;
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  border-left: none;
  border-right: none;
  box-shadow: 0 -12px 40px rgba(15, 23, 42, 0.22);
  transform: translateY(100%);
  opacity: 0;
  transition:
    transform 0.22s cubic-bezier(0.2, 0.9, 0.2, 1),
    opacity 0.18s ease;
  will-change: transform, opacity;
  contain: layout paint;
  overflow: hidden;
}

.popover-card-mobile.is-visible {
  transform: translateY(0);
  opacity: 1;
}

.popover-card-mobile.is-dragging,
.modal-card-mobile-sheet.is-dragging {
  transition: none !important;
}

.popover-card-mobile .popover-arrow {
  display: none;
}

.popover-sheet-handle,
.modal-sheet-handle {
  display: none;
}

.popover-card-mobile .modal-header {
  padding: max(14px, env(safe-area-inset-top)) 18px 12px;
  margin-bottom: 0;
}

.popover-card-mobile .popover-sheet-handle,
.modal-card-mobile-sheet .modal-sheet-handle {
  display: block;
  width: 44px;
  height: 5px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.55);
  margin: 10px auto 8px;
  flex-shrink: 0;
}

.popover-card-mobile .popover-tabs {
  margin: 0 14px 8px;
  padding-bottom: 8px;
  gap: 6px;
}

.popover-card-mobile .vh-list {
  padding: 0 14px calc(14px + env(safe-area-inset-bottom));
  overscroll-behavior: contain;
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.popover-card-mobile .vh-list::-webkit-scrollbar {
  display: none;
}

.popover-card > .modal-header {
  border-top-left-radius: inherit;
  border-top-right-radius: inherit;
}

.modal-overlay-mobile-sheet {
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  background: rgba(15, 23, 42, 0.6);
}

.modal-card-mobile-sheet {
  width: 100%;
  max-width: none;
  max-height: min(82dvh, 760px);
  margin: 0;
  padding: 0;
  border-radius: 24px 24px 0 0;
  transform: translateY(0);
  overflow: hidden;
  box-shadow: 0 -12px 40px rgba(15, 23, 42, 0.22);
}

.modal-card-mobile-sheet .modal-header {
  padding: 6px 18px 12px;
  margin-bottom: 0;
}

.modal-card-mobile-sheet .vh-list {
  padding: 0 14px calc(14px + env(safe-area-inset-bottom));
  overscroll-behavior: contain;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.modal-card-mobile-sheet .vh-list::-webkit-scrollbar {
  display: none;
}

.modal-skeleton-list {
  display: grid;
  gap: 10px;
}

.modal-skeleton-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  background: #fff;
}

.modal-skeleton-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  margin-top: 8px;
  background: #e2e8f0;
  flex: 0 0 auto;
}

.modal-skeleton-content {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 8px;
}

.modal-skeleton-line {
  height: 11px;
  border-radius: 999px;
  background: #e2e8f0;
}

.modal-skeleton-line.w-35 {
  width: 35%;
}
.modal-skeleton-line.w-55 {
  width: 55%;
}
.modal-skeleton-line.w-80 {
  width: 80%;
}

.shimmer {
  position: relative;
  overflow: hidden;
}

.shimmer::after {
  content: '';
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.7),
    transparent
  );
  animation: modalShimmer 1.1s ease-in-out infinite;
}

@keyframes modalShimmer {
  100% {
    transform: translateX(100%);
  }
}

@keyframes popoverFadeIn {
  from {
    opacity: 0;
    transform: translateY(-10px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.popover-arrow {
  position: absolute;
  top: -8px;
  right: 14px;
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-bottom: 8px solid white;
  filter: drop-shadow(0 -1px 0 rgba(0, 0, 0, 0.05));
  z-index: 1;
}

.popover-tabs {
  display: flex;
  gap: 6px;
  margin: 2px 14px 10px;
  border-bottom: 1px solid #f1f5f9;
  padding-bottom: 8px;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.activity-tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  padding: 0 4px;
  border-radius: 999px;
  background: #dc2626;
  color: white;
  font-size: 0.72rem;
}

.activity-load-more {
  display: block;
  margin: 12px auto;
}

.activity-load-more-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 14px auto 8px;
  padding: 6px 16px;
  background: transparent;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  color: #4f46e5;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}

.activity-load-more-btn:hover {
  background: #eef2ff;
  border-color: #a5b4fc;
  color: #4338ca;
}

.activity-load-more-btn .material-symbols-outlined {
  font-size: 1.1rem;
}

.activity-limit-notice {
  display: block;
  text-align: center;
  font-size: 0.78rem;
  color: #94a3b8;
  margin: 12px auto 6px;
  font-style: italic;
}

.popover-tab-btn {
  flex: 1;
  padding: 6px 10px;
  border: none;
  border-radius: 8px;
  background: #f8fafc;
  color: #64748b;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.78rem;
  line-height: 1.25;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
}

.popover-tab-btn:hover {
  background: #f1f5f9;
  color: #1e293b;
}

.popover-tab-btn.active {
  background: #4f46e5;
  color: white;
}

.contribution-review-dialog {
  width: min(520px, calc(100vw - 28px));
  padding: 0;
  border: 0;
  border-radius: 20px;
  color: #1e293b;
  box-shadow: 0 24px 80px rgba(15, 23, 42, 0.3);
}

.contribution-review-dialog::backdrop {
  background: rgba(15, 23, 42, 0.52);
  backdrop-filter: blur(5px);
}

.contribution-editor-dialog {
  width: min(760px, calc(100vw - 24px));
  max-height: min(900px, calc(100vh - 24px));
  padding: 0;
  border: 0;
  border-radius: 22px;
  color: #1e293b;
  box-shadow: 0 24px 90px rgba(15, 23, 42, 0.34);
}

.contribution-editor-dialog::backdrop {
  background: rgba(15, 23, 42, 0.54);
  backdrop-filter: blur(5px);
}

.contribution-editor-shell {
  display: flex;
  max-height: min(900px, calc(100vh - 24px));
  box-sizing: border-box;
  flex-direction: column;
  gap: 16px;
  padding: 22px;
  overflow: auto;
}

.contribution-editor-shell > header,
.contribution-editor-shell > footer,
.contribution-editor-section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.contribution-editor-shell > header > span,
.contribution-editor-section-heading > span {
  display: flex;
  flex-direction: column;
}

.contribution-editor-shell > header small,
.contribution-editor-section-heading small {
  color: #6366f1;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.contribution-editor-shell > header strong {
  font-size: 1.2rem;
}

.contribution-editor-section-heading strong {
  font-size: 0.9rem;
}

.contribution-editor-close {
  display: grid;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid #e2e8f0;
  border-radius: 50%;
  background: #f8fafc;
  color: #64748b;
  cursor: pointer;
  place-items: center;
}

.contribution-editor-message-label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: #64748b;
  font-size: 0.72rem;
  font-weight: 700;
}

.contribution-editor-message {
  width: 100%;
  box-sizing: border-box;
  resize: vertical;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  padding: 11px 12px;
  color: #1e293b;
  font: inherit;
  font-weight: 500;
}

.contribution-editor-groups,
.contribution-editor-pages {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 13px;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  background: #f8fafc;
}

.contribution-editor-add-group,
.contribution-editor-add-pages {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 9px;
  border: 1px solid #c7d2fe;
  border-radius: 8px;
  background: #fff;
  color: #4338ca;
  font-size: 0.68rem;
  font-weight: 700;
  cursor: pointer;
}

.contribution-editor-add-group .material-symbols-outlined,
.contribution-editor-add-pages .material-symbols-outlined {
  font-size: 17px;
}

.contribution-editor-group-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.contribution-editor-group-row {
  display: flex;
  gap: 5px;
}

.contribution-editor-group-row input {
  min-width: 0;
  flex: 1;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 7px 8px;
  background: #fff;
  color: #334155;
  font: inherit;
  font-size: 0.72rem;
}

.contribution-editor-group-row button,
.contribution-editor-page-actions button,
.contribution-editor-page-actions label {
  display: grid;
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  padding: 0;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
  color: #64748b;
  cursor: pointer;
  place-items: center;
}

.contribution-editor-group-row button {
  color: #dc2626;
}

.contribution-editor-page-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.contribution-editor-page {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border: 1px solid #e2e8f0;
  border-radius: 11px;
  background: #fff;
}

.contribution-editor-page > img {
  width: 64px;
  height: 64px;
  border-radius: 8px;
  object-fit: cover;
  background: #e2e8f0;
}

.contribution-editor-page-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 4px;
}

.contribution-editor-page-copy strong {
  overflow: hidden;
  color: #334155;
  font-size: 0.72rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.contribution-editor-page-copy select {
  width: 100%;
  border: 1px solid #e2e8f0;
  border-radius: 7px;
  padding: 5px 6px;
  background: #fff;
  color: #475569;
  font: inherit;
  font-size: 0.66rem;
}

.contribution-editor-page-copy small {
  color: #6366f1;
  font-size: 0.62rem;
  font-weight: 700;
}

.contribution-editor-page-actions {
  display: grid;
  grid-template-columns: repeat(2, 30px);
  gap: 5px;
}

.contribution-editor-page-actions button:last-child {
  color: #dc2626;
}

.contribution-editor-page-actions button:disabled {
  cursor: default;
  opacity: 0.35;
}

.contribution-editor-page-actions .material-symbols-outlined,
.contribution-editor-group-row .material-symbols-outlined {
  font-size: 16px;
}

.contribution-editor-empty {
  margin: 4px 0;
  color: #94a3b8;
  font-size: 0.72rem;
  font-style: italic;
}

.contribution-editor-help {
  margin: 0;
  color: #64748b;
  font-size: 0.7rem;
  line-height: 1.45;
}

.contribution-editor-help.is-error {
  color: #b91c1c;
}

.contribution-editor-shell > footer {
  justify-content: flex-end;
}

@media (max-width: 600px) {
  .contribution-editor-shell {
    padding: 16px;
  }

  .contribution-editor-group-list {
    grid-template-columns: 1fr;
  }

  .contribution-editor-page {
    grid-template-columns: 54px minmax(0, 1fr);
  }

  .contribution-editor-page > img {
    width: 54px;
    height: 54px;
  }

  .contribution-editor-page-actions {
    grid-column: 1 / -1;
    display: flex;
    justify-content: flex-end;
  }
}

.contribution-review-shell {
  display: flex;
  flex-direction: column;
  gap: 17px;
  padding: 22px;
}

.contribution-review-shell header,
.contribution-review-shell footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.contribution-review-shell header span {
  display: flex;
  flex-direction: column;
}

.contribution-review-shell header small {
  color: #6366f1;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.contribution-review-shell header strong {
  font-size: 1.18rem;
}

.contribution-review-close {
  display: grid;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid #e2e8f0;
  border-radius: 50%;
  background: #f8fafc;
  color: #64748b;
  cursor: pointer;
  place-items: center;
}

.contribution-review-shell label {
  display: flex;
  flex-direction: column;
  gap: 7px;
  color: #475569;
  font-size: 0.78rem;
  font-weight: 700;
}

.contribution-review-shell select,
.contribution-review-shell textarea {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  padding: 11px 12px;
  background: #fff;
  color: #1e293b;
  font: inherit;
  font-weight: 500;
}

.contribution-review-shell textarea {
  resize: vertical;
}

.contribution-review-shell select:focus,
.contribution-review-shell textarea:focus {
  outline: none;
  border-color: #818cf8;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.14);
}

.contribution-review-help {
  margin: -5px 0 0;
  color: #64748b;
  font-size: 0.75rem;
  line-height: 1.45;
}

.contribution-review-shell footer {
  justify-content: flex-end;
}

.my-contributions-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin: 0 0 12px;
}

.my-contributions-summary span {
  display: flex;
  min-width: 0;
  flex-direction: column;
  padding: 8px;
  border-radius: 10px;
  background: #f8fafc;
  text-align: center;
}

.my-contributions-summary small {
  overflow: hidden;
  color: #64748b;
  font-size: 0.58rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.my-contributions-summary strong {
  color: #1e293b;
  font-size: 1rem;
}

.my-contribution-card {
  margin-bottom: 10px;
  padding: 13px;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  background: #fff;
}

.my-contribution-card.status-changes_requested {
  border-color: #fdba74;
  background: #fffaf3;
}

.my-contribution-card.status-rejected {
  border-color: #fecaca;
  background: #fffafa;
}

.my-contribution-card > header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.my-contribution-card > header > span {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.my-contribution-card > header strong {
  overflow: hidden;
  color: #1e293b;
  font-size: 0.84rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.my-contribution-card > header small {
  color: #94a3b8;
  font-size: 0.65rem;
}

.my-contribution-status,
.admin-contribution-status {
  flex: 0 0 auto;
  padding: 3px 7px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #475569;
  font-size: 0.6rem;
}

.my-contribution-status.status-approved,
.admin-contribution-status.status-approved {
  background: #dcfce7;
  color: #166534;
}

.my-contribution-status.status-changes_requested,
.admin-contribution-status.status-changes_requested {
  background: #ffedd5;
  color: #c2410c;
}

.my-contribution-status.status-rejected,
.admin-contribution-status.status-rejected {
  background: #fee2e2;
  color: #b91c1c;
}

.my-contribution-progress {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin: 13px 0 10px;
}

.my-contribution-step {
  position: relative;
  display: flex;
  min-width: 0;
  align-items: center;
  flex-direction: column;
  gap: 4px;
  color: #94a3b8;
  text-align: center;
}

.my-contribution-step::before {
  position: absolute;
  z-index: 0;
  top: 5px;
  right: 50%;
  width: 100%;
  height: 2px;
  background: #e2e8f0;
  content: '';
}

.my-contribution-step:first-child::before {
  display: none;
}

.my-contribution-step i {
  z-index: 1;
  width: 10px;
  height: 10px;
  border: 2px solid #cbd5e1;
  border-radius: 50%;
  background: #fff;
}

.my-contribution-step small {
  overflow: hidden;
  width: 100%;
  font-size: 0.54rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.my-contribution-step.is-done {
  color: #166534;
}

.my-contribution-step.is-done i {
  border-color: #22c55e;
  background: #22c55e;
}

.my-contribution-step.is-active {
  color: #c2410c;
  font-weight: 700;
}

.my-contribution-step.is-active i {
  border-color: #f97316;
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.16);
}

.my-contribution-step.is-rejected {
  color: #b91c1c;
}

.my-contribution-step.is-rejected i {
  border-color: #ef4444;
  background: #ef4444;
}

.my-contribution-message {
  display: -webkit-box;
  overflow: hidden;
  margin: 8px 0;
  color: #475569;
  font-size: 0.75rem;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.my-contribution-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.my-contribution-facts > span {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 6px;
  border-radius: 7px;
  background: #f1f5f9;
  color: #64748b;
  font-size: 0.62rem;
}

.my-contribution-facts .material-symbols-outlined {
  font-size: 14px;
}

.my-contribution-facts .is-points {
  background: #fef9c3;
  color: #854d0e;
}

.my-contribution-review-reason,
.admin-contribution-review-reason {
  margin-top: 9px;
  padding: 8px 9px;
  border-radius: 9px;
  background: #fff7ed;
  color: #9a3412;
  font-size: 0.68rem;
  line-height: 1.45;
}

.my-contribution-review-reason {
  display: flex;
  align-items: flex-start;
  gap: 6px;
}

.my-contribution-review-reason strong {
  display: block;
}

.my-contribution-review-reason .material-symbols-outlined {
  font-size: 16px;
}

.my-contribution-card > footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 10px;
}

.my-contribution-open {
  padding: 6px 9px;
  border: 1px solid #c7d2fe;
  border-radius: 8px;
  background: #eef2ff;
  color: #4338ca;
  font-size: 0.68rem;
  font-weight: 700;
  cursor: pointer;
}

.contrib-review-actions {
  display: flex;
  gap: 5px;
}

.contrib-admin-approve,
.contrib-admin-review {
  display: grid;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  place-items: center;
}

.contrib-admin-approve {
  background: #dcfce7;
  color: #15803d;
}

.contrib-admin-review {
  background: #ffedd5;
  color: #c2410c;
}

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

.admin-contribution-status {
  margin-left: 7px;
}

/* Log Modifiche (Admin Logs) */
.log-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px;
  border-radius: 8px;
  margin-bottom: 6px;
  border: 1px solid #e2e8f0;
  font-size: 0.9rem;
  background: #fff;
}

.log-item-row:nth-child(even) {
  background: #f8fafc;
}

.log-profile-link,
.log-place-link {
  color: #4f46e5;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s;
}

.log-profile-link:hover,
.log-place-link:hover {
  text-decoration: underline;
  color: #4338ca;
}

/* Template stili per index.html */
.fm-info-name {
  font-size: 1.1rem;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 2px;
}

.fm-info-meta {
  font-size: 0.85rem;
  color: #64748b;
}

.fm-info-extra {
  font-size: 0.8rem;
  color: #94a3b8;
  margin-top: 4px;
}

.inline-edit-area {
  margin-top: 10px;
}

.inline-edit-textarea {
  width: 100%;
  padding: 8px;
  background: transparent;
  border: none;
  border-bottom: 1.5px solid transparent;
  border-radius: 0;
  font-family: inherit;
  font-size: 0.9rem;
  color: #334155;
  box-sizing: border-box;
  resize: vertical;
  outline: none;
  transition:
    border-color 0.2s ease,
    background 0.2s ease;
}

.inline-edit-textarea:focus {
  border-bottom-color: var(--primary-color, #3b82f6);
  background: rgba(59, 130, 246, 0.04);
}

.inline-edit-actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  justify-content: flex-end;
}

.inline-btn-circle {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: all 0.2s;
}

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

.inline-btn-save:hover {
  background: rgba(22, 163, 74, 0.2);
}

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

.inline-btn-cancel:hover {
  background: rgba(239, 68, 68, 0.2);
}

/* Stemma Edit Controls */
.stemma-edit-wrapper {
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  display: flex;
}

.stemma-edit-controls {
  display: flex;
  gap: 8px;
  width: 100%;
  align-items: center;
}

/* QR Code */
.qr-container {
  display: flex;
  justify-content: center;
  margin-top: 10px;
  padding: 10px;
  background: white;
}

/* Contribuzioni */
.contrib-session-card {
  margin-bottom: 12px;
  padding: 10px 14px;
  background: #f8fafc;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all 0.2s;
}

.contrib-session-card:hover {
  border-color: #cbd5e1;
  background: #f1f5f9;
}

.contrib-session-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.contrib-label {
  font-size: 0.75rem;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 700;
}

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

/* Contributor Identity Selector (Profile & Guided Modals) */
.contrib-identity-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 14px;
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 12px;
  margin-bottom: 8px;
}

.contrib-identity-toggle {
  display: flex;
  gap: 6px;
  background: rgba(11, 17, 32, 0.7);
  padding: 4px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.15);
}

.contrib-identity-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  background: transparent;
  color: #94a3b8;
  transition: all 0.2s ease;
  user-select: none;
}

.contrib-identity-btn:hover {
  color: #f8fafc;
  background: rgba(255, 255, 255, 0.05);
}

.contrib-identity-btn.active {
  background: #0284c7;
  color: #ffffff;
  border-color: #38bdf8;
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.35);
}

.contrib-identity-btn.contrib-btn-anon.active {
  background: #334155;
  color: #f8fafc;
  border-color: #64748b;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.contrib-identity-hint {
  font-size: 0.78rem;
  line-height: 1.4;
  display: flex;
  align-items: flex-start;
  gap: 6px;
  color: #93c5fd;
  transition: color 0.2s ease;
}

:root:not(.dark) .contrib-session-card .contrib-identity-toggle {
  background: #e2e8f0;
  border-color: #cbd5e1;
}

:root:not(.dark) .contrib-session-card .contrib-identity-btn {
  color: #475569;
}

:root:not(.dark) .contrib-session-card .contrib-identity-btn.active {
  background: #0284c7;
  color: #ffffff;
}

:root:not(.dark) .contrib-session-card .contrib-identity-btn.contrib-btn-anon.active {
  background: #475569;
  color: #ffffff;
}

:root:not(.dark) .contrib-session-card .contrib-identity-hint {
  color: #0369a1;
}

/* Row-based Contribution Item (Admin List) */
.contrib-item-row,
.contrib-item-card {
  padding: 1rem 1.5rem 0.5rem;
  border-radius: 10px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: background 0.15s;
  border: 1px solid transparent;
  background: white;
}

.contrib-item-row:hover,
.contrib-item-card:hover {
  background: #f1f5f9;
}

.contrib-item-card.unread {
  background: #eff6ff !important;
  border-color: #bfdbfe !important;
}

.contrib-item-card.read {
  opacity: 0.75;
}

.contrib-author {
  color: #1e293b;
  font-weight: 700;
}

.contrib-date {
  font-size: 0.75rem;
  color: #1e293b;
  margin-left: 8px;
}

.verified-badge {
  font-size: 16px !important;
  color: #1d9bf0;
  vertical-align: middle;
  margin-left: 4px;
  cursor: pointer;
  user-select: none;
}

.contrib-profile-info {
  font-size: 0.85rem;
  color: #64748b;
  margin-bottom: 4px;
}

.contrib-msg {
  font-size: 0.9rem;
  color: #334155;
  margin-bottom: 6px;
  white-space: pre-wrap;
}

.contrib-photo-link {
  font-size: 0.8rem;
  color: #4f46e5;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 6px;
  margin-right: 12px;
}

.contrib-photo-link span {
  font-size: 16px;
}

/* User Notifications */
.notifications-push-banner-area {
  display: block;
}

.push-notification-control {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
  padding: 12px 14px;
  border: 1px solid #bfdbfe;
  border-radius: 12px;
  background: linear-gradient(135deg, #eff6ff, #f8fafc);
}

.push-notification-control.is-enabled {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  min-height: 28px;
  padding: 0;
  margin-bottom: 0;
  border: 1px solid #86efac;
  border-radius: 50%;
  background: #f0fdf4;
  color: #16a34a;
  cursor: pointer;
  flex-shrink: 0;
  box-shadow: 0 1px 2px rgba(22, 163, 74, 0.12);
  transition: all 0.2s ease;
}

.push-notification-control.is-enabled:hover,
.push-notification-control.is-enabled:focus-visible {
  background: #dcfce7;
  border-color: #4ade80;
  box-shadow: 0 2px 6px rgba(22, 163, 74, 0.25);
  outline: none;
}

.push-notification-control.is-denied,
.push-notification-control.is-unsupported,
.push-notification-control.is-requires_install {
  border-color: #e2e8f0;
  background: #f8fafc;
}

.push-notification-control.is-error {
  border-color: #fecaca;
  background: #fef2f2;
}

.push-notification-control-icon {
  color: #2563eb;
  font-size: 24px;
}

.push-notification-control.is-enabled .push-notification-control-icon {
  color: #16a34a;
  font-size: 16px;
  line-height: 1;
}

.push-notification-control.is-denied .push-notification-control-icon,
.push-notification-control.is-unsupported .push-notification-control-icon,
.push-notification-control.is-requires_install .push-notification-control-icon {
  color: #64748b;
}

.push-notification-control.is-error .push-notification-control-icon {
  color: #dc2626;
}

.push-notification-control-content {
  min-width: 0;
}

.push-notification-control-title {
  display: block;
  color: #0f172a;
  font-size: 0.86rem;
  line-height: 1.3;
}

.push-notification-control-description {
  margin: 3px 0 0;
  color: #475569;
  font-size: 0.75rem;
  line-height: 1.35;
}

/* Hover-only text popover for active push notifications */
.push-notification-control.is-enabled .push-notification-control-content {
  position: absolute;
  top: calc(100% + 7px);
  right: -4px;
  width: 240px;
  padding: 8px 10px;
  background: #0f172a;
  color: #ffffff;
  border-radius: 8px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.35), 0 8px 10px -6px rgba(0, 0, 0, 0.25);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
  pointer-events: none;
  z-index: 100;
  text-align: left;
}

.push-notification-control.is-enabled .push-notification-control-content::before {
  content: '';
  position: absolute;
  top: -5px;
  right: 12px;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-bottom: 5px solid #0f172a;
}

.push-notification-control.is-enabled:hover .push-notification-control-content,
.push-notification-control.is-enabled:focus-within .push-notification-control-content {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.push-notification-control.is-enabled .push-notification-control-title {
  color: #ffffff;
  font-size: 0.78rem;
  font-weight: 600;
  display: block;
}

.push-notification-control.is-enabled .push-notification-control-description {
  color: #cbd5e1;
  font-size: 0.72rem;
  margin-top: 2px;
  line-height: 1.35;
}

.push-notification-enable {
  min-height: 34px;
  padding: 6px 12px;
  font-size: 0.78rem;
  white-space: nowrap;
}

@media (max-width: 520px) {
  .push-notification-control {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .push-notification-enable {
    grid-column: 1 / -1;
    width: 100%;
  }
}

/* Notification Filter Bar */
.notification-filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 10px;
  margin-bottom: 10px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 9px;
  gap: 8px;
}

.notification-filter-main {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex-wrap: wrap;
}

.notification-filter-title {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.76rem;
  font-weight: 600;
  color: #64748b;
  white-space: nowrap;
}

.notification-filter-icon {
  font-size: 1rem;
  color: #64748b;
}

.notification-filter-group {
  display: inline-flex;
  gap: 2px;
  background: #e2e8f0;
  padding: 2px;
  border-radius: 7px;
}

.notification-filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: none;
  background: transparent;
  padding: 3px 8px;
  border-radius: 5px;
  font-size: 0.74rem;
  font-weight: 500;
  color: #475569;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
  line-height: 1.2;
}

.notification-filter-btn .material-symbols-outlined {
  font-size: 0.95rem;
}

.notification-filter-btn:hover {
  color: #0f172a;
}

.notification-filter-btn.active {
  background: #ffffff;
  color: #4f46e5;
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.notification-push-slot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.notification-item-row {
  padding: 12px;
  border-radius: 10px;
  margin-bottom: 8px;
  border: 1px solid #e2e8f0;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  transition: all 0.2s;
  cursor: pointer;
}

.notification-item-row:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.notification-icon-container {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.notification-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid #cbd5e1;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  background: #f1f5f9;
}

.notification-sender {
  font-weight: 600;
  font-size: 0.9rem;
  color: #1e293b;
}

.notification-message {
  font-size: 0.85rem;
  color: #475569;
  line-height: 1.4;
}

.notification-images-preview {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}

.notification-preview-thumb {
  width: 48px;
  height: 48px;
  border-radius: 6px;
  object-fit: cover;
  border: 1px solid #cbd5e1;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.contrib-unread-dot,
.notification-unread-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #4f46e5;
  flex-shrink: 0;
}

/* Lightbox Sidebar Tags */
.lb-tags-container {
  padding: 20px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.lb-tags-header {
  margin: 0 0 16px 0;
  color: #64748b;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  flex-shrink: 0;
}

.lb-tag-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px;
  border-radius: 6px;
  transition: background 0.2s;
}

.lb-tag-row:hover {
  background: #f8fafc;
}

.lb-tag-name-text {
  color: #1e293b;
  font-size: 0.95rem;
  font-weight: 500;
}

/* Stemmi Edit Items (Redesign) */
.stemma-edit-value {
  display: flex !important;
  align-items: center !important;
  gap: 8px;
  height: auto !important;
  line-height: normal !important;
  justify-content: flex-end !important;
}

.stemma-add-tile {
  width: 36px;
  height: 36px;
  min-width: 36px;
  border: 1.5px dashed #cbd5e1;
  border-radius: 8px;
  background: transparent;
  color: #94a3b8;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  padding: 0;
  font-size: 0;
}

.stemma-add-tile .material-symbols-outlined {
  font-size: 20px;
}

.stemma-add-tile:hover {
  border-color: #4f46e5;
  color: #4f46e5;
  background: #eef2ff;
}

.stemma-edit-item {
  position: relative;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  border-radius: 0;
  padding: 0;
}

.stemma-edit-item img {
  width: 36px;
  height: 36px;
  object-fit: contain;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.15));
}

.stemma-remove-btn {
  position: absolute;
  top: -5px;
  right: -5px;
  width: 16px;
  height: 16px;
  background: #ef4444;
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px !important;
  border: 1.5px solid white;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  transition: transform 0.15s;
  padding: 0;
  line-height: 1;
}

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

/* Stemmi Selector Modal */
.stemmi-selector-modal {
  width: 100%;
  max-width: 500px;
  background: white;
  border-radius: 20px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
}

.stemmi-selector-modal .modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #f1f5f9;
}

.stemmi-selector-modal .modal-header h3 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
  color: #0f172a;
}

.stemmi-selector-modal .modal-close-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f1f5f9;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  color: #64748b;
  font-size: 20px;
  transition: all 0.15s;
}

.stemmi-selector-modal .modal-close-btn:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.search-bar-container {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
}

.search-bar-container .relative {
  position: relative;
  flex: 1;
  min-width: 0;
}

.modal-search-input {
  width: 100%;
  padding: 8px 12px 8px 36px;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  outline: none;
  font-size: 0.9rem;
  transition: border-color 0.2s;
  box-sizing: border-box;
}

.modal-search-input:focus {
  border-color: #4f46e5;
}

.search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
  font-size: 18px;
  pointer-events: none;
}

.btn-stemma-action {
  width: 36px;
  height: 36px;
  min-width: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f1f5f9;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  cursor: pointer;
  color: #64748b;
  transition: all 0.15s;
  padding: 0;
}

.btn-stemma-action:hover {
  border-color: #4f46e5;
  color: #4f46e5;
  background: #eef2ff;
}

.btn-stemma-action .material-symbols-outlined {
  font-size: 18px;
}

.stemmi-selection-grid {
  padding: 20px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 16px;
  max-height: 400px;
  overflow-y: auto;
}

.stemma-selection-item {
  aspect-ratio: 1;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  background: #fff;
}

.stemma-selection-item:hover {
  border-color: #4f46e5;
  background: #eef2ff;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.1);
}

.stemma-selection-item img {
  max-width: 100%;
  max-height: 50px;
  object-fit: contain;
  margin-bottom: 4px;
}

.stemma-selection-name {
  font-size: 0.75rem;
  color: #64748b;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
}

/* Add Person Modal (Lightbox variation) */
.add-person-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(8px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.add-person-card {
  background: white;
  border-radius: 20px;
  padding: 0;
  max-width: 440px;
  width: 95%; /* More space on mobile */
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 70px rgba(0, 0, 0, 0.4);
  font-family: 'Inter', sans-serif;
  overflow: hidden;
}

@media (max-width: 600px) {
  .add-person-card {
    width: 100%;
    height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
  }
  .ap-header {
    padding: 16px;
  }
  .ap-body {
    padding: 16px;
  }
}

.ap-header {
  padding: 24px 24px 16px;
  border-bottom: 1px solid #f1f5f9;
}

.ap-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.ap-title {
  margin: 0;
  font-size: 1.35rem;
  color: #0f172a;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.ap-close-btn {
  background: #f1f5f9;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 1.25rem;
  cursor: pointer;
  color: #64748b;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ap-tabs {
  display: flex;
  background: #f8fafc;
  padding: 4px;
  border-radius: 12px;
  gap: 4px;
}

.ap-tab-btn {
  flex: 1;
  padding: 8px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  transition: all 0.2s;
  background: transparent;
  color: #64748b;
}

.ap-tab-btn.active {
  background: white;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  color: #0f172a;
}

.ap-body {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  overflow-y: auto; /* Enable internal scrolling */
  flex: 1;
}

.ap-footer {
  padding: 16px 24px 24px;
  background: #f8fafc;
  border-top: 1px solid #f1f5f9;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.ap-btn-save {
  padding: 10px 24px;
  border: none;
  background: #4f46e5;
  color: white;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
}

.ap-btn-cancel {
  padding: 10px 18px;
  border: none;
  background: transparent;
  color: #64748b;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.95rem;
}

.ap-field-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ap-label {
  font-size: 0.85rem;
  color: #475569;
  font-weight: 600;
}

.ap-input,
.ap-select {
  padding: 12px;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  font-size: 1rem;
  width: 100%;
  box-sizing: border-box;
  outline: none;
}

.vh-item {
  margin: 8px 16px;
  padding: 12px;
  background: #f8fafc;
  border: 1px solid #f1f5f9;
  border-radius: 16px;
  position: relative;
  transition: all 0.2s;
}

.vh-item:hover {
  background: #f1f5f9;
  border-color: #e2e8f0;
}
/* Custom Autocomplete */
.custom-autocomplete-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  margin-top: 4px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
  max-height: 250px;
  overflow-y: auto;
  z-index: 1000;
}

.stemma-suggestion-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  cursor: pointer;
  transition: background 0.2s;
}

.stemma-suggestion-item:hover {
  background: #f1f5f9;
}

.stemma-suggestion-item img {
  width: 32px;
  height: 32px;
  object-fit: contain;
  border-radius: 4px;
  background: #f8fafc;
}

.suggestion-info {
  display: flex;
  flex-direction: column;
}

.suggestion-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: #1e293b;
}

.suggestion-filename {
  font-size: 0.75rem;
  color: #94a3b8;
}

/* Bio Editor Buttons */
.bio-edit-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  justify-content: flex-end;
}

/* Person Detail Panel (Sidebar) */
.panel-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 16px 12px;
}

.panel-avatar-wrapper {
  margin-bottom: 8px;
  border-radius: 50%;
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.1);
}

.panel-header h2 {
  font-size: 1.25rem;
  font-weight: 800;
  margin-bottom: 2px;
  color: #0f172a;
  line-height: 1.2;
}

.panel-id {
  font-size: 0.72rem;
  color: #94a3b8;
  margin-bottom: 8px;
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: 0.05em;
}

.panel-completeness-slot {
  display: flex;
  justify-content: center;
  margin: 6px 0 12px;
  width: 100%;
}

.sidebar-completeness-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 12px;
  border-radius: 999px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.06);
  font-size: 0.78rem;
  color: #475569;
  cursor: default;
  transition: all 0.18s ease;
}

.sidebar-completeness-chip:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(15, 23, 42, 0.08);
}

.sidebar-completeness-chip .radial-completeness-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.15));
}

.sidebar-completeness-label {
  letter-spacing: 0.01em;
  color: #334155;
  font-weight: 500;
}

.sidebar-completeness-label strong {
  color: #0f172a;
  font-weight: 800;
}

.panel-action-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  width: 100%;
}

.panel-action-buttons button {
  height: 38px;
  border-radius: 12px;
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  font-size: 0.85rem;
  font-weight: 600;
}

.panel-action-buttons button:hover {
  background: #e2e8f0;
  color: #1e293b;
}

.panel-details,
.panel-family {
  padding: 0 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.panel-detail-label,
.panel-family-label {
  font-size: 0.9rem;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: block;
  margin-bottom: 2px;
}

.panel-detail-value,
.panel-family-value {
  font-size: 0.85rem;
  color: #334155;
  font-weight: 500;
}

.panel-divider {
  border: none;
  border-top: 1px solid #f1f5f9;
  margin: 12px 0;
}

.privacy-blur {
  filter: blur(5px);
  user-select: none;
}

.footer-page-overlay {
  position: fixed;
  inset: 0;
  z-index: 14000;
  background: rgba(15, 23, 42, 0.46);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  box-sizing: border-box;
  opacity: 1;
  transition: opacity 0.18s ease;
}

.footer-page-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.footer-page-shell {
  width: min(1040px, 100%);
  height: min(88vh, 860px);
  border-radius: 24px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 30px 90px rgba(15, 23, 42, 0.28);
  display: flex;
  flex-direction: column;
  transform: translateY(0);
  transition:
    transform 0.22s ease,
    opacity 0.22s ease;
}

.footer-page-overlay.hidden .footer-page-shell {
  transform: translateY(18px);
}

.footer-page-toolbar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: rgba(248, 250, 252, 0.96);
  border-bottom: 1px solid #e2e8f0;
}

.footer-page-title {
  font-size: 0.98rem;
  font-weight: 700;
  color: #0f172a;
  text-align: center;
}

.footer-page-close,
.footer-page-dismiss {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: white;
  border: 1px solid #e2e8f0;
  color: #334155;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

.footer-page-content {
  flex: 1;
  width: 100%;
  background: white;
  overflow: auto;
  overscroll-behavior: contain;
}

.footer-page-document {
  min-height: 100%;
  box-sizing: border-box;
  max-width: 800px;
  margin: 0 auto;
  padding: 40px 20px;
  color: #1e293b;
  font-family: 'Inter', sans-serif;
  line-height: 1.6;
  background: #f8fafc;
}

.footer-page-document .header {
  text-align: center;
  margin-bottom: 3rem;
}

.footer-page-document .logo {
  max-width: 240px;
  height: auto;
  margin-bottom: 1.5rem;
}

.footer-page-document h1 {
  font-size: 1.75rem;
  font-weight: 700;
  color: #0f172a;
  margin: 0 0 1rem;
  line-height: 1.3;
}

.footer-page-document h2 {
  font-size: 1.25rem;
  font-weight: 600;
  color: #0284c7;
  margin: 2rem 0 1rem;
  border-left: 4px solid #0284c7;
  padding-left: 1rem;
}

.footer-page-document h2:first-of-type {
  margin-top: 0;
}

.footer-page-document h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 1.5rem 0 0.75rem;
}

.footer-page-document p,
.footer-page-document ul {
  margin: 0 0 1.25rem;
  font-size: 1rem;
  color: #334155;
}

.footer-page-document ul {
  padding-left: 1.5rem;
}

.footer-page-document li {
  margin-bottom: 0.5rem;
}

.footer-page-document a {
  color: #0284c7;
  text-decoration: none;
  font-weight: 500;
}

.footer-page-document a:hover {
  text-decoration: underline;
}

.footer-page-document .info-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 2.5rem;
  box-shadow:
    0 4px 6px -1px rgba(0, 0, 0, 0.05),
    0 2px 4px -1px rgba(0, 0, 0, 0.03);
  margin-bottom: 2rem;
  text-align: left;
}

.footer-page-document .contact-box {
  background-color: #f1f5f9;
  border-radius: 12px;
  padding: 1.5rem;
  margin-top: 2rem;
  border-left: 4px solid #94a3b8;
}

.footer-page-document .footer-legal {
  margin-top: 4rem;
  padding-top: 2rem;
  border-top: 1px solid #e2e8f0;
  font-size: 0.85rem;
  color: #64748b;
  text-align: left;
}

.footer-page-document .footer-legal h4 {
  font-size: 0.9rem;
  color: #1e293b;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.footer-page-document .legal-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
}

.footer-page-loading,
.footer-page-error {
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 10px;
  color: #64748b;
  font-weight: 500;
}

.footer-page-error .material-symbols-outlined {
  font-size: 28px;
}

body.footer-page-open {
  overflow: hidden;
}

@media (max-width: 768px) {
  .footer-page-overlay {
    padding: 0;
    align-items: flex-end;
  }

  .footer-page-shell {
    width: 100%;
    height: 100dvh;
    max-height: none;
    border-radius: 18px 18px 0 0;
  }

  .footer-page-toolbar {
    padding-top: max(14px, env(safe-area-inset-top));
  }

  .footer-page-document {
    padding: 24px 16px;
  }

  .footer-page-document .info-card {
    padding: 1.5rem;
  }

  .footer-page-document .legal-grid {
    grid-template-columns: 1fr;
  }

  #panel-content,
  .relationship-path-modal__body,
  .relationship-path-viewport,
  .stemmi-selection-grid,
  .ap-body,
  .custom-autocomplete-results,
  .footer-page-content {
    -ms-overflow-style: none;
    scrollbar-width: none;
  }

  #panel-content::-webkit-scrollbar,
  .relationship-path-modal__body::-webkit-scrollbar,
  .relationship-path-viewport::-webkit-scrollbar,
  .stemmi-selection-grid::-webkit-scrollbar,
  .ap-body::-webkit-scrollbar,
  .custom-autocomplete-results::-webkit-scrollbar,
  .footer-page-content::-webkit-scrollbar {
    width: 0;
    height: 0;
    display: none;
  }
}

/* Guided Contributions Modal Centering */
#guided-contribution-dialog {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100vw !important;
  height: 100dvh !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 16px !important;
  box-sizing: border-box !important;
  z-index: 10050 !important;
  overflow: hidden !important;
}

.guided-contribution-card,
.guided-media-card {
  margin: auto !important;
  max-width: 460px !important;
  width: 100% !important;
  box-sizing: border-box !important;
  transform: none !important;
}

@media (max-width: 600px) {
  #guided-contribution-dialog {
    padding: 12px !important;
    align-items: center !important;
    justify-content: center !important;
  }
  .guided-contribution-card,
  .guided-media-card {
    max-width: 100% !important;
    width: 100% !important;
    margin: auto !important;
    padding: 20px 16px !important;
    border-radius: 14px !important;
  }
}

/* --- Place Section & Street Details (Mirrors Stemma Section Style) --- */
#place-section {
  width: 100%;
  height: 100%;
  overflow-y: auto;
  background: var(--bg-gradient);
  background-color: var(--bg-color);
  scroll-behavior: smooth;
}

.place-detail-card {
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 0 60px;
  text-align: center;
  background: white;
  min-height: 100%;
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.06);
  box-sizing: border-box;
  position: relative;
  overflow: hidden;
}

.place-cover-banner {
  position: relative;
  width: 100%;
  height: 220px;
  overflow: hidden;
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 50%, #0f766e 100%);
  margin-bottom: 24px;
}

.place-cover-banner-img {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
}

.place-cover-banner-gradient {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.2) 0%, rgba(15, 23, 42, 0.75) 100%);
}

.place-header-flex {
  display: flex;
  justify-content: flex-start;
  margin-bottom: 20px;
  padding: 20px 24px 0;
}

.place-detail-card:has(#place-cover-banner:not([style*="display: none"])) .place-header-flex {
  position: absolute;
  top: 15px;
  left: 15px;
  z-index: 10;
  padding: 0;
  margin-bottom: 0;
}

.place-content-body {
  padding: 0 24px;
}

.place-category-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 14px;
  border-radius: 9999px;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: #f1f5f9;
  color: #475569;
  margin-bottom: 14px;
  white-space: nowrap;
}

.place-category-pill.precision-hamlet {
  background: #fef3c7;
  color: #92400e;
}

.place-category-pill.precision-street {
  background: #e0f2fe;
  color: #0369a1;
}

.place-category-pill.precision-municipality {
  background: #ede9fe;
  color: #5b21b6;
}

.place-category-pill .material-symbols-outlined {
  font-size: 1.1rem;
}

.place-title-main {
  font-size: 2.25rem;
  font-weight: 800;
  color: #1e293b;
  margin: 0 0 10px;
  line-height: 1.25;
}

.place-desc-main {
  font-size: 1.1rem;
  color: #475569;
  line-height: 1.6;
  max-width: 620px;
  margin: 0 auto 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
}

.place-desc-main .material-symbols-outlined {
  font-size: 1.25rem;
  color: #0284c7;
}

/* Historical alias banner matching stemma style */
.place-historical-banner {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 12px;
  padding: 14px 18px;
  max-width: 680px;
  margin: 0 auto 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  color: #92400e;
  font-size: 0.96rem;
  box-sizing: border-box;
}

.place-historical-banner .material-symbols-outlined {
  font-size: 1.7rem;
  color: #d97706;
  flex-shrink: 0;
}

/* Approximate location banner */
.place-notice-banner {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 12px;
  padding: 14px 18px;
  max-width: 680px;
  margin: 0 auto 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  color: #1e40af;
  font-size: 0.95rem;
  box-sizing: border-box;
}

.place-notice-banner .material-symbols-outlined {
  font-size: 1.7rem;
  color: #3b82f6;
  flex-shrink: 0;
}

/* Section content blocks inside place-detail-card */
.place-section-block {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 22px;
  margin: 0 auto 24px;
  max-width: 720px;
  text-align: left;
  box-sizing: border-box;
}

.place-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.15rem;
  font-weight: 700;
  color: #1e293b;
  margin: 0 0 14px;
}

.place-section-title .material-symbols-outlined {
  color: #0284c7;
  font-size: 1.35rem;
}

.place-count-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  padding: 0 8px;
  border-radius: 9999px;
  background: #e2e8f0;
  color: #334155;
  font-size: 0.78rem;
  font-weight: 700;
  margin-left: auto;
}

.place-history-text {
  font-size: 1rem;
  line-height: 1.7;
  color: #334155;
  margin: 0;
  white-space: pre-wrap;
}

/* Map preview container */
.place-map-container {
  height: 240px;
  width: 100%;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid #cbd5e1;
  background: #f1f5f9;
  position: relative;
  margin-bottom: 14px;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.place-map-container:hover,
.place-map-container:focus-visible {
  transform: translateY(-2px);
  border-color: #0284c7;
  box-shadow: 0 8px 24px rgba(2, 132, 199, 0.18);
  outline: none;
}

.place-map-tile {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 256px;
  height: 256px;
  max-width: none;
  display: block;
}

.place-map-pin {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -100%);
  color: #ef4444;
  font-size: 2.6rem;
  filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.45));
  pointer-events: none;
}

.place-map-coords-badge {
  position: absolute;
  bottom: 10px;
  right: 10px;
  background: rgba(15, 23, 42, 0.85);
  color: white;
  padding: 4px 10px;
  border-radius: 6px;
  font-family: monospace;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  pointer-events: none;
}

.place-map-hover-hint {
  position: absolute;
  bottom: 10px;
  left: 10px;
  background: rgba(15, 23, 42, 0.85);
  color: white;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.75rem;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-weight: 600;
  pointer-events: none;
  transition: background 0.18s ease;
}

.place-map-hover-hint .material-symbols-outlined {
  font-size: 1rem;
}

.place-map-container:hover .place-map-hover-hint {
  background: #0284c7;
}

.place-map-action-bar {
  display: flex;
  justify-content: center;
}

.btn-place-action {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.18s ease;
  background: #0284c7;
  color: white;
}

.btn-place-action:hover {
  background: #0369a1;
  transform: translateY(-1px);
}

/* Connected People Grid */
.place-people-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.place-person-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
  animation: placeItemFadeIn 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  width: 100%;
  box-sizing: border-box;
}

.place-person-card:hover {
  border-color: #94a3b8;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
  transform: translateY(-1px);
}

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

.place-person-name {
  display: block;
  font-size: 0.98rem;
  font-weight: 650;
  color: #1e293b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.place-person-dates {
  display: block;
  font-size: 0.82rem;
  color: #64748b;
  margin-top: 3px;
}

.place-person-events {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 6px;
}

.place-person-event-badge {
  display: inline-block;
  font-size: 0.74rem;
  padding: 2px 7px;
  border-radius: 4px;
  font-weight: 600;
  white-space: nowrap;
}

.place-person-event-badge.type-birth {
  background: #dcfce7;
  color: #166534;
}

.place-person-event-badge.type-death {
  background: #f1f5f9;
  color: #475569;
}

.place-person-event-badge.type-residence {
  background: #e0f2fe;
  color: #075985;
}

.place-person-event-badge.type-marriage {
  background: #fef3c7;
  color: #92400e;
}

.place-person-arrow {
  font-weight: 650;
  cursor: pointer;
  transition: all 0.18s ease;
}

.place-modal-qr-toggle-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.place-qr-chevron {
  margin-left: auto;
  transition: transform 0.2s ease;
}

.place-modal-qr-toggle-btn.is-open .place-qr-chevron {
  transform: rotate(180deg);
}

.place-modal-qr-container {
  margin-top: 14px;
  padding: 16px;
  background: #f8fafc;
  border-radius: 14px;
  border: 1px solid #e2e8f0;
}

.place-qr-card-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.place-qr-image {
  max-width: 240px;
  width: 100%;
  height: auto;
  border-radius: 12px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.1);
  display: block;
}

.place-qr-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.place-qr-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 0.84rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.15s ease;
  border: 1px solid transparent;
}

.place-qr-btn-copy {
  background: #e0f2fe;
  border-color: #bae6fd;
  color: #0369a1;
}

.place-qr-btn-copy:hover {
  background: #bae6fd;
  color: #0284c7;
}

.place-qr-btn-whatsapp {
  background: #dcfce7;
  border-color: #bbf7d0;
  color: #15803d;
}

.place-qr-btn-whatsapp:hover {
  background: #bbf7d0;
  color: #166534;
}

.place-qr-btn-download {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: #334155;
}

.place-qr-btn-download:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.place-qr-btn .material-symbols-outlined {
  font-size: 1.1rem;
}

.map-cluster-open-place-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  margin-bottom: 12px;
  background: rgba(14, 165, 233, 0.15);
  border: 1px solid rgba(14, 165, 233, 0.3);
  border-radius: 10px;
  color: #38bdf8;
  font-size: 0.82rem;
  font-weight: 650;
  cursor: pointer;
  transition: all 0.18s ease;
  width: 100%;
}

.map-cluster-open-place-btn:hover {
  background: rgba(14, 165, 233, 0.25);
  color: #ffffff;
}

/* Lightbox Place Badge */
.lightbox-place-badge-container {
  display: flex;
  align-items: center;
  margin-bottom: 12px;
}

.lightbox-place-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  background: #e0f2fe;
  color: #0369a1;
  border: 1px solid #bae6fd;
  cursor: pointer;
  transition: all 0.18s ease;
}

.lightbox-place-badge:hover {
  background: #0284c7;
  color: white;
  border-color: #0284c7;
  transform: translateY(-1px);
}

.lightbox-place-badge .material-symbols-outlined {
  font-size: 16px;
}

/* Street Photos & Stories Sections */
.place-section-header-flex {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.place-section-header-flex .place-section-title {
  margin-bottom: 0;
}

.btn-place-action-small {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  background: #0284c7;
  color: white;
  border: none;
  cursor: pointer;
  transition: all 0.18s ease;
}

.btn-place-action-small:hover {
  background: #0369a1;
  transform: translateY(-1px);
}

.btn-place-action-small .material-symbols-outlined {
  font-size: 16px;
}

/* Place Photo Grid & Cards */
.place-photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.place-photo-card {
  display: flex;
  flex-direction: column;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  overflow: hidden;
  padding: 0;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s ease;
  animation: placeItemFadeIn 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  width: 100%;
  box-sizing: border-box;
}

.place-photo-card:hover {
  border-color: #0284c7;
  box-shadow: 0 6px 18px rgba(2, 132, 199, 0.12);
  transform: translateY(-2px);
}

.place-photo-card-thumb {
  position: relative;
  width: 100%;
  height: 130px;
  background: #0f172a;
  overflow: hidden;
}

.place-photo-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.25s ease;
  display: block;
}

.place-photo-card:hover .place-photo-card-thumb img {
  transform: scale(1.04);
}

.place-photo-year-badge {
  position: absolute;
  bottom: 6px;
  right: 6px;
  background: rgba(15, 23, 42, 0.85);
  color: white;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 600;
}

.place-photo-card-info {
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.place-photo-card-caption {
  font-size: 0.85rem;
  font-weight: 600;
  color: #1e293b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.place-photo-card-sub {
  font-size: 0.75rem;
  color: #64748b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.place-photos-empty {
  text-align: center;
  padding: 28px 16px;
  color: #64748b;
  background: white;
  border: 1px dashed #cbd5e1;
  border-radius: 10px;
  margin-top: 10px;
}

.place-photos-empty .material-symbols-outlined {
  font-size: 40px;
  color: #94a3b8;
  margin-bottom: 8px;
}

.place-photos-empty p {
  margin: 0 0 6px;
  font-size: 0.95rem;
  font-weight: 600;
  color: #334155;
}

.place-photos-empty .place-photos-empty-sub {
  font-size: 0.82rem;
  font-weight: normal;
  color: #64748b;
  margin-bottom: 14px;
}

.place-stories-hint {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  color: #475569;
  background: white;
  padding: 12px 16px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  margin-top: 12px;
}

.place-stories-hint .material-symbols-outlined {
  color: #0284c7;
  font-size: 1.2rem;
}

.btn-link-action {
  background: none;
  border: none;
  color: #0284c7;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
  font-size: inherit;
}

.btn-link-action:hover {
  color: #0369a1;
}

/* Progressive Reveal / Expand Controls for Place Photos & People */
.place-expand-bar {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 14px;
  width: 100%;
}

.btn-place-expand {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 20px;
  background: #ffffff;
  color: #334155;
  border: 1px solid #cbd5e1;
  border-radius: 9999px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-place-expand:hover {
  background: #f8fafc;
  border-color: #0284c7;
  color: #0284c7;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.12);
  transform: translateY(-1px);
}

.btn-place-expand:active {
  transform: translateY(0);
}

.btn-place-expand .material-symbols-outlined {
  font-size: 19px;
  transition: transform 0.2s ease;
}

.place-expand-count-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  background: #f1f5f9;
  color: #475569;
  border-radius: 12px;
  font-size: 0.76rem;
  font-weight: 700;
  margin-left: 2px;
  transition: background 0.2s ease, color 0.2s ease;
}

.btn-place-expand:hover .place-expand-count-badge {
  background: #e0f2fe;
  color: #0369a1;
}

.btn-place-collapse {
  background: #f8fafc;
  color: #64748b;
  border-color: #e2e8f0;
}

.btn-place-collapse:hover {
  background: #f1f5f9;
  color: #334155;
  border-color: #cbd5e1;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

@keyframes placeItemFadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.place-item-fade-in {
  animation: placeItemFadeIn 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* ==========================================================================
   Place Cover Admin Controls & Municipality Upload Modal
   ========================================================================== */

.place-cover-admin-container {
  position: absolute;
  top: 15px;
  right: 15px;
  z-index: 15;
}

.place-cover-banner-empty-admin {
  height: 120px !important;
  background: linear-gradient(135deg, rgba(2, 132, 199, 0.06) 0%, rgba(15, 118, 110, 0.06) 100%) !important;
  border: 2px dashed rgba(2, 132, 199, 0.35) !important;
  border-radius: 12px !important;
  margin: 15px 24px 20px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  position: relative !important;
}

.place-cover-banner-empty-admin .place-cover-banner-gradient {
  display: none !important;
}

.place-cover-banner-empty-admin .place-cover-admin-container {
  position: static !important;
}

.place-cover-admin-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: 9999px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.place-cover-change-btn {
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #f8fafc;
  border: 1px solid rgba(255, 255, 255, 0.25);
  padding: 8px 16px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
}

.place-cover-change-btn:hover {
  background: rgba(15, 23, 42, 0.9);
  border-color: rgba(255, 255, 255, 0.5);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4);
}

.place-cover-add-btn {
  background: #0284c7;
  color: #ffffff;
  border: none;
  padding: 10px 22px;
  font-size: 0.9rem;
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.35);
}

.place-cover-add-btn:hover {
  background: #0369a1;
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(2, 132, 199, 0.45);
}

/* Place Cover Modal */
.place-cover-modal-content {
  width: 100%;
  max-width: 540px;
  padding: 6px;
}

.place-cover-modal-header {
  margin-bottom: 20px;
}

.place-cover-modal-title {
  margin: 0 0 8px;
  font-size: 1.25rem;
  font-weight: 700;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 8px;
}

.place-cover-modal-title .material-symbols-outlined {
  color: #0284c7;
  font-size: 1.5rem;
}

.place-cover-modal-desc {
  margin: 0;
  font-size: 0.88rem;
  color: #64748b;
  line-height: 1.5;
}

.place-cover-current-box {
  margin-bottom: 16px;
  padding: 12px;
  background: #f8fafc;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
}

.place-cover-current-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: #475569;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.place-cover-current-thumb {
  width: 100%;
  height: 120px;
  border-radius: 8px;
  overflow: hidden;
  background: #0f172a;
}

.place-cover-current-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.place-cover-dropzone {
  border: 2px dashed #cbd5e1;
  border-radius: 12px;
  padding: 28px 20px;
  text-align: center;
  cursor: pointer;
  background: #f8fafc;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.place-cover-dropzone:hover,
.place-cover-dropzone.drag-over {
  border-color: #0284c7;
  background: rgba(2, 132, 199, 0.04);
}

.place-cover-drop-icon {
  font-size: 2.5rem;
  color: #0284c7;
}

.place-cover-drop-text {
  margin: 0;
  font-size: 0.92rem;
  color: #334155;
}

.place-cover-drop-text strong {
  display: block;
  color: #0f172a;
  margin-bottom: 2px;
}

.place-cover-drop-hint {
  font-size: 0.78rem;
  color: #94a3b8;
}

.place-cover-preview-box {
  margin-top: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  background: #f1f5f9;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
}

.place-cover-preview-thumb {
  width: 80px;
  height: 52px;
  border-radius: 6px;
  overflow: hidden;
  background: #0f172a;
  flex-shrink: 0;
}

.place-cover-preview-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.place-cover-preview-name {
  font-size: 0.85rem;
  font-weight: 500;
  color: #1e293b;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.place-cover-modal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 24px;
  gap: 12px;
}

.place-cover-actions-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.place-cover-actions-right {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.place-cover-modal-actions .btn-danger-outline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: transparent;
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.4);
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.place-cover-modal-actions .btn-danger-outline:hover {
  background: rgba(239, 68, 68, 0.1);
  border-color: #ef4444;
}

/* Dark Mode Overrides */
[data-theme='dark'] .place-cover-modal-title {
  color: #f1f5f9;
}

[data-theme='dark'] .place-cover-modal-desc {
  color: #94a3b8;
}

[data-theme='dark'] .place-cover-current-box,
[data-theme='dark'] .place-cover-preview-box {
  background: #1e293b;
  border-color: #334155;
}

[data-theme='dark'] .place-cover-current-label {
  color: #94a3b8;
}

[data-theme='dark'] .place-cover-dropzone {
  background: #0f172a;
  border-color: #334155;
}

[data-theme='dark'] .place-cover-dropzone:hover,
[data-theme='dark'] .place-cover-dropzone.drag-over {
  border-color: #38bdf8;
  background: rgba(56, 189, 248, 0.08);
}

[data-theme='dark'] .place-cover-drop-text {
  color: #cbd5e1;
}

[data-theme='dark'] .place-cover-drop-text strong {
  color: #f1f5f9;
}

[data-theme='dark'] .place-cover-preview-name {
  color: #e2e8f0;
}

/* Municipality Streets & Contrade Directory Grid */
.place-streets-directory-block {
  background: #f8fafc;
}

.place-section-subtitle {
  font-size: 0.9rem;
  color: #64748b;
  margin: -6px 0 16px;
  line-height: 1.5;
}

.place-streets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}

.place-street-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 16px;
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  text-align: left;
  position: relative;
}

.place-street-card:hover,
.place-street-card:focus-visible {
  transform: translateY(-2px);
  border-color: #0284c7;
  box-shadow: 0 8px 20px rgba(2, 132, 199, 0.12);
  outline: none;
}

.place-street-card-top {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 8px;
}

.place-street-card-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: #f0f9ff;
  color: #0284c7;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.place-street-card-icon .material-symbols-outlined {
  font-size: 1.35rem;
}

.place-street-card-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.place-street-card-badge {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748b;
}

.place-street-card-title {
  font-size: 1rem;
  font-weight: 700;
  color: #0f172a;
  margin: 2px 0 0;
  line-height: 1.3;
}

.place-street-card-alias {
  font-size: 0.78rem;
  color: #854d0e;
  font-style: italic;
  display: block;
  margin-top: 3px;
}

.place-street-card-desc {
  font-size: 0.84rem;
  color: #475569;
  line-height: 1.45;
  margin: 6px 0 12px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.place-street-card-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px dashed #f1f5f9;
}

.place-street-card-cta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.82rem;
  font-weight: 600;
  color: #0284c7;
  transition: gap 0.15s ease, color 0.15s ease;
}

.place-street-card:hover .place-street-card-cta {
  gap: 8px;
  color: #0369a1;
}

/* Dark mode overrides for streets directory */
[data-theme='dark'] .place-streets-directory-block {
  background: #1e293b;
  border-color: #334155;
}

[data-theme='dark'] .place-section-subtitle {
  color: #94a3b8;
}

[data-theme='dark'] .place-street-card {
  background: #0f172a;
  border-color: #334155;
}

[data-theme='dark'] .place-street-card:hover,
[data-theme='dark'] .place-street-card:focus-visible {
  border-color: #38bdf8;
  box-shadow: 0 8px 20px rgba(56, 189, 248, 0.12);
}

[data-theme='dark'] .place-street-card-icon {
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
}

[data-theme='dark'] .place-street-card-title {
  color: #f1f5f9;
}

[data-theme='dark'] .place-street-card-desc {
  color: #94a3b8;
}

[data-theme='dark'] .place-street-card-badge {
  color: #94a3b8;
}

[data-theme='dark'] .place-street-card-alias {
  color: #fef08a;
}

[data-theme='dark'] .place-street-card-footer {
  border-top-color: #1e293b;
}

[data-theme='dark'] .place-street-card-cta {
  color: #38bdf8;
}

/* Toponymic Evolution (Predecessors & Successors Timeline) */
.place-evolution-block {
  margin: 14px 0 18px;
  padding: 14px 16px;
  background: linear-gradient(135deg, #fefce8 0%, #fffbeb 100%);
  border: 1px solid #fef08a;
  border-left: 4px solid #ca8a04;
  border-radius: 12px;
}

.place-evolution-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  color: #854d0e;
}

.place-evolution-header .material-symbols-outlined {
  font-size: 1.25rem;
}

.place-evolution-title {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.place-evolution-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.place-evolution-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #ffffff;
  border: 1px solid #fef3c7;
  border-radius: 10px;
  padding: 10px 14px;
  box-shadow: 0 2px 6px rgba(202, 138, 4, 0.08);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.place-evolution-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(202, 138, 4, 0.15);
  border-color: #fde047;
}

.place-evolution-card-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.place-evolution-card.type-predecessor .place-evolution-card-icon {
  background: #fef3c7;
  color: #b45309;
}

.place-evolution-card.type-successor .place-evolution-card-icon {
  background: #e0f2fe;
  color: #0369a1;
}

.place-evolution-card-body {
  flex: 1;
  min-width: 0;
}

.place-evolution-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  color: #92400e;
  margin-bottom: 2px;
}

.place-evolution-card.type-successor .place-evolution-badge {
  color: #075985;
}

.place-evolution-name {
  font-size: 0.96rem;
  font-weight: 700;
  color: #1e293b;
  margin: 0;
  line-height: 1.3;
}

.place-evolution-note {
  font-size: 0.8rem;
  color: #64748b;
  margin: 2px 0 0;
  line-height: 1.35;
}

.btn-evolution-navigate {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 8px;
  border: 1px solid #d97706;
  background: #fffbeb;
  color: #b45309;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  flex-shrink: 0;
}

.place-evolution-card.type-successor .btn-evolution-navigate {
  border-color: #0284c7;
  background: #f0f9ff;
  color: #0369a1;
}

.btn-evolution-navigate:hover {
  background: #d97706;
  color: #ffffff;
}

.place-evolution-card.type-successor .btn-evolution-navigate:hover {
  background: #0284c7;
  color: #ffffff;
}

.btn-evolution-navigate .material-symbols-outlined {
  font-size: 1.1rem;
}

.place-evolution-admin-actions {
  margin-top: 10px;
  display: flex;
  justify-content: flex-end;
}

.btn-place-admin-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: transparent;
  border: 1px dashed #ca8a04;
  color: #854d0e;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-place-admin-action:hover {
  background: #fef08a;
  color: #713f12;
}

.btn-place-admin-action .material-symbols-outlined {
  font-size: 1.1rem;
}

/* Modal Evolution Form */
.place-evolution-modal-content {
  padding: 4px;
}

.place-evolution-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin: 16px 0;
}

.place-evolution-form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.place-evolution-form-group label {
  font-size: 0.84rem;
  font-weight: 600;
  color: #334155;
}

.place-evolution-form-group input,
.place-evolution-form-group select,
.place-evolution-form-group textarea {
  padding: 9px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s ease;
}

.place-evolution-form-group input:focus,
.place-evolution-form-group select:focus,
.place-evolution-form-group textarea:focus {
  border-color: #ca8a04;
}

/* Dark mode overrides for Toponymic Evolution */
[data-theme='dark'] .place-evolution-block {
  background: linear-gradient(135deg, rgba(113, 63, 18, 0.25) 0%, rgba(133, 77, 14, 0.18) 100%);
  border-color: rgba(202, 138, 4, 0.35);
  border-left-color: #eab308;
}

[data-theme='dark'] .place-evolution-header {
  color: #fef08a;
}

[data-theme='dark'] .place-evolution-card {
  background: #0f172a;
  border-color: rgba(202, 138, 4, 0.25);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

[data-theme='dark'] .place-evolution-card:hover {
  border-color: #eab308;
}

[data-theme='dark'] .place-evolution-name {
  color: #f8fafc;
}

[data-theme='dark'] .place-evolution-note {
  color: #94a3b8;
}

[data-theme='dark'] .place-evolution-badge {
  color: #fef08a;
}

[data-theme='dark'] .place-evolution-card.type-successor .place-evolution-badge {
  color: #7dd3fc;
}

[data-theme='dark'] .btn-evolution-navigate {
  background: rgba(217, 119, 6, 0.15);
  color: #fef08a;
  border-color: #ca8a04;
}

[data-theme='dark'] .place-evolution-card.type-successor .btn-evolution-navigate {
  background: rgba(2, 132, 199, 0.15);
  color: #7dd3fc;
  border-color: #0284c7;
}

[data-theme='dark'] .btn-evolution-navigate:hover {
  background: #ca8a04;
  color: #ffffff;
}

[data-theme='dark'] .btn-place-admin-action {
  border-color: #ca8a04;
  color: #fef08a;
}

[data-theme='dark'] .btn-place-admin-action:hover {
  background: rgba(202, 138, 4, 0.2);
}

/* Breadcrumb bar & Superior Structure Return Navigation */
.place-breadcrumb-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
  font-size: 0.85rem;
}

.btn-breadcrumb-parent {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 9999px;
  background: rgba(2, 132, 199, 0.08);
  border: 1px solid rgba(2, 132, 199, 0.25);
  color: #0284c7;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-breadcrumb-parent:hover {
  background: #0284c7;
  color: #ffffff;
  border-color: #0284c7;
}

.btn-breadcrumb-parent .material-symbols-outlined {
  font-size: 1rem;
}

.place-breadcrumb-sep {
  display: inline-flex;
  align-items: center;
  color: #94a3b8;
}

.place-breadcrumb-sep .material-symbols-outlined {
  font-size: 1.1rem;
}

.place-breadcrumb-current {
  font-weight: 600;
  color: #475569;
}

/* Header Parent Municipality Return Button */
.btn-return-municipality {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 9999px;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #1e293b;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-return-municipality:hover {
  background: #e2e8f0;
  border-color: #94a3b8;
}

.btn-return-municipality .material-symbols-outlined {
  font-size: 1.1rem;
  color: #0284c7;
}

/* When header is overlaid on cover banner */
.place-detail-card:has(#place-cover-banner:not([style*="display: none"])) .btn-return-municipality {
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.place-detail-card:has(#place-cover-banner:not([style*="display: none"])) .btn-return-municipality:hover {
  background: rgba(15, 23, 42, 0.92);
  border-color: rgba(255, 255, 255, 0.5);
}

.place-detail-card:has(#place-cover-banner:not([style*="display: none"])) .btn-return-municipality .material-symbols-outlined {
  color: #38bdf8;
}

/* Subtitle clickable municipality link */
.btn-place-municipality-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(2, 132, 199, 0.08);
  color: #0284c7;
  border: 1px solid rgba(2, 132, 199, 0.2);
  font-size: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  vertical-align: middle;
}

.btn-place-municipality-link:hover {
  background: #0284c7;
  color: #ffffff;
  border-color: #0284c7;
}

.btn-place-municipality-link .material-symbols-outlined {
  font-size: 0.95rem;
}

/* Actions row and propose toponym button */
.place-evolution-actions-row {
  margin-top: 12px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.btn-place-propose-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: rgba(202, 138, 4, 0.08);
  border: 1px solid rgba(202, 138, 4, 0.35);
  color: #92400e;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-place-propose-action:hover {
  background: #ca8a04;
  color: #ffffff;
  border-color: #ca8a04;
}

.btn-place-propose-action .material-symbols-outlined {
  font-size: 1.1rem;
}

/* Evolution Empty Hint */
.place-evolution-empty-hint {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 8px;
  background: rgba(254, 240, 138, 0.3);
  border: 1px dashed rgba(202, 138, 4, 0.35);
  margin-bottom: 8px;
}

.place-evolution-empty-hint .material-symbols-outlined {
  font-size: 1.35rem;
  color: #b45309;
  flex-shrink: 0;
  margin-top: 1px;
}

.place-evolution-empty-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.place-evolution-empty-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: #78350f;
  margin: 0;
}

.place-evolution-empty-sub {
  font-size: 0.8rem;
  color: #92400e;
  margin: 0;
}

/* Dark mode additions */
[data-theme='dark'] .btn-breadcrumb-parent {
  background: rgba(56, 189, 248, 0.12);
  border-color: rgba(56, 189, 248, 0.3);
  color: #38bdf8;
}

[data-theme='dark'] .btn-breadcrumb-parent:hover {
  background: #38bdf8;
  color: #0f172a;
}

[data-theme='dark'] .place-breadcrumb-current {
  color: #cbd5e1;
}

[data-theme='dark'] .place-breadcrumb-sep {
  color: #64748b;
}

[data-theme='dark'] .btn-return-municipality {
  background: rgba(30, 41, 59, 0.85);
  border-color: rgba(148, 163, 184, 0.25);
  color: #f8fafc;
}

[data-theme='dark'] .btn-return-municipality:hover {
  background: #334155;
  border-color: #94a3b8;
}

[data-theme='dark'] .btn-place-municipality-link {
  background: rgba(56, 189, 248, 0.12);
  border-color: rgba(56, 189, 248, 0.3);
  color: #38bdf8;
}

[data-theme='dark'] .btn-place-municipality-link:hover {
  background: #38bdf8;
  color: #0f172a;
}

[data-theme='dark'] .btn-place-propose-action {
  background: rgba(202, 138, 4, 0.15);
  border-color: rgba(202, 138, 4, 0.35);
  color: #fef08a;
}

[data-theme='dark'] .btn-place-propose-action:hover {
  background: #ca8a04;
  color: #0f172a;
}

[data-theme='dark'] .place-evolution-empty-hint {
  background: rgba(113, 63, 18, 0.2);
  border-color: rgba(202, 138, 4, 0.3);
}

[data-theme='dark'] .place-evolution-empty-title {
  color: #fef08a;
}

[data-theme='dark'] .place-evolution-empty-sub {
  color: #fde047;
}



/* Coda di revisione dei dati proposti */
.data-review-entry {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  margin: 0 0 10px;
  padding: 12px 14px;
  border: 1px solid #c7d2fe;
  border-radius: 14px;
  background: #eef2ff;
  color: #3730a3;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}

.data-review-entry:hover,
.data-review-entry:focus-visible {
  background: #e0e7ff;
}

.contribution-data-review-dialog {
  width: min(860px, calc(100vw - 24px));
}

.data-review-groups {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.data-review-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  background: #ffffff;
}

.data-review-group > header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.data-review-group > header span,
.data-review-current,
.data-review-note {
  color: #64748b;
  font-size: 0.85rem;
}

.data-review-current,
.data-review-note,
.data-review-manual {
  margin: 0;
}

.data-review-manual {
  padding: 8px 10px;
  border-radius: 10px;
  background: #fffbeb;
  color: #92400e;
  font-size: 0.82rem;
}

.data-review-final {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.82rem;
  font-weight: 700;
}

.data-review-final input,
.data-review-item input,
.data-review-item select {
  min-height: 38px;
  padding: 6px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  font: inherit;
  font-weight: 400;
}

.data-review-items {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.data-review-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #f8fafc;
}

.data-review-item-head,
.data-review-item-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.data-review-item-head span,
.data-review-document {
  color: #64748b;
  font-size: 0.8rem;
}

.data-review-points {
  color: #15803d;
  font-size: 0.82rem;
  font-weight: 700;
}

.data-review-group > footer {
  display: flex;
  justify-content: flex-end;
}

.data-review-empty {
  margin: 24px 0;
  color: #64748b;
  text-align: center;
}

/* Inviti al collegamento del profilo */
.profile-invite-dialog {
  width: min(520px, calc(100vw - 24px));
}

.profile-invite-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.profile-invite-body p {
  margin: 0;
  line-height: 1.45;
}

.profile-invite-body input {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  font: inherit;
}

.profile-invite-link {
  font-family: ui-monospace, monospace;
  font-size: 0.8rem;
}

.profile-invite-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.profile-invite-actions > * {
  flex: 1 1 0;
  padding: 8px 12px;
}

.profile-invite-note {
  color: #64748b;
  font-size: 0.85rem;
}

.profile-invite-error {
  color: #b91c1c;
  font-size: 0.85rem;
}

.profile-invite-error:empty {
  display: none;
}

.profile-invite-sent {
  color: #047857;
  font-weight: 600;
}

/* Barra laterale: completezza e invito sulla stessa riga, compatti */
.panel-status-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  margin: 6px 0 12px;
}

.panel-status-row .panel-completeness-slot {
  width: auto;
  margin: 0;
}

.panel-invite-slot {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.panel-invite-slot:empty {
  display: none;
}

.sidebar-invite-chip,
.sidebar-invite-button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 100%;
  padding: 4px 10px;
  border-radius: 999px;
  font: inherit;
  font-size: 0.75rem;
  line-height: 1.3;
  text-align: left;
}

.sidebar-invite-chip .material-symbols-outlined,
.sidebar-invite-button .material-symbols-outlined {
  font-size: 16px;
}

.sidebar-invite-chip.is-linked {
  border: 1px solid #a7f3d0;
  background: #ecfdf5;
  color: #047857;
  font-weight: 600;
}

.sidebar-invite-chip.is-pending {
  border: 1px solid #fde68a;
  background: #fffbeb;
  color: #92400e;
}

.sidebar-invite-button {
  border: 1px solid #c7d2fe;
  background: #eef2ff;
  color: #4338ca;
  font-weight: 600;
  cursor: pointer;
}

.sidebar-invite-button:hover {
  background: #e0e7ff;
}

.profile-invite-whatsapp {
  text-decoration: none;
  color: #15803d;
  border-color: #bbf7d0;
}

.profile-invite-whatsapp:hover {
  background: #f0fdf4;
  color: #166534;
  border-color: #86efac;
}

/* Percorsi di parentela tra le stesse due persone (fino a 3). */
.relationship-path-routes {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 12px;
}

.relationship-path-route {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  padding: 6px 12px;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  background: #ffffff;
  color: #0f172a;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.relationship-path-route.is-active {
  border-color: #2563eb;
  background: rgba(37, 99, 235, 0.06);
  box-shadow: 0 0 0 1px #2563eb inset;
}

.relationship-path-route__index {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #64748b;
}

.relationship-path-route__name {
  font-size: 0.85rem;
  font-weight: 600;
}
