body {
  margin: 0;
  font-family: sans-serif;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.topbar {
  display: flex;
  background-color: #ddd;
  z-index: 400;
  position: relative;
  flex-shrink: 0;
  gap: 0;
}

.buttonbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  width: 100%;
}

.btn-grey {
  background-color: #e0e0e0;
  border: 1px solid #ccc;
  color: #333;
  padding: 6px 12px;
  font-size: 14px;
  font-weight: 500;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.btn-grey:hover {
  background-color: #d5d5d5;
  border-color: #bbb;
}

.btn-grey:active {
  background-color: #c9c9c9;
  border-color: #aaa;
}

.btn-grey:focus {
  outline: none;
  box-shadow: 0 0 0 0.2rem rgba(180, 180, 180, 0.5);
}

.btn-grey-tsm {
  background-color: #e0e0e0;
  border: 1px solid #ccc;
  color: #333;
  padding: 4px 4px;
  font-size: 14px;
  font-weight: 500;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.topbar-header {
  background-color: #f4f4f4;
  width: 300px;
  min-width: 150px;
  padding: 10px;
  overflow-y: auto;
  display: flex;
  flex-shrink: 0;
  flex-direction: column;
  box-sizing: border-box;
}

#main {
  flex: 1;
  display: flex;
  height: 100%;
  overflow: hidden;
}

#controls {
  width: 300px;
  min-width: 150px;
  background-color: #f4f4f4;
  padding: 10px;
  box-sizing: border-box;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.resizer {
  width: 5px;
  background: #ccc;
  cursor: col-resize;
  user-select: none;
  flex-shrink: 0;
}

#schemagrid {
  flex: 1;
  background-color: #fff;
  overflow: scroll;
  position: relative;

  background-image:
    linear-gradient(to right, rgba(0,0,0,0.05) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(0,0,0,0.05) 1px, transparent 1px),
    linear-gradient(to right, rgba(0,0,0,0.15) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(0,0,0,0.15) 1px, transparent 1px);
  background-size: 10px 10px, 10px 10px, 50px 50px, 50px 50px;
}

.table {
  position: absolute;
  top: 50px;
  left: 50px;
  width: 200px;
  border-radius: 6px;
}

.title {
  font-weight: bold;
  margin-bottom: 6px;
}

.field {
  position: relative;
  padding: 4px 8px;
  margin-bottom: 4px;
  background: #eee;
  border-radius: 4px;
}

.endpoint {
  position: absolute;
  width: 10px;
  height: 10px;
  background: #333;
  border-radius: 50%;
  right: -6px;
  cursor: crosshair;
}

#addTableBtn {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 10;
  padding: 8px 12px;
  font-size: 16px;
}

/**
 * Treeview
 */
#treeview {
  flex: 1 1 auto;
  overflow-y: auto;
  margin-top: 10px;
  border: 1px solid #ccc;
  padding: 8px;
  font-size: 14px;
  background-color: #fff;
}

.treeview ul {
  list-style-type: none;
  margin: 0;
  padding-left: 1em;
  border-left: 1px dashed #ccc;
}

.treeview ul ul {
  margin-left: 0.5em;
}

.folder-line {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 2px 4px;
  border-radius: 4px;
  transition: background 0.2s ease;
}

.folder-line:hover {
  background-color: #f0f4f8;
}

.folder-line-hover {
  background-color: #a9c9e8;
}

.treeview .folder {
  cursor: pointer;
  user-select: none;
  font-weight: 500;
}

.treeview-file {
  font-style: italic;
  color: #555;
}

.treeview-file.active {
  background-color: #d0e6ff;
  border-radius: 4px;
  padding: 2px 4px;
}

.treeview-file.active2 {
  background-color: #d8f5dc;
  border-radius: 4px;
  padding: 2px 4px;
}

.folder-line button {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 12px;
  border-radius: 4px;
  transition: background 0.2s ease;
}

.folder-line:hover button {
  display: unset;
}

.folder-line button:hover {
  background-color: #e0e0e0;
}

button.delete-folder {
  color: #c00;
}

button.add-folder {
  color: #006400;
}

.toggle-icon {
  display: inline-block;
  width: 1em;
  cursor: pointer;
  user-select: none;
  transition: transform 0.3s ease;
}

.folder-line.dragging button {
  display: none;
}

.toggle-icon.dragging {
  display: none;
}

.folder-line.open > .toggle-icon {
  /*transform: rotate(90deg);*/
}

.drag-over {
  background-color: #f0f0f0;
  outline: 1px dashed #888;
}

.jtk-connector.hovered-connection path {
  stroke: #ff6600 !important;
  stroke-width: 2px !important;
}

.drop-area {
  background-color: #ffe0b2;
  border: 2px dashed #ff8000;
  color: #ff6600;
  font-weight: 16;
  padding: 10px;
  margin-top: 10px;
  text-align: center;
  transition: all 0.2s ease;
}

.drop-area.hidden {
  display: none;
}

.drop-area.hover {
  background-color: #ff8000;
  color: #000000;
}

.dialog-checkbox {
  width: 16px;
  height: 16px;
  accent-color: #3e7e9c;
}