* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: #f5f6f8;
  color: #1f2328;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ---------- 顶栏 ---------- */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand { font-weight: 700; font-size: 16px; }
.user-info { display: flex; gap: 12px; align-items: center; font-size: 13px; }
.rep {
  background: #eef2ff;
  color: #4338ca;
  padding: 4px 10px;
  border-radius: 999px;
  font-weight: 600;
}
.uid { color: #9ca3af; font-family: ui-monospace, monospace; }

/* ---------- 主区 ---------- */
main {
  max-width: 720px;
  margin: 20px auto;
  padding: 0 16px 60px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 20px;
}

.card h2 {
  margin: 0 0 12px;
  font-size: 16px;
  font-weight: 700;
}

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.card-head h2 { margin: 0; }

.hint { color: #6b7280; font-size: 13px; margin: 0 0 12px; }
.empty { color: #9ca3af; font-size: 14px; text-align: center; padding: 16px 0; }
.loading { color: #9ca3af; text-align: center; padding: 32px 0; font-size: 14px; }

/* ---------- 表单 ---------- */
form { display: flex; flex-direction: column; gap: 10px; }

input[type="url"],
input[type="text"],
select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
  outline: none;
  transition: border-color .15s;
}
input:focus, select:focus { border-color: #6366f1; }

/* ---------- 按钮 ---------- */
button, .btn {
  display: inline-block;
  padding: 10px 16px;
  border: none;
  border-radius: 8px;
  background: #6366f1;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  transition: background .15s, opacity .15s;
}
button:hover, .btn:hover { background: #4f46e5; }
button:disabled { opacity: .55; cursor: not-allowed; }

.btn-primary { background: #10b981; }
.btn-primary:hover { background: #059669; }

.btn-ghost {
  background: transparent;
  color: #6366f1;
  border: 1px solid #c7d2fe;
  padding: 6px 12px;
  font-size: 13px;
}
.btn-ghost:hover { background: #eef2ff; }

.btn-copy {
  background: #f3f4f6;
  color: #374151;
  border: 1px solid #e5e7eb;
  padding: 8px 12px;
  font-size: 13px;
  flex-shrink: 0;
}
.btn-copy:hover { background: #e5e7eb; }

/* ---------- 任务列表 ---------- */
.task-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid #f3f4f6;
}
.task-item:last-child { border-bottom: none; }

.task-main { flex: 1; min-width: 0; }

.task-url {
  font-size: 13px;
  color: #374151;
  word-break: break-all;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.task-meta {
  display: flex;
  gap: 8px;
  margin-top: 6px;
  font-size: 12px;
  color: #9ca3af;
  align-items: center;
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  background: #f3f4f6;
  color: #4b5563;
  font-size: 12px;
}
.badge-waiting { background: #dbeafe; color: #1d4ed8; }
.badge-done { background: #d1fae5; color: #047857; }
.badge-expired { background: #fee2e2; color: #b91c1c; }

.task-actions { display: flex; gap: 8px; flex-shrink: 0; }

/* ---------- 任务详情 ---------- */
.task-view { display: flex; flex-direction: column; gap: 14px; }

.task-header { display: flex; gap: 8px; flex-wrap: wrap; }

.target-box {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 14px;
  word-break: break-all;
  font-size: 13px;
}
.target-box a { color: #4f46e5; text-decoration: none; }
.target-box a:hover { text-decoration: underline; }

.steps {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: #fffbeb;
  border-left: 3px solid #f59e0b;
  padding: 12px 14px;
  border-radius: 6px;
  font-size: 13px;
  color: #78350f;
}

/* ---------- 复制行 ---------- */
.copy-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}
.copy-row input { flex: 1; font-size: 13px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 32px;
  transform: translate(-50%, 20px);
  background: #1f2937;
  color: #fff;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
  z-index: 100;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: #dc2626; }
.toast.success { background: #059669; }

/* ---------- 错误框 ---------- */
.error-box {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
  padding: 16px;
  border-radius: 8px;
  font-size: 14px;
}

@media (max-width: 480px) {
  .task-item { flex-direction: column; align-items: stretch; }
  .task-actions { justify-content: flex-end; }
}
