/* Project: edge-to-edge workspace. Colors come from the existing stylesheet. */
:root { --project-library-width: 320px; }

html, body {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
}

/* The header stays outside the two independently scrolling content panes. */
body > .shell {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: none;
  height: 100vh;
  height: 100dvh;
  margin: 0;
  padding: 0;
  gap: 0;
  min-height: 0;
}

.shell > .topbar {
  position: relative;
  z-index: 100;
  flex: 0 0 auto;
  margin: 0;
  padding: 10px 14px;
  border-width: 0 0 1px;
  border-radius: 0;
  box-shadow: none;
}

.shell > .filters { flex: 0 0 auto; margin: 0; border-radius: 0; }

.shell > .layout {
  display: grid;
  grid-template-columns: var(--project-library-width) 6px minmax(0, 1fr);
  align-items: stretch;
  flex: 1 1 0;
  min-height: 0;
  min-width: 0;
  margin: 0;
  padding: 0;
  gap: 0;
  overflow: hidden;
}

.layout > .left-pane,
.layout > .right-pane {
  position: relative;
  top: auto;
  min-width: 0;
  min-height: 0;
  height: 100%;
  max-height: none;
  margin: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.layout > .left-pane { display: flex; flex-direction: column; overflow: hidden; }
.layout > .left-pane > .tabs { flex: 0 0 auto; }
.layout > .left-pane > .tree-wrap {
  flex: 1 1 0;
  min-height: 0;
  max-height: none;
  overflow: auto;
  overscroll-behavior: contain;
}

.layout > .right-pane {
  overflow: auto;
  overscroll-behavior: contain;
  padding: 14px;
}

/* Square containers, including cards and dialogs; circular spinners stay circular. */
body div:not(.project-list-loading-spinner),
body aside,
body main,
body section,
body dialog,
body .card { border-radius: 0 !important; }

#projectLibraryResizer {
  align-self: stretch;
  min-width: 0;
  border-inline: 1px solid var(--line);
  background: var(--bg2);
  cursor: col-resize;
  touch-action: none;
}

#projectLibraryResizer:hover,
#projectLibraryResizer:focus-visible {
  background: var(--cyan-dim);
  outline: 1px solid var(--cyan);
  outline-offset: -1px;
}

body.project-library-resizing,
body.project-library-resizing * { cursor: col-resize !important; user-select: none !important; }

/* Preserve a usable document area on narrow windows without hiding the library. */
@media (max-width: 640px) {
  .shell > .topbar { padding: 8px; gap: 8px; }
  .shell > .topbar .toolbar { justify-content: flex-start; }
  .layout > .right-pane { padding: 8px; }
  .right-pane > .grid { grid-template-columns: repeat(auto-fill, minmax(min(250px, 100%), 1fr)); }
}


/* Tree UI parity with AnnoRevision: compact hierarchy toolbar and full-height tree. */
.project-tree-toolbar {
  flex: 0 0 auto; min-height: 34px; padding: 5px 8px; display: flex; align-items: center;
  justify-content: space-between; gap: 8px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 11px;
}
.project-tree-toolbar.hidden { display: none !important; }
#structureTree.tree-wrap.annolink-tree { padding: 8px 6px; }
#structureTree .tree-node.annolink-tree-row { display: flex; grid-template-columns: none; column-gap: 0; }
#structureTree .tree-indent { display: none; }
