:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #1f2528;
  background: #f6f7f3;
}

body {
  margin: 0;
}

.shell {
  max-width: none;
  margin: 0;
  padding: 0 16px 20px 0;
}

.toolbar {
  display: grid;
  grid-template-columns: auto minmax(260px, 1.5fr) repeat(4, minmax(120px, 1fr)) auto auto;
  gap: 10px;
  align-items: end;
  padding: 4px 0 14px;
  border-bottom: 1px solid #d5dbd0;
}

.record-link-field {
  min-width: 260px;
}

.brand {
  font-size: 24px;
  font-weight: 750;
  align-self: center;
}

label {
  display: grid;
  gap: 5px;
  font-size: 12px;
  font-weight: 650;
  color: #596158;
}

input,
button,
select,
textarea {
  border: 1px solid #b9c3b2;
  border-radius: 6px;
  font: inherit;
}

input,
select,
textarea {
  padding: 8px 10px;
  background: #fff;
}

button {
  min-height: 36px;
  padding: 0 12px;
  background: #24566a;
  color: #fff;
  cursor: pointer;
}

.status {
  min-height: 24px;
  padding: 10px 0;
  color: #485246;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(220px, 0.65fr) minmax(760px, 1.9fr) minmax(300px, 0.8fr);
  gap: 10px;
  align-items: start;
}

.pane {
  min-height: 620px;
  border-top: 1px solid #d5dbd0;
  background: #fff;
}

.pane-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 12px 8px;
  border-bottom: 1px solid #e2e6dd;
}

h1,
h2 {
  margin: 0;
}

h1 {
  font-size: 17px;
}

h2 {
  font-size: 14px;
}

.tree-list {
  padding: 8px;
}

.tree-list h2 {
  margin: 12px 4px 6px;
  color: #5b635b;
}

.tree-item,
.edge-item {
  display: grid;
  width: 100%;
  min-height: 42px;
  margin: 4px 0;
  padding: 7px 9px;
  text-align: left;
  color: #1f2528;
  background: #f7f9f5;
  border-color: #d7ded0;
}

.tree-item small {
  color: #657064;
}

.tree-person-line {
  display: flex;
  gap: 7px;
  align-items: center;
}

.status-dot {
  flex: 0 0 auto;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  border: 1px solid rgba(31, 37, 40, 0.2);
}

.status-green {
  background: #2f7d48;
}

.status-amber {
  background: #d49220;
}

.status-red {
  background: #b93a35;
}

.edge-item {
  min-height: 30px;
  margin-left: 14px;
  border-style: dashed;
}

.selected,
tr.related {
  outline: 2px solid #24566a;
  outline-offset: -2px;
}

.fact {
  border-left: 4px solid #2f7d48;
}

.inference {
  border-left: 4px solid #2b6ea6;
}

.suggestion {
  border-left: 4px dashed #b67a1d;
}

.manual_fact {
  border-left: 4px solid #6b4aa0;
}

.manual_assumption {
  border-left: 4px solid #6b4aa0;
}

.table-wrap {
  max-height: 650px;
  overflow: auto;
}

table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  font-size: 12.5px;
}

th,
td {
  padding: 9px 7px;
  border-bottom: 1px solid #e4e8e0;
  text-align: left;
  vertical-align: top;
  overflow-wrap: anywhere;
}

th:nth-child(1),
td:nth-child(1) {
  width: 18%;
}

th:nth-child(2),
td:nth-child(2) {
  width: 13%;
}

th:nth-child(3),
td:nth-child(3) {
  width: 10%;
}

th:nth-child(4),
td:nth-child(4) {
  width: 9%;
}

th:nth-child(5),
td:nth-child(5) {
  width: 30%;
}

th:nth-child(6),
td:nth-child(6) {
  width: 12%;
}

th:nth-child(7),
td:nth-child(7) {
  width: 8%;
}

th {
  position: sticky;
  top: 0;
  background: #f2f5ee;
  z-index: 1;
}

.badge {
  display: inline-block;
  padding: 3px 6px;
  border-radius: 5px;
  color: #fff;
  background: #687369;
}

.badge.fact {
  background: #2f7d48;
}

.badge.inference {
  background: #2b6ea6;
}

.badge.suggestion {
  background: #b67a1d;
}

.badge.manual_fact {
  background: #6b4aa0;
}

.badge.manual_assumption {
  background: #6b4aa0;
}

.link-button {
  min-height: 28px;
  margin: 2px;
  background: #f7f9f5;
  color: #24566a;
}

.danger-button {
  background: #8d2d2d;
}

.danger-link {
  border-color: #c99;
  color: #8d2d2d;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.inspector,
.fix-form,
.document-panel {
  display: grid;
  gap: 10px;
  padding: 12px;
  border-bottom: 1px solid #e2e6dd;
}

.inspector-row {
  padding: 8px;
  background: #f7f9f5;
  border-left: 3px solid #b67a1d;
}

.form-error {
  min-height: 18px;
  color: #a32727;
  font-size: 13px;
  font-weight: 650;
}

.document-panel iframe {
  width: 100%;
  height: 240px;
  border: 1px solid #d5dbd0;
}

.document-panel pre {
  min-height: 80px;
  max-height: 220px;
  overflow: auto;
  padding: 10px;
  white-space: pre-wrap;
  background: #f7f9f5;
}

#documentActions {
  display: grid;
  gap: 8px;
}

#documentActions a {
  align-content: center;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid #b9c3b2;
  border-radius: 6px;
  color: #24566a;
}

.document-group {
  display: grid;
  gap: 5px;
}

.document-year {
  font-size: 12px;
  font-weight: 750;
  color: #596158;
}

.document-button {
  width: 100%;
  text-align: left;
}

.forms-gallery {
  display: grid;
  gap: 10px;
  min-height: 380px;
  margin: 10px;
  padding: 12px;
  border: 1px solid #d5dbd0;
  background: #fbfcf8;
}

.forms-gallery[hidden] {
  display: none;
}

.forms-gallery-header,
.forms-gallery-actions,
.forms-gallery-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.forms-gallery-header {
  justify-content: space-between;
}

.forms-gallery-body {
  display: grid;
  grid-template-columns: minmax(180px, 0.34fr) minmax(420px, 1fr);
  gap: 10px;
  min-height: 360px;
}

.forms-gallery-list {
  display: grid;
  align-content: start;
  gap: 6px;
  max-height: 430px;
  overflow: auto;
}

.forms-gallery-card {
  min-height: 34px;
  padding: 7px 9px;
  text-align: left;
  color: #24566a;
  background: #fff;
}

.forms-gallery-card.selected-doc,
.selected-tab {
  outline: 2px solid #24566a;
  outline-offset: -2px;
  background: #eef5f7;
}

.forms-gallery iframe {
  width: 100%;
  min-height: 430px;
  border: 1px solid #d5dbd0;
  background: #fff;
}

.forms-gallery-actions a {
  align-content: center;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid #b9c3b2;
  border-radius: 6px;
  color: #24566a;
}

.forms-gallery-text {
  min-height: 90px;
  max-height: 220px;
  overflow: auto;
  padding: 10px;
  white-space: pre-wrap;
  background: #f7f9f5;
}

@media (max-width: 1050px) {
  .toolbar,
  .workspace {
    grid-template-columns: 1fr;
  }

  .forms-gallery-body {
    grid-template-columns: 1fr;
  }

  .pane {
    min-height: auto;
  }
}
