/* ============================================================================
   Stellarium · AutoHeypixel 控制台 (v3)
   - 玻璃质感 + 极淡青绿调
   - 字体：Inter + Noto Sans SC + PingFang SC 系统回退
   - 移动端响应式 + 安全区适配
   - iOS Hello 开机动画 + 粒子背景
   ========================================================================= */

:root {
  --primary: #00685d;
  --primary-soft: #008376;
  --primary-tint: rgba(0, 104, 93, 0.08);
  --primary-tint-hover: rgba(0, 104, 93, 0.14);
  --gradient-from: #00897b;
  --gradient-to:   #009688;
  --gradient-aux:  #6ed4c4;
  --error:   #ba1a1a;
  --warn:    #b76b00;
  --warn-soft: #f9a825;
  --success: #2e7d32;
  --info:    #0277bd;
  --on-surface:         #071e27;
  --on-surface-variant: #3d4946;
  --outline:      #6d7a77;
  --outline-soft: #e2eaeb;
  --surface-0:  #f3faff;
  --surface-1:  rgba(255, 255, 255, 0.78);
  --surface-2:  rgba(255, 255, 255, 0.94);
  --shadow-card:  0 1px 0 rgba(0,0,0,0.02), 0 6px 18px rgba(0, 80, 75, 0.05);
  --shadow-hover: 0 1px 0 rgba(0,0,0,0.03), 0 12px 32px rgba(0, 80, 75, 0.10);
  --shadow-pop:   0 24px 64px rgba(0, 80, 75, 0.20);
  --radius-card: 16px;
  --radius-btn:  10px;
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "PingFang SC",
               "HarmonyOS Sans SC", "MiSans", "Noto Sans SC",
               "Microsoft YaHei UI", "Segoe UI", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", ui-monospace, "Cascadia Code",
               "Roboto Mono", monospace;
  --safe-top:    env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--on-surface);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "ss01", "cv11", "ss03";
}

body {
  background:
    radial-gradient(at 8% 0%, rgba(0,150,136,0.07) 0%, transparent 38%),
    radial-gradient(at 100% 10%, rgba(112,216,200,0.06) 0%, transparent 40%),
    radial-gradient(at 50% 100%, rgba(0,131,118,0.05) 0%, transparent 50%),
    #f5fafc;
  min-height: 100vh;
  min-height: 100svh;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; }

.material-symbols-outlined {
  font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 24;
  user-select: none;
  line-height: 1;
}

/* ── Hello 开机动画 ──────────────────────────────────────────────── */
.hello-intro {
  position: fixed; inset: 0;
  z-index: 9999;
  background: #ffffff;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  transition: opacity 0.7s cubic-bezier(0.4, 0, 0.2, 1), transform 0.7s ease;
}
.hello-intro.hello-leave {
  opacity: 0;
  transform: scale(1.05);
  pointer-events: none;
}
.hello-bg {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  filter: blur(40px);
  opacity: 0.85;
}
.hello-stage {
  position: relative; z-index: 1;
  text-align: center;
  padding: 0 24px;
}
/* SVG 容器：留足上下空间避免被裁 */
#hello-stage {
  width: 100%;
  max-width: min(54vw, 680px);
  padding: 60px 24px;   /* 上下各 60px，给 stroke-width=60 的笔画留出溢出空间 */
}
.hello-svg {
  width: 100%;
  height: auto;
  display: block;
  overflow: visible;    /* 让 stroke 能突破 viewBox 不被裁 */
  filter: drop-shadow(0 4px 18px rgba(0, 80, 75, 0.12));
}

/* 平板 */
@media (max-width: 1024px) {
  #hello-stage { max-width: min(66vw, 580px); padding: 48px 20px; }
}
/* 移动端 */
@media (max-width: 768px) {
  #hello-stage { max-width: 76vw; padding: 36px 16px; }
}
@media (max-width: 480px) {
  #hello-stage { max-width: 82vw; padding: 28px 12px; }
}

.hello-skip {
  position: absolute;
  right: max(24px, env(safe-area-inset-right, 0px));
  bottom: max(24px, var(--safe-bottom));
  z-index: 2;
  padding: 8px 18px;
  border-radius: 999px;
  background: rgba(7, 30, 39, 0.06);
  color: var(--on-surface-variant);
  border: 1px solid rgba(7, 30, 39, 0.08);
  font-size: 12px;
  cursor: pointer;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: background 0.15s ease;
}
.hello-skip:hover { background: rgba(7, 30, 39, 0.12); }

/* ── 粒子背景（z-index: 0，在所有内容之下，纯做背景）──────────────── */
.bg-particles {
  position: fixed; inset: 0;
  width: 100%; height: 100%;
  z-index: 0;
  pointer-events: none;
}
#app { position: relative; z-index: 1; }

/* ── 卡片 ────────────────────────────────────────────────────────── */
.card {
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.04);
  box-shadow: var(--shadow-card);
  border-radius: var(--radius-card);
}
.card-soft {
  background: var(--surface-2);
  border: 1px solid rgba(0, 0, 0, 0.03);
  box-shadow: var(--shadow-card);
  border-radius: var(--radius-card);
}
.card-glass {
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(24px) saturate(140%);
  -webkit-backdrop-filter: blur(24px) saturate(140%);
  border: 1px solid rgba(255, 255, 255, 0.6);
  box-shadow: 0 16px 48px rgba(0, 90, 80, 0.12);
  border-radius: 20px;
}
.hoverable { transition: box-shadow .2s ease, transform .2s ease, border-color .2s ease; }
.hoverable:hover { box-shadow: var(--shadow-hover); transform: translateY(-1px); }

/* ── 按钮 ────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px;
  border-radius: 12px;
  font-size: 13px; font-weight: 500;
  border: 1.5px solid transparent;
  transition: all .2s ease;
  cursor: pointer;
  background: transparent;
  color: var(--on-surface);
  white-space: nowrap;
  line-height: 1.2;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

.btn-primary {
  background: linear-gradient(135deg, var(--gradient-from), var(--gradient-to));
  color: #fff;
  box-shadow: 0 4px 14px rgba(0, 137, 123, 0.30);
}
.btn-primary:hover:not(:disabled) { filter: brightness(1.08); box-shadow: 0 8px 22px rgba(0, 137, 123, 0.40); transform: translateY(-1px); }
.btn-primary:active:not(:disabled) { transform: translateY(0); filter: brightness(1.0); }

.btn-secondary {
  background: #ffffff;
  color: var(--on-surface-variant);
  border-color: var(--outline-soft);
}
.btn-secondary:hover:not(:disabled) {
  color: var(--primary);
  border-color: var(--primary);
  background: var(--primary-tint);
}

.btn-ghost { color: var(--on-surface-variant); }
.btn-ghost:hover:not(:disabled) { background: var(--primary-tint); color: var(--primary); }

.btn-danger {
  color: var(--error);
  border: 1px solid rgba(186, 26, 26, 0.25);
  background: #ffffff;
}
.btn-danger:hover:not(:disabled) {
  background: rgba(186, 26, 26, 0.06);
  border-color: var(--error);
}

.btn-icon {
  width: 36px; height: 36px; padding: 0;
  justify-content: center;
  border-radius: 10px;
}

/* ── 输入 ────────────────────────────────────────────────────────── */
.input {
  width: 100%;
  padding: 12px 16px;
  background: linear-gradient(180deg, #ffffff 0%, #fafdfd 100%);
  border: 1.5px solid var(--outline-soft);
  border-radius: 14px;
  font-family: var(--font-sans);
  font-size: 14px;
  color: var(--on-surface);
  transition: all .2s ease;
  box-shadow: inset 0 1px 2px rgba(7, 30, 39, 0.025);
}
.input:hover { border-color: rgba(0, 104, 93, 0.25); }
.input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow:
    0 0 0 4px rgba(0, 104, 93, 0.14),
    inset 0 1px 2px rgba(0, 104, 93, 0.05);
  background: #ffffff;
}
.input::placeholder { color: #9aa6a4; letter-spacing: 0.02em; }
.input-mono { font-family: var(--font-mono); letter-spacing: 0.04em; }

select.input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%236d7a77' d='M5 6 0 0h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  padding-right: 38px;
}

/* ── 徽章 ────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 999px;
  font-size: 11px; font-weight: 500;
  border: 1px solid transparent;
  font-family: var(--font-sans);
  line-height: 1.4;
  white-space: nowrap;
}
.badge .dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.badge-success { background: rgba(46,125,50,0.08); color: var(--success); border-color: rgba(46,125,50,0.18); }
.badge-success .dot { background: var(--success); }
.badge-error   { background: rgba(186,26,26,0.07); color: var(--error); border-color: rgba(186,26,26,0.18); }
.badge-error .dot { background: var(--error); }
.badge-primary { background: var(--primary-tint); color: var(--primary); border-color: rgba(0,104,93,0.18); }
.badge-primary .dot { background: var(--primary); }
.badge-warn    { background: rgba(249,168,37,0.10); color: var(--warn); border-color: rgba(249,168,37,0.25); }
.badge-warn .dot { background: var(--warn-soft); }
.badge-info    { background: rgba(2,119,189,0.08); color: var(--info); border-color: rgba(2,119,189,0.18); }
.badge-info .dot { background: var(--info); }
.badge-muted   { background: #f1f5f6; color: var(--on-surface-variant); border-color: var(--outline-soft); }
.badge-muted .dot { background: var(--outline); }
.badge-pill    { padding: 4px 12px; font-size: 12px; }

/* 呼吸点 */
.pulse-dot { position: relative; }
.pulse-dot::before {
  content: ''; position: absolute; inset: -3px;
  border-radius: 50%; background: inherit;
  opacity: 0.5;
  animation: pulse 2s ease-out infinite;
}
@keyframes pulse {
  0%   { transform: scale(0.6); opacity: 0.6; }
  100% { transform: scale(2.2); opacity: 0;   }
}

/* ── OTP 验证码盒子 ───────────────────────────────────────────────── */
.otp-input {
  width: 46px; height: 58px;
  background: rgba(0, 137, 123, 0.06);
  border: 2px solid transparent;
  border-radius: 999px;            /* 全圆胶囊 */
  text-align: center;
  font-family: var(--font-mono);
  font-size: 22px; font-weight: 700;
  color: var(--on-surface);
  transition: all .18s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 2px 8px rgba(0, 104, 93, 0.06);
  caret-color: var(--primary);
  letter-spacing: 0;
}
.otp-input:hover {
  background: rgba(0, 137, 123, 0.11);
  border-color: rgba(0, 104, 93, 0.18);
}
.otp-input:focus {
  outline: none;
  background: #fff;
  border-color: var(--primary);
  box-shadow:
    0 0 0 4px rgba(0, 104, 93, 0.15),
    0 4px 16px rgba(0, 104, 93, 0.18);
  transform: translateY(-2px) scale(1.06);
}
.otp-input:not(:placeholder-shown) {
  background: rgba(0, 137, 123, 0.09);
  border-color: rgba(0, 104, 93, 0.35);
  color: var(--primary);
}

.error-shake { animation: shake 0.4s cubic-bezier(.36,.07,.19,.97); }
@keyframes shake {
  10%, 90% { transform: translate3d(-1px, 0, 0); }
  20%, 80% { transform: translate3d(2px, 0, 0); }
  30%, 50%, 70% { transform: translate3d(-3px, 0, 0); }
  40%, 60% { transform: translate3d(3px, 0, 0); }
}

/* ── Topbar / Sidebar ────────────────────────────────────────────── */
.topbar {
  position: fixed;
  top: var(--safe-top); left: 0; right: 0;
  z-index: 40;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px;
  height: 60px;
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  border-bottom: 1px solid var(--outline-soft);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand a { display: flex; align-items: center; gap: 10px; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 10px;
  background: linear-gradient(135deg, var(--gradient-from), var(--gradient-to));
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 14px rgba(0, 137, 123, 0.35);
}
.brand-mark .material-symbols-outlined { color: #fff; font-size: 18px; }
.brand-name { font-size: 16px; font-weight: 600; letter-spacing: 0.01em; }
.brand-sep  { color: var(--outline-soft); }
.brand-page { font-size: 13px; color: var(--on-surface-variant); }

.hamburger {
  display: none;
  width: 40px; height: 40px;
  align-items: center; justify-content: center;
  border-radius: 10px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--on-surface-variant);
  cursor: pointer;
}
.hamburger:hover { background: var(--primary-tint); color: var(--primary); }

.sidebar {
  position: fixed;
  top: calc(60px + var(--safe-top));
  bottom: 0; left: 0;
  width: 240px;
  background: rgba(255,255,255,0.72);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  border-right: 1px solid var(--outline-soft);
  padding: 16px 12px;
  display: flex; flex-direction: column; gap: 16px;
  overflow-y: auto;
  z-index: 38;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.sidebar-overlay {
  position: fixed; inset: 0; z-index: 37;
  background: rgba(7, 30, 39, 0.4);
  backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.sidebar.open + .sidebar-overlay,
.sidebar-overlay.open { opacity: 1; pointer-events: auto; }

.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-link {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 10px;
  font-size: 13px; color: var(--on-surface-variant);
  transition: all .15s ease;
  cursor: pointer;
}
.side-link:hover { background: var(--primary-tint); color: var(--primary); }
.side-link.active { background: var(--primary-tint); color: var(--primary); font-weight: 600; }
.side-link .material-symbols-outlined { font-size: 18px; }

.side-section-title {
  padding: 14px 12px 6px;
  font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--outline); font-weight: 600;
}

.side-stat {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255,255,255,0.6);
  border: 1px solid var(--outline-soft);
  transition: all 0.15s ease;
}
.side-stat:hover { background: rgba(255,255,255,0.85); border-color: rgba(0,104,93,0.15); }
.side-stat .lbl { font-size: 12px; color: var(--on-surface-variant); }
.side-stat .val { font-family: var(--font-mono); font-size: 16px; font-weight: 600; color: var(--on-surface); }
.side-stat .val.primary { color: var(--primary); }
.side-stat .val.error   { color: var(--error); }

/* ── 通用版式 ───────────────────────────────────────────────────── */
.section-title {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
  gap: 8px;
}
.section-title h2 {
  font-size: 14px; font-weight: 600; color: var(--on-surface);
  display: flex; align-items: center; gap: 8px;
  margin: 0;
}
.section-title .meta { font-size: 12px; color: var(--outline); font-family: var(--font-mono); }

.kv-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 20px;
}
.kv-grid > div { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.kv-grid .k { font-size: 11px; color: var(--outline); font-weight: 500; }
.kv-grid .v { font-size: 13px; font-family: var(--font-mono); color: var(--on-surface); word-break: break-all; }

.divider { height: 1px; background: var(--outline-soft); margin: 12px 0; }

/* ── KPI ─────────────────────────────────────────────────────────── */
.kpi {
  background: #ffffff;
  border-radius: var(--radius-card);
  border: 1px solid var(--outline-soft);
  padding: 16px 18px;
  display: flex; flex-direction: column; gap: 6px;
  position: relative;
  overflow: hidden;
  transition: all 0.2s ease;
}
.kpi:hover { transform: translateY(-1px); box-shadow: var(--shadow-hover); }
.kpi::after {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 100px; height: 100px;
  background: radial-gradient(circle, var(--primary-tint), transparent 70%);
  opacity: 0.3;
  pointer-events: none;
}
.kpi .kpi-head { display: flex; align-items: center; justify-content: space-between; }
.kpi .kpi-label { font-size: 12px; color: var(--on-surface-variant); display: flex; align-items: center; gap: 6px; }
.kpi .kpi-trend { font-size: 11px; font-family: var(--font-mono); color: var(--outline); }
.kpi .kpi-value {
  font-family: var(--font-mono);
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--on-surface);
  line-height: 1.05;
}
.kpi.success .kpi-value { color: var(--success); }
.kpi.primary .kpi-value { color: var(--primary); }
.kpi.warn    .kpi-value { color: var(--warn); }
.kpi.error   .kpi-value { color: var(--error); }
.kpi .kpi-foot { font-size: 11px; color: var(--outline); font-family: var(--font-mono); }

/* ── 运行中 ticker（横向滚动正在拉谁）─────────────────────────── */
.run-ticker {
  display: flex; align-items: center;
  gap: 16px;
  padding: 12px 18px;
  background: linear-gradient(90deg, rgba(0,104,93,0.06), rgba(112,216,200,0.04), rgba(0,104,93,0.06));
  border: 1px solid rgba(0,104,93,0.10);
  border-radius: 14px;
  overflow: hidden;
}
.run-ticker .lbl {
  display: flex; align-items: center; gap: 6px;
  flex-shrink: 0;
  font-size: 11px; font-weight: 600;
  color: var(--primary);
  text-transform: uppercase; letter-spacing: 0.05em;
}
.run-ticker .lbl .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--primary); }
.run-ticker .lane {
  display: flex; gap: 24px;
  flex: 1; min-width: 0;
  overflow: hidden;
  mask: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent);
  -webkit-mask: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent);
}
.run-ticker .lane-track {
  display: flex; gap: 24px;
  white-space: nowrap;
  animation: ticker-slide 36s linear infinite;
}
@keyframes ticker-slide {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}
.run-ticker .item {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12.5px;
  color: var(--on-surface);
  font-family: var(--font-mono);
}
.run-ticker .item .cid { color: var(--outline); }
.run-ticker .item .arrow { color: var(--primary); }
.run-ticker .empty {
  flex: 1; text-align: center;
  font-size: 12px; color: var(--on-surface-variant); font-style: italic;
}

/* ── Bot 卡片 ───────────────────────────────────────────────────── */
.bot-card {
  display: block;
  background: #ffffff;
  border: 1px solid var(--outline-soft);
  border-radius: var(--radius-card);
  padding: 16px 18px 14px;
  transition: all .2s ease;
  position: relative;
  overflow: hidden;
}
.bot-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--outline-soft);
  border-radius: var(--radius-card) var(--radius-card) 0 0;
}
.bot-card.is-online::before { background: linear-gradient(90deg, var(--success), #61c266); }
.bot-card.is-working::before { background: linear-gradient(90deg, var(--primary), var(--gradient-aux)); }
.bot-card.is-paused::before { background: linear-gradient(90deg, var(--warn), var(--warn-soft)); }
.bot-card.is-offline::before { background: linear-gradient(90deg, var(--error), #d35454); }
.bot-card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
  border-color: rgba(0, 104, 93, 0.25);
}
.bot-card .cid {
  font-family: var(--font-mono);
  font-size: 17px; font-weight: 700;
  color: var(--on-surface);
  letter-spacing: 0.01em;
}
.bot-card .meta-row {
  display: flex; align-items: center;
  gap: 8px; margin-top: 4px;
  font-size: 12px; color: var(--on-surface-variant);
  min-width: 0;
}
.bot-card .meta-row > * { min-width: 0; }
.bot-card .meta-row .dot-sep { width: 3px; height: 3px; border-radius: 50%; background: var(--outline-soft); flex-shrink: 0; }
.bot-card .task {
  margin-top: 14px;
  padding: 12px;
  background: var(--primary-tint);
  border-radius: 12px;
  border: 1px solid rgba(0, 104, 93, 0.10);
  font-size: 13px;
}
.bot-card .task.idle {
  background: #f6f9fa;
  border-color: var(--outline-soft);
  color: var(--on-surface-variant);
}
.bot-card .stats-row {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 14px; padding-top: 12px;
  border-top: 1px solid var(--outline-soft);
}
.bot-card .stats-row .item { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.bot-card .stats-row .item .lbl { font-size: 10.5px; color: var(--outline); letter-spacing: 0.04em; }
.bot-card .stats-row .item .val { font-family: var(--font-mono); font-size: 14px; font-weight: 600; color: var(--on-surface); }
.bot-card .stats-row .item .val.success { color: var(--primary); }
.bot-card .stats-row .item .val.error   { color: var(--error); }

/* ── 流程 timeline ──────────────────────────────────────────────── */
.flow-step { position: relative; padding-left: 36px; padding-bottom: 18px; }
.flow-step:last-child { padding-bottom: 0; }
.flow-step::before {
  content: ''; position: absolute;
  left: 13px; top: 26px; bottom: -4px;
  width: 2px;
  background: var(--outline-soft);
}
.flow-step:last-child::before { display: none; }
.flow-step.is-ok::before { background: var(--primary); }
.flow-step.is-run::before { background: linear-gradient(180deg, var(--primary), var(--outline-soft)); }
.flow-step .node {
  position: absolute; left: 0; top: 0;
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: #fff;
  border: 2px solid var(--outline-soft);
  z-index: 1;
}
.flow-step .node .material-symbols-outlined { font-size: 15px; color: var(--outline); }
.flow-step.is-run  .node { border-color: var(--primary); background: var(--primary-tint); }
.flow-step.is-run  .node .material-symbols-outlined { color: var(--primary); animation: spin 1.4s linear infinite; }
.flow-step.is-ok   .node { background: var(--primary); border-color: var(--primary); }
.flow-step.is-ok   .node .material-symbols-outlined { color: #fff; }
.flow-step.is-fail .node { background: var(--error); border-color: var(--error); }
.flow-step.is-fail .node .material-symbols-outlined { color: #fff; }
.flow-step .label { font-size: 13px; font-weight: 600; color: var(--on-surface); padding-top: 4px; }
.flow-step.is-wait .label { color: var(--outline); font-weight: 500; }
.flow-step .sub { font-size: 11px; color: var(--outline); margin-top: 2px; font-family: var(--font-mono); }

@keyframes spin { to { transform: rotate(360deg); } }

/* ── 队列 ────────────────────────────────────────────────────────── */
.queue-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 12px;
  border-radius: 10px;
  background: #fafdfd;
  border: 1px solid var(--outline-soft);
  transition: background .15s ease;
  gap: 8px;
}
.queue-item:hover { background: #f0f7f8; }
.queue-item .pos {
  width: 28px; height: 28px;
  border-radius: 8px;
  background: #fff; border: 1px solid var(--outline-soft);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-size: 12px; font-weight: 700;
  color: var(--on-surface-variant);
  flex-shrink: 0;
}
.queue-item .pos.priority {
  background: linear-gradient(135deg, var(--primary-tint), rgba(112,216,200,0.18));
  color: var(--primary);
  border-color: rgba(0,104,93,0.25);
}
.queue-item .name { font-size: 13px; font-weight: 600; color: var(--on-surface); }
.queue-item .sub  { font-size: 11px; color: var(--outline); font-family: var(--font-mono); }

/* ── 日志终端 ──────────────────────────────────────────────────── */
.term-shell {
  background: #0d1117;
  border-radius: var(--radius-card);
  overflow: hidden;
  display: flex; flex-direction: column;
  border: 1px solid rgba(255,255,255,0.04);
  box-shadow: 0 12px 32px rgba(13, 17, 23, 0.25);
}
.term-head {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  background: #161b22;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  font-family: var(--font-mono);
  font-size: 11px;
  color: #768390;
}
.term-head .dots { display: flex; gap: 6px; }
.term-head .dots span { width: 11px; height: 11px; border-radius: 50%; }
.term-head .dots span:nth-child(1) { background: #ff5f57; }
.term-head .dots span:nth-child(2) { background: #ffbd2e; }
.term-head .dots span:nth-child(3) { background: #28c93f; }
.term-body {
  flex: 1; overflow-y: auto; padding: 8px 0;
  font-family: var(--font-mono);
  font-size: 12.5px;
  scrollbar-width: thin;
  scrollbar-color: #30363d transparent;
}
.term-body::-webkit-scrollbar { width: 8px; height: 8px; }
.term-body::-webkit-scrollbar-track { background: transparent; }
.term-body::-webkit-scrollbar-thumb { background: #30363d; border-radius: 4px; }
.term-body::-webkit-scrollbar-thumb:hover { background: #484f58; }

.log-line {
  display: grid;
  grid-template-columns: 90px 50px 90px 1fr;
  gap: 12px; align-items: baseline;
  padding: 2px 16px;
  line-height: 1.65;
}
.log-line:hover { background: rgba(255,255,255,0.025); }
.log-line .ts  { color: #6e7681; }
.log-line .lv  {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 700; font-size: 10.5px;
  text-align: center;
  letter-spacing: 0.04em;
}
.log-line .lv-OK   { color: #3fb950; background: rgba(63,185,80,0.12); }
.log-line .lv-INFO { color: #58a6ff; background: rgba(88,166,255,0.12); }
.log-line .lv-ERR  { color: #ff7b72; background: rgba(255,123,114,0.12); }
.log-line .lv-WARN { color: #d29922; background: rgba(210,153,34,0.12); }
.log-line .op  {
  color: #79c0ff;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.log-line .msg { color: #c9d1d9; word-break: break-word; }
.log-line .det { color: #8b949e; margin-left: 4px; font-style: italic; }

.log-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--outline-soft);
  font-size: 11px;
  color: var(--on-surface-variant);
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}
.log-chip:hover { border-color: var(--primary); color: var(--primary); }
.log-chip.active {
  background: var(--primary-tint);
  border-color: var(--primary);
  color: var(--primary);
  font-weight: 600;
}

/* ── 表格 ────────────────────────────────────────────────────────── */
.table-host { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl thead th {
  text-align: left;
  font-size: 11px; font-weight: 700;
  color: var(--outline);
  padding: 10px 12px;
  border-bottom: 1px solid var(--outline-soft);
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.tbl tbody td {
  padding: 11px 12px;
  border-bottom: 1px solid #f0f4f5;
  font-family: var(--font-mono);
  font-size: 12.5px;
  vertical-align: top;
}
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl tbody tr:hover td { background: #f8fbfc; }
.tbl .col-result.ok   { color: var(--primary); font-weight: 700; }
.tbl .col-result.fail { color: var(--error);   font-weight: 700; }

/* ── Toast ──────────────────────────────────────────────────────── */
.toast-host {
  position: fixed;
  z-index: 80;
  bottom: max(24px, var(--safe-bottom));
  right: max(24px, env(safe-area-inset-right, 0px));
  display: flex; flex-direction: column; gap: 10px;
  pointer-events: none;
  max-width: calc(100vw - 48px);
}
.toast {
  pointer-events: auto;
  min-width: 280px; max-width: 380px;
  padding: 12px 14px 12px 16px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-left: 3px solid var(--primary);
  box-shadow: var(--shadow-pop);
  transform: translateX(110%);
  transition: transform .35s cubic-bezier(0.16, 1, 0.3, 1), opacity .3s ease;
  opacity: 0;
  font-size: 13px;
  color: var(--on-surface);
}
.toast.show { transform: translateX(0); opacity: 1; }
.toast.toast-error   { border-left-color: var(--error); }
.toast.toast-warn    { border-left-color: var(--warn-soft); }
.toast.toast-info    { border-left-color: var(--info); }
.toast.toast-success { border-left-color: var(--success); }

/* ── 抽屉 ───────────────────────────────────────────────────────── */
.drawer { position: fixed; inset: 0; z-index: 70; pointer-events: none; }
.drawer.open { pointer-events: auto; }
.drawer .overlay {
  position: absolute; inset: 0;
  background: rgba(7, 30, 39, 0.4);
  backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity .3s ease;
}
.drawer.open .overlay { opacity: 1; }
.drawer .panel {
  position: absolute; right: 0; top: 0; bottom: 0;
  width: 100%; max-width: 460px;
  background: #fff;
  border-left: 1px solid var(--outline-soft);
  transform: translateX(100%);
  transition: transform .4s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex; flex-direction: column;
  box-shadow: -16px 0 48px rgba(0, 80, 75, 0.18);
}
.drawer.open .panel { transform: translateX(0); }
.drawer .panel-head, .drawer .panel-foot {
  padding: 18px 22px;
  border-color: var(--outline-soft);
}
.drawer .panel-head {
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--outline-soft);
}
.drawer .panel-body {
  flex: 1; overflow-y: auto;
  padding: 22px;
  padding-bottom: calc(22px + var(--safe-bottom));
}
.drawer .panel-foot {
  border-top: 1px solid var(--outline-soft);
  padding-bottom: calc(18px + var(--safe-bottom));
}

/* ── 工具类 ─────────────────────────────────────────────────────── */
.hidden { display: none !important; }
.fade-in { animation: fade-in .3s ease both; }
@keyframes fade-in { from { opacity: 0; transform: translateY(2px); } to { opacity: 1; transform: none; } }

.glitch-line {
  height: 2px; width: 100%;
  background: linear-gradient(90deg, transparent, var(--primary-soft) 50%, transparent);
  animation: glitch-slide 4s infinite linear;
  opacity: 0.5;
}
@keyframes glitch-slide {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.skel {
  background: linear-gradient(90deg, #f0f4f5 0%, #fafdfd 50%, #f0f4f5 100%);
  background-size: 200% 100%;
  animation: shimmer 1.6s linear infinite;
  border-radius: 8px;
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ── 主容器 ─────────────────────────────────────────────────────── */
.app-main {
  padding: calc(76px + var(--safe-top)) 20px calc(24px + var(--safe-bottom));
}
.with-sidebar { padding-left: 264px; }
.container { max-width: 1440px; margin: 0 auto; }
.row-section { display: flex; flex-direction: column; gap: 18px; }

/* ── 详情页：两栏布局 ───────────────────────────────────────────── */
.detail-grid {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}
.detail-aside {
  display: flex; flex-direction: column; gap: 16px;
  position: sticky; top: 80px;
}
.detail-main { display: flex; flex-direction: column; gap: 12px; min-width: 0; }

@media (max-width: 1023px) {
  .detail-grid { grid-template-columns: 1fr; }
  .detail-aside { position: static; }
}

/* ── 详情页 Hero 条 ─────────────────────────────────────────────── */
.hero-row {
  display: flex; align-items: center; gap: 32px;
  flex-wrap: wrap;
}
.hero-ring { position: relative; width: 112px; height: 112px; flex-shrink: 0; }
.hero-ring-text {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center;
}
.hero-ring-text .rate {
  font-family: var(--font-mono);
  font-size: 22px; font-weight: 700;
  color: var(--primary); line-height: 1;
}
.hero-ring-text .lbl { font-size: 11px; color: var(--outline); margin-top: 4px; }

.hero-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
  flex: 1;
}
.hero-stat {
  display: flex; flex-direction: column; gap: 4px;
  padding-left: 18px;
  border-left: 1px solid var(--outline-soft);
}
.hero-stat .lbl { font-size: 11px; color: var(--on-surface-variant); }
.hero-stat .val {
  font-family: var(--font-mono);
  font-size: 28px; font-weight: 700;
  color: var(--on-surface);
  letter-spacing: -0.01em;
  line-height: 1.1;
}
.hero-stat.ok  .val { color: var(--primary); }
.hero-stat.err .val { color: var(--error); }

@media (max-width: 640px) {
  .hero-row { gap: 18px; }
  .hero-stats { grid-template-columns: repeat(3, 1fr); gap: 12px; }
  .hero-stat { padding-left: 10px; }
  .hero-stat .val { font-size: 20px; }
}

/* ── Tab Bar ────────────────────────────────────────────────────── */
.tab-bar {
  display: flex; align-items: center; gap: 2px;
  border-bottom: 1px solid var(--outline-soft);
  padding: 0 4px;
  overflow-x: auto;
  scrollbar-width: none;
}
.tab-bar::-webkit-scrollbar { display: none; }
.tab {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 16px;
  font-size: 13px; font-weight: 500;
  color: var(--on-surface-variant);
  background: transparent;
  border: 0; border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: color .15s ease, border-color .15s ease;
  white-space: nowrap;
  margin-bottom: -1px;
}
.tab:hover { color: var(--primary); }
.tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 600;
}
.tab-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 18px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--primary-tint);
  color: var(--primary);
  font-family: var(--font-mono);
  font-size: 10.5px; font-weight: 600;
  margin-left: 2px;
}
.tab.active .tab-count { background: var(--primary); color: #fff; }

/* ── 历史筛选 chip ─────────────────────────────────────────────── */
.tab-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--outline-soft);
  font-size: 12px; font-weight: 500;
  color: var(--on-surface-variant);
  cursor: pointer;
  transition: all .15s ease;
}
.tab-chip:hover { border-color: var(--primary); color: var(--primary); }
.tab-chip.active {
  background: var(--primary-tint);
  border-color: var(--primary);
  color: var(--primary);
  font-weight: 600;
}
.tab-chip-count {
  display: inline-flex; align-items: center;
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.06);
}
.tab-chip.active .tab-chip-count { background: rgba(255, 255, 255, 0.5); }

/* ── 历史行 ────────────────────────────────────────────────────── */
.hist-head {
  display: grid;
  grid-template-columns: 90px 1fr 150px 1fr 80px 24px;
  gap: 12px; align-items: center;
  padding: 10px 16px;
  border-bottom: 1px solid var(--outline-soft);
  background: #fafdfd;
  font-size: 11px; font-weight: 600;
  color: var(--outline);
  text-transform: uppercase; letter-spacing: 0.05em;
}
.hist-row {
  display: grid;
  grid-template-columns: 90px 1fr 150px 1fr 80px 24px;
  gap: 12px; align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid #f0f4f5;
  cursor: pointer;
  transition: background .15s ease;
  font-size: 13px;
}
.hist-row:hover { background: #f8fbfc; }
.hist-row.expanded { background: var(--primary-tint); border-bottom-color: rgba(0,104,93,0.15); }
.hist-row .ts { font-family: var(--font-mono); font-size: 12px; color: var(--outline); }
.hist-row .player { font-weight: 600; color: var(--on-surface); }
.hist-row .source-grp { font-family: var(--font-mono); font-size: 12px; color: var(--on-surface-variant); }
.hist-row .mode {
  font-size: 12.5px; color: var(--on-surface-variant);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.hist-row .result {
  display: inline-flex; align-items: center; gap: 4px;
  font-weight: 600; font-size: 12px;
}
.hist-row .result.ok   { color: var(--primary); }
.hist-row .result.fail { color: var(--error); }
.hist-row .expand-ind { color: var(--outline); }

.hist-detail {
  padding: 18px 24px;
  background: #f8fbfc;
  border-bottom: 1px solid var(--outline-soft);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px 24px;
}
.hist-detail .kv { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.hist-detail .k {
  font-size: 10.5px; font-weight: 600;
  color: var(--outline);
  text-transform: uppercase; letter-spacing: 0.05em;
}
.hist-detail .v {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--on-surface);
  word-break: break-all;
}
.hist-detail .err-block {
  grid-column: 1 / -1;
  padding: 12px 14px;
  background: rgba(186, 26, 26, 0.04);
  border: 1px solid rgba(186, 26, 26, 0.15);
  border-radius: 10px;
  margin-top: 4px;
}
.hist-detail .err-block .k { color: var(--error); margin-bottom: 4px; }
.hist-detail .err-block .v { color: #7a0b0b; font-style: italic; }

@media (max-width: 768px) {
  .hist-head { display: none; }
  .hist-row {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "player result"
      "src    expand"
      "mode   ts";
    gap: 6px 8px;
    padding: 12px 14px;
  }
  .hist-row .player     { grid-area: player; font-size: 14px; }
  .hist-row .result     { grid-area: result; justify-self: end; }
  .hist-row .source-grp { grid-area: src; font-size: 11px; }
  .hist-row .expand-ind { grid-area: expand; justify-self: end; }
  .hist-row .mode       { grid-area: mode; font-size: 11px; }
  .hist-row .ts         { grid-area: ts; justify-self: end; font-size: 11px; }
  .hist-detail { grid-template-columns: 1fr; padding: 14px 16px; }
}

.btn-sm { padding: 6px 12px; font-size: 12px; }

/* ── 媒体查询：移动端适配 ──────────────────────────────────────── */
@media (max-width: 1023px) {
  .hamburger { display: inline-flex; }
  .sidebar {
    transform: translateX(-100%);
    box-shadow: 16px 0 48px rgba(0, 80, 75, 0.18);
  }
  .sidebar.open { transform: translateX(0); }
  .with-sidebar { padding-left: 20px; }
}

@media (max-width: 768px) {
  .topbar { padding: 0 14px; height: 56px; }
  .brand-name { font-size: 15px; }
  .brand-sep, .brand-page { display: none; }
  .app-main { padding: calc(70px + var(--safe-top)) 14px calc(20px + var(--safe-bottom)); }

  .kpi { padding: 14px; }
  .kpi .kpi-value { font-size: 26px; }

  .bot-card { padding: 14px; }
  .bot-card .cid { font-size: 16px; }

  .otp-input { width: 38px; height: 48px; font-size: 17px; }

  .log-line {
    grid-template-columns: 78px 44px 1fr;
    padding: 2px 12px;
    font-size: 11.5px;
  }
  .log-line .op { display: none; }     /* 移动端隐藏 op 列 */

  .run-ticker { padding: 10px 14px; gap: 12px; }

  .drawer .panel { max-width: 100%; }
  .topbar .qq-chip { display: none; }
}

@media (max-width: 480px) {
  .term-body { font-size: 11px; }
  .kpi .kpi-value { font-size: 22px; }
}
