.desk-tool {
  min-width: 0;
  display: grid;
  gap: 1rem;
  color: var(--text, #f3f6f9);
}

.desk-tool [hidden] {
  display: none;
}

.desk-tool-bar,
.desk-fields {
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: .75rem;
}

.desk-tool-bar {
  align-items: center;
}

.desk-fields-form,
.desk-rows,
.desk-results {
  min-width: 0;
  display: grid;
  gap: .875rem;
}

.desk-fields-form > * {
  min-width: 0;
}

.desk-fields-form > button {
  justify-self: start;
}

.desk-fields-form p,
.desk-tool .desk-results p {
  margin: .5rem 0;
  color: var(--muted, #c3ccd7);
}

.desk-fields-form fieldset,
.desk-tool details,
.desk-result-card {
  min-width: 0;
  margin: 0;
  border: 1px solid var(--line, #465263);
  background: var(--panel, #1c2430);
  border-radius: 4px;
  padding: clamp(.7rem, 2vw, 1rem);
}

.desk-fields-form fieldset + fieldset {
  margin-top: .875rem;
}

.desk-fields-form legend,
.desk-tool summary {
  font-size: 1rem;
  font-weight: 750;
}

.desk-tool summary {
  cursor: pointer;
  overflow-wrap: anywhere;
}

.desk-tool details[open] > summary {
  margin-bottom: .8rem;
}

.desk-tool details > details,
.desk-tool details > button {
  margin-top: .75rem;
}

.desk-fields > .desk-field {
  flex: 1 1 10rem;
}

.desk-field {
  min-width: min(100%, 8rem);
  display: flex;
  flex-direction: column;
  gap: .3rem;
  color: var(--muted, #c3ccd7);
}

.desk-field input,
.desk-field select,
.desk-field textarea {
  box-sizing: border-box;
  display: block;
  width: 100%;
  min-height: 2.75rem;
  padding: .55rem .65rem;
  border: 1px solid var(--line, #465263);
  border-radius: 4px;
  color: var(--text, #f3f6f9);
  background: var(--page, #11151c);
  font: inherit;
  color-scheme: dark;
}

.desk-field textarea {
  resize: vertical;
}

.desk-tool button,
.desk-import {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  padding: .5rem .85rem;
  border: 1px solid var(--line, #465263);
  border-radius: 4px;
  color: var(--text, #f3f6f9);
  background: var(--panel, #1c2430);
  font: inherit;
  font-weight: 700;
  text-align: center;
  cursor: pointer;
}

.desk-tool button:hover:not(:disabled),
.desk-import:hover {
  border-color: var(--accent, #d7ff3f);
}

.desk-tool button.desk-primary {
  color: #11151c;
  background: var(--accent, #d7ff3f);
  border-color: var(--accent, #d7ff3f);
}

.desk-tool button:disabled {
  opacity: .53;
  cursor: default;
}

.desk-tool button.desk-primary:focus-visible {
  outline-color: #11151c;
  box-shadow: 0 0 0 6px #f3f6f9;
}

.desk-import {
  position: relative;
}

.desk-import:focus-within {
  outline: 3px solid var(--accent, #d7ff3f);
  outline-offset: 3px;
}

.desk-import input {
  position: absolute;
  width: 1px;
  height: 1px;
  clip-path: inset(50%);
}

.desk-demo {
  color: #f7ce79;
}

.desk-result-card h3 {
  margin: 0 0 .75rem;
  font-size: 1.12rem;
}

.desk-result-card strong {
  display: block;
  margin-bottom: .7rem;
}

.desk-results-data {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
  gap: .5rem;
  margin: 0;
  overflow-wrap: anywhere;
}

.desk-results-data dt {
  color: var(--muted, #c3ccd7);
}

.desk-results-data dd {
  min-width: 0;
  margin: 0;
  font-variant-numeric: tabular-nums;
  font-weight: 720;
}

.desk-findings {
  margin: .65rem 0 0;
  padding-inline-start: 1.3rem;
  overflow-wrap: anywhere;
}

.desk-matrix,
.desk-diagram {
  max-width: 100%;
  overflow: auto;
  border: 1px solid var(--line, #465263);
  border-radius: 4px;
}

.desk-matrix table {
  min-width: max-content;
  width: 100%;
  border-collapse: collapse;
}

.desk-matrix :is(th, td) {
  min-width: 6rem;
  max-width: 15rem;
  padding: .55rem .7rem;
  border: 1px solid var(--line, #465263);
  text-align: start;
  vertical-align: top;
  overflow-wrap: anywhere;
}

.desk-diagram {
  margin-bottom: .8rem;
}

.desk-diagram canvas {
  display: block;
  width: 100%;
  min-width: 400px;
  height: auto;
}

.desk-live {
  min-height: 1.5rem;
  margin: 0;
  color: var(--muted, #c3ccd7);
}

.desk-copy-buffer,
.desk-copy-fallback {
  position: fixed;
  padding: .7rem;
  left: 0;
  top: 0;
  z-index: 20;
}

.desk-copy-buffer {
  width: 1px;
  height: 1px;
  opacity: 0;
}

.desk-copy-fallback {
  inset: 1rem 1rem auto;
  min-height: 10rem;
}
