* { box-sizing: border-box; }
body {
  font-family: "Microsoft JhengHei", "PingFang TC", -apple-system, sans-serif;
  background: #f4f5f7;
  color: #222;
  margin: 0;
  padding: 24px 12px 80px;
}
.page {
  max-width: 900px;
  margin: 0 auto;
  background: #fff;
  border-radius: 10px;
  padding: 28px 32px;
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
}
.company-logo { display: block; max-width: 220px; height: auto; margin: 0 0 16px; }
h1 { margin-top: 0; font-size: 1.6rem; }
.hint { color: #666; margin-top: -8px; font-size: .9rem; }
section {
  border-top: 1px solid #e3e5e8;
  padding: 18px 0;
}
section h2 {
  font-size: 1.05rem;
  margin: 0 0 12px;
  color: #1a4a8a;
}
.grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px 20px;
}
label {
  display: flex;
  flex-direction: column;
  font-size: .85rem;
  color: #444;
  gap: 4px;
}
label.inline {
  flex-direction: row;
  align-items: center;
  gap: 4px;
  font-size: .9rem;
  color: #222;
}
input[type=text], input[type=number], input[type=email], select, textarea {
  font-size: .95rem;
  padding: 6px 8px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-family: inherit;
}
textarea { resize: vertical; }
.ymd, .ymd-range { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.ymd input, .ymd-range input { width: 90px; }
.two-col { display: flex; gap: 8px; }
.radio-row { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; }
.radio-col { display: flex; flex-direction: column; gap: 8px; }
.conditional {
  margin-top: 6px;
}
.conditional[hidden] { display: none; }
table.datatable {
  width: 100%;
  border-collapse: collapse;
  font-size: .85rem;
  margin-top: 6px;
}
table.datatable th, table.datatable td {
  border: 1px solid #d8dade;
  padding: 6px;
  text-align: left;
}
table.datatable th { background: #f0f2f5; }
table.datatable input, table.datatable select { width: 100%; min-width: 70px; }
.btn-secondary {
  margin-top: 8px;
  background: #eef1f5;
  border: 1px solid #ccc;
  border-radius: 6px;
  padding: 6px 12px;
  cursor: pointer;
  font-size: .85rem;
}
.submit-row { padding-top: 20px; text-align: center; }
#submitBtn {
  background: #1a4a8a;
  color: #fff;
  border: none;
  padding: 12px 32px;
  font-size: 1rem;
  border-radius: 8px;
  cursor: pointer;
}
#submitBtn:disabled { opacity: .6; cursor: not-allowed; }
.msgbox {
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: .9rem;
}
.msgbox.success { background: #e6f6ea; color: #1a7d3a; border: 1px solid #b6e6c3; }
.msgbox.error { background: #fdeaea; color: #a02020; border: 1px solid #f3bcbc; }
.msgbox.info { background: #eaf1fb; color: #1a4a8a; border: 1px solid #bcd4f3; }
.declaration-text { font-size: .85rem; color: #555; }
.remove-row { background: #f8d7da; border: 1px solid #f1aeb5; border-radius: 4px; cursor: pointer; }
.privacy-notice {
  max-height: 320px;
  overflow-y: auto;
  border: 1px solid #d8dade;
  border-radius: 8px;
  padding: 14px 18px;
  background: #fafbfc;
  font-size: .85rem;
  line-height: 1.7;
  color: #333;
}
.privacy-notice p { margin: 0 0 10px; }
.privacy-notice p:last-child { margin-bottom: 0; }
.privacy-notice ul { margin: 6px 0 12px; padding-left: 20px; }
.privacy-notice li { margin-bottom: 4px; }
.field-error {
  color: #a02020;
  font-size: .78rem;
}
.consent-checkbox {
  margin-top: 12px;
  font-size: .9rem;
  font-weight: 600;
}

.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, .85);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  z-index: 1000;
}
.loading-overlay[hidden] { display: none; }
.spinner {
  width: 48px;
  height: 48px;
  border: 5px solid #d8dade;
  border-top-color: #1a4a8a;
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
.loading-overlay p { color: #1a4a8a; font-size: .95rem; margin: 0; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 640px) {
  body { padding: 12px 8px 60px; }
  .page { padding: 16px 14px; border-radius: 8px; }
  h1 { font-size: 1.3rem; }
  .grid { grid-template-columns: 1fr; }
  .two-col { flex-direction: column; }
  .ymd input, .ymd-range input { width: 64px; }
  table.datatable, table.list { font-size: .8rem; }
  table.datatable th, table.datatable td, table.list th, table.list td { padding: 4px; }
  .submit-row { padding-top: 14px; }
  #submitBtn { width: 100%; padding: 14px; font-size: .95rem; }
  .privacy-notice { max-height: 220px; padding: 10px 12px; font-size: .8rem; }
}
