:root {
  --ink: #17313a;
  --muted: #62757b;
  --teal: #0f766e;
  --teal-dark: #0d5f59;
  --cream: #f6f4ee;
  --paper: #fffefb;
  --line: #d9e1df;
  --sun: #f1b44c;
  --danger: #b42318;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; color: var(--ink); background: radial-gradient(circle at 90% 0%, #e3f1ec 0, transparent 33%), var(--cream); font-family: "Noto Sans TC", "Microsoft JhengHei", sans-serif; }
button, input, select, textarea { font: inherit; }
button { touch-action: manipulation; }
[hidden] { display: none !important; }
.site-shell { width: min(1040px, calc(100% - 32px)); margin: 0 auto; padding: 28px 0 72px; }
.brand-bar { display: flex; align-items: center; gap: 14px; padding-bottom: 22px; border-bottom: 1px solid rgba(23, 49, 58, .12); }
.brand-logo { width: 64px; height: 64px; flex: 0 0 64px; object-fit: contain; }
.brand-bar h1 { margin: 0; font-size: clamp(19px, 3vw, 25px); letter-spacing: .03em; }
.eyebrow, .section-kicker { margin: 0; color: var(--teal); font-size: 12px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.secure-chip, .local-badge { margin-left: auto; padding: 8px 12px; border: 1px solid #b9d8d1; border-radius: 999px; color: var(--teal-dark); background: rgba(255, 255, 255, .66); font-size: 13px; font-weight: 700; white-space: nowrap; }
.local-badge { color: #8a5810; border-color: #ead2a8; background: #fff7e9; }
.form-card { margin-top: 30px; padding: clamp(22px, 4vw, 42px); border: 1px solid rgba(23, 49, 58, .11); border-radius: 24px; background: var(--paper); box-shadow: 0 24px 70px rgba(38, 66, 70, .1); }
.form-step { animation: step-in .22s ease-out; }
@keyframes step-in { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }
.card-heading { display: flex; align-items: center; gap: 14px; }
.card-heading h3 { margin: 3px 0 0; font-size: 22px; }
.number-badge { display: grid; place-items: center; width: 44px; height: 44px; flex: 0 0 44px; border-radius: 14px; color: var(--teal); background: #e4f1ed; font-weight: 900; }
.version { margin-left: auto; color: #7b8b8f; font-size: 13px; }
.notice-box { margin: 24px 0 18px; padding: 22px 24px; border: 1px solid #dce6e3; border-radius: 16px; background: #f8faf9; color: #435b61; line-height: 1.85; }
.notice-box p { margin: 0 0 12px; }
.notice-box p:last-child { margin-bottom: 0; }
.notice-box h4 { margin: 24px 0 9px; color: var(--ink); font-size: 17px; line-height: 1.55; }
.notice-box h4:first-of-type { margin-top: 0; }
.notice-box h5 { margin: 14px 0 3px; color: var(--ink); font-size: 15px; }
.privacy-section-title { padding-bottom: 7px; border-bottom: 1px solid #dce6e3; }
.privacy-loading { color: var(--muted); }
.privacy-list-item, .privacy-numbered-item { position: relative; padding-left: 20px; }
.privacy-list-item::before { content: "•"; position: absolute; left: 3px; color: var(--teal); font-weight: 900; }
.privacy-numbered-item::before { content: "–"; position: absolute; left: 3px; color: var(--teal); font-weight: 900; }
.privacy-inline-list-item { position: relative; margin-left: 4px !important; padding-left: 20px; }
.privacy-inline-list-item::before { content: "•"; position: absolute; left: 3px; color: var(--teal); font-weight: 900; }
.privacy-callout, .legal-copy blockquote { padding: 10px 14px; border-left: 3px solid #b9d8d1; background: rgba(255, 255, 255, .65); }
.privacy-nested { margin-left: 18px; }
.privacy-underline { text-decoration: underline; }
.legal-copy p, .legal-copy h4, .legal-copy h5, .legal-copy blockquote { white-space: pre-line; }
.legal-copy a { color: var(--teal-dark); }
.legal-copy hr { border: 0; border-top: 1px solid var(--line); }
.consent-row { display: flex; gap: 12px; align-items: flex-start; padding: 16px 0; line-height: 1.6; cursor: pointer; }
.consent-row input, .choice input { width: 19px; height: 19px; margin-top: 3px; accent-color: var(--teal); }
.consent-panel { margin-top: 20px; padding: 18px 20px; border: 1px solid #b9d8d1; border-radius: 14px; background: #edf6f3; }
.consent-panel h4 { margin: 0 0 10px; color: var(--teal-dark); font-size: 16px; }
.consent-panel .consent-row { padding: 0; color: #27464d; }
.consent-panel .consent-row span { flex: 1; }
.consent-panel .consent-row em { font-style: normal; font-weight: 700; }
.identity-panel { display: grid; grid-template-columns: 54px 1fr; gap: 16px; align-items: start; margin: 26px 0; padding: 24px; border: 1px solid var(--line); border-radius: 18px; background: #fbfcfa; }
.identity-icon { display: grid; place-items: center; width: 54px; height: 54px; border-radius: 16px; color: white; background: var(--teal); font-size: 24px; font-weight: 900; }
.identity-panel h4 { margin: 0 0 6px; font-size: 18px; }
.identity-panel p { margin: 0; color: var(--muted); line-height: 1.7; }
.full-field { max-width: 700px; }
.inline-field { display: flex; gap: 10px; }
.inline-field input { flex: 1; }
.secondary-button { min-width: 120px; padding: 12px 16px; border: 1px solid #afcbc5; border-radius: 11px; color: var(--teal-dark); background: #edf6f3; font-weight: 800; cursor: pointer; }
.success-note, .error-note { margin: 14px 0 0; padding: 11px 14px; border-radius: 10px; color: #16664f; background: #e9f6f0; font-size: 14px; }
.error-note { color: var(--danger); background: #fff0ee; }
.data-section { min-width: 0; margin: 32px 0 0; padding: 26px 0 0; border: 0; border-top: 1px solid var(--line); }
.data-section.inline-data-section { margin-top: 20px; padding-top: 0; border-top: 0; }
.data-section legend { padding: 0 14px 0 0; color: var(--ink); font-size: 18px; font-weight: 900; }
.section-note { margin: -6px 0 20px; color: var(--muted); font-size: 14px; line-height: 1.65; }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.field { display: flex; flex-direction: column; gap: 8px; min-width: 0; color: #314b52; font-size: 14px; font-weight: 750; }
.field input, .field select, .field textarea { width: 100%; border: 1px solid #cdd8d5; border-radius: 11px; outline: none; color: var(--ink); background: white; transition: border-color .15s, box-shadow .15s; }
.field input.field-invalid, .field select.field-invalid, .field textarea.field-invalid { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(190, 55, 45, .12); }
.field-error-message { display: block; margin: -2px 0 0; color: var(--danger); font-size: 13px; font-weight: 700; line-height: 1.45; }
.collection-invalid > .choice-grid, .collection-invalid > .structured-list { padding: 10px; border: 1px solid var(--danger); border-radius: 12px; box-shadow: 0 0 0 3px rgba(190, 55, 45, .08); }
.field input, .field select { min-height: 47px; padding: 11px 13px; }
.field textarea { resize: vertical; min-height: 96px; padding: 12px 13px; line-height: 1.65; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(15, 118, 110, .12); }
.field small { color: #7b8b8f; font-weight: 500; line-height: 1.45; }
.field-title-row, .entry-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.field-group-title { color: #213e46; font-size: 15px; font-weight: 850; }
.address-contact-group, .contact-group { gap: 12px; padding: 15px; border: 1px solid #d9e2df; border-radius: 13px; background: #f9fbfa; }
.address-contact-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(190px, 1fr); gap: 16px; align-items: start; }
.contact-inline-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.inline-check { display: inline-flex; align-items: center; gap: 7px; color: var(--teal-dark); font-size: 13px; font-weight: 700; cursor: pointer; }
.inline-check input { width: 17px; min-height: 17px; height: 17px; padding: 0; accent-color: var(--teal); }
.inline-check.disabled { color: #94a09f; cursor: not-allowed; }
.conditional-field { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; padding: 14px; border: 1px dashed #bfd0cc; border-radius: 11px; background: #f8fbfa; }
.structured-list { display: grid; gap: 12px; }
.structured-entry { padding: 15px; border: 1px solid #d9e2df; border-radius: 13px; background: #f9fbfa; }
.entry-heading strong { color: #53666b; font-size: 13px; }
.entry-buttons { display: flex; gap: 7px; }
.entry-summary { margin: 10px 0 0; color: #314b52; font-size: 14px; font-weight: 600; line-height: 1.65; overflow-wrap: anywhere; }
.empty-entry-note { margin: 0; padding: 18px; border: 1px dashed #c8d6d2; border-radius: 12px; color: #7b8b8f; background: #fbfcfb; text-align: center; font-size: 14px; font-weight: 500; }
.add-entry-button, .edit-entry-button, .remove-entry-button { border: 1px solid #b8d1cb; border-radius: 9px; color: var(--teal-dark); background: #edf6f3; font: inherit; font-size: 13px; font-weight: 800; cursor: pointer; }
.add-entry-button { padding: 8px 11px; }
.edit-entry-button, .remove-entry-button { padding: 5px 9px; }
.remove-entry-button { padding: 5px 9px; color: #8c4a44; border-color: #e2c3bf; background: #fff5f3; }
.add-entry-button:hover, .edit-entry-button:hover { background: #dfeeea; }
.remove-entry-button:hover { background: #fbe8e4; }
.field textarea[readonly] { color: #53666b; background: #f1f5f3; cursor: not-allowed; }
.span-2 { grid-column: 1 / -1; }
.choice-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.choice { display: flex; align-items: center; gap: 7px; padding: 9px 12px; border: 1px solid #d2dcda; border-radius: 999px; color: #435b61; background: #fafbf9; cursor: pointer; font-weight: 600; }
.choice input { width: 16px; height: 16px; margin: 0; }
.statement-box { margin-top: 28px; font-size: 16px; }
.enneagram-step-heading { margin-bottom: 34px; }
.enneagram-heading { margin-bottom: 42px; text-align: center; }
.enneagram-heading h3 { margin: 0; color: #111827; font-size: clamp(25px, 4vw, 32px); letter-spacing: .04em; }
.enneagram-heading p { display: inline-block; margin: 12px 0 0; padding-bottom: 5px; border-bottom: 2px solid #111827; color: #111827; font-size: 17px; font-weight: 800; }
.enneagram-intro { margin-bottom: 38px; color: #5d646f; font-size: 16px; line-height: 1.75; }
.enneagram-intro p { margin: 0 0 7px; }
.enneagram-status { margin: 28px 0; padding: 24px; border: 1px dashed #bfd0cc; border-radius: 14px; color: var(--muted); background: #f8fbfa; text-align: center; font-weight: 700; }
#enneagram-load-error { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
#enneagram-load-error .back-button { flex: 0 0 auto; padding: 9px 13px; }
.enneagram-quiz { margin-top: 26px; }
.enneagram-progress-row { display: flex; justify-content: space-between; gap: 14px; color: #52666b; font-size: 14px; }
.enneagram-progress-track { height: 9px; margin: 10px 0 28px; overflow: hidden; border-radius: 999px; background: #e2e9e7; }
#enneagram-progress-bar { width: 0; height: 100%; border-radius: inherit; background: var(--teal); transition: width .2s ease; }
.enneagram-question-number { margin: 0 0 8px; color: var(--teal-dark); font-size: 14px; font-weight: 900; }
.enneagram-question-title { margin: 0 0 16px; font-size: 19px; }
.enneagram-options { display: grid; gap: 12px; }
.enneagram-option { display: flex; align-items: flex-start; gap: 13px; padding: 18px; border: 1px solid #ccd9d6; border-radius: 14px; color: #314b52; background: #fff; line-height: 1.65; cursor: pointer; transition: border-color .15s, background .15s, box-shadow .15s; }
.enneagram-option:hover { border-color: #9fc5bc; background: #f8fbfa; }
.enneagram-option.selected { border-color: var(--teal); background: #edf6f3; box-shadow: 0 0 0 3px rgba(15, 118, 110, .09); }
.enneagram-option input { width: 19px; height: 19px; flex: 0 0 19px; margin: 3px 0 0; accent-color: var(--teal); }
.enneagram-actions { display: flex; justify-content: space-between; gap: 12px; margin-top: 28px; padding-top: 22px; border-top: 1px solid var(--line); }
.form-actions { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 34px; padding-top: 24px; border-top: 1px solid var(--line); }
.primary-button, .back-button { padding: 14px 22px; border-radius: 12px; font-weight: 800; cursor: pointer; }
.primary-button { min-width: 220px; border: 0; color: white; background: var(--teal); box-shadow: 0 12px 25px rgba(15, 118, 110, .2); }
.primary-button:hover { background: var(--teal-dark); }
.primary-button:disabled { color: #8c999b; background: #dfe5e3; box-shadow: none; cursor: not-allowed; }
.back-button { border: 1px solid #d4ddda; color: #53666b; background: white; }
.completion { padding: 44px 10px; text-align: center; }
.completion h3 { margin: 10px 0 8px; font-size: 28px; }
.completion p:last-child { max-width: 600px; margin: 0 auto; color: var(--muted); line-height: 1.7; }
.success-mark { display: grid; place-items: center; width: 72px; height: 72px; margin: 0 auto 20px; border-radius: 50%; color: white; background: var(--teal); font-size: 34px; font-weight: 900; box-shadow: 0 14px 30px rgba(15, 118, 110, .2); }
.privacy-footer { margin: 18px 0 0; color: #7a898d; text-align: center; font-size: 12px; }
.trap { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.visually-hidden { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }
.entry-dialog { width: min(760px, calc(100% - 28px)); max-height: calc(100vh - 32px); padding: 0; border: 0; border-radius: 20px; color: var(--ink); background: var(--paper); box-shadow: 0 28px 90px rgba(18, 37, 42, .28); }
.entry-dialog::backdrop { background: rgba(18, 37, 42, .52); backdrop-filter: blur(2px); }
.entry-dialog-card { margin: 0; }
.entry-dialog-header { display: flex; justify-content: space-between; align-items: center; gap: 18px; padding: 20px 24px; border-bottom: 1px solid var(--line); }
.entry-dialog-header h3 { margin: 0; font-size: 21px; }
.dialog-close-button { width: 38px; height: 38px; border: 0; border-radius: 50%; color: #66777b; background: transparent; font-size: 28px; line-height: 1; cursor: pointer; }
.dialog-close-button:hover { background: #eef2f0; }
.entry-dialog-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; padding: 24px; }
.dialog-field { display: flex; flex-direction: column; gap: 8px; color: #314b52; font-size: 14px; font-weight: 750; }
.dialog-field-wide { grid-column: 1 / -1; }
.dialog-field input, .dialog-field select, .dialog-field textarea { width: 100%; min-height: 47px; padding: 11px 13px; border: 1px solid #cdd8d5; border-radius: 11px; outline: none; color: var(--ink); background: white; font: inherit; }
.dialog-field input:disabled { border-color: #d7dddb; color: #8a9698; background: #ecefee; cursor: not-allowed; opacity: 1; -webkit-text-fill-color: #8a9698; }
.dialog-field textarea { resize: vertical; min-height: 96px; line-height: 1.6; }
.dialog-field input:focus, .dialog-field select:focus, .dialog-field textarea:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(15, 118, 110, .12); }
.dialog-checkbox-field { grid-column: 2; flex-direction: row; align-items: center; align-self: start; cursor: pointer; }
.dialog-checkbox-field input { width: 20px; min-height: 20px; margin: 0; padding: 0; accent-color: var(--teal); }
.entry-dialog-actions { display: flex; justify-content: flex-end; gap: 12px; padding: 18px 24px 24px; border-top: 1px solid var(--line); }
.entry-dialog-actions .primary-button { min-width: 130px; }

@media (min-width: 880px) { .step small { display: block; } }
@media (max-width: 720px) {
  .site-shell { width: min(100% - 22px, 1040px); padding-top: 16px; }
  .secure-chip { display: none; }
  .form-card { margin-top: 22px; padding: 22px 18px; border-radius: 18px; }
  .version, .local-badge { display: none; }
  .field-grid { grid-template-columns: 1fr; }
  .address-contact-grid, .contact-inline-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .inline-field { flex-direction: column; }
  .secondary-button { width: 100%; }
  .form-actions { align-items: stretch; }
  .primary-button { min-width: 0; flex: 1; }
  .entry-dialog-fields { grid-template-columns: 1fr; padding: 20px; }
  .dialog-field-wide { grid-column: auto; }
  .dialog-checkbox-field { grid-column: auto; }
  .entry-dialog-actions { align-items: stretch; }
  .entry-dialog-actions .back-button, .entry-dialog-actions .primary-button { flex: 1; }
  #enneagram-load-error { align-items: stretch; flex-direction: column; }
  .enneagram-actions .back-button, .enneagram-actions .primary-button { flex: 1; min-width: 0; }
}

@media (max-width: 460px) {
  .identity-panel { grid-template-columns: 1fr; }
  .form-actions { flex-direction: column-reverse; }
  .back-button, .primary-button { width: 100%; }
  .enneagram-actions { flex-direction: column-reverse; }
}

@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; animation: none !important; transition: none !important; } }
