/* ==================================================================
   FormBridge · 控制台样式
   侧边导航 + 多视图主区，复用 shared/theme.css 的设计令牌
   ================================================================== */

[hidden] { display: none !important; }

.shell {
  display: grid;
  grid-template-columns: 264px 1fr;
  min-height: 100vh;
}

/* ---------------- 侧边栏 ---------------- */
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: var(--sp-5) var(--sp-4);
  gap: var(--sp-5);
  background: var(--bg-surface);
  border-right: 1px solid var(--line-1);
}

.side-brand {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-2);
}
.brand-mark {
  width: 38px; height: 38px;
  border-radius: var(--r-md);
  background: linear-gradient(135deg, var(--brand-600), var(--accent-500));
  box-shadow: var(--shadow-brand);
  position: relative;
  flex: none;
}
.brand-mark::after {
  content: '';
  position: absolute; inset: 10px;
  border-radius: 6px;
  border: 2px solid rgba(255, 255, 255, 0.9);
  border-right-color: transparent;
  border-bottom-color: transparent;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-text strong { font-size: var(--fs-md); letter-spacing: 0.2px; }
.brand-text span { font-size: var(--fs-xs); color: var(--text-3); }

.side-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 11px var(--sp-3);
  border-radius: var(--r-md);
  color: var(--text-2);
  font-size: var(--fs-sm);
  font-weight: 500;
  transition: all var(--t-fast);
  position: relative;
}
.nav-item svg { width: 19px; height: 19px; flex: none; }
.nav-item:hover { background: var(--bg-hover); color: var(--text-1); }
.nav-item.active {
  background: var(--bg-active);
  color: var(--brand-600);
}
.nav-item.active::before {
  content: '';
  position: absolute; left: calc(-1 * var(--sp-4)); top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 20px;
  border-radius: var(--r-full);
  background: var(--brand-500);
}
.nav-badge {
  margin-left: auto;
  min-width: 20px; height: 20px;
  padding: 0 6px;
  display: grid; place-items: center;
  font-size: 11px; font-style: normal; font-weight: 600;
  border-radius: var(--r-full);
  background: var(--brand-500);
  color: #fff;
  opacity: 0;
  transform: scale(0.6);
  transition: all var(--t-base);
}
.nav-badge.show { opacity: 1; transform: scale(1); }

.side-foot { display: flex; flex-direction: column; gap: var(--sp-3); }
.engine-card {
  padding: var(--sp-3);
  border-radius: var(--r-md);
  background: var(--bg-sunken);
  border: 1px solid var(--line-1);
}
.engine-row { display: flex; align-items: center; justify-content: space-between; }
.engine-state { display: inline-flex; align-items: center; gap: 7px; font-size: var(--fs-sm); font-weight: 500; }
.engine-state .dot { color: var(--text-3); }
.engine-state.on .dot { color: var(--ok-500); animation: pulse 1.6s var(--ease-in-out) infinite; }
.engine-state.off .dot { color: var(--text-3); }
.engine-meta { margin-top: 6px; font-size: var(--fs-xs); color: var(--text-3); }

.side-bottom { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); }
.conn-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px;
  border-radius: var(--r-full);
  font-size: var(--fs-xs); font-weight: 500;
  background: var(--bg-sunken);
  color: var(--text-2);
}
.conn-pill.online { background: var(--tint-ok); color: var(--ok-600); }
.conn-pill.online .dot { color: var(--ok-500); animation: none; }
.conn-pill.offline { background: var(--tint-err); color: var(--err-600); }
.conn-pill.offline .dot { color: var(--err-500); animation: none; }

/* ---------------- 主区 ---------------- */
.main {
  padding: var(--sp-8) var(--sp-10) var(--sp-12);
  max-width: 1280px;
  width: 100%;
  overflow-x: hidden;
  position: relative;
}
@media (max-width: 1100px) { .main { padding: var(--sp-6) var(--sp-6) var(--sp-10); } }

.view { display: none; animation: slideUp var(--t-base); }
.view.active { display: block; }

.view-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-4);
  margin-bottom: var(--sp-6);
  flex-wrap: wrap;
}
.view-head h1 { margin: 0; font-size: var(--fs-2xl); font-weight: 700; letter-spacing: -0.5px; }
.view-head p { margin: 6px 0 0; color: var(--text-2); font-size: var(--fs-sm); }
.head-actions { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }

.panel { padding: var(--sp-5); }
.panel + .panel { margin-top: var(--sp-5); }
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: var(--sp-4);
  gap: var(--sp-3);
}
.panel-head h2 { margin: 0; font-size: var(--fs-md); font-weight: 600; }
.count-chip {
  min-width: 24px; padding: 2px 9px;
  border-radius: var(--r-full);
  background: var(--bg-sunken); color: var(--text-2);
  font-size: var(--fs-xs); font-weight: 600; text-align: center;
}
.link-more { font-size: var(--fs-sm); color: var(--brand-600); cursor: pointer; }
.link-more:hover { text-decoration: underline; }
.muted { color: var(--text-3); font-size: var(--fs-xs); }

/* ---------------- 统计卡 ---------------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--sp-4);
  margin-bottom: var(--sp-5);
}
@media (max-width: 900px) { .stat-grid { grid-template-columns: repeat(2, 1fr); } }
.stat-card {
  position: relative;
  padding: var(--sp-5);
  border-radius: var(--r-lg);
  background: var(--bg-surface);
  border: 1px solid var(--line-1);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute; top: 0; left: 0; width: 4px; height: 100%;
}
.stat-card[data-tone="brand"]::before { background: var(--brand-500); }
.stat-card[data-tone="warn"]::before { background: var(--warn-500); }
.stat-card[data-tone="info"]::before { background: var(--info-500); }
.stat-card[data-tone="ok"]::before { background: var(--ok-500); }
.stat-label { display: block; font-size: var(--fs-xs); color: var(--text-3); font-weight: 500; }
.stat-value { display: block; font-size: var(--fs-2xl); font-weight: 700; line-height: 1.2; margin: 4px 0; font-variant-numeric: tabular-nums; }
.stat-foot { font-size: var(--fs-xs); color: var(--text-2); }

/* ---------------- 监控栅格 ---------------- */
.monitor-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: var(--sp-5);
  margin-bottom: var(--sp-5);
}
@media (max-width: 1000px) { .monitor-grid { grid-template-columns: 1fr; } }

.live-body { min-height: 220px; }
.live-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: var(--sp-8) var(--sp-4);
  color: var(--text-3);
  gap: var(--sp-2);
}
.live-empty-icon {
  width: 56px; height: 56px;
  display: grid; place-items: center;
  border-radius: var(--r-full);
  background: var(--bg-sunken);
  margin-bottom: var(--sp-2);
}
.live-empty-icon svg { width: 28px; height: 28px; color: var(--text-3); }
.live-empty p { margin: 0; font-size: var(--fs-base); color: var(--text-2); font-weight: 500; }
.live-empty span { font-size: var(--fs-xs); max-width: 320px; }

.live-run-head {
  display: flex; align-items: center; justify-content: space-between;
  padding-bottom: var(--sp-3); margin-bottom: var(--sp-3);
  border-bottom: 1px solid var(--line-1);
}
.live-run-head strong { display: block; font-size: var(--fs-base); }
.live-run-head .muted { display: block; margin-top: 2px; }

/* 执行步骤流 */
.step-flow { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.step-item {
  display: flex; align-items: flex-start; gap: var(--sp-3);
  padding: 9px var(--sp-2);
  border-radius: var(--r-sm);
  animation: slideUp var(--t-fast);
}
.step-icon {
  width: 22px; height: 22px; flex: none; margin-top: 1px;
  border-radius: var(--r-full);
  display: grid; place-items: center;
  font-size: 12px;
}
.step-icon.running { background: var(--tint-info); color: var(--info-500); }
.step-icon.success { background: var(--tint-ok); color: var(--ok-600); }
.step-icon.warn { background: var(--tint-warn); color: var(--warn-600); }
.step-icon.failed { background: var(--tint-err); color: var(--err-600); }
.step-icon.skipped { background: var(--bg-sunken); color: var(--text-3); }
.step-icon .spinner { width: 12px; height: 12px; border-width: 2px; }
.step-main { flex: 1; min-width: 0; }
.step-name { font-size: var(--fs-sm); font-weight: 500; }
.step-detail { font-size: var(--fs-xs); color: var(--text-2); word-break: break-all; }
.step-dur { font-size: 11px; color: var(--text-3); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------------- 设备列表 ---------------- */
.device-list { display: flex; flex-direction: column; gap: var(--sp-2); min-height: 100px; }
.device-item {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-3);
  border-radius: var(--r-md);
  background: var(--bg-sunken);
  animation: slideUp var(--t-fast);
}
.device-avatar {
  width: 34px; height: 34px; flex: none;
  border-radius: var(--r-full);
  display: grid; place-items: center;
  background: var(--tint-brand); color: var(--brand-600);
}
.device-avatar svg { width: 17px; height: 17px; }
.device-info { flex: 1; min-width: 0; }
.device-name { font-size: var(--fs-sm); font-weight: 500; }
.device-meta { font-size: var(--fs-xs); color: var(--text-3); }
.device-count-badge { font-size: var(--fs-xs); color: var(--text-2); }
.device-count-badge.busy { color: var(--warn-500); font-weight: 600; }
.empty-hint { text-align: center; color: var(--text-3); font-size: var(--fs-sm); padding: var(--sp-8); }

/* ---------------- Agent 列表 ---------------- */
.agent-list { display: flex; flex-direction: column; gap: var(--sp-2); min-height: 60px; }
.agent-avatar { background: var(--tint-accent); color: var(--accent-600); }
.agent-hint { font-size: var(--fs-xs); color: var(--text-3); margin: var(--sp-3) 0 0; line-height: 1.5; }

/* ---------------- 最近任务（迷你） ---------------- */
.mini-task-list { display: flex; flex-direction: column; }
.mini-task {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center; gap: var(--sp-3);
  padding: 11px var(--sp-2);
  border-bottom: 1px solid var(--line-1);
  cursor: pointer;
  transition: background var(--t-fast);
}
.mini-task:last-child { border-bottom: none; }
.mini-task:hover { background: var(--bg-hover); }
.mini-task-sum { font-size: var(--fs-sm); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-task-dev { font-size: var(--fs-xs); color: var(--text-3); white-space: nowrap; }
.mini-task-time { font-size: var(--fs-xs); color: var(--text-3); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------------- 任务表 ---------------- */
.task-table-wrap { padding: 0; overflow: hidden; }
.task-table { display: flex; flex-direction: column; }
.task-row {
  display: grid;
  grid-template-columns: 120px 1fr 130px 90px 120px 150px;
  align-items: center; gap: var(--sp-3);
  padding: 13px var(--sp-5);
  border-bottom: 1px solid var(--line-1);
  transition: background var(--t-fast);
  cursor: pointer;
}
.task-row:last-child { border-bottom: none; }
.task-row:hover { background: var(--bg-hover); }
.task-row.head {
  position: sticky; top: 0; z-index: 2;
  background: var(--bg-sunken);
  cursor: default;
  font-size: var(--fs-xs); color: var(--text-3); font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.4px;
}
.task-row.head:hover { background: var(--bg-sunken); }
.tc-status { display: flex; }
.tc-sum { overflow: hidden; }
.tc-sum strong { display: block; font-size: var(--fs-sm); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tc-sum span { font-size: var(--fs-xs); color: var(--text-3); }
.tc-dev { font-size: var(--fs-sm); color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tc-attempt { font-size: var(--fs-sm); color: var(--text-2); font-variant-numeric: tabular-nums; }
.tc-time { font-size: var(--fs-xs); color: var(--text-3); font-variant-numeric: tabular-nums; }
.tc-ops { display: flex; gap: 6px; justify-content: flex-end; }
.tc-ops .btn { padding: 5px 10px; font-size: 11px; }

.status-pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: var(--r-full);
  font-size: var(--fs-xs); font-weight: 500; white-space: nowrap;
}
.status-pill.queued { background: var(--tint-warn); color: var(--warn-600); }
.status-pill.running { background: var(--tint-info); color: var(--info-500); }
.status-pill.success { background: var(--tint-ok); color: var(--ok-600); }
.status-pill.failed { background: var(--tint-err); color: var(--err-600); }
.status-pill.canceled { background: var(--bg-sunken); color: var(--text-3); }

/* ---------------- 配置 ---------------- */
.config-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-5); margin-bottom: var(--sp-5); }
@media (max-width: 1000px) { .config-grid { grid-template-columns: 1fr; } }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-4); }
.field { display: flex; flex-direction: column; gap: 6px; }
.field-full { grid-column: 1 / -1; }
.field-label { font-size: var(--fs-xs); color: var(--text-2); font-weight: 500; }
.field-label em { color: var(--err-500); font-style: normal; }
.input, .select {
  width: 100%;
  padding: 10px var(--sp-3);
  border-radius: var(--r-md);
  border: 1px solid var(--line-1);
  background: var(--bg-surface);
  color: var(--text-1);
  font-size: var(--fs-sm);
  transition: all var(--t-fast);
}
.input:focus, .select:focus { outline: none; border-color: var(--brand-500); box-shadow: 0 0 0 3px var(--tint-brand); }
.input.mono { font-family: var(--font-mono); font-size: var(--fs-xs); }
.input-sm { padding: 6px 10px; font-size: var(--fs-xs); width: 160px; }
.select { cursor: pointer; }

.rules-grid { display: flex; flex-direction: column; gap: var(--sp-3); }
.switch-row {
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3);
  padding: 10px var(--sp-3);
  border-radius: var(--r-md);
  background: var(--bg-sunken);
}
.switch-row span { display: flex; flex-direction: column; }
.switch-row strong { font-size: var(--fs-sm); font-weight: 500; }
.switch-row em { font-size: var(--fs-xs); color: var(--text-3); font-style: normal; }

/* 开关 */
.switch { appearance: none; -webkit-appearance: none; position: relative; width: 42px; height: 24px; border-radius: var(--r-full); background: var(--line-2); cursor: pointer; transition: background var(--t-base); flex: none; }
.switch::after { content: ''; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform var(--t-base); }
.switch:checked { background: var(--brand-500); }
.switch:checked::after { transform: translateX(18px); }

.num-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-3); margin-top: var(--sp-2); }

/* 字段映射 */
.field-map-head, .field-map-row {
  display: grid;
  grid-template-columns: 1.1fr 1.1fr 1fr 1.4fr 1fr 60px 40px;
  gap: var(--sp-2);
  align-items: center;
}
.field-map-head { padding: 0 var(--sp-2) var(--sp-2); font-size: var(--fs-xs); color: var(--text-3); font-weight: 600; }
.field-map-row { padding: var(--sp-2); border-radius: var(--r-md); animation: slideUp var(--t-fast); }
.field-map-row:hover { background: var(--bg-hover); }
.field-map-row .input, .field-map-row .select { padding: 7px 10px; font-size: var(--fs-xs); }
.field-map-row .del-field { color: var(--err-500); width: 32px; height: 32px; border-radius: var(--r-sm); display: grid; place-items: center; }
.field-map-row .del-field:hover { background: var(--tint-err); }
.chk-cell { display: grid; place-items: center; }
.field-map-tip { font-size: var(--fs-xs); color: var(--text-3); margin: var(--sp-3) var(--sp-2) 0; }

.config-actions {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--sp-4); margin-top: var(--sp-5); margin-bottom: var(--sp-8); flex-wrap: wrap;
}
.config-actions-left, .config-actions-right { display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap; }
.inline-check { display: inline-flex; align-items: center; gap: 7px; font-size: var(--fs-xs); color: var(--text-2); cursor: pointer; }
.probe-result { font-size: var(--fs-xs); font-weight: 500; }
.probe-result.ok { color: var(--ok-600); }
.probe-result.err { color: var(--err-600); }

/* ---------------- 日志控制台 ---------------- */
.log-console {
  padding: var(--sp-3);
  height: calc(100vh - 220px);
  min-height: 360px;
  overflow-y: auto;
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  line-height: 1.7;
  background: var(--bg-sunken);
}
.log-line { display: flex; gap: var(--sp-3); padding: 2px var(--sp-2); border-radius: 4px; }
.log-line:hover { background: var(--bg-hover); }
.log-time { color: var(--text-3); white-space: nowrap; }
.log-level { width: 48px; flex: none; font-weight: 600; text-transform: uppercase; }
.log-level.info { color: var(--info-500); }
.log-level.warn { color: var(--warn-600); }
.log-level.error { color: var(--err-600); }
.log-level.debug { color: var(--text-3); }
.log-scope { color: var(--accent-600); white-space: nowrap; }
.log-msg { color: var(--text-1); word-break: break-word; }

/* ---------------- 手机接入 ---------------- */
.connect-grid { display: grid; grid-template-columns: 340px 1fr; gap: var(--sp-5); }
@media (max-width: 900px) { .connect-grid { grid-template-columns: 1fr; } }
.qr-card { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--sp-4); }
.qr-box {
  width: 260px; height: 260px;
  display: grid; place-items: center;
  border-radius: var(--r-lg);
  background: #fff;
  padding: var(--sp-3);
  box-shadow: var(--shadow-md);
}
.qr-box img { width: 100%; height: 100%; border-radius: var(--r-sm); }
.qr-hint { color: var(--text-2); font-size: var(--fs-sm); margin: 0; }

.net-info { display: flex; flex-direction: column; gap: var(--sp-3); }
.net-row { display: flex; align-items: center; gap: var(--sp-3); }
.net-label { width: 88px; flex: none; font-size: var(--fs-xs); color: var(--text-3); }
.net-value { flex: 1; font-family: var(--font-mono); font-size: var(--fs-sm); color: var(--text-1); background: var(--bg-sunken); padding: 6px 10px; border-radius: var(--r-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.net-addrs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }
.net-addr-chip { font-family: var(--font-mono); font-size: 11px; padding: 4px 9px; border-radius: var(--r-full); background: var(--bg-sunken); color: var(--text-2); }
.connect-steps { margin-top: var(--sp-5); padding-top: var(--sp-5); border-top: 1px solid var(--line-1); }
.connect-steps h3 { margin: 0 0 var(--sp-3); font-size: var(--fs-sm); }
.connect-steps ol { margin: 0; padding-left: var(--sp-5); color: var(--text-2); font-size: var(--fs-sm); }
.connect-steps li { margin-bottom: 8px; }

/* ---------------- 接入令牌 ---------------- */
.token-card { grid-column: 1 / -1; }
.token-status {
  font-size: var(--fs-xs); font-weight: 600; padding: 3px 10px;
  border-radius: var(--r-full); background: var(--bg-sunken); color: var(--text-2);
}
.token-status[data-on="true"] { background: var(--tint-ok, rgba(34,197,94,.12)); color: var(--ok-600, #16a34a); }
.token-status[data-on="false"] { background: var(--bg-sunken); color: var(--text-3); }
.token-desc { margin: var(--sp-3) 0 var(--sp-4); color: var(--text-2); font-size: var(--fs-sm); line-height: 1.7; }
.token-desc code { font-family: var(--font-mono); font-size: 12px; padding: 1px 6px; border-radius: var(--r-sm); background: var(--bg-sunken); color: var(--brand-600); }
.token-row { display: flex; gap: var(--sp-2); align-items: center; }
.token-row .input { flex: 1; }
.token-hint { margin: var(--sp-3) 0 0; font-size: var(--fs-xs); }

/* ---------------- 目标站点登录 ---------------- */
.login-status {
  font-size: var(--fs-xs); font-weight: 600; padding: 3px 10px;
  border-radius: var(--r-full); background: var(--bg-sunken); color: var(--text-2);
}
.login-status[data-on="true"] { background: var(--tint-ok, rgba(34,197,94,.12)); color: var(--ok-600, #16a34a); }
.login-status[data-on="false"] { background: var(--bg-sunken); color: var(--text-3); }
.login-status[data-on="unknown"] { background: var(--bg-sunken); color: var(--text-3); }
.login-desc { margin: var(--sp-3) 0 var(--sp-4); color: var(--text-2); font-size: var(--fs-sm); line-height: 1.7; }
.login-target { display: flex; align-items: center; gap: var(--sp-3); margin-bottom: var(--sp-3); }
.login-target .net-label { width: 88px; flex: none; font-size: var(--fs-xs); color: var(--text-3); }
.login-target .net-value { flex: 1; font-family: var(--font-mono); font-size: var(--fs-sm); color: var(--text-1); background: var(--bg-sunken); padding: 6px 10px; border-radius: var(--r-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.login-row { display: flex; gap: var(--sp-2); align-items: center; }
.login-row .input { flex: 1; }
.login-foot { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); margin-top: var(--sp-3); flex-wrap: wrap; }
.login-result { font-size: var(--fs-xs); font-weight: 500; }
.login-result.ok { color: var(--ok-600); }
.login-result.err { color: var(--err-600); }

/* ---------------- 分段控件 ---------------- */
.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--bg-sunken); border: 1px solid var(--line-1); border-radius: var(--r-md); }
.seg-btn { padding: 6px 12px; border-radius: var(--r-sm); font-size: var(--fs-xs); font-weight: 500; color: var(--text-2); transition: all var(--t-fast); }
.seg-btn:hover { color: var(--text-1); }
.seg-btn.active { background: var(--bg-surface); color: var(--brand-600); box-shadow: var(--shadow-sm); }

/* ---------------- 抽屉 ---------------- */
.drawer-mask { position: fixed; inset: 0; background: rgba(15, 23, 42, 0.4); backdrop-filter: blur(2px); z-index: 40; animation: fadeIn var(--t-fast); }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.drawer {
  position: fixed; top: 0; right: 0; z-index: 50;
  width: 480px; max-width: 92vw; height: 100vh;
  background: var(--bg-surface);
  border-left: 1px solid var(--line-1);
  box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column;
  animation: drawerIn var(--t-base);
}
.drawer[hidden], .drawer-mask[hidden] { display: none; }
@keyframes drawerIn { from { transform: translateX(30px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@media (max-width: 1200px) { .drawer { width: 420px; } }
@media (max-width: 720px) { .drawer { width: 100vw; max-width: 100vw; } }
.drawer-head { display: flex; align-items: flex-start; justify-content: space-between; padding: var(--sp-5); border-bottom: 1px solid var(--line-1); }
.drawer-head h2 { margin: 0; font-size: var(--fs-md); }
.drawer-body { flex: 1; overflow-y: auto; padding: var(--sp-5); }

.detail-block { margin-bottom: var(--sp-5); }
.detail-block h3 { margin: 0 0 var(--sp-3); font-size: var(--fs-sm); color: var(--text-2); }
.kv { display: grid; grid-template-columns: 100px 1fr; gap: 8px var(--sp-3); font-size: var(--fs-sm); }
.kv dt { color: var(--text-3); font-size: var(--fs-xs); }
.kv dd { margin: 0; word-break: break-all; }
.data-table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.data-table td { padding: 7px 10px; border-bottom: 1px solid var(--line-1); }
.data-table td:first-child { color: var(--text-3); width: 120px; font-size: var(--fs-xs); }
.error-box { padding: var(--sp-3); border-radius: var(--r-md); background: var(--tint-err); color: var(--err-600); font-size: var(--fs-sm); }
.shot-img { width: 100%; border-radius: var(--r-md); border: 1px solid var(--line-1); margin-top: var(--sp-2); }

/* ---------------- 轻提示 ---------------- */
.toast-wrap { position: fixed; bottom: var(--sp-6); left: 50%; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: var(--sp-2); align-items: center; }
.toast {
  padding: 11px var(--sp-5);
  border-radius: var(--r-full);
  background: var(--text-1); color: var(--bg-surface);
  font-size: var(--fs-sm); font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: toastIn var(--t-base);
  display: flex; align-items: center; gap: var(--sp-2);
}
.toast.ok { background: var(--ok-600); color: #fff; }
.toast.err { background: var(--err-600); color: #fff; }
.toast.warn { background: var(--warn-600); color: #fff; }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px) scale(0.96); } to { opacity: 1; transform: translateY(0) scale(1); } }

/* ---------------- 抓取结果预览 ---------------- */
.capture-result { margin-top: var(--sp-4); display: flex; flex-direction: column; gap: var(--sp-3); }
.cap-block {
  padding: var(--sp-4);
  border-radius: var(--r-lg);
  border: 1px solid var(--line-1);
  background: var(--bg-soft);
  animation: toastIn var(--t-base);
}
.cap-title { font-weight: 600; font-size: var(--fs-sm); color: var(--text-1); margin-bottom: var(--sp-2); }
.cap-desc { font-size: var(--fs-sm); color: var(--text-2); line-height: 1.6; }
.cap-list { list-style: none; margin: var(--sp-3) 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 6px var(--sp-4); }
.cap-list li { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); font-size: var(--fs-sm); padding: 5px 10px; background: var(--bg-surface); border: 1px solid var(--line-1); border-radius: var(--r-sm); }
.cap-k { color: var(--text-1); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cap-t { color: var(--text-3); font-size: var(--fs-xs); flex-shrink: 0; font-family: var(--mono, monospace); }
.cap-sub { font-size: var(--fs-xs); color: var(--text-3); font-family: var(--mono, monospace); margin: 4px 0; word-break: break-all; }
.cap-actions { margin-top: var(--sp-3); display: flex; gap: var(--sp-2); }
