:root {
  --radius: var(--cursor-radius-lg, 12px);
  --shadow: var(--cursor-shadow-sm);
  --spine-w: 236px;
  --explorer-w: 236px;
  --platform-chrome-z: 200;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; min-height: 100%; }

.topbar {
  position: sticky; top: 0; z-index: var(--platform-chrome-z, 200);
  display: flex; align-items: center; gap: 16px;
  padding: 0 16px; height: var(--topbar-h, 48px);
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--border);
  overflow: visible;
}
.topbar__brand { font-weight: 700; font-size: 15px; }
.topbar__badge { font-size: 11px; color: var(--muted); background: var(--surface-active); padding: 2px 8px; border-radius: 999px; }
.topbar__spacer { flex: 1; }
.topbar__link { font-size: 14px; color: var(--muted); cursor: pointer; border: none; background: none; padding: 0; }
.topbar__link:hover { color: var(--primary); }
.topbar__nav { display: flex; gap: 4px; margin-left: 8px; }
.nav-tab {
  padding: 6px 12px; border: none; background: none; border-radius: 8px;
  font-size: 14px; color: var(--muted); cursor: pointer;
}
.nav-tab.is-active { background: var(--surface-active); color: var(--text); font-weight: 600; }
.nav-tab:hover:not(.is-active) { background: var(--surface-hover); }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); display: inline-block; margin-right: 6px; }
.status-dot.is-off { background: var(--cursor-text-tertiary, #555); }

.page-main { max-width: 1080px; margin: 0 auto; padding: 24px 20px 48px; }
.page-panel { display: none; }
.page-panel.is-active { display: block; }

.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 20px; }
@media (max-width: 768px) { .dash-grid { grid-template-columns: 1fr; } }
.dash-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 20px; box-shadow: var(--shadow);
}
.dash-card--wide { margin-top: 16px; }
.dash-card__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.dash-card__head h2 { margin: 0; font-size: 15px; }
.dash-card__meta { font-size: 12px; color: var(--muted); }
.dash-list { list-style: none; margin: 0; padding: 0; }
.dash-list__item { padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 14px; line-height: 1.5; }
.dash-list__item:last-child { border-bottom: none; }
.dash-list__item--click { cursor: pointer; }
.dash-list__item--click:hover { color: var(--primary); }
.dash-list__time { color: var(--muted); font-size: 12px; margin-right: 8px; }
.dash-list__empty { color: var(--muted); font-size: 14px; padding: 8px 0; }
.quick-row { display: flex; flex-wrap: wrap; gap: 10px; }
.quick-chip {
  padding: 10px 16px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); cursor: pointer; font-size: 14px;
}
.quick-chip:hover { border-color: var(--primary); color: var(--primary); }
.link-btn { border: none; background: none; color: var(--primary); font-size: 13px; cursor: pointer; }
.hub-meta { font-size: 13px; color: var(--muted); margin-top: 8px; }
.project-card__path--muted { font-style: italic; }
.modal-hint { font-size: 13px; color: var(--muted); margin: -8px 0 12px; }
.btn--sm { padding: 6px 10px; font-size: 13px; }
.project-card__path { font-size: 11px; color: var(--muted); word-break: break-all; margin: 0 0 8px !important; }
.project-card__warn { color: var(--danger); font-size: 13px; margin: 0 0 8px !important; }
.project-card--warn { border-color: color-mix(in srgb, var(--danger) 35%, var(--border)); }
.project-card__actions { display: flex; gap: 8px; flex-wrap: wrap; }

.mode-select-wrap { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.mode-label { white-space: nowrap; }

.project-home__head h2 { margin: 0 0 8px; font-size: 24px; }
.scan-stats { font-size: 14px; color: var(--muted); margin-top: 8px; }
.module-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; margin-bottom: 24px; }
.module-tile { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 16px; }
.module-tile h3 { margin: 0 0 6px; font-size: 15px; }
.module-tile p { margin: 0; font-size: 13px; color: var(--muted); }
.ui-banner {
  background: #fffbeb; border: 1px solid #fde68a; border-radius: 10px; padding: 14px 16px; margin-bottom: 20px;
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px; font-size: 14px;
}
.ui-banner--ok { background: #f0fdf4; border-color: #bbf7d0; }
.ui-banner__actions { display: flex; gap: 8px; margin-left: auto; }
.project-home__readme pre {
  white-space: pre-wrap; font-size: 13px; color: var(--muted); background: var(--surface-muted);
  padding: 16px; border-radius: 8px; border: 1px solid var(--border);
}
.ui-embed-wrap { display: flex; flex-direction: column; height: calc(100vh - 120px); margin: -24px; }
.ui-embed-toolbar { padding: 8px 12px; background: var(--surface); border-bottom: 1px solid var(--border); }
.ui-embed { flex: 1; width: 100%; border: none; background: var(--surface); }
.ui-start-panel, .loading-panel { max-width: 560px; padding: 32px; }
.ui-start-panel .hint { font-size: 13px; color: var(--muted); margin-top: 16px; }
.ui-start-error { color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, var(--surface)); border: 1px solid color-mix(in srgb, var(--danger) 30%, var(--border)); border-radius: 8px; padding: 10px 12px; font-size: 13px; margin: 12px 0; }
.field-hint { font-size: 12px; color: var(--muted); margin: 6px 0 0; }
.req { color: var(--danger); }

.sync-badge { font-size: 12px; color: var(--muted); margin-right: 8px; }
.sync-badge.is-live { color: var(--success); }
.sync-badge.is-stale { color: var(--warning); }

.file-explorer {
  width: var(--explorer-w, 300px);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.file-explorer.is-hidden { display: none; }

.file-editor-panel { display: flex; flex-direction: column; height: calc(100vh - 120px); margin: -24px; border-top: 1px solid var(--border); background: var(--surface); }
.file-editor-toolbar { display: flex; gap: 8px; align-items: center; padding: 8px 12px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.file-editor-toolbar .path-label { flex: 1; font-size: 12px; color: var(--muted); word-break: break-all; font-family: ui-monospace, monospace; }
.file-editor-body { flex: 1; display: flex; flex-direction: column; min-height: 0; overflow: auto; }

.resource-browser { display: flex; height: calc(100vh - 120px); margin: -24px; border-top: 1px solid var(--border); }
.resource-tree { width: 280px; flex-shrink: 0; border-right: 1px solid var(--border); overflow: auto; padding: 8px; background: var(--surface-muted); font-size: 13px; }
.resource-tree details { margin-left: 4px; }
.resource-tree summary { cursor: pointer; padding: 4px 6px; border-radius: 6px; list-style: none; }
.resource-tree summary:hover { background: var(--surface-hover); }
.resource-tree .file-item { cursor: pointer; padding: 4px 6px 4px 20px; border-radius: 6px; word-break: break-all; }
.resource-tree .file-item:hover, .resource-tree .file-item.is-active { background: var(--surface-active); color: var(--text); }
.resource-panel { flex: 1; display: flex; flex-direction: column; min-width: 0; background: var(--surface); }
.resource-toolbar { display: flex; gap: 8px; align-items: center; padding: 8px 12px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.resource-toolbar .path-label { flex: 1; font-size: 12px; color: var(--muted); word-break: break-all; }
.resource-editor { flex: 1; border: none; padding: 16px; font-family: ui-monospace, monospace; font-size: 13px; line-height: 1.6; resize: none; }
.resource-preview { flex: 1; padding: 16px; overflow: auto; }
.resource-preview img { max-width: 100%; border-radius: 8px; border: 1px solid var(--border); }
.resource-preview pre { white-space: pre-wrap; font-size: 13px; line-height: 1.65; }
.bindings-table { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 12px; }
.bindings-table th, .bindings-table td { border: 1px solid var(--border); padding: 8px 10px; text-align: left; }
.bindings-path { word-break: break-all; color: var(--muted); font-size: 12px; }
.bindings-path-note { margin-top: 4px; font-size: 11px; color: var(--muted); }
.binding-badge {
  display: inline-block; margin-left: 6px; font-size: 11px; padding: 1px 7px;
  border-radius: 999px; vertical-align: middle;
}
.binding-badge--ok { background: color-mix(in srgb, var(--success) 15%, var(--surface)); color: var(--success); }
.binding-badge--relocated { background: var(--surface-selected); color: var(--text); }
.binding-badge--missing { background: color-mix(in srgb, var(--danger) 12%, var(--surface)); color: var(--danger); }
.binding-reconcile-banner {
  margin: 12px 0 0; padding: 10px 12px; border-radius: 8px;
  background: var(--surface-active); color: var(--text); font-size: 13px; line-height: 1.5;
}
.bindings-table th, .bindings-table td { border: 1px solid var(--border); padding: 8px 10px; text-align: left; }
.bindings-path { word-break: break-all; color: var(--muted); font-size: 12px; }

.client-mode .spine-item[data-internal="1"],
.client-mode .spine h4[data-internal="1"],
.client-mode .mode-select-wrap,
.client-mode .ui-embed-toolbar a[target="_blank"]:not([href*="8791"]) { display: none; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 14px; border-radius: 8px; border: 1px solid transparent;
  font-size: 14px; cursor: pointer; background: var(--primary); color: #fff;
}
.btn:hover { background: var(--primary-hover); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn--ghost { background: var(--btn-ghost-bg, transparent); color: var(--text); border-color: var(--btn-ghost-border, var(--border)); }
.btn--ghost:hover { background: var(--btn-ghost-hover-bg, var(--surface-hover)); border-color: var(--btn-ghost-hover-border, var(--accent-border-strong)); }

.hub-main { max-width: 960px; margin: 0 auto; padding: 32px 20px 48px; }
.hub-hero h1 { margin: 0 0 8px; font-size: 28px; }
.hub-hero p { margin: 0; color: var(--muted); line-height: 1.65; max-width: 560px; }
.hub-actions { display: flex; gap: 12px; margin: 24px 0; flex-wrap: wrap; }

.empty-panel {
  background: var(--surface); border: 1px dashed var(--border); border-radius: var(--radius);
  padding: 48px 24px; text-align: center; color: var(--muted);
}
.empty-panel h2 { margin: 0 0 8px; font-size: 18px; color: var(--text); }

.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; margin-top: 16px; }
.project-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow);
}
.project-card h3 { margin: 0 0 8px; font-size: 17px; }
.project-card p { margin: 0 0 12px; font-size: 14px; color: var(--muted); line-height: 1.5; }
.project-card__tag { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 999px; background: var(--surface-selected, #e2e8f0); color: var(--text); }

.section-title { font-size: 13px; font-weight: 600; color: var(--muted); margin: 28px 0 8px; }

.modal-backdrop { position: fixed; inset: 0; background: rgba(15,23,42,.35); z-index: 50; display: none; align-items: center; justify-content: center; padding: 20px; }
.modal-backdrop.is-open { display: flex; }
.fp-browse-backdrop {
  /* 须高于「添加项目资源」等业务弹窗（约 80），否则侧栏会沉到遮罩下层 */
  z-index: 200;
  padding: 16px 24px;
  align-items: stretch;
  justify-content: center;
}

.fp-browse-modal {
  width: min(1080px, calc(100vw - 48px));
  max-height: min(760px, 94vh);
  display: flex;
  flex-direction: column;
  padding: 20px 24px 18px;
  margin: auto;
}
.fp-finder-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  flex-shrink: 0;
}
.fp-finder-head__main { flex: 1; min-width: 0; }
.fp-finder-head h2 { margin: 0 0 4px; font-size: 18px; }
.fp-finder-head .modal-hint { margin: 0; font-size: 12px; }
.fp-modal-close {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  margin: -4px -4px 0 0;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  font-family: inherit;
}
.fp-modal-close:hover,
.fp-modal-close:focus-visible {
  background: var(--surface-hover, #f1f5f9);
  color: var(--text);
  outline: none;
}
.fp-finder {
  display: flex;
  gap: 0;
  flex: 1;
  min-height: 480px;
  height: min(540px, calc(94vh - 168px));
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: var(--surface-elevated, #fff);
}
.fp-finder-sidebar {
  width: 200px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  background: var(--surface-muted, #f5f5f7);
  overflow-y: auto;
  padding: 8px 0 12px;
}
.fp-sidebar-section { margin-bottom: 8px; }
.fp-sidebar-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  padding: 4px 12px 6px;
  letter-spacing: 0.03em;
}
.fp-sidebar-list { list-style: none; margin: 0; padding: 0; }
.fp-sidebar-item {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  border: none;
  background: transparent;
  text-align: left;
  padding: 6px 10px 6px 12px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
}
.fp-sidebar-item:hover { background: var(--surface-hover, rgba(0,0,0,.06)); }
.fp-sidebar-item.is-active {
  background: var(--surface-active, #dbeafe);
  color: var(--primary);
  font-weight: 600;
}
.fp-sidebar-item__icon { font-size: 14px; flex-shrink: 0; width: 18px; text-align: center; }
.fp-sidebar-item__label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fp-finder-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.fp-finder-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-muted, #fafafa);
  flex-wrap: wrap;
}
.fp-finder-nav { display: flex; gap: 2px; flex-shrink: 0; }
.fp-nav-btn {
  width: 28px; height: 28px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-elevated, #fff);
  color: var(--text);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}
.fp-nav-btn:hover:not(:disabled) { background: var(--surface-hover); border-color: var(--primary); }
.fp-nav-btn:disabled { opacity: 0.35; cursor: default; }
.fp-breadcrumbs {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 2px;
  font-size: 12px;
}
.fp-crumb {
  border: none;
  background: none;
  color: var(--primary);
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
  font-size: 12px;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.fp-crumb:hover { background: var(--surface-hover); text-decoration: underline; }
.fp-crumb--current { color: var(--text); font-weight: 600; cursor: default; max-width: min(420px, 40vw); }
.fp-crumb-sep { color: var(--muted); user-select: none; }
.fp-search-wrap { flex-shrink: 0; width: min(280px, 34%); min-width: 180px; }
.fp-search {
  width: 100%;
  padding: 6px 10px 6px 28px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  background: var(--input-bg, #fff) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' fill='%2394a3b8' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85zm-5.242 1.006a5.5 5.5 0 1 1 0-11 5.5 5.5 0 0 1 0 11z'/%3E%3C/svg%3E") no-repeat 8px center;
}
.fp-search:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 2px rgba(59,130,246,.15); }

.fp-view-toggle {
  display: flex;
  gap: 2px;
  flex-shrink: 0;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-elevated, #fff);
}
.fp-view-btn {
  width: 30px; height: 28px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}
.fp-view-btn:hover { background: var(--surface-hover); color: var(--text); }
.fp-view-btn.is-active {
  background: var(--surface-active, #dbeafe);
  color: var(--primary);
  font-weight: 600;
}

.fp-current-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  font-size: 12px;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  background: var(--surface-muted, #fafafa);
  cursor: pointer;
}
.fp-current-path {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: ui-monospace, monospace;
  color: var(--text);
  font-size: 12px;
}
.fp-search-hint {
  font-size: 12px;
  color: var(--muted);
  padding: 8px 12px 4px;
  margin: 0;
}

.modal { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); width: min(440px, 100%); padding: 24px; }
.modal.fp-browse-modal {
  width: min(1080px, calc(100vw - 48px));
  max-width: none;
  max-height: min(760px, 94vh);
  padding: 20px 24px 18px;
}
.modal--wide { width: min(560px, 100%); }
.modal--create {
  width: min(680px, calc(100vw - 32px));
  max-height: min(90vh, 820px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 22px 24px 20px;
}
.modal--create h2 { margin-bottom: 8px; flex-shrink: 0; }
.modal--create .modal-hint { margin: 0 0 18px; font-size: 13px; line-height: 1.55; flex-shrink: 0; }
.modal--create .create-form {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding-right: 2px;
}
.modal--create .modal__actions {
  flex-shrink: 0;
  position: relative;
  z-index: 40;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  background: var(--surface-elevated, #fff);
}

.create-form { display: flex; flex-direction: column; gap: 16px; }
.create-form__basic {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 14px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-muted, #f8fafc);
}
.create-form__basic .field { margin-bottom: 0; }
.create-form__basic .field--compact textarea { min-height: 42px; }
@media (max-width: 560px) {
  .create-form__basic { grid-template-columns: 1fr; }
}

.create-sources {
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: visible;
  background: var(--surface-elevated, #fff);
}
.create-sources__label {
  padding: 12px 16px 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.create-sources__label .req { color: #ef4444; font-weight: 400; }

.source-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 12px 0;
}
.source-tab {
  border: 1px solid var(--border);
  background: var(--surface-muted, #f8fafc);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  cursor: pointer;
  font-family: inherit;
  color: var(--muted);
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.source-tab:hover { border-color: var(--primary); color: var(--primary); }
.source-tab.is-active {
  background: var(--surface-active, #f1f5f9);
  border-color: var(--primary);
  color: var(--primary);
  font-weight: 600;
}

.source-panels { padding: 12px 14px 120px; overflow: visible; }
.source-panel { display: none; overflow: visible; }
.source-panel.is-active { display: block; overflow: visible; }
.source-panel .fp-field { margin-top: 0; }
.source-panel .field-hint { margin-bottom: 0; }

.source-link-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.source-link-form input {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
}
.source-link-form .btn { align-self: flex-start; margin-top: 2px; }

.create-sources__summary {
  border-top: 1px solid var(--border);
  padding: 10px 14px 12px;
  background: var(--surface-muted, #f8fafc);
}
.create-sources__summary-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 8px;
}
.create-source-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.create-source-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-elevated, #fff);
  font-size: 13px;
}
.create-source-item__icon { flex-shrink: 0; }
.create-source-item__body { flex: 1; min-width: 0; }
.create-source-item__label {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.create-source-item__url {
  font-size: 11px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: ui-monospace, monospace;
}
.create-source-item__remove {
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  padding: 2px 6px;
  border-radius: 6px;
}
.create-source-item__remove:hover { background: #fee2e2; color: #dc2626; }

.create-progress {
  margin-top: 4px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-muted, #f8fafc);
}
.create-progress.is-loading .create-progress__spinner {
  animation: fp-spin 0.8s linear infinite;
}
.create-progress__head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.create-progress__spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  flex-shrink: 0;
}
.create-progress__title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.create-progress__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.create-progress__item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--surface-elevated, #fff);
  border: 1px solid var(--border);
  font-size: 13px;
}
.create-progress__item.is-pending { color: var(--muted); }
.create-progress__item.is-ok { border-color: #bbf7d0; background: #f0fdf4; }
.create-progress__item.is-fail { border-color: #fecaca; background: #fef2f2; }
.create-progress__icon { flex-shrink: 0; width: 18px; text-align: center; font-weight: 700; }
.create-progress__body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.create-progress__text { font-weight: 600; color: var(--text); }
.create-progress__sub { font-size: 12px; color: var(--muted); line-height: 1.45; }
.create-progress__hint {
  margin: 10px 0 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}
@keyframes fp-spin {
  to { transform: rotate(360deg); }
}

.modal h2 { margin: 0 0 16px; font-size: 18px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.field input, .field textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; }
.field textarea { min-height: 72px; resize: vertical; }

.fp-field { margin-top: 4px; }
.fp-field--external-summary .fp-selected { display: none; }

.fp-selected {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-muted, #f8fafc);
  padding: 10px 12px;
  min-height: 52px;
  margin-top: 10px;
  margin-bottom: 0;
}
.fp-selected.has-items {
  background: var(--surface-elevated, #fff);
  padding: 8px 10px;
}
.fp-selected__empty {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
  text-align: center;
  padding: 6px 0;
}
.fp-selected__empty[hidden] { display: none; }

.fp-add-group {
  position: relative;
  display: flex;
  align-items: stretch;
  margin-bottom: 8px;
}
.fp-add-group .fp-add-btn {
  margin-bottom: 0;
}
.fp-add-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border: 1.5px dashed var(--border);
  background: var(--surface-muted, #f8fafc);
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.fp-add-btn--primary {
  flex: 1;
  min-width: 0;
  border-radius: 10px 0 0 10px;
  border-right: none;
}
.fp-add-btn--caret {
  width: 42px;
  flex-shrink: 0;
  justify-content: center;
  padding: 0;
  border-radius: 0 10px 10px 0;
  border-left: 1px dashed var(--border);
  color: var(--muted);
  font-size: 14px;
}
.fp-add-group:hover .fp-add-btn,
.fp-add-group:focus-within .fp-add-btn {
  border-color: var(--primary);
  background: var(--surface-active, #f1f5f9);
}
.fp-add-btn--primary:hover,
.fp-add-btn--primary:focus-visible,
.fp-add-btn--caret:hover,
.fp-add-btn--caret:focus-visible {
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
  outline: none;
}
.fp-add-btn__body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.fp-add-btn__icon {
  width: 28px; height: 28px;
  border-radius: 8px;
  background: var(--surface-elevated, #fff);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 600; color: var(--primary);
  flex-shrink: 0;
}
.fp-add-btn__text { font-size: 14px; font-weight: 600; color: var(--text); }
.fp-add-btn__sub { font-size: 11px; color: var(--muted); }

.fp-add-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 25;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-elevated, #fff);
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.12);
}
.fp-add-menu--up {
  top: auto;
  bottom: calc(100% + 6px);
}
/* 固定定位：逃出业务弹窗 overflow:hidden，避免菜单被裁切或滚到底部 */
.fp-add-menu.fp-add-menu--fixed {
  position: fixed;
  left: auto;
  right: auto;
  top: auto;
  bottom: auto;
  z-index: 210;
}
.modal .fp-add-menu,
.modal-backdrop .fp-add-menu {
  z-index: 55;
}
.modal .fp-add-menu.fp-add-menu--fixed,
.modal-backdrop .fp-add-menu.fp-add-menu--fixed {
  z-index: 210;
}
.fp-add-menu[hidden] { display: none; }
.fp-add-menu__item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
}
.fp-add-menu__item:hover,
.fp-add-menu__item.is-active {
  background: var(--surface-active, #f1f5f9);
}
.fp-add-menu__icon { flex-shrink: 0; font-size: 16px; line-height: 1.4; }
.fp-add-menu__meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.fp-add-menu__label { font-size: 13px; font-weight: 600; color: var(--text); }
.fp-add-menu__hint { font-size: 11px; color: var(--muted); }

.fp-chips { list-style: none; margin: 0; padding: 0; max-height: 180px; overflow: auto; }
.fp-chips:empty { display: none; }
.fp-chip {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px; margin-bottom: 6px;
  background: var(--surface-elevated, #fff); border: 1px solid var(--border); border-radius: 8px; font-size: 12px;
}
.fp-chip:last-child { margin-bottom: 0; }
.fp-chip__meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.fp-chip__name { font-weight: 600; font-size: 13px; color: var(--text); }
.fp-chip__path { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: ui-monospace, monospace; color: var(--muted); font-size: 11px; }
.fp-chip__remove {
  border: none; background: var(--surface-hover, #f1f5f9); width: 24px; height: 24px; border-radius: 6px; cursor: pointer; color: var(--muted); flex-shrink: 0;
}
.fp-chip__remove:hover { background: #fee2e2; color: #dc2626; }
.fp-actions--secondary { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 8px; margin-bottom: 4px; }
.fp-actions__sep { color: var(--muted); font-size: 12px; user-select: none; }
.link-btn.is-loading { opacity: 0.6; pointer-events: none; }
.fp-manual { width: 100%; margin-top: 8px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 13px; font-family: ui-monospace, monospace; }

.fp-list {
  flex: 1;
  min-height: 280px;
  max-height: none;
  overflow: auto;
  background: var(--surface-elevated, #fff);
}
.fp-list--grid { padding: 12px; }
.fp-list--tree { padding: 4px 0; }

.fp-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(108px, 1fr));
  gap: 10px;
}
.fp-grid-item {
  position: relative;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-muted, #f8fafc);
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.fp-grid-item:hover { border-color: #93c5fd; background: var(--surface-hover, #f1f5f9); }
.fp-grid-item.is-checked {
  border-color: var(--primary);
  background: var(--surface-active, #f1f5f9);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.12);
}
.fp-grid-item__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 8px 10px;
  cursor: default;
  text-align: center;
  user-select: none;
}
.fp-grid-item__check {
  position: absolute;
  top: 8px;
  left: 8px;
  width: 16px;
  height: 16px;
}
.fp-grid-item__icon { font-size: 36px; line-height: 1; }
.fp-grid-item__name {
  font-size: 12px;
  line-height: 1.35;
  color: var(--text);
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  width: 100%;
}
.fp-grid-item__sub {
  font-size: 10px;
  color: var(--muted);
  word-break: break-all;
  line-height: 1.3;
}
.fp-grid-item__enter {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 24px; height: 24px;
  border: none;
  border-radius: 6px;
  background: rgba(255,255,255,0.85);
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s;
}
.fp-grid-item:hover .fp-grid-item__enter { opacity: 1; }
.fp-grid-item__enter:hover { color: var(--primary); background: var(--surface-hover); }

.fp-tree {
  list-style: none;
  margin: 0;
  padding: 0 8px 8px;
}
.fp-tree-children {
  list-style: none;
  margin: 0;
  padding: 0 0 0 22px;
  border-left: 1px dashed var(--border);
  margin-left: 14px;
}
.fp-tree-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
}
.fp-tree-row:hover { background: var(--surface-hover, #f8fafc); }
.fp-tree-row.is-checked { background: var(--surface-active, #f1f5f9); }
.fp-tree-toggle {
  width: 20px; height: 20px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
  transition: transform 0.15s;
}
.fp-tree-toggle.is-open { transform: rotate(90deg); }
.fp-tree-toggle.is-empty { opacity: 0.25; cursor: default; }
.fp-tree-toggle.is-loading { opacity: 0.5; }
.fp-tree-check { flex-shrink: 0; width: 16px; height: 16px; }
.fp-tree-icon { flex-shrink: 0; }
.fp-tree-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fp-tree-enter {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  width: 24px; height: 24px;
  border-radius: 6px;
  cursor: pointer;
  flex-shrink: 0;
  opacity: 0;
}
.fp-tree-row:hover .fp-tree-enter { opacity: 1; }
.fp-tree-enter:hover { background: var(--surface-hover); color: var(--primary); }

.fp-row {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 14px;
  border: none; border-bottom: 1px solid var(--border);
  background: var(--surface-elevated, #fff); text-align: left; cursor: pointer; font-size: 14px;
}
.fp-row:last-child { border-bottom: none; }
.fp-row:hover { background: var(--surface-hover, #f8fafc); }
.fp-row.is-checked { background: var(--surface-active, #f1f5f9); }
.fp-row__check { flex-shrink: 0; width: 16px; height: 16px; cursor: pointer; }
.fp-row__icon { flex-shrink: 0; }
.fp-row__body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.fp-row__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fp-row__sub {
  font-size: 11px; color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-family: ui-monospace, monospace;
}
.fp-row__enter {
  border: none; background: transparent; color: var(--muted); font-size: 18px; line-height: 1;
  width: 28px; height: 28px; border-radius: 6px; cursor: pointer; flex-shrink: 0;
}
.fp-row__enter:hover { background: var(--surface-hover, #f1f5f9); color: var(--primary); }
.fp-browse-actions { flex-wrap: wrap; margin-top: 10px; flex-shrink: 0; }

.fp-browse-selected {
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-muted, #f8fafc);
  flex-shrink: 0;
  min-height: 52px;
}
.fp-browse-selected.has-items {
  background: var(--surface-elevated, #fff);
}
.fp-browse-selected__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.fp-browse-selected__title {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}
.fp-browse-selected__count {
  font-size: 11px;
  color: var(--primary);
  font-weight: 600;
}
.fp-browse-selected__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-height: 88px;
  overflow-y: auto;
}
.fp-browse-selected__empty {
  width: 100%;
  margin: 0;
  padding: 4px 0;
  font-size: 12px;
  color: var(--muted);
  text-align: center;
}
.fp-browse-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: min(280px, 100%);
  padding: 4px 6px 4px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-active, #f1f5f9);
  font-size: 12px;
}
.fp-browse-chip__icon { flex-shrink: 0; font-size: 12px; }
.fp-browse-chip__name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
  color: var(--text);
}
.fp-browse-chip__remove {
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  padding: 0 4px;
  border-radius: 4px;
  flex-shrink: 0;
}
.fp-browse-chip__remove:hover { background: #fee2e2; color: #dc2626; }

.modal__actions { display: flex; justify-content: flex-end; gap: 8px; }

.placeholder-card--wide { max-width: 960px; }
.source-add-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
  margin-top: 24px;
}
.source-add-card {
  border: 1px solid var(--border);
  border-radius: var(--cursor-radius-md, var(--radius));
  padding: 16px;
  background: var(--cursor-bg-subtle, #fafafa);
}
.source-add-card h3 { margin: 0 0 12px; font-size: 14px; font-weight: 600; }
.source-add-card input {
  width: 100%;
  box-sizing: border-box;
  padding: 8px 10px;
  margin-bottom: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
}
.fe-ext-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  margin-bottom: 2px;
  border-radius: 6px;
  font-size: 13px;
  color: var(--text);
  text-decoration: none;
}
.fe-ext-row:hover { background: var(--surface-active, #f1f5f9); color: var(--text); }
.fe-root-block--external { margin-top: 12px; padding-top: 8px; border-top: 1px dashed var(--border); }

.workbench { display: flex; height: calc(100vh - var(--topbar-h, 48px)); position: relative; z-index: 0; }
.spine { width: var(--spine-w); flex-shrink: 0; background: var(--surface-muted); border-right: 1px solid var(--border); padding: 16px 12px; overflow: auto; }
.spine h4 { margin: 16px 0 8px; font-size: 11px; color: #94a3b8; letter-spacing: .06em; text-transform: uppercase; }
.spine h4:first-child { margin-top: 0; }
.spine-item {
  display: block; width: 100%; text-align: left; padding: 8px 10px; margin-bottom: 2px;
  border: none; background: none; border-radius: 8px; font-size: 14px; cursor: pointer;
}
.spine-item:hover { background: #f1f5f9; }
.spine-item.is-active { background: var(--surface-active, #f1f5f9); color: var(--text); font-weight: 600; }
.spine-item--sub { padding-left: 22px; font-size: 13px; color: var(--muted); }
.spine-item--disabled { opacity: .45; cursor: default; }

.workbench-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.breadcrumb {
  display: none;
  padding: 10px 16px;
  font-size: 13px;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  background: #fff;
}
.workbench.wb-show-breadcrumb .breadcrumb { display: block; }
.panel-body { flex: 1; overflow: auto; padding: 24px; }
/* 项目工作台主区 #panelBody 始终贴边，不保留壳层内边距 */
#panelBody,
#panelBody.panel-body {
  padding: 0 !important;
  margin: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}
.placeholder-card {
  max-width: 720px; background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 32px; box-shadow: var(--shadow);
}
.placeholder-card h2 { margin: 0 0 12px; font-size: 22px; }
.placeholder-card p { margin: 0 0 16px; color: var(--muted); line-height: 1.65; }
.placeholder-card ul { margin: 0; padding-left: 20px; color: var(--muted); line-height: 1.8; }

.select { padding: 6px 10px; border-radius: 8px; border: 1px solid var(--border); font-size: 14px; background: var(--input-bg); color: var(--text); }

.auth-bar { display: flex; align-items: center; gap: 10px; margin-right: 12px; font-size: 13px; color: var(--muted); }
.auth-bar__user { font-weight: 600; color: var(--text, #1a1a1a); }
.auth-bar__team { padding: 2px 8px; background: #f1f5f9; border-radius: 999px; font-size: 12px; }
.auth-bar__team-select { max-width: min(280px, 34vw); min-width: 120px; font-size: 12px; padding: 4px 24px 4px 8px; }

@media (max-width: 900px) { .spine { display: none; } }

/* —— 创建/Git 任务悬浮进度 —— */
.job-dock {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 9999;
  width: min(380px, calc(100vw - 32px));
  font-size: 13px;
}
.job-dock__card {
  background: var(--panel, #111827);
  color: var(--text, #f8fafc);
  border: 1px solid var(--border, rgba(255,255,255,.12));
  border-radius: 14px;
  box-shadow: 0 18px 50px rgba(0,0,0,.35);
  overflow: hidden;
}
.job-dock__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px 8px;
}
.job-dock__title { font-weight: 700; font-size: 14px; }
.job-dock__sub { opacity: .7; margin-top: 2px; }
.job-dock__actions { display: flex; gap: 4px; }
.job-dock__icon-btn {
  border: 0;
  background: transparent;
  color: inherit;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  cursor: pointer;
  opacity: .75;
}
.job-dock__icon-btn:hover { opacity: 1; background: rgba(255,255,255,.08); }
.job-dock__body { padding: 0 14px 14px; }
.job-dock__bar {
  height: 6px;
  border-radius: 999px;
  background: rgba(255,255,255,.1);
  overflow: hidden;
  margin-bottom: 8px;
}
.job-dock__bar-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #38bdf8, #22c55e);
  transition: width .35s ease;
}
.job-dock__meta {
  display: flex;
  justify-content: space-between;
  opacity: .75;
  margin-bottom: 10px;
  font-size: 12px;
}
.job-dock__steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.job-dock__step { display: flex; gap: 8px; align-items: flex-start; }
.job-dock__step-icon {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  background: rgba(255,255,255,.08);
  flex: 0 0 auto;
}
.job-dock__step.is-succeeded .job-dock__step-icon { background: rgba(34,197,94,.2); color: #4ade80; }
.job-dock__step.is-failed .job-dock__step-icon { background: rgba(239,68,68,.2); color: #f87171; }
.job-dock__step.is-running .job-dock__step-icon { background: rgba(56,189,248,.2); color: #38bdf8; }
.job-dock__step-body { display: grid; gap: 2px; min-width: 0; }
.job-dock__step-label { font-weight: 600; }
.job-dock__step-detail { opacity: .7; font-size: 12px; line-height: 1.4; word-break: break-word; }
.job-dock__hint { margin: 10px 0 0; line-height: 1.45; opacity: .85; }
.job-dock__foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.job-dock__pill {
  border: 0;
  cursor: pointer;
  border-radius: 999px;
  padding: 10px 14px;
  background: #0ea5e9;
  color: #fff;
  font-weight: 700;
  box-shadow: 0 10px 30px rgba(14,165,233,.35);
}
.create-git-feedback {
  margin: 10px 0 0;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid transparent;
  display: none;
  line-height: 1.5;
  font-size: 13px;
}
.create-git-feedback.is-show { display: block; }
.create-git-feedback.is-ok {
  background: rgba(34,197,94,.12);
  border-color: rgba(34,197,94,.35);
  color: #4ade80;
}
.create-git-feedback.is-err {
  background: rgba(239,68,68,.12);
  border-color: rgba(239,68,68,.35);
  color: #f87171;
}
.create-git-feedback.is-info {
  background: rgba(56,189,248,.12);
  border-color: rgba(56,189,248,.3);
  color: #7dd3fc;
}
