/* ==========================================================================
   WorkBuddy Design System — Apple HIG & macOS Interface
   ========================================================================== */

:root {
  --bg-app: #f5f5f7;
  --bg-surface: #ffffff;
  --bg-sidebar: #f8f8fa;
  --bg-sidebar-hover: rgba(0, 0, 0, 0.05);
  --bg-sidebar-active: #ffffff;
  --bg-card: #ffffff;
  --bg-card-subtle: #fbfbfc;
  --bg-input: #ffffff;
  --bg-tag: #f0f2f5;

  --text-primary: #1d1d1f;
  --text-secondary: #48484a;
  --text-tertiary: #86868b;
  --text-quaternary: #aeaeb2;

  --accent: #10b981;
  --accent-hover: #059669;
  --accent-light: #ecfdf5;
  --accent-border: #a7f3d0;
  --accent-glow: rgba(16, 185, 129, 0.2);

  --system-red: #ff3b30;
  --system-orange: #ff9500;
  --system-yellow: #ffcc00;
  --system-blue: #0071e3;

  --border-subtle: rgba(0, 0, 0, 0.06);
  --border-normal: rgba(0, 0, 0, 0.12);
  --border-strong: rgba(0, 0, 0, 0.18);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.08);
  --shadow-dropdown: 0 12px 32px rgba(0, 0, 0, 0.15);

  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;
  --radius-pill: 9999px;

  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--text-primary);
  background: var(--bg-app);
}

*, *::before, *::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  min-width: 1080px;
  background: #ffffff;
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.5;
}

button, input, textarea, select {
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: transparent;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  transition: all 0.15s ease;
}

button:active {
  transform: scale(0.98);
}

button:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-glow), 0 0 0 1px var(--accent);
}

.hidden, [hidden] {
  display: none !important;
}

/* ==========================================================================
   顶栏 (Window Bar)
   ========================================================================== */

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

.window-bar {
  height: 36px;
  background: #f6f6f8;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  padding: 0 16px;
  user-select: none;
}

.window-brand {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.window-brand::before {
  content: "✦";
  color: var(--accent);
}

.window-menu {
  display: flex;
  align-items: center;
  margin-left: 20px;
  gap: 4px;
}

.window-menu button {
  height: 24px;
  padding: 0 8px;
  border-radius: var(--radius-xs);
  font-size: 12px;
  color: var(--text-secondary);
}

.window-menu button:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--text-primary);
}

.window-actions {
  margin-left: auto;
  display: flex;
  gap: 8px;
  align-items: center;
}

.window-actions span {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
}

.window-actions span:nth-child(1) { background: #ff5f57; border: 1px solid #e0443e; }
.window-actions span:nth-child(2) { background: #febc2e; border: 1px solid #d89e24; }
.window-actions span:nth-child(3) { background: #28c840; border: 1px solid #1aab29; }

/* ==========================================================================
   登录屏幕 (Login Screen)
   ========================================================================== */

.login-screen {
  min-height: calc(100vh - 36px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 30%, #f0fdf4 0%, #ffffff 70%);
  padding: 32px 24px;
  position: relative;
}

.login-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 400px;
  width: 100%;
}

.login-illustration {
  width: 140px;
  height: 140px;
  margin-bottom: 20px;
  padding: 20px;
  background: #ffffff;
  border-radius: 32px;
  box-shadow: var(--shadow-lg), 0 0 0 1px var(--border-subtle);
  color: var(--accent);
}

.login-illustration svg {
  width: 100%;
  height: 100%;
}

.login-center h1 {
  margin: 0 0 10px 0;
  font-size: 26px;
  font-weight: 700;
  color: var(--text-primary);
}

.login-primary {
  margin-top: 24px;
  height: 42px;
  padding: 0 36px;
  border-radius: var(--radius-pill);
  background: var(--text-primary);
  color: #ffffff;
  font-size: 14px;
  font-weight: 600;
}

.login-primary:hover {
  background: #000000;
  transform: translateY(-1px);
}

.login-footer {
  position: absolute;
  bottom: 24px;
  display: flex;
  gap: 20px;
}

.login-footer button {
  font-size: 12px;
  color: var(--text-tertiary);
}

.login-footer button:hover {
  color: var(--text-primary);
  text-decoration: underline;
}

/* ==========================================================================
   工作区主布局 (Workspace & Sidebar)
   ========================================================================== */

.workspace {
  display: none;
  min-height: calc(100vh - 36px);
  background: #ffffff;
}

.workspace.authenticated {
  display: flex;
}

.sidebar {
  width: 240px;
  flex: 0 0 240px;
  min-height: calc(100vh - 36px);
  padding: 16px 12px 14px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
}

.sidebar-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4px 14px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
  margin-bottom: 8px;
}

.brand-block {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.brand-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}

.brand-version {
  font-size: 10px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-light);
  padding: 1px 6px;
  border-radius: var(--radius-pill);
}

.sidebar-tools {
  display: flex;
  align-items: center;
  gap: 4px;
}

.icon-button {
  width: 26px;
  height: 26px;
  border-radius: var(--radius-xs);
  color: var(--text-secondary);
  font-size: 14px;
}

.icon-button:hover {
  background: rgba(0, 0, 0, 0.06);
  color: var(--text-primary);
}

.side-nav {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.nav-item {
  width: 100%;
  height: 36px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  color: var(--text-secondary);
  font-size: 13.5px;
  font-weight: 500;
  text-align: left;
}

.nav-item:hover {
  background: var(--bg-sidebar-hover);
  color: var(--text-primary);
}

.nav-item.active {
  background: #ffffff;
  color: var(--accent);
  font-weight: 600;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04), 0 0 0 1px var(--border-subtle);
}

.nav-icon {
  width: 16px;
  text-align: center;
  font-size: 14px;
}

.more-item {
  position: relative;
}

.more-label {
  margin-left: auto;
  font-size: 11px;
  color: var(--text-tertiary);
}

.more-dot {
  width: 6px;
  height: 6px;
  background: var(--system-red);
  border-radius: 50%;
  margin-left: auto;
  margin-right: -4px;
}

.more-dot + .more-label {
  margin-left: 0;
}

.more-popover {
  position: absolute;
  z-index: 50;
  left: 12px;
  bottom: 56px;
  width: 200px;
  padding: 6px;
  border-radius: var(--radius-lg);
  background: #ffffff;
  box-shadow: var(--shadow-dropdown);
  border: 1px solid var(--border-normal);
}

.more-popover button {
  width: 100%;
  height: 34px;
  border-radius: var(--radius-sm);
  padding: 0 10px;
  justify-content: flex-start;
  gap: 8px;
  color: var(--text-primary);
  font-size: 13px;
}

.more-popover button:hover {
  background: var(--accent-light);
  color: var(--accent);
}

.popover-icon {
  font-size: 14px;
  color: var(--text-tertiary);
}

.empty-tasks {
  margin: auto 0 16px;
  min-height: 120px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  text-align: center;
  padding: 12px;
  background: rgba(255, 255, 255, 0.6);
  border-radius: var(--radius-md);
  border: 1px dashed rgba(0, 0, 0, 0.08);
}

.empty-tasks strong {
  font-size: 13px;
  color: var(--text-secondary);
}

.empty-tasks span {
  font-size: 11px;
  color: var(--text-tertiary);
}

.sidebar-bottom {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.profile-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-primary);
  font-weight: 600;
  font-size: 13px;
}

.avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
}

.bottom-icons {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ==========================================================================
   主内容区域 (Main Content)
   ========================================================================== */

.main-content {
  flex: 1;
  min-width: 0;
  background: #ffffff;
  overflow-y: auto;
}

.view {
  min-height: calc(100vh - 36px);
  padding-bottom: 40px;
}

/* 首页视图 */
.home-toolbar {
  display: flex;
  justify-content: flex-end;
  padding: 16px 28px 0;
}

.reward-pill {
  height: 32px;
  padding: 0 12px;
  border-radius: var(--radius-pill);
  background: #ffffff;
  border: 1px solid var(--border-normal);
  color: var(--text-secondary);
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.reward-pill:hover {
  background: var(--bg-card-subtle);
  color: var(--text-primary);
}

.reward-icon {
  color: var(--accent);
  font-size: 13px;
}

.chevron {
  color: var(--text-quaternary);
  font-size: 14px;
}

.home-inner {
  width: min(760px, calc(100% - 64px));
  margin: 32px auto 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.welcome-title {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.6px;
  color: var(--text-primary);
  text-align: center;
}

.mode-switch {
  display: inline-flex;
  align-items: center;
  background: rgba(0, 0, 0, 0.05);
  border-radius: var(--radius-pill);
  padding: 3px;
  margin-top: 16px;
}

.mode {
  height: 30px;
  padding: 0 16px;
  border-radius: var(--radius-pill);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 13px;
}

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

.quick-chips {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  margin-top: 36px;
  overflow-x: auto;
  padding: 2px 2px 6px;
}

.quick-chips button {
  white-space: nowrap;
  height: 34px;
  padding: 0 14px;
  border-radius: var(--radius-pill);
  background: #ffffff;
  border: 1px solid var(--border-normal);
  color: var(--text-secondary);
  font-size: 12.5px;
  font-weight: 500;
}

.quick-chips button:hover {
  background: var(--accent-light);
  border-color: var(--accent-border);
  color: var(--accent);
}

.quick-chips .chip-next {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  padding: 0;
  border-radius: 50%;
  background: var(--bg-tag);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
  font-size: 16px;
}

.composer-card {
  width: 100%;
  margin-top: 14px;
  border-radius: var(--radius-xl);
  background: #ffffff;
  border: 1px solid var(--border-normal);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.composer-card:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.composer-card textarea {
  width: 100%;
  height: 110px;
  border: none;
  resize: none;
  padding: 16px 18px 8px;
  color: var(--text-primary);
  font-size: 14px;
  background: transparent;
  outline: none;
}

.composer-card textarea::placeholder {
  color: var(--text-quaternary);
}

.composer-controls {
  height: 44px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 14px 0 16px;
  border-bottom: 1px solid var(--border-subtle);
}

.plus-control {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-xs);
  color: var(--text-secondary);
  font-size: 18px;
}

.plus-control:hover {
  background: rgba(0, 0, 0, 0.05);
}

.composer-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.plain-control {
  height: 28px;
  padding: 0 8px;
  border-radius: var(--radius-xs);
  color: var(--text-secondary);
  font-size: 12px;
}

.plain-control:hover {
  background: rgba(0, 0, 0, 0.05);
}

.send-button {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--text-quaternary);
  color: #ffffff;
  font-size: 13px;
}

.send-button.ready {
  background: var(--accent);
}

.send-button.ready:hover {
  background: var(--accent-hover);
}

.composer-footer {
  height: 36px;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 16px;
  background: var(--bg-card-subtle);
  color: var(--text-tertiary);
  font-size: 12px;
}

.footer-control {
  color: var(--text-secondary);
  font-size: 12px;
  padding: 3px 6px;
  border-radius: var(--radius-xs);
}

.footer-control:hover {
  background: rgba(0, 0, 0, 0.05);
}

.home-actions {
  width: 100%;
  margin-top: 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-lg);
  background: var(--accent-light);
  border: 1px solid var(--accent-border);
}

.workbench-link {
  color: var(--accent-hover);
  font-size: 13.5px;
  font-weight: 600;
}

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

.home-hint {
  color: var(--text-secondary);
  font-size: 12px;
}

/* ==========================================================================
   连接器与专家中心 (#connectorsView)
   ========================================================================== */

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

.section-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(0, 0, 0, 0.05);
  padding: 3px;
  border-radius: var(--radius-pill);
}

.section-tab {
  height: 30px;
  padding: 0 16px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

.section-tab.active {
  background: #ffffff;
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

.connector-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.search-box {
  width: 220px;
  height: 34px;
  border: 1px solid var(--border-normal);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  padding: 0 10px;
  background: #ffffff;
}

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

.search-box > span {
  color: var(--text-tertiary);
  font-size: 14px;
  margin-right: 6px;
}

.search-box input {
  border: none;
  outline: none;
  flex: 1;
  font-size: 13px;
  color: var(--text-primary);
}

.clear-search {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--text-quaternary);
  color: #ffffff;
  font-size: 11px;
}

.custom-connector {
  height: 34px;
  padding: 0 14px;
  border-radius: var(--radius-md);
  background: #ffffff;
  border: 1px solid var(--border-normal);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 600;
}

.custom-connector:hover {
  background: var(--bg-card-subtle);
}

.connector-grid {
  padding: 24px 28px;
  display: grid;
  grid-template-columns: repeat(3, minmax(240px, 1fr));
  gap: 16px;
}

.connector-card {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 16px;
  background: #ffffff;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: all 0.15s ease;
}

.connector-card:hover {
  border-color: var(--border-normal);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.connector-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.connector-logo {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 14px;
  font-weight: 700;
}

.connector-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}

.connector-connect {
  margin-left: auto;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--bg-tag);
  color: var(--text-secondary);
  font-size: 15px;
  font-weight: 600;
}

.connector-connect:hover {
  background: var(--accent-light);
  color: var(--accent);
}

.connector-connect.connected {
  background: var(--accent-light);
  color: var(--accent);
  font-size: 13px;
}

.connector-description {
  margin: 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.no-results {
  color: var(--text-tertiary);
  text-align: center;
  padding: 60px 0;
  font-size: 14px;
}

/* ==========================================================================
   工作台创建与管理 (#workbenchView)
   ========================================================================== */

.workbench-header {
  height: 52px;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 28px;
  border-bottom: 1px solid var(--border-subtle);
}

.workbench-brand-mini {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 700;
}

.brand-mark {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
}

.workbench-breadcrumb {
  color: var(--text-tertiary);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.workbench-breadcrumb::before {
  content: "/";
  color: var(--text-quaternary);
}

.workbench-page {
  width: min(1140px, calc(100% - 48px));
  margin: 28px auto 0;
}

.assistant-intro {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 20px;
}

.assistant-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #34d399, #059669);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.assistant-intro .muted {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-tertiary);
}

.assistant-intro p {
  margin: 2px 0 0;
  font-size: 14px;
  color: var(--text-primary);
}

/* 创建表单卡片 */
.workbench-card {
  border: 1px solid var(--border-normal);
  border-radius: var(--radius-xl);
  padding: 24px 28px;
  background: #ffffff;
  box-shadow: var(--shadow-md);
  max-width: 720px;
  margin: 0 auto;
}

.workbench-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-subtle);
}

.card-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  font-weight: 700;
}

.card-title-icon {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  background: var(--accent-light);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
}

.status-tag {
  background: var(--bg-tag);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-field + .form-field {
  margin-top: 16px;
}

.form-field label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

.form-field > input, .role-editor input {
  height: 38px;
  border: 1px solid var(--border-normal);
  border-radius: var(--radius-md);
  padding: 0 12px;
  color: var(--text-primary);
  font-size: 13.5px;
}

.form-field > input:focus, .role-editor input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
  outline: none;
}

.role-editor {
  display: flex;
  align-items: center;
  gap: 10px;
}

.role-editor input:first-child {
  flex: 0 0 130px;
}

.role-editor input:nth-child(2) {
  flex: 1;
}

.add-role {
  height: 38px;
  padding: 0 16px;
  border-radius: var(--radius-md);
  background: var(--bg-tag);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.add-role:hover {
  background: rgba(0, 0, 0, 0.08);
}

.role-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.role-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--accent-light);
  color: var(--accent-hover);
  border: 1px solid var(--accent-border);
  border-radius: var(--radius-md);
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 600;
}

.role-chip small {
  color: var(--text-secondary);
  font-weight: 400;
}

.role-chip button {
  color: var(--accent);
  font-size: 13px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
}

.role-chip button:hover {
  background: rgba(0, 0, 0, 0.08);
}

.workbench-card-foot {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border-subtle);
}

.back-button {
  height: 36px;
  padding: 0 16px;
  border-radius: var(--radius-md);
  background: #ffffff;
  border: 1px solid var(--border-normal);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
}

.back-button:hover {
  background: var(--bg-card-subtle);
  color: var(--text-primary);
}

.create-button {
  height: 36px;
  padding: 0 20px;
  border-radius: var(--radius-md);
  background: var(--accent);
  color: #ffffff;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 2px 8px var(--accent-glow);
}

.create-button:hover:not(:disabled) {
  background: var(--accent-hover);
}

.create-button:disabled {
  background: var(--text-quaternary);
  box-shadow: none;
  cursor: not-allowed;
  opacity: 0.6;
}

/* ==========================================================================
   跨平台字段血缘治理阶段 (#workbenchStage)
   ========================================================================== */

.workbench-stage {
  margin-top: 14px;
}

.workbench-stage-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  background: #ffffff;
  padding: 18px 24px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
}

.workbench-stage-kicker {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  background: var(--accent-light);
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  margin-bottom: 4px;
}

.workbench-stage-head h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

.workbench-stage-head p {
  margin: 4px 0 0;
  color: var(--text-secondary);
  font-size: 12.5px;
}

.workbench-stage-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.workbench-stage-roles {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.stage-role-chip {
  display: inline-flex;
  flex-direction: column;
  gap: 2px;
  border: 1px solid var(--border-normal);
  background: #ffffff;
  border-radius: var(--radius-md);
  padding: 6px 12px;
  box-shadow: var(--shadow-sm);
}

.stage-role-chip strong {
  font-size: 12.5px;
  color: var(--text-primary);
}

.stage-role-chip small {
  font-size: 11px;
  color: var(--text-tertiary);
}

.workbench-stage-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 16px;
  align-items: start;
}

.workbench-stage-main {
  display: grid;
  gap: 16px;
}

.stage-card {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  background: #ffffff;
  box-shadow: var(--shadow-sm);
  padding: 18px 22px;
}

.stage-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.stage-card-head strong {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--text-primary);
}

.stage-card-note {
  color: var(--text-tertiary);
  font-size: 12px;
}

.stage-role-tag {
  display: inline-flex;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  background: var(--accent-light);
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  margin-bottom: 4px;
}

.source-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.source-platform {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  background: var(--bg-card-subtle);
}

.source-platform h4 {
  margin: 0 0 8px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-primary);
}

.chipbox {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.stage-chip {
  padding: 5px 10px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-normal);
  background: #ffffff;
  font-size: 12px;
  cursor: grab;
  user-select: none;
}

.stage-chip:hover {
  border-color: var(--accent-border);
  color: var(--accent);
}

.target-list {
  display: grid;
  gap: 10px;
}

.map-row {
  display: grid;
  grid-template-columns: 160px 1.2fr 1fr;
  gap: 10px;
  align-items: stretch;
}

.target {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  background: var(--bg-card-subtle);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.target b {
  font-size: 12.5px;
}

.map-drop, .transform-drop {
  min-height: 48px;
  border: 1.5px dashed var(--border-normal);
  border-radius: var(--radius-md);
  padding: 6px 10px;
  background: #ffffff;
  display: flex;
  align-items: center;
}

.map-drop.dragover, .transform-drop.dragover {
  border-color: var(--accent);
  background: var(--accent-light);
}

.mapvalue {
  width: 100%;
  font-size: 12px;
  color: var(--accent-hover);
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.transform-chain {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  width: 100%;
}

.op {
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  background: #fffbeb;
  color: #b45309;
  font-size: 11px;
  font-weight: 600;
  cursor: grab;
  border: 1px solid #fde68a;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.op.green {
  background: var(--accent-light);
  color: var(--accent-hover);
  border-color: var(--accent-border);
}

.inline-remove {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.06);
  color: var(--text-secondary);
  font-size: 11px;
}

.inline-remove:hover {
  background: var(--system-red);
  color: #ffffff;
}

.stage-actions-row {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 14px;
}

.stage-preview {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: #0f172a;
  color: #38bdf8;
  font-family: monospace;
  font-size: 11.5px;
  line-height: 1.6;
  min-height: 80px;
  white-space: pre-line;
}

.workbench-stage-side {
  display: grid;
  gap: 14px;
  position: sticky;
  top: 20px;
}

.stage-side-card {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  background: #ffffff;
  padding: 16px;
  box-shadow: var(--shadow-sm);
}

.stage-side-title {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 6px;
}

.stage-side-note {
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-secondary);
}

.wbhead {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
}

.wbavatar {
  width: 24px;
  height: 24px;
  border-radius: var(--radius-xs);
  background: var(--accent);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
}

.wbmsg {
  margin-top: 10px;
  padding: 10px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-card-subtle);
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-secondary);
}

/* ==========================================================================
   模态弹窗与 Toast
   ========================================================================== */

.modal-backdrop, .login-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal, .login-modal {
  width: min(380px, 100%);
  background: #ffffff;
  border-radius: var(--radius-xl);
  padding: 26px 28px;
  box-shadow: var(--shadow-dropdown);
  text-align: center;
  position: relative;
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--bg-tag);
  color: var(--text-secondary);
  font-size: 16px;
}

.modal-close:hover {
  background: rgba(0, 0, 0, 0.1);
}

.modal-icon, .login-modal-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 14px;
  border-radius: 50%;
  background: var(--accent-light);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 700;
}

.modal h2, .login-modal h2 {
  margin: 0 0 6px;
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

.modal p, .login-modal-hint {
  margin: 0 0 20px;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.5;
}

.modal-confirm, .login-submit {
  width: 100%;
  height: 40px;
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: #ffffff;
  font-size: 13.5px;
  font-weight: 600;
}

.modal-confirm:hover, .login-submit:hover {
  background: var(--accent-hover);
}

.login-field {
  display: flex;
  flex-direction: column;
  text-align: left;
  gap: 6px;
  margin-bottom: 12px;
}

.login-field span {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
}

.login-field input {
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--border-normal);
  border-radius: var(--radius-md);
  font-size: 13px;
  outline: none;
}

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

.login-error {
  min-height: 18px;
  color: var(--system-red);
  font-size: 12px;
  text-align: left;
  margin-bottom: 6px;
}

.toast {
  position: fixed;
  z-index: 2000;
  left: 50%;
  bottom: 30px;
  transform: translate(-50%, 20px);
  background: rgba(29, 29, 31, 0.9);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  color: #ffffff;
  padding: 8px 18px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-dropdown);
  opacity: 0;
  pointer-events: none;
  transition: all 0.2s ease;
}

.toast.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.placeholder-view {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: calc(100vh - 36px);
}

/* 第二阶段经营创值面板 */
.phase-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 14px 0 10px;
  padding: 4px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  background: var(--bg-card-subtle);
  width: fit-content;
}
.phase-tab {
  border: 0;
  border-radius: var(--radius-pill);
  padding: 8px 14px;
  color: var(--text-secondary);
  background: transparent;
  font-size: 12px;
  cursor: pointer;
}
.phase-tab.active { color: var(--accent-hover); background: #ffffff; box-shadow: var(--shadow-card); font-weight: 700; }
.phase-tab.upcoming { cursor: not-allowed; opacity: .55; padding-right: 12px; }
.phase2-overview { margin: 0 0 14px; border: 1px solid var(--accent-border); border-radius: var(--radius-lg); background: linear-gradient(135deg, #f2f7ff, #ffffff); padding: 14px; }
.phase2-overview-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.phase2-overview-head strong { display: block; font-size: 15px; }
.phase2-overview-head small { display: block; margin-top: 4px; color: var(--text-secondary); font-size: 12px; }
.phase2-active-task { color: var(--accent-hover); font-size: 12px; white-space: nowrap; }
.phase2-kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; margin-top: 12px; }
.phase2-kpis > div { padding: 9px 10px; border-radius: var(--radius-md); background: rgba(255,255,255,.9); border: 1px solid var(--border-subtle); }
.phase2-kpis span, .phase2-kpis b { display: block; }
.phase2-kpis span { color: var(--text-secondary); font-size: 11px; }
.phase2-kpis b { margin-top: 4px; color: var(--text-primary); font-size: 13px; }
.phase2-task-strip { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.phase2-task-pill { display: inline-flex; padding: 4px 8px; border-radius: var(--radius-pill); background: var(--bg-tag); color: var(--text-secondary); font-size: 11px; }
.phase2-section { margin-top: 12px; padding: 12px; border: 1px solid var(--border-subtle); border-radius: var(--radius-md); background: #fff; }
.phase2-section-title { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 9px; }
.phase2-section-title strong { font-size: 13px; }
.phase2-section-title span { color: var(--accent-hover); font-size: 11px; }
.phase2-section p { margin: 6px 0; color: var(--text-secondary); font-size: 12px; line-height: 1.5; }
.phase2-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px; margin: 8px 0; }
.phase2-form-grid label { display: flex; flex-direction: column; gap: 4px; color: var(--text-secondary); font-size: 11px; }
.phase2-form-grid input { min-height: 30px; padding: 0 8px; border: 1px solid var(--border-normal); border-radius: var(--radius-sm); font-size: 12px; }
.phase2-result { margin: 8px 0; padding: 8px 10px; border-radius: var(--radius-sm); background: var(--bg-card-subtle); color: var(--text-secondary); font-size: 12px; }
.phase2-plan-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 8px 0; }
.phase2-plan-grid > div { display: flex; flex-direction: column; gap: 4px; padding: 8px; border: 1px solid var(--border-subtle); border-radius: var(--radius-sm); }
.phase2-plan-grid span { color: var(--text-secondary); font-size: 11px; }
.phase2-plan-grid strong { color: var(--text-primary); font-size: 13px; }
@media (max-width: 900px) { .phase2-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 600px) { .phase2-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } .phase2-form-grid, .phase2-plan-grid { grid-template-columns: 1fr; } .phase2-overview-head { flex-direction: column; } }

.placeholder-card {
  text-align: center;
  max-width: 360px;
}

.placeholder-icon {
  color: var(--accent);
  font-size: 46px;
}

.placeholder-card h2 {
  font-size: 18px;
  margin: 12px 0 6px;
}

.placeholder-card p {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 0 0 16px;
}

.placeholder-card button {
  height: 34px;
  padding: 0 16px;
  border-radius: var(--radius-pill);
  background: var(--accent-light);
  border: 1px solid var(--accent-border);
  color: var(--accent-hover);
  font-weight: 600;
}

/* ==========================================================================
   四岗实时协同工作区与财务组件样式 (#roleWorkspace)
   ========================================================================== */

.role-workspace {
  margin-top: 24px;
  display: grid;
  gap: 16px;
}

/* 未创建/未加入工作台时只保留加入入口，避免展示没有上下文的空岗位和阶段状态。 */
.role-workspace.prejoin .collab-statusbar,
.role-workspace.prejoin .phase-tabs,
.role-workspace.prejoin #phase2Overview,
.role-workspace.prejoin .collab-members,
.role-workspace.prejoin .role-card-grid,
.role-workspace.prejoin .role-panels,
.role-workspace.prejoin .activity-card {
  display: none;
}

.collab-statusbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 18px;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-normal);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.collab-room {
  margin-left: 12px;
  color: var(--text-tertiary);
  font-size: 12.5px;
}

.collab-room code {
  color: var(--accent-hover);
  background: var(--accent-light);
  padding: 2px 6px;
  border-radius: var(--radius-xs);
  font-family: monospace;
}

.collab-status-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--text-secondary);
  font-size: 12.5px;
}

.status-dot {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
}

.status-dot::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-quaternary);
}

.status-dot.connected::before {
  background: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

.status-dot.connecting::before, .status-dot.reconnecting::before {
  background: var(--system-orange);
}

/* 加入表单 */
.collab-join-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px;
  padding: 14px 18px;
  background: #ffffff;
  border: 1px solid var(--border-normal);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.collab-join-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
}

.collab-join-form input {
  height: 36px;
  min-width: 180px;
  border: 1px solid var(--border-normal);
  border-radius: var(--radius-md);
  padding: 0 10px;
  font-size: 13px;
  outline: none;
}

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

.collab-members {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-height: 28px;
}

.member-pill {
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  background: var(--accent-light);
  color: var(--accent-hover);
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.member-pill.offline {
  opacity: 0.5;
  background: var(--bg-tag);
  color: var(--text-tertiary);
}

/* 岗位卡片网格导航 */
.role-card-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.role-card {
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 84px;
  padding: 14px 16px;
  border: 1px solid var(--border-normal);
  border-radius: var(--radius-lg);
  background: #ffffff;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: all 0.15s ease;
}

.role-card:hover {
  border-color: var(--accent-border);
  transform: translateY(-2px);
}

.role-card.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow);
  background: radial-gradient(circle at 100% 0%, var(--accent-light) 0%, #ffffff 80%);
}

.role-card strong {
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 700;
}

.role-card small {
  color: var(--text-tertiary);
  font-size: 11.5px;
}

.role-card em {
  margin-top: auto;
  color: var(--accent-hover);
  font-size: 11.5px;
  font-weight: 600;
  font-style: normal;
}

/* 岗位面板卡片 */
.role-panel {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  background: #ffffff;
  padding: 20px 24px;
  box-shadow: var(--shadow-sm);
}

.role-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-subtle);
}

.role-panel-head h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.role-progress {
  padding: 2px 10px;
  border-radius: var(--radius-pill);
  background: var(--bg-tag);
  color: var(--text-secondary);
  font-size: 11.5px;
  font-weight: 600;
}

.role-claim {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 16px;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-subtle);
  font-size: 12.5px;
  color: var(--text-secondary);
}

.boundary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.boundary-grid label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
}

.boundary-grid input {
  height: 36px;
  border: 1px solid var(--border-normal);
  border-radius: var(--radius-md);
  padding: 0 10px;
  font-size: 13px;
  outline: none;
}

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

.indicator-list, .metric-chips, .mapping-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 14px 0;
}

.indicator-list strong {
  font-size: 12.5px;
  color: var(--text-primary);
  margin-right: 4px;
}

.indicator-list label, .metric-chips span {
  padding: 5px 10px;
  border-radius: var(--radius-pill);
  background: var(--bg-tag);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
}

.panel-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
}

.panel-note {
  color: var(--text-tertiary);
  font-size: 12px;
  margin-top: 10px;
}

/* 成本会计岗勾稽规则行 */
.rule-list {
  display: grid;
  gap: 8px;
}

.rule-row {
  display: grid;
  grid-template-columns: 140px 1fr 100px auto;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-card-subtle);
}

.rule-row span {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-primary);
}

.rule-row input {
  height: 32px;
  border: 1px solid var(--border-normal);
  border-radius: var(--radius-sm);
  padding: 0 8px;
  font-size: 12px;
  outline: none;
}

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

.validation-results {
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: #ffffff;
  display: grid;
  gap: 6px;
  font-size: 12px;
}

.validation-results strong {
  font-size: 12.5px;
  color: var(--text-primary);
}

.validation-row {
  display: grid;
  grid-template-columns: 1.4fr 1fr auto;
  gap: 8px;
  align-items: center;
  padding-top: 6px;
  border-top: 1px solid var(--border-subtle);
}

.validation-row .pass {
  color: var(--accent);
  font-weight: 700;
}

.validation-row .fail {
  color: var(--system-red);
  font-weight: 700;
}

/* 活动日志卡片 */
.activity-card {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  background: #ffffff;
  padding: 16px 20px;
  box-shadow: var(--shadow-sm);
}

.activity-log {
  display: grid;
  gap: 6px;
  max-height: 140px;
  overflow-y: auto;
  margin-top: 8px;
}

.activity-item {
  font-size: 12px;
  color: var(--text-secondary);
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.activity-item span {
  color: var(--text-quaternary);
  font-family: monospace;
  font-size: 11px;
}
