/* FlowDeck 流程编排台 — 生产环境控制台样式 */

:root {
  --bg: #0E1116;
  --panel: #161B22;
  --panel-2: #1B212B;
  --panel-3: #12171E;
  --line: rgba(255, 255, 255, .08);
  --line-2: rgba(255, 255, 255, .16);
  --accent: #D7FF3E;
  --muted: #8A94A6;
  --muted-2: #6B7484;
  --text: #E8ECF3;
  --red: #FF6B6B;
  --amber: #FFC857;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif;
  --r: 4px;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

svg { display: block; }
h1, h2, h3, p { margin: 0; }
button { font-family: inherit; }

.num, .mono {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

/* ---------- 顶栏 ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 16px;
  background: #11151B;
  border-bottom: 1px solid var(--line);
}

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

.brand-mark {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(215, 255, 62, .35);
  background: rgba(215, 255, 62, .07);
  border-radius: var(--r);
  flex: 0 0 auto;
}

.brand-name {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: .2px;
  white-space: nowrap;
}

.brand-sub {
  margin-left: 7px;
  font-size: 12.5px;
  font-weight: 400;
  color: var(--muted);
}

.env {
  flex: 0 0 auto;
  padding: 2px 5px;
  border: 1px solid rgba(215, 255, 62, .4);
  border-radius: 3px;
  background: rgba(215, 255, 62, .1);
  color: var(--accent);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .09em;
}

.topbar-right { display: flex; align-items: center; gap: 12px; min-width: 0; }

.runstate {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.lamp {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(215, 255, 62, .12);
  animation: lampPulse 2.4s ease-in-out infinite;
}

.sep { width: 1px; height: 16px; background: var(--line); }

.clock {
  font-size: 12px;
  color: var(--text);
  letter-spacing: .04em;
  white-space: nowrap;
}

.user { display: flex; align-items: center; gap: 7px; min-width: 0; }

.avatar {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-2);
  border-radius: var(--r);
  background: var(--panel-2);
  color: var(--accent);
  font-size: 11px;
  flex: 0 0 auto;
}

.user-name { font-size: 12px; color: var(--muted); white-space: nowrap; }

/* ---------- 骨架 ---------- */

.shell { display: flex; align-items: stretch; min-height: calc(100vh - 52px); }

/* ---------- 侧栏 ---------- */

.sidebar {
  position: sticky;
  top: 52px;
  flex: 0 0 240px;
  width: 240px;
  height: calc(100vh - 52px);
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 10px;
  background: #12161C;
  border-right: 1px solid var(--line);
  overflow: auto;
  transition: width .16s ease, flex-basis .16s ease, padding .16s ease;
}

.shell.side-collapsed .sidebar {
  width: 0;
  flex-basis: 0;
  padding-left: 0;
  padding-right: 0;
  border-right: 0;
  overflow: hidden;
}

.side-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2px 8px 6px;
}

.side-title {
  font-size: 11px;
  letter-spacing: .08em;
  color: var(--muted-2);
  text-transform: uppercase;
}

.side-total { font-size: 11px; color: var(--muted); }

.tree { display: flex; flex-direction: column; gap: 1px; }

.tree-item {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  padding: 5px 8px;
  border: 0;
  border-radius: var(--r);
  background: transparent;
  color: var(--muted);
  font-size: 12.5px;
  text-align: left;
  cursor: pointer;
}

.tree-item:hover { background: rgba(255, 255, 255, .04); color: var(--text); }

.tree-item.is-active {
  background: rgba(215, 255, 62, .07);
  color: var(--text);
  box-shadow: inset 2px 0 0 var(--accent);
}

.tree-item .caret {
  width: 10px;
  height: 10px;
  flex: 0 0 auto;
  color: var(--muted-2);
  transition: transform .14s ease;
}

.tree-item.is-open .caret { transform: rotate(90deg); }

.tree-item .label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.tree-item .count {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted-2);
  flex: 0 0 auto;
}

.tree-item.is-active .count { color: var(--accent); }

.tree-children {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin: 1px 0 4px 18px;
  padding-left: 8px;
  border-left: 1px solid var(--line);
}

.tree-children[hidden] { display: none; }

.tree-child {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border: 0;
  border-radius: var(--r);
  background: transparent;
  color: var(--muted-2);
  font-size: 12px;
  text-align: left;
  cursor: pointer;
}

.tree-child:hover { background: rgba(255, 255, 255, .035); color: var(--text); }

.tree-child.is-active { color: var(--accent); background: rgba(215, 255, 62, .05); }

.tree-child .count { margin-left: auto; font-family: var(--mono); font-size: 10.5px; }

.side-foot {
  margin-top: auto;
  padding: 10px 8px 4px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.foot-row {
  display: flex;
  justify-content: space-between;
  font-size: 11.5px;
  color: var(--muted-2);
}

.foot-row .mono { color: var(--muted); font-size: 11px; }

/* ---------- 主区 ---------- */

.main {
  flex: 1 1 auto;
  min-width: 0;
  padding: 14px 20px 26px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.page-title { display: flex; align-items: flex-start; gap: 10px; }

.page-title h1 { font-size: 16px; font-weight: 600; letter-spacing: .2px; }

.page-sub { font-size: 12px; color: var(--muted-2); margin-top: 2px; }

.page-sub .mono { color: var(--muted); }

.page-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.search {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 9px;
  background: var(--panel-2);
  border: 1px solid var(--line-2);
  border-radius: var(--r);
  color: var(--muted-2);
}

.search:focus-within { border-color: rgba(215, 255, 62, .55); }

.search input {
  width: 168px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 12px;
}

.search input::placeholder { color: var(--muted-2); }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.icon-btn:hover { border-color: var(--line-2); color: var(--text); background: rgba(255, 255, 255, .04); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 27px;
  padding: 0 10px;
  border: 1px solid var(--line-2);
  border-radius: var(--r);
  background: var(--panel-2);
  color: var(--text);
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
}

.btn:hover { background: #232B37; border-color: rgba(255, 255, 255, .28); }

.btn:active { transform: translateY(1px); }

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #0E1116;
  font-weight: 600;
}

.btn-primary:hover { background: #E2FF6A; border-color: #E2FF6A; }

.btn:disabled { opacity: .4; cursor: not-allowed; transform: none; }

.btn-sm { height: 23px; padding: 0 7px; font-size: 11.5px; }

.btn-quiet { background: transparent; border-color: var(--line); color: var(--muted); }

.btn-quiet:hover { color: var(--text); }

/* ---------- 指标卡 ---------- */

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

.metric {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 11px 14px 12px;
  min-width: 0;
}

.metric-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
}

.metric-label .tag {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted-2);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 0 4px;
}

.metric-value {
  margin-top: 6px;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 27px;
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -.6px;
  color: var(--text);
}

.metric-value .unit {
  font-family: var(--sans);
  font-size: 11.5px;
  font-weight: 400;
  color: var(--muted-2);
  margin-left: 4px;
  letter-spacing: 0;
}

.metric-value.is-accent { color: var(--accent); }

.metric-foot {
  margin-top: 5px;
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  color: var(--muted-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.metric-foot .accent { color: var(--accent); }
.metric-foot .warn { color: var(--amber); }
.metric-foot .bad { color: var(--red); }

/* ---------- 面板 ---------- */

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); }

.panel-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}

.panel-title { font-size: 13px; font-weight: 600; }

.badge {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 1px 5px;
  background: rgba(255, 255, 255, .02);
  white-space: nowrap;
}

.panel-tools { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.scope-hint { font-size: 11.5px; color: var(--muted-2); white-space: nowrap; }

.field { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--muted-2); }

select {
  height: 25px;
  padding: 0 6px;
  border: 1px solid var(--line-2);
  border-radius: var(--r);
  background: var(--panel-2);
  color: var(--text);
  font-family: inherit;
  font-size: 12px;
  outline: none;
  cursor: pointer;
}

select:focus { border-color: rgba(215, 255, 62, .55); }

/* ---------- 表格 ---------- */

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

.task-table { width: 100%; border-collapse: collapse; }

.task-table th {
  padding: 8px 12px;
  text-align: left;
  font-size: 11px;
  font-weight: 500;
  color: var(--muted-2);
  letter-spacing: .04em;
  background: #141920;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.task-table th:first-child { padding-left: 14px; width: 25%; }

.task-table td {
  padding: 8px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, .05);
  font-size: 12.5px;
  vertical-align: middle;
  white-space: nowrap;
}

.task-table td:first-child { padding-left: 14px; }

.task-table tbody tr { cursor: pointer; }

.task-table tbody tr:hover { background: rgba(255, 255, 255, .025); }

.task-table tbody tr.is-open { background: rgba(215, 255, 62, .035); }

.task-table tbody tr:last-child td { border-bottom: 0; }

.ta-r { text-align: right !important; }

.tname { display: flex; flex-direction: column; gap: 1px; min-width: 0; }

.tname-main { font-size: 12.5px; font-weight: 500; color: var(--text); }

.tname-sub {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--muted-2);
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 260px;
}

.flow-name { color: var(--muted); }

.trigger { color: var(--muted); font-size: 12px; }

.cell-mono { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 12px; color: var(--text); }

.cell-mono.dim { color: var(--muted); }

.exit-bad { color: var(--red); }

/* 状态胶囊 */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 20px;
  padding: 0 7px;
  border: 1px solid transparent;
  border-radius: 3px;
  font-size: 11px;
  line-height: 1;
  white-space: nowrap;
}

.pill .dot { width: 5px; height: 5px; border-radius: 50%; flex: 0 0 auto; }

.pill.ok {
  color: var(--accent);
  background: rgba(215, 255, 62, .1);
  border-color: rgba(215, 255, 62, .32);
}
.pill.ok .dot { background: var(--accent); }

.pill.run {
  color: #FFFFFF;
  background: rgba(255, 255, 255, .06);
  border-color: rgba(255, 255, 255, .42);
}
.pill.run .dot { background: #fff; animation: lampPulse 1s ease-in-out infinite; }

.pill.fail {
  color: var(--red);
  background: rgba(255, 107, 107, .1);
  border-color: rgba(255, 107, 107, .32);
}
.pill.fail .dot { background: var(--red); }

.pill.skip {
  color: var(--muted);
  background: rgba(255, 255, 255, .03);
  border-color: var(--line);
}
.pill.skip .dot { background: var(--muted-2); }

/* 运行进度条 */
.tbar {
  margin-top: 5px;
  height: 3px;
  width: 100%;
  max-width: 190px;
  background: rgba(255, 255, 255, .08);
  border-radius: 1px;
  overflow: hidden;
  display: none;
}

.tbar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .14s linear; }

tr.is-running .tbar { display: block; }

.row-actions { display: inline-flex; align-items: center; gap: 6px; justify-content: flex-end; }

.row-actions .btn { height: 23px; padding: 0 7px; font-size: 11.5px; }

.empty { padding: 26px 14px; text-align: center; color: var(--muted-2); font-size: 12.5px; }

/* ---------- DAG + 产物 ---------- */

.flow-grid { display: grid; grid-template-columns: 1.65fr 1fr; gap: 12px; align-items: stretch; }

.dag-panel, .art-panel { display: flex; flex-direction: column; min-width: 0; }

.dag-wrap { padding: 6px 10px 2px; flex: 1 1 auto; display: flex; align-items: center; }

.dag { width: 100%; height: auto; }

.dag .n-name { font-family: var(--sans); font-size: 13px; fill: var(--text); }

.dag .n-sub { font-family: var(--mono); font-size: 10.5px; fill: var(--muted-2); }

.dag .node rect { fill: var(--panel-2); stroke: rgba(255, 255, 255, .1); stroke-width: 1; }

.dag .node.is-ok rect { stroke: rgba(215, 255, 62, .22); }

.dag .node.is-run rect { fill: #1E242C; stroke: rgba(215, 255, 62, .6); }

.dag .node.is-run .n-sub { fill: var(--accent); }

.dag .pulse {
  fill: var(--accent);
  animation: lampPulse 1.1s ease-in-out infinite;
}

.dag .edge { fill: none; stroke-width: 1.2; }

.dag .edge.done { stroke: rgba(215, 255, 62, .38); }

.dag .edge.flow {
  stroke: var(--accent);
  stroke-width: 1.4;
  stroke-dasharray: 4 4;
  animation: dashFlow 1.1s linear infinite;
}

.dag .edge.idle { stroke: rgba(255, 255, 255, .14); }

.legend { gap: 12px; }

.lg { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; color: var(--muted-2); }

.lg-dot { width: 6px; height: 6px; border-radius: 1px; }

.lg-dot.ok { background: rgba(215, 255, 62, .55); }
.lg-dot.run { background: var(--accent); animation: lampPulse 1.1s ease-in-out infinite; }
.lg-dot.idle { background: rgba(255, 255, 255, .2); }

.dag-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  padding: 8px 14px;
  border-top: 1px solid var(--line);
  font-size: 11.5px;
  color: var(--muted-2);
}

.dag-foot .mono { color: var(--muted); }

.art-list { list-style: none; margin: 0; padding: 4px 0; flex: 1 1 auto; }

.art-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, .04);
}

.art-item:last-child { border-bottom: 0; }

.ftype {
  flex: 0 0 auto;
  width: 34px;
  height: 22px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-2);
  border-radius: 3px;
  background: rgba(255, 255, 255, .02);
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: .03em;
  color: var(--muted);
}

.ftype.csv { color: var(--accent); border-color: rgba(215, 255, 62, .3); }
.ftype.xlsx { color: #9BD1FF; border-color: rgba(155, 209, 255, .3); }
.ftype.pq { color: #C8B6FF; border-color: rgba(200, 182, 255, .3); }

.art-main { min-width: 0; flex: 1 1 auto; display: flex; flex-direction: column; }

.art-name {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.art-meta { font-size: 10.5px; color: var(--muted-2); font-family: var(--mono); }

.art-dl {
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: transparent;
  color: var(--muted-2);
  cursor: pointer;
}

.art-dl:hover { color: var(--accent); border-color: rgba(215, 255, 62, .4); }

.art-foot {
  padding: 8px 14px;
  border-top: 1px solid var(--line);
  font-size: 11px;
  color: var(--muted-2);
}

.art-foot .mono { color: var(--muted); }

/* ---------- 日志抽屉 ---------- */

.mask {
  position: fixed;
  inset: 0;
  z-index: 55;
  background: rgba(6, 8, 11, .62);
  opacity: 0;
  pointer-events: none;
  transition: opacity .16s ease;
}

.mask.open { opacity: 1; pointer-events: auto; }

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 60;
  width: 540px;
  max-width: 94vw;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--panel-3);
  border-left: 1px solid var(--line-2);
  transform: translateX(100%);
  transition: transform .18s ease;
  visibility: hidden;
}

.drawer.open { transform: none; visibility: visible; }

.drawer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: #141920;
}

.drawer-title-wrap { min-width: 0; }

.drawer-title { font-size: 14px; font-weight: 600; letter-spacing: .2px; }

.drawer-sub {
  margin-top: 3px;
  font-size: 11.5px;
  color: var(--muted-2);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.drawer-sub .mono { color: var(--muted); }

.drawer-body { padding: 12px 14px 24px; overflow: auto; flex: 1 1 auto; }

.sec { margin-bottom: 16px; }

.sec-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  letter-spacing: .07em;
  color: var(--muted-2);
  text-transform: uppercase;
  margin-bottom: 8px;
}

.sec-title::after { content: ""; flex: 1 1 auto; height: 1px; background: var(--line); }

.meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
  background: var(--panel);
}

.meta-cell { padding: 7px 10px; border-bottom: 1px solid var(--line); min-width: 0; }

.meta-cell:nth-child(odd) { border-right: 1px solid var(--line); }

.meta-cell:nth-last-child(-n+2) { border-bottom: 0; }

.meta-k { font-size: 11px; color: var(--muted-2); }

.meta-v {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text);
  margin-top: 1px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.meta-v.bad { color: var(--red); }
.meta-v.good { color: var(--accent); }

.cmd {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: #0F1318;
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.6;
  color: #C9D3E1;
  white-space: normal;
  overflow-wrap: anywhere;
}

.cmd .prompt { color: var(--accent); flex: 0 0 auto; }

.logbox {
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: #0F1318;
  padding: 8px 0;
  max-height: 320px;
  overflow: auto;
}

.logline {
  display: grid;
  grid-template-columns: 62px 42px 1fr;
  gap: 8px;
  padding: 1px 10px;
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.62;
  color: #B9C4D4;
}

.logline:hover { background: rgba(255, 255, 255, .025); }

.logline .lt { color: var(--muted-2); }

.logline .lvl { letter-spacing: .02em; }

.logline.info .lvl { color: var(--muted-2); }
.logline.warn .lvl { color: var(--amber); }
.logline.error .lvl { color: var(--red); }
.logline.error .msg { color: #FFB3B3; }
.logline.warn .msg { color: #EBD9A8; }

.logline .msg { min-width: 0; overflow-wrap: anywhere; }

.cursor {
  display: inline-block;
  width: 6px;
  height: 12px;
  background: var(--accent);
  vertical-align: -2px;
  animation: blink 1s steps(2, start) infinite;
}

.art-drawer { display: flex; flex-direction: column; gap: 6px; }

.art-drawer .art-item {
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--panel);
  padding: 7px 10px;
}

.drawer-note {
  font-size: 11.5px;
  color: var(--muted-2);
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: rgba(255, 255, 255, .015);
}

/* ---------- Toast ---------- */

.toast {
  position: fixed;
  left: 18px;
  bottom: 18px;
  z-index: 80;
  max-width: 360px;
  padding: 8px 12px;
  border: 1px solid rgba(215, 255, 62, .35);
  border-left: 2px solid var(--accent);
  border-radius: var(--r);
  background: #171D25;
  color: var(--text);
  font-size: 12px;
  line-height: 1.45;
  transform: translateY(8px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .16s ease, transform .16s ease;
}

.toast.show { opacity: 1; transform: none; }

.toast .mono { color: var(--accent); }

/* ---------- 移动端分组条 ---------- */

.mobile-group {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
}

.mobile-group select { flex: 1 1 auto; min-width: 0; height: 28px; }

/* ---------- 动画 ---------- */

@keyframes lampPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .28; }
}

@keyframes dashFlow {
  to { stroke-dashoffset: -16; }
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001s !important; animation-iteration-count: 1 !important; transition-duration: .001s !important; }
}

/* ---------- 中等宽度 ---------- */

@media (max-width: 1180px) {
  .flow-grid { grid-template-columns: 1fr; }
  .task-table th:first-child { width: auto; }
  .tname-sub { max-width: 180px; }
}

@media (max-width: 1024px) {
  .sidebar { flex-basis: 208px; width: 208px; }
  .main { padding: 12px 14px 22px; }
  .metric-value { font-size: 24px; }
  .search input { width: 130px; }
}

/* ---------- 移动端 ---------- */

@media (max-width: 860px) {
  .topbar { height: 48px; padding: 0 12px; gap: 8px; }

  .brand-sub { display: none; }

  .runstate, .only-wide, .sep { display: none; }

  .topbar-right { gap: 8px; }

  .clock { font-size: 11.5px; }

  .user-name { display: none; }

  .shell { display: block; }

  .sidebar { display: none; }

  .main { padding: 12px 12px 24px; gap: 10px; }

  .page-head { align-items: center; }

  .page-title h1 { font-size: 15px; }

  .page-sub { font-size: 11.5px; }

  .page-actions { width: 100%; }

  .search { flex: 1 1 auto; }

  .search input { width: 100%; }

  .btn-primary { flex: 0 0 auto; }

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

  .metric { padding: 10px 12px; }

  .metric-value { font-size: 22px; }

  .metric-foot { font-size: 11px; }

  .panel-head { padding: 8px 12px; gap: 6px; }

  .panel-tools .scope-hint { display: none; }

  .mobile-group { display: flex; }

  .table-wrap { overflow: visible; }

  .task-table, .task-table tbody, .task-table tr, .task-table td { display: block; width: auto; }

  .task-table thead { display: none; }

  .task-table tbody { display: flex; flex-direction: column; gap: 8px; padding: 10px; }

  .task-table tbody tr {
    border: 1px solid var(--line);
    border-radius: var(--r);
    background: var(--panel-2);
    padding: 10px 12px;
  }

  .task-table tbody tr:hover { background: var(--panel-2); }

  .task-table td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 3px 0;
    border: 0;
    font-size: 12px;
    white-space: normal;
  }

  .task-table td::before {
    content: attr(data-label);
    flex: 0 0 auto;
    color: var(--muted-2);
    font-size: 11px;
  }

  .task-table td.cell-name {
    display: block;
    padding: 0 0 8px;
    margin-bottom: 6px;
    border-bottom: 1px dashed rgba(255, 255, 255, .08);
  }

  .task-table td.cell-name::before { display: none; }

  .tname-sub { max-width: 100%; }

  .task-table td.cell-act {
    display: flex;
    justify-content: flex-end;
    gap: 6px;
    padding-top: 8px;
    margin-top: 6px;
    border-top: 1px solid rgba(255, 255, 255, .06);
  }

  .task-table td.cell-act::before { display: none; }

  .tbar { max-width: none; }

  .drawer { width: 100%; max-width: 100%; }

  .drawer-body { padding: 10px 12px 20px; }

  .meta-grid { grid-template-columns: 1fr 1fr; }

  .logline { grid-template-columns: 56px 36px 1fr; gap: 6px; font-size: 11px; padding: 1px 8px; }

  .toast { left: 12px; right: 12px; bottom: 12px; max-width: none; }

  .dag-wrap { padding: 4px 6px; }

  .dag .n-name { font-size: 13px; }

  .dag .n-sub { font-size: 11px; }

  .legend { display: none; }
}

@media (max-width: 420px) {
  .brand-name { font-size: 13px; }
  .env { font-size: 9.5px; }
  .metric-value { font-size: 21px; }
  .clock { letter-spacing: 0; }
}

/* 移动端 DAG 横向滚动，保持节点文字可读 */
.swipe-hint { display: none; }

@media (max-width: 860px) {
  .page-title .icon-btn { display: none; }
  .mobile-group .scope-hint { display: none; }
  .dag-wrap { overflow-x: auto; overflow-y: hidden; padding: 6px 8px 2px; }
  .dag { min-width: 640px; }
  .swipe-hint {
    display: inline-flex;
    margin-left: auto;
    font-size: 11px;
    color: var(--muted-2);
    white-space: nowrap;
  }
}
