/* Publication browsing styles adapted from the desktop application's app/style.css. */
:root {
  --brand-blue: #1570ef; --brand-blue-hover: #175cd3;
  --page: #fff; --panel: #f2f7fc; --control: #fff; --text: #10263f;
  --muted: #4e535d; --border: #7894ad; --logo: var(--brand-blue);
  --focus: var(--brand-blue); --hover: #d1eaf6; --danger: #a42035;
  --chrome-line: #d7e0e9; --chrome-soft: #edf2f8; --chrome-muted: #536579;
  --chrome-active: #e8f0fc; --card-surface: #fff; --chrome-shadow: #10263f0a;
  color-scheme: light;
  font: 14px Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
html[data-theme="dark"] {
  --page: #000; --panel: #020b18; --control: #10263f; --text: #fff;
  --muted: #b5bcc5; --border: #597690; --logo: #fff; --focus: #b2ddff;
  --hover: #1b3858; --danger: #ff8c9b; --chrome-line: #28384b;
  --chrome-soft: #112034; --chrome-muted: #9aaabd; --chrome-active: #112c50;
  --card-surface: #020b18; --chrome-shadow: #0004;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; background: var(--page); color: var(--text); }
button, input, select { font: inherit; color: var(--text); background: var(--control); border: 1px solid var(--border); border-radius: 7px; padding: 9px 12px; }
button { cursor: pointer; white-space: nowrap; }
button:hover:not(:disabled) { background: var(--hover); }
button:disabled { opacity: .45; cursor: default; }
button.primary { background: var(--brand-blue); border-color: var(--brand-blue); color: #fff; }
button.primary:hover:not(:disabled) { background: var(--brand-blue-hover); }
button.danger, .form-error { color: var(--danger); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
a { color: var(--focus); text-underline-offset: 3px; }
input[type="checkbox"] { accent-color: var(--brand-blue); }
h1, h2, h3, p { margin: 0; }
.session-check :is(#shell, #adminContent, dialog, #hoverPreview, #abstractPreview) { visibility: hidden; }
.session-message { display: flex; gap: 12px; align-items: center; justify-content: center; padding: 20px; }

body > header { flex: none; min-height: 74px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; padding: 17px 28px; gap: 20px; border-bottom: 1px solid var(--chrome-line); }
.header-brand { display: flex; align-items: center; gap: 24px; min-width: 0; }
.header-title { font-size: 32px; line-height: 1.2; letter-spacing: -1px; font-weight: 600; }
#brand { display: flex; align-items: center; gap: 24px; color: var(--text); text-decoration: none; font-size: 15px; font-weight: 650; letter-spacing: -.2px; }
#logo { display: block; width: 146px; aspect-ratio: 362.8 / 67.2; flex-shrink: 0; background: var(--logo); mask: url("/assets/dho-logo.svg") center / contain no-repeat; transform: translateY(-11%); }
.header-actions { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.header-actions button { background: var(--control); border-color: var(--chrome-line); font-size: 13px; padding: 9px 14px; min-height: 38px; }
#shell { display: grid; grid-template-columns: minmax(0, 1fr); flex: 1; min-height: 0; }
#shell.has-detail { grid-template-columns: minmax(260px, 1fr) minmax(350px, 470px); }
.appearance { display: flex; align-items: center; gap: 8px; }
.appearance-label { font-size: 9px; text-transform: uppercase; letter-spacing: 1.4px; color: var(--chrome-muted); }
.theme-select { display: inline-flex; border: 1px solid var(--chrome-line); border-radius: 7px; background: var(--control); }
/* Keep the browser's arrow, inset within the select's clickable area. */
#theme { min-width: 118px; min-height: 36px; font-size: 13px; border: 0; border-right: 10px solid transparent; border-radius: 6px; background: transparent; }
#shell > main { display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden; padding: 29px 30px 22px; container-type: inline-size; }
.heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 16px; min-height: 40px; margin-bottom: 18px; flex: none; }
.heading h1 { font-size: 32px; line-height: 1.2; letter-spacing: -1px; font-weight: 600; overflow-wrap: anywhere; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; flex: none; gap: 8px; padding-bottom: 16px; border-bottom: 1px solid var(--chrome-line); }
.ui-icon { width: 16px; height: 16px; flex: none; vertical-align: middle; }
.search-wrap { display: flex; align-items: center; gap: 9px; flex: 1 1 300px; min-width: 0; min-height: 40px; padding: 0 10px; border: 1px solid var(--chrome-line); border-radius: 7px; background: var(--control); color: var(--chrome-muted); }
.search-wrap:focus-within { outline: 2px solid var(--focus); outline-offset: 2px; }
#search { width: 100%; min-width: 0; flex: 1; border: 0; padding: 10px 0; background: transparent; font-size: 13px; outline: none; }
#search::placeholder { color: var(--chrome-muted); opacity: 1; }
.search-wrap kbd { font: inherit; }
#searchScope { width: 111px; max-width: 43%; padding: 6px 2px 6px 8px; font-size: 11px; border: 0; border-left: 1px solid var(--chrome-line); border-radius: 0; background: transparent; color: var(--chrome-muted); }
#searchField { max-width: 100%; font-size: 12px; border-color: var(--chrome-line); }
.toolbar-actions, .layout-toggle { display: flex; align-items: center; gap: 7px; }
.toolbar-actions > button, .layout-toggle button, .catalog-controls > button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; font-size: 12px; min-height: 38px; padding: 8px 11px; border-color: var(--chrome-line); }
.toolbar-actions > .icon-button { padding: 9px; width: 38px; }
.layout-toggle { gap: 0; border: 1px solid var(--chrome-line); border-radius: 7px; padding: 2px; background: var(--chrome-soft); }
.layout-toggle button { border: 0; border-radius: 5px; background: transparent; color: var(--chrome-muted); min-height: 32px; padding: 7px 10px; }
.layout-toggle button[aria-pressed="true"] { background: var(--control); color: var(--text); box-shadow: 0 1px 4px #0002; }
.catalog-meta { display: flex; align-items: center; flex: none; padding: 14px 0 12px; color: var(--chrome-muted); }
.catalog-controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.catalog-controls > button { font-size: 11px; min-height: 34px; padding: 6px 8px; gap: 5px; }
#subtitle { font-size: 12px; color: var(--chrome-muted); margin-right: 3px; }
#ruleSummary { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; margin: 0 0 13px -3px; padding: 3px; max-height: 25vh; overflow: auto; flex: none; }
#ruleSummary:empty { display: none; }
#ruleSummary .rule-tag { display: inline-flex; align-items: center; gap: 5px; border: 0; border-radius: 4px; background: var(--chrome-soft); color: var(--chrome-muted); font-size: 11px; padding: 3px 5px 3px 8px; max-width: 100%; }
.rule-tag button, .rule-tag .rule-grip { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; min-height: 22px; border: 0; border-radius: 3px; padding: 0 3px; background: transparent; color: inherit; }
.rule-tag button:hover, .rule-tag .rule-grip[draggable="true"]:hover { background: var(--hover); color: var(--text); }
.rule-grip[draggable="true"] { cursor: grab; }
.rule-grip[aria-disabled="true"] { opacity: .35; }
.rule-grip svg { pointer-events: none; }
.rule-tag.dragging { opacity: .4; }
.rule-tag.drop-before { box-shadow: -3px 0 0 var(--focus); }
.rule-tag.drop-after { box-shadow: 3px 0 0 var(--focus); }
.rule-label { min-width: 0; overflow-wrap: anywhere; }
.rule-tag .rule-toggle { white-space: normal; text-align: left; }
#notice { margin-bottom: 7px; }
#collection { flex: 1; min-height: 0; overflow: auto; padding: 3px 3px 12px; scrollbar-gutter: stable; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(230px, 100%), 1fr)); gap: 18px; }
#collection[data-card-size="small"] .cards { grid-template-columns: repeat(auto-fill, minmax(min(180px, 100%), 1fr)); }
#collection[data-card-size="large"] .cards { grid-template-columns: repeat(auto-fill, minmax(min(340px, 100%), 1fr)); }
#collection[data-card-size="small"] .card-image { height: 135px; }
#collection[data-card-size="large"] .card-image { height: 245px; }
.card { display: flex; flex-direction: column; border: 1px solid var(--chrome-line); border-radius: 9px; background: var(--card-surface); overflow: hidden; cursor: pointer; position: relative; isolation: isolate; }
.card:hover { border-color: var(--focus); box-shadow: 0 3px 14px var(--chrome-shadow); }
.card.active-record { box-shadow: 0 0 0 2px var(--focus); }
.card-image { flex: none; height: 170px; display: flex; align-items: center; justify-content: center; background: var(--control); border-bottom: 1px solid var(--chrome-line); overflow: hidden; }
.card-image button { width: 100%; height: 100%; border: 0; border-radius: 0; background: transparent; padding: 0; }
.card-image button:focus-visible { outline-offset: -4px; }
.card-image img { display: block; width: 100%; height: 100%; object-fit: contain; }
.card-body { flex: 1; padding: 14px 15px 16px; }
.card-body:focus-visible { outline-offset: -4px; }
.card h3 { font-size: 15px; font-weight: 600; line-height: 1.45; margin-bottom: 11px; }
.card:has(.card-subheader) h3 { margin-bottom: 6px; }
.card-subheader { display: flex; flex-direction: column; gap: 2px; color: var(--chrome-muted); font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }
.card-subheader time { font-size: 11px; font-variant-numeric: tabular-nums; }
.card-facts { border-top: 1px solid var(--chrome-muted); margin-top: 12px; padding-top: 10px; }
.card-facts > * + * { margin-top: 9px; }
.card-fact { display: flex; flex-direction: column; gap: 2px; color: var(--chrome-muted); font-size: 12px; line-height: 1.6; overflow-wrap: anywhere; }
.card-fact strong { color: var(--text); font-size: 11px; }
.publication-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.pill { display: inline-block; border-radius: 5px; background: var(--chrome-soft); color: var(--chrome-muted); padding: 3px 7px; font-size: 11px; line-height: 1.4; overflow-wrap: anywhere; }
.card .pill { font-size: 10px; }
.group-heading { margin: 14px 0 9px; font-size: 13px; color: var(--muted); }
.table-wrap { overflow: auto; border: 1px solid var(--chrome-line); border-radius: 8px; }
#collection > .table-wrap { height: 100%; }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th, td { padding: 12px 14px; border-bottom: 1px solid var(--chrome-line); vertical-align: top; }
th { position: sticky; top: 0; z-index: 1; background: var(--panel); text-align: left; font-size: 11px; font-weight: 550; color: var(--chrome-muted); white-space: nowrap; }
td { min-width: 130px; max-width: 300px; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.6; }
tr[data-record] { cursor: pointer; }
tr[data-record]:hover, tr.active-record { background: var(--chrome-active); }
tr[data-record]:focus-visible { outline-offset: -3px; }
td.primary-cell { font-weight: 600; }
td button { white-space: normal; text-align: left; }
.grid-media { display: flex; flex-wrap: wrap; gap: 6px; }
.grid-media button { display: grid; place-items: center; width: 65px; height: 48px; padding: 0; overflow: hidden; }
.grid-media img { width: 100%; height: 100%; object-fit: contain; }
.empty { text-align: center; padding: 70px 20px; color: var(--muted); }

#detail { display: flex; flex-direction: column; min-width: 0; overflow: hidden; background: var(--page); border-left: 1px solid var(--border); }
#detail .dialog-head { padding: 19px 20px; flex: none; }
#detail h2 { font-size: 20px; line-height: 1.45; overflow-wrap: anywhere; }
#detail .dialog-body { flex: 1; min-height: 0; max-height: none; padding: 20px; }
.eyebrow { font-size: 10px; letter-spacing: 1.8px; margin: 0 0 3px; color: var(--muted); }
.record-navigation { display: flex; align-items: center; gap: 5px; }
.field { margin: 0 0 18px; min-width: 0; }
.field label, .field-name { display: block; font-size: 12px; font-weight: 650; margin-bottom: 7px; }
.field input:not([type="checkbox"]), .field select { width: 100%; }
.field small, .muted { color: var(--muted); }
.field small { display: block; line-height: 1.6; margin-top: 6px; }
.field-value { overflow-wrap: anywhere; line-height: 1.6; white-space: pre-wrap; }
.markdown { background: var(--panel); border-radius: 8px; padding: 13px; line-height: 1.65; overflow-wrap: anywhere; white-space: pre-wrap; }
.attachments { display: grid; gap: 10px; }
.attachment { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px; border: 1px solid var(--border); border-radius: 9px; min-width: 0; }
.attachment .caption { flex: 1; min-width: 90px; overflow-wrap: anywhere; font-size: 12px; line-height: 1.6; }
.attachment .preview-button { display: grid; place-items: center; width: 90px; height: 65px; padding: 0; flex: none; overflow: hidden; }
.attachment .preview-button img { width: 100%; height: 100%; object-fit: contain; }
.attachment-actions { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; width: 100%; }
.attachment-actions button, .attachment-actions a { font-size: 11px; }
.attachment-actions button { padding: 6px 8px; }

dialog { padding: 0; border: 1px solid var(--border); border-radius: 15px; color: var(--text); background: var(--page); box-shadow: 0 20px 100px #0005; max-height: 92dvh; max-width: calc(100vw - 20px); }
dialog::backdrop { background: #0009; }
#modal { width: min(690px, 96vw); }
#codeDialog { width: min(540px, 96vw); }
.dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding: 23px 26px; border-bottom: 1px solid var(--border); background: var(--panel); }
.dialog-head h2 { padding-top: 2px; }
.dialog-head button { font-size: 24px; padding: 0 10px; }
.dialog-body { padding: 23px 26px; overflow: auto; max-height: calc(88dvh - 110px); }
.rule-editor { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 8px 0; }
.rule-editor :is(select, input) { min-width: 120px; flex: 1; }
.rule-editor .rule-buttons { display: flex; align-items: center; gap: 4px; }
.rule-buttons button { padding-inline: 9px; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 18px 0 0; }
.display-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 8px 0 16px; }
.display-options label { display: flex; align-items: flex-start; gap: 6px; }
#hoverPreview, #abstractPreview { position: fixed; z-index: 120; background: var(--panel); border: 1px solid var(--border); border-radius: 13px; box-shadow: 0 16px 60px #0004; }
#hoverPreview { padding: 10px; max-width: calc(100vw - 24px); }
#hoverPreviewOpen { display: block; width: 100%; border: 0; padding: 0; background: transparent; white-space: normal; text-align: left; }
#hoverPreviewMedia { display: flex; align-items: center; justify-content: center; width: min(460px, calc(100vw - 44px)); height: min(330px, 50vh); background: var(--control); border-radius: 7px; overflow: hidden; }
#hoverPreviewMedia img { max-width: 100%; max-height: 100%; object-fit: contain; }
#hoverPreviewCaption { display: block; padding: 10px 4px 1px; overflow-wrap: anywhere; font-size: 12px; line-height: 1.6; }
#abstractPreview { width: min(500px, calc(100vw - 24px)); max-height: min(520px, calc(100dvh - 24px)); overflow: auto; overscroll-behavior: contain; padding: 0 20px 20px; line-height: 1.7; }
.abstract-preview-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; position: sticky; top: 0; background: var(--panel); padding: 13px 0 9px; }
.abstract-preview-title { flex: 1; min-width: 0; }
.abstract-preview-head strong { display: block; padding: 4px 0; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--chrome-muted); }
#abstractPreviewActions { display: flex; flex-wrap: wrap; gap: 6px; }
#abstractPreviewActions button { font-size: 11px; line-height: 1.4; padding: 4px 7px; border-radius: 5px; }
#closeAbstract { font-size: 19px; line-height: 1; padding: 5px 8px; border-color: transparent; background: transparent; color: var(--chrome-muted); }
#abstractPreviewText { font-size: 13px; white-space: pre-wrap; overflow-wrap: anywhere; user-select: text; }
#viewer { width: min(1100px, 96vw); height: 92dvh; }
#viewer[open] { display: flex; flex-direction: column; }
#viewer .dialog-head { flex: none; padding: 15px 20px; }
#viewerTitle { font-size: 19px; overflow-wrap: anywhere; }
#viewerTools { flex: none; display: flex; gap: 7px; align-items: center; flex-wrap: wrap; padding: 10px 20px; }
.viewer-position { flex: 1; min-width: 130px; overflow-wrap: anywhere; font-size: 12px; }
.viewer-file-select { max-width: min(240px, 100%); min-width: 100px; }
#viewerBody { flex: 1; min-height: 0; overflow: auto; position: relative; padding: 12px; background: var(--panel); }
#viewerBody .zoom-canvas { margin: auto; }
#viewerBody .zoom-canvas img { display: block; width: 100%; height: 100%; object-fit: contain; user-select: none; touch-action: none; cursor: grab; }
#viewerFilmstrip { flex: none; display: flex; gap: 8px; padding: 10px 18px; border-top: 1px solid var(--border); overflow: auto; }
#viewerFilmstrip button { flex: none; display: flex; align-items: center; gap: 7px; padding: 5px 7px; width: 130px; white-space: normal; font-size: 10px; text-align: left; line-height: 1.4; }
#viewerFilmstrip button[aria-current="true"] { border-color: var(--focus); box-shadow: 0 0 0 1px var(--focus); }
.film-thumb { width: 44px; height: 40px; flex: none; display: grid; place-items: center; background: var(--chrome-soft); overflow: hidden; }
.film-thumb img { max-width: 100%; max-height: 40px; object-fit: contain; }
#zoomLevel { font-size: 12px; min-width: 42px; text-align: center; }
.viewer-empty { padding: 40px 20px; line-height: 1.7; text-align: center; }
.account-area { flex: 1; overflow: auto; min-height: 0; padding: 30px 24px; display: grid; place-items: center; }
.sign-in-card { width: min(420px, 100%); padding: 32px; border: 1px solid var(--chrome-line); border-radius: 12px; background: var(--panel); }
.sign-in-card h1 { margin-bottom: 24px; font-size: 28px; letter-spacing: -.6px; }
.form-error:not(:empty) { margin: 12px 0; line-height: 1.5; }
.admin-area { place-items: start center; }
.admin-content { width: min(1100px, 100%); min-width: 0; }
.admin-content td { min-width: 100px; }
.admin-content td:last-child { white-space: normal; min-width: 160px; }
.admin-content td button { padding: 5px 8px; margin-right: 5px; font-size: 12px; }
.code-value { display: block; padding: 12px; margin-top: 12px; border: 1px solid var(--border); border-radius: 7px; overflow-wrap: anywhere; user-select: all; }

@container (max-width: 700px) { .search-wrap { flex-basis: 100%; } .toolbar-actions { width: 100%; } #displayBtn { margin-left: auto; } .heading h1 { font-size: 28px; } }
@container (max-width: 360px) { .search-wrap kbd { display: none; } .search-wrap { gap: 6px; } #searchScope { width: 97px; } }
@media (max-width: 1200px) {
  #shell.has-detail { grid-template-columns: minmax(220px, 1fr) minmax(340px, 390px); }
  #shell > main { padding: 24px 22px 18px; }
}
@media (max-width: 900px) {
  body > header { padding: 15px 20px; }
  .header-brand { gap: 16px; }
  #brand { gap: 16px; font-size: 13px; }
  #logo { width: 125px; }
  #detail .dialog-head { flex-wrap: wrap; gap: 9px; }
  #detail .record-navigation { order: -1; margin-left: auto; }
}
@media (max-width: 760px) {
  #shell.has-detail { grid-template-columns: minmax(0, 1fr); }
  #detail { position: fixed; right: 0; top: var(--header-height, 74px); bottom: 0; z-index: 20; width: min(82vw, 390px); box-shadow: -12px 0 45px #0005; }
  #detail .dialog-head, #detail .dialog-body { padding: 13px; }
}
@media (max-width: 600px) {
  body > header { gap: 10px; padding: 13px 14px; }
  .header-brand { gap: 12px; }
  .header-title { font-size: 28px; }
  #brand { gap: 9px; }
  #logo { transform: none; width: 110px; }
  #shell, #shell.has-detail { display: flex; flex-direction: column; }
  .header-actions { gap: 8px; }
  .appearance-label { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  #shell > main { flex: 1; padding: 20px 16px 14px; }
  #detail { width: min(100vw, 390px); }
  #viewerTools, #viewer .dialog-head { padding: 8px 10px; }
  #viewerTools button, #viewerTools select { font-size: 12px; padding: 6px 8px; }
  .dialog-head, .dialog-body { padding: 18px; }
  .sign-in-card { padding: 24px; }
}
