/* Shared window chrome loads after the desktop renderer's overlay styles. */
html body #app {
  --titlebar-h: 44px;
  --window-drag-strip-h: 0px;
  --session-tabs-h: 0px;
  --window-titlebar-h: var(--titlebar-h);
  --window-header-h: calc(var(--window-titlebar-h) + var(--session-tabs-h));
}
/* Reserve the tab row only for the active workspace's open chats. */
html:not([data-bot-mode="1"]) body #app:has(.session-tabs:not([hidden])),
html[data-bot-mode="1"] body #app:has(.bot-tabs:not([hidden])) {
  --session-tabs-h: 40px;
}
html body #titlebar {
  --titlebar-control-h: 28px;
  --titlebar-control-radius: var(--radius-s);
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 8px;
  height: var(--titlebar-h);
  min-width: 0;
  padding: 0 10px;
  white-space: nowrap;
  -webkit-app-region: drag;
}
#titlebar .titlebar-app-name {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
}
#titlebar :is(.titlebar-group, .titlebar-nav, .titlebar-actions) {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: nowrap;
  align-items: center;
  gap: 3px;
  min-width: 0;
  overflow: visible;
}
#titlebar .titlebar-group-start { gap: 8px; }
#titlebar .titlebar-group::before,
#titlebar .titlebar-group::after { content: none; }
#titlebar .titlebar-title {
  display: flex;
  flex: 1 1 0;
  min-width: 0;
  max-width: none;
  padding: 0;
  font-size: 13px;
  overflow: hidden;
}
#titlebar :is(.orax-mode-switch, .view-switch) {
  display: inline-flex;
  flex: none;
  align-items: center;
  height: var(--titlebar-control-h);
  white-space: nowrap;
}
#titlebar :is(.orax-mode-option, .view-switch-option) {
  flex: none;
  white-space: nowrap;
  line-height: 20px;
}
#titlebar .orax-mode-option { font-size: 12px; }
#titlebar .orax-mode-option.is-active { font-weight: 700; }
#titlebar :is(.titlebar-text-btn, .icon-btn, .usage-meter, .device-chip) {
  display: inline-flex;
  flex: 0 0 var(--titlebar-control-h);
  align-items: center;
  justify-content: center;
  gap: 0;
  width: var(--titlebar-control-h);
  min-width: var(--titlebar-control-h);
  max-width: var(--titlebar-control-h);
  height: var(--titlebar-control-h);
  min-height: var(--titlebar-control-h);
  padding: 0;
  color: var(--text-muted);
  background: transparent;
  border: 0;
  border-radius: var(--titlebar-control-radius);
  cursor: pointer;
}
#titlebar button[hidden] { display: none; }
#titlebar button:disabled { cursor: default; opacity: .4; }
#titlebar button:hover { color: var(--text); background: var(--bg-hover); }
#titlebar .icon-btn:is(.active, [aria-pressed="true"]) { color: var(--text); background: var(--bg-active); }
#titlebar button:focus-visible { outline: 2px solid var(--focus-ring, var(--primary)); outline-offset: 1px; }
#titlebar .titlebar-btn-icon { display: inline-flex; align-items: center; justify-content: center; }
#titlebar :is(.titlebar-btn-label, .orax-desk-label) { display: none; }
#titlebar svg {
  display: block;
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}
/* Icon actions don't inherit the terminal skin's decorative text brackets. */
#titlebar :is(.titlebar-text-btn, .usage-meter, .device-chip)::before,
#titlebar :is(.titlebar-text-btn, .usage-meter, .device-chip)::after { content: none; }
.window-header .session-tabs-row {
  display: flex;
  min-width: 0;
  height: var(--session-tabs-h);
  background: var(--bg-chrome);
  border-bottom: 1px solid var(--border-subtle);
}
.window-header .session-tabs-row:has(> .session-tabs[hidden]):not(:has(.bot-tabs:not([hidden]))) { display: none; }
html[data-bot-mode="1"] .window-header .session-tabs-row:not(:has(.bot-tabs:not([hidden]))) { display: none; }
.window-header :is(.session-tabs, .bot-tabs) { align-items: center; padding: 0 8px; }
.window-header .bot-tabs {
  display: flex;
  flex: 1 1 0;
  gap: 3px;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  overscroll-behavior-x: contain;
}
.window-header .bot-tabs::-webkit-scrollbar { display: none; }
.window-header .bot-tabs[hidden],
html:not([data-bot-mode="1"]) .window-header .bot-tabs,
html[data-bot-mode="1"] .window-header :is(#sessionTabs, #sessionTabOverflow) { display: none; }
.window-header .bot-tabs .bot-tab-avatar { width: 16px; height: 16px; min-width: 16px; flex: 0 0 16px; }
.window-header .bot-tabs .bot-tab-avatar img { display: block; width: 100%; height: 100%; object-fit: contain; }
.window-header .bot-tabs .session-tab-icon { flex-basis: 16px; }
.window-header .session-tab-item { border-radius: var(--radius-s); background: transparent; }
.window-header .session-tab-overflow { padding: 0; border: 0; }
.window-header .session-tab-overflow[hidden] { display: none; }
.header-devices-list { height: min(520px, 65vh); min-width: min(420px, 70vw); }

/* The native drag strip shares the title row instead of reserving another row. */
html[data-desktop="1"] #windowDragStrip { position: absolute; top: 0; right: 0; height: 44px; z-index: 1; background: transparent; }
html[data-desktop="1"][data-platform="darwin"] #titlebar { padding-left: 80px; }
html[data-desktop="1"][data-platform="linux"] #titlebar { padding-right: 136px; }
html[data-desktop="1"][data-platform="win32"] #titlebar { padding-right: 148px; }
@media (max-width: 760px) {
  html body #titlebar { overflow-x: auto; scrollbar-width: none; }
  #titlebar .titlebar-title { min-width: 100px; }
}
