/* ============================================================
   PINCKNEY FAMILY ARCHIVE — GLOBAL STYLES
   styles.css
   ============================================================ */

/* ── Design tokens ────────────────────────────────────────── */
:root {
  --parchment:      #f5efe0;
  --parchment-dark: #e8ddc8;
  --parchment-mid:  #ede3ce;
  --ink:            #1a1208;
  --ink-light:      #3d2f1a;
  --sepia:          #8b6914;
  --sepia-light:    #c4993a;
  --sepia-pale:     rgba(196,153,58,0.12);
  --connector:      #c8b080;
  --white:          #ffffff;
  --shadow-sm:      0 1px 4px rgba(26,18,8,0.08);
  --shadow-md:      0 4px 14px rgba(26,18,8,0.13);
  --shadow-lg:      0 8px 28px rgba(26,18,8,0.18);
  --radius:         3px;
  --radius-lg:      6px;

  /* Status colours */
  --s-unreviewed: #9e9e9e;
  --s-submitted:  #e8a020;
  --s-review:     #d4601a;
  --s-tentative:  #3a7abf;
  --s-verified:   #2d7a45;

  /* Layout */
  --header-h:  54px;
  --toolbar-h: 42px;
  --legend-h:  36px;
  --nav-total: calc(var(--header-h) + var(--toolbar-h) + var(--legend-h));

  /* Typography */
  --font-display: 'Playfair Display', Georgia, serif;
  --font-body:    'Crimson Pro', Georgia, serif;
}

/* ── Reset ────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  background: var(--parchment);
  color: var(--ink);
  min-height: 100vh;
  background-image:
    radial-gradient(ellipse at 15% 15%, rgba(196,153,58,0.06) 0%, transparent 55%),
    radial-gradient(ellipse at 85% 85%, rgba(139,105,20,0.04) 0%, transparent 55%);
}
img { display: block; max-width: 100%; }
button { cursor: pointer; font-family: var(--font-body); }
input, textarea, select { font-family: var(--font-body); }
a { color: var(--sepia); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Loading screen ───────────────────────────────────────── */
#app-loading {
  position: fixed; inset: 0;
  background: var(--ink);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 16px; z-index: 9999;
  transition: opacity 0.4s;
}
#app-loading h1 {
  font-family: var(--font-display);
  color: var(--parchment);
  font-size: 1.6rem;
  letter-spacing: 0.04em;
}
#app-loading h1 em { color: var(--sepia-light); font-style: italic; font-weight: 400; }
#app-loading .spinner {
  width: 32px; height: 32px;
  border: 2px solid rgba(196,153,58,0.3);
  border-top-color: var(--sepia-light);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
#app-loading.hidden { opacity: 0; pointer-events: none; }

/* ── Header ───────────────────────────────────────────────── */
#app-header {
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: var(--ink);
  border-bottom: 3px solid var(--sepia);
  display: flex; align-items: center;
  padding: 0 24px; gap: 20px;
  z-index: 50;
}
#app-header .logo {
  font-family: var(--font-display);
  color: var(--parchment);
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  white-space: nowrap;
  cursor: pointer;
}
#app-header .logo em {
  color: var(--sepia-light);
  font-style: italic;
  font-weight: 400;
  font-size: 1rem;
}
#app-header nav {
  display: flex; align-items: center; gap: 4px; flex: 1;
}
.nav-link {
  color: var(--parchment-dark);
  font-size: 0.82rem;
  padding: 5px 12px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  transition: all 0.15s;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.nav-link:hover, .nav-link.active {
  background: var(--sepia-pale);
  border-color: rgba(196,153,58,0.3);
  color: var(--sepia-light);
  text-decoration: none;
}
.nav-link.active { color: var(--sepia-light); font-weight: 600; }
.nav-sep { width: 1px; height: 18px; background: rgba(196,153,58,0.2); margin: 0 4px; }
#header-right {
  display: flex; align-items: center; gap: 12px; margin-left: auto;
}
.user-badge {
  background: rgba(196,153,58,0.15);
  border: 1px solid var(--sepia);
  padding: 3px 10px;
  border-radius: var(--radius);
  color: var(--sepia-light);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.admin-badge {
  background: rgba(45,122,69,0.2);
  border: 1px solid #2d7a45;
  color: #5aad7a;
  font-size: 0.68rem;
  padding: 2px 7px;
  border-radius: 10px;
  letter-spacing: 0.05em;
}
.btn-signout {
  background: none; border: none;
  color: var(--sepia-light); font-size: 0.75rem;
  opacity: 0.5; transition: opacity 0.15s;
  padding: 4px 8px;
}
.btn-signout:hover { opacity: 1; }

/* ── Banner strip ─────────────────────────────────────────── */
#banner-strip {
  position: fixed;
  top: var(--header-h); left: 0; right: 0;
  z-index: 39;
  display: none; /* shown when banner items exist */
}
#banner-strip.visible { display: block; }
.banner-inner {
  background: var(--ink-light);
  border-bottom: 2px solid var(--sepia);
  padding: 7px 24px;
  display: flex; align-items: center; gap: 12px;
  overflow-x: auto; white-space: nowrap;
}
.banner-item {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(196,153,58,0.12);
  border: 1px solid rgba(196,153,58,0.3);
  border-radius: var(--radius);
  padding: 3px 10px;
  font-size: 0.76rem;
  color: var(--parchment-dark);
  cursor: pointer;
  transition: background 0.15s;
  text-decoration: none;
}
.banner-item:hover { background: rgba(196,153,58,0.22); color: var(--parchment); }
.banner-item .bi-icon { font-size: 0.85rem; }
.banner-item .bi-date { color: var(--sepia-light); font-size: 0.7rem; }
.banner-book {
  margin-left: auto;
  background: var(--sepia);
  border: none;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 0.75rem;
  padding: 4px 12px;
  border-radius: var(--radius);
  flex-shrink: 0;
}
.banner-book:hover { opacity: 0.85; }

/* ── Page content area ────────────────────────────────────── */
#page-content {
  margin-top: var(--header-h);
  min-height: calc(100vh - var(--header-h));
  transition: margin-top 0.2s;
  position: relative;
  z-index: 1;
}
#page-content.with-banner { margin-top: calc(var(--header-h) + 38px); }

/* ── Page sections ────────────────────────────────────────── */
.page-section {
  padding: 24px 28px 60px;
}
.page-header {
  font-family: var(--font-display);
  font-size: 1rem;
  color: var(--sepia);
  border-bottom: 1px solid var(--parchment-dark);
  padding-bottom: 8px;
  margin-bottom: 22px;
  font-style: italic;
}

/* ── Toolbar ──────────────────────────────────────────────── */
.toolbar {
  background: var(--ink-light);
  padding: 0 24px;
  height: var(--toolbar-h);
  display: flex; align-items: center; gap: 14px;
  border-bottom: 1px solid rgba(196,153,58,0.15);
  flex-wrap: nowrap;
  overflow-x: auto;
}
.toolbar-label {
  color: var(--parchment-dark);
  font-size: 0.72rem;
  opacity: 0.55;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  white-space: nowrap;
}
.toolbar-sep { width: 1px; height: 20px; background: rgba(196,153,58,0.18); flex-shrink: 0; }
.tab-btn {
  background: transparent;
  border: 1px solid rgba(196,153,58,0.3);
  color: var(--parchment-dark);
  padding: 4px 13px;
  font-family: var(--font-body);
  font-size: 0.8rem;
  border-radius: var(--radius);
  transition: all 0.15s;
  white-space: nowrap;
}
.tab-btn:hover, .tab-btn.active {
  background: var(--sepia);
  color: var(--ink);
  border-color: var(--sepia);
}
.toolbar-action {
  margin-left: auto;
  background: var(--sepia);
  color: var(--ink);
  border: none;
  padding: 5px 14px;
  font-family: var(--font-display);
  font-size: 0.8rem;
  border-radius: var(--radius);
  transition: opacity 0.15s;
  flex-shrink: 0;
}
.toolbar-action:hover { opacity: 0.85; }

/* ── Legend strip ─────────────────────────────────────────── */
.legend-strip {
  background: var(--parchment-dark);
  border-bottom: 1px solid var(--connector);
  padding: 6px 24px;
  display: flex; align-items: center; gap: 14px;
  flex-wrap: wrap;
}
.legend-label {
  font-size: 0.68rem;
  opacity: 0.52;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.legend-item { display: flex; align-items: center; gap: 5px; font-size: 0.74rem; color: var(--ink-light); }
.legend-pip { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }

/* ── Person cards ─────────────────────────────────────────── */
.person-card {
  width: 158px;
  background: var(--white);
  border: 1.5px solid var(--parchment-dark);
  border-radius: var(--radius);
  padding: 10px 10px 8px;
  position: relative;
  cursor: pointer;
  transition: transform 0.14s, box-shadow 0.14s;
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
  user-select: none;
}
.person-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.person-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0;
  height: 3px;
  border-radius: var(--radius) var(--radius) 0 0;
}
.s-unreviewed::before { background: var(--s-unreviewed); }
.s-submitted::before  { background: var(--s-submitted); }
.s-review::before     { background: var(--s-review); }
.s-tentative::before  { background: var(--s-tentative); }
.s-verified::before   { background: var(--s-verified); }

.card-photo {
  width: 36px; height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid var(--parchment-dark);
  float: right; margin: 0 0 4px 6px;
}
.card-name {
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.25;
  margin-bottom: 2px;
}
.card-dates { font-size: 0.67rem; color: var(--ink-light); opacity: 0.72; font-style: italic; margin-bottom: 2px; }
.card-place { font-size: 0.65rem; color: var(--sepia); opacity: 0.8; margin-bottom: 6px; }
.card-btns  { display: flex; gap: 3px; clear: both; }
.btn-sm {
  flex: 1;
  font-size: 0.63rem;
  padding: 3px 4px;
  border: none;
  border-radius: var(--radius);
  transition: opacity 0.14s;
  white-space: nowrap;
  font-family: var(--font-body);
}
.btn-edit-sm   { background: var(--sepia); color: white; }
.btn-expand-sm { background: var(--parchment-dark); color: var(--ink-light); }
.btn-sm:hover  { opacity: 0.78; }

/* Ghost / add card */
.ghost-card {
  width: 158px;
  background: transparent;
  border: 1.5px dashed var(--connector);
  border-radius: var(--radius);
  padding: 10px;
  cursor: pointer;
  flex-shrink: 0;
  transition: border-color 0.15s, background 0.15s;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  min-height: 76px; gap: 4px;
}
.ghost-card:hover { border-color: var(--sepia); background: rgba(139,105,20,0.04); }
.ghost-label { font-size: 0.72rem; color: var(--sepia); opacity: 0.7; font-style: italic; }
.ghost-icon  { font-size: 1rem; color: var(--sepia); opacity: 0.5; }

/* Partner dash */
.partner-dash {
  width: 158px; display: flex;
  align-items: center; justify-content: center;
  flex-shrink: 0; opacity: 0.3;
}
.partner-dash span { font-size: 1.3rem; color: var(--connector); letter-spacing: 0.12em; }

/* ── Union connector elements ─────────────────────────────── */
.union-year {
  font-size: 0.63rem; color: var(--sepia);
  font-style: italic; flex-shrink: 0;
  padding: 0 2px; align-self: center;
}
.union-line { background: var(--connector); flex-shrink: 0; }
.union-line-h { height: 1px; width: 24px; }
.union-line-v { width: 1px; }

/* ── Buttons (global) ─────────────────────────────────────── */
.btn-primary {
  background: var(--sepia); color: white;
  border: none; padding: 8px 20px;
  font-family: var(--font-display); font-size: 0.88rem;
  border-radius: var(--radius); transition: opacity 0.15s;
}
.btn-primary:hover { opacity: 0.85; }
.btn-ghost {
  background: transparent; color: var(--ink-light);
  border: 1px solid var(--parchment-dark); padding: 7px 14px;
  font-family: var(--font-body); font-size: 0.88rem;
  border-radius: var(--radius);
}
.btn-ghost:hover { border-color: var(--sepia); }
.btn-danger {
  background: #b83232; color: white;
  border: none; padding: 7px 14px;
  font-family: var(--font-body); font-size: 0.85rem;
  border-radius: var(--radius); transition: opacity 0.15s;
}
.btn-danger:hover { opacity: 0.85; }
.btn-success {
  background: var(--s-verified); color: white;
  border: none; padding: 7px 14px;
  font-family: var(--font-body); font-size: 0.85rem;
  border-radius: var(--radius); transition: opacity 0.15s;
}
.btn-success:hover { opacity: 0.85; }

/* ── Form elements ────────────────────────────────────────── */
.form-group { margin-bottom: 14px; }
.form-label {
  display: block;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--ink-light);
  opacity: 0.65;
  margin-bottom: 4px;
}
.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 7px 10px;
  font-family: var(--font-body);
  font-size: 0.9rem;
  background: var(--white);
  border: 1px solid var(--parchment-dark);
  border-radius: var(--radius);
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--sepia);
  box-shadow: 0 0 0 2px rgba(196,153,58,0.15);
}
.form-input::placeholder, .form-textarea::placeholder {
  color: var(--ink-light); opacity: 0.35; font-style: italic;
}
.form-input.readonly, .f-current {
  background: var(--parchment-mid);
  border-color: var(--parchment-dark);
  color: var(--ink-light);
}
.form-textarea { min-height: 72px; resize: vertical; }
.form-row { display: flex; gap: 10px; }
.form-row .form-group { flex: 1; }
.form-hint { font-size: 0.72rem; color: var(--ink-light); opacity: 0.55; margin-top: 3px; font-style: italic; }
.form-error { font-size: 0.75rem; color: #b83232; margin-top: 3px; }

/* Edit field row: current → proposed */
.edit-row { display: flex; gap: 6px; align-items: center; }
.edit-arrow { font-size: 0.75rem; color: var(--connector); flex-shrink: 0; }
.edit-current {
  flex: 1; padding: 5px 9px;
  font-family: var(--font-body); font-size: 0.88rem;
  background: var(--parchment-mid);
  border: 1px solid var(--parchment-dark);
  border-radius: var(--radius);
  color: var(--ink-light); min-width: 0;
}
.edit-proposed {
  flex: 1; padding: 5px 9px;
  font-family: var(--font-body); font-size: 0.88rem;
  background: var(--white);
  border: 1px solid var(--sepia);
  border-radius: var(--radius);
  color: var(--ink); outline: none; min-width: 0;
}
.edit-proposed:focus {
  border-color: var(--sepia-light);
  box-shadow: 0 0 0 2px rgba(196,153,58,0.18);
}
.edit-proposed::placeholder { color: var(--ink-light); opacity: 0.35; font-style: italic; }

/* ── Modal ────────────────────────────────────────────────── */
.overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(26,18,8,0.55);
  z-index: 100; align-items: center; justify-content: center;
  padding: 20px;
}
.overlay.open { display: flex; }
.modal {
  background: var(--parchment);
  border: 2px solid var(--sepia);
  border-radius: var(--radius-lg);
  padding: 26px 28px 22px;
  width: 480px; max-width: 100%;
  max-height: 88vh; overflow-y: auto;
  position: relative;
}
.modal-lg { width: 640px; }
.modal-sm { width: 380px; }
.modal-close {
  position: absolute; top: 12px; right: 14px;
  background: none; border: none;
  font-size: 1.1rem; color: var(--ink-light);
  opacity: 0.4; transition: opacity 0.15s;
}
.modal-close:hover { opacity: 1; }
.modal-title {
  font-family: var(--font-display);
  font-size: 1.15rem; margin-bottom: 2px;
}
.modal-sub { font-size: 0.78rem; color: var(--sepia); font-style: italic; margin-bottom: 14px; }
.modal-section {
  font-size: 0.68rem;
  text-transform: uppercase; letter-spacing: 0.09em;
  color: var(--sepia);
  border-bottom: 1px solid var(--parchment-dark);
  padding-bottom: 4px;
  margin: 18px 0 12px;
}
.modal-footer {
  display: flex; gap: 10px; justify-content: flex-end;
  margin-top: 20px; padding-top: 16px;
  border-top: 1px solid var(--parchment-dark);
}

/* Status pill */
.status-pill {
  display: inline-block;
  font-size: 0.68rem; padding: 2px 10px;
  border-radius: 10px; color: white;
  margin-bottom: 14px; letter-spacing: 0.04em;
}

/* ── Cards (events, announcements, queue items) ───────────── */
.card {
  background: var(--white);
  border: 1.5px solid var(--parchment-dark);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.15s;
}
.card:hover { box-shadow: var(--shadow-md); }
.card-header {
  display: flex; align-items: flex-start;
  justify-content: space-between; gap: 12px;
  margin-bottom: 8px;
}
.card-title {
  font-family: var(--font-display);
  font-size: 1rem; font-weight: 600;
}
.card-meta { font-size: 0.75rem; color: var(--sepia); font-style: italic; }
.card-body { font-size: 0.9rem; line-height: 1.55; color: var(--ink-light); }
.card-footer {
  margin-top: 12px; padding-top: 10px;
  border-top: 1px solid var(--parchment-dark);
  display: flex; align-items: center; gap: 10px;
  flex-wrap: wrap;
}

/* Event type badge */
.type-badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 0.72rem; padding: 2px 9px;
  border-radius: 10px; color: white;
}

/* ── Table ────────────────────────────────────────────────── */
.data-table { width: 100%; border-collapse: collapse; font-size: 0.87rem; }
.data-table th {
  text-align: left; padding: 8px 12px;
  font-size: 0.68rem; text-transform: uppercase;
  letter-spacing: 0.07em; color: var(--sepia);
  border-bottom: 2px solid var(--parchment-dark);
  white-space: nowrap;
}
.data-table td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--parchment-dark);
  vertical-align: middle;
}
.data-table tr:hover td { background: rgba(196,153,58,0.04); }
.data-table .actions { display: flex; gap: 6px; }

/* ── Search bar ───────────────────────────────────────────── */
.search-wrap {
  position: relative; flex: 1; max-width: 320px;
}
.search-input {
  width: 100%; padding: 6px 10px 6px 32px;
  font-family: var(--font-body); font-size: 0.85rem;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(196,153,58,0.3);
  border-radius: var(--radius);
  color: var(--parchment-dark); outline: none;
  transition: all 0.15s;
}
.search-input::placeholder { color: var(--parchment-dark); opacity: 0.4; }
.search-input:focus {
  background: rgba(255,255,255,0.12);
  border-color: var(--sepia);
  color: var(--parchment);
}
.search-icon {
  position: absolute; left: 9px; top: 50%;
  transform: translateY(-50%);
  font-size: 0.85rem; opacity: 0.45; pointer-events: none;
}
.search-results {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0;
  background: var(--ink);
  border: 1px solid var(--sepia);
  border-radius: var(--radius);
  max-height: 280px; overflow-y: auto;
  z-index: 60; box-shadow: var(--shadow-lg);
  display: none;
}
.search-results.open { display: block; }
.search-result-item {
  padding: 8px 12px; cursor: pointer;
  border-bottom: 1px solid rgba(196,153,58,0.1);
  transition: background 0.12s;
}
.search-result-item:hover { background: rgba(196,153,58,0.12); }
.search-result-item:last-child { border-bottom: none; }
.sri-name { font-size: 0.85rem; color: var(--parchment); }
.sri-dates { font-size: 0.72rem; color: var(--sepia-light); font-style: italic; }

/* ── Toast ────────────────────────────────────────────────── */
#toast-container {
  position: fixed; bottom: 80px; right: 24px;
  display: flex; flex-direction: column; gap: 8px;
  z-index: 500; pointer-events: none;
}
.toast {
  background: var(--ink); color: var(--parchment);
  padding: 10px 16px; border-radius: var(--radius);
  font-size: 0.82rem; max-width: 320px;
  box-shadow: var(--shadow-lg);
  border-left: 4px solid var(--sepia);
  opacity: 0; transform: translateX(20px);
  transition: all 0.28s;
  pointer-events: auto;
}
.toast.show { opacity: 1; transform: translateX(0); }
.toast.toast-success { border-color: var(--s-verified); }
.toast.toast-error   { border-color: #b83232; }
.toast.toast-info    { border-color: var(--s-tentative); }

/* ── Feedback button ──────────────────────────────────────── */
#feedback-btn {
  position: fixed; bottom: 24px; right: 24px;
  z-index: 400;
}
#feedback-toggle {
  width: 42px; height: 42px;
  background: var(--ink);
  border: 2px solid var(--sepia);
  border-radius: 50%;
  color: var(--sepia-light);
  font-size: 1rem;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-md);
  transition: all 0.18s;
}
#feedback-toggle:hover { background: var(--ink-light); transform: scale(1.08); }
#feedback-menu {
  position: absolute; bottom: 50px; right: 0;
  background: var(--ink);
  border: 1px solid var(--sepia);
  border-radius: var(--radius-lg);
  padding: 8px;
  display: none; flex-direction: column; gap: 4px;
  min-width: 180px; box-shadow: var(--shadow-lg);
}
#feedback-menu.open { display: flex; }
.feedback-option {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; border-radius: var(--radius);
  color: var(--parchment-dark); font-size: 0.82rem;
  text-decoration: none; transition: background 0.15s;
  white-space: nowrap;
}
.feedback-option:hover {
  background: rgba(196,153,58,0.12);
  color: var(--parchment);
  text-decoration: none;
}
.feedback-option .fo-icon { font-size: 0.9rem; }

/* ── Auth pages ───────────────────────────────────────────── */
.auth-page {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.auth-card {
  background: var(--white);
  border: 2px solid var(--sepia);
  border-radius: var(--radius-lg);
  padding: 36px 40px;
  width: 400px; max-width: 100%;
  box-shadow: var(--shadow-lg);
}
.auth-title {
  font-family: var(--font-display);
  font-size: 1.5rem; text-align: center;
  margin-bottom: 4px;
}
.auth-subtitle {
  font-size: 0.82rem; color: var(--sepia);
  text-align: center; font-style: italic;
  margin-bottom: 28px;
}
.auth-link {
  text-align: center; margin-top: 16px;
  font-size: 0.82rem; color: var(--ink-light);
}
.auth-error {
  background: rgba(184,50,50,0.08);
  border: 1px solid rgba(184,50,50,0.3);
  border-radius: var(--radius);
  padding: 8px 12px;
  font-size: 0.82rem; color: #b83232;
  margin-bottom: 16px;
  display: none;
}
.auth-error.visible { display: block; }

/* ── Admin queue badges ───────────────────────────────────── */
.queue-count {
  display: inline-block;
  background: var(--s-submitted);
  color: white; font-size: 0.65rem;
  padding: 1px 6px; border-radius: 10px;
  margin-left: 4px; font-style: normal;
  font-family: var(--font-body);
}

/* ── Scroll area for tree ─────────────────────────────────── */
.tree-scroll {
  overflow-x: auto; overflow-y: auto;
  padding: 24px 28px 80px;
}

/* ── Empty state ──────────────────────────────────────────── */
.empty-state {
  text-align: center; padding: 60px 20px;
  color: var(--ink-light); opacity: 0.55;
}
.empty-state .es-icon { font-size: 2.5rem; margin-bottom: 12px; }
.empty-state .es-text { font-size: 0.95rem; font-style: italic; }

/* ── Spinner (inline) ─────────────────────────────────────── */
.spinner-sm {
  display: inline-block;
  width: 16px; height: 16px;
  border: 2px solid var(--parchment-dark);
  border-top-color: var(--sepia);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 768px) {
  #app-header { padding: 0 14px; }
  #app-header .logo em { display: none; }
  .nav-link { padding: 4px 8px; font-size: 0.76rem; }
  .page-section { padding: 16px 14px 60px; }
  .toolbar { padding: 0 14px; }
  .legend-strip { padding: 5px 14px; }
  .modal { padding: 20px 18px 18px; }
  .auth-card { padding: 28px 22px; }
  .person-card { width: 138px; }
  .ghost-card { width: 138px; }
  .partner-dash { width: 138px; }
  .form-row { flex-direction: column; gap: 0; }
  .edit-row { flex-direction: column; gap: 4px; }
  .edit-arrow { display: none; }
}

@media (max-width: 480px) {
  #app-header nav .nav-link:not(.always-show) { display: none; }
  .data-table th:nth-child(n+4),
  .data-table td:nth-child(n+4) { display: none; }
}

/* ── Book viewer ──────────────────────────────────────────── */
.book-viewer {
  display: grid;
  grid-template-columns: 260px 1fr;
  height: calc(100vh - var(--nav-total));
  overflow: hidden;
}
.book-sidebar {
  background: var(--parchment-dark);
  border-right: 1px solid var(--connector);
  overflow-y: auto; padding: 14px;
}
.book-main { overflow-y: auto; padding: 24px 32px; }
.book-page-thumb {
  width: 100%; aspect-ratio: 3/4;
  object-fit: cover; border-radius: var(--radius);
  border: 1px solid var(--connector);
  cursor: pointer; transition: opacity 0.15s;
  margin-bottom: 8px;
}
.book-page-thumb:hover { opacity: 0.85; }
.book-page-thumb.active { border-color: var(--sepia); box-shadow: 0 0 0 2px var(--sepia); }
.book-page-image {
  max-width: 100%; border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  margin-bottom: 24px;
}
.book-passage {
  font-size: 1rem; line-height: 1.7;
  color: var(--ink);
  background: var(--white);
  border: 1px solid var(--parchment-dark);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-top: 12px;
}
.book-passage mark {
  background: rgba(196,153,58,0.25);
  border-radius: 2px; padding: 0 2px;
}
.passage-corrected {
  background: rgba(232,160,32,0.12);
  border-bottom: 2px solid var(--s-submitted);
  cursor: pointer;
}
.passage-corrected:hover { background: rgba(232,160,32,0.2); }

/* ── Family hub ───────────────────────────────────────────── */
.hub-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 24px;
  padding: 24px 28px 60px;
}
@media (max-width: 900px) {
  .hub-grid { grid-template-columns: 1fr; }
}
.hub-section-title {
  font-family: var(--font-display);
  font-size: 1.05rem; color: var(--sepia);
  border-bottom: 1px solid var(--parchment-dark);
  padding-bottom: 8px; margin-bottom: 16px;
  font-style: italic;
}
.events-list { display: flex; flex-direction: column; gap: 14px; }
.links-list { display: flex; flex-direction: column; gap: 8px; }
.link-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 12px;
  background: var(--white);
  border: 1px solid var(--parchment-dark);
  border-radius: var(--radius);
  text-decoration: none;
  transition: box-shadow 0.15s;
  color: var(--ink);
}
.link-item:hover { box-shadow: var(--shadow-sm); text-decoration: none; }
.link-item .li-icon { font-size: 1.1rem; flex-shrink: 0; margin-top: 1px; }
.link-item .li-title { font-size: 0.88rem; font-weight: 600; }
.link-item .li-desc  { font-size: 0.76rem; color: var(--ink-light); opacity: 0.7; margin-top: 2px; }

/* ── Utility ──────────────────────────────────────────────── */
.text-sepia   { color: var(--sepia); }
.text-muted   { color: var(--ink-light); opacity: 0.6; }
.text-sm      { font-size: 0.8rem; }
.text-xs      { font-size: 0.72rem; }
.italic       { font-style: italic; }
.bold         { font-weight: 600; }
.mt-8         { margin-top: 8px; }
.mt-16        { margin-top: 16px; }
.mt-24        { margin-top: 24px; }
.mb-8         { margin-bottom: 8px; }
.mb-16        { margin-bottom: 16px; }
.flex         { display: flex; }
.flex-center  { display: flex; align-items: center; }
.gap-8        { gap: 8px; }
.gap-12       { gap: 12px; }
.gap-16       { gap: 16px; }
.hidden       { display: none !important; }
.w-full       { width: 100%; }
