:root {
  --paper: var(--bg);
  --surface: var(--panel);
  --card: var(--panel);
  --teal: #0b6f69;
  --teal-dark: #084d4a;
  --teal-soft: #dcecea;
  --lime: #b9d968;
  --amber: #d78a28;
  --red: #b94638;
  --blue: #3d6c91;
}

* { box-sizing: border-box; }
html { min-height: 100%; }
body { margin: 0; min-width: 320px; }
.app-header:has(.enterprise-global-search) .crumb { flex: 1 0 auto; }
.app-header .enterprise-global-search {
  position: relative;
  flex: 1 1 320px;
  max-width: 440px;
  min-width: 220px;
}
.app-header .enterprise-search-row { display: flex; min-width: 0; }
.app-header .enterprise-search-row input {
  width: 100%;
  height: 36px;
  margin: 0;
  padding: 0 28px 0 11px;
  border: 1px solid var(--line, #dbe3ea);
  border-radius: 9px;
  background: var(--panel, #fff);
  color: var(--ink, #0f172a);
  box-shadow: none;
}
.app-header .enterprise-search-kbd {
  position: absolute;
  right: 9px;
  top: 8px;
  color: var(--muted, #64748b);
  font: 11px/20px ui-monospace, SFMono-Regular, Menlo, monospace;
  pointer-events: none;
}
.app-header .enterprise-search-results {
  position: absolute;
  z-index: 80;
  left: 0;
  right: 0;
  top: calc(100% + 7px);
  max-height: min(64vh, 520px);
  overflow: auto;
  border: 1px solid var(--line, #dbe3ea);
  border-radius: 12px;
  background: var(--panel, #fff);
  box-shadow: 0 18px 45px rgba(15, 23, 42, .18);
  padding: 6px;
}
.app-header .enterprise-search-status { padding: 9px 10px; color: var(--muted, #64748b); font-size: 12px; }
.app-header .enterprise-search-item {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  padding: 9px 10px;
  text-align: left;
  cursor: pointer;
}
.app-header .enterprise-search-item:hover,
.app-header .enterprise-search-item[aria-selected="true"] { background: rgba(15, 118, 110, .09); }
.app-header .enterprise-search-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 650; }
.app-header .enterprise-search-meta { color: var(--muted, #64748b); font-size: 12px; }
.app-header .enterprise-search-type { grid-row: 1 / span 2; grid-column: 2; align-self: center; }
.app-header .enterprise-sr-status {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}
.page-toolbar:not(.filters) { display: flex; align-items: center; justify-content: space-between; gap: 12px 16px; flex-wrap: wrap; min-height: 56px; }
.page-note { color: var(--muted); font-size: 13px; }
.page-toolbar label.page-note { display: flex; align-items: center; gap: 8px; }
.page-toolbar select { width: auto; min-width: 140px; }
button, input, select, textarea { font: inherit; color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
.hidden { display: none !important; }

.boot { position: fixed; inset: 0; z-index: 100; display: grid; place-content: center; gap: 16px; color: var(--muted); background: var(--paper); text-align: center; }
.boot span { width: 34px; height: 34px; justify-self: center; border: 3px solid var(--teal-soft); border-top-color: var(--teal); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.icon-button { position: relative; }
.icon-button em { position: absolute; top: -5px; right: -5px; min-width: 20px; height: 20px; padding: 0 5px; border: 2px solid #102a2a; border-radius: 99px; color: white; background: var(--red); font: 700 12px/16px sans-serif; }
.eyebrow, .panel-title small, .dialog-head small, .drawer-head small { margin: 0; color: var(--muted); font-size: var(--fs-xs); font-weight: var(--fw-sb); letter-spacing: 0; }

.primary, .secondary, .ghost { border-radius: 8px; padding: 8px 14px; font-size: var(--fs-sm); font-weight: var(--fw-sb); line-height: 1.4; cursor: pointer; }
.primary { border: 0; color: #fff; background: var(--brand); }
.primary:hover { filter: brightness(0.97); }
.secondary { border: 1px solid var(--line); color: var(--ink); background: var(--btn); }
.ghost { border: 1px solid var(--line); color: var(--ink); background: transparent; }
.ghost:hover, .secondary:hover { filter: brightness(0.97); }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid rgba(11,111,105,.2); outline-offset: 2px; }

.panel { background: var(--panel); }

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 16px; padding: 13px 15px; box-shadow: none; }
input, select, textarea { border: 1px solid var(--line); border-radius: 8px; color: var(--ink); background: var(--input); }
input:not([type="checkbox"]):not([type="radio"]), select { height: 36px; padding: 0 11px; }
textarea { padding: 10px 11px; resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--soft); }

.stack-body { padding: 16px; }
.stack-body > .domain-grid,
.stack-body > .split-grid { margin-bottom: 16px; }
.dash-board { display: grid; gap: 16px; }
.dash-board > .domain-grid,
.dash-board > .split-grid { margin-bottom: 0; }
#view-quality > .dash-board { margin-top: 18px; }
.page-toolbar label.page-note { display: flex; align-items: center; gap: 8px; }
.page-toolbar select { width: auto; min-width: 140px; }

/* TASK-UX-1：我的任务页对齐后台通用组件（.card 指标卡 / 下划线页签 / 通用筛选条 / 表格行），颜色全部走 token，暗色可用 */
.task-kpis { grid-template-columns: repeat(5, minmax(0, 1fr)); margin-bottom: 16px; }
.task-kpi { display: block; width: 100%; color: var(--ink); text-align: left; font: inherit; cursor: pointer; transition: border-color .15s ease, box-shadow .15s ease; }
.task-kpi:hover { border-color: var(--brand-line); }
.task-kpi.active { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand) inset, var(--shadow); }
.task-kpi.is-danger.has-value .v { color: var(--danger-ink); }
.task-kpi-sub { margin-top: 4px; color: var(--muted); font-size: var(--fs-xs); line-height: 1.4; }

.task-panel { display: flex; flex-direction: column; min-height: 360px; }
.task-tabs { display: flex; flex-wrap: wrap; padding: 0 12px; border-bottom: 1px solid var(--line); }
.task-tab { margin-bottom: -1px; padding: 11px 12px 10px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--muted); font-size: var(--fs-sm); font-weight: var(--fw-md); line-height: 1.4; }
.task-tab:hover { color: var(--ink); }
.task-tab.active { color: var(--brand); border-bottom-color: var(--brand); font-weight: var(--fw-sb); }
.toolbar.task-filter { justify-content: flex-start; gap: 8px; margin: 0; padding: 12px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.task-filter > select, .task-filter > input { height: 34px; }
.task-total { margin-left: auto; color: var(--muted); font-size: var(--fs-xs); white-space: nowrap; }

.task-table { display: grid; }
.task-row { display: grid; grid-template-columns: 28px minmax(220px, 1fr) 84px 70px 112px 108px 84px; gap: 12px; align-items: center; min-height: 56px; padding: 8px 16px; border-bottom: 1px solid var(--line); cursor: pointer; }
.task-row:hover:not(.head) { background: var(--hover); }
.task-row.head { min-height: 0; padding-top: 9px; padding-bottom: 9px; background: var(--bg); color: var(--muted); font-size: var(--fs-xs); font-weight: var(--fw-sb); cursor: default; }
.task-row.is-done .task-title b { color: var(--muted); text-decoration: line-through; }
.task-row.is-loading { display: block; min-height: 0; padding: 32px 16px; color: var(--muted); text-align: center; cursor: default; }
.task-title { min-width: 0; }
.task-title b { display: block; overflow: hidden; color: var(--ink); font-size: var(--fs-sm); font-weight: var(--fw-sb); text-overflow: ellipsis; white-space: nowrap; }
.task-title small { display: flex; gap: 8px; margin-top: 3px; overflow: hidden; color: var(--muted); font-size: var(--fs-xs); white-space: nowrap; }
.task-title small span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.task-title small em { flex: none; font-style: normal; }
.task-cell { min-width: 0; overflow: hidden; color: var(--ink-2); font-size: var(--fs-sm); text-overflow: ellipsis; white-space: nowrap; font-variant-numeric: tabular-nums; }
.task-cell.is-overdue { color: var(--danger-ink); font-weight: var(--fw-sb); }
.task-check { display: grid; place-items: center; width: 20px; height: 20px; padding: 0; border: 1.5px solid var(--soft); border-radius: 50%; background: transparent; color: transparent; font-size: 12px; line-height: 1; }
.task-check:hover { border-color: var(--brand); color: var(--brand); }
.task-check.is-on { border-color: var(--brand); background: var(--brand); color: #fff; }
.task-check:disabled { opacity: .5; cursor: progress; }
.source-tag, .status-tag, .priority-tag { display: inline-flex; width: fit-content; max-width: 100%; align-items: center; padding: 2px 8px; border-radius: 999px; font-size: var(--fs-xs); font-weight: var(--fw-sb); line-height: 1.4; white-space: nowrap; }
.source-tag { color: var(--ink-2); background: var(--msg); }
.status-tag { color: var(--brand); background: var(--brand-soft); }
.status-tag.waiting, .status-tag.pending { color: var(--warn-ink); background: var(--warn-soft); }
.status-tag.completed { color: var(--ok); background: var(--brand-soft); }
.status-tag.cancelled, .status-tag.draft { color: var(--muted); background: var(--msg); }
.status-tag.overdue, .priority-tag.urgent { color: var(--danger-ink); background: var(--danger-soft); }
.priority-tag { color: var(--muted); background: var(--msg); }
.priority-tag.high { color: var(--warn-ink); background: var(--warn-soft); }
.task-empty { display: grid; place-items: center; align-content: center; gap: 6px; padding: 48px 16px; }
.task-empty b { color: var(--ink-2); font-size: var(--fs-sm); }
.task-more { display: flex; justify-content: center; padding: 12px; }
.empty { display: grid; place-items: center; align-content: center; gap: 4px; padding: 40px 16px; color: var(--muted); text-align: center; font-size: var(--fs-sm); }
.empty span { display: none; }
.empty p { margin: 0; font-size: var(--fs-xs); }

.analytics-filter { justify-content: flex-start; align-items: flex-end; }
.analytics-filter label { display: grid; gap: 4px; color: var(--muted); font-size: 13px; font-weight: 650; }
.analytics-filter button { margin-top: 0; }
.domain-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin-bottom: 0; }
.domain-card { position: relative; display: block; min-height: 124px; padding: 16px 16px 14px; overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); box-shadow: var(--shadow-sm, 0 1px 2px rgba(15, 23, 42, .04)); }
.domain-card::before { position: absolute; top: 0; right: 0; left: 0; height: 3px; background: var(--brand, var(--teal)); content: ""; }
.domain-card.unavailable::before { background: var(--line); }
a.domain-card:hover { border-color: var(--brand-line, #99f6e4); }
.domain-card small { color: var(--muted); font-size: 13px; font-weight: 650; }
.domain-card b { display: block; margin: 12px 0 8px; color: var(--ink); font-size: 28px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.domain-card p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.45; }
.domain-card.unavailable { background: var(--bg); }
.domain-card.unavailable b { color: var(--soft); font-size: 18px; }
.insight-grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(280px, .75fr); gap: 16px; align-items: start; }
.insight { min-height: 0; padding: 18px 20px 16px; }
.insight.wide { grid-row: span 2; }
#familyRevenuePanel { min-height: 0; }
.panel-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.panel-title h2, .dialog-head h2, .drawer-head h2 { margin: 2px 0 0; color: var(--ink); font-size: 18px; font-weight: 700; line-height: 1.3; }
.panel-title .definition { max-width: 360px; color: var(--muted); font-size: 12px; line-height: 1.45; text-align: right; }
.chart-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 22px; }
.chart-block h3 { margin: 0 0 10px; color: var(--muted); font-size: 12px; font-weight: 650; }
.bar-row { display: grid; grid-template-columns: minmax(72px, 96px) minmax(0, 1fr) auto; gap: 8px; align-items: center; margin: 7px 0; font-size: 13px; }
.bar-row span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar { height: 8px; overflow: hidden; border-radius: 99px; background: var(--line-soft, #f1f5f9); }
.bar i { display: block; height: 100%; border-radius: inherit; background: var(--brand, var(--teal)); }
.bar-row b { color: var(--ink); font-size: 13px; font-variant-numeric: tabular-nums; }
.revenue-row { display: grid; grid-template-columns: 72px minmax(80px, 1fr) auto; gap: 6px 12px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.revenue-row b { font-size: 13px; font-weight: 650; }
.revenue-figs { display: flex; gap: 14px; color: var(--ink-2); white-space: nowrap; font-variant-numeric: tabular-nums; }
.revenue-row small { grid-column: 2 / -1; color: var(--muted); font-size: 12px; }
.metric-stack { display: grid; }
.metric-item { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.metric-item span { color: var(--muted); font-size: 13px; }
.metric-item b { color: var(--ink); font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; }
.team-list { display: grid; }
.team-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 11px 0; border-bottom: 1px solid var(--line); }
.team-row b { font-size: 14px; }
.team-row small { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; line-height: 1.4; }
.team-row strong { color: var(--brand, var(--teal)); font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; }

.split-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.split-grid > .panel, .flow-panel, .quality-panel { padding: 22px; }
.card-list { display: grid; gap: 10px; }
.mini-card { padding: 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.mini-card-head { display: flex; justify-content: space-between; gap: 12px; }
.mini-card b { font-size: var(--fs-sm); }
.mini-card p { margin: 6px 0 0; color: var(--muted); font-size: var(--fs-xs); line-height: 1.55; }
.mini-card .actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 11px; }
.mini-card .actions button { min-height: 28px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; color: var(--brand); background: var(--panel); font-size: var(--fs-xs); font-weight: var(--fw-sb); }
.hint { margin: 8px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.flow-panel { margin-top: 16px; }
.flow-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }
.flow-columns h3 { margin: 0 0 13px; color: var(--muted); font-size: var(--fs-xs); }
.coverage-card ul { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.coverage-card li { display: flex; justify-content: space-between; padding: 10px 12px; border-radius: 8px; font-size: var(--fs-xs); background: var(--bg); }
.coverage-card li.ready span { color: var(--ok); }
.coverage-card li.hold span { color: var(--warn-ink); }
.quality-list { display: grid; }
.quality-row { display: grid; grid-template-columns: 90px minmax(220px, 1fr) 120px 110px auto; gap: 12px; align-items: center; padding: 12px 4px; border-bottom: 1px solid var(--line); }
.quality-row > b { font-size: var(--fs-sm); }
.quality-row small { color: var(--muted); font-size: var(--fs-xs); }
.severity { width: fit-content; padding: 2px 8px; border-radius: 999px; color: var(--warn-ink); background: var(--warn-soft); font-size: var(--fs-xs); font-weight: var(--fw-sb); }
.severity.critical { color: var(--danger-ink); background: var(--danger-soft); }

.drawer { position: fixed; top: 0; right: 0; z-index: 60; width: min(430px, 100vw); height: 100vh; overflow: auto; border-left: 1px solid var(--line); background: var(--panel); box-shadow: var(--shadow-lg); }
.detail-drawer { width: min(640px, 100vw); }
.drawer-backdrop { position: fixed; inset: 0; z-index: 59; background: rgba(15, 23, 42, .28); }
.drawer-head { position: sticky; top: 0; z-index: 2; display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); background: var(--panel); }
.drawer-head h2 { overflow-wrap: anywhere; }
.drawer-head button, .dialog-head button { flex: none; width: 32px; height: 32px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink-2); background: var(--panel); font-size: 18px; line-height: 1; }
.notice-list { display: grid; }
.notice { display: block; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.notice.unread { background: var(--brand-soft); }
.notice b { display: block; font-size: var(--fs-sm); }
.notice p { margin: 4px 0; color: var(--muted); font-size: var(--fs-xs); line-height: 1.5; }
.notice small { color: var(--soft); font-size: var(--fs-xs); }

/* TASK-UX-7：任务详情抽屉 */
.task-detail { padding: 16px 20px 32px; }
.task-detail .hint { margin: 0 0 8px; padding: 0; }
.link-row .check-row { flex: 1; min-width: 0; }
.detail-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 14px; }
.detail-actions select { width: auto; min-width: 120px; height: 34px; }
.detail-actions .detail-note { color: var(--muted); font-size: var(--fs-xs); }
.detail-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; margin-bottom: 4px; }
.detail-field { display: grid; gap: 4px; min-width: 0; margin: 0; font-weight: var(--fw); }
.detail-field > small { color: var(--muted); font-size: var(--fs-xs); font-weight: var(--fw-md); }
.detail-field > b { min-height: 34px; padding: 7px 0; overflow-wrap: anywhere; font-size: var(--fs-sm); font-weight: var(--fw-md); }
.detail-field > b a { color: var(--brand); }
.detail-field :is(select, input) { width: 100%; height: 34px; }
.detail-section { padding: 16px 0 4px; border-top: 1px solid var(--line); margin-top: 14px; }
.detail-section h3 { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 0 10px; color: var(--ink); font-size: var(--fs-sm); font-weight: var(--fw-sb); }
.detail-section h3 small { color: var(--muted); font-size: var(--fs-xs); font-weight: var(--fw-md); }
.detail-desc { margin: 0; color: var(--ink-2); font-size: var(--fs-sm); line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }
.detail-desc.is-empty { color: var(--muted); }
.detail-edit { display: grid; gap: 8px; }
.detail-edit textarea { min-height: 96px; }
.detail-edit .row-ops { justify-content: flex-end; }
.mini-progress { height: 4px; margin: 0 0 8px; overflow: hidden; border-radius: 999px; background: var(--line-soft); }
.mini-progress i { display: block; height: 100%; border-radius: inherit; background: var(--brand); }
.check-row { display: flex; gap: 9px; align-items: center; margin: 0; padding: 6px 0; font-size: var(--fs-sm); font-weight: var(--fw); }
.check-row span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.check-row.is-done span { color: var(--muted); text-decoration: line-through; }
.link-row { display: flex; align-items: center; gap: 8px; padding: 7px 0; border-bottom: 1px dashed var(--line); font-size: var(--fs-sm); }
.link-row:last-of-type { border-bottom: 0; }
.link-row .link-main { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link-row button.link-main { padding: 0; border: 0; background: none; color: var(--brand); text-align: left; }
.link-row button.link-main:hover { text-decoration: underline; }
.link-row small { flex: none; color: var(--muted); font-size: var(--fs-xs); }
.link-remove { flex: none; width: 24px; height: 24px; padding: 0; border: 0; border-radius: 6px; background: transparent; color: var(--soft); font-size: 15px; line-height: 1; }
.link-remove:hover { background: var(--danger-soft); color: var(--danger-ink); }
.comment { margin: 8px 0; padding: 9px 12px; border-radius: 8px; background: var(--bg); font-size: var(--fs-sm); line-height: 1.55; overflow-wrap: anywhere; white-space: pre-wrap; }
.comment small { display: block; margin-top: 4px; color: var(--muted); font-size: var(--fs-xs); white-space: normal; }
.event-row { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; color: var(--ink-2); font-size: var(--fs-xs); }
.event-row small { flex: none; color: var(--muted); }
.inline-form { display: flex; gap: 8px; margin-top: 8px; }
.inline-form :is(input, select) { min-width: 0; flex: 1; height: 34px; }
.inline-form .btn { flex: none; }

dialog { width: min(680px, calc(100vw - 28px)); max-height: calc(100vh - 40px); padding: 0; overflow: auto; border: 1px solid var(--line); border-radius: 16px; color: var(--ink); background: var(--panel); box-shadow: 0 24px 70px rgba(15, 23, 42, .22); }
dialog::backdrop { background: rgba(15, 23, 42, .46); }
.wide-dialog { width: min(1120px, calc(100vw - 28px)); }
#metricDialog[open] { display: flex; flex-direction: column; width: min(1180px, calc(100vw - 32px)); max-height: min(860px, calc(100vh - 40px)); overflow: hidden; background: var(--panel); }
#metricDialog form { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; overflow: hidden; }
.dialog-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 20px; border-bottom: 1px solid var(--line); background: var(--panel); }
.metric-lead { margin: 0; padding: 12px 20px; border-bottom: 1px solid var(--line); color: var(--muted); background: var(--panel); font-size: 13px; line-height: 1.45; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; padding: 22px 24px; }
.form-grid label { display: grid; gap: 6px; margin: 0; color: var(--ink-2); font-size: var(--fs-sm); font-weight: var(--fw-sb); }
.form-grid .span-2 { grid-column: span 2; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 9px; padding: 14px 24px 18px; border-top: 1px solid var(--line); }
.metric-table { flex: 1 1 auto; min-height: 0; overflow: auto; background: var(--panel); }
.metric-row { display: grid; grid-template-columns: 104px 132px minmax(160px, 1.15fr) minmax(180px, 1.25fr) minmax(128px, .9fr) 80px; gap: 12px; align-items: start; min-width: 860px; padding: 12px 20px; border-bottom: 1px solid var(--line); background: var(--panel); color: var(--ink); font-size: 13px; line-height: 1.45; }
.metric-row > * { min-width: 0; overflow-wrap: anywhere; }
.metric-row.head { position: sticky; top: 0; z-index: 1; align-items: center; color: var(--muted); background: var(--bg); font-size: 12px; font-weight: 650; white-space: nowrap; }
.metric-row:hover:not(.head) { background: var(--hover); }
.metric-name { font-size: 14px; font-weight: 700; }
.metric-state { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.metric-domain, .metric-flag { font-style: normal; }
.metric-domain { color: var(--muted); font-size: 12px; }
.metric-flag { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 99px; background: var(--brand-soft); color: var(--brand); font-size: 12px; font-weight: 650; white-space: nowrap; }
.metric-flag.is-wait { background: var(--warn-soft); color: var(--warn-ink); }
.metric-formula { font-family: var(--font-mono); font-size: 12px; line-height: 1.45; color: var(--ink-2); }

.toast-region { position: fixed; right: 22px; top: calc(56px + 12px); bottom: auto; z-index: 12000; display: grid; gap: 8px; justify-items: end; }
.toast-region .toast { position: static; top: auto; right: auto; bottom: auto; z-index: auto; }
.toast { max-width: 360px; padding: 12px 15px; border-radius: 11px; color: white; background: #173b38; box-shadow: 0 12px 35px rgba(0,0,0,.22); font-size: 12px; animation: toast-in .2s ease-out; }
.toast.error { background: #873a31; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } }

@media (max-width: 1100px) {
  .domain-grid { grid-template-columns: repeat(3, 1fr); }
  .task-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .task-row { grid-template-columns: 28px minmax(200px, 1fr) 70px 104px 84px; }
  .task-row > :nth-child(3), .task-row > :nth-child(5) { display: none; }
}

@media (max-width: 780px) {
  .task-kpis, .domain-grid { grid-template-columns: repeat(2, 1fr); }
  .toolbar:not(.task-filter) { align-items: stretch; flex-direction: column; }
  .task-tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .task-tab { flex: none; }
  .task-filter > input[type="search"], .has-app-shell .task-filter > input[type="search"] { flex-basis: 100%; max-width: none; }
  .task-row { grid-template-columns: 28px minmax(0, 1fr) auto; }
  .task-row > :nth-child(3), .task-row > :nth-child(4), .task-row > :nth-child(5), .task-row > :nth-child(6) { display: none; }
  .detail-meta { grid-template-columns: 1fr; }
  .insight-grid, .split-grid, .flow-columns { grid-template-columns: 1fr; }
  .insight.wide { grid-row: auto; }
  .panel-title .definition { max-width: none; text-align: left; }
  .chart-grid { grid-template-columns: 1fr; }
  .quality-row { grid-template-columns: 75px minmax(0, 1fr) auto; }
  .quality-row > :nth-child(3), .quality-row > :nth-child(4) { display: none; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: span 1; }
  .metric-row { min-width: 760px; }
}

@media (max-width: 860px) {
  .toast-region { top: auto; bottom: 16px; }
}

/* W-31：任务抽屉里从子任务返回上级任务 */
.detail-back { display: block; margin-bottom: 4px; padding: 0; border: 0; background: none; color: var(--brand, #2f6fed); font-size: 13px; cursor: pointer; text-align: left; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.detail-back.hidden { display: none; }
