/* App shell */

.app-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-5);
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.top-bar-start {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.header-nav {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  min-width: 0;
}

.header-nav-item {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  margin: 0;
  padding: var(--space-1) var(--space-2);
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  cursor: pointer;
}

.header-nav-item__label {
  min-width: 0;
}

.header-nav-item:hover {
  color: var(--text);
  background: var(--bg-elevated);
}

.header-nav-item.active {
  color: var(--text);
  border-color: var(--accent);
  background: var(--selection);
  font-weight: 500;
}

.top-bar-end {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-shrink: 0;
  gap: var(--space-3);
  min-width: 0;
}

.header-end {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 0;
}

/* Compact session chip — EntityRow in the top bar (before Account). */
.header-session {
  flex-shrink: 1;
  min-width: 0;
  max-width: min(22rem, 36vw);
}

.header-session .entity-row__shell {
  width: auto;
  max-width: 100%;
}

.header-session .entity-row__shell > .entity-row {
  width: auto;
  max-width: 100%;
}

.header-session-row.entity-row,
.header-session .entity-row {
  width: auto;
  max-width: 100%;
  padding: 0 var(--space-1) 0 0;
  border-bottom: none;
  gap: var(--space-1);
  min-height: 0;
}

.header-session .entity-row:hover,
.header-session .entity-row.selected,
.header-session .entity-row__shell,
.header-session .entity-row__shell:hover,
.header-session .entity-row__shell:has(> .entity-row.selected) {
  background: transparent;
  box-shadow: none;
  border-bottom: none;
}

.header-session .entity-row__text {
  flex: 1;
  min-width: 0;
}

.header-session .user-email {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: inherit;
  line-height: 1.2;
}

.header-session .entity-row__meta {
  flex-shrink: 0;
}

.header-session .entity-row__menu-btn {
  width: 1.5rem;
  height: 1.5rem;
}

.app-title {
  font-weight: 500;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
}

.brand-mark-logo {
  width: 20px;
  height: 20px;
  object-fit: contain;
  flex-shrink: 0;
  border-radius: 2px;
}

.app-main {
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.view-pane {
  height: 100%;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Column pages fill the center pane — no inset max-width cards. */
.workspace-center > .view-pane > * {
  flex: 1;
  min-height: 0;
  min-width: 0;
  width: 100%;
}

/* 3-column workspace — polynome projects-layout clone */

.workspace-layout {
  flex: 1;
  min-height: 0;
  height: 100%;
  display: flex;
  flex-direction: row;
  min-width: 0;
  position: relative;
}

.workspace-layout::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: var(--pane-chrome-height);
  height: 1px;
  background: var(--border-subtle);
  z-index: 4;
  pointer-events: none;
}

.workspace-layout.is-compact::after {
  display: none;
}

.workspace-main {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
}

.workspace-main > .split-shell {
  flex: 1;
  min-width: 0;
  min-height: 0;
}

.workspace-layout .split-primary > .split-shell {
  height: 100%;
  min-height: 0;
}

.workspace-left,
.workspace-center,
.workspace-right {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
}

.workspace-left {
  border-right: 1px solid transparent;
}

.workspace-right {
  border-left: 1px solid transparent;
}

.pane-chrome {
  box-sizing: border-box;
  flex: 0 0 var(--pane-chrome-height);
  height: var(--pane-chrome-height);
  max-height: var(--pane-chrome-height);
  min-height: 0;
  margin: 0;
  padding: 0 var(--space-3);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  border-bottom: 1px solid var(--border);
  overflow: hidden;
  flex-shrink: 0;
}

.workspace-layout .pane-chrome {
  border-bottom-color: transparent;
  background: var(--bg);
}

.pane-chrome-label {
  color: var(--text-muted);
  font-weight: 500;
}

.pane-chrome-dismiss {
  margin-left: auto;
  flex-shrink: 0;
}

/* Header actions — cluster at the right; cancel/danger immediately before accept. */
.pane-chrome-actions {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  margin-left: auto;
  flex-shrink: 0;
}

.pane-chrome:has(> .pane-chrome-actions) > .pane-chrome-dismiss {
  margin-left: 0;
}

/* Compact — control-h (7u) fits the pane-chrome band. */
.pane-chrome-actions .btn {
  box-sizing: border-box;
  min-height: var(--control-h);
  max-height: var(--control-h);
  padding-top: 0;
  padding-bottom: 0;
  padding-left: var(--space-2);
  padding-right: var(--space-2);
  font-size: inherit;
  line-height: 1.25;
}

/* Entity header row hosted inside pane chrome (inspector / left-rail title). */
.pane-chrome > .entity-row,
.pane-chrome > .entity-row__block {
  flex: 1;
  min-width: 0;
  height: 100%;
  max-height: 100%;
}

.pane-chrome > .entity-row__block {
  /* Override default column block — chrome is a single horizontal title row. */
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
}

.pane-chrome .entity-row--header,
.pane-chrome .entity-row--header.user-row,
.pane-chrome .entity-row--header.entity-row--static {
  box-sizing: border-box;
  min-height: 0;
  height: 100%;
  max-height: 100%;
  padding: 0;
  border-bottom: none;
  align-items: center;
}

.pane-chrome .entity-row--header .entity-row__text,
.pane-chrome .entity-row--header .user-row-text {
  flex: 1;
  min-width: 0;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 0;
  line-height: 1.25;
}

.pane-chrome .entity-row--header .user-email {
  flex: 0 1 auto;
  line-height: inherit;
}

.pane-chrome .entity-row--header .entity-row__meta,
.pane-chrome .entity-row--header .entity-icon,
.pane-chrome .entity-row--header .badge {
  align-self: center;
  line-height: 1.25;
}

/* Row already fills the chrome — don't let dismiss's auto margin collapse it. */
.pane-chrome:has(> .entity-row__block) > .pane-chrome-dismiss,
.pane-chrome:has(> .entity-row) > .pane-chrome-dismiss {
  margin-left: 0;
}

.layout-toggles {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
}

.layout-toggle.active {
  border-color: var(--accent);
  color: var(--text);
}

.nav-rail,
.inspector-pane {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
}

