/* ===== CHRONOLORE SAFE RECORD BUILDER =====
   Additive styles only. It does not replace the People system.
*/
.people-archive-shell {
  width: min(1440px, calc(100vw - var(--sidebar-width, 220px) - 64px));
  margin: 0 auto;
  padding: 94px 28px 60px;
}
.people-archive-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  margin-bottom: 18px;
}
.people-archive-header h1 {
  margin: 0;
  font-family: var(--heading-font, 'Cinzel', serif);
  font-size: clamp(34px, 4vw, 58px);
}
.people-archive-header p { max-width: 620px; opacity: .76; line-height: 1.55; }
.people-archive-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.archive-button {
  border: 1px solid rgba(214,179,106,.38);
  background: rgba(0,0,0,.32);
  color: var(--text);
  padding: 9px 12px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  letter-spacing: .6px;
  cursor: pointer;
}
.archive-button:hover,
.archive-button.primary {
  background: var(--accent);
  color: #060706;
  box-shadow: 0 0 18px color-mix(in srgb, var(--accent) 45%, transparent);
}
.people-filter-panel {
  display: grid;
  grid-template-columns: repeat(5, minmax(140px, 1fr));
  gap: 10px;
  padding: 14px;
  border: 1px solid rgba(214,179,106,.16);
  background: linear-gradient(180deg, rgba(10,10,8,.72), rgba(0,0,0,.42));
  box-shadow: 0 20px 70px rgba(0,0,0,.35), inset 0 0 35px rgba(0,0,0,.32);
  margin-bottom: 18px;
}
.people-filter-panel label,
.entity-editor-grid label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  letter-spacing: .8px;
  text-transform: uppercase;
  color: rgba(245,222,179,.72);
}
.people-filter-panel .wide,
.entity-editor-grid .wide { grid-column: span 2; }
.people-filter-panel input,
.people-filter-panel select,
.entity-editor-grid input,
.entity-editor-grid select,
.entity-editor-grid textarea {
  width: 100%;
  border: 1px solid rgba(214,179,106,.25);
  background: rgba(0,0,0,.32);
  color: var(--text);
  padding: 9px 10px;
  outline: none;
  border-radius: 4px;
  font: 13px/1.25 'Inter', sans-serif;
}
.people-filter-panel input:focus,
.people-filter-panel select:focus,
.entity-editor-grid input:focus,
.entity-editor-grid select:focus,
.entity-editor-grid textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 22%, transparent);
}
.people-archive-count { opacity: .66; margin: 8px 0 14px; font-family: 'IBM Plex Mono', monospace; font-size: 12px; }
.people-entity-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.people-empty { grid-column: 1 / -1; padding: 30px; border: 1px dashed rgba(255,255,255,.15); text-align: center; opacity: .72; }
.entity-card {
  min-height: 300px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: left;
  border: 1px solid rgba(214,179,106,.25);
  background: rgba(0,0,0,.35);
  color: var(--text);
  padding: 10px;
  cursor: pointer;
  transition: .22s ease;
}
.entity-card:hover { transform: translateY(-4px); border-color: var(--accent); box-shadow: 0 0 24px rgba(214,179,106,.18); }
.entity-card-image { flex: 1; min-height: 180px; overflow: hidden; border: 1px solid rgba(255,255,255,.10); background: #050505; }
.entity-card-image img { width: 100%; height: 100%; object-fit: cover; display: block; }
.entity-card-body { display: flex; flex-direction: column; gap: 5px; }
.entity-record-stamp { color: var(--accent); font: 10px/1.2 'IBM Plex Mono', monospace; text-transform: uppercase; letter-spacing: .8px; }
.entity-card strong { font-family: 'Cinzel', serif; font-size: 18px; }
.entity-card small { opacity: .76; }
.entity-card em { opacity: .58; font-size: 12px; }

.entity-dossier-modal,
.entity-editor-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 8800;
  background: rgba(0,0,0,.72);
  backdrop-filter: blur(6px);
  padding: 26px;
}
.entity-dossier-modal.open,
.entity-editor-modal.open { display: flex; }
.entity-dossier-backdrop,
.entity-editor-backdrop { position: absolute; inset: 0; }
.entity-dossier-card,
.entity-editor-card {
  position: relative;
  z-index: 2;
  width: min(1080px, 92vw);
  max-height: 90vh;
  overflow: auto;
  border: 1px solid rgba(214,179,106,.32);
  background: linear-gradient(135deg, #17100a, #070706);
  color: #f3e7cc;
  box-shadow: 0 40px 120px rgba(0,0,0,.75);
}
.entity-dossier-close,
.entity-editor-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 4;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid rgba(214,179,106,.45);
  background: rgba(0,0,0,.55);
  color: inherit;
  cursor: pointer;
}
.entity-dossier-card { display: grid; grid-template-columns: minmax(280px, 38%) 1fr; }
.entity-dossier-media { min-height: 520px; }
.entity-dossier-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.entity-dossier-body { padding: 34px; }
.entity-dossier-body h2 { margin: 0 0 8px; font-family: 'Cinzel', serif; font-size: 42px; }
.entity-dossier-type, .entity-dossier-meta { color: var(--accent); opacity: .86; }
.entity-dossier-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; margin: 22px 0; padding: 18px 0; border-top: 1px solid rgba(255,255,255,.12); border-bottom: 1px solid rgba(255,255,255,.12); }
.entity-dossier-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.entity-dossier-tags span { border: 1px solid rgba(214,179,106,.25); padding: 6px 8px; font-size: 11px; }

.safe-record-builder-modal {
  width: min(1260px, 94vw);
  background: linear-gradient(135deg, rgba(17,12,8,.98), rgba(4,5,5,.98));
}
.record-builder-form { padding: 0; }
.record-builder-layout { display: grid; grid-template-columns: minmax(320px, 40%) 1fr; min-height: 650px; }
.record-builder-preview-panel {
  padding: 28px;
  border-right: 1px solid rgba(214,179,106,.18);
  background: radial-gradient(circle at 50% 10%, rgba(214,179,106,.10), transparent 35%), rgba(0,0,0,.22);
}
.record-builder-preview-label { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 14px; color: var(--accent); font-family: 'IBM Plex Mono', monospace; font-size: 11px; }
.record-builder-fields { padding: 30px; }
.entity-editor-header h2 { margin: 0; font-family: 'Cinzel', serif; font-size: 34px; }
.entity-editor-header p { opacity: .72; }
.entity-editor-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 16px; }
.entity-editor-grid label span { display: block; }
.entity-image-preview { width: 100%; max-height: 120px; object-fit: cover; margin-top: 8px; border: 1px solid rgba(214,179,106,.22); }
.entity-overlay-fields { margin-top: 18px; padding: 14px; border: 1px solid rgba(214,179,106,.16); background: rgba(0,0,0,.18); }
.entity-overlay-fields h3 { margin: 0 0 6px; font-family: 'Cinzel', serif; color: var(--accent); }
.entity-editor-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

.record-builder-preview {
  position: sticky;
  top: 20px;
  min-height: 560px;
  padding: 22px;
  overflow: hidden;
  isolation: isolate;
  color: #241409;
  box-shadow: 0 28px 90px rgba(0,0,0,.55), inset 0 0 60px rgba(60,25,4,.35);
}
.record-builder-preview::before,
.record-builder-preview::after { content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 0; }
.record-builder-preview::before {
  background: radial-gradient(circle at 12% 8%, rgba(80,35,9,.30), transparent 12%), radial-gradient(circle at 86% 16%, rgba(60,26,7,.24), transparent 16%), repeating-linear-gradient(83deg, rgba(80,42,12,.09) 0 1px, transparent 1px 13px);
  mix-blend-mode: multiply;
}
.record-builder-preview > * { position: relative; z-index: 2; }
.rbp-stamp { position: absolute; right: 18px; top: 18px; width: 58px; height: 58px; border: 3px double rgba(100,0,0,.45); border-radius: 50%; z-index: 3; opacity: .78; }
.rbp-media { height: 260px; border: 5px solid rgba(70,35,10,.48); overflow: hidden; background: #111; transform: rotate(-1deg); box-shadow: 0 14px 34px rgba(0,0,0,.35); }
.rbp-media img { width: 100%; height: 100%; object-fit: cover; display: block; filter: sepia(.24) contrast(1.08); }
.rbp-body { margin-top: 20px; }
.rbp-body small { display: block; color: rgba(45,20,5,.72); font-family: 'IBM Plex Mono', monospace; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 8px; }
.rbp-body h3 { margin: 0 0 8px; font-family: 'Cinzel', serif; font-size: 32px; line-height: 1; }
.rbp-body p { line-height: 1.45; }

.record-preview-antique,
.record-preview-manuscript,
.record-preview-medieval,
.record-preview-witchtrial,
.record-preview-parchment,
.record-preview-folklore {
  background: linear-gradient(135deg, #d8b879, #a8763a 70%, #5b3013);
  clip-path: polygon(1% 2%, 10% 1%, 21% 2%, 35% 1%, 52% 2%, 70% 1%, 88% 2%, 99% 1%, 98% 16%, 99% 35%, 98% 55%, 99% 77%, 98% 98%, 83% 97%, 65% 99%, 48% 98%, 30% 99%, 12% 98%, 1% 99%, 2% 80%, 1% 58%, 2% 37%, 1% 18%);
}
.record-preview-manuscript { background: linear-gradient(90deg, rgba(115,20,18,.25) 0 18px, transparent 18px), linear-gradient(135deg, #e4c988, #b98542 70%, #633718); }
.record-preview-medieval { background: repeating-linear-gradient(0deg, transparent 0 28px, rgba(45,18,4,.13) 28px 29px), linear-gradient(135deg, #d8ba7c, #b17d3f 72%, #5e3215); }
.record-preview-witchtrial { background: linear-gradient(315deg, transparent 0 30px, rgba(55,23,6,.55) 30px 36px, transparent 36px), linear-gradient(135deg, #d1a965, #9e6731 62%, #46230e); }
.record-preview-victorian-news,
.record-preview-newspaper {
  color: #15120e;
  background: repeating-linear-gradient(0deg, rgba(0,0,0,.04) 0 1px, transparent 1px 4px), linear-gradient(135deg, #dfd5bf, #b8ae98);
  box-shadow: 0 28px 90px rgba(0,0,0,.55), inset 0 0 35px rgba(0,0,0,.16);
}
.record-preview-victorian-news .rbp-body h3,
.record-preview-newspaper .rbp-body h3 { font-family: 'Playfair Display', serif; border-top: 3px solid rgba(0,0,0,.55); padding-top: 8px; }
.record-preview-classified,
.record-preview-cctv,
.record-preview-vhs,
.record-preview-grimoire,
.record-preview-social,
.record-preview-glitch,
.record-preview-typewriter {
  color: #e9f3ef;
  background: linear-gradient(135deg, #20242c, #07090d);
  box-shadow: 0 28px 90px rgba(0,0,0,.68), inset 0 0 70px rgba(0,0,0,.55);
}
.record-preview-classified .rbp-stamp { width: auto; height: auto; border-radius: 0; color: #ff4e43; border: 3px solid rgba(255,78,67,.55); padding: 7px 10px; transform: rotate(-8deg); }
.record-preview-classified .rbp-stamp::before { content: "CLASSIFIED"; font: 900 14px/1 'IBM Plex Mono', monospace; }
.record-preview-cctv,
.record-preview-vhs { color: #d8ffe3; background: repeating-linear-gradient(0deg, rgba(180,255,190,.10) 0 1px, transparent 1px 4px), linear-gradient(135deg, #07130d, #010302); text-shadow: 0 0 5px rgba(120,255,160,.45); }
.record-preview-grimoire { color: #ead8b4; background: radial-gradient(circle at 70% 18%, rgba(120,0,0,.25), transparent 20%), linear-gradient(135deg, #24150f, #0a0605 70%, #030202); }
.record-preview-social { color: #eaf6ff; background: linear-gradient(180deg, rgba(80,160,220,.35) 0 36px, transparent 36px), linear-gradient(135deg, #131e2b, #05070a); border-radius: 16px; }
.record-preview-glitch { color: #e0fbff; background: radial-gradient(circle at 80% 20%, rgba(255,0,110,.20), transparent 23%), radial-gradient(circle at 20% 80%, rgba(0,220,255,.18), transparent 24%), linear-gradient(135deg, #070814, #010104); text-shadow: 1px 0 rgba(255,0,90,.45), -1px 0 rgba(0,220,255,.45); }
.record-preview-typewriter { color: #111; background: repeating-linear-gradient(0deg, transparent 0 24px, rgba(0,0,0,.13) 24px 25px), linear-gradient(135deg, #dcd6c7, #b9af9b); }
.record-preview-typewriter * { font-family: 'IBM Plex Mono', monospace !important; }
.record-preview-classified .rbp-body small,
.record-preview-cctv .rbp-body small,
.record-preview-vhs .rbp-body small,
.record-preview-grimoire .rbp-body small,
.record-preview-social .rbp-body small,
.record-preview-glitch .rbp-body small { color: rgba(235,245,240,.68); }

@media (max-width: 1050px) {
  .people-filter-panel { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .record-builder-layout { grid-template-columns: 1fr; }
  .record-builder-preview-panel { border-right: 0; border-bottom: 1px solid rgba(214,179,106,.18); }
  .record-builder-preview { position: relative; min-height: 460px; }
}
@media (max-width: 760px) {
  .people-archive-shell { width: 100%; padding: 84px 18px 40px; }
  .people-archive-header { flex-direction: column; align-items: flex-start; }
  .people-filter-panel, .entity-editor-grid { grid-template-columns: 1fr; }
  .people-filter-panel .wide, .entity-editor-grid .wide { grid-column: auto; }
  .entity-dossier-card { grid-template-columns: 1fr; }
}
