/* ==========================================================================
   export.css — 资料导出看板（自包含：自有 reset / tokens）
   视觉语言延续 accounts.css / check_pc.css：浅色主题 · 中性灰 + 单一强调色
   #2563eb · 8px 间距刻度 · 6/8/12/16 圆角。
   ========================================================================== */

:root {
  /* 色彩 */
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --surface-muted: #f1f5f9;
  --border: #e2e8f0;
  --border-strong: #d5dde8;
  --text: #1e293b;
  --text-soft: #475569;
  --muted: #64748b;
  --muted-2: #94a3b8;

  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-soft: #eff6ff;
  --accent-ring: rgba(37, 99, 235, 0.18);

  --success: #15803d;
  --success-soft: #ecfdf3;
  --success-border: #bbf7d0;

  --warn: #b45309;
  --warn-soft: #fffbeb;
  --warn-border: #fde68a;

  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --danger-border: #fecaca;

  /* 间距（8px 刻度） */
  --sp-1: 8px;
  --sp-2: 16px;
  --sp-3: 24px;
  --sp-4: 32px;
  --sp-5: 40px;

  /* 圆角 / 阴影 */
  --radius-sm: 6px;
  --radius: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 10px 30px rgba(15, 23, 42, 0.09);

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

/* ── reset ───────────────────────────────────────────────────────────────── */
* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background:
    radial-gradient(1100px 420px at 50% -200px, #e9effb 0%, rgba(233, 239, 251, 0) 72%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, p {
  margin: 0;
}

button, input, select, textarea {
  font: inherit;
  color: inherit;
}

[hidden] {
  display: none !important;
}

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

.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;
}

.icon {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
}

.icon--lg {
  width: 26px;
  height: 26px;
}

/* ── 页面骨架 ────────────────────────────────────────────────────────────── */
.page {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: var(--sp-4);
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--sp-2);
  padding-bottom: var(--sp-3);
}

.page-title {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 0.4px;
  line-height: 1.2;
}

.page-sub {
  margin-top: var(--sp-1);
  font-size: 13px;
  color: var(--muted);
}

.page-head__meta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  font-size: 12.5px;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  box-shadow: var(--shadow-sm);
  white-space: nowrap;
}

.whoami-label {
  color: var(--muted-2);
}

.whoami-name {
  font-weight: 600;
  color: var(--text-soft);
}

.whoami-user {
  color: var(--accent);
  font-family: var(--mono);
  font-size: 12px;
}

/* ── 双栏看板 ───────────────────────────────────────────────────────────── */
.board {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(330px, 1fr);
  align-items: start;
  gap: var(--sp-2);
}

.card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.summary-card {
  position: sticky;
  top: var(--sp-3);
}

.card-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 20px var(--sp-3) 0;
}

.step {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  margin-top: 1px;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid #dbe7fd;
  border-radius: 9px;
}

.card-head__text {
  min-width: 0;
}

.card-title {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.2px;
  line-height: 1.3;
}

.card-hint {
  margin-top: 3px;
  font-size: 12.5px;
  color: var(--muted);
}

.card-body {
  padding: var(--sp-3);
}

.card-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--sp-1);
  padding: 14px var(--sp-3);
  background: var(--surface-soft);
  border-top: 1px solid var(--border);
}

.card-foot--stack {
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
}

/* ── 范围选择（分段卡片） ────────────────────────────────────────────────── */
.scope {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: var(--sp-3);
}

.scope-opt {
  position: relative;
  display: block;
  min-width: 0;
  cursor: pointer;
  user-select: none;
}

.scope-opt__input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  opacity: 0;
  pointer-events: none;
}

.scope-opt__box {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 62px;
  padding: 11px 13px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  transition: border-color 0.15s ease, background-color 0.15s ease,
    box-shadow 0.15s ease, color 0.15s ease;
}

.scope-opt__box .icon {
  width: 20px;
  height: 20px;
  color: var(--muted);
  transition: color 0.15s ease;
}

.scope-opt:hover .scope-opt__box {
  border-color: #bcc9da;
  background: #fbfcfe;
}

.scope-opt__text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.scope-opt__text strong {
  font-size: 13.5px;
  font-weight: 650;
  color: var(--text);
  line-height: 1.35;
}

.scope-opt__text small {
  margin-top: 2px;
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.scope-opt__input:checked + .scope-opt__box {
  background: var(--accent-soft);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

.scope-opt__input:checked + .scope-opt__box .icon,
.scope-opt__input:checked + .scope-opt__box strong {
  color: var(--accent);
}

.scope-opt__input:focus-visible + .scope-opt__box {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ── 筛选字段 ───────────────────────────────────────────────────────────── */
.fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px var(--sp-2);
}

.field {
  min-width: 0;
}

.field--wide {
  grid-column: 1 / -1;
}

.field__label {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.2px;
  color: var(--muted);
}

.input,
.select {
  width: 100%;
  height: 38px;
  padding: 0 12px;
  font-size: 13.5px;
  color: var(--text);
  background: #fbfcfe;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease,
    background-color 0.15s ease, opacity 0.15s ease;
}

.input::placeholder {
  color: var(--muted-2);
}

.input:hover:not(:disabled),
.select:hover:not(:disabled) {
  border-color: #bcc9da;
}

.input:focus,
.select:focus {
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

.input:disabled,
.select:disabled {
  color: var(--muted-2);
  background: var(--surface-muted);
  border-color: var(--border);
  cursor: not-allowed;
}

.input:disabled::placeholder {
  color: #b8c2d0;
}

.select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 32px;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

.select:disabled {
  background-image: none;
}

.date-range {
  display: flex;
  align-items: center;
  gap: 10px;
}

.input--date {
  flex: 1 1 0;
  min-width: 0;
  padding-right: 8px;
}

.date-sep {
  font-size: 12.5px;
  color: var(--muted-2);
}

/* ── 范围提示 / 指定记录 ────────────────────────────────────────────────── */
.filter-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: var(--sp-2);
  padding: 10px 12px;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--muted);
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.filter-note__dot {
  width: 6px;
  height: 6px;
  flex: 0 0 auto;
  margin-top: 6px;
  background: var(--accent);
  border-radius: 50%;
}

.scope-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  margin-top: 10px;
  padding: 0 10px;
  font-size: 12px;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid #bfdbfe;
  border-radius: 999px;
  white-space: nowrap;
}

.scope-chip__label {
  color: var(--muted);
}

.scope-chip__value {
  font-family: var(--mono);
  font-weight: 600;
}

/* ── 按钮 ───────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  color: var(--text-soft);
  background: var(--surface);
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  user-select: none;
  transition: background-color 0.15s ease, border-color 0.15s ease,
    color 0.15s ease, box-shadow 0.15s ease, transform 0.06s ease;
}

.btn:active:not(:disabled) {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn--primary {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

.btn--primary:hover:not(:disabled) {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.btn--ghost {
  color: var(--text-soft);
  background: var(--surface);
  border-color: var(--border-strong);
}

.btn--ghost:hover:not(:disabled) {
  background: var(--surface-soft);
  border-color: #bcc9da;
}

.btn--export {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.18);
}

.btn--export:hover:not(:disabled) {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.24);
}

.btn--lg {
  width: 100%;
  height: 46px;
  font-size: 14.5px;
  border-radius: var(--radius-lg);
}

.btn__icon {
  width: 17px;
  height: 17px;
}

.spinner {
  display: none;
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.btn.is-busy .spinner {
  display: inline-block;
}

.btn.is-busy .btn__icon {
  display: none;
}

.btn.is-busy {
  cursor: progress;
  opacity: 1;
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

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

/* ── 预览结果 ───────────────────────────────────────────────────────────── */
.summary-body {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  min-height: 218px;
}

.summary-empty {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: var(--sp-4) var(--sp-2);
  text-align: center;
  background: var(--surface-soft);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
}

.summary-empty__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  margin-bottom: 4px;
  color: var(--muted-2);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 50%;
}

.summary-empty__icon .icon {
  width: 24px;
  height: 24px;
}

.summary-empty__title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-soft);
}

.summary-empty__hint {
  max-width: 260px;
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--muted);
}

.summary-empty__cap {
  margin-top: 6px;
  font-size: 11.5px;
  color: var(--muted-2);
  font-variant-numeric: tabular-nums;
}

.summary-empty.is-stale .summary-empty__title {
  color: var(--warn);
}

.summary-empty.is-nodata .summary-empty__title {
  color: var(--text-soft);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  padding: 13px 14px;
  background: var(--surface-soft);
}

.stat--cap {
  grid-column: 1 / -1;
  background: var(--surface);
}

.stat__label {
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.3px;
  color: var(--muted);
}

.stat__value {
  font-size: 25px;
  font-weight: 700;
  line-height: 1.15;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stat__value--sm {
  font-size: 16px;
  line-height: 1.4;
}

.stat__value.is-warn {
  color: var(--warn);
}

.stat__sub {
  font-size: 11.5px;
  color: var(--muted-2);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── 警示 / 空结果 ──────────────────────────────────────────────────────── */
.warn {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.45;
  color: var(--warn);
  background: var(--warn-soft);
  border: 1px solid var(--warn-border);
  border-radius: var(--radius);
}

.warn .icon {
  width: 15px;
  height: 15px;
  margin-top: 1px;
}

.empty-note {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  background: var(--surface-soft);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
}

.empty-note .icon {
  width: 16px;
  height: 16px;
  color: var(--muted-2);
}

.summary-meta {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  font-size: 11.5px;
  line-height: 1.55;
  color: var(--muted-2);
}

.summary-meta .icon {
  width: 13px;
  height: 13px;
  margin-top: 1px;
}

.export-hint {
  font-size: 11.5px;
  line-height: 1.45;
  color: var(--muted);
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.export-hint.is-warn {
  color: var(--warn);
  font-weight: 600;
}

.export-hint.is-progress {
  color: var(--accent);
  font-weight: 600;
}

/* ── 页脚 ───────────────────────────────────────────────────────────────── */
.page-foot {
  margin-top: var(--sp-2);
  padding-top: var(--sp-2);
  font-size: 11.5px;
  color: var(--muted-2);
  text-align: center;
  border-top: 1px solid rgba(226, 232, 240, 0.8);
}

/* ── Toast ──────────────────────────────────────────────────────────────── */
.toast-wrap {
  position: fixed;
  right: var(--sp-3);
  bottom: var(--sp-3);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--sp-1);
  pointer-events: none;
}

.toast {
  max-width: 360px;
  padding: 11px 14px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.toast.is-in {
  opacity: 1;
  transform: translateY(0);
}

.toast--error {
  border-left-color: var(--danger);
}

.toast--success {
  border-left-color: var(--success);
}

/* ── 响应式 ─────────────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .board {
    grid-template-columns: minmax(0, 1fr);
  }

  .summary-card {
    position: static;
  }
}

@media (max-width: 900px) {
  .page {
    padding: var(--sp-2);
  }

  .page-head {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--sp-1);
    padding-bottom: var(--sp-2);
  }

  .page-title {
    font-size: 21px;
  }
}

@media (max-width: 640px) {
  .scope {
    grid-template-columns: minmax(0, 1fr);
  }

  .scope-opt__box {
    min-height: 54px;
  }

  .fields {
    grid-template-columns: minmax(0, 1fr);
  }

  .stat__value {
    font-size: 22px;
  }

  .toast-wrap {
    right: var(--sp-2);
    bottom: var(--sp-2);
    left: var(--sp-2);
    align-items: stretch;
  }

  .toast {
    max-width: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
