:root {
  color-scheme: light;
  --bg: #f4f6f5;
  --surface: #ffffff;
  --surface-soft: #f0f4f2;
  --surface-alpha: rgba(255, 255, 255, 0.94);
  --topbar: rgba(255, 255, 255, 0.9);
  --map-surface: #f6f8f7;
  --map-node: #ffffff;
  --map-node-selected: #f0faf6;
  --map-link: #b5c8bd;
  --match-surface: #f2fbf8;
  --soft-green: #e5f1ef;
  --soft-gold: #f5e9d6;
  --soft-blue: #e7edf3;
  --success-bg: #eef9f4;
  --error-bg: #fff1ed;
  --ink: #212b26;
  --muted: #58685f;
  --line: #d9e3dd;
  --accent: #0f766e;
  --accent-strong: #0b5f59;
  --rose: #a24f6f;
  --gold: #a76b1f;
  --leaf: #607a33;
  --blue: #396a91;
  --danger: #a24730;
  --shadow: 0 20px 50px rgba(75, 60, 31, 0.12);
  --radius: 8px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #15191b;
  --surface: #202628;
  --surface-soft: #293133;
  --surface-alpha: rgba(32, 38, 40, 0.98);
  --topbar: rgba(28, 33, 35, 0.97);
  --map-surface: #181e20;
  --map-node: #252d2f;
  --map-node-selected: #2b3e36;
  --map-link: #617269;
  --match-surface: #1d2b26;
  --soft-green: #18342f;
  --soft-gold: #352819;
  --soft-blue: #182838;
  --success-bg: #16332a;
  --error-bg: #3a211c;
  --ink: #f0f5f2;
  --muted: #b0bfb6;
  --line: #3c4842;
  --accent: #94d7b7;
  --accent-strong: #ade5cb;
  --rose: #f08ab5;
  --gold: #f2b866;
  --leaf: #a6c96a;
  --blue: #83b8e8;
  --danger: #ff987f;
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(circle at 12% 0%, rgba(15, 118, 110, 0.13), transparent 30rem),
    linear-gradient(180deg, var(--surface-soft) 0%, var(--bg) 48rem);
  color: var(--ink);
}

body.landing-page {
  min-height: 100vh;
}

button,
input,
select,
.button {
  font: inherit;
}

button,
.button,
.menu-button {
  min-height: 2.5rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  padding: 0.58rem 0.78rem;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
}

button:hover,
.button:hover,
.menu-button:hover {
  border-color: var(--accent);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

button.primary,
.button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--surface);
}

button.ghost {
  min-height: 2rem;
  padding: 0.3rem 0.55rem;
  border-color: transparent;
  background: transparent;
  color: var(--accent-strong);
}

button.segmented {
  min-height: 2.25rem;
  padding: 0.42rem 0.7rem;
}

button.segmented.active {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--surface);
}

.theme-toggle {
  min-width: 6.4rem;
}

.theme-toggle[aria-pressed="true"] {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--surface);
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  padding: 0.78rem 0.85rem;
}

textarea {
  resize: vertical;
  min-height: 7rem;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 1rem;
  max-width: 12ch;
  font-size: 2rem;
  line-height: 0.98;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 1rem;
  letter-spacing: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem clamp(1rem, 3vw, 2.5rem);
  border-bottom: 1px solid var(--line);
  background: var(--topbar);
  backdrop-filter: blur(16px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

.brand.compact {
  margin-bottom: 1.5rem;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 2.8rem;
  height: 2.8rem;
  border-radius: 50%;
  background: var(--accent);
  color: var(--surface);
  font-size: 1.25rem;
  font-weight: 800;
  flex: 0 0 auto;
}

.brand strong {
  display: block;
  font-size: 1.15rem;
}

.eyebrow,
.card-label {
  display: block;
  color: var(--accent-strong);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.top-actions,
.hero-actions,
.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
}

.account-menu {
  position: relative;
}

.account-menu summary {
  list-style: none;
}

.account-menu summary::-webkit-details-marker {
  display: none;
}

.menu-button {
  width: 2.75rem;
  min-width: 2.75rem;
  padding: 0;
  user-select: none;
}

.menu-icon {
  display: grid;
  gap: 0.24rem;
  width: 1.05rem;
}

.menu-icon span {
  display: block;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
}

.menu-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 0.55rem);
  z-index: 80;
  display: grid;
  gap: 0.45rem;
  width: min(15rem, calc(100vw - 2rem));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 0.55rem;
}

.menu-panel button,
.menu-panel .button {
  width: 100%;
  justify-content: start;
  background: transparent;
}

.menu-panel .theme-toggle[aria-pressed="true"] {
  background: var(--ink);
  color: var(--surface);
}

[data-admin="false"] [data-admin-only] {
  display: none;
}

main {
  padding-bottom: 2rem;
}

.landing-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 390px);
  gap: clamp(1rem, 4vw, 2rem);
  align-items: stretch;
  padding: clamp(1.4rem, 5vw, 4rem) clamp(1rem, 3vw, 2.5rem) 1.2rem;
}

.landing-copy,
.landing-login,
.landing-grid article {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-alpha);
  box-shadow: var(--shadow);
}

.landing-copy {
  display: grid;
  align-content: center;
  min-height: 26rem;
  padding: clamp(1.2rem, 4vw, 2.4rem);
  background:
    radial-gradient(circle at 82% 18%, rgba(15, 118, 110, 0.12), transparent 16rem),
    radial-gradient(circle at 16% 82%, rgba(167, 107, 31, 0.11), transparent 15rem),
    var(--surface-alpha);
}

.landing-copy h1 {
  max-width: 13ch;
}

.landing-copy p {
  max-width: 58ch;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.65;
}

.landing-login {
  display: grid;
  align-content: start;
  gap: 0.75rem;
  padding: clamp(1rem, 3vw, 1.35rem);
}

.landing-login h2 {
  color: var(--ink);
  font-size: 1.25rem;
}

.landing-login p {
  color: var(--muted);
  line-height: 1.55;
}

.landing-login strong {
  font-size: 1.25rem;
}

.landing-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  padding: 0 clamp(1rem, 3vw, 2.5rem) 1rem;
}

.landing-grid article {
  padding: 1rem;
}

.landing-grid h2 {
  margin-bottom: 0.45rem;
}

.landing-grid p {
  color: var(--muted);
  line-height: 1.55;
}

.hero-actions {
  margin-top: 1rem;
}

.access-label {
  display: inline-flex;
  align-items: center;
  margin-bottom: 0.85rem;
  color: var(--accent-strong);
  font-weight: 800;
}

.search-box {
  display: grid;
  gap: 0.5rem;
  max-width: 40rem;
  margin-top: 1.4rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.search-box input {
  min-height: 3.4rem;
  font-size: 1rem;
  box-shadow: var(--shadow);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(260px, 340px) minmax(0, 1fr);
  gap: 1rem;
  padding: 0 clamp(1rem, 3vw, 2.5rem);
}

.tree-app {
  padding: 1rem 0;
}

.tree-app .workspace {
  grid-template-columns: minmax(250px, 320px) minmax(0, 1fr);
  min-height: calc(100vh - 6.2rem);
}

.control-panel {
  display: grid;
  align-content: start;
  gap: 1rem;
  position: sticky;
  top: 5.6rem;
  max-height: calc(100vh - 6.4rem);
  overflow: auto;
}

.panel-block,
.tree-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-alpha);
  box-shadow: var(--shadow);
}

.panel-block {
  padding: 1rem;
}

.tree-summary {
  display: grid;
  gap: 0.45rem;
}

.tree-summary strong {
  color: var(--ink);
  font-size: 1.05rem;
}

.tree-summary > span:not(.card-label) {
  color: var(--muted);
}

.compact-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.45rem;
  margin-top: 0.4rem;
}

.compact-metrics span {
  display: grid;
  gap: 0.1rem;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
  color: var(--muted);
  padding: 0.5rem;
  font-size: 0.76rem;
}

.compact-metrics strong {
  color: var(--ink);
  font-size: 1rem;
}

.panel-block .search-box {
  max-width: none;
  margin: 0 0 1rem;
}

.field {
  display: grid;
  gap: 0.45rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

.branch-cards {
  display: grid;
  gap: 0.55rem;
}

.branch-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  min-height: 3.8rem;
  text-align: left;
  background: var(--surface-soft);
}

.branch-card[aria-pressed="true"] {
  border-color: var(--branch-color, var(--accent));
  background: var(--surface);
}

.avatar {
  display: grid;
  place-items: center;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 50%;
  overflow: hidden;
  background: var(--branch-tint, #e6f1ef);
  color: var(--branch-color, var(--accent));
  font-weight: 800;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.branch-card strong,
.branch-card span {
  display: block;
}

.branch-card strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.branch-card span {
  color: var(--muted);
  font-size: 0.86rem;
}

.branch-card .avatar {
  color: var(--branch-color, var(--accent));
}

.details-panel {
  color: var(--muted);
  line-height: 1.55;
}

.detail-profile {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.8rem;
  align-items: center;
}

.detail-avatar {
  display: grid;
  place-items: center;
  width: 4.1rem;
  height: 4.1rem;
  border: 2px solid var(--avatar-tint, #e6f1ef);
  border-radius: 50%;
  overflow: hidden;
  background: var(--avatar-tint, #e6f1ef);
  color: var(--avatar-color, var(--accent));
  font-size: 1.1rem;
  font-weight: 800;
}

.detail-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.detail-name {
  color: var(--ink);
  font-size: 1.2rem;
  font-weight: 800;
}

.detail-profile-meta {
  display: block;
  margin-top: 0.15rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.detail-grid {
  display: grid;
  gap: 0.45rem;
  margin-top: 0.8rem;
}

.detail-grid div {
  display: grid;
  grid-template-columns: 6.2rem minmax(0, 1fr);
  gap: 0.5rem;
}

.detail-grid dt {
  color: var(--muted);
}

.detail-grid dd {
  margin: 0;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.detail-action {
  width: 100%;
  margin-top: 0.9rem;
}

.contact-card {
  margin-top: 0.9rem;
  border-top: 1px solid var(--line);
  padding-top: 0.9rem;
}

.contact-card h3 {
  margin: 0 0 0.55rem;
  color: var(--ink);
  font-size: 0.95rem;
}

.contact-actions {
  display: grid;
  gap: 0.5rem;
}

.contact-link {
  display: block;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
  color: var(--ink);
  padding: 0.62rem 0.7rem;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.contact-link:hover {
  border-color: var(--accent);
}

.contact-card p {
  margin: 0.55rem 0 0;
  color: var(--muted);
}

.tree-panel {
  min-width: 0;
  overflow: hidden;
}

.tree-app .tree-panel {
  min-height: calc(100vh - 6.2rem);
}

.tree-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 1rem;
  padding: 1rem;
  border-bottom: 1px solid var(--line);
}

.tree-toolbar p {
  margin-bottom: 0.15rem;
  font-weight: 800;
}

.tree-toolbar span {
  color: var(--muted);
}

.map-root {
  min-height: 28rem;
  overflow: auto;
  background:
    radial-gradient(circle at 16% 14%, rgba(15, 118, 110, 0.08), transparent 18rem),
    radial-gradient(circle at 84% 72%, rgba(167, 107, 31, 0.09), transparent 20rem),
    var(--map-surface);
  scrollbar-color: color-mix(in srgb, var(--accent) 55%, var(--line)) transparent;
}

.tree-app .map-root {
  min-height: calc(100vh - 13rem);
  height: calc(100dvh - 13rem);
  cursor: grab;
}

.tree-load-status {
  padding: 2rem;
  color: var(--ink);
}

.tree-load-status .button {
  margin-left: 0.5rem;
}

.tree-app .map-root.is-panning {
  cursor: grabbing;
}

.map-root svg {
  display: block;
}

.map-link {
  fill: none;
  stroke: var(--map-link);
  stroke-width: 1.35;
  transition: stroke 180ms ease;
}

.map-node {
  cursor: pointer;
}

.map-node foreignObject {
  overflow: visible;
}

.map-card {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.72rem;
  width: 100%;
  height: 100%;
  border: 1px solid var(--line);
  border-left: 4px solid var(--node-color, var(--accent));
  border-radius: var(--radius);
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--node-tint, var(--surface-soft)) 72%, transparent), transparent 60%),
    var(--map-node);
  box-shadow: 0 14px 30px rgba(33, 27, 15, 0.1);
  color: var(--ink);
  padding: 0.65rem 0.65rem 0.65rem 0.72rem;
  transition: border-color 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.map-card:hover {
  box-shadow: 0 18px 40px rgba(33, 27, 15, 0.16);
}

.map-card.is-selected {
  border-color: var(--accent);
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--node-tint, var(--surface-soft)) 86%, transparent), transparent 64%),
    var(--map-node-selected);
  box-shadow: 0 16px 36px rgba(15, 118, 110, 0.18);
}

.map-card.is-compact {
  gap: 0.5rem;
  padding: 0.5rem 0.52rem;
  box-shadow: none;
}

.map-card-photo {
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  border: 1px solid color-mix(in srgb, var(--node-color, var(--accent)) 70%, var(--surface));
  border-radius: 50%;
  overflow: hidden;
  background:
    radial-gradient(circle at 35% 24%, rgba(255, 255, 255, 0.55), transparent 1.1rem),
    var(--node-tint, var(--surface-soft));
  color: var(--node-color, var(--accent));
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1;
}

.map-card-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.map-card.is-compact .map-card-photo {
  width: 2.2rem;
  height: 2.2rem;
  font-size: 0.68rem;
}

.map-card-body {
  display: grid;
  gap: 0.22rem;
  min-width: 0;
}

.map-card .node-title,
.map-card .node-meta {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.map-card .node-title {
  color: var(--ink);
  font-size: 0.88rem;
  font-weight: 800;
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.2;
}

.map-card .node-meta {
  color: var(--muted);
  font-size: 0.78rem;
}

.map-expander {
  min-width: 2.45rem;
  min-height: 2rem;
  align-self: center;
  border-color: color-mix(in srgb, var(--node-color, var(--accent)) 45%, var(--line));
  background: var(--node-tint, var(--surface-soft));
  color: var(--node-color, var(--accent));
  padding: 0.25rem 0.48rem;
  font-size: 0.78rem;
  font-weight: 800;
}

.map-expander.is-closed {
  background: var(--node-color, var(--accent));
  color: var(--surface);
}

@keyframes map-card-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .map-card {
    animation: none;
  }
}

.tree-list {
  padding: 1rem;
  overflow: auto;
}

.tree-list ul {
  list-style: none;
  margin: 0;
  padding-left: 1.2rem;
  position: relative;
}

.tree-list ul::before {
  content: "";
  position: absolute;
  left: 0.42rem;
  top: 0;
  bottom: 0.85rem;
  border-left: 1px solid var(--line);
}

.tree-list > ul {
  padding-left: 0;
}

.tree-list > ul::before,
.tree-list > ul > li::before {
  display: none;
}

.tree-list li {
  position: relative;
  padding: 0.28rem 0 0.28rem 0.8rem;
}

.tree-list li::before {
  content: "";
  position: absolute;
  left: 0.42rem;
  top: 1.55rem;
  width: 0.45rem;
  border-top: 1px solid var(--line);
}

.person {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr);
  gap: 0.48rem;
  align-items: start;
  width: 100%;
  border: 1px solid var(--line);
  border-left: 0.35rem solid var(--branch-color, var(--accent));
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  padding: 0.7rem;
  text-align: left;
}

.person-avatar {
  display: grid;
  place-items: center;
  width: 2.35rem;
  height: 2.35rem;
  border-radius: 50%;
  overflow: hidden;
  background: var(--avatar-tint, #e6f1ef);
  color: var(--avatar-color, var(--accent));
  font-size: 0.78rem;
  font-weight: 800;
}

.person-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.person:hover,
.person[aria-current="true"] {
  border-color: var(--branch-color, var(--accent));
}

.toggle {
  display: grid;
  place-items: center;
  width: 1.45rem;
  height: 1.45rem;
  border-radius: 5px;
  background: var(--surface-soft);
  color: var(--accent-strong);
  border: 1px solid var(--line);
  font-weight: 800;
  line-height: 1;
}

.toggle.empty {
  visibility: hidden;
}

.person-main {
  min-width: 0;
}

.person-name {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.number {
  color: var(--accent-strong);
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem 0.7rem;
  margin-top: 0.3rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.status,
.needs-more {
  display: inline-flex;
  align-items: center;
  min-height: 1.3rem;
  border-radius: 999px;
  padding: 0.1rem 0.45rem;
  font-size: 0.76rem;
  font-weight: 800;
  background: var(--soft-gold);
  color: var(--gold);
}

.needs-more {
  background: var(--soft-green);
  color: var(--accent-strong);
}

.is-hidden {
  display: none;
}

.is-match > .person {
  background: var(--match-surface);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 1rem;
  transform: translateX(-50%);
  z-index: 60;
  width: min(92vw, 34rem);
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  border-left: 0.45rem solid var(--accent);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 0.9rem 1rem;
  line-height: 1.45;
}

.toast[hidden] {
  display: none;
}

footer {
  padding: 1.4rem 1rem 2rem;
  color: var(--muted);
  text-align: center;
}

.login-form {
  display: grid;
  gap: 0.9rem;
  margin-top: 1.2rem;
}

.form-error {
  border: 1px solid #e1b7ac;
  border-radius: var(--radius);
  background: var(--error-bg);
  color: var(--danger);
  padding: 0.8rem;
}

.form-success {
  border: 1px solid #b9dacb;
  border-radius: var(--radius);
  background: var(--success-bg);
  color: var(--accent-strong);
  padding: 0.8rem;
}

.suggestion-panel[hidden],
.review-panel[hidden],
.editor-panel[hidden] {
  display: none;
}

.suggestion-form {
  display: grid;
  gap: 0.8rem;
}

.editor-form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.8rem;
}

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

.add-child-form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
  align-items: end;
  margin-top: 1rem;
  border-top: 1px solid var(--line);
  padding-top: 1rem;
}

.review-list {
  display: grid;
  gap: 0.7rem;
}

.review-item,
.empty-state {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
  padding: 0.8rem;
}

.review-item strong,
.review-item span {
  display: block;
}

.review-item span,
.empty-state {
  color: var(--muted);
  font-size: 0.9rem;
}

.review-item p,
.empty-state p {
  margin: 0.45rem 0 0;
  color: var(--ink);
  line-height: 1.45;
}

.admin-shell {
  width: min(100%, 74rem);
  margin: 0 auto;
  padding: clamp(1.2rem, 4vw, 3rem) clamp(1rem, 3vw, 2.5rem) 3rem;
}

.admin-hero {
  margin-bottom: 1rem;
}

.admin-hero h1 {
  max-width: none;
  margin-bottom: 0.8rem;
}

.admin-hero p {
  max-width: 62ch;
  color: var(--muted);
  line-height: 1.6;
}

.suggestions-list {
  display: grid;
  gap: 1rem;
  margin-top: 1rem;
}

.suggestion-card,
.empty-admin-state {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-alpha);
  box-shadow: var(--shadow);
  padding: clamp(1rem, 3vw, 1.35rem);
}

.suggestion-card-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  margin-bottom: 0.75rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 1.6rem;
  border-radius: 999px;
  padding: 0.16rem 0.55rem;
  background: var(--soft-green);
  color: var(--accent-strong);
  font-size: 0.78rem;
  font-weight: 800;
}

.status-reviewed {
  background: var(--soft-gold);
  color: var(--gold);
}

.status-done {
  background: var(--soft-blue);
  color: var(--blue);
}

.suggestion-card h2,
.empty-admin-state h2 {
  margin-bottom: 0.35rem;
  font-size: 1.12rem;
}

.admin-meta {
  color: var(--muted);
  line-height: 1.45;
}

.suggestion-text {
  margin: 0.85rem 0 1rem;
  line-height: 1.6;
}

.status-form {
  display: grid;
  grid-template-columns: minmax(12rem, 1fr) auto;
  gap: 0.75rem;
  align-items: end;
  border-top: 1px solid var(--line);
  padding-top: 1rem;
}

@media (max-width: 980px) {
  .workspace,
  .landing-hero {
    grid-template-columns: 1fr;
  }

  .landing-copy {
    min-height: auto;
  }

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

  .control-panel {
    position: static;
    max-height: none;
    overflow: visible;
  }

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

@media (max-width: 640px) {
  .tree-app .workspace {
    grid-template-columns: minmax(0, 1fr);
  }

  .tree-app .tree-panel {
    grid-row: 1;
    min-height: 0;
  }

  .tree-app .control-panel {
    grid-row: 2;
  }

  .tree-app .map-root {
    min-height: 24rem;
    height: calc(100dvh - 16rem);
  }
  .topbar {
    align-items: center;
    flex-direction: row;
  }

  .hero-actions,
  .toolbar-actions {
    width: 100%;
  }

  .hero-actions button,
  .toolbar-actions button {
    flex: 1 1 auto;
  }

  .menu-panel {
    right: 0;
    width: min(15rem, calc(100vw - 2rem));
  }

  h1 {
    max-width: 11ch;
    font-size: 2.55rem;
  }

  .branch-cards {
    grid-template-columns: 1fr;
  }

  .tree-toolbar {
    display: grid;
  }

  .status-form,
  .editor-form,
  .add-child-form {
    grid-template-columns: 1fr;
  }

  .map-root {
    min-height: 28rem;
  }

  .tree-list {
    padding: 0.7rem;
  }

  .tree-list ul {
    padding-left: 0.8rem;
  }

  .tree-list li {
    padding-left: 0.55rem;
  }
}

@media print {
  .topbar,
  .control-panel,
  footer,
  .tree-toolbar,
  .toast {
    display: none;
  }

  body {
    background: white;
    color: black;
  }

  .workspace,
  .tree-panel {
    display: block;
    padding: 0;
    border: 0;
    box-shadow: none;
  }

  .map-root {
    display: none;
  }

  .tree-list {
    display: block !important;
    padding: 0;
  }

  .is-hidden {
    display: list-item;
  }
}

/* App shell and shared account pages. */
body { background: var(--bg); }
h1 { max-width: none; line-height: 1.15; }
h2 { font-weight: 650; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.topbar { min-height: 74px; padding: .75rem 1.5rem; backdrop-filter: none; }
.brand strong { font-size: 1rem; }
.brand-mark { width: 40px; height: 40px; font-size: 1rem; }
.eyebrow { font-size: .68rem; font-weight: 650; }
.top-actions { flex-wrap: nowrap; }
.menu-panel { animation: menu-reveal 160ms ease; }
.menu-panel button, .menu-panel a { display: flex; justify-content: start; width: 100%; padding: .7rem; color: var(--ink); text-decoration: none; border: 0; border-radius: 5px; }
.menu-panel button:hover, .menu-panel a:hover { background: var(--surface-soft); }
.menu-panel .theme-toggle[aria-pressed="true"] { background: var(--surface-soft); color: var(--ink); }
.menu-household { padding: .7rem; font-weight: 650; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.menu-household small { display: block; margin-top: .3rem; font-weight: 400; font-size: .75rem; color: var(--muted); }
.theme-toggle { justify-content: space-between !important; }
.theme-toggle::after { content: ""; width: 30px; height: 18px; border-radius: 12px; background: var(--line); box-shadow: inset 12px 0 0 3px var(--muted); }
.theme-toggle[aria-pressed="true"]::after { background: var(--accent); box-shadow: inset -12px 0 0 3px var(--surface); }
.tree-app { padding: 0; }
.tree-app .workspace { grid-template-columns: 300px minmax(0, 1fr); gap: 0; padding: 0; min-height: calc(100dvh - 74px); }
.control-panel { gap: 0; background: var(--surface); border-right: 1px solid var(--line); top: 74px; max-height: calc(100dvh - 74px); }
.panel-block, .tree-panel { border: 0; border-radius: 0; box-shadow: none; }
.panel-block { padding: 1.25rem; border-bottom: 1px solid var(--line); }
.panel-block .search-box { margin: 0; }
.search-box input { min-height: 44px; font-size: .9rem; box-shadow: none; }
.tree-app .tree-panel { min-height: 0; }
.tree-toolbar { min-height: 68px; align-items: center; padding: .75rem 1.4rem; background: var(--surface); }
.tree-toolbar p { margin: 0; font-size: .85rem; font-weight: 600; }
.tree-toolbar > div:first-child { min-width: 0; flex: 1; }
#branchFilter { width: min(100%, 260px); min-height: 40px; font-size: .9rem; padding: .5rem .65rem; }
.tree-toolbar { gap: 1rem; }
.toolbar-actions { flex-wrap: nowrap; gap: 2px; padding: 3px; border-radius: 8px; background: var(--surface-soft); }
button.segmented { min-height: 34px; border: 0; background: transparent; }
button.segmented.active { color: var(--ink); background: var(--surface); box-shadow: 0 1px 4px #00000015; }
.tree-app .map-root { height: calc(100dvh - 142px); min-height: 28rem; background: var(--map-surface); }
.map-link { stroke-width: 1.4; }
.map-card { grid-template-columns: 48px minmax(0, 1fr) 34px; gap: 10px; border-left: 1px solid var(--line); border-top: 2px solid var(--node-color); padding: 12px; background: var(--map-node); box-shadow: 0 4px 12px #00000009; }
.map-card.is-selected { background: var(--map-node-selected); box-shadow: 0 0 0 2px var(--accent); }
.map-card.is-compact { grid-template-columns: 34px minmax(0, 1fr) 34px; gap: 8px; padding: 10px; }
.map-card-photo { width: 48px; height: 48px; background: var(--node-tint); border: 0; }
.map-card.is-compact .map-card-photo { width: 34px; height: 34px; }
.map-card .node-title { font-size: 13px; font-weight: 650; line-height: 1.3; }
.map-card .node-meta { font-size: 11px; }
.map-expander { min-width: 34px; width: 34px; padding: 0; min-height: 32px; border: 0; font-size: 12px; }
.detail-profile { grid-template-columns: 56px minmax(0, 1fr); }
.detail-avatar { width: 56px; height: 56px; border: 0; }
.detail-name { font-size: 1.12rem; font-weight: 650; overflow-wrap: anywhere; }
.detail-grid { gap: .8rem; font-size: .85rem; }
.detail-grid div { grid-template-columns: 1fr; gap: .2rem; }
.detail-grid dt { font-size: .75rem; }
.detail-action { font-size: .85rem; }
.contact-link { border: 0; background: none; padding: .5rem 0; text-decoration: underline; }
.tree-list { max-height: calc(100dvh - 142px); }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .9; }
input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); flex: 0 0 auto; }
.form-hint { margin: 0; color: var(--muted); font-size: .75rem; }
.welcome { position: relative; min-height: calc(100dvh - 130px); padding: 2.5rem 1.5rem; display: flex; flex-direction: column; justify-content: center; align-items: center; background: #ecf0ed url('assets/family-banyan.png') center center / cover no-repeat; isolation: isolate; }
.welcome::before { content: ""; position: absolute; inset: 0; z-index: -1; background: rgba(244, 248, 245, .48); }
.welcome-heading { width: min(100%, 960px); margin-bottom: 1.5rem; text-align: center; animation: welcome-reveal 600ms ease both; }
.welcome-heading h1 { font-family: Georgia, 'Times New Roman', serif; font-size: 4rem; font-weight: 500; margin: .3rem 0 .7rem; color: #15372d; text-wrap: balance; }
.welcome-heading p { max-width: 55ch; color: #253f33; margin-left: auto; margin-right: auto; }
.signin-panel { width: min(100%, 380px); padding: 1.5rem; border-radius: 8px; background: var(--surface); border: 1px solid var(--line); box-shadow: 0 16px 55px #142e2524; animation: welcome-reveal 650ms 80ms ease both; }
.signin-panel h2 { font-size: 1.15rem; }
.signin-panel p { font-size: .85rem; color: var(--muted); }
.signin-panel > strong, .signin-panel > span { display: block; margin-bottom: .7rem; }
.signin-panel .button { margin-top: .6rem; }
.welcome-note { margin: 1.2rem 0 0; color: #364d40; font-size: .8rem; }
html[data-theme="dark"] .welcome::before { background: rgba(9, 23, 19, .65); }
html[data-theme="dark"] .welcome-heading h1 { color: #f5faf7; text-shadow: 0 2px 18px #09211970; }
html[data-theme="dark"] .welcome-heading p, html[data-theme="dark"] .welcome-note { color: #eef5f0; }
.welcome .eyebrow { color: #234e3e; }
html[data-theme="dark"] .welcome .eyebrow { color: #d1f1e2; }
.landing-page a:not(.button):not(.brand) { color: var(--accent-strong); }
.landing-page footer { min-height: 56px; display: grid; place-items: center; }
@keyframes welcome-reveal { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .welcome-heading, .signin-panel { animation: none; } }
footer { padding: 1rem; font-size: .75rem; }
footer p { margin: 0; }
.admin-shell h1 { font-size: 2rem; }
.accounts-layout { display: grid; grid-template-columns: minmax(240px, 350px) minmax(0, 1fr); gap: 4rem; margin-top: 2rem; }
.check-field { display: flex; align-items: start; gap: .6rem; font-size: .85rem; line-height: 1.5; }
.household-list { list-style: none; padding: 0; }
.household-list li { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 1rem 0; border-bottom: 1px solid var(--line); }
.household-list strong { display: block; overflow-wrap: anywhere; }
.household-list small { display: block; margin-top: .3rem; color: var(--muted); }
.role-label { color: var(--accent-strong); background: var(--surface-soft); padding: .15rem .4rem; border-radius: 4px; font-size: .75rem; }
@keyframes menu-reveal { from { opacity: 0; transform: translateY(-5px); } to { opacity: 1; transform: translateY(0); } }
@media (max-width: 760px) {
  .topbar { padding: .7rem 1rem; }
  .brand strong { font-size: .9rem; }
  .brand .eyebrow { display: none; }
  .brand-mark { width: 34px; height: 34px; }
  .top-actions { gap: .4rem; }
  .tree-app .workspace { grid-template-columns: minmax(0, 1fr); }
  .tree-app .tree-panel { grid-row: 1; }
  .control-panel { grid-row: 2; position: static; max-height: none; border: 0; }
  .tree-toolbar { display: flex; padding: .75rem 1rem; }
  .toolbar-actions { width: auto; }
  .tree-app .map-root { height: calc(100dvh - 205px); min-height: 380px; }
  .tree-list { max-height: calc(100dvh - 205px); }
  .welcome { padding: 1.75rem 1.25rem; align-items: center; background-position: 60% center; }
  .welcome::before { background: rgba(244, 248, 245, .6); }
  .welcome-heading { text-align: center; }
  .welcome-heading h1 { font-size: 2.45rem; max-width: none; }
  .welcome-heading p { margin-left: auto; margin-right: auto; }
  .accounts-layout { grid-template-columns: 1fr; gap: 2.5rem; }
  .admin-shell { padding: 1.5rem 1rem; }
}
@media print {
  .tree-app .workspace { display: block; }
  .tree-list { max-height: none; overflow: visible; }
}

/* Portrait nodes share stable bounds with the tree layout. */
.tree-panel { position: relative; }
.tree-app .map-root { overflow: hidden; touch-action: none; }
.map-card, .map-card.is-compact {
  display: flex; flex-direction: column; justify-content: flex-start; align-items: center;
  gap: 8px; padding: 10px 8px 20px; border: 1px solid transparent; background: transparent;
  box-shadow: none; text-align: center; position: relative;
}
.map-card:hover, .map-card.is-selected { background: transparent; border-color: transparent; box-shadow: none; }
.map-card-photo { transition: transform 180ms ease, box-shadow 180ms ease; }
.map-card:hover .map-card-photo { transform: scale(1.06); }
.map-card-photo, .map-card.is-compact .map-card-photo { width: 56px; height: 56px; flex: 0 0 56px; border: 2px solid var(--node-color); font-size: 15px; box-shadow: 0 0 0 4px var(--map-surface); }
.map-card.is-selected .map-card-photo { box-shadow: 0 0 0 5px var(--node-tint), 0 0 0 6px var(--node-color); }
.map-card-body { width: 100%; gap: 5px; }
.map-card .node-title { font-size: 15px; line-height: 1.3; }
.map-expander { position: absolute; bottom: -12px; left: calc(50% - 17px); border-radius: 16px; min-height: 28px; font-size: 11px; }
.map-controls { position: absolute; right: 20px; bottom: 20px; display: flex; gap: 4px; background: var(--surface); padding: 4px; border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); }
.map-controls button { width: 38px; min-height: 38px; padding: 8px; border: 0; }
.map-controls svg { width: 18px; height: 18px; }
@media print { .map-controls { display: none; } }

/* Account maintenance stays compact, with profile details beside the canvas. */
/* A couple is a shared relationship, with separate selectable portraits. */
.map-card.family-unit, .map-card.family-unit.is-compact {
  display: grid; grid-template-columns: minmax(0, 1fr); align-items: start;
  gap: 0; padding: 8px; width: 100%; height: 100%; position: relative; overflow: hidden;
}
.map-card.family-unit.is-couple { grid-template-columns: minmax(0, 1fr) 40px minmax(0, 1fr); }
.family-unit .map-person {
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  gap: 9px; width: 100%; min-width: 0; height: 170px; min-height: 0; padding: 4px 0;
  background: transparent; border: 0; border-radius: 0; box-shadow: none; color: var(--ink);
  text-align: center; z-index: 1;
}
.family-unit.is-compact .map-person { height: 150px; }
.family-unit .map-person.is-partner { grid-column: 3; }
.family-unit .map-person:hover { background: transparent; transform: none; }
.family-unit .map-card-photo, .family-unit.is-compact .map-card-photo {
  width: 56px; height: 56px; flex: 0 0 56px; background: var(--node-tint); color: var(--node-color);
  border: 2px solid var(--node-color); box-shadow: 0 0 0 4px var(--map-surface);
}
.family-unit .map-person:hover .map-card-photo { transform: translateY(-2px); }
.family-unit .map-person.is-selected .map-card-photo { box-shadow: 0 0 0 4px var(--map-surface), 0 0 0 6px var(--node-color); }
.family-unit .node-title {
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3;
  overflow: hidden; overflow-wrap: anywhere; white-space: normal; font-size: 14px;
  line-height: 19px; max-height: 57px; min-height: 38px; width: 100%;
}
.family-unit .node-meta { font-size: 11px; line-height: 15px; max-height: 30px; overflow: hidden; white-space: normal; overflow-wrap: anywhere; }
.couple-link { position: absolute; top: 40px; left: calc(25% + 22px); right: calc(25% + 22px); height: 1.5px; background: var(--map-link); }
.couple-link::after { content: ''; position: absolute; left: calc(50% - 3px); top: -2px; width: 6px; height: 6px; border-radius: 50%; background: var(--map-link); }
.family-stem { position: absolute; top: 174px; bottom: 20px; left: calc(50% - .75px); width: 1.5px; background: var(--map-link); }
.is-couple .family-stem { top: 40px; }
.family-unit .map-expander { bottom: 4px; left: calc(50% - 18px); width: 36px; height: 28px; min-height: 28px; z-index: 2; }
.list-partner { display: flex; align-items: center; gap: .65rem; margin: .25rem 0 .6rem 2rem; border: 0; background: transparent; text-align: left; padding: .35rem; }
.list-partner .person-avatar { width: 32px; height: 32px; flex: 0 0 32px; }
.profile-partner-link { padding: 0; border: 0; background: none; color: var(--accent-strong); text-align: left; text-decoration: underline; min-height: 30px; }
.contact-row { display: grid; grid-template-columns: minmax(0, 1fr) 36px; align-items: center; gap: .4rem; padding: .55rem 0; border-bottom: 1px solid var(--line); }
.contact-row .contact-link { display: flex; align-items: center; gap: .5rem; overflow-wrap: anywhere; font-size: .85rem; min-width: 0; }
.contact-row .contact-link svg { width: 16px; height: 16px; flex: 0 0 16px; }
.contact-row .copy-contact { display: grid; place-items: center; width: 36px; min-height: 36px; padding: 7px; border: 0; background: transparent; }
.copy-contact svg { width: 16px; height: 16px; }
.suggestion-filters { display: flex; flex-wrap: wrap; gap: 1.25rem; border-bottom: 1px solid var(--line); margin: 1.5rem 0; }
.suggestion-filters a { padding: .8rem 0; color: var(--muted); text-decoration: none; border-bottom: 2px solid transparent; }
.suggestion-filters a[aria-current] { color: var(--accent-strong); border-bottom-color: var(--accent); }
.section-intro { max-width: 75ch; color: var(--muted); line-height: 1.6; }
.users-layout { display: grid; grid-template-columns: minmax(240px, 310px) minmax(0, 1fr); gap: 2.5rem; margin-top: 2rem; }
.users-layout > section { min-width: 0; }
.admin-table { width: 100%; border-collapse: collapse; text-align: left; font-size: .85rem; }
.admin-table th { color: var(--muted); font-size: .75rem; font-weight: 600; }
.admin-table th, .admin-table td { padding: .9rem .7rem; border-bottom: 1px solid var(--line); vertical-align: top; overflow-wrap: anywhere; }
.admin-table td small { display: block; margin-top: .35rem; color: var(--muted); }
.admin-table .icon-button { display: inline-flex; align-items: center; justify-content: center; padding: 8px; width: 36px; height: 36px; min-height: 36px; }
.icon-button svg { width: 16px; height: 16px; }
.table-scroll { overflow-x: auto; max-width: 100%; }
.settings-section { padding: 1.5rem 0; border-bottom: 1px solid var(--line); }
.settings-section h2, .users-layout h2 { font-size: 1.1rem; margin: 0 0 1rem; }
.settings-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; max-width: 780px; }
.settings-form button { justify-self: start; }
.health-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1.5rem; }
.health-grid dt { color: var(--muted); font-size: .75rem; margin-bottom: .4rem; }
.health-grid dd { margin: 0; font-size: .95rem; overflow-wrap: anywhere; }
.muted { color: var(--muted); font-weight: 400; }
.inline-form { margin-top: 1rem; }
.recovery-form { max-width: 420px; }
.recovery-form .login-form { margin: 1.5rem 0; }
.mail-preview { padding: 1rem 0; border-bottom: 1px solid var(--line); }
.mail-preview summary { cursor: pointer; overflow-wrap: anywhere; }
.mail-preview small { color: var(--muted); }
.mail-preview pre { white-space: pre-wrap; overflow-wrap: anywhere; font-size: .8rem; padding: 1rem; background: var(--surface-soft); }
.signin-panel > a { display: inline-block; margin-top: 1rem; font-size: .85rem; }
@media (min-width: 761px) {
  .tree-app .workspace { grid-template-columns: minmax(0, 1fr) 300px; }
  .tree-app .tree-panel { grid-column: 1; grid-row: 1; }
  .tree-app .control-panel { grid-column: 2; grid-row: 1; border-right: 0; border-left: 1px solid var(--line); }
}
@media (max-width: 900px) {
  .users-layout { grid-template-columns: 1fr; }
  .health-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 540px) {
  .settings-form { grid-template-columns: 1fr; }
  .admin-page .brand-mark { display: none; }
  .admin-page .top-actions > a:first-child:not(:last-child) { display: none; }
  .admin-table th, .admin-table td { padding: .7rem .4rem; }
}

/* Shared management pages keep daily tasks visible and setup details optional. */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.admin-shell { max-width: 1120px; }
.admin-tabs { display: flex; gap: 1.5rem; border-bottom: 1px solid var(--line); margin-bottom: 2rem; }
.admin-tabs a { padding: .25rem 0 .9rem; color: var(--muted); text-decoration: none; font-size: .85rem; border-bottom: 2px solid transparent; }
.admin-tabs a[aria-current] { color: var(--accent-strong); border-color: var(--accent-strong); }
.admin-shell > h1 { margin-bottom: .6rem; }
.admin-shell > .section-intro { margin-top: 0; margin-bottom: 2rem; }
.admin-shell a:not(.button) { color: var(--accent-strong); }
.admin-shell button svg, .admin-shell .button svg { width: 17px; height: 17px; flex-shrink: 0; }
.admin-shell button, .admin-shell .button { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin: 1rem 0 1.5rem; }
.section-heading h2 { margin: 0; font-size: 1.15rem; }
.section-heading a:not(.button) { font-size: .85rem; }
.account-filters { display: grid; grid-template-columns: minmax(0, 1fr) 210px; gap: 1rem; margin-bottom: 1.5rem; max-width: 720px; }
.account-filters .field, .account-form .field { min-width: 0; }
.account-table { table-layout: fixed; }
.account-table th:first-child { width: 37%; }
.account-table th:nth-child(2) { width: 37%; }
.account-table th:last-child { width: 52px; }
.account-table td small { font-size: .8rem; line-height: 1.5; }
.account-status { color: var(--muted); font-size: .8rem; }
.account-form { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 3rem; row-gap: 1.5rem; }
.account-form fieldset { min-width: 0; padding: 0; margin: 0; border: 0; display: flex; flex-direction: column; gap: 1.1rem; }
.account-form legend { font-size: .8rem; font-weight: 650; color: var(--muted); margin-bottom: 1.2rem; }
.account-form small { font-size: .75rem; color: var(--muted); }
.permission-summary { margin: 0; padding: .25rem 0 .25rem 1rem; border-left: 2px solid var(--accent); color: var(--muted); font-size: .85rem; line-height: 1.65; }
.form-actions { grid-column: 1 / -1; border-top: 1px solid var(--line); padding-top: 1.5rem; display: flex; align-items: center; gap: 1.5rem; }
.setting-row { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 1.2rem; align-items: center; padding: 1.5rem 0; border-bottom: 1px solid var(--line); }
.setting-row h2 { font-size: 1rem; margin: 0 0 .35rem; }
.setting-row p { margin: 0; color: var(--muted); font-size: .85rem; max-width: 66ch; line-height: 1.6; }
.setting-row small { display: block; font-size: .75rem; margin-top: .5rem; max-width: 70ch; }
.setting-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 8px; background: var(--surface-soft); color: var(--accent-strong); }
.setting-icon svg { width: 21px; height: 21px; }
.setting-state { font-size: .75rem; color: var(--muted); white-space: nowrap; }
.needs-attention { color: #935520; }
html[data-theme="dark"] .needs-attention { color: #edc38e; }
.settings-disclosure { border-bottom: 1px solid var(--line); }
.settings-disclosure > summary { display: flex; align-items: center; gap: 1rem; padding: 1.25rem 0; cursor: pointer; list-style: none; }
.settings-disclosure > summary::-webkit-details-marker { display: none; }
.settings-disclosure > summary::after { content: ''; width: 8px; height: 8px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); margin: 0 8px 0 auto; flex-shrink: 0; }
.settings-disclosure[open] > summary::after { transform: rotate(225deg); }
.settings-disclosure summary strong { font-weight: 600; font-size: .95rem; }
.settings-disclosure summary small { display: block; color: var(--muted); font-size: .8rem; margin-top: .3rem; }
.disclosure-body { padding: 0 0 1.5rem; }
.disclosure-body > .section-intro { margin-top: 0; font-size: .85rem; }
.settings-disclosure[open] .disclosure-body { animation: menu-reveal 180ms ease; }
.suggestion-card { border-radius: 8px; }
.status-form { grid-template-columns: minmax(120px, 220px) auto; justify-content: start; }
@media (max-width: 760px) {
  .admin-tabs { gap: 1rem; margin-bottom: 1.5rem; }
  .admin-tabs a { font-size: .8rem; }
  .account-form { grid-template-columns: minmax(0, 1fr); gap: 2rem; }
  .status-form { grid-template-columns: minmax(0, 1fr); }
  .status-form button { justify-self: start; }
  .setting-row { grid-template-columns: 32px minmax(0, 1fr); gap: .8rem; }
  .setting-icon { width: 32px; height: 32px; }
  .setting-row > :last-child:not(:nth-child(2)) { grid-column: 2; justify-self: start; }
  .account-filters { grid-template-columns: minmax(0, 1fr); }
  .account-table thead { display: none; }
  .account-table tbody { display: block; }
  .account-table tr { display: grid; grid-template-columns: minmax(0, 1fr) 44px; padding: .8rem 0; border-bottom: 1px solid var(--line); }
  .account-table td { border: 0; padding: .4rem 0; grid-column: 1; }
  .account-table td:last-child { grid-column: 2; grid-row: 1; }
  .account-table td:nth-child(3)::before { content: 'Sign-in: '; color: var(--muted); font-size: .8rem; }
  .section-heading { align-items: start; }
}
@media (prefers-reduced-motion: reduce) { .settings-disclosure[open] .disclosure-body { animation: none; } }

.menu-panel .theme-color-trigger { justify-content: space-between; }
.theme-color-trigger::after { content: ''; width: 18px; height: 18px; border-radius: 50%; background: var(--accent); border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--line); }
.theme-dialog { width: min(420px, calc(100% - 32px)); max-height: calc(100dvh - 32px); overflow-y: auto; padding: 24px; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); }
.theme-dialog::backdrop { background: #10151bb3; backdrop-filter: blur(3px); }
.theme-dialog[open] { animation: menu-reveal 180ms ease-out; }
.theme-dialog h2 { margin: 0 0 20px; font-size: 1.25rem; }
.theme-colors { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; border: 0; padding: 0; margin: 0; min-width: 0; }
.theme-option { position: relative; display: flex; flex-direction: column; align-items: center; gap: 9px; padding: 12px 4px; cursor: pointer; font-size: .8rem; color: var(--ink); }
.theme-option input { position: absolute; width: 100%; height: 100%; inset: 0; margin: 0; opacity: 0; cursor: pointer; }
.theme-swatch { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: var(--swatch-light); color: white; box-shadow: 0 0 0 3px var(--surface); }
html[data-theme="dark"] .theme-swatch { background: var(--swatch-dark); color: #202628; }
.theme-option input:checked + .theme-swatch::after { content: ''; width: 8px; height: 14px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: translateY(-2px) rotate(45deg); }
.theme-option input:checked + .theme-swatch { box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--accent); }
.theme-option:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 1px; border-radius: 6px; }
.theme-dialog form { display: flex; justify-content: flex-end; margin-top: 24px; }
@media (max-width: 400px) { .theme-dialog { padding: 20px 16px; } .theme-colors { gap: 8px; } }
@media (prefers-reduced-motion: reduce) { .theme-dialog[open] { animation: none; } }
