:root {
  --line: #25a4a4;
  --action: #116d6d;
  --nav: #c9e7ea;
  --selected: #beedf0;
  --ink: #111;
  --muted: #566365;
  font-family: Arial, sans-serif;
  color: var(--ink);
  background: #fff;
}
* { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
h1, h2, h3 { line-height: 1.15; }
h1, h2 { margin: 0; }
button, input, select, summary { font: inherit; color: inherit; }
button, select, summary, input:not([type=file]) {
  min-height: 36px; border: 1px solid var(--action); border-radius: 5px; background: transparent;
}
button, summary { padding: 5px 10px; cursor: pointer; color: var(--action); font-weight: 700; }
button:hover:not(:disabled), button:active:not(:disabled), summary:hover { background: var(--action); color: white; }
button:disabled { color: var(--muted); border-color: #b0bfc0; cursor: default; opacity: .64; }
button img { height: 1.1em; width: 1.1em; vertical-align: -.19em; }
button:hover:not(:disabled) > img { filter: invert(1); }
a { color: var(--action); }
input:not([type=file]), select { padding: 5px 9px; min-width: 0; }
input::placeholder { color: #4f5759; opacity: 1; }
:focus-visible { outline: 2px solid #1e6091; outline-offset: 2px; }
.muted { color: var(--muted); }
.top {
  min-height: 63px; display: flex; justify-content: space-between; align-items: center;
  border-bottom: 2px solid var(--line); padding: 8px 16px; gap: 20px;
}
.top h1 { font-size: clamp(22px, 2.16vw, 33px); }
.top form, .in-text-search { display: flex; align-items: center; min-width: 0; gap: 4px; }
.top form { width: min(29vw, 405px); position: relative; }
.top form input { flex: 1; width: 100%; padding-left: 35px; }
.top form button { position: absolute; left: 1px; min-height: 34px; border: 0; }
.workspace {
  --left: 19%; --right: 35.4%; --reader-size: 16pt;
  display: grid; grid-template-columns: var(--left) 1px minmax(0, 1fr) 1px var(--right);
  height: calc(100dvh - 63px); min-height: 360px;
}
.column { min-width: 0; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.scroll { overflow: auto; min-height: 0; flex: 1; scrollbar-color: #b8bfc0 #f7f7f7; }
.sidebar { background: var(--nav); font-size: 10pt; }
.sidebar-head { padding: 20px 14px 8px; }
.sidebar h2, .sidebar .tree { font-size: inherit; }
.sidebar-head button { display: block; text-align: left; width: 100%; margin-top: 12px; }
.sidebar-head button img { margin-right: 8px; }
.sidebar-heading { display: flex; align-items: center; justify-content: space-between; gap: 4px; }
.sidebar-head .library-toggle { width: auto; min-height: 28px; margin: 0; padding: 3px 5px; }
.sidebar-head .library-toggle img { display: inline; margin: 0; }
.workspace.library-collapsed { grid-template-columns: 36px minmax(0, 1fr) 1px var(--right); }
.library-collapsed .sidebar-head { padding: 8px 3px; }
.library-collapsed .library-toggle img { transform: rotate(180deg); }
.library-collapsed :is(#library-title, #new-section, #new-document, #show-review, #article-sidebar, #tree, [data-side=left]) {
  display: none;
}
.divider { position: relative; background: var(--line); cursor: col-resize; z-index: 2; touch-action: none; }
.divider::before {
  content: ""; position: absolute; left: -4px; width: 9px; top: 0; bottom: 0;
}
.divider::after {
  content: ""; position: absolute; width: 13px; height: 26px; left: -6px; top: calc(50% - 13px);
  background: #fff url("/static/icons/grip-vertical.svg") center / 13px no-repeat;
}
.tree { padding: 10px 12px; font-size: 1.12rem; }
.tree details { margin: 4px 0; }
.tree summary { border: 0; padding: 4px 2px; display: list-item; cursor: pointer; color: var(--ink); }
.tree summary:hover { color: var(--ink); background: #b5dce0; }
.tree .branch { padding-left: 14px; }
.tree button, .tree-document, .result-button {
  display: block; width: 100%; text-align: left; border: 0; padding: 6px 8px; overflow-wrap: anywhere;
}
.tree button, .tree-document { color: var(--ink); font-weight: 400; }
.tree-document { cursor: grab; border-radius: 5px; text-decoration: none; }
.tree-document:active { cursor: grabbing; }
.tree [aria-current="true"] { background: #a7d4d9; }
.tree button:hover:not(:disabled), .tree-document:hover { color: var(--ink); background: #b5dce0; }
.tree details[data-document-drop="section"] > summary { outline: 1px dashed var(--action); background: #a7d4d9; }
.tree-document[data-document-drop="before"] { box-shadow: inset 0 2px var(--action); }
.tree-document[data-document-drop="after"] { box-shadow: inset 0 -2px var(--action); }
.center-head, .right-head { border-bottom: 1px solid #d5e1e2; }
.toolbar { display: flex; gap: 7px; align-items: center; padding: 12px 14px; flex-wrap: wrap; }
.format-tools { display: flex; gap: 6px; }
.globe-icon { font-variant-emoji: text; }
.icon-button { padding: 4px 8px; white-space: nowrap; }
.secondary-toolbar { padding-top: 0; padding-bottom: 9px; font-size: .94rem; }
.in-text-search { flex: 1 1 120px; }
.in-text-search input { width: 100%; }
.in-text-search button:disabled { display: none; }
.in-text-search output { font-size: .82rem; white-space: nowrap; }
.review-label { display: inline-flex; align-items: center; margin: 0; font-size: .9rem; white-space: nowrap; }
.review-label input { width: auto; min-height: 0; margin: 0; accent-color: var(--action); }
.exports { position: relative; }
.exports summary { list-style: none; }
.exports div, .selection-menu {
  position: absolute; background: #fff; border: 1px solid var(--action); border-radius: 5px; z-index: 4;
}
.exports div { right: 0; min-width: 145px; padding: 4px; }
.exports a { display: block; padding: 6px 8px; white-space: nowrap; }
.reader { padding: 18px 20px; overflow-wrap: anywhere; }
.center-reader { padding-inline: 23px; }
#center-page {
  inline-size: calc(100% + 2 * var(--hit-inline, 0px));
  padding-inline: var(--hit-inline, 0px);
  padding-block: var(--hit-block, 0px);
}
.legal-text { font-size: var(--reader-size, 17pt); line-height: 1.36; }
.legal-text h2 { font-size: 1.44em; margin-bottom: 7px; }
.legal-text h3, .legal-text h4, .legal-text h5, .legal-text h6 { line-height: 1.22; margin: .65em 0 .35em; }
.legal-text p { margin: 0 0 .42em; }
.legal-text table { border-collapse: collapse; max-width: 100%; margin: 0 0 .55em; }
.legal-text td, .legal-text th { border: 1px solid #9bb2b4; padding: 4px 6px; vertical-align: top; }
.legal-text td p:last-child, .legal-text th p:last-child { margin-bottom: 0; }
.block-text { white-space: pre-wrap; }
.block-text[contenteditable] { min-width: .7em; max-width: 100%; display: inline-block; outline: none; }
.block-text[contenteditable]:focus { background: #eef7f7; }
.legal-text .blank-block:not(:focus-within) { line-height: .35; margin: 0; }
.document-heading { margin: 0 0 22px; }
.document-heading .meta { margin: 4px 0 0; font-size: .81em; color: var(--muted); }
.linked-document .document-heading h2 { display: none; }
.right-head { padding: 12px 18px 10px; }
.right-navigation { display: flex; flex-wrap: wrap; gap: 5px; }
.right-navigation button {
  min-height: 27px; padding: 4px 7px; font-size: .8rem;
  background: var(--action); color: #fff;
}
.right-navigation button:hover:not(:disabled),
.right-navigation button:active:not(:disabled) { background: transparent; color: var(--action); }
.right-navigation button[aria-pressed="true"] { text-decoration: underline; text-underline-offset: 2px; }
#right-tools:not(:empty) { margin-top: 8px; }
#right-tools h2 { font-size: 1.05rem; }
#right-tools > * { margin-bottom: 4px; }
#right-tools .in-text-search { width: 100%; }
#right-tools select { max-width: 100%; }
.actions { display: flex; gap: 9px; justify-content: flex-end; padding: 15px 16px 25px; border-top: 1px solid var(--line); }
.actions button { min-height: 42px; }
.primary { background: var(--action); color: white; }
.primary:hover:not(:disabled) { background: #0b5454; }
.back-button { border: 0; min-height: 42px; font-weight: 400; }
.back-button img { margin-right: 6px; }
.selection-menu { position: fixed; display: flex; gap: 3px; padding: 5px; flex-wrap: wrap; max-width: calc(100vw - 12px); }
.selection-menu button { border: 0; font-weight: 400; }
.marker {
  display: inline-block; border: 0; border-radius: 50%; padding: 0; min-height: 0;
  width: .94em; height: .94em; margin-right: .26em; vertical-align: -.045em;
  background: currentColor; user-select: none;
}
.marker.note { color: #bd1822; mask: url("/static/icons/info-circle.svg") center / contain no-repeat; }
.marker.link { color: #175ec5; mask: url("/static/icons/arrow-right-circle.svg") center / contain no-repeat; }
.marker.incoming { color: #175ec5; mask: url("/static/icons/arrow-right-circle.svg") center / contain no-repeat; transform: rotate(180deg); }
.marker.external { color: var(--action); width: auto; background: transparent; }
.marker.external::before { content: "🌐︎"; font-variant-emoji: text; }
.marker:hover:not(:disabled), .marker:focus-visible { color: #222; background: currentColor; }
.marker.external:hover:not(:disabled), .marker.external:focus-visible { background: transparent; }
::highlight(source-selection), ::highlight(target-selection) { background: var(--selected); color: #111; }
::highlight(center-search), ::highlight(right-search) { background: #ffef9c; color: #111; }
::highlight(library-hit) { background: #ffdf4b; color: #111; }
mark.library-hit { background: #ffdf4b; color: #111; }
.anchor-fallback { background: var(--selected); }
.note-editor { min-height: 145px; margin: 9px 0 12px; padding: 10px; border: 1px solid #8bb3b7; border-radius: 4px; line-height: 1.4; }
.note-copy { white-space: pre-wrap; line-height: 1.45; }
.right-caption { color: var(--muted); }
.right-caption blockquote { margin-left: 0; }
.search-result-group { margin-bottom: 16px; }
.search-result-group h3 { margin: 0 0 5px; font-size: 1rem; }
.result-button { color: var(--action); min-height: 30px; font-size: .875rem; font-weight: 400; line-height: 1.4; }
.outline-item { display: flex; align-items: flex-start; gap: 5px; }
.outline-item .result-button { flex: 1; min-width: 0; }
.outline-item .icon-button { min-height: 30px; }
.outline-title-form { flex: 1; padding: 5px 0; }
.outline-title-form button { margin-right: 5px; }
.annotation-list .result-button { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.article-sidebar { padding: 0 9px; }
.article-sidebar summary { min-height: 0; }
.article-sidebar-list { max-height: min(25vh, 150px); overflow: auto; }
.article-fragment { white-space: pre-wrap; }
.article-actions, .article-block-actions { display: flex; flex-wrap: wrap; gap: 5px; }
.article-actions { margin-top: 8px; }
#article-heading { overflow-wrap: anywhere; }
#article-title-field { margin: 8px 0; }
.article-block + .article-block { margin-top: 14px; }
.article-block-actions { justify-content: space-between; margin-bottom: 4px; }
.article-block-actions button { min-height: 28px; font-size: .85rem; }
.article-grip { cursor: grab; touch-action: none; }
.article-block[data-article-dragging] { opacity: .55; }
.article-block[data-article-drop="before"] { box-shadow: 0 -3px var(--line); }
.article-block[data-article-drop="after"] { box-shadow: 0 3px var(--line); }
.article-source { display: flex; align-items: center; gap: 6px; min-width: 0; }
.article-source-title { color: #5c6363; font-size: 8pt; overflow-wrap: anywhere; }
.article-copy { white-space: pre-wrap; line-height: 1.4; }
.article-image-preview { display: block; max-width: 100%; max-height: 140px; object-fit: contain; }
.article-block textarea {
  display: block; width: 100%; min-height: 5em; resize: vertical;
  padding: 8px; border: 1px solid #8bb3b7; border-radius: 4px; font: inherit; line-height: 1.4;
}
#article-save-status { font-size: .82rem; }
.status { position: fixed; bottom: 10px; left: 50%; transform: translateX(-50%); z-index: 5; background: #fff; border: 1px solid var(--action); border-radius: 5px; padding: 8px 12px; }
dialog { width: min(720px, 95vw); max-height: 94vh; border: 1px solid var(--action); border-radius: 6px; padding: 19px; }
dialog::backdrop { background: rgb(12 30 31 / 38%); }
dialog h2 { margin-bottom: 13px; }
label { display: grid; gap: 4px; margin-bottom: 10px; }
label input, label select { width: 100%; }
.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px 10px; }
.form-grid .wide { grid-column: 1 / -1; }
.authority-field { position: relative; }
.authority-options {
  position: absolute; z-index: 1; inset: auto 0; top: calc(100% - 10px); margin: 0; padding: 0;
  list-style: none; max-height: 12rem; overflow: auto; background: white;
  border: 1px solid var(--action); border-radius: 5px;
}
.authority-options li { padding: 7px 9px; cursor: pointer; }
.authority-options li:hover, .authority-options [aria-selected=true] { background: var(--selected); }
.form-error { margin: 6px 0; color: #9c1520; }
.form-error:empty { display: none; }
.dialog-actions { margin-top: 12px; display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.import-preview { max-height: 31vh; min-height: 7rem; overflow: auto; border: 1px solid #a4b8b9; padding: 10px; }
.import-preview .legal-text { font-size: 1rem; }
.login-page { min-height: 100dvh; border-top: 2px solid var(--line); display: grid; place-items: center; }
.login { max-width: 32rem; padding: 24px; }
.login p { line-height: 1.4; }
@media (max-width: 1100px) {
  .toolbar, .reader, .right-head { padding-left: 12px; padding-right: 12px; }
  .sidebar-head { padding-left: 9px; padding-right: 9px; }
  .sidebar-head button img { display: none; }
}
@media (max-width: 740px) {
  .top { flex-wrap: wrap; gap: 6px; }
  .top form { width: 100%; }
  .workspace { height: auto; display: block; }
  .workspace.library-collapsed { display: grid; grid-template-columns: 36px minmax(0, 1fr); }
  .library-collapsed .sidebar { grid-area: 1 / 1 / 3 / 2; max-height: none; }
  .library-collapsed :is(.center, .right) { grid-column: 2; }
  .column { min-height: 0; border-bottom: 1px solid var(--line); }
  .sidebar { max-height: 260px; }
  .writing .sidebar { max-height: none; }
  .divider { display: none; }
  .reader { min-height: 92px; max-height: 58vh; }
  .tree { max-height: 165px; }
  .form-grid { grid-template-columns: 1fr; }
}
[data-highlight-source-selection], [data-highlight-target-selection] { background: var(--selected); }
[data-highlight-center-search], [data-highlight-right-search] { background: #ffef9c; }
