/* Workspace layout: left files · center canvas (+ bottom queue) · right controls. */

.app {
  display: grid;
  grid-template-rows: var(--topbar-h) minmax(0, 1fr);
  height: 100vh;
  height: 100dvh;
}

/* ── Top bar ─────────────────────────────────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  z-index: 5;
  min-width: 0;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.01em;
  margin-right: 6px;
  white-space: nowrap;
}
.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  display: grid;
  place-items: center;
}
.brand-mark svg {
  width: 17px;
  height: 17px;
}
.brand .ver {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 1px 7px;
  border-radius: 20px;
}
.topbar-spacer {
  flex: 1;
}
.topbar-group {
  display: flex;
  align-items: center;
  gap: 6px;
}
.topbar-sep {
  width: 1px;
  height: 22px;
  background: var(--border);
  margin: 0 4px;
}

/* ── Workspace grid ──────────────────────────────────────────────────────── */
.workspace {
  --left-w: 280px;
  --right-w: 330px;
  --queue-h: 210px;
  display: grid;
  grid-template-columns: var(--left-w) 0 minmax(0, 1fr) 0 var(--right-w);
  grid-template-rows: minmax(0, 1fr) 0 var(--queue-h);
  grid-template-areas:
    'left lres center rres right'
    'left lres bres   rres right'
    'left lres queue  rres right';
  min-height: 0;
  min-width: 0;
  overflow: hidden;
}

.panel-left {
  grid-area: left;
}
.panel-center {
  grid-area: center;
}
.panel-queue {
  grid-area: queue;
}
.panel-right {
  grid-area: right;
}

.panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: var(--surface);
  position: relative;
}
.panel-left {
  border-right: 1px solid var(--border);
}
.panel-right {
  border-left: 1px solid var(--border);
}
.panel-queue {
  border-top: 1px solid var(--border);
}

.panel-header {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 8px 0 14px;
  border-bottom: 1px solid var(--border);
  flex: none;
}
.panel-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-2);
  min-width: 0;
}
.panel-title .icon {
  color: var(--primary);
  width: 16px;
  height: 16px;
}
.panel-header .spacer {
  flex: 1;
}
.panel-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
}
.panel-footer {
  flex: none;
  border-top: 1px solid var(--border);
  padding: 12px 14px;
  background: var(--surface);
}
.rail-label {
  display: none;
}

/* Center column: contextual toolbar + canvas */
.panel-center {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: var(--bg);
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: none;
  height: 46px;
  padding: 0 10px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
}
.toolbar::-webkit-scrollbar {
  display: none;
}
.toolbar-group {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: none;
}
.toolbar-sep {
  width: 1px;
  height: 22px;
  background: var(--border);
  margin: 0 6px;
  flex: none;
}
.toolbar-spacer {
  flex: 1;
  min-width: 8px;
}
.toolbar-file {
  max-width: 220px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  line-height: 1.2;
  padding: 0 4px;
}
.toolbar-file b {
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.toolbar-file small {
  font-size: 11px;
  color: var(--text-3);
}
.zoom-label {
  min-width: 52px;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}

/* ── Resizers: zero-width grid tracks; the handle overflows 6px into the neighbouring area ── */
.resizer {
  position: relative;
  z-index: 4;
  touch-action: none;
}
.resizer::before {
  content: '';
  position: absolute;
  background: transparent;
  transition: background 0.12s;
}
.resizer-left {
  grid-area: lres;
  cursor: col-resize;
  justify-self: start;
  width: 6px;
  height: 100%;
}
.resizer-right {
  grid-area: rres;
  cursor: col-resize;
  justify-self: start;
  width: 6px;
  height: 100%;
}
.resizer-bottom {
  grid-area: bres;
  cursor: row-resize;
  align-self: start;
  height: 6px;
  width: 100%;
}
.resizer-left::before,
.resizer-right::before {
  top: 0;
  bottom: 0;
  left: 0;
  width: 2px;
}
.resizer-bottom::before {
  left: 0;
  right: 0;
  top: 0;
  height: 2px;
}
.resizer:hover::before,
.resizer.dragging::before,
.resizer:focus-visible::before {
  background: var(--primary);
  opacity: 0.6;
}
.resizer:focus-visible {
  outline: none;
}
body.is-resizing {
  user-select: none;
}
body.is-resizing.col {
  cursor: col-resize;
}
body.is-resizing.row {
  cursor: row-resize;
}
body.is-resizing iframe,
body.is-resizing img {
  pointer-events: none;
}

/* ── Collapsed panels (desktop only) ─────────────────────────────────────── */
@media (min-width: 801px) {
  .panel[data-collapsed='true'] .panel-body,
  .panel[data-collapsed='true'] .panel-footer,
  .panel[data-collapsed='true'] .panel-title,
  .panel[data-collapsed='true'] .hide-collapsed {
    display: none;
  }
  .panel-left[data-collapsed='true'] .panel-header,
  .panel-right[data-collapsed='true'] .panel-header {
    flex-direction: column;
    padding: 8px 0;
    border-bottom: 0;
    gap: 14px;
  }
  .panel-left[data-collapsed='true'] .rail-label,
  .panel-right[data-collapsed='true'] .rail-label {
    display: block;
    writing-mode: vertical-rl;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-3);
  }
  .panel-queue[data-collapsed='true'] .panel-header {
    border-bottom: 0;
  }
  .resizer[data-disabled='true'] {
    pointer-events: none;
    display: none;
  }
}

/* ── Bottom nav (mobile only) ────────────────────────────────────────────── */
.bottom-nav {
  display: none;
}
