/* MPD 控制台样式
   设计语言参考 Arco Design：4/8px 圆角、32px 控件、#165DFF 主色、
   柔和阴影替代硬描边、14px 正文。
   "科技感"来自：深色视频舞台 + 活体脉冲指示 + 发光数值 + 层次化表面，
   不是渐变和玻璃拟态。
   明暗两套主题共用同一组变量，切换只换变量值。 */

/* ============================================================ 设计变量 */

:root,
[data-theme="light"] {
  --brand:         #165DFF;
  --brand-hover:   #4080FF;
  --brand-active:  #0E42D2;
  --brand-fill:    #E8F3FF;
  --brand-fill-2:  #BEDAFF;
  --brand-glow:    rgba(22, 93, 255, .18);

  --success:       #00B42A;
  --success-fill:  #E8FFEA;
  --warning:       #FF7D00;
  --warning-fill:  #FFF7E8;
  --danger:        #F53F3F;
  --danger-fill:   #FFECE8;
  --danger-hover:  #F76965;

  --text-1: #1D2129;
  --text-2: #4E5969;
  --text-3: #86909C;
  --text-4: #C9CDD4;

  --border:   #E5E6EB;
  --border-2: #C9CDD4;

  --bg:        #F2F3F5;
  --surface:   #FFFFFF;
  --surface-2: #F7F8FA;
  --surface-3: #F2F3F5;
  --hover:     #F7F8FA;

  --stage:      #16171A;
  --stage-ring: rgba(22, 93, 255, .22);

  --shadow-1: 0 1px 2px rgba(29, 33, 41, .04), 0 2px 8px rgba(29, 33, 41, .05);
  --shadow-2: 0 4px 10px rgba(29, 33, 41, .08), 0 12px 32px rgba(29, 33, 41, .06);
  --scrollbar: #C9CDD4;
}

[data-theme="dark"] {
  --brand:         #3C7EFF;
  --brand-hover:   #5C93FF;
  --brand-active:  #2C6BE6;
  --brand-fill:    rgba(60, 126, 255, .16);
  --brand-fill-2:  rgba(60, 126, 255, .28);
  --brand-glow:    rgba(60, 126, 255, .32);

  --success:       #23C343;
  --success-fill:  rgba(35, 195, 67, .14);
  --warning:       #FF9A2E;
  --warning-fill:  rgba(255, 154, 46, .14);
  --danger:        #F76965;
  --danger-fill:   rgba(247, 105, 101, .14);
  --danger-hover:  #F98D8A;

  --text-1: rgba(255, 255, 255, .92);
  --text-2: rgba(255, 255, 255, .70);
  --text-3: rgba(255, 255, 255, .48);
  --text-4: rgba(255, 255, 255, .28);

  --border:   #2E2E30;
  --border-2: #414143;

  --bg:        #131316;
  --surface:   #1D1D1F;
  --surface-2: #232326;
  --surface-3: #2A2A2D;
  --hover:     #26262A;

  --stage:      #0C0C0E;
  --stage-ring: rgba(60, 126, 255, .3);

  --shadow-1: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow-2: 0 6px 20px rgba(0, 0, 0, .45);
  --scrollbar: #3A3A3D;
}

:root {
  --r-sm: 4px;
  --r:    6px;
  --r-lg: 10px;
  --h:    32px;
  --pad:  14px;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
          "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", "JetBrains Mono", Menlo,
          Consolas, "Liberation Mono", monospace;

  --ease: cubic-bezier(.34, .69, .1, 1);
}

* { box-sizing: border-box; }

/* 任何设了 display 的类都会盖掉浏览器默认的 [hidden]{display:none}，
   导致 hidden 属性失效（按钮、进度条、徽标都踩过）。这里统一兜住。 */
[hidden] { display: none !important; }

html, body { height: 100%; margin: 0; }

body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5715;
  color: var(--text-1);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: background .2s var(--ease), color .2s var(--ease);
}

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

/* ============================================================ 顶栏 */

.topbar {
  flex: 0 0 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  z-index: 10;
}

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

.mark {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .06em;
  color: #fff;
  background: var(--brand);
  padding: 5px 9px;
  border-radius: var(--r-sm);
  box-shadow: 0 2px 8px var(--brand-glow);
}

.topbar-brand .title {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -.01em;
  white-space: nowrap;
}

.stage-tag {
  font-size: 12px;
  color: var(--text-3);
  padding: 3px 8px;
  background: var(--surface-3);
  border-radius: 20px;
  white-space: nowrap;
}

.topbar-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.topbar-meta .divider {
  width: 1px;
  height: 18px;
  background: var(--border);
}

.stat-inline { display: flex; align-items: baseline; gap: 6px; }
.stat-inline .k { font-size: 12px; color: var(--text-3); }
.stat-inline .v {
  font-size: 12px;
  color: var(--text-2);
  max-width: 190px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.clock {
  color: var(--text-2);
  font-size: 13px;
  letter-spacing: .02em;
}

.platform-chip,
.user-chip,
.icon-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 30px;
  padding: 0 11px;
  font: inherit;
  font-size: 13px;
  color: var(--text-2);
  background: var(--surface-2);
  border: 1px solid transparent;
  border-radius: var(--r);
  cursor: pointer;
  transition: background .15s var(--ease), color .15s var(--ease);
}
.platform-chip:hover,
.user-chip:hover,
.icon-btn:hover { background: var(--surface-3); color: var(--text-1); }

.icon-btn { padding: 0 9px; }
.icon-btn svg { width: 16px; height: 16px; display: block; }

.user-chip .role {
  font-size: 12px;
  color: var(--brand);
  padding: 1px 6px;
  background: var(--brand-fill);
  border-radius: 3px;
}

/* 状态点：运行中会呼吸，一眼看出是不是活的 */
.dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--text-4);
  flex: 0 0 auto;
  position: relative;
}
.dot[data-state="ok"]    { background: var(--success); box-shadow: 0 0 0 3px var(--success-fill); }
.dot[data-state="warn"]  { background: var(--warning); box-shadow: 0 0 0 3px var(--warning-fill); }
.dot[data-state="error"] { background: var(--danger);  box-shadow: 0 0 0 3px var(--danger-fill); }

@keyframes pulse-ring {
  0%   { transform: scale(1);   opacity: .55; }
  70%  { transform: scale(2.4); opacity: 0; }
  100% { transform: scale(2.4); opacity: 0; }
}

/* ============================================================ 布局 */

.layout { flex: 1; display: flex; min-height: 0; }

.sidebar {
  flex: 0 0 324px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px;
  overflow-y: auto;
}

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

/* ============================================================ 卡片 */

.panel {
  background: var(--surface);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
  overflow: hidden;
}

.panel-flat { display: flex; flex-direction: column; min-height: 0; }

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 44px;
  padding: 0 var(--pad);
}

.panel-head h2 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-1);
}

.panel-note { font-size: 12px; color: var(--text-3); }

/* ============================================================ 标签页 */

.tabs {
  display: flex;
  align-items: center;
  padding: 0 var(--pad);
  border-bottom: 1px solid var(--border);
}

.tabs-flat { background: transparent; }
.tabs-spacer { flex: 1; }

.tab {
  appearance: none;
  border: 0;
  background: none;
  font: inherit;
  font-size: 14px;
  color: var(--text-2);
  padding: 11px 0;
  margin-right: 22px;
  cursor: pointer;
  position: relative;
  transition: color .15s var(--ease);
}
.tab:hover { color: var(--text-1); }
.tab.is-active { color: var(--brand); font-weight: 500; }
.tab.is-active::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 2px;
  border-radius: 2px 2px 0 0;
  background: var(--brand);
}

.badge {
  display: inline-block;
  min-width: 18px;
  padding: 0 5px;
  margin-left: 6px;
  font-family: var(--mono);
  font-size: 11px;
  line-height: 16px;
  text-align: center;
  color: var(--brand);
  background: var(--brand-fill);
  border-radius: 9px;
}

.tabpane { display: none; }
.tabpane.is-active { display: block; }
.bottom .tabpane.is-active { display: flex; flex-direction: column; min-height: 0; flex: 1; }

/* ============================================================ 表单 */

.field { padding: 12px var(--pad) 0; }
.field:last-child { padding-bottom: var(--pad); }

.field > label {
  display: block;
  font-size: 13px;
  color: var(--text-2);
  margin-bottom: 6px;
}

.field .unit { color: var(--text-3); font-size: 12px; margin-left: 2px; }

.row { display: flex; gap: 8px; }
.row > input { flex: 1; min-width: 0; }

.grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 10px;
  padding: 0 var(--pad) var(--pad);
}
.grid2 .field { padding: 12px 0 0; }

input[type="text"],
input[type="password"],
input[type="tel"],
input[type="number"] {
  width: 100%;
  height: var(--h);
  padding: 0 11px;
  font: inherit;
  font-size: 14px;
  color: var(--text-1);
  background: var(--surface-2);
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  outline: none;
  transition: background .15s var(--ease), border-color .15s var(--ease), box-shadow .15s var(--ease);
}
input.mono { font-family: var(--mono); font-size: 13px; }
input::placeholder { color: var(--text-4); }

input[type="text"]:hover,
input[type="password"]:hover,
input[type="tel"]:hover,
input[type="number"]:hover { background: var(--surface-3); }

input[type="text"]:focus,
input[type="password"]:focus,
input[type="tel"]:focus,
input[type="number"]:focus {
  background: var(--surface);
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-glow);
}

.check {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  color: var(--text-2);
  cursor: pointer;
  user-select: none;
}
.check input { margin: 0; accent-color: var(--brand); width: 14px; height: 14px; }
.check-sm { font-size: 12px; }
.field-check { display: flex; align-items: flex-end; padding-bottom: 2px; }

/* ============================================================ 按钮 */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: var(--h);
  padding: 0 15px;
  font: inherit;
  font-size: 14px;
  color: var(--text-1);
  background: var(--surface-2);
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s var(--ease), color .15s var(--ease), box-shadow .15s var(--ease);
}
.btn:hover:not(:disabled) { background: var(--surface-3); }
.btn:active:not(:disabled) { background: var(--border); }
.btn:disabled { color: var(--text-4); background: var(--surface-2); cursor: not-allowed; }

.btn-primary {
  color: #fff;
  background: var(--brand);
  box-shadow: 0 2px 8px var(--brand-glow);
}
.btn-primary:hover:not(:disabled) { background: var(--brand-hover); }
.btn-primary:active:not(:disabled) { background: var(--brand-active); }
.btn-primary:disabled { background: var(--brand); opacity: .4; color: #fff; box-shadow: none; }

.btn-danger { color: var(--danger); background: var(--danger-fill); }
.btn-danger:hover:not(:disabled) { color: #fff; background: var(--danger); }

.btn-xs { height: 26px; padding: 0 10px; font-size: 13px; border-radius: 3px; }

.linkbtn {
  appearance: none;
  border: 0;
  background: none;
  font: inherit;
  font-size: 13px;
  color: var(--brand);
  cursor: pointer;
  padding: 0;
  transition: color .15s var(--ease);
}
.linkbtn:hover { color: var(--brand-hover); }

/* 分段控件 */
.segmented {
  display: inline-flex;
  padding: 3px;
  background: var(--surface-2);
  border-radius: var(--r);
  gap: 2px;
}
.seg {
  appearance: none;
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 13px;
  color: var(--text-2);
  height: 26px;
  padding: 0 13px;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background .15s var(--ease), color .15s var(--ease), box-shadow .15s var(--ease);
}
.seg:hover:not(:disabled):not(.is-active) { color: var(--text-1); background: var(--surface-3); }
.seg.is-active {
  background: var(--brand);
  color: #fff;
  font-weight: 500;
  box-shadow: 0 2px 6px var(--brand-glow);
}
.seg:disabled { color: var(--text-4); cursor: not-allowed; }

.segmented-block { display: flex; width: 100%; }
.segmented-block .seg { flex: 1; padding: 0 8px; }

/* ============================================================ 下拉选择 */

/* 原生 select 各系统长得都不一样，这里剥掉外观自己画一个，
   保持和 input 同一套高度、圆角、focus 环。箭头用外层的 svg，
   不用 background-image —— 那样在深色主题下还要再准备一份图。 */
.select-wrap { position: relative; display: block; }

.select-wrap select {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  height: var(--h);
  padding: 0 32px 0 11px;
  font: inherit;
  font-size: 14px;
  color: var(--text-1);
  background: var(--surface-2);
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  outline: none;
  cursor: pointer;
  text-overflow: ellipsis;
  transition: background .15s var(--ease), border-color .15s var(--ease),
              box-shadow .15s var(--ease);
}

.select-wrap select:hover:not(:disabled) { background: var(--surface-3); }

.select-wrap select:focus-visible {
  background: var(--surface);
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-glow);
}

.select-wrap select:disabled {
  color: var(--text-4);
  background: var(--surface-2);
  cursor: not-allowed;
}

/* 下拉展开的列表是系统绘制的，只能给到配色，给了总比默认白底强 */
.select-wrap select option { background: var(--surface); color: var(--text-1); }
.select-wrap select option:disabled { color: var(--text-4); }

.select-caret {
  position: absolute;
  right: 10px;
  top: 50%;
  width: 14px;
  height: 14px;
  margin-top: -7px;
  color: var(--text-3);
  pointer-events: none;
  transition: color .15s var(--ease);
}
.select-wrap:hover .select-caret { color: var(--text-2); }
.select-wrap select:disabled ~ .select-caret { color: var(--text-4); }

/* ============================================================ 折叠面板 */

.fold-head {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  height: 44px;
  padding: 0 var(--pad);
  background: transparent;
  border: 0;
  font: inherit;
  text-align: left;
  cursor: pointer;
  color: var(--text-1);
}
.fold-head:hover { background: var(--hover); }
.fold-head h2 { margin: 0; font-size: 14px; font-weight: 600; flex: 1; }

.fold-caret {
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
  color: var(--text-3);
  transition: transform .2s var(--ease);
}
.fold.is-open .fold-caret { transform: rotate(90deg); }

.fold-badge {
  font-size: 12px;
  color: var(--text-3);
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.fold-badge[data-state="active"] { color: var(--brand); }

.fold-body { display: none; padding-bottom: 4px; }
.fold.is-open .fold-body { display: block; }

.fold-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 2px 10px;
  margin: 0;
  padding: 4px var(--pad) 12px;
}
.fold-stats div { display: flex; justify-content: space-between; gap: 8px; min-width: 0; }
.fold-stats dt { font-size: 12px; color: var(--text-3); white-space: nowrap; }
.fold-stats dd {
  margin: 0;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-1);
}

/* ============================================================ 服务状态流程图 */

.flowchart { padding: 4px var(--pad) 0; }
.flowchart svg { width: 100%; height: auto; display: block; }

.flow-node rect {
  fill: var(--surface-2);
  stroke: var(--border);
  stroke-width: 1;
  transition: fill .25s var(--ease), stroke .25s var(--ease);
}
/* 图标在左、两行文字在右，所以正文一律左对齐；素材库那种窄卡片才居中 */
.flow-node .flow-label {
  font-family: var(--font);
  font-size: 12px;
  font-weight: 600;
  fill: var(--text-1);
  text-anchor: start;
}
.flow-node .flow-sub {
  font-family: var(--mono);
  font-size: 9px;
  fill: var(--text-3);
  text-anchor: start;
}
.flow-node .flow-sub-2 { font-size: 8.5px; }
.flow-node .flow-label-c,
.flow-node .flow-sub-c { text-anchor: middle; }

.flow-icon {
  fill: none;
  stroke: var(--text-3);
  stroke-width: 1.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: stroke .25s var(--ease);
}

.flow-node.is-muted rect { fill: transparent; stroke-dasharray: 3 3; }
.flow-node.is-muted .flow-label { fill: var(--text-2); font-weight: 500; }

/* 在干活的节点点亮：描边换主色 + 一圈很淡的辉光，扫一眼就知道卡在哪一步 */
.flow-node.is-live rect {
  fill: var(--brand-fill);
  stroke: var(--brand);
}
.flow-node.is-live .flow-label { fill: var(--brand); }
.flow-node.is-live .flow-icon { stroke: var(--brand); }
.flow-node.is-live .flow-sub { fill: var(--brand); opacity: .85; }

/* 告警有待复核的时候用橙色，和"在干活"区分开 */
.flow-node.is-warn rect { fill: var(--warning-fill); stroke: var(--warning); }
.flow-node.is-warn .flow-label { fill: var(--warning); }
.flow-node.is-warn .flow-icon { stroke: var(--warning); }
.flow-node.is-warn .flow-sub { fill: var(--warning); }

.flow-edges .edge path {
  fill: none;
  stroke: var(--border-2);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: stroke .25s var(--ease);
}

/* 流动：虚线本身不动，动的是 dashoffset。只给线加虚线，箭头保持实心，
   否则箭头会跟着一起断成两截。静止时是实线，避免一屏虚线看着像坏了。 */
.flow-edges .edge.is-flowing path { stroke: var(--brand); }
.flow-edges .edge.is-flowing .edge-line {
  stroke-dasharray: 5 4;
  animation: flow-dash .7s linear infinite;
}

@keyframes flow-dash {
  to { stroke-dashoffset: -9; }
}

/* 系统设置里关了动效就不流，只保留主色 */
@media (prefers-reduced-motion: reduce) {
  .flow-edges .edge.is-flowing .edge-line { animation: none; stroke-dasharray: none; }
}

/* ============================================================ 表单零件 */

.field-hint {
  margin: 6px 0 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-3);
}
.field-hint.mono { font-family: var(--mono); font-size: 11px; word-break: break-all; }

.input-row { display: flex; gap: 8px; align-items: center; }
.input-row input { flex: 1; min-width: 0; }

.btn-sm { height: 28px; padding: 0 12px; font-size: 13px; }

.empty-note {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin: 0 var(--pad) 12px;
  padding: 12px;
  background: var(--surface-2);
  border-radius: var(--r);
  border: 1px dashed var(--border-2);
}
.empty-note strong { font-size: 13px; font-weight: 600; color: var(--text-2); }
.empty-note span { font-size: 12px; line-height: 1.6; color: var(--text-3); }

/* ============================================================ 面板工具条 */

/* 表格上方那条：左边说明现在看的是什么范围，右边放过滤器 */
.pane-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px var(--pad);
  border-bottom: 1px solid var(--border);
}
.pane-bar .segmented { margin-left: auto; }
.pane-scope {
  font-size: 12px;
  color: var(--brand);
  padding: 2px 8px;
  background: var(--brand-fill);
  border-radius: 3px;
}
.pane-summary { font-size: 12px; color: var(--text-3); font-family: var(--mono); }

/* ============================================================ 事实字段悬浮 */

.eye-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 24px;
  padding: 0;
  color: var(--text-3);
  background: transparent;
  border: 0;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: color .15s var(--ease), background .15s var(--ease);
}
.eye-btn:hover { color: var(--brand); background: var(--brand-fill); }
.eye-btn svg { width: 15px; height: 15px; display: block; }
.col-eye { text-align: center; }

.facts-pop {
  position: fixed;
  z-index: 60;
  width: 340px;
  max-width: calc(100vw - 16px);
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: var(--shadow-2);
  /* 默认不吃鼠标事件，免得挡住底下的行来回闪；
     内容超高需要滚动时由 JS 临时打开 pointer-events */
  pointer-events: none;
  overscroll-behavior: contain;
}

.facts-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 4px 14px;
  margin: 0;
}
.facts-grid div { display: flex; justify-content: space-between; gap: 8px; }
.facts-grid dt { font-size: 12px; color: var(--text-3); white-space: nowrap; }
.facts-grid dd { margin: 0; font-size: 12px; color: var(--text-1); text-align: right; }

.facts-extra {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
.facts-extra p { margin: 0 0 4px; font-size: 12px; line-height: 1.55; color: var(--text-2); }
.facts-extra p:last-child { margin-bottom: 0; }
.facts-extra b {
  display: inline-block;
  min-width: 62px;
  font-weight: 500;
  color: var(--text-3);
}

/* ============================================================ 检测日志 */

/* 加权骑行概率：条 + 数字。卡在 0.3~0.6 中间那些最值得看，条长一眼分得出 */
.minibar {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 16px;
}
.minibar i {
  position: relative;
  display: block;
  flex: 0 0 52px;
  height: 4px;
  background: var(--surface-3);
  border-radius: 2px;
  overflow: hidden;
}
.minibar i::after {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: var(--p, 0%);
  background: var(--brand);
  border-radius: 2px;
}
/* 概率过半 = 偏骑行，换个颜色，扫一列就知道哪些被过滤了 */
.minibar.is-riding i::after { background: var(--warning); }
.minibar span { font-size: 12px; color: var(--text-2); }

/* 单元格截断：.table tbody td 已经统一 ellipsis 了，这里只是标出"这列可能很长" */
.dim { color: var(--text-4); }

.log-src {
  flex: 0 0 auto;
  margin-right: 6px;
  padding: 0 5px;
  font-size: 11px;
  line-height: 16px;
  color: var(--brand);
  background: var(--brand-fill);
  border-radius: 3px;
}

/* ============================================================ 清单 */

.listhead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 14px var(--pad) 8px;
  font-size: 13px;
  color: var(--text-2);
}
.listhead-actions { display: flex; align-items: center; gap: 10px; }
.source-note {
  font-size: 12px;
  color: var(--text-3);
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.list { max-height: 260px; overflow-y: auto; padding: 0 8px 8px; }

.list-empty {
  padding: 18px var(--pad);
  font-size: 13px;
  color: var(--text-3);
  text-align: center;
  line-height: 1.7;
}

.item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--r-sm);
  transition: background .15s var(--ease);
}
.item:hover { background: var(--hover); }

.item-body { flex: 1; min-width: 0; }
.item-title {
  font-size: 13px;
  color: var(--text-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.item-sub {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-3);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.item-actions { display: flex; gap: 6px; flex: 0 0 auto; opacity: .55; transition: opacity .15s var(--ease); }
.item:hover .item-actions { opacity: 1; }

/* ============================================================ 上传 */

.dropzone {
  margin: 12px var(--pad) 0;
  padding: 22px 14px;
  text-align: center;
  border: 1px dashed var(--border-2);
  border-radius: var(--r);
  background: var(--surface-2);
  cursor: pointer;
  outline: none;
  transition: border-color .15s var(--ease), background .15s var(--ease);
}
.dropzone:hover, .dropzone:focus-visible, .dropzone.is-over {
  border-color: var(--brand);
  background: var(--brand-fill);
}
.dropzone-main { font-size: 13px; color: var(--text-2); }
.dropzone-sub { margin-top: 5px; font-size: 11px; color: var(--text-3); font-family: var(--mono); }

.progress { display: flex; align-items: center; gap: 10px; padding: 10px var(--pad) 0; }
.progress-bar { flex: 1; height: 5px; background: var(--surface-3); border-radius: 3px; overflow: hidden; }
.progress-bar i {
  display: block; height: 100%; width: 0;
  background: var(--brand);
  border-radius: 3px;
  transition: width .2s var(--ease);
}
.progress-text { color: var(--text-2); font-size: 12px; flex: 0 0 auto; }

/* ============================================================ 舞台 */

.stagebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  height: 52px;
  padding: 0 12px 0 16px;
  background: var(--surface);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
  flex: 0 0 auto;
}
.stagebar-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.stagebar-right { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }

.state-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--text-4);
  flex: 0 0 auto;
  position: relative;
}
.state-dot::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: inherit;
}
.state-dot[data-state="running"] { background: var(--success); }
/* 运行中呼吸一下，一眼分辨"活的"和"停住的" */
.state-dot[data-state="running"]::after { animation: pulse-ring 2s ease-out infinite; }
.state-dot[data-state="starting"],
.state-dot[data-state="reconnecting"],
.state-dot[data-state="interrupted"] { background: var(--warning); }
.state-dot[data-state="starting"]::after,
.state-dot[data-state="reconnecting"]::after { animation: pulse-ring 1.4s ease-out infinite; }
.state-dot[data-state="error"],
.state-dot[data-state="failed"] { background: var(--danger); }

.stage-label {
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.stage-sub { color: var(--text-3); font-size: 12px; white-space: nowrap; }

.stage {
  position: relative;
  flex: 1;
  min-height: 220px;
  background: var(--stage);
  border-radius: var(--r-lg);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-1), inset 0 0 0 1px var(--stage-ring);
}

.stage-media {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  display: block;
  background: var(--stage);
}

.stage-placeholder { text-align: center; }
.ph-title {
  font-size: 15px;
  letter-spacing: .18em;
  color: rgba(255, 255, 255, .38);
  font-family: var(--mono);
}
.ph-text { margin-top: 8px; font-size: 13px; color: rgba(255, 255, 255, .26); }

.stage-badge {
  position: absolute;
  left: 12px;
  bottom: 12px;
  padding: 5px 10px;
  font-size: 11px;
  color: rgba(255, 255, 255, .82);
  background: rgba(12, 12, 14, .72);
  backdrop-filter: blur(8px);
  border-radius: var(--r-sm);
  border: 1px solid rgba(255, 255, 255, .08);
}

.viewers {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  font-size: 12px;
  color: var(--text-2);
  background: var(--surface-2);
  border-radius: 20px;
  white-space: nowrap;
}
.viewers.is-shared { color: var(--brand); background: var(--brand-fill); font-weight: 500; }

/* ============================================================ 播放进度 */

.playbar {
  display: flex;
  align-items: center;
  gap: 14px;
  height: 44px;
  padding: 0 16px;
  background: var(--surface);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
  flex: 0 0 auto;
}

.playbar-time { color: var(--text-2); font-size: 13px; flex: 0 0 auto; }
.playbar-note { font-size: 12px; color: var(--text-3); flex: 0 0 auto; }

.playbar-range {
  flex: 1;
  min-width: 0;
  appearance: none;
  height: 4px;
  border-radius: 3px;
  background: var(--surface-3);
  outline: none;
  cursor: pointer;
}
.playbar-range::-webkit-slider-thumb {
  appearance: none;
  width: 13px; height: 13px;
  border-radius: 50%;
  background: var(--brand);
  border: 2px solid var(--surface);
  box-shadow: 0 0 0 3px var(--brand-glow);
  cursor: pointer;
  transition: transform .15s var(--ease);
}
.playbar-range::-webkit-slider-thumb:hover { transform: scale(1.15); }
.playbar-range::-moz-range-thumb {
  width: 13px; height: 13px;
  border-radius: 50%;
  background: var(--brand);
  border: 2px solid var(--surface);
  cursor: pointer;
}
.playbar-range:disabled { cursor: not-allowed; opacity: .45; }

/* ============================================================ 指标 */

.metrics {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 1px;
  background: var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
  overflow: hidden;
  flex: 0 0 auto;
}
.metric { padding: 12px 14px; background: var(--surface); min-width: 0; }
.m-k {
  display: block;
  font-size: 12px;
  color: var(--text-3);
  letter-spacing: .02em;
}
.m-v {
  display: block;
  margin-top: 5px;
  font-size: 18px;
  font-weight: 600;
  line-height: 1.25;
  color: var(--text-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* 文字类指标不需要那么大，避免撑破格子 */
.m-v:not(.mono) { font-size: 15px; font-weight: 500; margin-top: 7px; }
/* 编码器那格内容最长（codec + 人数），单独压小一档免得被截断 */
.m-v.is-long { font-size: 13px; font-weight: 500; margin-top: 8px; }
.m-v.is-ok    { color: var(--success); }
.m-v.is-warn  { color: var(--warning); }
.m-v.is-error { color: var(--danger); font-size: 13px; font-weight: 400; }

/* ============================================================ 分隔条 */

.splitter {
  flex: 0 0 8px;
  margin: -4px 0;
  cursor: row-resize;
  position: relative;
  z-index: 5;
}
.splitter::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 40px;
  height: 3px;
  border-radius: 2px;
  background: var(--border-2);
  opacity: 0;
  transition: opacity .15s var(--ease);
}
.splitter:hover::after,
.splitter:focus-visible::after,
.splitter.is-dragging::after { opacity: 1; background: var(--brand); }
body.is-resizing { cursor: row-resize; user-select: none; }

/* ============================================================ 底部 */

.bottom {
  flex: 0 0 var(--bottom-h, 340px);
  min-height: 0;
  overflow: hidden;
}

.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  text-align: left;
  font-weight: 500;
  font-size: 12px;
  color: var(--text-3);
  background: var(--surface);
  padding: 9px 14px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table tbody td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 0;
  color: var(--text-2);
}
.table tbody tr { transition: background .15s var(--ease); }
.table tbody tr:hover { background: var(--hover); }
.table tbody tr.is-current { background: var(--brand-fill); }
.table tbody tr.is-current td { color: var(--text-1); }
.table-empty td { text-align: center; color: var(--text-3); padding: 26px 0; }
.table .col-actions { text-align: right; }
.table .col-actions .btn { opacity: .6; transition: opacity .15s var(--ease); }
.table tr:hover .col-actions .btn { opacity: 1; }

.bottom .tabpane[data-botpane] { overflow-y: auto; }

.logbox {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.8;
}
.logline { display: flex; gap: 12px; padding: 1px 16px; }
.logline:hover { background: var(--hover); }
.log-ts { color: var(--text-4); flex: 0 0 auto; }
.log-msg { color: var(--text-2); word-break: break-all; }
.logline[data-level="warn"]  .log-msg { color: var(--warning); }
.logline[data-level="error"] .log-msg { color: var(--danger); }

/* 状态标签：Arco 风格的浅填充胶囊 */
.tag {
  display: inline-block;
  padding: 2px 9px;
  font-size: 12px;
  border-radius: 20px;
  color: var(--text-2);
  background: var(--surface-3);
}
.tag[data-state="running"]      { color: var(--success); background: var(--success-fill); }
.tag[data-state="reconnecting"],
.tag[data-state="starting"],
.tag[data-state="interrupted"]  { color: var(--warning); background: var(--warning-fill); }
.tag[data-state="error"],
.tag[data-state="failed"]       { color: var(--danger);  background: var(--danger-fill); }

/* 事件缩略图 */
.thumb {
  display: block;
  width: 88px;
  height: 50px;
  object-fit: cover;
  border-radius: var(--r-sm);
  background: var(--surface-3);
  cursor: zoom-in;
  transition: box-shadow .15s var(--ease), transform .15s var(--ease);
}
.thumb:hover { box-shadow: 0 0 0 2px var(--brand-glow); transform: scale(1.03); }
.thumb-none {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 88px;
  height: 50px;
  border-radius: var(--r-sm);
  background: var(--surface-3);
  color: var(--text-4);
  font-size: 11px;
}
/* 缩略图那一列不要被表格的省略号规则挤掉 */
.table td.col-thumb { overflow: visible; padding: 6px 14px; }

/* 放大查看 */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(8, 8, 10, .88);
  backdrop-filter: blur(6px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 24px;
}
.lightbox-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  color: rgba(255, 255, 255, .82);
}
.lightbox-title { font-size: 13px; }
.lightbox img {
  max-width: min(1400px, 94vw);
  max-height: 80vh;
  border-radius: var(--r);
  box-shadow: 0 20px 60px rgba(0, 0, 0, .6);
}
.lightbox .btn { background: rgba(255, 255, 255, .12); color: #fff; }
.lightbox .btn:hover { background: rgba(255, 255, 255, .2); }
.lightbox .segmented { background: rgba(255, 255, 255, .12); }
.lightbox .seg { color: rgba(255, 255, 255, .7); }
.lightbox .seg:hover:not(.is-active) { color: #fff; background: rgba(255, 255, 255, .12); }

.llm-usage {
  padding: 8px 14px;
  font-size: 12px;
  color: var(--text-2);
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.llm-usage b { color: var(--text-1); font-weight: 600; }
.llm-raw {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--text-3);
}

/* 底部面板全屏：把整块面板铺满视口，方便扫日志和事件 */
body.panel-expanded .stagebar,
body.panel-expanded .stage,
body.panel-expanded .playbar,
body.panel-expanded .metrics,
body.panel-expanded .splitter,
body.panel-expanded .sidebar { display: none !important; }
body.panel-expanded .main { padding: 12px; }
body.panel-expanded .bottom { flex: 1 1 auto !important; }

/* ============================================================ 提示 */

.toasts {
  position: fixed;
  right: 18px;
  bottom: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 100;
  max-width: 400px;
}
.toast {
  padding: 11px 15px;
  font-size: 13px;
  color: var(--text-1);
  background: var(--surface);
  border-radius: var(--r);
  box-shadow: var(--shadow-2);
  border-left: 3px solid var(--text-4);
  animation: toast-in .22s var(--ease);
}
.toast[data-kind="ok"]    { border-left-color: var(--success); }
.toast[data-kind="warn"]  { border-left-color: var(--warning); }
.toast[data-kind="error"] { border-left-color: var(--danger); }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px) scale(.98); }
  to   { opacity: 1; transform: none; }
}

/* ============================================================ 登录页 */

.login-body {
  display: block;
  overflow: auto;
  background: var(--bg);
}

/* 背景上放两团很淡的品牌色光晕，给一点科技感但不抢内容 */
.login-shell {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow: hidden;
}
.login-shell::before,
.login-shell::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: .5;
  pointer-events: none;
}
.login-shell::before {
  width: 460px; height: 460px;
  background: var(--brand-glow);
  top: -140px; left: -90px;
}
.login-shell::after {
  width: 380px; height: 380px;
  background: var(--brand-glow);
  bottom: -130px; right: -70px;
  opacity: .35;
}

.login-card {
  position: relative;
  width: 400px;
  background: var(--surface);
  border-radius: 14px;
  box-shadow: var(--shadow-2);
  padding: 32px 32px 28px;
}

.login-head { display: flex; align-items: center; gap: 13px; padding-bottom: 4px; }
.login-titles h1 { margin: 0; font-size: 17px; font-weight: 600; letter-spacing: -.01em; }
.login-titles p { margin: 3px 0 0; font-size: 13px; color: var(--text-3); }

.login-tabs { padding: 0; margin-top: 22px; }
.login-tabs .tab { margin-right: 24px; }
.login-tabs .tab:only-child { display: none; }

.login-pane { display: none; padding-top: 6px; }
.login-pane.is-active { display: block; }
.login-pane .field { padding: 16px 0 0; }

.captcha-img {
  width: 112px;
  height: var(--h);
  flex: 0 0 auto;
  object-fit: cover;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  cursor: pointer;
  transition: box-shadow .15s var(--ease);
}
.captcha-img:hover { box-shadow: 0 0 0 2px var(--brand-glow); }
.captcha-img.is-broken {
  color: transparent;
  background: repeating-linear-gradient(45deg,
    var(--surface-2), var(--surface-2) 7px, var(--surface-3) 7px, var(--surface-3) 14px);
}

.field-error { margin-top: 6px; font-size: 12px; color: var(--danger); }

.btn-block { width: 100%; margin-top: 24px; height: 38px; font-size: 15px; }

.login-hint { margin: 18px 0 0; font-size: 13px; color: var(--text-2); line-height: 1.8; }

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

.login-theme {
  position: absolute;
  top: 18px;
  right: 18px;
  z-index: 2;
}

/* ============================================================ 窄屏 */

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

@media (max-width: 960px) {
  .layout { flex-direction: column; overflow-y: auto; }
  .sidebar { flex: 0 0 auto; }
  .main { padding: 0 12px 12px; }
  .stage-tag, .topbar-meta .stat-inline { display: none; }
}

/* 滚动条 */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--scrollbar);
  border: 3px solid transparent;
  background-clip: content-box;
  border-radius: 6px;
}
::-webkit-scrollbar-thumb:hover { background: var(--border-2); background-clip: content-box; }
