@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,500;9..144,600;9..144,700&family=EB+Garamond:ital,wght@0,400;0,500;0,600;1,400&display=swap');

:root {
  --bg: #ffffff;
  --ink: #1a1a1a;
  --muted: #6f6f6f;
  --line: #e7e7e7;
  --accent: #cc0000;        /* EDEP red */
  --accent-ink: #fff;
  --code-bg: #1f2023;
  --code-ink: #ece6dd;
  --field-bg: #fafafa;
  --ok: #1a7f37;
  --bad: #b42318;
  --serif-display: "Fraunces", "Cinzel", Georgia, serif;
  --serif-body: "EB Garamond", Georgia, "Times New Roman", serif;
  font-size: 16px;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--serif-body);
  font-size: 1rem;
  color: var(--ink);
  background: var(--bg);
  display: flex;
  flex-direction: column;
}

/* ---- secondary (Latin/German) label visibility ---- */
.sec { color: var(--muted); font-weight: 400; }
.label .en + .sec { margin-left: 0.4em; }

/* ---- top bar ---- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding: 0.6rem 1rem; border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.brand { font-size: 0.95rem; }
.controls { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.btn {
  border: 1px solid var(--line); background: #fff; border-radius: 6px;
  padding: 0.4rem 0.7rem; cursor: pointer; font-size: 0.85rem; color: var(--ink);
  text-decoration: none; display: inline-block; line-height: 1.4;
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary:hover { filter: brightness(1.12); }
.btn.small { padding: 0.15rem 0.45rem; font-size: 0.75rem; }
.btn-icon { padding: 0.27rem 0.5rem; font-size: 0.9rem; line-height: 1; min-width: 0; border-radius: 5px; }
.btn[disabled] { opacity: 0.55; cursor: default; }

/* ---- layout ---- */
.layout { display: grid; grid-template-columns: 1fr 1fr; flex: 1; min-height: 0; }
.pane { overflow: auto; min-height: 0; }
.form { padding: 1rem 1.2rem; border-right: 1px solid var(--line); }
.preview { background: var(--code-bg); color: var(--code-ink); display: flex; flex-direction: column; }
.preview-head {
  display: flex; justify-content: space-between; align-items: center; padding: 0.5rem 0.9rem;
  color: #b9aea0; font-size: 0.8rem; border-bottom: 1px solid #3a332c; position: sticky; top: 0;
  background: var(--code-bg); z-index: 2;
}
.preview pre { margin: 0; padding: 0.9rem; overflow: auto; flex: 1; }
.preview code { font-family: "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace; font-size: 0.78rem; white-space: pre; line-height: 1.5; }
.validity.ok { color: #7ee2a8; }
.validity.bad { color: #ff9a8f; }

/* ---- form ---- */
.section-title {
  margin: 1.3rem 0 0.5rem; font-size: 0.82rem; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--accent); border-bottom: 1px solid var(--line);
  padding-bottom: 0.3rem;
}
.section-title:first-child { margin-top: 0; }
.field { margin-bottom: 0.7rem; }
.field.row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0.5rem; }
.field.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
.field .label { display: block; font-size: 0.8rem; font-weight: 600; margin-bottom: 0.2rem; }
.field .hint { font-size: 0.72rem; color: var(--muted); margin-top: 0.15rem; }
input, select, textarea {
  width: 100%; padding: 0.4rem 0.5rem; border: 1px solid var(--line);
  border-radius: 5px; background: var(--field-bg); font: inherit; font-size: 0.85rem; color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); border-color: var(--accent); background: #fff; }
textarea { resize: vertical; min-height: 3.2rem; }
textarea.mono { font-family: "SF Mono", Menlo, monospace; }

/* ---- repeatable text blocks ---- */
.textblock { border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: 7px; padding: 0.6rem 0.7rem; margin-bottom: 0.7rem; background: #fcfaf7; }
.textblock-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.5rem; color: var(--accent); font-size: 0.85rem; }
#btn-add-text { margin-top: 0.2rem; }

/* ---- Leiden editor host ---- */
.edition-editor { margin-bottom: 0.6rem; }
.edition-mode-bar { display: flex; gap: 0.4rem; align-items: center; margin: 0.1rem 0 0.4rem; font-size: 0.78rem; color: var(--muted); }
jinn-epidoc-editor {
  display: block; font-size: 14px;
  border: 1px solid var(--line); border-radius: 6px; overflow: hidden;
  --jinn-codemirror-background-color: #fbfaf8;
}
jinn-epidoc-editor[valid="false"] { border-color: var(--bad); }
[slot="leiden-toolbar"], [slot="xml-toolbar"] {
  display: flex; flex-wrap: wrap; gap: 3px; width: 100%; padding: 4px 6px;
  background: #f3ede5; border-bottom: 1px solid var(--line);
}
[slot="leiden-toolbar"] button, [slot="xml-toolbar"] button {
  font-size: 0.78rem; border: 1px solid transparent; background: #fff;
  border-radius: 4px; padding: 0.12rem 0.4rem; cursor: pointer; color: var(--ink);
}
[slot="leiden-toolbar"] button:hover, [slot="xml-toolbar"] button:hover { border-color: var(--accent); }
[slot="leiden-toolbar"] .sep, [slot="xml-toolbar"] .sep { border-right: 1px solid var(--line); margin-right: 3px; padding-right: 6px; }
[slot="leiden-header"], [slot="xml-header"] { font-size: 0.78rem; color: var(--muted); margin: 0; padding: 0.25rem 0.5rem; font-weight: 600; }

/* ---- toast ---- */
#toast {
  position: fixed; bottom: 1.6rem; left: 50%; transform: translateX(-50%);
  background: #1a1714; color: #fff; padding: 0.45rem 1.1rem;
  border-radius: 8px; font-size: 0.82rem; pointer-events: none;
  opacity: 0; transition: opacity 0.2s; z-index: 999; white-space: nowrap;
}
#toast.show { opacity: 1; }
#toast.toast-error { background: var(--bad); }

/* ---- GitHub settings modal form ---- */
.modal-desc { font-size: 0.83rem; color: var(--muted); margin: 0 0 1rem; line-height: 1.5; }
.modal-desc a { color: var(--accent); }
.modal-desc code { font-size: 0.8rem; background: var(--field-bg); border: 1px solid var(--line); border-radius: 3px; padding: 0 0.25rem; }
.gh-form { display: flex; flex-direction: column; gap: 0.55rem; margin-bottom: 1.1rem; }
.gh-label { display: flex; flex-direction: column; gap: 0.2rem; font-size: 0.8rem; color: var(--muted); font-weight: 500; }
.gh-input {
  width: 100%; padding: 0.38rem 0.6rem; border: 1px solid var(--line); border-radius: 5px;
  font-size: 0.85rem; font-family: inherit; background: var(--field-bg); color: var(--ink);
}
.gh-input:focus { outline: none; border-color: var(--accent); }
.gh-actions { display: flex; gap: 0.5rem; }

/* ---- editor hint + save target ---- */
.editor-hint {
  display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap;
  padding: 0.28rem 1rem; background: #f8f4ef; border-bottom: 1px solid var(--line);
  font-size: 0.77rem; color: var(--muted);
}
.editor-hint .step strong { color: var(--accent); }
.editor-hint .arrow { color: #ccc; }
.hint-or { color: var(--muted); font-style: italic; font-size: 0.78rem; padding: 0 0.1rem; }
.save-target-wrap { font-size: 0.78rem; color: var(--muted); }
#save-target { font-size: 0.74rem; background: var(--field-bg); border: 1px solid var(--line); border-radius: 3px; padding: 0.05rem 0.35rem; color: var(--ink); }

/* collection picker in editor toolbar */
.col-picker-wrap { display: flex; align-items: center; gap: 0.35rem; }
.col-picker-label { font-size: 0.8rem; color: var(--muted); white-space: nowrap; }
.col-picker {
  font-size: 0.78rem; height: 1.9rem;
  border: 1px solid var(--line); border-radius: 4px;
  background: var(--field-bg); color: var(--ink);
  padding: 0 0.5rem; cursor: pointer;
  max-width: 160px;
}

.foot { padding: 0.5rem 1rem; font-size: 0.72rem; color: var(--muted); border-top: 1px solid var(--line); }
.foot a { color: var(--accent); }

/* ---- site navigation ---- */
.sitenav { display: flex; gap: 0.4rem; align-items: center; flex-wrap: wrap; }
.sitenav-editor { margin-right: auto; margin-left: 1rem; }
.sitenav-link { font-size: 0.85rem; color: var(--ink); text-decoration: none; padding: 0.35rem 0.6rem; border-radius: 6px; border: 1px solid transparent; }
.sitenav-link:hover { border-color: var(--line); }
.sitenav-link.active { color: var(--accent); font-weight: 600; }
.brand-home { font-weight: 700; color: var(--accent); text-decoration: none; font-size: 0.95rem; letter-spacing: -0.01em; }
.brand-home:hover { opacity: 0.8; }
.brand-sep { color: var(--muted); margin: 0 0.3rem; }

/* ---- landing ---- */
.landing-page { min-height: 100vh; }
.landing-header { display: flex; align-items: center; justify-content: space-between; padding: 0.9rem 1.5rem; border-bottom: 1px solid var(--line); }
.landing-brand { display: flex; flex-direction: column; gap: 0.05rem; }
.landing-brand strong { font-size: 1.4rem; color: var(--accent); letter-spacing: -0.02em; }
.landing-tagline { font-size: 0.78rem; color: var(--muted); }
.landing-main { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 3rem 1.5rem 2rem; }
.landing-intro { max-width: 580px; text-align: center; margin: 0 auto; font-size: 0.9rem; line-height: 1.7; color: var(--muted); }
.landing-intro a { color: var(--accent); }
.landing-intro strong { color: var(--ink); }
.landing-hero { max-width: 640px; text-align: center; }
.landing-hero h1 { font-size: 2.6rem; color: var(--accent); margin: 0 0 0.25rem; letter-spacing: -0.02em; }
.landing-sub { font-size: 1.05rem; color: var(--muted); margin: 0 0 1.5rem; }
.landing-actions { display: flex; gap: 0.6rem; justify-content: center; margin-top: 1.6rem; flex-wrap: wrap; }
.landing-guide-link { margin: 1rem 0 0; font-size: 0.9rem; }
.landing-guide-link a { color: var(--accent); }
.landing-credits { max-width: 640px; width: 100%; margin: 2.8rem auto 0; padding-top: 1.4rem; border-top: 1px solid var(--line); }
.landing-credits h2 { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); margin: 0 0 0.65rem; }
.landing-credits ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.28rem; }
.landing-credits li { font-size: 0.82rem; color: var(--muted); line-height: 1.5; }
.landing-credits a { color: var(--accent); }
.landing-credits strong { color: var(--ink); }
.landing-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 1rem; max-width: 940px; width: 100%; }
.landing-card { display: block; text-decoration: none; border: 1px solid var(--line); border-radius: 10px; padding: 1.4rem 1.2rem; background: #fff; transition: border-color 0.15s, box-shadow 0.15s; }
.landing-card:hover { border-color: var(--accent); box-shadow: 0 4px 18px rgba(110,20,35,0.12); }
.card-primary { background: var(--accent); border-color: var(--accent); }
.card-primary:hover { filter: brightness(1.07); box-shadow: none; }
.card-label { font-size: 1rem; font-weight: 700; color: var(--ink); margin-bottom: 0.4rem; }
.card-primary .card-label { color: #fff; }
.card-desc { font-size: 0.81rem; color: var(--muted); line-height: 1.45; }
.card-primary .card-desc { color: rgba(255,255,255,0.82); }

/* ---- modal ---- */
.modal-overlay { position: fixed; inset: 0; z-index: 1000; background: rgba(0,0,0,0.45); display: flex; align-items: center; justify-content: center; padding: 1rem; }
.modal-overlay[hidden] { display: none; }
.modal-box { background: #fff; border-radius: 12px; padding: 1.5rem 1.5rem 1.3rem; max-width: 700px; width: 100%; max-height: 85vh; overflow: auto; position: relative; box-shadow: 0 24px 64px rgba(0,0,0,0.22); }
.modal-title { font-size: 0.95rem; margin: 0 2.5rem 1.1rem 0; text-transform: uppercase; letter-spacing: 0.06em; color: var(--accent); border-bottom: 1px solid var(--line); padding-bottom: 0.4rem; }
.modal-close { position: absolute; top: 1rem; right: 1rem; background: none; border: 1px solid var(--line); border-radius: 5px; width: 1.9rem; height: 1.9rem; cursor: pointer; font-size: 0.9rem; color: var(--muted); display: flex; align-items: center; justify-content: center; line-height: 1; }
.modal-close:hover { color: var(--ink); border-color: var(--ink); }
.workflow-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.9rem; margin-top: 0.4rem; }
.workflow-card { border: 1px solid var(--line); border-radius: 8px; padding: 1.3rem 1rem 0.8rem; background: #fafafa; position: relative; }
.workflow-num { position: absolute; top: -0.75rem; left: 1rem; background: var(--accent); color: #fff; width: 1.5rem; height: 1.5rem; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 0.8rem; font-weight: 700; }
.workflow-card h3 { font-size: 0.85rem; margin: 0 0 0.5rem; }
.workflow-card ol { margin: 0; padding-left: 1.2rem; font-size: 0.82rem; line-height: 1.65; }
.workflow-card a { color: var(--accent); }

/* ---- catalog ---- */
.catalog-wrap { padding: 1rem 1.2rem; overflow: auto; }
.catalog-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.7rem; gap: 0.5rem; flex-wrap: wrap; }
.catalog-head h2 { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.07em; color: var(--accent); margin: 0; }
.catalog-head-actions { display: flex; gap: 0.5rem; align-items: center; }
.catalog-searchbox { width: 220px; padding: 0.3rem 0.5rem; border: 1px solid var(--line); border-radius: 5px; background: var(--field-bg); font: inherit; font-size: 0.82rem; }
.catalog-searchbox:focus { outline: 2px solid var(--accent); border-color: var(--accent); }
.catalog-loading, .catalog-empty { font-size: 0.84rem; color: var(--muted); padding: 0.5rem 0; }
.catalog-empty a { color: var(--accent); }
.catalog-item { border: 1px solid var(--line); border-radius: 7px; margin-bottom: 0.6rem; overflow: hidden; }
.catalog-item.selected { border-color: var(--accent); }
.catalog-monument { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.8rem; padding: 0.6rem 0.8rem; background: #fafafa; }
.catalog-info { flex: 1; min-width: 0; }
.catalog-filename { font-size: 0.77rem; color: var(--muted); display: block; }
.catalog-title { font-size: 0.9rem; font-weight: 600; margin-top: 0.15rem; color: var(--ink); }
.catalog-meta { font-size: 0.77rem; color: var(--muted); display: block; margin-top: 0.15rem; }
.catalog-tags { margin-top: 0.3rem; display: flex; gap: 0.3rem; flex-wrap: wrap; }
.catalog-tag { font-size: 0.7rem; color: var(--accent); background: #f6eef0; padding: 0.04rem 0.4rem; border-radius: 10px; }
.catalog-actions { display: flex; gap: 0.3rem; flex-shrink: 0; flex-wrap: wrap; justify-content: flex-end; }

/* ---- viewer / reading ---- */
.viewer-layout { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: minmax(0, 1fr) auto;
  grid-template-areas: "reading image" "map map"; flex: 1; min-height: 0; }
.viewer-pane { overflow: auto; padding: 1.3rem 1.6rem; }
.viewer-pane.reading-pane { grid-area: reading; }
.viewer-pane.image-pane { grid-area: image; background: #faf8f4; border-left: 1px solid var(--line); display: flex; flex-direction: column; }
.viewer-pane.map-pane { grid-area: map; padding: 0; overflow: hidden; }
.viewer-map { width: 100%; height: 320px; border-top: 1px solid var(--line); }
.viewer-map:empty { display: none; }
@media (max-width: 760px) {
  .viewer-layout { grid-template-columns: 1fr; grid-template-areas: "reading" "image" "map"; }
  .viewer-pane.image-pane { border-left: 0; border-top: 1px solid var(--line); }
}
.viewer-image { max-width: 100%; border: 1px solid var(--line); border-radius: 5px; background: #fff; }
.viewer-noimage { color: var(--muted); font-size: 0.85rem; font-style: italic; margin: auto; }
.reading-title { font-size: 1.1rem; margin: 0 0 0.2rem; }
.reading-sub { font-size: 0.82rem; color: var(--muted); margin: 0 0 1.2rem; }
.reading-section h3 { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--accent); border-bottom: 1px solid var(--line); padding-bottom: 0.25rem; margin: 1.4rem 0 0.6rem; }
.edition-text { font-family: "Times New Roman", Georgia, serif; font-size: 1rem; line-height: 1.9; white-space: pre-wrap; }
.edition-text .lb-num { color: var(--muted); font-size: 0.72rem; margin-right: 0.5rem; font-family: "SF Mono", Menlo, monospace; user-select: none; }
.edition-text .ex { font-style: italic; }
.edition-text .supplied { }
.edition-text .unclear { border-bottom: 1px dotted var(--muted); }
.edition-text .gap { color: var(--muted); }
.edition-text .num { font-variant-numeric: normal; }
.reading-section p { font-size: 0.9rem; line-height: 1.65; }
.app-entry { font-size: 0.84rem; line-height: 1.5; margin-bottom: 0.4rem; }
.app-entry .loc { color: var(--accent); font-weight: 600; margin-right: 0.4rem; }
.bibl-list { font-size: 0.84rem; line-height: 1.6; padding-left: 1.2rem; margin: 0; }

/* ---- map (legacy viewer context) ---- */
.viewer-pane.map-pane #map { flex: 1 1 auto; min-height: 480px; height: 100%; }
.map-wrap { flex: 1 1 auto; display: flex; flex-direction: column; min-height: 480px; }
.leaflet-popup-content { font-size: 0.84rem; line-height: 1.5; }
.leaflet-popup-content a { color: var(--accent); }

/* ---- map page (3-column: filters | list | map) ---- */
.map-page { display: flex; flex-direction: column; overflow: hidden; }
.map-layout {
  display: grid;
  grid-template-columns: 210px 340px 1fr;
  height: calc(100vh - 52px);
  overflow: hidden;
}
.map-facets {
  overflow-y: auto;
  padding: 0.8rem 1rem;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}
.map-facets .facet { display: flex; flex-direction: column; gap: 0.2rem; font-size: 0.72rem; color: var(--muted); }
.map-facets .facet select,
.map-facets .facet input[type="search"],
.map-facets .facet input[type="number"] { font-family: var(--serif-body); font-size: 0.95rem; color: var(--ink); border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: transparent; padding: 0.2rem 0.1rem; width: 100%; box-sizing: border-box; }
.map-facets .facet select:focus,
.map-facets .facet input:focus { outline: 0; border-bottom-color: var(--accent); }
.map-facets .facet-date span { display: flex; align-items: center; gap: 0.3rem; }
.map-facets .facet-date .yr { width: 4.4rem; }
.site-notice { font-size: 0.8rem; color: var(--muted); background: #fdf8f0; border-bottom: 1px solid #e8d8b0; padding: 0.5rem 0.8rem; line-height: 1.45; }
.site-notice code { font-size: 0.78rem; background: rgba(0,0,0,0.06); padding: 0.05rem 0.25rem; border-radius: 2px; }
.site-notice-map { flex-shrink: 0; }
.map-list-col { display: flex; flex-direction: column; overflow: hidden; border-right: 1px solid var(--line); }
.map-list-head { padding: 0.4rem 0.8rem; border-bottom: 1px solid var(--line); background: var(--bg); flex-shrink: 0; }
.map-list-body { overflow-y: auto; flex: 1 1 0; padding: 0 0.5rem; }
.map-layout #map { height: 100%; min-height: 0; }
.map-entry { cursor: pointer; }
.map-entry.selected .catalog-title a { color: var(--accent); font-weight: 600; }
@media (max-width: 900px) {
  .map-layout { grid-template-columns: 1fr; grid-template-rows: auto 240px 1fr; height: auto; overflow: auto; }
  .map-facets { border-right: 0; border-bottom: 1px solid var(--line); flex-direction: row; flex-wrap: wrap; gap: 0.5rem; padding: 0.6rem; }
  .map-list-col { border-right: 0; border-bottom: 1px solid var(--line); max-height: 260px; }
  .map-layout #map { min-height: 300px; }
}

/* ---- docs ---- */
.docs-pane { max-width: 820px; margin: 0 auto; padding: 1.5rem 1.5rem 3rem; overflow: auto; }
.docs-section { margin-top: 1.8rem; }
.docs-section h1 { font-size: 1.3rem; margin: 0 0 0.5rem; }
.docs-section h2 { font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.07em; color: var(--accent); border-bottom: 1px solid var(--line); padding-bottom: 0.3rem; margin: 0 0 0.8rem; }
.docs-section h3 { font-size: 0.85rem; font-weight: 700; color: var(--ink); margin: 1rem 0 0.35rem; }
.docs-section p { font-size: 0.88rem; line-height: 1.65; margin: 0 0 0.55rem; }
.docs-section a { color: var(--accent); }
.docs-list { font-size: 0.88rem; line-height: 1.6; margin: 0; padding-left: 1.3rem; }
.docs-list li { margin-bottom: 0.4rem; }
.docs-table { width: 100%; border-collapse: collapse; font-size: 0.84rem; margin-top: 0.3rem; }
.docs-table th { text-align: left; padding: 0.35rem 0.6rem; border-bottom: 2px solid var(--line); color: var(--muted); font-weight: 600; }
.docs-table td { padding: 0.35rem 0.6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.docs-table code { font-size: 0.82rem; background: var(--field-bg); border: 1px solid var(--line); border-radius: 3px; padding: 0 0.25rem; }

/* ---- login ---- */
.login-page { justify-content: center; align-items: center; min-height: 100vh; }
.login-main { width: 100%; max-width: 400px; padding: 2rem 1rem; }
.login-card { border: 1px solid var(--line); border-radius: 0.6rem; padding: 2rem 2rem 1.6rem; background: var(--bg); }
.login-title { font-size: 1.3rem; font-weight: 700; margin: 0 0 0.4rem; }
.login-title a { color: var(--ink); text-decoration: none; }
.login-subtitle { font-size: 0.82rem; color: var(--muted); margin: 0 0 1.4rem; }
.login-mode-label { font-weight: 600; margin: 0 0 0.5rem; font-size: 0.97rem; }
.field-label { font-size: 0.8rem; font-weight: 600; display: block; margin-bottom: 0.25rem; }
.text-input { width: 100%; padding: 0.45rem 0.6rem; border: 1px solid var(--line); border-radius: 5px; background: var(--field-bg); font: inherit; font-size: 0.88rem; }
.text-input:focus { outline: 2px solid var(--accent); border-color: var(--accent); background: #fff; }
.login-error { color: var(--bad); font-size: 0.82rem; min-height: 1.1em; margin: 0.5rem 0 0; }
.login-ok { color: #2e7d32; font-size: 0.82rem; min-height: 1.1em; margin: 0.5rem 0 0; }
.login-ok a { color: #2e7d32; font-weight: 600; }
a.btn.disabled { opacity: 0.5; cursor: default; pointer-events: none; }

/* ---- favorites & collections ---- */
.fav-btn { background: transparent; border: 0; cursor: pointer; padding: 0.2rem; line-height: 0; color: var(--muted); display: inline-flex; }
.fav-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.5; }
.fav-btn:hover { color: #e0a500; }
.fav-btn.saved { color: #e0a500; }
.fav-btn.saved svg { fill: currentColor; }
.rp-fav { display: inline-flex; align-items: center; margin-right: 0.2rem; }
.rp-fav .fav-btn svg { width: 20px; height: 20px; }

.fav-pop { position: fixed; z-index: 1100; background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 12px 32px rgba(0,0,0,0.16); padding: 0.4rem; min-width: 200px; max-width: 250px; font-family: var(--serif-body); }
.fav-pop-title { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); padding: 0.2rem 0.4rem 0.4rem; }
.fav-pop-row { display: flex; align-items: center; gap: 0.45rem; padding: 0.32rem 0.4rem; font-size: 0.9rem; border-radius: 5px; cursor: pointer; }
.fav-pop-row:hover { background: var(--field-bg); }
.fav-pop-star { color: #e0a500; }
.fav-pop-new { display: flex; gap: 0.3rem; padding: 0.45rem 0.4rem 0.2rem; border-top: 1px solid var(--line); margin-top: 0.3rem; }
.fav-pop-new input { flex: 1; min-width: 0; border: 1px solid var(--line); border-radius: 5px; padding: 0.28rem 0.4rem; font: inherit; font-size: 0.85rem; }
.fav-pop-new button { border: 0; background: var(--accent); color: #fff; border-radius: 5px; padding: 0.28rem 0.6rem; cursor: pointer; font: inherit; font-size: 0.82rem; }

.fav-main { max-width: 900px; margin: 0 auto; padding: 1.6rem 1.6rem 4rem; }
.fav-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.fav-intro { font-size: 0.88rem; color: var(--muted); max-width: 520px; margin: 0; line-height: 1.55; }
.fav-intro a { color: var(--accent); }
.fav-newcoll { display: flex; gap: 0.4rem; }
.fav-newcoll input { border: 1px solid var(--line); border-radius: 6px; padding: 0.3rem 0.55rem; font: inherit; font-size: 0.9rem; min-width: 200px; }
.fav-sec { margin-bottom: 2rem; }
.fav-sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; border-bottom: 1px solid var(--line); padding-bottom: 0.4rem; margin-bottom: 0.5rem; }
.fav-sec-title { font-family: var(--serif-display); font-weight: 600; font-size: 1.15rem; color: var(--ink); margin: 0; display: flex; align-items: baseline; gap: 0.5rem; }
.fav-sec-count { font-family: var(--serif-body); font-size: 0.8rem; color: var(--muted); font-weight: 400; }
.fav-sec-actions { display: flex; gap: 0.3rem; flex-shrink: 0; }
.fav-row { display: flex; align-items: flex-start; gap: 0.5rem; padding: 0.55rem 0.2rem; border-bottom: 1px solid var(--line); }
.fav-row .fav-btn { margin-top: 0.1rem; }
.fav-row-info { min-width: 0; }
.fav-row-info .catalog-title { font-size: 1rem; }
.fav-row-meta { font-size: 0.82rem; color: var(--muted); margin-top: 0.15rem; }
.fav-empty { color: var(--muted); font-style: italic; font-size: 0.85rem; padding: 0.6rem 0.2rem; }
.login-note { font-size: 0.78rem; color: var(--muted); margin: 0.8rem 0 0; line-height: 1.5; }
.login-note a { color: var(--accent); }
.login-change { margin-top: 0.8rem; font-size: 0.83rem; text-align: center; }
.login-change a { color: var(--accent); }
.btn-wide { width: 100%; justify-content: center; margin-top: 0.6rem; text-align: center; }
.login-avatar-row { display: flex; align-items: center; gap: 0.75rem; padding: 0.7rem 0.9rem; background: var(--field-bg); border: 1px solid var(--line); border-radius: 6px; margin-bottom: 0.9rem; }
.login-avatar { width: 40px; height: 40px; border-radius: 50%; flex: 0 0 40px; background: var(--line); object-fit: cover; }
.login-avatar-placeholder { width: 40px; height: 40px; border-radius: 50%; flex: 0 0 40px; background: var(--line); display: flex; align-items: center; justify-content: center; font-size: 1.1rem; color: var(--muted); }
.login-avatar-handle { font-weight: 700; font-size: 0.92rem; }
.login-avatar-fullname { font-size: 0.78rem; color: var(--muted); }
.pat-wrap { position: relative; }
.pat-reveal { position: absolute; right: 0.6rem; top: 50%; transform: translateY(-50%); background: none; border: none; cursor: pointer; font-size: 0.75rem; color: var(--muted); padding: 0.2rem 0.3rem; }
.pat-reveal:hover { color: var(--ink); }
.pat-wrap .text-input { padding-right: 3rem; }
.login-help { margin-top: 1.2rem; padding-top: 0.9rem; border-top: 1px solid var(--line); font-size: 0.8rem; color: var(--muted); text-align: center; line-height: 1.55; }
.login-help a { color: var(--accent); }
.login-request { margin-top: 1.1rem; padding-top: 0.9rem; border-top: 1px solid var(--line); text-align: center; }
.login-request-label { font-size: 0.82rem; color: var(--muted); margin: 0 0 0.55rem; }
.login-request-note { font-size: 0.75rem; color: var(--muted); margin: 0.4rem 0 0; }
.login-spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid rgba(255,255,255,.4); border-top-color: white; border-radius: 50%; animation: spin .7s linear infinite; vertical-align: middle; margin-right: .4rem; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .form { border-right: 0; border-bottom: 1px solid var(--line); }
  .field.row { grid-template-columns: 1fr 1fr; }
  .landing-cards { grid-template-columns: 1fr; max-width: 360px; }
  .workflow-grid { grid-template-columns: 1fr; }
  .sitenav-editor { display: none; }
}

/* ============================================================
   EDEP-style theme — serif identity, red accents, register lists
   ============================================================ */

/* topbar / identity */
.topbar { padding: 0.7rem 1.5rem; align-items: center; }
.brand-home { font-family: var(--serif-display); font-weight: 600; font-size: 1.55rem; color: var(--ink); letter-spacing: -0.01em; }
.brand-edep { color: var(--accent); font-weight: 700; }
.brand-sep, .brand span:not(.brand-home):not(.brand-edep) { font-family: var(--serif-body); color: var(--muted); font-weight: 400; }
.sitenav { gap: 0.1rem; }
.sitenav-editor { margin-left: 1.6rem; }
.sitenav-link { font-family: var(--serif-body); font-size: 1.02rem; color: var(--ink); border: 0; padding: 0.3rem 0.7rem; }
.sitenav-link:hover { border: 0; color: var(--accent); }
.sitenav-link.active { color: var(--accent); font-weight: 600; }
.sitenav-right { display: flex; align-items: center; padding-right: 0.4rem; border-right: 1px solid var(--line); margin-right: 0.4rem; }
.sitenav-icon { display: inline-flex; align-items: center; padding: 0.3rem 0.5rem; }
.sitenav-icon svg { width: 18px; height: 18px; }

/* topbar right: language + login */
.topbar-right { display: flex; align-items: center; gap: 1.4rem; }
.lang-box { display: flex; flex-direction: column; font-size: 0.72rem; color: var(--muted); line-height: 1.1; }
.lang-box select { font-family: var(--serif-body); font-size: 0.95rem; color: var(--ink); border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: transparent; padding: 0.1rem 1.2rem 0.1rem 0; }
.account-link { display: inline-flex; align-items: center; gap: 0.4rem; color: var(--ink); text-decoration: none; font-family: var(--serif-body); font-size: 1rem; background: transparent; border: 0; cursor: pointer; }
.account-link:hover { color: var(--accent); }
.account-link svg { width: 22px; height: 22px; }
.account-avatar { width: 20px; height: 20px; border-radius: 50%; object-fit: cover; display: inline-block; }

/* big serif page titles */
.page-title { font-family: var(--serif-display); font-weight: 600; font-size: 2.1rem; color: var(--ink); letter-spacing: 0.01em; margin: 1.6rem 0 1.4rem; }

/* form & docs headings in serif */
.section-title { font-family: var(--serif-display); font-weight: 600; text-transform: none; letter-spacing: 0.02em; color: var(--accent); font-size: 0.95rem; }
.docs-section h1 { font-family: var(--serif-display); font-weight: 600; color: var(--ink); }
.docs-section h2 { font-family: var(--serif-display); font-weight: 600; text-transform: none; letter-spacing: 0.02em; color: var(--accent); font-size: 1.1rem; }
.docs-section h3 { font-family: var(--serif-display); font-weight: 600; color: var(--ink); font-size: 0.97rem; margin: 1.2rem 0 0.4rem; }
.docs-section p, .docs-list { font-size: 1.02rem; line-height: 1.6; }
.landing-hero h1 { font-family: var(--serif-display); font-weight: 700; color: var(--ink); }
.landing-sub { font-family: var(--serif-body); }
.landing-intro { font-size: 1.05rem; }

/* register list (inscriptions / people / places) — red serif titles */
.register-controls { display: flex; gap: 1.6rem; align-items: flex-end; flex-wrap: wrap; margin: 0.4rem 0 0.6rem; }
.register-controls .field-col { display: flex; flex-direction: column; gap: 0.2rem; font-size: 0.72rem; color: var(--muted); }
.register-controls select,
.register-controls input[type="search"] { font-family: var(--serif-body); font-size: 1rem; color: var(--ink); border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: transparent; padding: 0.25rem 0.1rem; min-width: 150px; }
.register-controls input[type="search"] { min-width: 240px; }
.register-controls select:focus, .register-controls input:focus { outline: 0; border-bottom-color: var(--accent); }
.btn-new { display: inline-flex; align-items: center; gap: 0.35rem; color: var(--accent); font-family: var(--serif-body); font-weight: 600; font-size: 1.02rem; background: transparent; border: 0; cursor: pointer; padding: 0.5rem 0; text-decoration: none; }
.btn-new:hover { text-decoration: underline; }
.btn-new .plus { font-size: 1.2rem; line-height: 1; }
.register-pager { display: flex; align-items: center; gap: 0.7rem; font-size: 0.95rem; color: var(--muted); margin: 0.2rem 0 0.6rem; }
.register-pager button { font-family: var(--serif-body); border: 0; background: transparent; cursor: pointer; color: var(--ink); font-size: 1rem; padding: 0.1rem 0.4rem; }
.register-pager button.on { background: #333; color: #fff; border-radius: 50%; width: 1.8rem; height: 1.8rem; }
.register-pager button:disabled { color: var(--line); cursor: default; }

/* list items — EDEP register look */
.catalog-item { border: 0; border-top: 1px solid var(--line); border-radius: 0; margin: 0; }
.catalog-item:last-child { border-bottom: 1px solid var(--line); }
.catalog-monument { background: transparent; padding: 0.85rem 0.2rem; }
.catalog-title { font-family: var(--serif-display); font-weight: 600; font-size: 1.05rem; color: var(--accent); letter-spacing: 0.01em; }
.catalog-title a { color: inherit; text-decoration: none; }
.catalog-title a:hover { text-decoration: underline; }
.catalog-filename, .catalog-meta { font-family: var(--serif-body); color: var(--muted); }
.catalog-tag { background: transparent; color: var(--muted); border: 1px solid var(--line); border-radius: 2px; font-family: var(--serif-body); }
.catalog-actions .btn { font-family: var(--serif-body); }
.catalog-head h2, .catalog-wrap > .page-title { font-family: var(--serif-display); }

/* two-column register (people, places) */
.register-two-col .catalog-monument { padding: 0.6rem 0.2rem; }
@media (min-width: 760px) {
  .register-two-col #cat-list, .register-two-col #ppl-list { display: grid; grid-template-columns: 1fr 1fr; column-gap: 3.5rem; align-items: start; }
  .register-two-col .catalog-item { border-top: 0; border-bottom: 1px solid var(--line); }
}

/* compact people register rows */
.ppl-list { display: flex; flex-direction: column; }
.ppl-row { display: flex; align-items: baseline; gap: 0.5rem; padding: 0.28rem 0; border-bottom: 1px solid var(--line); min-width: 0; }
.ppl-row:hover { background: #fafafa; }
.ppl-row.selected { background: #fbf4f4; }
.ppl-name { font-family: var(--serif-body); font-size: 0.95rem; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 0 1 auto; }
a.ppl-name { color: var(--accent); text-decoration: none; }
a.ppl-name:hover { text-decoration: underline; }
.ppl-chips { font-size: 0.78rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1 1 0; min-width: 0; }
.ppl-tags { display: flex; gap: 0.25rem; flex-shrink: 0; margin-left: auto; }
.ppl-hd { white-space: nowrap; }
.ppl-edit { font-size: 0.72rem; padding: 0.1rem 0.4rem; }
/* person name — opens right panel */
button.ppl-name { background: none; border: none; padding: 0; cursor: pointer; font-family: var(--serif-body); font-size: 0.95rem; color: var(--accent); text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 0 1 auto; }
button.ppl-name:hover { text-decoration: underline; }
/* person detail inside the right panel */
.ppl-detail-dl { display: grid; grid-template-columns: 7rem 1fr; gap: 0.12rem 0.5rem; margin-bottom: 0.7rem; font-size: 0.88rem; }
.ppl-detail-dl dt { color: var(--muted); font-size: 0.8rem; }
.ppl-detail-dl dd { margin: 0; }
.ppl-detail-actions { display: flex; gap: 0.4rem; flex-wrap: wrap; }
/* find-spot entries */
.geo-entry { display: flex; align-items: flex-start; gap: 0.4rem; padding: 0.3rem 0.1rem; border-bottom: 1px solid var(--line); cursor: pointer; }
.geo-entry:hover { background: #fafafa; }
.geo-entry.selected { background: #fbf4f4; }
.geo-entry-body { flex: 1; min-width: 0; }
.geo-name { font-family: var(--serif-body); font-size: 0.9rem; display: block; }
.geo-gid { font-size: 0.72rem; }
.geo-meta { font-size: 0.78rem; color: var(--muted); display: block; }
.geo-links { flex-shrink: 0; display: flex; gap: 0.2rem; flex-direction: column; align-items: flex-end; }
.geo-place-head { display: flex; align-items: center; gap: 0.5rem; padding: 0.35rem 0.2rem; border-bottom: 1px solid var(--line); margin-bottom: 0; }
.geo-back-btn { background: none; border: 1px solid var(--line); border-radius: 3px; padding: 0.15rem 0.5rem; cursor: pointer; font-family: var(--serif-body); font-size: 0.8rem; color: var(--muted); white-space: nowrap; flex-shrink: 0; }
.geo-back-btn:hover { border-color: var(--accent); color: var(--accent); }
.geo-place-title { font-family: var(--serif-body); font-size: 0.9rem; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* find-spot detail card */
.geo-detail-card { padding: 0.6rem 0.3rem 0.5rem; border-bottom: 2px solid var(--accent); margin-bottom: 0.4rem; }
.geo-detail-name { font-family: var(--serif-display); font-size: 1.15rem; font-weight: 600; color: var(--ink); margin: 0 0 0.4rem; }
.geo-detail-dl { display: grid; grid-template-columns: 8rem 1fr; gap: 0.1rem 0.5rem; font-size: 0.85rem; margin-bottom: 0.5rem; }
.geo-detail-dl dt { color: var(--muted); font-size: 0.78rem; }
.geo-detail-dl dd { margin: 0; }
.geo-detail-links { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.geo-inscr-head { font-size: 0.78rem; color: var(--muted); padding: 0.3rem 0.1rem 0.3rem; border-bottom: 1px solid var(--line); margin-bottom: 0.1rem; }
.geo-place-more { font-size: 0.78rem; color: var(--muted); padding: 0.5rem 0.2rem; border-top: 1px solid var(--line); margin-top: 0.3rem; }

/* buttons in serif */
.btn { font-family: var(--serif-body); }
.btn.primary { background: var(--accent); border-color: var(--accent); }

/* reading view headings */
.reading-title { font-family: var(--serif-display); font-weight: 600; color: var(--ink); }
.reading-section h3 { font-family: var(--serif-display); text-transform: none; letter-spacing: 0.02em; color: var(--accent); font-size: 1rem; }

/* editor section titles keep serif but compact */
.field .label { font-family: var(--serif-body); font-size: 0.85rem; }

/* viewer action row */
.viewer-actions { display: flex; gap: 0.5rem; margin-bottom: 1rem; }
.viewer-actions .btn { font-size: 0.85rem; }

/* linked external identifiers (viewer) — upstream edep #15 */
.reading-ids { display: flex; flex-wrap: wrap; gap: 0.4rem 1.1rem; margin: 0 0 1.2rem; font-size: 0.9rem; }
.reading-ids .id-item { white-space: nowrap; }
.reading-ids .id-type { color: var(--muted); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; }
.reading-ids a { color: var(--accent); text-decoration: none; }
.reading-ids a:hover { text-decoration: underline; }

/* fullscreen / modal editor — upstream edep #39 */
jinn-epidoc-editor.editor-fullscreen {
  position: fixed; inset: 0; z-index: 2000; margin: 0; border-radius: 0;
  background: #fff; padding: 3.2rem 1.6rem 1.6rem; overflow: auto;
  box-shadow: 0 0 0 100vmax rgba(0,0,0,0.4);
}
body.has-fullscreen-editor { overflow: hidden; }
.edition-fs-hint { position: fixed; top: 0.7rem; right: 1.2rem; z-index: 2001; font-size: 0.8rem; color: var(--muted); display: none; }
body.has-fullscreen-editor .edition-fs-hint { display: block; }

/* docs tip box */
.docs-tip { background: #fbf4f4; border-left: 3px solid var(--accent); padding: 0.7rem 0.9rem; border-radius: 0 4px 4px 0; }
.docs-tip kbd { background: #fff; border: 1px solid var(--line); border-radius: 3px; padding: 0 0.3rem; font-size: 0.85em; }
.docs-code { background: var(--field-bg); border: 1px solid var(--line); border-radius: 4px; padding: 0.6rem 0.9rem; font-size: 0.8rem; line-height: 1.6; overflow-x: auto; margin: 0.4rem 0 0.6rem; font-family: monospace; white-space: pre; display: block; }

/* register pager ellipsis + bibliography citations */
.reg-ell { color: var(--muted); padding: 0 0.2rem; }
.bib-cite { font-family: var(--serif-body); font-size: 1rem; line-height: 1.5; color: var(--ink); }
.bib-cite em { font-style: italic; }
.bib-cite .bib-author { font-weight: 600; }

/* photos gallery */
.photo-credit { font-size: 0.82rem; color: var(--muted); margin: -0.4rem 0 1rem; }
.photo-credit a { color: var(--accent); }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0.8rem; }
.photo-tile { display: flex; flex-direction: column; text-decoration: none; border: 1px solid var(--line); border-radius: 4px; overflow: hidden; background: #faf8f4; }
.photo-tile:hover { border-color: var(--accent); }
.photo-tile img { width: 100%; height: 150px; object-fit: cover; background: #eee; display: block; }
.photo-noimg { height: 150px; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 0.8rem; }
.photo-cap { font-size: 0.74rem; color: var(--ink); padding: 0.3rem 0.4rem; line-height: 1.3; }
a.catalog-tag { text-decoration: none; }
a.catalog-tag:hover { border-color: var(--accent); }
.catalog-tag.tag-photo { color: var(--accent); border-color: var(--accent); }

/* IIIF viewer in the inscription viewer */
#osd-host { width: 100%; height: 62vh; min-height: 340px; background: #1f2023; border: 1px solid var(--line); border-radius: 5px; }
.iiif-thumbs { display: flex; gap: 0.4rem; flex-wrap: wrap; margin: 0.6rem 0 0.3rem; }
.iiif-thumb { width: 62px; height: 62px; object-fit: cover; border: 2px solid transparent; border-radius: 3px; cursor: pointer; background: #eee; }
.iiif-thumb.on { border-color: var(--accent); }
.iiif-credit { font-size: 0.76rem; color: var(--muted); margin-top: 0.4rem; }
.iiif-credit a { color: var(--accent); }

/* faceted filter bar (EDH-style dropdowns) */
.facet-bar { display: flex; flex-wrap: wrap; gap: 0.5rem 0.9rem; align-items: flex-end; margin: 0.2rem 0 0.6rem; padding: 0.6rem 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.facet { display: flex; flex-direction: column; font-size: 0.72rem; color: var(--muted); gap: 0.15rem; }
.facet select { font-family: var(--serif-body); font-size: 0.95rem; color: var(--ink); border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: transparent; padding: 0.2rem 0.1rem; max-width: 210px; }
.facet select:focus { outline: 0; border-bottom-color: var(--accent); }
.facet-date span { display: flex; align-items: center; gap: 0.3rem; color: var(--ink); }
.facet .yr { width: 4.4rem; font-size: 0.95rem; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: transparent; padding: 0.2rem 0.1rem; }
.facet-check { flex-direction: row; align-items: center; gap: 0.3rem; font-size: 0.92rem; color: var(--ink); }
.facet-check input { width: auto; }
#f-reset { align-self: center; }

/* faceted catalogue: left facet sidebar + results column */
.catalog-wrap.with-facets { display: grid; grid-template-columns: 232px 1fr; gap: 1.8rem; align-items: start; }
.facet-side { display: flex; flex-direction: column; gap: 0.85rem; position: sticky; top: 0.8rem; }
.facet-side .facet { width: 100%; }
.facet-side .facet select, .facet-side .facet input[type="search"], .facet-side .facet input[type="number"] { max-width: none; width: 100%; }
.facet-side .facet-date span { display: flex; align-items: center; gap: 0.3rem; }
.facet-side .facet-date .yr { width: 4.4rem; }
.facet-side #f-reset { align-self: flex-start; margin-top: 0.2rem; }
.catalog-main { min-width: 0; }
.register-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 0.4rem; }
.register-head .register-pager { margin: 0; }
@media (max-width: 820px) {
  .catalog-wrap.with-facets { grid-template-columns: 1fr; }
  .facet-side { position: static; }
}

/* right-side reading panel (docked drawer) */
.record-panel { position: fixed; top: 56px; right: 0; bottom: 0; width: clamp(340px, 42vw, 560px); background: #fff; border-left: 1px solid var(--line); box-shadow: -10px 0 30px rgba(0,0,0,0.10); z-index: 900; display: flex; flex-direction: column; transform: translateX(102%); transition: transform 0.22s ease; }
.record-panel.open { transform: translateX(0); }
.record-panel-head { display: flex; align-items: center; gap: 0.5rem; padding: 0.55rem 0.9rem; border-bottom: 1px solid var(--line); flex-shrink: 0; }
.record-panel-id { font-family: var(--serif-body); color: var(--muted); font-size: 0.9rem; margin-right: auto; }
.record-panel-body { overflow: auto; padding: 0.9rem 1.1rem 2rem;
  display: grid; grid-template-columns: minmax(0,1fr) 152px;
  grid-template-rows: auto auto auto auto 1fr; column-gap: 0.9rem; align-items: start; }
#rp-reading { grid-column: 1; grid-row: 1 / -1; }
#rp-image   { grid-column: 2; grid-row: 1; }
#rp-thumbs  { grid-column: 2; grid-row: 2; }
#rp-credit  { grid-column: 2; grid-row: 3; }
#rp-map     { grid-column: 2; grid-row: 4; }
#rp-image:empty { display: none; }
#rp-thumbs:empty { display: none; }
#rp-image .img-frame { margin-bottom: 0; }
#rp-image .img-frame.size-s .osd,
#rp-image .img-frame.size-m .osd { height: 150px; }
#rp-image .img-frame.size-l .osd { height: 300px; }
#rp-image .viewer-image { max-height: 180px; object-fit: contain; }
.rp-image:empty { display: none; }
.rp-map { width: 100%; height: 140px; border: 1px solid var(--line); border-radius: 5px; margin: 0.5rem 0 0; }
.rp-map:empty { display: none; }
.rp-reading .reading-title { font-size: 1.15rem; }
.catalog-item.selected { background: #fbf4f4; }
.catalog-item.selected .catalog-title a { text-decoration: underline; }

/* IIIF image frame with three size presets (S/M/L) */
.img-frame { position: relative; border: 1px solid var(--line); border-radius: 5px; overflow: hidden; background: #1f2023; margin-bottom: 0.5rem; }
.img-frame .osd { width: 100%; }
.img-frame.size-s .osd { height: 170px; }
.img-frame.size-m .osd { height: 300px; }
.img-frame.size-l .osd { height: 68vh; min-height: 460px; }
.img-presets { position: absolute; top: 6px; right: 6px; z-index: 5; display: flex; gap: 2px; background: rgba(255,255,255,0.92); border: 1px solid var(--line); border-radius: 5px; padding: 2px; }
.img-presets button { font-family: var(--serif-body); font-size: 0.78rem; width: 1.7rem; height: 1.5rem; border: 0; background: transparent; cursor: pointer; border-radius: 3px; color: var(--ink); }
.img-presets button.on { background: var(--accent); color: #fff; }
@media (max-width: 560px) { .record-panel { width: 100vw; } }

/* collection selector + badges */
.collections-picker { border-bottom: 1px solid var(--line); padding-bottom: 0.7rem; margin-bottom: 0.2rem; }
.col-toggle { background: none; border: none; padding: 0; cursor: pointer; font-size: 0.72rem; color: var(--muted); width: 100%; text-align: left; display: flex; align-items: center; margin-bottom: 0.35rem; font-family: inherit; }
.col-toggle:hover { color: var(--ink); }
.col-count { color: var(--ink); margin-left: 0.15em; }
.col-chevron { margin-left: auto; flex-shrink: 0; transition: transform 0.18s; }
.collections-picker.collapsed .col-chevron { transform: rotate(-90deg); }
.collections-picker.collapsed .col-body { display: none; }
.col-check { display: flex; align-items: center; gap: 0.35rem; font-size: 0.92rem; color: var(--ink); padding: 0.12rem 0; cursor: pointer; }
.col-check input { width: auto; margin: 0; }
.col-check.reconcile { margin-top: 0.35rem; padding-top: 0.4rem; border-top: 1px dashed var(--line); color: var(--accent); font-size: 0.86rem; }
.col-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: 0 0 auto; }
.col-dot.col-edh { background: #cc0000; } .col-dot.col-isic { background: #127a4f; } .col-dot.col-local { background: #6e1423; }
.col-badge { font-size: 0.7rem; padding: 0 0.32rem; border-radius: 3px; color: #fff; }
.col-badge.col-edh { background: #cc0000; } .col-badge.col-isic { background: #127a4f; } .col-badge.col-local { background: #6e1423; }
.catalog-tag.tag-also { color: #127a4f; border-color: #127a4f; }
