/* ═══════════════════════════════════════════════════════════
   Gemini Subscribe — storefront styles
   Tokens → base → layout → components → feature blocks
   ═══════════════════════════════════════════════════════════ */

:root {
  color-scheme: light;
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f2f4f7;
  --surface-3: #e9ecf1;
  --border: #e2e6ec;
  --border-strong: #cdd3dc;
  --text: #0f172a;
  --text-2: #475569;
  --text-3: #5f6b7e;

  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-text: #4338ca;
  --primary-soft: #eef0ff;
  --on-primary: #ffffff;

  --success: #15803d;
  --success-soft: #eafaf0;
  --warning: #a16207;
  --warning-soft: #fff8e6;
  --danger: #b91c1c;
  --danger-soft: #fdf0f0;
  --info: #0369a1;
  --info-soft: #eef7fd;
  --running: #2563eb;
  --running-soft: #edf3ff;

  --focus: 0 0 0 3px rgba(79, 70, 229, 0.35);
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.06), 0 6px 20px rgba(15, 23, 42, 0.05);
  --shadow-lg: 0 20px 50px rgba(15, 23, 42, 0.18);
  --backdrop: rgba(15, 23, 42, 0.45);

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;

  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0b0f17;
    --surface: #121826;
    --surface-2: #182033;
    --surface-3: #1f2940;
    --border: #232c3f;
    --border-strong: #33405a;
    --text: #e7eaf0;
    --text-2: #aab3c4;
    --text-3: #8b95a9;
    --primary: #6d6af5;
    --primary-hover: #807df8;
    --primary-text: #a5b4fc;
    --primary-soft: rgba(109, 106, 245, 0.16);
    --success: #4ade80;
    --success-soft: rgba(74, 222, 128, 0.12);
    --warning: #fbbf24;
    --warning-soft: rgba(251, 191, 36, 0.12);
    --danger: #f87171;
    --danger-soft: rgba(248, 113, 113, 0.12);
    --info: #38bdf8;
    --info-soft: rgba(56, 189, 248, 0.12);
    --running: #60a5fa;
    --running-soft: rgba(96, 165, 250, 0.14);
    --focus: 0 0 0 3px rgba(129, 140, 248, 0.5);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.25);
    --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.55);
    --backdrop: rgba(3, 6, 12, 0.65);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b0f17;
  --surface: #121826;
  --surface-2: #182033;
  --surface-3: #1f2940;
  --border: #232c3f;
  --border-strong: #33405a;
  --text: #e7eaf0;
  --text-2: #aab3c4;
  --text-3: #8b95a9;
  --primary: #6d6af5;
  --primary-hover: #807df8;
  --primary-text: #a5b4fc;
  --primary-soft: rgba(109, 106, 245, 0.16);
  --success: #4ade80;
  --success-soft: rgba(74, 222, 128, 0.12);
  --warning: #fbbf24;
  --warning-soft: rgba(251, 191, 36, 0.12);
  --danger: #f87171;
  --danger-soft: rgba(248, 113, 113, 0.12);
  --info: #38bdf8;
  --info-soft: rgba(56, 189, 248, 0.12);
  --running: #60a5fa;
  --running-soft: rgba(96, 165, 250, 0.14);
  --focus: 0 0 0 3px rgba(129, 140, 248, 0.5);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.55);
  --backdrop: rgba(3, 6, 12, 0.65);
}

/* ─── Base ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
body.is-locked { overflow: hidden; }
h1, h2, h3, h4 { margin: 0; line-height: 1.3; font-weight: 600; }
p { margin: 0; }
a { color: var(--primary-text); }
code, kbd, pre { font-family: var(--mono); }
code {
  font-size: 0.88em;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.05em 0.35em;
  overflow-wrap: anywhere;
}
img { max-width: 100%; }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: none; box-shadow: var(--focus); }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 12px; top: -48px; z-index: 100;
  background: var(--primary); color: var(--on-primary);
  padding: 8px 14px; border-radius: var(--radius-sm); text-decoration: none;
  transition: top 0.15s;
}
.skip-link:focus { top: 12px; }
.icon { width: 16px; height: 16px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon--sm { width: 14px; height: 14px; }
.icon--lg { width: 20px; height: 20px; }
.mono { font-family: var(--mono); }
.muted { color: var(--text-3); }

/* ─── Top bar ──────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 30;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar__inner {
  max-width: 1280px; margin: 0 auto;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 20px; min-height: 60px;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); min-width: 0; }
.brand__logo { width: 32px; height: 32px; border-radius: 8px; flex-shrink: 0; }
.brand__name { font-weight: 700; font-size: 15px; letter-spacing: -0.01em; white-space: nowrap; }
.topbar__status { display: flex; align-items: center; gap: 8px; margin-left: 8px; min-width: 0; }
.topbar__actions { display: flex; align-items: center; gap: 6px; margin-left: auto; }

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  height: 28px; padding: 0 10px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface);
  font-size: 12px; font-weight: 500; color: var(--text-2); white-space: nowrap;
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); flex-shrink: 0; }
.pill[data-state="running"] .dot { background: var(--success); box-shadow: 0 0 0 3px var(--success-soft); }
.pill[data-state="paused"] { color: var(--warning); border-color: color-mix(in srgb, var(--warning) 35%, var(--border)); background: var(--warning-soft); }
.pill[data-state="paused"] .dot { background: var(--warning); }
.pill[data-state="offline"] { color: var(--danger); }
.pill[data-state="offline"] .dot { background: var(--danger); }

/* ─── Buttons ──────────────────────────────────────────── */
.btn {
  --h: 40px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: var(--h); padding: 0 16px; border-radius: var(--radius-sm);
  border: 1px solid transparent; cursor: pointer;
  font-size: 14px; font-weight: 600; line-height: 1; white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, color 0.15s, opacity 0.15s;
  text-decoration: none;
}
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; }
.btn--primary { background: var(--primary); color: var(--on-primary); }
.btn--primary:not(:disabled):hover { background: var(--primary-hover); }
.btn--secondary { background: var(--surface); border-color: var(--border-strong); color: var(--text); }
.btn--danger { background: var(--danger); color: #fff; }
.btn--danger:not(:disabled):hover { filter: brightness(0.94); }
.btn--secondary:not(:disabled):hover { background: var(--surface-2); }
.btn--ghost { background: transparent; color: var(--text-2); }
.btn--ghost:not(:disabled):hover { background: var(--surface-2); color: var(--text); }
.btn--sm { --h: 32px; padding: 0 10px; font-size: 13px; font-weight: 500; gap: 6px; }
.btn--xs { --h: 26px; padding: 0 8px; font-size: 12px; font-weight: 500; gap: 4px; border-radius: 5px; }
.btn--block { width: 100%; }
.btn--lg { --h: 46px; font-size: 15px; }
.btn__meta { font-weight: 500; font-size: 12px; opacity: 0.85; padding-left: 8px; border-left: 1px solid rgba(255, 255, 255, 0.35); }
.btn.is-loading { position: relative; color: transparent !important; pointer-events: none; }
.btn.is-loading::after {
  content: ''; position: absolute; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid var(--on-primary); border-right-color: transparent;
  animation: spin 0.7s linear infinite;
}
.btn--secondary.is-loading::after { border-color: var(--text-2); border-right-color: transparent; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: var(--radius-sm);
  border: 1px solid transparent; background: transparent; color: var(--text-2); cursor: pointer;
  flex-shrink: 0;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn[aria-pressed="true"] { color: var(--primary-text); background: var(--primary-soft); }
.link-btn {
  background: none; border: 0; padding: 0; cursor: pointer;
  color: var(--primary-text); font-size: 13px; font-weight: 500; text-decoration: underline; text-underline-offset: 2px;
}
.link-btn:hover { text-decoration-thickness: 2px; }

/* Segmented control */
.seg {
  display: inline-flex; padding: 2px; gap: 2px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px;
}
.seg__btn {
  border: 0; background: transparent; cursor: pointer;
  height: 28px; padding: 0 10px; border-radius: 6px;
  font-size: 13px; font-weight: 500; color: var(--text-2); white-space: nowrap;
}
.seg__btn:hover:not(:disabled) { color: var(--text); }
.seg__btn[aria-pressed="true"], .seg__btn[aria-selected="true"] {
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm);
}
.seg__btn:disabled { opacity: 0.45; cursor: not-allowed; }
.seg--lang .seg__btn { padding: 0 9px; min-width: 34px; }
.seg--block { display: flex; }
.seg--block .seg__btn { flex: 1; }

/* ─── Banners ──────────────────────────────────────────── */
.banners { max-width: 1280px; margin: 0 auto; padding: 0 20px; }
.banner {
  display: flex; align-items: flex-start; gap: 10px;
  margin-top: 16px; padding: 12px 14px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--surface); font-size: 13.5px;
}
.banner .icon { margin-top: 2px; }
.banner__text { flex: 1; min-width: 0; white-space: pre-line; word-break: break-word; }
.banner__title { font-weight: 600; display: block; }
.banner--info { background: var(--info-soft); border-color: color-mix(in srgb, var(--info) 25%, transparent); color: var(--text); }
.banner--info > .icon { color: var(--info); }
.banner--warn { background: var(--warning-soft); border-color: color-mix(in srgb, var(--warning) 30%, transparent); }
.banner--warn > .icon { color: var(--warning); }
.banner--danger { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 30%, transparent); }
.banner--danger > .icon { color: var(--danger); }

/* ─── Layout ───────────────────────────────────────────── */
.layout {
  max-width: 1280px; margin: 0 auto; padding: 20px;
  display: grid; gap: 20px;
  grid-template-columns: minmax(0, 420px) minmax(0, 1fr);
  align-items: start;
}
.col { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
@media (max-width: 1023px) {
  .layout { grid-template-columns: minmax(0, 1fr); max-width: 760px; }
}

/* ─── Cards ────────────────────────────────────────────── */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow); min-width: 0;
}
.card__head {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 16px 18px; border-bottom: 1px solid var(--border);
}
.card__titles { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1 1 auto; }
.card__title { font-size: 15px; }
.card__sub { font-size: 12.5px; color: var(--text-3); margin-top: 1px; }
.card__tools { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-left: auto; }
.card__body { padding: 18px; }
.card__foot {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  padding: 10px 18px; border-top: 1px solid var(--border); font-size: 13px; color: var(--text-3);
}
.step-num {
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--primary-soft); color: var(--primary-text);
  font-size: 13px; font-weight: 700;
}
#keyCard.is-done .step-num { background: var(--success-soft); color: var(--success); }

/* ─── Forms ────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field:last-child { margin-bottom: 0; }
.label { font-size: 13px; font-weight: 600; color: var(--text); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.label__tag {
  font-size: 11px; font-weight: 600; padding: 1px 6px; border-radius: 4px;
  background: var(--surface-2); color: var(--text-3); border: 1px solid var(--border);
}
.label__tag--req { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.label__aside { margin-left: auto; font-weight: 500; }
.input {
  width: 100%; height: 40px; padding: 0 12px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  font: inherit; font-size: 14px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input::placeholder { color: var(--text-3); opacity: 0.8; }
.input:hover { border-color: color-mix(in srgb, var(--text-3) 60%, var(--border-strong)); }
.input:focus { outline: none; border-color: var(--primary); box-shadow: var(--focus); }
.input[aria-invalid="true"] { border-color: var(--danger); }
.input[aria-invalid="true"]:focus { box-shadow: 0 0 0 3px var(--danger-soft); }
.input:disabled { background: var(--surface-2); cursor: not-allowed; }
.input--mono { font-family: var(--mono); font-size: 13px; letter-spacing: 0.01em; }
.textarea {
  height: auto; min-height: 160px; padding: 10px 12px; resize: vertical;
  font-family: var(--mono); font-size: 12.5px; line-height: 1.6; white-space: pre; overflow-x: auto;
}
.input-wrap { position: relative; flex: 1; min-width: 0; }
.input-wrap .input { padding-right: 40px; }
.input-wrap__btn {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
}
.input-row { display: flex; gap: 8px; }
.help { font-size: 12.5px; color: var(--text-3); line-height: 1.5; }
.help strong { color: var(--text-2); }
.field-error { font-size: 12.5px; color: var(--danger); display: flex; gap: 6px; align-items: flex-start; }
.field-warn { font-size: 12.5px; color: var(--warning); display: flex; gap: 6px; align-items: flex-start; }
.field-error .icon, .field-warn .icon { margin-top: 2px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); cursor: pointer; user-select: none; }
.check input { width: 16px; height: 16px; accent-color: var(--primary); margin: 0; }
.form-actions { margin-top: 18px; display: flex; flex-direction: column; gap: 8px; }
.form-hint { font-size: 12.5px; color: var(--text-3); text-align: center; }
.details { border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); padding: 0 12px; margin-bottom: 14px; }
.details > summary {
  cursor: pointer; list-style: none; padding: 10px 0; font-size: 13px; font-weight: 500; color: var(--text-2);
  display: flex; align-items: center; gap: 6px;
}
.details > summary::-webkit-details-marker { display: none; }
.details > summary .icon { transition: transform 0.2s; }
.details[open] > summary .icon { transform: rotate(90deg); }
.details[open] { padding-bottom: 12px; }
.twofa-box {
  border: 1px solid var(--border); background: var(--surface-2);
  border-radius: var(--radius); padding: 12px; margin-bottom: 14px;
}
.twofa-box .field { margin-bottom: 0; }
.twofa-box__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.twofa-box .input { background: var(--surface); }
.twofa-note { font-size: 12px; color: var(--text-3); margin-top: 8px; display: flex; gap: 6px; align-items: flex-start; }
.twofa-note .icon { margin-top: 1px; }

/* ─── Notices ──────────────────────────────────────────── */
.notice {
  display: flex; gap: 8px; align-items: flex-start;
  padding: 10px 12px; border-radius: var(--radius-sm); font-size: 13px; line-height: 1.5;
  border: 1px solid transparent;
}
.notice .icon { margin-top: 2px; }
.notice--info { background: var(--info-soft); color: var(--text); }
.notice--info > .icon { color: var(--info); }
.notice--warn { background: var(--warning-soft); color: var(--text); }
.notice--warn > .icon { color: var(--warning); }
.notice--danger { background: var(--danger-soft); color: var(--text); }
.notice--danger > .icon { color: var(--danger); }
.notice--muted { background: var(--surface-2); color: var(--text-2); }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack:empty { display: none; }

/* ─── Badges ───────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  height: 22px; padding: 0 8px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
  background: var(--surface-2); color: var(--text-2);
}
.badge--primary { background: var(--primary-soft); color: var(--primary-text); }
.badge--success { background: var(--success-soft); color: var(--success); }
.badge--warn { background: var(--warning-soft); color: var(--warning); }
.badge--danger { background: var(--danger-soft); color: var(--danger); }
.badge--running { background: var(--running-soft); color: var(--running); }
.badge--info { background: var(--info-soft); color: var(--info); }
.badge--outline { background: transparent; border: 1px solid var(--border-strong); color: var(--text-2); font-weight: 500; }

/* ─── Key card ─────────────────────────────────────────── */
.key-row { display: flex; gap: 8px; }
.key-row .btn { flex-shrink: 0; }
.key-opts { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.key-info { margin-top: 16px; padding: 14px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--border); }
.key-info__top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.key-info__label { font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.quota__nums { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.quota__big { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.quota__of { color: var(--text-3); font-size: 13px; }
.quota__used { margin-left: auto; color: var(--text-3); font-size: 12.5px; }
.meter { height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; margin-top: 8px; }
.meter__bar { height: 100%; width: 0; border-radius: inherit; background: var(--primary); transition: width 0.5s var(--ease); }
.meter__bar[data-level="low"] { background: var(--warning); }
.meter__bar[data-level="empty"] { background: var(--danger); }
#keyCardNotices { margin-top: 12px; }

/* ─── Submit card ──────────────────────────────────────── */
.tabs { margin-left: auto; }
.tab-panel[hidden] { display: none; }
.format-hint {
  display: flex; flex-direction: column; gap: 4px;
  font-size: 12.5px; color: var(--text-3); margin-top: 2px;
}
.format-hint code { font-size: 12px; }
.batch-toolbar { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.batch-toolbar .btn--primary { margin-left: auto; }
.batch-summary {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-top: 16px; padding: 10px 12px; border-radius: var(--radius-sm);
  background: var(--surface-2); border: 1px solid var(--border); font-size: 13px;
}
.batch-summary__cost { margin-left: auto; font-weight: 600; color: var(--text-2); }
.batch-list {
  margin-top: 8px; max-height: 320px; overflow-y: auto;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.batch-row {
  display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 8px; align-items: center;
  padding: 8px 10px; border-bottom: 1px solid var(--border); font-size: 13px;
}
.batch-row:last-child { border-bottom: 0; }
.batch-row__n { color: var(--text-3); font-family: var(--mono); font-size: 11.5px; }
.batch-row__main { min-width: 0; }
.batch-row__email { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.batch-row__meta { display: flex; flex-wrap: wrap; gap: 4px 8px; margin-top: 2px; font-size: 12px; color: var(--text-3); }
.batch-row__meta .mono { font-size: 11.5px; }
.batch-row--invalid { background: var(--danger-soft); }
.batch-row--invalid .batch-row__reason { color: var(--danger); font-size: 12px; margin-top: 2px; }
.batch-row--warn .batch-row__reason { color: var(--warning); font-size: 12px; margin-top: 2px; }
.batch-result { margin-top: 14px; }
.batch-result ul { margin: 6px 0 0; padding-left: 18px; }
.batch-result li { margin: 2px 0; word-break: break-word; }

/* ─── Task lists ───────────────────────────────────────── */
.list { display: flex; flex-direction: column; }
.empty {
  display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center;
  padding: 36px 20px; color: var(--text-3); font-size: 13.5px;
}
.empty .icon { width: 28px; height: 28px; stroke-width: 1.5; opacity: 0.7; }
.empty__title { color: var(--text-2); font-weight: 600; }
.stat { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-2); }
.stat strong { font-variant-numeric: tabular-nums; color: var(--text); }
.stat .dot { width: 7px; height: 7px; }
.stat--queued .dot { background: var(--warning); }
.stat--running .dot { background: var(--running); }

.task {
  padding: 14px 18px; border-bottom: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 8px; min-width: 0;
}
.task:last-child { border-bottom: 0; }
.task__top { display: flex; align-items: center; gap: 8px; min-width: 0; flex-wrap: wrap; }
.task__cancel { margin-left: auto; color: var(--text-3); }
.task__cancel .icon { width: 13px; height: 13px; }
.task__cancel:not(:disabled):hover { color: var(--danger); background: var(--danger-soft); }
.task__cancel + .task__cancel { margin-left: 0; }
.task__email {
  font-weight: 600; font-size: 13.5px; min-width: 0; flex: 1 1 160px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.task__meta { display: flex; align-items: center; gap: 8px; color: var(--text-3); font-size: 12px; flex-wrap: wrap; }
.task__meta .sep::before { content: '·'; }
.task__time { font-variant-numeric: tabular-nums; }
.progress {
  position: relative; height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden;
}
.progress__bar {
  position: absolute; inset: 0 auto 0 0; width: 0; border-radius: inherit;
  background: var(--running); transition: width 0.6s var(--ease);
}
.progress--queued .progress__bar {
  width: 30% !important; background: color-mix(in srgb, var(--warning) 70%, transparent);
  animation: indeterminate 1.6s ease-in-out infinite;
}
/* 执行中但没有进度百分比（部分上游不返回进度）：不显示 0%，用流动条表示正在处理 */
.progress--busy .progress__bar {
  width: 30% !important;
  animation: indeterminate 1.6s ease-in-out infinite;
}
.task__step { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12.5px; color: var(--text-2); }
.task__step-label { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.task__pct { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--running); }
.spinner {
  width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0;
  border: 2px solid var(--running); border-right-color: transparent; animation: spin 0.8s linear infinite;
}

/* History */
.status-icon {
  width: 22px; height: 22px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.status-icon .icon { width: 13px; height: 13px; stroke-width: 3; }
.status-icon--success { background: var(--success-soft); color: var(--success); }
.status-icon--failed { background: var(--danger-soft); color: var(--danger); }
.result {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 10px 12px; border-radius: var(--radius-sm); font-size: 13px; min-width: 0;
}
.result--success { background: var(--success-soft); }
.result--failed { background: var(--danger-soft); }
.result__icon { flex-shrink: 0; }
.result--success .result__icon { color: var(--success); }
.result--failed .result__icon { color: var(--danger); }
.result__text { flex: 1 1 180px; min-width: 0; word-break: break-word; }
.result__link {
  font-family: var(--mono); font-size: 12.5px; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block;
}
.result__title { font-weight: 600; }
.result--success .result__title { color: var(--success); }
.result--failed .result__title { color: var(--danger); }
.result__hint { font-size: 13px; color: var(--text); margin-top: 4px; line-height: 1.5; word-break: break-word; }
.result__sub { font-size: 12px; color: var(--text-2); margin-top: 2px; word-break: break-word; }
.result__actions { display: flex; gap: 6px; flex-shrink: 0; flex-wrap: wrap; }
.result__actions .btn--secondary { background: var(--surface); }
.remark { display: flex; align-items: flex-start; gap: 6px; font-size: 12.5px; color: var(--text-2); min-width: 0; }
.remark .icon { margin-top: 2px; color: var(--text-3); }
.remark__text { flex: 1; min-width: 0; word-break: break-word; white-space: pre-wrap; }
.remark-edit { display: flex; gap: 6px; flex-wrap: wrap; }
.remark-edit .input { height: 32px; font-size: 13px; flex: 1 1 200px; }
.task__foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: space-between; }

.filter-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 18px; border-bottom: 1px solid var(--border); }
.filter-bar .seg { flex-shrink: 0; }
.filter-bar__right { margin-left: auto; display: flex; gap: 4px; align-items: center; }
.pager { display: flex; align-items: center; gap: 6px; }
.pager__label { font-variant-numeric: tabular-nums; min-width: 48px; text-align: center; }

/* Menu */
.menu { position: relative; }
.menu__list {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; min-width: 220px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); padding: 4px;
}
.menu__item {
  display: flex; flex-direction: column; align-items: flex-start; gap: 1px; width: 100%;
  background: none; border: 0; text-align: left; cursor: pointer;
  padding: 8px 10px; border-radius: 6px; font-size: 13px; font-weight: 500;
}
.menu__item small { color: var(--text-3); font-weight: 400; font-size: 12px; }
.menu__item:hover, .menu__item:focus-visible { background: var(--surface-2); }

/* ─── Footer ───────────────────────────────────────────── */
.footer {
  max-width: 1280px; margin: 0 auto; padding: 8px 20px 32px;
  display: flex; gap: 12px; flex-wrap: wrap; justify-content: space-between;
  color: var(--text-3); font-size: 12.5px;
}
.footer__links { display: flex; gap: 14px; }

/* ─── Toasts ───────────────────────────────────────────── */
.toasts {
  position: fixed; z-index: 80; right: 16px; bottom: 16px;
  display: flex; flex-direction: column; gap: 8px; align-items: flex-end;
  max-width: calc(100vw - 32px); pointer-events: none;
}
.toast {
  pointer-events: auto; display: flex; gap: 10px; align-items: flex-start;
  min-width: 220px; max-width: 380px; padding: 11px 14px;
  background: var(--surface); color: var(--text); border: 1px solid var(--border);
  border-left: 3px solid var(--text-3); border-radius: var(--radius); box-shadow: var(--shadow-lg);
  font-size: 13.5px; animation: toast-in 0.25s var(--ease);
  word-break: break-word;
}
.toast .icon { margin-top: 2px; }
.toast--success { border-left-color: var(--success); }
.toast--success .icon { color: var(--success); }
.toast--error { border-left-color: var(--danger); }
.toast--error .icon { color: var(--danger); }
.toast--info .icon { color: var(--info); }
.toast--info { border-left-color: var(--info); }
.toast.is-out { opacity: 0; transform: translateY(6px); transition: opacity 0.25s, transform 0.25s; }

/* ─── Dialogs: drawer + modal ──────────────────────────── */
.overlay {
  position: fixed; inset: 0; z-index: 60; visibility: hidden;
  transition: visibility 0s linear 0.25s;
}
.overlay.is-open { visibility: visible; transition-delay: 0s; }
.overlay__backdrop {
  position: absolute; inset: 0; background: var(--backdrop);
  opacity: 0; transition: opacity 0.25s;
}
.overlay.is-open .overlay__backdrop { opacity: 1; }

.drawer__panel {
  position: absolute; top: 0; right: 0; bottom: 0;
  width: min(720px, 100%); background: var(--surface); box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column;
  transform: translateX(100%); transition: transform 0.3s var(--ease);
  border-left: 1px solid var(--border);
}
.overlay.is-open .drawer__panel { transform: none; }
.drawer__head {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 18px 20px 14px; border-bottom: 1px solid var(--border);
}
.drawer__titles { flex: 1; min-width: 0; }
.drawer__eyebrow { font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--primary-text); }
.drawer__title { font-size: 18px; margin-top: 2px; }
.drawer__sub { font-size: 13px; color: var(--text-3); margin-top: 2px; }
.drawer__tools { display: flex; gap: 4px; }
.drawer__tabs { padding: 10px 20px 0; }
.drawer__body { flex: 1; overflow-y: auto; padding: 18px 20px 40px; overscroll-behavior: contain; }

.modal__panel {
  position: absolute; left: 50%; top: 50%;
  width: min(440px, calc(100% - 32px)); max-height: calc(100% - 32px); overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); padding: 28px 24px 22px; text-align: center;
  transform: translate(-50%, -46%) scale(0.98); opacity: 0;
  transition: transform 0.25s var(--ease), opacity 0.2s;
}
.overlay.is-open .modal__panel { transform: translate(-50%, -50%); opacity: 1; }
.modal__close { position: absolute; top: 10px; right: 10px; }
.modal__icon {
  width: 56px; height: 56px; border-radius: 50%; margin: 0 auto 14px;
  display: flex; align-items: center; justify-content: center;
}
.modal__icon .icon { width: 28px; height: 28px; stroke-width: 2.2; }
.modal__icon--success { background: var(--success-soft); color: var(--success); }
.modal__icon--warn { background: var(--warning-soft); color: var(--warning); }
.modal__title { font-size: 18px; }
.modal__desc { color: var(--text-2); margin-top: 8px; font-size: 14px; }
.modal__email { font-weight: 600; color: var(--text); word-break: break-all; }
.modal__link {
  margin-top: 14px; padding: 10px 12px; border-radius: var(--radius-sm);
  background: var(--surface-2); border: 1px solid var(--border);
  font-family: var(--mono); font-size: 12.5px; word-break: break-all; text-align: left;
  max-height: 96px; overflow-y: auto;
}
.modal__more { margin-top: 10px; font-size: 12.5px; color: var(--text-3); }
.modal__actions { display: flex; gap: 8px; margin-top: 20px; justify-content: center; flex-wrap: wrap; }
.modal__actions .btn { flex: 1 1 140px; }
.modal__opt { margin-top: 14px; justify-content: center; }
.confetti { position: absolute; inset: 0; overflow: hidden; pointer-events: none; border-radius: inherit; }
.confetti i {
  position: absolute; top: -10px; width: 7px; height: 10px; border-radius: 2px; opacity: 0.9;
  animation: confetti-fall 1.8s ease-in forwards;
}

/* ─── Animations ───────────────────────────────────────── */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes indeterminate { 0% { transform: translateX(-100%); } 100% { transform: translateX(340%); } }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes confetti-fall {
  0% { transform: translateY(0) rotate(0deg); opacity: 1; }
  100% { transform: translateY(420px) rotate(540deg); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
  .confetti { display: none; }
}

/* ─── Responsive ───────────────────────────────────────── */
@media (max-width: 760px) {
  .topbar__inner { padding: 8px 16px; gap: 8px; flex-wrap: wrap; }
  .topbar__status { order: 3; width: 100%; margin-left: 0; }
  .topbar__actions { gap: 2px; }
  .topbar__actions .btn--sm { padding: 0 8px; }
  .brand { gap: 8px; }
  .brand__logo { width: 28px; height: 28px; }
  .brand__name { overflow: hidden; text-overflow: ellipsis; }
  .nav-text { display: none; }
  .banners { padding: 0 16px; }
  .layout { padding: 16px; gap: 16px; }
  .col { gap: 16px; }
  .card__head { padding: 14px 16px; }
  .card__body { padding: 16px; }
  .task { padding: 12px 16px; }
  .filter-bar { padding: 10px 16px; }
  .card__foot { padding: 10px 16px; }
  .drawer__head { padding: 14px 16px 12px; }
  .drawer__tabs { padding: 10px 16px 0; }
  .drawer__body { padding: 16px 16px 40px; }
  .toasts { left: 16px; right: 16px; align-items: stretch; }
  .toast { max-width: none; }
}
@media (max-width: 420px) {
  .brand__name { font-size: 14px; }
  .key-row { flex-direction: column; }
  .key-row .btn { width: 100%; }
  .tabs { margin-left: 0; width: 100%; display: flex; }
  .tabs .seg__btn { flex: 1; }
  .batch-toolbar .btn--primary { margin-left: 0; width: 100%; }
  .filter-bar__right { margin-left: 0; }
  .card__tools { margin-left: 0; }
}
