.data-workspace-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

html.research-record-modal-open,
html.research-record-modal-open body {
  overflow: hidden;
}

.research-record-dialog {
  width: min(620px, calc(100vw - 32px));
  max-width: 100%;
  max-height: calc(100dvh - 32px);
  margin: auto;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--ui-dialog-border, var(--ui-border));
  border-radius: 8px;
  background: var(--ui-surface);
  color: var(--ui-text);
  box-shadow: 0 20px 64px var(--ui-dialog-shadow, var(--ui-shadow, transparent));
}

.research-record-dialog::backdrop {
  background: var(--ui-backdrop, rgb(20 32 40 / 45%));
}

.research-record-layout {
  display: flex;
  flex-direction: column;
  max-height: calc(100dvh - 34px);
}

.research-record-header,
.research-record-footer {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
}

.research-record-header {
  border-bottom: 1px solid var(--ui-border);
}

.research-record-header h2 {
  font-size: 18px;
}

.research-record-help {
  margin-top: 5px;
  color: var(--ui-text-muted);
  font-size: 12px;
  line-height: 1.55;
}

.research-record-body {
  min-height: 0;
  padding: 18px 20px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.research-record-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.research-record-field {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 6px;
  color: var(--ui-text-soft);
  font-size: 13px;
  font-weight: 650;
}

.research-record-field select {
  width: 100%;
  min-width: 0;
  min-height: 40px;
  padding: 7px 30px 7px 10px;
  font-weight: 400;
  text-overflow: ellipsis;
}

.research-record-reading {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin-top: 18px;
  color: var(--ui-text);
  line-height: 1.55;
  cursor: pointer;
}

.research-record-reading input {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  margin-top: 2px;
}

.research-record-reading-help {
  margin: 6px 0 0 27px;
  color: var(--ui-text-muted);
  font-size: 12px;
  line-height: 1.55;
}

.research-record-summary {
  margin-top: 18px;
  padding: 13px 14px;
  border: 1px solid var(--ui-border);
  border-radius: 5px;
  background: var(--ui-surface-subtle);
}

.research-record-summary:empty {
  display: none;
}

.research-record-summary h3 {
  margin-bottom: 8px;
  font-size: 14px;
}

.research-record-summary dl {
  display: grid;
  grid-template-columns: minmax(110px, 0.45fr) minmax(0, 1fr);
  gap: 6px 12px;
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
}

.research-record-summary dt {
  color: var(--ui-text-muted);
}

.research-record-summary dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
}

.research-record-summary-note {
  margin-top: 10px;
  color: var(--ui-text-soft);
  font-size: 12px;
  line-height: 1.55;
}

.research-record-status {
  min-height: 22px;
  margin-top: 12px;
  color: var(--ui-text-soft);
  font-size: 13px;
  line-height: 1.55;
}

.research-record-status[data-kind="error"] {
  color: var(--ui-danger, #a32727);
}

.research-record-status[data-kind="warning"] {
  color: var(--ui-warning, #805500);
}

.research-record-status[data-kind="success"] {
  color: var(--ui-success, #236b45);
}

.research-record-retry {
  margin-left: 8px;
}

.research-record-footer {
  justify-content: flex-end;
  border-top: 1px solid var(--ui-border);
}

@media (max-width: 820px) {
  .data-workspace-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 520px) {
  .data-workspace-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .data-workspace-actions #research-record-open,
  .data-workspace-actions .data-tool-switch {
    align-self: flex-start;
  }

  .research-record-dialog {
    width: calc(100vw - 20px);
    max-height: calc(100dvh - 20px);
  }

  .research-record-layout {
    max-height: calc(100dvh - 22px);
  }

  .research-record-header,
  .research-record-body,
  .research-record-footer {
    padding-inline: 14px;
  }

  .research-record-fields {
    grid-template-columns: minmax(0, 1fr);
  }

  .research-record-summary dl {
    grid-template-columns: minmax(0, 1fr);
    gap: 2px;
  }

  .research-record-summary dd + dt {
    margin-top: 7px;
  }

  .research-record-footer .button {
    flex: 1;
  }
}
