:root {
  color-scheme: light;
  --bg: #f4f6f3;
  --panel: #ffffff;
  --text: #18201d;
  --muted: #66706b;
  --line: #dce4df;
  --accent: #1f7a5a;
  --accent-dark: #145b42;
  --accent-soft: #dff1e9;
  --shadow: 0 16px 42px rgba(26, 38, 32, 0.08);
  --cmu-bg: #ffffff;
  --cmu-panel: #ffffff;
  --cmu-border: #d8dee8;
  --cmu-muted: #667085;
  --cmu-text: #101828;
  --cmu-blue: #155eef;
  --cmu-blue-soft: #eef4ff;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  min-height: 36px;
  border: 0;
  border-radius: 7px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font-weight: 760;
  padding: 0 13px;
}

button:hover {
  background: var(--accent-dark);
}

.secondary-button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
}

.secondary-button:hover {
  background: #eef3f0;
}

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

.danger-button:hover {
  background: #6f2d23;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fbfcfb;
  color: var(--text);
  padding: 9px 10px;
}

textarea {
  resize: vertical;
}

.login-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
}

.login-view[hidden] {
  display: none;
}

.login-panel {
  width: min(420px, 100%);
  display: grid;
  gap: 14px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.login-panel h1 {
  margin: 2px 0 0;
  font-size: 2rem;
}

.login-panel button {
  min-height: 42px;
}

.login-status {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.cmu-panel {
  background: var(--cmu-panel);
  border: 1px solid var(--cmu-border);
  border-radius: 10px;
  overflow: hidden;
}

.cmu-panel-header {
  align-items: center;
  border-bottom: 1px solid var(--cmu-border);
  display: flex;
  justify-content: space-between;
  padding: 16px 20px;
}

.cmu-panel-body {
  padding: 16px;
}

.cmu-table {
  border-collapse: collapse;
  width: 100%;
}

.cmu-table th,
.cmu-table td {
  border-bottom: 1px solid var(--cmu-border);
  padding: 12px 14px;
  text-align: left;
}

.cmu-primary-button {
  background: var(--cmu-blue);
  border-radius: 8px;
  color: #fff;
  padding: 10px 14px;
}

label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 720;
}

.app-shell {
  width: min(1680px, calc(100% - 24px));
  margin: 0 auto;
  padding: 18px 0 22px;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto minmax(180px, 1fr);
  align-items: center;
  gap: 18px;
  padding: 8px 0 16px;
}

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

.brand-context {
  display: grid;
  gap: 3px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 680;
}

.brand-context span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.top-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.sync-notice {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 8px 14px;
  border: 1px solid #e8d48a;
  border-radius: 7px;
  background: #fff7da;
  color: #5f4500;
  font-size: 0.84rem;
  font-weight: 720;
  margin: 0 0 14px;
}

.sync-notice[hidden] {
  display: none;
}

.sync-notice button {
  min-height: 26px;
  padding: 4px 8px;
  font-size: 0.72rem;
}

.view-nav {
  display: inline-grid;
  grid-template-columns: repeat(4, auto);
  gap: 6px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.view-button {
  background: transparent;
  color: var(--muted);
  min-width: 120px;
}

.view-button:hover,
.view-button.active {
  background: var(--accent);
  color: #fff;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 780;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(1.9rem, 4vw, 3.2rem);
  line-height: 1;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 1.02rem;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 8px;
  font-size: 0.9rem;
}

p {
  color: var(--muted);
  line-height: 1.5;
}

.status-badge,
.pill,
.action-status {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 760;
  white-space: nowrap;
}

.action-status {
  max-width: 360px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.action-status[data-tone="success"] {
  border-color: #b9dfcf;
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.action-status[data-tone="error"] {
  border-color: #e2b8ad;
  background: #f7ece7;
  color: #7b3328;
}

.status-badge.ok {
  border-color: #b9dfcf;
  background: var(--accent-soft);
  color: var(--accent);
}

.icon-button {
  width: 36px;
  padding: 0;
}

.view[hidden] {
  display: none;
}

.analysis-layout {
  display: grid;
  grid-template-columns: 2fr 3fr;
  gap: 14px;
  min-height: calc(100vh - 118px);
}

.analysis-right {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 14px;
  min-width: 0;
}

.administration-layout {
  display: grid;
  grid-template-columns: minmax(360px, 1.2fr) minmax(320px, 0.8fr);
  gap: 14px;
}

.projects-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 2fr);
  gap: 14px;
  align-items: start;
  min-height: calc(100vh - 118px);
}

#administrationView .administration-layout {
  grid-template-columns: minmax(320px, 0.95fr) minmax(380px, 1.05fr);
  align-items: start;
}

.audit-panel {
  grid-column: 1 / -1;
}

.project-access-panel {
  grid-column: 1 / -1;
}

.user-administration-layout {
  display: grid;
  grid-template-columns: minmax(260px, 0.8fr) minmax(420px, 1.2fr);
  gap: 14px;
  align-items: start;
}

.profile-grid {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  gap: 8px 12px;
  margin: 0;
}

.profile-grid dt {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 760;
}

.profile-grid dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
  font-weight: 700;
}

.collaborator-list {
  max-height: calc(100vh - 220px);
  overflow: auto;
}

.collaborator-project {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.collaborator-project-heading {
  display: grid;
  gap: 2px;
}

.collaborator-project-heading span,
.collaborator-project li span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 650;
}

.collaborator-project ul {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.collaborator-project li {
  display: grid;
  min-width: 0;
  padding: 7px;
  border-radius: 7px;
  background: #f7faf8;
}

.collaborator-project li.current-user {
  background: var(--accent-soft);
}

.audit-list {
  max-height: 260px;
  overflow: auto;
}

.panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 15px;
}

.document-panel,
.glossary-panel,
.graph-panel {
  min-height: 0;
  overflow: hidden;
}

.work-panel {
  min-height: 0;
  overflow: visible;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.stack-form,
.document-form {
  display: grid;
  gap: 9px;
}

.compact-form {
  gap: 8px;
}

.document-form,
.pdf-import-form {
  grid-template-columns: 1fr auto;
  margin-bottom: 12px;
}

.document-actions-stack {
  display: grid;
  gap: 10px;
}

.document-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.document-actions-stack .admin-subsection {
  margin-bottom: 0;
}

.document-actions-stack .document-form,
.document-actions-stack .pdf-import-form {
  margin-bottom: 0;
}

.document-form textarea {
  grid-column: 1 / -1;
}

.pdf-import-form,
.table-import-form {
  display: grid;
  gap: 9px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}

.import-kind-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.import-kind-switch button.active {
  border-color: #b9dfcf;
  background: var(--accent-soft);
  color: var(--accent);
}

.import-helper {
  display: grid;
  gap: 7px;
}

.import-helper span {
  color: var(--muted);
  font-size: 0.84rem;
}

.project-assignment {
  display: grid;
  gap: 7px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.project-assignment-list {
  display: grid;
  gap: 5px;
}

.project-assignment-option {
  min-height: 28px;
}

.import-dialog {
  width: min(680px, calc(100vw - 32px));
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  box-shadow: var(--shadow);
  padding: 16px;
}

.document-dialog {
  width: min(820px, calc(100vw - 32px));
}

.document-dialog .admin-subsection {
  border: 0;
  padding: 0;
  background: transparent;
}

.import-dialog::backdrop {
  background: rgba(18, 28, 23, 0.36);
}

.import-structure-body {
  display: grid;
  gap: 10px;
}

.import-structure-body table {
  width: 100%;
  border-collapse: collapse;
}

.import-structure-body th,
.import-structure-body td {
  border: 1px solid var(--line);
  padding: 8px;
  text-align: left;
  vertical-align: top;
}

.import-structure-body pre {
  overflow: auto;
  margin: 0;
  padding: 10px;
  border-radius: 8px;
  background: #eef3f0;
  white-space: pre-wrap;
}

.table-import-form {
  grid-template-columns: repeat(2, minmax(110px, 1fr)) auto;
  align-items: end;
}

.table-import-head {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.admin-subsection {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}

.subsection-heading {
  display: grid;
  gap: 3px;
}

.muted-small {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
}

.member-form {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) minmax(112px, 0.5fr);
  gap: 8px;
}

.member-form button {
  grid-column: 1 / -1;
}

.member-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  min-width: 0;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.member-item strong,
.member-item span {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
}

.member-item span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
}

.member-item button {
  min-height: 30px;
  padding: 0 9px;
}

.export-actions,
.export-control {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.export-actions button,
.export-control button {
  min-height: 32px;
  padding: 0 10px;
}

.export-panel {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}

.export-control {
  align-items: center;
}

.export-control select {
  min-width: 140px;
}

.graph-export-panel {
  margin: 0;
}

.checkbox-label {
  grid-template-columns: auto 1fr;
  align-items: center;
  color: var(--text);
}

.checkbox-label input {
  width: auto;
}

.document-browser {
  display: grid;
  gap: 10px;
}

.document-tabs {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  min-height: 42px;
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
  padding: 0 2px;
}

.document-tab {
  flex: 0 0 auto;
  max-width: 190px;
  min-height: 36px;
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  background: #eef3f0;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.document-tab:hover {
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.document-tab.active {
  min-height: 40px;
  background: #fff;
  color: var(--text);
  box-shadow: 0 -1px 0 #fff inset;
}

.document-reader {
  min-height: 42vh;
  max-height: 58vh;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fbfcfb;
  color: var(--text);
  padding: 10px;
  white-space: pre-wrap;
  line-height: 1.5;
  user-select: text;
  outline: none;
}

.document-reader:focus {
  border-color: #aadbc9;
  box-shadow: 0 0 0 3px rgba(31, 122, 90, 0.12);
}

.document-highlight {
  border-radius: 4px;
  background: var(--concept-color);
  color: var(--text);
  padding: 1px 2px;
}

.pdf-preview-wrap {
  height: min(32vh, 360px);
  min-height: 220px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}

.pdf-preview-wrap iframe {
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
}

.selection-tools {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 0.72rem;
}

.collaboration-strip {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 0.72rem;
}

.presence-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}

.presence-pill {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 3px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #eef7f2;
  color: var(--accent-dark);
  font-size: 0.72rem;
}

.key-hint {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfb;
  color: var(--text);
  font-size: 0.72rem;
  font-weight: 650;
  padding: 0 7px;
}

#selectionStatus {
  color: var(--muted);
  font-size: 0.72rem;
}

#saveSelectionButton {
  min-height: 24px;
  padding: 3px 7px;
  font-size: 0.68rem;
}

#refreshHighlightsButton {
  min-height: 24px;
  padding: 3px 7px;
  font-size: 0.68rem;
}

.project-list,
.item-list {
  display: grid;
  gap: 8px;
}

.project-column,
.analyses-column,
.documents-column {
  max-height: calc(100vh - 118px);
  overflow: auto;
}

.document-details-column {
  display: grid;
  gap: 12px;
  min-width: min(880px, calc(100vw - 48px));
  max-width: min(1040px, calc(100vw - 48px));
  max-height: calc(100vh - 70px);
  overflow: auto;
}

.document-details-dialog {
  max-width: min(1080px, calc(100vw - 36px));
}

.project-documents-table-wrap {
  max-height: calc(100vh - 275px);
}

.project-documents-table {
  min-width: 820px;
  table-layout: fixed;
}

.project-documents-table th,
.project-documents-table td {
  text-align: left;
  vertical-align: top;
}

.project-documents-table th:nth-child(1) {
  width: 27%;
}

.project-documents-table th:nth-child(2) {
  width: 16%;
}

.project-documents-table th:nth-child(3),
.project-documents-table th:nth-child(4) {
  width: 18%;
}

.project-documents-table th:nth-child(5) {
  width: 9%;
}

.project-documents-table th:nth-child(6) {
  width: 12%;
}

.document-table-title,
.document-table-meta {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.document-table-title strong,
.document-table-meta span {
  overflow-wrap: anywhere;
}

.project-documents-table .active-row {
  background: var(--accent-soft);
}

.text-button {
  min-height: auto;
  width: 100%;
  justify-content: flex-start;
  border: 0;
  background: transparent;
  color: var(--text);
  padding: 0;
  text-align: left;
}

.text-button:hover {
  background: transparent;
  color: var(--accent-dark);
}

.project-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-width: 0;
  min-height: 58px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
  color: var(--text);
  padding: 8px;
}

.project-item.active {
  border-color: #aadbc9;
  background: var(--accent-soft);
}

.document-item {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  min-width: 0;
  border-left: 5px solid transparent;
}

.document-item.active {
  border-color: #aadbc9;
  border-left-color: var(--accent);
  background: var(--accent-soft);
}

.document-select {
  display: grid;
  gap: 4px;
  min-width: 0;
  min-height: 30px;
  background: transparent;
  color: var(--text);
  padding: 0;
  text-align: left;
  white-space: normal;
}

.document-select strong {
  font-size: 0.92rem;
  line-height: 1.25;
}

.document-select:hover {
  background: transparent;
  color: var(--accent-dark);
}

.document-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px;
}

.document-actions button,
.project-actions button,
.glossary-actions button,
.matrix-edit-button {
  min-height: 16px;
  padding: 0 5px;
  border-radius: 5px;
  font-size: 0.64rem;
  line-height: 1.1;
}

.document-item .document-actions {
  min-width: 92px;
}

.document-content-preview {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}

.document-content-preview pre {
  max-height: calc(100vh - 260px);
  min-height: 420px;
  margin: 0;
  overflow: auto;
  white-space: pre-wrap;
  color: var(--text);
  font: inherit;
  line-height: 1.5;
}

.document-details-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.document-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0 0 12px;
}

.document-meta-grid span {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}

.document-meta-grid strong {
  color: var(--muted);
  font-size: 0.76rem;
}

.document-meta-grid code {
  min-width: 0;
  overflow-wrap: anywhere;
  font: inherit;
  font-weight: 760;
}

.project-create-panel {
  margin-bottom: 12px;
}

.project-analysis-options {
  display: grid;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.project-select {
  display: grid;
  gap: 4px;
  min-width: 0;
  min-height: 44px;
  background: transparent;
  color: var(--text);
  padding: 0 6px;
  text-align: left;
  white-space: normal;
}

.project-select:hover {
  background: transparent;
  color: var(--accent-dark);
}

.project-actions,
.form-actions,
.project-pills {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.project-actions {
  justify-content: flex-end;
}

.project-item span,
.list-item span {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.project-item strong,
.list-item strong,
.document-select strong,
.project-select strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

.list-item {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}

.user-list {
  max-height: calc(100vh - 260px);
  overflow: auto;
  padding-right: 2px;
}

.user-item {
  grid-template-columns: 1fr auto;
  align-items: center;
  border-left: 5px solid transparent;
}

.user-item:hover {
  border-left-color: #aadbc9;
  background: #f6faf8;
}

.user-item strong,
.user-item span {
  min-width: 0;
}

.user-item.inactive {
  opacity: 0.62;
}

.scroll-list {
  max-height: 180px;
  overflow: auto;
  padding-right: 2px;
}

.sub-tabs {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  margin-bottom: 14px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}

.sub-tab {
  background: transparent;
  color: var(--muted);
}

.sub-tab:hover,
.sub-tab.active {
  background: var(--accent);
  color: #fff;
}

.subview[hidden] {
  display: none;
}

.relation-form {
  display: grid;
  grid-template-columns: minmax(220px, 1.35fr) 64px minmax(220px, 1.35fr) 76px auto;
  align-items: end;
  gap: 8px;
  margin-bottom: 12px;
}

.relation-form button {
  white-space: nowrap;
  padding: 0 9px;
}

#relationSubmitButton {
  min-width: 0;
  width: 76px;
  font-size: 0.78rem;
}

.combo-label {
  position: relative;
}

.combo-field {
  display: grid;
  grid-template-columns: 1fr 36px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fbfcfb;
  overflow: hidden;
}

.combo-field input {
  border: 0;
  border-radius: 0;
  background: transparent;
}

.combo-toggle {
  min-height: 100%;
  width: 36px;
  border-left: 1px solid var(--line);
  border-radius: 0;
  background: #eef3f0;
  color: var(--text);
  padding: 0;
}

.combo-toggle:hover {
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.combo-options {
  position: absolute;
  z-index: 20;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 220px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
  padding: 4px;
}

.combo-option {
  display: block;
  width: 100%;
  min-height: 34px;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  text-align: left;
}

.combo-option:hover,
.combo-option.active {
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.table-wrap {
  max-height: calc(100vh - 310px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 640px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 9px;
  text-align: left;
  vertical-align: top;
}

th {
  position: sticky;
  top: 0;
  background: #fbfcfb;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

tr:last-child td {
  border-bottom: 0;
}

.direction {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-weight: 860;
}

.direction-plus {
  background: #dff3e8;
  color: #16643b;
}

.direction-minus {
  background: #ffe2e0;
  color: #a4261d;
}

.direction-neutral {
  background: #dfeeff;
  color: #195a9d;
}

.coding-stack {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.coding-lists {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.coding-lists h3 {
  margin-bottom: 7px;
}

.glossary-list {
  max-height: calc(100vh - 210px);
  overflow: auto;
}

.glossary-item {
  gap: 8px;
  border-left: 5px solid var(--concept-color);
}

.glossary-evidence {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}

.inline-edit-label {
  display: grid;
  gap: 5px;
}

.inline-edit-label span {
  font-size: 0.76rem;
  font-weight: 760;
  color: var(--muted);
}

.concept-chip {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  border-radius: 7px;
  background: var(--concept-color);
  color: var(--text);
  font-weight: 760;
  padding: 4px 7px;
}

.concept-swatch {
  display: inline-block;
  width: 0.72rem;
  height: 0.72rem;
  margin-right: 6px;
  border: 1px solid rgba(24, 32, 29, 0.16);
  border-radius: 999px;
  background: var(--concept-color);
  vertical-align: -0.05em;
}

.glossary-actions {
  display: flex;
  gap: 8px;
}

.glossary-table-panel {
  min-height: calc(100vh - 118px);
}

.glossary-table-toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.glossary-context-panel {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 10px;
  align-items: end;
  margin-bottom: 12px;
}

.glossary-context-panel label {
  display: grid;
  gap: 5px;
  font-size: 0.76rem;
  font-weight: 760;
  color: var(--muted);
}

.glossary-context-panel select {
  min-width: 0;
}

.glossary-context-panel .scope-highlight-label {
  color: var(--accent-dark);
  font-weight: 700;
}

.glossary-context-panel .scope-highlight {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 2px rgba(24, 121, 85, 0.14);
}

.glossary-table-wrap {
  max-height: calc(100vh - 240px);
}

.glossary-table {
  min-width: 760px;
  table-layout: fixed;
}

.glossary-table th,
.glossary-table td {
  text-align: left;
  vertical-align: top;
}

.glossary-table th:nth-child(1) {
  width: 76px;
}

.glossary-table th:nth-child(2) {
  width: 32%;
}

.glossary-table th:nth-child(3) {
  width: 23%;
}

.glossary-table th:nth-child(4) {
  width: 28%;
}

.glossary-table th:nth-child(5) {
  width: 120px;
}

.glossary-tags-input {
  width: 100%;
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 6px 8px;
  font-size: 0.9rem;
}

.glossary-table-concept {
  margin-bottom: 5px;
  justify-content: flex-start;
  text-align: left;
  border: 0;
  cursor: text;
}

.glossary-checkbox-cell {
  text-align: center;
}

.glossary-checkbox-cell input {
  margin-top: 5px;
}

.glossary-bulk-tools {
  display: flex;
  align-items: center;
  gap: 8px;
}

.glossary-concept-select {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  justify-content: flex-start;
  text-align: left;
}

.glossary-concept-edit {
  min-width: 0;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 6px 8px;
  font-size: 0.9rem;
}

.compact-checkbox {
  min-height: auto;
  gap: 6px;
  justify-content: flex-start;
  margin-bottom: 4px;
}

.table-heading-label {
  display: block;
  margin-top: 2px;
}

.tag-checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
  max-height: 260px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
}

.tag-checkbox {
  min-height: 32px;
}

.glossary-documents {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  font-size: 0.88rem;
  color: var(--muted);
}

.graph-panel {
  min-height: calc(100vh - 118px);
}

.graph-canvas {
  min-height: calc(100vh - 200px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
  overflow: auto;
}

.graph-canvas svg {
  width: 100%;
  min-width: 720px;
  height: auto;
  display: block;
}

.graph-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(180px, 2fr);
  gap: 10px;
  align-items: start;
  margin-bottom: 12px;
}

.graph-tabs {
  align-items: start;
  margin-bottom: 0;
  min-height: 0;
}

.graph-tab {
  background: transparent;
  color: var(--muted);
  min-height: 28px;
  padding: 0 9px;
  font-size: 0.72rem;
}

.graph-tab:hover,
.graph-tab.active {
  background: var(--accent);
  color: #fff;
}

.graph-reset-button {
  margin-left: 0;
  min-height: 28px;
  padding: 0 9px;
  font-size: 0.72rem;
}

.graph-side-tools {
  display: grid;
  grid-template-columns: repeat(3, minmax(110px, 1fr));
  gap: 8px;
  justify-self: end;
  width: min(42%, 520px);
  min-width: 360px;
}

.graph-tool-panel {
  display: grid;
  align-content: start;
  gap: 4px;
  min-width: 0;
  margin: 0;
  padding: 6px;
}

.graph-tool-panel strong {
  font-size: 0.68rem;
  line-height: 1;
}

.graph-zoom-control {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, auto));
  gap: 5px;
  align-items: center;
}

.graph-zoom-button {
  min-height: 28px;
  padding: 0 7px;
  font-size: 0.72rem;
}

.graph-zoom-panel .pill {
  min-height: 28px;
  padding: 0 7px;
  font-size: 0.72rem;
}

#graphFitButton {
  grid-column: 1 / -1;
}

.graph-tool-panel .export-control {
  display: grid;
  grid-template-columns: 1fr;
  gap: 4px;
}

.graph-tool-panel .export-control select {
  width: 100%;
  min-width: 0;
}

.graph-tool-panel .export-control button {
  min-height: 28px;
  padding: 0 8px;
  font-size: 0.72rem;
}

.graph-export-button {
  min-height: 36px;
  padding: 0 12px;
}

.graph-analytics-dialog {
  width: min(1120px, calc(100vw - 36px));
  max-height: calc(100vh - 36px);
  padding: 0;
}

.graph-analytics-dialog .graph-analytics-panel {
  max-height: calc(100vh - 56px);
  margin: 0;
  overflow: auto;
}

.dialog-heading-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.inline-select-label {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 760;
}

.inline-select-label select {
  min-height: 28px;
  padding: 3px 7px;
  font-size: 0.76rem;
}

.graph-analytics-panel {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}

.graph-analytics-table-wrap {
  max-height: 220px;
  overflow: auto;
}

.graph-analytics-table {
  min-width: 780px;
  font-size: 0.78rem;
}

.graph-analytics-table th,
.graph-analytics-table td {
  padding: 6px 7px;
}

.graph-analytics-table th:nth-child(2),
.graph-analytics-table td:nth-child(2) {
  min-width: 220px;
  text-align: left;
}

.matrix-canvas {
  min-height: calc(100vh - 200px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
  overflow: auto;
}

.matrix-wrap {
  min-width: 720px;
}

.matrix-table {
  min-width: 720px;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
}

.matrix-table th,
.matrix-table td {
  text-align: center;
  white-space: nowrap;
}

.matrix-table td,
.matrix-code-head,
.matrix-code-cell {
  width: 42px;
  min-width: 42px;
  max-width: 42px;
  height: 42px;
  min-height: 42px;
  padding: 0;
  line-height: 42px;
  overflow: hidden;
}

.matrix-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
}

.matrix-concept {
  width: 170px;
  max-width: 170px;
  min-width: 170px;
  height: 42px;
  padding: 4px 6px;
  text-align: left;
  white-space: normal;
}

.matrix-concept strong {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  line-height: 1.15;
}

.matrix-diagonal {
  background: #e5e7eb;
  border-color: #cfd4da;
}

.matrix-concept {
  position: sticky;
  left: 0;
  z-index: 1;
  width: 210px;
  min-width: 210px;
  max-width: 240px;
  background: #fbfcfb;
  border-left: 5px solid var(--concept-color);
  text-align: left !important;
  white-space: normal !important;
}

.matrix-code-cell {
  position: sticky;
  left: 210px;
  z-index: 1;
  width: 54px;
  min-width: 54px;
  background: #fbfcfb;
  color: var(--accent-dark);
  font-size: 0.78rem;
  font-weight: 860;
  text-align: center !important;
}

.matrix-concept strong {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-height: 1.25;
}

.matrix-edit-button {
  margin-top: 6px;
}

.matrix-concept-edit {
  width: 100%;
  margin-top: 6px;
  font-size: 0.78rem;
}

.matrix-actions {
  margin-top: 6px;
}

.matrix-linked {
  background: var(--concept-color);
  color: var(--accent-dark);
  font-weight: 860;
}

.graph-edge {
  fill: none;
  stroke: #5c6a63;
  stroke-width: 1.8;
}

.graph-edge.directed {
  stroke: #405047;
  stroke-width: 2.35;
}

.graph-edge.undirected {
  stroke-dasharray: none;
}

.graph-edge-label {
  fill: #405047;
  font-size: 12px;
  text-anchor: middle;
}

.graph-node {
  stroke: var(--accent);
  stroke-width: 2;
}

.graph-node-group {
  cursor: grab;
  touch-action: none;
}

.graph-node-group.dragging {
  cursor: grabbing;
}

.graph-node-group.dragging .graph-node {
  stroke-width: 3;
  filter: drop-shadow(0 5px 10px rgba(28, 82, 63, 0.18));
}

.graph-node-group.uncovered-focus .graph-node {
  stroke: #111827;
  stroke-width: 4;
}

.graph-node-label {
  fill: var(--text);
  font-size: 12px;
  font-weight: 760;
  text-anchor: middle;
}

.graph-node-metric {
  fill: #1f4d3b;
  font-size: 10px;
  font-weight: 820;
  text-anchor: middle;
}

.graph-analytics-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.analytics-card {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}

.analytics-card:last-child {
  grid-column: 1 / -1;
}

.analytics-path-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 8px 0;
}

.analytics-list {
  display: grid;
  gap: 6px;
  max-height: 150px;
  overflow: auto;
  color: var(--text);
  font-size: 0.78rem;
  line-height: 1.35;
}

.analytics-list p {
  margin: 0;
  overflow-wrap: anywhere;
}

.analytics-list span {
  display: inline-block;
  padding: 2px 4px;
  border-radius: 4px;
  background: #eef6f1;
  font-weight: 720;
}

.empty,
.empty-cell {
  color: var(--muted);
}

.empty {
  margin: 0;
  padding: 10px 0;
}

.archetypes-panel {
  min-height: calc(100vh - 150px);
}

.archetypes-toolbar {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
}

.archetype-strategy-tabs {
  margin: 0;
}

.archetype-strategy-tab {
  background: #f6f8f5;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  cursor: pointer;
  font-weight: 760;
  padding: 8px 12px;
}

.archetype-strategy-tab.active {
  background: var(--accent-dark);
  color: #ffffff;
}

.archetypes-layout {
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(220px, 0.85fr) minmax(360px, 1.55fr) minmax(240px, 0.9fr);
}

.archetype-copy-panel,
.archetype-graph-panel,
.archetype-loop-panel {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
}

.archetype-copy-panel h3,
.archetype-loop-panel h3 {
  margin: 6px 0 8px;
}

.archetype-graph-canvas {
  min-height: 290px;
  overflow: auto;
}

.archetype-current-graph-canvas {
  min-height: 300px;
  overflow: auto;
}

.archetype-graph-canvas svg,
.archetype-current-graph-canvas svg {
  display: block;
  min-width: 620px;
  width: 100%;
}

.archetype-middle-block {
  border-bottom: 1px solid var(--border);
  display: grid;
  gap: 8px;
  padding-bottom: 10px;
}

.archetype-middle-block + .archetype-middle-block {
  border-bottom: 0;
  padding-top: 10px;
}

.archetype-middle-heading {
  align-items: center;
  display: flex;
  gap: 8px;
  justify-content: space-between;
}

.archetype-middle-heading h3 {
  margin: 0;
}

.archetype-current-tabs {
  margin: 0;
}

.archetype-current-tab {
  background: #f6f8f5;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  cursor: pointer;
  font-size: 12px;
  font-weight: 760;
  padding: 6px 9px;
}

.archetype-current-tab.active {
  background: var(--accent-dark);
  color: #ffffff;
}

.archetype-edge {
  fill: none;
  stroke: #405047;
  stroke-width: 2;
}

.archetype-edge.delayed {
  stroke-dasharray: 7 5;
}

.archetype-edge-label {
  fill: #24352d;
  font-size: 12px;
  font-weight: 850;
  text-anchor: middle;
}

.archetype-edge-label.polarity-plus {
  fill: #23784c;
}

.archetype-edge-label.polarity-minus {
  fill: #b34545;
}

.archetype-node {
  fill: #f7faf7;
  stroke: var(--accent);
  stroke-width: 1.8;
}

.archetype-node-label {
  fill: var(--text);
  font-size: 11px;
  font-weight: 760;
  text-anchor: middle;
}

.archetype-current-node {
  stroke: var(--accent);
  stroke-width: 1.8;
}

.current-edge.undirected {
  stroke-dasharray: 6 4;
}

.archetype-matrix-wrap {
  overflow: auto;
}

.archetype-current-matrix th,
.archetype-current-matrix td {
  height: 34px;
  min-width: 34px;
  text-align: center;
}

.archetype-current-matrix .matrix-concept-cell {
  max-width: 150px;
  min-width: 120px;
  text-align: left;
}

.archetype-current-matrix .matrix-concept-cell span {
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  display: -webkit-box;
  overflow: hidden;
}

.archetype-current-matrix .matrix-concept-cell b {
  display: block;
  font-size: 11px;
  margin-top: 2px;
}

.matrix-missing-spot {
  background: #ffe7e3;
  border-color: #d95c4f;
  color: #b1281d;
  font-weight: 900;
}

.matrix-same-spot {
  background: #dff4e6;
  border-color: #48a067;
  color: #1f6f3f;
  font-weight: 900;
}

.matrix-different-spot {
  background: #fff2cc;
  border-color: #c59b32;
  color: #7a5a00;
  font-weight: 900;
}

.missing-matrix-label {
  color: #b1281d !important;
}

.loop-badge {
  border-radius: 999px;
  color: #ffffff;
  display: inline-block;
  font-size: 11px;
  margin-right: 5px;
  min-width: 28px;
  padding: 2px 6px;
  text-align: center;
}

.loop-badge.reinforcing {
  background: #23784c;
}

.loop-badge.balancing {
  background: #466aa0;
}

.glossary-scope-tools {
  border: 1px solid var(--border);
  border-radius: 8px;
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
  padding: 10px;
}

.glossary-scope-tools label {
  display: grid;
  gap: 4px;
}

.glossary-tool-row {
  align-items: center;
  display: grid;
  gap: 6px;
  grid-template-columns: minmax(0, 1fr) auto;
}

.glossary-tool-row:has(select + select) {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
}

.archetype-compare-panel {
  background: #f8faf7;
  border: 1px solid var(--border);
  border-radius: 8px;
  display: grid;
  gap: 8px;
  margin: 12px 0;
  padding: 10px;
}

.archetype-compare-head {
  align-items: center;
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(0, 1fr) auto auto;
}

.archetype-compare-head select {
  max-width: 130px;
}

.archetype-compare-result {
  display: grid;
  gap: 8px;
}

body.cmu-light-layout {
  background: var(--cmu-bg);
}

.cmu-light-layout .analysis-layout {
  display: grid;
  grid-template-columns: 2fr 2fr 1fr;
  gap: 16px;
  align-items: stretch;
  padding: 16px;
}

.cmu-light-layout .analysis-right {
  display: contents;
}

.cmu-light-layout .document-reader {
  font-size: 0.96rem;
  line-height: 1.62;
}

.cmu-light-layout .relation-form {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(84px, 0.45fr) minmax(0, 1.25fr) auto auto;
  gap: 12px;
  align-items: end;
}

.cmu-light-layout #relationSubmitButton {
  align-self: end;
  min-width: 96px;
  width: auto;
}

.cmu-light-layout .glossary-tag-list-panel {
  border: 1px solid var(--cmu-border);
  border-radius: 8px;
  margin-bottom: 12px;
  padding: 10px;
}

.glossary-tag-count-list {
  display: grid;
  gap: 5px;
  margin-top: 8px;
  max-height: 220px;
  overflow: auto;
}

.glossary-tag-count-list button {
  align-items: center;
  background: #fff;
  border: 1px solid var(--cmu-border);
  color: var(--cmu-text);
  display: flex;
  justify-content: space-between;
  min-height: 28px;
  padding: 4px 8px;
  text-align: left;
}

.glossary-tag-count-list button.active,
.glossary-tag-count-list button:hover {
  background: var(--cmu-blue-soft);
  border-color: #b7c7ff;
  color: var(--cmu-blue);
}

.glossary-tag-count-list b {
  color: var(--cmu-muted);
  font-size: 0.78rem;
}

.cmu-light-layout .archetypes-layout {
  display: grid;
  grid-template-columns: 1fr 2fr 2fr;
  gap: 16px;
  align-items: stretch;
  padding: 16px;
}

.cmu-light-layout .archetype-copy-panel,
.cmu-light-layout .archetype-graph-panel,
.cmu-light-layout .archetype-loop-panel {
  background: var(--cmu-panel);
  border-color: var(--cmu-border);
  border-radius: 10px;
}

.cmu-light-layout .archetype-copy-panel .details-list dt:nth-of-type(3),
.cmu-light-layout .archetype-copy-panel .details-list dd:nth-of-type(3) {
  display: none;
}

.archetype-catalog-list {
  display: grid;
  gap: 8px;
  margin: 10px 0 14px;
}

.archetype-catalog-item {
  align-items: center;
  background: #fff;
  border: 1px solid var(--cmu-border);
  color: var(--cmu-text);
  display: grid;
  gap: 8px;
  grid-template-columns: auto minmax(0, 1fr) auto;
  min-height: 52px;
  padding: 8px;
  text-align: left;
}

.archetype-catalog-item.active,
.archetype-catalog-item:hover {
  background: var(--cmu-blue-soft);
  border-color: #b7c7ff;
  color: var(--cmu-text);
}

.archetype-catalog-icon {
  border: 1px solid var(--cmu-border);
  border-radius: 6px;
  color: var(--cmu-blue);
  font-size: 0.62rem;
  font-weight: 900;
  padding: 4px;
}

.archetype-catalog-item em {
  color: var(--cmu-muted);
  display: -webkit-box;
  font-size: 0.72rem;
  font-style: normal;
  line-height: 1.25;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}

.archetype-matrix-comparison {
  display: grid;
  gap: 14px;
}

.adjacency-matrix {
  display: grid;
  gap: 8px;
}

.adjacency-matrix h3 {
  margin: 0;
}

.matrix-scroll {
  max-width: 100%;
  overflow: auto;
}

.adjacency-matrix-table {
  min-width: 520px;
}

.adjacency-matrix-table th {
  font-weight: 700;
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.adjacency-matrix-table td,
.adjacency-matrix-table th {
  text-align: center;
}

.adjacency-matrix-table tbody th {
  text-align: left;
}

.adjacency-matrix-table .matrix-cell-active {
  background: var(--cmu-blue-soft);
  color: var(--cmu-blue);
  font-weight: 900;
}

.archetype-behavior-panel {
  display: grid;
  gap: 8px;
}

.behavior-curve {
  border: 1px solid var(--cmu-border);
  border-radius: 8px;
  padding: 8px;
}

.behavior-curve svg {
  display: block;
  width: 100%;
}

.compare-score {
  align-items: baseline;
  display: flex;
  gap: 8px;
}

.compare-score strong {
  color: var(--accent-dark);
  font-size: 28px;
  line-height: 1;
}

.compare-score span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}

.compare-grid {
  display: grid;
  gap: 5px 8px;
  grid-template-columns: minmax(84px, 1fr) auto auto;
}

.compare-grid span,
.compare-grid em {
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
}

.compare-grid b {
  font-size: 12px;
  text-align: right;
}

.loop-card {
  background: #fbfcfa;
  border: 1px solid var(--border);
  border-left: 5px solid #466aa0;
  border-radius: 8px;
  display: grid;
  gap: 8px;
  margin-bottom: 8px;
  padding: 10px;
}

.loop-card.reinforcing {
  border-left-color: #23784c;
}

.loop-card p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  margin: 0;
}

.loop-card-head {
  align-items: center;
  display: grid;
  gap: 8px;
  grid-template-columns: auto minmax(0, 1fr);
}

.loop-card-head strong,
.loop-card-head span {
  display: block;
  min-width: 0;
}

.loop-card-head strong {
  font-size: 13px;
}

.loop-card-head div > span {
  color: var(--muted);
  font-size: 11px;
  margin-top: 2px;
}

.loop-edge-list {
  display: grid;
  gap: 4px;
}

.loop-edge-list span {
  background: #f3f6f1;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 11px;
  line-height: 1.25;
  overflow-wrap: anywhere;
  padding: 5px 7px;
}

.polarity-plus {
  color: #23784c;
}

.polarity-minus {
  color: #b34545;
}

.json-preview {
  background: #f6f8f5;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 11px;
  max-height: 250px;
  overflow: auto;
  padding: 10px;
  white-space: pre-wrap;
}

@media (max-width: 1260px) {
  .analysis-layout,
  .analysis-right,
  .administration-layout,
  .graph-analytics-grid,
  .graph-toolbar,
  .archetypes-layout,
  .projects-layout {
    grid-template-columns: 1fr;
  }

  .graph-side-tools {
    justify-self: stretch;
    width: 100%;
    min-width: 0;
  }

  .table-wrap {
    max-height: none;
  }

  .coding-stack,
  .coding-lists {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 820px) {
  .topbar {
    grid-template-columns: 1fr;
  }

  .top-actions {
    justify-content: flex-start;
  }

  .view-nav {
    width: 100%;
    grid-template-columns: 1fr;
  }

  .view-button {
    width: 100%;
  }

  .document-form,
  .pdf-import-form,
  .table-import-form,
  .relation-form {
    grid-template-columns: 1fr;
  }

  .project-item,
  .document-item,
  .project-actions,
  .document-actions,
  .form-actions {
    align-items: stretch;
    grid-template-columns: 1fr;
    flex-direction: column;
  }

  .selection-tools {
    align-items: flex-start;
    flex-direction: column;
  }
}
