/* ═══ 软著材料自动生成系统 · 前端样式 ═══ */
* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --brand: #4f46e5;
  --brand-dark: #4338ca;
  --brand-grad: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  --bg: #f3f4f8;
  --card: #ffffff;
  --text: #1f2330;
  --muted: #6b7280;
  --border: #e5e7eb;
  --danger: #dc2626;
  --ok: #16a34a;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(16,24,40,.08), 0 4px 16px rgba(16,24,40,.06);
}
body {
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", system-ui, sans-serif;
  background: var(--bg); color: var(--text); font-size: 14px;
}
.hidden { display: none !important; }
.mono { font-family: Consolas, "Courier New", monospace; }

/* ── 按钮 ── */
.btn {
  border: none; border-radius: 8px; padding: 9px 18px; font-size: 14px;
  cursor: pointer; transition: all .15s; font-family: inherit;
}
.btn-primary { background: var(--brand-grad); color: #fff; }
.btn-primary:hover { filter: brightness(1.08); }
.btn-primary:disabled { opacity: .55; cursor: not-allowed; }
.btn-ghost { background: transparent; color: inherit; border: 1px solid var(--border); }
.btn-ghost:hover { background: rgba(0,0,0,.05); }
.btn-sm { padding: 5px 10px; font-size: 12.5px; border-radius: 6px; }
.btn-block { width: 100%; }
.btn-danger { background: #fee2e2; color: var(--danger); }
.btn-danger:hover { background: #fecaca; }
.btn-link { background: none; color: var(--brand); padding: 4px 8px; }
.btn-link:hover { text-decoration: underline; }

/* ── 表单 ── */
.field { margin-bottom: 14px; flex: 1; }
.field label { display: block; margin-bottom: 6px; color: var(--muted); font-size: 13px; }
.field label em { color: var(--danger); font-style: normal; }
.field input, .field textarea, .field select {
  width: 100%; padding: 9px 12px; border: 1px solid var(--border);
  border-radius: 8px; font-size: 14px; font-family: inherit; background: #fff;
  outline: none; transition: border .15s;
}
.field input:focus, .field textarea:focus { border-color: var(--brand); }
.field-row { display: flex; gap: 16px; }
.error-msg { color: var(--danger); font-size: 13px; min-height: 18px; margin-bottom: 8px; }
.hint { color: var(--muted); font-size: 13px; margin: 6px 0 18px; }

/* ── 登录页 ── */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: var(--brand-grad);
}
.login-card {
  background: var(--card); border-radius: 16px; padding: 40px 36px;
  width: 380px; box-shadow: 0 20px 60px rgba(0,0,0,.25); text-align: center;
}
.login-logo { font-size: 42px; margin-bottom: 8px; }
.login-card h1 { font-size: 19px; margin-bottom: 4px; }
.login-sub { color: var(--muted); font-size: 13px; margin-bottom: 24px; }
.login-card .field { text-align: left; }

/* ── 顶栏 ── */
.topbar {
  display: flex; align-items: center; gap: 28px;
  background: var(--brand-grad); color: #fff; padding: 0 24px; height: 56px;
  position: sticky; top: 0; z-index: 10; box-shadow: var(--shadow);
}
.topbar-title { font-weight: 700; font-size: 15.5px; white-space: nowrap; }
.topbar-tabs { display: flex; gap: 4px; flex: 1; }
.tab {
  background: transparent; border: none; color: rgba(255,255,255,.75);
  padding: 8px 16px; border-radius: 8px; cursor: pointer; font-size: 14px;
}
.tab:hover { background: rgba(255,255,255,.12); color: #fff; }
.tab.active { background: rgba(255,255,255,.2); color: #fff; font-weight: 600; }
.topbar-user { display: flex; align-items: center; gap: 8px; color: #fff; }
.topbar-user .btn-ghost { color: #fff; border-color: rgba(255,255,255,.35); }
.topbar-user .btn-ghost:hover { background: rgba(255,255,255,.15); }

/* ── 内容区 ── */
.content { max-width: 1080px; margin: 24px auto; padding: 0 20px; }
.card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 24px 26px; margin-bottom: 20px;
}
.card h2 { font-size: 16.5px; margin-bottom: 12px; }
.card h3 { font-size: 14.5px; margin: 18px 0 8px; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.card-head h2 { margin: 0; }
.auto-refresh { color: var(--muted); font-size: 12px; }
.card-head-right { display: flex; align-items: center; gap: 12px; }

/* ── 批量下载（v40） ── */
.col-check { width: 34px; text-align: center; }
.col-check input { cursor: pointer; accent-color: var(--primary, #4a6cf7); }
.col-check input:disabled { cursor: not-allowed; opacity: .35; }
.dl-flag {
  display: inline-block; color: #27ae60; font-size: 12px;
  white-space: nowrap; cursor: default;
}
.form-card { max-width: 640px; }
.adv { margin-bottom: 14px; }
.adv summary { cursor: pointer; color: var(--muted); font-size: 13px; margin-bottom: 10px; }

/* ── 任务表格 ── */
.task-table { width: 100%; border-collapse: collapse; }
.task-table th {
  text-align: left; color: var(--muted); font-weight: 500; font-size: 12.5px;
  padding: 8px 10px; border-bottom: 1px solid var(--border);
}
.task-table td { padding: 10px; border-bottom: 1px solid #f1f2f5; vertical-align: middle; }
.task-table tr:hover td { background: #fafbfe; }
.empty { text-align: center; color: var(--muted); padding: 36px 0; }

/* ── 状态徽章 ── */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 999px; font-size: 12.5px; white-space: nowrap;
}
.badge-queued { background: #f1f2f5; color: #555; }
.badge-running { background: #dbeafe; color: #1d4ed8; }
.badge-running .dot {
  width: 7px; height: 7px; border-radius: 50%; background: #1d4ed8;
  animation: pulse 1.2s infinite;
}
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .25; } }
.badge-success { background: #dcfce7; color: var(--ok); }
.progress-text { color: #1d4ed8; font-size: 12px; margin-top: 4px; }
.progress-text .pct { color: var(--muted); }
.badge-failed { background: #fee2e2; color: var(--danger); }
.badge-canceled { background: #ffedd5; color: #c2410c; }
.badge-interrupted { background: #fef9c3; color: #a16207; }

/* ── 任务详情 ── */
.detail-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px 20px; margin: 14px 0;
}
.detail-grid label { color: var(--muted); font-size: 12px; display: block; margin-bottom: 3px; }
.detail-actions { margin: 10px 0 4px; display: flex; gap: 10px; }
.log-box {
  background: #16181d; color: #d3d7de; border-radius: 10px; padding: 14px 16px;
  font-family: Consolas, "Courier New", monospace; font-size: 12.5px; line-height: 1.55;
  height: 420px; overflow-y: auto; white-space: pre-wrap; word-break: break-all;
}

/* ── 弹窗 ── */
.modal {
  position: fixed; inset: 0; background: rgba(15,18,25,.45);
  display: flex; align-items: center; justify-content: center; z-index: 100;
}
.modal-card {
  background: #fff; border-radius: 14px; padding: 26px 28px; width: 360px;
  box-shadow: 0 24px 70px rgba(0,0,0,.3);
}
.modal-card h2 { font-size: 16px; margin-bottom: 16px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }

@media (max-width: 760px) {
  .field-row { flex-direction: column; gap: 0; }
  .detail-grid { grid-template-columns: repeat(2, 1fr); }
  .topbar { gap: 12px; padding: 0 12px; }
  .topbar-title { display: none; }
}
