/* The document area: tabs, breadcrumbs, the tool frame and the diagram surface. */

.tabbar {
  height: 36px;
  flex: none;
  display: flex;
  align-items: stretch;
  border-bottom: 1px solid var(--line);
  padding-right: 8px;
  gap: 8px;
}
.tabs {
  display: flex;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
  flex: 1;
}
.tab {
  flex: none;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 6px 0 10px;
  border-bottom: 3px solid transparent;
  border-top: 3px solid transparent;
  color: var(--muted);
  min-width: 0;
  white-space: nowrap;
}
.tab span {
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 190px;
}
.tab:hover {
  background: var(--hover);
}
.tab.on {
  border-bottom-color: var(--accent);
  color: var(--fg);
}
.tab .x {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  display: grid;
  place-items: center;
  opacity: 0.6;
}
.tab .x:hover {
  background: var(--ctl);
  opacity: 1;
}
.tab .x .i {
  width: 10px;
  height: 10px;
}
/* the row of views of what shows: nothing where there is none */
.tabbar .seg {
  align-self: center;
}
.tabbar .seg:empty {
  display: none;
}
/* the breadcrumbs, and at their right what the tool that shows adds to them: a row as high as the row of the tabs over
   it, that ends at the right where that one does */
.crumbs {
  height: 36px;
  flex: none;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 8px 0 10px;
  color: var(--muted);
  font-size: 12px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  overflow: hidden;
}
.crumbs .path {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 2px;
  overflow: hidden;
}
.crumbs .path button {
  padding: 1px 5px;
  border-radius: 4px;
  display: inline-flex;
  gap: 5px;
  align-items: center;
}
.crumbs .path button:hover {
  background: var(--hover);
  color: var(--fg);
}
.crumbs .i {
  width: 12px;
  height: 12px;
}
.crumbs .cur {
  color: var(--fg);
}
/* What a tool adds is as high as the switch at the right of the tabs is, and written as large: a switch is that switch
   and a button or a search is as high as it, so the row is as high with it as without. Where the row has no room for
   both, a legend gives way before the breadcrumbs do: it shows as many of its entries as there is room for, each of
   them whole. A button, a switch or a search gives way to nothing. */
.crumbs .side {
  flex: 0 1000 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  overflow: hidden;
  font-size: var(--fs);
}
.crumbs .side:has(.btn, .seg, .find) {
  flex-shrink: 0;
}
.crumbs .side .km-legend {
  flex: 0 1 auto;
  min-width: 0;
  max-height: 18px;
  flex-wrap: wrap;
  row-gap: 10px;
  overflow: hidden;
  font-size: 12px;
}
.crumbs .side:empty {
  display: none;
}
.crumbs .side .btn {
  height: 26px;
  padding: 0 9px;
  border-radius: 5px;
  gap: 5px;
}
/* the field that searches what shows, with its icon before it */
.find {
  flex: none;
  width: 200px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
}
.find .i {
  flex: none;
}
.find .in {
  height: 26px;
  width: 100%;
  min-width: 0;
  border-radius: 5px;
}
/* the error that disables what the document area shows, above it */
.disabled-by {
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  padding: 2px 10px;
  border-top: 1px solid var(--line);
  font-size: 12px;
}
.disabled-by span {
  flex: 1;
  min-width: 0;
}
.disabled-by.on-disk {
  border-top: 0;
  border-bottom: 1px solid var(--line);
}
.disabled-by .btn {
  flex: none;
  height: 22px;
  padding: 0 9px;
}
.doc {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}
/* a bar of controls a tool has over what it shows: the views of a table, the tags a graph is filtered by. It is as high
   as the rows of the tabs and of the breadcrumbs over it. */
.tb {
  height: 36px;
  flex: none;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
}
/* what a tool shows; the header of a diagram is at its top left */
.tbody {
  flex: 1;
  min-height: 0;
  display: flex;
  overflow: hidden;
  position: relative;
}
.sq {
  width: 9px;
  height: 9px;
  border-radius: 2px;
  background: currentColor;
  flex: none;
}
/* The surface a diagram is drawn on. The diagram is in the middle of it: the middle of the surface is where the middle
   of the diagram is, and not its top left. A diagram that is larger than the surface begins at the top left and is
   scrolled. Over and under it is the room the header at the top left takes, so that nothing of it is under that
   header and the middle stays the middle. */
.surf {
  flex: 1;
  min-width: 0;
  overflow: auto;
  display: flex;
  padding: 48px 8px;
  background-image: radial-gradient(var(--grid) 1px, transparent 1px);
  background-size: 20px 20px;
}
.dg {
  position: relative;
  flex: none;
  margin: auto;
}
/* a surface that is a plane is dragged along by the pointer, and nothing on it is selected as text meanwhile; it is
   not scrolled but moved, as the canvas of a level is, so it goes as far as the pointer takes it */
.surf.pans {
  user-select: none;
  overflow: hidden;
  cursor: grab;
  background-image: radial-gradient(var(--grid) 1.2px, transparent 1.2px);
}
.surf > .pl {
  flex: 1;
  min-width: 0;
  display: flex;
}
.surf.panning {
  cursor: grabbing;
}
/* a diagram is as large as its surface zooms it */
.surf .dg {
  zoom: var(--zoom, 1);
}
.dg > svg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: visible;
}
.dg path,
.dg line {
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.3;
}
.dg text {
  fill: var(--muted);
  font: 11px var(--ui);
  stroke: var(--editor);
  stroke-width: 4px;
  paint-order: stroke;
}
.dn {
  position: absolute;
  background: var(--bg);
  border: 1px solid var(--ctl);
  border-radius: 6px;
  padding: 5px 9px;
  text-align: left;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1px;
  overflow: hidden;
}
.dn small {
  font-size: 10.5px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
}
.dn span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dn:hover {
  border-color: var(--muted);
}
.dn.on {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}
.dn.err {
  border-color: var(--red);
}
.dn.new span {
  color: var(--green);
}
.en {
  position: absolute;
  width: 170px;
  background: var(--bg);
  border: 1px solid var(--ctl);
  border-radius: 6px;
  overflow: hidden;
  text-align: left;
  padding: 0;
}
.en:hover {
  border-color: var(--muted);
}
.en.on {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}
.en b {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 9px;
  border-bottom: 1px solid var(--line);
  font-weight: 600;
}
.en i {
  font-style: normal;
  display: block;
  padding: 0 9px;
  height: 19px;
  line-height: 19px;
  font: 11.5px/19px var(--mono);
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
