/* ===== 基础变量 ===== */
:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --sidebar: #101828;
  --sidebar-hover: #1d2939;
  --text: #1d2939;
  --muted: #667085;
  --faint: #98a2b3;
  --border: #e4e7ec;
  --primary: #4f6ef7;
  --primary-dark: #3d5bd9;
  --primary-soft: #eef1ff;
  --success: #12b76a;
  --success-soft: #e7f8f0;
  --warn: #f79009;
  --warn-soft: #fff6e6;
  --danger: #f04438;
  --danger-soft: #fef0ef;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 4px 16px rgba(16, 24, 40, .04);
  --radius: 12px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font-family: inherit; font-size: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
svg { width: 18px; height: 18px; flex: none; }

/* ===== 登录 ===== */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(circle at 18% 20%, rgba(79, 110, 247, .18), transparent 42%),
    radial-gradient(circle at 82% 78%, rgba(18, 183, 106, .12), transparent 40%),
    #f4f6fb;
}
.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: 0 20px 60px rgba(16, 24, 40, .12);
  padding: 36px;
}
.login-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 30px; }
.brand-mark {
  width: 46px; height: 46px; border-radius: 13px; flex: none;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--primary), #7b8cff);
  color: #fff;
}
.brand-mark svg { width: 25px; height: 25px; }
.login-brand h1 { font-size: 19px; margin: 0 0 3px; letter-spacing: -.2px; }
.login-brand p { margin: 0; color: var(--faint); font-size: 12px; letter-spacing: .4px; }
.login-form label { display: block; font-weight: 600; margin-bottom: 8px; font-size: 13px; }
.login-form input {
  width: 100%; padding: 12px 14px; border: 1px solid var(--border);
  border-radius: 9px; outline: none; transition: .15s;
}
.login-form input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.form-error { color: var(--danger); font-size: 12px; min-height: 16px; margin: 8px 0 4px; }
.login-tip { color: var(--faint); font-size: 11px; line-height: 1.6; margin: 20px 0 0; text-align: center; }
.login-tip code { background: var(--surface-2); padding: 1px 5px; border-radius: 4px; color: var(--muted); }

/* ===== 布局 ===== */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 236px; flex: none; background: var(--sidebar); color: #fff;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
  z-index: 40;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 11px; padding: 22px 20px 24px;
  border-bottom: 1px solid rgba(255,255,255,.07);
}
.sidebar .brand-mark { width: 38px; height: 38px; border-radius: 10px; }
.sidebar .brand-mark svg { width: 21px; height: 21px; }
.brand-text strong { display: block; font-size: 15px; letter-spacing: .2px; }
.brand-text span { display: block; font-size: 11px; color: #98a2b3; margin-top: 2px; }
.nav { padding: 18px 12px; flex: 1; overflow-y: auto; }
.nav-label {
  font-size: 10px; text-transform: uppercase; letter-spacing: 1.4px;
  color: #667085; padding: 12px 10px 8px; font-weight: 600;
}
.nav-item {
  width: 100%; display: flex; align-items: center; gap: 12px;
  background: transparent; color: #cbd2dc; border: 0; border-radius: 9px;
  padding: 11px 12px; text-align: left; transition: .15s; font-size: 13.5px;
  margin-bottom: 3px;
}
.nav-item svg { width: 18px; height: 18px; opacity: .85; }
.nav-item:hover { background: var(--sidebar-hover); color: #fff; }
.nav-item.active { background: var(--primary); color: #fff; font-weight: 600; }
.nav-item.active svg { opacity: 1; }
.sidebar-footer { padding: 14px 12px 18px; border-top: 1px solid rgba(255,255,255,.07); }
.worker-status {
  display: flex; align-items: center; gap: 9px; font-size: 12px;
  color: #98a2b3; background: rgba(255,255,255,.04);
  padding: 10px 12px; border-radius: 8px; margin-bottom: 8px;
}
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #98a2b3; flex: none; }
.status-dot.on { background: #12b76a; box-shadow: 0 0 0 3px rgba(18,183,106,.18); }
.status-dot.off { background: #f04438; }
.status-dot.busy { background: #f79009; box-shadow: 0 0 0 3px rgba(247,144,9,.18); }
.sidebar-logout {
  width: 100%; display: flex; align-items: center; gap: 10px; background: transparent;
  border: 0; color: #98a2b3; padding: 10px 12px; border-radius: 8px; font-size: 12.5px;
}
.sidebar-logout:hover { background: var(--sidebar-hover); color: #fff; }
.sidebar-logout svg { width: 16px; height: 16px; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 76px; flex: none; background: var(--surface);
  border-bottom: 1px solid var(--border); display: flex; align-items: center;
  justify-content: space-between; padding: 0 30px; position: sticky; top: 0; z-index: 30;
}
.topbar-title h2 { margin: 0; font-size: 18px; letter-spacing: -.3px; }
.topbar-title p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.topbar-actions { display: flex; gap: 10px; align-items: center; }
.mobile-menu { display: none; background: none; border: 0; color: var(--text); padding: 6px; }
.page { padding: 26px 30px 60px; flex: 1; }

/* ===== 按钮 ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 15px; border-radius: 8px; border: 1px solid transparent;
  font-size: 13px; font-weight: 600; transition: .15s; white-space: nowrap;
  background: var(--surface); color: var(--text);
}
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-ghost { border-color: var(--border); color: var(--muted); background: var(--surface); }
.btn-ghost:hover { border-color: var(--primary); color: var(--primary); }
.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-danger:hover { background: #fdd9d6; }
.btn-success { background: var(--success-soft); color: #087443; }
.btn-success:hover { background: #d2f0e0; }
.btn-sm { padding: 6px 10px; font-size: 12px; border-radius: 7px; }
.btn-sm svg { width: 14px; height: 14px; }
.btn-icon { padding: 7px; width: 32px; height: 32px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ===== 卡片 ===== */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 20px;
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px; border-bottom: 1px solid var(--border); gap: 12px;
}
.card-header h3 { margin: 0; font-size: 15px; }
.card-header p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.card-body { padding: 20px; }
.card-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ===== 统计卡 ===== */
.stats-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px;
}
.stat-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 20px; box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.stat-card::after {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: var(--accent);
}
.stat-top { display: flex; justify-content: space-between; align-items: flex-start; }
.stat-label { color: var(--muted); font-size: 12px; font-weight: 500; }
.stat-icon {
  width: 36px; height: 36px; border-radius: 9px; display: flex; align-items: center;
  justify-content: center; background: var(--accent-soft); color: var(--accent);
}
.stat-icon svg { width: 18px; height: 18px; }
.stat-value { font-size: 28px; font-weight: 700; letter-spacing: -.8px; margin-top: 10px; }
.stat-foot { color: var(--faint); font-size: 11px; margin-top: 5px; }

/* ===== 图表 ===== */
.chart-wrap { height: 180px; display: flex; align-items: flex-end; gap: 14px; padding: 10px 4px 0; }
.chart-col { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; justify-content: flex-end; gap: 7px; }
.chart-bars { display: flex; align-items: flex-end; gap: 3px; height: 100%; width: 100%; justify-content: center; }
.chart-bar { width: 14px; border-radius: 4px 4px 0 0; min-height: 2px; transition: height .4s ease; }
.chart-bar.processed { background: #c7d2fe; }
.chart-bar.forwarded { background: var(--primary); }
.chart-bar.failed { background: #fda29b; }
.chart-label { font-size: 10.5px; color: var(--faint); white-space: nowrap; }
.chart-legend { display: flex; gap: 16px; font-size: 11px; color: var(--muted); }
.chart-legend span { display: flex; align-items: center; gap: 6px; }
.legend-dot { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }

/* ===== 表格 ===== */
.table-scroll { overflow-x: auto; }
table.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th {
  text-align: left; font-weight: 600; color: var(--muted); font-size: 11.5px;
  text-transform: uppercase; letter-spacing: .4px; padding: 12px 16px;
  background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap;
}
.data-table td { padding: 13px 16px; border-bottom: 1px solid #f0f2f5; vertical-align: middle; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: #fafbfe; }
.cell-main { font-weight: 600; color: var(--text); }
.cell-sub { color: var(--faint); font-size: 11px; margin-top: 3px; }
.cell-actions { display: flex; gap: 6px; justify-content: flex-end; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; }

/* ===== 徽章与开关 ===== */
.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px;
  border-radius: 20px; font-size: 11px; font-weight: 600; white-space: nowrap;
}
.badge.success { background: var(--success-soft); color: #087443; }
.badge.danger { background: var(--danger-soft); color: #b42318; }
.badge.warn { background: var(--warn-soft); color: #b54708; }
.badge.info { background: var(--primary-soft); color: var(--primary-dark); }
.badge.muted { background: #f2f4f7; color: var(--muted); }
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.switch { position: relative; display: inline-block; width: 36px; height: 20px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; inset: 0; background: #d0d5dd; border-radius: 20px; transition: .2s; }
.slider::before { content: ''; position: absolute; width: 14px; height: 14px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; }
.switch input:checked + .slider { background: var(--primary); }
.switch input:checked + .slider::before { transform: translateX(16px); }

/* ===== 表单 ===== */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.full { grid-column: 1 / -1; }
.form-group label { font-size: 12.5px; font-weight: 600; color: #344054; }
.form-group .hint { font-size: 11px; color: var(--faint); line-height: 1.5; }
.form-control {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px;
  outline: none; background: #fff; color: var(--text); transition: .15s;
}
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
textarea.form-control { resize: vertical; min-height: 78px; line-height: 1.6; }
select.form-control { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23667085' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }
.form-section-title {
  font-size: 12px; font-weight: 700; color: var(--primary-dark); text-transform: uppercase;
  letter-spacing: .7px; margin: 4px 0 2px; grid-column: 1 / -1;
  border-bottom: 1px solid var(--border); padding-bottom: 9px;
}
.checkbox-row { display: flex; align-items: center; gap: 9px; font-size: 13px; color: #344054; }
.checkbox-row input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--primary); }

/* ===== 弹窗 ===== */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(16, 24, 40, .48);
  display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 100;
  animation: fade .16s ease;
}
.modal {
  background: #fff; border-radius: 14px; width: 100%; max-width: 640px;
  max-height: 90vh; display: flex; flex-direction: column;
  box-shadow: 0 24px 70px rgba(16,24,40,.24); animation: rise .2s ease;
}
.modal.wide { max-width: 760px; }
.modal-header {
  padding: 18px 22px; border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
}
.modal-header h3 { margin: 0; font-size: 16px; }
.modal-header p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.modal-close { background: none; border: 0; color: var(--muted); padding: 5px; border-radius: 6px; }
.modal-close:hover { background: var(--surface-2); color: var(--text); }
.modal-body { padding: 22px; overflow-y: auto; flex: 1; }
.modal-footer {
  padding: 15px 22px; border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 9px; align-items: center;
}
.modal-footer .spacer { flex: 1; }
@keyframes fade { from { opacity: 0 } to { opacity: 1 } }
@keyframes rise { from { transform: translateY(12px); opacity: 0 } to { transform: translateY(0); opacity: 1 } }

/* ===== Toast ===== */
.toast-root { position: fixed; right: 22px; top: 22px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast {
  background: #fff; border: 1px solid var(--border); border-left: 4px solid var(--primary);
  border-radius: 9px; padding: 12px 16px; box-shadow: 0 10px 30px rgba(16,24,40,.14);
  font-size: 13px; min-width: 240px; max-width: 380px; animation: rise .2s ease;
}
.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.warn { border-left-color: var(--warn); }
.toast strong { display: block; margin-bottom: 3px; }
.toast span { color: var(--muted); font-size: 12px; }

/* ===== 日志 ===== */
.log-row { display: flex; gap: 12px; padding: 11px 0; border-bottom: 1px solid #f0f2f5; font-size: 12.5px; }
.log-row:last-child { border-bottom: 0; }
.log-icon {
  width: 28px; height: 28px; border-radius: 8px; flex: none; display: flex;
  align-items: center; justify-content: center;
}
.log-icon.success { background: var(--success-soft); color: #087443; }
.log-icon.error { background: var(--danger-soft); color: #b42318; }
.log-icon.warn { background: var(--warn-soft); color: #b54708; }
.log-icon.info { background: var(--primary-soft); color: var(--primary); }
.log-icon svg { width: 15px; height: 15px; }
.log-content { flex: 1; min-width: 0; }
.log-content strong { font-weight: 600; }
.log-content p { margin: 2px 0 0; color: var(--muted); font-size: 11.5px; word-break: break-all; }
.log-time { color: var(--faint); font-size: 11px; white-space: nowrap; }

/* ===== 空状态 / 其他 ===== */
.empty { text-align: center; padding: 54px 20px; color: var(--muted); }
.empty svg { width: 42px; height: 42px; color: #cbd2dc; margin-bottom: 12px; }
.empty h4 { margin: 0 0 6px; color: var(--text); font-size: 15px; }
.empty p { margin: 0 0 18px; font-size: 12.5px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
.info-strip {
  background: var(--primary-soft); border: 1px solid #dbe3ff; border-radius: 9px;
  padding: 12px 14px; color: #35469c; font-size: 12px; line-height: 1.7; margin-bottom: 18px;
}
.info-strip strong { display: block; margin-bottom: 2px; font-size: 12.5px; }
.settings-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.divider { height: 1px; background: var(--border); margin: 20px 0; }
.text-mono-note { font-family: ui-monospace, monospace; font-size: 11px; color: var(--faint); }
.loading { text-align: center; padding: 60px; color: var(--muted); }
.spinner {
  width: 26px; height: 26px; border: 3px solid var(--border); border-top-color: var(--primary);
  border-radius: 50%; animation: spin .8s linear infinite; margin: 0 auto 14px;
}
@keyframes spin { to { transform: rotate(360deg) } }

/* ===== 响应式 ===== */
@media (max-width: 1100px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 800px) {
  .sidebar { position: fixed; left: -236px; transition: left .22s; box-shadow: 8px 0 30px rgba(16,24,40,.2); }
  .sidebar.open { left: 0; }
  .mobile-menu { display: block; }
  .topbar { padding: 0 16px; height: 66px; }
  .page { padding: 18px 16px 50px; }
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .form-grid { grid-template-columns: 1fr; }
  .topbar-actions .btn-ghost { display: none; }
  .topbar-title p { display: none; }
}
@media (max-width: 520px) {
  .stats-grid { grid-template-columns: 1fr; }
  .topbar-actions .btn span { display: none; }
}

/* ===== 实时监控 ===== */
.nav-pulse {
  width: 6px; height: 6px; border-radius: 50%; margin-left: auto;
  background: #12b76a; opacity: 0; transition: opacity .2s;
}
.nav-pulse.on { opacity: 1; box-shadow: 0 0 0 3px rgba(18,183,106,.22); }

.live-badge {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px;
  border-radius: 20px; font-size: 12px; font-weight: 600;
  background: var(--success-soft); color: #087443;
}
.live-badge.off { background: #f2f4f7; color: var(--muted); }
.live-dot {
  width: 7px; height: 7px; border-radius: 50%; background: currentColor;
  animation: pulse 1.8s ease-in-out infinite;
}
.live-badge.off .live-dot { animation: none; }
@keyframes pulse { 0%,100% { opacity: 1 } 50% { opacity: .35 } }

.monitor-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.mini-stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; box-shadow: var(--shadow); border-top: 3px solid var(--accent);
}
.mini-stat .label { color: var(--muted); font-size: 11.5px; }
.mini-stat .value { font-size: 23px; font-weight: 700; letter-spacing: -.6px; margin-top: 5px; }
.mini-stat .foot { color: var(--faint); font-size: 10.5px; margin-top: 3px; }

.pipeline { display: flex; align-items: stretch; gap: 0; padding: 4px 0; }
.pipeline-step { flex: 1; position: relative; text-align: center; padding: 8px 6px; }
.pipeline-step:not(:last-child)::after {
  content: ''; position: absolute; top: 26px; right: -14px; width: 28px; height: 2px;
  background: var(--border); z-index: 1;
}
.pipeline-step.done:not(:last-child)::after { background: var(--success); }
.pipeline-icon {
  width: 42px; height: 42px; border-radius: 12px; margin: 0 auto 8px;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface-2); color: var(--faint); border: 1px solid var(--border);
  transition: .2s; position: relative; z-index: 2;
}
.pipeline-icon svg { width: 20px; height: 20px; }
.pipeline-step.active .pipeline-icon {
  background: var(--primary-soft); color: var(--primary); border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(79,110,247,.1);
}
.pipeline-step.done .pipeline-icon { background: var(--success-soft); color: #087443; border-color: var(--success); }
.pipeline-name { font-size: 12.5px; font-weight: 600; }
.pipeline-desc { font-size: 10.5px; color: var(--faint); margin-top: 3px; }

.log-toolbar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 14px 20px; border-bottom: 1px solid var(--border); background: var(--surface-2);
}
.log-search {
  flex: 1; min-width: 160px; padding: 8px 12px; border: 1px solid var(--border);
  border-radius: 8px; outline: none; background: #fff; font-size: 12.5px;
}
.log-search:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.filter-chips { display: flex; gap: 4px; background: #eaecf0; padding: 3px; border-radius: 8px; }
.filter-chip {
  border: 0; background: transparent; color: var(--muted); padding: 5px 10px;
  border-radius: 6px; font-size: 11.5px; font-weight: 600;
}
.filter-chip.active { background: #fff; color: var(--primary); box-shadow: 0 1px 3px rgba(16,24,40,.1); }
.log-toolbar select {
  padding: 7px 10px; border: 1px solid var(--border); border-radius: 8px;
  background: #fff; color: var(--text); font-size: 12px; max-width: 150px;
}

.log-stream { max-height: 520px; overflow-y: auto; padding: 4px 0; }
.stream-row {
  display: grid; grid-template-columns: 68px 74px 1fr auto; gap: 10px;
  align-items: start; padding: 10px 20px; border-bottom: 1px solid #f2f4f7;
  font-size: 12.5px; position: relative; animation: slideIn .22s ease;
}
.stream-row::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: transparent;
}
.stream-row.level-success::before { background: var(--success); }
.stream-row.level-error::before { background: var(--danger); }
.stream-row.level-warn::before { background: var(--warn); }
.stream-row.level-info::before { background: var(--primary); }
.stream-row:hover { background: #fafbfe; }
@keyframes slideIn { from { opacity: 0; transform: translateY(-6px) } to { opacity: 1; transform: translateY(0) } }
.stream-time { color: var(--faint); font-size: 11px; font-variant-numeric: tabular-nums; padding-top: 2px; }
.stream-level { padding-top: 1px; }
.stream-main { min-width: 0; }
.stream-title {
  font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.stream-sub {
  color: var(--muted); font-size: 11px; margin-top: 3px; line-height: 1.5; word-break: break-word;
}
.stream-meta { color: var(--faint); font-size: 10.5px; margin-top: 3px; }
.stream-right { text-align: right; color: var(--faint); font-size: 10.5px; white-space: nowrap; padding-top: 2px; }
.stream-tag {
  display: inline-block; padding: 1px 6px; border-radius: 4px; background: #f2f4f7;
  color: var(--muted); font-size: 10px; margin-left: 5px;
}

.monitor-side .card-body { padding-top: 10px; }
.state-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 9px 0; border-bottom: 1px solid #f2f4f7; font-size: 12.5px;
}
.state-row:last-child { border-bottom: 0; }
.state-row .k { color: var(--muted); }
.state-row .v { font-weight: 600; text-align: right; }
.account-pulse { display: flex; align-items: center; gap: 8px; padding: 9px 0; border-bottom: 1px solid #f2f4f7; font-size: 12px; }
.account-pulse:last-child { border-bottom: 0; }
.account-pulse .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--success); flex: none; }
.account-pulse .dot.warn { background: var(--warn); }
.account-pulse .dot.off { background: var(--faint); }
.account-pulse .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-pulse .meta { color: var(--faint); font-size: 10.5px; }
.stream-footer {
  padding: 10px 20px; border-top: 1px solid var(--border); color: var(--faint);
  font-size: 11px; display: flex; justify-content: space-between; align-items: center;
}

@media (max-width: 1100px) {
  .monitor-stats { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 800px) {
  .pipeline-step:nth-child(n+3) { display: none; }
  .stream-row { grid-template-columns: 58px 60px 1fr; padding: 10px 12px; }
  .stream-right { display: none; }
  .log-toolbar { padding: 12px; }
}

/* 转发规则：条件行 / 替换行 / 预演结果 */
.condition-row {
  display: grid;
  grid-template-columns: 100px 120px 1fr auto;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
  padding: 8px;
  background: var(--soft);
  border-radius: 8px;
}
.condition-row[data-repl] { grid-template-columns: 1fr 1fr 100px auto auto; }
@media (max-width: 800px) {
  .condition-row, .condition-row[data-repl] { grid-template-columns: 1fr 1fr; }
}
.preview-result { margin-top: 12px; font-size: 12px; }
.preview-head { padding: 10px 14px; border-radius: 8px; font-weight: 600; margin-bottom: 10px; }
.preview-head.hit { background: #e8f7ee; color: #166534; }
.preview-head.miss { background: #fdeaea; color: #b42318; }
.preview-details { list-style: none; padding: 0; margin: 0 0 12px; }
.preview-details li { padding: 4px 0; color: var(--muted); }
.preview-details li.ok { color: #166534; }
.preview-details li.no { color: #b42318; }
.preview-block { margin-bottom: 10px; padding: 10px 12px; background: var(--soft); border-radius: 8px; }
.preview-block strong { display: block; margin-bottom: 4px; color: var(--muted); }
.preview-block pre { margin: 0; white-space: pre-wrap; word-break: break-word; font-family: inherit; font-size: 12px; }
