/* ==========================================================================
   check_pc.css — PC 检测记录看板（自包含：自有 reset / tokens）
   视觉语言延续 accounts.css：浅色主题 · 中性灰 + 单一强调色 #2563eb · 8px 间距
   ========================================================================== */

: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-hover: #b91c1c;
  --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);
  --shadow-lg: 0 24px 60px rgba(15, 23, 42, 0.22);

  --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: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

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

table {
  border-collapse: collapse;
  width: 100%;
}

[hidden] {
  display: none !important;
}

body.has-modal {
  overflow: hidden;
}

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

/* ── 页面骨架 ────────────────────────────────────────────────────────────── */
.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;
}

/* ── 工具条 ─────────────────────────────────────────────────────────────── */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
  padding: var(--sp-2);
  margin-bottom: var(--sp-2);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.toolbar__filters {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--sp-1);
  min-width: 0;
}

.toolbar__actions {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
  margin-left: auto;
}

.filter {
  min-width: 0;
}

.filter--select .select {
  min-width: 116px;
}

.date-range {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
}

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

.input,
.select {
  height: 36px;
  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;
}

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

.input:hover,
.select:hover {
  border-color: #bcc9da;
}

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

.input[type="search"] {
  width: 236px;
}

.input--date {
  width: 142px;
  padding-right: 8px;
}

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

/* 客户编号筛选胶囊（来自 URL / 门户跳转） */
.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 4px 0 10px;
  font-size: 12.5px;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid #bfdbfe;
  border-radius: 999px;
  white-space: nowrap;
}

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

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

.filter-chip__clear {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  font-size: 15px;
  line-height: 1;
  color: var(--accent);
  background: transparent;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
}

.filter-chip__clear:hover {
  color: var(--accent-hover);
  background: rgba(37, 99, 235, 0.12);
}

/* ── 按钮 ───────────────────────────────────────────────────────────────── */
.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--danger {
  color: #fff;
  background: var(--danger);
  border-color: var(--danger);
}

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

.btn--sm {
  height: 30px;
  padding: 0 10px;
  font-size: 12.5px;
}

.btn--export {
  color: var(--accent);
  border-color: #bfdbfe;
  background: var(--accent-soft);
}

.btn--export:hover:not(:disabled) {
  background: #dbeafe;
  border-color: #93c5fd;
}

/* ── 表格 ───────────────────────────────────────────────────────────────── */
.table-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.table-scroll {
  width: 100%;
  max-height: 62vh;
  overflow: auto;
}

.data-table {
  min-width: 940px;
  font-size: 13.5px;
}

.data-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 11px 16px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.3px;
  color: var(--muted);
  text-align: left;
  white-space: nowrap;
  background: var(--surface-soft);
  border-bottom: 1px solid var(--border);
  box-shadow: inset 0 -1px 0 var(--border);
}

.data-table tbody td {
  padding: 12px 16px;
  color: var(--text-soft);
  vertical-align: middle;
  border-top: 1px solid #eef2f7;
}

.data-table tbody tr:first-child td {
  border-top: 0;
}

.data-table tbody tr:hover td {
  background: #f9fbfe;
}

.cell-user {
  font-weight: 600;
  color: var(--text);
  font-family: var(--mono);
  font-size: 12.5px;
  white-space: nowrap;
}

.cell-mono {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--text-soft);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

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

.cell-time {
  color: var(--muted);
  font-size: 12.5px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.tag {
  display: inline-block;
  padding: 1px 7px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-soft);
  background: var(--surface-muted);
  border-radius: var(--radius-sm);
  white-space: nowrap;
}

.tag--video {
  color: var(--accent);
  background: var(--accent-soft);
}

.tag--image {
  color: var(--success);
  background: var(--success-soft);
}

.tag--disabled {
  color: var(--muted);
  background: var(--surface-muted);
}

/* 状态胶囊 */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 22px;
  padding: 0 9px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  border: 1px solid transparent;
  border-radius: 999px;
  white-space: nowrap;
}

.pill__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.pill--done {
  color: var(--success);
  background: var(--success-soft);
  border-color: var(--success-border);
}

.pill--todo {
  color: var(--warn);
  background: var(--warn-soft);
  border-color: var(--warn-border);
}

/* 完成度 */
.col-progress {
  width: 190px;
}

.progress-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.progress {
  position: relative;
  width: 104px;
  height: 6px;
  overflow: hidden;
  background: #eaeff5;
  border-radius: 999px;
}

.progress__fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 0;
  background: var(--accent);
  border-radius: inherit;
  transition: width 0.2s ease;
}

.progress__fill.is-complete {
  background: var(--success);
}

.progress-text {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-soft);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.progress-text.is-complete {
  color: var(--success);
}

/* 行内操作 */
.col-actions {
  width: 160px;
}

.row-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 2px;
}

.link-btn {
  padding: 4px 8px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--accent);
  background: transparent;
  border: 0;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.link-btn:hover:not(:disabled) {
  background: var(--accent-soft);
}

.link-btn--danger {
  color: var(--danger);
}

.link-btn--danger:hover:not(:disabled) {
  background: var(--danger-soft);
}

.link-btn:disabled {
  color: var(--muted-2);
  background: transparent;
  cursor: not-allowed;
}

/* 空 / 错误状态 */
.state {
  padding: var(--sp-5) var(--sp-2);
  text-align: center;
  font-size: 13px;
  color: var(--muted);
}

.state--error {
  color: var(--danger);
}

/* 分页 */
.pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--sp-2);
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: var(--surface-soft);
}

.pager__info {
  font-size: 12.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ── 弹窗（native dialog） ──────────────────────────────────────────────── */
.modal {
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100vh - 64px);
  padding: 0;
  color: var(--text);
  background: var(--surface);
  border: 0;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.modal--sm {
  width: min(440px, calc(100vw - 32px));
}

.modal--wide {
  width: min(880px, calc(100vw - 32px));
}

.modal--media {
  width: min(920px, calc(100vw - 32px));
}

.modal::backdrop {
  background: rgba(15, 23, 42, 0.46);
  backdrop-filter: blur(1px);
}

.modal[open] {
  animation: modal-in 0.16s ease-out;
}

@keyframes modal-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.99);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal__form {
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 64px);
}

.modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
}

.modal__title {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.modal__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  font-size: 20px;
  line-height: 1;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.modal__close:hover {
  color: var(--text);
  background: var(--surface-muted);
}

.modal__body {
  padding: var(--sp-3);
  overflow-y: auto;
}

.modal__body--media {
  background: #0f172a;
  padding: var(--sp-2);
}

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

.modal__hint {
  margin-right: auto;
  font-size: 12px;
  color: var(--muted-2);
}

.confirm-text {
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-soft);
}

.confirm-text strong {
  color: var(--text);
  font-family: var(--mono);
}

/* ── 详情弹窗 ───────────────────────────────────────────────────────────── */
.detail-summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 1px;
  margin-bottom: var(--sp-3);
  overflow: hidden;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.detail-item {
  min-width: 0;
  padding: 12px 14px;
  background: var(--surface-soft);
}

.detail-item__label {
  display: block;
  margin-bottom: 4px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.2px;
  color: var(--muted);
}

.detail-item__value {
  display: block;
  min-height: 22px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.detail-item__value.is-mono {
  font-family: var(--mono);
  font-size: 12.5px;
}

.detail-item__value.is-muted {
  font-weight: 500;
  color: var(--muted-2);
}

.detail-progress {
  display: flex;
  align-items: center;
  gap: 8px;
}

.detail-progress .progress {
  width: 70px;
}

.sub-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--sp-2);
  margin-bottom: var(--sp-1);
}

.sub-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.sub-count {
  font-size: 12.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.sub-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sub-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--sp-2);
  padding: 10px 14px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-left: 3px solid var(--border-strong);
  border-radius: var(--radius);
}

.sub-item.is-done {
  background: linear-gradient(180deg, #f4fcf7, #ecfdf3);
  border-color: var(--success-border);
  border-left-color: var(--success);
}

.sub-item.is-todo {
  background: var(--surface-soft);
  border-color: var(--border);
  border-left-color: var(--border-strong);
}

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

.sub-item__name {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sub-item__meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 12px;
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.sub-item__meta .dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--muted-2);
}

.sub-item__empty {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted-2);
}

.sub-item__actions {
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.sub-item__actions .link-btn {
  border: 1px solid transparent;
}

.sub-item.is-done .sub-item__actions .link-btn:not(.link-btn--danger) {
  color: var(--success);
}

.sub-item.is-done .sub-item__actions .link-btn:not(.link-btn--danger):hover {
  background: rgba(21, 128, 61, 0.1);
}

/* ── 媒体弹窗 ───────────────────────────────────────────────────────────── */
.media-video {
  display: block;
  width: 100%;
  max-height: calc(100vh - 250px);
  min-height: 220px;
  background: #000;
  border-radius: var(--radius);
  outline: none;
}

.media-image-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 220px;
  max-height: calc(100vh - 250px);
  padding: 8px;
  overflow: auto;
  background: #0b1220;
  border-radius: var(--radius);
}

.media-image {
  display: block;
  max-width: 100%;
  max-height: calc(100vh - 266px);
  object-fit: contain;
  background: #fff;
  border-radius: var(--radius-sm);
}

.media-meta {
  margin-top: 10px;
  font-size: 12.5px;
  color: #cbd5e1;
  font-variant-numeric: tabular-nums;
}

/* ── 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);
}

/* ── 响应式：900px 以下堆叠 ─────────────────────────────────────────────── */
@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;
  }

  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .toolbar__filters {
    gap: var(--sp-1);
  }

  .toolbar__actions {
    margin-left: 0;
    justify-content: flex-end;
  }

  .filter,
  .filter .input[type="search"],
  .filter .select {
    flex: 1 1 160px;
  }

  .input[type="search"] {
    width: 100%;
  }

  .date-range {
    flex: 1 1 auto;
  }

  .input--date {
    flex: 1 1 120px;
    width: auto;
  }

  .detail-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .data-table {
    min-width: 820px;
  }

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

  .toast {
    max-width: none;
  }
}

@media (max-width: 480px) {
  .pager {
    justify-content: space-between;
  }

  .pager__info {
    font-size: 12px;
  }

  .modal {
    width: calc(100vw - 16px);
    max-height: calc(100vh - 24px);
  }

  .modal__head,
  .modal__body,
  .modal__foot {
    padding-left: var(--sp-2);
    padding-right: var(--sp-2);
  }

  .detail-summary {
    grid-template-columns: 1fr;
  }

  .sub-item {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .sub-item__actions {
    justify-content: flex-end;
  }
}

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