/* ============================================================
   融城照相馆 · 电子协议签署工具 —— 全局样式（暖橙主题）
   ============================================================ */

:root {
  --orange: #f97316;
  --orange-dark: #e05e0a;
  --orange-light: #fff3e6;
  --orange-bg: #fff8f1;
  --ink: #2d2a26;
  --ink-2: #5f5a52;
  --gray: #9a948c;
  --line: #f0e5da;
  --green: #16a34a;
  --red: #e11d48;
  --radius: 14px;
  --shadow: 0 6px 24px rgba(180, 100, 30, 0.10);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  background: var(--orange-bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.page {
  max-width: 640px;
  margin: 0 auto;
  padding: 20px 16px 40px;
}

/* ---------- 顶部 ---------- */
.topbar {
  max-width: 640px;
  margin: 0 auto;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fff;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar .brand {
  font-size: 17px;
  font-weight: 700;
  color: var(--orange-dark);
  letter-spacing: 0.5px;
}
.topbar .back {
  font-size: 14px;
  color: var(--ink-2);
  text-decoration: none;
  padding: 4px 8px;
}
.topbar .mode-badge {
  font-size: 11px;
  color: var(--gray);
  background: var(--orange-light);
  padding: 3px 10px;
  border-radius: 20px;
}
.topbar .topbar-right { display: flex; align-items: center; gap: 8px; }
.topbar .logout-link {
  font-size: 13px;
  color: var(--gray);
  text-decoration: none;
  padding: 3px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  white-space: nowrap;
}

/* ---------- 卡片 ---------- */
.card {
  background: #fff;
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}

/* ---------- 按钮 ---------- */
.btn {
  display: inline-block;
  width: 100%;
  padding: 14px 20px;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  text-decoration: none;
  color: #fff;
  background: var(--orange);
  transition: background .15s, transform .05s;
}
.btn:active { background: var(--orange-dark); transform: scale(0.985); }
.btn.secondary {
  background: #fff;
  color: var(--orange-dark);
  border: 1px solid var(--orange);
}
.btn.ghost {
  background: var(--orange-light);
  color: var(--orange-dark);
}
.btn.gray {
  background: #f1ede8;
  color: var(--ink-2);
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-row { display: flex; gap: 12px; margin-top: 16px; }
.btn-row .btn { flex: 1; }

/* ---------- 首页入口 ---------- */
.hero { text-align: center; padding: 28px 8px 8px; }
.hero h1 { font-size: 22px; color: var(--ink); margin-bottom: 6px; }
.hero p { color: var(--ink-2); font-size: 14px; }
.entry-list { margin-top: 20px; }
.entry {
  display: flex;
  align-items: center;
  gap: 16px;
  background: #fff;
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  margin-bottom: 14px;
  text-decoration: none;
  color: var(--ink);
  border: 1px solid transparent;
  transition: border-color .15s;
}
.entry:active { border-color: var(--orange); }
.entry .icon {
  width: 52px; height: 52px; flex: 0 0 52px;
  border-radius: 14px;
  background: var(--orange-light);
  display: flex; align-items: center; justify-content: center;
  font-size: 26px;
}
.entry .txt b { display: block; font-size: 17px; }
.entry .txt span { color: var(--ink-2); font-size: 13px; }
.entry .arrow { margin-left: auto; color: var(--gray); font-size: 18px; }

/* ---------- 表单 ---------- */
.form-title { font-size: 18px; font-weight: 700; margin-bottom: 4px; }
.form-sub { color: var(--ink-2); font-size: 13px; margin-bottom: 16px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 14px; color: var(--ink-2); margin-bottom: 6px; }
.field label .req { color: var(--red); margin-left: 2px; }
.field input, .field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 15px;
  color: var(--ink);
  background: #fffdfb;
  font-family: inherit;
}
.field input:focus, .field textarea:focus {
  outline: none;
  border-color: var(--orange);
  background: #fff;
}
.field textarea { min-height: 76px; resize: vertical; }
.field .hint { font-size: 12px; color: var(--gray); margin-top: 4px; }

/* ---------- 协议 ---------- */
.agr-wrap { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px 20px; }
.agr-title { text-align: center; font-size: 20px; margin-bottom: 6px; }
.agr-no { text-align: center; color: var(--gray); font-size: 13px; margin-bottom: 16px; }
.agr-wrap p { margin-bottom: 8px; font-size: 14px; color: var(--ink); }
.agr-wrap h4 { font-size: 15px; margin: 16px 0 6px; color: var(--orange-dark); }
.agr-table { width: 100%; border-collapse: collapse; margin: 8px 0 12px; font-size: 14px; }
.agr-table td { border: 1px solid var(--line); padding: 8px 10px; }
.agr-table td:first-child { width: 34%; background: var(--orange-bg); color: var(--ink-2); }
.agr-signs { display: flex; gap: 16px; margin-top: 24px; }
.agr-sign-col { flex: 1; }
.agr-sign-label { font-size: 13px; color: var(--ink-2); }
.agr-sign-box {
  height: 74px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  margin: 8px 0 6px;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.agr-sign-box img { max-width: 100%; max-height: 100%; object-fit: contain; }
.agr-sign-date { font-size: 12px; color: var(--gray); }

/* ---------- 签名 ---------- */
.sign-area {
  position: relative;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  height: 220px;
  overflow: hidden;
  touch-action: none;
}
.sign-area canvas { display: block; width: 100%; height: 100%; }
.sign-tip { text-align: center; color: var(--gray); font-size: 13px; margin-top: 10px; }

/* ---------- 结果页 / 协议单预览 ---------- */
.preview { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px; }
.preview img { width: 100%; display: block; border-radius: 8px; }
.status-line {
  display: flex; align-items: center; gap: 8px;
  background: var(--orange-light);
  color: var(--orange-dark);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 14px;
  margin-bottom: 14px;
}
.status-line.ok { background: #ecfdf3; color: var(--green); }
.status-line .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: 0 0 8px; }

/* ---------- 时间线 ---------- */
.timeline { position: relative; padding-left: 22px; }
.tl-item { position: relative; padding-bottom: 16px; }
.tl-item::before {
  content: ''; position: absolute; left: -16px; top: 8px; bottom: -4px;
  width: 2px; background: var(--line);
}
.tl-item:last-child::before { display: none; }
.tl-dot {
  position: absolute; left: -20px; top: 6px;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--orange); box-shadow: 0 0 0 3px var(--orange-light);
}
.tl-title { font-size: 14px; font-weight: 600; }
.tl-time { font-size: 12px; color: var(--gray); }
.tl-detail { font-size: 13px; color: var(--ink-2); margin-top: 2px; }

/* ---------- 后台列表 ---------- */
.list-item {
  display: block;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 12px;
  text-decoration: none;
  color: var(--ink);
}
.list-item .top { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.list-item .tag {
  font-size: 11px; padding: 2px 8px; border-radius: 6px;
  background: var(--orange-light); color: var(--orange-dark);
}
.list-item .tag.repair { background: #eef2ff; color: #4f46e5; }
.list-item .tag.making { background: #ecfdf3; color: #15803d; }
.list-item .tag.portrait { background: #fdf2f8; color: #be185d; }
.list-item .no { font-size: 12px; color: var(--gray); margin-left: auto; }
.list-item .name { font-size: 16px; font-weight: 600; }
.list-item .meta { font-size: 13px; color: var(--ink-2); margin-top: 4px; }

/* ---------- 提示 ---------- */
.empty { text-align: center; color: var(--gray); padding: 30px 10px; font-size: 14px; }
.note { font-size: 13px; color: var(--gray); margin-top: 14px; text-align: center; }
.section-title { font-size: 16px; font-weight: 700; margin: 20px 0 12px; }
.divider { height: 1px; background: var(--line); margin: 20px 0; }

/* ---------- 交易进度步骤条 ---------- */
.stepper { display: flex; margin-top: 10px; }
.step { flex: 1; text-align: center; position: relative; }
.step:not(:last-child)::after {
  content: ''; position: absolute; top: 15px; left: 50%; width: 100%;
  height: 2px; background: var(--line); z-index: 0;
}
.step.done:not(:last-child)::after { background: var(--orange); }
.step-dot {
  position: relative; z-index: 1;
  width: 30px; height: 30px; margin: 0 auto;
  border-radius: 50%; background: #fff; border: 2px solid var(--line);
  color: var(--gray); font-size: 13px;
  display: flex; align-items: center; justify-content: center;
}
.step.done .step-dot { background: var(--orange); border-color: var(--orange); color: #fff; }
.step.active .step-dot { border-color: var(--orange); color: var(--orange-dark); font-weight: 700; }
.step-label { font-size: 11px; color: var(--gray); margin-top: 6px; line-height: 1.3; }
.step.done .step-label, .step.active .step-label { color: var(--orange-dark); font-weight: 600; }

/* ---------- 后台：阶段选择 + 写日志 ---------- */
.stage-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.stage-btn {
  padding: 8px 14px; border-radius: 20px; font-size: 13px;
  border: 1px solid var(--line); background: #fff; color: var(--ink-2);
  cursor: pointer;
}
.stage-btn.active { background: var(--orange); border-color: var(--orange); color: #fff; font-weight: 600; }
.note-input {
  width: 100%; border: 1px solid var(--line); border-radius: 10px;
  padding: 12px 14px; font-size: 15px; color: var(--ink);
  background: #fffdfb; font-family: inherit; min-height: 76px; resize: vertical;
}
.note-input:focus { outline: none; border-color: var(--orange); background: #fff; }
.note-hint { font-size: 12px; color: var(--gray); margin-top: 6px; }

@media (max-width: 420px) {
  .agr-signs { flex-direction: column; }
}

/* ---------- 照片附件 ---------- */
.photo-list { display: flex; flex-wrap: wrap; gap: 10px; }
.photo-item {
  position: relative;
  width: 92px; height: 92px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #fff;
}
.photo-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-del {
  position: absolute;
  top: 4px; right: 4px;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 14px;
  line-height: 22px;
  text-align: center;
  cursor: pointer;
}
.photo-add {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 92px; height: 92px;
  border-radius: 10px;
  border: 1px dashed var(--orange);
  color: var(--orange-dark);
  font-size: 13px;
  cursor: pointer;
  background: var(--orange-light);
  text-align: center;
  line-height: 1.3;
}
.photo-add input { display: none; }
