/* Projects — minimal list (option A). Only project rows and their children
   are styled here; the surrounding conversation list keeps its existing theme. */

.project-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 5px;
    min-height: 30px;
    margin: 0 0 3px;
    padding: 5px 8px 5px 6px;
    border-radius: 6px;
    color: var(--b2-ink-2, #4B5563);
    font-family: var(--f-sans, inherit);
    font-size: 12px;
    font-weight: 400;
    letter-spacing: -0.005em;
    line-height: 1.4;
    cursor: pointer;
    user-select: none;
    --menu-plate: var(--b2-sunken, #F3F4F6);
}
.project-item:hover { background: var(--b2-sunken, #F3F4F6); color: var(--b2-ink, #111216); }
.project-item:focus-visible { outline: none; box-shadow: inset 0 0 0 1px var(--b2-acc-line, rgba(42,120,214,.28)); }
.project-item .pj-ic { width: 13px; height: 13px; flex: 0 0 13px; }
.project-chevron {
    display: inline-flex;
    width: 12px;
    flex: 0 0 12px;
    color: var(--b2-ink-4, #9CA3AF);
    transition: transform 120ms ease-out;
}
.project-chevron .pj-ic { width: 11px; height: 11px; flex-basis: 11px; }
.project-item.open .project-chevron { transform: rotate(90deg); }
.project-folder { display: inline-flex; color: #C99A43; }
.project-name {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.project-root { margin-top: 10px; }
.project-root-children { padding: 3px 0; }
.project-children { margin: 0 0 8px 28px; padding: 2px 0; }
.project-sub.current-project .project-name { font-weight: 400; color: var(--b2-ink, #111216); }
.project-root .project-name { font-size: 12px; font-weight: 400; color: var(--b2-ink, #111216); }
.project-sub { margin-left: 8px; min-height: 34px; gap: 9px; }
.project-sub .project-folder { color: #C99A43; }
.project-files-row { padding-left: 6px; min-height: 28px; color: var(--b2-ink-3, #6B7280); }
.project-files-row .project-folder { color: var(--b2-ink-4, #9CA3AF); }
.project-sub .project-name { font-size: 12px; font-weight: 400; }
.project-files-row .project-name { font-size: 11.5px; }
.project-file-row { padding-left: 25px; gap: 6px; }
.project-file-row .project-name { font-size: 12px; }
.project-file-row.selected { background: var(--b2-sunken, #F3F4F6); color: var(--b2-ink, #111216); }
/* The Explorer's file glyph (theme-b2-light.css .file-tree-item.ext-*) inside
   a sidebar row: keep the icon, drop the Explorer row's box. */
.project-item .pj-ftype.file-tree-item {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    flex: 0 0 14px;
    padding: 0 !important;
    margin: 0 !important;
    border-radius: 0 !important;
    background: none !important;
    transition: none !important;
    cursor: inherit !important;
}
.project-item .pj-ftype.file-tree-item:hover { background: none !important; }

/* + and ⋯ surface on hover as an overlay plate (same trick as the
   conversation row's ⋯, theme §45): they take no flex space at rest. */
.project-actions {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    display: none;
    gap: 1px;
    background: var(--menu-plate);
    box-shadow: -10px 0 10px -2px var(--menu-plate);
    border-radius: 4px;
}
.project-item:hover .project-actions,
.project-item:focus-within .project-actions,
.project-actions:focus-within { display: inline-flex; }
.project-act {
    width: 20px;
    height: 20px;
    padding: 0;
    border: 0;
    border-radius: 4px;
    background: none;
    color: var(--b2-ink-4, #9CA3AF);
    font-size: 13px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
.project-act:hover { background: color-mix(in srgb, var(--menu-plate), var(--b2-ink, #111216) 6%); color: var(--b2-ink, #111216); }
.project-act .pj-ic { width: 12px; height: 12px; flex-basis: 12px; }
.project-create,
.project-newchat { color: var(--b2-ink-3, #6B7280); }
.project-newchat { padding-left: 8px; margin-top: 4px; font-size: 12px; }
.project-newchat .project-folder { color: var(--b2-ink-4, #9CA3AF); }
.project-create .project-folder { color: var(--b2-ink-4, #9CA3AF); }

.project-root-children[hidden],
.project-children[hidden],
.project-files[hidden] { display: none !important; }
.conversation-item.in-project { padding-left: 8px !important; }
.project-empty {
    padding: 2px 10px 8px 25px;
    font-size: 11.5px;
    color: var(--b2-ink-4, #9CA3AF);
}
.project-empty.project-files-empty { padding-left: 25px; }

/* Drag and drop (projects.js _initDrag): the chat being dragged fades, the
   project it would land in lights up; the plain list outlines when a chat
   dragged out of a project would leave it there. */
.conversation-item.pj-dragging { opacity: .45; }
.project-item.pj-drop {
    background: var(--b2-acc-soft, rgba(42, 120, 214, .08)) !important;
    box-shadow: inset 0 0 0 1px var(--b2-acc-line, rgba(42, 120, 214, .35));
    color: var(--b2-ink, #111216);
}
.time-group.pj-drop-out {
    outline: 1px dashed var(--b2-acc-line, rgba(42, 120, 214, .45));
    outline-offset: -3px;
    border-radius: 8px;
}
/* Files dragged over a project go to the project, not the chat: hide the
   page-wide "drop to attach" overlay while a project is the target. */
.drag-overlay.pj-suppress { display: none !important; }

/* Fly-out menus — fixed to the viewport (the sidebar list scrolls and
   clips); same surface as .conversation-menu (theme L301). */
.proj-menu {
    position: fixed;
    z-index: 1300;
    min-width: 176px;
    max-width: 280px;
    max-height: 60vh;
    overflow-y: auto;
    padding: 4px;
    background: var(--b2-bg, #FAFAF9);
    border: 1px solid var(--b2-line, #E5E7EB);
    border-radius: 8px;
    box-shadow: 0 1px 2px rgba(17, 18, 22, .05), 0 12px 32px rgba(17, 18, 22, .16);
}
.proj-menu .conversation-menu-item {
    display: flex;
    align-items: center;
    width: 100%;
    text-align: left;
    white-space: nowrap;
}
.proj-menu .pm-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.proj-menu .pm-chev,
.proj-menu .pm-check { margin-left: auto; padding-left: 10px; }
.proj-menu .pm-check { color: var(--b2-acc, #2A78D6); }
.proj-menu-sep { height: 1px; margin: 4px 6px; background: var(--b2-line, #E5E7EB); }

/* The header follows the visible page: project name or conversation title. */
.chat-header h1.project-title {
    gap: 7px;
    min-width: 0;
    overflow: hidden;
    cursor: default;
}
.chat-header h1.project-title[role="button"] { cursor: pointer; }
.chat-header h1.project-title .pj-ic { width: 15px; height: 15px; flex: 0 0 15px; color: #C99A43; }
.project-title-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.chat-header h1.project-title[role="button"]:hover .project-title-name { text-decoration: underline; text-underline-offset: 3px; }
.chat-header h1.project-title:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--b2-acc-line, rgba(42,120,214,.28)); border-radius: 4px; }

/* Welcome line of a new chat in a project. */
.typewriter-subtitle.project-welcome { color: var(--b2-ink-2, #4B5563); font-weight: 500; }
/* Under "How can I help you today?": smaller and lighter (the theme's
   .welcome-message p rule is !important, so this one has to be too). */
.welcome-message .typewriter-subtitle.project-welcome-hint { font-size: 12px !important; color: var(--b2-ink-4, #9CA3AF) !important; margin-top: 0; }

/* ── Project dialog (character.css .char-* skeleton) ── */
/* Reuse Character/Preferences dialog typography, spacing, field surfaces and
   footer buttons. Only project-specific layout belongs here. */
.proj-dialog label.char-lab { display: block; }
.proj-dialog .proj-files[hidden] { display: none; }
.proj-upload-source { margin-top: 8px; text-align: right; font-size: 11.5px; }
.proj-dialog .char-foot { flex-wrap: wrap; }
.proj-dialog .char-err:not(:empty) { flex: 1 0 100%; order: -1; }

.proj-name {
    width: 100%;
    box-sizing: border-box;
    height: 32px;
    padding: 0 11px;
    border: 1px solid var(--b2-line-2, #D1D5DB);
    border-radius: 6px;
    background: var(--b2-surface, #fff);
    font: inherit;
    font-size: 13px;
    font-weight: 500;
    color: var(--b2-ink, #111216);
}
.proj-name:focus,
.proj-name:focus-visible {
    outline: none !important;
    box-shadow: none !important;
    border-color: var(--b2-line-strong, #9CA3AF) !important;
}
/* Keep the character count beside Instructions rather than in a spacer row. */
.proj-instr-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.proj-instr-head .char-count { margin: 0; white-space: nowrap; }
.proj-dialog .proj-instr { display: block; min-height: 84px; height: 84px; }
/* Same 14 px above as every other label here (user 2026-11-03: Project files sat closer to Instructions than Instructions to the name). */
.proj-dialog .proj-files-label { margin-top: 14px; }
.proj-files {
    border: 1px solid var(--b2-line, #E5E7EB);
    border-radius: 8px;
    overflow: hidden;
    max-height: 180px;
    overflow-y: auto;
}
.proj-files-empty { padding: 9px 11px; font-size: 12px; color: var(--b2-ink-4, #9CA3AF); }
.proj-file {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px 6px 11px;
    border-bottom: 1px solid var(--b2-line, #E5E7EB);
    font-size: 12.5px;
}
.proj-file:last-child { border-bottom: 0; }
.proj-file .pj-ftype.file-tree-item {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    flex: 0 0 14px;
    padding: 0 !important;
    margin: 0 !important;
    border-radius: 0 !important;
    background: none !important;
    transition: none !important;
}
.proj-file-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.proj-file small { font-family: var(--f-mono, ui-monospace, SFMono-Regular, Menlo, monospace); font-size: 10.5px; color: var(--b2-ink-4, #9CA3AF); }
.proj-file.missing .proj-file-name { color: var(--b2-ink-4, #9CA3AF); text-decoration: line-through; }
.proj-file-x {
    border: 0;
    background: none;
    color: var(--b2-ink-4, #9CA3AF);
    font-size: 12px;
    cursor: pointer;
    padding: 0 3px;
    border-radius: 4px;
}
.proj-file-x:hover { color: var(--b2-err, #DC2626); background: rgba(220, 38, 38, .08); }
/* Files from the computer: one dashed drop zone (layout A of the review,
   2026-10-22); click = file chooser, the My Uploads link opens the picker. */
.proj-drop {
    margin-top: 8px;
    padding: 16px 12px 14px;
    border: 1.5px dashed var(--b2-line-2, #D1D5DB);
    border-radius: 10px;
    background: var(--b2-raised, #F8FAFC);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    text-align: center;
    color: var(--b2-ink-3, #6B7280);
    cursor: pointer;
    transition: border-color 120ms ease-out, background 120ms ease-out;
}
.proj-drop .pj-ic { width: 20px; height: 20px; flex: 0 0 20px; }
.proj-drop:hover,
.proj-drop.over { border-color: var(--b2-acc, #2A78D6); background: var(--b2-acc-soft, rgba(42, 120, 214, .10)); }
.proj-drop:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--b2-acc-line, rgba(42, 120, 214, .28)); }
.proj-drop.busy { cursor: progress; opacity: .75; }
.proj-drop-main { font-size: 12.5px; color: var(--b2-ink-2, #4B5563); }
.proj-drop-sub { font-size: 11.5px; }
.proj-link {
    border: 0;
    background: none;
    padding: 0;
    font: inherit;
    font-weight: 500;
    color: var(--b2-acc-ink, #1E5AA8);
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
}
.proj-picker {
    margin-top: 6px;
    border: 1px solid var(--b2-line, #E5E7EB);
    border-radius: 8px;
    background: var(--b2-raised, #F8FAFC);
}
.proj-picker[hidden] { display: none; }
.proj-picker-list { max-height: 170px; overflow-y: auto; padding: 4px 0; }
.proj-pick { display: flex; align-items: center; gap: 8px; padding: 4px 11px; font-size: 12.5px; cursor: pointer; }
.proj-pick:hover { background: var(--b2-sunken, #F3F4F6); }
.proj-pick-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.proj-pick small { font-family: var(--f-mono, ui-monospace, SFMono-Regular, Menlo, monospace); font-size: 10.5px; color: var(--b2-ink-4, #9CA3AF); }
.proj-picker-note { padding: 9px 11px; font-size: 12px; color: var(--b2-ink-3, #6B7280); }
.proj-picker-foot { display: flex; justify-content: flex-end; padding: 6px 8px; border-top: 1px solid var(--b2-line, #E5E7EB); }
/* White like every dialog button (user decision 2026-09-08), not the
   template card's cream/amber primary. */
.proj-picker-foot .tpl-btn.primary {
    background: var(--b2-surface, #fff);
    border-color: var(--b2-line-2, #D1D5DB);
    color: var(--b2-ink, #111216);
}
.proj-picker-foot .tpl-btn.primary { font-weight: 600; }
.proj-picker-foot .tpl-btn.primary:hover {
    background: var(--b2-line, #E5E7EB);
    border-color: var(--b2-line-strong, #9CA3AF);
}
/* Use the platform dialog button family for Delete / Cancel / Save. */
.proj-dialog .proj-delete { margin-right: auto; }
.proj-dialog .tpl-save-btn:disabled { opacity: .55; cursor: not-allowed; }

@media (prefers-reduced-motion: reduce) {
    .project-chevron,
    .project-root-chevron { transition: none; }
}

/* Touch users need a visible menu target without a hover gesture. */
@media (hover: none) {
    .project-actions { display: inline-flex; position: static; transform: none; box-shadow: none; background: transparent; }
    .project-act { width: 28px; height: 28px; }
    .project-item { min-height: 38px; }
}

/* Project conversations share the folder typography, including the selected row. */
.project-group .conversation-item { font-weight: 400 !important; }

/* Project names navigate to the home, rather than expanding a sidebar tree. */
.project-root { margin-top: 6px; margin-bottom: 3.5px; padding-left: 9px; padding-right: 10px; }
.project-root-children { padding: 0 0 0 12px; }
/* A project's name starts on the same line as "Projects" above it — text on
   text, not under the folder (user 2026-11-04 「上下文字要对齐」, 「对准的是p」):
   root padding 9 + folder 13 + gap 5 = 27 = children indent 12 + 15.
   Rows closer (user 2026-11-05 「间距太大了 缩小30%」, then 「改成27px呢」): one
   project to the next 31 → 27 px, the folder row to the first project 5 → 3.5 px. */
.project-sub { margin: 1px 0; padding: 4px 9px 4px 15px; min-height: 26px; gap: 6px; }
.project-sub.current-project { background: var(--b2-user-bg, #FBF5E9); }

/* "Projects" folds like the date groups (theme-b2-light.css §47b; user
   2026-11-05 「默认project可以折叠」): its chevron sits where theirs does, at
   the row's right end — shown on hover, and kept, pointing right, while the
   folder is folded. The ⋯ menu shows just left of it. A folded folder keeps
   the project whose home is open (projects.js toggleRoot). */
.project-root-chevron {
    display: inline-flex;
    flex: 0 0 10px;
    width: 10px;
    height: 10px;
    margin-left: auto;
    color: var(--b2-ink-4, #9CA3AF);
    opacity: 0;
    transform: rotate(90deg);
    transition: transform 120ms ease-out, opacity 120ms ease-out;
}
.project-root-chevron svg { display: block; width: 10px; height: 10px; }
.project-root:hover .project-root-chevron { color: var(--b2-ink-2, #4B5563); }
.project-root:hover .project-root-chevron,
.project-root:focus-visible .project-root-chevron,
.project-group.folded .project-root-chevron { opacity: 1; }
.project-group.folded .project-root-chevron { transform: none; }
.project-root .project-actions { right: 24px; }
.project-group.folded .project-sub:not(.current-project) { display: none; }

#chatPanel.project-home-open #chatMessages,
#chatPanel.project-home-open .chat-input-container,
#chatPanel.project-home-open #shareConvBtn,
#chatPanel.project-home-open #presenceStack { display: none !important; }
.project-home { flex: 1 1 auto; min-height: 0; overflow: auto; container-type: inline-size; }
.project-home[hidden] { display: none !important; }
.project-home-inner { padding: 26px 20px; max-width: 700px; margin: 0 auto; color: var(--b2-ink, #111216); }
.project-home-kicker { font-size: 12px; color: var(--b2-ink-3, #6B7280); }
.project-home h2 { font-size: 20px; font-weight: 500; letter-spacing: -.3px; margin: 0; overflow-wrap: anywhere; }
.project-home-heading { margin-bottom: 20px; }
.project-home-heading-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.project-home-title-row { display: flex; align-items: center; gap: 8px; }
.project-home-title-row h2 { flex: 1; min-width: 0; display: flex; align-items: center; gap: 9px; }
.project-home-title-row h2 > span:last-child { min-width: 0; }
.project-home-title-icon { display: inline-flex; flex: 0 0 18px; color: #C99A43; }
.project-home-title-icon .pj-ic { width: 18px; height: 18px; }
.project-home-toolbar [data-home-new] .mi-icon { color: #C99A43; }
.project-home-more { border: 0; background: transparent; color: var(--b2-ink-3, #6B7280); border-radius: 6px; width: 28px; height: 28px; flex-shrink: 0; font: inherit; font-size: 20px; cursor: pointer; }
.project-home-more:hover { background: var(--b2-sunken, #F3F4F6); color: var(--b2-ink, #111216); }
.project-home-more:focus-visible { outline: 1px solid currentColor; outline-offset: 2px; }
.project-home-toolbar { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.project-home-toolbar .project-home-search { flex: 1; min-width: 0; margin: 0; }
.project-home-heading .tpl-save-btn, .project-home-toolbar .tpl-save-btn { font-size: 12px; padding: 7px 10px; flex-shrink: 0; white-space: nowrap; }
@container (max-width: 290px) { .project-home-toolbar { flex-wrap: wrap; } .project-home-toolbar .project-home-search { flex-basis: 100%; } }
.project-home-task { display: flex; align-items: center; gap: 10px; min-height: 46px; border-bottom: 1px solid var(--b2-line, #E5E7EB); }
.project-home-task .conversation-item { flex: 1 1 auto; min-width: 0; margin: 0 !important; padding: 10px 0 !important; }
.project-home-task .conversation-title { font-weight: 400 !important; }
.project-home-task time { flex-shrink: 0; font-size: 11px; color: var(--b2-ink-4, #9CA3AF); }
.project-home-empty, .project-home-error { font-size: 12px; line-height: 1.6; color: var(--b2-ink-3, #6B7280); margin: 18px 0; }
@media (max-width: 450px) { .project-home-inner { padding: 20px 12px; } }

.project-return { padding: 5px 14px; border-bottom: 1px solid var(--b2-line, #E5E7EB); }
.project-return[hidden] { display: none !important; }
.project-return button { border: 0; border-radius: 5px; background: transparent; padding: 5px 2px; font-family: var(--f-sans, inherit); font-size: 12px; color: var(--b2-ink-3, #6B7280); cursor: pointer; }
.project-return button:hover { color: var(--b2-ink, #111216); text-decoration: underline; text-underline-offset: 3px; }
.project-return button:focus-visible { outline: 1px solid var(--b2-line-strong, #9CA3AF); outline-offset: 2px; }

/* Match conversation rows: the menu replaces the shared mark on hover. */
.project-shared-mark { display: inline-flex; flex: 0 0 13px; color: var(--b2-ink-3, #6B7280); }
.project-shared-mark svg { width: 13px; height: 13px; margin-right: 0; }
.project-sub { padding-right: 8px; }
.project-sub .project-actions { right: 4px; }
.project-sub.current-project { --menu-plate: var(--b2-user-bg, #FBF5E9); }
.project-sub:hover .project-shared-mark,
.project-sub:focus-within .project-shared-mark { opacity: 0; }
.project-readonly { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 12px; line-height: 1.6; max-height: 220px; overflow: auto; }

/* Empty project: quiet guidance beneath the existing New Task action. */
.project-home-welcome { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 44px 12px 36px; }
.project-home-welcome-icon { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; margin-bottom: 14px; border-radius: 14px; background: var(--b2-user-bg, #FBF5E9); color: #C99A43; }
.project-home-welcome-icon .pj-ic { width: 23px; height: 23px; stroke-width: 1.5; }
.project-home-welcome h3 { margin: 0 0 5px; font: inherit; font-size: 14px; font-weight: 500; color: var(--b2-ink, #111216); }
.project-home-welcome p { margin: 0; font-size: 12px; line-height: 1.6; color: var(--b2-ink-3, #6B7280); }

/* Paperclip → From Project / Library (2026-11-03, E1): the Explorer's file
   glyph inside the window's rows, without the Explorer row's box. */
.library-type-icon .lib-ftype.file-tree-item {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    padding: 0 !important;
    margin: 0 !important;
    border-radius: 0 !important;
    background: none !important;
    transition: none !important;
    cursor: inherit !important;
}
.library-type-icon:has(.lib-ftype) { opacity: 1; display: inline-flex; flex: 0 0 16px; }
.library-file-item.lib-off { cursor: default; }
.library-file-item.lib-off .library-file-name,
.library-file-item.lib-off .library-type-icon { opacity: .55; }

/* Project home: the name is a button that opens Project settings. */
.project-home-name {
    display: inline-flex; align-items: center; gap: 9px; min-width: 0; max-width: 100%;
    margin: -4px -8px; padding: 4px 8px; border: 0; border-radius: 8px;
    background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer;
}
.project-home-name-text { min-width: 0; overflow-wrap: anywhere; }
.project-home-name:hover { background: var(--b2-sunken, #F3F4F6); }
.project-home-name:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--b2-acc-line, rgba(42,120,214,.28)); }

/* Touch: the project rows keep their 30 px finger target and the folder's
   chevron always shows (no hover); after the 2026-11-05 rules above. */
@media (hover: none) {
    .project-sub { min-height: 30px; padding-top: 5px; padding-bottom: 5px; }
    .project-root-chevron { opacity: 1; }
}
