html[data-theme="mofi"] {
  --font-sans: "Metropolis", Arial, Helvetica, sans-serif;
  --ink: #000000;
  --ink-strong: #002c71;
  --muted: #627fa0;
  --muted-strong: #002c71;
  --line: #c9d6f4;
  --line-strong: #c9d6f4;
  --surface: #ffffff;
  --surface-subtle: #f4f6f8;
  --surface-hover: #f4f6f8;
  --accent: #2858d3;
  --accent-hover: #002c71;
  --success: #16794a;
  --warning: #8a560f;
  --danger: #b42318;
  --shadow: 0 12px 28px rgba(0, 44, 113, 0.16);
  font-family: var(--font-sans);
}

html[data-theme="mofi"] body,
html[data-theme="mofi"] body *,
html[data-theme="mofi"] button,
html[data-theme="mofi"] input,
html[data-theme="mofi"] select,
html[data-theme="mofi"] textarea,
html[data-theme="mofi"] code,
html[data-theme="mofi"] pre {
  font-family: var(--font-sans) !important;
}

html[data-theme="mofi"] .brand-mark {
  background: #2858d3;
}

.mofi-brand-block {
  min-width: 0;
}

html[data-theme="mofi"] button:not([class]) {
  min-height: 28px;
  padding: 5px 9px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  color: var(--ink-strong);
  background: #ffffff;
  cursor: pointer;
}

html[data-theme="mofi"] button:not([class]):hover {
  border-color: var(--accent);
  background: #ffffff;
}

html[data-theme="mofi"] button:not([class]):disabled {
  opacity: 0.52;
  cursor: not-allowed;
}

/* Keep the primary tables usable beside the AI panel at the demo width. */
.mofi-rules-table,
.mofi-all-rules-table,
.mofi-funder-rules-table,
.mofi-review-table,
.mofi-files-table {
  min-width: 0;
  table-layout: fixed;
}

.mofi-rules-table th[data-column-key] {
  min-width: 0;
}

.mofi-rules-table th[data-column-key="status"] { width: 9%; }
.mofi-rules-table th[data-column-key="review"] { width: 11%; }
.mofi-rules-table th[data-column-key="funder"] { width: 14%; }
.mofi-rules-table th[data-column-key="rule"] { width: 15%; }
.mofi-rules-table th[data-column-key="current"] { width: 10%; }
.mofi-rules-table th[data-column-key="required"] { width: 10%; }
.mofi-rules-table th[data-column-key="room_left"] { width: 8%; }
.mofi-rules-table th[data-column-key="next_date"] { width: 8%; }
.mofi-rules-table th[data-column-key="if_broken"] { width: 8%; }
.mofi-rules-table th[data-column-key="source"] { min-width: 0; width: 7%; }

.mofi-funders-table .mofi-row-button,
.mofi-funders-table .mofi-cell-secondary,
.mofi-files-table .mofi-file-name,
.mofi-files-table .mofi-file-funder-link {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

html[data-theme="mofi"] .brand-name,
html[data-theme="mofi"] .assistant-title-row h1,
html[data-theme="mofi"] .view-toolbar h1,
html[data-theme="mofi"] .drawer-header h2 {
  color: #002c71;
}

html[data-theme="mofi"] a {
  color: #2858d3;
}

html[data-theme="mofi"] a:hover {
  color: #002c71;
}

.mofi-app-shell .workspace-pane {
  grid-template-columns: 220px minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
}

.mofi-app-shell .workspace-pane.is-sidebar-collapsed {
  grid-template-columns: 56px minmax(0, 1fr);
}

.mofi-app-shell .workspace-content {
  grid-column: 2;
}

.mofi-app-shell .app-sidebar .workspace-tab.is-active {
  color: var(--accent);
  background: #eef3fc;
  font-weight: 700;
}

.mofi-view {
  overflow: hidden;
}

.mofi-page-shell {
  display: flex;
  flex-direction: column;
  gap: 16px;
  height: 100%;
  min-height: 0;
  padding: 18px 22px;
  overflow: hidden;
}

.mofi-view-toolbar {
  flex: 0 0 auto;
  min-height: 48px;
  padding: 0;
}

.mofi-view-toolbar h1,
.mofi-view-toolbar p {
  margin: 0;
}

.mofi-view-toolbar h1 {
  font-size: 22px;
}

.mofi-filter-grid {
  display: grid;
  flex: 0 0 auto;
  grid-template-columns: repeat(4, minmax(112px, 1fr)) minmax(150px, 1.35fr) auto;
  gap: 8px;
  align-items: end;
}

.mofi-filter-grid label {
  display: grid;
  min-width: 0;
  gap: 4px;
  color: var(--muted);
  font-size: 10px;
}

.mofi-filter-grid select,
.mofi-filter-grid input {
  width: 100%;
  min-width: 0;
  height: 34px;
  padding: 0 8px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  color: var(--ink);
  background: #ffffff;
  font-size: 11px;
}

.mofi-filter-grid select:focus,
.mofi-filter-grid input:focus {
  border-color: var(--accent);
  outline: 0;
  box-shadow: 0 0 0 2px rgba(40, 88, 211, 0.12);
}

.mofi-clear-filters {
  height: 34px;
}

.mofi-rules-table-scroll,
.mofi-funders-table-scroll,
.mofi-certificates-table-scroll,
.mofi-certificate-table-scroll,
.mofi-review-table-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.mofi-rules-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
  font-size: 11px;
}

.mofi-rules-table th,
.mofi-rules-table td {
  padding: 9px 8px;
}

.mofi-all-rules-table {
  min-width: 980px;
  font-size: 9px;
  line-height: 1.3;
}

.mofi-all-rules-table th,
.mofi-all-rules-table td {
  padding: 7px 5px;
  overflow-wrap: anywhere;
  white-space: normal;
  vertical-align: top;
}

.mofi-rules-table th small {
  display: block;
  margin-top: 2px;
  color: #d6e1ff;
  font-size: 8px;
  font-weight: 400;
  white-space: normal;
}

.mofi-rules-table,
.mofi-all-rules-table,
.mofi-funder-rules-table,
.mofi-review-table {
  min-width: 980px;
  table-layout: auto;
}

.mofi-rules-table th,
.mofi-all-rules-table th,
.mofi-funder-rules-table th,
.mofi-review-table th {
  width: auto;
}

.mofi-rules-table th[data-column-key="status"] { min-width: 112px; }
.mofi-rules-table th[data-column-key="confidence"] { min-width: 112px; }
.mofi-rules-table th[data-column-key="review"] { min-width: 145px; }
.mofi-rules-table th[data-column-key="funder"] { min-width: 145px; }
.mofi-rules-table th[data-column-key="rule"] { min-width: 180px; }
.mofi-rules-table th[data-column-key="kind"] { min-width: 170px; }
.mofi-rules-table th[data-column-key="rule_type"] { min-width: 110px; }
.mofi-rules-table th[data-column-key="current"] { min-width: 135px; }
.mofi-rules-table th[data-column-key="required"] { min-width: 150px; }
.mofi-rules-table th[data-column-key="room_left"] { min-width: 120px; }
.mofi-rules-table th[data-column-key="cadence"] { min-width: 120px; }
.mofi-rules-table th[data-column-key="next_date"] { min-width: 105px; }
.mofi-rules-table th[data-column-key="owner"] { min-width: 110px; }
.mofi-rules-table th[data-column-key="if_broken"] { min-width: 185px; }
.mofi-rules-table th[data-column-key="source"] { min-width: 105px; }
.mofi-rules-table th[data-column-key="last_reviewed_by"] { min-width: 125px; }

.mofi-all-rules-table .mofi-status {
  min-height: 18px;
  padding: 2px 5px;
  font-size: 8px;
}

.mofi-all-rules-table .mofi-cell-secondary {
  font-size: 8px;
}

.mofi-rule-value,
.mofi-rule-room,
.mofi-consequence-button {
  display: block;
  color: var(--ink);
  line-height: 1.35;
  overflow-wrap: anywhere;
  white-space: normal;
}

.mofi-rule-value,
.mofi-rule-room {
  font-weight: 600;
}

.mofi-consequence-button {
  width: 100%;
  padding: 0;
  border: 0;
  color: var(--accent);
  background: transparent;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.mofi-consequence-button:hover,
.mofi-consequence-button:focus-visible {
  color: var(--accent-hover);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.mofi-all-rules-table .mofi-consequence-button {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.mofi-all-rules-table td {
  overflow: hidden;
}

.mofi-all-rules-table .mofi-money-nowrap {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: bottom;
  white-space: nowrap;
}

.mofi-money-nowrap {
  white-space: nowrap;
}

html[data-theme="mofi"] .data-table th {
  border-color: #002c71;
  color: #ffffff;
  background: #002c71;
  overflow-wrap: anywhere;
  white-space: normal;
}

html[data-theme="mofi"] .data-table tbody tr:hover td {
  background: #f4f6f8;
}

.mofi-sort-button {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  max-width: 100%;
  padding: 0;
  border: 0;
  color: inherit;
  background: transparent;
  font: inherit;
  text-align: left;
  overflow-wrap: anywhere;
  white-space: normal;
  cursor: pointer;
}

.mofi-sort-button:focus-visible {
  border-radius: 2px;
  outline: 2px solid #d6e1ff;
  outline-offset: 2px;
}

.mofi-sort-indicator {
  display: inline-block;
  flex: 0 0 10px;
  width: 10px;
  color: #d6e1ff;
  text-align: center;
}

.mofi-sort-button:not(.is-active):hover .mofi-sort-indicator::after,
.mofi-sort-button:not(.is-active):focus-visible .mofi-sort-indicator::after {
  content: "\2195";
  opacity: 0.65;
}

.mofi-rule-row,
.mofi-funder-row,
.mofi-file-row,
.mofi-certificate-row,
.mofi-review-row {
  cursor: pointer;
}

.mofi-rule-row:focus,
.mofi-funder-row:focus,
.mofi-file-row:focus,
.mofi-certificate-row:focus,
.mofi-review-row:focus {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.mofi-cell-primary,
.mofi-cell-secondary {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mofi-cell-primary {
  color: var(--ink-strong);
  font-weight: 600;
}

.mofi-cell-secondary {
  margin-top: 2px;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.35;
}

.mofi-rule-status-reason {
  max-width: 32rem;
  white-space: normal;
}

.mofi-json-record {
  margin: 0;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.mofi-facility {
  overflow-wrap: anywhere;
  white-space: normal;
}

.approval-value.mofi-facility {
  color: var(--muted-strong);
  font-size: 10px;
  line-height: 1.35;
}

.mofi-clamp-two {
  display: -webkit-box;
  white-space: normal;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.mofi-source-button,
.mofi-row-button,
.mofi-text-button {
  padding: 0;
  border: 0;
  color: var(--accent);
  background: transparent;
  font: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.mofi-source-button:hover,
.mofi-row-button:hover,
.mofi-text-button:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

.mofi-rules-table .mofi-source-button {
  display: block;
  max-width: 100%;
  overflow-wrap: anywhere;
  white-space: normal;
}

.mofi-status {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  min-height: 22px;
  padding: 3px 7px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  color: var(--muted-strong);
  background: #ffffff;
  font-size: 9px;
  font-weight: 700;
  line-height: 1.2;
  white-space: normal;
}

.mofi-status.is-breach {
  border-color: #f3b5b0;
  color: #8f1e16;
  background: #fff1f0;
}

.mofi-status.is-broken {
  border-color: #f3b5b0;
  color: #8f1e16;
  background: #fff1f0;
}

.mofi-status.is-watch {
  border-color: #edcf98;
  color: #754309;
  background: #fff7e8;
}

.mofi-status.is-at-risk {
  border-color: #edcf98;
  color: #754309;
  background: #fff7e8;
}

.mofi-status.is-pass {
  border-color: #9ed6b9;
  color: #0d633c;
  background: #eefbf4;
}

.mofi-status.is-met {
  border-color: #9ed6b9;
  color: #0d633c;
  background: #eefbf4;
}

.mofi-status.is-approved {
  border-color: #9ed6b9;
  color: #0d633c;
  background: #eefbf4;
}

.mofi-status.is-new-needs-approval {
  border-color: #edcf98;
  color: #754309;
  background: #fff7e8;
}

.mofi-status.is-needs-review {
  border-color: #bfc6d0;
  color: #475467;
  background: #f2f4f7;
}

.mofi-status.is-not-tested-yet {
  color: #52667e;
  background: #f8fafc;
}

.mofi-status.is-not-checked-yet {
  color: #52667e;
  background: #f8fafc;
}

.mofi-review-state {
  display: inline-block;
  color: var(--muted-strong);
  font-size: 9px;
  font-weight: 700;
  line-height: 1.35;
}

.mofi-review-state.is-check-this {
  color: #8f1e16;
}

.mofi-review-state.is-new {
  color: #754309;
}

.mofi-review-state.is-rejected {
  color: #8f1e16;
}

.mofi-funders-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
  font-size: 11px;
}

.mofi-funders-table th:nth-child(1) { width: 22%; }
.mofi-funders-table th:nth-child(2) { width: 10%; }
.mofi-funders-table th:nth-child(3) { width: 9%; }
.mofi-funders-table th:nth-child(4) { width: 9%; }
.mofi-funders-table th:nth-child(5) { width: 9%; }
.mofi-funders-table th:nth-child(6) { width: 13%; }
.mofi-funders-table th:nth-child(7) { width: 28%; }

.mofi-funders-table td {
  white-space: normal;
}

.mofi-files-main {
  width: 100%;
}

.mofi-files-toolbar p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.mofi-files-filters {
  grid-template-columns: minmax(160px, 1.4fr) repeat(5, minmax(104px, 1fr)) auto;
}

.mofi-files-table-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.mofi-files-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
  font-size: 11px;
}

html[data-theme="mofi"] .mofi-files-table-scroll > table.mofi-files-table {
  width: 0;
  min-width: 100%;
  max-width: 100%;
}

.mofi-files-table th:nth-child(1) { width: 24%; }
.mofi-files-table th:nth-child(2) { width: 18%; }
.mofi-files-table th:nth-child(3) { width: 13%; }
.mofi-files-table th:nth-child(4) { width: 13%; }
.mofi-files-table th:nth-child(5) { width: 10%; }
.mofi-files-table th:nth-child(6) { width: 12%; }
.mofi-files-table th:nth-child(9) { width: 10%; }

.mofi-files-table th,
.mofi-files-table td {
  height: auto;
  padding: 9px 8px;
  overflow-wrap: anywhere;
  white-space: normal;
}

.mofi-files-table .mofi-file-name {
  display: block;
  width: 100%;
  overflow-wrap: anywhere;
  white-space: normal;
}

.mofi-file-filename {
  display: block;
  margin-top: 3px;
  overflow-wrap: anywhere;
}

.mofi-file-funder-link {
  color: var(--accent);
  text-decoration: none;
  overflow-wrap: anywhere;
  white-space: normal;
}

.mofi-file-funder-link:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

.mofi-file-rule-count {
  text-align: right;
}

.mofi-agreement-status {
  color: var(--muted-strong);
  font-weight: 700;
  white-space: nowrap;
}

.mofi-agreement-status.is-active {
  color: var(--success);
}

.mofi-file-rule-link {
  display: inline-block;
  min-width: 24px;
  text-align: right;
}

@media (max-width: 1400px) {
  .mofi-files-table th:nth-child(6),
  .mofi-files-table td:nth-child(6) {
    display: none;
  }

  .mofi-files-table th:nth-child(1) { width: 30%; }
  .mofi-files-table th:nth-child(2) { width: 22%; }
  .mofi-files-table th:nth-child(3) { width: 15%; }
  .mofi-files-table th:nth-child(4) { width: 13%; }
  .mofi-files-table th:nth-child(5) { width: 10%; }
  .mofi-files-table th:nth-child(9) { width: 10%; }
}

.mofi-file-drawer {
  z-index: 8;
  grid-template-rows: auto auto minmax(0, 1fr);
}

.mofi-file-drawer > .mofi-reviewer-section {
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
}

.mofi-file-drawer .detail-list {
  grid-template-columns: 104px minmax(0, 1fr);
}

.mofi-file-drawer .detail-list dd {
  min-width: 0;
  overflow-wrap: anywhere;
}

.mofi-record-fields {
  align-items: start;
}

.mofi-record-json {
  max-width: 100%;
  margin: 0;
  overflow: auto;
  color: var(--ink);
  font: inherit;
  white-space: pre-wrap;
}

.mofi-funders-index,
.mofi-funder-detail {
  display: flex;
  min-height: 0;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 16px;
}

.mofi-funders-index[hidden],
.mofi-funder-detail[hidden] {
  display: none;
}

.mofi-funder-detail {
  padding-right: 2px;
  overflow-y: auto;
}

.mofi-funder-detail-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.mofi-funder-detail-toolbar .back-button {
  margin-bottom: 8px;
}

.mofi-funder-detail-toolbar p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.mofi-funder-detail-toolbar .mofi-detail-facility,
.mofi-certificate-toolbar .mofi-detail-facility {
  color: var(--muted-strong);
  font-size: 10px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.mofi-funder-detail-toolbar .mofi-detail-facility[hidden],
.mofi-certificate-toolbar .mofi-detail-facility[hidden] {
  display: none;
}

.mofi-funder-detail-toolbar .mofi-salesforce-status {
  margin-top: 7px;
  font-size: 10px;
}

.mofi-funder-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 14px;
  padding-top: 30px;
  font-size: 11px;
}

.mofi-funder-actions .mofi-text-button:disabled {
  color: var(--muted);
  cursor: wait;
  text-decoration: none;
}

.mofi-funder-section {
  display: flex;
  flex: 0 0 auto;
  min-height: 0;
  flex-direction: column;
  gap: 8px;
}

.mofi-funder-section h2 {
  margin: 0;
  color: var(--ink-strong);
  font-size: 13px;
}

.mofi-funder-table-scroll,
.mofi-funder-rules-table-scroll {
  max-height: 280px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.mofi-funder-rules-table-scroll {
  max-height: 340px;
}

.mofi-funder-contacts-table,
.mofi-funder-activity-table {
  width: 100%;
  min-width: 620px;
  table-layout: fixed;
  font-size: 11px;
}

.mofi-funder-contacts-table th:nth-child(1) { width: 24%; }
.mofi-funder-contacts-table th:nth-child(2) { width: 27%; }
.mofi-funder-contacts-table th:nth-child(3) { width: 29%; }
.mofi-funder-contacts-table th:nth-child(4) { width: 20%; }

.mofi-funder-activity-table th:nth-child(1) { width: 16%; }
.mofi-funder-activity-table th:nth-child(2) { width: 44%; }
.mofi-funder-activity-table th:nth-child(3) { width: 18%; }
.mofi-funder-activity-table th:nth-child(4) { width: 22%; }

.mofi-funder-contacts-table td,
.mofi-funder-activity-table td,
.mofi-funder-certificate-table td {
  white-space: normal;
  overflow-wrap: anywhere;
}

.mofi-funder-rules-table {
  min-width: 0;
}

.mofi-crm-empty {
  display: block;
  padding: 4px 0;
  color: var(--muted);
  font-size: 11px;
}

.mofi-document-lines {
  display: block;
  color: var(--muted-strong);
  font-size: 10px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.mofi-certificate-index,
.mofi-certificate-detail {
  display: flex;
  min-height: 0;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 16px;
}

.mofi-certificate-index[hidden],
.mofi-certificate-detail[hidden],
.mofi-certificate-notes[hidden] {
  display: none;
}

.mofi-certificate-index .mofi-view-toolbar p,
.mofi-certificate-detail .mofi-view-toolbar p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.mofi-certificates-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
  font-size: 11px;
}

.mofi-certificates-table th:nth-child(1) { width: 18%; }
.mofi-certificates-table th:nth-child(2) { width: 22%; }
.mofi-certificates-table th:nth-child(3) { width: 13%; }
.mofi-certificates-table th:nth-child(4) { width: 11%; }
.mofi-certificates-table th:nth-child(5) { width: 21%; }
.mofi-certificates-table th:nth-child(6) { width: 15%; }

.mofi-certificates-table td {
  white-space: normal;
  overflow-wrap: anywhere;
}

.mofi-certificate-state {
  color: var(--ink-strong);
  font-weight: 600;
  line-height: 1.4;
}

.mofi-cfo-review {
  color: var(--muted-strong);
  font-size: 10px;
  line-height: 1.4;
}

.mofi-certificate-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.mofi-certificate-toolbar > div:first-child {
  flex: 1 1 100%;
  min-width: 0;
}

.mofi-certificate-toolbar .mofi-toolbar-actions {
  flex: 1 1 100%;
  flex-wrap: wrap;
  min-width: 0;
}

.mofi-certificate-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  margin: 20px 0;
}

.mofi-certificate-tabs a {
  padding: 6px 0;
}

.mofi-toolbar-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
}

.mofi-columns-control {
  position: relative;
}

.mofi-columns-menu {
  position: absolute;
  z-index: 30;
  top: calc(100% + 6px);
  right: 0;
  width: 292px;
  max-height: min(520px, calc(100vh - 150px));
  padding: 10px;
  overflow: auto;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.mofi-columns-menu[hidden] {
  display: none;
}

.mofi-columns-menu-title {
  margin-bottom: 7px;
  color: var(--ink-strong);
  font-size: 11px;
  font-weight: 700;
}

.mofi-columns-list {
  display: grid;
  gap: 2px;
}

.mofi-column-choice {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 29px;
  padding: 3px 4px;
  border-radius: 5px;
}

.mofi-column-choice:hover {
  background: var(--surface-hover);
}

.mofi-column-choice label {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  color: var(--ink);
  font-size: 10px;
}

.mofi-column-choice label small {
  color: var(--muted);
  font-size: 8px;
  font-weight: 400;
}

.mofi-column-order {
  display: inline-flex;
  gap: 2px;
}

.mofi-column-order button,
.mofi-columns-reset {
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--muted-strong);
  background: #ffffff;
  font-size: 10px;
  cursor: pointer;
}

.mofi-column-order button {
  width: 24px;
  height: 23px;
  padding: 0;
}

.mofi-column-order button:disabled {
  opacity: 0.35;
  cursor: default;
}

.mofi-columns-reset {
  width: 100%;
  margin-top: 8px;
  padding: 7px 8px;
}

.mofi-review-filter-grid {
  display: grid;
  flex: 0 0 auto;
  grid-template-columns: repeat(3, minmax(130px, 1fr)) auto;
  gap: 8px;
  align-items: end;
}

.mofi-review-filter-grid label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 10px;
}

.mofi-review-filter-grid select {
  width: 100%;
  height: 34px;
  padding: 0 8px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  color: var(--ink);
  background: #ffffff;
  font-size: 11px;
}

.mofi-certificate-table {
  min-width: 700px;
  table-layout: fixed;
  font-size: 11px;
}

.mofi-certificate-table th:nth-child(1) { width: 26%; }
.mofi-certificate-table th:nth-child(2) { width: 22%; }
.mofi-certificate-table th:nth-child(3) { width: 15%; }
.mofi-certificate-table th:nth-child(4) { width: 22%; }
.mofi-certificate-table th:nth-child(5) { width: 15%; }

.mofi-certificate-notes {
  display: flex;
  flex: 0 0 auto;
  min-height: 0;
  flex-direction: column;
  gap: 8px;
}

.mofi-certificate-notes h2 {
  margin: 0;
  color: var(--ink-strong);
  font-size: 13px;
}

.mofi-certificate-notes-scroll {
  max-height: 190px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.mofi-certificate-notes-table {
  width: 100%;
  min-width: 700px;
  table-layout: fixed;
  font-size: 10px;
}

.mofi-certificate-notes-table th:nth-child(1) { width: 36%; }
.mofi-certificate-notes-table th:nth-child(2) { width: 18%; }
.mofi-certificate-notes-table th:nth-child(3) { width: 28%; }
.mofi-certificate-notes-table th:nth-child(4) { width: 18%; }

.mofi-certificate-notes-table td {
  white-space: normal;
  overflow-wrap: anywhere;
  vertical-align: top;
}

.mofi-approval-receipt {
  flex: 0 0 auto;
  padding: 10px 12px;
  border: 1px solid #9ed6b9;
  border-radius: 7px;
  color: #0d633c;
  background: #eefbf4;
  font-size: 11px;
}

.mofi-review-table {
  width: 100%;
  min-width: 700px;
  table-layout: fixed;
  font-size: 11px;
}

.mofi-review-table td {
  white-space: normal;
}

.mofi-drawer-scrim {
  position: absolute;
  z-index: 18;
  inset: 0;
  background: rgba(0, 22, 56, 0.2);
}

.mofi-rule-drawer {
  position: absolute;
  z-index: 19;
  top: 0;
  right: 0;
  bottom: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(520px, 92%);
  overflow: hidden;
  border-left: 1px solid var(--line-strong);
  background: #ffffff;
  box-shadow: -10px 0 28px rgba(0, 44, 113, 0.16);
}

.mofi-rule-drawer-body {
  min-height: 0;
  padding: 0 19px 34px;
  overflow: auto;
}

.mofi-detail-section {
  padding: 17px 0;
  border-bottom: 1px solid var(--line);
}

.mofi-detail-section:last-child {
  border-bottom: 0;
}

.mofi-detail-section h3,
.mofi-detail-section h4,
.mofi-detail-section p {
  margin-top: 0;
}

.mofi-detail-section h3 {
  margin-bottom: 10px;
  color: var(--ink-strong);
  font-size: 13px;
}

.mofi-rule-lede {
  color: var(--ink-strong);
  font-size: 14px;
  line-height: 1.5;
}

.mofi-stand-summary {
  display: grid;
  gap: 9px;
}

.mofi-stand-summary .mofi-rule-lede {
  margin-bottom: 0;
}

.mofi-status-review-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
  margin: 0;
}

.mofi-status-review-grid > div {
  display: grid;
  gap: 4px;
}

.mofi-status-review-grid dt {
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
}

.mofi-status-review-grid dd {
  margin: 0;
}

.mofi-where-stand-detail {
  margin: 0;
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.45;
}

.mofi-stand-line {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 7px 12px;
  margin: 0;
  color: var(--ink);
  font-size: 11px;
  line-height: 1.45;
}

.mofi-stand-line strong {
  color: var(--ink-strong);
}

.mofi-current-calculation {
  display: grid;
  gap: 3px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.mofi-calculation-label {
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
}

.mofi-formula {
  margin-bottom: 13px;
  color: var(--ink-strong);
  font-size: 12px;
  line-height: 1.6;
}

.mofi-current-expression {
  margin: 0;
  font-size: 11px;
}

.mofi-formula-input {
  display: inline;
  padding: 0 2px;
  border: 0;
  border-bottom: 1px solid currentColor;
  color: var(--accent);
  background: transparent;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.mofi-formula-input:hover,
.mofi-formula-input:focus-visible {
  color: var(--accent-hover);
  background: #eef3fc;
  outline: none;
}

.mofi-definition-list,
.mofi-consequence-list {
  display: grid;
  gap: 10px;
  margin: 0;
}

.mofi-definition,
.mofi-consequence-fact {
  display: grid;
  gap: 4px;
}

.mofi-definition dt,
.mofi-definition dd,
.mofi-consequence-fact dt,
.mofi-consequence-fact dd {
  margin: 0;
}

.mofi-definition dt,
.mofi-consequence-fact dt {
  color: var(--ink-strong);
  font-size: 11px;
  font-weight: 700;
}

.mofi-definition dd,
.mofi-consequence-fact dd {
  color: var(--muted-strong);
  font-size: 10px;
  line-height: 1.5;
}

.mofi-consequence-linked-rules {
  display: grid;
  gap: 6px;
  margin-top: 12px;
}

.mofi-consequence-linked-rules h4,
.mofi-consequence-linked-rules ul {
  margin: 0;
}

.mofi-consequence-linked-rules h4 {
  color: var(--ink-strong);
  font-size: 11px;
}

.mofi-consequence-linked-rules ul {
  display: grid;
  gap: 7px;
  padding: 0;
  list-style: none;
}

.mofi-consequence-linked-rules li {
  display: grid;
  gap: 2px;
}

.mofi-linked-rule-button {
  justify-self: start;
  padding: 0;
  text-align: left;
}

.mofi-consequence-linked-rules li span {
  color: var(--muted-strong);
  font-size: 9px;
}

.mofi-citation-link {
  display: inline-block;
  padding: 0;
  border: 0;
  color: var(--accent);
  background: transparent;
  font: inherit;
  font-size: 9px;
  text-align: left;
  cursor: pointer;
}

.mofi-citation-link:hover,
.mofi-citation-link:focus-visible {
  color: var(--accent-hover);
  text-decoration: underline;
}

.mofi-trend-wrap {
  display: grid;
  gap: 5px;
}

.mofi-trend-chart {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.mofi-trend-axis {
  stroke: #c9d6f4;
  stroke-width: 1;
}

.mofi-trend-limit {
  stroke: #b42318;
  stroke-width: 1.5;
  stroke-dasharray: 5 4;
}

.mofi-trend-value {
  fill: none;
  stroke: #2858d3;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mofi-trend-point {
  fill: #ffffff;
  stroke: #2858d3;
  stroke-width: 2;
}

.mofi-trend-chart text {
  fill: var(--muted);
  font-size: 8px;
}

.mofi-trend-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin: 0;
  color: var(--muted);
  font-size: 9px;
}

.mofi-trend-key::before {
  display: inline-block;
  width: 14px;
  margin-right: 5px;
  border-top: 2px solid #2858d3;
  vertical-align: middle;
  content: "";
}

.mofi-trend-key.is-limit::before {
  border-color: #b42318;
  border-top-style: dashed;
}

.mofi-action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.mofi-action-row button {
  min-height: 31px;
  padding: 6px 9px;
  font-size: 10px;
}

.mofi-action-help {
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.45;
}

.mofi-rule-action-dialog {
  width: min(570px, calc(100vw - 32px));
  max-width: 570px;
}

.mofi-rule-action-dialog form {
  display: block;
}

.mofi-rule-action-body {
  display: grid;
  gap: 13px;
  padding: 18px;
}

.mofi-rule-action-body > p {
  margin: 0;
  color: var(--muted-strong);
  font-size: 11px;
  line-height: 1.5;
}

.mofi-rule-action-body label {
  display: grid;
  gap: 5px;
  color: var(--muted-strong);
  font-size: 10px;
  font-weight: 600;
}

.mofi-rule-action-body input,
.mofi-rule-action-body select,
.mofi-rule-action-body textarea {
  width: 100%;
  min-width: 0;
  padding: 8px 9px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  color: var(--ink);
  background: #ffffff;
  font-size: 11px;
  font-weight: 400;
}

.mofi-rule-action-body input,
.mofi-rule-action-body select {
  height: 36px;
}

.mofi-rule-action-body textarea {
  min-height: 110px;
  resize: vertical;
}

.mofi-rule-action-cite {
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted-strong);
  background: #ffffff;
  font-size: 10px;
  line-height: 1.5;
}

.mofi-draft-copy {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.mofi-draft-copy textarea {
  width: 100%;
  min-height: 96px;
  padding: 8px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  color: var(--ink);
  background: #ffffff;
  font-size: 10px;
  line-height: 1.5;
  resize: vertical;
}

.mofi-draft-copy button {
  justify-self: start;
}

.mofi-detail-grid {
  display: grid;
  grid-template-columns: 105px minmax(0, 1fr);
  gap: 7px 12px;
  margin: 0;
  font-size: 11px;
}

.mofi-detail-grid dt {
  color: var(--muted);
}

.mofi-detail-grid dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
}

.mofi-cite-quote {
  margin: 11px 0;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted-strong);
  background: #ffffff;
  font-size: 11px;
  line-height: 1.55;
}

.mofi-detail-table-scroll {
  max-width: 100%;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.mofi-amendment-table,
.mofi-history-table {
  width: 100%;
  table-layout: fixed;
  font-size: 10px;
}

.mofi-amendment-table { min-width: 620px; }
.mofi-amendment-table th:nth-child(1) { width: 15%; }
.mofi-amendment-table th:nth-child(2) { width: 22%; }
.mofi-amendment-table th:nth-child(3) { width: 28%; }
.mofi-amendment-table th:nth-child(4) { width: 35%; }

.mofi-history-table { min-width: 760px; }
.mofi-history-table th:nth-child(1) { width: 12%; }
.mofi-history-table th:nth-child(2) { width: 13%; }
.mofi-history-table th:nth-child(3) { width: 23%; }
.mofi-history-table th:nth-child(4) { width: 17%; }
.mofi-history-table th:nth-child(5) { width: 15%; }
.mofi-history-table th:nth-child(6) { width: 20%; }

.mofi-amendment-table td,
.mofi-history-table td {
  white-space: normal;
  overflow-wrap: anywhere;
  vertical-align: top;
}

.mofi-review-history {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.mofi-review-history li {
  display: grid;
  gap: 3px;
  padding: 9px 0;
  border-top: 1px solid var(--line);
  font-size: 10px;
}

.mofi-review-history li:first-child {
  border-top: 0;
}

.mofi-review-history time {
  color: var(--muted);
}

.mofi-amendment-gap-list {
  margin: 0;
  padding-left: 1.25rem;
}

.mofi-amendment-gap-list > li {
  border-top: 1px solid var(--border-color, #d8dde6);
  padding: 0.85rem 0;
}

.mofi-amendment-gap-list > li:first-child {
  border-top: 0;
}

.mofi-amendment-gap-list blockquote {
  margin: 0.55rem 0;
}

.mofi-amendment-gap-list small,
.mofi-gap-resolution {
  display: block;
  margin-top: 0.35rem;
}

.mofi-gap-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.65rem;
}

.mofi-document-chain-table tr.is-gap td {
  background: color-mix(in srgb, var(--warning, #b7791f) 9%, transparent);
  font-weight: 600;
}

.mofi-rule-history-gap {
  border-block: 1px solid var(--border-color, #d8dde6);
  margin: 1rem 0;
  padding: 1rem 0;
}

.mofi-input-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.mofi-input-list li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 9px;
  padding: 7px 0;
  border-top: 1px solid var(--line);
  font-size: 10px;
}

.mofi-document-body {
  padding: 28px 34px 70px;
}

.mofi-document-viewer {
  z-index: 20;
  grid-template-rows: auto auto minmax(0, 1fr);
}

.mofi-document-viewer > .mofi-reviewer-section {
  padding: 12px 34px;
  border-bottom: 1px solid var(--line);
}

.mofi-document-body.is-pdf {
  padding: 0;
  overflow: hidden;
}

.mofi-document-paper {
  max-width: 850px;
  margin: 0 auto;
  color: var(--ink);
  font-size: 12px;
  line-height: 1.75;
  white-space: pre-wrap;
}

.mofi-document-paper mark {
  padding: 2px 0;
  color: #000000;
  background: #fff29a;
  box-shadow: 0 0 0 3px #fff29a;
}

.mofi-workbook-preview {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
}

.mofi-workbook-cite,
.mofi-workbook-note {
  color: var(--muted-strong);
  font-size: 11px;
}

.mofi-workbook-tabs {
  display: flex;
  gap: 5px;
  margin: 0 0 14px;
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
}

.mofi-workbook-tabs button {
  flex: 0 0 auto;
  padding: 7px 10px;
  border: 0;
  border-bottom: 2px solid transparent;
  color: var(--muted-strong);
  background: transparent;
  font: inherit;
  cursor: pointer;
}

.mofi-workbook-tabs button.is-active {
  border-bottom-color: var(--accent);
  color: var(--accent);
  font-weight: 700;
}

.mofi-workbook-preview h3 {
  margin: 0 0 9px;
  color: var(--ink-strong);
  font-size: 13px;
}

.mofi-workbook-table-scroll {
  max-width: 100%;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.mofi-workbook-table {
  border-collapse: collapse;
  color: var(--ink);
  background: #ffffff;
  font-size: 10px;
  white-space: nowrap;
}

.mofi-workbook-table td {
  min-width: 80px;
  max-width: 260px;
  padding: 6px 8px;
  overflow: hidden;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  text-overflow: ellipsis;
}

.mofi-workbook-table .mofi-workbook-row-number {
  position: sticky;
  left: 0;
  z-index: 1;
  min-width: 38px;
  padding: 6px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  background: var(--surface-subtle);
  font-weight: 400;
  text-align: center;
}

.mofi-workbook-table td.is-cited-cell,
.mofi-workbook-table td#source-cell {
  position: relative;
  z-index: 2;
  color: var(--ink-strong);
  background: #fff3a6;
  box-shadow: inset 0 0 0 2px var(--accent);
  scroll-margin: 64px;
}

.mofi-workbook-table tr.is-cited-row {
  scroll-margin: 64px;
}

.mofi-workbook-table tr.is-cited-row > .mofi-workbook-row-number,
.mofi-workbook-table tr.is-cited-row > td {
  color: var(--ink-strong);
  background: #fff3a6;
  box-shadow: inset 0 2px 0 var(--accent), inset 0 -2px 0 var(--accent);
}

.mofi-reviewer-source-highlight {
  position: relative;
  z-index: 1;
  background: #fff3a6 !important;
  box-shadow: inset 0 0 0 2px var(--accent);
  scroll-margin: 64px;
}

tr.mofi-reviewer-source-highlight > th,
tr.mofi-reviewer-source-highlight > td {
  background: #fff3a6 !important;
}

.mofi-pdf-cite {
  max-width: 700px;
  margin: 0 auto;
  padding: 14px 20px;
}

.mofi-pdf-cite h2,
.mofi-pdf-cite p {
  margin-top: 0;
}

.mofi-pdf-view {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: 100%;
  height: 100%;
  min-height: 0;
  background: var(--surface-subtle);
}

.mofi-pdf-view .mofi-cite-quote {
  margin-bottom: 0;
}

.mofi-pdf-embed {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 420px;
  border: 0;
  border-top: 1px solid var(--line);
  background: #ffffff;
}

.mofi-certificate-dialog {
  width: min(520px, calc(100vw - 32px));
}

.mofi-certificate-dialog #certificate-source-body {
  padding: 16px 18px;
}

.mofi-certificate-source-grid {
  display: grid;
  grid-template-columns: 90px minmax(0, 1fr);
  gap: 8px 12px;
  margin: 0;
}

.mofi-certificate-source-grid dt {
  color: var(--muted);
}

.mofi-certificate-source-grid dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.assistant-unconfigured {
  margin: 16px;
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--muted-strong);
  background: var(--surface-subtle);
  font-size: 11px;
}

.assistant-pane.is-not-connected .composer {
  opacity: 0.62;
}

.assistant-pane.is-not-connected .suggestions button {
  cursor: not-allowed;
}

.mofi-screen-note {
  margin: 8px 16px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted-strong);
  background: #ffffff;
  font-size: 10px;
}

.assistant-pane .approval-card.is-inline {
  margin-right: 16px;
}

.assistant-pane .approval-value-change {
  grid-template-columns: minmax(78px, auto) minmax(0, 1fr);
}

.assistant-pane .approval-source {
  display: block;
  white-space: normal;
  overflow-wrap: anywhere;
}

.mofi-view-toolbar,
.mofi-section-heading,
.mofi-files-actions,
.mofi-funder-crm-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.mofi-files-actions,
.mofi-section-heading .mofi-toolbar-actions {
  flex: 0 0 auto;
}

.mofi-files-actions {
  flex-wrap: wrap;
}

.mofi-files-action-status {
  flex-basis: 100%;
  color: var(--muted-strong);
  font-size: 10px;
  text-align: right;
}

.mofi-files-action-status.is-error {
  color: var(--danger);
}

.mofi-files-action-status.is-success {
  color: var(--success);
}

.mofi-funder-tabs {
  flex: 0 0 auto;
  margin-bottom: 0;
}

.mofi-funder-tab-panel {
  display: flex;
  flex: 0 0 auto;
  min-height: 0;
  flex-direction: column;
  gap: 16px;
}

.mofi-funder-tab-panel[hidden] {
  display: none;
}

.mofi-timeline-heading {
  align-items: center;
  flex-wrap: wrap;
}

.mofi-funder-tab-panel[data-funder-tab-panel="timeline"],
.mofi-funder-tab-panel[data-funder-tab-panel="timeline"] .mofi-funder-section,
.mofi-funder-tab-panel[data-funder-tab-panel="timeline"] .table-scroll {
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

.mofi-timeline-controls,
.mofi-timeline-sort,
.mofi-timeline-as-of {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mofi-timeline-controls {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.mofi-timeline-sort,
.mofi-timeline-as-of {
  color: var(--muted-strong);
  font-size: 10px;
}

.mofi-timeline-sort button {
  min-height: 28px;
}

.mofi-timeline-sort button.is-active {
  border-color: var(--accent);
  color: #ffffff;
  background: var(--accent);
}

.mofi-timeline-as-of input {
  min-height: 28px;
  padding: 4px 7px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  color: var(--ink);
  background: #ffffff;
  font: inherit;
}

.mofi-timeline-feedback {
  margin: 0;
  color: var(--muted-strong);
  font-size: 10px;
}

.mofi-timeline-table {
  width: 0;
  min-width: 100%;
  max-width: 100%;
  table-layout: fixed;
  font-size: 11px;
}

.mofi-timeline-table th:nth-child(1) { width: 23%; }
.mofi-timeline-table th:nth-child(2) { width: 35%; }
.mofi-timeline-table th:nth-child(3) { width: 30%; }
.mofi-timeline-table th:nth-child(4) { width: 12%; }

.mofi-timeline-table td {
  overflow-wrap: anywhere;
}

.mofi-timeline-dates span {
  display: block;
  line-height: 1.5;
}

.mofi-timeline-dates strong {
  color: var(--muted-strong);
  font-size: 9px;
  font-weight: 700;
}

.mofi-timeline-row.is-gap td {
  border-top-style: dashed;
}

.mofi-timeline-row.is-gap .mofi-cell-primary::before {
  content: "Missing: ";
  color: var(--danger);
}

.mofi-timeline-row.is-in-force .mofi-cell-primary {
  color: var(--ink-strong);
  font-weight: 700;
}

.mofi-timeline-terms .table-scroll {
  max-height: 260px;
}

.mofi-timeline-terms .data-table {
  width: 0;
  min-width: 100%;
  max-width: 100%;
  table-layout: fixed;
  font-size: 11px;
}

.mofi-timeline-terms .data-table th:nth-child(1) { width: 25%; }
.mofi-timeline-terms .data-table th:nth-child(2) { width: 50%; }
.mofi-timeline-terms .data-table th:nth-child(3) { width: 15%; }
.mofi-timeline-terms .data-table th:nth-child(4) { width: 10%; }

.mofi-timeline-terms .data-table td {
  overflow-wrap: anywhere;
}

.mofi-overview-table-scroll,
.mofi-funder-documents-table-scroll {
  max-height: none;
}

.mofi-overview-table,
.mofi-funder-issues-table,
.mofi-funder-documents-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
  font-size: 11px;
}

.mofi-overview-table th:nth-child(1) { width: 28%; }
.mofi-overview-table th:nth-child(2) { width: 72%; }

.mofi-funder-issues-table {
  min-width: 820px;
  table-layout: auto;
}

.mofi-overview-table td,
.mofi-funder-issues-table td,
.mofi-funder-documents-table td {
  white-space: normal;
  overflow-wrap: anywhere;
}

.mofi-document-family-row th {
  background: var(--surface-subtle);
  color: var(--ink-strong);
  font-size: 11px;
  font-weight: 700;
  padding: 9px 12px;
  text-align: left;
}

.mofi-document-tree-row td:first-child {
  padding-left: 24px;
}

.mofi-document-tree-gap-row td {
  background: color-mix(in srgb, var(--warning, #b7791f) 9%, transparent);
}

.mofi-document-tree-gap-row .mofi-text-button {
  display: block;
  margin-top: 4px;
}

.mofi-funder-certificate-table {
  min-width: 840px;
}

.mofi-funder-certificate-table th:nth-child(1) { width: 12%; }
.mofi-funder-certificate-table th:nth-child(2) { width: 17%; }
.mofi-funder-certificate-table th:nth-child(3) { width: 19%; }
.mofi-funder-certificate-table th:nth-child(4) { width: 12%; }
.mofi-funder-certificate-table th:nth-child(5) { width: 10%; }
.mofi-funder-certificate-table th:nth-child(6) { width: 17%; }
.mofi-funder-certificate-table th:nth-child(7) { width: 13%; }

.mofi-funder-notes-table {
  width: 100%;
  min-width: 720px;
  table-layout: fixed;
  font-size: 10px;
}

.mofi-funder-notes-table th:nth-child(1) { width: 34%; }
.mofi-funder-notes-table th:nth-child(2) { width: 16%; }
.mofi-funder-notes-table th:nth-child(3) { width: 19%; }
.mofi-funder-notes-table th:nth-child(4) { width: 17%; }
.mofi-funder-notes-table th:nth-child(5) { width: 14%; }

.mofi-funder-notes-table td {
  white-space: normal;
  overflow-wrap: anywhere;
  vertical-align: top;
}

.mofi-funder-crm-heading {
  align-items: flex-start;
}

.mofi-funder-crm-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
}

.mofi-funder-crm-heading .mofi-funder-actions {
  padding-top: 0;
}

.mofi-connector-popover {
  width: min(430px, calc(100vw - 32px));
  max-height: min(620px, calc(100vh - 110px));
  overflow: hidden;
}

.mofi-connector-popover .connector-popover-heading > div {
  display: grid;
  gap: 2px;
}

.mofi-connector-popover .connector-popover-heading small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 400;
}

.mofi-connector-popover ul {
  max-height: min(540px, calc(100vh - 180px));
  margin-bottom: 0;
}

.mofi-connector-popover .mofi-connector-row {
  display: grid;
  gap: 6px;
  padding: 10px 0;
}

.mofi-connector-heading {
  display: flex !important;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.mofi-connector-row p {
  margin: 0;
  color: var(--muted-strong);
  font-size: 10px;
}

.mofi-connector-row dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
}

.mofi-connector-row dl div {
  display: grid;
  gap: 2px;
}

.mofi-connector-row dt,
.mofi-connector-row dd {
  margin: 0;
  font-size: 10px;
}

.mofi-connector-row dt {
  color: var(--muted);
}

.mofi-connector-row dd {
  color: var(--ink);
}

.mofi-connector-files {
  display: grid;
  gap: 4px;
}

.mofi-connector-files > span {
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
}

.mofi-connector-files > div {
  display: grid;
  gap: 2px;
}

.mofi-connector-files > div > span {
  overflow-wrap: anywhere;
  color: var(--muted-strong);
  font-size: 9px;
}

.mofi-view-connector-data {
  justify-self: start;
  min-height: 28px;
  padding: 4px 9px;
}

.mofi-connector-data-view {
  z-index: 17;
  min-width: 0;
  min-height: 0;
}

.mofi-connector-data-toolbar {
  align-items: flex-end;
}

.mofi-connector-data-toolbar p,
.mofi-connector-used-by p,
.mofi-connector-data-count {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 10px;
}

.mofi-connector-dataset-control {
  display: grid;
  min-width: 210px;
  gap: 4px;
  color: var(--muted);
  font-size: 10px;
}

.mofi-connector-dataset-control select {
  height: 34px;
  padding: 0 8px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  color: var(--ink);
  background: #ffffff;
}

.mofi-connector-data-content {
  min-width: 0;
  min-height: 0;
  padding: 0 18px 24px;
  overflow: auto;
}

.mofi-connector-data-scroll,
.mofi-connector-used-by-scroll {
  max-width: 100%;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.mofi-connector-data-table {
  min-width: 900px;
  font-size: 10px;
}

.mofi-connector-data-table th,
.mofi-connector-data-table td {
  max-width: 260px;
  padding: 8px;
  overflow-wrap: anywhere;
  white-space: normal;
  vertical-align: top;
}

.mofi-connector-used-by {
  display: grid;
  gap: 8px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.mofi-connector-used-by[hidden] {
  display: none;
}

.mofi-review-filters {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mofi-review-filters .is-active {
  border-color: var(--accent);
  color: var(--accent);
  background: #eef3fc;
}

.mofi-source-review-section {
  display: flex;
  min-height: 0;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 8px;
}

.mofi-source-review-section[hidden] {
  display: none;
}

.mofi-section-heading h2 {
  margin: 0;
  color: var(--ink-strong);
  font-size: 13px;
}

.mofi-source-review-table-scroll {
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.mofi-source-review-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
  font-size: 10px;
}

.mofi-source-review-table th:nth-child(1) { width: 11%; }
.mofi-source-review-table th:nth-child(2) { width: 13%; }
.mofi-source-review-table th:nth-child(3) { width: 18%; }
.mofi-source-review-table th:nth-child(4) { width: 12%; }
.mofi-source-review-table th:nth-child(5) { width: 9%; }
.mofi-source-review-table th:nth-child(6) { width: 20%; }
.mofi-source-review-table th:nth-child(7) { width: 17%; }

.mofi-source-review-table td {
  white-space: normal;
  overflow-wrap: anywhere;
  vertical-align: top;
}

.mofi-replay-status {
  display: inline-block;
  color: var(--muted-strong);
  font-size: 10px;
  font-weight: 700;
}

.mofi-replay-status.is-pending {
  color: var(--warning);
}

.mofi-source-sentence {
  display: grid;
  width: 100%;
  gap: 4px;
  padding: 0;
  border: 0;
  color: var(--ink);
  background: transparent;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.mofi-source-sentence-text {
  display: -webkit-box;
  width: 100%;
  max-height: calc(1.4em * 3);
  padding: 0;
  overflow: hidden;
  border: 0;
  color: var(--ink);
  background: transparent;
  font: inherit;
  line-height: 1.4;
  text-align: left;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  cursor: pointer;
}

.mofi-source-sentence.is-expanded .mofi-source-sentence-text {
  display: block;
  max-height: none;
  overflow: visible;
  -webkit-line-clamp: initial;
}

.mofi-source-toggle {
  justify-self: start;
  padding: 0;
  border: 0;
  color: var(--accent);
  background: transparent;
  font: inherit;
  font-size: 9px;
  font-weight: 600;
  cursor: pointer;
}

.mofi-source-toggle:hover,
.mofi-source-toggle:focus-visible {
  color: var(--accent-hover);
  text-decoration: underline;
}

.mofi-source-sentence:hover span,
.mofi-source-sentence:focus-visible span {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.mofi-source-sentence small {
  color: var(--muted);
  font-size: 9px;
}

.mofi-review-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.mofi-review-actions button {
  flex: 1 1 48px;
  width: auto;
  min-height: 26px;
  padding: 4px 5px;
  font-size: 9px;
}

.mofi-agreement-dialog {
  width: min(560px, calc(100vw - 32px));
  max-width: 560px;
}

.mofi-agreement-dialog form {
  display: block;
}

.mofi-agreement-choose {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.mofi-agreement-choose[hidden],
.mofi-agreement-progress[hidden] {
  display: none;
}

.mofi-agreement-choose label {
  display: grid;
  gap: 5px;
  color: var(--muted-strong);
  font-size: 11px;
}

.mofi-agreement-choose input,
.mofi-agreement-choose select {
  width: 100%;
  min-width: 0;
  height: 36px;
  padding: 6px 8px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  color: var(--ink);
  background: #ffffff;
}

.mofi-demo-note {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
}

.mofi-agreement-progress {
  padding: 8px 18px 22px;
}

.mofi-agreement-progress ol {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.mofi-agreement-progress li {
  position: relative;
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 9px;
  min-height: 50px;
  color: var(--muted);
}

.mofi-agreement-progress li:not(:last-child)::after {
  position: absolute;
  top: 22px;
  bottom: 2px;
  left: 10px;
  width: 1px;
  background: var(--line);
  content: "";
}

.mofi-replay-check {
  position: relative;
  z-index: 1;
  display: inline-flex;
  width: 21px;
  height: 21px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  color: var(--muted);
  background: #ffffff;
  font-size: 12px;
}

.mofi-agreement-progress li.is-active,
.mofi-agreement-progress li.is-complete {
  color: var(--ink);
}

.mofi-agreement-progress li.is-active .mofi-replay-check {
  border-color: var(--accent);
  color: var(--accent);
}

.mofi-agreement-progress li.is-complete .mofi-replay-check {
  border-color: var(--success);
  color: #ffffff;
  background: var(--success);
}

.mofi-agreement-progress li.is-error .mofi-replay-check {
  border-color: var(--danger);
  color: var(--danger);
}

.mofi-agreement-progress li div {
  display: grid;
  align-content: start;
  gap: 3px;
  padding-top: 2px;
}

.mofi-agreement-progress li strong {
  color: inherit;
  font-size: 11px;
}

.mofi-agreement-progress li small {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.4;
}

.mofi-agreement-upload-dialog {
  width: min(820px, calc(100vw - 32px));
  max-width: 820px;
  max-height: calc(100vh - 32px);
}

/* Shared polish contracts: preserve whole words and align dialog chrome with
   the 20px content inset used by the branded dialogs. */
html[data-theme="mofi"] .data-table th {
  overflow-wrap: normal;
  word-break: normal;
}

html[data-theme="mofi"] .data-table th .mofi-sort-button {
  overflow-wrap: normal;
  word-break: normal;
}

.form-dialog .drawer-header {
  margin: 0;
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--line);
}

.mofi-agreement-new-funder,
.mofi-agreement-edit-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.mofi-agreement-new-funder[hidden],
.mofi-agreement-review[hidden] {
  display: none;
}

.mofi-agreement-choose label small {
  color: var(--muted);
  font-size: 10px;
}

.mofi-agreement-review {
  display: grid;
  gap: 12px;
  max-height: 54vh;
  overflow-y: auto;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.mofi-agreement-review-heading,
.mofi-agreement-review-item > header {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  justify-content: space-between;
}

.mofi-agreement-review-heading h3,
.mofi-agreement-review-heading p,
.mofi-agreement-review-item p,
.mofi-agreement-clear,
.mofi-agreement-visibility {
  margin: 0;
}

.mofi-agreement-visibility {
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-subtle);
  color: var(--muted-strong);
  font-size: 11px;
}

.mofi-agreement-review-heading p,
.mofi-agreement-review-item p,
.mofi-agreement-clear {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
}

.mofi-agreement-version-choice {
  display: grid;
  gap: 12px;
}

.mofi-agreement-version-choice h3,
.mofi-agreement-version-choice p {
  margin: 0;
}

.mofi-agreement-version-choice > label {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #ffffff;
}

.mofi-agreement-version-choice label span {
  display: grid;
  gap: 3px;
}

.mofi-agreement-version-choice small {
  color: var(--muted);
}

.mofi-agreement-review-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.mofi-agreement-review-item {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #ffffff;
}

.mofi-agreement-review-item blockquote {
  margin: 0;
  padding: 9px 11px;
  border-left: 3px solid var(--line-strong);
  color: var(--muted-strong);
  background: var(--surface-subtle);
  font-size: 11px;
  line-height: 1.5;
}

.mofi-agreement-review-item details {
  border-top: 1px solid var(--line);
  padding-top: 9px;
}

.mofi-agreement-review-item summary {
  cursor: pointer;
  color: var(--muted-strong);
  font-size: 11px;
  font-weight: 600;
}

.mofi-agreement-edit-grid {
  margin-top: 10px;
}

.mofi-agreement-edit-grid label {
  display: grid;
  gap: 4px;
  color: var(--muted-strong);
  font-size: 10px;
}

.mofi-agreement-edit-grid input,
.mofi-agreement-edit-grid select {
  min-width: 0;
  height: 34px;
  padding: 6px 8px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: #ffffff;
}

@media (max-width: 640px) {
  .mofi-agreement-new-funder,
  .mofi-agreement-edit-grid {
    grid-template-columns: 1fr;
  }
}

.mofi-app-shell .nav-icon svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

@media (max-width: 1180px) {
  .mofi-filter-grid {
    grid-template-columns: repeat(3, minmax(120px, 1fr));
  }

  .mofi-review-filter-grid {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
  }

  .mofi-files-filters {
    grid-template-columns: repeat(3, minmax(120px, 1fr));
  }
}

.mofi-table-more {
  padding: 12px 0 4px;
  text-align: center;
}

@media (max-width: 900px) {
  .mofi-app-shell .workspace-pane {
    grid-template-columns: 56px minmax(0, 1fr);
  }

}

@media (max-width: 720px) {
  .mofi-page-shell {
    padding: 14px;
  }

  .mofi-filter-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .mofi-review-filter-grid {
    grid-template-columns: 1fr;
  }

  .mofi-search-filter,
  .mofi-clear-filters {
    grid-column: 1 / -1;
  }

  .mofi-file-drawer {
    width: 100%;
  }

  .mofi-file-drawer .detail-list {
    grid-template-columns: 88px minmax(0, 1fr);
  }

  .mofi-document-body {
    padding: 18px 16px 52px;
  }

  .mofi-certificate-toolbar {
    display: block;
  }

  .mofi-funder-detail-toolbar {
    display: block;
  }

  .mofi-funder-actions {
    padding-top: 12px;
  }

  .mofi-toolbar-actions {
    margin-top: 12px;
  }
}

@media (min-width: 721px) {
  .mofi-rules-table,
  .mofi-all-rules-table,
  .mofi-funder-rules-table,
  .mofi-review-table,
  .mofi-files-table {
    min-width: 0;
    table-layout: fixed;
  }

  .mofi-rules-table th[data-column-key] {
    min-width: 0;
  }

  .mofi-funders-table .mofi-row-button,
  .mofi-funders-table .mofi-cell-secondary,
  .mofi-files-table .mofi-file-name,
  .mofi-files-table .mofi-file-funder-link {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

/* Fit the actual workspace width, including when the assistant is resized. */
@media (min-width: 900px) {
  .mofi-files-filters {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  }
}
