* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  background: #f5f7fa;
  color: #333;
  line-height: 1.8;
}
.container { max-width: 780px; margin: 0 auto; padding: 20px; }
.logo-bar {
  text-align: center;
  background: #fff;
  padding: 18px 20px 14px;
  border-radius: 12px 12px 0 0;
}
.doc-logo { max-height: 64px; width: auto; }
.header {
  text-align: center;
  background: linear-gradient(135deg, #f08888 0%, #dc7e7e 100%);
  color: #fff;
  padding: 22px 20px;
}
.header h1 { font-size: 20px; margin-bottom: 4px; }
.header p  { font-size: 13px; opacity: 0.85; }

.card {
  background: #fff;
  padding: 24px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.07);
  margin-bottom: 2px;
}
.card:last-of-type { border-radius: 0 0 12px 12px; }
.card h3 {
  font-size: 15px; font-weight: 700;
  margin-bottom: 14px; padding-bottom: 8px;
  border-bottom: 2px solid #f08888;
  color: #dc7e7e;
}

/* 授權書本文樣式 */
.doc-wrap {
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 28px 32px;
  font-size: 16px;
  line-height: 1.9;
  color: #2c2c2c;
}
.doc-title {
  text-align: center;
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 4px;
  letter-spacing: 1px;
}
.doc-subtitle {
  text-align: center;
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 20px;
  letter-spacing: 1px;
}
.doc-hr { border: none; border-top: 1.5px solid #ccc; margin: 16px 0; }
.doc-section-title {
  font-size: 17px;
  font-weight: 700;
  margin: 18px 0 8px;
}
.doc-wrap p { margin-bottom: 8px; }
.doc-wrap ul { padding-left: 24px; margin-bottom: 8px; }
.doc-wrap ul li { margin-bottom: 4px; }
.doc-wrap ol { padding-left: 24px; margin-bottom: 8px; }
.doc-wrap ol li { margin-bottom: 4px; }
.doc-wrap ol.sub-ol { list-style-type: lower-alpha; }
.doc-note { color: #666; font-size: 13px; margin-top: 4px; }

/* 簽署區 */
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-weight: 600; font-size: 15px; margin-bottom: 6px; }
.form-group label .req { color: #e74c3c; }
.form-group input {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid #ddd;
  border-radius: 8px;
  font-size: 15px;
  transition: border-color 0.2s;
}
.form-group input:focus { outline: none; border-color: #f08888; box-shadow: 0 0 0 3px rgba(240,136,136,0.15); }
.errorlist { list-style: none; margin: 6px 0 0; padding: 0; color: #e74c3c; font-size: 15px; }
.has-error input { border-color: #e74c3c !important; background: #fff8f8; }
.has-error .canvas-wrapper { border-color: #e74c3c !important; }

.check-group { margin-bottom: 10px; }
.check-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  border: 1.5px solid #e0e0e0; border-radius: 8px;
  margin-bottom: 8px; cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
.check-item:hover { border-color: #f08888; background: #fff5f5; }
.check-item.checked { border-color: #f08888; background: #fff5f5; }
.check-item input[type="checkbox"] { width: 18px; height: 18px; accent-color: #f08888; cursor: pointer; flex-shrink: 0; }
.check-item label { font-size: 16px; cursor: pointer; }

.sig-label { font-weight: 600; font-size: 14px; margin-bottom: 8px; }
.canvas-wrapper {
  background: #fff; border: 2px solid #ccc;
  border-radius: 8px; position: relative;
  touch-action: none; cursor: crosshair;
}
.canvas-wrapper.active { border-color: #f08888; }
canvas { display: block; border-radius: 6px; width: 100%; }
.guide-line { position: absolute; bottom: 36px; left: 14px; right: 14px; border-bottom: 1px dashed #ddd; pointer-events: none; }
.sig-hint { font-size: 12px; color: #aaa; margin-top: 6px; text-align: center; }
.btn-clear {
  margin-top: 8px; padding: 6px 16px; font-size: 13px;
  background: #f0f0f0; border: 1px solid #ddd; border-radius: 6px;
  cursor: pointer; color: #666;
}
.btn-clear:hover { background: #e8e8e8; }

.notice {
  font-size: 14px; color: #666;
  background: #fff8e1; border-left: 3px solid #f59e0b;
  padding: 10px 14px; border-radius: 0 6px 6px 0;
  margin-bottom: 14px; line-height: 1.6;
}

.submit-wrap { text-align: center; padding-top: 8px; }
.btn-submit {
  padding: 15px 56px; font-size: 17px; font-weight: 700;
  background: linear-gradient(135deg, #f08888 0%, #dc7e7e 100%);
  color: #fff; border: none; border-radius: 12px; cursor: pointer;
  box-shadow: 0 4px 15px rgba(240,136,136,0.3);
  transition: all 0.25s;
}
.btn-submit:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(240,136,136,0.4); }
.btn-submit:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.55); z-index: 1000;
  justify-content: center; align-items: center;
}
.result-card {
  background: #fff; padding: 36px 32px; border-radius: 16px;
  text-align: center; max-width: 380px; margin: 20px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}
.result-card .icon { font-size: 56px; margin-bottom: 12px; }
.result-card h3 { font-size: 22px; margin-bottom: 10px; }
.result-card p { color: #666; font-size: 14px; line-height: 1.6; }
.ref-no {
  font-family: monospace; background: #f0f2f5;
  padding: 8px 16px; border-radius: 6px;
  display: inline-block; margin-top: 12px;
  font-size: 15px; font-weight: 600;
}

/* 平板：769px – 1300px */
@media (min-width: 769px) and (max-width: 1300px) {
  .container { padding: 14px; }
  .card { padding: 20px; }
  .doc-wrap { padding: 22px 24px; }
}

/* 手機：≤ 768px */
@media (max-width: 768px) {
  .container { padding: 8px; }
  .card { padding: 14px; }
  .logo-bar { border-radius: 8px 8px 0 0; padding: 14px 14px 10px; }
  .doc-logo { max-height: 50px; }
  .header { padding: 18px 14px; }
  .header h1 { font-size: 18px; }
  .header p { font-size: 13px; }
  .card h3 { font-size: 15px; }
  .doc-wrap { padding: 16px 13px; font-size: 15px; }
  .doc-section-title { font-size: 16px; }
  .sig-hint { font-size: 13px; }
  .check-item { font-size: 15px; padding: 9px 11px; gap: 8px; }
  .form-group input { font-size: 16px; padding: 10px 12px; } /* 16px 避免 iOS 自動縮放 */
  .errorlist { font-size: 16px; }
  .form-group input[type="date"] {
    -webkit-appearance: none; appearance: none;
    width: 100%; min-width: 0;
    height: 44px; color: #333; background: #fff;
    border: 1.5px solid #ddd; border-radius: 8px;
    padding: 10px 12px; font-size: 16px;
  }
  .notice { font-size: 14px; padding: 9px 12px; }
  .btn-submit { width: 100%; padding: 14px 20px; font-size: 16px; }
}
