:root {
  --bg: #fafaf9;
  --surface: #ffffff;
  --ink: #16161a;
  --ink-soft: #68686f;
  --ink-faint: #a0a0a6;
  --border: #e7e6e3;
  --border-strong: #d6d5d1;
  --accent: #16161a;
  --accent-ink: #ffffff;
  --focus: #2451c9;
  --warn-ink: #8a5a10;
  --warn-bg: #fbf3e2;
  --fail-ink: #b3261e;
  --fail-bg: #fbeae9;
  --pass-ink: #246b3f;
  --pass-bg: #e9f3ec;
  --mono: "SF Mono", "Menlo", ui-monospace, monospace;
}

/* 配色選項：mono 是預設（跟 :root 相同），其餘只換 accent/focus，版型、留白、
   字級都不動——避免像之前一次改太多東西（底色+字體+裝飾）結果一起走鐘。
   dark 是唯一真的換了底色/文字色的深色模式。 */
html[data-theme="dark"] {
  --bg: #141416;
  --surface: #1c1c1f;
  --ink: #f2f1ee;
  --ink-soft: #a8a7ad;
  --ink-faint: #76757c;
  --border: #2d2d31;
  --border-strong: #3c3c41;
  --accent: #f2f1ee;
  --accent-ink: #141416;
  --focus: #85a4ff;
  --warn-ink: #e0ad53;
  --warn-bg: #352a14;
  --fail-ink: #e2726b;
  --fail-bg: #351715;
  --pass-ink: #6fcf91;
  --pass-bg: #123320;
}

html[data-theme="indigo"] {
  --accent: #33469e;
  --accent-ink: #ffffff;
  --focus: #33469e;
}

html[data-theme="forest"] {
  --accent: #1f5c45;
  --accent-ink: #ffffff;
  --focus: #1f5c45;
}

html[data-theme="clay"] {
  --accent: #ab5330;
  --accent-ink: #fff9f5;
  --focus: #ab5330;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.6 -apple-system, BlinkMacSystemFont, "PingFang TC", "Microsoft JhengHei", "Noto Sans TC", sans-serif;
  -webkit-font-smoothing: antialiased;
}

body {
  display: flex;
  justify-content: center;
  padding: 72px 24px 140px;
}

main {
  width: 100%;
  max-width: 640px;
}

header {
  margin-bottom: 56px;
}

.header-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

header h1 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.35;
  margin: 0 0 10px;
  color: var(--ink);
}

.theme-switcher {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
  padding-top: 4px;
}

.theme-switcher .swatch {
  width: 22px;
  height: 22px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  cursor: pointer;
  background: var(--swatch-bg);
  position: relative;
}

.theme-switcher .swatch[data-theme="mono"] { --swatch-bg: #16161a; }
.theme-switcher .swatch[data-theme="dark"] { --swatch-bg: #141416; border-color: #3c3c41; }
.theme-switcher .swatch[data-theme="indigo"] { --swatch-bg: #33469e; }
.theme-switcher .swatch[data-theme="forest"] { --swatch-bg: #1f5c45; }
.theme-switcher .swatch[data-theme="clay"] { --swatch-bg: #ab5330; }

.theme-switcher .swatch:hover {
  transform: scale(1.12);
}

.theme-switcher .swatch.active {
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--ink-faint);
}

header p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 14px;
}

section {
  margin-bottom: 8px;
  padding: 32px 0;
  border-top: 1px solid var(--border);
}

section:first-of-type {
  border-top: none;
  padding-top: 0;
}

.section-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--ink-faint);
  text-transform: uppercase;
  margin: 0 0 22px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-label .num {
  font-family: var(--mono);
  color: var(--ink-faint);
  font-weight: 500;
}

.field {
  margin-bottom: 20px;
}

.field label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  margin-bottom: 8px;
}

.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

input[type="text"],
input[type="date"],
select,
textarea {
  width: 100%;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  font: inherit;
  font-size: 14px;
  color: var(--ink);
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

select {
  cursor: pointer;
}

textarea {
  resize: vertical;
}

input::placeholder,
textarea::placeholder {
  color: var(--ink-faint);
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--focus);
  box-shadow: 0 0 0 3px rgba(36, 81, 201, 0.14);
}

.hint {
  font-size: 12.5px;
  color: var(--ink-faint);
  margin-top: 6px;
}

details {
  border: 1px solid var(--border);
  border-radius: 8px;
}

details summary {
  cursor: pointer;
  padding: 13px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-soft);
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

details summary::-webkit-details-marker { display: none; }

details summary::after {
  content: "";
  width: 7px;
  height: 7px;
  border-right: 1.5px solid var(--ink-faint);
  border-bottom: 1.5px solid var(--ink-faint);
  transform: rotate(45deg);
  transition: transform 0.15s ease;
  flex-shrink: 0;
}

details[open] summary::after {
  transform: rotate(-135deg);
}

details[open] summary {
  border-bottom: 1px solid var(--border);
}

details .details-body {
  padding: 18px 16px 4px;
}

.person-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}

button {
  font: inherit;
  font-weight: 600;
  font-size: 13.5px;
  padding: 10px 18px;
  border-radius: 6px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease, opacity 0.12s ease;
}

button:hover:not(:disabled) {
  background: var(--bg);
  border-color: var(--ink-faint);
}

button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

button.primary:hover:not(:disabled) {
  opacity: 0.85;
}

button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.actions {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-top: 20px;
  flex-wrap: wrap;
}

.status-line {
  font-size: 13px;
  color: var(--ink-soft);
}

#draft-box {
  min-height: 280px;
  font-size: 14px;
  line-height: 1.8;
}

.checklist {
  list-style: none;
  margin: 20px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.checklist li {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 14px;
  font-size: 13px;
  background: var(--surface);
}

.checklist li.warn { background: var(--warn-bg); }
.checklist li.fail { background: var(--fail-bg); }

.checklist .mark {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 12px;
  flex-shrink: 0;
  width: 1.1em;
  margin-top: 1px;
}

.checklist li.pass .mark { color: var(--pass-ink); }
.checklist li.warn .mark { color: var(--warn-ink); }
.checklist li.fail .mark { color: var(--fail-ink); }

.checklist .label { font-weight: 600; margin-right: 4px; }

.photo-grid {
  display: grid;
  gap: 10px;
}

.photo-row {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 14px;
  align-items: start;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.photo-row img {
  width: 96px;
  height: 72px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid var(--border);
}

.photo-picker {
  border: 1px dashed var(--border-strong);
  border-radius: 8px;
  padding: 28px 20px;
  text-align: center;
  color: var(--ink-soft);
  font-size: 13px;
}

.photo-picker label {
  font-weight: 500;
  color: var(--ink);
}

footer {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--ink-faint);
  line-height: 1.7;
}

@media (max-width: 560px) {
  body { padding: 48px 18px 120px; }
  .row, .person-grid { grid-template-columns: 1fr; }
  .photo-row { grid-template-columns: 1fr; }
  .photo-row img { width: 100%; height: 160px; }
}
