:root {
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --line: #e2e8f0;
  --ink: #172033;
  --muted: #64748b;
  --brand: #1f5eff;
  --brand-dark: #183fa8;
}

body {
  background: linear-gradient(180deg, #f7f9fc 0%, #eef3f8 100%);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.app-shell { min-height: 100vh; }
.topbar {
  background: linear-gradient(135deg, #16357f 0%, #2457d6 55%, #6ca0ff 100%);
  color: white;
  padding: .82rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 10px 28px rgba(15, 37, 90, .22);
  position: sticky;
  top: 0;
  z-index: 50;
}
.brand-mark { font-size: 1.35rem; font-weight: 760; letter-spacing: .01em; }
.brand-subtitle { color: rgba(255,255,255,.78); font-size: .88rem; }
.user-pill { background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.25); border-radius: 999px; padding: .32rem .65rem; font-size: .82rem; }

.status-centre {
  width: 100%;
  margin: 0;
  padding: .35rem 1rem;
  background: #fff7d6;
  border-bottom: 1px solid #f4d980;
}
.status-card {
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  padding: .15rem 0;
  margin-bottom: .2rem;
}
.progress { height: .5rem; border-radius: 999px; }
.progress-bar { background: var(--brand); }

.card, .workspace-card, .project-banner, .import-box, .prompt-preview, .usage-card, .threshold-panel {
  border: 1px solid var(--line);
  box-shadow: 0 5px 18px rgba(15, 23, 42, .045);
}
.card, .workspace-card, .project-banner, .import-box, .prompt-preview, .usage-card, .threshold-panel, .record-card {
  border-radius: .95rem;
}
.card-header {
  background: var(--surface-soft);
  border-bottom: 1px solid var(--line);
  border-radius: .95rem .95rem 0 0 !important;
}

.project-sidebar { position: sticky; top: 5.2rem; overflow: hidden; }
.project-list { max-height: 72vh; overflow: auto; }
.project-item { border-color: var(--line); min-height: 7rem; display: flex; align-items: stretch; gap: .5rem; }
.project-select { appearance: none; background: transparent; border: 0; color: inherit; display: block; padding: 0; text-align: left; flex: 1 1 auto; min-width: 0; }
.list-group-item.active { background: var(--brand); border-color: var(--brand); }
.list-group-item.active small { color: rgba(255,255,255,.82) !important; }
.active-project-tools { display: flex; flex-direction: column; gap: .25rem; min-width: 4.4rem; align-self: stretch; justify-content: center; }
.active-project-tools .btn { font-size: .70rem; padding: .12rem .35rem; }
.save-state { color: rgba(255,255,255,.82); min-height: 1.2rem; }
.side-toggle { position: sticky; top: 5.2rem; }

.project-banner {
  background: rgba(255,255,255,.94);
  padding: .78rem 1rem;
}
.stats-strip {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: .8rem;
}
.metric {
  background: transparent;
  padding: .35rem .1rem;
}
.metric span { display: block; color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; }
.metric strong { font-size: 1.55rem; line-height: 1.15; }

.workspace-card { background: var(--surface); overflow: hidden; }
.app-tabs { background: var(--surface-soft); padding: .65rem .75rem 0; border-bottom: 1px solid var(--line); }
.app-tabs .nav-link { border-radius: .7rem .7rem 0 0; color: #475569; }
.app-tabs .nav-link.active { color: var(--brand-dark); font-weight: 650; }
.tab-content-box { padding: 1rem; }
.section-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.import-box, .prompt-preview, .usage-card, .threshold-panel { background: var(--surface-soft); padding: 1rem; }
.info-button { width: 1.6rem; height: 1.6rem; padding: 0; line-height: 1; font-weight: 700; }

.abstract { white-space: pre-wrap; }
.record-card { border-width: 2px !important; transition: background-color .15s ease, border-color .15s ease, box-shadow .15s ease; }
.record-card:hover { box-shadow: 0 8px 22px rgba(15, 23, 42, .08); }
.record-card.record-include { background: #eef8f0; border-color: #75c58a !important; }
.record-card.record-maybe { background: #fff8df; border-color: #f5bb38 !important; }
.record-card.record-exclude { background: #fff0f0; border-color: #e98484 !important; }
.record-card.record-pending { background: #fff; border-color: var(--line) !important; }
.human-decision-row { background: rgba(255,255,255,.76); border: 1px solid rgba(15,23,42,.07); border-radius: .75rem; padding: .65rem; }
.llm-panel { background: rgba(255,255,255,.72); }
.llm-panel.llm-include { border-color: #75b987 !important; background: #e8f6ec; }
.llm-panel.llm-maybe { border-color: #f0bf49 !important; background: #fff4cf; }
.llm-panel.llm-exclude { border-color: #df7b7b !important; background: #fde5e5; }
.llm-panel.llm-pending { border-color: var(--line) !important; background: #f8fafc; }
.save-dot { display: inline-block; min-width: 3.4rem; margin-left: .5rem; font-size: .72rem; color: var(--muted); visibility: hidden; }
.save-dot.visible { visibility: visible; }

.btn { border-radius: .55rem; }
.btn-xs { --bs-btn-padding-y: .13rem; --bs-btn-padding-x: .45rem; --bs-btn-font-size: .78rem; }
.modal { background: rgba(15, 23, 42, .08); }
pre { max-height: 460px; overflow: auto; }
.empty-state { padding: 2rem; color: var(--muted); }

@media (max-width: 992px) {
  .stats-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .topbar { position: static; }
}
@media (max-width: 576px) {
  .stats-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.app-footer {
  color: var(--muted);
  font-size: .78rem;
  text-align: center;
  padding: 1.2rem 0 1.6rem;
}
.autosave-state { min-width: 5rem; text-align: right; }
.status-centre .alert { padding: .35rem .75rem; margin-bottom: .25rem !important; background: transparent; border: 0; }
.status-centre .alert-info { color: #6b5300; }
.status-centre .alert-danger { color: #842029; }
.status-centre .progress { height: .35rem; background: rgba(120, 95, 0, .15); }

/* v0.4.0 UI refinements */
.status-centre {
  min-height: 2.15rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.status-card { margin-bottom: .05rem; }
.btn:disabled, .btn.disabled {
  opacity: .35;
  filter: grayscale(.25);
  cursor: not-allowed;
}
.action-row .btn {
  min-width: 7.5rem;
  font-weight: 650;
}
.placeholder-panel {
  background: var(--surface-soft);
  border: 1px dashed #cbd5e1;
  border-radius: .95rem;
  padding: 1rem;
}
.active-project-tools .btn-secondary {
  background: #e2e8f0;
  color: #0f172a;
  border-color: #cbd5e1;
}
@media (max-width: 768px) {
  .action-row .btn { min-width: auto; }
}

/* v0.4.1 layout and PDF import refinements */
.topbar-left {
  display: flex;
  align-items: center;
  gap: 1.15rem;
  min-width: 0;
}
.topbar-project {
  display: flex;
  align-items: center;
  gap: .45rem;
  min-width: 0;
  font-size: .95rem;
}
.topbar-project strong {
  max-width: 36vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.project-meta { color: rgba(255,255,255,.78); font-size: .82rem; }
.topbar .autosave-state { color: rgba(255,255,255,.8); font-size: .78rem; min-width: 4.4rem; }
.brand-subtitle { display: none; }
.status-centre {
  position: sticky;
  top: 3.85rem;
  z-index: 45;
  min-height: 0;
  padding: .28rem 1rem;
  background: #fff8d8;
  box-shadow: 0 6px 16px rgba(96, 74, 0, .06);
}
.status-card .small {
  margin-bottom: .15rem !important;
  line-height: 1.05;
}
.status-centre .alert { line-height: 1.1; }
.project-meta-lines { display: flex; flex-direction: column; gap: .1rem; margin-top: .25rem; font-size: .78rem; opacity: .85; }
.list-group-item.active .project-meta-lines { color: rgba(255,255,255,.86); }
.project-item { min-height: 6.6rem; }
.active-project-tools .btn { background: rgba(255,255,255,.9); color: #0f172a; border-color: rgba(15,23,42,.12); }
.active-project-tools .btn-danger { background: #dc3545; color: white; border-color: #dc3545; }
.pdf-drop { border-style: dashed; }
.pdf-table small { max-width: 36rem; display: inline-block; }
@media (max-width: 992px) {
  .topbar { position: sticky; top: 0; }
  .topbar-left { flex-direction: column; align-items: flex-start; gap: .25rem; }
  .topbar-project { flex-wrap: wrap; }
  .status-centre { top: 5.6rem; }
}

/* v0.4.2 polish */
.topbar {
  min-height: 58px;
  z-index: 1000;
}
.topbar-project strong {
  font-size: 1.04rem;
  letter-spacing: .01em;
}
.topbar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: .55rem;
}
.account-menu-wrap {
  position: relative;
}
.account-menu {
  position: absolute;
  right: 0;
  top: calc(100% + .45rem);
  min-width: 15rem;
  background: #fff;
  color: #0f172a;
  border: 1px solid var(--line);
  border-radius: .85rem;
  box-shadow: 0 16px 40px rgba(15, 23, 42, .18);
  padding: .45rem;
  z-index: 1100;
}
.account-menu-user {
  padding: .55rem .65rem .65rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: .25rem;
}
.account-menu-user span {
  display: block;
  color: var(--muted);
  font-size: .78rem;
  overflow: hidden;
  text-overflow: ellipsis;
}
.account-menu .dropdown-item {
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  border-radius: .55rem;
  padding: .45rem .65rem;
}
.account-menu .dropdown-item:hover {
  background: #f1f5f9;
}
.status-centre {
  position: sticky;
  top: 58px;
  z-index: 900;
  padding: .22rem 1rem;
  min-height: 2rem;
  display: flex;
  justify-content: center;
  box-shadow: 0 6px 14px rgba(96, 74, 0, .08);
}
.status-card {
  width: min(100%, 1100px);
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: .65rem;
  min-height: 1.45rem;
}
.status-card .small {
  min-width: 14rem;
  margin-bottom: 0 !important;
  display: flex !important;
  align-items: center;
  gap: .5rem;
}
.status-card .progress {
  flex: 1 1 auto;
  margin-top: 0;
}
.status-centre .alert {
  width: min(100%, 1100px);
  margin: 0 auto !important;
  padding: .25rem .5rem;
}
.project-item {
  min-height: 6.65rem;
  border-left-width: 1px !important;
  border-right-width: 1px !important;
}
.project-select {
  min-height: 5.9rem;
}
.active-project-tools.invisible {
  visibility: hidden !important;
  pointer-events: none;
}
.active-project-tools {
  flex: 0 0 4.75rem;
}
.active-project-tools .btn {
  min-height: 1.35rem;
}
.autosave-state {
  opacity: .78;
  min-width: 6.2rem;
  transition: opacity .2s ease;
}
.autosave-state.is-unsaved {
  color: #fff3bf;
}
.autosave-state.is-saving {
  color: #e0f2fe;
}
.human-decision-row .form-label {
  margin-bottom: .18rem;
}
.pdf-drop {
  background: #f8fafc;
}
@media (max-width: 992px) {
  .status-centre { top: 58px; }
  .topbar-left { flex: 1 1 auto; }
  .topbar-actions { align-self: flex-start; }
}

/* v0.4.3 compact UI and PDF matching polish */
html { font-size: 14px; }
body { font-size: .92rem; }
.form-control, .form-select, .btn, .table, .dropdown-item { font-size: .88rem; }
.form-control-sm, .form-select-sm, .btn-sm { font-size: .80rem; }
.btn-xs { --bs-btn-font-size: .72rem; }
.topbar { min-height: 54px; padding: .6rem 1rem; }
.brand-mark { font-size: 1.18rem; }
.topbar-project { border-left: 1px solid rgba(255,255,255,.38); border-right: 1px solid rgba(255,255,255,.38); padding: .12rem .85rem; margin-left: .25rem; }
.project-title-separator { display: none; }
.topbar-project strong { font-size: .98rem; max-width: 42vw; }
.status-centre { top: 54px; padding: .16rem .75rem; }
.status-card { min-height: 1.6rem; align-items: center; }
.status-card .small { line-height: 1; align-items: center; }
.status-centre .progress { height: .38rem; }
.project-item { box-sizing: border-box; min-height: 6.55rem; border: 1px solid var(--line) !important; transform: none !important; }
.list-group-item.active { border: 1px solid var(--brand) !important; transform: none !important; }
.project-select { min-height: 5.75rem; }
.record-card h2 { font-size: 1rem !important; margin-bottom: .2rem; }
.abstract { font-size: .82rem; line-height: 1.38; }
.llm-panel { font-size: .78rem; }
.record-year { background: transparent; color: var(--muted); font-size: .78rem; padding: .15rem 0; }
.human-decision-row { font-size: .82rem; }
.human-decision-row .form-label { font-size: .78rem; }
.metric strong { font-size: 1.25rem; }
.metric span { font-size: .68rem; }
.tab-content-box { padding: .85rem; }
.section-title { margin-bottom: .75rem; }
.pdf-progress-list { border: 1px solid var(--line); border-radius: .8rem; background: #fff; overflow: hidden; }
.pdf-progress-row { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(8rem, 1.5fr); gap: .6rem; align-items: center; padding: .45rem .65rem; border-bottom: 1px solid var(--line); font-size: .82rem; }
.pdf-progress-row:last-child { border-bottom: 0; }
.pdf-table { font-size: .82rem; }
.pdf-table select { min-width: 18rem; }
@media (max-width: 992px) {
  .status-centre { top: 54px; }
  .pdf-progress-row { grid-template-columns: 1fr; }
}

/* v0.4.4 layout and clarity refinements */
html {
  scrollbar-gutter: stable;
}
@supports not (scrollbar-gutter: stable) {
  body { overflow-y: scroll; }
}
.topbar-project {
  border-right: 0 !important;
  margin-right: .25rem;
}
.import-drop {
  border-style: dashed;
}
.pdf-log-pre {
  max-height: 70vh;
  font-size: .78rem;
}
.pdf-row-progress .progress { height: 0.35rem; max-width: 16rem; }
.pdf-viewer-modal .modal-body { height: min(82vh, 920px); }
.pdf-frame { width: 100%; height: 100%; border: 0; background: #f8fafc; }
.nav-pills-sm .nav-link { padding: 0.25rem 0.55rem; font-size: 0.8rem; }
.extraction-editor { border-top: 1px solid rgba(15, 23, 42, 0.08); padding-top: 0.75rem; }
.extraction-list { max-height: 420px; overflow: auto; border: 1px solid rgba(15, 23, 42, 0.08); border-radius: 0.75rem; }
.extraction-list .list-group-item { font-size: 0.82rem; border-left: 0; border-right: 0; }
.extraction-list .list-group-item:first-child { border-top: 0; }
.extraction-list .list-group-item:last-child { border-bottom: 0; }

/* v0.4.8 upload progress and fuller extraction setup editor */
.status-card .small span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.extraction-tabs {
  gap: .25rem;
}
.extraction-tabs .nav-link {
  white-space: nowrap;
}
.extraction-json-editor {
  min-height: 32rem;
  line-height: 1.35;
}
.config-summary-panel {
  border: 1px solid var(--line);
  border-radius: .95rem;
  background: #fff;
  padding: 1rem;
}

.extraction-results-layout .list-group-item.active .text-muted {
  color: rgba(255, 255, 255, .75) !important;
}
.extraction-result-list {
  max-height: 72vh;
  overflow: auto;
}
.extraction-row-progress {
  height: .45rem;
}
.extraction-detail-card {
  min-height: 40rem;
}
.extraction-values-table {
  max-height: 62vh;
  overflow: auto;
}
.extraction-values-table thead th {
  position: sticky;
  top: 0;
  background: var(--bs-body-bg);
  z-index: 2;
}
.extraction-number {
  width: 5.5rem;
}

.prisma-layout .card-header {
  background: #fff;
}

.prisma-preview-card {
  min-height: 30rem;
  max-width: 980px;
  margin-left: auto;
  margin-right: auto;
}

.prisma-svg-preview {
  overflow: auto;
  border: 1px solid #e5e7eb;
  border-radius: 0.75rem;
  background: #fff;
  padding: 0.75rem;
  display: flex;
  justify-content: center;
}

.prisma-svg-preview svg { max-width: min(100%, 920px); height: auto; display: block; margin: 0 auto; }

/* v0.4.9 records consolidation and clearer job status */
.status-centre {
  padding: .55rem 1rem;
  min-height: 3.15rem;
}
.status-centre .alert {
  padding: .52rem .75rem;
  line-height: 1.25;
}
.status-card {
  min-height: 2.1rem;
}
.status-centre .progress {
  height: .52rem;
}
.records-toolbar {
  border: 1px solid #cbd5e1;
  border-radius: .95rem;
  background: #e8eef7;
  padding: .9rem 1rem;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.65), 0 6px 18px rgba(15, 23, 42, .05);
}
.records-toolbar-secondary {
  background: #edf2f7;
  border-style: dashed;
}
.records-toolbar-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: .9rem;
  flex-wrap: wrap;
}
.records-pdf-input {
  max-width: 28rem;
}
.record-pdf-panel {
  background: #eef4ff;
  border-color: #b8c9ef !important;
}
.record-pdf-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .75rem;
  padding: .35rem 0;
  border-top: 1px solid rgba(15, 23, 42, .08);
}
.record-pdf-row:first-of-type {
  border-top: 0;
}
.record-pdf-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.record-pdf-select {
  width: min(28rem, 45vw);
}
@media (max-width: 768px) {
  .record-pdf-row { align-items: stretch; flex-direction: column; }
  .record-pdf-select { width: 100%; }
  .records-pdf-input { max-width: 100%; }
}

/* v0.4.12 per-tab Office-style ribbon actions */
.tab-ribbon {
  display: flex;
  align-items: stretch;
  gap: 0;
  flex-wrap: wrap;
  padding: .55rem .78rem .48rem;
  background: #f8fafc;
  border-bottom: 1px solid #dbe3ee;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.9), 0 1px 0 rgba(15,23,42,.04);
}
.tab-ribbon-review {
  background: #f7faff;
}
.ribbon-group {
  display: flex;
  align-items: flex-start;
  gap: .34rem;
  padding: .12rem .72rem 1.28rem;
  border-right: 1px solid #ccd6e4;
  min-height: 5.55rem;
  position: relative;
  flex-wrap: wrap;
  justify-content: center;
  align-content: flex-start;
}
.ribbon-group:last-child { border-right: 0; }
.ribbon-group-title {
  position: absolute;
  left: .45rem;
  right: .45rem;
  bottom: .22rem;
  text-align: center;
  font-size: .68rem;
  font-weight: 650;
  color: #64748b;
  letter-spacing: .02em;
  text-transform: uppercase;
  line-height: 1;
  white-space: nowrap;
  pointer-events: none;
}
.ribbon-button {
  min-width: 5.85rem;
  max-width: 8rem;
  min-height: 4.18rem;
  border: 1px solid transparent;
  background: transparent;
  color: #1f2a44;
  border-radius: .55rem;
  padding: .34rem .38rem .3rem;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .24rem;
  text-align: center;
  line-height: 1.08;
  font-weight: 650;
  font-size: .8rem;
}
.ribbon-button:hover:not(:disabled), .ribbon-button.active {
  background: #eef5ff;
  border-color: #b7c8ff;
  box-shadow: none;
}
.ribbon-button:focus {
  outline: none;
  box-shadow: none;
}
.ribbon-button:focus-visible {
  outline: 2px solid rgba(37, 99, 235, .45);
  outline-offset: 2px;
}
.ribbon-button:disabled {
  opacity: .36;
  filter: grayscale(.3);
  cursor: not-allowed;
}
.ribbon-button.ribbon-primary {
  background: transparent;
  border-color: transparent;
  color: #0b4bd3;
  box-shadow: none;
}
.ribbon-button.ribbon-primary:hover:not(:disabled) {
  background: #eef5ff;
  border-color: #b7c8ff;
}
.ribbon-icon {
  display: block;
  font-size: 1.55rem;
  line-height: 1;
  min-height: 1.7rem;
  font-weight: 500;
  color: inherit;
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.ribbon-note {
  order: 1;
  align-self: center;
  color: #58657a;
  font-size: .76rem;
  max-width: 8.5rem;
  padding: .35rem .35rem .2rem;
  line-height: 1.2;
}
.ribbon-group-danger .ribbon-button {
  color: #991b1b;
}
@media (max-width: 992px) {
  .tab-ribbon { overflow-x: auto; flex-wrap: nowrap; }

  .ribbon-group { flex: 0 0 auto; }
}

/* v0.4.9 ribbon consistency and meta-analysis selector */
.tab-ribbon {
  min-height: 6.75rem;
  flex-wrap: nowrap;
  overflow-x: auto;
  align-items: stretch;
  padding-left: .82rem;
  padding-right: .82rem;
}
.ribbon-group {
  min-height: 5.8rem;
  flex: 0 0 auto;
  padding-left: .82rem;
  padding-right: .82rem;
}
.ribbon-group:first-child {
  padding-left: .82rem;
}
.ribbon-button {
  min-height: 4.15rem;
  flex: 0 0 auto;
}
.side-toggle {
  width: 2.35rem;
  height: 2.35rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: flex-start;
}
.meta-analysis-badge {
  display: inline-flex;
  align-items: center;
  margin-left: .5rem;
  padding: .08rem .45rem;
  border-radius: 999px;
  background: rgba(255,255,255,.18);
  border: 1px solid rgba(255,255,255,.26);
  color: rgba(255,255,255,.92);
  font-size: .72rem;
  font-weight: 650;
  white-space: nowrap;
}
.meta-analysis-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .8rem;
}
.meta-analysis-option {
  border: 1px solid var(--line);
  border-radius: .9rem;
  background: #fff;
  padding: .9rem;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: .25rem;
  min-height: 7rem;
}
.meta-analysis-option:hover:not(:disabled), .meta-analysis-option.active {
  border-color: var(--brand);
  background: #f0f6ff;
}
.meta-analysis-option.disabled, .meta-analysis-option:disabled {
  background: #f1f5f9;
  color: #94a3b8;
  cursor: not-allowed;
}
.meta-analysis-option span {
  color: var(--muted);
  font-size: .84rem;
}
.meta-analysis-option small {
  color: #64748b;
  font-weight: 650;
}
.human-decision-row .row {
  align-items: flex-start !important;
}
.human-decision-row .form-label {
  min-height: 2.35rem;
  display: flex;
  align-items: flex-end;
}
.decision-notes-col {
  position: relative;
}
.decision-notes-col .save-dot {
  position: absolute;
  right: .15rem;
  top: calc(100% + .1rem);
  margin-left: 0;
}
@media (max-width: 768px) {
  .meta-analysis-grid { grid-template-columns: 1fr; }
  .meta-analysis-badge { display: none; }
}

/* v0.4.15 risk-of-bias selector in extraction ribbon */
.ribbon-select-label {
  min-width: 10.5rem;
  min-height: 4.15rem;
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  gap: .3rem;
  margin: 0;
  color: #1f2a44;
  font-size: .78rem;
  font-weight: 650;
  line-height: 1.1;
  text-align: left;
}
.ribbon-select {
  min-width: 10.5rem;
  height: 2rem;
  font-weight: 500;
}

/* v0.4.16 standardised ribbon dropdowns */
.tab-ribbon {
  background: #e2e8f0;
  border-bottom-color: #c4cfdd;
}
.tab-ribbon-review {
  background: #e0e8f4;
}
.ribbon-group {
  border-right-color: #b7c3d2;
}
.ribbon-select-label {
  min-width: 11.75rem;
  min-height: 4.15rem;
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  gap: .3rem;
  margin: 0;
  color: #1f2a44;
  font-size: .78rem;
  font-weight: 700;
  line-height: 1.1;
  text-align: left;
}
.ribbon-select {
  min-width: 11.75rem;
  height: 2rem;
  font-weight: 550;
  background-color: #f8fafc;
  border-color: #aab7c8;
}

/* v0.4.17 preset extraction fields and darker workspace */
body {
  background: linear-gradient(180deg, #d5deea 0%, #c7d1df 100%);
}
.workspace-card {
  background: #f7f9fc;
}
.app-tabs,
.tab-ribbon,
.tab-ribbon-review {
  background: #dbe3ee;
}
.app-tabs {
  border-bottom-color: #b9c6d7;
}
.tab-ribbon {
  border-bottom-color: #b9c6d7;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.58), 0 1px 0 rgba(15,23,42,.05);
}
.tab-content-box {
  background: #f7f9fc;
}
.project-banner {
  background: rgba(248, 250, 252, .96);
}
.predefined-field-groups {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.predefined-field-group {
  border: 1px solid var(--line);
  border-radius: .95rem;
  background: #f8fafc;
  padding: .9rem;
}
.predefined-field-group h6 {
  margin-bottom: .75rem;
  color: #334155;
  font-weight: 760;
}
.predefined-field-option {
  min-height: 8rem;
  display: flex;
  gap: .65rem;
  align-items: flex-start;
  border: 1px solid #d8e1ee;
  background: #fff;
  border-radius: .75rem;
  padding: .75rem;
  cursor: pointer;
  height: 100%;
}
.predefined-field-option:hover,
.predefined-field-option.active {
  border-color: #94a9cf;
  background: #eef5ff;
}
.predefined-field-option .form-check-input {
  margin-top: .18rem;
  flex: 0 0 auto;
}
.predefined-field-body {
  display: flex;
  flex-direction: column;
  gap: .25rem;
  min-width: 0;
}

/* v0.4.18 structure and visual polish */
body {
  background: #252525;
}
.workspace-card {
  background: #ffffff;
  border-color: #d7e0ec;
  box-shadow: 0 14px 40px rgba(0, 0, 0, .12);
}
.app-tabs,
.tab-ribbon,
.tab-ribbon-review {
  background: #ffffff;
}
.app-tabs {
  padding: .78rem .9rem 0;
  border-bottom: 1px solid #dbe3ee;
}
.app-tabs .nav-link {
  color: #475569;
  border: 1px solid transparent;
  border-bottom: 0;
  border-radius: .92rem .92rem 0 0;
  padding: .78rem 1.25rem;
  font-weight: 540;
  background: transparent;
}
.app-tabs .nav-link.active {
  color: #0b4bd3;
  background: #ffffff;
  border-color: #dbe3ee;
  box-shadow: 0 -1px 0 rgba(15, 23, 42, .03);
  font-weight: 760;
}
.tab-ribbon {
  border-bottom-color: #dbe3ee;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.9), 0 1px 0 rgba(15,23,42,.04);
}
.ribbon-group {
  border-right-color: #d7e0ec;
}
.tab-content-box {
  background: #ffffff;
}
.project-banner {
  background: #ffffff;
}

/* v0.4.19 extraction defaults and darker shell refinements */
.stats-strip .metric span,
.stats-strip .metric strong {
  color: #ffffff;
}
.stats-strip .metric span {
  opacity: .78;
}
.stats-strip .metric strong {
  text-shadow: 0 1px 2px rgba(0,0,0,.25);
}

/* v0.4.21 project column and export/log refinements */
.main-layout {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}
.project-column {
  flex: 0 0 auto;
  transition: width .16s ease, flex-basis .16s ease;
}
.project-column-expanded {
  width: min(23rem, 28vw);
}
.project-column-collapsed {
  width: 3.1rem;
  min-height: calc(100vh - 6rem);
  background: #111111;
  border-radius: .8rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: .65rem .35rem;
  box-shadow: 0 10px 30px rgba(0,0,0,.2);
}
.workspace-column {
  flex: 1 1 auto;
  min-width: 0;
}
.project-column-collapsed .side-toggle {
  position: static;
  width: 2.25rem;
  height: 2.25rem;
  border: 1px solid rgba(255,255,255,.18);
  background: #1f2937;
  color: #fff;
  border-radius: .65rem;
}
.project-column-collapsed .collapsed-label {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  color: rgba(255,255,255,.68);
  font-weight: 650;
  letter-spacing: .08em;
  text-transform: uppercase;
  font-size: .72rem;
  margin-top: .75rem;
}
.project-sidebar {
  top: 4.7rem;
}
@media (max-width: 992px) {
  .main-layout { flex-direction: column; }
  .project-column-expanded, .project-column-collapsed { width: 100%; min-height: auto; }
  .project-column-collapsed { flex-direction: row; justify-content: flex-start; }
  .project-column-collapsed .collapsed-label { writing-mode: horizontal-tb; transform: none; margin: 0 0 0 .75rem; }
}

/* v0.4.22 export resilience, extraction split, and sidebar polish */
.extraction-results-layout {
  --extraction-left-width: 33%;
  display: grid;
  grid-template-columns: minmax(14rem, var(--extraction-left-width)) 10px minmax(0, 1fr);
  gap: .75rem;
  align-items: stretch;
}
.extraction-list-pane,
.extraction-detail-pane {
  min-width: 0;
}
.extraction-divider {
  cursor: col-resize;
  border-radius: 999px;
  background: transparent;
  position: relative;
}
.extraction-divider::after {
  content: "";
  position: absolute;
  top: .25rem;
  bottom: .25rem;
  left: 4px;
  width: 2px;
  border-radius: 999px;
  background: #cbd5e1;
}
.extraction-divider:hover::after,
body.is-resizing-extraction .extraction-divider::after {
  background: var(--brand);
}
body.is-resizing-extraction {
  cursor: col-resize;
  user-select: none;
}
@media (max-width: 992px) {
  .extraction-results-layout {
    display: block;
  }
  .extraction-divider {
    display: none;
  }
  .extraction-list-pane {
    margin-bottom: 1rem;
  }
}

.main-layout {
  align-items: stretch;
}
.project-column-expanded {
  width: min(22rem, 27vw);
  min-height: calc(100vh - 6.2rem);
  background: #151719;
  border-radius: 1rem;
  padding: .65rem;
  box-shadow: 0 18px 42px rgba(0,0,0,.18);
}
.project-column-expanded .project-sidebar {
  position: sticky;
  top: 4.7rem;
  background: transparent;
  color: #f8fafc;
  border: 0;
  box-shadow: none;
}
.project-column-expanded .project-sidebar .card-header {
  background: transparent;
  border-bottom: 1px solid rgba(255,255,255,.08);
  padding-left: .25rem;
  padding-right: .25rem;
}
.project-column-expanded .project-sidebar .card-body {
  padding-left: 0;
  padding-right: 0;
}
.project-column-expanded .project-item {
  background: transparent;
  border-color: rgba(255,255,255,.08);
  color: #f8fafc;
}
.project-column-expanded .project-item:not(.active):hover {
  background: rgba(255,255,255,.06);
}
.project-column-expanded .project-meta-lines,
.project-column-expanded .text-muted {
  color: rgba(248,250,252,.68) !important;
}
.project-column-expanded .active-project-tools .btn-light {
  background: rgba(255,255,255,.10);
  border-color: rgba(255,255,255,.12);
  color: #fff;
}
.project-column-collapsed {
  border-radius: 1rem;
  min-height: calc(100vh - 6.2rem);
  background: #151719;
}

/* v0.4.23 compact extracted-outcome editor */
.extraction-values-compact-table th,
.extraction-values-compact-table td {
  vertical-align: top;
}
.extraction-outcome-cell {
  width: 24rem;
  min-width: 18rem;
}
.details-toggle-cell {
  width: 7rem;
  white-space: nowrap;
}
.extraction-value-grid,
.extraction-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr));
  gap: .55rem .65rem;
  align-items: start;
}
.extraction-detail-grid {
  grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
}
.mini-field {
  display: flex;
  flex-direction: column;
  gap: .2rem;
  min-width: 0;
  font-size: .78rem;
  font-weight: 700;
  color: #475569;
}
.mini-field-wide {
  grid-column: span 2;
}
.extraction-detail-row td {
  background: #f8fafc;
  border-top: 0;
  padding: .85rem 1rem;
}
@media (max-width: 900px) {
  .mini-field-wide {
    grid-column: span 1;
  }
  .extraction-outcome-cell {
    min-width: 14rem;
  }
}

/* v0.4.24 extracted data editor polish */
.extraction-result-item {
  cursor: pointer;
  min-width: 0;
  overflow: hidden;
}
.extraction-study-short-name,
.extraction-status-row,
.extraction-row-actions {
  min-width: 0;
}
.extraction-status-badge {
  flex: 0 1 auto;
  max-width: 100%;
  white-space: normal;
  text-align: left;
  overflow-wrap: anywhere;
}
.extraction-result-item .btn-xs {
  --bs-btn-padding-y: .08rem;
  --bs-btn-padding-x: .35rem;
  --bs-btn-font-size: .72rem;
  --bs-btn-border-radius: .35rem;
}
.extraction-result-item.active .text-muted,
.extraction-result-item.active .text-warning-emphasis {
  color: rgba(255,255,255,.78) !important;
}
.extraction-result-item.active .btn-outline-secondary,
.extraction-result-item.active .btn-outline-primary {
  color: #fff;
  border-color: rgba(255,255,255,.58);
}
.extraction-result-item.active .btn-outline-secondary:hover,
.extraction-result-item.active .btn-outline-primary:hover {
  background: rgba(255,255,255,.16);
}
.extraction-detail-card .card-body {
  padding: 1rem;
}
.extraction-metadata-scroll {
  max-height: 22rem;
  overflow-y: auto;
  border: 1px solid #e2e8f0;
  border-radius: .65rem;
}
.extraction-metadata-scroll .table {
  margin-bottom: 0;
}
.extraction-metadata-scroll thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #fff;
}
.extraction-unit-readonly {
  display: inline-flex;
  align-items: center;
  min-height: calc(1.5em + .5rem + 2px);
  padding: .25rem .55rem;
  border: 1px solid #e2e8f0;
  border-radius: .45rem;
  background: #f8fafc;
  font-weight: 500;
  color: #334155;
}
.extraction-outcome-cell {
  width: 26rem;
}

/* v0.4.26 setup-driven extraction controls */
.ribbon-button,
.ribbon-button.ribbon-primary,
.ribbon-group-danger .ribbon-button {
  color: #111827;
}
.ribbon-button:hover:not(:disabled),
.ribbon-button.active,
.ribbon-button.ribbon-primary:hover:not(:disabled) {
  color: #111827;
}
.extracted-data-tabs .nav-link,
.extraction-tabs .nav-link {
  color: #334155;
}
.extracted-data-tabs .nav-link.active,
.extraction-tabs .nav-link.active {
  color: #0f172a;
  background: #e8eef7;
}

/* v0.4.27 compact ribbon: no labels underneath toolbar buttons */
.ribbon-group-title {
  display: none;
}
.ribbon-group {
  padding-bottom: .12rem;
  min-height: 4.55rem;
  align-items: center;
  align-content: center;
}
.tab-ribbon {
  padding-top: .48rem;
  padding-bottom: .48rem;
}

/* v0.4.28 ITT selector, compact extraction rows, and sidebar guardrails */
.project-column-expanded {
  width: clamp(14rem, 22vw, 22rem);
  max-width: 22rem;
  flex: 0 0 clamp(14rem, 22vw, 22rem);
}
.project-column-collapsed {
  width: 3.25rem;
  flex: 0 0 3.25rem;
}
@media (max-width: 992px) {
  .main-layout {
    flex-direction: row;
    align-items: stretch;
    overflow-x: auto;
  }
  .project-column-expanded {
    width: min(18rem, 74vw);
    max-width: 74vw;
    min-width: 13rem;
    flex: 0 0 min(18rem, 74vw);
  }
  .project-column-collapsed {
    width: 3.25rem;
    min-width: 3.25rem;
    flex: 0 0 3.25rem;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
  }
  .project-column-collapsed .collapsed-label {
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    margin: .75rem 0 0;
  }
  .workspace-column {
    min-width: min(42rem, calc(100vw - 4rem));
  }
}
.extraction-values-compact-table th,
.extraction-values-compact-table td {
  padding-top: .35rem;
  padding-bottom: .35rem;
}
.extraction-values-compact-table .form-control,
.extraction-values-compact-table .form-select {
  min-height: 2rem;
  padding-top: .22rem;
  padding-bottom: .22rem;
}
.extraction-value-grid-inline {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem .55rem;
  align-items: flex-end;
}
.compact-mini-field {
  gap: .12rem;
  min-width: 4.8rem;
  margin: 0;
}
.compact-mini-field > span {
  font-size: .68rem;
  line-height: 1;
  color: #64748b;
}
.compact-value-field {
  min-width: 12rem;
  flex: 1 1 12rem;
}
.compact-unit {
  min-height: 2rem;
  align-self: flex-end;
  font-size: .8rem;
  padding: .22rem .5rem;
  max-width: 16rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.extraction-outcome-cell {
  width: 20rem;
  min-width: 14rem;
}
.details-toggle-cell {
  width: 5.5rem;
}
.details-toggle-cell .btn-xs {
  --bs-btn-padding-y: .16rem;
  --bs-btn-padding-x: .38rem;
  --bs-btn-font-size: .76rem;
  --bs-btn-border-radius: .35rem;
}

/* v0.4.29 toolbar consistency, bottom status, and screening highlights */
.status-centre {
  position: fixed !important;
  top: auto !important;
  left: 50%;
  right: auto;
  bottom: 1rem;
  transform: translateX(-50%);
  z-index: 1200;
  width: min(1100px, calc(100vw - 2rem));
  border: 1px solid #f0d271;
  border-radius: .85rem;
  box-shadow: 0 18px 42px rgba(0,0,0,.22);
  padding: .55rem .75rem;
}
.status-card,
.status-centre .alert {
  width: 100%;
}
.status-centre .alert {
  border-radius: .65rem;
}
.tab-ribbon .ribbon-button {
  width: 6.7rem;
  min-width: 6.7rem;
  max-width: 6.7rem;
  min-height: 4.25rem;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: normal;
}
.tab-ribbon .ribbon-button > span:last-child {
  display: block;
  max-width: 100%;
}
.ribbon-select-label {
  width: 12rem;
  min-width: 12rem;
}
.ribbon-select {
  width: 12rem;
  min-width: 12rem;
}
.predefined-field-actions .predefined-action-btn {
  width: 8.25rem;
  min-width: 8.25rem;
  white-space: normal;
  line-height: 1.1;
}
.predefined-field-option {
  min-height: 5.8rem;
  padding: .55rem;
  gap: .5rem;
}
.predefined-field-body {
  gap: .12rem;
}
.predefined-field-body .small:not(.text-muted) {
  display: none;
}
.predefined-field-group {
  padding: .7rem;
}
.predefined-field-group h6 {
  margin-bottom: .55rem;
}
.screening-hit {
  padding: .04rem .12rem;
  border-radius: .22rem;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}
.screening-hit-include {
  background: #bbf7d0;
  color: #14532d;
}
.screening-hit-exclude {
  background: #fecaca;
  color: #7f1d1d;
}
.screening-hit-maybe {
  background: #fde68a;
  color: #713f12;
}
.screening-hit-neutral {
  background: #e2e8f0;
  color: #1e293b;
}
.extraction-values-compact-table .extraction-value-grid-inline {
  gap: .25rem .45rem;
}
.extraction-values-compact-table .compact-mini-field {
  min-width: 4.5rem;
}
.extraction-values-compact-table .extraction-number {
  width: 5rem;
}

/* v0.4.30 usability fixes */
.topbar-actions {
  display: flex;
  align-items: center;
  gap: .5rem;
}
.undo-topbar-button {
  min-width: 4.5rem;
}
.icon-text-button,
.icon-only-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .35rem;
}
.project-button-icon {
  width: 1.15rem;
  height: 1.15rem;
  object-fit: contain;
}
.project-toggle-icon {
  width: 1.25rem;
  height: 1.25rem;
  object-fit: contain;
}
.icon-only-button {
  min-width: 2.25rem;
  min-height: 2rem;
  padding: .25rem .45rem;
}
.project-column-collapsed .side-toggle {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: .7rem;
}
.project-item {
  min-height: 6.6rem;
}
.active-project-tools {
  visibility: visible !important;
  opacity: 1;
}
.list-group-item:not(.active) .active-project-tools .btn-light {
  border-color: #cbd5e1;
  background: #fff;
  color: #1e293b;
}
.list-group-item:not(.active) .active-project-tools .btn-danger {
  background: #fff;
  border-color: #dc3545;
  color: #dc3545;
}
.list-group-item.active .active-project-tools .btn-light {
  background: rgba(255,255,255,.94);
}
.setup-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  align-items: stretch;
}
.setup-field {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: .9rem;
  padding: .85rem;
  display: flex;
  flex-direction: column;
  min-height: 8.75rem;
}
.setup-field-full {
  grid-column: 1 / -1;
  min-height: 7rem;
}
.setup-field-tall {
  min-height: 13.5rem;
}
.setup-field .form-label {
  font-weight: 650;
  color: #334155;
  margin-bottom: .4rem;
}
.setup-field .form-control {
  flex: 1 1 auto;
  min-height: 0;
}
.screening-hit-maybe {
  background: #fff06a;
  color: #513a00;
  box-shadow: inset 0 0 0 1px rgba(120, 82, 0, .28);
}
@media (max-width: 992px) {
  .setup-grid { grid-template-columns: 1fr; }
  .setup-field, .setup-field-full, .setup-field-tall { grid-column: 1; }
}

.analysis-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  padding: 0.75rem 1rem;
  border: 1px solid #e5e7eb;
  border-radius: 0.75rem;
  background: #fff;
}
.analysis-subtabs .nav-link {
  padding: 0.35rem 0.75rem;
}
.analysis-filter {
  max-width: 260px;
}
.analysis-table-card .card-header,
.analysis-figure-card .card-header {
  background: #fbfbfd;
}
.analysis-table-scroll {
  max-height: 520px;
  overflow: auto;
}
.analysis-table-scroll th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f8f9fa;
  white-space: nowrap;
}
.analysis-table-scroll td {
  max-width: 360px;
  white-space: pre-wrap;
  vertical-align: top;
}
.analysis-figure-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 1rem;
}
.analysis-figure-group-title {
  margin: 0 0 0.5rem;
  color: #374151;
}
.analysis-svg-frame {
  width: 100%;
  min-height: 220px;
  overflow: auto;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  padding: 0.5rem;
}
.analysis-svg-frame svg,
.analysis-figure-img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 0 auto;
}
.analysis-settings-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}
.analysis-settings-grid .form-check {
  margin-bottom: 0;
}
@media (max-width: 768px) {
  .analysis-toolbar { flex-direction: column; }
  .analysis-filter { max-width: none; }
  .analysis-figure-grid { grid-template-columns: 1fr; }
}
.analysis-output-section-title {
  margin: 0 0 0.5rem;
  color: #374151;
}
.analysis-narrative-card .card-header {
  background: #fbfbfd;
}
.analysis-narrative-paragraph {
  white-space: pre-wrap;
  margin-bottom: 0.75rem;
  line-height: 1.5;
}
.analysis-narrative-paragraph:last-child {
  margin-bottom: 0;
}

/* v0.4.29 analysis/extraction polish */
.ribbon-status {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: .5rem;
  min-height: 4.55rem;
  max-width: min(34rem, 45vw);
  padding: .25rem .25rem .25rem 1rem;
  white-space: nowrap;
}
.ribbon-status .text-truncate {
  max-width: min(26rem, 34vw);
}
.extraction-setup-layout {
  --extraction-setup-left-width: 33%;
  display: grid;
  grid-template-columns: minmax(14rem, var(--extraction-setup-left-width)) 10px minmax(0, 1fr);
  gap: .75rem;
  align-items: stretch;
}
.extraction-setup-list-pane,
.extraction-setup-detail-pane {
  min-width: 0;
}
.extraction-setup-list-pane .extraction-list {
  max-height: calc(100vh - 24rem);
  overflow: auto;
}
.extraction-setup-divider:hover::after,
body.is-resizing-extraction-setup .extraction-setup-divider::after {
  background: var(--brand);
}
body.is-resizing-extraction-setup {
  cursor: col-resize;
  user-select: none;
}
@media (max-width: 992px) {
  .ribbon-status {
    width: 100%;
    max-width: 100%;
    min-height: auto;
    justify-content: flex-start;
    padding: .25rem .75rem;
  }
  .ribbon-status .text-truncate {
    max-width: 70vw;
  }
  .extraction-setup-layout {
    display: block;
  }
  .extraction-setup-divider {
    display: none;
  }
  .extraction-setup-list-pane {
    margin-bottom: 1rem;
  }
}


/* v0.4.32 PubMed query generation and three-pane extraction workspace */
.pane-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
}
.collapsed-pane-button {
  width: 100%;
  height: 100%;
  min-height: 14rem;
  border: 1px solid #cbd5e1;
  border-radius: .75rem;
  background: #f8fafc;
  color: #475569;
  font-size: .78rem;
  font-weight: 600;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  letter-spacing: .04em;
}
.collapsed-pane-button:hover {
  background: #eef2ff;
  border-color: var(--brand);
  color: var(--brand);
}
.extraction-results-layout {
  grid-template-columns: minmax(14rem, var(--extraction-left-width)) 10px minmax(22rem, 1.15fr) minmax(22rem, .95fr);
}
.extraction-results-layout.study-list-collapsed {
  grid-template-columns: 2.75rem minmax(22rem, 1.15fr) minmax(22rem, .95fr);
}
.extraction-study-collapsed-pane,
.extraction-setup-collapsed-pane {
  min-width: 0;
}
.extraction-pdf-pane,
.extraction-detail-pane,
.extraction-list-pane {
  min-width: 0;
}
.extraction-pdf-card,
.extraction-detail-card {
  height: calc(100vh - 18.5rem);
  min-height: 34rem;
}
.extraction-pdf-card .card-body,
.extraction-detail-card .card-body {
  height: 100%;
  overflow: auto;
}
.extraction-inline-pdf-frame {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 31rem;
  border: 0;
  background: #f8fafc;
}
.extraction-result-list {
  max-height: calc(100vh - 21rem);
  overflow: auto;
}
.extraction-outcome-name {
  font-weight: 600;
  line-height: 1.2;
}
.extraction-setup-layout.setup-list-collapsed {
  grid-template-columns: 2.75rem minmax(0, 1fr);
}
@media (max-width: 1200px) {
  .extraction-results-layout,
  .extraction-results-layout.study-list-collapsed {
    grid-template-columns: minmax(12rem, var(--extraction-left-width)) minmax(22rem, 1fr);
  }
  .extraction-results-layout .extraction-divider {
    display: none;
  }
  .extraction-pdf-pane {
    grid-column: 2;
  }
  .extraction-detail-pane {
    grid-column: 1 / -1;
  }
}
@media (max-width: 992px) {
  .collapsed-pane-button {
    min-height: 2.5rem;
    writing-mode: horizontal-tb;
    transform: none;
  }
  .extraction-pdf-card,
  .extraction-detail-card {
    height: auto;
    min-height: 0;
  }
  .extraction-inline-pdf-frame {
    height: 70vh;
  }
}

/* v0.4.33 compact toolbar, topbar stats and adjustable extraction panes */
.topbar {
  gap: .75rem;
  min-height: 50px;
  padding: .5rem .9rem;
}
.topbar-left {
  flex: 1 1 auto;
  min-width: 0;
  gap: .75rem;
}
.topbar-project {
  flex: 1 1 auto;
  min-width: 0;
  gap: .35rem;
}
.topbar-project strong {
  max-width: clamp(10rem, 20vw, 26rem);
}
.topbar-stats {
  display: flex;
  align-items: center;
  gap: .45rem;
  margin-left: .35rem;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  color: rgba(255,255,255,.84);
  font-size: .72rem;
}
.topbar-stats span {
  display: inline-flex;
  align-items: baseline;
  gap: .12rem;
}
.topbar-stats strong {
  max-width: none;
  font-size: .86rem;
  color: #fff;
  letter-spacing: 0;
}
.topbar-actions {
  gap: .35rem;
}
@media (max-width: 1400px) {
  .topbar-stats { display: none; }
}
@media (max-width: 992px) {
  .topbar { min-height: 50px; }
  .topbar-left { gap: .25rem; }
}

.tab-ribbon,
.tab-ribbon-review {
  min-height: 0;
  padding: .28rem .45rem .24rem;
  gap: 0;
}
.ribbon-group {
  min-height: 3.25rem;
  padding: .05rem .42rem .86rem;
  gap: .2rem;
  align-items: flex-start;
  align-content: flex-start;
}
.ribbon-group:first-child {
  padding-left: .42rem;
}
.ribbon-group-title {
  bottom: .12rem;
  left: .25rem;
  right: .25rem;
  font-size: .57rem;
  letter-spacing: .015em;
}
.tab-ribbon .ribbon-button,
.ribbon-button,
.ribbon-button.ribbon-primary,
.ribbon-group-danger .ribbon-button {
  width: 5.15rem;
  min-width: 5.15rem;
  max-width: 5.15rem;
  min-height: 2.55rem;
  padding: .16rem .22rem;
  gap: .08rem;
  font-size: .7rem;
  line-height: 1.05;
  border-radius: .42rem;
}
.ribbon-icon {
  font-size: 1.05rem;
  min-height: 1.08rem;
}
.ribbon-select-label {
  width: 9.6rem;
  min-width: 9.6rem;
  font-size: .7rem;
  gap: .12rem;
}
.ribbon-select {
  width: 9.6rem;
  min-width: 9.6rem;
  padding-top: .16rem;
  padding-bottom: .16rem;
  font-size: .74rem;
}
.ribbon-status {
  min-height: 3.1rem;
  padding: .1rem .2rem .1rem .65rem;
  gap: .35rem;
}

.extraction-results-layout {
  --extraction-left-width: 30%;
  --extraction-detail-width: 34%;
  grid-template-columns: minmax(12rem, var(--extraction-left-width)) 8px minmax(18rem, 1fr) 8px minmax(18rem, var(--extraction-detail-width));
  gap: .55rem;
}
.extraction-results-layout.study-list-collapsed {
  grid-template-columns: 2.65rem minmax(18rem, 1fr) 8px minmax(18rem, var(--extraction-detail-width));
}
.extraction-results-layout.detail-pane-collapsed {
  grid-template-columns: minmax(12rem, var(--extraction-left-width)) 8px minmax(18rem, 1fr) 2.65rem;
}
.extraction-results-layout.study-list-collapsed.detail-pane-collapsed {
  grid-template-columns: 2.65rem minmax(18rem, 1fr) 2.65rem;
}
.extraction-detail-collapsed-pane {
  min-width: 0;
}
.extraction-detail-divider::after {
  background: #cbd5e1;
}
.extraction-detail-divider:hover::after,
body.is-resizing-extraction-detail .extraction-detail-divider::after {
  background: var(--brand);
}
body.is-resizing-extraction-detail {
  cursor: col-resize;
  user-select: none;
}
body.is-resizing-extraction-detail .extraction-detail-divider {
  cursor: col-resize;
}
.extraction-values-compact-table th,
.extraction-values-compact-table td {
  padding: .32rem .35rem;
}
.extraction-outcome-cell {
  min-width: 8rem;
}
.extraction-value-grid-inline {
  gap: .3rem;
}
@media (max-width: 1200px) {
  .extraction-results-layout,
  .extraction-results-layout.study-list-collapsed,
  .extraction-results-layout.detail-pane-collapsed,
  .extraction-results-layout.study-list-collapsed.detail-pane-collapsed {
    display: block;
  }
  .extraction-results-layout .extraction-divider,
  .extraction-detail-divider {
    display: none;
  }
  .extraction-pdf-pane,
  .extraction-detail-pane,
  .extraction-detail-collapsed-pane {
    margin-top: .75rem;
  }
}

/* v0.4.34 clean compact command bar */
:root {
  --brand: #ff6b00;
  --brand-dark: #d95b00;
  --brand-soft: #fff1e7;
  --focus-ring: rgba(255, 107, 0, .22);
  --surface: #ffffff;
  --surface-soft: #f7f9fc;
  --line: #dbe3ee;
  --ink: #111827;
  --muted: #667085;
}

body {
  background: #f4f7fb;
  color: var(--ink);
}

main.container-fluid {
  padding-top: .75rem !important;
}

.topbar {
  background: rgba(255,255,255,.96);
  color: #111827;
  border-bottom: 1px solid #dbe3ee;
  box-shadow: 0 8px 22px rgba(16, 24, 40, .06);
  min-height: 54px;
  padding: .46rem .95rem;
  backdrop-filter: saturate(1.2) blur(10px);
}

.brand-mark {
  display: inline-flex;
  align-items: baseline;
  gap: 0;
  color: #111827;
  font-size: 1.38rem;
  font-weight: 820;
  letter-spacing: -.035em;
  white-space: nowrap;
}
.brand-mark .brand-accent {
  color: var(--brand);
}

.topbar-project {
  border-left: 1px solid #d5dde9;
  border-right: 0;
  padding-left: .9rem;
  margin-left: .25rem;
  color: #111827;
}
.topbar-project::before {
  content: "▣";
  color: #667085;
  font-size: .9rem;
  margin-right: .12rem;
}
.topbar-project strong {
  font-size: .98rem;
  font-weight: 730;
  letter-spacing: -.01em;
}
.meta-analysis-badge,
.topbar .autosave-state {
  display: none;
}

.topbar-stats {
  gap: .38rem;
  margin-left: auto;
  color: #344054;
}
.topbar-stats span {
  background: #f0f3f8;
  border: 1px solid #e5e9f0;
  border-radius: 999px;
  padding: .18rem .5rem;
  gap: .22rem;
  font-size: .75rem;
  line-height: 1.1;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.82);
}
.topbar-stats span:nth-child(2) {
  color: #175cd3;
  background: #edf4ff;
  border-color: #d7e8ff;
}
.topbar-stats span:nth-child(4),
.topbar-stats span:nth-child(5) {
  color: #b54708;
  background: #fff6e8;
  border-color: #fde6bc;
}
.topbar-stats span:nth-child(6) {
  color: #067647;
  background: #ecfdf3;
  border-color: #d3f8df;
}
.topbar-stats strong {
  color: inherit;
  font-size: .78rem;
  font-weight: 760;
}

.topbar-actions .btn {
  border-radius: .65rem;
  font-weight: 650;
  padding: .28rem .55rem;
}
.topbar-actions .btn-light,
.topbar-actions .btn-outline-light {
  color: #344054;
  background: #ffffff;
  border-color: #d5dde9;
}
.topbar-actions .btn-light:hover,
.topbar-actions .btn-outline-light:hover {
  color: #111827;
  background: #f7f9fc;
  border-color: #c9d3e2;
}
.account-menu {
  border: 1px solid #dbe3ee;
  box-shadow: 0 18px 45px rgba(16, 24, 40, .15);
}

.status-centre {
  top: 54px;
  width: min(980px, calc(100vw - 2rem));
  left: 50%;
  transform: translateX(-50%);
  margin: .45rem 0 0;
  background: #fff7df;
  border: 1px solid #f6d47b;
  border-radius: .8rem;
  box-shadow: 0 12px 30px rgba(122, 85, 0, .14);
}

.main-layout {
  gap: .75rem;
}
.workspace-card {
  background: #ffffff;
  border-color: #dbe3ee;
  border-radius: .9rem;
  box-shadow: 0 14px 36px rgba(16, 24, 40, .08);
}
.tab-content-box {
  background: #ffffff;
  padding: .85rem;
}
.project-column-collapsed {
  background: #ffffff;
  border: 1px solid #dbe3ee;
  box-shadow: 0 12px 28px rgba(16,24,40,.08);
}
.project-column-collapsed .side-toggle {
  background: #f7f9fc;
  color: #344054;
  border-color: #dbe3ee;
}
.project-column-collapsed .collapsed-label {
  color: #667085;
}
.project-sidebar {
  top: 4.35rem;
}

.app-tabs {
  display: flex;
  align-items: center;
  gap: .42rem;
  padding: .6rem .72rem .35rem;
  background: #ffffff;
  border-bottom: 1px solid #e5e9f0;
}
.app-tabs .nav-link {
  position: relative;
  border: 0;
  border-radius: .72rem;
  background: transparent;
  color: #475467;
  font-size: .86rem;
  font-weight: 680;
  padding: .48rem .72rem;
  letter-spacing: -.005em;
}
.app-tabs .nav-link:hover {
  color: #111827;
  background: #f3f6fb;
}
.app-tabs .nav-link.active {
  color: var(--brand);
  background: #fff;
  border: 1px solid #e6ebf3;
  box-shadow: 0 8px 22px rgba(16, 24, 40, .06);
}
.app-tabs .nav-link.active::after {
  content: "";
  position: absolute;
  left: .72rem;
  right: .72rem;
  bottom: -.38rem;
  height: 2px;
  border-radius: 999px;
  background: var(--brand);
}

.tab-ribbon,
.tab-ribbon-review {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  overflow-x: auto;
  gap: .22rem;
  min-height: 48px;
  padding: .42rem .62rem;
  background: linear-gradient(180deg, #ffffff 0%, #fbfcfe 100%);
  border-bottom: 1px solid #e5e9f0;
  box-shadow: none;
  scrollbar-width: thin;
}
.ribbon-group {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  align-content: center;
  justify-content: flex-start;
  flex-wrap: nowrap;
  gap: .28rem;
  min-height: 36px;
  padding: 0 .58rem;
  border-right: 1px solid #e1e7ef;
}
.ribbon-group:first-child {
  padding-left: .15rem;
}
.ribbon-group:last-child {
  border-right: 0;
}
.ribbon-group-title {
  display: none !important;
}

.tab-ribbon .ribbon-button,
.ribbon-button,
.ribbon-button.ribbon-primary,
.ribbon-group-danger .ribbon-button {
  width: auto;
  min-width: 0;
  max-width: none;
  min-height: 32px;
  height: 32px;
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: .34rem;
  padding: .28rem .56rem;
  border-radius: .62rem;
  border: 1px solid transparent;
  background: transparent;
  color: #344054;
  font-size: .74rem;
  font-weight: 720;
  line-height: 1;
  white-space: nowrap;
}
.tab-ribbon .ribbon-button > span:last-child {
  display: inline;
  max-width: none;
}
.ribbon-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1rem;
  min-height: 1rem;
  font-size: .95rem;
  line-height: 1;
  filter: saturate(.78);
}
.ribbon-button:hover:not(:disabled),
.ribbon-button.active,
.ribbon-button.ribbon-primary:hover:not(:disabled) {
  color: #111827;
  background: #f3f6fb;
  border-color: #dbe3ee;
  box-shadow: 0 1px 2px rgba(16,24,40,.05);
}
.ribbon-button.ribbon-primary {
  color: var(--brand-dark);
  background: var(--brand-soft);
  border-color: #ffd8bd;
}
.ribbon-button.ribbon-primary:hover:not(:disabled) {
  color: var(--brand-dark);
  background: #ffe7d6;
  border-color: #ffc99f;
}
.ribbon-group-danger .ribbon-button {
  color: #b42318;
}
.ribbon-button:focus-visible,
.app-tabs .nav-link:focus-visible,
.ribbon-select:focus {
  outline: 0;
  box-shadow: 0 0 0 .18rem var(--focus-ring);
}
.ribbon-button:disabled {
  opacity: .38;
  filter: grayscale(.55);
}

.ribbon-select-label {
  width: auto;
  min-width: 8.6rem;
  min-height: 32px;
  height: 32px;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: .38rem;
  padding: 0;
  color: #344054;
  font-size: .72rem;
  font-weight: 720;
  white-space: nowrap;
}
.ribbon-select {
  width: 8.8rem;
  min-width: 8.8rem;
  height: 30px;
  padding: .16rem 1.9rem .16rem .5rem;
  border-radius: .56rem;
  background-color: #ffffff;
  border-color: #d5dde9;
  color: #111827;
  font-size: .74rem;
  font-weight: 620;
}
.ribbon-status {
  align-self: center;
  min-height: 32px;
  height: 32px;
  margin-left: auto !important;
  padding: 0 .35rem 0 .55rem;
  border-left: 1px solid #e1e7ef;
}
.ribbon-status .badge {
  border-radius: 999px;
}

.btn,
.form-control,
.form-select {
  border-radius: .6rem;
}
.btn-primary {
  background-color: var(--brand);
  border-color: var(--brand);
  color: #fff;
}
.btn-primary:hover,
.btn-primary:focus {
  background-color: var(--brand-dark);
  border-color: var(--brand-dark);
  color: #fff;
}
.btn-outline-primary {
  color: var(--brand-dark);
  border-color: #ffc99f;
}
.btn-outline-primary:hover,
.btn-outline-primary:focus {
  background: var(--brand-soft);
  color: var(--brand-dark);
  border-color: #ffb57f;
}
.progress-bar {
  background: var(--brand);
}

.analysis-toolbar,
.pane-header,
.card-header {
  background: #fbfcfe;
}
.extraction-results-layout {
  gap: .5rem;
}
.extraction-list-pane,
.extraction-pdf-card,
.extraction-detail-card,
.project-sidebar,
.record-card,
.placeholder-panel,
.card {
  border-color: #dbe3ee;
}
.extraction-result-item.active,
.list-group-item.active {
  background: #fff7f0;
  color: #111827;
  border-color: #ffbc8a;
  box-shadow: inset 3px 0 0 var(--brand);
}
.list-group-item.active .project-meta-lines,
.list-group-item.active small {
  color: #667085 !important;
}

@media (max-width: 1500px) {
  .topbar-stats { display: none; }
}
@media (max-width: 992px) {
  .topbar {
    position: sticky;
    top: 0;
    min-height: 54px;
  }
  .topbar-left {
    flex-direction: row;
    align-items: center;
  }
  .topbar-project {
    flex-wrap: nowrap;
  }
  .status-centre {
    top: 54px;
  }
  .app-tabs {
    overflow-x: auto;
    flex-wrap: nowrap;
  }
}
@media (max-width: 760px) {
  .topbar-project strong {
    max-width: 34vw;
  }
  .topbar-actions .btn-light,
  .undo-topbar-button {
    display: none;
  }
  .ribbon-select-label {
    min-width: 7.8rem;
  }
  .ribbon-select {
    width: 7.8rem;
    min-width: 7.8rem;
  }
}

/* v0.4.35 fixed workspace fit and neutral compact toolbar */
html,
body {
  height: 100%;
  overflow: hidden;
}

.app-shell {
  height: 100dvh;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.topbar {
  flex: 0 0 auto;
}

main.container-fluid {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding-top: .65rem !important;
  padding-bottom: .65rem !important;
}

.main-layout {
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  align-items: stretch;
  overflow: hidden;
}

.project-column,
.project-column-expanded,
.project-column-collapsed,
.workspace-column {
  min-height: 0 !important;
  height: 100%;
}

.project-column-expanded,
.project-column-collapsed {
  max-height: 100%;
}

.project-sidebar {
  position: static !important;
  top: auto !important;
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.project-sidebar > .card-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.project-list {
  max-height: none !important;
  height: 100%;
  overflow: auto;
}

.workspace-column {
  display: flex;
  flex-direction: column;
}

.workspace-card {
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.app-tabs,
.tab-ribbon,
.tab-ribbon-review {
  flex: 0 0 auto;
}

.tab-content-box {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.tab-content-box > section {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  overflow: auto;
}

.tab-content-box > section:has(.extraction-results-layout),
.tab-content-box > section:has(.extraction-setup-layout) {
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.extraction-results-layout,
.extraction-setup-layout {
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

.extraction-list-pane,
.extraction-pdf-pane,
.extraction-detail-pane,
.extraction-setup-list-pane,
.extraction-setup-detail-pane {
  min-height: 0;
  overflow: hidden;
}

.extraction-list-pane,
.extraction-setup-list-pane {
  display: flex;
  flex-direction: column;
}

.extraction-list-pane .extraction-result-list,
.extraction-setup-list-pane .extraction-list {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none !important;
  overflow: auto;
}

.extraction-pdf-pane,
.extraction-detail-pane {
  display: flex;
  flex-direction: column;
}

.extraction-pdf-card,
.extraction-detail-card {
  flex: 1 1 auto;
  min-height: 0 !important;
  height: 100% !important;
  display: flex;
  flex-direction: column;
}

.extraction-pdf-card > .card-header,
.extraction-detail-card > .card-header {
  flex: 0 0 auto;
}

.extraction-pdf-card > .card-body,
.extraction-detail-card > .card-body {
  flex: 1 1 auto;
  min-height: 0;
  height: auto !important;
  overflow: auto;
}

.extraction-inline-pdf-frame {
  height: 100% !important;
  min-height: 0 !important;
}

.extraction-metadata-scroll,
.extraction-values-table,
.analysis-table-scroll {
  max-height: none;
}

.app-tabs {
  gap: .65rem;
  padding: .54rem .72rem .24rem;
}

.app-tabs .nav-link,
.app-tabs .nav-link:hover,
.app-tabs .nav-link.active {
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

.app-tabs .nav-link {
  padding: .42rem .14rem .5rem;
  color: #475467;
}

.app-tabs .nav-link:hover {
  color: #111827;
}

.app-tabs .nav-link.active {
  color: var(--brand);
  font-weight: 740;
}

.app-tabs .nav-link.active::after {
  left: 0;
  right: 0;
  bottom: -.26rem;
  height: 2px;
}

.tab-ribbon .ribbon-button,
.ribbon-button,
.ribbon-button.ribbon-primary,
.ribbon-button.active,
.ribbon-button.ribbon-primary.active,
.ribbon-group-danger .ribbon-button,
.ribbon-group-danger .ribbon-button.active,
.ribbon-button.ribbon-primary:hover:not(:disabled),
.ribbon-group-danger .ribbon-button:hover:not(:disabled) {
  color: #344054 !important;
  background: transparent !important;
  border-color: transparent !important;
  box-shadow: none !important;
}

.ribbon-button:hover:not(:disabled) {
  color: #344054 !important;
  background: #f5f7fb !important;
  border-color: transparent !important;
  box-shadow: none !important;
}

.ribbon-button:disabled {
  color: #344054 !important;
}

.ribbon-select-label,
.ribbon-select-label span,
.ribbon-status,
.ribbon-status .badge {
  color: #344054;
}

@media (max-width: 992px) {
  html,
  body,
  .app-shell {
    overflow: hidden;
  }

  .main-layout {
    overflow: auto;
  }

  .project-column,
  .project-column-expanded,
  .project-column-collapsed,
  .workspace-column {
    height: auto;
  }
}

/* v0.4.35 extraction setup viewport helpers */
.tab-content-box > section:has(.extraction-setup-layout) > .mb-3,
.tab-content-box > section:has(.extraction-setup-layout) .extraction-editor {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.tab-content-box > section:has(.extraction-setup-layout) .extraction-editor > .d-flex:first-child {
  flex: 0 0 auto;
}

.extraction-setup-detail-pane {
  overflow: auto;
}

/* v0.4.36 consistent toolbar hover, dark mode, and extracted-data legibility */
.account-theme-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.theme-toggle-state {
  font-size: .75rem;
  font-weight: 700;
  color: #667085;
}

.tab-ribbon .ribbon-button:hover:not(:disabled),
.tab-ribbon .ribbon-button.ribbon-primary:hover:not(:disabled),
.tab-ribbon .ribbon-group-danger .ribbon-button:hover:not(:disabled),
.ribbon-button:hover:not(:disabled),
.ribbon-button.ribbon-primary:hover:not(:disabled),
.ribbon-group-danger .ribbon-button:hover:not(:disabled) {
  color: #344054 !important;
  background: #f3f6fb !important;
  border-color: #dbe3ee !important;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .05) !important;
}

.extraction-result-item.active .text-muted,
.extraction-result-item.active .text-warning-emphasis,
.extraction-results-layout .list-group-item.active .text-muted,
.extraction-results-layout .list-group-item.active .text-warning-emphasis {
  color: #667085 !important;
}
.extraction-result-item.active .btn-outline-secondary,
.extraction-result-item.active .btn-outline-primary {
  color: #344054 !important;
  background: #ffffff !important;
  border-color: #cbd5e1 !important;
}
.extraction-result-item.active .btn-outline-danger {
  color: #b42318 !important;
  background: #ffffff !important;
  border-color: #f4b0aa !important;
}
.extraction-result-item.active .btn-outline-secondary:hover,
.extraction-result-item.active .btn-outline-primary:hover {
  color: #111827 !important;
  background: #f3f6fb !important;
  border-color: #94a3b8 !important;
}
.extraction-result-item.active .btn-outline-danger:hover {
  background: #fff1f0 !important;
}

body.theme-dark {
  background: #0b1120;
  color: #e5e7eb;
}
.theme-dark {
  --surface: #111827;
  --surface-soft: #0f172a;
  --line: #263449;
  --ink: #e5e7eb;
  --muted: #94a3b8;
  --brand-soft: rgba(255, 107, 0, .16);
  --focus-ring: rgba(255, 107, 0, .34);
  color: #e5e7eb;
}
.theme-dark .topbar,
.theme-dark .workspace-card,
.theme-dark .project-sidebar,
.theme-dark .project-column-collapsed,
.theme-dark .card,
.theme-dark .modal-content,
.theme-dark .account-menu {
  background: #111827;
  color: #e5e7eb;
  border-color: #263449;
  box-shadow: 0 14px 34px rgba(0, 0, 0, .32);
}
.theme-dark .brand-mark,
.theme-dark .topbar-project,
.theme-dark .topbar-project strong,
.theme-dark .card-header,
.theme-dark .pane-header,
.theme-dark .analysis-toolbar {
  color: #e5e7eb;
}
.theme-dark .topbar-project {
  border-left-color: #263449;
}
.theme-dark .topbar-project::before,
.theme-dark .project-column-collapsed .collapsed-label,
.theme-dark .text-muted,
.theme-dark small.text-muted,
.theme-dark .small.text-muted {
  color: #94a3b8 !important;
}
.theme-dark .topbar-actions .btn-light,
.theme-dark .topbar-actions .btn-outline-light,
.theme-dark .project-column-collapsed .side-toggle {
  color: #dbe4f0;
  background: #162033;
  border-color: #334155;
}
.theme-dark .topbar-actions .btn-light:hover,
.theme-dark .topbar-actions .btn-outline-light:hover,
.theme-dark .project-column-collapsed .side-toggle:hover {
  color: #f8fafc;
  background: #1e293b;
  border-color: #475569;
}
.theme-dark .account-menu-user,
.theme-dark .dropdown-item {
  color: #e5e7eb;
}
.theme-dark .dropdown-item:hover,
.theme-dark .dropdown-item:focus {
  color: #f8fafc;
  background: #1e293b;
}
.theme-dark .theme-toggle-state {
  color: #cbd5e1;
}
.theme-dark .app-tabs,
.theme-dark .tab-ribbon,
.theme-dark .tab-ribbon-review,
.theme-dark .tab-content-box,
.theme-dark .card-header,
.theme-dark .pane-header,
.theme-dark .analysis-toolbar {
  background: #111827;
  border-color: #263449;
}
.theme-dark .app-tabs .nav-link {
  color: #cbd5e1;
}
.theme-dark .app-tabs .nav-link:hover {
  color: #f8fafc;
}
.theme-dark .app-tabs .nav-link.active {
  color: #ff9b54;
}
.theme-dark .ribbon-group,
.theme-dark .ribbon-status {
  border-color: #263449;
}
.theme-dark .tab-ribbon .ribbon-button,
.theme-dark .ribbon-button,
.theme-dark .ribbon-button.ribbon-primary,
.theme-dark .ribbon-group-danger .ribbon-button,
.theme-dark .ribbon-select-label,
.theme-dark .ribbon-select-label span,
.theme-dark .ribbon-status,
.theme-dark .ribbon-status .badge {
  color: #cbd5e1 !important;
}
.theme-dark .tab-ribbon .ribbon-button:hover:not(:disabled),
.theme-dark .tab-ribbon .ribbon-button.ribbon-primary:hover:not(:disabled),
.theme-dark .tab-ribbon .ribbon-group-danger .ribbon-button:hover:not(:disabled),
.theme-dark .ribbon-button:hover:not(:disabled),
.theme-dark .ribbon-button.ribbon-primary:hover:not(:disabled),
.theme-dark .ribbon-group-danger .ribbon-button:hover:not(:disabled) {
  color: #f8fafc !important;
  background: #1e293b !important;
  border-color: #334155 !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .22) !important;
}
.theme-dark .form-control,
.theme-dark .form-select,
.theme-dark .ribbon-select {
  color: #e5e7eb;
  background-color: #0f172a;
  border-color: #334155;
}
.theme-dark .form-control:focus,
.theme-dark .form-select:focus,
.theme-dark .ribbon-select:focus {
  color: #f8fafc;
  background-color: #111827;
  border-color: #ff9b54;
}
.theme-dark .form-control::placeholder {
  color: #64748b;
}
.theme-dark .list-group-item,
.theme-dark .project-item,
.theme-dark .record-card,
.theme-dark .placeholder-panel,
.theme-dark .extraction-pdf-card,
.theme-dark .extraction-detail-card,
.theme-dark .extraction-list-pane,
.theme-dark .extraction-setup-list-pane,
.theme-dark .extraction-setup-detail-pane {
  color: #e5e7eb;
  background: #111827;
  border-color: #263449;
}
.theme-dark .list-group-item-action:hover,
.theme-dark .project-item:hover {
  color: #f8fafc;
  background: #162033;
}
.theme-dark .extraction-result-item.active,
.theme-dark .list-group-item.active {
  color: #f8fafc;
  background: #241b14;
  border-color: #b45309;
  box-shadow: inset 3px 0 0 #ff9b54;
}
.theme-dark .extraction-result-item.active .text-muted,
.theme-dark .extraction-result-item.active .text-warning-emphasis,
.theme-dark .extraction-results-layout .list-group-item.active .text-muted,
.theme-dark .extraction-results-layout .list-group-item.active .text-warning-emphasis {
  color: #cbd5e1 !important;
}
.theme-dark .extraction-result-item.active .btn-outline-secondary,
.theme-dark .extraction-result-item.active .btn-outline-primary {
  color: #e5e7eb !important;
  background: #162033 !important;
  border-color: #475569 !important;
}
.theme-dark .extraction-result-item.active .btn-outline-danger {
  color: #fecaca !important;
  background: #251416 !important;
  border-color: #7f1d1d !important;
}
.theme-dark .table {
  --bs-table-color: #e5e7eb;
  --bs-table-bg: #111827;
  --bs-table-border-color: #263449;
  --bs-table-striped-bg: #0f172a;
  --bs-table-hover-bg: #162033;
}
.theme-dark .extraction-detail-row td,
.theme-dark .llm-panel,
.theme-dark .record-pdf-panel,
.theme-dark .config-summary-panel,
.theme-dark .setup-grid,
.theme-dark .extraction-unit-readonly {
  background: #0f172a;
  border-color: #263449;
  color: #e5e7eb;
}
.theme-dark .topbar-stats span,
.theme-dark .badge.text-bg-light {
  color: #cbd5e1 !important;
  background: #162033 !important;
  border-color: #334155 !important;
}
.theme-dark .alert-light,
.theme-dark .alert-info,
.theme-dark .alert-warning {
  color: #f8fafc;
  background: #172033;
  border-color: #334155;
}
.theme-dark .btn-outline-secondary {
  color: #cbd5e1;
  border-color: #475569;
}
.theme-dark .btn-outline-secondary:hover {
  color: #f8fafc;
  background: #1e293b;
  border-color: #64748b;
}
.theme-dark .btn-close {
  filter: invert(1) grayscale(1);
}

/* v0.4.37 compact setup, lighter projects pane, and selected analysis outputs */
.app-footer {
  flex: 0 0 auto;
  padding: .16rem 0 .18rem !important;
  font-size: .64rem !important;
  line-height: 1 !important;
  opacity: .72;
}
main.container-fluid {
  padding-bottom: .45rem !important;
}

/* Match the projects pane to the light application surfaces in non-dark mode. */
.project-column-expanded,
.project-column-collapsed {
  background: var(--surface) !important;
  border: 1px solid var(--line);
  box-shadow: 0 8px 24px rgba(15, 23, 42, .06) !important;
}
.project-column-expanded .project-sidebar {
  color: var(--ink) !important;
}
.project-column-expanded .project-sidebar .card-header {
  background: var(--surface) !important;
  border-bottom-color: var(--line) !important;
}
.project-column-expanded .project-item {
  color: var(--ink) !important;
  background: #fff !important;
  border-color: var(--line) !important;
}
.project-column-expanded .project-item:not(.active):hover {
  background: #f8fafc !important;
}
.project-column-expanded .project-meta-lines,
.project-column-expanded .text-muted {
  color: var(--muted) !important;
}
.project-column-expanded .active-project-tools .btn-light,
.project-column-expanded .active-project-tools .btn-danger {
  box-shadow: none;
}
.project-column-collapsed .collapsed-label {
  color: var(--muted);
}

/* Setup fields: retain the clean grid, but reduce vertical footprint. */
.setup-grid {
  gap: .65rem !important;
}
.setup-field {
  min-height: 6.15rem !important;
  padding: .55rem .65rem !important;
  border-radius: .72rem !important;
}
.setup-field-full {
  min-height: 5.35rem !important;
}
.setup-field-tall {
  min-height: 9.1rem !important;
}
.setup-field .form-label {
  margin-bottom: .22rem !important;
  font-size: .78rem;
}
.setup-field textarea.form-control {
  line-height: 1.28;
  padding-top: .36rem;
  padding-bottom: .36rem;
}

/* Analysis: fixed subtabs, left output list, one selected output on the right. */
.analysis-section {
  display: flex !important;
  flex-direction: column;
  min-height: 0;
  overflow: hidden !important;
}
.analysis-subtabs {
  flex: 0 0 auto;
  margin: 0 0 .55rem !important;
  padding-bottom: .35rem;
  border-bottom: 1px solid var(--line);
  gap: .3rem;
}
.analysis-subtabs .nav-link {
  border-radius: .45rem;
  color: #475467;
  padding: .28rem .58rem;
}
.analysis-subtabs .nav-link.active {
  color: var(--brand-dark);
  background: var(--brand-soft);
  font-weight: 700;
}
.analysis-state-panel,
.analysis-notes-panel {
  flex: 0 0 auto;
  margin-bottom: .55rem;
}
.analysis-workspace {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(13rem, 18rem) minmax(0, 1fr);
  gap: .75rem;
  overflow: hidden;
}
.analysis-list-pane,
.analysis-preview-pane {
  min-height: 0;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: .8rem;
  overflow: hidden;
}
.analysis-list-pane {
  display: flex;
  flex-direction: column;
}
.analysis-list-tools {
  flex: 0 0 auto;
  padding: .55rem;
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
}
.analysis-list-tools .analysis-filter {
  max-width: none;
}
.analysis-output-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: .35rem;
}
.analysis-list-item {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink);
  width: 100%;
  display: block;
  text-align: left;
  border-radius: .62rem;
  padding: .5rem .55rem;
  margin-bottom: .25rem;
  transition: background .14s ease, border-color .14s ease, box-shadow .14s ease;
}
.analysis-list-item:hover {
  background: #f8fafc;
  border-color: #e5e9f0;
}
.analysis-list-item.active {
  background: #fff7f0;
  border-color: #ffbc8a;
  box-shadow: inset 3px 0 0 var(--brand);
}
.analysis-list-title,
.analysis-list-meta {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.analysis-list-title {
  font-weight: 700;
  font-size: .82rem;
  white-space: nowrap;
}
.analysis-list-meta {
  color: var(--muted);
  font-size: .72rem;
  margin-top: .12rem;
  white-space: nowrap;
}
.analysis-list-empty {
  color: var(--muted);
  font-size: .82rem;
  padding: .7rem .55rem;
}
.analysis-preview-pane {
  overflow: auto;
  padding: .65rem;
}
.analysis-output-card {
  min-height: 100%;
  display: flex;
  flex-direction: column;
}
.analysis-output-card > .card-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}
.analysis-output-actions {
  display: flex;
  align-items: center;
  gap: .4rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.analysis-svg-frame {
  min-height: 0;
  max-height: none;
}
.analysis-figure-card .analysis-svg-frame {
  height: 100%;
}

@media (max-width: 900px) {
  .analysis-workspace {
    grid-template-columns: 1fr;
  }
  .analysis-list-pane {
    max-height: 13rem;
  }
}

.theme-dark .project-column-expanded,
.theme-dark .project-column-collapsed {
  background: #111827 !important;
  border-color: #263449;
  box-shadow: 0 14px 34px rgba(0, 0, 0, .32) !important;
}
.theme-dark .project-column-expanded .project-sidebar,
.theme-dark .project-column-expanded .project-item {
  color: #e5e7eb !important;
}
.theme-dark .project-column-expanded .project-sidebar .card-header,
.theme-dark .project-column-expanded .project-item,
.theme-dark .analysis-list-pane,
.theme-dark .analysis-preview-pane,
.theme-dark .analysis-list-item,
.theme-dark .analysis-output-card {
  background: #111827 !important;
  border-color: #263449 !important;
}
.theme-dark .project-column-expanded .project-item:not(.active):hover,
.theme-dark .analysis-list-item:hover {
  background: #162033 !important;
}
.theme-dark .analysis-list-tools {
  background: #0f172a;
  border-color: #263449;
}
.theme-dark .analysis-list-item.active {
  background: #241b14 !important;
  border-color: #b45309 !important;
  box-shadow: inset 3px 0 0 #ff9b54;
}
.theme-dark .analysis-subtabs {
  border-color: #263449;
}
.theme-dark .analysis-subtabs .nav-link {
  color: #cbd5e1;
}
.theme-dark .analysis-subtabs .nav-link.active {
  color: #ff9b54;
  background: rgba(255, 107, 0, .16);
}

/* v0.4.38 workspace polish and analysis item settings */
.topbar-project::before,
.project-title-separator {
  display: none !important;
  content: none !important;
}
.meta-analysis-badge {
  display: inline-flex !important;
  align-items: center;
  margin-left: .45rem;
  padding: .13rem .42rem;
  border-radius: 999px;
  background: #f1f5f9;
  color: #475569;
  font-size: .72rem;
  font-weight: 700;
  line-height: 1.1;
  white-space: nowrap;
}
.theme-dark .meta-analysis-badge {
  background: #1f2937;
  color: #cbd5e1;
}
.project-column-expanded .project-item.active .project-select,
.project-column-expanded .project-item.active .project-meta-lines,
.project-column-expanded .project-item.active .text-muted {
  color: #fff !important;
}
.project-column-expanded .project-item.active .active-project-tools .btn-light,
.project-column-expanded .project-item.active .active-project-tools .btn:not(.btn-danger) {
  background: #fff !important;
  color: #172033 !important;
  border-color: rgba(255,255,255,.92) !important;
  opacity: 1 !important;
}
.project-column-expanded .project-item.active .active-project-tools .btn-light:hover,
.project-column-expanded .project-item.active .active-project-tools .btn:not(.btn-danger):hover {
  background: #eef2ff !important;
  color: var(--brand-dark) !important;
}
.project-column-expanded .project-item.active .active-project-tools .btn-danger {
  background: #dc3545 !important;
  color: #fff !important;
  border-color: #dc3545 !important;
}
.record-refresh-state {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  color: var(--muted);
  font-size: .8rem;
  margin-bottom: .45rem;
  padding: .2rem .45rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-soft);
}
.compact-placeholder {
  padding: .85rem 1rem !important;
  min-height: auto !important;
  display: flex;
  align-items: center;
}
.pane-header-icon-only {
  justify-content: flex-end !important;
  min-height: 1.45rem;
}
.pane-collapse-button {
  width: 1.6rem;
  height: 1.6rem;
  padding: .16rem !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.pane-collapse-button .project-toggle-icon,
.collapsed-pane-icon-button .project-toggle-icon {
  width: 1rem;
  height: 1rem;
  object-fit: contain;
}
.collapsed-pane-button.collapsed-pane-icon-button {
  min-height: 100% !important;
  height: 100% !important;
  writing-mode: horizontal-tb !important;
  transform: none !important;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: .45rem;
  border-radius: .55rem;
}
.extraction-study-collapsed-pane,
.extraction-setup-collapsed-pane,
.extraction-detail-collapsed-pane {
  align-self: stretch;
  display: flex;
  align-items: stretch;
}
.analysis-item-settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .75rem;
}
.analysis-item-setting-field {
  display: flex;
  flex-direction: column;
  gap: .2rem;
  margin: 0;
}
.analysis-item-setting-field small {
  line-height: 1.25;
}
.analysis-notes-list {
  padding-left: 1.1rem;
}
.analysis-notes-list li {
  margin-bottom: .45rem;
}
@media (max-width: 760px) {
  .analysis-item-settings-grid { grid-template-columns: 1fr; }
  .meta-analysis-badge { display: none !important; }
}

/* v0.4.39 cached analysis and extraction workspace polish */
.project-column-expanded .project-item.active .project-select,
.project-column-expanded .project-item.active .project-meta-lines,
.project-column-expanded .project-item.active .text-muted {
  color: #111827 !important;
}
.project-column-expanded .project-item.active .project-select strong,
.project-column-expanded .project-item.active .project-select .fw-semibold {
  color: #111827 !important;
}
.project-column-expanded .project-item.active .active-project-tools .btn-light,
.project-column-expanded .project-item.active .active-project-tools .btn:not(.btn-danger) {
  background: #fff !important;
  color: #1f2937 !important;
  border: 1px solid #cbd5e1 !important;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .05);
}
.project-column-expanded .project-item.active .active-project-tools .btn-light:hover,
.project-column-expanded .project-item.active .active-project-tools .btn:not(.btn-danger):hover {
  background: #fff7f0 !important;
  color: var(--brand-dark) !important;
  border-color: #ffbc8a !important;
}
.project-column-expanded .project-item.active .active-project-tools .btn-danger {
  border: 1px solid #dc3545 !important;
}
.theme-dark .project-column-expanded .project-item.active .project-select,
.theme-dark .project-column-expanded .project-item.active .project-meta-lines,
.theme-dark .project-column-expanded .project-item.active .text-muted {
  color: #e5e7eb !important;
}
.theme-dark .project-column-expanded .project-item.active .active-project-tools .btn-light,
.theme-dark .project-column-expanded .project-item.active .active-project-tools .btn:not(.btn-danger) {
  background: #1f2937 !important;
  color: #e5e7eb !important;
  border-color: #475569 !important;
}

.extraction-pdf-card-plain .card-body {
  height: 100%;
}
.extraction-pdf-card-plain .extraction-inline-pdf-frame {
  display: block;
  height: 100%;
}
.collapsed-pane-button.collapsed-pane-icon-button {
  flex-direction: column;
  gap: .45rem;
}
.collapsed-pane-label {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  letter-spacing: .08em;
  font-size: .65rem;
  font-weight: 800;
  color: var(--muted);
  line-height: 1;
}
.collapsed-pane-icon-button:hover .collapsed-pane-label,
.collapsed-pane-icon-button:focus .collapsed-pane-label {
  color: var(--brand-dark);
}
.extraction-value-row,
.extraction-detail-row {
  cursor: pointer;
  transition: background .15s ease, box-shadow .15s ease;
}
.extraction-values-compact-table tbody tr.extraction-value-row.selected > td,
.extraction-values-compact-table tbody tr.extraction-detail-row.selected > td {
  background: #fff7ed !important;
  box-shadow: none;
}
.extraction-values-compact-table tbody tr.extraction-value-row:hover > td {
  background: #fffaf5;
}
.theme-dark .collapsed-pane-label {
  color: #cbd5e1;
}
.theme-dark .extraction-values-compact-table tbody tr.extraction-value-row.selected > td,
.theme-dark .extraction-values-compact-table tbody tr.extraction-detail-row.selected > td {
  background: #241b14 !important;
  box-shadow: none;
}
.theme-dark .extraction-values-compact-table tbody tr.extraction-value-row:hover > td {
  background: #172033;
}
.analysis-stale-alert {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  margin: .45rem 0;
  padding: .45rem .65rem;
  border: 1px solid #fed7aa;
  border-radius: .7rem;
  background: #fff7ed;
  color: #7c2d12;
  font-size: .82rem;
}
.analysis-stale-alert .btn {
  flex: 0 0 auto;
}
.theme-dark .analysis-stale-alert {
  background: #241b14;
  border-color: #9a5a17;
  color: #fed7aa;
}
@media (max-width: 900px) {
  .analysis-stale-alert {
    align-items: flex-start;
    flex-direction: column;
  }
}

/* Embedded PDF.js reader */
.extraction-custom-pdf-reader {
  background: #e8edf3;
  color-scheme: light;
}
.theme-dark .extraction-custom-pdf-reader {
  background: #111827;
  color-scheme: dark;
}


/* v0.4.49 account theme persistence and dark-mode surface corrections */
.theme-dark .collapsed-pane-button,
.theme-dark .collapsed-pane-button.collapsed-pane-icon-button,
.theme-dark .extraction-study-collapsed-pane,
.theme-dark .extraction-setup-collapsed-pane,
.theme-dark .extraction-detail-collapsed-pane {
  background: #111827 !important;
  color: #cbd5e1 !important;
  border-color: #334155 !important;
}
.theme-dark .collapsed-pane-button:hover,
.theme-dark .collapsed-pane-button:focus {
  background: #1e293b !important;
  color: #f8fafc !important;
  border-color: #64748b !important;
}
.theme-dark .collapsed-pane-button:hover .collapsed-pane-label,
.theme-dark .collapsed-pane-button:focus .collapsed-pane-label {
  color: #f8fafc !important;
}

.theme-dark .analysis-table-scroll thead,
.theme-dark .analysis-table-scroll thead tr,
.theme-dark .analysis-table-scroll thead th,
.theme-dark .analysis-table-card .card-header,
.theme-dark .analysis-figure-card .card-header,
.theme-dark .analysis-narrative-card .card-header {
  background: #0f172a !important;
  color: #e5e7eb !important;
  border-color: #334155 !important;
}
.theme-dark .analysis-table-scroll thead th {
  box-shadow: inset 0 -1px 0 #334155;
}

.theme-dark .human-decision-row {
  background: #172033 !important;
  border-color: #334155 !important;
  color: #e5e7eb !important;
}
.theme-dark .human-decision-row .form-label,
.theme-dark .human-decision-row .form-check-label {
  color: #dbe4f0 !important;
}

.theme-dark .predefined-field-group {
  background: #0f172a !important;
  border-color: #334155 !important;
}
.theme-dark .predefined-field-group h6 {
  color: #e5e7eb !important;
}
.theme-dark .predefined-field-option {
  background: #111827 !important;
  border-color: #334155 !important;
  color: #e5e7eb !important;
}
.theme-dark .predefined-field-option:hover,
.theme-dark .predefined-field-option.active {
  background: #172033 !important;
  border-color: #64748b !important;
}
.theme-dark .predefined-field-option.active {
  box-shadow: inset 3px 0 0 #ff8a2a;
}

/* Bottom notifications use one clean surface. Warnings remain conventionally yellow. */
.theme-dark .status-centre {
  background: #172033 !important;
  border-color: #475569 !important;
  box-shadow: 0 18px 42px rgba(0, 0, 0, .38) !important;
}
.theme-dark .status-centre .alert,
.theme-dark .status-centre .alert-info {
  color: #e5e7eb !important;
  background: transparent !important;
  border: 0 !important;
}
.status-centre.status-warning {
  background: #fff7d6 !important;
  border-color: #e8bd42 !important;
  color: #6b4b00 !important;
}
.status-centre.status-warning .alert-warning {
  color: inherit !important;
  background: transparent !important;
  border: 0 !important;
}
.theme-dark .status-centre.status-warning {
  background: #3b2a08 !important;
  border-color: #d6a11d !important;
  color: #fde68a !important;
}
.theme-dark .status-centre.status-warning .alert-warning {
  color: #fde68a !important;
}
.status-centre.status-error {
  background: #fff1f0 !important;
  border-color: #f1a6a0 !important;
}
.theme-dark .status-centre.status-error {
  background: #351517 !important;
  border-color: #8f3438 !important;
}
.theme-dark .status-centre.status-error .alert-danger {
  color: #fecaca !important;
  background: transparent !important;
  border: 0 !important;
}

/* Visual manuscript editor */














/* v0.4.54: keep drag events inside Medscreen when the pointer crosses the preview iframe. */











@media (max-width: 760px) {
  
  
  
  
}












@media (max-width: 900px) {
  
}





/* v0.4.60 inline-code, viewport, save-state, and collapsed-rail refinements */
:root {
  --collapsed-rail-width: 2.65rem;
}

/* The application workspace should use the viewport rather than reserve space for a footer. */
main.container-fluid {
  padding: .28rem .35rem .3rem !important;
}
.main-layout {
  gap: .38rem !important;
}
.app-footer {
  display: none !important;
}

/* Restore the contextual save state beside the project title. */
.topbar .autosave-state {
  display: inline-flex !important;
  align-items: center;
  min-width: 0 !important;
  max-width: 11rem;
  margin-left: .35rem;
  color: #667085 !important;
  font-size: .72rem;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topbar .autosave-state.is-saving {
  color: #b54708 !important;
}
.topbar .autosave-state.is-unsaved {
  color: #b42318 !important;
}
.theme-dark .topbar .autosave-state {
  color: #94a3b8 !important;
}
.theme-dark .topbar .autosave-state.is-saving {
  color: #fbbf24 !important;
}
.theme-dark .topbar .autosave-state.is-unsaved {
  color: #fca5a5 !important;
}

/* One consistent collapsed rail across projects, extraction panes, and preview. */
.project-column-collapsed,
.extraction-study-collapsed-pane,
.extraction-setup-collapsed-pane,
.extraction-detail-collapsed-pane{
  width: var(--collapsed-rail-width) !important;
  min-width: var(--collapsed-rail-width) !important;
  flex: 0 0 var(--collapsed-rail-width) !important;
  height: 100% !important;
  min-height: 0 !important;
  box-sizing: border-box;
  align-self: stretch;
  display: flex;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: .45rem !important;
  padding: .34rem .22rem !important;
  overflow: hidden;
  background: var(--surface-soft) !important;
  border: 1px solid var(--line) !important;
  border-radius: .68rem !important;
  box-shadow: none !important;
  color: var(--muted) !important;
}

.project-column-collapsed .side-toggle,
.collapsed-pane-button.collapsed-pane-icon-button{
  position: static !important;
  flex: 0 0 auto !important;
  width: 2rem !important;
  min-width: 2rem !important;
  height: 2rem !important;
  min-height: 2rem !important;
  margin: 0 !important;
  padding: .42rem !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  background: var(--surface) !important;
  border: 1px solid var(--line) !important;
  border-radius: .55rem !important;
  color: var(--muted) !important;
  transform: none !important;
  writing-mode: horizontal-tb !important;
  box-shadow: none !important;
}

.extraction-study-collapsed-pane .collapsed-pane-button,
.extraction-setup-collapsed-pane .collapsed-pane-button,
.extraction-detail-collapsed-pane .collapsed-pane-button {
  width: 100% !important;
  height: 100% !important;
  min-width: 0 !important;
  min-height: 0 !important;
  padding: 0 !important;
  gap: .5rem !important;
  background: transparent !important;
  border: 0 !important;
  border-radius: 0 !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: flex-start !important;
  overflow: hidden;
}

.extraction-study-collapsed-pane .collapsed-pane-button .project-toggle-icon,
.extraction-setup-collapsed-pane .collapsed-pane-button .project-toggle-icon,
.extraction-detail-collapsed-pane .collapsed-pane-button .project-toggle-icon {
  flex: 0 0 auto;
  width: 2rem !important;
  height: 2rem !important;
  margin: 0 !important;
  padding: .42rem;
  object-fit: contain;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: .55rem;
}

.project-column-collapsed .project-toggle-icon{
  width: 1rem !important;
  height: 1rem !important;
  object-fit: contain;
}

.project-column-collapsed .collapsed-label,
.collapsed-pane-label{
  flex: 0 1 auto;
  margin: .05rem 0 0 !important;
  padding: 0 !important;
  writing-mode: vertical-rl !important;
  text-orientation: mixed !important;
  transform: rotate(180deg) !important;
  text-transform: uppercase !important;
  letter-spacing: .12em !important;
  font-size: .64rem !important;
  font-weight: 760 !important;
  line-height: 1 !important;
  color: var(--muted) !important;
  white-space: nowrap;
}

.project-column-collapsed .side-toggle:hover,
.project-column-collapsed .side-toggle:focus-visible,
.collapsed-pane-button:hover .project-toggle-icon,
.collapsed-pane-button:focus-visible .project-toggle-icon{
  background: var(--brand-soft) !important;
  border-color: var(--brand) !important;
  outline: none;
}
.project-column-collapsed:hover .collapsed-label,
.collapsed-pane-button:hover .collapsed-pane-label,
.collapsed-pane-button:focus-visible .collapsed-pane-label{
  color: var(--brand-dark) !important;
}

.extraction-results-layout.study-list-collapsed {
  grid-template-columns: var(--collapsed-rail-width) minmax(18rem, 1fr) 8px minmax(18rem, var(--extraction-detail-width));
}
.extraction-results-layout.detail-pane-collapsed {
  grid-template-columns: minmax(12rem, var(--extraction-left-width)) 8px minmax(18rem, 1fr) var(--collapsed-rail-width);
}
.extraction-results-layout.study-list-collapsed.detail-pane-collapsed {
  grid-template-columns: var(--collapsed-rail-width) minmax(18rem, 1fr) var(--collapsed-rail-width);
}
.extraction-setup-layout.setup-list-collapsed {
  grid-template-columns: var(--collapsed-rail-width) minmax(0, 1fr);
}

.theme-dark .project-column-collapsed,
.theme-dark .extraction-study-collapsed-pane,
.theme-dark .extraction-setup-collapsed-pane,
.theme-dark .extraction-detail-collapsed-pane{
  background: #0f172a !important;
  border-color: #334155 !important;
  color: #cbd5e1 !important;
}
.theme-dark .project-column-collapsed .side-toggle,
.theme-dark .extraction-study-collapsed-pane .project-toggle-icon,
.theme-dark .extraction-setup-collapsed-pane .project-toggle-icon,
.theme-dark .extraction-detail-collapsed-pane .project-toggle-icon{
  background: #172033 !important;
  border-color: #475569 !important;
}
.theme-dark .project-column-collapsed .collapsed-label,
.theme-dark .collapsed-pane-label{
  color: #cbd5e1 !important;
}
.theme-dark .project-column-collapsed .side-toggle:hover,
.theme-dark .collapsed-pane-button:hover .project-toggle-icon,
.theme-dark .collapsed-pane-button:focus-visible .project-toggle-icon{
  background: rgba(255, 107, 0, .16) !important;
  border-color: #ff9b54 !important;
}
.theme-dark .project-column-collapsed:hover .collapsed-label,
.theme-dark .collapsed-pane-button:hover .collapsed-pane-label,
.theme-dark .collapsed-pane-button:focus-visible .collapsed-pane-label{
  color: #ffb37c !important;
}

@media (max-width: 760px) {
  .project-column-collapsed,
.extraction-study-collapsed-pane,
.extraction-setup-collapsed-pane,
.extraction-detail-collapsed-pane{
    width: 100% !important;
    min-width: 0 !important;
    height: 2.65rem !important;
    min-height: 2.65rem !important;
    flex: 0 0 2.65rem !important;
    flex-direction: row !important;
    padding: .28rem .35rem !important;
  }
  .project-column-collapsed .collapsed-label,
.collapsed-pane-label{
    writing-mode: horizontal-tb !important;
    transform: none !important;
    margin: 0 !important;
  }
  .extraction-study-collapsed-pane .collapsed-pane-button,
  .extraction-setup-collapsed-pane .collapsed-pane-button,
  .extraction-detail-collapsed-pane .collapsed-pane-button {
    flex-direction: row !important;
  }
}

/* Use more of the available workspace area. */
.tab-content-box {
  padding: .34rem !important;
}

/* v0.4.62: individual reference import and manuscript citation picker */
.reference-lookup-card {
  border: 1px solid var(--bs-border-color);
  border-radius: 0.75rem;
  padding: 0.9rem 1rem;
  background: var(--bs-tertiary-bg);
}
.reference-lookup-abstract {
  max-height: 8rem;
  overflow: auto;
  line-height: 1.45;
}
.citation-modal-body {
  min-height: min(62vh, 680px);
}
.citation-record-list {
  display: grid;
  gap: 0.45rem;
}
.citation-record-item {
  width: 100%;
  border: 1px solid var(--bs-border-color);
  border-radius: 0.65rem;
  background: var(--bs-body-bg);
  color: var(--bs-body-color);
  padding: 0.7rem 0.85rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  text-align: left;
  transition: background-color 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
}
.citation-record-item:hover,
.citation-record-item:focus-visible {
  background: var(--bs-tertiary-bg);
  border-color: var(--app-accent, #ff7a00);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--app-accent, #ff7a00) 18%, transparent);
  outline: none;
}
.citation-record-main {
  min-width: 0;
}
.citation-record-main strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
}
.citation-key {
  flex: 0 0 auto;
  border: 1px solid var(--bs-border-color);
  border-radius: 0.45rem;
  padding: 0.28rem 0.5rem;
  background: var(--bs-tertiary-bg);
  color: var(--app-accent, #ff7a00);
  font-weight: 700;
  white-space: nowrap;
}

.theme-dark .reference-lookup-card,
.theme-dark .citation-record-item,
.theme-dark .citation-key{
  background: #111b2c;
  border-color: #35445d;
  color: #e6edf7;
}
.theme-dark .citation-record-item:hover,
.theme-dark .citation-record-item:focus-visible {
  background: #182438;
  border-color: #ff8a1f;
}

/* v0.5.6 extraction schema synchronisation and workspace polish */
.extraction-detail-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.extraction-detail-fixed-header {
  flex: 0 0 auto;
  padding: .55rem .65rem .5rem;
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
}
.extraction-detail-fixed-header .extracted-data-tabs {
  margin-top: .45rem;
}
.extraction-detail-card .extraction-detail-scroll-body {
  flex: 1 1 auto;
  min-height: 0;
  height: auto;
  overflow: auto;
  padding-top: .65rem;
}
.theme-dark .extraction-detail-fixed-header {
  background: #0f172a;
  border-color: #283548;
}

/* Keep resize handles visible without a bright strip in dark mode. */



.theme-dark .extraction-divider::after,
.theme-dark .extraction-detail-divider::after,
.theme-dark .extraction-setup-divider::after{
  background: #263244;
}
.theme-dark .extraction-divider:hover::after,
.theme-dark .extraction-detail-divider:hover::after,
.theme-dark .extraction-setup-divider:hover::after,
body.is-resizing-extraction .theme-dark .extraction-divider::after,
body.is-resizing-extraction-detail .theme-dark .extraction-detail-divider::after,
body.is-resizing-extraction-setup .theme-dark .extraction-setup-divider::after{
  background: var(--brand);
}

/* Manuscript controls float over the panes instead of occupying a full header bar. */





@media (max-width: 760px) {
  
  
}

/* v0.6.0 canonical analysis bundles, grouped figures and manuscript prose */
.analysis-list-section-title {
  padding: .65rem .55rem .3rem;
  color: var(--muted);
  font-size: .69rem;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.analysis-text-output-list .analysis-list-section-title:first-child {
  padding-top: .35rem;
}
.analysis-figure-group-card > .card-header {
  background: #fbfbfd;
}
.analysis-subfigure-grid {
  display: grid;
  grid-template-columns: repeat(var(--analysis-group-columns, 2), minmax(0, 1fr));
  gap: .9rem;
  align-items: start;
}
.analysis-subfigure-panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: .7rem;
  background: var(--surface);
  padding: .55rem;
}
.analysis-subfigure-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: .65rem;
  margin-bottom: .5rem;
}
.analysis-subfigure-title-wrap {
  display: flex;
  align-items: flex-start;
  gap: .5rem;
  min-width: 0;
}
.analysis-subfigure-label {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 1.55rem;
  height: 1.55rem;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-size: .76rem;
  font-weight: 800;
}
.analysis-subfigure-panel .analysis-svg-frame {
  min-height: 180px;
}
.analysis-figure-group-caption {
  margin-top: .8rem;
  color: var(--muted);
  font-size: .82rem;
  line-height: 1.45;
}
.analysis-linked-artefacts {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .4rem;
  padding: .55rem .65rem;
  margin-bottom: .9rem;
  border: 1px solid var(--line);
  border-radius: .6rem;
  background: var(--surface-soft);
}
.theme-dark .analysis-figure-group-card > .card-header,
.theme-dark .analysis-subfigure-panel {
  background: #111827 !important;
  border-color: #334155 !important;
  color: #e5e7eb !important;
}
.theme-dark .analysis-subfigure-label {
  background: rgba(255, 107, 0, .16);
  color: #ff9b54;
}
.theme-dark .analysis-linked-artefacts {
  background: #0f172a;
  border-color: #334155;
}
@media (max-width: 1200px) {
  .analysis-subfigure-grid {
    grid-template-columns: 1fr;
  }
}

/* v0.7.5: keep subordinate tab labels readable in dark mode. */
.theme-dark .nav-pills:not(.app-tabs) .nav-link:not(.active),
.theme-dark .nav-tabs:not(.app-tabs) .nav-link:not(.active),
.theme-dark .extracted-data-tabs .nav-link:not(.active),
.theme-dark .extraction-tabs .nav-link:not(.active),
.theme-dark .analysis-subtabs .nav-link:not(.active) {
  color: #cbd5e1 !important;
}
.theme-dark .nav-pills:not(.app-tabs) .nav-link:hover,
.theme-dark .nav-tabs:not(.app-tabs) .nav-link:hover,
.theme-dark .extracted-data-tabs .nav-link:hover,
.theme-dark .extraction-tabs .nav-link:hover,
.theme-dark .analysis-subtabs .nav-link:hover {
  color: #f8fafc !important;
}


/* v0.7.6 incomplete-data and ROB visibility */
.extraction-hazard { border: 0; background: transparent; padding: 0 .18rem; font-weight: 800; line-height: 1; vertical-align: middle; }
.extraction-hazard-incomplete { color: #b7791f; }
.extraction-hazard-invalid { color: #c53030; }
.rob-design-panel { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; padding: 0; overflow: auto; height: auto; }
.rob-archives summary { cursor: pointer; font-weight: 600; }
.rob-archive-row { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .65rem 0; border-top: 1px solid var(--bs-border-color); }
[data-bs-theme="dark"] .extraction-hazard-incomplete { color: #f6c453; }
[data-bs-theme="dark"] .extraction-hazard-invalid { color: #ff7b7b; }
[data-bs-theme="dark"] .analysis-subtabs .nav-link:not(.active),
[data-bs-theme="dark"] .extracted-data-tabs .nav-link:not(.active),
[data-bs-theme="dark"] .extraction-editor-tabs .nav-link:not(.active) { color: #d8dee9 !important; }

/* v0.8.2 minimal PRISMA compliance */
.setup-review-methods > summary { cursor: pointer; user-select: none; }
.setup-review-methods > summary::marker { color: var(--brand); }
.help-label { display: inline-flex; align-items: center; gap: .35rem; }
.field-help-button {
  position: relative;
  width: 1.15rem;
  height: 1.15rem;
  padding: 0;
  border: 1px solid currentColor;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: .72rem;
  font-weight: 800;
  line-height: 1;
}
.field-help-button::after {
  content: attr(data-help);
  position: absolute;
  z-index: 10020;
  left: 50%;
  bottom: calc(100% + .55rem);
  width: min(19rem, 75vw);
  padding: .55rem .65rem;
  border: 1px solid var(--line);
  border-radius: .5rem;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 .4rem 1.4rem rgb(0 0 0 / 18%);
  font-size: .78rem;
  font-weight: 400;
  line-height: 1.35;
  text-align: left;
  white-space: normal;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translate(-50%, .15rem);
  transition: opacity .12s ease, transform .12s ease, visibility .12s ease;
}
.field-help-button:hover::after,
.field-help-button:focus-visible::after {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
}
.prisma-checklist-row { cursor: pointer; }
.prisma-checklist-row:hover > td { background: rgba(13, 110, 253, .08) !important; }
.prisma-status-badge {
  display: inline-block;
  min-width: 6.2rem;
  padding: .22rem .45rem;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 700;
  text-align: center;
}
.prisma-status-complete { background: #d1e7dd; color: #0f5132; }
.prisma-status-partial { background: #fff3cd; color: #664d03; }
.prisma-status-missing { background: #f8d7da; color: #842029; }
.prisma-status-not-applicable { background: #e2e3e5; color: #41464b; }
.theme-dark .field-help-button::after,
[data-bs-theme="dark"] .field-help-button::after { background: #111827; border-color: #475569; color: #f8fafc; }
.theme-dark .prisma-status-complete,
[data-bs-theme="dark"] .prisma-status-complete { background: #123c2b; color: #b7f7d0; }
.theme-dark .prisma-status-partial,
[data-bs-theme="dark"] .prisma-status-partial { background: #4a3810; color: #ffe69c; }
.theme-dark .prisma-status-missing,
[data-bs-theme="dark"] .prisma-status-missing { background: #4a1f24; color: #ffb3ba; }
.theme-dark .prisma-status-not-applicable,
[data-bs-theme="dark"] .prisma-status-not-applicable { background: #374151; color: #e5e7eb; }

/* Independent review workflow */
.review-mode-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .7rem .85rem;
  border: 1px solid var(--border-color, #d8dee6);
  border-radius: .55rem;
  background: var(--surface-soft, #f6f8fb);
}
.consensus-panel {
  padding: .7rem .8rem;
  border: 1px solid #d9a400;
  border-radius: .5rem;
  background: rgba(255, 193, 7, .10);
}
.review-entry-status { min-height: 1.5rem; }
.review-workflow-intro { margin-bottom: -.25rem; }
[data-theme="dark"] .review-mode-banner,
body.dark-mode .review-mode-banner {
  background: rgba(255,255,255,.04);
  border-color: rgba(255,255,255,.16);
}
[data-theme="dark"] .consensus-panel,
body.dark-mode .consensus-panel {
  background: rgba(255,193,7,.12);
  color: var(--text-color, #f1f3f5);
}

/* Analysis artefact registry and manuscript integration */
.ribbon-select-wrap {
  min-width: 118px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 2px 6px;
  font-size: .72rem;
  color: var(--bs-secondary-color);
}
.ribbon-select-wrap .form-select { min-width: 112px; }
.analysis-artifact-summary {
  padding: .75rem 1rem;
  background: var(--bs-tertiary-bg);
}
.analysis-panel-subcaption {
  margin: .35rem 0 .65rem;
  color: var(--bs-secondary-color);
}
.analysis-artifact-child-row {
  display: grid;
  grid-template-columns: 34px 72px minmax(0, 1fr) auto;
  gap: .5rem;
  align-items: start;
  padding: .65rem 0;
  border-top: 1px solid var(--bs-border-color);
}
.analysis-artifact-panel-letter {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--bs-tertiary-bg);
  font-weight: 700;
}
.analysis-artifact-order { width: 72px; }
.analysis-artifact-picker-list {
  display: flex;
  flex-direction: column;
  gap: .65rem;
}
.analysis-artifact-picker-item {
  border: 1px solid var(--bs-border-color);
  border-radius: .6rem;
  overflow: hidden;
  background: var(--bs-body-bg);
}
.analysis-artifact-picker-main {
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  padding: .8rem 1rem;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: .25rem;
}
.analysis-artifact-picker-main:hover,
.analysis-artifact-picker-main:focus-visible {
  background: var(--bs-tertiary-bg);
}
.analysis-artifact-panel-links {
  display: flex;
  align-items: center;
  gap: .4rem;
  padding: .55rem 1rem;
  border-top: 1px solid var(--bs-border-color);
  background: var(--bs-tertiary-bg);
}
@media (max-width: 760px) {
  .analysis-artifact-child-row { grid-template-columns: 34px 64px minmax(0, 1fr); }
  .analysis-artifact-child-row .btn { grid-column: 3; justify-self: start; }
}

/* v0.9.1 central contextual help */
.help-labelled-control {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  min-width: 0;
}
.help-tip {
  display: inline-flex;
  position: relative;
  align-items: center;
  flex: 0 0 auto;
  vertical-align: middle;
}
.help-tip-trigger {
  display: inline-grid;
  place-items: center;
  width: 1.1rem;
  height: 1.1rem;
  padding: 0;
  border: 1px solid currentColor;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: .78rem;
  font-weight: 700;
  line-height: 1;
  cursor: help;
}
.help-tip-trigger-symbol {
  width: auto;
  height: auto;
  border: 0;
  border-radius: 0;
  font-size: .92rem;
}
.help-tip-trigger:hover,
.help-tip-trigger:focus-visible,
.help-tip-trigger[aria-expanded="true"] {
  color: var(--brand);
  outline: none;
  box-shadow: 0 0 0 .18rem color-mix(in srgb, var(--brand) 18%, transparent);
}
.help-tip-popover {
  position: fixed;
  z-index: 12050;
  display: grid;
  gap: .32rem;
  max-width: calc(100vw - 24px);
  padding: .7rem .78rem;
  border: 1px solid var(--line);
  border-radius: .55rem;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 .55rem 1.6rem rgb(0 0 0 / 22%);
  font-size: .8rem;
  font-weight: 400;
  line-height: 1.4;
  text-align: left;
  white-space: normal;
}
.help-tip-hover-bridge {
  position: fixed;
  z-index: 12049;
  display: block;
  background: transparent;
  pointer-events: auto;
}
.help-tip-title { font-size: .82rem; }
.help-tip-text { display: block; }
.help-tip-more {
  justify-self: start;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--brand);
  font: inherit;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: .14rem;
}
.help-tip[data-help-id="status.incomplete"] .help-tip-trigger { color: #a56a00; }
.help-tip[data-help-id="status.invalid"] .help-tip-trigger { color: #b42318; }
.help-tip[data-help-id="status.information"] .help-tip-trigger { color: #0b63a5; }
.context-help {
  display: flex;
  align-items: flex-start;
  gap: .5rem;
  margin: .35rem 0 .65rem;
  padding: .48rem .62rem;
  border-left: 3px solid color-mix(in srgb, var(--brand) 55%, var(--line));
  border-radius: .25rem;
  background: color-mix(in srgb, var(--brand) 6%, var(--surface));
  color: var(--muted);
  font-size: .79rem;
  line-height: 1.4;
}
.context-help::before {
  content: "ⓘ";
  flex: 0 0 auto;
  color: var(--brand);
  font-weight: 700;
}
.context-help-link {
  flex: 0 0 auto;
  margin-left: auto;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--brand);
  font: inherit;
  font-weight: 700;
  white-space: nowrap;
}

.toolbar-hover-tooltip {
  position: fixed;
  z-index: 12060;
  width: max-content;
  max-width: min(22rem, calc(100vw - 24px));
  padding: .48rem .62rem;
  border: 1px solid var(--line);
  border-radius: .48rem;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 .45rem 1.25rem rgb(0 0 0 / 20%);
  font-size: .78rem;
  font-weight: 500;
  line-height: 1.35;
  text-align: left;
  white-space: normal;
  pointer-events: none;
}
.toolbar-hover-tooltip[hidden] { display: none; }
[data-bs-theme="dark"] .toolbar-hover-tooltip,
.theme-dark .toolbar-hover-tooltip {
  background: #111827;
  border-color: #475569;
  color: #f8fafc;
}

.help-window-modal .modal-dialog { max-width: min(1120px, calc(100vw - 2rem)); }
.help-window-body {
  display: grid;
  grid-template-columns: minmax(250px, 32%) minmax(0, 1fr);
  gap: 1rem;
  min-height: min(68vh, 680px);
  padding: 0;
}
.help-window-index {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 1rem;
  border-right: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 96%, var(--brand));
}
.help-window-count { margin: .45rem 0; }
.help-topic-list {
  min-height: 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: .45rem;
  background: var(--surface);
}
.help-topic-list-item {
  display: grid;
  width: 100%;
  gap: .12rem;
  padding: .62rem .7rem;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  text-align: left;
}
.help-topic-list-item:last-child { border-bottom: 0; }
.help-topic-list-item:hover,
.help-topic-list-item:focus-visible { background: color-mix(in srgb, var(--brand) 7%, transparent); outline: none; }
.help-topic-list-item.active { background: color-mix(in srgb, var(--brand) 12%, transparent); box-shadow: inset 3px 0 0 var(--brand); }
.help-topic-list-item span { color: var(--muted); font-size: .74rem; }
.help-topic-detail {
  min-width: 0;
  overflow: auto;
  padding: 1.3rem 1.35rem 1.5rem .35rem;
}
.help-topic-detail h2 { margin: .15rem 0 .75rem; font-size: 1.45rem; outline: none; }
.help-topic-section {
  color: var(--brand);
  font-size: .76rem;
  font-weight: 800;
  letter-spacing: .03em;
  text-transform: uppercase;
}
.help-topic-summary { font-size: 1rem; font-weight: 650; }
.help-topic-meta { margin-top: 1.2rem; color: var(--muted); font-size: .75rem; }
.help-topic-example { max-width: 46rem; }
[data-bs-theme="dark"] .help-tip-popover,
.theme-dark .help-tip-popover { background: #111827; border-color: #475569; color: #f8fafc; }
[data-bs-theme="dark"] .context-help,
.theme-dark .context-help { background: color-mix(in srgb, var(--brand) 13%, #111827); }

@media (max-width: 760px) {
  .help-window-body { grid-template-columns: 1fr; }
  .help-window-index { max-height: 42vh; border-right: 0; border-bottom: 1px solid var(--line); }
  .help-topic-detail { padding: 1rem; }
  .context-help { flex-wrap: wrap; }
  .context-help-link { margin-left: 1.6rem; }
}

/* v0.9.3 extraction workspace and figure-type corrections */
.extraction-setup-layout {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}
.extraction-setup-detail-pane {
  min-width: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding-right: .15rem;
}
.extraction-setup-detail-pane > .row {
  width: 100%;
  margin-right: 0;
  margin-left: 0;
}
.extraction-setup-detail-pane > .row > [class*="col-"] {
  min-width: 0;
}
.extraction-setup-list-header {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  min-height: 2rem;
}
.extraction-setup-list-header .pane-collapse-button {
  flex: 0 0 auto;
}
.extraction-study-warning {
  display: inline-grid;
  width: 1.45rem;
  height: 1.45rem;
  place-items: center;
  padding: 0;
  border: 1px solid #d89b00;
  border-radius: 50%;
  background: color-mix(in srgb, #f5b301 13%, var(--surface));
  color: #8a5b00;
  font-size: .82rem;
  line-height: 1;
}
.extraction-study-warning:hover,
.extraction-study-warning:focus-visible {
  background: color-mix(in srgb, #f5b301 24%, var(--surface));
  outline: 2px solid color-mix(in srgb, #f5b301 45%, transparent);
  outline-offset: 1px;
}
.analysis-figure-type {
  font-weight: 650;
}
.analysis-single-figure-frame {
  max-width: min(100%, 72rem);
  margin-inline: auto;
}
.analysis-single-figure-card .analysis-figure-group-caption {
  max-width: 72rem;
  margin-inline: auto;
}

/* Extraction arm definitions and visually linked outcome blocks */
.extraction-arm-setup {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0;
}
.extraction-setup-subtab {
  width: 100%;
  min-height: 0;
  margin: 0;
  box-sizing: border-box;
}
.extraction-arm-setup > .alert,
.extraction-arm-setup > .placeholder-panel {
  flex: 0 0 auto;
}
.extraction-arm-setup > .extraction-setup-layout {
  flex: 1 1 auto;
  min-height: 0;
  height: auto;
}
.network-study-treatment-picker {
  border: 1px solid var(--border-color);
  border-radius: .5rem;
  padding: .65rem .75rem;
  background: color-mix(in srgb, var(--surface) 92%, var(--surface-muted));
}
.network-treatment-option {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  border: 1px solid var(--border-color);
  border-radius: 999px;
  padding: .3rem .6rem;
  background: var(--surface);
  cursor: pointer;
  font-size: .82rem;
}
.network-treatment-option:has(input:checked) {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, var(--surface));
}
.extraction-outcome-block-table {
  border-collapse: separate;
  border-spacing: 0 .45rem;
}
.extraction-outcome-group {
  --outcome-group-border: color-mix(in srgb, var(--border-color) 85%, transparent);
}
.extraction-outcome-group > tr > td {
  border-left: 1px solid var(--outcome-group-border);
  border-right: 1px solid var(--outcome-group-border);
}
.extraction-outcome-group > tr:not(.extraction-outcome-group-header):last-child > td {
  border-bottom: 1px solid var(--outcome-group-border);
}
.extraction-outcome-group-header {
  cursor: pointer;
  background: color-mix(in srgb, var(--surface-muted) 75%, var(--surface));
}
.extraction-outcome-group-header td {
  border-top: 1px solid var(--outcome-group-border) !important;
  border-bottom: 1px solid var(--outcome-group-border) !important;
  padding: .55rem .7rem !important;
}
.extraction-outcome-group:hover > tr:not(.extraction-outcome-group-header) > td {
  background: color-mix(in srgb, var(--accent) 4%, var(--surface));
}
.extraction-outcome-group.has-warning {
  --outcome-group-border: color-mix(in srgb, #d89b00 65%, var(--border-color));
}
.outcome-group-chevron {
  display: inline-block;
  width: 1.2rem;
  color: var(--text-muted);
}
.outcome-group-warning {
  color: #8a5b00;
  font-size: .76rem;
  font-weight: 600;
}
.extraction-arm-cell {
  min-width: 10rem;
  vertical-align: middle;
}
.arm-badge {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border-color);
  border-radius: 999px;
  padding: .18rem .52rem;
  font-size: .76rem;
  font-weight: 650;
  line-height: 1.25;
  background: var(--surface-muted);
}
.arm-badge-intervention {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--border-color));
  background: color-mix(in srgb, var(--accent) 10%, var(--surface));
}
.arm-badge-comparator {
  border-color: color-mix(in srgb, var(--text-muted) 55%, var(--border-color));
  background: color-mix(in srgb, var(--text-muted) 8%, var(--surface));
}
.arm-badge-treatment {
  border-color: color-mix(in srgb, var(--accent) 35%, var(--border-color));
}

/* v0.10.0 multiple-analysis workflow */
.setup-analysis-structure .card-header,
.analysis-outcome-matrix-card .card-header {
  display: flex;
  flex-direction: column;
  gap: .15rem;
}
.analysis-setup-section + .analysis-setup-section {
  border-top: 1px solid var(--bs-border-color);
  padding-top: 1rem;
}
.treatment-dictionary-list {
  display: grid;
  gap: .5rem;
}
.treatment-dictionary-item,
.analysis-plan-card,
.treatment-add-panel {
  border: 1px solid var(--bs-border-color);
  border-radius: .5rem;
  background: var(--bs-body-bg);
  padding: .75rem;
}
.treatment-dictionary-item summary,
.treatment-add-panel summary {
  cursor: pointer;
}
.treatment-dictionary-item.is-archived {
  opacity: .68;
}
.treatment-structure-tools {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(22rem, 1fr));
  gap: .75rem;
}
.analysis-plan-card + .analysis-plan-card {
  margin-top: .75rem;
}
.analysis-plan-card-header {
  display: grid;
  grid-template-columns: minmax(12rem, 1fr) auto;
  gap: .75rem;
  align-items: center;
}
.single-plan-card {
  padding: 0;
  border: 0;
}
.treatment-check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
  gap: .35rem .9rem;
  border: 1px solid var(--bs-border-color);
  border-radius: .4rem;
  padding: .65rem .8rem;
}
.study-structure-layout {
  display: grid;
  grid-template-columns: minmax(14rem, 28%) minmax(0, 1fr);
  gap: 1rem;
  min-height: 22rem;
}
.study-structure-list {
  border: 1px solid var(--bs-border-color);
  border-radius: .45rem;
  overflow: auto;
  max-height: 36rem;
}
.study-structure-list .list-group-item {
  border-width: 0 0 1px;
  width: 100%;
  text-align: left;
}
.study-structure-editor {
  min-width: 0;
}
.study-report-linking {
  border: 1px solid var(--bs-border-color);
  border-radius: .45rem;
  padding: .75rem;
  background: var(--bs-body-bg);
}
.study-report-list {
  display: grid;
  gap: .45rem;
}
.study-report-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .75rem;
  border: 1px solid var(--bs-border-color);
  border-radius: .35rem;
  padding: .55rem .65rem;
  background: var(--bs-tertiary-bg);
}
.study-report-main {
  min-width: 0;
  flex: 1 1 auto;
}
.study-report-add .input-group {
  max-width: 56rem;
}
.study-arm-mapping-list {
  display: grid;
  gap: .65rem;
}
.study-arm-mapping-row {
  display: grid;
  grid-template-columns: auto minmax(11rem, 1fr) minmax(11rem, 1fr) minmax(10rem, .8fr) auto;
  gap: .7rem;
  align-items: end;
  border: 1px solid var(--bs-border-color);
  border-radius: .45rem;
  padding: .7rem;
  background: var(--bs-tertiary-bg);
}
.study-arm-mapping-row > .badge {
  align-self: center;
}
.study-arm-actions {
  align-self: end;
  min-width: 4.5rem;
  text-align: right;
}
.analysis-outcome-matrix-card td {
  min-width: 9rem;
  vertical-align: top;
}
.plan-outcome-settings {
  min-width: 16rem;
  max-width: 24rem;
  margin-top: .4rem;
  border-top: 1px solid var(--bs-border-color);
  padding-top: .4rem;
}
.analysis-plan-selector-bar {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 1rem;
  border: 1px solid var(--bs-border-color);
  border-radius: .5rem;
  padding: .75rem;
  margin-bottom: .75rem;
  background: var(--bs-tertiary-bg);
}
.analysis-plan-selector-bar > div:first-child {
  min-width: min(28rem, 70vw);
}
.analysis-current-plan {
  margin-bottom: .65rem;
}
.analysis-eligibility-preview {
  border: 1px solid var(--bs-border-color);
  border-radius: .45rem;
  background: var(--bs-body-bg);
}
.analysis-eligibility-preview summary {
  cursor: pointer;
  padding: .65rem .8rem;
}
.eligibility-preview-section + .eligibility-preview-section {
  margin-top: 1rem;
  padding-top: .85rem;
  border-top: 1px solid var(--bs-border-color);
}
.eligibility-preview-section h6 {
  margin-bottom: .45rem;
}
.analysis-artifact-picker-group + .analysis-artifact-picker-group {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--bs-border-color);
}
.analysis-artifact-picker-group > h6 {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--bs-body-bg);
  padding: .25rem 0 .5rem;
}
@media (max-width: 900px) {
  .study-structure-layout { grid-template-columns: 1fr; }
  .study-structure-list { max-height: 15rem; }
  .study-arm-mapping-row { grid-template-columns: 1fr; }
  .study-report-row { align-items: flex-start; flex-direction: column; }
  .analysis-plan-card-header { grid-template-columns: 1fr; }
  .analysis-plan-selector-bar { align-items: stretch; flex-direction: column; }
  .analysis-plan-selector-bar > div:first-child { min-width: 0; }
}

/* v0.10.0 review-level versus analysis-plan output scopes */
.analysis-scope-switch {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
}
.analysis-review-scope-intro {
  border: 1px solid var(--bs-border-color);
  border-radius: .65rem;
  padding: .75rem 1rem;
  background: var(--bs-tertiary-bg);
}

/* v0.10.1 contextual tooltips, review naming and toolbar downloads */
.topbar-project-name {
  max-width: 42vw;
  padding: .12rem .28rem;
  border: 1px solid transparent;
  border-radius: .35rem;
  background: transparent;
  color: inherit;
  font-size: .98rem;
  font-weight: 700;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
}
.topbar-project-name:hover:not(:disabled),
.topbar-project-name:focus-visible {
  border-color: rgba(255,255,255,.55);
  background: rgba(255,255,255,.10);
  outline: none;
}
.topbar-project-name:disabled { opacity: 1; }
.topbar-project-name-input {
  width: min(28rem, 42vw);
  padding: .14rem .35rem;
  border: 1px solid rgba(255,255,255,.78);
  border-radius: .35rem;
  background: rgba(255,255,255,.98);
  color: #111827;
  font-size: .98rem;
  font-weight: 700;
  line-height: 1.25;
  outline: none;
}

.setup-review-details { margin-top: 0; }
.setup-review-details .card-header > .small { margin-top: .15rem; }

.workspace-card:has(.ribbon-dropdown:hover),
.workspace-card:has(.ribbon-dropdown:focus-within) { overflow: visible; }
.tab-ribbon:has(.ribbon-dropdown:hover),
.tab-ribbon:has(.ribbon-dropdown:focus-within) {
  position: relative;
  z-index: 12020;
  overflow: visible;
}
.ribbon-dropdown {
  position: relative;
  display: flex;
  align-items: stretch;
}
.ribbon-dropdown-menu {
  position: absolute;
  z-index: 120;
  top: calc(100% - 1px);
  left: 0;
  display: none;
  min-width: 13rem;
  max-height: min(28rem, 70vh);
  overflow-y: auto;
  padding: .35rem;
  border: 1px solid var(--line);
  border-radius: .5rem;
  background: var(--surface);
  box-shadow: 0 .65rem 1.6rem rgb(0 0 0 / 22%);
}
.ribbon-dropdown-wide .ribbon-dropdown-menu { min-width: 15rem; }
.ribbon-dropdown:hover .ribbon-dropdown-menu,
.ribbon-dropdown:focus-within .ribbon-dropdown-menu { display: grid; }
.ribbon-dropdown-menu button {
  width: 100%;
  padding: .48rem .6rem;
  border: 0;
  border-radius: .35rem;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: .8rem;
  font-weight: 600;
  text-align: left;
  white-space: nowrap;
}
.ribbon-dropdown-menu button:hover:not(:disabled),
.ribbon-dropdown-menu button:focus-visible {
  background: color-mix(in srgb, var(--brand) 10%, var(--surface));
  color: var(--brand-dark);
  outline: none;
}
.ribbon-dropdown-menu button:disabled { opacity: .45; }

.toolbar-hover-tooltip { pointer-events: auto; }
.help-tip-popover { pointer-events: auto; }

/* v0.13.0 analysis isolation and compact workflow polish */
.analysis-plan-more > summary,
.unmapped-evidence-panel > summary,
.unmapped-evidence-item > summary {
  cursor: pointer;
}
.analysis-plan-more > summary {
  font-size: .86rem;
  font-weight: 600;
  color: var(--bs-secondary-color);
}
.outcome-analysis-assignment {
  border: 1px solid var(--bs-border-color);
  border-radius: .5rem;
  padding: .8rem;
  background: var(--bs-tertiary-bg);
}
.outcome-analysis-assignment-row {
  display: grid;
  grid-template-columns: minmax(10rem, 1fr) auto;
  align-items: start;
  gap: .35rem .75rem;
  padding: .55rem 0;
  border-top: 1px solid var(--bs-border-color);
}
.outcome-analysis-assignment-row:first-of-type {
  border-top: 0;
}
.outcome-analysis-assignment-row .plan-outcome-settings {
  grid-column: 1 / -1;
  max-width: none;
  min-width: 0;
  margin-top: .25rem;
}
.unmapped-evidence-panel {
  border: 1px solid var(--bs-warning-border-subtle);
  border-radius: .45rem;
  background: var(--bs-warning-bg-subtle);
  margin-bottom: .75rem;
}
.unmapped-evidence-panel > summary {
  padding: .55rem .7rem;
  font-weight: 600;
}
.unmapped-evidence-body {
  padding: 0 .7rem .7rem;
}
.unmapped-evidence-item {
  border-top: 1px solid color-mix(in srgb, var(--bs-warning-border-subtle) 75%, transparent);
  padding: .4rem 0;
}
.analysis-selector-inline {
  flex: 0 1 24rem;
}
.analysis-current-plan {
  border-left: 3px solid var(--bs-primary);
  padding: .45rem .65rem;
  margin-bottom: .65rem;
  background: var(--bs-tertiary-bg);
}
.extraction-result-item {
  min-height: 88px;
  padding: .65rem .75rem;
  border-left: 3px solid transparent !important;
  border-top-color: var(--bs-border-color) !important;
  border-right-color: var(--bs-border-color) !important;
  border-bottom-color: var(--bs-border-color) !important;
}
.extraction-result-item.active {
  border-left-color: var(--bs-primary) !important;
}
.extraction-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .25rem;
}
@media (max-width: 900px) {
  .outcome-analysis-assignment-row { grid-template-columns: 1fr; }
  .outcome-analysis-assignment-row .plan-outcome-settings { grid-column: 1; }
  .analysis-selector-inline { flex-basis: 100%; }
}

/* v0.14.0 synchronisation and interface upgrade */
.topbar-project-name {
  cursor: text;
  border: 1px solid transparent;
  border-radius: .3rem;
  padding: .16rem .32rem;
  margin: -.16rem -.32rem;
  transition: border-color .12s ease, background-color .12s ease;
}
.topbar-project-name:hover,
.topbar-project-name:focus-visible {
  border-color: rgba(255, 255, 255, .55);
  background: rgba(255, 255, 255, .1);
  outline: none;
}
.topbar-project-name:disabled { cursor: default; }

.account-theme-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.theme-switch {
  position: relative;
  display: inline-flex;
  width: 2.1rem;
  height: 1.15rem;
  border-radius: 999px;
  background: #c5cbd3;
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, .16);
  transition: background .16s ease;
  flex: 0 0 auto;
}
.theme-switch-knob {
  position: absolute;
  top: .14rem;
  left: .14rem;
  width: .87rem;
  height: .87rem;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(15, 23, 42, .3);
  transition: transform .16s ease;
}
.theme-switch.is-on { background: var(--bs-primary, #0d6efd); }
.theme-switch.is-on .theme-switch-knob { transform: translateX(.95rem); }

.project-column-expanded .project-item.active,
.theme-dark .project-column-expanded .project-item.active {
  background: color-mix(in srgb, var(--bs-primary, #0d6efd) 22%, var(--panel, #fff));
  border-color: color-mix(in srgb, var(--bs-primary, #0d6efd) 45%, var(--line));
}
.project-column-expanded .project-item.active .project-select,
.project-column-expanded .project-item.active .project-select strong,
.project-column-expanded .project-item.active .fw-semibold,
.project-column-expanded .project-item.active .project-meta-lines,
.project-column-expanded .project-item.active .text-muted,
.theme-dark .project-column-expanded .project-item.active .project-select,
.theme-dark .project-column-expanded .project-item.active .project-select strong,
.theme-dark .project-column-expanded .project-item.active .fw-semibold,
.theme-dark .project-column-expanded .project-item.active .project-meta-lines,
.theme-dark .project-column-expanded .project-item.active .text-muted {
  color: var(--text, #172033) !important;
  opacity: 1;
}
.theme-dark .project-column-expanded .project-item.active,
.theme-dark .project-column-expanded .project-item.active .project-select,
.theme-dark .project-column-expanded .project-item.active .project-select strong,
.theme-dark .project-column-expanded .project-item.active .fw-semibold,
.theme-dark .project-column-expanded .project-item.active .project-meta-lines,
.theme-dark .project-column-expanded .project-item.active .text-muted {
  color: #f6f8fb !important;
}

.main-layout,
.workspace-column,
.workspace-card,
.tab-content-box,
.tab-content-box > section,
.records-toolbar,
.record-card,
.extraction-results-layout,
.extraction-pdf-pane,
.extraction-detail-pane {
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}
.workspace-column { overflow-x: hidden; }
.record-card h2,
.record-card .record-title,
.record-card .record-authors { overflow-wrap: anywhere; }
.record-card .d-flex { min-width: 0; }
.table-responsive { max-width: 100%; }

.setup-workspace {
  display: grid;
  grid-template-columns: minmax(13.5rem, 17rem) minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}
.setup-navigation {
  position: sticky;
  top: .75rem;
  display: flex;
  flex-direction: column;
  gap: .25rem;
  padding: .5rem;
  border: 1px solid var(--line);
  border-radius: .55rem;
  background: var(--panel, #fff);
  max-height: calc(100vh - 11rem);
  overflow-y: auto;
}
.setup-navigation-row {
  border: 0;
  border-radius: .4rem;
  background: transparent;
  color: var(--text);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .75rem;
  width: 100%;
  text-align: left;
  padding: .58rem .65rem;
}
.setup-navigation-row:hover { background: var(--subtle, #f3f5f8); }
.setup-navigation-row.active {
  background: color-mix(in srgb, var(--bs-primary, #0d6efd) 12%, var(--panel, #fff));
  box-shadow: inset 3px 0 0 var(--bs-primary, #0d6efd);
  font-weight: 600;
}
.setup-content-panel { min-width: 0; }
.setup-status-icon,
.setup-field-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.1rem;
  height: 1.1rem;
  border-radius: 50%;
  font-size: .72rem;
  font-weight: 800;
  line-height: 1;
  flex: 0 0 auto;
}
.setup-status-icon.is-danger,
.setup-field-status.is-danger { color: #fff; background: var(--bs-danger, #dc3545); }
.setup-status-icon.is-warning,
.setup-field-status.is-warning { color: #422f00; background: var(--bs-warning, #ffc107); }
.setup-status-icon.is-success { color: #fff; background: var(--bs-success, #198754); }
.analysis-plan-card-header,
.archived-analysis-row,
.return-route-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .75rem;
}
.archived-analysis-row,
.return-route-banner {
  padding: .65rem .75rem;
  border: 1px solid var(--line);
  border-radius: .45rem;
  background: var(--panel, #fff);
}
.archived-analysis-row + .archived-analysis-row { margin-top: .45rem; }

.ribbon-select-inline {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: .45rem;
  white-space: nowrap;
}
.ribbon-select-inline .form-select { min-width: 7.75rem; }
.extraction-notes-button.ribbon-status-success .ribbon-icon { color: var(--bs-success, #198754); }
.extraction-notes-button.ribbon-status-warning .ribbon-icon { color: #c17b00; }
.extraction-notes-button.ribbon-status-danger .ribbon-icon { color: var(--bs-danger, #dc3545); }
.extraction-notes-button.ribbon-status-secondary .ribbon-icon { color: var(--muted); }
.status-count-card {
  display: flex;
  flex-direction: column;
  min-height: 5rem;
  padding: .75rem;
  border: 1px solid var(--line);
  border-radius: .45rem;
  background: var(--panel, #fff);
}
.status-count-card strong { font-size: 1.35rem; }
.status-count-card span { color: var(--muted); font-size: .84rem; }

.extraction-result-item {
  min-height: 7.2rem;
  height: auto !important;
  overflow: visible;
  padding-top: .75rem;
  padding-bottom: .75rem;
}
.extraction-result-item .extraction-row-actions {
  white-space: normal;
  overflow: visible;
  align-items: center;
}
.extraction-result-item .extraction-row-actions .btn { flex: 0 0 auto; }
.included-data-summary-table { max-width: 30rem; }

.theme-dark .setup-navigation,
.theme-dark .archived-analysis-row,
.theme-dark .return-route-banner,
.theme-dark .status-count-card {
  background: var(--panel);
  border-color: var(--line);
}
.theme-dark .setup-navigation-row:hover { background: rgba(255,255,255,.06); }
.theme-dark .setup-navigation-row.active { background: rgba(76, 132, 255, .16); }
.theme-dark .theme-switch { background: #535b68; }
.theme-dark .theme-switch.is-on { background: #4f8cff; }

@media (max-width: 900px) {
  .setup-workspace { grid-template-columns: 1fr; }
  .setup-navigation {
    position: static;
    max-height: none;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 560px) {
  .setup-navigation { grid-template-columns: 1fr; }
  .analysis-plan-card-header,
  .archived-analysis-row,
  .return-route-banner { align-items: stretch; flex-direction: column; }
}

/* v0.14.0 shared extraction setup panels */
.study-structure-layout.extraction-setup-layout {
  grid-template-columns: minmax(14rem, var(--extraction-setup-left-width)) 10px minmax(0, 1fr);
  gap: .75rem;
}
.study-structure-list-pane {
  min-width: 0;
}
.study-structure-list-pane .study-structure-list {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
}
.study-arm-mapping-row {
  cursor: pointer;
  transition: border-color .12s ease, box-shadow .12s ease, background-color .12s ease;
}
.study-arm-mapping-row.selected-study-arm {
  border-color: color-mix(in srgb, var(--brand) 65%, var(--bs-border-color));
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand) 16%, transparent);
  background: color-mix(in srgb, var(--brand) 5%, var(--bs-body-bg));
}


/* v0.15.2 review layout and analysis scope fixes */
.topbar-project-name:hover:not(:disabled),
.topbar-project-name:focus-visible {
  cursor: text;
  border-color: rgba(17, 24, 39, .48);
  background: rgba(17, 24, 39, .055);
  box-shadow: 0 0 0 1px rgba(17, 24, 39, .025);
  outline: none;
}
.theme-dark .topbar-project-name:hover:not(:disabled),
.theme-dark .topbar-project-name:focus-visible {
  border-color: rgba(255, 255, 255, .62);
  background: rgba(255, 255, 255, .10);
  box-shadow: none;
}
.records-section {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  overflow-x: hidden !important;
  padding-right: 1px;
}
.records-filter-row {
  position: sticky;
  top: 0;
  z-index: 35;
  width: 100%;
  margin-right: 0;
  margin-left: 0;
  padding: .55rem .25rem;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 3px 8px rgba(15, 23, 42, .06);
}
.records-filter-row > [class*="col-"] {
  min-width: 0;
}
.records-section .record-card {
  width: 100%;
  max-width: 100%;
}
.extraction-result-list > .extraction-result-item {
  display: block;
  flex: 0 0 auto;
  min-height: 9rem;
  height: auto !important;
  max-height: none !important;
  overflow: visible !important;
  padding: .75rem;
}
.extraction-result-item .extraction-row-actions {
  min-height: 1.65rem;
  align-content: flex-start;
}
.analysis-eligibility-modal-content {
  border: 0;
  background: transparent;
}
.analysis-eligibility-modal-content .eligibility-preview-section:last-child {
  margin-bottom: 0;
}

/* v0.15.3 project templates */
.project-template-modal .modal-body {
  padding-top: 1.1rem;
}
.project-template-summary {
  border: 1px solid var(--bs-border-color);
  border-radius: .5rem;
  background: var(--bs-tertiary-bg);
  padding: .9rem 1rem;
  line-height: 1.35;
}
.project-template-summary .alert {
  font-size: .875rem;
}

/* v0.15.4 incremental Records loading */
.records-count {
  color: var(--muted);
  font-size: .82rem;
  white-space: nowrap;
}
.records-count strong {
  color: var(--text);
  font-weight: 700;
}
.records-load-sentinel {
  width: 100%;
  height: 1px;
  pointer-events: none;
}
.records-pagination-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 2.25rem;
  padding: .35rem 0 .15rem;
  color: var(--muted);
  font-size: .82rem;
  text-align: center;
}
.records-load-error {
  justify-content: space-between;
  gap: .75rem;
}
.theme-dark .records-count strong {
  color: #f8fafc;
}

/* Publication-style analysis tables mirror jmeta booktabs output without exposing implementation IDs. */
.analysis-publication-table {
  --bs-table-bg: transparent;
  border-collapse: collapse;
  font-size: .86rem;
}
.analysis-publication-table thead th {
  border-top: 2px solid var(--bs-border-color);
  border-bottom: 1.5px solid var(--bs-border-color);
  background: transparent;
  font-weight: 700;
  vertical-align: bottom;
  white-space: normal;
}
.analysis-publication-table tbody td {
  border-top: 0;
  border-bottom: 0;
  vertical-align: top;
  padding-top: .38rem;
  padding-bottom: .38rem;
}
.analysis-publication-table tbody tr:last-child td {
  border-bottom: 2px solid var(--bs-border-color);
}
.analysis-publication-table th:not(:first-child),
.analysis-publication-table td:not(:first-child) {
  text-align: right;
}
.analysis-publication-table th:first-child,
.analysis-publication-table td:first-child {
  text-align: left;
}
.theme-dark .analysis-publication-table thead th {
  background: transparent !important;
}

/* Structured visual manuscript editor */
.visual-manuscript-section {
  min-height: 0;
  height: calc(100vh - 14.3rem);
  padding: 0 !important;
  overflow: hidden;
}
.visual-manuscript-host,
.msv2-shell {
  width: 100%;
  height: 100%;
  min-height: 0;
}
.msv2-shell {
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: .8rem;
  background: var(--surface);
  color: var(--ink);
}
.msv2-shell button,
.msv2-shell select,
.msv2-shell input {
  font: inherit;
}
.msv2-shell button,
.msv2-shell select {
  min-height: 2rem;
  border: 1px solid var(--line);
  border-radius: .45rem;
  background: var(--surface);
  color: var(--ink);
}
.msv2-shell button {
  padding: .3rem .58rem;
  cursor: pointer;
}
.msv2-shell button:hover:not(:disabled),
.msv2-shell button.active {
  border-color: color-mix(in srgb, var(--brand) 55%, var(--line));
  background: color-mix(in srgb, var(--brand) 9%, var(--surface));
  color: var(--brand-dark);
}
.msv2-shell button:focus-visible,
.msv2-shell select:focus-visible,
.msv2-shell input:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--brand) 70%, transparent);
  outline-offset: 2px;
}
.msv2-prosemirror:focus-visible { outline: none; }
.msv2-shell button:disabled {
  cursor: not-allowed;
  opacity: .5;
}
.msv2-topline {
  flex: 0 0 auto;
  min-height: 3.1rem;
  display: flex;
  align-items: centre;
  justify-content: space-between;
  gap: .8rem;
  padding: .55rem .75rem;
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
}
.msv2-topline > div:first-child {
  display: flex;
  align-items: baseline;
  gap: .65rem;
  min-width: 0;
}
.msv2-topline strong {
  white-space: nowrap;
}
.msv2-save-state {
  color: var(--muted);
  font-size: .76rem;
  white-space: nowrap;
}
.msv2-top-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: .35rem;
}
.msv2-top-actions button[data-action="export-docx"] {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}
.msv2-top-actions button[data-action="export-docx"]:hover:not(:disabled) {
  background: var(--brand-dark);
  color: #fff;
}
.msv2-conflict,
.msv2-presence,
.msv2-recovery {
  flex: 0 0 auto;
  padding: .6rem .75rem;
  border-bottom: 1px solid var(--line);
  font-size: .84rem;
}
.msv2-presence {
  background: #eef5ff;
  color: #23466f;
}
.msv2-recovery {
  background: #edf9f1;
  color: #245a38;
}
.msv2-conflict {
  border-bottom-color: #f0b64f;
  background: #fff5d6;
  color: #6f4700;
}
.msv2-conflict button,
.msv2-presence button,
.msv2-recovery button {
  margin-left: .35rem;
  min-height: 1.8rem;
}
.msv2-toolbar {
  flex: 0 0 auto;
  display: flex;
  align-items: centre;
  flex-wrap: wrap;
  gap: .35rem;
  padding: .45rem .65rem;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.msv2-toolbar > select {
  width: 8.2rem;
  padding: .25rem .42rem;
}
.msv2-toolbar-group {
  display: inline-flex;
  gap: .18rem;
  padding-left: .35rem;
  border-left: 1px solid var(--line);
}
.msv2-toolbar button {
  min-width: 2rem;
  white-space: nowrap;
}
.msv2-search-bar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .35rem;
  padding: .45rem .65rem;
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
  font-size: .78rem;
}
.msv2-search-bar > input[type="search"] { width: min(22rem, 40vw); }
.msv2-search-bar [data-replace-controls] { display: inline-flex; gap: .3rem; align-items: center; }
.msv2-search-bar [data-replace-controls][hidden] { display: none; }
.msv2-search-match { background: #ffe98f; border-radius: .12rem; }
.msv2-search-match.active { background: #ffbf4a; box-shadow: 0 0 0 1px #9c6800; }
.msv2-supplementary-badge {
  display: inline-block;
  margin-left: .35rem;
  padding: .05rem .3rem;
  border-radius: 999px;
  background: #e8ecf5;
  color: #465166;
  font-size: .62rem;
  font-weight: 600;
}
.msv2-layout {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(13.5rem, 16.5rem) minmax(0, 1fr);
  overflow: hidden;
}
.msv2-sidebar {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: var(--surface-soft);
  overflow: hidden;
}
.msv2-panel-tabs {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .25rem;
  padding: .5rem;
  border-bottom: 1px solid var(--line);
}
.msv2-panel-tabs button {
  min-width: 0;
  min-height: 1.9rem;
  padding: .25rem .28rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: .72rem;
}
.msv2-panel-tabs button.active {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}
.msv2-panel {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: .8rem;
}
.msv2-panel h3 {
  margin: 0 0 .75rem;
  font-size: 1rem;
}
.msv2-panel h4 {
  margin: 1rem 0 .45rem;
  color: var(--muted);
  font-size: .78rem;
  letter-spacing: .035em;
  text-transform: uppercase;
}
.msv2-panel p {
  margin-bottom: .65rem;
}
.msv2-panel label:not(.msv2-checkbox) {
  display: grid;
  gap: .3rem;
  margin-bottom: .7rem;
  color: var(--muted);
  font-size: .78rem;
  font-weight: 650;
}
.msv2-panel input[type="text"],
.msv2-panel input:not([type]),
.msv2-panel select {
  width: 100%;
  min-height: 2.25rem;
  padding: .4rem .5rem;
  border: 1px solid var(--line);
  border-radius: .45rem;
  background: var(--surface);
  color: var(--ink);
  font-weight: 400;
}
.msv2-panel-heading {
  display: flex;
  align-items: centre;
  justify-content: space-between;
  gap: .5rem;
}
.msv2-panel-heading h3 {
  margin-bottom: 0;
}
.msv2-help {
  color: var(--muted);
  font-size: .76rem;
  line-height: 1.35;
}
.msv2-card,
.msv2-status-item,
.msv2-issue,
.msv2-reference {
  position: relative;
  display: grid;
  gap: .35rem;
  margin-bottom: .55rem;
  padding: .65rem;
  border: 1px solid var(--line);
  border-radius: .6rem;
  background: var(--surface);
}
.msv2-card strong,
.msv2-reference strong,
.msv2-status-item strong,
.msv2-issue strong {
  font-size: .82rem;
}
.msv2-card small,
.msv2-reference small,
.msv2-status-item small,
.msv2-issue small {
  display: block;
  color: var(--muted);
  font-size: .7rem;
}
.msv2-card p {
  margin: 0;
  color: var(--ink);
  font-size: .78rem;
  line-height: 1.4;
}
.msv2-card > div {
  display: flex;
  flex-wrap: wrap;
  gap: .3rem;
}
.msv2-list-item {
  width: 100%;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: .15rem .5rem;
  margin-bottom: .35rem;
  padding: .55rem !important;
  text-align: left;
}
.msv2-list-item > strong {
  grid-row: 1 / span 2;
  max-width: 6.7rem;
  color: var(--brand-dark);
  font-size: .78rem;
  overflow-wrap: anywhere;
}
.msv2-list-item > span,
.msv2-list-item > small {
  min-width: 0;
  overflow-wrap: anywhere;
}
.msv2-list-item > span {
  font-size: .78rem;
}
.msv2-list-item > small {
  color: var(--muted);
  font-size: .68rem;
}
.msv2-reference {
  grid-template-columns: minmax(0, 1fr) auto;
  padding: .3rem;
}
.msv2-reference > button:first-child {
  display: grid;
  grid-template-columns: 1.25rem minmax(0, 1fr);
  gap: .15rem .4rem;
  padding: .35rem;
  border: 0;
  background: transparent;
  text-align: left;
}
.msv2-reference > button:first-child:hover {
  background: transparent;
}
.msv2-reference .msv2-check {
  grid-row: 1 / span 3;
  width: 1.1rem;
  height: 1.1rem;
  display: inline-grid;
  place-items: centre;
  border: 1px solid var(--line);
  border-radius: .25rem;
}
.msv2-reference.selected {
  border-color: var(--brand);
  background: color-mix(in srgb, var(--brand) 7%, var(--surface));
}
.msv2-reference.selected .msv2-check {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}
.msv2-delete {
  align-self: start;
  min-width: 1.75rem;
  min-height: 1.75rem !important;
  padding: 0 !important;
  border: 0 !important;
  color: #b42318 !important;
  font-size: 1.1rem !important;
}
.msv2-primary-wide {
  width: 100%;
  margin-bottom: .65rem;
  border-color: var(--brand) !important;
  background: var(--brand) !important;
  color: #fff !important;
}

.msv2-secondary-wide {
  width: 100%;
  margin: -.25rem 0 .65rem;
}
.msv2-node-preview {
  width: 100%;
}
.msv2-node-content {
  width: 100%;
  margin-top: .5rem;
}
.msv2-node-content:empty::before {
  content: "Add caption";
  color: #7a8798;
  font-size: .78rem;
}
.msv2-checkbox {
  display: flex;
  align-items: centre;
  gap: .45rem;
  margin-top: .7rem;
  font-size: .8rem;
}
.msv2-status-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .35rem;
  margin-bottom: .65rem;
}
.msv2-status-summary span {
  padding: .38rem .45rem;
  border: 1px solid var(--line);
  border-radius: .4rem;
  background: var(--surface);
  font-size: .72rem;
  font-weight: 650;
}
.msv2-status-summary [data-status="current"],
.msv2-status-item[data-status="current"] { border-left: 3px solid #25945c; }
.msv2-status-summary [data-status="changed"],
.msv2-status-item[data-status="changed"] { border-left: 3px solid #d88816; }
.msv2-status-summary [data-status="stale"],
.msv2-status-item[data-status="stale"] { border-left: 3px solid #b86312; }
.msv2-status-summary [data-status="snapshot"],
.msv2-status-item[data-status="snapshot"] { border-left: 3px solid #5277b8; }
.msv2-status-summary [data-status="broken"],
.msv2-status-item[data-status="broken"] { border-left: 3px solid #c83f49; }
.msv2-issue.error { border-left: 3px solid #c83f49; }
.msv2-issue.warning { border-left: 3px solid #d88816; }
.msv2-canvas-wrap {
  min-width: 0;
  min-height: 0;
  overflow: auto;
  padding: 1.5rem clamp(.75rem, 2.5vw, 2.5rem) 4rem;
  background: #e9edf3;
}
.msv2-paper {
  box-sizing: border-box;
  width: min(100%, 72rem);
  min-height: calc(100% - 1rem);
  margin: 0 auto;
  padding: clamp(2.5rem, 4vw, 3.5rem);
  border: 1px solid #d9dee8;
  border-radius: .25rem;
  background: #fff;
  box-shadow: 0 12px 34px rgba(15, 23, 42, .12);
  color: #1b2333;
}
.msv2-prosemirror {
  min-height: 58rem;
  outline: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 11.5pt;
  line-height: 1.62;
  /* ProseMirror text segments intentionally carry spaces around inline atoms. */
  white-space: pre-wrap;
  white-space: break-spaces;
  overflow-wrap: anywhere;
}
.msv2-prosemirror > :first-child { margin-top: 0; }
.msv2-prosemirror h1,
.msv2-prosemirror h2,
.msv2-prosemirror h3,
.msv2-prosemirror h4,
.msv2-prosemirror h5,
.msv2-prosemirror h6 {
  color: #111827;
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  line-height: 1.25;
}
.msv2-prosemirror h1 { margin: 1.8rem 0 .75rem; font-size: 1.65rem; }
.msv2-prosemirror h2 { margin: 1.45rem 0 .65rem; font-size: 1.35rem; }
.msv2-prosemirror h3 { margin: 1.2rem 0 .55rem; font-size: 1.15rem; }
.msv2-prosemirror p { margin: 0 0 .9rem; }
.msv2-prosemirror blockquote {
  margin: 1rem 0;
  padding: .15rem 0 .15rem 1rem;
  border-left: 3px solid #aab5c5;
  color: #475569;
}
.msv2-prosemirror a { color: #164fc6; }
.msv2-prosemirror .ProseMirror-selectednode {
  outline: 2px solid var(--brand);
  outline-offset: 3px;
}
.msv2-citation,
.msv2-analysis-field,
.msv2-cross-reference {
  display: inline;
  padding: 0;
  border-radius: 0;
  color: inherit;
  box-decoration-break: clone;
}
.msv2-citation,
.msv2-cross-reference {
  cursor: pointer;
}
.msv2-citation:hover,
.msv2-cross-reference:hover {
  background: rgba(49, 94, 180, .08);
  box-shadow: 0 1px 0 rgba(49, 94, 180, .35);
}
.msv2-analysis-field {
  border: 0;
  border-radius: 2px;
  background: transparent;
  color: inherit;
  cursor: default;
  font-variant-numeric: tabular-nums;
  font-weight: inherit;
  box-shadow: none;
}
.msv2-analysis-field:hover {
  background: rgba(49, 94, 180, .08);
  box-shadow: 0 1px 0 rgba(49, 94, 180, .35);
  cursor: pointer;
}
.msv2-analysis-field[data-status="stale"],
.msv2-analysis-field[data-status="changed"] {
  background: #fff4d6;
  color: #7a4b00;
}
.msv2-analysis-field[data-status="broken"] {
  background: #ffe8e8;
  color: #9f1f2d;
}
.msv2-generated-prose,
.msv2-analysis-table,
.msv2-analysis-figure,
.msv2-figure,
.msv2-figure-group,
.msv2-figure-panel,
.msv2-editable-table,
.msv2-bibliography {
  margin: 1.2rem 0;
}
.msv2-generated-prose {
  position: relative;
  margin: 0;
}
.msv2-generated-prose::before {
  content: none;
  display: none;
}
.msv2-generated-prose > p:first-child { margin-top: 0; }
.msv2-analysis-table,
.msv2-analysis-figure,
.msv2-figure,
.msv2-figure-group,
.msv2-figure-panel,
.msv2-editable-table {
  padding: 0;
  border: 0;
  background: transparent;
}
.msv2-linked-kicker {
  margin-bottom: .25rem;
  color: #315b9e;
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  font-size: .67rem;
  font-weight: 750;
  letter-spacing: .05em;
  text-transform: uppercase;
}
.msv2-linked-title {
  margin-bottom: .55rem;
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  font-weight: 700;
}
.msv2-linked-hint {
  margin-top: .5rem;
  color: #64748b;
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  font-size: .68rem;
}
.msv2-caption {
  display: block;
  margin-top: .45rem;
  color: #374151;
  font-size: .9rem;
  line-height: 1.4;
  text-align: left;
}
.msv2-table-scroll {
  width: 100%;
  overflow: auto;
}
.msv2-prosemirror table,
.msv2-analysis-table table {
  width: 100%;
  border-collapse: collapse;
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  font-size: .78rem;
}
.msv2-prosemirror th,
.msv2-prosemirror td,
.msv2-analysis-table th,
.msv2-analysis-table td {
  min-width: 4rem;
  padding: .4rem .45rem;
  border: 1px solid #cfd7e3;
  vertical-align: top;
}
.msv2-prosemirror th,
.msv2-analysis-table th {
  background: #f3f6fa;
  font-weight: 700;
}
.msv2-prosemirror .selectedCell::after {
  background: rgba(31, 94, 255, .12);
}
.msv2-figure,
.msv2-analysis-figure,
.msv2-figure-group,
.msv2-figure-panel {
  text-align: center;
}
.msv2-figure img,
.msv2-analysis-figure img,
.msv2-figure-panel img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: .65rem auto;
}
.msv2-figure-group {
  width: 100%;
  margin-right: auto;
  margin-left: auto;
}
.msv2-figure-group > .msv2-node-content {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem 1.25rem;
  align-items: start;
}
.msv2-figure-group[data-columns="1"] > .msv2-node-content {
  grid-template-columns: minmax(0, 1fr);
}
.msv2-figure-group > .msv2-node-content > .msv2-figure-panel {
  min-width: 0;
  margin: 0;
}
.msv2-figure-group[data-columns="2"] > .msv2-node-content > .msv2-figure-panel:last-of-type:nth-of-type(odd) {
  grid-column: 1 / -1;
  width: min(100%, calc(50% - .625rem));
  justify-self: centre;
}
.msv2-figure-group > .msv2-node-content > .msv2-caption {
  grid-column: 1 / -1;
  margin-top: .15rem;
}
.msv2-figure-panel > .msv2-node-preview {
  min-height: 3rem;
}
.msv2-figure-panel > .msv2-node-content {
  margin-top: .2rem;
}
.msv2-figure-panel .msv2-caption {
  margin-top: .25rem;
  font-size: .86rem;
}
@media (max-width: 760px) {
  .msv2-figure-group > .msv2-node-content {
    grid-template-columns: minmax(0, 1fr);
  }
  .msv2-figure-group[data-columns="2"] > .msv2-node-content > .msv2-figure-panel:last-of-type:nth-of-type(odd) {
    grid-column: auto;
    width: 100%;
  }
}
.msv2-page-break {
  position: relative;
  margin: 1.8rem 0;
  border-top: 1px dashed #9aa7b9;
  text-align: center;
}
.msv2-page-break span {
  position: relative;
  top: -.7rem;
  padding: 0 .5rem;
  background: #fff;
  color: #64748b;
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  font-size: .68rem;
}
.msv2-download-menu {
  position: absolute;
  z-index: 30;
  top: 3.05rem;
  right: .65rem;
  width: min(18rem, calc(100% - 1.3rem));
  display: grid;
  gap: .2rem;
  padding: .4rem;
  border: 1px solid var(--line);
  border-radius: .55rem;
  background: var(--surface);
  box-shadow: 0 14px 34px rgba(15, 23, 42, .18);
}
.msv2-download-menu button {
  width: 100%;
  text-align: left;
}
.msv2-toast {
  position: absolute;
  z-index: 40;
  right: 1rem;
  bottom: 1rem;
  max-width: min(26rem, calc(100% - 2rem));
  padding: .7rem .9rem;
  border-radius: .55rem;
  background: #17305f;
  color: #fff;
  box-shadow: 0 12px 30px rgba(15, 23, 42, .2);
  font-size: .82rem;
}
.msv2-toast.error { background: #8f2631; }

.msv2-derived-status {
  display: inline-flex;
  align-items: centre;
  min-height: 1.35rem;
  padding: .1rem .4rem;
  border: 1px solid #d99a2b;
  border-radius: 999px;
  background: #fff8e8;
  color: #7b5000;
  font-size: .68rem;
  white-space: nowrap;
}
.msv2-number-prefix {
  user-select: none;
}
.msv2-heading-number {
  color: inherit;
}
.msv2-caption-number {
  color: inherit;
}
.msv2-derived-unavailable {
  color: #9f1f2d;
  font-size: .92em;
}
.msv2-figure-error {
  margin: .75rem 0;
  padding: .7rem;
  border: 1px solid #d6a4aa;
  background: #fff5f6;
  color: #8f2631;
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  font-size: .78rem;
  text-align: left;
}
.msv2-bibliography {
  line-height: 1.45;
}
.msv2-bibliography .csl-entry {
  margin: 0 0 .65rem 2rem;
  text-indent: -2rem;
}
.msv2-bibliography .csl-left-margin {
  float: left;
  padding-right: .65rem;
}
.msv2-bibliography .csl-right-inline {
  margin-left: 2rem;
}
.msv2-caption:empty::after {
  content: "Add caption";
  color: #7a8798;
  font-weight: 400;
}
.theme-dark .msv2-canvas-wrap { background: #131a25; }
.theme-dark .msv2-paper {
  border-color: #465166;
  background: #f8fafc;
  color: #1b2333;
}
.theme-dark .msv2-shell button:hover:not(:disabled),
.theme-dark .msv2-shell button.active {
  color: #dce8ff;
}
.theme-dark .msv2-conflict {
  border-color: #8b6619;
  background: #3d2c0b;
  color: #fde4a6;
}
.theme-dark .msv2-presence { background: #162b49; color: #cfe3ff; }
.theme-dark .msv2-recovery { background: #173423; color: #d4f3df; }
.theme-dark .msv2-reference.selected {
  background: #12294e;
}

@media (max-width: 1100px) {
  .visual-manuscript-section { height: calc(100vh - 13.2rem); }
  .msv2-layout { grid-template-columns: minmax(12.5rem, 15rem) minmax(0, 1fr); }
  .msv2-paper { padding: 2.5rem; }
  .msv2-topline { align-items: flex-start; }
}
@media (max-width: 800px) {
  .visual-manuscript-section { height: auto; min-height: 75rem; }
  .msv2-layout { grid-template-columns: 1fr; grid-template-rows: minmax(18rem, 32vh) minmax(50rem, 1fr); overflow: visible; }
  .msv2-shell { overflow: visible; }
  .msv2-sidebar { border-right: 0; border-bottom: 1px solid var(--line); }
  .msv2-canvas-wrap { padding: 1rem .5rem 3rem; }
  .msv2-paper { min-height: 50rem; padding: 2rem 1.25rem; }
  .msv2-topline { flex-direction: column; }
  .msv2-top-actions { justify-content: flex-start; }
}

/* v0.16.5 consolidated controls and loading states */
.ribbon-button-subtitle {
  display: block;
  max-width: 8rem;
  margin-top: .08rem;
  overflow: hidden;
  color: inherit;
  font-size: .64rem;
  font-weight: 650;
  line-height: 1.05;
  opacity: .82;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ribbon-dropdown-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-width: 12rem;
  padding: .5rem .7rem;
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
  color: var(--muted);
  font-size: .74rem;
}
.ribbon-dropdown-status strong {
  color: var(--text);
  font-size: .76rem;
}
.ribbon-design-button > span:last-child {
  align-items: flex-start;
  text-align: left;
}
.ribbon-design-button strong,
.ribbon-design-button small {
  display: block;
}
.ribbon-design-button small {
  max-width: 10rem;
  overflow: hidden;
  color: inherit;
  font-size: .65rem;
  font-weight: 600;
  line-height: 1.1;
  opacity: .82;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.project-loading-state {
  display: flex;
  min-height: min(70vh, 42rem);
  align-items: center;
  justify-content: center;
  gap: .8rem;
  color: var(--muted);
}
.project-loading-state .spinner-border {
  width: 1.55rem;
  height: 1.55rem;
}
.analysis-population-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .7rem .8rem;
  border: 1px solid var(--line);
  border-radius: .55rem;
  background: var(--surface-soft);
}
.analysis-population-row select {
  flex: 0 1 25rem;
  max-width: 25rem;
}
.analysis-table-scroll-padded {
  width: calc(100% - 1.2rem);
  margin-right: .6rem;
  margin-left: .6rem;
}
.risk-of-bias-tool-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .75rem;
}
.risk-of-bias-tool-option {
  display: flex;
  min-height: 9rem;
  flex-direction: column;
  gap: .55rem;
  padding: .9rem;
  border: 1px solid var(--line);
  border-radius: .65rem;
  background: var(--surface);
  color: var(--text);
  text-align: left;
  transition: border-color .12s ease, box-shadow .12s ease, background-color .12s ease;
}
.risk-of-bias-tool-option:hover:not(:disabled),
.risk-of-bias-tool-option:focus-visible {
  border-color: color-mix(in srgb, var(--brand) 65%, var(--line));
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand) 14%, transparent);
  outline: none;
}
.risk-of-bias-tool-option.active {
  border-color: var(--brand);
  background: color-mix(in srgb, var(--brand) 6%, var(--surface));
}
.risk-of-bias-tool-option > span {
  color: var(--muted);
  font-size: .85rem;
}
.risk-of-bias-tool-option > small {
  margin-top: auto;
  color: var(--muted);
  font-size: .72rem;
  line-height: 1.35;
}
.theme-dark .records-filter-row,
.theme-dark .ribbon-dropdown-status {
  background: var(--panel);
}
@media (max-width: 760px) {
  .risk-of-bias-tool-grid { grid-template-columns: 1fr; }
  .analysis-population-row { align-items: stretch; flex-direction: column; }
  .analysis-population-row select { max-width: none; }
}

/* Evidence source viewer: keep the PDF reader mounted while the abstract is shown. */
.extraction-source-pane .extraction-pdf-card {
  overflow: hidden;
}
.extraction-source-toolbar {
  flex: 0 0 auto;
  min-height: 2.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: .45rem .55rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface-muted, #f8fafc);
}
.extraction-study-navigator {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: .4rem;
}
.extraction-study-nav-button {
  flex: 0 0 auto;
  min-width: 2rem;
}
.extraction-study-reference {
  min-width: 0;
  max-width: 24rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}
.extraction-source-actions {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: .5rem;
}
.extraction-source-body {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden !important;
}
.extraction-source-body > .extraction-inline-pdf-frame,
.extraction-source-body > .extraction-abstract-panel {
  width: 100%;
  height: 100%;
}
.extraction-abstract-panel {
  overflow: auto;
  background: var(--surface, #fff);
}
.extraction-abstract-text {
  max-width: 52rem;
  margin: 0 auto;
  padding: 1.5rem 1.75rem 3rem;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1rem;
  line-height: 1.7;
  white-space: pre-wrap;
  user-select: text;
  cursor: text;
}
.extraction-abstract-highlight {
  scroll-margin-block: 7rem;
  padding: 0 .08rem;
}
.theme-dark .extraction-source-toolbar {
  background: #111827;
  border-bottom-color: #334155;
}
.theme-dark .extraction-abstract-panel,
.theme-dark .extraction-abstract-text {
  background: #0f172a;
  color: #e5e7eb;
}

/* Visual manuscript whole-object selection */
.msv2-generated-prose,
.msv2-analysis-table,
.msv2-analysis-figure,
.msv2-figure,
.msv2-figure-group,
.msv2-figure-panel,
.msv2-editable-table,
.msv2-bibliography,
.msv2-page-break {
  position: relative;
}
.msv2-object-selected {
  outline: 2px solid var(--brand) !important;
  outline-offset: 4px;
}

/* v0.16.10 compact visual manuscript toolbar, wide canvas and magnification */
.msv2-shell [hidden] {
  display: none !important;
}
.msv2-shell {
  --msv2-zoom: 1;
  border-radius: .58rem;
}
.msv2-toolbar.tab-ribbon {
  position: relative;
  z-index: 30;
  flex: 0 0 auto;
  box-sizing: border-box;
  height: 48px;
  min-height: 48px;
  max-height: 48px;
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: .18rem;
  padding: .36rem .5rem;
  overflow-x: auto;
  overflow-y: hidden;
  border-bottom: 1px solid #e5e9f0;
  background: linear-gradient(180deg, #fff 0%, #fbfcfe 100%);
  scrollbar-width: thin;
}
.msv2-toolbar.tab-ribbon:has(.ribbon-dropdown:hover),
.msv2-toolbar.tab-ribbon:has(.ribbon-dropdown:focus-within) {
  overflow: visible;
}
.msv2-toolbar-identity {
  flex: 0 0 auto;
  min-width: 9.8rem;
  min-height: 36px;
  display: flex;
  align-items: center;
  gap: .48rem;
  padding: 0 .7rem 0 .25rem;
  border-right: 1px solid #e1e7ef;
  white-space: nowrap;
}
.msv2-toolbar-identity strong {
  font-size: .82rem;
  line-height: 1;
}
.msv2-toolbar .ribbon-group {
  min-height: 36px;
  padding: 0 .42rem;
  gap: .18rem;
}
.msv2-shell .msv2-toolbar .ribbon-button,
.msv2-shell .msv2-toolbar .ribbon-button.ribbon-primary {
  width: auto;
  min-width: 0;
  min-height: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .3rem;
  padding: .26rem .5rem;
  border: 1px solid transparent;
  border-radius: .6rem;
  background: transparent;
  color: #344054;
  font-size: .72rem;
  font-weight: 720;
  line-height: 1;
  white-space: nowrap;
}
.msv2-shell .msv2-toolbar .ribbon-button:hover:not(:disabled),
.msv2-shell .msv2-toolbar .ribbon-button.active {
  border-color: #dbe3ee;
  background: #f3f6fb;
  color: #111827;
  box-shadow: 0 1px 2px rgba(16,24,40,.05);
}
.msv2-shell .msv2-toolbar .ribbon-button.ribbon-primary {
  border-color: #ffd8bd;
  background: var(--brand-soft);
  color: var(--brand-dark);
}
.msv2-shell .msv2-toolbar .ribbon-button.ribbon-primary:hover:not(:disabled) {
  border-color: #ffc99f;
  background: #ffe7d6;
  color: var(--brand-dark);
}
.msv2-shell .msv2-toolbar .ribbon-select {
  width: 7.45rem;
  min-width: 7.45rem;
  min-height: 30px;
  height: 30px;
  padding: .14rem 1.7rem .14rem .45rem;
  border: 1px solid #d5dde9;
  border-radius: .55rem;
  background-color: #fff;
  color: #111827;
  font-size: .72rem;
  font-weight: 620;
}
.msv2-shell .msv2-toolbar .msv2-icon-button {
  width: 2rem;
  min-width: 2rem;
  padding-right: .25rem;
  padding-left: .25rem;
  font-size: .86rem;
}
.msv2-shell .msv2-toolbar .ribbon-icon {
  min-width: .95rem;
  min-height: .95rem;
  font-size: .88rem;
}
.msv2-shell .ribbon-dropdown-menu {
  top: calc(100% - 1px);
  min-width: 13rem;
}
.msv2-shell .ribbon-dropdown-menu button {
  width: 100%;
  min-height: 2rem;
  padding: .44rem .58rem;
  border: 0;
  border-radius: .35rem;
  background: transparent;
  color: var(--text);
  font-size: .78rem;
  font-weight: 600;
  text-align: left;
}
.msv2-shell .ribbon-dropdown-menu button:hover:not(:disabled),
.msv2-shell .ribbon-dropdown-menu button:focus-visible,
.msv2-shell .ribbon-dropdown-menu button.active {
  border: 0;
  background: color-mix(in srgb, var(--brand) 10%, var(--surface));
  color: var(--brand-dark);
}
.msv2-dropdown-end .ribbon-dropdown-menu {
  right: 0;
  left: auto;
}
.msv2-zoom-group {
  gap: .05rem !important;
}
.msv2-shell .msv2-toolbar .msv2-zoom-label {
  min-width: 3.3rem;
  padding-right: .35rem;
  padding-left: .35rem;
  font-variant-numeric: tabular-nums;
}
.msv2-toolbar-status {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  margin-left: auto;
  padding-left: .45rem;
  border-left: 1px solid #e1e7ef;
}
.msv2-lease-status,
.msv2-derived-status {
  min-height: 1.5rem;
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  padding: .1rem .42rem;
  border: 1px solid #ccd5e2;
  border-radius: 999px;
  background: #f7f9fc;
  color: #475467;
  font-size: .66rem;
  font-weight: 700;
  white-space: nowrap;
}
.msv2-lease-status.editing {
  border-color: #a9d8bd;
  background: #edf9f1;
  color: #245a38;
}
.msv2-lease-status.readonly,
.msv2-lease-status.warning {
  border-color: #e6c471;
  background: #fff7df;
  color: #76510a;
}
.msv2-lease-status button {
  min-height: 1.25rem !important;
  padding: .05rem .3rem !important;
  border: 0 !important;
  background: transparent !important;
  color: inherit !important;
  font-size: .64rem !important;
  text-decoration: underline;
}
.msv2-readonly-banner {
  flex: 0 0 auto;
  min-height: 2.65rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .8rem;
  padding: .55rem .85rem;
  border-bottom: 1px solid #e6c471;
  background: #fff7df;
  color: #76510a;
  font-size: .82rem;
}
.msv2-readonly-banner button {
  flex: 0 0 auto;
  min-height: 2rem;
  border-color: currentColor;
  background: transparent;
  color: inherit;
  font-weight: 750;
}
.msv2-readonly-banner button:hover:not(:disabled) {
  border-color: currentColor;
  background: rgba(118, 81, 10, .08);
  color: inherit;
}
.msv2-recovery,
.msv2-conflict {
  padding: .48rem .65rem;
  font-size: .78rem;
}
.msv2-layout {
  grid-template-columns: minmax(0, 1fr);
}
.msv2-shell.msv2-panel-open .msv2-layout {
  grid-template-columns: minmax(13.5rem, 16rem) minmax(0, 1fr);
}
.msv2-sidebar-header {
  flex: 0 0 auto;
  min-height: 2.45rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  padding: .42rem .55rem .42rem .7rem;
  border-bottom: 1px solid var(--line);
}
.msv2-sidebar-header strong {
  overflow: hidden;
  font-size: .78rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.msv2-sidebar-header button {
  width: 1.75rem;
  min-width: 1.75rem;
  min-height: 1.75rem;
  padding: 0;
  border: 0;
  background: transparent;
  font-size: 1rem;
}
.msv2-canvas-wrap {
  padding: .55rem .55rem 1.25rem;
}
.msv2-paper {
  width: 100%;
  max-width: none;
  min-height: calc(100% - .2rem);
  margin: 0;
  padding: clamp(1.2rem, 1.8vw, 1.9rem);
  border-radius: .2rem;
  box-shadow: 0 5px 18px rgba(15,23,42,.09);
}
.msv2-prosemirror {
  min-height: calc(100vh - 18rem);
  font-size: calc(10.5pt * var(--msv2-zoom));
  line-height: 1.58;
}
.msv2-prosemirror h1,
.msv2-prosemirror h2,
.msv2-prosemirror h3,
.msv2-prosemirror h4,
.msv2-prosemirror h5,
.msv2-prosemirror h6 {
  font-size: inherit;
}
.msv2-prosemirror h1 { margin: 1.65em 0 .65em; font-size: 1.62em; }
.msv2-prosemirror h2 { margin: 1.35em 0 .58em; font-size: 1.34em; }
.msv2-prosemirror h3 { margin: 1.1em 0 .5em; font-size: 1.16em; }
.msv2-prosemirror h4 { margin: 1em 0 .45em; font-size: 1.06em; }
.msv2-prosemirror p { margin-bottom: .78em; }
.theme-dark .msv2-toolbar.tab-ribbon {
  border-bottom-color: #334155;
  background: linear-gradient(180deg, #172033 0%, #131b2b 100%);
}
.theme-dark .msv2-toolbar-identity,
.theme-dark .msv2-toolbar .ribbon-group,
.theme-dark .msv2-toolbar-status {
  border-color: #334155;
}
.theme-dark .msv2-shell .msv2-toolbar .ribbon-button,
.theme-dark .msv2-shell .msv2-toolbar .ribbon-button.ribbon-primary {
  color: #d9e2ef;
}
.theme-dark .msv2-shell .msv2-toolbar .ribbon-button:hover:not(:disabled),
.theme-dark .msv2-shell .msv2-toolbar .ribbon-button.active {
  border-color: #475569;
  background: #243047;
  color: #fff;
}
.theme-dark .msv2-shell .msv2-toolbar .ribbon-select {
  border-color: #475569;
  background-color: #111827;
  color: #f8fafc;
}
@media (max-width: 1500px) {
  .msv2-toolbar-identity { min-width: 8.7rem; padding-right: .5rem; }
  .msv2-toolbar .ribbon-group { padding-right: .3rem; padding-left: .3rem; }
  .msv2-shell .msv2-toolbar .ribbon-button,
  .msv2-shell .msv2-toolbar .ribbon-button.ribbon-primary { padding-right: .42rem; padding-left: .42rem; }
  .msv2-toolbar-status { margin-left: 0; }
}
@media (max-width: 1100px) {
  .msv2-shell.msv2-panel-open .msv2-layout { grid-template-columns: minmax(12.5rem, 14rem) minmax(0, 1fr); }
  .msv2-paper { padding: 1.2rem; }
  .msv2-toolbar-status { display: none; }
}
@media (max-width: 800px) {
  .msv2-toolbar.tab-ribbon { max-height: none; }
  .msv2-layout { grid-template-columns: 1fr; grid-template-rows: minmax(48rem, 1fr); overflow: visible; }
  .msv2-shell.msv2-panel-open .msv2-layout { grid-template-columns: 1fr; grid-template-rows: minmax(15rem, 32vh) minmax(48rem, 1fr); }
  .msv2-canvas-wrap { padding: .35rem .3rem 1rem; }
  .msv2-paper { padding: 1rem .85rem; }
}

/* v0.16.16 visual manuscript toolbar and document panel */
.tab-ribbon-visual-manuscript {
  position: relative;
  z-index: 30;
  width: 100%;
  height: 48px;
  min-height: 48px;
  max-height: 48px;
  padding: 0 .45rem;
  overflow: visible;
}
.visual-manuscript-toolbar-host {
  width: 100%;
  min-width: 0;
  height: 100%;
}
.visual-manuscript-toolbar-host .msv2-toolbar {
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  min-height: 0;
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: .16rem;
  padding: .32rem 0;
  border: 0;
  background: transparent;
  overflow: visible;
}
.visual-manuscript-toolbar-host .msv2-toolbar .ribbon-group {
  min-height: 36px;
  gap: .16rem;
  padding: 0 .38rem;
}
.visual-manuscript-toolbar-host .msv2-toolbar .ribbon-button,
.visual-manuscript-toolbar-host .msv2-toolbar .ribbon-button.ribbon-primary {
  width: auto;
  min-width: 0;
  min-height: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .3rem;
  padding: .26rem .48rem;
  border: 1px solid transparent;
  border-radius: .6rem;
  background: transparent;
  color: #344054;
  font-size: .72rem;
  font-weight: 720;
  line-height: 1;
  white-space: nowrap;
}
.visual-manuscript-toolbar-host .msv2-toolbar .ribbon-button:hover:not(:disabled),
.visual-manuscript-toolbar-host .msv2-toolbar .ribbon-button.active {
  border-color: #dbe3ee;
  background: #f3f6fb;
  color: #111827;
  box-shadow: 0 1px 2px rgba(16,24,40,.05);
}
.visual-manuscript-toolbar-host .msv2-toolbar .ribbon-button.ribbon-primary {
  border-color: #ffd8bd;
  background: var(--brand-soft);
  color: var(--brand-dark);
}
.visual-manuscript-toolbar-host .msv2-toolbar .ribbon-select {
  width: 7.45rem;
  min-width: 7.45rem;
  min-height: 30px;
  height: 30px;
  padding: .14rem 1.7rem .14rem .45rem;
  border: 1px solid #d5dde9;
  border-radius: .55rem;
  background-color: #fff;
  color: #111827;
  font-size: .72rem;
  font-weight: 620;
}
.visual-manuscript-toolbar-host .msv2-icon-button {
  width: 2rem !important;
  min-width: 2rem !important;
  padding-right: .25rem !important;
  padding-left: .25rem !important;
  font-size: .86rem !important;
}
.visual-manuscript-toolbar-host .msv2-zoom-label {
  min-width: 3.25rem !important;
  padding-right: .32rem !important;
  padding-left: .32rem !important;
  font-variant-numeric: tabular-nums;
}
.visual-manuscript-toolbar-host .msv2-toolbar-status {
  flex: 0 0 auto;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  margin-left: auto;
  padding-left: .45rem;
  border-left: 1px solid #e1e7ef;
}
.visual-manuscript-toolbar-host .ribbon-dropdown-menu {
  top: calc(100% - 1px);
  z-index: 120;
  min-width: 13rem;
}
.visual-manuscript-toolbar-host .ribbon-dropdown-menu button {
  width: 100%;
  min-height: 2rem;
  padding: .44rem .58rem;
  border: 0;
  border-radius: .35rem;
  background: transparent;
  color: var(--text);
  font-size: .78rem;
  font-weight: 600;
  text-align: left;
}
.visual-manuscript-toolbar-host .ribbon-dropdown-menu button:hover:not(:disabled),
.visual-manuscript-toolbar-host .ribbon-dropdown-menu button:focus-visible,
.visual-manuscript-toolbar-host .ribbon-dropdown-menu button.active {
  background: color-mix(in srgb, var(--brand) 10%, var(--surface));
  color: var(--brand-dark);
}
.theme-dark .tab-ribbon-visual-manuscript,
[data-bs-theme="dark"] .tab-ribbon-visual-manuscript {
  border-bottom-color: #334155;
  background: linear-gradient(180deg, #172033 0%, #131b2b 100%);
}
.theme-dark .visual-manuscript-toolbar-host .msv2-toolbar .ribbon-button,
.theme-dark .visual-manuscript-toolbar-host .msv2-toolbar .ribbon-button.ribbon-primary,
[data-bs-theme="dark"] .visual-manuscript-toolbar-host .msv2-toolbar .ribbon-button,
[data-bs-theme="dark"] .visual-manuscript-toolbar-host .msv2-toolbar .ribbon-button.ribbon-primary {
  color: #d9e2ef;
}
.theme-dark .visual-manuscript-toolbar-host .msv2-toolbar .ribbon-button:hover:not(:disabled),
.theme-dark .visual-manuscript-toolbar-host .msv2-toolbar .ribbon-button.active,
[data-bs-theme="dark"] .visual-manuscript-toolbar-host .msv2-toolbar .ribbon-button:hover:not(:disabled),
[data-bs-theme="dark"] .visual-manuscript-toolbar-host .msv2-toolbar .ribbon-button.active {
  border-color: #475569;
  background: #243047;
  color: #fff;
}
.theme-dark .visual-manuscript-toolbar-host .msv2-toolbar .ribbon-select,
[data-bs-theme="dark"] .visual-manuscript-toolbar-host .msv2-toolbar .ribbon-select {
  border-color: #475569;
  background-color: #111827;
  color: #f8fafc;
}

.visual-manuscript-section {
  height: calc(100vh - 10.75rem);
}
.msv2-shell {
  --msv2-panel-width: 288px;
  border-radius: .55rem;
}
.msv2-layout,
.msv2-shell.msv2-panel-open .msv2-layout {
  grid-template-columns: minmax(0, 1fr) 2.35rem;
  grid-template-rows: minmax(0, 1fr);
}
.msv2-shell.msv2-panel-open .msv2-layout {
  grid-template-columns: minmax(0, 1fr) var(--msv2-panel-width);
}
.msv2-sidebar {
  position: relative;
  grid-column: 2;
  grid-row: 1;
  min-width: 0;
  border-right: 0;
  border-left: 1px solid var(--line);
  background: var(--surface-soft);
  overflow: hidden;
}
.msv2-canvas-wrap {
  grid-column: 1;
  grid-row: 1;
  min-width: 0;
  padding: .65rem .75rem 1.25rem;
}
.msv2-sidebar-fold {
  width: 100%;
  height: 100%;
  min-height: 0 !important;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: .55rem;
  padding: .65rem .25rem !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  color: var(--muted) !important;
}
.msv2-sidebar-fold [data-panel-fold-title] {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  overflow: hidden;
  font-size: .68rem;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.msv2-sidebar-expanded {
  width: 100%;
  height: 100%;
  display: none;
  flex-direction: column;
  min-height: 0;
}
.msv2-panel-open .msv2-sidebar-fold { display: none; }
.msv2-panel-open .msv2-sidebar-expanded { display: flex; }
.msv2-sidebar-resizer {
  position: absolute;
  z-index: 5;
  top: 0;
  bottom: 0;
  left: -4px;
  width: 8px;
  display: none;
  cursor: col-resize;
}
.msv2-panel-open .msv2-sidebar-resizer { display: block; }
body.msv2-resizing-panel { cursor: col-resize !important; user-select: none !important; }
.msv2-sidebar-header {
  min-height: 2.6rem;
  justify-content: stretch;
  padding: .38rem .42rem .38rem .55rem;
}
.msv2-sidebar-header select {
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  min-height: 1.9rem;
  padding: .25rem 1.55rem .25rem .42rem;
  border: 1px solid var(--line);
  border-radius: .42rem;
  background: var(--surface);
  color: var(--ink);
  font-size: .76rem;
  font-weight: 700;
}
.msv2-sidebar-header button {
  flex: 0 0 1.75rem;
  transform: rotate(180deg);
}
.msv2-paper {
  width: min(100%, 1160px);
  max-width: 1160px;
  min-height: calc(100% - .2rem);
  margin: 0 auto;
  padding: clamp(1.25rem, 2vw, 2rem);
}
.msv2-prosemirror {
  font-size: calc(10.5pt * var(--msv2-zoom));
}

.msv2-figure img,
.msv2-analysis-figure img,
.msv2-figure-panel img {
  max-height: 65vh;
  object-fit: contain;
  cursor: zoom-in;
}
.msv2-node-preview.msv2-figure-preview-expanded img {
  max-width: 100% !important;
  max-height: none !important;
  cursor: zoom-out;
}
.msv2-figure-group {
  margin-right: auto;
  margin-left: auto;
}
.msv2-editable-table,
.msv2-analysis-table {
  width: calc(100% - 2rem);
  max-width: calc(100% - 2rem);
  margin-right: 1rem;
  margin-left: 1rem;
}
.msv2-editable-table .tableWrapper,
.msv2-editable-table .msv2-node-content,
.msv2-analysis-table .msv2-node-preview,
.msv2-table-scroll {
  max-width: 100%;
  overflow-x: auto;
}
.msv2-editable-table .msv2-caption,
.msv2-analysis-table .msv2-caption {
  width: 100%;
}

.msv2-reference-search {
  width: 100%;
  min-height: 2.35rem;
  margin-bottom: .65rem;
  padding: .42rem .55rem;
  border: 1px solid var(--line);
  border-radius: .48rem;
  background: var(--surface);
  color: var(--ink);
}
.msv2-reference-selected {
  display: flex;
  flex-wrap: wrap;
  gap: .3rem;
  margin-bottom: .55rem;
}
.msv2-reference-chip {
  display: inline-flex;
  align-items: center;
  gap: .2rem;
  max-width: 100%;
  padding: .18rem .28rem .18rem .42rem;
  border: 1px solid color-mix(in srgb, var(--brand) 35%, var(--line));
  border-radius: 999px;
  background: color-mix(in srgb, var(--brand) 8%, var(--surface));
  font-size: .7rem;
  font-weight: 650;
}
.msv2-reference-chip button {
  width: 1.15rem;
  min-width: 1.15rem;
  height: 1.15rem;
  min-height: 1.15rem;
  padding: 0;
  border: 0;
  background: transparent;
}
.msv2-reference-results { margin-top: .65rem; }
.msv2-object-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: stretch;
  gap: .3rem;
  margin-bottom: .45rem;
}
.msv2-object-row.is-panel {
  margin-left: 1rem;
}
.msv2-object-row-main {
  min-width: 0;
  display: grid;
  gap: .18rem;
  padding: .52rem .58rem !important;
  text-align: left;
}
.msv2-object-row-main strong,
.msv2-object-row-main span,
.msv2-object-row-main small,
.msv2-object-row-main em {
  min-width: 0;
  overflow-wrap: anywhere;
}
.msv2-object-row-main small { color: var(--muted); font-size: .68rem; }
.msv2-object-row-main em { color: #996000; font-size: .68rem; font-style: normal; }
.msv2-object-row-actions {
  display: grid;
  grid-template-rows: 1fr 1fr;
  gap: .2rem;
}
.msv2-object-row-actions button {
  width: 1.8rem;
  min-width: 1.8rem;
  min-height: 1.45rem;
  padding: 0;
}

.msv2-fallback-toolbar-layout {
  display: flex;
  flex-direction: column;
}
.msv2-fallback-toolbar-layout > .msv2-owned-toolbar-host {
  flex: 0 0 48px;
  padding: 0 .45rem;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.msv2-fallback-toolbar-layout > .msv2-shell {
  flex: 1 1 auto;
  height: auto;
}

@media (max-width: 1250px) {
  .visual-manuscript-toolbar-host .msv2-toolbar-status { display: none; }
  .visual-manuscript-toolbar-host .msv2-toolbar .ribbon-group { padding-right: .22rem; padding-left: .22rem; }
  .visual-manuscript-toolbar-host .msv2-toolbar .ribbon-button,
  .visual-manuscript-toolbar-host .msv2-toolbar .ribbon-button.ribbon-primary { padding-right: .36rem; padding-left: .36rem; }
}
@media (max-width: 900px) {
  .tab-ribbon-visual-manuscript { overflow-x: auto; overflow-y: hidden; }
  .visual-manuscript-toolbar-host .msv2-toolbar { width: max-content; min-width: 100%; }
  .visual-manuscript-section { height: auto; min-height: 70rem; }
  .msv2-layout,
  .msv2-shell.msv2-panel-open .msv2-layout { grid-template-columns: minmax(0,1fr) 2.35rem; grid-template-rows: minmax(52rem,1fr); }
  .msv2-shell.msv2-panel-open .msv2-layout { grid-template-columns: minmax(0,1fr) min(42vw,var(--msv2-panel-width)); }
  .msv2-paper { padding: 1rem .9rem; }
  .msv2-editable-table,
  .msv2-analysis-table { width: calc(100% - 1rem); max-width: calc(100% - 1rem); margin-right: .5rem; margin-left: .5rem; }
}

/* Keep the single manuscript toolbar usable inside the narrower workspace beside the project panel. */
.visual-manuscript-toolbar-host { container-type: inline-size; }
@container (max-width: 1080px) {
  .visual-manuscript-toolbar-host .msv2-toolbar .ribbon-button > span:last-child:not(.ribbon-icon) {
    display: none;
  }
  .visual-manuscript-toolbar-host .msv2-toolbar .ribbon-button,
  .visual-manuscript-toolbar-host .msv2-toolbar .ribbon-button.ribbon-primary {
    width: 2rem;
    min-width: 2rem;
    padding-right: .25rem;
    padding-left: .25rem;
  }
  .visual-manuscript-toolbar-host .msv2-toolbar .ribbon-select {
    width: 6.7rem;
    min-width: 6.7rem;
  }
  .visual-manuscript-toolbar-host .msv2-toolbar .msv2-find-button {
    width: auto;
    min-width: 0;
    padding-right: .42rem;
    padding-left: .36rem;
  }
  .visual-manuscript-toolbar-host .msv2-toolbar .msv2-find-button > span:last-child {
    display: inline;
  }
}
@container (max-width: 760px) {
  .visual-manuscript-toolbar-host .msv2-toolbar .ribbon-select {
    width: 5.9rem;
    min-width: 5.9rem;
  }
  .visual-manuscript-toolbar-host .msv2-toolbar .ribbon-group {
    padding-right: .14rem;
    padding-left: .14rem;
  }
}

/* Visual manuscript refinements */
.visual-manuscript-toolbar-host .ribbon-dropdown > .ribbon-button[title] {
  --tooltip-placement: top;
}
.msv2-document-group { min-width: 0; }
.msv2-document-select { min-width: 10.5rem; max-width: 15rem; }
.msv2-toolbar-field {
  display: flex;
  flex-direction: column;
  gap: .12rem;
  margin: 0;
  color: var(--muted);
  font-size: .61rem;
  font-weight: 700;
  line-height: 1;
}
.msv2-toolbar-field .ribbon-select { min-width: 9rem; }
.msv2-download-icon svg,
.msv2-delete-icon svg { width: 1.05rem; height: 1.05rem; display: block; }
.msv2-toolbar-status { border-left: 0; padding-left: .15rem; }
.msv2-paper {
  width: min(100%, 210mm);
  max-width: 210mm;
}
.msv2-caption,
.msv2-figure-panel .msv2-caption,
.msv2-caption-number,
.msv2-linked-label,
.msv2-linked-hint {
  font-size: calc(.9rem * var(--msv2-zoom));
  text-align: left;
}
.msv2-figure,
.msv2-analysis-figure,
.msv2-figure-group { text-align: left; }
.msv2-figure-panel { text-align: left; }
.msv2-figure-panel img { margin-left: 0; margin-right: auto; }
.msv2-figure-group > .msv2-node-content > .msv2-caption,
.msv2-figure > .msv2-node-content > .msv2-caption,
.msv2-analysis-figure > .msv2-node-content > .msv2-caption { width: 100%; text-align: left; }
.msv2-figure img,
.msv2-analysis-figure img,
.msv2-figure-panel img { cursor: default; }
.msv2-node-preview.msv2-figure-preview-expanded img { max-height: 65vh !important; }
.msv2-panel {
  padding: .7rem;
  background: var(--surface-soft);
}
.msv2-panel > h3,
.msv2-panel > h4,
.msv2-panel > article,
.msv2-panel > section,
.msv2-panel > label,
.msv2-panel > p,
.msv2-panel > button {
  margin-right: 0;
  margin-left: 0;
}
.msv2-panel > article,
.msv2-panel-card,
.msv2-panel > section {
  border: 1px solid var(--line);
  border-radius: .5rem;
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(15,23,42,.04);
}
/* Manuscript document templates and project-wide fields. */
.msv2-new-document-button { flex: 0 0 auto; }
.msv2-document-field {
  display: inline;
  padding: .04em .18em;
  border-radius: .2rem;
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  box-shadow: inset 0 -1px 0 color-mix(in srgb, var(--accent) 35%, transparent);
}
.msv2-crossref-document { margin: .55rem 0; padding: .45rem; }
.msv2-crossref-document > h4 { margin: 0 0 .35rem; }
.msv2-crossref-document > h4 small { font-weight: 500; opacity: .7; }
.msv2-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 2500;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(15, 23, 42, .48);
}
.msv2-modal-backdrop[hidden] { display: none; }
.msv2-modal {
  width: min(32rem, 100%);
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: .75rem;
  background: var(--surface);
  box-shadow: 0 18px 50px rgba(15, 23, 42, .28);
}
.msv2-modal > header,
.msv2-modal > footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
}
.msv2-modal > header h2 { margin: 0; }
.msv2-modal > header button { font-size: 1.35rem; line-height: 1; }
.msv2-modal > label { display: grid; gap: .3rem; margin-top: .85rem; }
.msv2-modal select,
.msv2-modal input { width: 100%; }
.msv2-modal > footer { justify-content: flex-end; margin-top: 1rem; }


/* v0.16.19 manuscript templates, preferences, provenance and toolbar behaviour */
.ribbon-dropdown.ribbon-dropdown-dismissed .ribbon-dropdown-menu {
  display: none !important;
}
.analysis-generator-badge {
  display: inline-flex;
  align-items: center;
  padding: .12rem .42rem;
  border: 1px solid color-mix(in srgb, var(--brand) 28%, var(--line));
  border-radius: 999px;
  background: color-mix(in srgb, var(--brand) 7%, var(--surface));
  color: var(--brand-dark);
  font-size: .67rem;
  font-weight: 700;
  white-space: nowrap;
}
.msv2-prosemirror .msv2-document-title {
  margin: 0 0 1.25em;
  text-align: center;
  font-size: calc(2.15rem * var(--msv2-zoom));
  font-weight: 750;
  line-height: 1.15;
}
.msv2-analysis-placeholder {
  display: grid;
  gap: .25rem;
  margin: .65rem 0;
  padding: .65rem .75rem;
  border: 1px dashed color-mix(in srgb, var(--brand) 38%, var(--line));
  border-radius: .5rem;
  background: color-mix(in srgb, var(--brand) 5%, var(--surface));
  color: var(--muted);
}
.msv2-analysis-placeholder strong { color: var(--ink); font-size: .76rem; }
.msv2-analysis-placeholder span { font-size: .78rem; }
.msv2-canvas-wrap { position: relative; }
.msv2-word-count {
  position: sticky;
  bottom: .4rem;
  left: .45rem;
  width: max-content;
  margin: .3rem 0 .2rem .45rem;
  padding: .2rem .5rem;
  border: 1px solid var(--line);
  border-radius: .38rem;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  color: var(--muted);
  box-shadow: 0 1px 4px rgba(15,23,42,.07);
  font-size: .7rem;
  font-weight: 650;
}
.msv2-empty-state {
  width: min(30rem, calc(100% - 2rem));
  margin: 5rem auto;
  padding: 2rem;
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: .75rem;
  background: var(--surface);
}
.msv2-preferences-modal {
  width: min(58rem, 100%);
  height: min(42rem, calc(100vh - 2rem));
  max-height: min(48rem, calc(100vh - 2rem));
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.msv2-preferences-tabs {
  display: flex;
  gap: .25rem;
  margin: .8rem 0 0;
  border-bottom: 1px solid var(--line);
}
.msv2-preferences-tabs button {
  padding: .45rem .65rem;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
}
.msv2-preferences-tabs button.active {
  border-bottom-color: var(--brand);
  color: var(--brand-dark);
}
.msv2-preferences-content {
  min-height: 0;
  max-height: none;
  flex: 1 1 auto;
  overflow: auto;
  padding: .9rem .1rem .25rem;
}
.msv2-preferences-content > label { display: grid; gap: .3rem; margin-bottom: .75rem; }
.msv2-preferences-content > .msv2-checkbox { display: flex; align-items: center; gap: .45rem; }
.msv2-preferences-content .msv2-checkbox input[type="checkbox"] {
  flex: 0 0 auto;
  width: 1rem;
  height: 1rem;
  margin: 0;
}
.msv2-preferences-content select { width: 100%; }
.msv2-preferences-section + .msv2-preferences-section {
  margin-top: 1.15rem;
  padding-top: 1.15rem;
  border-top: 1px solid var(--line);
}

/* v0.16.24 manuscript selectors, loading, linked content and context menu */
.visual-manuscript-toolbar-host .msv2-selector-button {
  min-width: 10.5rem;
  max-width: 18rem;
  justify-content: flex-start;
}
.visual-manuscript-toolbar-host .msv2-format-dropdown .msv2-selector-button { min-width: 8rem; }
.visual-manuscript-toolbar-host .msv2-selector-button [data-document-label],
.visual-manuscript-toolbar-host .msv2-selector-button [data-format-label] {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.msv2-selector-caret { margin-left: auto; font-size: .72rem; opacity: .75; }
.msv2-selector-menu { max-height: min(24rem, 60vh); overflow-y: auto; }
.msv2-selector-menu button.active { font-weight: 800; }
.msv2-paper { position: relative; }
.msv2-layout { position: relative; }
.msv2-word-count {
  position: absolute;
  bottom: 0;
  left: 0;
  z-index: 35;
  width: max-content;
  margin: 0;
  padding: .32rem .72rem .34rem .8rem;
  border-left: 0;
  border-bottom: 0;
  border-radius: 0 .42rem 0 0;
  font-size: .96rem;
  font-weight: 750;
}
.msv2-document-loading {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .65rem;
  background: color-mix(in srgb, var(--surface) 80%, transparent);
  backdrop-filter: blur(1.5px);
  color: var(--ink);
}
.msv2-document-loading[hidden] { display: none; }
.msv2-loading-spinner {
  width: 1.2rem;
  height: 1.2rem;
  border: 2px solid color-mix(in srgb, var(--brand) 28%, transparent);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: msv2-spin .8s linear infinite;
}
@keyframes msv2-spin { to { transform: rotate(360deg); } }
[data-linked-analysis-output="true"] {
  border-radius: .3rem;
  outline: 1px dotted color-mix(in srgb, var(--muted) 58%, transparent);
  outline-offset: 3px;
  transition: background-color .12s ease, box-shadow .12s ease, outline-color .12s ease;
}
[data-linked-analysis-output="true"]:hover {
  background: color-mix(in srgb, var(--brand) 8%, var(--surface));
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand) 24%, transparent);
  outline-color: color-mix(in srgb, var(--brand) 46%, transparent);
}
.msv2-analysis-table > .msv2-node-content { order: 1; margin-bottom: .55rem; }
.msv2-analysis-table > .msv2-node-preview { order: 2; }
.msv2-context-menu {
  position: fixed;
  z-index: 10020;
  display: grid;
  min-width: 20rem;
  padding: .45rem;
  border: 1px solid var(--line);
  border-radius: .72rem;
  background: var(--surface);
  box-shadow: 0 12px 32px rgba(15,23,42,.2);
}
.msv2-context-menu[hidden] { display: none; }
.msv2-context-menu button {
  display: grid;
  grid-template-columns: 1.55rem minmax(0, 1fr) auto;
  align-items: center;
  gap: .65rem;
  width: 100%;
  min-height: 2.65rem;
  padding: .5rem .72rem;
  border: 0;
  border-radius: .42rem;
  background: transparent;
  color: var(--ink);
  text-align: left;
  font-size: .96rem;
  font-weight: 500;
}
.msv2-context-menu button:hover:not(:disabled),
.msv2-context-menu button:focus-visible {
  border-color: transparent;
  background: color-mix(in srgb, var(--ink) 7%, var(--surface));
  color: var(--ink);
  outline: none;
}
.msv2-context-menu button:disabled { opacity: .45; }
.msv2-context-menu hr { width: 100%; margin: .3rem 0; border: 0; border-top: 1px solid var(--line); }
.msv2-context-menu kbd { color: var(--muted); font: inherit; font-size: .86rem; font-weight: 600; white-space: nowrap; }
.msv2-context-menu-icon {
  width: 1.35rem;
  height: 1.35rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: color-mix(in srgb, var(--ink) 82%, transparent);
}
.msv2-context-menu-icon svg {
  width: 1.35rem;
  height: 1.35rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.msv2-context-menu-label { min-width: 0; }
.manuscript-table figcaption { margin: .2em 0 .6em; }
@media (max-width: 700px) {
  .msv2-word-count { margin: 0; }
}

/* v0.16.24 manuscript selection and context-menu refinements */
.msv2-context-menu kbd {
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  color: #667085 !important;
  font-weight: 500;
}
.theme-dark .msv2-context-menu kbd {
  color: #98a2b3 !important;
}
.theme-dark .msv2-analysis-table.msv2-object-selected,
.theme-dark .msv2-analysis-figure.msv2-object-selected,
.theme-dark .msv2-figure.msv2-object-selected,
.theme-dark .msv2-figure-group.msv2-object-selected,
.theme-dark .msv2-figure-panel.msv2-object-selected {
  background: #e5e7eb !important;
  color: #1f2937 !important;
  box-shadow: 0 0 0 2px #cbd5e1 !important;
}
.theme-dark .msv2-analysis-table.msv2-object-selected table,
.theme-dark .msv2-analysis-table.msv2-object-selected th,
.theme-dark .msv2-analysis-table.msv2-object-selected td,
.theme-dark .msv2-analysis-figure.msv2-object-selected .msv2-caption,
.theme-dark .msv2-figure.msv2-object-selected .msv2-caption,
.theme-dark .msv2-figure-group.msv2-object-selected .msv2-caption,
.theme-dark .msv2-figure-panel.msv2-object-selected .msv2-caption {
  color: #1f2937 !important;
}
.topbar .autosave-state {
  flex: 0 0 10.75rem !important;
  width: 10.75rem !important;
  min-width: 10.75rem !important;
  max-width: 10.75rem !important;
  min-height: 1rem;
  color: #667085 !important;
  font-size: .72rem !important;
  font-weight: 400 !important;
  line-height: 1rem !important;
}
.topbar .autosave-state.is-saving,
.topbar .autosave-state.is-unsaved,
.theme-dark .topbar .autosave-state,
.theme-dark .topbar .autosave-state.is-saving,
.theme-dark .topbar .autosave-state.is-unsaved {
  color: #667085 !important;
}
.theme-dark .topbar .autosave-state,
.theme-dark .topbar .autosave-state.is-saving,
.theme-dark .topbar .autosave-state.is-unsaved {
  color: #94a3b8 !important;
}

/* v0.16.26 extraction, analysis-table and manuscript reliability */
body.theme-dark {
  background: #1b2634;
  color: #f4f7fb;
}
.theme-dark {
  --surface: #263548;
  --surface-soft: #304156;
  --line: #566a82;
  --ink: #f5f7fa;
  --muted: #c5d0dd;
  --panel: #263548;
  --text: #f5f7fa;
  color: #f5f7fa;
}
.theme-dark .topbar,
.theme-dark .workspace-card,
.theme-dark .project-sidebar,
.theme-dark .project-column-collapsed,
.theme-dark .card,
.theme-dark .modal-content,
.theme-dark .account-menu,
.theme-dark .app-tabs,
.theme-dark .tab-ribbon,
.theme-dark .tab-content-box,
.theme-dark .card-header,
.theme-dark .pane-header,
.theme-dark .analysis-toolbar {
  background: #263548;
  color: #f5f7fa;
  border-color: #566a82;
}
.theme-dark .surface-soft,
.theme-dark .records-toolbar,
.theme-dark .analysis-section,
.theme-dark .analysis-card,
.theme-dark .config-summary-panel,
.theme-dark .setup-grid,
.theme-dark .llm-panel,
.theme-dark .record-pdf-panel,
.theme-dark .extraction-detail-row td,
.theme-dark .extraction-unit-readonly {
  background: #304156;
  color: #f5f7fa;
  border-color: #60748c;
}
.theme-dark .text-muted,
.theme-dark small.text-muted,
.theme-dark .small.text-muted,
.theme-dark .form-text,
.theme-dark .help-text,
.theme-dark .theme-toggle-state {
  color: #c5d0dd !important;
}
.theme-dark .form-control,
.theme-dark .form-select,
.theme-dark .ribbon-select,
.theme-dark textarea,
.theme-dark input:not([type="checkbox"]):not([type="radio"]) {
  color: #f7f9fc;
  background-color: #1f2c3d;
  border-color: #60748c;
}
.theme-dark .form-control:disabled,
.theme-dark .form-select:disabled,
.theme-dark textarea:disabled,
.theme-dark input:disabled {
  color: #d8e0e9;
  background-color: #34465b;
  opacity: 1;
}
.theme-dark .form-control::placeholder,
.theme-dark input::placeholder,
.theme-dark textarea::placeholder {
  color: #aebccc;
  opacity: 1;
}
.theme-dark .list-group-item,
.theme-dark .project-item,
.theme-dark .record-card,
.theme-dark .placeholder-panel,
.theme-dark .extraction-pdf-card,
.theme-dark .extraction-detail-card,
.theme-dark .extraction-list-pane,
.theme-dark .extraction-setup-list-pane,
.theme-dark .extraction-setup-detail-pane {
  color: #f5f7fa;
  background: #2b3a4e;
  border-color: #566a82;
}
.theme-dark .list-group-item-action:hover,
.theme-dark .project-item:hover {
  color: #ffffff;
  background: #374a61;
}
.theme-dark .extraction-result-item.active,
.theme-dark .list-group-item.active,
.theme-dark .project-item.active {
  color: #ffffff;
  background: #4a3b31;
  border-color: #e08a47;
  box-shadow: inset 3px 0 0 #ff9b54;
}
.theme-dark .extraction-result-item.active .text-muted,
.theme-dark .list-group-item.active .text-muted,
.theme-dark .project-item.active .text-muted {
  color: #eef2f7 !important;
}
.theme-dark .table {
  --bs-table-color: #f5f7fa;
  --bs-table-bg: #2b3a4e;
  --bs-table-border-color: #60748c;
  --bs-table-striped-bg: #304156;
  --bs-table-hover-bg: #3a4d64;
  --bs-table-hover-color: #ffffff;
}
.theme-dark .badge.text-bg-light {
  color: #172033 !important;
  background: #e5eaf0 !important;
}
.theme-dark a:not(.btn) { color: #9ec8ff; }
.theme-dark a:not(.btn):hover { color: #c7e0ff; }

/* The studies rail gives way first. Keep the evidence and data panes side by side
   until the viewport is genuinely too narrow for readable content. */
@media (min-width: 860px) and (max-width: 1320px) {
  .extraction-results-layout.study-list-collapsed {
    display: grid;
    grid-template-columns: 2.65rem minmax(18rem, 1fr) 8px minmax(18rem, var(--extraction-detail-width));
    gap: .55rem;
  }
  .extraction-results-layout.study-list-collapsed.detail-pane-collapsed {
    display: grid;
    grid-template-columns: 2.65rem minmax(18rem, 1fr) 2.65rem;
  }
  .extraction-results-layout.study-list-collapsed .extraction-detail-divider {
    display: block;
  }
  .extraction-results-layout.study-list-collapsed .extraction-pdf-pane,
  .extraction-results-layout.study-list-collapsed .extraction-detail-pane,
  .extraction-results-layout.study-list-collapsed .extraction-detail-collapsed-pane {
    min-width: 0;
    margin-top: 0;
  }
}

/* Main captions are centred by default. Panel subcaptions remain left aligned. */
.msv2-shell[data-caption-alignment="centre"] .msv2-editable-table > .msv2-node-content > .msv2-caption,
.msv2-shell[data-caption-alignment="centre"] .msv2-analysis-table > .msv2-node-content > .msv2-caption,
.msv2-shell[data-caption-alignment="centre"] .msv2-figure > .msv2-node-content > .msv2-caption,
.msv2-shell[data-caption-alignment="centre"] .msv2-analysis-figure > .msv2-node-content > .msv2-caption,
.msv2-shell[data-caption-alignment="centre"] .msv2-figure-group > .msv2-node-content > .msv2-caption {
  width: min(88%, 44rem);
  margin-right: auto;
  margin-left: auto;
  text-align: center;
}
.msv2-shell[data-caption-alignment="left"] .msv2-editable-table > .msv2-node-content > .msv2-caption,
.msv2-shell[data-caption-alignment="left"] .msv2-analysis-table > .msv2-node-content > .msv2-caption,
.msv2-shell[data-caption-alignment="left"] .msv2-figure > .msv2-node-content > .msv2-caption,
.msv2-shell[data-caption-alignment="left"] .msv2-analysis-figure > .msv2-node-content > .msv2-caption,
.msv2-shell[data-caption-alignment="left"] .msv2-figure-group > .msv2-node-content > .msv2-caption {
  width: 100%;
  margin-right: 0;
  margin-left: 0;
  text-align: left;
}
.msv2-shell .msv2-figure-panel .msv2-caption {
  width: 100%;
  margin-right: 0;
  margin-left: 0;
  text-align: left;
}

/* Whole-object selection stays pale and legible even when the surrounding UI is dark. */
.theme-dark .msv2-editable-table.msv2-object-selected,
.theme-dark .msv2-analysis-table.msv2-object-selected,
.theme-dark .msv2-analysis-figure.msv2-object-selected,
.theme-dark .msv2-figure.msv2-object-selected,
.theme-dark .msv2-figure-group.msv2-object-selected,
.theme-dark .msv2-figure-panel.msv2-object-selected {
  background: #e7ebf0 !important;
  color: #1f2937 !important;
  box-shadow: 0 0 0 2px #b8c3d0 !important;
}
.theme-dark .msv2-editable-table.msv2-object-selected > .msv2-node-content,
.theme-dark .msv2-analysis-table.msv2-object-selected > .msv2-node-content,
.theme-dark .msv2-analysis-table.msv2-object-selected > .msv2-node-preview,
.theme-dark .msv2-analysis-figure.msv2-object-selected > .msv2-node-content,
.theme-dark .msv2-analysis-figure.msv2-object-selected > .msv2-node-preview,
.theme-dark .msv2-figure.msv2-object-selected > .msv2-node-content,
.theme-dark .msv2-figure.msv2-object-selected > .msv2-node-preview,
.theme-dark .msv2-figure-group.msv2-object-selected > .msv2-node-content,
.theme-dark .msv2-figure-panel.msv2-object-selected > .msv2-node-content,
.theme-dark .msv2-figure-panel.msv2-object-selected > .msv2-node-preview {
  background: #e7ebf0 !important;
  color: #1f2937 !important;
}
.theme-dark .msv2-editable-table.msv2-object-selected table,
.theme-dark .msv2-analysis-table.msv2-object-selected table,
.theme-dark .msv2-editable-table.msv2-object-selected td,
.theme-dark .msv2-analysis-table.msv2-object-selected td {
  background: #f5f7f9 !important;
  color: #1f2937 !important;
  border-color: #b8c3d0 !important;
}
.theme-dark .msv2-editable-table.msv2-object-selected th,
.theme-dark .msv2-analysis-table.msv2-object-selected th {
  background: #dde3e9 !important;
  color: #172033 !important;
  border-color: #aeb9c6 !important;
}
.theme-dark .msv2-editable-table.msv2-object-selected .msv2-caption,
.theme-dark .msv2-analysis-table.msv2-object-selected .msv2-caption,
.theme-dark .msv2-analysis-figure.msv2-object-selected .msv2-caption,
.theme-dark .msv2-figure.msv2-object-selected .msv2-caption,
.theme-dark .msv2-figure-group.msv2-object-selected .msv2-caption,
.theme-dark .msv2-figure-panel.msv2-object-selected .msv2-caption {
  color: #1f2937 !important;
}
.theme-dark .msv2-analysis-figure.msv2-object-selected img,
.theme-dark .msv2-figure.msv2-object-selected img,
.theme-dark .msv2-figure-group.msv2-object-selected img,
.theme-dark .msv2-figure-panel.msv2-object-selected img {
  background: #f3f5f7 !important;
  opacity: 1 !important;
  filter: none !important;
}

/* v0.16.26 table-output controls and manuscript selection hardening */
.analysis-table-layout-settings {
  border-top: 1px solid var(--line);
  padding-top: 1rem;
}
.analysis-table-layout-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: .5rem;
  align-items: center;
  margin-bottom: .5rem;
}
.analysis-table-layout-removed {
  opacity: .62;
}
.analysis-table-layout-removed input {
  text-decoration: line-through;
}

/* Main captions follow the document preference. Subfigure captions are centred separately. */
.msv2-shell .msv2-figure-panel .msv2-caption {
  width: min(88%, 38rem);
  margin-right: auto;
  margin-left: auto;
  text-align: center;
}

/* A selected table or figure must stay pale and fully legible in dark mode. */
.theme-dark .msv2-prosemirror :is(
  .msv2-editable-table,
  .msv2-analysis-table,
  .msv2-analysis-figure,
  .msv2-figure,
  .msv2-figure-group,
  .msv2-figure-panel
):is(.msv2-object-selected, .ProseMirror-selectednode) {
  color-scheme: light;
  background: #e8edf2 !important;
  color: #172033 !important;
  box-shadow: 0 0 0 2px #aeb9c6 !important;
}
.theme-dark .msv2-prosemirror :is(
  .msv2-editable-table,
  .msv2-analysis-table
):is(.msv2-object-selected, .ProseMirror-selectednode) :is(.msv2-node-content, .msv2-node-preview, .msv2-table-scroll, .tableWrapper, table, tbody, tr, td) {
  background: #f6f8fa !important;
  color: #172033 !important;
  opacity: 1 !important;
  filter: none !important;
}
.theme-dark .msv2-prosemirror :is(
  .msv2-editable-table,
  .msv2-analysis-table
):is(.msv2-object-selected, .ProseMirror-selectednode) th {
  background: #dce3e9 !important;
  color: #101828 !important;
  opacity: 1 !important;
  filter: none !important;
}
.theme-dark .msv2-prosemirror :is(
  .msv2-analysis-figure,
  .msv2-figure,
  .msv2-figure-group,
  .msv2-figure-panel
):is(.msv2-object-selected, .ProseMirror-selectednode) :is(.msv2-node-content, .msv2-node-preview, .msv2-caption, figcaption) {
  background: #e8edf2 !important;
  color: #172033 !important;
  opacity: 1 !important;
  filter: none !important;
}
.theme-dark .msv2-prosemirror :is(
  .msv2-analysis-figure,
  .msv2-figure,
  .msv2-figure-group,
  .msv2-figure-panel
):is(.msv2-object-selected, .ProseMirror-selectednode) img {
  background: #f6f8fa !important;
  opacity: 1 !important;
  filter: none !important;
}

/* v0.16.30 shared collapsible-panel control */
.ms-panel-toggle {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 0;
  margin: 0;
  box-shadow: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.ms-panel-toggle.is-expanded {
  width: 2rem;
  height: 2rem;
  flex: 0 0 2rem;
}
.ms-panel-toggle.is-collapsed {
  width: 100%;
  height: 100%;
  min-height: 0;
  flex: 1 1 auto;
  flex-direction: column;
  justify-content: flex-start;
  gap: .5rem;
  padding: .28rem .12rem;
  border-radius: .55rem;
}
.ms-panel-toggle-icon {
  width: 2rem;
  height: 2rem;
  flex: 0 0 2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: .5rem;
  background: transparent;
  transition: background-color .12s ease, color .12s ease, filter .12s ease;
}
.ms-panel-toggle-icon img,
.ms-panel-toggle-icon svg {
  width: 1rem;
  height: 1rem;
  display: block;
}
.ms-panel-toggle-icon svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.ms-panel-toggle-label {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  transform: rotate(180deg);
  text-transform: uppercase;
  letter-spacing: .12em;
  font-size: .64rem;
  font-weight: 760;
  line-height: 1;
  color: inherit;
  white-space: nowrap;
}
.ms-panel-toggle:hover,
.ms-panel-toggle:focus-visible {
  color: var(--brand-dark);
  outline: none;
}
.ms-panel-toggle:hover .ms-panel-toggle-icon,
.ms-panel-toggle:focus-visible .ms-panel-toggle-icon {
  color: var(--brand);
  background: var(--brand-soft);
}
.ms-panel-toggle:hover .ms-panel-toggle-icon img,
.ms-panel-toggle:focus-visible .ms-panel-toggle-icon img {
  filter: sepia(1) saturate(8) hue-rotate(345deg) brightness(1.05);
}
.project-column-collapsed > .ms-panel-toggle,
.extraction-study-collapsed-pane > .ms-panel-toggle,
.extraction-setup-collapsed-pane > .ms-panel-toggle,
.extraction-detail-collapsed-pane > .ms-panel-toggle {
  width: 100% !important;
  height: 100% !important;
}
.theme-dark .ms-panel-toggle {
  color: #cbd5e1;
}
.theme-dark .ms-panel-toggle:hover,
.theme-dark .ms-panel-toggle:focus-visible {
  color: #ffb37c;
}
.theme-dark .ms-panel-toggle:hover .ms-panel-toggle-icon,
.theme-dark .ms-panel-toggle:focus-visible .ms-panel-toggle-icon {
  background: rgba(255, 107, 0, .18);
  color: #ff9b54;
}
@media (max-width: 760px) {
  .ms-panel-toggle.is-collapsed {
    flex-direction: row;
    justify-content: flex-start;
  }
  .ms-panel-toggle-label {
    writing-mode: horizontal-tb;
    transform: none;
  }
}

/* Summary tables composer */
.predefined-field-search{min-width:260px;max-width:430px;flex:1 1 320px}
.summary-composer{display:flex;flex-direction:column;gap:.75rem;min-width:0}
.summary-composer-toolbar{position:sticky;top:0;z-index:7;display:flex;align-items:center;gap:.45rem;flex-wrap:wrap;padding:.65rem;background:var(--bs-body-bg);border:1px solid var(--bs-border-color);border-radius:.65rem;box-shadow:0 1px 4px rgba(0,0,0,.05)}
.summary-search{min-width:220px;max-width:380px;flex:1 1 260px}
.summary-new-table-drop{position:fixed;left:var(--summary-new-table-left,12px);right:var(--summary-new-table-right,12px);bottom:12px;z-index:1190;display:grid;place-items:center;height:56px;min-height:56px;margin:0;overflow:hidden;border:2px dashed var(--bs-primary);border-radius:.6rem;padding:.55rem;text-align:center;font-size:.86rem;color:var(--bs-primary);opacity:0;visibility:hidden;pointer-events:none;transform:translateY(10px) scale(.995);background:color-mix(in srgb,var(--bs-primary) 8%,var(--bs-body-bg));box-shadow:0 8px 28px rgba(0,0,0,.14);transition:opacity .12s ease,transform .14s ease,visibility 0s linear .14s}
body.summary-sortable-active .summary-new-table-drop{opacity:1;visibility:visible;pointer-events:auto;transform:translateY(0) scale(1);transition-delay:0s}
.summary-new-table-drop-label{pointer-events:none;font-weight:600}
.summary-table-canvas{display:flex;flex-direction:column;gap:.85rem;min-width:0}
.summary-table-card{border:1px solid var(--bs-border-color);border-radius:.7rem;background:var(--bs-body-bg);overflow:clip;box-shadow:0 1px 3px rgba(0,0,0,.04)}
.summary-table-card.summary-table-active{box-shadow:0 0 0 2px color-mix(in srgb,var(--bs-primary) 30%,transparent)}
.summary-table-card-header{display:flex;align-items:center;gap:.55rem;padding:.68rem .75rem;border-bottom:1px solid var(--bs-border-color);background:var(--bs-tertiary-bg)}
.summary-collapse-button{width:1.7rem;height:1.7rem;display:inline-grid;place-items:center;border:0;background:transparent;border-radius:.3rem;color:var(--bs-secondary-color);flex:0 0 auto}
.summary-collapse-button:hover{background:var(--bs-secondary-bg)}
.summary-inline-title,.summary-inline-node-label{border:1px solid transparent;background:transparent;color:inherit;border-radius:.3rem;min-width:0;padding:.18rem .3rem}
.summary-inline-title{font-size:1rem;font-weight:650;width:min(100%,34rem)}
.summary-inline-node-label{flex:1 1 auto;width:auto;font-size:.86rem;line-height:1.35}
.summary-inline-heading{font-weight:650}
.summary-inline-title:hover,.summary-inline-title:focus,.summary-inline-node-label:hover,.summary-inline-node-label:focus{border-color:var(--bs-border-color);background:var(--bs-body-bg);outline:none;box-shadow:0 0 0 .15rem color-mix(in srgb,var(--bs-primary) 18%,transparent)}
body.summary-sortable-active .summary-inline-node-label,body.summary-sortable-active .summary-inline-node-label:hover,body.summary-sortable-active .summary-inline-node-label:focus{pointer-events:none;border-color:transparent!important;background:transparent!important;outline:none!important;box-shadow:none!important}
body.summary-sortable-active .summary-heading-row{background:var(--bs-tertiary-bg)!important;box-shadow:none!important}
body.summary-sortable-active .summary-variable-row:hover{background:var(--bs-body-bg)}
.summary-settings-button{display:inline-grid;place-items:center;width:2rem;height:2rem;border:1px solid transparent;border-radius:.38rem;background:transparent;color:var(--bs-secondary-color);padding:.3rem;flex:0 0 auto}
.summary-settings-button svg{width:1.15rem;height:1.15rem;fill:none;stroke:currentColor;stroke-width:1.45;stroke-linecap:round;stroke-linejoin:round}
.summary-settings-button:hover,.summary-settings-button:focus-visible,.summary-settings-button.active{background:var(--bs-secondary-bg);border-color:var(--bs-border-color);color:var(--bs-body-color);outline:none}
.summary-table-settings-panel{padding:.65rem .75rem;border-bottom:1px solid var(--bs-border-color);background:color-mix(in srgb,var(--bs-tertiary-bg) 62%,var(--bs-body-bg));font-size:.82rem}
.summary-settings-panel-heading{display:flex;align-items:center;justify-content:space-between;gap:1rem}
.summary-settings-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(180px,1fr));gap:.55rem 1rem;padding:.7rem 0 .2rem;align-items:end}
.summary-settings-grid>label:not(.form-check){display:flex;flex-direction:column;gap:.2rem}
.summary-settings-modal .summary-settings-grid{padding:.1rem 0}
.summary-grid-scroll{max-height:min(66vh,780px);overflow:auto;min-width:0;background:var(--bs-body-bg)}
.summary-grid-header,.summary-grid-row{display:grid;align-items:stretch;min-width:max-content}
.summary-grid-header{position:sticky;top:0;z-index:5;background:var(--bs-body-bg);border-bottom:1px solid var(--bs-border-color);font-size:.76rem;font-weight:650;color:var(--bs-secondary-color)}
.summary-grid-header>div{display:flex;align-items:flex-end;padding:.48rem .55rem;white-space:nowrap;border-right:1px solid color-mix(in srgb,var(--bs-border-color) 70%,transparent)}
.summary-grid-header>div:last-child{border-right:0}
.summary-node-list{display:block;min-width:max-content;--summary-depth:0}
.summary-node-list .summary-node-list{--summary-depth:1}
.summary-node-item{position:relative;min-width:max-content;background:var(--bs-body-bg)}
.summary-grid-row{position:relative;border-bottom:1px solid color-mix(in srgb,var(--bs-border-color) 82%,transparent);background:var(--bs-body-bg);transition:transform 165ms cubic-bezier(.2,0,0,1),box-shadow 120ms ease,background-color 120ms ease,opacity 120ms ease}
.summary-grid-row>div{min-width:0;border-right:1px solid color-mix(in srgb,var(--bs-border-color) 64%,transparent)}
.summary-grid-row>div:last-child{border-right:0}
.summary-item-cell{position:relative;display:flex;align-items:center;gap:.18rem;min-height:42px;padding:.34rem .4rem .34rem calc(.35rem + (var(--summary-depth,0) * 1.3rem));white-space:nowrap}
.summary-result-cell{display:flex;align-items:center;justify-content:flex-end;min-height:42px;padding:.38rem .55rem;text-align:right;font-variant-numeric:tabular-nums;white-space:nowrap;font-size:.8rem}
.summary-row-actions{display:flex;align-items:center;justify-content:flex-end;gap:.08rem;min-height:42px;padding:.22rem .35rem;white-space:nowrap;text-align:right}
.summary-row-actions .btn-link{text-decoration:none;font-size:1.1rem;line-height:1;padding:.2rem .35rem}
.summary-drag-handle{display:inline-grid;place-items:center;cursor:grab!important;border:0;background:transparent;color:var(--bs-secondary-color);border-radius:.3rem;width:1.85rem;height:2rem;padding:.2rem;touch-action:none;flex:0 0 auto;transition:background-color 120ms ease,color 120ms ease}
.summary-drag-handle svg{width:.75rem;height:1.15rem;fill:currentColor}
.summary-drag-handle:hover{background:var(--bs-secondary-bg);color:var(--bs-body-color)}
.summary-drag-handle:active,.summary-sortable-chosen .summary-drag-handle,body.summary-sortable-active .summary-drag-handle{cursor:grabbing!important}
.summary-drag-handle:focus-visible{outline:2px solid var(--bs-primary);outline-offset:1px}
.summary-heading-row{background:var(--bs-tertiary-bg);isolation:isolate}
.summary-heading-row .summary-item-cell{font-weight:650}
.summary-heading-result-spacer{min-height:42px;background:transparent}
.summary-variable-row:hover{background:color-mix(in srgb,var(--bs-primary) 3%,var(--bs-body-bg))}
.summary-delete-row-button{display:inline-grid;place-items:center;width:1.75rem;height:1.75rem;padding:.2rem;border:0;border-radius:.3rem;background:transparent;color:var(--bs-secondary-color)}
.summary-delete-row-button svg{width:1rem;height:1rem;fill:none;stroke:currentColor;stroke-width:1.4;stroke-linecap:round;stroke-linejoin:round}
.summary-delete-row-button:hover,.summary-delete-row-button:focus-visible{background:color-mix(in srgb,var(--bs-danger) 12%,transparent);color:var(--bs-danger);outline:none}
.summary-empty-nest{display:flex;align-items:center;justify-content:flex-start;min-height:0;max-height:0;overflow:hidden;padding:0 calc(.65rem + (var(--summary-depth,0) * 1.3rem));border:0 dashed transparent;color:var(--bs-secondary-color);font-size:.74rem;opacity:0;transition:min-height 140ms ease,max-height 140ms ease,padding 140ms ease,opacity 120ms ease,border-color 120ms ease}
body.summary-sortable-active .summary-node-list-empty[data-summary-parent-id=""]>.summary-empty-nest{min-height:42px;max-height:42px;padding:.45rem calc(.65rem + (var(--summary-depth,0) * 1.3rem));border-bottom:1px dashed var(--bs-primary);opacity:1;background:color-mix(in srgb,var(--bs-primary) 5%,var(--bs-body-bg))}
.summary-heading-children.summary-node-list-empty>.summary-empty-nest{display:none}
.summary-split-slot{position:relative;height:0;z-index:3;min-width:max-content}
.summary-split-control{position:absolute;left:50%;top:0;transform:translate(-50%,-50%) scale(.96);display:flex;align-items:center;gap:.25rem;max-width:180px;white-space:nowrap;border:1px solid var(--bs-primary);border-radius:999px;padding:.12rem .48rem;background:var(--bs-body-bg);color:var(--bs-primary);font-size:.69rem;font-weight:600;opacity:0;pointer-events:none;box-shadow:0 1px 4px rgba(0,0,0,.12);transition:opacity 100ms ease,transform 100ms ease}
.summary-split-slot:hover .summary-split-control,.summary-split-control:focus-visible{opacity:1;pointer-events:auto;transform:translate(-50%,-50%) scale(1);outline:none}
body.summary-sortable-active .summary-split-control{opacity:0!important;pointer-events:none!important}
.summary-split-slot::before{content:"";position:absolute;inset:-8px 0;height:16px}
.summary-sortable-ghost{opacity:.2!important;background:color-mix(in srgb,var(--bs-primary) 10%,var(--bs-body-bg))!important}
.summary-sortable-ghost>.summary-grid-row{box-shadow:inset 0 0 0 1px var(--bs-primary);background:color-mix(in srgb,var(--bs-primary) 8%,var(--bs-body-bg))}
.summary-sortable-chosen>.summary-grid-row{box-shadow:0 7px 24px rgba(0,0,0,.16);background:var(--bs-body-bg)}
.summary-sortable-dragging-item,.summary-sortable-fallback{z-index:1100!important;opacity:.96!important;box-shadow:0 12px 34px rgba(0,0,0,.22)!important;border-radius:.45rem!important;overflow:hidden!important;background:var(--bs-body-bg)!important;pointer-events:none!important}
.summary-sortable-dragging-item>.summary-grid-row,.summary-sortable-fallback>.summary-grid-row{border:1px solid color-mix(in srgb,var(--bs-primary) 60%,var(--bs-border-color));box-shadow:none;background:var(--bs-body-bg)}
.summary-sortable-fallback>.summary-node-list{max-height:170px;overflow:hidden;opacity:.92}
.summary-sortable-chosen>.summary-grid-row,.summary-sortable-ghost>.summary-grid-row{will-change:transform}
body.summary-sortable-settling .summary-node-item,body.summary-sortable-settling .summary-grid-row,body.summary-sortable-settling .summary-node-list,body.summary-sortable-settling .summary-table-card{transition:none!important;animation:none!important;scroll-behavior:auto!important}
.summary-empty-table-set{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:.5rem;min-height:180px;padding:1.25rem;border:1px dashed var(--bs-border-color);border-radius:.65rem;text-align:center;color:var(--bs-secondary-color);background:var(--bs-tertiary-bg)}
.summary-empty-table-set strong{color:var(--bs-body-color)}
.summary-available-drawer{border:1px solid var(--bs-border-color);border-radius:.65rem;background:var(--bs-body-bg)}
.summary-available-drawer>summary{cursor:pointer;padding:.65rem .75rem;font-weight:600}
.summary-available-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(220px,1fr));gap:.5rem;padding:0 .75rem .75rem}
.summary-available-variable{display:flex;flex-direction:column;gap:.15rem;text-align:left;border:1px solid var(--bs-border-color);border-radius:.45rem;background:var(--bs-body-bg);padding:.55rem .65rem;color:inherit}
.summary-available-variable:hover{background:var(--bs-tertiary-bg);border-color:var(--bs-primary)}
.summary-available-variable span{font-size:.72rem;color:var(--bs-secondary-color)}

/* v0.16.38 compact composer header and always-open variable palette */
.summary-table-card{overflow:visible}
.summary-table-card-header.summary-grid-header{position:relative;top:auto;z-index:6;display:grid;align-items:stretch;gap:0;padding:0;border-bottom:1px solid var(--bs-border-color);border-radius:.7rem .7rem 0 0;background:var(--bs-tertiary-bg);font-size:.76rem;font-weight:650;color:var(--bs-secondary-color)}
.summary-table-card-header.summary-grid-header>div{display:flex;align-items:center;min-height:48px;padding:.38rem .48rem;border-right:1px solid color-mix(in srgb,var(--bs-border-color) 70%,transparent)}
.summary-table-card-header.summary-grid-header>div:last-child{border-right:0}
.summary-table-title-cell{gap:.35rem;min-width:0}
.summary-table-title-cell .summary-inline-title{width:100%;max-width:none;font-size:.96rem;color:var(--bs-body-color)}
.summary-table-column-heading{justify-content:flex-start;white-space:nowrap}
.summary-table-menu-cell{justify-content:center;padding:.25rem!important;overflow:visible}
.summary-table-menu-cell>.dropdown{position:relative}
.summary-table-action-menu{min-width:15rem;max-width:calc(100vw - 16px);max-height:calc(100vh - 16px);overflow:auto;z-index:1085}
.summary-grid-scroll{border-radius:0 0 .7rem .7rem}
.summary-row-actions{justify-content:center;padding:.2rem}
.summary-row-actions .dropdown{display:none!important}
.summary-available-drawer{overflow:hidden}
.summary-available-header{display:flex;align-items:center;gap:.45rem;padding:.62rem .75rem;border-bottom:1px solid var(--bs-border-color);background:var(--bs-tertiary-bg)}
.summary-available-list{display:block;min-width:0;max-height:min(42vh,520px);overflow:auto;--summary-depth:0}
.summary-available-variable-item{min-width:0}
.summary-available-variable-row{display:grid;grid-template-columns:2.35rem minmax(180px,1fr) auto 2.25rem;align-items:center;gap:.35rem;min-height:44px;padding:.25rem .45rem;border-bottom:1px solid color-mix(in srgb,var(--bs-border-color) 78%,transparent);background:var(--bs-body-bg)}
.summary-available-variable-item:last-of-type .summary-available-variable-row{border-bottom:0}
.summary-available-variable-row:hover{background:color-mix(in srgb,var(--bs-primary) 3%,var(--bs-body-bg))}
.summary-available-variable-copy{display:flex;min-width:0;flex-direction:column;gap:.08rem}
.summary-available-variable-copy strong{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:.84rem}
.summary-available-variable-copy span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:.7rem;color:var(--bs-secondary-color)}
.summary-variable-usage{white-space:nowrap;font-size:.7rem;color:var(--bs-secondary-color)}
.summary-variable-usage.is-used{color:var(--bs-primary)}
.summary-available-add-button{display:inline-grid;place-items:center;width:1.75rem;height:1.75rem;border:1px solid transparent;border-radius:.32rem;background:transparent;color:var(--bs-secondary-color);font-size:1rem;line-height:1}
.summary-available-add-button:hover,.summary-available-add-button:focus-visible{border-color:var(--bs-border-color);background:var(--bs-secondary-bg);color:var(--bs-body-color);outline:none}
.summary-sortable-fallback>.summary-available-variable-row,.summary-sortable-dragging-item>.summary-available-variable-row{min-width:420px;border:1px solid color-mix(in srgb,var(--bs-primary) 60%,var(--bs-border-color));background:var(--bs-body-bg)}
@media (prefers-reduced-motion:reduce){
  .summary-grid-row,.summary-new-table-drop,.summary-empty-nest,.summary-split-control{transition:none!important}
}
@media (max-width:900px){
  .summary-composer-toolbar{position:static}
  .summary-table-card-header.summary-grid-header{min-width:920px}
  .summary-available-variable-row{grid-template-columns:2.35rem minmax(150px,1fr) 2.25rem}
  .summary-variable-usage{display:none}
  .summary-grid-scroll{max-height:none}
}

/* v0.16.44 hover-only smart-summary presentation */
.msv2-smart-summary-boundary {
  display: inline-block;
  width: 0;
  height: 1em;
  overflow: hidden;
  pointer-events: none;
  vertical-align: text-bottom;
}
.msv2-smart-summary-range {
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: inherit;
  text-decoration: none;
}
.msv2-smart-summary-group-host {
  position: relative;
}
.msv2-smart-summary-hover-layer {
  position: absolute;
  inset: 0;
  z-index: 2;
  overflow: visible;
  pointer-events: none;
}
.msv2-smart-summary-hover-rect {
  position: absolute;
  border-radius: 2px;
  background: rgba(107, 114, 128, .105);
  pointer-events: none;
}
.msv2-smart-summary-group-bar {
  position: absolute;
  z-index: 3;
  width: 3px;
  min-height: 1.15em;
  border-radius: 999px;
  background: rgba(107, 114, 128, .58);
  pointer-events: none;
}
.msv2-smart-summary-group-bar[hidden] {
  display: none;
}
::highlight(msv2-smart-summary-hover) {
  background: rgba(107, 114, 128, .105);
}
.msv2-smart-summary-inspector small {
  display: block;
  margin: .25rem 0 .5rem;
}
.msv2-smart-summary-inspector > div {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
}
/* v0.16.49 focused analysis and top-bar polish */
.account-menu-trigger {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  flex-flow: row nowrap !important;
  gap: .32rem;
  width: auto !important;
  min-width: max-content;
  white-space: nowrap !important;
  line-height: 1.2;
}
.account-menu-trigger > span,
.account-menu-caret { white-space: nowrap !important; flex: 0 0 auto; }
.analysis-component-list {
  display: grid;
  gap: .55rem;
}
.analysis-component-option {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: .7rem;
  padding: .8rem .9rem;
  border: 1px solid var(--bs-border-color);
  border-radius: .7rem;
  background: var(--bs-body-bg);
  cursor: pointer;
}
.analysis-component-option:hover { background: var(--bs-tertiary-bg); }
.analysis-component-option.is-required { background: var(--bs-tertiary-bg); cursor: default; }
.analysis-component-option .form-check-input { margin-top: .22rem; }
.analysis-component-copy { display: grid; gap: .18rem; min-width: 0; }
.analysis-component-copy > span:last-child { color: var(--bs-secondary-color); font-size: .875rem; }
.analysis-component-title { display: flex; align-items: center; flex-wrap: wrap; gap: .4rem; }
.analysis-component-title .badge { font-weight: 500; }
.account-menu-wrap {
  flex: 0 0 auto;
  white-space: nowrap;
}

/* Reusable table structure editor */
.table-structure-editor .table-structure-entry{grid-template-columns:32px minmax(180px,1fr) auto;align-items:center}
.table-structure-drag-handle{width:28px;height:30px;cursor:grab}
.table-structure-drag-handle:active{cursor:grabbing}
.table-structure-entry[draggable="true"]{transition:background-color .12s ease,opacity .12s ease}
.table-structure-entry[draggable="true"]:hover{background:var(--bs-tertiary-bg)}

/* v0.16.55 free-structure analysis tables */
.table-structure-heading-entry {
  background: var(--bs-tertiary-bg);
  border-left: 3px solid var(--bs-secondary-color);
  padding-left: .35rem;
}
.table-structure-heading-entry input {
  font-weight: 600;
}
.analysis-table-heading-row > td {
  background: var(--bs-tertiary-bg) !important;
  border-top: 1px solid var(--bs-border-color);
  border-bottom: 1px solid var(--bs-border-color);
  padding-top: .45rem;
  padding-bottom: .45rem;
}

/* v0.16.55: the Summary tables free-structure editor is reused inline for analysis tables. */
.analysis-inline-table-editor-wrap {
  padding: .9rem;
  overflow: auto;
}
.analysis-free-structure-editor {
  display: grid;
  gap: .75rem;
  min-width: max-content;
}
.analysis-free-structure-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  min-width: min(100%, 720px);
}
.analysis-free-table-card {
  min-width: max-content;
  overflow: visible;
}
.analysis-free-table-card .summary-node-list {
  min-width: 100%;
}
.analysis-free-column-editor {
  display: grid;
  gap: .45rem;
  padding: .8rem;
  border: 1px solid var(--bs-border-color);
  border-radius: .65rem;
  background: var(--bs-body-bg);
  min-width: min(100%, 720px);
}
.analysis-free-hidden-rows {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .4rem;
  padding: .55rem .7rem;
  border: 1px dashed var(--bs-border-color);
  border-radius: .55rem;
  min-width: min(100%, 720px);
}
.analysis-free-table-card .summary-node-item[draggable="true"] {
  cursor: default;
}
.analysis-free-table-card .summary-node-item[draggable="true"] .summary-drag-handle {
  cursor: grab;
}
.analysis-free-table-card .summary-node-item[draggable="true"] .summary-drag-handle:active {
  cursor: grabbing;
}
@media (max-width: 900px) {
  .analysis-free-structure-toolbar { align-items: stretch; flex-direction: column; }
}

/* v0.16.56: compact table layout prioritises fitting ordinary tables without horizontal scrolling. */
.analysis-inline-table-editor-wrap {
  overflow-x: hidden;
}
.analysis-free-structure-editor,
.analysis-free-table-card,
.analysis-free-table-card .summary-node-list,
.analysis-free-table-card .summary-node-item,
.analysis-free-table-card .summary-grid-row,
.analysis-free-table-card .summary-grid-header {
  min-width: 0;
  width: 100%;
}
.analysis-free-table-card {
  overflow: hidden;
}
.analysis-free-table-card .summary-grid-header > div,
.analysis-free-table-card .summary-grid-row > div {
  min-width: 0;
  padding-left: .38rem;
  padding-right: .38rem;
}
.analysis-free-table-card .summary-table-column-heading {
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.12;
}
.analysis-free-table-card .summary-result-cell {
  min-width: 0;
  font-size: .88rem;
  line-height: 1.18;
  white-space: normal;
  overflow-wrap: anywhere;
}
.analysis-free-table-card .summary-item-cell {
  min-width: 0;
}
.analysis-free-table-card .summary-inline-node-label {
  min-width: 0;
  width: 100%;
  text-overflow: ellipsis;
}
.analysis-free-table-card .summary-row-actions {
  width: 38px;
}
@media (max-width: 1100px) {
  .analysis-inline-table-editor-wrap { overflow-x: auto; }
  .analysis-free-table-card { min-width: 900px; overflow: visible; }
}

/* v0.16.60 title-bar save state and analysis-only heading continuity */
.topbar .autosave-state {
  flex: 0 1 auto !important;
  width: auto !important;
  min-width: 0 !important;
  max-width: 11rem !important;
  margin-left: .32rem;
  margin-right: .08rem;
}
.analysis-free-table-card .analysis-heading-has-rows > .summary-grid-row {
  border-bottom-color: transparent;
}
.analysis-free-table-card .analysis-row-under-heading .summary-item-cell {
  padding-left: 1.35rem;
}
body.analysis-sortable-active .analysis-free-table-card .summary-node-item,
body.analysis-sortable-active .analysis-free-table-card .summary-grid-row {
  will-change: transform;
}

/* v0.16.61 consolidated controls and workspace stability */
.extraction-editor {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.extraction-tabs-row {
  flex: 0 0 auto;
  min-height: 2.1rem;
  margin-bottom: .5rem !important;
}
.extraction-setup-subtab {
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}
.extraction-setup-subtab.extraction-setup-layout,
.extraction-setup-subtab > .extraction-setup-layout,
.rob-design-panel > .extraction-setup-layout {
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
}
.rob-design-panel {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
}
.extraction-setup-list-pane,
.extraction-setup-detail-pane {
  scrollbar-gutter: stable;
}
.extraction-setup-divider {
  width: 10px;
  min-width: 10px;
}

.extraction-study-toolbar-group {
  flex: 1 1 22rem;
  min-width: min(22rem, 38vw);
  max-width: 42vw;
}
.extraction-study-toolbar-group .extraction-study-navigator {
  flex: 1 1 auto;
  padding: .12rem .3rem;
}
.extraction-study-toolbar-group .extraction-study-reference {
  max-width: min(22rem, 30vw);
}

.extraction-values-compact-table tbody tr.extraction-value-row.selected,
.extraction-values-compact-table tbody tr.extraction-detail-row.selected,
.extraction-values-compact-table tbody tr.extraction-value-row.selected > td,
.extraction-values-compact-table tbody tr.extraction-detail-row.selected > td {
  border-inline-start-color: var(--bs-border-color) !important;
  box-shadow: none !important;
  outline: 0 !important;
}
.extraction-values-compact-table tbody tr.extraction-value-row.selected::before,
.extraction-values-compact-table tbody tr.extraction-value-row.selected::after,
.extraction-values-compact-table tbody tr.extraction-detail-row.selected::before,
.extraction-values-compact-table tbody tr.extraction-detail-row.selected::after {
  display: none !important;
  content: none !important;
}

.analysis-list-item {
  display: flex;
  align-items: center;
  gap: .4rem;
  cursor: pointer;
}
.analysis-list-copy {
  flex: 1 1 auto;
  min-width: 0;
}
.analysis-list-delete {
  flex: 0 0 auto;
  width: 1.8rem;
  height: 1.8rem;
  min-height: 1.8rem !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: .25rem !important;
  border: 0 !important;
  border-radius: .42rem !important;
  background: transparent !important;
  color: var(--muted) !important;
  opacity: .72;
}
.analysis-list-delete svg {
  width: 1rem;
  height: 1rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.analysis-list-delete:hover,
.analysis-list-delete:focus-visible {
  background: color-mix(in srgb, var(--bs-danger) 10%, transparent) !important;
  color: var(--bs-danger) !important;
  opacity: 1;
}

.extraction-unmapped-notes {
  padding: .8rem;
  border: 1px solid var(--bs-border-color);
  border-radius: .65rem;
  background: var(--bs-tertiary-bg);
}
.extraction-unmapped-study {
  padding: .55rem 0;
  border-top: 1px solid var(--bs-border-color);
}
.extraction-unmapped-study:first-of-type { border-top: 0; }
.extraction-unmapped-study > summary { cursor: pointer; }
.extraction-unmapped-note-item {
  padding: .55rem .65rem;
  border: 1px solid var(--bs-border-color);
  border-radius: .5rem;
  background: var(--bs-body-bg);
}
.extraction-unmapped-note-item + .extraction-unmapped-note-item { margin-top: .45rem; }
.settings-extraction-panel { min-height: 26rem; }

.visual-manuscript-toolbar-host .ribbon-dropdown.msv2-dropdown-open .ribbon-dropdown-menu {
  display: grid;
}
.msv2-linked-update-banner {
  flex: 0 0 auto;
  padding: .55rem .85rem;
  border-top: 0;
  border-right: 0;
  border-left: 0;
  border-radius: 0;
  font-size: .82rem;
}
.msv2-sidebar-fold [data-panel-fold-title] {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  transform: rotate(180deg);
  text-transform: uppercase;
  letter-spacing: .12em;
  font-size: .64rem;
  font-weight: 760;
  line-height: 1;
  color: inherit;
  white-space: nowrap;
}

/* v0.16.62 extraction setup bundles */
.characteristic-setup-bundle .characteristic-bundle-components {
  opacity: .78;
}
.characteristic-setup-bundle.active .characteristic-bundle-components {
  opacity: .9;
}
.characteristic-bundle-readonly-list code {
  overflow-wrap: anywhere;
}
.characteristic-component-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: .5rem;
  align-items: end;
}
.characteristic-component-grid-single {
  grid-template-columns: minmax(180px, 1fr);
}
.characteristic-component-field {
  min-width: 0;
}
.predefined-field-option.partial {
  border-style: dashed;
}

/* v0.16.63: compact title-bar actions, durable record-import progress and unified table controls. */
.topbar-icon-button,
.undo-topbar-button.topbar-icon-button {
  width: 2rem;
  min-width: 2rem;
  height: 2rem;
  padding: .3rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.topbar-icon-button svg {
  width: 1.15rem;
  height: 1.15rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.status-card.status-card-complete .progress-bar { width: 100%; }
.status-card.status-card-failed .progress-bar { background: var(--bs-danger); }
.analysis-list-delete.is-disabled,
.analysis-list-delete:disabled {
  opacity: .32;
  cursor: not-allowed;
}
.analysis-list-delete.is-disabled:hover,
.analysis-list-delete.is-disabled:focus-visible,
.analysis-list-delete:disabled:hover,
.analysis-list-delete:disabled:focus-visible {
  background: transparent !important;
  color: var(--muted) !important;
}
.table-structure-delete-button {
  flex: 0 0 auto;
  margin-inline: .1rem;
}
.analysis-table-layout-row .summary-delete-row-button {
  width: 1.8rem;
  height: 1.8rem;
}

/* v0.16.72-v0.16.73: global administration workspace and follow-up fixes */
.admin-topbar-button {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  min-height: 2rem;
  padding: .28rem .6rem;
  font-weight: 650;
}
.admin-topbar-button svg {
  width: 1.05rem;
  height: 1.05rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.administrative-access-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .62rem .9rem;
  background: #eef5ff;
  border-bottom: 1px solid #bdd4ff;
  color: #173b75;
  font-size: .86rem;
}
.administrative-project-entry { min-height: 4.6rem; }

.administration-workspace {
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 1rem 1.25rem 2rem;
  background: var(--surface-soft);
  color: var(--ink);
}
.administration-header,
.admin-section-heading,
.admin-dialog > header,
.admin-dialog > footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.administration-header {
  padding: .25rem 0 .85rem;
}
.administration-header h1 { margin: 0; font-size: 1.45rem; }
.administration-header p { margin: .15rem 0 0; color: var(--muted); font-size: .88rem; }
.administration-tabs {
  display: flex;
  gap: .25rem;
  margin-bottom: 1rem;
  padding: .3rem;
  border: 1px solid var(--line);
  border-radius: .8rem;
  background: var(--surface);
}
.administration-tabs button {
  appearance: none;
  min-width: 7rem;
  padding: .5rem .85rem;
  border: 0;
  border-radius: .58rem;
  background: transparent;
  color: var(--muted);
  font-weight: 650;
}
.administration-tabs button:hover { background: var(--surface-soft); color: var(--ink); }
.administration-tabs button.active { background: var(--brand); color: #fff; }
.admin-alert { margin: 0 0 .75rem; }
.admin-busy {
  position: fixed;
  z-index: 1080;
  right: 1.25rem;
  bottom: 1.25rem;
  padding: .45rem .72rem;
  border-radius: 999px;
  background: #172033;
  color: #fff;
  box-shadow: 0 8px 24px rgba(15,23,42,.2);
  font-size: .82rem;
}
.administration-content { min-width: 0; }
.admin-section,
.admin-subsection {
  border: 1px solid var(--line);
  border-radius: .9rem;
  background: var(--surface);
  box-shadow: 0 5px 18px rgba(15,23,42,.04);
}
.admin-section { padding: 1rem; }
.admin-subsection { padding: 1rem; }
.admin-subsection + .admin-subsection { margin-top: 1rem; }
.admin-section-heading { margin-bottom: .85rem; }
.admin-section-heading h2 { margin: 0; font-size: 1.06rem; }
.admin-section-heading span { display: block; margin-top: .12rem; color: var(--muted); font-size: .78rem; }
.admin-filters {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(170px, .45fr) auto auto;
  gap: .65rem;
  align-items: center;
  margin-bottom: .85rem;
}
.admin-check {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  margin: 0;
}
.admin-check .form-check-input { margin: 0; flex: 0 0 auto; }
.admin-table-wrap {
  width: 100%;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: .7rem;
}
.admin-table {
  width: 100%;
  min-width: 820px;
  border-collapse: collapse;
  font-size: .83rem;
}
.admin-table th,
.admin-table td {
  padding: .58rem .65rem;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  text-align: left;
}
.admin-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: .71rem;
  text-transform: uppercase;
  letter-spacing: .035em;
  white-space: nowrap;
}
.admin-table tbody tr:last-child td { border-bottom: 0; }
.admin-table td > strong,
.admin-table td > span { display: block; }
.admin-table td code { color: inherit; font-size: .76rem; overflow-wrap: anywhere; }
.admin-clickable-row { cursor: pointer; }
.admin-clickable-row:hover,
.admin-clickable-row.selected { background: color-mix(in srgb, var(--brand) 7%, var(--surface)); }
.admin-empty { padding: 1.4rem !important; text-align: center !important; color: var(--muted); }
.admin-badge {
  display: inline-flex !important;
  width: max-content;
  padding: .18rem .42rem;
  border-radius: 999px;
  background: #eef2f7;
  color: #475569;
  font-size: .7rem;
  font-weight: 700;
  white-space: nowrap;
}
.admin-badge-primary { background: #e7efff; color: #1e4a9d; }
.admin-badge-success { background: #e6f7ec; color: #176237; }
.admin-badge-warning { background: #fff3ce; color: #7c5200; }
.admin-badge-danger { background: #fde8e8; color: #9b1c1c; }
.admin-badge-muted { background: #eef0f3; color: #687386; }
.admin-action-trigger {
  width: 2rem;
  height: 2rem;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: .5rem;
  background: var(--surface);
  color: inherit;
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
}
.admin-action-trigger:hover,
.admin-action-trigger[aria-expanded="true"] { background: var(--surface-soft); }
.admin-action-menu-popover {
  position: fixed;
  z-index: 1060;
  width: 14rem;
  max-height: calc(100vh - 1rem);
  overflow: auto;
  padding: .3rem;
  border: 1px solid var(--line);
  border-radius: .65rem;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 12px 30px rgba(15,23,42,.18);
}
.admin-action-menu-popover button {
  display: block;
  width: 100%;
  padding: .45rem .55rem;
  border: 0;
  border-radius: .4rem;
  background: transparent;
  color: inherit;
  text-align: left;
  font-size: .8rem;
}
.admin-action-menu-popover button:hover,
.admin-action-menu-popover button:focus-visible {
  background: var(--surface-soft);
  outline: none;
}
.admin-action-menu-popover button.danger { color: var(--bs-danger); }
.admin-actions { position: relative; width: max-content; }
.admin-actions summary {
  list-style: none;
  width: 2rem;
  height: 2rem;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: .5rem;
  cursor: pointer;
  font-size: 1.1rem;
}
.admin-actions summary::-webkit-details-marker { display: none; }
.admin-actions > div {
  position: absolute;
  z-index: 20;
  right: 0;
  top: calc(100% + .25rem);
  min-width: 13rem;
  padding: .3rem;
  border: 1px solid var(--line);
  border-radius: .65rem;
  background: var(--surface);
  box-shadow: 0 12px 30px rgba(15,23,42,.16);
}
.admin-actions button {
  display: block;
  width: 100%;
  padding: .45rem .55rem;
  border: 0;
  border-radius: .4rem;
  background: transparent;
  color: inherit;
  text-align: left;
  font-size: .8rem;
}
.admin-actions button:hover { background: var(--surface-soft); }
.admin-actions button.danger { color: var(--bs-danger); }
.admin-pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: .7rem;
  margin-top: .7rem;
  color: var(--muted);
  font-size: .8rem;
}
.admin-button-row { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .4rem; }
.admin-file-panel { scroll-margin-top: 5rem; }
.admin-file-select-cell {
  width: 1%;
  min-width: 5.5rem;
  text-align: center !important;
  white-space: nowrap;
}
.admin-file-select-cell .form-check-input { margin: 0; }
.admin-protected-file {
  display: inline-block !important;
  color: var(--muted);
  font-size: .68rem;
  font-weight: 600;
}
.admin-app-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, .72fr); gap: 1rem; }
.admin-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem; }
.admin-form-grid label > span { display: block; margin-bottom: .3rem; font-size: .78rem; font-weight: 650; }
.admin-form-grid label small { display: block; margin-top: .25rem; color: var(--muted); }
.admin-form-wide { grid-column: 1 / -1; }
.admin-system-list { margin: 0; }
.admin-system-list > div { display: flex; justify-content: space-between; gap: 1rem; padding: .48rem 0; border-bottom: 1px solid var(--line); }
.admin-system-list > div:last-child { border-bottom: 0; }
.admin-system-list dt { color: var(--muted); font-weight: 550; }
.admin-system-list dd { margin: 0; text-align: right; font-weight: 650; overflow-wrap: anywhere; }
.admin-member-add { display: grid; grid-template-columns: minmax(220px, 1fr) 160px auto; gap: .55rem; margin-top: .75rem; }

.admin-overlay {
  position: fixed;
  z-index: 1070;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(15,23,42,.48);
}
.admin-dialog {
  width: min(640px, 100%);
  max-height: calc(100vh - 2rem);
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: .9rem;
  background: var(--surface);
  box-shadow: 0 20px 60px rgba(15,23,42,.25);
}
.admin-dialog-large { width: min(820px, 100%); }
.admin-dialog-drawer {
  position: fixed;
  right: 0;
  top: 57px;
  bottom: 0;
  width: min(760px, 96vw);
  max-height: none;
  border-radius: .9rem 0 0 .9rem;
}
.admin-dialog > header,
.admin-dialog > footer { padding: .85rem 1rem; flex: 0 0 auto; }
.admin-dialog > header { border-bottom: 1px solid var(--line); }
.admin-dialog > footer { border-top: 1px solid var(--line); justify-content: flex-end; }
.admin-dialog > header h2 { margin: 0; font-size: 1.1rem; }
.admin-dialog-body { padding: 1rem; overflow: auto; }
.admin-danger-card {
  display: grid;
  gap: .35rem;
  margin: .65rem 0;
  padding: .75rem;
  border: 1px solid #f1b9b9;
  border-radius: .65rem;
  background: #fff5f5;
}

.theme-dark .administration-workspace { background: #111827; }
.theme-dark .administration-tabs,
.theme-dark .admin-section,
.theme-dark .admin-subsection,
.theme-dark .admin-dialog,
.theme-dark .admin-action-menu-popover,
.theme-dark .admin-actions > div { background: #1e293b; border-color: #3b4659; }
.theme-dark .admin-table-wrap,
.theme-dark .admin-table th,
.theme-dark .admin-table td,
.theme-dark .admin-system-list > div,
.theme-dark .admin-dialog > header,
.theme-dark .admin-dialog > footer { border-color: #3b4659; }
.theme-dark .admin-table th { background: #172033; }
.theme-dark .administration-tabs button:hover,
.theme-dark .admin-action-trigger:hover,
.theme-dark .admin-action-trigger[aria-expanded="true"],
.theme-dark .admin-action-menu-popover button:hover,
.theme-dark .admin-action-menu-popover button:focus-visible,
.theme-dark .admin-actions button:hover { background: #29364b; }
.theme-dark .administrative-access-banner { background: #172a47; border-color: #31547f; color: #dbeafe; }
.theme-dark .admin-danger-card { background: #3b2025; border-color: #7f3b45; }
.theme-dark .admin-badge { filter: brightness(.88); }

@media (max-width: 900px) {
  .administration-workspace { padding: .75rem; }
  .admin-filters,
  .admin-app-grid,
  .admin-form-grid { grid-template-columns: 1fr; }
  .admin-form-wide { grid-column: auto; }
  .administration-tabs { overflow-x: auto; }
  .administration-tabs button { min-width: 6rem; }
  .admin-member-add { grid-template-columns: 1fr; }
  .administrative-access-banner,
  .administration-header,
  .admin-section-heading { align-items: flex-start; flex-direction: column; }
}
