/*
 * 组织驾驶舱（P0）。
 *
 * 只服务 `/cockpit` 的真实读模型：中性纸面、发丝线、单一强调色。这里没有渐变、
 * 玻璃或大圆角；数据密度靠表格与对齐，而不是卡片数量。所有颜色都限定在
 * `.cockpit` 作用域内，避免影响组织控制台的其它页签。
 */

.cockpit {
  --ck-ink: #1d1d1b;
  --ck-ink-2: #5d5d58;
  --ck-ink-3: #8b8b85;
  --ck-ink-4: #aaa9a2;
  --ck-hair: #e5e4df;
  --ck-hair-soft: #efeee9;
  --ck-surface: #fff;
  --ck-accent: #5b4bc7;
  --ck-good: #1e7a4e;
  --ck-warn: #a4661b;
  --ck-bad: #a63d35;
  --ck-blue: #2c5f9e;
  display: grid;
  gap: 14px;
  min-width: 0;
  color: var(--ck-ink);
}

.cockpit * { box-sizing: border-box; }

/* ---------------------------------------------------------------- toolbar */
.ck-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 2px 0 0;
}
.ck-toolbar-copy { min-width: 0; }
.ck-sync {
  display: flex; align-items: center; gap: 6px;
  color: var(--ck-ink-3); font-size: 10.5px;
}
.ck-live {
  width: 5px; height: 5px; border-radius: 50%; background: var(--ck-good); flex: none;
}
.ck-toolbar-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.ck-seg {
  display: inline-flex; gap: 1px; padding: 2px;
  border: 1px solid var(--ck-hair); border-radius: 6px; background: #f5f5f2;
}
body.is-chat .org-main .ck-seg button.ck-btn {
  height: 24px; min-height: 0; padding: 0 9px;
  border: 0; border-radius: 4px; background: transparent;
  color: var(--ck-ink-3); font-size: 10.5px; font-weight: 500;
  box-shadow: none;
}
body.is-chat .org-main .ck-seg button.ck-btn[aria-pressed="true"] {
  background: var(--ck-surface); color: var(--ck-ink);
  box-shadow: 0 1px 2px rgba(20, 20, 18, .06); font-weight: 550;
}
body.is-chat .org-main button.ck-refresh {
  height: 29px; min-height: 0; padding: 0 11px;
  border: 1px solid var(--ck-hair); border-radius: 6px;
  background: var(--ck-surface); color: var(--ck-ink-2);
  font-size: 10.5px; font-weight: 500;
}
body.is-chat .org-main button.ck-refresh:hover { border-color: #d2d1c9; }

/* ---------------------------------------------------------------- kpis */
.ck-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.ck-kpi {
  display: flex; flex-direction: column; min-width: 0;
  padding: 14px 16px 13px;
  border: 1px solid var(--ck-hair); border-radius: 10px; background: var(--ck-surface);
}
.ck-kpi-label { color: var(--ck-ink-3); font-size: 10.5px; }
.ck-kpi-value {
  display: flex; align-items: baseline; gap: 3px;
  margin: 6px 0 8px;
  font-size: 27px; font-weight: 640; letter-spacing: -.04em; line-height: 1.05;
  font-variant-numeric: tabular-nums;
}
.ck-kpi-value small { font-size: 11px; font-weight: 500; letter-spacing: 0; color: var(--ck-ink-4); }
.ck-kpi-value.accent { color: var(--ck-accent); }
.ck-kpi-note { margin-top: 7px; color: var(--ck-ink-4); font-size: 10px; line-height: 1.55; }
.ck-kpi-note b { color: var(--ck-warn); font-weight: 560; }

.ck-bar { display: flex; gap: 2px; width: 100%; height: 3px; }
.ck-bar i { flex: 1; height: 3px; border-radius: 2px; background: #ecebe6; }
.ck-bar i.on { background: var(--ck-accent); }

/* ---------------------------------------------------------------- cards/grid */
.ck-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 12px; }
.ck-span-8 { grid-column: span 8; }
.ck-span-7 { grid-column: span 7; }
.ck-span-5 { grid-column: span 5; }
.ck-span-4 { grid-column: span 4; }
.ck-card {
  min-width: 0; padding: 15px 17px 16px;
  border: 1px solid var(--ck-hair); border-radius: 10px; background: var(--ck-surface);
}
.ck-card-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px; margin-bottom: 12px;
}
body.is-chat .org-main .ck-card-head h3 {
  margin: 0; font-size: 12.5px; font-weight: 620; letter-spacing: -.01em; color: var(--ck-ink);
}
.ck-card-head p { margin: 3px 0 0; color: var(--ck-ink-4); font-size: 10px; line-height: 1.6; }
.ck-tag {
  display: inline-flex; align-items: center; height: 19px; padding: 0 7px;
  border: 1px solid var(--ck-hair); border-radius: 4px;
  color: var(--ck-ink-3); font-size: 9px; white-space: nowrap;
}

/* ---------------------------------------------------------------- chart */
.ck-chart-wrap { min-width: 0; }
.ck-chart { display: block; width: 100%; height: auto; min-height: 170px; overflow: visible; }
.ck-legend {
  display: flex; align-items: center; gap: 14px;
  margin-top: 8px; padding-top: 9px;
  border-top: 1px solid var(--ck-hair-soft);
  color: var(--ck-ink-4); font-size: 9.5px;
}
.ck-legend span { display: flex; align-items: center; gap: 5px; }
.ck-legend-line { width: 13px; height: 2px; border-radius: 2px; background: var(--ck-accent); }
.ck-legend-bar { width: 7px; height: 7px; border-radius: 2px; background: #dcdcd5; }

/* ---------------------------------------------------------------- risks */
.ck-risks { list-style: none; margin: 0; padding: 0; }
.ck-risks li {
  display: grid; grid-template-columns: 7px minmax(0, 1fr);
  gap: 9px; align-items: start; padding: 9px 0;
  border-top: 1px solid var(--ck-hair-soft);
}
.ck-risks li:first-child { border-top: 0; padding-top: 0; }
.ck-dot { width: 6px; height: 6px; margin-top: 5px; border-radius: 50%; background: var(--ck-ink-4); }
.ck-dot.bad { background: var(--ck-bad); }
.ck-dot.warn { background: var(--ck-warn); }
.ck-dot.blue { background: var(--ck-blue); }
.ck-risks strong { display: block; font-size: 11px; font-weight: 560; color: var(--ck-ink-2); }
.ck-risks span { display: block; margin-top: 1px; color: var(--ck-ink-4); font-size: 9.5px; line-height: 1.5; }

/* ---------------------------------------------------------------- matrix */
.ck-matrix { margin-top: 0; }
.ck-table-wrap { overflow-x: auto; max-width: 100%; }
.ck-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.ck-table th {
  padding: 0 9px 8px; border-bottom: 1px solid var(--ck-hair);
  color: var(--ck-ink-4); font-size: 9px; font-weight: 550; text-align: left; white-space: nowrap;
}
.ck-table th:first-child, .ck-table td:first-child { padding-left: 0; }
.ck-table th:last-child, .ck-table td:last-child { padding-right: 0; }
.ck-table th:nth-child(1) { width: 23%; }
.ck-table th:nth-child(2) { width: 28%; }
.ck-table th:nth-child(3) { width: 20%; }
.ck-table th:nth-child(4) { width: 10%; }
.ck-table th:nth-child(5) { width: 7%; }
.ck-table th:nth-child(6) { width: 12%; }
.ck-table td {
  padding: 9px; border-bottom: 1px solid var(--ck-hair-soft);
  font-size: 11px; color: var(--ck-ink-2); white-space: nowrap;
}
.ck-table tbody tr:last-child td { border-bottom: 0; }
.ck-table th.num, .ck-table td.num { text-align: right; }
.ck-person { display: flex; align-items: center; gap: 8px; min-width: 0; }
.ck-avatar {
  display: grid; place-items: center; flex: none;
  width: 23px; height: 23px; border-radius: 50%;
  background: #ecebe6; color: #6a6a63;
  font-style: normal; font-size: 9px; font-weight: 600;
}
.ck-avatar.agent { border-radius: 6px; background: #efecfb; color: var(--ck-accent); }
.ck-person-copy { display: grid; gap: 1px; min-width: 0; }
.ck-person-copy strong { overflow: hidden; text-overflow: ellipsis; font-size: 11px; font-weight: 570; color: var(--ck-ink); }
.ck-person-copy em { color: var(--ck-ink-4); font-style: normal; font-size: 8.5px; }
.ck-task { display: grid; gap: 1px; min-width: 0; }
.ck-task b { overflow: hidden; text-overflow: ellipsis; font-size: 11px; font-weight: 520; color: var(--ck-ink-2); }
.ck-task em { color: var(--ck-ink-4); font-style: normal; font-size: 8.5px; }
.ck-progress { display: flex; align-items: center; gap: 7px; }
.ck-progress .ck-bar { width: 58px; flex: none; }
.ck-progress em { color: var(--ck-ink-4); font-style: normal; font-size: 9px; }
.ck-money { color: var(--ck-ink); font-weight: 560; }
.ck-muted { color: var(--ck-ink-4); }
.ck-status { display: inline-flex; align-items: center; gap: 5px; color: var(--ck-ink-4); font-size: 10px; }
.ck-status::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.ck-status.run { color: var(--ck-good); }
.ck-status.wait { color: var(--ck-warn); }
.ck-status.block { color: var(--ck-bad); }
.ck-status.fail { color: var(--ck-bad); }
.ck-status.done { color: var(--ck-ink-3); }
.ck-status.idle { color: var(--ck-ink-4); }

/* ---------------------------------------------------------------- lists */
.ck-files, .ck-events { list-style: none; margin: 0; padding: 0; }
.ck-files li {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 0; border-top: 1px solid var(--ck-hair-soft);
}
.ck-files li:first-child { border-top: 0; padding-top: 0; }
.ck-file-icon {
  display: grid; place-items: center; flex: none;
  width: 25px; height: 25px; border-radius: 5px;
  background: #f2f1ec; color: #7c7b73; font-size: 6.5px; font-weight: 650;
}
.ck-file-copy { flex: 1; min-width: 0; display: grid; gap: 1px; }
.ck-file-copy strong { overflow: hidden; text-overflow: ellipsis; font-size: 10.5px; font-weight: 550; }
.ck-file-copy em { color: var(--ck-ink-4); font-style: normal; font-size: 8.5px; }
.ck-files time { color: var(--ck-ink-4); font-size: 8.5px; white-space: nowrap; }
.ck-events li {
  display: grid; grid-template-columns: 34px minmax(0, 1fr);
  gap: 8px; padding: 7px 0; border-top: 1px solid var(--ck-hair-soft);
}
.ck-events li:first-child { border-top: 0; padding-top: 0; }
.ck-events time { color: var(--ck-ink-4); font-size: 9px; font-variant-numeric: tabular-nums; }
.ck-event-text { color: var(--ck-ink-2); font-size: 10.5px; line-height: 1.55; }
.ck-event-text.warn { color: var(--ck-warn); }
.ck-event-text.bad { color: var(--ck-bad); }

/* ---------------------------------------------------------------- empty/start */
.ck-empty {
  display: grid; place-items: center; gap: 6px;
  min-height: 150px; padding: 16px; text-align: center;
  border: 1px dashed #e4e2db; border-radius: 8px;
  color: var(--ck-ink-3); font-size: 10.5px; line-height: 1.7;
}
.ck-empty strong { color: var(--ck-ink-2); font-size: 11.5px; font-weight: 570; }
.ck-empty-small { min-height: 92px; }
.ck-start { padding-bottom: 18px; }
.ck-steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; margin-top: 2px; }
.ck-step {
  padding: 2px 20px; border-left: 1px solid var(--ck-hair-soft);
}
.ck-step:first-child { padding-left: 0; border-left: 0; }
.ck-step:last-child { padding-right: 0; }
.ck-step-index { display: block; margin-bottom: 8px; color: #c7c4ba; font-size: 16px; font-weight: 620; line-height: 1; }
.ck-step strong { display: block; font-size: 11.5px; font-weight: 590; color: var(--ck-ink); }
.ck-step p { margin: 5px 0 0; color: var(--ck-ink-4); font-size: 10px; line-height: 1.75; }
.ck-hint { margin: 14px 0 0; padding-top: 11px; border-top: 1px solid var(--ck-hair-soft); color: var(--ck-ink-4); font-size: 9.5px; }

/* ---------------------------------------------------------------- states */
.ck-skeleton {
  min-height: 86px;
  border-color: var(--ck-hair-soft);
  background: linear-gradient(180deg, #fbfbf9, #f7f7f4);
}
.ck-skeleton-tall { min-height: 260px; }
.ck-error {
  display: grid; gap: 6px; padding: 18px 18px;
  border: 1px solid #ead9d6; border-radius: 10px; background: #fdf7f6;
  color: var(--ck-bad); font-size: 11px;
}
.ck-error strong { font-size: 12.5px; font-weight: 600; }
.ck-error span { color: #8a5c56; }
.ck-foot { margin: 0; color: var(--ck-ink-4); font-size: 9.5px; line-height: 1.7; }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 1100px) {
  .ck-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ck-span-8, .ck-span-7, .ck-span-5, .ck-span-4 { grid-column: 1 / -1; }
}
@media (max-width: 700px) {
  .ck-toolbar { align-items: flex-start; flex-direction: column; gap: 10px; }
  .ck-toolbar-actions { width: 100%; justify-content: space-between; }
  .ck-table { min-width: 620px; }
  .ck-steps { grid-template-columns: minmax(0, 1fr); }
  .ck-step { padding: 14px 0; border-left: 0; border-top: 1px solid var(--ck-hair-soft); }
  .ck-step:first-child { padding-top: 2px; border-top: 0; }
}
@media (max-width: 460px) {
  .ck-kpis { gap: 8px; }
  .ck-kpi { padding: 12px 12px 11px; }
  .ck-kpi-value { font-size: 23px; }
  .ck-card { padding: 13px 13px 14px; }
}

/* ------------------------------------------------------- drill-down drawer
 * The drawer is the evidence behind a number: one task, its Runs, settled
 * charges, files and events. It lives inside `.cockpit`, so it inherits the
 * neutral paper palette instead of introducing a second theme.
 */
.ck-link {
  display: inline; padding: 0; border: 0; background: none;
  color: var(--ck-ink); font: inherit; font-weight: 570; text-align: left;
  cursor: pointer; text-decoration: underline;
  text-decoration-color: #d5d3c9; text-underline-offset: 3px;
}
.ck-link:hover { text-decoration-color: var(--ck-accent); color: var(--ck-accent); }
.ck-mini-link {
  padding: 0; margin-left: 6px; border: 0; background: none;
  color: var(--ck-ink-3); font-size: 9.5px; cursor: pointer;
  text-decoration: underline; text-underline-offset: 3px;
}
.ck-mini-link:hover { color: var(--ck-accent); }
.ck-file-link { color: var(--ck-ink); font-size: 10.5px; font-weight: 550; text-decoration: none; }
.ck-file-link:hover { color: var(--ck-accent); text-decoration: underline; }

.ck-drawer-backdrop {
  position: fixed; inset: 0; z-index: 90;
  display: flex; justify-content: flex-end;
  background: rgba(22, 22, 20, .28);
}
.ck-drawer {
  display: flex; flex-direction: column; gap: 14px;
  width: min(560px, 100%); height: 100%; overflow-y: auto;
  padding: 20px 22px 26px;
  background: var(--ck-surface); border-left: 1px solid var(--ck-hair);
  box-shadow: -18px 0 44px rgba(24, 24, 21, .14);
}
.ck-drawer-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
  padding-bottom: 13px; border-bottom: 1px solid var(--ck-hair-soft);
}
.ck-drawer-kicker {
  display: block; margin-bottom: 5px;
  color: var(--ck-ink-4); font-size: 9.5px; letter-spacing: .06em; text-transform: uppercase;
}
.ck-drawer-head h3 { margin: 0; color: var(--ck-ink); font-size: 16px; font-weight: 640; letter-spacing: -.02em; line-height: 1.35; }
.ck-drawer-close {
  flex: none; height: 28px; min-height: 0; padding: 0 10px;
  border: 1px solid var(--ck-hair); border-radius: 6px; background: #fbfbf8;
  color: var(--ck-ink-2); font-size: 10.5px; cursor: pointer;
}
.ck-drawer-close:hover { border-color: #d2d1c9; }
.ck-drawer-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; color: var(--ck-ink-3); font-size: 10.5px; }
.ck-drawer-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.ck-drawer-metrics > div {
  display: flex; flex-direction: column; gap: 5px; min-width: 0;
  padding: 11px 12px; border: 1px solid var(--ck-hair); border-radius: 8px;
}
.ck-drawer-metrics span { color: var(--ck-ink-3); font-size: 9.5px; }
.ck-drawer-metrics strong {
  color: var(--ck-ink); font-size: 13px; font-weight: 600; letter-spacing: -.01em;
  overflow-wrap: anywhere; font-variant-numeric: tabular-nums;
}
.ck-drawer-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.ck-drawer-actions button { min-height: 32px; padding: 0 14px; border-radius: 7px; font-size: 11px; font-weight: 550; cursor: pointer; }
.ck-drawer-actions button:disabled { opacity: .55; cursor: default; }
.ck-drawer-actions .ck-primary { border: 1px solid var(--ck-accent); background: var(--ck-accent); color: #fff; }
.ck-drawer-actions .ck-secondary { border: 1px solid var(--ck-hair); background: #fbfbf8; color: var(--ck-ink-2); }
.ck-note {
  flex: 1 1 220px; min-width: 160px; height: 32px; padding: 0 10px;
  border: 1px solid var(--ck-hair); border-radius: 7px; background: #fff;
  color: var(--ck-ink); font-size: 11px;
}
.ck-note:focus { outline: 2px solid #d9d4f4; outline-offset: 1px; border-color: var(--ck-accent); }
.ck-drawer-accepted { margin: 0; color: var(--ck-ink-3); font-size: 10px; line-height: 1.7; }
.ck-drawer-error { margin: 0; color: var(--ck-bad); font-size: 10.5px; }
.ck-drawer-section { padding-top: 13px; border-top: 1px solid var(--ck-hair-soft); }
.ck-drawer-section h4 { margin: 0 0 4px; color: var(--ck-ink); font-size: 11.5px; font-weight: 600; }
.ck-drawer-note { margin: 0 0 8px; color: var(--ck-ink-4); font-size: 9.5px; line-height: 1.65; }
.ck-drawer-empty { margin: 4px 0 0; color: var(--ck-ink-4); font-size: 10px; }
.ck-drawer-list { display: grid; gap: 7px; margin: 8px 0 0; padding: 0; list-style: none; }
.ck-drawer-list li {
  display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px;
  color: var(--ck-ink-2); font-size: 10.5px; line-height: 1.5;
}
.ck-drawer-list li time { color: var(--ck-ink-4); font-size: 9px; font-variant-numeric: tabular-nums; }
.ck-drawer-run-time { color: var(--ck-ink-4); font-size: 9.5px; font-variant-numeric: tabular-nums; }
.ck-drawer-run-cost { margin-left: auto; color: var(--ck-ink); font-variant-numeric: tabular-nums; }

@media (max-width: 720px) {
  .ck-drawer { width: 100%; padding: 16px 15px 22px; }
  .ck-drawer-metrics { grid-template-columns: minmax(0, 1fr); }
}

/* The drawer is appended to <body> so no page stacking context can paint over it. */
.ck-drawer-stage {
  display: block; position: fixed; inset: 0; z-index: 200;
  pointer-events: none;
}
.ck-drawer-stage > .ck-drawer-backdrop { pointer-events: auto; }

/* Member requests inside the task drawer. */
.ck-request-list li { align-items: flex-start; }
.ck-request-state { flex: none; margin-top: 1px; color: var(--ck-warn); font-size: 9.5px; }
.ck-request-state.resolved { color: var(--ck-good); }
.ck-request-body { flex: 1 1 220px; overflow-wrap: anywhere; color: var(--ck-ink-2); }
.ck-request-body strong { color: var(--ck-ink); font-weight: 600; }
.ck-request em {
  flex-basis: 100%; color: var(--ck-good);
  font-size: 9.5px; font-style: normal; line-height: 1.6;
}
.ck-request time { margin-left: auto; }
.ck-request-resolve {
  min-height: 24px; padding: 0 9px;
  border: 1px solid var(--ck-hair); border-radius: 6px;
  background: #fbfbf8; color: var(--ck-ink-2); font-size: 9.5px; cursor: pointer;
}
.ck-request-note { width: 100%; margin-top: 8px; }
