:root {
  --ink: #182033;
  --muted: #697386;
  --paper: rgba(255, 255, 255, 0.92);
  --paper-solid: #ffffff;
  --line: rgba(24, 32, 51, 0.12);
  --line-strong: rgba(24, 32, 51, 0.22);
  --accent: #7c5cff;
  --accent-dark: #4d35c8;
  --accent-soft: #ede9ff;
  --gold: #d6a84f;
  --shadow: 0 24px 70px rgba(24, 32, 51, 0.14);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  background:
    radial-gradient(circle at top left, rgba(124, 92, 255, 0.24), transparent 32rem),
    radial-gradient(circle at bottom right, rgba(214, 168, 79, 0.22), transparent 34rem),
    linear-gradient(135deg, #f7f2ea 0%, #eef1ff 48%, #f8fafc 100%);
}

button,
input,
select {
  font: inherit;
}

.app {
  width: min(1180px, calc(100% - 32px));
  margin: 34px auto 60px;
}

.site-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 24px;
  align-items: stretch;
  margin-bottom: 22px;
}

.brand-area,
.finder-card,
.profile-shell {
  border: 1px solid rgba(255, 255, 255, 0.7);
  background: var(--paper);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.brand-area {
  padding: 28px;
  border-radius: 30px;
  position: relative;
  overflow: hidden;
}

.brand-area::after {
  content: "";
  position: absolute;
  inset: auto 28px 0 auto;
  width: 180px;
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--gold));
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(36px, 5vw, 68px);
  line-height: 0.95;
  letter-spacing: -0.06em;
}

.subtitle {
  width: min(560px, 100%);
  margin: 16px 0 22px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.6;
}

.language-toggle {
  display: inline-flex;
  gap: 6px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
}

.language-toggle button {
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 800;
  padding: 9px 14px;
  transition: 160ms ease;
}

.language-toggle button.active {
  background: var(--ink);
  color: white;
  box-shadow: 0 10px 24px rgba(24, 32, 51, 0.18);
}

.finder-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 22px;
  border-radius: 26px;
}

.finder-card label {
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}

.search-row {
  position: relative;
}

.search-row::before {
  content: "#";
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--accent-dark);
  font-weight: 900;
}

.finder-card input,
.finder-card select {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--ink);
  outline: none;
  padding: 13px 14px;
  transition: 160ms ease;
}

.finder-card input {
  padding-left: 34px;
}

.finder-card input:focus,
.finder-card select:focus {
  border-color: rgba(124, 92, 255, 0.75);
  box-shadow: 0 0 0 4px rgba(124, 92, 255, 0.12);
}

.finder-card select {
  cursor: pointer;
}

.finder-card small {
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.status-message {
  margin-bottom: 14px;
  padding: 12px 14px;
  border: 1px solid rgba(214, 168, 79, 0.42);
  border-radius: 16px;
  background: rgba(255, 247, 224, 0.92);
  color: #7a5614;
  display: none;
}

.status-message.show {
  display: block;
}

.profile-shell {
  border-radius: 32px;
  overflow: hidden;
}

.profile-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 290px;
  gap: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.74), rgba(255, 255, 255, 0.48));
}

.basic-info-card {
  padding: 24px;
}

.card-heading {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.card-heading span:first-child {
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

#profileNamePreview {
  color: var(--ink);
  font-weight: 850;
  text-align: right;
}

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

.info-row {
  display: grid;
  gap: 6px;
  min-height: 72px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.78);
}

.info-row.hidden {
  display: none;
}

.info-row label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.info-row span {
  align-self: end;
  color: var(--ink);
  font-size: 17px;
  font-weight: 750;
}

.picture-card {
  padding: 24px 24px 24px 0;
}

.picture-box {
  height: 100%;
  min-height: 300px;
  border: 1px solid var(--line-strong);
  border-radius: 26px;
  background:
    linear-gradient(135deg, rgba(124, 92, 255, 0.16), rgba(214, 168, 79, 0.18)),
    #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.picture-box::before {
  content: "";
  position: absolute;
  width: 92px;
  height: 92px;
  border: 2px solid rgba(255, 255, 255, 0.75);
  border-radius: 50%;
  transform: translateY(-28px);
}

.picture-box::after {
  content: "";
  position: absolute;
  width: 150px;
  height: 80px;
  border: 2px solid rgba(255, 255, 255, 0.75);
  border-radius: 80px 80px 0 0;
  transform: translateY(72px);
}

.picture-box img {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
}

.picture-box span {
  position: relative;
  z-index: 1;
  color: rgba(24, 32, 51, 0.54);
  font-size: 22px;
  font-weight: 900;
}

.picture-box.has-image img {
  display: block;
}

.picture-box.has-image span,
.picture-box.has-image::before,
.picture-box.has-image::after {
  display: none;
}

.table-section {
  margin: 0 24px 22px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.78);
  overflow: hidden;
}

.table-section:first-of-type {
  margin-top: 0;
}

.section-header,
.table-row {
  display: grid;
  grid-template-columns: 210px 1fr 240px;
  align-items: center;
  min-height: 48px;
}

.table-section.has-title-column .section-header,
.table-section.has-title-column .table-row {
  grid-template-columns: 210px 150px 1fr 240px;
}

.section-header {
  background: linear-gradient(90deg, rgba(124, 92, 255, 0.12), rgba(214, 168, 79, 0.10));
  border-bottom: 1px solid var(--line-strong);
  color: var(--ink);
  font-weight: 900;
}

.section-header strong,
.section-header span,
.table-row span {
  padding: 10px 16px;
}

.section-header span {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.table-section:not(.has-title-column) .title-cell {
  display: none;
}

.table-row {
  border-bottom: 1px solid var(--line);
  transition: background 160ms ease;
}

.table-row:last-child {
  border-bottom: 0;
}

.table-row:hover {
  background: rgba(124, 92, 255, 0.05);
}

.row-label {
  color: var(--muted);
  font-weight: 800;
}

.empty-table-row {
  grid-template-columns: 1fr;
}

.empty-row {
  grid-column: 1 / -1;
  color: var(--muted);
  font-style: italic;
}

.clickable-name {
  color: var(--accent-dark);
  cursor: pointer;
  font-weight: 850;
  text-decoration: none;
}

.clickable-name:hover {
  text-decoration: underline;
  text-underline-offset: 4px;
}

body.farsi {
  direction: rtl;
}

body.farsi .brand-area::after {
  inset: auto auto 0 28px;
}

body.farsi #profileNamePreview {
  text-align: left;
}

body.farsi .search-row::before {
  left: auto;
  right: 14px;
}

body.farsi .finder-card input {
  padding-left: 14px;
  padding-right: 34px;
}

body.farsi .picture-card {
  padding: 24px 0 24px 24px;
}

@media (max-width: 900px) {
  .site-header,
  .profile-grid,
  .info-grid {
    grid-template-columns: 1fr;
  }

  .picture-card,
  body.farsi .picture-card {
    padding: 0 24px 24px;
  }

  .picture-box {
    min-height: 240px;
  }
}

@media (max-width: 680px) {
  .app {
    width: min(100% - 18px, 1180px);
    margin-top: 12px;
  }

  .brand-area,
  .finder-card,
  .profile-shell {
    border-radius: 22px;
  }

  .brand-area,
  .finder-card,
  .basic-info-card {
    padding: 18px;
  }

  .card-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  #profileNamePreview,
  body.farsi #profileNamePreview {
    text-align: inherit;
  }

  .section-header,
  .table-row,
  .table-section.has-title-column .section-header,
  .table-section.has-title-column .table-row {
    grid-template-columns: 1fr;
  }

  .section-header span {
    display: none;
  }

  .table-section {
    margin: 0 14px 16px;
  }

  .table-row span {
    padding: 6px 14px;
  }

  .row-label {
    padding-top: 12px !important;
  }
}

.header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.admin-link,
.secondary-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 9px 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  font-weight: 850;
  text-decoration: none;
  box-shadow: 0 10px 24px rgba(24, 32, 51, 0.08);
}

.admin-link:hover,
.secondary-link:hover {
  transform: translateY(-1px);
  border-color: rgba(124, 92, 255, 0.35);
}

.admin-page .site-header {
  grid-template-columns: 1fr;
}

.admin-shell {
  display: grid;
  gap: 18px;
}

.admin-panel,
.login-card,
.people-list-card,
.admin-form-card,
.quick-help-card {
  border: 1px solid rgba(255, 255, 255, 0.7);
  background: var(--paper);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  border-radius: 30px;
}

.login-card,
.people-list-card,
.admin-form-card,
.quick-help-card {
  padding: 24px;
}

.admin-panel {
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr);
  gap: 18px;
  padding: 18px;
}

.admin-panel.hidden,
.login-card.hidden {
  display: none;
}

.admin-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  margin-top: 18px;
}

.admin-toolbar-left,
.admin-toolbar-right {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.pill-stat {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.pill-stat strong {
  color: var(--ink);
}

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

.form-grid .wide {
  grid-column: 1 / -1;
}

.field {
  display: grid;
  gap: 7px;
}

.field label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.field input,
.field select,
.field textarea,
.people-search {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.88);
  color: var(--ink);
  outline: none;
  padding: 13px 14px;
  transition: 160ms ease;
}

.field textarea {
  min-height: 90px;
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.people-search:focus {
  border-color: rgba(124, 92, 255, 0.75);
  box-shadow: 0 0 0 4px rgba(124, 92, 255, 0.12);
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 16px;
}

.primary-button,
.ghost-button,
.danger-button {
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 900;
  padding: 12px 18px;
  transition: 160ms ease;
}

.primary-button {
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: white;
  box-shadow: 0 14px 28px rgba(124, 92, 255, 0.25);
}

.ghost-button {
  background: rgba(255, 255, 255, 0.78);
  color: var(--ink);
  border: 1px solid var(--line);
}

.danger-button {
  background: rgba(255, 240, 240, 0.9);
  color: #8a1f1f;
  border: 1px solid rgba(138, 31, 31, 0.18);
}

.primary-button:hover,
.ghost-button:hover,
.danger-button:hover {
  transform: translateY(-1px);
}

.people-list {
  display: grid;
  gap: 8px;
  max-height: 620px;
  overflow: auto;
  padding-right: 4px;
  margin-top: 14px;
}

.person-list-button {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.76);
  color: var(--ink);
  cursor: pointer;
  padding: 12px;
  text-align: left;
}

.person-list-button strong {
  display: block;
  font-size: 14px;
}

.person-list-button span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.person-list-button.active,
.person-list-button:hover {
  border-color: rgba(124, 92, 255, 0.45);
  background: rgba(237, 233, 255, 0.78);
}

.admin-status {
  border-radius: 16px;
  padding: 12px 14px;
  margin-top: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  display: none;
}

.admin-status.show {
  display: block;
}

.admin-status.good {
  color: #245f39;
  background: rgba(234, 255, 241, 0.9);
  border-color: rgba(36, 95, 57, 0.2);
}

.admin-status.bad {
  color: #8a1f1f;
  background: rgba(255, 240, 240, 0.9);
  border-color: rgba(138, 31, 31, 0.2);
}

.admin-card-title {
  margin: 0 0 14px;
  font-size: 22px;
  letter-spacing: -0.03em;
}

.help-list {
  color: var(--muted);
  line-height: 1.7;
  margin: 0;
  padding-left: 20px;
}

@media (max-width: 900px) {
  .admin-panel {
    grid-template-columns: 1fr;
  }

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


/* Theme + navigation additions */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 9px 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  font-weight: 850;
  text-decoration: none;
  box-shadow: 0 10px 24px rgba(24, 32, 51, 0.08);
  cursor: pointer;
  transition: 160ms ease;
}

.theme-toggle:hover {
  transform: translateY(-1px);
  border-color: rgba(124, 92, 255, 0.35);
}

body.dark-mode {
  --ink: #f7f8ff;
  --muted: #b7c0d8;
  --paper: rgba(18, 22, 37, 0.88);
  --paper-solid: #151a2c;
  --line: rgba(255, 255, 255, 0.12);
  --line-strong: rgba(255, 255, 255, 0.22);
  --accent: #a593ff;
  --accent-dark: #c7bdff;
  --accent-soft: rgba(124, 92, 255, 0.16);
  --gold: #ffd88a;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.35);
  background:
    radial-gradient(circle at top left, rgba(124, 92, 255, 0.28), transparent 32rem),
    radial-gradient(circle at bottom right, rgba(214, 168, 79, 0.16), transparent 34rem),
    linear-gradient(135deg, #070914 0%, #10162a 52%, #090d18 100%);
}

body.dark-mode .brand-area,
body.dark-mode .finder-card,
body.dark-mode .profile-shell,
body.dark-mode .login-card,
body.dark-mode .people-list-card,
body.dark-mode .admin-form-card,
body.dark-mode .quick-help-card,
body.dark-mode .admin-panel,
body.dark-mode .tree-shell,
body.dark-mode .tree-toolbar-card {
  border-color: rgba(255, 255, 255, 0.12);
  background: var(--paper);
}

body.dark-mode .language-toggle,
body.dark-mode .admin-link,
body.dark-mode .secondary-link,
body.dark-mode .theme-toggle,
body.dark-mode .ghost-button,
body.dark-mode .pill-stat,
body.dark-mode .field input,
body.dark-mode .field select,
body.dark-mode .field textarea,
body.dark-mode .people-search,
body.dark-mode .finder-card input,
body.dark-mode .finder-card select,
body.dark-mode .info-row,
body.dark-mode .table-section,
body.dark-mode .person-list-button {
  background: rgba(255, 255, 255, 0.07);
  color: var(--ink);
}

body.dark-mode .profile-grid {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03));
}

body.dark-mode .picture-box {
  background:
    linear-gradient(135deg, rgba(124, 92, 255, 0.26), rgba(214, 168, 79, 0.14)),
    rgba(255, 255, 255, 0.05);
}

body.dark-mode .status-message {
  background: rgba(255, 216, 138, 0.12);
  color: #ffe2a6;
}

body.dark-mode .admin-status.good {
  background: rgba(36, 95, 57, 0.18);
  color: #bff2ce;
}

body.dark-mode .admin-status.bad {
  background: rgba(138, 31, 31, 0.18);
  color: #ffc6c6;
}

.small-note {
  margin: -6px 0 14px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

/* Full tree page */
.wide-app {
  width: min(1480px, calc(100% - 32px));
}

.tree-header {
  grid-template-columns: minmax(0, 1fr) 360px;
}

.tree-shell,
.tree-toolbar-card {
  border: 1px solid rgba(255, 255, 255, 0.7);
  background: var(--paper);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.tree-shell {
  border-radius: 32px;
  padding: 18px;
  overflow: hidden;
}

.tree-toolbar-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-radius: 24px;
  padding: 16px 18px;
  margin-bottom: 18px;
  box-shadow: none;
}

.tree-toolbar-card strong {
  display: block;
  font-size: 18px;
  letter-spacing: -0.02em;
}

.tree-toolbar-card span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-top: 3px;
}

.tree-canvas {
  position: relative;
  min-height: 620px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 26px;
  background:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px),
    rgba(255, 255, 255, 0.38);
  background-size: 42px 42px;
}

body.dark-mode .tree-canvas {
  background:
    linear-gradient(rgba(255, 255, 255, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.06) 1px, transparent 1px),
    rgba(255, 255, 255, 0.035);
}

.tree-lines {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  overflow: visible;
}

.tree-lines marker path {
  fill: var(--accent-dark);
}

.tree-connector {
  fill: none;
  stroke: var(--accent-dark);
  stroke-width: 2.5;
  opacity: 0.72;
}

.spouse-connector {
  fill: none;
  stroke: var(--gold);
  stroke-width: 2;
  stroke-dasharray: 8 7;
  opacity: 0.9;
}

.tree-levels {
  position: relative;
  z-index: 2;
  display: grid;
  gap: 92px;
  min-width: 1050px;
  padding: 36px 46px 70px;
}

.tree-level {
  display: grid;
  gap: 14px;
}

.tree-level h2 {
  justify-self: center;
  margin: 0;
  padding: 7px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.tree-person-row {
  display: flex;
  justify-content: center;
  align-items: stretch;
  gap: 18px;
  flex-wrap: nowrap;
}

.tree-person-card {
  width: 210px;
  min-height: 112px;
  border: 1px solid var(--line-strong);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.88);
  color: var(--ink);
  box-shadow: 0 16px 35px rgba(24, 32, 51, 0.10);
  cursor: pointer;
  padding: 14px;
  text-align: left;
  transition: 160ms ease;
}

body.dark-mode .tree-person-card {
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 16px 35px rgba(0, 0, 0, 0.25);
}

.tree-person-card:hover {
  transform: translateY(-4px);
  border-color: rgba(124, 92, 255, 0.62);
  box-shadow: 0 18px 40px rgba(124, 92, 255, 0.22);
}

.tree-person-card.highlighted {
  transform: translateY(-6px) scale(1.06);
  border: 3px solid #ffd36a;
  background: linear-gradient(135deg, rgba(255, 211, 106, 0.22), rgba(165, 147, 255, 0.22));
  box-shadow:
    0 0 0 6px rgba(255, 211, 106, 0.20),
    0 22px 55px rgba(255, 211, 106, 0.28);
  font-weight: 950;
  z-index: 5;
}

.tree-person-card.highlighted strong {
  font-size: 17px;
  font-weight: 950;
}

.tree-person-card.highlighted .tree-id-badge {
  background: linear-gradient(135deg, #ffd36a, #a593ff);
  color: #10131f;
}

.tree-id-badge {
  display: inline-flex;
  margin-bottom: 9px;
  padding: 4px 8px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: white;
  font-size: 11px;
  font-weight: 900;
}

.tree-person-card strong {
  display: block;
  font-size: 16px;
  line-height: 1.25;
}

.tree-person-card > span:last-child {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  margin-top: 7px;
}

body.farsi .tree-person-card {
  text-align: right;
}

@media (max-width: 900px) {
  .tree-header {
    grid-template-columns: 1fr;
  }

  .tree-toolbar-card {
    align-items: flex-start;
    flex-direction: column;
  }
}

/* Final polish: cleaner top navigation, icon theme toggle, readable dark dropdowns */
.corner-admin-link {
  position: fixed;
  z-index: 50;
  top: 16px;
  left: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 8px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.76);
  color: var(--ink);
  font-size: 13px;
  font-weight: 900;
  text-decoration: none;
  box-shadow: 0 12px 28px rgba(24, 32, 51, 0.12);
  backdrop-filter: blur(18px);
}

.corner-admin-link:hover {
  transform: translateY(-1px);
  border-color: rgba(124, 92, 255, 0.42);
}

.corner-admin-link.is-current {
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: #fff;
}

.corner-theme-toggle {
  position: fixed;
  z-index: 50;
  top: 16px;
  right: 18px;
  width: 44px;
  min-height: 44px;
  padding: 0;
  border-radius: 50%;
  font-size: 20px;
  line-height: 1;
  background: rgba(255, 255, 255, 0.76);
  backdrop-filter: blur(18px);
}

body.dark-mode .corner-admin-link,
body.dark-mode .corner-theme-toggle {
  background: rgba(255, 255, 255, 0.10);
  color: var(--ink);
  border-color: rgba(255, 255, 255, 0.16);
}

body.dark-mode .corner-admin-link.is-current {
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: #10131f;
}

/* Native select dropdown menus can open as white boxes in Chrome, so force visible option text. */
select option,
body.dark-mode select option {
  color: #182033;
  background: #ffffff;
}

body.dark-mode .finder-card input::placeholder,
body.dark-mode .field input::placeholder,
body.dark-mode .field textarea::placeholder,
body.dark-mode .people-search::placeholder {
  color: rgba(247, 248, 255, 0.54);
}

body.dark-mode .section-header,
body.dark-mode .table-row,
body.dark-mode .field label,
body.dark-mode .finder-card label,
body.dark-mode .info-row label,
body.dark-mode .tree-toolbar-card span,
body.dark-mode .person-list-button span,
body.dark-mode .help-list {
  color: var(--muted);
}

body.dark-mode .section-header strong,
body.dark-mode .section-header span,
body.dark-mode .table-row span,
body.dark-mode .info-row span,
body.dark-mode .pill-stat strong,
body.dark-mode .tree-toolbar-card strong {
  color: var(--ink);
}

body.dark-mode .table-section,
body.dark-mode .table-row,
body.dark-mode .admin-status {
  border-color: rgba(255, 255, 255, 0.12);
}

/* Keep the main hero from feeling crowded after moving Admin/theme to the corners. */
.header-actions {
  gap: 12px;
}

/* Full tree zoom/fitting layout */
.tree-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.zoom-controls {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
}

.zoom-controls button {
  width: 42px;
  height: 36px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font-weight: 900;
}

.zoom-controls button:hover:not(:disabled) {
  background: rgba(124, 92, 255, 0.14);
}

.zoom-controls button:disabled {
  opacity: 0.42;
  cursor: default;
}

.zoom-controls span {
  min-width: 48px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 900;
  text-align: center;
  margin: 0;
}

body.dark-mode .zoom-controls {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.14);
}

body.dark-mode .zoom-controls button,
body.dark-mode .zoom-controls span {
  color: var(--ink);
}

.tree-canvas {
  height: min(720px, calc(100vh - 260px));
  min-height: 420px;
  overflow: auto;
  overscroll-behavior: contain;
}

.tree-zoom-layer {
  position: relative;
  min-width: 100%;
  min-height: 100%;
}

.tree-content {
  position: relative;
  width: max-content;
  min-width: 100%;
  transform-origin: top left;
}

.tree-lines {
  left: 0;
  top: 0;
}

.tree-levels {
  width: max-content;
  min-width: 100%;
  gap: 120px;
  padding: 42px 64px 80px;
}

.tree-person-row {
  gap: 28px;
}

.tree-person-card {
  width: 185px;
  min-height: 96px;
  border-radius: 20px;
  padding: 12px 13px;
}

.tree-person-card strong {
  font-size: 15px;
}

.tree-person-card > span:last-child {
  font-size: 11px;
}

.tree-connector {
  stroke-width: 2.1;
  opacity: 0.66;
}

.spouse-connector {
  stroke-width: 1.8;
  opacity: 0.78;
}

@media (max-width: 680px) {
  .corner-admin-link {
    top: 10px;
    left: 10px;
  }

  .corner-theme-toggle {
    top: 10px;
    right: 10px;
  }

  .app {
    margin-top: 62px;
  }

  .tree-toolbar-actions {
    width: 100%;
    justify-content: space-between;
  }
}


/* Last polish: readable language toggle in dark mode + drag-to-pan tree */
body.dark-mode .language-toggle {
  background: rgba(255, 255, 255, 0.08);
}

body.dark-mode .language-toggle button {
  color: rgba(247, 248, 255, 0.72);
}

body.dark-mode .language-toggle button.active {
  background: linear-gradient(135deg, #a593ff, #ffd88a);
  color: #10131f;
  box-shadow: 0 12px 30px rgba(165, 147, 255, 0.22);
}

.tree-canvas {
  cursor: grab;
  user-select: none;
  touch-action: none;
}

.tree-canvas.is-dragging {
  cursor: grabbing;
}

.tree-person-card,
.tree-person-card * {
  user-select: none;
}

/* Admin delete button disabled state */
.danger-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.danger-button:disabled:hover {
  transform: none;
}
