/* 公共样式：三页共享的变量、布局与组件（文件转换 / 证照调整 / 拍照识文） */
:root {
  --bg: #f5f5f7;
  --card: #ffffff;
  --text: #1e293b;
  --muted: #475569;
  --accent: #50b8d8;
  --accent-deep: #3aa3c4;
  --border: #e2e8f0;
  --danger: #d94a4a;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
}

/* 左侧菜单栏 */
.sidebar {
  width: 200px;
  flex-shrink: 0;
  background: var(--card);
  border-right: 1px solid var(--border);
  padding: 24px 12px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
  transition: width .2s ease;
}
.sidebar.collapsed { width: 64px; }
.brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4px 20px;
}
.brand-text { font-size: 15px; font-weight: 600; white-space: nowrap; }
.collapse-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  border: none;
  background: transparent;
  border-radius: 6px;
  color: var(--muted);
  cursor: pointer;
  transition: background .15s, color .15s;
}
.collapse-btn:hover { background: #f0f9fc; color: var(--accent-deep); }
.collapse-btn svg { display: block; transition: transform .2s; }
.sidebar.collapsed .collapse-btn svg { transform: rotate(180deg); }
.sidebar.collapsed .brand { justify-content: center; padding: 0 0 20px; }
.sidebar.collapsed .brand-text { display: none; }
.menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border-radius: 8px;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
  margin-bottom: 4px;
  transition: all .15s;
  white-space: nowrap;
}
.mi-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 18px;
  height: 18px;
}
.mi-icon svg { display: block; }
.sidebar.collapsed .menu-item { justify-content: center; padding: 11px 0; }
.sidebar.collapsed .mi-text { display: none; }
.menu-item:hover { background: #f0f9fc; color: var(--accent-deep); }
.menu-item.active { background: #f0f9fc; color: var(--accent-deep); font-weight: 500; }

/* 内容区 */
.main { flex: 1; padding: 40px 28px; }
.page { max-width: 680px; margin: 0 auto; }
h1 { font-size: 22px; font-weight: 600; margin-bottom: 6px; }
.sub { color: var(--muted); font-size: 14px; margin-bottom: 24px; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 16px;
}
.field-label { font-size: 14px; font-weight: 500; margin-bottom: 10px; }
.types { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.type-btn {
  flex: 1 1 45%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
  text-align: center;
  transition: all .15s;
}
.type-btn:hover { border-color: var(--accent); }
.type-btn.active { border-color: var(--accent); background: #f0f9fc; color: var(--accent-deep); }

.drop {
  border: 1.5px dashed var(--border);
  border-radius: 10px;
  padding: 28px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
  transition: all .15s;
  margin-bottom: 16px;
}
.drop.hover { border-color: var(--accent); background: #f0f9fc; }
.drop .fname { color: var(--text); font-weight: 500; margin-top: 6px; word-break: break-all; }

.btn {
  width: 100%;
  padding: 13px;
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s;
}
.btn:hover { background: var(--accent-deep); }
.btn:disabled { background: #cbd5e1; cursor: not-allowed; }
.btn.ghost {
  background: #fff;
  color: var(--text);
  border: 1px solid var(--border);
}
.btn.ghost:hover { background: #fff; border-color: var(--accent); color: var(--accent-deep); }
.btn.sm { width: auto; padding: 8px 16px; font-size: 13px; }

.input {
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  color: var(--text);
  background: #fff;
  transition: border-color .15s;
}
.input:focus { outline: none; border-color: var(--accent); }

/* 任务状态 */
.task { display: none; }
.task.show { display: block; }
.task-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.task-name { font-size: 14px; font-weight: 500; word-break: break-all; }
.task-status { font-size: 13px; color: var(--muted); }
.task-status.error { color: var(--danger); }
.bar { height: 8px; background: var(--border); border-radius: 4px; overflow: hidden; margin-bottom: 12px; }
.bar-fill { height: 100%; width: 0; background: var(--accent); border-radius: 4px; transition: width .3s; }
.dl {
  display: inline-block;
  padding: 10px 20px;
  background: var(--accent);
  color: #fff;
  border-radius: 8px;
  text-decoration: none;
  font-size: 14px;
  margin-top: 12px;
}
.dl:hover { background: var(--accent-deep); }
.preview {
  max-width: 100%;
  max-height: 360px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: repeating-conic-gradient(#f1f1f1 0% 25%, #ffffff 0% 50%) 50% / 16px 16px;
  display: block;
}
.err-msg { color: var(--danger); font-size: 13px; }

/* 文本直显区 */
.text-view { margin-top: 16px; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.text-head { padding: 10px 14px; font-size: 13px; color: var(--muted); border-bottom: 1px solid var(--border); background: #f8fafc; }
.text-body { max-height: 480px; overflow: auto; padding: 16px; font-size: 14px; line-height: 1.7; white-space: pre-wrap; word-break: break-word; color: var(--text); margin: 0; font-family: inherit; }
.hidden { display: none; }

/* ===== 证照调整 ===== */
.custom-size { display: flex; align-items: center; gap: 8px; margin-bottom: 20px; }
.custom-size .x { color: var(--muted); font-size: 14px; }
.custom-size .input { flex: 1; width: 100%; }
.colors { display: flex; gap: 12px; margin-bottom: 20px; }
.color-swatch {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 2px solid var(--border);
  cursor: pointer;
  transition: all .15s;
}
.color-swatch.active { border-color: var(--accent); box-shadow: 0 0 0 2px #f0f9fc; }
.color-swatch.white { background: #ffffff; }
.color-swatch.blue { background: #628bce; }
.color-swatch.red { background: #d74532; }

/* ===== 拍照识文 ===== */
.cam-off { text-align: center; padding: 8px 0; }
.cam-off .btn { margin-top: 12px; }
.cam-wrap video {
  width: 100%;
  max-height: 65vh;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #000;
  display: block;
  object-fit: contain;
}
.cam-wrap:fullscreen,
.cam-wrap:-webkit-full-screen {
  width: 100vw;
  height: 100vh;
  background: #000;
  padding: 12px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.cam-wrap:fullscreen video,
.cam-wrap:-webkit-full-screen video {
  flex: 1;
  max-height: none;
  width: 100%;
  height: 100%;
  object-fit: contain;
  border: none;
  border-radius: 0;
}
.cam-wrap:fullscreen .cam-toolbar,
.cam-wrap:-webkit-full-screen .cam-toolbar {
  flex-shrink: 0;
  margin-top: 12px;
}
.cam-wrap:fullscreen .cam-tip,
.cam-wrap:-webkit-full-screen .cam-tip {
  color: #a0aec0;
}
.cam-toolbar { display: flex; gap: 8px; margin-top: 12px; }
.cam-toolbar .btn { flex: 1; }
.cam-tip { color: var(--muted); font-size: 12px; margin-top: 10px; text-align: center; }

.review-grid { display: flex; gap: 12px; margin-bottom: 14px; }
.review-img {
  width: 40%;
  max-height: 240px;
  object-fit: contain;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: repeating-conic-gradient(#f1f1f1 0% 25%, #ffffff 0% 50%) 50% / 16px 16px;
}
.review-text {
  flex: 1;
  min-height: 140px;
  height: auto;
  padding: 12px;
  resize: vertical;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
}
.review-btns { display: flex; gap: 8px; }
.review-btns .btn { flex: 1; }

.sum-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; flex-wrap: wrap; gap: 8px; }
.sum-head .field-label { margin-bottom: 0; }
.sum-actions { display: flex; gap: 8px; }
.sum-list { display: flex; flex-direction: column; gap: 10px; }
.sum-empty { color: var(--muted); font-size: 13px; text-align: center; padding: 12px 0; }
.sum-item { border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; }
.sum-item-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.sum-item-title { font-size: 13px; font-weight: 500; color: var(--muted); }
.sum-item-ops { display: flex; gap: 6px; }
.sum-op {
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
  padding: 3px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #fff;
  transition: all .15s;
}
.sum-op:hover { color: var(--accent-deep); border-color: var(--accent); }
.sum-op.del:hover { color: var(--danger); border-color: var(--danger); }
.sum-item-body { font-size: 14px; line-height: 1.7; white-space: pre-wrap; word-break: break-word; }

@media (max-width: 600px) {
  .review-grid { flex-direction: column; }
  .review-img { width: 100%; max-height: 200px; }
}
