/* Home uses the retained shared sidebar geometry and theme tokens. */
#zbHomeProjects { margin: 4px 0 8px; }
#zbHomeProjects .zb-sidebar-row {
  display: flex;
  align-items: center;
  box-sizing: border-box;
  width: 100%;
  min-height: 33px;
  padding: 5.5px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  font: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
#zbHomeProjectsBody[hidden] { display: none !important; }
#zbHomeProjects .zb-home-project > span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
#zbHomeProjects p { padding: 3px 6px; margin: 0; color: var(--text-200); font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }
#zbHomeProjects .zb-home-projects-status:empty { display: none; }
#zbHomeProjects .zb-sidebar-row:hover { background: var(--zb-sidebar-hover, #8882); }
#zbHomeProjects .zb-sidebar-row:focus-visible { outline: 2px solid var(--text-200); outline-offset: -2px; }
#zbHomeProjects .zb-home-project.is-drop-target { outline: 2px solid var(--text-200); outline-offset: -2px; background: var(--zb-sidebar-hover, #8882); }
#zbHomeProjects .zb-home-project[aria-busy="true"] { opacity: .55; cursor: progress; }
.zb-project-chat-dragging { opacity: .55; }

[data-zb-projects-link]:not([hidden]) {
  display: flex;
}
/* Reserve the page before footer scripts/API initialization without destroying
   retained Home nodes or altering their inline display values. */
body.projects-page-open :is(#chatbox, .avatarSection, #networkCont, #compareCont,
  #actionsHubPage, #libraryPage, #usagePage, #flashcardsPage, #providerKeysPage,
  #account_settingsCont, #profilePage, #zbPagesHost, #menubar,
  #inputMessageCont, #modelOptions, #models, #activityButtonsCont) {
  display: none !important;
}
/* The shared mobile toggle lives inside Home's header. Keep only that control
   painted above Projects, without restoring the header or its layout footprint. */
@media (max-width: 991px) {
  body.projects-page-open #menubar {
    display: block !important;
    visibility: hidden !important;
    height: 0 !important;
    min-height: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    border: 0 !important;
    background: transparent !important;
    z-index: 60 !important;
  }
  body.projects-page-open #menubar .sidebarMenu2_0a:has(#open_settings2) {
    display: flex !important;
  }
  body.projects-page-open #open_settings2 {
    visibility: visible !important;
    position: fixed !important;
    top: 9px;
    left: 18px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
  }
}
#zbProjectsHost {
  position: fixed;
  inset: 0 0 0 var(--zb-agent-browser-left, 52px);
  z-index: 30;
  overflow: auto;
  padding: 64px clamp(24px, 5vw, 84px);
  background: var(--bg-100, #fff);
  color: var(--text-100, #202123);
}
/* Static loading shapes: reuse real row/header geometry, without shimmer or spinners. */
.zb-projects-skeleton-controls{display:flex;gap:16px;max-width:100%;flex-wrap:wrap}
.zb-projects-skeleton-controls span{display:block;width:clamp(140px,24vw,260px);height:42px;border-radius:9px}
.zb-projects-skeleton-controls span+span{width:100px}
.zb-projects-skeleton-row>span{display:block;width:65%;height:12px;border-radius:4px}
.zb-projects-skeleton-row>span:first-child{display:flex;align-items:center;gap:14px;width:100%;height:22px;background:none}
.zb-projects-skeleton-row>span:first-child::before{content:"";flex:none;width:22px;height:22px;border-radius:6px}
.zb-projects-skeleton-row>span:first-child::after{content:"";width:60%;height:12px;border-radius:4px}
.zb-projects-skeleton-row:nth-child(even)>span:first-child::after{width:44%}
.zb-projects-skeleton-row>span:last-child{width:88px;justify-self:end}
.zb-projects-skeleton-composer{height:154px;margin:36px 0;border-radius:18px}
.zb-projects-skeleton-controls span,.zb-projects-skeleton-row>span:not(:first-child),.zb-projects-skeleton-row>span:first-child::before,.zb-projects-skeleton-row>span:first-child::after,.zb-projects-skeleton-composer{background:color-mix(in srgb,var(--text-200,#888) 14%,transparent)}
.zb-projects-loading,.zb-projects-loading *{animation:none!important;transition:none!important;pointer-events:none}
.zb-projects-loading-detail{max-width:800px;margin:auto}
#zbProjectsHost[hidden],
[data-zb-projects-link][hidden],
[data-zb-experimental][hidden] {
  display: none !important;
}
#zbProjectsHost *,
.zb-projects-dialog * {
  box-sizing: border-box;
}
#zbProjectsHost button,
.zb-projects-dialog button {
  font: inherit;
  color: inherit;
  background: transparent;
  border: 1px solid var(--border-color, #8885);
  border-radius: 9px;
  padding: 8px 12px;
  cursor: pointer;
}
#zbProjectsHost button:hover,
.zb-projects-dialog button:hover {
  background: #8882;
}
#zbProjectsHost button:disabled,
.zb-projects-dialog button:disabled {
  opacity: 0.5;
  cursor: wait;
}
#zbProjectsHost :focus-visible,
.zb-projects-dialog :focus-visible {
  outline: 2px solid #6366f1;
  outline-offset: 3px;
}
#zbProjectsHost a {
  color: inherit;
  text-decoration: none;
}
.zb-projects-heading {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 32px;
}
.zb-projects-heading h1 {
  font-size: 30px;
  line-height: 1.3;
  font-weight: 600;
  margin: 0 auto 0 0;
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  overflow-wrap: anywhere;
}
.zb-projects-heading input {
  max-width: 260px;
  width: 28%;
  min-width: 140px;
}
.zb-projects-heading input,
.zb-projects-dialog input[type="text"],
.zb-projects-picker + input {
  font: inherit;
  color: inherit;
  background: transparent;
  border: 1px solid #8885;
  border-radius: 9px;
  padding: 10px 12px;
}
.zb-projects-row {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) 150px 210px;
  gap: 18px;
  align-items: center;
  min-height: 76px;
  border-bottom: 1px solid #8883;
}
.zb-projects-columns {
  min-height: 48px;
  color: var(--text-200, #888);
}
.zb-projects-columns button {
  justify-self: start;
  border: 0 !important;
  padding-left: 0 !important;
}
.zb-projects-name {
  display: flex;
  gap: 16px;
  align-items: center;
  min-width: 0;
}
.zb-projects-name span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.zb-projects-folder {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  fill: currentColor;
  stroke: none;
}
.zb-projects-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  justify-content: end;
}
.zb-projects-actions button {
  border: 0 !important;
  padding: 6px !important;
  font-size: 13px !important;
}
.zb-projects-actions details {
  position: relative;
}
.zb-projects-actions summary {
  cursor: pointer;
  list-style: none;
  padding: 6px 9px;
  font-size: 20px;
}
.zb-projects-actions details[open] > button {
  position: absolute;
  right: 0;
  top: 100%;
  z-index: 1;
  min-width: 100px;
  background: var(--bg-100, #fff) !important;
  border: 1px solid #8885 !important;
}
.zb-projects-empty {
  padding: 40px 0;
  color: var(--text-200, #888);
}
.zb-projects-error {
  color: #d65c5c;
  overflow-wrap: anywhere;
}
.zb-projects-detail {
  max-width: 800px;
  margin: auto;
}
.zb-projects-detail > header {
  margin-top: 32px;
}
.zb-projects-detail .zb-projects-actions {
  margin-left: auto;
}
.zb-projects-composer {
  border: 1px solid #8885;
  border-radius: 18px;
  padding: 16px;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  margin: 36px 0;
}
.zb-projects-composer textarea {
  font: inherit;
  background: transparent;
  color: inherit;
  resize: vertical;
  border: 0;
  width: 100%;
  min-height: 90px;
}
.zb-projects-composer .zb-projects-error {
  width: 100%;
  margin: 0;
}
.zb-projects-chats-heading {
  border-bottom: 1px solid #8883;
  padding-bottom: 12px;
  margin-bottom: 0;
}
.zb-projects-chats-heading h2 {
  font-size: 16px;
  margin: 0 auto 0 0;
}
.zb-projects-chat {
  display: flex;
  align-items: center;
  gap: 14px;
  border-bottom: 1px solid #8883;
  padding: 16px 0;
}
.zb-projects-chat > button:first-child {
  text-align: left;
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
  border: 0 !important;
}
.zb-projects-chat time,
.zb-projects-row time {
  font-size: 13px;
  color: var(--text-200, #888);
}
.zb-projects-dialog {
  box-sizing: border-box;
  width: min(440px, calc(100vw - 32px));
  max-height: 85vh;
  overflow: auto;
  color: var(--text-100, #202123);
  background: var(--bg-100, #fff);
  border: 1px solid #8885;
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 20px 80px #0005;
}
.zb-projects-dialog::backdrop {
  background: #0009;
}
.zb-projects-dialog h2 {
  font-size: 22px;
  margin: 0 0 20px;
}
.zb-projects-dialog label {
  display: block;
  margin: 18px 0;
}
.zb-projects-dialog input[type="text"] {
  display: block;
  width: 100%;
  margin-top: 8px;
}
.zb-projects-color-palette {
  min-width: 0;
  margin: 18px 0;
  padding: 0;
  border: 0;
}
.zb-projects-color-palette legend { padding: 0; margin-bottom: 8px; }
.zb-projects-color-options {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 8px;
  max-width: 312px;
}
.zb-projects-dialog input.zb-projects-color-swatch {
  appearance: none;
  display: block;
  width: 100%;
  max-width: 32px;
  height: auto;
  aspect-ratio: 1;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 4px solid transparent;
  border-radius: 50%;
  background: var(--project-swatch);
  background-clip: padding-box;
  box-shadow: none;
  outline: none;
  transition: none;
  cursor: pointer;
}
.zb-projects-dialog input.zb-projects-color-swatch:checked {
  /* Paint selection on this swatch, not the native radio focus outline. */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='m4 8 2.5 2.5L12 5' fill='none' stroke='%2317212b' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 14px 14px;
  box-shadow: inset 0 0 0 1.5px var(--text-100, #202123);
}
.zb-projects-dialog input.zb-projects-color-swatch:focus-visible {
  box-shadow: inset 0 0 0 1.5px var(--text-100, #202123), 0 0 0 2px var(--text-100, #202123);
}
.zb-projects-icon-picker {
  min-width: 0;
  margin: 18px 0;
  padding: 0;
  border: 0;
}
.zb-projects-icon-picker legend { padding: 0; margin-bottom: 8px; }
.zb-projects-icon-picker input[type="search"] {
  appearance: none;
  display: block;
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  height: 40px;
  padding: 8px 12px;
  border: 1px solid var(--border-200, #8885);
  border-radius: 10px;
  background: transparent;
  color: inherit;
  font: inherit;
  margin-bottom: 12px;
}
.zb-projects-icon-picker input::placeholder { color: var(--text-200, #888); opacity: .7; }
.zb-projects-icon-grid {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 4px;
}
.zb-projects-dialog label.zb-projects-icon-choice {
  display: grid;
  place-items: center;
  position: relative;
  min-width: 0;
  height: 40px;
  margin: 0;
  border-radius: 8px;
  cursor: pointer;
}
.zb-projects-dialog .zb-projects-icon-choice[hidden] { display: none; }
.zb-projects-icon-choice input[type="radio"] {
  appearance: none;
  position: absolute;
  inset: 0;
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 1px solid transparent;
  border-radius: inherit;
  background: transparent;
  cursor: inherit;
}
.zb-projects-icon-choice input:hover { background: #8882; }
.zb-projects-icon-choice input:checked {
  border-color: var(--text-200, #888);
  background: #8883;
}
.zb-projects-icon-choice input:focus-visible {
  outline: 2px solid var(--text-100, #202123);
  outline-offset: 1px;
}
.zb-projects-icon-choice:has(input:disabled) { opacity: .35; cursor: not-allowed; }
.zb-projects-icon-choice .zb-projects-folder { width: 20px; height: 20px; pointer-events: none; z-index: 1; }
.zb-projects-icon-check {
  display: none;
  position: absolute;
  right: 1px;
  bottom: 0;
  font: bold 11px/12px system-ui;
  pointer-events: none;
  z-index: 2;
}
.zb-projects-icon-choice input:checked ~ .zb-projects-icon-check { display: block; }
.zb-projects-icon-status { margin: 8px 0 0; font-size: 13px; color: var(--text-200, #888); }
.zb-projects-icon-status:empty { display: none; }
@media (max-width: 360px) {
  .zb-projects-dialog { padding: 16px; max-width: calc(100vw - 16px); }
  .zb-projects-icon-grid { gap: 2px; }
}
.zb-projects-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
}
.zb-projects-picker {
  display: grid;
  gap: 6px;
  margin-top: 16px;
  max-height: 280px;
  overflow: auto;
}
.zb-projects-picker button {
  text-align: left;
  overflow-wrap: anywhere;
}
@media (prefers-color-scheme: dark) {
  #zbProjectsHost,
  .zb-projects-dialog {
    background: var(--bg-100, #212121);
    color: var(--text-100, #eee);
  }
}
@media (max-width: 769px) {
  .zb-projects-color-options { gap: 4px; }
  #zbProjectsHost {
    left: 0;
    padding: 64px 18px 28px;
  }
  .zb-projects-heading {
    gap: 12px;
    margin-bottom: 22px;
  }
  .zb-projects-heading h1 {
    font-size: 26px;
  }
  .zb-projects-heading input {
    order: 3;
    width: 100%;
    max-width: none;
  }
  .zb-projects-row {
    grid-template-columns: minmax(90px, 1fr) 80px 102px;
    gap: 6px;
    min-height: 78px;
  }
  .zb-projects-actions {
    gap: 0;
    flex-wrap: wrap;
  }
  .zb-projects-actions button {
    font-size: 12px !important;
  }
  .zb-projects-name {
    gap: 9px;
  }
  .zb-projects-chat {
    flex-wrap: wrap;
    gap: 5px;
  }
  .zb-projects-chat time {
    font-size: 12px;
  }
  .zb-projects-detail .zb-projects-heading h1 {
    width: 100%;
  }
  .zb-projects-detail .zb-projects-actions {
    margin-left: 0;
  }
}
