/* 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-card {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto 34px;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid #f1f5f9;
}

.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;
}

.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-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) 32px;
  }

  .user-admin-role,
  .user-admin-role-select {
    grid-column: 2;
    justify-self: start;
  }

  .user-admin-card .delete-btn,
  .user-admin-lock {
    grid-column: 3;
    grid-row: 1 / span 2;
  }
}

/* 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__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-direction: column;
  gap: 18px;
  padding: 20px 24px 24px;
  overflow: auto;
}

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

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

.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 {
  overflow: auto;
  padding: 8px 24px 16px;
  min-height: min(62vh, 640px);
}

.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__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 {
    width: min(96vw, 680px);
    max-width: min(96vw, 680px);
  }

  .relationship-path-modal__body {
    padding: 18px 16px 20px;
  }

  .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;
  }
}

/* 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 16px 12px;
  padding-bottom: 10px;
}

.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: 8px;
  margin: 4px 16px 16px;
  border-bottom: 1px solid #f1f5f9;
  padding-bottom: 12px;
}

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

.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 {
  color: #4f46e5;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s;
}

.log-profile-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;
}

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

.push-notification-control.is-enabled {
  border-color: #bbf7d0;
  background: linear-gradient(135deg, #f0fdf4, #f8fafc);
}

.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: 26px;
}

.push-notification-control.is-enabled .push-notification-control-icon {
  color: #16a34a;
}

.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.9rem;
  line-height: 1.3;
}

.push-notification-control-description {
  margin: 4px 0 0;
  color: #475569;
  font-size: 0.78rem;
  line-height: 1.4;
}

.push-notification-enable {
  min-height: 38px;
  padding: 8px 13px;
  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-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-sender {
  font-weight: 600;
  font-size: 0.9rem;
  color: #1e293b;
}

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

.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: 12px;
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: 0.05em;
}

.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;
  }
}
