/* WorkBuddy 任务看板 — 设计基线
   纯静态、零构建。中性色阶 + 单一靛蓝强调色；状态色只用于语义（成功 / 警示 / 危险）。
   深色模式跟随系统，也支持顶栏手动切换（html[data-theme]）。 */

:root {
  color-scheme: light;

  --bg: var(--magpie-bg, #f4f5f8);
  --surface: var(--magpie-card, #ffffff);
  --surface-2: #f7f8fa;
  --surface-3: #eef0f4;
  --ink: var(--magpie-ink, #16181d);
  --ink-2: var(--magpie-ink2, #4c5563);
  --ink-3: var(--magpie-ink3, #7b8494);
  --line: var(--magpie-line, #e3e7ed);
  --line-strong: #cfd6df;

  --accent: #4361ee;
  --accent-hover: #3550d6;
  --accent-strong: #2f49c7;
  --accent-soft: #eef1ff;
  --accent-line: #c7d2fe;
  --accent-ink: #ffffff;

  --ok: #117a54;
  --ok-soft: #e8f7f0;
  --warn: #956200;
  --warn-soft: #fff8e5;
  --warn-line: #f1dca4;
  --danger: #b42318;
  --danger-soft: #fef3f2;

  --shadow-panel: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .05);
  --shadow-pop: 0 12px 32px -12px rgba(16, 24, 40, .28), 0 2px 6px rgba(16, 24, 40, .06);

  --font-ui: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei UI", "Microsoft YaHei",
    "Noto Sans SC", "Noto Sans CJK SC", "Source Han Sans SC", "WenQuanYi Micro Hei",
    system-ui, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;

  --radius: 14px;
  --radius-sm: 9px;
  --page-w: 1240px;
}

:root[data-theme="dark"] {
  color-scheme: dark;

  --bg: #0c0e12;
  --surface: #13161b;
  --surface-2: #191d24;
  --surface-3: #20252e;
  --ink: #eef1f6;
  --ink-2: #aab3c2;
  --ink-3: #7d8798;
  --line: #252b35;
  --line-strong: #374050;

  --accent: #7c93ff;
  --accent-hover: #93a7ff;
  --accent-strong: #a9b9ff;
  --accent-soft: rgba(124, 147, 255, .14);
  --accent-line: rgba(124, 147, 255, .38);
  --accent-ink: #0c1020;

  --ok: #4cd4a0;
  --ok-soft: rgba(76, 212, 160, .12);
  --warn: #e6b450;
  --warn-soft: rgba(230, 180, 80, .12);
  --warn-line: rgba(230, 180, 80, .3);
  --danger: #ff9188;
  --danger-soft: rgba(255, 145, 136, .12);

  --shadow-panel: 0 1px 2px rgba(0, 0, 0, .35);
  --shadow-pop: 0 16px 40px -16px rgba(0, 0, 0, .8), 0 2px 8px rgba(0, 0, 0, .4);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;

    --bg: #0c0e12;
    --surface: #13161b;
    --surface-2: #191d24;
    --surface-3: #20252e;
    --ink: #eef1f6;
    --ink-2: #aab3c2;
    --ink-3: #7d8798;
    --line: #252b35;
    --line-strong: #374050;

    --accent: #7c93ff;
    --accent-hover: #93a7ff;
    --accent-strong: #a9b9ff;
    --accent-soft: rgba(124, 147, 255, .14);
    --accent-line: rgba(124, 147, 255, .38);
    --accent-ink: #0c1020;

    --ok: #4cd4a0;
    --ok-soft: rgba(76, 212, 160, .12);
    --warn: #e6b450;
    --warn-soft: rgba(230, 180, 80, .12);
    --warn-line: rgba(230, 180, 80, .3);
    --danger: #ff9188;
    --danger-soft: rgba(255, 145, 136, .12);

    --shadow-panel: 0 1px 2px rgba(0, 0, 0, .35);
    --shadow-pop: 0 16px 40px -16px rgba(0, 0, 0, .8), 0 2px 8px rgba(0, 0, 0, .4);
  }
}

/* ---- 基础 ---------------------------------------------------------------- */

* { box-sizing: border-box; }

/* hidden 属性必须压过组件的 display（.btn 等设为 inline-flex，否则 [hidden] 会失效） */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p, dl, dd, figure { margin: 0; }

code, kbd {
  font-family: var(--font-mono);
  font-size: .88em;
  background: var(--surface-3);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 1px 5px;
  word-break: break-all;
}

a {
  color: var(--accent-strong);
  text-decoration: none;
  text-underline-offset: 2px;
}
a:hover { text-decoration: underline; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0);
  white-space: nowrap; border: 0;
}

.mono { font-family: var(--font-mono); font-size: .92em; }
.muted { color: var(--ink-3); }
.warn-text { color: var(--warn); }
.hint { color: var(--ink-3); font-size: 11.5px; line-height: 1.6; }
.label {
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: .08em;
  color: var(--ink-3);
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
}
.skip-link:focus { left: 12px; top: 12px; }

/* ---- 顶栏 ---------------------------------------------------------------- */

.appbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.appbar-inner {
  max-width: var(--page-w);
  margin: 0 auto;
  padding: 10px 24px;
  display: flex;
  align-items: center;
  gap: 12px 20px;
  flex-wrap: wrap;
}

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

.brand-mark {
  width: 28px;
  height: 28px;
  flex: none;
  display: block;
}
.brand-mark img {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .14);
}

.brand-copy { display: flex; flex-direction: column; gap: 0; min-width: 0; }
.brand-name { font-size: 14px; font-weight: 650; letter-spacing: .01em; white-space: nowrap; }
.brand-sub {
  font-size: 10.5px;
  color: var(--ink-3);
  letter-spacing: .04em;
  white-space: nowrap;
}

.status-group { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.appbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* 状态胶囊 */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--ink-3);
  font-size: 11.5px;
  font-weight: 550;
  white-space: nowrap;
}
.pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex: none;
}
.pill-ok { color: var(--ok); background: var(--ok-soft); }
.pill-warn { color: var(--warn); background: var(--warn-soft); }
.pill-off { color: var(--ink-3); background: var(--surface-3); }
.pill-quiet { color: var(--ink-3); background: var(--surface-3); }

/* ---- 今日统计条 ------------------------------------------------------------ */

.statbar { background: var(--surface); border-bottom: 1px solid var(--line); }

.statbar-inner {
  max-width: var(--page-w);
  margin: 0 auto;
  padding: 10px 24px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px 24px;
  flex-wrap: wrap;
}

.stats { display: flex; align-items: stretch; margin: 0; }
.stat {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding-right: 22px;
  margin-right: 22px;
  border-right: 1px solid var(--line);
}
.stat:last-child { padding-right: 0; margin-right: 0; border-right: 0; }
.stat dt {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .06em;
  color: var(--ink-3);
}
.stat dd {
  margin: 0;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--ink);
}
.statbar-note { color: var(--ink-3); font-size: 11.5px; }

/* ---- 页面骨架 -------------------------------------------------------------- */

.page {
  max-width: var(--page-w);
  margin: 0 auto;
  padding: 20px 24px 48px;
  display: grid;
  gap: 18px;
}

.panel {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-panel);
  padding: 18px 20px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.panel-title { display: flex; align-items: center; gap: 9px; min-width: 0; }
.panel-title h2 { font-size: 15px; font-weight: 650; letter-spacing: .01em; white-space: nowrap; }

.count {
  display: inline-flex;
  align-items: center;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--ink-3);
  font-size: 10.5px;
  font-weight: 600;
  white-space: nowrap;
}

.panel-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.panel-meta { color: var(--ink-3); font-size: 11.5px; }

.panel-accounts { padding: 0; }
.panel-accounts .panel-head { padding: 16px 20px 12px; margin-bottom: 0; }

.workbench {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(320px, 1fr);
  gap: 18px;
  align-items: stretch;
}

/* 两栏同高：实时进度为空时也保持展开，与右侧排程卡片齐平 */
.workbench > .panel { display: flex; flex-direction: column; }
.workbench > .panel > #jobBody { flex: 1 1 auto; display: flex; flex-direction: column; }

.job-empty {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 24px;
  border: 0;
  background: transparent;
  text-align: center;
}
.job-empty strong {
  display: block;
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-2);
}

/* ---- 按钮 / 表单 ------------------------------------------------------------ */

.btn, .ghost-btn, .icon-btn, .mini-btn, .tab {
  font-family: var(--font-ui);
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, color .15s ease,
    box-shadow .15s ease, transform .06s ease;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 15px;
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
  box-shadow: 0 1px 2px rgba(40, 60, 180, .18);
  white-space: nowrap;
}
.btn:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn:active { transform: translateY(1px); box-shadow: none; }

.ghost-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink-2);
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1.5;
  white-space: nowrap;
}
.ghost-btn:hover { background: var(--surface-2); border-color: var(--line-strong); color: var(--ink); }
.ghost-btn:active { transform: translateY(1px); }

/* 抽屉按钮上的小箭头：展开时翻转 */
.chev {
  width: 5px;
  height: 5px;
  flex: none;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
  margin-top: -3px;
  transition: transform .15s ease, margin-top .15s ease;
}
.ghost-btn.is-open .chev { transform: rotate(-135deg); margin-top: 2px; }

.ghost-danger { color: var(--danger); }
.ghost-danger:hover { background: var(--danger-soft); border-color: var(--danger); color: var(--danger); }

.icon-btn {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink-2);
  font-size: 14px;
  line-height: 1;
}
.icon-btn:hover { background: var(--surface-2); border-color: var(--line-strong); color: var(--ink); }
.theme-glyph { font-size: 15px; }

.btn:disabled, .ghost-btn:disabled, .icon-btn:disabled, .mini-btn:disabled {
  opacity: .42;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.mini-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: transparent;
  color: var(--ink-2);
  font-size: 11.5px;
  font-weight: 500;
  line-height: 1.7;
  white-space: nowrap;
}
.mini-btn:hover { background: var(--surface-2); border-color: var(--line-strong); color: var(--ink); }

.input, select.input, textarea.input {
  font-family: var(--font-ui);
  font-size: 13px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 5px 9px;
  min-width: 0;
  min-height: 32px;
}
.input:hover { border-color: var(--line-strong); }
.input:focus, textarea.input:focus {
  border-color: var(--accent);
  outline: 3px solid var(--accent-soft);
  outline-offset: 0;
}
.input-mono { font-family: var(--font-mono); font-size: 12.5px; }

input[type="checkbox"] { accent-color: var(--accent); width: 14px; height: 14px; margin: 0; }
input[type="radio"] { accent-color: var(--accent); width: 14px; height: 14px; margin: 0; }

.check, .radio, .select-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--ink-2);
  cursor: pointer;
  user-select: none;
}
.check:has(input:disabled), .radio:has(input:disabled) { cursor: not-allowed; opacity: .55; }
.select-inline { gap: 6px; }

/* 开关：原生 checkbox 视觉隐藏，自绘轨道 */
.switch-inline, .switch-row {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--ink-2);
  cursor: pointer;
  user-select: none;
}
.switch-inline input, .switch-row input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
  pointer-events: none;
}
.switch-track {
  position: relative;
  width: 32px;
  height: 19px;
  flex: none;
  border-radius: 999px;
  background: var(--line-strong);
  transition: background .18s ease;
}
.switch-track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .28);
  transition: transform .18s ease;
}
.switch-inline input:checked + .switch-track,
.switch-row input:checked + .switch-track { background: var(--accent); }
.switch-inline input:checked + .switch-track::after,
.switch-row input:checked + .switch-track::after { transform: translateX(13px); }
.switch-inline input:focus-visible + .switch-track,
.switch-row input:focus-visible + .switch-track { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch-inline input:disabled + .switch-track,
.switch-row input:disabled + .switch-track { opacity: .4; }
.switch-inline:has(input:disabled), .switch-row:has(input:disabled) { cursor: not-allowed; opacity: .6; }

.toggle-text { display: none; }

/* 任务腿分段选择 */
.segments {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  border: 0;
  padding: 0;
  margin: 0;
  min-width: 0;
}
.segment { position: relative; display: inline-flex; cursor: pointer; user-select: none; }
.segment input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}
.segment span {
  display: inline-flex;
  align-items: center;
  padding: 4px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.segment:hover span { border-color: var(--line-strong); color: var(--ink); }
.segment input:checked + span {
  background: var(--accent-soft);
  border-color: var(--accent-line);
  color: var(--accent-strong);
  font-weight: 600;
}
.segment input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

.field-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .05em;
  color: var(--ink-3);
  white-space: nowrap;
}
.section-label {
  margin: 0 0 6px;
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: .08em;
  color: var(--ink-3);
}

/* ---- 提示条 / 空态 ------------------------------------------------------------ */

.banners { display: grid; gap: 8px; padding: 0 20px 12px; }
.banners:empty { display: none; }

.banner {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
  padding: 10px 12px;
  font-size: 12.5px;
  color: var(--ink-2);
  line-height: 1.65;
}
.banner strong { display: block; margin-bottom: 2px; color: var(--ink); font-weight: 600; }
.banner p + p { margin-top: 4px; }
.banner ul { margin: 4px 0 0; padding-left: 18px; }
.banner-warn { border-color: var(--warn-line); background: var(--warn-soft); }
.banner-warn strong { color: var(--warn); }

.callout {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  padding: 8px 11px;
  font-size: 12px;
  line-height: 1.65;
  color: var(--ink-2);
}
.callout-warn { border-color: var(--warn-line); background: var(--warn-soft); color: var(--warn); }
.callout[hidden], .hint[hidden] { display: none; }

.empty {
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  background: var(--surface-2);
  padding: 22px 18px;
  color: var(--ink-3);
  font-size: 12.5px;
  line-height: 1.75;
}
.empty strong { display: block; margin-bottom: 3px; color: var(--ink-2); font-size: 13.5px; font-weight: 600; }
.empty code { margin: 0 1px; }
.empty .ghost-btn { margin-top: 10px; }

/* ---- 账号表 ---------------------------------------------------------------- */

.acct-table {
  --acct-cols: 26px minmax(0, 1.4fr) 118px minmax(120px, 1fr) 118px 54px 100px;
  min-width: 0;
}

.acct-head {
  display: grid;
  grid-template-columns: var(--acct-cols);
  align-items: center;
  gap: 0 18px;
  padding: 7px 20px;
  background: var(--surface-2);
  border-block: 1px solid var(--line);
}
.acct-head[hidden] { display: none; }
.head-label {
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: .08em;
  color: var(--ink-3);
  white-space: nowrap;
}
.head-label.center { text-align: center; }
.head-label.right { text-align: right; }

.acct { border-bottom: 1px solid var(--line); }
.acct:last-child { border-bottom: none; }

.acct-grid {
  display: grid;
  grid-template-columns: var(--acct-cols);
  align-items: center;
  gap: 0 18px;
  padding: 12px 20px;
  transition: background .12s ease;
}
.acct-grid:hover { background: var(--surface-2); }

.acct-cell { min-width: 0; }
.acct-pick { display: flex; align-items: center; }

.acct-id { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.acct-name {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.acct-sub {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.acct-status { display: flex; }
.cell-stack { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-width: 0; }
.acct-note { font-size: 11px; color: var(--ink-3); white-space: nowrap; }
.acct-note.warn-text { color: var(--warn); }

.acct-progress { display: flex; flex-direction: column; align-items: flex-start; gap: 5px; min-width: 0; padding-right: 24px; }
.acct-prog-main {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
}
/* 进度条用 SVG + crispEdges 绘制，并提升为独立合成层：
   避免 125%/150% 缩放下因所在行的小数 y 坐标，把 4px 高的填充
   光栅化成 5/6 设备像素不一致。 */
.acct-bar {
  display: block;
  width: 100%;
  /* 填满任务列：写死 190px 时弹性任务列会在「任务 → 积分」之间
     留下约 90px 空白，与其余 18px 的列间距明显不均。 */
  max-width: none;
  height: 4px;
  overflow: visible;
  background: none;
  border-radius: 0;
  backface-visibility: hidden;
}
.acct-bar-track { fill: var(--surface-3); }
.acct-bar-fill {
  fill: var(--accent);
  transition: width .3s ease;
}
.acct-prog-sub { font-size: 11px; color: var(--ink-3); white-space: nowrap; }

/* 积分列（任务列右侧）：余额一行，明细按钮 + 临期徽章在下一行 */
.acct-credits { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-width: 0; }
.credits-main {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--ink);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.credits-remain { color: var(--ok); font-weight: 700; }
.credits-dim { color: var(--ink-3); font-weight: 400; }
.credits-size { color: var(--ink-3); font-weight: 500; }
.credits-main-empty {
  font-family: var(--font-ui);
  font-size: 11.5px;
  font-weight: 500;
  color: var(--ink-3);
}
.credits-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.badge.credits-soon { padding: 0 6px; font-size: 10px; line-height: 1.7; }

.acct-toggle-cell { display: flex; align-items: center; justify-content: center; }
.acct-side { display: flex; justify-content: flex-end; }

/* 任务明细折叠条 */
.acct-tasks { border-top: 1px solid var(--line); }
.acct-tasks-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 20px 7px 64px;
  background: var(--surface-2);
  color: var(--ink-3);
  font-size: 11.5px;
  list-style: none;
  cursor: pointer;
  user-select: none;
}
.acct-tasks-summary::-webkit-details-marker { display: none; }
.acct-tasks-summary::marker { content: ""; }
.acct-tasks-summary::before {
  content: "";
  width: 5px;
  height: 5px;
  flex: none;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(-45deg);
  transition: transform .15s ease;
  margin-top: -2px;
}
details[open] > .acct-tasks-summary::before { transform: rotate(45deg); margin-top: 0; }
.acct-tasks-summary:hover { color: var(--ink); }
details[open] > .acct-tasks-summary { color: var(--ink-2); border-bottom: 1px solid var(--line); }
.acct-tasks-label {
  font-weight: 600;
  color: var(--ink-2);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.acct-tasks-label.warn-text { color: var(--warn); }
.acct-tasks-meta {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-3);
  white-space: nowrap;
}
.acct-tasks-body { background: var(--surface); }

.acct-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(88px, 1fr));
  gap: 1px;
  background: var(--line);
  border-bottom: 1px solid var(--line);
}
.metric {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 8px 12px;
  background: var(--surface);
  min-width: 0;
}
.metric-l { font-size: 10px; letter-spacing: .04em; color: var(--ink-3); white-space: nowrap; }
.metric-v {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--ink);
}
.acct-metrics-empty {
  display: block;
  padding: 9px 20px;
  border-bottom: 1px solid var(--line);
  font-size: 11.5px;
  color: var(--ink-3);
}
.acct-tasks .tbl-wrap { padding: 2px 20px 12px; }

/* 国际版账号诊断：一行次要文字，绝不列出具体账号 */
.acct-intl {
  padding: 8px 20px 0;
  font-size: 11px;
  color: var(--ink-3);
  line-height: 1.6;
}
.acct-intl[hidden] { display: none; }

/* ---- 表格 ------------------------------------------------------------------ */

.tbl-wrap { overflow-x: auto; }

.tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}
.tbl th {
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: .06em;
  color: var(--ink-3);
  text-align: left;
  padding: 7px 8px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.tbl td {
  padding: 8px;
  border-bottom: 1px solid var(--line);
  color: var(--ink-2);
  vertical-align: middle;
}
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl tbody tr:hover td { background: var(--surface-2); }
.tbl td.num, .tbl th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.tbl .cell-main { color: var(--ink); font-weight: 500; }
.tbl .cell-sub {
  display: block;
  margin-top: 1px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-3);
  word-break: break-all;
}
.tbl .detail-cell { max-width: 320px; word-break: break-word; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
}
.badge-strong { color: var(--ok); background: var(--ok-soft); border-color: transparent; }
.badge-warn { color: var(--warn); background: var(--warn-soft); border-color: transparent; }
.badge-quiet { color: var(--ink-3); background: var(--surface-3); border-color: transparent; }

.prog-cell { display: flex; align-items: center; gap: 8px; min-width: 120px; }
.prog {
  flex: 1 1 60px;
  height: 5px;
  background: var(--surface-3);
  border-radius: 999px;
  overflow: hidden;
  min-width: 46px;
}
.prog-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
  transition: width .35s ease;
}
.prog-text {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-3);
  white-space: nowrap;
}

.cell-badges { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.pin-id {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-3);
  white-space: nowrap;
}
.row-note {
  margin-top: 2px;
  max-width: 420px;
  font-size: 11px;
  color: var(--ink-3);
  word-break: break-word;
}
.row-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.snap-stale { padding: 8px 20px 0; font-size: 11.5px; color: var(--warn); }

/* ---- 任务级勾选（只收窄批量操作，不影响单任务按钮） ------------------------------ */

.task-sel-bar {
  display: flex;
  align-items: center;
  gap: 4px 12px;
  flex-wrap: wrap;
  padding: 8px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  font-size: 11.5px;
  color: var(--ink-3);
}
.task-sel-all { font-size: 11.5px; color: var(--ink-3); }
.task-sel-hint { min-width: 0; }
.task-sel-count {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  color: var(--ink-2);
  white-space: nowrap;
}
.task-sel-summary { font-size: 11.5px; color: var(--accent-strong); white-space: nowrap; }
.task-sel-summary[hidden] { display: none; }

.tbl th.pick-col, .tbl td.pick-cell {
  width: 30px;
  padding-right: 0;
}
.tbl td.pick-cell .check { cursor: pointer; }

/* ---- 批量操作条 -------------------------------------------------------------- */

.batchbar {
  display: flex;
  align-items: center;
  gap: 12px 18px;
  flex-wrap: wrap;
  padding: 14px 20px 10px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
  border-radius: 0 0 var(--radius) var(--radius);
}

.batch-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.batch-hints {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
  min-width: 0;
}
.sel-count { font-size: 11.5px; color: var(--ink-3); white-space: nowrap; }
.accept-note { font-size: 11px; color: var(--ink-3); max-width: 280px; text-align: right; line-height: 1.5; }
.accept-note[hidden] { display: none; }
.batch-buttons { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.batch-status {
  flex-basis: 100%;
  margin: 0;
  padding-top: 8px;
  border-top: 1px dashed var(--line-strong);
  font-size: 12px;
  color: var(--ink-2);
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
}
.batch-status:empty { display: none; }

/* ---- 实时进度 ---------------------------------------------------------------- */

.job-meta {
  display: flex;
  align-items: center;
  gap: 6px 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
  font-size: 12px;
  color: var(--ink-3);
}
.job-meta .mono { font-size: 11px; }

.job-totals {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 0 0 14px;
}
.job-totals > div {
  display: flex;
  flex-direction: column-reverse;
  gap: 1px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
  min-width: 0;
}
.job-totals dt { font-size: 10px; letter-spacing: .05em; color: var(--ink-3); white-space: nowrap; }
.job-totals dd {
  margin: 0;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.3;
}

.logpane {
  margin-top: 10px;
  max-height: 220px;
  overflow-y: auto;
  padding: 10px 12px;
  border: 1px solid #1e242e;
  border-radius: 10px;
  background: #0e1116;
  color: #c8d0dc;
  font-family: var(--font-mono);
  font-size: 11.5px;
  line-height: 1.8;
  white-space: pre-wrap;
  word-break: break-all;
}
.logpane:empty::before { content: "（暂无日志）"; color: #6b7686; }

.subhead {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin: 14px 0 8px;
}
.subhead .label {
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: .08em;
  color: var(--ink-3);
}

/* ---- 排程 -------------------------------------------------------------------- */

.sched { display: grid; gap: 12px; }

.switch-row { align-items: flex-start; }
.switch-row .switch-track { margin-top: 1px; }
.switch-text { display: flex; flex-direction: column; gap: 1px; font-size: 13px; color: var(--ink); min-width: 0; }
.switch-text strong { font-weight: 600; }
.switch-text small { font-size: 11.5px; color: var(--ink-3); font-weight: 400; line-height: 1.5; }

/* 小时窗口：两列 × 两行紧凑布局；每行只留 label + input，
   细节说明统一收在下方 .hours-note，避免每行再占一行 hint。 */
.hours {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 14px;
}
.hour-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.hour-row .field-label {
  flex: 0 0 92px;
  width: 92px;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--ink-2);
}
.hour-row .input { flex: 1; width: auto; max-width: none; min-width: 0; }
.hour-row .hint { display: none; }
.hours-note { margin-top: -4px; }

.form-actions { display: flex; justify-content: flex-end; }

.sched-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.sched-block {
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
}

.next-runs { display: grid; gap: 5px; }
.next-run { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; font-size: 12px; color: var(--ink-2); }
.next-run time {
  padding: 0 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink);
  white-space: nowrap;
}

.holds { display: grid; gap: 5px; font-size: 12px; color: var(--ink-2); }
.hold-item { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.hold-name { font-weight: 600; color: var(--ink); }
.hold-uid { font-family: var(--font-mono); font-size: 10.5px; color: var(--ink-3); }
.hold-release { color: var(--warn); font-size: 11.5px; white-space: nowrap; }

details.adv { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
details.adv summary {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 9px 12px;
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 12px;
  list-style: none;
  cursor: pointer;
  user-select: none;
}
details.adv summary::-webkit-details-marker { display: none; }
details.adv summary::marker { content: ""; }
details.adv summary::before {
  content: "";
  width: 5px;
  height: 5px;
  flex: none;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(-45deg);
  margin-top: -2px;
  transition: transform .15s ease;
}
details.adv[open] summary::before { transform: rotate(45deg); margin-top: 0; }
details.adv summary:hover { color: var(--ink); }
details.adv[open] summary { border-bottom: 1px solid var(--line); }
details.adv summary small { color: var(--ink-3); font-size: 11px; }
.adv-body { display: grid; gap: 12px; padding: 12px; }
.adv-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-2); }
.gap-input { width: 100px; }
.hosts { display: grid; gap: 2px; font-size: 11.5px; color: var(--ink-3); }
.hosts span { font-family: var(--font-mono); word-break: break-all; }
.adv-body .hint { margin-top: 4px; }

/* ---- 历史 / 分页 --------------------------------------------------------------- */

.pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 12px;
  font-size: 11.5px;
  color: var(--ink-3);
}
.pager .mono { color: var(--ink-2); }

/* ---- 账号导入 / 导出抽屉 -------------------------------------------------------- */

.io-panel {
  margin: 0 20px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
  overflow: hidden;
}
.io-panel[hidden] { display: none; }

.io-head {
  display: flex;
  align-items: center;
  gap: 10px 16px;
  flex-wrap: wrap;
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.tabs { display: flex; align-items: stretch; gap: 2px; }
.tab {
  padding: 9px 10px 8px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--ink-3);
  font-size: 12.5px;
  font-weight: 500;
}
.tab:hover { color: var(--ink); }
.tab.is-active { color: var(--accent-strong); border-bottom-color: var(--accent); font-weight: 600; }
.io-sub { margin-left: auto; color: var(--ink-3); font-size: 11px; }

.tab-pane { padding: 14px; display: grid; gap: 10px; }
.tab-pane[hidden] { display: none; }

.field-row { display: flex; align-items: center; gap: 10px 14px; flex-wrap: wrap; }
.io-actions { display: flex; align-items: center; gap: 8px 12px; flex-wrap: wrap; }
.io-file-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.file-btn { display: inline-flex; }

textarea.io-textarea {
  display: block;
  width: 100%;
  min-height: 110px;
  margin-top: 2px;
  resize: vertical;
  line-height: 1.6;
  white-space: pre;
  overflow-wrap: normal;
  overflow-x: auto;
}
.io-textarea::placeholder { color: var(--ink-3); }

.status-line {
  margin: 0;
  font-size: 12px;
  color: var(--ink-2);
  line-height: 1.7;
  word-break: break-word;
}
.status-line:empty { display: none; }

.rules { border-top: 1px dashed var(--line-strong); padding-top: 8px; }
.rules summary {
  font-size: 11.5px;
  color: var(--ink-3);
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.rules summary::-webkit-details-marker { display: none; }
.rules summary::marker { content: ""; }
.rules summary::before {
  content: "+";
  display: inline-block;
  width: 12px;
  color: var(--ink-3);
}
.rules[open] summary::before { content: "−"; }
.rules summary:hover { color: var(--ink); }
.rules-body { padding: 6px 0 0 12px; font-size: 11.5px; color: var(--ink-3); line-height: 1.75; }
.rules-body code { font-size: .92em; }
.rules-body strong { color: var(--ink-2); }

/* 导入预览 / 结果 */
.imp-totals {
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink);
}
.imp-group { margin-top: 10px; }
.imp-group-title { margin: 0 0 3px; }
.imp-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  padding: 4px 0;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  color: var(--ink-2);
}
.imp-row:last-child { border-bottom: none; }
.imp-name { font-weight: 600; color: var(--ink); }
.imp-uid { color: var(--ink-3); word-break: break-all; }
.imp-key { color: var(--ink); }
.imp-expiry { color: var(--ink-3); white-space: nowrap; }
.imp-reason { flex: 1 1 220px; min-width: 0; word-break: break-word; }
.imp-index { color: var(--warn); }
.imp-row-skip, .imp-row-skip .imp-name { color: var(--ink-3); font-weight: 400; }
.imp-row-reject { color: var(--warn); }
.imp-row-reject .imp-reason { color: var(--warn); }
.imp-hint { color: var(--ink-3); word-break: break-all; }
.imp-row-reject .imp-hint { color: inherit; opacity: .8; }
.imp-line { margin-top: 6px; font-size: 12px; color: var(--ink-2); word-break: break-word; }
.imp-line code { margin-left: 2px; }
.imp-reload { margin-top: 10px; }

/* ---- Toast ----------------------------------------------------------------------- */

.toasts {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 80;
  display: grid;
  gap: 8px;
  justify-items: end;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  max-width: 420px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow-pop);
  color: var(--ink-2);
  font-size: 12.5px;
  line-height: 1.6;
  word-break: break-word;
}
.toast-warn { border-left-color: var(--warn); }

/* ---- 对话框 ------------------------------------------------------------------------ */

dialog {
  width: calc(100% - 32px);
  max-width: 560px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-pop);
}
dialog::backdrop { background: rgba(8, 10, 14, .5); }
.dialog-body { display: grid; gap: 10px; padding: 20px; }
.dialog-title { font-size: 15px; font-weight: 650; }
.dialog-text { font-size: 12.5px; color: var(--ink-2); line-height: 1.7; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.cmd-pre {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--ink-2);
  font-family: var(--font-mono);
  font-size: 11.5px;
  line-height: 1.8;
  white-space: pre-wrap;
  word-break: break-all;
}
.error-text { font-size: 12px; color: var(--warn); }

/* ---- 积分明细弹窗 ------------------------------------------------------------------ */

.credits-dialog { max-width: 960px; }
.credits-body { display: flex; flex-direction: column; max-height: min(88vh, 900px); }
.credits-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--line);
}
.credits-head-main { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.credits-badges { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.credits-close { flex: none; font-size: 18px; line-height: 1; }

.credits-scroll { overflow-y: auto; padding: 14px 20px 4px; }
.credits-status {
  margin: 0 0 12px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  font-size: 12px;
  line-height: 1.6;
}
.credits-status[hidden] { display: none; }
.credits-status-loading { color: var(--ink-3); }
.credits-status-error {
  border-color: var(--warn-line);
  background: var(--warn-soft);
  color: var(--warn);
}

.credits-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.credits-metric {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
}
.credits-metric-l { font-size: 10.5px; letter-spacing: .05em; color: var(--ink-3); }
.credits-metric-v {
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 650;
  line-height: 1.25;
  color: var(--ink);
  overflow-wrap: anywhere;
  font-variant-numeric: tabular-nums;
}
.credits-metric-v.is-remain { color: var(--ok); }
.credits-metric-v.is-muted { color: var(--ink-3); font-size: 17px; }
.credits-metric-sub { font-size: 11px; line-height: 1.5; color: var(--ink-3); }

.credits-usage {
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}
.credits-usage-row { display: flex; align-items: center; gap: 10px 16px; flex-wrap: wrap; }
.credits-bar {
  flex: 1 1 240px;
  min-width: 120px;
  height: 8px;
  border-radius: 999px;
  background: var(--surface-3);
  overflow: hidden;
}
.credits-bar-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
  transition: width .3s ease;
}
.credits-usage-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  font-size: 11px;
  color: var(--ink-3);
  white-space: nowrap;
}
.credits-usage-pct { color: var(--ink-2); font-weight: 600; }

.credits-filters { margin-top: 14px; }
.credits-filter-row { display: flex; align-items: center; gap: 10px 12px; flex-wrap: wrap; }
.credits-filter-tabs { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.credits-filter {
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-3);
  font-family: var(--font-ui);
  font-size: 11.5px;
  font-weight: 500;
  line-height: 1.6;
  white-space: nowrap;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.credits-filter:hover { border-color: var(--line-strong); color: var(--ink); }
.credits-filter.is-active {
  background: var(--accent-soft);
  border-color: var(--accent-line);
  color: var(--accent-strong);
  font-weight: 600;
}
.credits-filter-tools { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.credits-search { width: 250px; max-width: 100%; }
.credits-sort { min-width: 138px; }

.credits-table-wrap { margin-top: 12px; overflow-x: auto; }
.credits-tbl { min-width: 760px; }
.credits-tbl th, .credits-tbl td { vertical-align: top; }
.credits-tbl td { padding-top: 10px; padding-bottom: 10px; }
.credits-pkg-main { display: block; color: var(--ink); font-weight: 600; word-break: break-word; }
.credits-pkg-sub {
  display: block;
  margin-top: 2px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-3);
  word-break: break-all;
}
.credits-pkg-note {
  display: block;
  margin-top: 3px;
  font-size: 11px;
  line-height: 1.5;
  color: var(--ink-3);
  word-break: break-word;
}
.credits-exp-main { display: block; margin-top: 5px; font-size: 11.5px; color: var(--ink-2); white-space: nowrap; }
.credits-exp-sub {
  display: block;
  margin-top: 2px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-3);
  white-space: nowrap;
}
.credits-tbl .credits-remain-cell { color: var(--ok); font-weight: 650; }
.credits-tbl .credits-remain-cell.credits-zero { color: var(--ink-3); font-weight: 400; }
.credits-mini { display: flex; align-items: center; gap: 7px; min-width: 104px; }
.credits-mini-bar {
  flex: 1 1 52px;
  min-width: 40px;
  height: 5px;
  border-radius: 999px;
  background: var(--surface-3);
  overflow: hidden;
}
.credits-mini-fill { display: block; height: 100%; border-radius: 999px; background: var(--accent); }
.credits-mini-text {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-3);
  white-space: nowrap;
}
.credits-empty { padding: 26px 0; text-align: center; color: var(--ink-3); font-size: 12.5px; }
.credits-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 12px 20px;
  border-top: 1px solid var(--line);
  background: var(--surface);
}
.credits-foot .dialog-actions { margin-top: 0; }

/* ---- 页脚 -------------------------------------------------------------------------- */

.foot {
  max-width: var(--page-w);
  margin: 0 auto;
  padding: 0 24px 32px;
  color: var(--ink-3);
  font-size: 11px;
  line-height: 1.7;
}
.foot p + p { margin-top: 3px; }

/* ---- 响应式 ------------------------------------------------------------------------ */

@media (max-width: 1100px) {
  .workbench { grid-template-columns: minmax(0, 1fr); }
  .acct-table { --acct-cols: 26px minmax(0, 1.3fr) 108px minmax(112px, 1fr) 112px 52px 94px; }
  .acct-head, .acct-grid { gap: 0 14px; }
}

@media (max-width: 820px) {
  .appbar-inner, .statbar-inner { padding-left: 16px; padding-right: 16px; }
  .page { padding: 16px 16px 40px; gap: 14px; }
  .foot { padding-left: 16px; padding-right: 16px; }
  .panel { padding: 16px; }
  .panel-accounts { padding: 0; }

  /* 账号表降级为卡片 */
  .acct-head { display: none; }
  .acct-table { --acct-cols: none; }
  .acct-grid {
    grid-template-columns: 24px minmax(0, 1fr) auto;
    grid-template-areas:
      "pick id side"
      "pick status status"
      "pick prog prog"
      "pick credits credits"
      "pick toggle toggle";
    align-items: start;
    gap: 7px 12px;
    padding: 14px 16px;
  }
  .acct-pick { grid-area: pick; padding-top: 2px; }
  .acct-id { grid-area: id; }
  .acct-status { grid-area: status; }
  .acct-progress { grid-area: prog; }
  .acct-credits { grid-area: credits; flex-direction: row; align-items: center; gap: 8px; flex-wrap: wrap; }
  .acct-toggle-cell {
    grid-area: toggle;
    justify-content: flex-start;
    padding-top: 7px;
    border-top: 1px dashed var(--line);
  }
  .acct-side { grid-area: side; }

  .acct-status, .acct-progress { flex-direction: row; align-items: center; gap: 8px; flex-wrap: wrap; }
  .cell-stack { flex-direction: row; align-items: center; gap: 8px; }
  .acct-progress {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 4px 10px;
    padding-right: 0;
  }
  .acct-progress .acct-prog-main { grid-column: 1; }
  .acct-progress .acct-prog-sub { grid-column: 2; text-align: right; }
  .acct-progress .acct-bar { grid-column: 1 / -1; width: 100%; max-width: none; }
  .toggle-text { display: inline; }

  .acct-tasks-summary { padding-left: 16px; }

  .banners { padding: 0 16px 10px; }
  .acct-intl { padding: 8px 16px 0; }
  .acct-tasks .tbl-wrap { padding: 2px 16px 10px; }
  .task-sel-bar { padding-left: 16px; padding-right: 16px; }
  /* 窄屏：小时窗口降为单列，避免两列时输入框过窄 */
  .hours { grid-template-columns: minmax(0, 1fr); }
  .acct-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .batchbar { padding: 14px 16px 10px; }
  .batch-actions { margin-left: 0; width: 100%; justify-content: space-between; }
  .batch-hints { align-items: flex-start; }
  .accept-note { text-align: left; }
}

@media (max-width: 640px) {
  .appbar { position: static; }
  .appbar-inner { padding-top: 10px; padding-bottom: 10px; }
  .brand-sub { display: none; }
  .appbar-actions { margin-left: 0; width: 100%; }
  .appbar-actions .ghost-btn { flex: 1 1 auto; }

  .statbar-inner { padding-top: 9px; padding-bottom: 9px; }
  .statbar-note { display: none; }
  .stats { width: 100%; justify-content: space-between; }
  .stat { flex: 1; padding-right: 12px; margin-right: 12px; }
  .stat dd { font-size: 16px; }

  .page { padding: 12px 12px 36px; gap: 12px; }
  .panel { padding: 14px; border-radius: 12px; }
  .panel-accounts { padding: 0; }
  .panel-accounts .panel-head { padding: 14px 14px 10px; }
  .panel-title h2 { font-size: 14.5px; }

  .foot { padding: 0 12px 28px; }

  .job-totals { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sched-cols { grid-template-columns: minmax(0, 1fr); }

  .batchbar { border-radius: 0 0 12px 12px; }
  .batch-actions { flex-direction: column; align-items: stretch; gap: 8px; }
  .batch-buttons { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .batch-buttons .btn { grid-column: 1 / -1; order: -1; }

  .io-panel { margin: 0 14px 12px; }
  .io-head { padding: 0 10px; }
  .io-sub { display: none; }
  .tab-pane { padding: 12px; }

  /* 通用表格降级为卡片 */
  .tbl thead { display: none; }
  .tbl, .tbl tbody, .tbl tr, .tbl td { display: block; width: 100%; }
  .tbl tr {
    margin-bottom: 8px;
    padding: 4px 0;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
  }
  .tbl td {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px 12px;
    flex-wrap: wrap;
    padding: 5px 12px;
    border-bottom: none;
    text-align: left;
  }
  .tbl td::before {
    content: attr(data-label);
    flex: none;
    font-size: 10.5px;
    letter-spacing: .06em;
    color: var(--ink-3);
  }
  .tbl td[data-label=""]::before { content: none; }
  .tbl td.num { text-align: right; }
  .tbl td .cell-badges, .tbl td .row-note { flex-basis: 100%; }
  .tbl td .row-actions { flex: 1 1 100%; justify-content: flex-start; }
  .detail-cell, .prog-cell { max-width: none; }
  .prog-cell { flex: 1 1 auto; }

  /* 任务 / 步骤 / 历史：窄屏不摊成六行高卡片，压成三行紧凑条目 */
  .tbl-steps tr, .tbl-history tr, .tbl-tasks tr {
    display: grid;
    gap: 3px 10px;
    margin-bottom: 6px;
    padding: 9px 12px;
  }
  .tbl-steps td, .tbl-history td, .tbl-tasks td {
    display: block;
    padding: 0;
    border: 0;
    text-align: left;
  }
  .tbl-steps td::before, .tbl-history td::before, .tbl-tasks td::before { display: none; }

  .tbl-steps tr { grid-template-columns: minmax(0, 1fr) auto auto; }
  .tbl-steps td[data-label="账号"] { grid-column: 1; grid-row: 1; }
  .tbl-steps td[data-label="状态"] { grid-column: 2; grid-row: 1; justify-self: end; }
  .tbl-steps td[data-label="时间"] { grid-column: 3; grid-row: 1; justify-self: end; font-size: 10.5px; color: var(--ink-3); }
  .tbl-steps td[data-label="详情"] { grid-column: 1 / -1; grid-row: 2; font-size: 11.5px; color: var(--ink-2); }
  .tbl-steps td[data-label="收益"] { grid-column: 1; grid-row: 3; font-size: 11px; text-align: left; }
  .tbl-steps td[data-label="腿"] { grid-column: 2 / -1; grid-row: 3; justify-self: end; font-size: 10.5px; color: var(--ink-3); }

  .tbl-history tr { grid-template-columns: auto minmax(0, 1fr) auto; }
  .tbl-history td[data-label="账号"] { grid-column: 1 / 3; grid-row: 1; }
  .tbl-history td[data-label="结果"] { grid-column: 3; grid-row: 1; justify-self: end; }
  .tbl-history td[data-label="说明"] { grid-column: 1 / -1; grid-row: 2; font-size: 11.5px; color: var(--ink-2); }
  .tbl-history td[data-label="时间"] { grid-column: 1; grid-row: 3; font-size: 10.5px; color: var(--ink-3); }
  .tbl-history td[data-label="腿"] { grid-column: 2; grid-row: 3; justify-self: center; font-size: 10.5px; color: var(--ink-3); }
  .tbl-history td[data-label="收益"] { grid-column: 3; grid-row: 3; justify-self: end; font-size: 11px; }
  .tbl-history td[data-label="触发"] { display: none; }

  .tbl-tasks tr { grid-template-columns: auto minmax(0, 1fr) auto; }
  .tbl-tasks td[data-label="选"] { grid-column: 1; grid-row: 1; align-self: start; padding-top: 2px; }
  .tbl-tasks td[data-label="任务"] { grid-column: 2 / -1; grid-row: 1; }
  .tbl-tasks td[data-label="状态"] { grid-column: 1; grid-row: 2; }
  .tbl-tasks td[data-label="进度"] { grid-column: 2; grid-row: 2; }
  .tbl-tasks td[data-label="奖励"] { grid-column: 3; grid-row: 2; justify-self: end; font-size: 11px; }
  .tbl-tasks td[data-label="操作"] { grid-column: 1 / -1; grid-row: 3; }
  .tbl-tasks .prog-cell { min-width: 0; }

  /* 账号卡片里的任务表：去掉双层边框，和卡片对齐 */
  .acct-tasks .tbl tr {
    margin-bottom: 0;
    border: 0;
    border-bottom: 1px solid var(--line);
    border-radius: 0;
    background: transparent;
  }
  .acct-tasks .tbl tr:last-child { border-bottom: none; }

  .toasts { left: 12px; right: 12px; bottom: 12px; justify-items: stretch; }
  .toast { max-width: none; }
}

@media (max-width: 420px) {
  .acct-grid {
    grid-template-columns: 22px minmax(0, 1fr) auto;
    grid-template-areas:
      "pick id side"
      "pick status status"
      "pick prog prog"
      "pick credits credits"
      "pick toggle toggle";
  }
  .acct-side { align-self: start; }
}

/* 积分明细：窄屏下权益包表格保持横向滚动，不跟随通用 .tbl 的卡片化 */
@media (max-width: 640px) {
  .credits-tbl { display: table; width: 100%; }
  .credits-tbl thead { display: table-header-group; }
  .credits-tbl tbody { display: table-row-group; }
  .credits-tbl tr {
    display: table-row;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
  }
  .credits-tbl th, .credits-tbl td {
    display: table-cell;
    width: auto;
    padding: 8px;
    border-bottom: 1px solid var(--line);
    text-align: left;
  }
  .credits-tbl td::before { content: none; }
  .credits-tbl th.num, .credits-tbl td.num { text-align: right; }
}

@media (max-width: 600px) {
  .credits-dialog {
    width: 100vw;
    max-width: 100vw;
    height: 100vh;
    height: 100dvh;
    max-height: 100vh;
    max-height: 100dvh;
    margin: 0;
    border: 0;
    border-radius: 0;
  }
  .credits-body { max-height: none; height: 100%; }
  .credits-head { padding: 14px 14px 10px; }
  .credits-scroll { padding: 12px 14px 4px; }
  .credits-foot { padding: 10px 14px; }
  .credits-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .credits-filter-row { align-items: stretch; }
  .credits-filter-tabs { width: 100%; }
  .credits-filter-tools { margin-left: 0; width: 100%; }
  .credits-search { flex: 1 1 170px; width: auto; }
  .credits-sort { flex: 1 1 140px; }
  .credits-usage-meta { align-items: flex-start; }
}

@media (max-width: 360px) {
  .batch-buttons { grid-template-columns: minmax(0, 1fr); }
  .batch-buttons .btn { grid-column: auto; }
}

/* ---- 动效偏好 ---------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition: none !important;
    animation: none !important;
    scroll-behavior: auto !important;
  }
}
