/* ==========================================================================
   NiuCloud 运维控制台 — 全局样式
   暗色数据监控台风格：玻璃拟态面板 + 靛蓝/青色渐变点缀 + 微交互
   ========================================================================== */

/* ------------------------------ Design Tokens ---------------------------- */
:root {
  /* 主色 */
  --primary-500: #6366f1;
  --primary-600: #4f46e5;
  --accent-400: #22d3ee;

  /* 背景层 */
  --bg-base: #0b0f19;
  --bg-panel: #111827;
  --bg-elevated: #1a2234;

  /* 文本 */
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  /* 功能色 */
  --c-info: #3b82f6;
  --c-success: #22c55e;
  --c-danger: #ef4444;
  --c-warn: #f59e0b;
  --c-cyan: #22d3ee;
  --c-violet: #a78bfa;

  /* 描边 / 分隔 */
  --border-soft: rgba(148, 163, 184, 0.14);
  --border-strong: rgba(148, 163, 184, 0.26);
  --panel-bg: rgba(26, 34, 52, 0.62);
  --panel-bg-strong: rgba(17, 24, 39, 0.86);

  /* 阴影 / 圆角 / 间距 */
  --shadow-sm: 0 2px 8px rgba(2, 6, 23, 0.4);
  --shadow-md: 0 10px 30px rgba(2, 6, 23, 0.5);
  --shadow-lg: 0 24px 60px rgba(2, 6, 23, 0.62);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --gap: 8px;

  --sidebar-w: 240px;
  --topbar-h: 64px;

  --font-sans: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

/* ------------------------------ Base ------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-base);
  background-image:
    radial-gradient(1100px 620px at 10% -10%, rgba(99, 102, 241, 0.2), transparent 62%),
    radial-gradient(900px 540px at 100% 0%, rgba(34, 211, 238, 0.14), transparent 58%),
    radial-gradient(800px 600px at 50% 120%, rgba(167, 139, 250, 0.12), transparent 60%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  font-weight: 600;
}

button,
input,
select {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

::-webkit-scrollbar {
  width: 9px;
  height: 9px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.28);
  border-radius: 6px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(148, 163, 184, 0.46);
}

/* ------------------------------ Layout Shell ----------------------------- */
.app-shell {
  display: flex;
  min-height: 100vh;
}

/* ------------------------------ Sidebar ---------------------------------- */
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  padding: 20px 14px 16px;
  background: linear-gradient(180deg, rgba(17, 24, 39, 0.94), rgba(11, 15, 25, 0.92));
  border-right: 1px solid var(--border-soft);
  backdrop-filter: blur(18px);
  z-index: 40;
  transition: width 0.26s cubic-bezier(0.4, 0, 0.2, 1);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 8px 22px;
}

.brand-logo {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  font-size: 19px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, var(--primary-500), var(--accent-400));
  box-shadow: 0 8px 20px rgba(99, 102, 241, 0.42);
}

.brand-title {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.4px;
}

.brand-sub {
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 1.4px;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
  flex: 1;
}

.nav-section {
  padding: 14px 10px 6px;
  font-size: 11px;
  letter-spacing: 1.4px;
  color: var(--text-muted);
  text-transform: uppercase;
}

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 11px 12px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text-secondary);
  text-align: left;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.nav-item svg {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  opacity: 0.85;
}

.nav-item:hover:not(.is-disabled) {
  background: rgba(99, 102, 241, 0.1);
  color: var(--text-primary);
  transform: translateX(2px);
}

.nav-item.is-active {
  color: #fff;
  background: linear-gradient(90deg, rgba(99, 102, 241, 0.28), rgba(34, 211, 238, 0.08));
  border-color: rgba(99, 102, 241, 0.4);
  box-shadow: inset 0 0 0 1px rgba(99, 102, 241, 0.12);
}

.nav-item.is-active::before {
  content: "";
  position: absolute;
  left: -14px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 22px;
  border-radius: 0 4px 4px 0;
  background: linear-gradient(180deg, var(--primary-500), var(--accent-400));
  box-shadow: 0 0 14px rgba(99, 102, 241, 0.85);
}

.nav-item.is-disabled {
  cursor: not-allowed;
  opacity: 0.4;
}

.nav-item .nav-badge {
  margin-left: auto;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(148, 163, 184, 0.14);
  color: var(--text-muted);
}

.sidebar-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 10px 4px;
  margin-top: 8px;
  border-top: 1px solid var(--border-soft);
  font-size: 12px;
  color: var(--text-muted);
}

.sidebar-foot .version {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 11px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--c-success);
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.16);
  animation: pulse-dot 2s ease-in-out infinite;
}

/* ------------------------------ Main ------------------------------------- */
.main {
  flex: 1;
  min-width: 0;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  transition: margin-left 0.26s cubic-bezier(0.4, 0, 0.2, 1);
}

.topbar {
  position: sticky;
  top: 0;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 24px;
  background: rgba(11, 15, 25, 0.72);
  border-bottom: 1px solid var(--border-soft);
  backdrop-filter: blur(16px);
  z-index: 30;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.page-title {
  font-size: 20px;
  letter-spacing: 0.2px;
  white-space: nowrap;
}

.crumb {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.page-host {
  flex: 1;
  min-width: 0;
  padding: 22px 24px 40px;
}

/* ------------------------------ Buttons / Inputs ------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: rgba(26, 34, 52, 0.7);
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.18s ease;
}

.btn svg {
  width: 15px;
  height: 15px;
}

.btn:hover {
  color: var(--text-primary);
  border-color: rgba(99, 102, 241, 0.55);
  background: rgba(99, 102, 241, 0.16);
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn-primary {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(135deg, var(--primary-600), var(--primary-500));
  box-shadow: 0 6px 18px rgba(79, 70, 229, 0.42);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--primary-500), var(--accent-400));
  color: #fff;
}

.btn-ghost {
  background: transparent;
}

.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
  border-radius: 8px;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  background: rgba(26, 34, 52, 0.6);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.18s ease;
}

.icon-btn:hover {
  color: var(--text-primary);
  border-color: rgba(99, 102, 241, 0.5);
  background: rgba(99, 102, 241, 0.16);
}

.nav-toggle {
  display: none;
}

.input,
.select {
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  background: rgba(11, 15, 25, 0.66);
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.input::placeholder {
  color: var(--text-muted);
}

.input:focus,
.select:focus {
  border-color: rgba(99, 102, 241, 0.7);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.18);
}

.select {
  cursor: pointer;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-muted) 50%),
    linear-gradient(135deg, var(--text-muted) 50%, transparent 50%);
  background-position: calc(100% - 16px) 15px, calc(100% - 11px) 15px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 30px;
}

.select option {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

/* 自动刷新开关 */
.switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}

.switch input {
  display: none;
}

.switch-track {
  position: relative;
  width: 38px;
  height: 20px;
  border-radius: 999px;
  background: rgba(100, 116, 139, 0.4);
  transition: background 0.2s ease;
}

.switch-track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.2s ease;
}

.switch input:checked + .switch-track {
  background: linear-gradient(135deg, var(--primary-500), var(--accent-400));
}

.switch input:checked + .switch-track::after {
  transform: translateX(18px);
}

/* ------------------------------ Stat Cards ------------------------------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.stat-card {
  position: relative;
  overflow: hidden;
  padding: 16px 18px 16px 20px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  background: var(--panel-bg);
  backdrop-filter: blur(14px);
  cursor: pointer;
  transition: transform 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease;
}

.stat-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--card-accent, var(--primary-500));
}

.stat-card::after {
  content: "";
  position: absolute;
  right: -30px;
  top: -40px;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: var(--card-accent, var(--primary-500));
  opacity: 0.09;
  filter: blur(6px);
}

.stat-card:hover {
  transform: translateY(-3px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
}

.stat-card.is-active {
  border-color: color-mix(in srgb, var(--card-accent, var(--primary-500)) 60%, transparent);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--card-accent, var(--primary-500)) 40%, transparent),
    var(--shadow-md);
}

.stat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.stat-label {
  font-size: 12px;
  letter-spacing: 1px;
  color: var(--text-secondary);
}

.stat-icon {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  color: var(--card-accent, var(--primary-500));
  background: color-mix(in srgb, var(--card-accent, var(--primary-500)) 16%, transparent);
}

.stat-icon svg {
  width: 16px;
  height: 16px;
}

.stat-value {
  margin-top: 10px;
  font-family: var(--font-mono);
  font-size: 30px;
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.5px;
}

.stat-card.is-running .stat-value {
  color: var(--c-cyan);
  animation: breathe 2.4s ease-in-out infinite;
}

.stat-foot {
  margin-top: 4px;
  font-size: 11px;
  color: var(--text-muted);
}

/* ------------------------------ Panel ------------------------------------ */
.panel {
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  background: var(--panel-bg);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-soft);
  background: rgba(11, 15, 25, 0.34);
}

.toolbar .grow {
  flex: 1;
}

.toolbar .result-count {
  font-size: 12px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.filter-tabs {
  display: inline-flex;
  padding: 3px;
  gap: 3px;
  border: 1px solid var(--border-soft);
  border-radius: 11px;
  background: rgba(11, 15, 25, 0.5);
}

.filter-tab {
  padding: 6px 13px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.18s ease;
}

.filter-tab:hover {
  color: var(--text-primary);
  background: rgba(99, 102, 241, 0.12);
}

.filter-tab.is-active {
  color: #fff;
  background: linear-gradient(135deg, var(--primary-600), var(--primary-500));
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.38);
}

/* ------------------------------ Table ------------------------------------ */
.table-wrap {
  overflow-x: auto;
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1000px;
}

/* 数据稠密表格：单元格统一不换行，超宽时横向滚动，避免文字被逐字挤压换行 */
.data-table th,
.data-table td {
  white-space: nowrap;
}

.data-table td .cell-sub {
  white-space: nowrap;
}

.data-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 11px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1px;
  color: var(--text-muted);
  text-transform: uppercase;
  background: rgba(17, 24, 39, 0.96);
  border-bottom: 1px solid var(--border-soft);
  white-space: nowrap;
}

.data-table tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.08);
  vertical-align: middle;
  font-size: 13px;
}

.data-table tbody tr {
  cursor: pointer;
  transition: background 0.16s ease;
}

.data-table tbody tr:hover {
  background: rgba(99, 102, 241, 0.08);
}

.data-table tbody tr.row-running {
  background: linear-gradient(90deg, rgba(34, 211, 238, 0.09), transparent 46%);
  animation: row-breathe 2.6s ease-in-out infinite;
}

.data-table tbody tr.row-failed td:first-child {
  box-shadow: inset 3px 0 0 var(--c-danger);
}

.data-table tbody tr.row-completed td:first-child {
  box-shadow: inset 3px 0 0 var(--c-success);
}

.mono {
  font-family: var(--font-mono);
  font-size: 12px;
}

.task-id {
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: 340px;
}

.task-id-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-primary);
}

.copy-btn {
  flex: 0 0 auto;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px;
  border-radius: 5px;
  opacity: 0;
  transition: all 0.18s ease;
}

tr:hover .copy-btn {
  opacity: 1;
}

.copy-btn:hover {
  color: var(--accent-400);
  background: rgba(34, 211, 238, 0.14);
}

/* 徽章 */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
  border: 1px solid transparent;
}

.badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.badge-waiting {
  color: var(--c-warn);
  background: rgba(245, 158, 11, 0.13);
  border-color: rgba(245, 158, 11, 0.3);
}

.badge-running {
  color: var(--c-cyan);
  background: rgba(34, 211, 238, 0.13);
  border-color: rgba(34, 211, 238, 0.32);
}

.badge-running::before {
  animation: pulse-dot 1.6s ease-in-out infinite;
}

.badge-failed {
  color: var(--c-danger);
  background: rgba(239, 68, 68, 0.13);
  border-color: rgba(239, 68, 68, 0.32);
}

.badge-completed {
  color: var(--c-success);
  background: rgba(34, 197, 94, 0.13);
  border-color: rgba(34, 197, 94, 0.3);
}

.badge-cancelled,
.badge-unknown {
  color: var(--text-secondary);
  background: rgba(148, 163, 184, 0.12);
  border-color: rgba(148, 163, 184, 0.26);
}

.type-chip {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  padding: 3px 9px;
  border-radius: 7px;
  font-size: 12px;
  color: var(--text-secondary);
  background: rgba(99, 102, 241, 0.12);
  border: 1px solid rgba(99, 102, 241, 0.24);
}

.type-chip.type-cloud {
  color: #93c5fd;
  background: rgba(59, 130, 246, 0.13);
  border-color: rgba(59, 130, 246, 0.28);
}

.type-chip.type-weapp {
  color: #86efac;
  background: rgba(34, 197, 94, 0.12);
  border-color: rgba(34, 197, 94, 0.26);
}

.type-chip.type-dev {
  color: #fcd34d;
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.26);
}

.type-chip.type-task {
  color: #c4b5fd;
  background: rgba(167, 139, 250, 0.14);
  border-color: rgba(167, 139, 250, 0.3);
}

/* 进度条 */
.progress {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 120px;
}

.progress-track {
  position: relative;
  flex: 1;
  height: 6px;
  border-radius: 999px;
  background: rgba(100, 116, 139, 0.26);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--primary-500), var(--accent-400));
  transition: width 0.5s ease;
}

.progress-fill.is-failed {
  background: linear-gradient(90deg, #b91c1c, var(--c-danger));
}

.progress-fill.is-completed {
  background: linear-gradient(90deg, #15803d, var(--c-success));
}

.progress-track.is-running .progress-fill {
  background-image: linear-gradient(90deg, var(--primary-500), var(--accent-400), var(--primary-500));
  background-size: 200% 100%;
  animation: stripes 1.6s linear infinite;
}

.progress-text {
  flex: 0 0 38px;
  text-align: right;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-secondary);
}

.cell-sub {
  font-size: 11px;
  color: var(--text-muted);
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.error-hint {
  color: var(--c-danger);
  cursor: help;
}

/* ------------------------------ Empty / Loading -------------------------- */
.empty-state {
  padding: 62px 20px;
  text-align: center;
  color: var(--text-muted);
}

.empty-state svg {
  width: 44px;
  height: 44px;
  opacity: 0.4;
  margin-bottom: 12px;
}

.empty-state .empty-title {
  font-size: 14px;
  color: var(--text-secondary);
}

.spinner {
  width: 15px;
  height: 15px;
  border: 2px solid rgba(148, 163, 184, 0.3);
  border-top-color: var(--accent-400);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}

.loading-inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 12px;
}

/* ------------------------------ Pager ------------------------------------ */
.pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 12px 16px;
  border-top: 1px solid var(--border-soft);
  color: var(--text-muted);
  font-size: 12px;
}

.pager .pager-info {
  margin-right: auto;
  font-family: var(--font-mono);
}

/* ------------------------------ Drawer ----------------------------------- */
.drawer-mask {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.62);
  backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity 0.24s ease;
  z-index: 60;
}

.drawer-mask.is-open {
  opacity: 1;
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(760px, 92vw);
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, rgba(20, 27, 43, 0.98), rgba(11, 15, 25, 0.99));
  border-left: 1px solid var(--border-strong);
  box-shadow: var(--shadow-lg);
  transform: translateX(100%);
  transition: transform 0.28s cubic-bezier(0.32, 0.72, 0, 1);
  z-index: 61;
}

.drawer.is-open {
  transform: translateX(0);
}

.drawer-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border-soft);
  background: rgba(11, 15, 25, 0.5);
}

.drawer-head .drawer-title-wrap {
  min-width: 0;
  flex: 1;
}

.drawer-title {
  font-family: var(--font-mono);
  font-size: 14px;
  word-break: break-all;
}

.drawer-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-muted);
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px 20px 30px;
}

.drawer-foot {
  padding: 12px 20px;
  border-top: 1px solid var(--border-soft);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background: rgba(11, 15, 25, 0.5);
}

.section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 0 12px;
  font-size: 13px;
  letter-spacing: 0.6px;
  color: var(--text-secondary);
}

.section-title::before {
  content: "";
  width: 3px;
  height: 14px;
  border-radius: 3px;
  background: linear-gradient(180deg, var(--primary-500), var(--accent-400));
}

.notice {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  margin-bottom: 14px;
  border-radius: 10px;
  font-size: 12px;
  color: #fcd34d;
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.28);
}

/* ------------------------------ Timeline --------------------------------- */
.timeline {
  position: relative;
  padding-left: 24px;
  margin-bottom: 22px;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 7px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: linear-gradient(180deg, rgba(99, 102, 241, 0.5), rgba(34, 211, 238, 0.18));
}

.tl-item {
  position: relative;
  padding: 10px 12px;
  margin-bottom: 8px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  background: rgba(26, 34, 52, 0.5);
  transition: border-color 0.2s ease, background 0.2s ease;
}

.tl-item:hover {
  border-color: var(--border-strong);
  background: rgba(26, 34, 52, 0.72);
}

.tl-item::before {
  content: "";
  position: absolute;
  left: -22px;
  top: 16px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--text-muted);
  box-shadow: 0 0 0 3px rgba(11, 15, 25, 0.9);
}

.tl-item.tl-completed::before {
  background: var(--c-success);
  box-shadow: 0 0 0 3px rgba(11, 15, 25, 0.9), 0 0 10px rgba(34, 197, 94, 0.6);
}

.tl-item.tl-failed::before {
  background: var(--c-danger);
  box-shadow: 0 0 0 3px rgba(11, 15, 25, 0.9), 0 0 10px rgba(239, 68, 68, 0.6);
}

.tl-item.tl-running::before,
.tl-item.tl-in_progress::before {
  background: var(--c-cyan);
  box-shadow: 0 0 0 3px rgba(11, 15, 25, 0.9), 0 0 10px rgba(34, 211, 238, 0.7);
  animation: pulse-dot 1.7s ease-in-out infinite;
}

.tl-item.tl-pending::before {
  background: var(--c-warn);
}

.tl-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.tl-seq {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}

.tl-name {
  font-size: 13px;
  font-weight: 500;
}

.tl-time {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}

.tl-current {
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-secondary);
}

.tl-error {
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: #fecaca;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.28);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 220px;
  overflow: auto;
}

/* 子步骤 */
.sub-steps {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--border-soft);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sub-step {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 12px;
}

.sub-step .dot {
  flex: 0 0 7px;
  width: 7px;
  height: 7px;
  margin-top: 6px;
  border-radius: 50%;
  background: var(--text-muted);
}

.sub-step.s-completed .dot {
  background: var(--c-success);
}

.sub-step.s-failed .dot {
  background: var(--c-danger);
}

.sub-step.s-in_progress .dot {
  background: var(--c-cyan);
  animation: pulse-dot 1.6s ease-in-out infinite;
}

.sub-step.s-pending .dot {
  background: rgba(148, 163, 184, 0.5);
}

.sub-step .sub-body {
  min-width: 0;
  flex: 1;
}

.sub-step .sub-name {
  color: var(--text-secondary);
}

.sub-step .sub-op {
  color: var(--text-muted);
  font-size: 11px;
  word-break: break-all;
}

.sub-step .sub-err {
  color: var(--c-danger);
  font-size: 11px;
  margin-top: 2px;
  word-break: break-word;
}

.kv-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.kv {
  padding: 10px 12px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  background: rgba(26, 34, 52, 0.44);
}

.kv .k {
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.6px;
}

.kv .v {
  margin-top: 4px;
  font-size: 13px;
  word-break: break-all;
}

/* ------------------------------ Log Viewer -------------------------------- */
.log-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.log-tab {
  padding: 4px 10px;
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  background: rgba(11, 15, 25, 0.5);
  color: var(--text-secondary);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.18s ease;
}

.log-tab:hover {
  color: var(--text-primary);
  border-color: rgba(99, 102, 241, 0.5);
}

.log-tab.is-active {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(135deg, var(--primary-600), var(--primary-500));
}

.log-viewer {
  max-height: 420px;
  overflow: auto;
  padding: 10px 12px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  background: rgba(2, 6, 23, 0.72);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.65;
}

.log-line {
  display: flex;
  gap: 10px;
  padding: 2px 4px;
  border-radius: 5px;
  word-break: break-word;
  white-space: pre-wrap;
}

.log-line:hover {
  background: rgba(99, 102, 241, 0.1);
}

.log-line .log-time {
  flex: 0 0 auto;
  color: var(--text-muted);
}

.log-line .log-level {
  flex: 0 0 auto;
  min-width: 52px;
  text-transform: uppercase;
  font-size: 10px;
  padding-top: 2px;
}

.log-line .log-msg {
  flex: 1;
  min-width: 0;
  color: #cbd5e1;
}

.log-line.is-error {
  background: rgba(239, 68, 68, 0.09);
}

.log-line.is-error .log-level,
.log-line.is-error .log-msg {
  color: #fca5a5;
}

.log-line.is-warn .log-level,
.log-line.is-warn .log-msg {
  color: #fcd34d;
}

.log-line.is-step .log-level,
.log-line.is-phase .log-level,
.log-line.is-port .log-level,
.log-line.is-cmd .log-level,
.log-line.is-collect .log-level {
  color: #c4b5fd;
}

.log-line.is-file {
  margin: 6px 0 2px;
  background: rgba(34, 211, 238, 0.1);
}

.log-line.is-file .log-msg {
  color: var(--accent-400);
  font-weight: 600;
}

.log-line.is-raw .log-msg {
  color: #94a3b8;
}

.log-more {
  margin-top: 10px;
  display: flex;
  justify-content: center;
}

.drawer-mask[hidden] {
  display: none;
}

/* 未打开时不拦截点击（避免关闭动画期间挡住页面交互） */
.drawer-mask:not(.is-open),
.drawer:not(.is-open) {
  pointer-events: none;
}

/* ------------------------------ Toast ------------------------------------ */
.toast-host {
  position: fixed;
  right: 22px;
  bottom: 22px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 90;
}

.toast {
  min-width: 180px;
  max-width: 360px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  color: var(--text-primary);
  background: var(--panel-bg-strong);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(12px);
  animation: fade-in 0.24s ease both;
  transition: opacity 0.24s ease, transform 0.24s ease;
}

.toast-error {
  border-color: rgba(239, 68, 68, 0.45);
  color: #fecaca;
}

.toast-info {
  border-color: rgba(34, 211, 238, 0.4);
  color: #a5f3fc;
}

.toast.is-hide {
  opacity: 0;
  transform: translateY(6px);
}

/* ------------------------------ Login ------------------------------------ */
.sidebar-logout {
  padding: 3px 8px;
  border: 1px solid var(--border-soft);
  border-radius: 7px;
  background: transparent;
  color: var(--text-muted);
  font-size: 11px;
  cursor: pointer;
  transition: all 0.18s ease;
}

.sidebar-logout:hover {
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.45);
  background: rgba(239, 68, 68, 0.12);
}

/* 未登录时隐藏顶部工具栏操作区，避免误触 */
body.is-locked .topbar-right {
  display: none;
}

.login-wrap {
  min-height: calc(100vh - var(--topbar-h) - 90px);
  display: grid;
  place-items: center;
  padding: 24px 0;
}

.login-card {
  position: relative;
  width: min(400px, 92vw);
  padding: 36px 32px 26px;
  border: 1px solid var(--border-soft);
  border-radius: 22px;
  background: var(--panel-bg);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow-lg);
  text-align: center;
  animation: fade-in 0.3s ease both;
}

.login-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  border-radius: 22px 22px 0 0;
  background: linear-gradient(90deg, var(--primary-500), var(--accent-400));
}

.login-logo {
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  color: #fff;
  background: linear-gradient(135deg, var(--primary-500), var(--accent-400));
  box-shadow: 0 12px 28px rgba(99, 102, 241, 0.45);
}

.login-logo svg {
  width: 26px;
  height: 26px;
}

.login-title {
  font-size: 19px;
  letter-spacing: 0.3px;
}

.login-sub {
  margin: 6px 0 22px;
  font-size: 12.5px;
  color: var(--text-muted);
}

.login-field {
  display: block;
  margin-bottom: 14px;
  text-align: left;
}

.login-field > span {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  color: var(--text-secondary);
}

.login-field .input {
  width: 100%;
  height: 42px;
}

.login-error {
  margin-bottom: 12px;
  padding: 8px 10px;
  border-radius: 9px;
  font-size: 12.5px;
  text-align: left;
  color: #fecaca;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.32);
}

.login-submit {
  width: 100%;
  height: 42px;
  justify-content: center;
}

.login-tip {
  margin: 18px 0 0;
  font-size: 11px;
  line-height: 1.7;
  color: var(--text-muted);
}

/* ------------------------------ Animations ------------------------------- */
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes pulse-dot {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.45;
    transform: scale(0.86);
  }
}

@keyframes breathe {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.68;
  }
}

@keyframes row-breathe {
  0%,
  100% {
    background-color: rgba(34, 211, 238, 0.04);
  }
  50% {
    background-color: rgba(34, 211, 238, 0.11);
  }
}

@keyframes stripes {
  to {
    background-position: -200% 0;
  }
}

.fade-in {
  animation: fade-in 0.28s ease both;
}

@keyframes fade-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ------------------------------ Responsive ------------------------------- */
@media (max-width: 1180px) {
  .stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 1024px) {
  .sidebar {
    width: 72px;
    padding-left: 10px;
    padding-right: 10px;
  }

  .sidebar .brand-text,
  .sidebar .nav-item span:not(.nav-badge),
  .sidebar .nav-section,
  .sidebar .sidebar-foot-text,
  .sidebar .version {
    display: none;
  }

  .sidebar .nav-item {
    justify-content: center;
  }

  .main {
    margin-left: 72px;
  }

  .nav-toggle {
    display: inline-grid;
  }

  body.nav-open .sidebar {
    width: var(--sidebar-w);
  }

  body.nav-open .sidebar .brand-text,
  body.nav-open .sidebar .nav-item span:not(.nav-badge),
  body.nav-open .sidebar .nav-section,
  body.nav-open .sidebar .sidebar-foot-text,
  body.nav-open .sidebar .version {
    display: block;
  }

  body.nav-open .sidebar .nav-item {
    justify-content: flex-start;
  }

  body.nav-open .main {
    margin-left: var(--sidebar-w);
  }
}
