:root{
  --bg:#f6f8fc;
  --card:#ffffff;
  --card2:#f8fafc;
  --text:#111827;
  --muted:#6b7280;
  --line:#e5e7eb;
  --btn:#2563eb;
  --btn2:#1d4ed8;
  --danger:#dc2626;
  --ok:#16a34a;
  --warn:#d97706;
  --shadow: 0 10px 30px rgba(17,24,39,.08);
  --radius:16px;

  --dz-border:#d1d5db;
  --dz-bg:#ffffff;
  --dz-hover:#f8fafc;
  --dz-accent:#22c55e;
  --dz-btn:#22c55e;
  --dz-btn2:#16a34a;
}

*{box-sizing:border-box}

body{
  margin:0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC","Hiragino Sans GB","Microsoft YaHei", Arial, sans-serif;
  background: linear-gradient(180deg, #ffffff 0%, var(--bg) 100%);
  color:var(--text);
  min-height:100vh;
}

.wrap{max-width:1000px;margin:0 auto;margin-top:-180px;}

.topbar{
  display:flex;align-items:flex-start;justify-content:space-between;gap:16px;
  margin-bottom:18px;
}

.title{
  font-size:22px;font-weight:800;letter-spacing:.2px;margin:0 0 6px 0;
}
.sub{
  margin:0;color:var(--muted);font-size:13px;line-height:1.4;
}
.badge{
  display:inline-flex;align-items:center;gap:8px;
  background: rgba(17,24,39,.04);
  border:1px solid rgba(17,24,39,.10);
  border-radius:999px;
  padding:8px 12px;
  color:var(--muted);
  font-size:12px;
  white-space:nowrap;
}
.badge b{color:var(--text)}

.card{
  background: var(--card);
  border:1px solid rgba(17,24,39,.10);
  border-radius:var(--radius);
  box-shadow: var(--shadow);
  overflow:hidden;
}

.tabs{
  display:flex;flex-wrap:wrap;
  gap:8px;
  padding:14px;
  border-bottom:1px solid rgba(17,24,39,.10);
  background: var(--card2);
}

.tab{
  appearance:none;border:1px solid rgba(17,24,39,.12);
  background: #fff;
  color:var(--text);
  padding:10px 12px;
  border-radius:12px;
  font-size:13px;
  cursor:pointer;
  transition: .15s ease;
}
.tab:hover{transform: translateY(-1px); background: rgba(37,99,235,.06);}
.tab.active{border-color: rgba(37,99,235,.55); background: rgba(37,99,235,.10);}

.panel{display:none;padding:18px;}
.panel.active{display:block;}

.row{display:flex;flex-wrap:wrap;}
.col{flex:1 1 340px;min-width:260px;}

.box{
  background: #fff;
  border:1px solid rgba(17,24,39,.10);
  border-radius:14px;
  padding:14px;
}
.h{
  margin:0 0 8px 0;
  font-size:14px;
  font-weight:750;
}
.p{
  margin:0 0 12px 0;
  color:var(--muted);
  font-size:12px;
  line-height:1.45;
}

label{display:block;font-size:12px;color:var(--muted);margin:10px 0 6px}

input[type="text"], input[type="password"], select, textarea{
  width:100%;
  padding:10px 12px;
  border-radius:12px;
  border:1px solid rgba(17,24,39,.14);
  background: #fff;
  color: var(--text);
  outline:none;
}
textarea{min-height:90px;resize:vertical}

/* ===================== 表单：左右分栏（左：输入 / 右：操作+结果） ===================== */
form.jobform{
  display:grid;
  grid-template-columns: 1.15fr .85fr;
  gap:14px;
  align-items:start;
}

.job-left{ grid-column:1; min-width:0; }
.url-input{background: #ffffff;
    border-width: 1px;
    border-style: solid;
    border-color: #d9d9d9;
    margin: 0;
    padding: 4px 11px;
    color: rgba(0, 0, 0, 0.88);
    font-size: 14px;
    line-height: 1.5714285714285714;
    list-style: none;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';
    position: relative;
    display: inline-block;
    width: 100%;
    min-width: 0;
    border-radius: 6px;
    transition: all 0.2s;}
.job-right{ grid-column:2; min-width:0; align-self:start; }

.job-right .btnrow{ margin-top:0; }
.job-right .result{ margin-top:10px; }

/* 右侧“结果卡片”尽量保持可见 */
.job-right .result{
  position: sticky;
  top: 12px;
}

@media (max-width: 920px){
  form.jobform{
    grid-template-columns: 1fr;
  }
  .job-left,
  .job-right{
    grid-column:1;
  }
  .job-right{
    margin-top:14px;
  }
  .job-right .result{
    position: static;
    top:auto;
    margin-top:14px;
  }
}

/* ===================== 拖拽上传（图1风格） ===================== */
.dz{
  position:relative;
  border:2px dashed var(--dz-border);
  background: var(--dz-bg);
  border-radius:14px;
  padding:24px 16px;
  text-align:center;
  transition:.15s ease;
  user-select:none;
}
.dz:hover{background: var(--dz-hover);}
.dz.dragover{
  border-color: rgba(34,197,94,.85);
  background: rgba(34,197,94,.06);
}
.dz.hasfiles{
  border-color: rgba(34,197,94,.65);
  box-shadow: 0 10px 22px rgba(34,197,94,.12);
}
.dz input[type="file"]{
  position:absolute;
  inset:0;
  width:100%;
  height:100%;
  opacity:0;
  cursor:pointer;
}
.dz-ui{pointer-events:none;}
.dz-icon{
  width:46px;height:46px;
  margin:0 auto 10px;
  color:#9ca3af;
}
.dz-title{
  margin:0 0 6px 0;
  font-size:14px;
  font-weight:750;
  color:var(--text);
}
.dz-desc{
  margin:0 0 14px 0;
  font-size:12px;
  color:var(--muted);
}
.dz-btn{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:10px 16px;
  border-radius:10px;
  color:#fff;
  background: linear-gradient(180deg, var(--dz-btn) 0%, var(--dz-btn2) 100%);
  box-shadow: 0 10px 18px rgba(34,197,94,.18);
  font-size:13px;
  font-weight:650;
}
.dz-btn svg{width:16px;height:16px;flex:0 0 auto;}

/* 选择文件状态：显眼化（替换原来一行不显眼的文本） */
.dz-files{
  margin-top:14px;
  text-align:left;
  font-size:12px;
  color:var(--text);
  white-space:normal;
  word-break:break-word;

  background: rgba(34,197,94,.08);
  border:1px solid rgba(34,197,94,.22);
  border-radius:12px;
  padding:10px 10px;
}
.dz-count{
  font-size:12px;
  color: rgba(22,163,74,.95);
  margin-bottom:6px;
}
.dz-count b{color: rgba(22,163,74,.95);}
.dz-list{
  display:flex;
  flex-direction:column;
  gap:6px;
  max-height: 240px;
  overflow:auto;
  padding-right:6px;
}
.dz-item{
  padding:8px 10px;
  border-radius:10px;
  border:1px solid rgba(17,24,39,.10);
  background:#fff;
  color:var(--text);
  line-height:1.2;
}

/* Buttons / Result */
.btnrow{display:flex;flex-wrap:wrap;gap:10px;margin-top:12px;align-items:center}

button.primary{
  appearance:none;border:0;
  background: linear-gradient(180deg, var(--btn) 0%, var(--btn2) 100%);
  color:#fff;
  padding:10px 14px;
  border-radius:12px;
  font-size:13px;
  cursor:pointer;
  box-shadow: 0 10px 22px rgba(37,99,235,.18);
}
button.primary:disabled{opacity:.55;cursor:not-allowed}

button.ghost{
  appearance:none;border:1px solid rgba(17,24,39,.14);
  background: rgba(17,24,39,.02);
  color:var(--text);
  padding:10px 14px;border-radius:12px;font-size:13px;
  cursor:pointer;
}

.result{
  margin-top:0;
  border:1px solid rgba(17,24,39,.12);
  padding:12px;
  border-radius:14px;
  background: #fff;
}

.statusline{
  display:flex;align-items:center;justify-content:space-between;gap:10px;
  background: rgba(17,24,39,.03);
  border:1px solid rgba(17,24,39,.10);
  border-radius:12px;
  padding:10px 12px;
}

.status{font-size:12px;color:var(--muted);line-height:1.4}
.status b{color:var(--text)}

.spinner{
  width:18px;height:18px;border-radius:50%;
  border:2px solid rgba(17,24,39,.18);
  border-top-color: rgba(17,24,39,.70);
  animation: spin 0.9s linear infinite;
  flex:0 0 auto;
  display:none;
}
@keyframes spin{to{transform: rotate(360deg)}}

.msg{
  margin-top:10px;
  font-size:12px;
  color:var(--muted);
  white-space:pre-wrap;
  word-break:break-word;
}
.msg.ok{color: rgba(22,163,74,.95);}
.msg.err{color: rgba(220,38,38,.95);}

a.dl{
  color:#0b1220;
  text-decoration:none;
  background: rgba(22,163,74,.10);
  border:1px solid rgba(22,163,74,.22);
  padding:9px 12px;
  border-radius:12px;
  display:inline-flex;
  align-items:center;
  gap:8px;
  margin-top:10px;
}

.hint{
  font-size:12px;
  color:var(--muted);
  margin-top:10px;
}

.splitgrid{display:grid;grid-template-columns:1fr 1fr;gap:10px}
.splitgrid > div{min-width:0}

@media (max-width:720px){
  body{padding:14px}
  .splitgrid{grid-template-columns:1fr}
}

/* 结果强调动画（提交完成/失败时闪一下，用户更容易看到） */
.result-attn{
  animation: resultPulse 1.4s ease-out 1;
}
@keyframes resultPulse{
  0%{ box-shadow: 0 0 0 rgba(37,99,235,0); transform: translateY(0); }
  20%{ box-shadow: 0 16px 34px rgba(37,99,235,.18); transform: translateY(-2px); }
  100%{ box-shadow: 0 10px 30px rgba(17,24,39,.08); transform: translateY(0); }
}

/* ===================== 合并列表（可拖拽排序/删除） ===================== */
.mergebox{
  margin-top:12px;
  border:1px solid rgba(17,24,39,.10);
  border-radius:14px;
  background: rgba(17,24,39,.02);
  padding:12px;
}

.mergehint{
  font-size:12px;
  color:var(--muted);
  padding:8px 6px;
}
.mergelist{
  display:flex;
  flex-direction:column;
  gap:8px;
}
.mergeitem{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  padding:10px 12px;
  background:#fff;
  border:1px solid rgba(17,24,39,.10);
  border-radius:12px;
  cursor:grab;
}
.mergeitem.dragging{
  opacity:.75;
}
.mergeleft{
  display:flex;
  align-items:center;
  gap:10px;
  min-width:0;
}
.mergehandle{
  width:18px;
  height:18px;
  border-radius:6px;
  border:1px solid rgba(17,24,39,.18);
  background: rgba(17,24,39,.04);
  flex:0 0 auto;
}
.mergename{
  font-size:12px;
  color:var(--text);
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  max-width:560px;
}
.mergesub{
  font-size:11px;
  color:var(--muted);
  margin-left:28px;
  margin-top:-6px;
}
.mergeright{
  display:flex;
  align-items:center;
  gap:8px;
  flex:0 0 auto;
}
.mergebadge{
  font-size:11px;
  color:var(--muted);
  padding:6px 8px;
  border-radius:999px;
  border:1px solid rgba(17,24,39,.12);
  background: rgba(17,24,39,.03);
}
.mergedel{
  appearance:none;
  border:1px solid rgba(220,38,38,.25);
  background: rgba(220,38,38,.06);
  color: rgba(220,38,38,.95);
  padding:6px 10px;
  border-radius:10px;
  font-size:12px;
  cursor:pointer;
}

/* ===================== 水印预览区域 ===================== */
.wm-preview{
  margin-top:12px;
  border:1px solid rgba(17,24,39,.10);
  border-radius:14px;
  background:#fff;
  overflow:hidden;
  display:none;
}
.wm-preview.show{display:block;}
.wm-preview-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  padding:10px 12px;
  background: rgba(17,24,39,.03);
  border-bottom:1px solid rgba(17,24,39,.10);
}
.wm-preview-title{
  font-size:12px;
  color:var(--text);
  font-weight:650;
}
.wm-open{
  font-size:12px;
  color: rgba(37,99,235,.95);
  text-decoration:none;
}
.wm-preview-body{
  padding:12px;
}
.wm-preview-body img{
  width:100%;
  height:auto;
  display:block;
  border-radius:10px;
  border:1px solid rgba(17,24,39,.10);
  background: rgba(17,24,39,.02);
}

/* ===================== 水印：本地预览舞台（PDF embed + Canvas 水印叠加） ===================== */
.wm-stage{
  position: relative;
  width: 100%;
  height: min(70vh, 640px);
  border-radius:10px;
  border:1px solid rgba(17,24,39,.10);
  background: rgba(17,24,39,.02);
  overflow:hidden;
}

.wm-pdf{
  width: 100%;
  height: 100%;
  display:block;
  border:0;
  background:#fff;
}

.wm-canvas{
  position:absolute;
  inset:0;
  width:100%;
  height:100%;
  pointer-events:none;
}

.wm-fallback{
  position:absolute;
  inset:0;
  display:none;
  align-items:center;
  justify-content:center;
  padding:18px;
  text-align:center;
  color:var(--muted);
  background: rgba(255,255,255,.92);
}
.wm-fallback.show{display:flex;}
