/* ============================================================
   Family Tree — Warm Heritage Theme
   Inspired by shadcn/ui + Tailwind warm palette
   ============================================================ */

:root {
  /* Colors */
  --bg-body: #f5f0e8;
  --bg-card: #ffffff;
  --bg-muted: #faf6f1;
  --bg-nav: #2c1810;
  --bg-nav-item-hover: rgba(61, 37, 24, 0.5);
  --bg-nav-item-active: rgba(92, 58, 30, 0.6);

  --text-main: #2e2319;
  --text-muted: #7d7064;
  --text-nav: #f5e6d3;
  --text-nav-secondary: #b8a089;
  --text-nav-hover: #f5e6d3;

  --accent-gold: #c9a96e;
  --accent-gold-light: #e8d5a3;
  --accent-brown: #8b5e3c;
  --accent-brown-hover: #a06d4a;
  --accent-dark: #5c3a1e;

  --border-color: #ddd5c9;
  --border-color-light: rgba(212, 184, 150, 0.3);

  --shadow-sm: 0 1px 3px rgba(44, 24, 16, 0.08);
  --shadow-md: 0 4px 12px rgba(44, 24, 16, 0.10);
  --shadow-lg: 0 10px 24px rgba(44, 24, 16, 0.14);

  --radius-sm: 0.5rem;
  --radius-md: 0.75rem;
  --radius-lg: 1rem;
  --radius-xl: 1.25rem;

  --font-sans: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  --font-serif: Georgia, "Times New Roman", serif;
}

/* Base */
*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-sans);
  line-height: 1.55;
  color: var(--text-main);
  background: var(--bg-body);
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-serif);
  color: var(--accent-dark);
  margin-top: 0;
  line-height: 1.25;
}

a { color: var(--accent-brown); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ============================================================
   NAVBAR
   ============================================================ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.25rem;
  background: var(--bg-nav);
  border-bottom: 1px solid rgba(212, 184, 150, 0.25);
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}

.topbar a { color: var(--text-nav-secondary); text-decoration: none; margin-right: 0.25rem; }
.topbar a:hover { color: var(--text-nav-hover); text-decoration: none; }

.brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--text-nav) !important;
}
.brand-icon {
  width: 1.5rem;
  height: 1.5rem;
  color: var(--accent-gold);
  flex-shrink: 0;
}
.brand:hover .brand-icon { color: var(--accent-gold-light); }

.nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-wrap: wrap;
}

.nav a {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.7rem;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s ease;
}
.nav a:hover {
  background: var(--bg-nav-item-hover);
  color: var(--text-nav-hover);
}
.nav a.active {
  background: var(--bg-nav-item-active);
  color: var(--text-nav);
}

.meta {
  opacity: 0.9;
  font-size: 0.85rem;
  color: var(--text-nav-secondary);
  margin-left: 0.5rem;
}

.linkish {
  background: none;
  border: none;
  color: var(--text-nav-secondary);
  cursor: pointer;
  text-decoration: underline;
  font: inherit;
  font-size: 0.9rem;
  padding: 0.4rem 0.7rem;
  border-radius: var(--radius-md);
}
.linkish:hover {
  color: var(--text-nav-hover);
  background: var(--bg-nav-item-hover);
  text-decoration: none;
}

/* Mobile nav toggle (hidden by default, shown via media query if needed) */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-nav);
  cursor: pointer;
  padding: 0.35rem;
}

@media (max-width: 860px) {
  .nav {
    gap: 0.15rem;
  }
  .nav a {
    padding: 0.35rem 0.5rem;
    font-size: 0.85rem;
  }
  .meta {
    display: none;
  }
}

@media (max-width: 640px) {
  .nav a span { display: none; }
  .nav a { padding: 0.4rem; }
  .brand { font-size: 1rem; }
}

/* ============================================================
   LAYOUT
   ============================================================ */
.container { max-width: 1200px; margin: 0 auto; padding: 1.25rem; }

.hidden { display: none !important; }
.muted { color: var(--text-muted); }
.error { color: #b91c1c; }
.small { font-size: 0.875rem; }
.pre { white-space: pre-wrap; }

/* ============================================================
   CARD
   ============================================================ */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color-light);
}
.card.narrow { max-width: 420px; margin: 2rem auto; }
.card h2 {
  margin-top: 1.25rem;
  margin-bottom: 0.5rem;
  font-size: 1.15rem;
}

/* ============================================================
   BUTTONS
   ============================================================ */
a.button,
button[type="submit"],
.add-person-link,
a.button-link,
.inline-role-form button,
.form-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.55rem 1.15rem;
  border-radius: var(--radius-md);
  background: var(--accent-brown);
  color: #f5e6d3 !important;
  text-decoration: none;
  font-weight: 600;
  border: none;
  font: inherit;
  cursor: pointer;
  font-size: 0.95rem;
  transition: all 0.2s ease;
}
a.button:hover,
button[type="submit"]:hover,
.add-person-link:hover,
a.button-link:hover,
.inline-role-form button:hover,
.form-actions button:hover {
  background: var(--accent-brown-hover);
  box-shadow: var(--shadow-md);
}

a.button.secondary,
button[type="submit"].secondary,
a.button-link.secondary,
.form-actions .button.secondary {
  background: var(--bg-muted);
  color: var(--accent-dark) !important;
  border: 1px solid var(--border-color);
}
a.button.secondary:hover,
button[type="submit"].secondary:hover,
a.button-link.secondary:hover,
.form-actions .button.secondary:hover {
  background: #ede8e0;
}

.link-button {
  background: none;
  border: none;
  color: var(--accent-brown);
  cursor: pointer;
  font: inherit;
  text-decoration: underline;
  padding: 0.25rem 0;
}
.link-button:hover { color: var(--accent-brown-hover); }

/* ============================================================
   FORMS
   ============================================================ */
.stack { display: flex; flex-direction: column; gap: 0.75rem; }
.stack label { display: flex; flex-direction: column; gap: 0.35rem; font-weight: 600; color: var(--accent-dark); }
.stack input,
.stack select,
.stack textarea {
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font: inherit;
  background: var(--bg-muted);
  color: var(--text-main);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.stack input:focus,
.stack select:focus,
.stack textarea:focus {
  outline: none;
  border-color: var(--accent-brown);
  box-shadow: 0 0 0 3px rgba(139, 94, 60, 0.15);
}

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-end;
  margin-bottom: 0.75rem;
}
.row label { display: flex; flex-direction: column; gap: 0.25rem; font-weight: 600; color: var(--accent-dark); }
.row select, .row input { padding: 0.4rem 0.55rem; border: 1px solid var(--border-color); border-radius: var(--radius-sm); font: inherit; background: var(--bg-muted); }

.person-form { display: flex; flex-direction: column; gap: 1rem; }
.person-form label { display: flex; flex-direction: column; gap: 0.35rem; font-weight: 600; color: var(--accent-dark); }
.person-form input[type="text"],
.person-form input[type="date"],
.person-form textarea,
.person-form select {
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font: inherit;
  background: var(--bg-muted);
  color: var(--text-main);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.person-form input:focus,
.person-form textarea:focus,
.person-form select:focus {
  outline: none;
  border-color: var(--accent-brown);
  box-shadow: 0 0 0 3px rgba(139, 94, 60, 0.15);
}
.person-form textarea { resize: vertical; min-height: 4rem; }
.person-form textarea.mono { font-family: ui-monospace, monospace; font-size: 0.9rem; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 560px) { .form-row { grid-template-columns: 1fr; } }

.req { color: #b91c1c; }
.form-actions { display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap; margin-top: 0.5rem; }

.banner {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  margin-bottom: 1rem;
  font-weight: 500;
}
.banner.warn { background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; }
.banner.ok { background: #dcfce7; color: #166534; border: 1px solid #86efac; }

.toolbar { margin-bottom: 1rem; }

.checkbox-label { flex-direction: row !important; align-items: center; gap: 0.5rem; font-weight: 400 !important; }

/* ============================================================
   TABLES
   ============================================================ */
.table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.table th, .table td { border: 1px solid var(--border-color); padding: 0.5rem 0.65rem; text-align: left; }
.table thead { background: var(--bg-muted); }
.table thead th { color: var(--accent-dark); font-weight: 600; }
.table tbody tr:nth-child(even) { background: rgba(250, 246, 241, 0.5); }
.table tbody tr:hover { background: rgba(212, 184, 150, 0.12); }

.data-table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.data-table th, .data-table td { border: 1px solid var(--border-color); padding: 0.5rem 0.65rem; text-align: left; }
.data-table thead { background: var(--bg-muted); }
.data-table thead th { color: var(--accent-dark); font-weight: 600; }
.data-table thead a { color: inherit; text-decoration: none; }
.data-table thead a:hover { text-decoration: underline; }
.data-table tbody tr:nth-child(even) { background: rgba(250, 246, 241, 0.5); }
.data-table tbody tr:hover { background: rgba(212, 184, 150, 0.12); }

/* ============================================================
   PEOPLE LIST
   ============================================================ */
.people-list-wrap { overflow-x: auto; }
.people-list-table { min-width: 42rem; }
.people-list-table .people-col-thumb { width: 3.5rem; padding-right: 0.25rem; }
.people-list-table .people-col-name { min-width: 8rem; }
.people-list-table .people-col-given { min-width: 10rem; }
.people-list-table .people-col-place { max-width: 14rem; word-break: break-word; }
.people-list-table .people-col-id { width: 3.5rem; text-align: right; }
.people-list-table .person-list-thumb img {
  width: 40px; height: 40px; object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  vertical-align: middle;
}

/* Card grid for people */
.people-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1.25rem;
  list-style: none;
  padding: 0;
  margin: 0;
}
.people-card {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color-light);
  transition: box-shadow 0.3s ease, transform 0.2s ease;
}
.people-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-3px);
}
.people-card-img {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
}
.people-card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.5s ease;
}
.people-card:hover .people-card-img img {
  transform: scale(1.05);
}
.people-card-badge {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  color: #fff;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
}
.people-card-body {
  padding: 1rem;
}
.people-card-name {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--accent-dark);
  margin-bottom: 0.15rem;
}
.people-card-given {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}
.people-card-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.people-card-footer {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-color-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Filter bar */
.people-filter-bar { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 1rem; }
.people-filter-row { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: flex-end; }
.people-filter-row label { display: flex; flex-direction: column; gap: 0.25rem; font-weight: 600; color: var(--accent-dark); font-size: 0.9rem; }
.people-filter-row input,
.people-filter-row select {
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font: inherit;
  background: var(--bg-muted);
}

/* ============================================================
   PERSON DETAIL
   ============================================================ */
.profile-card {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color-light);
  margin-bottom: 1.5rem;
}
.profile-header {
  display: flex;
  flex-wrap: wrap;
}
.profile-photo {
  flex: 0 0 280px;
  max-width: 100%;
  position: relative;
  min-height: 280px;
  background: var(--bg-muted);
}
.profile-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  min-height: 280px;
}
.profile-info {
  flex: 1 1 0;
  padding: 1.5rem;
  min-width: 260px;
}
.profile-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-md);
  font-size: 0.8rem;
  font-weight: 600;
  border: 1px solid transparent;
}
.badge-blue { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }
.badge-pink { background: #fdf2f8; color: #be185d; border-color: #fbcfe8; }
.badge-green { background: #f0fdf4; color: #15803d; border-color: #bbf7d0; }
.badge-brown { background: var(--bg-muted); color: var(--accent-dark); border-color: var(--border-color); }

.profile-name {
  font-family: var(--font-serif);
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent-dark);
  margin-bottom: 0.25rem;
}
.profile-surname {
  font-size: 1.25rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.75rem;
}
.info-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem;
  background: var(--bg-muted);
  border-radius: var(--radius-md);
}
.info-item-icon {
  width: 1.25rem;
  height: 1.25rem;
  color: var(--accent-gold);
  flex-shrink: 0;
  margin-top: 0.1rem;
}
.info-item-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.15rem;
}
.info-item-value {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--accent-dark);
}

/* Sections */
.section-card {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color-light);
  margin-bottom: 1.5rem;
}
.section-title {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--accent-dark);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.section-title-icon {
  width: 1.25rem;
  height: 1.25rem;
  color: var(--accent-gold);
}

.relation-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.65rem 0.75rem;
  border-radius: var(--radius-md);
  transition: background 0.2s;
}
.relation-item:hover {
  background: var(--bg-muted);
}
.relation-avatar {
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border-color);
  flex-shrink: 0;
}
.relation-name {
  font-weight: 700;
  color: var(--accent-dark);
}
.relation-meta {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ============================================================
   PHOTOS
   ============================================================ */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1.25rem;
  list-style: none;
  padding: 0;
  margin: 0;
}
.photo-grid-item {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color-light);
  transition: box-shadow 0.3s ease, transform 0.2s ease;
}
.photo-grid-item:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-3px);
}
.photo-grid-item a { display: block; }
.photo-grid-item img {
  width: 100%;
  height: 140px;
  object-fit: cover;
  display: block;
  transition: transform 0.5s ease;
}
.photo-grid-item:hover img {
  transform: scale(1.05);
}
.photo-grid-item p {
  padding: 0.5rem 0.75rem;
  margin: 0;
  font-size: 0.85rem;
}

.photo-inline-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.photo-inline-list li {
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
}
.photo-inline-thumb img {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}
.photo-inline-meta { min-width: 0; }

/* ============================================================
   GRAPH
   ============================================================ */
.graph-canvas {
  width: 100%;
  height: 70vh;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  background: #fff;
}

.graph-canvas--tree {
  background: radial-gradient(ellipse 80% 60% at 50% 40%, #292524 0%, #1c1917 72%);
  border-color: #44403c;
}

.graph-tree-hint { margin: 0.35rem 0 0; }

.graph-panel {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 0.75rem 1rem 1rem;
  margin-bottom: 1rem;
  background: var(--bg-card);
}
.graph-panel legend {
  padding: 0 0.35rem;
  font-weight: 600;
  color: var(--accent-dark);
}

/* ============================================================
   PHOTO DETAIL / REGIONS
   ============================================================ */
.photo-viewport {
  position: relative;
  display: inline-block;
  max-width: 100%;
  margin: 0.5rem 0 1rem;
}
.photo-main-img {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}
.photo-hotspot {
  position: absolute;
  border: 2px solid rgba(59, 130, 246, 0.55);
  background: rgba(59, 130, 246, 0.12);
  box-sizing: border-box;
  border-radius: 4px;
}
.photo-hotspot:hover {
  background: rgba(59, 130, 246, 0.28);
  border-color: rgba(37, 99, 235, 0.9);
}
.photo-hotspot-face {
  border-color: rgba(239, 68, 68, 0.7);
  background: rgba(239, 68, 68, 0.15);
}
.photo-hotspot-face:hover {
  background: rgba(239, 68, 68, 0.35);
  border-color: rgba(220, 38, 38, 0.9);
}
.photo-face-number {
  position: absolute;
  top: 0;
  left: 0;
  background: rgba(220, 38, 38, 0.85);
  color: #fff;
  font-size: 11px;
  font-weight: bold;
  padding: 1px 4px;
  border-radius: 0 0 4px 0;
  line-height: 1;
  pointer-events: none;
}

.photo-draw-wrap {
  position: relative;
  display: inline-block;
  max-width: min(100%, 960px);
  margin: 0.5rem 0 1rem;
  align-self: flex-start;
}
.photo-draw-wrap img {
  display: block;
  max-width: 100%;
  height: auto;
  vertical-align: top;
  user-select: none;
}
.photo-draw-overlay {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  cursor: crosshair;
}
.photo-region-box {
  position: absolute;
  box-sizing: border-box;
  border: 2px solid rgba(34, 197, 94, 0.75);
  background: rgba(34, 197, 94, 0.12);
  pointer-events: none;
  z-index: 1;
}
.photo-region-box-pending {
  border: 2px dashed rgba(234, 179, 8, 0.85);
  background: rgba(234, 179, 8, 0.18);
}
.photo-region-number {
  position: absolute;
  top: -1px;
  left: -1px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 0.65rem;
  line-height: 1;
  padding: 1px 3px;
  border-radius: 2px;
  pointer-events: none;
}
.photo-region-pending-row { background: rgba(234, 179, 8, 0.06); }
.photo-draw-preview {
  position: absolute;
  box-sizing: border-box;
  border: 2px dashed rgba(59, 130, 246, 0.9);
  background: rgba(59, 130, 246, 0.15);
  pointer-events: none;
  z-index: 2;
}
.photo-regions-editor-table select { max-width: 18rem; }
.photo-regions-table-wrap { margin: 1rem 0; }

/* ============================================================
   AUDIT / ADMIN / MISC
   ============================================================ */
.audit-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  align-items: flex-end;
  margin: 1rem 0 1.25rem;
}
.audit-filters label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.9rem;
  color: var(--accent-dark);
}
.audit-filters input {
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font: inherit;
  min-width: 8rem;
  background: var(--bg-muted);
}
.audit-table-wrap { overflow-x: auto; }
.audit-detail { max-width: 18rem; word-break: break-word; }
pre.audit-json {
  margin: 0;
  max-width: 28rem;
  max-height: 12rem;
  overflow: auto;
  font-size: 0.75rem;
  white-space: pre-wrap;
  word-break: break-word;
  background: var(--bg-muted);
  padding: 0.5rem;
  border-radius: var(--radius-sm);
}

.grid-dl {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 0.35rem 1rem;
}
.grid-dl dt { font-weight: 600; color: #5c4a3a; }

.person-list { list-style: none; padding: 0; }
.person-list li { padding: 0.35rem 0; border-bottom: 1px solid var(--border-color); }

.dup-list { list-style: none; padding: 0; margin: 0; }
.dup-item { border-bottom: 1px solid var(--border-color); padding: 1rem 0; }
.dup-item:last-child { border-bottom: none; }
.dup-reasons { margin: 0.35rem 0 0 1rem; padding: 0; }
.dup-actions { margin: 0.5rem 0; display: flex; flex-wrap: wrap; gap: 0.5rem; }

.merge-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin: 1rem 0;
}
@media (max-width: 640px) { .merge-grid { grid-template-columns: 1fr; } }
.merge-col { border: 1px solid var(--border-color); border-radius: var(--radius-md); padding: 0.75rem 1rem; }
.merge-col h2 { margin-top: 0; font-size: 1rem; }
.muted-merge { background: var(--bg-muted); }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.inline-role-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
}
.inline-role-form select {
  padding: 0.3rem 0.45rem;
  font: inherit;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-muted);
}

.inline-form { display: inline; margin-left: 0.5rem; vertical-align: baseline; }

.form-card { max-width: 800px; }

.person-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem 2rem;
  margin-bottom: 0.75rem;
}
.person-form-grid .col-left,
.person-form-grid .col-right {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
@media (max-width: 640px) {
  .person-form-grid { grid-template-columns: 1fr; }
}

.collapsible-block details summary {
  font-weight: 600;
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0.25rem 0;
  color: var(--accent-dark);
}
.collapsible-block details[open] summary {
  margin-bottom: 0.5rem;
}

.person-photo-sources {
  list-style: none;
  padding: 0;
  margin: 0 0 1.25rem;
}
.person-photo-source-item { margin-bottom: 1rem; }
.person-photo-source-head { margin-bottom: 0.35rem; }
.person-photo-source-photos { margin: 0; padding-left: 1.25rem; }

/* ============================================================
   PHOTO MASONRY
   ============================================================ */
.photo-masonry {
  columns: 1;
  column-gap: 1.25rem;
}
@media (min-width: 640px) { .photo-masonry { columns: 2; } }
@media (min-width: 1024px) { .photo-masonry { columns: 3; } }
.photo-masonry-item {
  break-inside: avoid;
  margin-bottom: 1.25rem;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color-light);
  transition: box-shadow 0.3s ease, transform 0.2s ease;
}
.photo-masonry-item:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-3px);
}
.photo-masonry-item img {
  width: 100%;
  display: block;
  transition: transform 0.5s ease;
}
.photo-masonry-item:hover img {
  transform: scale(1.05);
}
.photo-masonry-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0);
  transition: background 0.3s;
}
.photo-masonry-item:hover .photo-masonry-overlay {
  background: rgba(0,0,0,0.1);
}

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-card {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  padding: 2rem;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-color-light);
  max-width: 400px;
  margin: 3rem auto;
}
.login-card h1 {
  text-align: center;
  margin-bottom: 0.25rem;
}
.login-card .muted {
  text-align: center;
  margin-bottom: 1.5rem;
}

/* ============================================================
   HERO (optional, for future use)
   ============================================================ */
.hero {
  position: relative;
  min-height: 50vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem;
  border-radius: var(--radius-xl);
  overflow: hidden;
  margin-bottom: 2rem;
  background: linear-gradient(135deg, #3d2518 0%, #2c1810 100%);
}
.hero-inner {
  position: relative;
  z-index: 1;
  color: #f5e6d3;
}
.hero h1 {
  color: #f5e6d3;
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
}
.hero p {
  color: #d4b896;
  font-size: 1.15rem;
  max-width: 600px;
  margin: 0 auto 1.5rem;
}
.hero-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* Stats row */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}
.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  padding: 1.25rem;
  text-align: center;
  border: 1px solid var(--border-color-light);
  box-shadow: var(--shadow-sm);
}
.stat-value {
  font-family: var(--font-serif);
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--accent-dark);
}
.stat-label {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ============================================================
   RESPONSIVE UTILITIES
   ============================================================ */
@media (max-width: 640px) {
  .container { padding: 0.75rem; }
  .profile-photo { flex: 0 0 100%; min-height: 220px; }
  .profile-name { font-size: 1.5rem; }
  .photo-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
  .people-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
}
