@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap");

:root {
  --font: "Inter", "PingFang SC", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;

  --rail-w: 56px;
  --sidebar-w: 300px;
  --titlebar-h: 52px;
  --tabbar-h: 40px;

  --rail-bg: #111116;
  --rail-hover: #1c1c24;
  --rail-active: #252530;
  --rail-border: rgba(255, 255, 255, 0.06);
  --rail-text: #8b8b9a;
  --rail-text-active: #f4f4f5;

  --sidebar-bg: #fafafa;
  --editor-bg: #ffffff;
  --canvas-bg: #f5f5f7;

  --border: #e8e8ed;
  --border-subtle: #f0f0f4;

  --text: #18181b;
  --text-secondary: #52525b;
  --text-muted: #a1a1aa;

  --accent: #5b5bd6;
  --accent-hover: #4f4fc4;
  --accent-soft: #ededfc;
  --accent-glow: rgba(91, 91, 214, 0.18);

  --success: #16a34a;
  --success-bg: #f0fdf4;
  --warning: #d97706;
  --warning-bg: #fffbeb;
  --danger: #dc2626;
  --danger-bg: #fef2f2;
  --info: #2563eb;
  --info-bg: #eff6ff;

  --radius: 10px;
  --radius-sm: 7px;
  --shadow-sm: 0 1px 2px rgba(24, 24, 27, 0.04);
  --shadow-md: 0 12px 40px rgba(24, 24, 27, 0.12);
  --shadow-card: 0 1px 3px rgba(24, 24, 27, 0.06), 0 0 0 1px rgba(24, 24, 27, 0.03);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font);
  color: var(--text);
  background: var(--canvas-bg);
  height: 100vh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; color: inherit; }

.app { display: flex; flex-direction: column; height: 100vh; }

/* Titlebar */
.titlebar {
  height: var(--titlebar-h);
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 20px;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: -0.02em;
  color: var(--text);
  white-space: nowrap;
}

.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: linear-gradient(135deg, #7c7cf0 0%, #5b5bd6 50%, #4343b8 100%);
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  box-shadow: 0 4px 12px var(--accent-glow);
}

.brand-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  border: none;
  background: transparent;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: -0.02em;
  color: var(--text);
  padding: 0;
}

.brand-btn:hover { opacity: 0.85; }

.brand-btn.is-active {
  color: var(--accent);
}

.back-projects-btn {
  color: var(--text-secondary);
}

.is-hidden { display: none !important; }

.project-bar {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  min-width: 0;
}

.project-bar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.create-ws-wrap {
  position: relative;
}

.create-ws-caret {
  display: inline-block;
  width: 0;
  height: 0;
  margin-left: 2px;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid currentColor;
  opacity: 0.7;
}

.create-ws-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 40;
  min-width: 200px;
  padding: 6px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
}

.create-ws-menu[hidden] {
  display: none;
}

.create-ws-menu button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: none;
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  color: var(--text);
  text-align: left;
}

.create-ws-menu button:hover {
  background: var(--sidebar-bg);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: #fff;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.18s ease;
  white-space: nowrap;
}

.btn:hover { background: var(--sidebar-bg); border-color: #d4d4d8; }
.btn:active { transform: scale(0.98); }
.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 2px 8px var(--accent-glow);
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--border-subtle); color: var(--text); }
.btn-sm { padding: 5px 9px; font-size: 12px; }
.btn-icon { width: 30px; height: 30px; padding: 0; }
.btn-danger-ghost {
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 28%, transparent);
  background: transparent;
}
.btn-danger-ghost:hover { background: var(--danger-bg); color: var(--danger); border-color: transparent; }

.user-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
  flex-shrink: 0;
  font-size: 13px;
  color: var(--text-secondary);
}

.avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, #a5b4fc, #6366f1);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 700;
}

/* Workbench */
.workbench { flex: 1; display: flex; min-height: 0; }

/* Project home (outer layer) */
.project-home {
  flex: 1;
  min-height: 0;
  overflow: auto;
  background: #f0f2f5;
}

.project-home-inner {
  max-width: 1440px;
  margin: 0 auto;
  padding: 20px 24px 28px;
}

.project-home-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.project-home-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.project-home-title-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  color: var(--accent);
}

.project-home-title h1 {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.project-home-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.project-home-search {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
  min-width: 220px;
}

.project-home-search input {
  border: none;
  outline: none;
  background: transparent;
  flex: 1;
  font-size: 13px;
  min-width: 120px;
}

.project-home-search .icon { color: var(--text-muted); }

.project-card-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

@media (max-width: 1280px) {
  .project-card-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 960px) {
  .project-card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.project-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  min-height: 200px;
  transition: box-shadow 0.18s ease, transform 0.18s ease;
}

.project-card:hover {
  box-shadow: 0 8px 24px rgba(24, 24, 27, 0.08);
  transform: translateY(-1px);
}

.project-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 14px 14px 0;
}

.project-card-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.project-card-logo {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

.project-card-tag {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.project-card-more {
  color: var(--text-muted);
  flex-shrink: 0;
}

.project-card-actions {
  position: relative;
  flex-shrink: 0;
}

.project-card-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 40;
  min-width: 188px;
  padding: 6px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
}

.project-card-menu[hidden] {
  display: none;
}

.project-card-menu button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: none;
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  color: var(--text);
  text-align: left;
}

.project-card-menu button[data-delete-project] {
  color: #dc2626;
}

.project-card-menu button:hover:not(:disabled) {
  background: var(--sidebar-bg);
}

.project-card-menu button[data-delete-project]:hover:not(:disabled) {
  background: #fef2f2;
}

.project-card-menu button:disabled {
  color: var(--text-muted);
  cursor: not-allowed;
  opacity: 0.65;
}

.project-card-body {
  flex: 1;
  text-align: left;
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 12px 14px 8px;
  width: 100%;
}

.project-card-name {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text);
}

.project-card-edit {
  opacity: 0;
  color: var(--text-muted);
  transition: opacity 0.15s ease;
}

.project-card:hover .project-card-edit { opacity: 1; }

.project-card-desc {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.project-card-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 10px 0 8px;
  padding: 10px;
  background: var(--sidebar-bg);
  border-radius: var(--radius-sm);
}

.project-metric {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  text-align: center;
}

.project-metric-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}

.project-metric-label {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}

.project-card-submetrics {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.project-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px 14px;
  border-top: 1px solid var(--border-subtle);
  margin-top: auto;
}

.project-pipeline {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 500;
  min-width: 0;
}

.project-pipeline .icon { flex-shrink: 0; }
.project-pipeline .icon svg { width: 14px; height: 14px; }

.pipeline-running { color: var(--accent); }
.pipeline-idle { color: var(--success); }
.pipeline-queued { color: var(--warning); }

.project-home-empty {
  grid-column: 1 / -1;
  padding: 48px 20px;
  text-align: center;
  color: var(--text-muted);
  background: #fff;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

.project-home-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 20px;
  padding-top: 16px;
  font-size: 12px;
  color: var(--text-muted);
  flex-wrap: wrap;
  gap: 12px;
}

.project-home-pagination {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pagination-pages {
  display: flex;
  align-items: center;
  gap: 4px;
}

.pagination-pages .btn.active {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: transparent;
}

/* Workspace panel (project → code repos) */
.workspace-panel {
  width: var(--ws-panel-w, 248px);
  background: #fff;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex-shrink: 0;
}

.workspace-panel-header {
  padding: 14px 14px 10px;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.workspace-panel-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
}

.workspace-panel-subtitle {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 10px;
  line-height: 1.4;
}

.workspace-panel-body {
  flex: 1;
  overflow: auto;
  padding: 6px 8px 10px;
}

.workspace-panel-header .sidebar-search {
  margin-top: 0;
}

.ws-panel-toolbar {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ws-type-filter-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ws-type-filter-field label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
}

.ws-panel-search {
  width: 100%;
  margin-top: 0;
}

.ws-panel-type-select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--text-secondary);
  background: #fff;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.ws-panel-type-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.workspace-panel-body::-webkit-scrollbar { width: 6px; }
.workspace-panel-body::-webkit-scrollbar-thumb { background: #d4d4d8; border-radius: 3px; }

/* Workspace group + nested chats (Cursor-style) */
.ws-group {
  margin-bottom: 6px;
  border-radius: var(--radius-sm);
}

.ws-group.ws-active .ws-group-head {
  background: var(--accent-soft);
}

.ws-group-head {
  display: flex;
  align-items: stretch;
  gap: 2px;
  border-radius: var(--radius-sm);
  transition: background 0.12s;
}

.ws-group-head:hover { background: var(--sidebar-bg); }

.ws-group-toggle {
  width: 26px;
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--text-muted);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}

.ws-group-toggle:hover { color: var(--text); background: rgba(0,0,0,0.03); }

.ws-group-select {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  text-align: left;
  padding: 8px 8px 8px 0;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.ws-group-icon {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: var(--sidebar-bg);
  color: var(--text-secondary);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.ws-group.ws-active .ws-group-icon {
  background: #fff;
  color: var(--accent);
}

.ws-group-info { flex: 1; min-width: 0; }

.ws-group-name {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--mono);
}

.ws-group-meta {
  display: block;
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 1px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ws-chat-list {
  padding: 2px 0 4px 26px;
}

.ws-view-all-btn {
  display: block;
  width: calc(100% - 8px);
  margin: 4px 4px 6px;
  padding: 7px 10px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-size: 12px;
  text-align: left;
  cursor: pointer;
}

.ws-view-all-btn:hover {
  background: var(--accent-soft);
}

.ws-load-more-btn {
  display: block;
  width: calc(100% - 8px);
  margin: 4px 4px 2px;
  padding: 7px 10px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 12px;
  text-align: center;
  cursor: pointer;
}

.ws-load-more-btn:hover {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent);
}

.tab-view--conversation-list {
  max-width: none;
  width: 100%;
  padding: 24px 28px 32px;
}

.conversation-list-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 12px 16px;
  margin-bottom: 16px;
}

.conversation-list-head {
  flex: 1;
  min-width: 200px;
}

.conversation-list-title {
  margin: 0 0 4px;
  font-size: 20px;
  font-weight: 700;
}

.conversation-list-subtitle {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
}

.conversation-list-search {
  width: min(100%, 280px);
  margin: 0;
}

.conversation-list-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.conversation-list-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: #fff;
  cursor: pointer;
  text-align: left;
  font: inherit;
  transition: border-color 0.12s, box-shadow 0.12s;
}

.conversation-list-item:hover {
  border-color: var(--border);
  box-shadow: var(--shadow-sm);
}

.conversation-list-item.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

.conversation-list-item-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.conversation-list-item-meta {
  font-size: 12px;
  color: var(--text-muted);
}

.ws-chat-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 2px;
}

.ws-chat-row > .ws-chat-item,
.ws-chat-rename {
  flex: 1;
  min-width: 0;
}

.ws-chat-rename {
  height: 32px;
  margin: 2px 0;
  padding: 0 8px;
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--text);
  font-size: 12px;
}

.ws-chat-menu-btn {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  margin-right: 4px;
  padding: 0;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  font-size: 16px;
  line-height: 22px;
  cursor: pointer;
  opacity: 0;
}

.ws-chat-row:hover .ws-chat-menu-btn,
.ws-chat-row.is-menu-open .ws-chat-menu-btn,
.ws-chat-row.is-renaming .ws-chat-menu-btn {
  opacity: 1;
}

.ws-chat-menu-btn:hover {
  background: var(--surface-hover, rgba(0, 0, 0, 0.06));
  color: var(--text);
}

.ws-chat-menu {
  position: absolute;
  top: 32px;
  right: 6px;
  z-index: 8;
  min-width: 108px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.ws-chat-menu button {
  display: block;
  width: 100%;
  padding: 6px 10px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  font-size: 12px;
  text-align: left;
  cursor: pointer;
}

.ws-chat-menu button:hover {
  background: var(--sidebar-bg);
}

.ws-chat-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border: none;
  background: transparent;
  cursor: pointer;
  text-align: left;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  transition: background 0.12s;
}

.ws-chat-item:hover { background: var(--sidebar-bg); }

.ws-chat-item.active {
  background: var(--accent-soft);
  box-shadow: inset 2px 0 0 var(--accent);
}

.ws-chat-title {
  font-size: 12px;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}

.ws-chat-item.active .ws-chat-title {
  color: var(--text);
  font-weight: 500;
}

.ws-chat-time {
  font-size: 10px;
  color: var(--text-muted);
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.ws-chat-empty {
  font-size: 11px;
  color: var(--text-muted);
  padding: 6px 10px;
}

.ws-chat-loading {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--text-muted);
  padding: 8px 10px;
}

.ws-chat-item--skeleton {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 10px;
  pointer-events: none;
}

.ws-chat-skeleton-title {
  width: 72%;
  height: 12px;
}

.ws-group--skeleton {
  padding: 10px 12px;
  margin-bottom: 8px;
}

.msg-wrap--skeleton {
  max-width: min(78%, 820px);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.file-preview-skeleton,
.task-agent-output-skeleton {
  padding: 16px 0;
}

.kanban-subtitle-skeleton {
  display: inline-block;
  width: 220px;
  height: 12px;
  margin-top: 4px;
}

.git-repo-hint-skeleton {
  display: inline-block;
  width: 240px;
  height: 12px;
}

.sidebar-loading {
  padding: 8px 4px;
}

.ws-chat-new {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 6px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 11px;
  color: var(--text-muted);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  margin-top: 2px;
}

.ws-chat-new:hover {
  color: var(--accent);
  background: var(--accent-soft);
}

/* legacy ws-item - kept for reference, unused */
.ws-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  text-align: left;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  padding: 10px 10px;
  cursor: pointer;
  transition: all 0.15s ease;
  margin-bottom: 4px;
}

.ws-item:hover {
  background: var(--sidebar-bg);
  border-color: var(--border-subtle);
}

.ws-item.active {
  background: var(--accent-soft);
  border-color: rgba(91, 91, 214, 0.25);
  box-shadow: 0 0 0 1px rgba(91, 91, 214, 0.08);
}

.ws-item-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--sidebar-bg);
  color: var(--text-secondary);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.ws-item.active .ws-item-icon {
  background: #fff;
  color: var(--accent);
}

.ws-item-main { flex: 1; min-width: 0; }

.ws-item-name {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  letter-spacing: -0.01em;
}

.ws-item-repo {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--mono);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-bottom: 6px;
}

.ws-item-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.ws-item-branch {
  font-size: 10px;
  font-family: var(--mono);
  padding: 2px 6px;
  border-radius: 999px;
  background: var(--sidebar-bg);
  color: var(--text-secondary);
}

.ws-splitter {
  width: 1px;
  cursor: col-resize;
  background: var(--border);
  flex-shrink: 0;
  position: relative;
  z-index: 2;
}

.ws-splitter::after {
  content: "";
  position: absolute;
  inset: 0 -3px;
}

.ws-splitter:hover, .ws-splitter.dragging { background: var(--accent); }

.ws-panel-collapse-btn {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fff;
  color: var(--text-muted);
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.ws-panel-collapse-btn:hover {
  background: var(--accent-soft, #eef2ff);
  color: var(--accent);
  border-color: rgba(91, 91, 214, 0.35);
}

.ws-panel-collapse-btn .icon {
  display: flex;
  width: 14px;
  height: 14px;
}

.ws-panel-collapse-btn .icon svg,
.ws-panel-collapse-btn > svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.workbench.ws-panel-collapsed .workspace-panel {
  width: 0 !important;
  overflow: hidden;
  border-right: none;
  pointer-events: none;
}

.workbench.ws-panel-collapsed .workspace-panel-header,
.workbench.ws-panel-collapsed .workspace-panel-body {
  display: none;
}

.workbench.ws-panel-collapsed .ws-splitter {
  width: 0;
  cursor: default;
  background: transparent;
}

.workbench.ws-panel-collapsed .ws-splitter::after {
  display: none;
}

.workbench.ws-panel-collapsed .ws-panel-collapse-btn {
  left: 0;
  transform: translate(0, -50%);
  border-radius: 0 999px 999px 0;
  border-left: none;
}

/* Project dashboard (main area) */
.project-dashboard-main {
  max-width: 1080px;
  margin: 0 auto;
}

.pd-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.pd-hero-main {
  display: flex;
  align-items: center;
  gap: 14px;
}

.pd-hero-title {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 4px;
}

.pd-hero-subtitle {
  font-size: 13px;
  color: var(--text-muted);
}

.project-dashboard-main .pd-desc {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 8px;
}

.pd-ws-list--grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 8px;
}

/* Task queue chart */
.queue-chart {
  margin-top: 12px;
}

.queue-legend {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 14px;
  font-size: 12px;
  color: var(--text-secondary);
}

.queue-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.queue-dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  display: inline-block;
}

.queue-dot.pending, .queue-seg.pending { background: #f59e0b; }
.queue-dot.running, .queue-seg.running { background: var(--accent); }
.queue-dot.completed, .queue-seg.completed { background: var(--success); }

.queue-current-panel {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: #fff;
  margin-bottom: 20px;
}

.queue-panel-head,
.queue-ws-row {
  display: grid;
  grid-template-columns: minmax(140px, 1.2fr) minmax(180px, 2fr) 64px 64px 72px;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
}

.queue-panel-head {
  background: var(--sidebar-bg);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border-subtle);
}

.queue-panel-head .queue-col-name,
.queue-panel-head .queue-col-bar,
.queue-panel-head .queue-col-stat {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.queue-ws-row {
  width: 100%;
  border: none;
  background: transparent;
  cursor: pointer;
  text-align: left;
  font: inherit;
  border-bottom: 1px solid var(--border-subtle);
  transition: background 0.12s;
}

.queue-ws-row:last-child { border-bottom: none; }
.queue-ws-row:hover { background: var(--sidebar-bg); }

.queue-col-name {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.queue-ws-name {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.queue-col-stat {
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.queue-ws-row .queue-col-stat {
  font-size: 14px;
  font-weight: 600;
}

.queue-stat-pending { color: #d97706; }
.queue-stat-running { color: var(--accent); }
.queue-stat-completed { color: var(--success); }

.queue-bar-track {
  display: flex;
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--border-subtle);
}

.queue-bar-track--empty {
  align-items: center;
  justify-content: center;
  height: 28px;
  font-size: 11px;
  color: var(--text-muted);
}

.queue-seg {
  display: block;
  height: 100%;
  min-width: 2px;
  transition: width 0.2s ease;
}

.queue-history-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 4px;
}

.queue-spark-label {
  font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap;
}

/* Single workspace queue chart */
.queue-chart--single {
  margin-top: 0;
}

.queue-current-panel--single {
  padding: 16px 18px;
}

.queue-single-summary {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.queue-single-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.queue-single-metric {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 10px;
  border-radius: var(--radius-sm);
  background: var(--sidebar-bg);
}

.queue-single-metric-value {
  font-size: 24px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.queue-single-metric-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.queue-single-bar {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.queue-single-bar-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

.queue-single-bar .queue-bar-track {
  height: 14px;
}

/* ROI metrics panel */
.queue-roi-panel {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  background: #fff;
  margin-top: 20px;
}

.queue-roi-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.queue-roi-panel-head-text {
  min-width: 0;
  flex: 1 1 220px;
}

.queue-roi-panel-head .queue-history-title {
  margin-bottom: 4px;
}

.queue-roi-panel-head .section-hint {
  margin: 0;
}

.roi-trend-filter {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  flex: 0 0 auto;
}

.roi-trend-time-filter {
  min-width: 120px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--sidebar-bg);
  font-size: 13px;
  color: var(--text);
}

.roi-trend-date-range {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.roi-trend-date-range.is-hidden {
  display: none;
}

.queue-roi-table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 14px 0 8px;
  flex-wrap: wrap;
}

.queue-roi-table-toolbar-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

.queue-roi-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 18px;
}

.queue-roi-summary--extended {
  grid-template-columns: repeat(auto-fit, minmax(108px, 1fr));
}

.queue-roi-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 8px;
  border-radius: var(--radius-sm);
  background: var(--sidebar-bg);
}

.queue-roi-value {
  font-size: 20px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  line-height: 1.1;
}

.queue-roi-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.queue-roi-charts {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 18px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border-subtle);
}

.queue-roi-trend-row {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 12px;
  align-items: end;
}

.queue-roi-trend-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  padding-bottom: 20px;
}

.queue-roi-trend-bars {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  min-height: 92px;
}

.queue-roi-trend-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.queue-roi-trend-value {
  font-size: 10px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text-secondary);
  line-height: 1.2;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.queue-roi-trend-bar {
  width: 100%;
  max-width: 36px;
  border-radius: 4px 4px 0 0;
  background: var(--accent);
  min-height: 4px;
}

.queue-roi-bar--tokens { background: #8b5cf6; }
.queue-roi-bar--tasks { background: var(--success); }
.queue-roi-bar--adoption { background: #0ea5e9; }
.queue-roi-bar--duration { background: #f59e0b; }

.queue-roi-table-wrap {
  overflow-x: auto;
}

.queue-roi-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.queue-roi-table th,
.queue-roi-table td {
  padding: 9px 10px;
  text-align: left;
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}

.queue-roi-table th {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--sidebar-bg);
}

.queue-roi-table tbody tr:last-child td {
  border-bottom: none;
}

.queue-roi-table td {
  font-variant-numeric: tabular-nums;
  color: var(--text-secondary);
}

.queue-roi-table td:first-child {
  font-weight: 500;
  color: var(--text);
}

.queue-roi-queue {
  font-size: 11px;
  color: var(--text-muted);
}

@media (max-width: 720px) {
  .queue-roi-summary {
    grid-template-columns: repeat(2, 1fr);
  }

  .queue-roi-trend-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .queue-roi-trend-label {
    padding-bottom: 0;
  }
}

.project-dashboard-main .section-block h2 {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pd-logo {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
}

.pd-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 500;
}

.pd-status .icon svg { width: 14px; height: 14px; }

.pd-hero-aside {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.workspace-empty {
  padding: 24px 12px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.6;
}

.pd-section {
  margin-bottom: 22px;
}

.pd-section h3 {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.pd-count {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--sidebar-bg);
  padding: 1px 6px;
  border-radius: 999px;
}

.pd-metrics-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-top: 10px;
}

.pd-metric {
  background: var(--sidebar-bg);
  border-radius: var(--radius-sm);
  padding: 12px 10px;
  text-align: center;
}

.pd-metric-value {
  display: block;
  font-size: 18px;
  font-weight: 700;
  color: var(--accent);
  line-height: 1.2;
}

.pd-metric-label {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

.pd-ws-list,
.pd-activity-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
}

.pd-activity-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 8px;
}

.pd-activity-heading {
  margin: 0 0 4px;
  font-size: 13px;
  font-weight: 650;
  color: var(--text-secondary);
}

.pd-trend-stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 16px;
}

.pd-trend-stack .queue-roi-panel {
  margin-top: 0;
}

@media (max-width: 900px) {
  .pd-activity-grid {
    grid-template-columns: 1fr;
  }
}

.pd-ws-item,
.pd-activity-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  text-align: left;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: #fff;
  padding: 8px 10px;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}

.pd-ws-item:hover,
.pd-activity-item:hover {
  background: var(--sidebar-bg);
  border-color: var(--border);
}

.pd-ws-item.active {
  background: var(--accent-soft);
  border-color: rgba(91, 91, 214, 0.25);
}

.pd-ws-info {
  flex: 1;
  min-width: 0;
}

.pd-ws-name,
.pd-activity-title {
  display: block;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pd-ws-meta,
.pd-activity-meta {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pd-info-list {
  margin-top: 10px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.pd-info-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 12px;
  font-size: 12px;
  border-bottom: 1px solid var(--border-subtle);
}

.pd-info-row:last-child { border-bottom: none; }

.pd-info-row span:first-child { color: var(--text-muted); flex-shrink: 0; }
.pd-info-row span:last-child { text-align: right; font-weight: 500; }

.pd-empty {
  font-size: 12px;
  color: var(--text-muted);
  padding: 12px;
  text-align: center;
  background: var(--sidebar-bg);
  border-radius: var(--radius-sm);
}

.workspace-empty {
  padding: 24px 12px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.6;
}

.workspace-empty {
  padding: 24px 12px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.6;
}

.workspace-activity-tabs {
  display: flex;
  justify-content: center;
  background: var(--editor-bg);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

#workspace-activity-tabs.is-hidden {
  display: none;
}

.workspace-activity-tabs-inner {
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 4px;
  max-width: 1080px;
  width: 100%;
  margin: 0 auto;
  padding: 0 32px;
  overflow-x: auto;
  scrollbar-width: none;
}

.workspace-activity-tabs-inner::-webkit-scrollbar { display: none; }

.ws-activity-tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 14px;
  border: none;
  border-bottom: 2px solid transparent;
  background: transparent;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
  flex-shrink: 0;
}

.ws-activity-tab:hover {
  color: var(--text-secondary);
  background: var(--border-subtle);
}

.ws-activity-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  background: transparent;
}

.ws-activity-tab .icon svg {
  width: 16px;
  height: 16px;
}

.sidebar.is-hidden,
.splitter.is-hidden {
  display: none;
}

/* Two-column workbench: workspace list | editor (activity panel + pane inside) */
.workspace-main {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.workspace-main--full .workspace-pane {
  flex: 1;
}

.activity-panel {
  width: var(--activity-panel-w, 280px);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
}

.activity-panel-header {
  padding: 12px 12px 8px;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.activity-panel-body {
  flex: 1;
  overflow: auto;
  padding: 8px;
}

.activity-panel-body::-webkit-scrollbar { width: 6px; }
.activity-panel-body::-webkit-scrollbar-thumb { background: #d4d4d8; border-radius: 3px; }

.workspace-pane {
  flex: 1;
  min-width: 0;
  overflow: auto;
  background: var(--editor-bg);
}

.editor {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--editor-bg);
  min-height: 0;
}

.editor-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  background: var(--editor-bg);
}

#detail-tab-bar.is-hidden {
  display: none;
}

/* legacy activity rail — removed from layout */
.activity-rail {
  width: var(--rail-w);
  background: var(--rail-bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 0;
  gap: 2px;
  flex-shrink: 0;
}

.rail-btn {
  width: 42px;
  height: 42px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  cursor: pointer;
  display: grid;
  place-items: center;
  color: var(--rail-text);
  position: relative;
  transition: all 0.18s ease;
}

.rail-btn svg { width: 20px; height: 20px; stroke-width: 1.75; }

.rail-btn:hover { background: var(--rail-hover); color: #c4c4d0; }

.rail-btn.active {
  background: var(--rail-active);
  color: var(--rail-text-active);
}

.rail-btn.active::before {
  content: "";
  position: absolute;
  left: -8px;
  top: 10px;
  bottom: 10px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: linear-gradient(180deg, #8b8bf5, #5b5bd6);
}

.rail-btn .tip {
  position: absolute;
  left: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%);
  background: #27272a;
  color: #fafafa;
  font-size: 11px;
  font-weight: 500;
  padding: 5px 10px;
  border-radius: 6px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
  z-index: 100;
  box-shadow: var(--shadow-md);
}

.rail-btn:hover .tip { opacity: 1; }
.rail-spacer { flex: 1; }

.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex-shrink: 0;
}

.sidebar-header {
  padding: 14px 14px 10px;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.sidebar-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 10px;
  letter-spacing: -0.01em;
}

.sidebar-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.sidebar-search {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
  font-size: 13px;
  margin-top: 10px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.sidebar-search:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.sidebar-body {
  flex: 1;
  overflow: auto;
  padding: 10px;
}

.sidebar-body::-webkit-scrollbar { width: 6px; }
.sidebar-body::-webkit-scrollbar-thumb { background: #d4d4d8; border-radius: 3px; }

.splitter {
  width: 1px;
  cursor: col-resize;
  background: var(--border);
  flex-shrink: 0;
  position: relative;
}

.splitter::after {
  content: "";
  position: absolute;
  inset: 0 -3px;
}

.splitter:hover, .splitter.dragging { background: var(--accent); }

.editor {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--editor-bg);
}

.tab-bar {
  height: var(--tabbar-h);
  display: flex;
  align-items: stretch;
  background: var(--sidebar-bg);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.tab-scroll-btn {
  width: 32px;
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--text-muted);
  flex-shrink: 0;
}

.tab-scroll-btn:hover { color: var(--text); background: #fff; }

.tab-strip { flex: 1; display: flex; align-items: stretch; overflow: hidden; min-width: 0; }
.tab-pinned { display: flex; border-right: 1px solid var(--border); flex-shrink: 0; }

.tab-scrollable {
  display: flex;
  overflow-x: auto;
  scrollbar-width: none;
  flex: 1;
  min-width: 0;
}

.tab-scrollable::-webkit-scrollbar { display: none; }

.tab {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 14px;
  border: none;
  border-right: 1px solid var(--border-subtle);
  background: transparent;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
  max-width: 180px;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.tab:hover { color: var(--text-secondary); background: rgba(255,255,255,0.6); }

.tab.active {
  background: var(--editor-bg);
  color: var(--text);
  box-shadow: inset 0 -2px 0 var(--accent);
}

.tab-icon { display: flex; opacity: 0.7; flex-shrink: 0; }
.tab-icon svg { width: 14px; height: 14px; }
.tab-label { overflow: hidden; text-overflow: ellipsis; }

.tab-close {
  width: 18px;
  height: 18px;
  border: none;
  border-radius: 4px;
  background: transparent;
  cursor: pointer;
  color: var(--text-muted);
  display: grid;
  place-items: center;
  font-size: 13px;
  flex-shrink: 0;
  opacity: 0;
  transition: opacity 0.15s;
}

.tab:hover .tab-close { opacity: 1; }
.tab-close:hover { background: var(--danger-bg); color: var(--danger); }
.tab.pinned .tab-close { display: none; }

.editor-content { flex: 1; overflow: auto; min-height: 0; background: var(--editor-bg); }

/* Entity cards */
.entity-card {
  background: #fff;
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  box-shadow: var(--shadow-card);
  overflow: hidden;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.entity-card:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(24,24,27,0.08); }
.entity-card.selected { box-shadow: 0 0 0 2px var(--accent-glow), var(--shadow-card); }

.entity-card-hit {
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  padding: 11px 12px;
  cursor: pointer;
}

.entity-card-title {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  letter-spacing: -0.01em;
}

.entity-card-sub {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--mono);
  margin-bottom: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.entity-card-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.entity-card-actions { display: flex; gap: 4px; padding: 0 8px 8px; justify-content: flex-end; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.7;
}

.badge-running { background: var(--info-bg); color: var(--info); }
.badge-completed { background: var(--success-bg); color: var(--success); }
.badge-failed { background: var(--danger-bg); color: var(--danger); }
.badge-queued { background: var(--warning-bg); color: var(--warning); }
.badge-stopped { background: var(--border-subtle); color: var(--text-secondary); }
.badge-muted { background: var(--border-subtle); color: var(--text-muted); }
.badge-muted::before { display: none; }

.time { font-size: 11px; color: var(--text-muted); font-variant-numeric: tabular-nums; }

.section-group { margin-bottom: 10px; }

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 6px;
  cursor: pointer;
  user-select: none;
}

.section-head h3 {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.section-body { padding: 0 2px; }

.tree-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  transition: background 0.12s;
}

.tree-item:hover { background: #fff; box-shadow: var(--shadow-sm); }
.tree-item .icon { color: var(--text-muted); display: flex; }
.tree-item .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-item .actions { display: flex; gap: 2px; opacity: 0; transition: opacity 0.12s; }
.tree-item:hover .actions { opacity: 1; }

.breadcrumb {
  font-size: 12px;
  color: var(--text-muted);
  word-break: break-all;
  line-height: 1.6;
  margin-bottom: 10px;
  padding: 0 6px;
}

.breadcrumb-link {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  font-size: inherit;
  color: var(--accent);
  cursor: pointer;
  font-weight: 500;
}

.breadcrumb-link:hover { text-decoration: underline; }

.breadcrumb-sep {
  color: var(--text-muted);
  margin: 0 2px;
}

.breadcrumb-current {
  color: var(--text-primary);
  font-weight: 500;
}

.breadcrumb span { color: var(--accent); cursor: pointer; font-weight: 500; }

.file-header .breadcrumb {
  margin-bottom: 0;
  padding: 6px 10px;
  background: var(--sidebar-bg);
  border-radius: var(--radius-sm);
  flex: 1;
  min-width: 0;
}

/* Tab views */
.tab-view { padding: 28px 32px; max-width: 1100px; }

.home-hero {
  position: relative;
  padding: 32px;
  margin: -28px -32px 32px;
  background:
    radial-gradient(ellipse 80% 60% at 10% 20%, rgba(91,91,214,0.12), transparent),
    radial-gradient(ellipse 60% 50% at 90% 80%, rgba(99,102,241,0.08), transparent),
    linear-gradient(180deg, #fafaff 0%, #fff 100%);
  border-bottom: 1px solid var(--border-subtle);
}

.home-hero-inner {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
}

.home-eyebrow {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
}

.home-title {
  font-size: 32px;
  font-weight: 700;
  line-height: 1.15;
  margin-bottom: 10px;
  letter-spacing: -0.03em;
}

.home-tagline { color: var(--text-secondary); font-size: 15px; line-height: 1.6; max-width: 480px; }

.home-theme-badge {
  display: inline-flex;
  padding: 5px 12px;
  border-radius: 999px;
  background: #fff;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  border: 1px solid var(--border);
  margin-bottom: 12px;
}

.section-block { margin-bottom: 32px; }

.section-block h2 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 4px;
  letter-spacing: -0.01em;
}

.section-hint { font-size: 13px; color: var(--text-muted); margin-bottom: 16px; }

.capability-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

.cap-card {
  padding: 18px;
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow-card);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.cap-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(24,24,27,0.08); }

.cap-card-icon {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: var(--accent-soft);
  color: var(--accent);
  display: grid;
  place-items: center;
  margin-bottom: 12px;
}

.cap-card h3 { font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.cap-card p { font-size: 13px; color: var(--text-secondary); line-height: 1.55; }

.cap-card--data .cap-card-summary {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 12px;
  line-height: 1.5;
}

.cap-card--data .cap-card-summary strong {
  color: var(--text);
  font-weight: 600;
}

.cap-card-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cap-card-list-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  min-width: 0;
}

.cap-card-list-btn {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 8px 10px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: var(--sidebar-bg);
  cursor: pointer;
  text-align: left;
  font: inherit;
  transition: background 0.12s, border-color 0.12s;
}

.cap-card-list-btn:hover {
  background: #fff;
  border-color: var(--border);
}

.cap-card-list-title {
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.cap-card-list-meta,
.cap-card-list-time {
  font-size: 11px;
  color: var(--text-muted);
  flex-shrink: 0;
  white-space: nowrap;
}

.cap-card-list-item:not(:has(.cap-card-list-btn)) .cap-card-list-title {
  flex: 1;
  min-width: 0;
}

.cap-card-list-item:not(:has(.cap-card-list-btn)) .cap-card-list-time {
  margin-left: auto;
}

.cap-task-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  flex-shrink: 0;
  margin-top: 1px;
}

.cap-task-badge--queued { background: #fffbeb; color: #d97706; }
.cap-task-badge--running { background: var(--accent-soft); color: var(--accent); }
.cap-task-badge--completed { background: var(--success-bg); color: var(--success); }

.cap-card-empty {
  font-size: 12px;
  color: var(--text-muted);
  padding: 8px 0 2px;
}

.skill-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }

.skill-item {
  display: flex;
  align-items: stretch;
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow-card);
  overflow: hidden;
  transition: box-shadow 0.15s;
}

.skill-item:hover { box-shadow: 0 4px 16px rgba(24,24,27,0.07); }

.skill-toggle {
  display: flex;
  align-items: center;
  padding: 0 14px;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border-subtle);
}

.skill-toggle input { accent-color: var(--accent); width: 16px; height: 16px; }

.skill-run {
  flex: 1;
  text-align: left;
  border: none;
  background: transparent;
  padding: 14px 16px;
  cursor: pointer;
}

.skill-run:hover { background: var(--accent-soft); }
.skill-name { display: block; font-weight: 600; font-size: 14px; margin-bottom: 2px; }
.skill-desc { display: block; font-size: 12px; color: var(--text-muted); }

.file-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.file-path {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text-secondary);
  padding: 6px 10px;
  background: var(--sidebar-bg);
  border-radius: var(--radius-sm);
}

.mode-tabs { display: flex; gap: 4px; background: var(--sidebar-bg); padding: 3px; border-radius: var(--radius-sm); }

.mode-tab {
  padding: 6px 14px;
  border: none;
  border-radius: 5px;
  background: transparent;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  transition: all 0.15s;
}

.mode-tab.active { background: #fff; color: var(--text); box-shadow: var(--shadow-sm); }

/* 文件预览正文（Preview / Raw 共用） */
.tab-view--file {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  box-sizing: border-box;
  max-width: none;
}

.file-raw-preview {
  margin: 0;
  padding: 16px;
  background: #fafafa;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.65;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.file-html-preview {
  display: block;
  width: 100%;
  height: calc(100vh - 260px);
  min-height: 420px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  background: #fff;
}

.file-md-preview {
  max-width: 860px;
}

.file-md-preview pre {
  background: #fafafa;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  overflow: auto;
  white-space: pre-wrap;
}

.file-preview-notice {
  padding: 16px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  background: #fafafa;
  color: var(--text-secondary);
  font-size: 13px;
}

.file-preview-hint {
  margin: 0 0 8px;
  font-size: 12px;
  color: var(--text-muted);
}

.code-block, .pane-body {
  background: #fafafa;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: 16px;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.65;
  overflow: auto;
  white-space: pre-wrap;
}

.md-preview { line-height: 1.75; font-size: 15px; max-width: 720px; }
.md-preview h1 { font-size: 26px; font-weight: 700; margin: 0 0 12px; letter-spacing: -0.02em; }
.md-preview h2 { font-size: 18px; font-weight: 600; margin: 24px 0 8px; }
.md-preview p { margin-bottom: 12px; color: var(--text-secondary); }
.md-preview code {
  background: var(--accent-soft);
  color: var(--accent);
  padding: 2px 7px;
  border-radius: 5px;
  font-family: var(--mono);
  font-size: 13px;
}

.detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.detail-title { font-size: 22px; font-weight: 700; margin-bottom: 10px; letter-spacing: -0.02em; }

.detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  font-size: 13px;
  color: var(--text-secondary);
}

.detail-meta span strong { color: var(--text-muted); font-weight: 500; }
.detail-meta a { color: var(--accent); text-decoration: none; font-weight: 500; }
.detail-meta a:hover { text-decoration: underline; }

.split-pane {
  display: grid;
  grid-template-rows: 2fr 8fr;
  gap: 12px;
  height: calc(100vh - 200px);
  min-height: 400px;
}

.pane {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: #fff;
}

.pane-head {
  padding: 9px 14px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--sidebar-bg);
  border-bottom: 1px solid var(--border-subtle);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.pane-body { flex: 1; overflow: auto; padding: 14px; }

.job-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 16px;
  height: calc(100vh - 180px);
  min-height: 420px;
}

.timeline {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  overflow: auto;
  background: #fff;
}

.timeline-step {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px;
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: background 0.12s;
}

.timeline-step:hover { background: var(--sidebar-bg); }
.timeline-step.active { background: var(--accent-soft); }

.step-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-top: 5px;
  flex-shrink: 0;
}

.step-dot.done { background: var(--success); box-shadow: 0 0 0 3px var(--success-bg); }
.step-dot.running { background: var(--info); box-shadow: 0 0 0 3px var(--info-bg); animation: pulse 2s infinite; }
.step-dot.pending { background: var(--border); }

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 3px var(--info-bg); }
  50% { box-shadow: 0 0 0 6px rgba(37,99,235,0.15); }
}

.chat-layout {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  height: 100%;
}

.tab-view--chat {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

.workspace-main--full .workspace-pane:has(.tab-view--chat),
.workspace-pane:has(.tab-view--chat) {
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.editor-content:has(.tab-view--chat) {
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.chat-task-context {
  flex-shrink: 0;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--sidebar-bg);
  padding: 10px 32px 12px;
}

.chat-task-context-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 8px;
}

.chat-task-actions,
.chat-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.chat-task-title {
  margin: 0;
  padding: 0;
  font-size: 15px;
  font-weight: 650;
  color: var(--text);
  line-height: 1.35;
  min-width: 0;
}

.chat-task-metrics.detail-metrics,
.chat-task-metrics.detail-metrics--task {
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
}

.chat-task-metrics .detail-metrics-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
}

.chat-task-metrics .detail-metric {
  padding: 6px 8px 5px;
}

.chat-task-metrics .detail-metric-value {
  font-size: 13px;
  margin-bottom: 2px;
}

.chat-task-metrics .detail-metric-label {
  font-size: 10px;
}

.chat-task-metrics .detail-metric--skeleton {
  gap: 6px;
}

.chat-task-metrics .detail-metric--skeleton .detail-metric-value {
  display: block;
  height: 14px;
  width: 56%;
  margin-bottom: 4px;
}

.chat-task-metrics .detail-metric--skeleton .detail-metric-label {
  display: block;
  height: 10px;
  width: 72%;
}

.chat-messages {
  flex: 1;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 24px 32px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.chat-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 32px;
  border-bottom: 1px solid var(--border-subtle);
  background: #fff;
  flex-shrink: 0;
}

.chat-toolbar--compact {
  justify-content: flex-end;
  padding-top: 8px;
  padding-bottom: 8px;
}

.chat-title {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-empty,
.chat-error {
  align-self: center;
  max-width: 420px;
  padding: 24px 16px;
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
}

.chat-error {
  color: var(--danger, #dc2626);
}

.chat-meta-panel {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px 32px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--sidebar-bg);
}

.chat-meta-panel label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

.chat-meta-panel input,
.chat-meta-panel textarea {
  font-weight: 400;
}

.chat-meta-actions {
  display: flex;
  justify-content: flex-end;
}

.msg-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: min(78%, 820px);
}

.msg-wrap--user {
  align-self: flex-end;
  align-items: flex-end;
}

.msg-wrap--assistant {
  align-self: stretch;
  max-width: none;
  width: 100%;
  align-items: stretch;
}

.msg-wrap--prompt {
  align-self: stretch;
  max-width: none;
  align-items: stretch;
}

.msg-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 11px;
  color: var(--text-muted);
  padding: 0 4px;
}

.msg-wrap--user .msg-meta {
  justify-content: flex-end;
}

.msg-role {
  font-weight: 600;
  color: var(--text-secondary);
}

.msg-time {
  font-variant-numeric: tabular-nums;
  margin-left: auto;
}

.msg-mode-tag {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--border-subtle);
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 600;
  line-height: 1.4;
}

.msg {
  width: 100%;
  font-size: 14px;
  line-height: 1.7;
}

.msg-content {
  white-space: pre-wrap;
  word-break: break-word;
}

.msg-user {
  padding: 12px 16px;
  border-radius: 16px 16px 4px 16px;
  background: var(--accent);
  color: #fff;
  box-shadow: 0 4px 16px var(--accent-glow);
}

.msg-user .msg-content {
  white-space: pre-wrap;
}

.msg-assistant {
  padding: 14px 18px;
  border-radius: 16px 16px 16px 4px;
  background: var(--sidebar-bg);
  border: 1px solid var(--border-subtle);
  color: var(--text);
}

.msg-prompt {
  padding: 14px 18px;
  border-radius: var(--radius);
  background: #fff;
  border: 1px solid var(--border-subtle);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.msg-prompt--collapsible {
  padding: 0;
  overflow: hidden;
}

.msg-prompt--collapsible .msg-prompt-body {
  padding: 0 18px 14px;
}

.msg-prompt--collapsible .msg-prompt-body[hidden] {
  display: none !important;
}

.msg-prompt--collapsible .msg-prompt-title {
  margin-bottom: 8px;
}

.msg-prompt--collapsible.is-expanded .msg-collapse-toggle {
  border-bottom: 1px solid var(--border-subtle);
}

.msg-prompt-title {
  font-size: 14px;
  font-weight: 650;
  color: var(--text);
  margin-bottom: 8px;
  line-height: 1.45;
}

.msg-prompt-desc {
  font-size: 13px;
  line-height: 1.65;
  color: var(--text-secondary);
  white-space: pre-wrap;
  word-break: break-word;
}

.msg-prompt-desc--empty {
  color: var(--text-muted);
  font-style: italic;
}

.msg-agent-meta {
  font-size: 10px;
  color: var(--text-muted);
}

.msg-assistant--collapsible {
  padding: 0;
  overflow: hidden;
}

.msg-assistant--collapsible .msg-content {
  padding: 0 18px 14px;
}

.msg-assistant--collapsible .msg-content[hidden] {
  display: none !important;
}

.msg-collapse-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.msg-collapse-toggle:hover {
  background: rgba(15, 23, 42, 0.03);
}

.msg-collapse-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.msg-collapse-preview {
  flex: 1;
  min-width: 0;
  font-size: 12px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.msg-collapse-icon {
  flex-shrink: 0;
  font-size: 11px;
  color: var(--text-muted);
}

.msg-assistant.is-expanded .msg-collapse-toggle {
  border-bottom: 1px solid var(--border-subtle);
}

.msg-prompt .md-preview h1,
.msg-prompt .md-preview h2,
.msg-prompt .md-preview h3,
.msg-assistant .md-preview h1,
.msg-assistant .md-preview h2,
.msg-assistant .md-preview h3 {
  color: var(--text);
}

.msg-streaming {
  opacity: 0.92;
}

.chat-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.chat-attachment-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  font-size: 11px;
}

.msg-assistant .chat-attachment-chip,
.msg-prompt .chat-attachment-chip {
  background: var(--border-subtle);
  color: var(--text-secondary);
}

.chat-composer {
  flex-shrink: 0;
  margin: auto 20px 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.chat-composer--locked {
  background: var(--sidebar-bg);
  opacity: 0.92;
}

.chat-composer--locked .composer-input {
  cursor: not-allowed;
  color: var(--text-muted);
}

.chat-composer--locked .send-btn:not(.send-btn--stop) {
  opacity: 0.45;
  cursor: not-allowed;
}

.composer-attachments {
  padding: 6px 12px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.composer-attachments:empty {
  display: none;
}

.attach-chip {
  font-size: 12px;
  padding: 4px 10px;
  background: var(--sidebar-bg);
  border-radius: 999px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 4px;
}

.composer-input {
  width: 100%;
  border: none;
  padding: 8px 12px;
  resize: none;
  min-height: 36px;
  max-height: 120px;
  background: transparent;
  outline: none;
  font-size: 13px;
  line-height: 1.45;
}

.composer-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 8px;
  border-top: 1px solid var(--border-subtle);
  background: var(--sidebar-bg);
  gap: 6px;
  flex-wrap: wrap;
  min-height: 0;
}

.executor-picker { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.executor-picker select {
  padding: 2px 8px;
  height: 26px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 11px;
  line-height: 1.2;
  background: #fff;
}

.run-style { display: flex; gap: 4px; }

.run-style label {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  cursor: pointer;
  color: var(--text-muted);
  transition: all 0.15s;
}

.run-style input { display: none; }
.run-style input:checked + span {
  background: #fff;
  color: var(--accent);
  box-shadow: var(--shadow-sm);
  font-weight: 500;
}

.send-btn {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  display: grid;
  place-items: center;
  box-shadow: 0 1px 4px var(--accent-glow);
  transition: transform 0.15s;
  flex-shrink: 0;
}

.send-btn .icon {
  line-height: 0;
}

.send-btn .icon svg {
  width: 11px;
  height: 11px;
}

.send-btn:hover { transform: scale(1.05); }

.skill-layout { display: grid; grid-template-columns: 1fr 260px; gap: 20px; }

.skill-section {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  margin-bottom: 12px;
  overflow: hidden;
  background: #fff;
}

.skill-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 14px;
  background: var(--sidebar-bg);
  border-bottom: 1px solid var(--border-subtle);
  font-size: 13px;
  font-weight: 600;
}

.skill-section-body { padding: 14px; font-size: 14px; line-height: 1.65; color: var(--text-secondary); }

.settings-group {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  margin-bottom: 12px;
  overflow: visible;
  background: #fff;
}

.settings-group h3 {
  padding: 10px 14px;
  background: var(--sidebar-bg);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-subtle);
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 13px;
}

.settings-row:last-child { border-bottom: none; }

.tab-view--settings {
  padding: 20px 24px 28px;
  max-width: 720px;
}

.settings-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.settings-head .detail-title { margin: 0 0 4px; }

.settings-head .section-hint {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
}

.settings-form {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.settings-form .form-field { margin: 0; }

.settings-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 2px;
}

.settings-callout {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-secondary);
}

.settings-callout--git {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
}

.settings-callout-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: #eef2ff;
  color: #6366f1;
  flex-shrink: 0;
}

.settings-callout-icon .icon svg {
  width: 16px;
  height: 16px;
}

.settings-callout p {
  margin: 0;
}

.settings-callout strong {
  font-weight: 600;
  color: var(--text);
}

.settings-readonly-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 16px;
  padding: 12px;
  background: var(--sidebar-bg);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
}

.settings-readonly-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
}

.settings-readonly-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.settings-mono {
  font-size: 11px;
  font-family: var(--mono);
  word-break: break-all;
}

@media (max-width: 640px) {
  .settings-readonly-grid { grid-template-columns: 1fr; }
  .settings-head { flex-direction: column; align-items: stretch; }
}

.toggle {
  width: 42px;
  height: 24px;
  border-radius: 999px;
  background: #d4d4d8;
  position: relative;
  cursor: pointer;
  transition: background 0.2s;
}

.toggle.on { background: var(--accent); }

.toggle::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.toggle.on::after { transform: translateX(18px); }

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(24, 24, 27, 0.45);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1300;
  padding: 24px;
}

.modal-overlay.open { display: flex; }

.modal {
  width: min(480px, 100%);
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 14px;
  box-shadow: var(--shadow-md);
  overflow: hidden;
  animation: modalIn 0.2s ease;
}

.modal.modal--wide {
  width: min(580px, 100%);
}

.modal.modal--story-form {
  width: min(760px, 100%);
}

.modal-body {
  padding: 22px;
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 0;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.modal-body::-webkit-scrollbar {
  width: 6px;
}

.modal-body::-webkit-scrollbar-thumb {
  background: #d4d4d8;
  border-radius: 999px;
}

.modal-body::-webkit-scrollbar-thumb:hover {
  background: #a1a1aa;
}

.modal-head,
.modal-foot {
  flex-shrink: 0;
}

.modal-body > .form-field:last-child {
  margin-bottom: 0;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.96) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-head {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border-subtle);
  font-weight: 600;
  font-size: 16px;
  letter-spacing: -0.01em;
}

.modal-head--with-desc {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.modal-title-main {
  font-weight: 600;
  font-size: 16px;
  letter-spacing: -0.01em;
}

.modal-title-desc {
  margin: 0;
  font-size: 13px;
  font-weight: 400;
  line-height: 1.45;
  color: var(--text-muted);
}

.modal-foot {
  padding: 14px 22px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  background: var(--sidebar-bg);
}

.modal-choice-lead {
  margin: 0 0 12px;
  font-size: 14px;
  color: var(--text-secondary);
}

.modal-choice-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.modal-choice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.modal-choice:hover {
  border-color: #c7d2fe;
  background: #f8fafc;
}

.modal-choice:has(input:checked) {
  border-color: #6366f1;
  background: #eef2ff;
}

.modal-choice input {
  margin-top: 3px;
  flex-shrink: 0;
}

.modal-choice-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.modal-choice-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.modal-choice-desc {
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-muted);
}

.btn-danger {
  background: #dc2626;
  border-color: #dc2626;
  color: #fff;
}

.btn-danger:hover {
  background: #b91c1c;
  border-color: #b91c1c;
}

.form-field { margin-bottom: 16px; }
.form-field label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 6px; color: var(--text-secondary); }
.form-field > [hidden],
.form-hint[hidden],
.schedule-testtask-list[hidden] { display: none !important; }

.modal-form-section {
  margin-top: 20px;
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  background: linear-gradient(180deg, #f8fafc 0%, #fff 28%);
  overflow: hidden;
}

.modal-form-section--git {
  border-color: #e2e8f0;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.modal-form-section-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px 0;
}

.modal-form-section-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: #eef2ff;
  color: #6366f1;
  flex-shrink: 0;
}

.modal-form-section-icon .icon svg {
  width: 18px;
  height: 18px;
}

.modal-form-section-title {
  margin: 0 0 4px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
}

.modal-form-section-desc {
  margin: 0;
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-muted);
}

.modal-form-section-body {
  padding: 14px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modal-form-section-body .form-field {
  margin-bottom: 0;
}

.modal-form-section-body .form-field-row {
  margin-bottom: 0;
}

.modal-form-compact {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modal-form-compact > .form-field,
.modal-form-compact > .form-field-row,
.modal-form-compact > .modal-form-subsection {
  margin-bottom: 0;
}

.modal-form-subsection {
  padding: 14px 16px;
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  background: linear-gradient(180deg, #f8fafc 0%, #fff 40%);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.modal-form-subsection-title {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--text-muted);
}

.modal-form-subsection .form-field {
  margin-bottom: 0;
}

.modal-form-subsection .form-field-row {
  margin-bottom: 0;
}

.modal-form-subsection .form-hint {
  margin-top: -4px;
}

.form-field input,
.form-field textarea,
.form-field select {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.form-field input[readonly] {
  background: var(--sidebar-bg);
  color: var(--text-secondary);
}

.schedule-testtask-item:has(input:disabled) {
  cursor: default;
}

.form-field input[type="checkbox"],
.form-field input[type="radio"] {
  width: 16px;
  height: 16px;
  min-width: 16px;
  max-width: 16px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  box-shadow: none;
  flex: 0 0 16px;
}

.form-field input:focus,
.form-field textarea:focus,
.form-field select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
  font-size: 14px;
}

/* Project → Workspace tree (Feishu doc IA) */
.project-group {
  margin-bottom: 8px;
  border-radius: var(--radius-sm);
}

.project-group.project-active .project-group-head {
  background: var(--accent-soft);
}

.project-group-head {
  display: flex;
  align-items: stretch;
  gap: 2px;
  border-radius: var(--radius-sm);
  transition: background 0.12s;
}

.project-group-head:hover { background: var(--sidebar-bg); }

.project-group-select {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  text-align: left;
  padding: 8px 8px 8px 0;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.project-group-icon {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: var(--sidebar-bg);
  color: var(--text-secondary);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.project-group.project-active .project-group-icon {
  background: #fff;
  color: var(--accent);
}

.project-group-info { flex: 1; min-width: 0; }

.project-group-name {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-group-meta {
  display: block;
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-ws-list {
  padding: 2px 0 6px 26px;
}

.project-ws-list .ws-group {
  margin-bottom: 4px;
}

.ws-group-head .ws-list-item {
  flex: 1;
  width: auto;
  min-width: 0;
  padding: 8px 4px 8px 0;
  border-radius: 0;
  margin-right: 2px;
}

.ws-task-add-wrap {
  position: relative;
  flex-shrink: 0;
  align-self: center;
  margin-right: 6px;
}

.ws-task-add-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  z-index: 40;
  min-width: 168px;
  padding: 6px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
}

.ws-task-add-menu[hidden] {
  display: none;
}

.ws-task-add-menu button {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border: none;
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  color: var(--text);
  text-align: left;
  white-space: nowrap;
}

.ws-task-add-menu button:hover {
  background: var(--accent-soft);
  color: var(--accent);
}

.ws-task-add-menu .icon svg {
  width: 14px;
  height: 14px;
}

.ws-task-add-wrap .ws-new-chat-btn {
  margin-right: 0;
}

.ws-new-chat-btn {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  align-self: center;
  margin-right: 6px;
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
  transition: background 0.12s, color 0.12s;
}

.ws-new-chat-btn:hover {
  background: var(--accent-soft);
  color: var(--accent);
}

.ws-new-chat-btn .icon svg {
  width: 14px;
  height: 14px;
}

.project-ws-list .ws-chat-list {
  padding-left: 26px;
}

.ws-list-item {
  width: 100%;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  border: none;
  background: transparent;
  cursor: pointer;
  text-align: left;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  transition: background 0.12s;
}

.ws-list-item:hover { background: var(--sidebar-bg); }

.ws-list-item.active {
  background: var(--accent-soft);
  box-shadow: inset 2px 0 0 var(--accent);
}

.ws-list-info { flex: 1; min-width: 0; }

.ws-list-name {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ws-list-meta {
  display: block;
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ws-type-badge {
  flex-shrink: 0;
  font-size: 9px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-top: 2px;
}

.ws-type-code { background: #e0e7ff; color: #4338ca; }
.ws-type-scan { background: #fef3c7; color: #b45309; }
.ws-type-test { background: #d1fae5; color: #047857; }
.ws-type-docs { background: #e0f2fe; color: #0369a1; }
.ws-type-script { background: #f3e8ff; color: #7e22ce; }
.ws-type-usecase { background: #fce7f3; color: #be185d; }
.ws-type-pl { background: #ede9fe; color: #6d28d9; }

/* Usecase workspace view */
.usecase-workspace-view {
  padding: 24px;
  max-width: 960px;
  margin: 0 auto;
}
.usecase-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.usecase-toolbar h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}
.usecase-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}
.usecase-stats .stat-card {
  background: var(--surface-2, #f8fafc);
  border-radius: 8px;
  padding: 16px;
  text-align: center;
}
.usecase-stats .stat-value {
  display: block;
  font-size: 24px;
  font-weight: 700;
  line-height: 1.2;
}
.usecase-stats .stat-label {
  display: block;
  font-size: 12px;
  color: var(--text-muted, #64748b);
  margin-top: 4px;
}
.usecase-list {
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 8px;
  overflow: hidden;
}
.usecase-list .empty-state {
  padding: 40px;
  text-align: center;
  color: var(--text-muted, #64748b);
}

.usecase-tasks {
  margin-bottom: 24px;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface-2, #f8fafc);
}
.usecase-tasks-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border, #e2e8f0);
  background: var(--surface-1, #fff);
}
.usecase-tasks-head h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
}
.usecase-tasks-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  max-height: 480px;
  overflow-y: auto;
}
.usecase-tasks-list .kanban-card {
  width: 100%;
  text-align: left;
}
.usecase-tasks-list .empty-state {
  padding: 24px;
  text-align: center;
  color: var(--text-muted, #64748b);
  font-size: 12px;
}

.ws-init-badge {
  display: inline-block;
  margin-left: 6px;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 4px;
  vertical-align: middle;
  text-transform: none;
  letter-spacing: 0;
}

.ws-init-pending { background: #fef3c7; color: #b45309; }
.ws-init-ready { background: #dcfce7; color: #15803d; }
.ws-init-failed { background: #fee2e2; color: #b91c1c; }

.ws-status-section {
  margin-top: 0;
}

.ws-status-card {
  padding: 14px 16px;
  border-radius: 10px;
  border: 1px solid var(--border, #e5e7eb);
  background: var(--surface, #fafafa);
}

.ws-status-card.ws-init-pending {
  background: #fffbeb;
  border-color: #fcd34d;
}

.ws-status-card.ws-init-failed {
  background: #fef2f2;
  border-color: #fca5a5;
}

.ws-status-card.ws-init-ready {
  background: #f0fdf4;
  border-color: #86efac;
}

.ws-status-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.ws-status-detail {
  margin: 0;
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-muted, #64748b);
  word-break: break-word;
}

/* Production line default workspace card (project home) */
.pl-default-ws-section .section-hint {
  margin-bottom: 12px;
}

.pl-default-ws-card {
  padding: 16px 18px;
}

.pl-default-ws-body {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.pl-default-ws-main {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  flex: 1;
  min-width: min(100%, 280px);
}

.pl-default-ws-icon {
  width: 44px;
  height: 44px;
  border-radius: 11px;
  background: #ede9fe;
  color: #6d28d9;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.pl-default-ws-icon .icon svg {
  width: 22px;
  height: 22px;
}

.pl-default-ws-info {
  flex: 1;
  min-width: 0;
}

.pl-default-ws-title-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.pl-default-ws-title {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}

.pl-default-ws-title-row .ws-init-badge {
  margin-left: 0;
}

.pl-default-ws-modules {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.pl-default-ws-module-tag {
  font-size: 11px;
  line-height: 1.3;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(109, 40, 217, 0.12);
  color: #5b21b6;
}

.pl-default-ws-card.ws-init-pending .pl-default-ws-module-tag {
  background: rgba(255, 255, 255, 0.65);
  border-color: rgba(180, 83, 9, 0.15);
  color: #92400e;
}

.pl-default-ws-card.ws-init-failed .pl-default-ws-module-tag {
  background: rgba(255, 255, 255, 0.72);
  border-color: rgba(185, 28, 28, 0.12);
  color: #991b1b;
}

.pl-default-ws-aside {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  margin-left: auto;
}

.pl-default-ws-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.pl-default-ws-path {
  margin: 12px 0 0;
  padding-top: 12px;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-muted);
  word-break: break-all;
}

.pl-default-ws-card.ws-init-pending .pl-default-ws-path,
.pl-default-ws-card.ws-init-ready .pl-default-ws-path {
  border-top-color: rgba(0, 0, 0, 0.06);
}

.pl-default-ws-error {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(185, 28, 28, 0.15);
  color: #b91c1c;
}

@media (max-width: 640px) {
  .pl-default-ws-aside {
    width: 100%;
    margin-left: 0;
  }

  .pl-default-ws-actions {
    justify-content: flex-start;
  }
}

.ws-init-banner {
  margin: 12px 16px 0;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.5;
}

.ws-init-banner.ws-init-pending {
  background: #fffbeb;
  border: 1px solid #fcd34d;
  color: #92400e;
}

.ws-init-banner.ws-init-failed {
  background: #fef2f2;
  border: 1px solid #fca5a5;
  color: #991b1b;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.ws-type-inline {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
}

.filter-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0 8px;
}

.filter-label {
  font-size: 11px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.empty-inline {
  text-align: center;
  padding: 24px 12px;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.6;
}

.form-hint {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 400;
}

.form-required {
  color: #dc2626;
  margin-left: 2px;
}

.form-field > .form-hint {
  display: block;
  margin-top: 6px;
  line-height: 1.4;
}

.git-repo-loading-hint {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-secondary, #64748b);
}

.form-field.is-field-loading .filter-select-trigger {
  cursor: wait;
  opacity: 0.85;
}

.filter-select.is-loading .filter-select-trigger {
  pointer-events: none;
}

.inline-spinner {
  flex-shrink: 0;
  width: 14px;
  height: 14px;
  border: 2px solid #cbd5e1;
  border-top-color: #6366f1;
  border-radius: 50%;
  animation: git-repo-spin 0.75s linear infinite;
}

@keyframes git-repo-spin {
  to { transform: rotate(360deg); }
}

.page-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 40px 20px;
  color: var(--text-muted);
  text-align: center;
}

.page-loading-spinner {
  width: 24px;
  height: 24px;
}

.page-loading-text {
  margin: 0;
  font-size: 14px;
}

.page-loading-inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 16px;
  font-size: 13px;
  color: var(--text-muted);
}

.project-home-loading {
  display: flex;
  flex-direction: column;
  gap: 24px;
  min-height: 320px;
}

.project-card-grid--loading {
  opacity: 0.72;
}

.project-card--skeleton {
  pointer-events: none;
  padding: 20px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  background: #fff;
}

.sidebar-loading {
  padding: 24px 12px;
}

.workspace-pane--loading {
  min-height: 360px;
}

@keyframes skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-line,
.skeleton-card,
.skeleton-pill,
.skeleton-dash-card,
.skeleton-panel {
  background: linear-gradient(90deg, #f1f5f9 25%, #e8edf4 50%, #f1f5f9 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.2s ease-in-out infinite;
  border-radius: 8px;
}

.skeleton-line--title { height: 18px; width: 42%; margin-bottom: 10px; }
.skeleton-line--subtitle { height: 12px; width: 68%; margin-bottom: 8px; }
.skeleton-line--chip { height: 14px; width: 72px; }
.skeleton-line--row { height: 14px; width: 100%; margin-bottom: 10px; }

.skeleton-pill { height: 32px; width: 88px; border-radius: 999px; }
.skeleton-pill--wide { width: 180px; }

.skeleton-card {
  height: 88px;
  margin-bottom: 10px;
  border: 1px solid var(--border-subtle);
}

.kanban-board--loading .kanban-column--skeleton .kanban-column-body {
  padding-top: 4px;
}

.kanban-toolbar--skeleton {
  margin-bottom: 8px;
}

.dashboard-skeleton-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.skeleton-dash-card {
  height: 92px;
}

.skeleton-dash-card--sm {
  height: 56px;
  flex: 1;
}

.skeleton-panel {
  height: 180px;
  margin-bottom: 12px;
}

.skeleton-panel--short {
  height: 120px;
}

.browse-skeleton .skeleton-line--title {
  margin: 16px 0 12px;
}

@media (prefers-reduced-motion: reduce) {
  .skeleton-line,
  .skeleton-card,
  .skeleton-pill,
  .skeleton-dash-card,
  .skeleton-panel,
  .inline-spinner {
    animation: none;
  }
}

/* Dashboard */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(152px, 1fr));
  gap: 12px;
}

.dash-card {
  background: #fff;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: 14px 10px;
  text-align: center;
  transition: box-shadow 0.18s, transform 0.18s;
  min-width: 0;
}

.dash-card:hover {
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.dash-value {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  line-height: 1.2;
}

.dash-value--single {
  display: block;
  font-size: 22px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.dash-value-main {
  font-size: 22px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.dash-value-sub {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
}

.dash-label {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* Zentao task detail */
.zentao-task-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 0;
  min-height: 400px;
}

.zentao-task-meta {
  padding: 20px;
  border-right: 1px solid var(--border-subtle);
  background: var(--sidebar-bg);
}

.meta-list { display: flex; flex-direction: column; gap: 10px; }

.meta-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  font-size: 12px;
}

.meta-row--round {
  align-items: center;
}

.task-round-select {
  flex: 1;
  min-width: 0;
  width: 100%;
  padding: 4px 28px 4px 8px;
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  background: var(--surface-raised, var(--sidebar-bg));
  color: var(--text-primary);
  font-size: 12px;
}

.task-round-select:focus-visible {
  outline: 2px solid var(--accent, #5b5bd6);
  outline-offset: 1px;
}

.meta-label {
  color: var(--text-muted);
  flex-shrink: 0;
}

.zentao-task-body {
  padding: 20px;
  overflow: auto;
}

.icon { display: inline-flex; align-items: center; justify-content: center; }
.icon svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }

/* Login page */
body.login-page {
  height: 100vh;
  overflow: auto;
  background: var(--canvas-bg);
}

.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(320px, 1.05fr) minmax(380px, 0.95fr);
}

.login-hero {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 56px;
  color: #fff;
  background:
    radial-gradient(ellipse 70% 55% at 15% 20%, rgba(255, 255, 255, 0.14), transparent),
    radial-gradient(ellipse 50% 45% at 85% 80%, rgba(124, 124, 240, 0.35), transparent),
    linear-gradient(145deg, #4343b8 0%, #5b5bd6 42%, #6d6de8 100%);
}

.login-hero-inner {
  max-width: 440px;
  width: 100%;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 36px;
}

.login-brand .brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  font-size: 16px;
}

.login-brand-name {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}

.login-hero-title {
  font-size: 32px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.03em;
  margin-bottom: 14px;
}

.login-hero-desc {
  font-size: 15px;
  line-height: 1.7;
  color: rgba(255, 255, 255, 0.86);
  margin-bottom: 28px;
}

.login-hero-features {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.login-hero-features li {
  position: relative;
  padding-left: 18px;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.92);
}

.login-hero-features li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.75);
}

.login-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  background: var(--editor-bg);
}

.login-card {
  width: 100%;
  max-width: 400px;
  padding: 8px 4px;
}

.login-card-head {
  margin-bottom: 28px;
}

.login-card-head h2 {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 6px;
}

.login-card-head p {
  font-size: 14px;
  color: var(--text-muted);
}

.login-form-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.login-remember {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
}

.login-remember input {
  width: 15px;
  height: 15px;
  accent-color: var(--accent);
}

.login-link {
  border: none;
  background: transparent;
  color: var(--accent);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  padding: 0;
}

.login-link:hover { text-decoration: underline; }

.login-error {
  margin-bottom: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--danger-bg);
  color: var(--danger);
  font-size: 13px;
}

.login-submit {
  width: 100%;
  padding: 11px 16px;
  font-size: 14px;
}

.login-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 24px 0 18px;
  color: var(--text-muted);
  font-size: 12px;
}

.login-divider::before,
.login-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.login-sso {
  width: 100%;
  justify-content: center;
  padding: 11px 16px;
  background: #fff;
}

.login-sso-icon {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  background: #3370ff;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}

.login-hint {
  margin-top: 18px;
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.5;
}

.login-footer {
  margin-top: 32px;
  font-size: 12px;
  color: var(--text-muted);
}

@media (max-width: 900px) {
  .login-shell {
    grid-template-columns: 1fr;
  }

  .login-hero {
    padding: 32px 24px 28px;
    align-items: flex-start;
  }

  .login-hero-inner {
    max-width: none;
  }

  .login-hero-title {
    font-size: 24px;
  }

  .login-hero-features {
    display: none;
  }
}

/* Task kanban */
.tab-view--kanban {
  max-width: none;
  width: 100%;
  padding: 24px 28px 32px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
  box-sizing: border-box;
}

.tab-view--kanban .kanban-board {
  flex: 1;
  min-height: 0;
}

.kanban-board {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-height: 0;
  --kanban-virtual-row-stride: 132px;
}

.kanban-toolbar {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.kanban-toolbar-main {
  min-width: 0;
}

.kanban-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}

.kanban-subtitle {
  font-size: 13px;
  color: var(--text-muted);
}

.kanban-toolbar-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.kanban-toolbar-filters {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.kanban-filter-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.kanban-toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-left: auto;
}

.kanban-toolbar-actions .btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.kanban-toolbar-actions .btn-icon svg {
  width: 16px;
  height: 16px;
}

.kanban-auto-sync {
  display: inline-flex;
  align-items: center;
  padding: 0 2px;
  user-select: none;
  cursor: pointer;
}

.kanban-auto-sync.is-disabled {
  opacity: 0.45;
  pointer-events: none;
}

.kanban-auto-sync-label {
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
}

.toggle.is-disabled {
  opacity: 0.45;
  pointer-events: none;
}

.kanban-search {
  width: 240px;
  max-width: 100%;
  margin: 0;
  flex: 0 0 auto;
}

.kanban-time-filter {
  width: 132px;
  max-width: 100%;
  flex: 0 0 auto;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
  font-size: 13px;
  line-height: 1.2;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.kanban-time-filter:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.kanban-date-range {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.kanban-date-input {
  width: 148px;
  max-width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
  font-size: 13px;
  outline: none;
}

.kanban-date-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.kanban-date-sep {
  font-size: 13px;
  color: var(--text-muted);
}

.kanban-filter-empty {
  margin-top: 8px;
  padding: 28px 16px;
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: #fff;
}

.kanban-columns {
  display: grid;
  grid-template-columns: repeat(3, minmax(260px, 1fr));
  gap: 14px;
  align-items: stretch;
  max-height: calc(100vh - 220px);
  flex: 1;
  min-height: 0;
  min-width: 0;
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-gutter: stable;
}

.kanban-column {
  display: flex;
  flex-direction: column;
  min-height: 0;
  max-height: 100%;
  background: var(--sidebar-bg);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  overflow: hidden;
}

.kanban-column-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-subtle);
  background: #fff;
}

.kanban-column-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

.kanban-column-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  background: var(--border-subtle);
  color: var(--text-secondary);
}

.kanban-column--pending .kanban-column-title { color: #d97706; }
.kanban-column--running .kanban-column-title { color: var(--accent); }
.kanban-column--completed .kanban-column-title { color: var(--success); }

.kanban-column--pending .kanban-column-count { background: #fffbeb; color: #d97706; }
.kanban-column--running .kanban-column-count { background: var(--accent-soft); color: var(--accent); }
.kanban-column--completed .kanban-column-count { background: var(--success-bg); color: var(--success); }

.kanban-column-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  flex: 1;
  min-height: 0;
  overflow: auto;
}

.kanban-column-body--virtual {
  position: relative;
  display: block;
}

.kanban-virtual-spacer {
  width: 100%;
  pointer-events: none;
}

.kanban-virtual-window {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  will-change: transform;
}

.kanban-card {
  width: 100%;
  text-align: left;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: #fff;
  box-shadow: var(--shadow-card);
  padding: 12px;
  cursor: pointer;
  font: inherit;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s;
}

.kanban-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(24, 24, 27, 0.08);
}

.kanban-card.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow), var(--shadow-card);
}

.kanban-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.kanban-card-badges {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 6px;
  flex-shrink: 0;
}

.kanban-card-type {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  line-height: 1.4;
}

.kanban-card-status {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  line-height: 1.3;
}

.kanban-card-status--queued { background: #fffbeb; color: #d97706; }
.kanban-card-status--running { background: var(--accent-soft); color: var(--accent); }
.kanban-card-status--completed { background: var(--success-bg); color: var(--success); }

/* 任务处理结果徽章（result 字段） */
.kanban-card-result {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  line-height: 1.3;
}

.kanban-card-result--success { background: var(--success-bg); color: var(--success); }
.kanban-card-result--failed { background: var(--danger-bg); color: var(--danger); }
.kanban-card-result--confirmed { background: var(--info-bg); color: var(--info); }

.kanban-card-priority {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  line-height: 1.3;
}

.kanban-card-priority--high {
  color: var(--danger);
  background: var(--danger-bg);
}

.kanban-card-priority--medium {
  color: var(--text-muted);
  background: #f4f4f5;
}

.kanban-card-priority--low {
  color: #a1a1aa;
  background: #fafafa;
  border: 1px solid var(--border-subtle);
}

.kanban-card-title {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.45;
  color: var(--text);
  margin-bottom: 6px;
}

.kanban-card-prompt {
  font-size: 11px;
  line-height: 1.45;
  color: var(--text-muted);
  margin: 0 0 10px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.kanban-card-prompt--empty {
  font-style: italic;
  opacity: 0.75;
}

.kanban-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.kanban-card-meta {
  font-size: 11px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kanban-card-time {
  font-size: 11px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.kanban-empty {
  padding: 24px 12px;
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.55);
}

.task-kanban-layout {
  display: grid;
  grid-template-columns: minmax(420px, 1.1fr) minmax(360px, 0.9fr);
  gap: 0;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.task-kanban-board-pane {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 24px 20px 32px;
  border-right: 1px solid var(--border);
  background: var(--editor-bg);
  min-height: 0;
  min-width: 0;
}

.task-kanban-board-pane .kanban-board {
  flex: 1;
  min-height: 0;
  min-width: 0;
}

.task-kanban-board-pane .kanban-columns {
  max-height: none;
  flex: 1;
  min-height: 0;
}

.task-kanban-detail-pane {
  position: relative;
  overflow: auto;
  background: #fff;
  min-width: 0;
}

.task-detail-head {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 12px 40px 12px 16px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--sidebar-bg);
  position: sticky;
  top: 0;
  z-index: 1;
}

.meta-row--round .meta-label {
  min-width: 56px;
}

.meta-row--round .task-round-select {
  max-width: none;
}

.task-detail-head > .btn {
  flex-shrink: 0;
}

.task-detail-close {
  position: absolute;
  top: 0;
  right: 0;
  z-index: 2;
  margin: 0;
  border-radius: 0;
  border-top: none;
  border-right: none;
}

.task-detail-head-metrics {
  flex: 1;
  min-width: 0;
}

.task-detail-head-metrics .detail-metrics--head {
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
}

.task-detail-head-metrics .detail-metrics--head .detail-metrics-title {
  margin: 0 0 6px;
}

.task-detail-head-metrics .detail-metrics--head .detail-metrics-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.task-detail-head-metrics .detail-metrics--head .detail-metric {
  padding: 8px 10px 7px;
}

.task-detail-panel {
  min-height: 100%;
}

.task-detail-panel.zentao-task-layout {
  grid-template-columns: 280px 1fr;
}

@media (max-width: 1100px) {
  .kanban-columns {
    grid-template-columns: 1fr;
  }

  .task-kanban-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }

  .task-kanban-board-pane {
    border-right: none;
    border-bottom: 1px solid var(--border);
    max-height: 48vh;
  }

  .task-detail-panel.zentao-task-layout {
    grid-template-columns: 1fr;
  }
}



.json-editor {
  font-family: var(--mono, ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace);
  font-size: 12.5px;
  line-height: 1.55;
  resize: vertical;
  min-height: 140px;
  white-space: pre;
  tab-size: 2;
}

.json-editor.is-valid {
  border-color: var(--success);
}

.json-editor.is-invalid {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px var(--danger-bg, rgba(239, 68, 68, 0.15));
}

.json-status {
  margin-top: 6px;
  font-size: 12px;
  line-height: 1.4;
}

/* Schedule testtask selector */
.schedule-testtask-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 220px;
  overflow-y: auto;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: 4px;
  background: #fff;
}

.form-field label.schedule-testtask-item {
  display: grid !important;
  grid-template-columns: 16px minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 10px;
  width: 100%;
  margin: 0;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.4;
}

.schedule-testtask-item:hover {
  background: var(--sidebar-bg);
}

.form-field .schedule-testtask-checkbox,
.form-field label.schedule-testtask-item input[type="checkbox"] {
  width: 16px !important;
  height: 16px !important;
  min-width: 16px !important;
  max-width: 16px !important;
  margin: 0;
  padding: 0 !important;
  border: 0 !important;
  box-shadow: none !important;
  flex: 0 0 16px;
  accent-color: var(--accent, #2563eb);
}

.schedule-testtask-copy {
  display: contents;
}

.schedule-testtask-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.schedule-testtask-meta {
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 400;
  color: var(--text-muted);
  white-space: nowrap;
}

.form-field label.schedule-run-now {
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 10px;
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  background: #fff;
  cursor: pointer;
  color: var(--text);
}

.form-field label.schedule-run-now input[type="checkbox"] {
  width: 16px !important;
  height: 16px !important;
  min-width: 16px !important;
  max-width: 16px !important;
  margin: 2px 0 0;
  padding: 0 !important;
  border: 0 !important;
  box-shadow: none !important;
  flex: 0 0 16px;
  accent-color: var(--accent, #2563eb);
}

.schedule-run-now strong {
  display: block;
  font-size: 13px;
  font-weight: 650;
}

.schedule-run-now .form-hint {
  display: block;
  margin-top: 2px;
}

.json-status[data-state="ok"] {
  color: var(--success);
}

.json-status[data-state="error"] {
  color: var(--danger);
}


/* Task calendar (scan / test workspaces) */
.tab-view--calendar {
  max-width: none;
  padding: 20px 24px 28px;
}

.cal-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 16px;
  align-items: start;
  min-height: 520px;
}

.cal-board {
  background: #fff;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: 16px 18px 18px;
}

.cal-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.cal-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cal-month-label {
  min-width: 110px;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 6px;
}

.cal-weekday {
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  padding: 4px 0;
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}

.cal-cell {
  position: relative;
  min-height: 78px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: var(--sidebar-bg);
  padding: 8px;
  text-align: left;
  cursor: pointer;
  font: inherit;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.cal-cell--muted {
  background: transparent;
  border-color: transparent;
  cursor: default;
  min-height: 78px;
}

.cal-cell:hover:not(.cal-cell--muted) {
  border-color: #d4d4d8;
  background: #fff;
}

.cal-cell.is-today {
  border-color: var(--accent);
}

.cal-cell.is-selected {
  background: #fff;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.cal-cell.has-runs .cal-day-num {
  font-weight: 700;
}

.cal-day-num {
  font-size: 13px;
  color: var(--text-secondary);
}

.cal-day-count {
  position: absolute;
  top: 6px;
  right: 6px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.cal-dots {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 18px;
}

.cal-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
  background: #a1a1aa;
}

.cal-dot--completed { background: var(--success); }
.cal-dot--running { background: var(--accent); }
.cal-dot--failed { background: var(--danger); }
.cal-dot--queued { background: #d97706; }
.cal-dot--stopped { background: var(--text-muted); }

.cal-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 14px;
  font-size: 12px;
  color: var(--text-muted);
}

.cal-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.cal-side {
  background: #fff;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  overflow: hidden;
  min-height: 420px;
}

.cal-side-head {
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--border-subtle);
}

.cal-side-head h3 {
  margin: 0 0 4px;
  font-size: 15px;
  font-weight: 600;
}

.cal-side-head p {
  margin: 0;
  font-size: 12px;
  color: var(--text-muted);
}

.cal-run-list {
  list-style: none;
  margin: 0;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cal-run-item {
  display: flex;
  flex-direction: column;
  padding: 0;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: var(--sidebar-bg);
  overflow: hidden;
}

.cal-run-hit {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 10px;
  width: 100%;
  padding: 10px;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
  color: inherit;
  font: inherit;
}

.cal-run-hit:hover {
  background: var(--hover-bg, rgba(0, 0, 0, 0.04));
}

.cal-run-hit--readonly {
  cursor: default;
}

.cal-run-hit--readonly:hover {
  background: transparent;
}

.cal-run-meta-muted {
  color: var(--text-muted);
  font-size: 12px;
}

.cal-run-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 0 10px 10px;
}

.cal-run-time {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  padding-top: 2px;
}

.cal-run-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
  margin-bottom: 6px;
}

.cal-run-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--text-muted);
}

.cal-run-empty {
  padding: 28px 12px;
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
}

@media (max-width: 980px) {
  .cal-layout {
    grid-template-columns: 1fr;
  }
}

/* —— 扫描 / 测试：执行日志（只读，无 Agent 对话） —— */
.runlog-layout {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  background: var(--editor-bg, var(--bg));
}

.runlog-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "eyebrow actions"
    "title actions"
    "meta meta"
    "params params";
  column-gap: 16px;
  row-gap: 6px;
  align-items: center;
  padding: 16px 24px 14px;
  border-bottom: 1px solid var(--border-subtle);
}

.runlog-eyebrow {
  grid-area: eyebrow;
  margin: 0;
  font-size: 12px;
  color: var(--text-muted);
}

.runlog-title-row {
  grid-area: title;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.runlog-title {
  margin: 0;
  min-width: 0;
  overflow: hidden;
  font-size: 20px;
  font-weight: 650;
  color: var(--text);
  white-space: nowrap;
  text-overflow: ellipsis;
}

.runlog-run-switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  margin-left: 4px;
  padding-left: 12px;
  border-left: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: 12px;
}

.runlog-run-switch select {
  box-sizing: border-box;
  width: max-content;
  max-width: 100%;
  field-sizing: content;
  height: 32px;
  padding: 0 28px 0 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font-size: 13px;
}

.runlog-meta {
  grid-area: meta;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 0;
  row-gap: 6px;
  min-width: 0;
  font-size: 12px;
  color: var(--text-secondary);
}

.runlog-meta > .badge {
  flex: 0 0 auto;
  margin-right: 10px;
  white-space: nowrap;
}

.runlog-meta > span:not(.badge) {
  flex: 0 0 auto;
  line-height: 20px;
  white-space: nowrap;
}

.runlog-meta > span:not(.badge) + span:not(.badge)::before {
  content: "";
  display: inline-block;
  width: 3px;
  height: 3px;
  margin: 0 8px;
  border-radius: 50%;
  background: var(--border);
  vertical-align: middle;
}

.runlog-meta--scan {
  row-gap: 6px;
}

.runlog-params {
  grid-area: params;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
  margin-top: 2px;
}

.runlog-params-label {
  flex: 0 0 auto;
  padding-top: 5px;
  font-size: 12px;
  line-height: 20px;
  color: var(--text-muted);
  white-space: nowrap;
}

.runlog-params-json {
  flex: 1;
  min-width: 0;
  max-height: 96px;
  margin: 0;
  padding: 4px 10px;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font-size: 12px;
  line-height: 1.45;
  overflow: auto;
  white-space: pre-wrap;
}

.runlog-actions {
  grid-area: actions;
  display: flex;
  gap: 8px;
  flex-shrink: 0;
  align-self: center;
}

.detail-metrics {
  padding: 12px 24px 14px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--sidebar-bg);
}

.detail-metrics--task {
  margin: 0 0 14px;
  padding: 12px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  border-bottom: 1px solid var(--border-subtle);
}

.detail-metrics--aggregate {
  background: var(--sidebar-bg);
}

.detail-metrics--round .detail-metrics-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.detail-metrics--aggregate .detail-metrics-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.detail-metrics-title {
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 650;
  color: var(--text-secondary);
}

.detail-metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 8px;
}

.detail-metrics--run .detail-metrics-grid {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  background: var(--border-subtle);
}

.detail-metric {
  padding: 10px 10px 9px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: var(--editor-bg);
}

.detail-metrics--run .detail-metric {
  padding: 14px 16px 12px;
  border: 0;
  border-radius: 0;
  background: #fff;
}

.detail-metric-value {
  display: block;
  font-size: 15px;
  font-weight: 650;
  color: var(--text);
  line-height: 1.2;
  margin-bottom: 4px;
  font-variant-numeric: tabular-nums;
}

.detail-metrics--run .detail-metric-value {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.03em;
}

.detail-metric-suffix {
  margin-left: 6px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--text-muted);
}

.detail-metric-label {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.3;
}

.detail-metric.is-ok .detail-metric-value { color: var(--success); }
.detail-metric.is-warn .detail-metric-value { color: var(--warning); }
.detail-metric.is-danger .detail-metric-value { color: var(--danger); }
.detail-metric.is-muted .detail-metric-value { color: var(--text-secondary); }
.detail-metrics--run .detail-metric.is-ok,
.detail-metrics--run .detail-metric.is-warn,
.detail-metrics--run .detail-metric.is-danger,
.detail-metrics--run .detail-metric.is-muted {
  background: #fff;
}

.runlog-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 8px 24px;
  font-size: 12px;
  color: var(--text-muted);
  background: var(--sidebar-bg);
  border-bottom: 1px solid var(--border-subtle);
}

.runlog-toolbar-hint {
  min-width: 0;
}

.runlog-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  margin-left: auto;
}

.test-result-toolbar,
.run-history-head {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex-wrap: wrap;
}

.test-result-current {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-secondary);
  white-space: nowrap;
}

.test-result-toolbar {
  flex: 1;
}

.test-case-name-filter {
  box-sizing: border-box;
  height: 32px;
  margin: 0 0 0 auto;
  padding: 0 10px;
  width: min(280px, 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
  font-size: 13px;
  line-height: 1.2;
  outline: none;
}

.test-case-name-filter:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.test-history-time {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-secondary);
  font-size: 12px;
  white-space: nowrap;
}

.test-history-time select,
.test-history-time-date {
  box-sizing: border-box;
  height: 32px;
  margin: 0;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--text);
  font-size: 12px;
}

.test-history-time-sep {
  color: var(--text-muted);
}

.test-result-filter {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.test-result-filter-btn {
  border: 1px solid var(--border-subtle);
  background: transparent;
  color: var(--text-secondary);
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 12px;
  line-height: 20px;
  cursor: pointer;
}

.test-result-filter-btn.is-active {
  border-color: var(--accent, #2563eb);
  color: var(--text-primary);
  background: var(--surface, #fff);
}

.test-result-col {
  width: 168px;
  white-space: nowrap;
}

.test-result-col-name {
  vertical-align: middle;
}

.test-duration-col {
  width: 72px;
  white-space: nowrap;
}

.test-result-column-filter {
  display: inline-block;
  width: 84px;
  margin: 0 0 0 8px;
  height: 26px;
  padding: 0 6px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  font-size: 12px;
  vertical-align: middle;
}

.run-history {
  padding: 16px 24px 24px;
}

.run-history--empty {
  padding: 32px 24px;
}

.run-history-lead {
  margin: 0 0 12px;
  font-size: 13px;
  color: var(--text-secondary);
}

@media (max-width: 860px) {
  .run-report-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.run-history-table th,
.run-history-table td {
  white-space: nowrap;
}

.runlog-tabs {
  display: flex;
  gap: 0;
  padding: 0 16px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--editor-bg);
}

.runlog-tab {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 10px 14px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.runlog-tab:hover { color: var(--text); }
.runlog-tab.is-active {
  color: var(--text);
  border-bottom-color: var(--accent);
}

.runlog-tab-hint {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--border-subtle);
  padding: 1px 6px;
  border-radius: 999px;
}

.runlog-pane {
  flex: 1;
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
}

.runlog-body {
  flex: 1;
  margin: 0;
  padding: 16px 24px 28px;
  overflow: auto;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.65;
  background: #0f1419;
  color: #c8d0d8;
}

.runlog-line {
  display: block;
  white-space: pre-wrap;
  word-break: break-word;
}

.runlog-time {
  color: #6b7a88;
  margin-right: 8px;
}

.runlog-info .runlog-text { color: #c8d0d8; }
.runlog-warn .runlog-text { color: #e6b84d; }
.runlog-error .runlog-text { color: #f07178; }

.detail-metrics.detail-metrics--run {
  background: transparent;
  border-bottom: 1px solid var(--border-subtle);
  padding: 16px 24px 18px;
}

@media (max-width: 960px) {
  .detail-metrics--run .detail-metrics-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.detail-metrics--scan .detail-metrics-grid {
  grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
}

.scan-attempt-breakdown {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  padding: 0 24px 12px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--sidebar-bg);
  font-size: 12px;
  color: var(--text-secondary);
}

.scan-attempt-item {
  padding: 4px 8px;
  border-radius: 6px;
  background: var(--editor-bg);
  border: 1px solid var(--border-subtle);
}

.scan-attempt-findings {
  margin-top: 14px;
}

.scan-attempt-findings-title {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

.scan-unit-progress-wrap {
  padding: 0 24px 14px;
  background: var(--sidebar-bg);
  border-bottom: 1px solid var(--border-subtle);
}

.scan-unit-progress {
  margin: 0;
  padding: 12px 14px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: var(--editor-bg);
}

.scan-unit-progress-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.scan-unit-progress-track {
  height: 6px;
  border-radius: 999px;
  background: #eef0f3;
  overflow: hidden;
}

.scan-unit-progress-bar {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), #5b9cf5);
  transition: width 0.35s ease;
}

.scan-unit-progress.is-final .scan-unit-progress-bar {
  background: linear-gradient(90deg, var(--text-secondary), #8a96a3);
}

.scan-unit-progress.is-final.is-failed .scan-unit-progress-bar {
  background: linear-gradient(90deg, #c45c5c, #f07178);
}

.scan-unit-progress-hint {
  margin: 8px 0 0;
  font-size: 11px;
  line-height: 1.45;
  color: var(--text-muted);
}

.form-field-row--bugfinder {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.bugfinder-param-block {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.bugfinder-param-lead {
  margin: 0;
  font-size: 12px;
  line-height: 1.55;
  color: var(--text-muted);
}

.form-hint--param {
  line-height: 1.5;
}

.form-hint--param code {
  display: inline-block;
  margin-top: 4px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-muted);
  background: #f4f4f5;
  padding: 1px 6px;
  border-radius: 4px;
}

@media (min-width: 720px) {
  .settings-form .form-field-row--bugfinder {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
  }
}

.run-report {
  padding: 20px 24px 32px;
  background: var(--editor-bg);
}

.run-report--empty {
  display: grid;
  place-content: center;
  min-height: 280px;
  text-align: center;
  gap: 8px;
}

.run-report-empty-title {
  margin: 0;
  font-size: 16px;
  font-weight: 650;
  color: var(--text);
}

.run-report-empty-desc {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
}

.run-report-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.run-report-stat {
  padding: 14px 14px 12px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  background: #fff;
}

.run-report-stat-label {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.run-report-stat-value {
  display: block;
  font-size: 22px;
  font-weight: 650;
  color: var(--text);
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}

.run-report-stat.is-ok .run-report-stat-value { color: var(--success); }
.run-report-stat.is-warn .run-report-stat-value { color: var(--warning); }
.run-report-stat.is-danger .run-report-stat-value { color: var(--danger); }
.run-report-stat.is-muted .run-report-stat-value { color: var(--text-secondary); }

.run-report-conclusion {
  margin: 0 0 18px;
  padding: 12px 14px;
  border: 1px solid color-mix(in srgb, var(--accent) 18%, transparent);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  background: var(--accent-soft, color-mix(in srgb, var(--accent) 8%, #fff));
  font-size: 13px;
  color: var(--text);
  line-height: 1.55;
}

.run-report-conclusion.is-failed {
  border-color: color-mix(in srgb, var(--danger) 18%, transparent);
  border-left-color: var(--danger);
  background: var(--danger-bg);
}

.run-report-section-title {
  margin: 0 0 10px;
  font-size: 14px;
  font-weight: 650;
}

.run-report-merge-hint {
  margin: 0 0 10px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-muted);
}

.run-report-table-wrap,
.run-history-table-wrap {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  overflow: auto;
  background: #fff;
}

.run-report-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.run-report-table th,
.run-report-table td {
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
}

.run-report-table th {
  height: 42px;
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 650;
  background: var(--sidebar-bg);
  white-space: nowrap;
}

.run-report-table tbody tr:last-child td {
  border-bottom: 0;
}

.run-report-table tbody tr:hover td {
  background: color-mix(in srgb, var(--accent) 5%, #fff);
}

.run-report-table .badge {
  white-space: nowrap;
}

.run-report-table td:nth-child(2) {
  min-width: 180px;
  line-height: 1.45;
}

.run-report-table td:nth-child(4) {
  vertical-align: top;
  min-width: 280px;
  line-height: 1.5;
  word-break: break-word;
}

.test-detail summary {
  cursor: pointer;
}

.test-detail-full {
  margin: 8px 0 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: inherit;
  font-size: 12px;
  line-height: 1.55;
}

.run-report-table .mono {
  font-family: var(--mono);
  font-size: 12px;
}

.findings-filter-bar {
  margin: 0 0 12px;
}

.findings-filter-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.findings-filter-row .filter-label {
  margin: 0;
  line-height: 32px;
}

.findings-filter-control {
  box-sizing: border-box;
  height: 32px;
  margin: 0;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
  font-size: 13px;
  line-height: 1.2;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.findings-filter-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.findings-severity-filter {
  min-width: 108px;
  padding-right: 28px;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
}

.findings-search {
  flex: 1 1 220px;
  min-width: 180px;
  max-width: 360px;
}

.findings-filter-reset {
  height: 32px;
  padding: 0 10px;
  box-sizing: border-box;
}

.findings-filter-meta {
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--text-muted);
}


.form-field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-field-row[hidden] {
  display: none !important;
}

.form-field input.is-invalid,
.form-field textarea.is-invalid {
  border-color: var(--danger);
}

@media (max-width: 560px) {
  .form-field-row {
    grid-template-columns: 1fr;
  }
}


.cal-repeat-tag {
  display: inline-flex;
  align-items: center;
  margin-left: 8px;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  color: var(--accent);
  background: var(--accent-soft);
  vertical-align: middle;
}

/* Filterable select (combobox) */
.filter-select {
  position: relative;
  width: 100%;
}

.filter-select-native {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.filter-select-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.filter-select-trigger:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
  outline: none;
}

.filter-select.is-disabled .filter-select-trigger {
  cursor: not-allowed;
  opacity: 0.65;
  background: var(--sidebar-bg);
}

.filter-select-value {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.filter-select-value.is-placeholder {
  color: var(--text-muted);
}

.filter-select-chevron {
  color: var(--text-muted);
  font-size: 12px;
  flex-shrink: 0;
}

.filter-select-panel {
  position: absolute;
  z-index: 1200;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.filter-select-search {
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-bottom: 1px solid var(--border-subtle);
  outline: none;
  background: #fff;
}

.filter-select-search:focus {
  box-shadow: inset 0 -2px 0 var(--accent);
}

.filter-select-list {
  list-style: none;
  margin: 0;
  padding: 4px 0;
  max-height: 240px;
  overflow: auto;
}

.filter-select-option {
  padding: 8px 12px;
  cursor: pointer;
  font-size: 13px;
  line-height: 1.4;
}

.filter-select-option.is-active,
.filter-select-option:hover {
  background: var(--accent-soft);
}

.filter-select-option.is-selected {
  color: var(--accent);
  font-weight: 600;
}

.filter-select-option.is-disabled {
  color: var(--text-muted);
  cursor: not-allowed;
}

.filter-select-empty {
  padding: 10px 12px;
  color: var(--text-muted);
  font-size: 13px;
}

.app-toast-host {
  position: fixed;
  inset: 0;
  z-index: 5000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  pointer-events: none;
}

.app-toast {
  pointer-events: auto;
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  line-height: 1.45;
  box-shadow: var(--shadow-card);
  opacity: 0;
  transform: scale(0.96);
  transition: opacity 0.2s ease, transform 0.2s ease;
  max-width: min(360px, calc(100vw - 32px));
  text-align: center;
}

.app-toast.is-visible {
  opacity: 1;
  transform: scale(1);
}

.app-toast--success {
  background: var(--success-bg);
  border: 1px solid color-mix(in srgb, var(--success) 35%, transparent);
  color: #166534;
}

.app-toast--error {
  background: var(--danger-bg);
  border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent);
  color: #991b1b;
}

.btn.is-loading {
  opacity: 0.72;
  pointer-events: none;
  cursor: wait;
}

/* ── Recording Result Panel (prototype-matched) ─────────────────────────── */

.recording-result-panel {
  background: #ffffff;
  border: 1px solid #e8ecf1;
  border-radius: 8px;
  padding: 24px 28px;
  margin: 20px 0 28px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.rp-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.rp-title-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.rp-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  background: #3b82f6;
  color: #ffffff;
  border-radius: 50%;
  font-size: 0.8125rem;
  font-weight: 600;
  flex-shrink: 0;
}

.rp-title {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 700;
  color: #1a1a2e;
  letter-spacing: -0.01em;
}

.rp-status-badge {
  display: inline-block;
  padding: 3px 14px;
  background: #fff7ed;
  color: #c2410c;
  border: 1px solid #fed7aa;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
}

.rp-description {
  margin: 0 0 20px;
  font-size: 0.8125rem;
  color: #8b95a5;
  line-height: 1.5;
}

.rp-steps-card {
  background: #f8f9fb;
  border: 1px solid #eef0f4;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 20px;
}

.rp-steps-header {
  font-size: 0.8125rem;
  font-weight: 500;
  color: #64748b;
  margin-bottom: 14px;
}

.rp-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}

.rp-table thead {
  background: #f1f3f7;
}

.rp-table th {
  padding: 10px 14px;
  text-align: left;
  font-weight: 600;
  color: #475569;
  font-size: 0.8125rem;
  border-bottom: 1px solid #e2e8f0;
}

.rp-table td {
  padding: 12px 14px;
  border-bottom: 1px solid #f1f3f7;
  vertical-align: top;
  color: #334155;
  line-height: 1.6;
}

.rp-table tbody tr:last-child td {
  border-bottom: none;
}

.rp-table tbody tr:hover {
  background: #f8f9fb;
}

.rp-step-num {
  font-weight: 700;
  color: #475569;
  text-align: center;
}

.rp-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding-top: 4px;
}

.rp-btn {
  display: inline-flex;
  align-items: center;
  padding: 8px 22px;
  font-size: 0.8125rem;
  font-weight: 500;
  border-radius: 6px;
  border: 1px solid #d1d5db;
  background: #ffffff;
  color: #374151;
  cursor: pointer;
  transition: all 0.15s ease;
  line-height: 1.4;
}

.rp-btn:hover {
  background: #f9fafb;
  border-color: #9ca3af;
}

.rp-btn-outline {
  border-color: #d1d5db;
}

.rp-btn-primary {
  background: #3b82f6;
  color: #ffffff;
  border-color: #3b82f6;
}

.rp-btn-primary:hover {
  background: #2563eb;
  border-color: #2563eb;
}

.rp-btn-upload {
  background: linear-gradient(135deg, #6366f1 0%, #818cf8 100%);
  color: #ffffff;
  border-color: #6366f1;
}

.rp-btn-upload:hover {
  background: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);
  border-color: #4f46e5;
}

/* ── Status badge variants ── */

.rp-status--recorded {
  background: #eff6ff;
  color: #1d4ed8;
  border-color: #bfdbfe;
}

.rp-status--pending {
  background: #fff7ed;
  color: #c2410c;
  border-color: #fed7aa;
}

.rp-status--reviewed {
  background: #f0fdf4;
  color: #15803d;
  border-color: #bbf7d0;
}

.rp-status--rejected {
  background: #fef2f2;
  color: #b91c1c;
  border-color: #fecaca;
}

.rp-status--uploaded {
  background: #f5f3ff;
  color: #6d28d9;
  border-color: #ddd6fe;
}

/* ── Step editing ── */

.rp-step-edit {
  width: 100%;
  padding: 6px 8px;
  font-size: 0.8125rem;
  font-family: inherit;
  line-height: 1.5;
  color: #334155;
  background: #ffffff;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  resize: vertical;
  box-sizing: border-box;
}

.rp-step-edit:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}

.rp-step-ops {
  white-space: nowrap;
  text-align: center;
}

.rp-step-op {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  margin: 0 2px;
  padding: 0;
  font-size: 0.75rem;
  color: #64748b;
  background: #ffffff;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.rp-step-op:hover:not(:disabled) {
  background: #f1f5f9;
  border-color: #94a3b8;
  color: #334155;
}

.rp-step-op:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.rp-step-op--danger:hover:not(:disabled) {
  background: #fef2f2;
  border-color: #fca5a5;
  color: #dc2626;
}

.rp-add-step {
  margin-top: 12px;
}

/* ── Meta form ── */

.rp-meta {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}

.rp-meta-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.rp-meta-label {
  flex-shrink: 0;
  width: 72px;
  padding-top: 7px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: #475569;
}

.rp-meta-input {
  flex: 1;
  padding: 6px 10px;
  font-size: 0.8125rem;
  font-family: inherit;
  line-height: 1.5;
  color: #334155;
  background: #ffffff;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  box-sizing: border-box;
}

.rp-meta-input:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}

.rp-meta-input:disabled {
  background: #f8f9fb;
  color: #64748b;
  cursor: not-allowed;
}

.rp-meta-select {
  width: auto;
  min-width: 80px;
}

textarea.rp-meta-input {
  resize: vertical;
}

/* ── Review area ── */

.rp-review {
  margin-bottom: 20px;
  padding: 16px 20px;
  background: #f8f9fb;
  border: 1px solid #eef0f4;
  border-radius: 8px;
}

.rp-review-title {
  font-size: 0.8125rem;
  font-weight: 500;
  color: #64748b;
  margin-bottom: 12px;
}

.rp-review-actions {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
}

.rp-review-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: #374151;
  margin-bottom: 6px;
}

/* ── Notices ── */

.rp-notice {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  margin-bottom: 20px;
  font-size: 0.8125rem;
  border-radius: 6px;
  line-height: 1.5;
}

.rp-notice--error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
}

.rp-notice--success {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #15803d;
}

.rp-notice--info {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1d4ed8;
}

/* ── Spinner ── */

.rp-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(29, 78, 216, 0.25);
  border-top-color: #1d4ed8;
  border-radius: 50%;
  animation: rp-spin 0.8s linear infinite;
  flex-shrink: 0;
}

@keyframes rp-spin {
  to { transform: rotate(360deg); }
}

/* ── Generating progress card ── */

.rp-generating {
  align-items: flex-start;
  padding: 16px;
}

.rp-generating .rp-spinner {
  width: 18px;
  height: 18px;
  margin-top: 2px;
}

.rp-generating-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.rp-generating-msg {
  font-weight: 600;
  font-size: 0.875rem;
}

.rp-generating-sub {
  color: #3b82f6;
  font-size: 0.75rem;
}

/* ── Generated Playwright script viewer ── */

.rp-script {
  margin: 0;
  padding: 12px;
  max-height: 420px;
  overflow: auto;
  background: #0f172a;
  color: #e2e8f0;
  font-family: "Cascadia Code", Consolas, Monaco, monospace;
  font-size: 0.75rem;
  line-height: 1.6;
  border-radius: 0 0 6px 6px;
  white-space: pre;
}

/* ── Close button ── */

.rp-btn-close {
  color: #94a3b8;
  border-color: transparent;
  background: transparent;
}

.rp-btn-close:hover {
  color: #64748b;
  background: #f1f5f9;
  border-color: transparent;
}

/* ── Schedule Reference Cards ── */

.schedule-refs-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 12px;
}

.schedule-ref-card {
  position: relative;
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.02);
  transition: box-shadow 0.2s ease, transform 0.15s ease;
  overflow: hidden;
}

.schedule-ref-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.06), 0 2px 4px rgba(0,0,0,0.04);
  transform: translateY(-1px);
}

.schedule-ref-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--ref-accent, var(--accent));
  border-radius: 12px 0 0 12px;
}

.schedule-ref-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px 0 16px;
}

.schedule-ref-card__badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.schedule-ref-card__remove {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: #94a3b8;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s ease;
  line-height: 1;
}

.schedule-ref-card__remove:hover {
  background: #fee2e2;
  color: #dc2626;
}

.schedule-ref-card__body {
  padding: 10px 14px 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.schedule-ref-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.schedule-ref-field label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.schedule-ref-field label .optional {
  font-size: 11px;
  font-weight: 400;
  color: var(--text-muted);
}

.schedule-ref-field input {
  padding: 8px 10px;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  font-size: 13px;
  background: #fafbfc;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  width: 100%;
  box-sizing: border-box;
}

.schedule-ref-field input:focus {
  outline: none;
  border-color: var(--ref-accent, var(--accent));
  box-shadow: 0 0 0 3px var(--ref-accent, var(--accent-soft));
  background: #fff;
}

.schedule-ref-field input::placeholder {
  color: #94a3b8;
}

.schedule-ref-field-row {
  display: flex;
  gap: 10px;
}

.schedule-ref-field--half {
  flex: 1;
  min-width: 0;
}

.schedule-refs-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.schedule-refs-actions .btn {
  padding: 6px 12px;
  font-size: 12px;
  border-radius: 8px;
  border: 1px dashed var(--border-subtle);
  background: #f8fafc;
  color: var(--text-secondary);
  transition: all 0.15s ease;
}

.schedule-refs-actions .btn:hover {
  border-style: solid;
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

/* Production-line document knowledge base */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.pl-knowledge-section {
  margin-bottom: 24px;
}

.pl-knowledge-section > h2,
.pl-knowledge-section > .section-hint {
  display: none;
}

.tab-view.project-dashboard-main--knowledge {
  max-width: none;
  width: 100%;
  padding: 0;
  min-height: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.project-dashboard-main--knowledge {
  max-width: none;
  margin: 0;
  width: 100%;
}

.pl-knowledge-page {
  height: 100%;
  min-height: 0;
}

.pl-knowledge-section--standalone {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  margin-bottom: 0;
  padding: 0;
  background: transparent;
  border: none;
  box-shadow: none;
}

.editor-content:has(.pl-knowledge-page) {
  overflow: hidden;
}

.workspace-pane:has(.pl-knowledge-page) {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.pl-knowledge-layout {
  display: grid;
  grid-template-columns: minmax(280px, 320px) minmax(0, 1fr);
  align-items: stretch;
  flex: 1;
  min-height: 0;
  height: 100%;
  border: none;
  border-top: 1px solid var(--border);
  border-radius: 0;
  overflow: hidden;
  background: #fff;
  box-shadow: none;
}

.pl-knowledge-sidebar {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-right: 1px solid var(--border);
  background: linear-gradient(180deg, #fafbff 0%, #f4f6fb 100%);
}

.pl-knowledge-sidebar-head {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 22px 18px 16px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(10px);
}

.pl-knowledge-sidebar-head-main {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.pl-knowledge-sidebar-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border-radius: 12px;
  background: linear-gradient(145deg, var(--accent-soft), #fff);
  color: var(--accent);
  box-shadow: inset 0 0 0 1px rgba(91, 91, 214, 0.12);
}

.pl-knowledge-sidebar-icon svg {
  width: 20px;
  height: 20px;
}

.pl-knowledge-sidebar-head-text {
  min-width: 0;
}

.pl-knowledge-sidebar-title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--text-primary);
}

.pl-knowledge-sidebar-meta {
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-muted);
}

.pl-knowledge-sidebar-new {
  width: 100%;
  justify-content: center;
  gap: 6px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 600;
  border-color: rgba(91, 91, 214, 0.22);
  background: rgba(255, 255, 255, 0.88);
}

.pl-knowledge-sidebar-new:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.pl-knowledge-sidebar-new svg {
  width: 14px;
  height: 14px;
}

.pl-knowledge-tree {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 14px 8px 18px;
}

.pl-knowledge-tree-row {
  display: flex;
  align-items: center;
  gap: 4px;
  min-height: 40px;
  margin: 2px 4px;
  padding-right: 8px;
  padding-left: calc(10px + var(--tree-depth, 0) * 18px);
  border-radius: 10px;
  transition: background 0.15s ease, box-shadow 0.15s ease;
}

.pl-knowledge-tree-row.is-current {
  background: #fff;
  box-shadow:
    0 1px 2px rgba(91, 91, 214, 0.08),
    inset 3px 0 0 var(--accent);
  padding-left: calc(7px + var(--tree-depth, 0) * 18px);
}

.pl-knowledge-tree-row:hover {
  background: rgba(255, 255, 255, 0.72);
}

.pl-knowledge-tree-row.is-current:hover {
  background: #fff;
}

.pl-knowledge-tree-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  border: none;
  border-radius: 6px;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 12px;
  padding: 0;
}

.pl-knowledge-tree-toggle:hover {
  background: rgba(15, 23, 42, 0.06);
  color: var(--text-primary);
}

.pl-knowledge-tree-toggle--spacer {
  cursor: default;
}

.pl-knowledge-tree-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
  border: none;
  background: none;
  padding: 6px 4px;
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: var(--text-primary);
}

.pl-knowledge-tree-icon {
  display: inline-flex;
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  color: #d97706;
}

.pl-knowledge-tree-row.is-current .pl-knowledge-tree-icon {
  color: var(--accent);
}

.pl-knowledge-tree-icon svg {
  width: 100%;
  height: 100%;
}

.pl-knowledge-tree-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.35;
}

.pl-knowledge-tree-row.is-current .pl-knowledge-tree-name {
  font-weight: 600;
  color: var(--accent);
}

.pl-knowledge-tree-delete {
  flex-shrink: 0;
  opacity: 0;
  padding: 3px 8px;
  font-size: 11px;
}

.pl-knowledge-tree-row:hover .pl-knowledge-tree-delete,
.pl-knowledge-tree-row.is-current .pl-knowledge-tree-delete {
  opacity: 1;
}

.pl-knowledge-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: linear-gradient(180deg, #fcfcfd 0%, #fff 160px);
}

.pl-knowledge-main-top {
  position: sticky;
  top: 0;
  z-index: 2;
  flex-shrink: 0;
  padding: 18px 28px 14px;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.04);
}

.pl-knowledge-main-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 16px 28px 28px;
}

.pl-knowledge-main-head {
  margin-bottom: 14px;
}

.pl-knowledge-main-head-label {
  margin-bottom: 8px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.pl-knowledge-breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 4px;
  font-size: 15px;
  line-height: 1.5;
}

.pl-knowledge-crumb {
  border: none;
  background: none;
  padding: 2px 4px;
  border-radius: 6px;
  font: inherit;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
}

.pl-knowledge-crumb:hover {
  background: var(--accent-soft);
  color: var(--accent);
}

.pl-knowledge-crumb.is-current {
  padding: 2px 6px;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
}

.pl-knowledge-crumb-sep {
  color: var(--text-muted);
  user-select: none;
}

.pl-knowledge-path-label {
  font-weight: 500;
  color: var(--text-primary);
}

.pl-knowledge-section .pl-knowledge-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

@media (max-width: 960px) {
  .pl-knowledge-layout {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .pl-knowledge-sidebar {
    border-right: none;
    border-bottom: 1px solid var(--border);
    max-height: 320px;
  }

  .pl-knowledge-tree {
    max-height: 220px;
  }

  .pl-knowledge-main-top,
  .pl-knowledge-main-body {
    padding-left: 16px;
    padding-right: 16px;
  }
}

.pl-knowledge-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pl-knowledge-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
}

.pl-knowledge-item--folder {
  align-items: center;
}

.pl-knowledge-folder-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
  border: none;
  background: none;
  padding: 0;
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: var(--text-primary);
}

.pl-knowledge-folder-btn:hover .pl-knowledge-folder-name {
  color: var(--accent);
}

.pl-knowledge-folder-icon {
  display: inline-flex;
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  color: #f59e0b;
}

.pl-knowledge-folder-icon svg {
  width: 100%;
  height: 100%;
}

.pl-knowledge-folder-name {
  font-weight: 600;
}

.pl-knowledge-item__title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: var(--text-primary);
}

.pl-knowledge-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}

.pl-knowledge-badge--feishu {
  background: #3370ff15;
  color: #3370ff;
}

.pl-knowledge-badge--upload {
  background: #0ea5e915;
  color: #0ea5e9;
}

.pl-knowledge-desc {
  margin: 6px 0 0;
  font-size: 13px;
  color: var(--text-secondary);
}

.pl-upload-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.pl-upload-count {
  font-size: 13px;
  color: var(--text-secondary);
}

.pl-upload-list-panel {
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  background: var(--surface-secondary, #f8fafc);
  overflow: hidden;
}

.pl-upload-list-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-subtle);
  background: #fff;
}

.pl-upload-filter {
  flex: 1;
  min-width: 0;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
}

.pl-upload-summary {
  padding: 8px 12px;
  font-size: 12px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-subtle);
  background: #fff;
}

.pl-upload-file-tree {
  max-height: 320px;
  overflow: auto;
  padding: 4px 0;
}

.pl-upload-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 16px;
  text-align: center;
  font-size: 13px;
  color: var(--text-secondary);
}

.pl-upload-empty-pick {
  flex-shrink: 0;
}

.pl-upload-empty--inline {
  padding: 12px;
}

.pl-upload-tree-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding-right: 8px;
  padding-left: calc(8px + var(--tree-depth, 0) * 14px);
}

.pl-upload-tree-row:hover {
  background: rgba(0, 0, 0, 0.03);
}

.pl-upload-tree-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  border: none;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 11px;
  padding: 0;
}

.pl-upload-tree-toggle--spacer {
  cursor: default;
}

.pl-upload-tree-folder-name,
.pl-upload-tree-file-name {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pl-upload-tree-folder-name {
  font-weight: 600;
}

.pl-upload-tree-folder-count {
  flex-shrink: 0;
  font-size: 12px;
  color: var(--text-secondary);
}

.pl-upload-tree-row .btn {
  flex-shrink: 0;
}

.pl-knowledge-item__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-muted);
}

.pl-knowledge-link {
  color: var(--accent);
  text-decoration: none;
}

.pl-knowledge-link:hover {
  text-decoration: underline;
}

.pl-knowledge-item__actions {
  display: flex;
  flex-shrink: 0;
  gap: 6px;
}

.pl-knowledge-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: min(420px, 50vh);
  padding: 48px 24px;
  text-align: center;
  font-size: 14px;
  line-height: 1.55;
  color: var(--text-muted);
  border: 1px dashed rgba(15, 23, 42, 0.12);
  border-radius: 14px;
  background: linear-gradient(180deg, #fafbfc 0%, #fff 100%);
}

.btn-danger-outline {
  border-color: #fecaca;
  color: #dc2626;
}

.btn-danger-outline:hover {
  background: #fef2f2;
  border-color: #f87171;
}

/* ── Production line UserStory / Case matrix ── */

.tab-view.project-dashboard-main--story,
.tab-view.project-dashboard-main--case,
.tab-view.project-dashboard-main--product-doc {
  max-width: none;
  width: 100%;
  padding: 0;
  min-height: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.project-dashboard-main--story,
.project-dashboard-main--case,
.project-dashboard-main--product-doc {
  max-width: none;
  margin: 0;
  width: 100%;
}

.pl-case-page {
  height: 100%;
  min-height: 0;
}

.editor-content:has(.pl-case-page) {
  overflow: hidden;
}

.workspace-pane:has(.pl-case-page) {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ── Compact list/table rows (UserStory & Case) ── */

.pl-compact-scroll {
  padding: 0 !important;
}

.pl-compact-table {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.pl-compact-head,
.pl-compact-row {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 56px 32px 44px 28px;
  gap: 5px;
  width: 100%;
  padding: 0 8px;
  box-sizing: border-box;
}

.pl-compact-head {
  grid-template-columns: 48px minmax(0, 1fr) 56px 32px 44px 28px 28px;
}

.pl-compact-table--story .pl-compact-head,
.pl-compact-table--story .pl-compact-row-wrap .pl-compact-row {
  grid-template-columns: 48px minmax(0, 1fr) 56px 32px 44px 28px;
}

.pl-compact-table--story .pl-compact-head {
  grid-template-columns: 48px minmax(0, 1fr) 56px 32px 44px 28px 28px;
}

.pl-compact-table--stacked .pl-compact-head {
  display: none;
}

.pl-compact-table--stacked .pl-compact-row-wrap .pl-compact-row {
  display: flex;
  grid-template-columns: unset;
}

.pl-compact-row--stacked {
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  min-height: auto;
  padding: 3px 8px;
  text-align: left;
}

.pl-stack-line--primary,
.pl-stack-line--meta {
  width: 100%;
  min-width: 0;
  text-align: left;
}

.pl-stack-line--primary {
  display: flex;
  align-items: baseline;
  justify-content: flex-start;
  gap: 6px;
}

.pl-stack-code {
  flex: 0 0 46px;
  width: 46px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10px;
  font-weight: 600;
  color: #475569;
  text-align: left;
  white-space: nowrap;
}

.pl-stack-title {
  flex: 1;
  min-width: 0;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: left;
}

.pl-stack-line--meta {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 22px 44px minmax(36px, 1fr);
  gap: 4px 6px;
  align-items: center;
  padding-left: 52px;
  font-size: 10px;
  line-height: 1.2;
  color: var(--text-secondary);
}

.pl-stack-meta-col {
  min-width: 0;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pl-stack-meta-pri {
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
}

.pl-stack-meta-status {
  overflow: hidden;
}

.pl-stack-meta-status .pl-compact-status {
  display: inline-block;
  max-width: 100%;
  vertical-align: top;
}

.pl-stack-meta-count,
.pl-stack-meta-zentao {
  font-variant-numeric: tabular-nums;
}

.pl-stack-meta-zentao {
  color: #6d28d9;
}

.pl-compact-table--stacked .pl-compact-row-wrap {
  border-radius: 0;
}

.pl-compact-table--stacked .pl-compact-row-wrap + .pl-compact-row-wrap .pl-compact-row {
  border-top: none;
}

.pl-compact-table--stacked .pl-compact-row {
  border-bottom: 1px solid rgba(15, 23, 42, 0.04);
}

.pl-compact-table--stacked .pl-compact-status {
  padding: 0 4px;
  font-size: 9px;
  line-height: 1.3;
}

.pl-case-stories-scroll.pl-compact-scroll,
.pl-case-cases-scroll.pl-compact-scroll {
  padding: 0 !important;
  background: #fff;
}

.pl-compact-row--orphan .pl-stack-title {
  color: #c2410c;
}

.pl-compact-table--case .pl-compact-head,
.pl-compact-table--case .pl-compact-row {
  grid-template-columns: 52px minmax(0, 1fr) 44px 36px 48px 40px;
}

.pl-compact-table--case .pl-compact-head {
  grid-template-columns: 52px minmax(0, 1fr) 44px 36px 48px 40px 28px;
}

.pl-compact-col--code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  font-weight: 600;
  color: #475569;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pl-compact-row-wrap {
  display: flex;
  align-items: stretch;
  gap: 2px;
  border-radius: 8px;
  transition: background 0.12s ease;
}

.pl-compact-row-wrap.is-active {
  background: rgba(99, 102, 241, 0.1);
}

.pl-compact-row-wrap .pl-compact-row {
  flex: 1;
  min-width: 0;
}

.pl-compact-row-delete {
  flex: 0 0 28px;
  align-self: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  margin-right: 4px;
  padding: 0;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.12s ease, background 0.12s ease, color 0.12s ease;
}

.pl-compact-row-wrap:hover .pl-compact-row-delete,
.pl-compact-row-wrap.is-active .pl-compact-row-delete,
.pl-compact-row-delete:focus-visible {
  opacity: 1;
}

.pl-compact-row-delete:hover:not(:disabled) {
  background: rgba(239, 68, 68, 0.12);
  color: #dc2626;
}

.pl-compact-row-delete:disabled {
  cursor: not-allowed;
  opacity: 0.35;
}

.pl-compact-row-delete svg {
  width: 14px;
  height: 14px;
}

.pl-compact-table--product-doc .pl-compact-head,
.pl-compact-table--product-doc .pl-compact-row {
  grid-template-columns: minmax(0, 1fr) minmax(72px, 0.55fr) 52px 48px;
}

.pl-compact-col--source {
  text-align: center;
  font-size: 11px;
  color: var(--text-muted);
}

.pl-compact-status--generating {
  background: #dbeafe;
  color: #1d4ed8;
}

.pl-compact-status--review {
  background: #fef3c7;
  color: #b45309;
}

.pl-compact-status--approved {
  background: #dcfce7;
  color: #15803d;
}

.pl-compact-filters--product-doc .pl-compact-filter-type {
  width: 108px;
}

.pl-compact-filter-module {
  width: 128px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pl-product-doc-preview {
  min-height: 280px;
  max-height: min(52vh, 560px);
  overflow: auto;
  border: 1px solid rgba(15, 23, 42, 0.1);
  border-radius: 12px;
  background: #f8fafc;
}

.pl-product-doc-preview--empty,
.pl-product-doc-preview--generating {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 20px;
}

.pl-product-doc-preview-empty {
  text-align: center;
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.6;
}

.pl-product-doc-preview--readonly {
  position: relative;
  padding: 14px 16px 16px;
  background: #fff;
}

.pl-product-doc-preview-badge {
  position: sticky;
  top: 0;
  z-index: 1;
  display: inline-block;
  margin-bottom: 12px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #ede9fe;
  color: #6d28d9;
  font-size: 11px;
  font-weight: 600;
}

.pl-product-doc-preview-body {
  font-size: 14px;
  line-height: 1.65;
  color: var(--text-primary);
}

.pl-product-doc-preview-body pre {
  overflow-x: auto;
  padding: 10px 12px;
  border-radius: 8px;
  background: #f1f5f9;
  font-size: 12px;
}

.pl-product-doc-preview-body code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
}

.pl-product-doc-generate-hint {
  margin: 0 0 10px;
  font-size: 13px;
  color: var(--text-muted);
}

.pl-product-doc-generate-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
}

.pl-product-doc-generating-meta {
  font-size: 12px;
  color: var(--text-muted);
}

.pl-product-doc-description {
  margin: 8px 0 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-muted);
  white-space: pre-wrap;
}

.pl-product-doc-version-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--border-subtle, rgba(0, 0, 0, 0.08));
  background: var(--surface-muted, rgba(0, 0, 0, 0.02));
}

.pl-product-doc-version-label {
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
}

.pl-product-doc-version-select {
  min-width: 220px;
  max-width: 420px;
}

.pl-product-doc-snapshot-banner {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(59, 130, 246, 0.08);
  color: var(--text-secondary, #475569);
  font-size: 13px;
}

.pl-product-doc-preview--snapshot .pl-product-doc-preview-body {
  opacity: 0.98;
}

.pl-product-doc-version-badge {
  margin-left: 4px;
  font-size: 10px;
  opacity: 0.85;
}

.pl-product-doc-versions-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pl-product-doc-version-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border-subtle, rgba(0, 0, 0, 0.08));
  border-radius: 8px;
}

.pl-product-doc-version-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.pl-product-doc-version-time {
  font-size: 12px;
  color: var(--text-muted);
}

.pl-product-doc-versions-empty {
  padding: 24px;
  text-align: center;
  color: var(--text-muted);
}

.pl-product-doc-page {
  height: 100%;
  min-height: 0;
}

.editor-content:has(.pl-product-doc-page) {
  overflow: hidden;
}

.workspace-pane:has(.pl-product-doc-page) {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.pl-product-doc-layout.pl-story-layout {
  grid-template-columns: minmax(320px, 400px) minmax(0, 1fr);
}

.pl-product-doc-preview-pane-wrap {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: #fff;
}

.pl-product-doc-preview-pane {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  height: 100%;
}

.pl-product-doc-preview-pane--empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
}

.pl-product-doc-preview-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 24px 16px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.07);
  background: rgba(255, 255, 255, 0.96);
}

.pl-product-doc-preview-eyebrow {
  margin: 0 0 4px;
  font-size: 12px;
  font-weight: 600;
  color: #6d28d9;
}

.pl-product-doc-preview-title {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  line-height: 1.3;
}

.pl-product-doc-preview-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

.pl-product-doc-source-tag,
.pl-product-doc-updated {
  font-size: 12px;
  color: var(--text-muted);
}

.pl-product-doc-preview-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-shrink: 0;
}

.pl-product-doc-preview-main {
  flex: 1;
  min-height: 0;
  padding: 16px 24px 24px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.pl-product-doc-preview--pane {
  flex: 1;
  min-height: 0;
  max-height: none;
  display: flex;
  flex-direction: column;
}

.pl-product-doc-preview--pane .pl-product-doc-preview-body {
  flex: 1;
  overflow: auto;
}

.pl-product-doc-preview--editing {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(15, 23, 42, 0.1);
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
}

.pl-product-doc-editor {
  flex: 1;
  width: 100%;
  min-height: 320px;
  padding: 16px;
  border: none;
  resize: none;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-primary);
  background: #fff;
  box-sizing: border-box;
}

.pl-product-doc-editor:focus {
  outline: none;
}

.pl-compact-head {
  position: sticky;
  top: 0;
  z-index: 2;
  flex-shrink: 0;
  align-items: center;
  min-height: 32px;
  border-bottom: 1px solid var(--border-subtle);
  background: #f4f6f9;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
}

.pl-compact-row {
  align-items: center;
  min-height: 34px;
  padding-top: 2px;
  padding-bottom: 2px;
  border: none;
  border-bottom: 1px solid rgba(15, 23, 42, 0.05);
  background: #fff;
  text-align: left;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  color: var(--text-primary);
  transition: background 0.12s ease;
}

.pl-compact-row:hover {
  background: rgba(91, 91, 214, 0.06);
}

.pl-compact-row.is-active {
  background: rgba(91, 91, 214, 0.1);
  box-shadow: inset 3px 0 0 var(--accent);
}

.pl-compact-row--orphan .pl-compact-col--title {
  color: #c2410c;
}

.pl-compact-col {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pl-compact-col--title {
  font-weight: 500;
  line-height: 1.3;
}

.pl-compact-col--module,
.pl-compact-col--type,
.pl-compact-col--pri,
.pl-compact-col--count,
.pl-compact-col--zentao {
  font-size: 11px;
  color: var(--text-secondary);
  text-align: center;
}

.pl-compact-col--module {
  text-align: left;
}

.pl-compact-col--zentao {
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  color: #6d28d9;
}

.pl-compact-status {
  display: inline-block;
  max-width: 100%;
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pl-compact-status--draft { background: #f3f4f6; color: #6b7280; }
.pl-compact-status--reviewing { background: #fef3c7; color: #b45309; }
.pl-compact-status--approved { background: #dcfce7; color: #15803d; }
.pl-compact-status--synced { background: #ede9fe; color: #6d28d9; }

/* ── Case Main Pane (全宽用例面板) ── */

.pl-case-main-pane {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  background: #fff;
}

.pl-case-main-head {
  flex-shrink: 0;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border-subtle);
  background: linear-gradient(135deg, #f8faff 0%, #fff 100%);
}

.pl-case-main-title-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.pl-case-main-title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pl-case-main-count {
  padding: 4px 10px;
  border-radius: 999px;
  background: #eef2ff;
  font-size: 12px;
  font-weight: 600;
  color: #4338ca;
  white-space: nowrap;
}

.pl-case-main-desc {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
}

.pl-case-main-body {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ── Case Filter Form (查询表单) ── */

.pl-case-filter-form {
  margin-top: 4px;
}

.pl-filter-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.pl-filter-item {
  flex-shrink: 0;
}

.pl-filter-search {
  flex: 1;
  min-width: 200px;
  max-width: 320px;
}

.pl-filter-input {
  width: 100%;
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  font-size: 13px;
  color: var(--text-primary);
  background: #fff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.pl-filter-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(91, 91, 214, 0.1);
}

.pl-filter-select {
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  font-size: 13px;
  color: var(--text-primary);
  background: #fff;
  cursor: pointer;
  transition: border-color 0.15s ease;
}

.pl-filter-select:focus {
  outline: none;
  border-color: var(--accent);
}

.pl-filter-actions {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

/* ── Case Table Scroll ── */

.pl-case-table-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}

.pl-case-table-wrapper {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

/* ── Case Pagination (分页) ── */

.pl-case-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 16px;
  border-top: 1px solid var(--border-subtle);
  background: #fafbfc;
  flex-shrink: 0;
}

.pl-case-pagination-info {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}

.pl-case-pagination-controls {
  display: flex;
  align-items: center;
  gap: 4px;
}

.pl-page-btn {
  padding: 6px 12px;
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  background: #fff;
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.pl-page-btn:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}

.pl-page-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.pl-page-numbers {
  display: flex;
  align-items: center;
  gap: 2px;
}

.pl-page-num {
  min-width: 28px;
  height: 28px;
  padding: 0 6px;
  border: none;
  border-radius: 6px;
  background: transparent;
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.pl-page-num:hover {
  background: rgba(91, 91, 214, 0.08);
  color: var(--accent);
}

.pl-page-num.active {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}

.pl-page-size {
  height: 30px;
  padding: 0 8px;
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  font-size: 12px;
  color: var(--text-secondary);
  background: #fff;
  cursor: pointer;
}

/* ── Case Table Sort ── */

.pl-sortable {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.pl-sortable:hover {
  color: var(--accent);
}

.pl-sort-icon {
  display: inline-block;
  margin-left: 4px;
  font-size: 10px;
  opacity: 0.4;
}

.pl-sort-icon.active {
  opacity: 1;
  color: var(--accent);
}

/* ── Responsive ── */

@media (max-width: 1200px) {
  .pl-story-layout.pl-case-layout {
    grid-template-columns: minmax(240px, 280px) minmax(0, 1fr);
  }
}

@media (max-width: 768px) {
  .pl-story-layout.pl-case-layout,
  .pl-story-layout.pl-case-layout.pl-case-layout--collapsed {
    grid-template-columns: 1fr;
  }
  
  .pl-story-layout.pl-case-layout .pl-case-stories-pane {
    display: none;
  }
  
  .pl-case-main-head {
    padding: 14px 16px 12px;
  }
  
  .pl-case-main-title-row {
    flex-wrap: wrap;
  }
  
  .pl-filter-row {
    flex-direction: column;
    align-items: stretch;
  }
  
  .pl-filter-search {
    max-width: none;
  }
  
  .pl-filter-actions {
    margin-left: 0;
    justify-content: flex-end;
  }
  
  .pl-case-pagination {
    flex-wrap: wrap;
    gap: 8px;
  }
  
  .pl-case-table-title {
    max-width: 150px;
  }
  
  .pl-case-table-type,
  .pl-case-table-zentao {
    display: none;
  }
}

.pl-case-story-card {
  display: flex;
}

.pl-case-card {
  display: flex;
}

.pl-case-story-card--orphan .pl-story-card-title {
  color: #c2410c;
}

.pl-case-editor-story {
  padding: 2px 8px;
  border-radius: 999px;
  background: #eef2ff;
  font-size: 11px;
  font-weight: 600;
  color: #4338ca;
}

.pl-story-page {
  height: 100%;
  min-height: 0;
}

.editor-content:has(.pl-story-page),
.editor-content:has(.project-dashboard-main--case) {
  overflow: hidden;
}

.workspace-pane:has(.pl-story-page),
.workspace-pane:has(.project-dashboard-main--case) {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.pl-story-section--standalone {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 0;
  background: transparent;
  border: none;
  box-shadow: none;
}

.pl-story-layout {
  display: grid;
  grid-template-columns: minmax(360px, 440px) minmax(0, 1fr);
  align-items: stretch;
  flex: 1;
  min-height: 0;
  height: 100%;
  border: none;
  border-top: 1px solid var(--border);
  border-radius: 0;
  overflow: hidden;
  background: #fff;
  box-shadow: none;
}

.pl-story-layout.pl-case-layout {
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
}

/* 生产线任务：左列表右详情（对齐用户故事页） */
/* 与 pl-story-page / pl-case-page 一致：约束视口高度，列表与详情各自单滚动，避免外层+内层双滚动条 */
.pl-task-page {
  height: 100%;
  min-height: 0;
}

.editor-content:has(.pl-task-page) {
  overflow: hidden;
}

.workspace-pane:has(.pl-task-page) {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.pl-task-layout.pl-story-layout {
  grid-template-columns: minmax(360px, 440px) minmax(0, 1fr);
}

.pl-task-list-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.pl-task-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 10px 16px;
}

.pl-task-list-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  text-align: left;
  cursor: pointer;
  color: inherit;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.pl-task-list-item:hover {
  border-color: color-mix(in srgb, var(--primary) 35%, var(--border));
  background: color-mix(in srgb, var(--primary) 4%, #fff);
}

.pl-task-list-item.is-active {
  border-color: var(--primary);
  background: color-mix(in srgb, var(--primary) 8%, #fff);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--primary) 25%, transparent);
}

.pl-task-list-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.pl-task-list-item-type {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

.pl-task-list-item-badges {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.pl-task-list-item-title {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.pl-task-list-item-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
}

.pl-task-list-item-meta {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.pl-task-detail-pane {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: auto;
}

.pl-task-detail-head {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 12px 16px 0;
}

.pl-task-detail-head .task-detail-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 1;
}

.pl-task-page .kanban-date-range {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 12px 8px;
}

.pl-task-page .kanban-date-range.is-hidden {
  display: none;
}



.pl-story-layout.pl-case-layout.pl-case-layout--collapsed {
  grid-template-columns: 48px minmax(0, 1fr);
}

.pl-story-layout.pl-case-layout.pl-case-layout--collapsed .pl-case-stories-pane .pl-story-list-head-text,
.pl-story-layout.pl-case-layout.pl-case-layout--collapsed .pl-case-stories-pane .pl-compact-filters,
.pl-story-layout.pl-case-layout.pl-case-layout--collapsed .pl-case-stories-pane .pl-story-list-scroll {
  display: none;
}

.pl-case-collapse-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.pl-case-collapse-btn:hover {
  background: rgba(15, 23, 42, 0.06);
  color: var(--text-primary);
}

.pl-case-editor-pane {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
}

.pl-case-editor-pane .pl-story-editor-empty {
  flex: 1 1 auto;
  min-height: 0;
}

.pl-story-list-pane {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-right: 1px solid var(--border);
  background:
    linear-gradient(180deg, #fafbff 0%, #f4f6fb 100%);
}

.pl-story-list-head {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 20px 16px 14px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.07);
  background: rgba(255, 255, 255, 0.9);
}

.pl-story-list-brand {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.pl-story-list-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border-radius: 12px;
  background: linear-gradient(145deg, var(--accent-soft), #fff);
  color: var(--accent);
  box-shadow: inset 0 0 0 1px rgba(91, 91, 214, 0.14);
}

.pl-story-list-icon svg {
  width: 20px;
  height: 20px;
}

.pl-story-list-search {
  width: 100%;
}

.pl-story-list-search-input {
  width: 100%;
  padding: 9px 12px 9px 34px;
  border: 1px solid rgba(15, 23, 42, 0.1);
  border-radius: 10px;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%2394a3b8' stroke-width='2' viewBox='0 0 24 24'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-3-3'/%3E%3C/svg%3E") no-repeat 10px center;
  font-size: 13px;
  color: var(--text-primary);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.pl-story-list-search-input:focus {
  outline: none;
  border-color: rgba(91, 91, 214, 0.45);
  box-shadow: 0 0 0 3px rgba(91, 91, 214, 0.1);
}

.pl-story-list-search-input::placeholder {
  color: var(--text-muted);
}

.pl-compact-filters {
  display: flex;
  gap: 8px;
  width: 100%;
  align-items: center;
}

.pl-compact-filter-search {
  flex: 1;
  min-width: 0;
}

.pl-compact-filter-status {
  flex-shrink: 0;
  width: 96px;
  padding: 9px 8px;
  border: 1px solid rgba(15, 23, 42, 0.1);
  border-radius: 10px;
  background: #fff;
  font-size: 12px;
  color: var(--text-primary);
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.pl-compact-filter-status:focus {
  outline: none;
  border-color: rgba(91, 91, 214, 0.45);
  box-shadow: 0 0 0 3px rgba(91, 91, 214, 0.1);
}

.pl-story-list-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}

.pl-story-list-meta {
  margin: 3px 0 0;
  font-size: 12px;
  color: var(--text-muted);
}

.pl-story-list-new {
  width: 100%;
  justify-content: center;
  gap: 6px;
  padding: 9px 12px;
  font-weight: 600;
  border-radius: 10px;
}

.pl-story-list-new svg {
  width: 14px;
  height: 14px;
}

.pl-story-list-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0;
}

/* Case 矩阵故事列表：列较多时允许左右滑动查看 */
.pl-case-stories-scroll {
  overflow-x: auto;
}

.pl-story-card-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px 16px;
}

.pl-story-card-wrap {
  display: flex;
  align-items: stretch;
  gap: 4px;
}

.pl-story-card-wrap .pl-story-card {
  flex: 1;
  min-width: 0;
  margin-bottom: 0;
}

.pl-story-card-wrap .pl-compact-row-delete {
  align-self: center;
  margin-right: 0;
  opacity: 0;
}

.pl-story-card-wrap:hover .pl-compact-row-delete,
.pl-story-card-wrap.is-active .pl-compact-row-delete,
.pl-story-card-wrap .pl-compact-row-delete:focus-visible {
  opacity: 1;
}

.pl-story-card-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  font-weight: 600;
  color: #64748b;
  letter-spacing: 0.01em;
}

.pl-story-card-head .pl-compact-status {
  flex-shrink: 0;
}

.pl-story-card--orphan .pl-story-card-title {
  color: #c2410c;
}

.pl-story-list-empty {
  padding: 40px 16px;
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
}

.pl-story-list-empty-hint {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-secondary);
}

.pl-story-load-more {
  display: block;
  width: 100%;
  margin-top: 8px;
  padding: 8px 10px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 12px;
  text-align: center;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.pl-story-load-more:hover:not(:disabled) {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent);
}

.pl-story-load-more:disabled {
  cursor: default;
  opacity: 0.7;
}

.pl-story-load-more-hint {
  min-height: 28px;
  margin: 4px 0 8px;
  padding: 6px 10px;
  color: var(--text-muted);
  font-size: 12px;
  text-align: center;
}

.pl-story-card {
  position: relative;
  display: flex;
  width: 100%;
  margin-bottom: 8px;
  padding: 0;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 14px;
  background: #fff;
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  transition:
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    transform 0.18s ease;
}

.pl-story-card:last-child {
  margin-bottom: 0;
}

.pl-story-card:hover {
  border-color: rgba(91, 91, 214, 0.22);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.07);
  transform: translateY(-1px);
}

.pl-story-card--active {
  border-color: rgba(91, 91, 214, 0.38);
  box-shadow:
    0 10px 28px rgba(91, 91, 214, 0.12),
    inset 0 0 0 1px rgba(91, 91, 214, 0.08);
}

.pl-story-card--active .pl-story-card-accent {
  opacity: 1;
}

.pl-story-card-accent {
  width: 4px;
  flex-shrink: 0;
  background: linear-gradient(180deg, #818cf8, var(--accent));
  opacity: 0;
  transition: opacity 0.18s ease;
}

.pl-story-card-body {
  flex: 1;
  min-width: 0;
  padding: 13px 14px 12px;
}

.pl-story-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.pl-story-card-title {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.45;
  color: var(--text-primary);
  letter-spacing: -0.01em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}

.pl-story-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 9px;
}

.pl-story-card-tag {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  line-height: 1.35;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pl-story-card-tag--module {
  background: #eef2ff;
  color: #4338ca;
}

.pl-story-card-tag--source {
  background: #fff7ed;
  color: #c2410c;
}

.pl-story-card-tag--type {
  background: #ecfdf5;
  color: #047857;
}

.pl-story-card-tag--pri {
  background: #f5f3ff;
  color: #6d28d9;
  font-weight: 700;
}

.pl-story-card-tag--muted {
  background: #f4f4f5;
  color: #71717a;
}

.pl-story-card-preview {
  margin: 8px 0 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.pl-story-card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(15, 23, 42, 0.06);
  font-size: 11px;
  color: var(--text-secondary);
}

.pl-story-card-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.pl-story-card-meta-item svg {
  width: 12px;
  height: 12px;
  opacity: 0.65;
}

.pl-story-card-meta-item--zentao {
  padding: 2px 7px;
  border-radius: 999px;
  background: #ede9fe;
  color: #6d28d9;
  font-weight: 600;
}

.pl-story-editor-pane {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  min-width: 0;
  background: #fff;
}

.pl-story-editor-empty {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 48px 32px;
  text-align: center;
}

.pl-story-editor-empty-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  border-radius: 18px;
  background: linear-gradient(145deg, var(--accent-soft), #fff);
  color: var(--accent);
  box-shadow: inset 0 0 0 1px rgba(91, 91, 214, 0.12);
}

.pl-story-editor-empty-icon svg {
  width: 28px;
  height: 28px;
}

.pl-story-editor-empty-title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

.pl-story-editor-empty-desc {
  margin: 0;
  max-width: 320px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-muted);
}

.pl-story-editor {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
}

.pl-story-editor-head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px 20px;
  padding: 18px 28px 16px;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.04);
}

.pl-story-editor-head-main {
  min-width: 0;
  flex: 1;
}

.pl-story-editor-eyebrow {
  margin: 0 0 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
}

.pl-story-editor-title {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.3;
  color: var(--text-primary);
}

.pl-story-editor-subtitle {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--text-muted);
}

.pl-story-editor-head-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

.pl-story-editor-code {
  padding: 2px 8px;
  border-radius: 999px;
  background: #e0f2fe;
  font-size: 11px;
  font-weight: 600;
  color: #0369a1;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.pl-story-editor-zentao {
  padding: 2px 8px;
  border-radius: 999px;
  background: #ede9fe;
  font-size: 11px;
  font-weight: 600;
  color: #6d28d9;
}

.pl-story-editor-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.pl-story-editor-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 8px 28px 32px;
  background: linear-gradient(180deg, #fcfcfd 0%, #fff 120px);
}

.pl-story-form-section {
  margin-top: 20px;
  padding: 20px 22px;
  border: 1px solid rgba(15, 23, 42, 0.07);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
}

.pl-story-form-section--last {
  margin-bottom: 4px;
}

.pl-story-form-section-title {
  margin: 0 0 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--text-secondary);
}

.pl-story-form-grid {
  display: grid;
  gap: 14px 16px;
}

.pl-story-form-grid--2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.pl-story-form-grid--3 {
  grid-template-columns: minmax(120px, 160px) minmax(0, 1fr) minmax(0, 1fr);
}

.pl-story-form-grid-span-2 {
  grid-column: span 2;
}

.pl-story-title-input {
  font-size: 15px;
  font-weight: 500;
  padding: 10px 12px;
}

.pl-field-readonly {
  background: #f8fafc !important;
  color: var(--text-secondary) !important;
  border-color: rgba(15, 23, 42, 0.08) !important;
  cursor: default;
}

.pl-story-editor-body .form-field-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px 16px;
}

.pl-story-editor-body .rich-text-editor {
  min-height: 120px;
}

.pl-story-editor-body .rich-text-surface {
  font-size: 14px;
  line-height: 1.65;
}

.pl-story-actions {
  white-space: nowrap;
}

@media (max-width: 1400px) {
  .pl-story-layout.pl-case-layout {
    grid-template-columns: minmax(240px, 280px) minmax(260px, 300px) minmax(0, 1fr);
  }

  .pl-story-editor-head {
    padding: 14px 20px 12px;
    gap: 10px 14px;
  }

  .pl-story-editor-body {
    padding: 8px 20px 28px;
  }

  .pl-story-form-section {
    padding: 16px 18px;
  }
}

@media (max-width: 1200px) {
  .pl-story-layout.pl-case-layout {
    grid-template-columns: minmax(220px, 260px) minmax(0, 1fr);
  }

  .pl-story-layout.pl-case-layout .pl-case-stories-pane {
    display: none;
  }

  .pl-case-cases-pane {
    border-right: 1px solid var(--border);
  }

  .pl-story-editor-head {
    flex-direction: column;
    align-items: stretch;
  }

  .pl-story-editor-actions {
    justify-content: flex-end;
  }

  .pl-story-form-grid--2 {
    grid-template-columns: 1fr;
  }

  .pl-story-form-grid-span-2 {
    grid-column: auto;
  }
}

@media (max-width: 960px) {
  .pl-story-layout {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .pl-story-layout.pl-case-layout {
    grid-template-columns: 1fr;
  }

  .pl-story-layout.pl-case-layout .pl-case-stories-pane {
    display: flex;
    max-height: 320px;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .pl-case-cases-pane {
    max-height: 280px;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .pl-story-list-pane {
    max-height: 320px;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .pl-story-form-grid--2,
  .pl-story-form-grid--3 {
    grid-template-columns: 1fr;
  }

  .pl-story-form-grid-span-2 {
    grid-column: auto;
  }

  .pl-story-editor-head,
  .pl-story-editor-body {
    padding-left: 16px;
    padding-right: 16px;
  }
}

.rich-text-editor {
  border: 1px solid var(--border-subtle, #e4e4e7);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.rich-text-toolbar {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border-subtle, #e4e4e7);
  background: #fafafa;
}

.rich-text-btn {
  min-width: 28px;
  height: 28px;
  padding: 0 6px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-secondary, #52525b);
  font-size: 13px;
  cursor: pointer;
}

.rich-text-btn:hover {
  background: #eef2ff;
  color: var(--text-primary, #18181b);
}

.rich-text-btn:focus-visible {
  outline: 2px solid #6366f1;
  outline-offset: 1px;
}

.rich-text-toolbar-sep {
  width: 1px;
  height: 18px;
  margin: 0 4px;
  background: var(--border-subtle, #e4e4e7);
}

.rich-text-u {
  text-decoration: underline;
}

.rich-text-surface {
  padding: 10px 12px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-primary, #18181b);
  outline: none;
  overflow-y: auto;
  max-height: 280px;
}

.rich-text-surface:empty::before {
  content: attr(data-placeholder);
  color: #a1a1aa;
  pointer-events: none;
}

.rich-text-surface p {
  margin: 0 0 0.5em;
}

.rich-text-surface p:last-child {
  margin-bottom: 0;
}

.rich-text-surface ul,
.rich-text-surface ol {
  margin: 0.25em 0 0.5em 1.25em;
  padding: 0;
}

.pl-story-attachment-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-top: 0.5rem;
}

.pl-story-attachment-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.08));
  border-radius: 6px;
  font-size: 0.875rem;
}

.pl-story-attachment-item--pending {
  opacity: 0.85;
}

.pl-story-actions .btn + .btn {
  margin-left: 6px;
}

.pl-review-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}

.pl-review-badge--draft { background: #f3f4f6; color: #6b7280; }
.pl-review-badge--reviewing { background: #fef3c7; color: #b45309; }
.pl-review-badge--approved { background: #dcfce7; color: #15803d; }
.pl-review-badge--synced { background: #ede9fe; color: #6d28d9; }

/* ── Case matrix split layout ── */

.pl-case-list-scroll {
  padding: 8px 10px 12px;
}

.pl-case-story-group {
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
}

.pl-case-story-group:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.pl-case-story-head {
  display: block;
  width: 100%;
  margin-bottom: 8px;
  padding: 12px 12px 10px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.55);
  text-align: left;
  cursor: pointer;
  transition:
    border-color 0.15s ease,
    background 0.15s ease,
    box-shadow 0.15s ease;
}

button.pl-case-story-head:hover {
  border-color: rgba(91, 91, 214, 0.18);
  background: #fff;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.06);
}

.pl-case-story-head--active {
  border-color: rgba(91, 91, 214, 0.35);
  background: #fff;
  box-shadow:
    inset 0 0 0 1px rgba(91, 91, 214, 0.12),
    0 6px 20px rgba(91, 91, 214, 0.08);
}

.pl-case-story-head--orphan {
  cursor: default;
  background: #fff7ed;
  border-color: #fed7aa;
}

.pl-case-story-head-main {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.pl-case-story-head-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.35;
}

.pl-case-story-head-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 6px;
  font-size: 11px;
  color: var(--text-secondary);
}

.pl-case-story-head-hint {
  margin: 6px 0 0;
  font-size: 11px;
  color: #c2410c;
}

.pl-case-story-add {
  width: calc(100% - 4px);
  margin: 0 2px 8px;
}

.pl-case-group-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 0 2px;
}

.pl-case-group-empty {
  padding: 8px 12px;
  font-size: 12px;
  color: var(--text-muted);
}

.pl-case-card {
  margin-bottom: 0;
  padding: 10px 12px;
}

.pl-case-story-context {
  margin-bottom: 18px;
  padding: 14px 16px;
  border: 1px solid rgba(91, 91, 214, 0.16);
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(238, 242, 255, 0.65), rgba(255, 255, 255, 0.95));
}

.pl-case-story-context--empty {
  border-color: #fde68a;
  background: #fffbeb;
}

.pl-case-story-context-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.pl-case-story-context-card {
  margin-top: 8px;
}

.pl-case-story-context-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}

.pl-case-story-context-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.pl-case-story-context-zentao {
  font-size: 12px;
  color: var(--text-secondary);
}

.pl-case-story-context-hint {
  margin: 10px 0 0;
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-muted);
}

.pl-case-steps-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.pl-case-steps-head label {
  margin: 0;
  font-weight: 600;
}

.pl-case-steps-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  background: #fff;
}

.pl-case-steps-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.pl-case-steps-table thead {
  background: #f4f6f9;
}

.pl-case-steps-table th {
  padding: 6px 8px;
  text-align: left;
  font-weight: 600;
  font-size: 11px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-subtle);
}

.pl-case-steps-table td {
  padding: 6px 8px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.05);
  vertical-align: top;
}

.pl-case-steps-table tbody tr:last-child td {
  border-bottom: none;
}

.pl-case-step-num {
  font-weight: 700;
  font-size: 11px;
  color: var(--text-secondary);
  text-align: center;
  vertical-align: middle !important;
}

.pl-case-step-input {
  width: 100%;
  min-height: 44px;
  padding: 6px 8px;
  font-size: 12px;
  font-family: inherit;
  line-height: 1.45;
  color: var(--text-primary);
  background: #fff;
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  resize: vertical;
  box-sizing: border-box;
}

.pl-case-step-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(91, 91, 214, 0.12);
}

.pl-case-step-ops {
  text-align: center;
  vertical-align: middle !important;
  white-space: nowrap;
}

.pl-case-step-op {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  margin: 0 1px;
  padding: 0;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
}

.pl-case-step-op:hover:not(:disabled) {
  background: rgba(15, 23, 42, 0.06);
  color: var(--text-primary);
}

.pl-case-step-op:disabled {
  opacity: 0.25;
  cursor: not-allowed;
}

.pl-case-step-remove:hover:not(:disabled) {
  background: rgba(239, 68, 68, 0.1);
  color: #dc2626;
}

.pl-matrix-block {
  margin-bottom: 20px;
  padding: 16px;
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  background: #fff;
}

.pl-matrix-story-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.pl-matrix-story-title {
  font-size: 15px;
  font-weight: 600;
}

.pl-matrix-zentao {
  font-size: 12px;
  color: var(--text-secondary);
}

.pl-matrix-empty-row {
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
}

.pl-case-matrix-section .pl-matrix-block .btn {
  margin-top: 10px;
}

/* ── Case Table (用例表格) ── */

.pl-case-table-wrapper {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.pl-case-batch-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: linear-gradient(135deg, #f8faff 0%, #fff 100%);
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

/* 用户故事列表：全选文案 / 评审按钮 / 导出分行，避免窄侧栏重叠与竖排 */
.pl-story-batch-bar {
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}

.pl-story-batch-bar-main,
.pl-story-batch-bar-actions,
.pl-story-batch-bar-export {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.pl-story-batch-bar-main .pl-case-batch-info {
  flex: 1 1 auto;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pl-story-batch-bar-actions .btn,
.pl-story-batch-bar-export .btn {
  flex-shrink: 0;
}

.pl-case-batch-check-all {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}

.pl-case-batch-check-all input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--accent);
}

.pl-case-batch-info {
  font-size: 12px;
  color: var(--text-muted);
  flex: 1;
}

.pl-case-batch-bar .btn {
  white-space: nowrap;
}

.pl-case-story-export-bar {
  position: sticky;
  top: 0;
  z-index: 3;
  gap: 8px;
  background: var(--bg-surface, #fff);
}

.pl-case-story-export-bar .pl-case-batch-info {
  min-width: 150px;
}

.pl-case-story-export-bar [data-pl-export-cases] {
  margin-left: auto;
}

.pl-case-batch-bar .btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.pl-case-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.pl-case-table thead {
  position: sticky;
  top: 0;
  z-index: 10;
  background: #f4f6f9;
}

.pl-case-table thead th {
  padding: 10px 12px;
  text-align: left;
  font-weight: 600;
  font-size: 12px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}

.pl-case-table tbody tr {
  cursor: pointer;
  transition: background 0.12s ease;
}

.pl-case-table tbody tr:hover {
  background: rgba(91, 91, 214, 0.04);
}

.pl-case-table tbody tr.is-active {
  background: rgba(91, 91, 214, 0.08);
  box-shadow: inset 2px 0 0 var(--accent);
}

/* UserStory / Case 矩阵故事列表：与 Case 用例表同风格 */
.pl-story-table-wrapper {
  border: none;
  box-shadow: none;
  background: transparent;
}

/* 外层 .pl-story-list-scroll 负责纵向滚动与触底加载；内层勿再 height:100%+overflow，否则出现双滚动条 */
.pl-story-list-scroll .pl-story-table-wrapper,
.pl-case-stories-scroll .pl-story-table-wrapper {
  height: auto;
  overflow: visible;
}

.pl-story-list-scroll .pl-case-table-scroll,
.pl-case-stories-scroll .pl-case-table-scroll {
  overflow: visible;
  flex: none;
}

/* Case 矩阵：表格按内容撑开宽度，配合外层 overflow-x 实现横向滑动 */
.pl-case-stories-scroll .pl-story-table {
  width: max-content;
  min-width: 100%;
}

.pl-story-table {
  font-size: 12px;
}

.pl-story-table thead th {
  padding: 8px 10px;
}

.pl-story-table tbody td {
  padding: 8px 10px;
}

.pl-story-table .pl-case-table-type {
  max-width: 72px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pl-case-table tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.05);
  vertical-align: middle;
}

.pl-case-table-check {
  width: 36px;
  text-align: center;
}

.pl-case-table-check input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--accent);
}

.pl-case-table-check input[type="checkbox"]:disabled {
  cursor: not-allowed;
  opacity: 0.35;
}

.pl-case-table-code {
  font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  white-space: nowrap;
}

.pl-case-table-title {
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
  color: var(--text-primary);
}

.pl-case-table-type {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
}

.pl-case-table-pri {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-align: center;
}

.pl-case-table-status {
  white-space: nowrap;
}

.pl-case-table-zentao {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}

@media (max-width: 768px) {
  .pl-case-table-title {
    max-width: 120px;
  }
  
  .pl-case-table-type,
  .pl-case-table-zentao {
    display: none;
  }
}

/* ── Case Modal (弹窗) ── */

.pl-case-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(4px);
  animation: pl-case-modal-fade-in 0.2s ease;
}

@keyframes pl-case-modal-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.pl-case-modal {
  width: min(860px, 100%);
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.15), 0 0 0 1px rgba(15, 23, 42, 0.05);
  overflow: hidden;
  animation: pl-case-modal-slide-in 0.25s ease;
}

@keyframes pl-case-modal-slide-in {
  from { transform: translateY(16px) scale(0.98); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

.pl-case-modal-content {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
}

.pl-case-modal-content .pl-story-editor {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
}

.pl-case-modal-head {
  position: relative;
  flex-shrink: 0;
  padding: 20px 56px 16px 24px !important;
  border-bottom: 1px solid var(--border-subtle);
  background: linear-gradient(135deg, #f8faff 0%, #fff 100%);
}

.pl-case-modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.pl-case-modal-close:hover {
  background: rgba(15, 23, 42, 0.06);
  color: var(--text-primary);
}

.pl-case-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 24px 24px !important;
}

.pl-case-modal-footer {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 24px;
  border-top: 1px solid var(--border-subtle);
  background: #fafbfc;
}

.pl-case-modal-footer .pl-story-editor-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

@media (max-width: 768px) {
  .pl-case-modal-overlay {
    padding: 0;
  }

  .pl-case-modal {
    width: 100%;
    max-height: 100vh;
    border-radius: 0;
  }

  .pl-case-modal-head {
    padding: 16px 48px 12px 16px !important;
  }

  .pl-case-modal-body {
    padding: 12px 16px 16px !important;
  }

  .pl-case-modal-footer {
    padding: 12px 16px;
    flex-wrap: wrap;
  }
}

@media (prefers-reduced-motion: reduce) {
  .pl-case-modal-overlay,
  .pl-case-modal {
    animation: none;
  }
}

/* ── Knowledge base long-running operation progress ── */

.pl-op-progress {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(24, 24, 27, 0.52);
  backdrop-filter: blur(6px);
}

.pl-op-progress-card {
  width: min(440px, 100%);
  padding: 22px 24px 20px;
  border-radius: 14px;
  background: #fff;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-subtle);
}

.pl-op-progress-head {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 14px;
}

.pl-op-progress-spinner {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  margin-top: 2px;
  border: 2px solid #e5e7eb;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: pl-op-spin 0.75s linear infinite;
}

@keyframes pl-op-spin {
  to { transform: rotate(360deg); }
}

.pl-op-progress-text {
  flex: 1;
  min-width: 0;
}

.pl-op-progress-title {
  margin: 0 0 4px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.pl-op-progress-detail {
  margin: 0;
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pl-op-progress-track {
  height: 6px;
  border-radius: 999px;
  background: #eef0f3;
  overflow: hidden;
  margin-bottom: 10px;
}

.pl-op-progress-bar {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), #5b9cf5);
  transition: width 0.35s ease;
}

.pl-op-progress.is-indeterminate .pl-op-progress-bar {
  width: 35% !important;
  animation: pl-op-indeterminate 1.4s ease-in-out infinite;
}

@keyframes pl-op-indeterminate {
  0% { transform: translateX(-120%); }
  100% { transform: translateX(340%); }
}

.pl-op-progress-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 11px;
  color: var(--text-muted);
}

@media (prefers-reduced-motion: reduce) {
  .pl-op-progress-spinner,
  .pl-op-progress.is-indeterminate .pl-op-progress-bar {
    animation: none;
  }
}

/* 批量创建禅道测试任务弹框：任务预览列表 */
.pl-bc-task-preview {
  max-height: 220px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 6px;
}

.pl-bc-task-preview-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 6px 10px;
  font-size: 12px;
}

.pl-bc-task-preview-row + .pl-bc-task-preview-row {
  border-top: 1px solid var(--border-subtle);
}

.pl-bc-task-preview-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pl-bc-task-preview-desc {
  flex-shrink: 0;
  color: var(--text-secondary);
  white-space: nowrap;
}
