:root {
  --bg: #f6f8fb;
  --surface: #ffffff;
  --text: #1a2332;
  --muted: #5c6b7a;
  --primary: #0b5cab;
  --primary-dark: #084a8a;
  --border: #d8e0ea;
  --error: #b42318;
  --success: #067647;
  --warning: #b54708;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
}
.container { max-width: 960px; margin: 0 auto; padding: 1rem; }
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.5rem;
}
.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}
.brand {
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;
  line-height: 1.3;
  max-width: 16rem;
}
@media (min-width: 640px) {
  .brand { max-width: none; }
}
.site-header nav a { margin-left: 1rem; color: var(--text); text-decoration: none; }
.site-footer { margin-top: 3rem; padding: 1.5rem 0; color: var(--muted); font-size: 0.9rem; }
.site-footer a { color: var(--primary); }
.site-footer p { margin: 0.35rem 0; }

h1 { margin-top: 0; }
.lead { font-size: 1.15rem; color: var(--muted); }
.muted { color: var(--muted); font-size: 0.9rem; }
.meta { margin-top: 1rem; }

.hero, .form-panel, fieldset, .card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem;
}
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}
.card h3 { margin-top: 0; }

.btn {
  display: inline-block;
  padding: 0.6rem 1rem;
  border-radius: 8px;
  border: none;
  text-decoration: none;
  cursor: pointer;
  font-size: 0.95rem;
}
.btn.primary { background: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-dark); }
.btn.secondary { background: #eef3f8; color: var(--text); }
.actions { display: flex; gap: 0.75rem; flex-wrap: wrap; margin-top: 1rem; }

label { display: block; margin-bottom: 0.85rem; font-weight: 500; }
label input, label select, label textarea {
  display: block;
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font: inherit;
}
label.checkbox { font-weight: 400; display: flex; align-items: flex-start; gap: 0.5rem; }
label.checkbox input { width: auto; margin-top: 0.25rem; flex-shrink: 0; }

.declaration-section { border-color: #c5d4e8; }
.declaration-notice {
  background: #f8fafc;
  border-left: 4px solid var(--primary);
  padding: 1rem 1rem 1rem 1.1rem;
  margin-bottom: 1.25rem;
  border-radius: 0 8px 8px 0;
}
.declaration-lead { margin: 0 0 0.75rem; font-size: 0.95rem; }
.declaration-items {
  margin: 0;
  padding-left: 1.35rem;
  font-size: 0.92rem;
  color: var(--text);
}
.declaration-items li { margin-bottom: 0.55rem; }
.declaration-items li:last-child { margin-bottom: 0; }
.declaration-consents {
  border-top: 1px solid var(--border);
  padding-top: 1rem;
}
.declaration-checkbox {
  padding: 0.65rem 0.75rem;
  margin-bottom: 0.5rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fafbfc;
}
.declaration-checkbox span { line-height: 1.5; }
.declaration-signature {
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}
.declaration-sign-note {
  margin: 0 0 0.85rem;
  font-size: 0.9rem;
  color: var(--muted);
}
.signature-input {
  max-width: 320px;
  font-family: "KaiTi", "STKaiti", "SimKai", serif;
  font-size: 1.15rem;
  letter-spacing: 0.08em;
}
.declaration-meta { margin: 0.75rem 0 0; font-size: 0.85rem; }

fieldset { margin: 0 0 1.25rem; }
legend { font-weight: 700; padding: 0 0.25rem; }
.grid.two-col {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0 1rem;
}
.grid .full { grid-column: 1 / -1; }

.address-row {
  display: grid;
  grid-template-columns: 1fr 9rem;
  gap: 1rem;
  align-items: end;
}
.address-row label { margin-bottom: 0; }

.field-display {
  margin-bottom: 0.85rem;
}
.field-display .field-label {
  display: block;
  font-weight: 500;
  margin-bottom: 0.35rem;
}
.field-display .field-value {
  display: block;
  padding: 0.55rem 0.65rem;
  background: #eef3f8;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--muted);
  font-size: 0.95rem;
}

.sub-card {
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  margin-bottom: 0.75rem;
}
.sub-card h4 { margin: 0 0 0.75rem; }
.optional-card {
  border-style: dotted;
  background: #fafbfc;
}
.optional-card h4 { color: var(--muted); font-weight: 600; }

.alert {
  padding: 0.85rem 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
}
.alert.error { background: #fef3f2; color: var(--error); border: 1px solid #fecdca; }
.alert.success { background: #ecfdf3; color: var(--success); border: 1px solid #abefc6; }
.alert.warning { background: #fffaeb; color: var(--warning); border: 1px solid #fedf89; }

.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: #eef3f8;
  font-size: 0.85rem;
  white-space: nowrap;
}
.badge-success { background: #ecfdf3; color: var(--success); }

.form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1rem;
}
.form-actions-note {
  flex: 1 1 100%;
  margin: 0;
  font-size: 0.9rem;
}
.over-limit { color: var(--error); font-weight: 700; }

.photo-preview img {
  max-width: 120px;
  max-height: 160px;
  border-radius: 6px;
  border: 1px solid var(--border);
}

/* Headshot upload panel */
.headshot-panel {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  padding: 1rem;
  margin-bottom: 1rem;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 10px;
}
.headshot-panel.readonly { grid-template-columns: 1fr; }
.headshot-guide h4 { margin: 0 0 0.5rem; }
.headshot-rules {
  margin: 0.5rem 0 1rem;
  padding-left: 1.2rem;
  font-size: 0.92rem;
  color: var(--text);
}
.headshot-rules li { margin-bottom: 0.35rem; }

.headshot-examples {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.example-card {
  flex: 1;
  min-width: 90px;
  text-align: center;
  font-size: 0.8rem;
}
.example-frame {
  margin: 0 auto 0.35rem;
  border: 2px solid var(--border);
  border-radius: 6px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.example-frame.portrait { width: 60px; height: 80px; }
.example-frame.landscape { width: 80px; height: 60px; }
.example-frame.square { width: 60px; height: 60px; }
.example-card.good .example-frame { border-color: var(--success); background: #ecfdf3; }
.example-card.bad .example-frame { border-color: #fecdca; background: #fef3f2; }
.example-label { display: block; font-weight: 600; }
.example-card.good .example-label { color: var(--success); }
.example-card.bad .example-label { color: var(--error); }
.example-desc { display: block; color: var(--muted); font-size: 0.75rem; }

.headshot-upload {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}
.headshot-preview-wrap { text-align: center; }
.headshot-preview-frame {
  width: 120px;
  height: 160px;
  margin: 0 auto;
  border: 2px dashed var(--border);
  border-radius: 8px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}
.headshot-preview-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.headshot-preview-frame img.hidden { display: none; }
.headshot-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  color: var(--muted);
  font-size: 0.8rem;
}
.headshot-placeholder.hidden { display: none; }
.headshot-placeholder svg { width: 80px; height: auto; opacity: 0.7; }
.headshot-preview-caption { font-size: 0.85rem; color: var(--muted); margin: 0.35rem 0 0; }

.headshot-controls { width: 100%; max-width: 320px; }
.headshot-file-label { display: block; text-align: center; cursor: pointer; margin-bottom: 0.35rem; }
.headshot-file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  overflow: hidden;
}
.headshot-filename { text-align: center; margin: 0 0 0.75rem; font-size: 0.85rem; }

.headshot-checklist {
  list-style: none;
  padding: 0;
  margin: 0 0 0.75rem;
  font-size: 0.88rem;
}
.headshot-checklist li {
  padding: 0.3rem 0 0.3rem 1.5rem;
  position: relative;
  color: var(--muted);
}
.headshot-checklist li::before {
  content: '○';
  position: absolute;
  left: 0;
  color: var(--muted);
}
.headshot-checklist li.pass { color: var(--success); }
.headshot-checklist li.pass::before { content: '✓'; color: var(--success); }
.headshot-checklist li.fail { color: var(--error); }
.headshot-checklist li.fail::before { content: '✗'; color: var(--error); }

.headshot-confirm {
  font-size: 0.88rem;
  line-height: 1.5;
  padding: 0.65rem;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
}

@media (max-width: 720px) {
  .headshot-panel { grid-template-columns: 1fr; }
}
.inline-form { display: inline; }
.link-btn {
  background: none;
  border: none;
  color: var(--text);
  cursor: pointer;
  font: inherit;
  padding: 0;
  margin-left: 1rem;
}
.table { width: 100%; border-collapse: collapse; background: var(--surface); }
.table th, .table td {
  border: 1px solid var(--border);
  padding: 0.6rem 0.75rem;
  text-align: left;
}
.table th { background: #eef3f8; }

@media (max-width: 640px) {
  .header-inner { flex-direction: column; align-items: flex-start; }
  .site-header nav a { margin-left: 0; margin-right: 1rem; }
  .address-row { grid-template-columns: 1fr; }
}
