:root { --rb-ink: #1b2a3a; --rb-accent: #0b5a8a; --rb-line: #d6dde4; }
html { font-size: 15px; }
body { background: #f4f6f8; color: var(--rb-ink); }

.skip-link { position: absolute; left: .5rem; top: .5rem; z-index: 2000; background: #fff; padding: .5rem 1rem; }
.rb-header { background: var(--rb-ink); }
.btn:focus-visible, .form-control:focus, .form-select:focus, .nav-link:focus-visible, a:focus-visible, [tabindex]:focus-visible {
  outline: 3px solid #f2b705; outline-offset: 2px; box-shadow: none;
}
.card { border-color: var(--rb-line); }
.table > :not(caption) > * > * { padding-top: .6rem; padding-bottom: .6rem; vertical-align: middle; }
.stage { font-size: .8rem; font-weight: 600; }
.stage-Drafting { color: #8a5a00; background: #fff4d6; }
.stage-Review { color: #0b5a8a; background: #dff0fb; }
.stage-Complete { color: #1b6b3a; background: #dff3e6; }
.stage-Intake { color: #444; background: #e9ecef; }
.source { font-size: .75rem; }
.suggested { background: #fff4d6; border-color: #e0b84a; }

.workspace { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1rem; align-items: start; }
@media (max-width: 1100px) { .workspace { grid-template-columns: 1fr; } }
.workspace .sticky-col { position: sticky; top: .75rem; }

.rb-viewer { min-height: 360px; }
.rb-viewer-stage { height: 68vh; overflow: auto; background: #3b4652; display: flex; align-items: flex-start; justify-content: center; }
.rb-viewer-stage img { max-width: none; transform-origin: center top; background: #fff; margin: 1rem; }
.rb-viewer-stage img.fit { max-width: calc(100% - 2rem); }

.rb-row { border: 1px solid var(--rb-line); border-radius: .5rem; padding: .75rem; background: #fbfcfd; margin-bottom: .75rem; }
.field-note { font-size: .8rem; color: #5c6b7a; }

.editor-canvas-wrap { background: #3b4652; overflow: auto; max-height: 70vh; text-align: center; padding: 1rem; }
.editor-canvas-wrap canvas { background: #fff; max-width: 100%; cursor: crosshair; touch-action: none; }
.page-thumbs button { text-align: left; }
.page-thumbs .list-group-item.active { background: #dff0fb; color: #0b3b5a; border-color: var(--rb-accent); }
.page-thumbs .list-group-item.active .text-secondary { color: #2b5a7a !important; }

.print-only { display: none; }
@media print {
  body.printing > *:not(.print-only) { display: none !important; }
  body.printing .print-only { display: block; }
  body.printing .print-only img { width: 100%; }
}

/* Server-side tables */
.rb-sort { all: unset; cursor: pointer; font-weight: 600; }
.rb-sort:hover { text-decoration: underline; }
.rb-sort:focus-visible { outline: 2px solid var(--rb-accent); outline-offset: 2px; }
th[aria-sort="ascending"] .rb-sort::after { content: " ▲"; font-size: .7em; }
th[aria-sort="descending"] .rb-sort::after { content: " ▼"; font-size: .7em; }
.rb-dt[aria-busy="true"] tbody { opacity: .55; }
.rb-dt .pagination .page-link { min-width: 2rem; text-align: center; }

/* Loading animation: centred on the screen, shown only when a wait lasts a moment */
.rb-loading { position: fixed; inset: 0; z-index: 2000; display: flex; align-items: center; justify-content: center; background: rgba(244, 246, 248, .72); }
.rb-loading[hidden] { display: none; }
.rb-loading-box { display: flex; flex-direction: column; align-items: center; gap: .9rem; padding: 1.5rem 2.25rem; background: #fff; border: 1px solid var(--rb-line); border-radius: .75rem; box-shadow: 0 .5rem 1.5rem rgba(20, 40, 60, .16); max-width: min(26rem, calc(100vw - 2rem)); text-align: center; }
.rb-loading-msg { color: #34495e; font-size: .95rem; }
.rb-spinner { width: 3rem; height: 3rem; border-radius: 50%; border: .35rem solid #dbe5ee; border-top-color: var(--rb-accent); animation: rb-spin .8s linear infinite; }
@keyframes rb-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .rb-spinner { animation-duration: 2.8s; } }

/* Icon buttons (tooltips carry the text) */
.rb-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.rb-icon { width: 1.15rem; height: 1.15rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -.2em; }
.rb-icon-btn { display: inline-flex; align-items: center; justify-content: center; min-width: 2.1rem; padding-inline: .5rem; }

/* An OCR suggestion offered under a field. The field itself turns .suggested once the value is used. */
.suggestion { margin-top: .25rem; font-size: .85rem; background: #fff4d6; border: 1px solid #e0b84a; border-radius: .35rem; padding: .15rem .5rem; }
.suggestion[hidden] { display: none; }

/* Searchable dropdown (searchable.js): the real select stays in the page, hidden, and holds the value. */
.searchable { position: relative; }
.searchable-native { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.searchable-list { position: absolute; z-index: 1055; left: 0; right: 0; top: calc(100% + 2px); margin: 0; padding: .25rem 0; list-style: none; max-height: 18rem; overflow-y: auto;
  background: #fff; border: 1px solid #c9d1c6; border-radius: .4rem; box-shadow: 0 8px 24px rgba(0,0,0,.18); }
.searchable-list[hidden] { display: none; }
.searchable-list li { padding: .35rem .75rem; cursor: pointer; font-size: .9rem; color: #1f2a1d; }
.searchable-list li.active { background: #586253; color: #fff; }
.searchable-list li[aria-selected="true"]:not(.active) { background: #eef1ec; font-weight: 600; }
.searchable-list li.searchable-none { color: #6b7568; cursor: default; }

/* Fields wrapped in their label (property and party rows) fill the whole column; a textarea fills its row and only grows taller. */
.rb-row label.form-label { display: block; width: 100%; }
.rb-row textarea.form-control { width: 100%; resize: vertical; }
