/* Company identity stays in the titlebar; names remain available to assistive technology. */
.moi-company-switch { width: max-content; max-width: 100%; }
.moi-company-switch .moi-company-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  width: 44px;
  min-width: 44px;
  height: 36px;
  min-height: 36px;
  padding: 4px;
}
.moi-company-mark { display: inline-flex; align-items: center; justify-content: center; gap: 2px; flex: none; }
.moi-company-mark img { display: block; width: 21px; height: 21px; object-fit: contain; border-radius: 5px; }
.moi-company-mark:has(img + img) img { width: 16px; height: 18px; }
.moi-company-switch .company-caret { width: 5px; height: 5px; margin: 0 1px 0 0; }
.moi-company-switch .moi-company-menu {
  grid-template-columns: minmax(0, 1fr);
  grid-auto-flow: row;
  gap: 2px;
  width: 202px;
  min-width: 202px;
  padding: 5px;
}
.moi-company-switch .moi-company-menu .moi-company-choice {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: nowrap;
  gap: 9px;
  width: 100%;
  min-width: 0;
  height: 42px;
  min-height: 42px;
  padding: 5px 8px;
  border: 0;
  border-radius: 9px;
  text-align: left;
  white-space: nowrap;
}
.moi-company-switch .moi-company-menu .moi-company-choice .moi-company-mark img { width: 24px; height: 24px; }
.moi-company-switch .moi-company-menu .moi-company-choice .moi-company-mark:has(img + img) img { width: 18px; height: 22px; }
.moi-company-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.moi-company-selected {
  display: grid;
  place-items: center;
  flex: none;
  width: 15px;
  height: 15px;
  margin-left: auto;
  border: 1px solid var(--surface);
  border-radius: 50%;
  background: var(--ink);
  color: var(--surface);
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
}
html[data-ui="workbench"] .native-titlebar .titlebar-company-slot { flex: none; -webkit-app-region: no-drag; }
html[data-ui="workbench"] .native-titlebar .moi-company-switch { max-width: none; }
html[data-ui="workbench"] .native-titlebar .moi-company-switch .moi-company-trigger {
  width: 34px;
  min-width: 34px;
  max-width: none;
  height: 32px;
  min-height: 32px;
  padding: 3px;
  overflow: visible;
}
html[data-ui="workbench"] .native-titlebar .moi-company-switch .moi-company-mark img { width: 18px; height: 18px; }
html[data-ui="workbench"] .native-titlebar .moi-company-switch .moi-company-mark:has(img + img) img { width: 13px; height: 16px; }
html[data-ui="workbench"] .native-titlebar .moi-company-switch .company-caret { margin-right: 0; }
html[data-ui="workbench"] .native-titlebar .moi-company-switch .moi-company-menu {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-auto-flow: row;
  width: 202px;
  min-width: 202px;
  max-width: calc(100vw - 16px);
  padding: 5px;
}
html[data-ui="workbench"] .native-titlebar .moi-company-switch .moi-company-menu .moi-company-choice {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: nowrap;
  gap: 9px;
  width: 100%;
  min-width: 0;
  height: 42px;
  min-height: 42px;
  padding: 5px 8px;
  white-space: nowrap;
}
html[data-ui="workbench"] .native-titlebar .moi-company-switch .moi-company-menu .moi-company-choice .moi-company-mark img { width: 24px; height: 24px; }
html[data-ui="workbench"] .native-titlebar .moi-company-switch .moi-company-menu .moi-company-choice .moi-company-mark:has(img + img) img { width: 18px; height: 22px; }
html[data-ui="workbench"] .native-titlebar .moi-company-switch .moi-company-menu .moi-company-choice:hover,
html[data-ui="workbench"] .native-titlebar .moi-company-switch .moi-company-menu .moi-company-choice:focus-visible { background: var(--brand-soft); }
html[data-ui="workbench"] .native-titlebar .moi-company-switch .moi-company-menu .moi-company-choice:focus-visible { outline: 2px solid var(--ink); outline-offset: -2px; }

/* Projects surround their own session tabs, as one continuous titlebar group. */
html[data-ui="workbench"] .native-titlebar .moi-project-tabs { gap: 4px; }
html[data-ui="workbench"] .moi-project-groups {
  display: flex;
  align-items: center;
  gap: 5px;
  flex: 1;
  min-width: 0;
  height: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
}
html[data-ui="workbench"] .moi-project-groups::-webkit-scrollbar { display: none; }
html[data-ui="workbench"] .moi-project-group {
  position: relative;
  display: flex;
  align-items: center;
  gap: 3px;
  flex: 0 0 auto;
  width: max-content;
  min-width: max-content;
  height: 35px;
  padding: 2px 5px;
  border-radius: 7px 7px 0 0;
  background: var(--bg);
}
html[data-ui="workbench"] .moi-project-group::after {
  content: "";
  position: absolute;
  right: 6px;
  bottom: 0;
  left: 6px;
  height: 2px;
  border-radius: 2px;
  background: var(--ink);
}
html[data-ui="workbench"] .moi-project-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex: none;
  max-width: 130px;
  padding: 0 5px;
  overflow: hidden;
  color: var(--ink);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0;
  white-space: nowrap;
}
html[data-ui="workbench"] .moi-project-label span { overflow: hidden; text-overflow: ellipsis; }
html[data-ui="workbench"] .moi-project-label svg,
html[data-ui="workbench"] .moi-project-chip svg { flex: none; width: 13px; height: 13px; }
html[data-ui="workbench"] .moi-project-group .conversation-tabs-list { flex: 0 0 auto; width: max-content; gap: 2px; }
html[data-ui="workbench"] .moi-project-group .conversation-tab { flex: 0 0 124px; width: 124px; min-width: 124px; max-width: 124px; }
html[data-ui="workbench"] .moi-project-group .conversation-tab.active { background: var(--surface); }
html[data-ui="workbench"] .moi-project-group .conversation-tab .conversation-select { flex: 1 1 0; width: 0; min-width: 0; max-width: none; }
html[data-ui="workbench"] .moi-project-group .moi-session-provider { width: 14px; height: 14px; border-radius: 3px; background: transparent; }
html[data-ui="workbench"] .moi-project-group .moi-session-provider::before { width: 13px; height: 13px; }
html[data-ui="workbench"] .moi-project-group .moi-session-favicon img { display: block; width: 13px; height: 13px; object-fit: contain; }
html[data-ui="workbench"] .moi-project-group :is(.moi-session-running,.moi-session-unread) { flex: none; width: 8px; height: 8px; border-radius: 50%; }
html[data-ui="workbench"] .moi-project-group .moi-session-running { border: 1.5px solid var(--muted); border-top-color: var(--ink); animation: moi-session-spin .9s linear infinite; }
html[data-ui="workbench"] .moi-project-group .moi-session-unread { background: var(--brand); box-shadow: 0 0 0 2px var(--surface); }
@keyframes moi-session-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { html[data-ui="workbench"] .moi-project-group .moi-session-running { animation: none; border-color: var(--ink); } }
html[data-ui="workbench"] .native-titlebar .moi-project-tabs .moi-project-chip {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 4px;
  flex: none;
  width: auto;
  max-width: 120px;
  height: 28px;
  padding: 4px 7px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0;
  white-space: nowrap;
}
html[data-ui="workbench"] .moi-project-chip span { overflow: hidden; text-overflow: ellipsis; }
html[data-ui="workbench"] .native-titlebar .moi-project-chip:hover,
html[data-ui="workbench"] .native-titlebar .moi-project-chip:focus-visible { background: var(--brand-soft); color: var(--ink); }
html[data-ui="workbench"] .native-titlebar .moi-project-chip:focus-visible,
html[data-ui="workbench"] .native-titlebar .moi-project-tabs button:focus-visible { outline: 2px solid var(--ink); outline-offset: -2px; }
html[data-ui="workbench"] .native-titlebar .moi-project-tabs button:disabled { cursor: default; opacity: .45; }
@media (max-width: 760px) {
  html[data-ui="workbench"] .moi-project-label { max-width: 100px; }
  html[data-ui="workbench"] .native-titlebar .moi-project-tabs .moi-project-chip { max-width: 84px; }
}
