:root { --black:#000; --gold:#C9A24D; --antique:#B08D57; --deep:#8A6D3B; --ivory:#F8F5EF; --sand:#F1EBDD; --charcoal:#292929; --muted:#6b6b6b; --line:#e6dcc6; --white:#fff; --ok:#3f7d4e; --warn:#a0711d; }
* { box-sizing:border-box; }
body { margin:0; background:var(--ivory); color:var(--charcoal); font-family:Lato, Helvetica, Arial, sans-serif; font-size:16.5px; line-height:1.6; }
h1, h2, h3 { font-family:Cinzel, Georgia, serif; font-weight:600; line-height:1.2; margin:0; color:var(--heading, #000); }
a { color:inherit; }
button, input, select, textarea { font:inherit; }
.wrap { max-width:1120px; margin:0 auto; padding:0 20px; }
.muted { color:var(--muted); }
.hidden { display:none !important; }

/* Top bar */
.top { position:sticky; top:0; z-index:20; background:rgba(255,255,255,.97); border-bottom:2px solid var(--gold); box-shadow:0 2px 12px rgba(138,109,59,.07); }
.top-in { display:flex; align-items:center; justify-content:space-between; gap:14px; min-height:64px; }
.brand { display:flex; align-items:center; gap:10px; text-decoration:none; min-width:0; }
.brand img { width:42px; height:42px; flex:0 0 42px; object-fit:contain; }
.brand span { display:flex; flex-direction:column; min-width:0; }
.brand small { font-size:10px; letter-spacing:3px; color:var(--deep); font-weight:700; }
.brand b { font-family:Cinzel, serif; font-size:16px; color:var(--heading, #000); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.top-nav { display:flex; align-items:center; gap:6px; }
.top-nav a, .top-nav button { display:inline-flex; align-items:center; gap:6px; text-decoration:none; color:var(--charcoal); font-size:14.5px; padding:9px 12px; border-radius:8px; border:0; background:none; cursor:pointer; }
.top-nav a:hover, .top-nav button:hover { background:var(--sand); }
.top-nav a.on { color:var(--deep); box-shadow:inset 0 -2px 0 var(--gold); border-radius:8px 8px 0 0; }
.top-nav .add { background:var(--gold); color:var(--on-accent, #000); font-weight:700; }
.top-nav .add:hover { background:var(--gold); filter:brightness(1.07); }
.ico { width:18px; height:18px; flex:0 0 18px; display:inline-block; }
@media (max-width:720px) { .top-nav .lbl { display:none; } .top-nav a, .top-nav button { padding:9px; } .brand b { font-size:14px; max-width:42vw; } }

/* Page motion */
#view { padding-top:22px; padding-bottom:90px; outline:none; }
.page { animation:pageIn .35s ease both; }
@keyframes pageIn { from { opacity:0; transform:translateY(10px); } to { opacity:1; transform:none; } }
.stagger > * { animation:pageIn .45s ease both; }
.stagger > *:nth-child(2) { animation-delay:.04s } .stagger > *:nth-child(3) { animation-delay:.08s } .stagger > *:nth-child(4) { animation-delay:.12s }
.stagger > *:nth-child(5) { animation-delay:.16s } .stagger > *:nth-child(6) { animation-delay:.2s } .stagger > *:nth-child(n+7) { animation-delay:.24s }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation:none !important; transition:none !important; } }

/* Breadcrumbs and headers */
.crumbs { display:flex; flex-wrap:wrap; align-items:center; gap:6px; font-size:14px; color:var(--muted); margin-bottom:14px; }
.crumbs a { color:var(--deep); text-decoration:none; font-weight:700; }
.crumbs a:hover { text-decoration:underline; }
.crumbs .sep { opacity:.5; }
.page-head { display:flex; justify-content:space-between; align-items:flex-end; gap:16px; flex-wrap:wrap; margin-bottom:22px; }
.page-head h1 { font-size:32px; }
.page-head p { margin:6px 0 0; color:var(--muted); }
.eyebrow { font-size:12px; letter-spacing:3px; text-transform:uppercase; color:var(--deep); font-weight:700; }

/* Buttons */
.btn { display:inline-flex; align-items:center; justify-content:center; gap:8px; padding:12px 20px; border-radius:8px; border:1.5px solid transparent; font-weight:700; font-size:15px; text-decoration:none; cursor:pointer; transition:transform .2s ease, box-shadow .2s ease, background .2s ease, border-color .2s ease; }
.btn:hover { transform:translateY(-2px); box-shadow:0 8px 18px rgba(138,109,59,.16); }
.btn:disabled { opacity:.55; cursor:not-allowed; transform:none; box-shadow:none; }
.btn-gold { background:var(--gold); color:var(--on-accent, #000); }
.btn-gold:hover { filter:brightness(1.07); }
.btn-line { background:#fff; border-color:var(--line); color:var(--charcoal); }
.btn-line:hover { border-color:var(--gold); }
.btn-ok { background:var(--ok); color:#fff; }
.btn-sm { padding:8px 14px; font-size:14px; }

/* Chapter hero */
.hero { background:#fff; border:1px solid var(--line); border-radius:18px; padding:28px; display:grid; grid-template-columns:1.3fr 1fr; gap:24px; align-items:center; margin-bottom:28px; box-shadow:0 10px 30px rgba(138,109,59,.06); }
.hero h1 { font-size:34px; margin:8px 0 6px; }
.hero .meta { color:var(--muted); }
.stats { display:flex; gap:22px; margin-top:16px; flex-wrap:wrap; }
.stat b { display:block; font-family:Cinzel, serif; font-size:26px; color:#000; }
.stat span { font-size:13px; color:var(--muted); }
.searchbox { display:flex; gap:8px; }
.searchbox input { flex:1; min-width:0; padding:14px 16px; border:1.5px solid var(--line); border-radius:10px; background:var(--ivory); font-size:16px; }
.searchbox input:focus, .field input:focus, .field select:focus, .field textarea:focus { outline:none; border-color:var(--gold); box-shadow:0 0 0 3px rgba(201,162,77,.18); }
.hero-actions { display:flex; gap:10px; flex-wrap:wrap; margin-top:12px; }
@media (max-width:820px) { .hero { grid-template-columns:1fr; padding:22px; } .hero h1 { font-size:27px; } }

/* Sections */
.section { margin:30px 0; }
.section-title { display:flex; align-items:baseline; justify-content:space-between; gap:12px; margin-bottom:14px; }
.section-title h2 { font-size:22px; }
.section-title a { color:var(--deep); font-weight:700; text-decoration:none; font-size:14.5px; }

/* Timeline of years */
.timeline { position:relative; display:grid; grid-template-columns:repeat(auto-fill, minmax(170px, 1fr)); gap:16px; }
.year { position:relative; display:block; text-decoration:none; background:#fff; border:1px solid var(--line); border-radius:14px; overflow:hidden; transition:transform .25s ease, box-shadow .25s ease, border-color .25s ease; }
.year:hover, .card:hover, .month.has:hover { transform:translateY(-4px); box-shadow:0 14px 28px rgba(138,109,59,.14); border-color:var(--gold); }
.year .cover { aspect-ratio:4/3; background:var(--sand) center/cover no-repeat; display:flex; align-items:center; justify-content:center; color:var(--antique); }
.year .cover .ico { width:42px; height:42px; }
.year .label { padding:12px 14px; display:flex; justify-content:space-between; align-items:baseline; }
.year .label b { font-family:Cinzel, serif; font-size:22px; color:#000; }
.year .label span { font-size:13px; color:var(--muted); }

/* Months */
.months { display:grid; grid-template-columns:repeat(auto-fill, minmax(150px, 1fr)); gap:14px; }
.month { background:#fff; border:1px solid var(--line); border-radius:14px; padding:16px; text-decoration:none; min-height:118px; display:flex; flex-direction:column; justify-content:space-between; transition:transform .25s ease, box-shadow .25s ease, border-color .25s ease; }
.month b { font-family:Cinzel, serif; font-size:19px; color:#000; }
.month span { font-size:13.5px; color:var(--muted); }
.month.has { cursor:pointer; }
.month.has span { color:var(--deep); font-weight:700; }
.month.empty { background:transparent; border-style:dashed; opacity:.6; }

/* Cards */
.grid { display:grid; grid-template-columns:repeat(auto-fill, minmax(260px, 1fr)); gap:18px; }
.card { background:#fff; border:1px solid var(--line); border-radius:14px; overflow:hidden; text-decoration:none; display:flex; flex-direction:column; transition:transform .25s ease, box-shadow .25s ease, border-color .25s ease; }
.card .img { aspect-ratio:16/10; background:var(--sand) center/cover no-repeat; position:relative; display:flex; align-items:center; justify-content:center; color:var(--antique); }
.card .img .count { position:absolute; right:10px; bottom:10px; background:rgba(255,255,255,.92); border-radius:20px; padding:3px 10px; font-size:12.5px; font-weight:700; color:var(--charcoal); display:flex; gap:5px; align-items:center; }
.card .body { padding:14px 16px 16px; }
.card .date { font-size:13px; color:var(--deep); font-weight:700; letter-spacing:.3px; }
.card h3 { font-size:17px; margin:4px 0 6px; font-family:Lato, sans-serif; font-weight:700; }
.card p { margin:0; font-size:14px; color:var(--muted); display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; }
.pill { display:inline-flex; align-items:center; gap:5px; font-size:12px; font-weight:700; padding:3px 9px; border-radius:20px; background:var(--sand); color:var(--deep); }
.pill.pending { background:#fff3d6; color:var(--warn); }
.pill.hidden-p { background:#eee; color:#666; }
.empty-state { background:#fff; border:1.5px dashed var(--line); border-radius:16px; padding:40px 24px; text-align:center; color:var(--muted); }
.empty-state .ico { width:44px; height:44px; color:var(--antique); margin-bottom:8px; }

/* Entry page */
.entry-head { display:grid; grid-template-columns:1fr auto; gap:16px; align-items:start; margin-bottom:18px; }
.entry-head h1 { font-size:30px; margin:6px 0 10px; }
.facts { display:flex; flex-wrap:wrap; gap:8px 18px; color:var(--muted); font-size:14.5px; }
.facts span { display:inline-flex; align-items:center; gap:6px; }
.desc { background:#fff; border:1px solid var(--line); border-radius:14px; padding:20px 22px; margin:18px 0; white-space:pre-wrap; }
.people { display:flex; flex-wrap:wrap; gap:8px; }
.people a { text-decoration:none; background:#fff; border:1px solid var(--line); border-radius:20px; padding:6px 12px; font-size:14px; transition:border-color .2s ease, background .2s ease; }
.people a:hover { border-color:var(--gold); background:var(--sand); }
.photos { display:grid; grid-template-columns:repeat(auto-fill, minmax(220px, 1fr)); gap:14px; }
.photo { border:1px solid var(--line); border-radius:12px; overflow:hidden; background:#fff; cursor:zoom-in; transition:transform .25s ease, box-shadow .25s ease; text-align:left; padding:0; }
.photo:hover { transform:translateY(-3px); box-shadow:0 12px 24px rgba(138,109,59,.14); }
.photo .img { aspect-ratio:4/3; background:var(--sand) center/cover no-repeat; display:flex; align-items:center; justify-content:center; color:var(--antique); }
.photo .cap { padding:10px 12px; font-size:14px; }
.review-bar { display:flex; align-items:center; justify-content:space-between; gap:12px; flex-wrap:wrap; background:#fff8e8; border:1px solid #f0d9a6; border-radius:12px; padding:14px 16px; margin-bottom:18px; }
@media (max-width:640px) { .entry-head { grid-template-columns:1fr; } .entry-head h1 { font-size:25px; } }

/* Lightbox */
.lightbox[hidden] { display:none !important; }
.lightbox { position:fixed; inset:0; z-index:50; background:rgba(248,245,239,.97); display:flex; flex-direction:column; animation:fadeIn .25s ease both; }
@keyframes fadeIn { from { opacity:0 } to { opacity:1 } }
.lb-top { display:flex; justify-content:space-between; align-items:center; gap:10px; padding:12px 18px; border-bottom:1px solid var(--line); background:#fff; }
.lb-top b { font-size:15.5px; }
.lb-main { flex:1; display:flex; align-items:center; justify-content:center; padding:16px; min-height:0; position:relative; }
.lb-main img { max-width:100%; max-height:100%; object-fit:contain; border-radius:6px; box-shadow:0 14px 40px rgba(0,0,0,.15); animation:zoomIn .3s ease both; }
@keyframes zoomIn { from { opacity:0; transform:scale(.97) } to { opacity:1; transform:none } }
.lb-nav { position:absolute; top:50%; transform:translateY(-50%); width:46px; height:46px; border-radius:50%; background:#fff; border:1.5px solid var(--line); cursor:pointer; display:flex; align-items:center; justify-content:center; }
.lb-nav:hover { border-color:var(--gold); }
.lb-prev { left:14px } .lb-next { right:14px }

/* Search */
.search-layout { display:grid; grid-template-columns:280px 1fr; gap:22px; align-items:start; }
.filters { background:#fff; border:1px solid var(--line); border-radius:14px; padding:18px; position:sticky; top:84px; }
.filters h3 { font-size:16px; margin-bottom:12px; }
@media (max-width:860px) { .search-layout { grid-template-columns:1fr; } .filters { position:static; } }

/* Forms */
.field { margin-bottom:16px; }
.field label { display:block; font-weight:700; font-size:14px; margin-bottom:6px; color:#222; }
.field label i { color:#b4492f; font-style:normal; }
.field .hint { font-size:13px; color:var(--muted); margin-top:5px; }
.field input, .field select, .field textarea { width:100%; padding:12px 13px; border:1.5px solid var(--line); border-radius:9px; background:#fffdf9; font-size:16px; }
.row2 { display:grid; grid-template-columns:1fr 1fr; gap:14px; }
.row3 { display:grid; grid-template-columns:1fr 1fr 1fr; gap:12px; }
@media (max-width:640px) { .row2, .row3 { grid-template-columns:1fr; } }
.panel { background:#fff; border:1px solid var(--line); border-radius:16px; padding:24px; box-shadow:0 10px 30px rgba(138,109,59,.05); }
.narrow { max-width:760px; margin:0 auto; }
.form-error { background:#fdeee9; border:1px solid #f1c6b8; color:#8a3a22; border-radius:10px; padding:12px 14px; margin-bottom:14px; }
.check { display:flex; gap:8px; align-items:center; font-size:14.5px; }

/* Stepper */
.steps { display:flex; gap:8px; margin-bottom:20px; }
.steps div { flex:1; }
.steps .bar { height:6px; border-radius:6px; background:var(--line); overflow:hidden; }
.steps .bar i { display:block; height:100%; width:0; background:var(--gold); transition:width .4s ease; }
.steps .on .bar i, .steps .done .bar i { width:100%; }
.steps small { display:block; margin-top:6px; font-size:13px; color:var(--muted); font-weight:700; }
.steps .on small { color:var(--deep); }
.step-nav { display:flex; justify-content:space-between; gap:10px; margin-top:20px; flex-wrap:wrap; }
.drop { border:2px dashed var(--line); border-radius:14px; padding:28px; text-align:center; background:var(--ivory); cursor:pointer; transition:border-color .2s ease, background .2s ease; }
.drop:hover, .drop.over { border-color:var(--gold); background:#fffaf0; }
.drop .ico { width:40px; height:40px; color:var(--antique); }
.upl-list { display:grid; gap:12px; margin-top:16px; }
.upl { display:grid; grid-template-columns:96px 1fr auto; gap:12px; align-items:center; background:#fff; border:1px solid var(--line); border-radius:12px; padding:10px; animation:pageIn .3s ease both; }
.upl .th { width:96px; height:72px; border-radius:8px; background:var(--sand) center/cover no-repeat; display:flex; align-items:center; justify-content:center; color:var(--antique); }
.upl input { width:100%; padding:10px 12px; border:1.5px solid var(--line); border-radius:8px; }
.upl input.bad { border-color:#d6806a; background:#fff6f3; }
.icon-btn { width:38px; height:38px; border-radius:50%; border:1.5px solid var(--line); background:#fff; cursor:pointer; display:flex; align-items:center; justify-content:center; color:var(--muted); }
.icon-btn:hover { border-color:#d6806a; color:#b4492f; }
.chips { display:flex; flex-wrap:wrap; gap:8px; margin-top:10px; }
.chip { display:inline-flex; align-items:center; gap:6px; background:var(--sand); border-radius:20px; padding:6px 8px 6px 12px; font-size:14px; animation:pageIn .25s ease both; }
.chip button { border:0; background:#fff; border-radius:50%; width:22px; height:22px; cursor:pointer; line-height:1; color:var(--muted); }
.summary { display:grid; grid-template-columns:150px 1fr; gap:8px 14px; font-size:15px; }
.summary dt { color:var(--muted); }
.summary dd { margin:0; }

/* Toast */
.toast { position:fixed; left:50%; bottom:22px; transform:translate(-50%, 20px); background:#fff; border:1px solid var(--line); border-left:4px solid var(--gold); color:var(--charcoal); padding:12px 18px; border-radius:10px; box-shadow:0 12px 30px rgba(0,0,0,.12); opacity:0; pointer-events:none; transition:opacity .3s ease, transform .3s ease; z-index:60; max-width:92vw; }
.toast.show { opacity:1; transform:translate(-50%, 0); }
.loading { display:flex; align-items:center; gap:10px; color:var(--muted); padding:40px 0; justify-content:center; }
.spin { width:22px; height:22px; border:3px solid var(--line); border-top-color:var(--gold); border-radius:50%; animation:spin 1s linear infinite; }
@keyframes spin { to { transform:rotate(360deg) } }

.vfoot { border-top:1px solid var(--line); background:#fff; font-size:13.5px; color:var(--muted); }
.vfoot .wrap { display:flex; justify-content:space-between; flex-wrap:wrap; gap:8px; padding-top:16px; padding-bottom:16px; }
.vfoot a { color:var(--deep); text-decoration:none; }

.hero-logo { width:96px; height:96px; object-fit:contain; float:right; margin:0 0 10px 16px; }
.affil { display:flex; flex-wrap:wrap; gap:10px; }
.affil a { display:inline-flex; align-items:center; gap:8px; background:#fff; border:1px solid var(--line); border-radius:12px; padding:10px 14px; text-decoration:none; font-weight:700; transition:border-color .2s ease, transform .2s ease; }
.affil a:hover { border-color:var(--gold); transform:translateY(-2px); }
.logo-box { display:flex; gap:14px; align-items:center; } .logo-box .lg { width:84px; height:84px; border:1px dashed var(--line); border-radius:12px; display:flex; align-items:center; justify-content:center; background:#fff; overflow:hidden; } .logo-box img { max-width:100%; max-height:100%; }
.swatch { display:flex; gap:10px; align-items:center; } .swatch input[type=color] { width:52px; height:44px; border:1.5px solid var(--line); border-radius:8px; padding:2px; background:#fff; cursor:pointer; flex:0 0 52px; }
.powered { font-size:12px; color:var(--muted); letter-spacing:.5px; }

/* ---------- Chapter Records ---------- */
.folder-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(250px,1fr)); gap:14px; margin-bottom:26px; }
.folder-card { display:flex; gap:14px; align-items:center; background:#fff; border:1px solid var(--line); border-radius:14px; padding:18px; color:inherit; text-decoration:none; transition:transform .2s, box-shadow .2s, border-color .2s; }
.folder-card .ico { width:30px; height:30px; color:var(--gold); flex:none; }
.folder-card b { display:block; font-size:16px; margin-bottom:2px; }
.folder-card .muted { font-size:13px; }
a.folder-card:hover { transform:translateY(-2px); box-shadow:0 10px 24px rgba(0,0,0,.06); border-color:var(--gold); }
.folder-card.locked { background:transparent; border-style:dashed; opacity:.75; }
.folder-card.locked .ico { color:var(--muted, #8a8580); }
.rec-tools { display:flex; gap:10px; margin-bottom:14px; flex-wrap:wrap; }
.rec-tools input { flex:1; min-width:200px; padding:11px 13px; border:1.5px solid var(--line); border-radius:9px; font:inherit; background:#fff; }
.rec-tools select { padding:11px 13px; border:1.5px solid var(--line); border-radius:9px; font:inherit; background:#fff; }
.rec-table { background:#fff; border:1px solid var(--line); border-radius:14px; overflow:hidden; }
.rec-row { display:flex; gap:14px; align-items:center; padding:14px 16px; border-top:1px solid var(--line); }
.rec-row:first-child { border-top:0; }
.rec-ic .ico { width:26px; height:26px; color:var(--gold); }
.rec-main { flex:1; min-width:0; }
.rec-main .muted { font-size:13px; }
.rec-notes { font-size:14px; margin-top:4px; color:#4a4642; }
.rec-acts { display:flex; gap:6px; align-items:center; flex-wrap:wrap; justify-content:flex-end; }
.redact { background:#FFF8E6; border:1px solid #F0D99A; border-radius:10px; padding:12px 14px; margin:0 0 16px; }
@media (max-width:640px) { .rec-row { flex-wrap:wrap; } .rec-acts { width:100%; justify-content:flex-start; } }
/* ---------- cloud backup ---------- */
.cloud-opts { display:grid; grid-template-columns:repeat(auto-fit,minmax(200px,1fr)); gap:10px; margin:6px 0 10px; }
.cloud-btn { display:flex; align-items:center; gap:10px; padding:14px 16px; border:1.5px solid var(--line); border-radius:12px; background:#fff; color:var(--ink, #292929); font-weight:700; text-decoration:none; transition:border-color .2s, transform .2s; }
.cloud-btn .ico { width:26px; height:26px; color:var(--gold); flex:none; }
a.cloud-btn:hover { border-color:var(--gold); transform:translateY(-1px); }
.cloud-btn.off { opacity:.55; cursor:not-allowed; }
.cloud-btn small { display:block; font-weight:400; font-size:12px; }
.cloud-on { display:flex; gap:12px; align-items:flex-start; margin-bottom:12px; }
.cloud-on .ico { width:30px; height:30px; color:var(--gold); flex:none; margin-top:2px; }
.cloud-on .muted { font-size:13px; }
.cloud-stats { display:flex; gap:26px; flex-wrap:wrap; margin:6px 0 14px; }
.cloud-stats b { display:block; font-size:22px; }
.cloud-stats span { font-size:13px; color:#77716b; }
.top-nav a, .top-nav button { white-space:nowrap; }
.panel > .hint, #cloud .hint { font-size:13px; color:var(--muted); margin-top:8px; }
@media (max-width:1320px) { .top-nav { gap:2px; } .top-nav a, .top-nav button { padding:9px 9px; font-size:14px; } .top-nav #signout .lbl { display:none; } }
@media (max-width:1100px) { .top-nav a:not(.add) .lbl { display:none; } .top-nav a:not(.add) { padding:9px; } }
.brand small, .brand b { white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
@media (max-width:560px) { .brand span { display:none; } .top-nav a, .top-nav button { padding:8px 7px; } }
