/* What several tools draw inside the document area: forms, tables and code. What one tool draws is in the
   tools-view.css of its folder under src/tools/adp. */

.scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
}
.form {
  max-width: 680px;
  padding: 16px 20px 28px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.form h3 {
  margin: 12px 0 2px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--dim);
}
.fl {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}
.fl > span {
  color: var(--muted);
}
.fl .in {
  width: 100%;
}
.fl select.in {
  padding: 0 4px;
}
@media (max-width: 620px) {
  .fl {
    grid-template-columns: 1fr;
    gap: 3px;
  }
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.lnk {
  color: var(--link);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-align: left;
}
.lnk:hover {
  text-decoration: underline;
}
.grid {
  width: 100%;
  border-collapse: collapse;
}
.grid th {
  position: sticky;
  top: 0;
  background: var(--editor);
  text-align: left;
  font-weight: 500;
  color: var(--muted);
  height: 28px;
  padding: 0 10px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.grid td {
  height: 28px;
  padding: 0 10px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.grid tr.clk {
  cursor: pointer;
}
.grid tbody tr:hover {
  background: var(--hover);
}
.grid tbody tr.on {
  background: var(--sel);
}
.grid td .i {
  vertical-align: -3px;
  margin-right: 6px;
}
.cell {
  width: 100%;
  height: 24px;
  border-color: transparent;
  background: transparent;
}
.cell:hover {
  border-color: var(--ctl);
}
.grid td:has(.cell) {
  padding: 0 4px;
}
.ok {
  color: var(--green);
}
.bad {
  color: var(--red);
}
.wait {
  color: var(--muted);
}
.code {
  flex: 1;
  min-height: 0;
  overflow: auto;
  font: 12.5px/20px var(--mono);
  padding: 8px 0;
  counter-reset: ln;
  tab-size: 2;
}
.code div {
  white-space: pre;
  padding-right: 16px;
  min-height: 20px;
}
.code div::before {
  counter-increment: ln;
  content: counter(ln);
  display: inline-block;
  width: 44px;
  padding-right: 14px;
  text-align: right;
  color: var(--dim);
  user-select: none;
}
/* what is selected of a text is marked behind its letters, which keep their colours, as in a JetBrains IDE */
.code ::selection {
  background: var(--sel-text);
}
/* a text that is typed in: the field lies under the highlighted lines, as large as they are and with the same letters,
   and shows only its caret and what is selected, behind the letters; the lines let the pointer through to it */
.code.editing {
  scroll-padding: 20px 16px 20px 74px;
}
.code.editing .typing {
  display: block;
  position: relative;
  width: max-content;
  min-width: 100%;
  min-height: 100%;
}
.code.editing .lines {
  display: block;
  position: relative;
  z-index: 1;
  pointer-events: none;
}
/* the numbers beside the text are not typed in: a right click on them asks what a right click on the text asks */
.code.editing .lines div::before {
  pointer-events: auto;
}
.code.editing .typed {
  position: absolute;
  z-index: 0;
  inset: 0 0 0 58px;
  width: calc(100% - 58px);
  height: 100%;
  margin: 0;
  padding: 0 16px 0 0;
  border: 0;
  outline: 0;
  resize: none;
  overflow: hidden;
  background: transparent;
  color: transparent;
  caret-color: var(--fg);
  font: inherit;
  letter-spacing: normal;
  tab-size: 2;
  white-space: pre;
}
.code.editing .typed::selection {
  background: var(--sel-text);
  color: transparent;
}
/* the annotations of a text: a column before its lines that stays where it is while the text is scrolled sideways, a
   line of it as high as a line of the text */
.code.annotated {
  display: flex;
  align-items: flex-start;
}
.code.annotated > .typing,
.code.annotated > .lines {
  flex: 1 0 auto;
  min-width: 0;
}
.code .blame {
  flex: none;
  position: sticky;
  left: 0;
  z-index: 2;
  width: 200px;
  background: var(--bg);
  border-right: 1px solid var(--line);
}
.code .blame button,
.code .blame i {
  display: flex;
  gap: 8px;
  width: 100%;
  height: 20px;
  padding: 0 8px;
  border: 0;
  background: none;
  color: var(--muted);
  font: 12px/20px var(--ui);
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
}
.code .blame button {
  cursor: pointer;
}
.code .blame button:hover {
  background: var(--hover);
  color: var(--fg);
}
.code .blame span {
  overflow: hidden;
  text-overflow: ellipsis;
}
/* the difference between a file on disk and the text here */
.code.difference div::before {
  content: none;
}
.code.difference div {
  padding-left: 12px;
}
.code.difference b {
  display: inline-block;
  width: 20px;
  font-weight: 400;
  color: var(--dim);
  user-select: none;
}
.code.difference .theirs {
  background: color-mix(in srgb, var(--red) 14%, transparent);
}
.code.difference .mine {
  background: color-mix(in srgb, var(--green) 14%, transparent);
}
.code.difference .left-out {
  color: var(--dim);
}
/* the difference viewer: a bar, and both texts as a table whose rows are the lines; a changed line is blue, an added one
   green and a deleted one grey, and the difference that was gone to has a line beside it */
.diff-bar {
  flex: none;
  display: flex;
  align-items: center;
  gap: 4px;
  height: 30px;
  padding: 0 10px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}
.diff-bar select {
  height: 22px;
  margin-left: 6px;
}
.diff-bar .grow {
  flex: 1;
}
.diff-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  font: 12.5px/20px var(--mono);
  tab-size: 2;
}
.diff-body table {
  border-collapse: collapse;
  min-width: 100%;
}
.diff-body table.side {
  table-layout: fixed;
  width: 100%;
}
.diff-body th {
  position: sticky;
  top: 0;
  z-index: 1;
  height: 24px;
  padding: 0 12px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font: 12px var(--ui);
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.diff-body table.side th + th {
  border-left: 1px solid var(--line);
}
.diff-body table.side col.no {
  width: 60px;
}
.diff-body td {
  height: 20px;
  padding: 0;
}
.diff-body td.no {
  width: 44px;
  padding: 0 8px;
  background: var(--bg);
  color: var(--dim);
  text-align: right;
  user-select: none;
}
.diff-body td.tx {
  padding: 0 12px;
  white-space: pre;
  overflow: hidden;
  text-overflow: ellipsis;
}
.diff-body table.unified td.tx {
  overflow: visible;
}
.diff-body td.changed {
  background: color-mix(in srgb, var(--blue) 18%, transparent);
}
.diff-body td.added {
  background: color-mix(in srgb, var(--green) 18%, transparent);
}
.diff-body td.deleted {
  background: color-mix(in srgb, var(--dim) 22%, transparent);
}
/* where one text has a line and the other has none, the place of the line that is not there is hatched */
.diff-body td.none {
  background: repeating-linear-gradient(
    -45deg,
    transparent 0 5px,
    color-mix(in srgb, var(--dim) 16%, transparent) 5px 6px
  );
}
.diff-body tr.at td:first-child {
  box-shadow: inset 3px 0 0 var(--accent);
}
/* the scrollbars that move texts side by side across, together (Across): a line is cut at its side and its text is
   moved by as much as the scrollbars are */
.tx > .ac {
  display: inline-block;
  translate: calc(-1 * var(--across, 0px)) 0;
}
/* what is moved past the start of its side is cut where the text starts, not under the space before it */
.diff-body td.tx:has(> .ac),
.mg-l .tx:has(> .ac) {
  overflow: clip;
  overflow-clip-margin: content-box;
}
.ac-bar {
  flex: none;
  height: 12px;
  overflow-x: auto;
  overflow-y: hidden;
  background: var(--bg);
  border-top: 1px solid var(--line);
}
.ac-bar > div {
  height: 1px;
}
.ac-row {
  flex: none;
  display: grid;
}
/* side by side the numbers of both texts stand in the middle, between the two scrollbars */
.diff-across {
  grid-template-columns: minmax(0, 1fr) 120px minmax(0, 1fr);
}
.diff-across > span {
  background: var(--bg);
  border-top: 1px solid var(--line);
}
/* the three panes a file in conflict is merged in: a side each on the left and on the right, with the numbers of its
   lines and what takes a change or leaves it out toward the middle, and the result between them, which is typed in */
.diff-bar .mg-all {
  margin-left: 10px;
}
.diff-bar .lnk:disabled {
  opacity: 0.45;
  text-decoration: none;
  cursor: default;
}
.mg-panes {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr);
}
.mg-pane {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}
.mg-pane + .mg-pane {
  border-left: 1px solid var(--line);
}
.mg-t {
  flex: none;
  height: 24px;
  padding: 0 12px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font: 12px/24px var(--ui);
}
.mg-lines {
  flex: 1;
  min-height: 0;
  overflow: auto;
  font: 12.5px/20px var(--mono);
  tab-size: 2;
}
.mg-l {
  display: flex;
  height: 20px;
}
.mg-pane.theirs .mg-l {
  flex-direction: row-reverse;
}
.mg-l .tx {
  flex: 1;
  min-width: 0;
  padding: 0 12px;
  white-space: pre;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mg-l .no {
  flex: none;
  width: 40px;
  padding: 0 6px;
  background: var(--bg);
  color: var(--dim);
  text-align: right;
  user-select: none;
}
.mg-l .do {
  flex: none;
  width: 40px;
  display: flex;
  justify-content: center;
  background: var(--bg);
}
.mg-l .do .ib {
  width: 18px;
  height: 20px;
  border-radius: 3px;
  font: 12px/20px var(--ui);
}
.mg-c.changed .tx,
.mg-gutter .changed {
  background: color-mix(in srgb, var(--blue) 18%, transparent);
}
.mg-c.added .tx {
  background: color-mix(in srgb, var(--green) 18%, transparent);
}
.mg-c.deleted .tx {
  background: color-mix(in srgb, var(--dim) 22%, transparent);
}
.mg-c.conflict .tx,
.mg-gutter .conflict {
  background: color-mix(in srgb, var(--red) 20%, transparent);
}
/* a change that was taken or left out on this side is pale */
.mg-c.done .tx {
  opacity: 0.55;
}
.mg-c.at {
  outline: 1px solid var(--accent);
  outline-offset: -1px;
}
.mg-res {
  flex: 1;
  min-height: 0;
  display: flex;
}
.mg-gutter {
  flex: none;
  width: 44px;
  padding-bottom: 40px;
  overflow: hidden;
  background: var(--bg);
  color: var(--dim);
  font: 12.5px/20px var(--mono);
  text-align: right;
  user-select: none;
}
.mg-gutter div {
  height: 20px;
  padding: 0 8px;
}
.mg-gutter .at {
  color: var(--fg);
  box-shadow: inset 3px 0 0 var(--accent);
}
#mg-text {
  flex: 1;
  min-width: 0;
  margin: 0;
  padding: 0 12px;
  border: 0;
  outline: 0;
  resize: none;
  background: var(--editor);
  color: var(--fg);
  font: 12.5px/20px var(--mono);
  tab-size: 2;
  white-space: pre;
  overflow: auto;
}
.mg-foot {
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-top: 1px solid var(--line);
}
.mg-foot .grow {
  flex: 1;
}
.mg-foot .btn:disabled {
  opacity: 0.45;
  cursor: default;
}
/* "Conflicts": the files in conflict with what each side did to them, and beside them what resolves the selected
   ones */
.dlg.cf {
  width: min(680px, calc(100vw - 48px));
}
.cf-w {
  color: var(--muted);
  font-size: 12px;
}
.cf-b {
  display: flex;
  gap: 12px;
  margin-top: 4px;
}
.cf-list {
  flex: 1;
  min-width: 0;
  height: 220px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--editor);
}
#cf-files {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}
#cf-files th + th {
  width: 92px;
}
#cf-files th {
  position: sticky;
  top: 0;
  height: 24px;
  padding: 0 10px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  text-align: left;
}
#cf-files td {
  height: var(--row);
  padding: 0 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: default;
}
#cf-files td small {
  margin-left: 8px;
  color: var(--dim);
}
#cf-files tr.sel td {
  background: var(--sel);
}
.cf-acts {
  flex: none;
  width: 132px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.cf-acts .btn:disabled {
  opacity: 0.45;
  cursor: default;
  filter: none;
}
.kw {
  color: var(--kw);
}
.s {
  color: var(--str);
}
.nu {
  color: var(--num);
}
.cm {
  color: var(--com);
  font-style: italic;
}
.ky {
  color: var(--key);
}
