:root {
  --ink: #1d2733;
  --muted: #5f6b78;
  --line: #d5dbe1;
  --bg: #f4f6f8;
  --card: #ffffff;
  --accent: #1f3b57;
  --accent-ink: #ffffff;
  --accent-soft: #eaf1fb; /* 與後台 admin.css 同值 */
  --danger: #b42318;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, -apple-system, "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif; color: var(--ink); background: var(--bg); font-size: 16px; line-height: 1.6; }
.top { background: var(--accent); color: var(--accent-ink); padding: 16px; }
.top h1 { margin: 0; font-size: 20px; }
.top .sub { margin: 2px 0 10px; font-size: 13px; opacity: .85; }
.steps { display: flex; gap: 6px; list-style: none; margin: 0; padding: 0; font-size: 12px; }
.steps li { flex: 1; text-align: center; padding: 4px 0; border-bottom: 3px solid rgba(255, 255, 255, .3); opacity: .7; }
.steps li.active { border-color: #fff; opacity: 1; font-weight: 600; }
main { max-width: 640px; margin: 0 auto; padding: 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 16px; }
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 14px; font-weight: 600; }
input, select, button { font: inherit; }
/* iOS：16px 以上才不會點擊放大；關掉原生灰底 */
.field input, .field select { font-weight: 400; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); -webkit-appearance: none; appearance: none; }
.field select { background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 32px; }
.field select:disabled { background-color: #eef1f4; color: var(--muted); }
button.primary { width: 100%; padding: 12px; border: 0; border-radius: 8px; background: var(--accent); color: var(--accent-ink); font-weight: 600; }
button.primary:disabled { opacity: .45; }
button.secondary { padding: 6px 14px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); }
button.link-danger { border: 0; background: none; color: var(--danger); padding: 4px 6px; }
.error { color: var(--danger); min-height: 1.2em; margin: 6px 0; }
.muted { color: var(--muted); font-size: 14px; }
.check { display: flex; gap: 10px; align-items: flex-start; margin: 12px 0; }
.check input { width: 22px; height: 22px; margin-top: 2px; flex: none; }
details { border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; margin: 10px 0; }
summary { cursor: pointer; color: var(--accent); font-weight: 600; }
.consent-sections h3 { font-size: 15px; margin: 12px 0 4px; }
.consent-sections ol { padding-left: 22px; margin: 4px 0; }
.sign { margin: 14px 0; }
.sign-title { margin: 0; }
.sign-note { margin: 0 0 6px; }
.sign-field { display: flex; align-items: center; justify-content: center; width: 100%; height: 140px; padding: 4px; border: 1px dashed var(--muted); border-radius: 8px; background: #fff; color: var(--muted); font-size: 16px; cursor: pointer; }
.sign-field img { max-width: 100%; max-height: 100%; }
.sign-dialog { padding: 0; width: min(90vw, 720px); max-width: none; }
.sign-board { position: relative; height: 300px; }
#signaturePad { position: absolute; inset: 0; width: 100%; height: 100%; background: #fff; touch-action: none; display: block; }
.sign-ui { position: absolute; inset: 0; display: flex; flex-direction: column; padding: 12px; pointer-events: none; }
.sign-hint { margin: 0; color: var(--muted); font-size: 14px; }
.sign-line { margin-top: auto; margin-bottom: 12px; border-bottom: 1px solid var(--line); }
.sign-actions { display: flex; gap: 8px; justify-content: flex-end; }
.sign-actions button { pointer-events: auto; }
.sign-actions button.primary { width: auto; padding: 8px 18px; }
html.signing, body.signing { overflow: hidden; overscroll-behavior: none; }
body.signing { position: fixed; left: 0; right: 0; width: 100%; }
/* 手機（P2C-5）：全螢幕；直向時文字與按鈕順時針轉 90°，客戶把手機轉橫（頂端朝左）看到正的橫式簽名板，「確認」在右下 */
.sign-dialog.mobile { width: 100vw; height: 100vh; height: 100dvh; max-width: none; max-height: none; margin: 0; border-radius: 0; }
.sign-dialog.mobile .sign-board { height: 100%; }
@media (orientation: portrait) {
  .sign-dialog.mobile .sign-ui { inset: auto; top: 50%; left: 50%; width: 100vh; width: 100dvh; height: 100vw; height: 100dvw; transform: translate(-50%, -50%) rotate(90deg); }
}
.sign-row { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; }
.doc-group { border-top: 1px solid var(--line); padding: 12px 0; }
.doc-group h3 { margin: 0 0 2px; font-size: 16px; }
.doc-group .hint { margin: 0 0 8px; }
.doc-list { list-style: none; margin: 6px 0 0; padding: 0; }
.doc-list li { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 8px; background: var(--bg); border-radius: 6px; margin-bottom: 4px; font-size: 14px; word-break: break-all; }
.file-button { display: inline-block; padding: 8px 14px; border: 1px solid var(--accent); color: var(--accent); border-radius: 8px; cursor: pointer; }
.file-button input { display: none; }
.file-button.disabled { opacity: .45; cursor: not-allowed; }
.big { font-size: 24px; font-weight: 700; letter-spacing: .5px; }
.final-no { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
.final-note { font-weight: 600; }
.copy-buffer { position: fixed; top: 0; left: 0; width: 1px; height: 1px; opacity: 0; font-size: 16px; }
dialog { border: 0; border-radius: 10px; padding: 18px; max-width: min(92vw, 420px); }
dialog::backdrop { background: rgba(0, 0, 0, .35); }
.dialog-row { display: flex; gap: 8px; justify-content: flex-end; margin-top: 12px; }
.dialog-row button.primary { width: auto; padding: 8px 18px; }
.upload-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.upload-status { color: var(--muted); font-size: 14px; }
.upload-note { margin: 6px 0 0; }
.button-row { display: flex; gap: 10px; margin-top: 12px; }
.button-row button.primary { flex: 1; width: auto; }
.button-row button.secondary { flex: none; padding: 12px 16px; }
.doc-thumb { width: 48px; height: 48px; object-fit: cover; border-radius: 4px; flex: none; background: var(--bg); }
.doc-thumb.placeholder { display: inline-flex; align-items: center; justify-content: center; font-size: 12px; color: var(--muted); border: 1px solid var(--line); }
.doc-name { flex: 1; min-width: 0; }
.confirm-info { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; margin: 0 0 12px; }
.confirm-info dt { color: var(--muted); }
.confirm-info dd { margin: 0; font-weight: 600; }
.offscreen-input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
button.file-button { background: #fff; font: inherit; }
button.file-button:disabled { opacity: .45; cursor: not-allowed; }
.source-dialog[open] { display: grid; gap: 10px; width: min(92vw, 360px); }
.source-title { margin: 0 0 4px; font-weight: 600; text-align: center; }
.link-muted { border: 0; background: none; color: var(--muted); padding: 8px; }
.camera-dialog { padding: 0; width: 100vw; height: 100vh; height: 100dvh; max-width: none; max-height: none; margin: 0; border-radius: 0; background: #000; }
.camera-dialog[open] { display: flex; flex-direction: column; }
.camera-stage { position: relative; flex: 1; overflow: hidden; }
.camera-stage video, .camera-preview { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.camera-frame { position: absolute; left: 50%; top: 50%; width: min(88vw, 70vh * 1.587); width: min(88vw, 70dvh * 1.587); aspect-ratio: 85.7 / 54; transform: translate(-50%, -50%);
  border: 3px solid #fff; border-radius: 12px; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .45); pointer-events: none; }
.camera-hint { position: absolute; left: 0; right: 0; top: 16px; margin: 0; text-align: center; color: #fff; font-size: 15px; text-shadow: 0 1px 2px #000; }
.camera-actions { display: flex; gap: 10px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); background: #000; }
.camera-actions button { flex: 1; }
.camera-actions button.primary { width: auto; }

/* 2026-11-05 接續未完成的填寫、上傳頁複製編號 */
#resumeOpen { display: block; width: 100%; margin-top: 14px; }
#copyDraftNo { margin: 0 6px; padding: 2px 10px; font-size: 14px; }
/* 2026-11-12 首頁新版設計（使用者 1112 參考圖）：深色主視覺＋弧形、副標兩側細線、橫式卡片。只用既有色票（淡藍＝主色混白） */
.home { display: flex; flex-direction: column; align-items: stretch; margin: -16px -16px 0; padding-bottom: 16px;
  min-height: calc(100vh - 16px); min-height: calc(100svh - 16px); } /* 撐滿一屏，兩張卡平分下方空間 */
.home-hero { position: relative; min-height: min(54vw, 346px); padding: min(15vw, 96px) 24px 0; color: var(--accent-ink);
  background: var(--ink) url('/home-hero.jpg') 72% 0 / 147% auto no-repeat; } /* 使用者提供：深藍流線豪華車頭.png 上半部（弧形在圖內） */
.home-title { position: relative; margin: 0; font-size: min(6vw, 34px); font-weight: 800; letter-spacing: 1px; white-space: nowrap; }
.home-hero-line { position: relative; display: block; width: 60%; height: 2px; margin-top: 18px; background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--accent-ink) 70%, transparent), transparent); }
.home-sub { display: flex; align-items: center; gap: 14px; margin: 18px 16px 22px; color: var(--muted); font-size: 17px; font-weight: 600; letter-spacing: 1px; }
.home-sub::before, .home-sub::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.home-sub span { flex: none; }
.home-card { display: flex; flex: 1 1 0; align-items: center; gap: 18px; min-height: 132px; max-height: 260px; margin: 0 16px 18px; padding: 24px 20px; text-align: left;
  border: 1px solid transparent; border-radius: 18px; background: var(--card); color: var(--ink); cursor: pointer;
  box-shadow: 0 6px 18px color-mix(in srgb, var(--ink) 10%, transparent); }
.home-card-icon { display: flex; align-items: center; justify-content: center; flex: none; width: min(84px, 20vw); height: min(84px, 20vw); border-radius: 20px;
  background: var(--accent-soft); color: var(--ink); }
.home-card-text { display: flex; flex-direction: column; flex: 1; gap: 6px; padding-left: 18px; border-left: 1px solid var(--line); }
.home-card-title { font-size: clamp(22px, 7vw, 30px); font-weight: 800; letter-spacing: 1px; }
.home-card-sub { color: var(--muted); font-size: clamp(15px, 4.6vw, 19px); letter-spacing: 1px; }
.home-card-go { display: flex; align-items: center; justify-content: center; flex: none; width: 46px; height: 46px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent); }
.home-card-icon svg { width: 50%; height: 50%; }
.home-card-go svg { width: 24px; height: 24px; }
.home-company { margin: auto 0 0; padding-top: 8px; text-align: center; color: var(--muted); font-size: 13px; }
@media (min-width: 641px) { .home { margin-top: 0; } }
.field-note { font-weight: 400; color: var(--muted); font-size: 13px; }
.field textarea { font: inherit; font-weight: 400; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); resize: vertical; font-size: 16px; }
.radio-row { display: flex; flex-direction: column; gap: 8px; margin: 4px 0 14px; }
.radio { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.radio input { width: 20px; height: 20px; margin: 0; }
.pre-wrap { white-space: pre-wrap; word-break: break-all; }
#suppConfirm h3, #step4 h3 { font-size: 16px; margin: 14px 0 6px; }
/* .home、.steps 有 display:flex，會蓋掉 hidden 屬性；要明確隱藏 */
.home[hidden], .steps[hidden] { display: none; }
