:root {
  color-scheme: light;
  --fg: #1a1a1a;
  --muted: #6b6b6b;
  --border: #d8d8d8;
  --accent: #0a6e4e;
  --accent-contrast: #ffffff;
  --error: #b3261e;
  --bg: #fafaf8;
  --radius: 10px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans Thai", sans-serif;
  color: var(--fg);
  background: var(--bg);
  line-height: 1.5;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  background: #fff;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
}

.brand {
  font-weight: 600;
  font-size: 1rem;
}

.lang-toggle a {
  margin-left: 0.75rem;
  text-decoration: none;
  color: var(--muted);
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
}

.lang-toggle a[aria-current="true"] {
  color: var(--accent);
  font-weight: 600;
  background: #eef7f3;
}

main {
  max-width: 480px;
  margin: 0 auto;
  padding: 1rem;
}

h1, h2 {
  font-size: 1.25rem;
  margin: 0.5rem 0 1rem;
}

fieldset {
  border: none;
  padding: 0;
  margin: 0 0 1rem;
}

fieldset legend {
  font-weight: 600;
  margin-bottom: 0.4rem;
  padding: 0;
}

.required-note {
  color: var(--muted);
  font-size: 0.82rem;
  margin: -0.25rem 0 1rem;
}

.required-mark {
  color: var(--error);
}

.optional-mark {
  color: var(--muted);
  font-weight: 400;
  font-size: 0.85em;
}

.entity-type label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  margin-right: 0.5rem;
  min-height: 44px;
}

.field {
  display: block;
  margin-bottom: 1rem;
}

.field > span {
  display: block;
  font-weight: 600;
  margin-bottom: 0.3rem;
  font-size: 0.92rem;
}

input[type="text"],
input[type="tel"],
input[type="email"],
textarea {
  width: 100%;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
  min-height: 44px;
  background: #fff;
}

textarea {
  min-height: 80px;
  resize: vertical;
}

.help {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  margin-top: 0.25rem;
}

.error {
  display: block;
  color: var(--error);
  font-size: 0.82rem;
  margin-top: 0.25rem;
  min-height: 1em;
}

.email-suggestion {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.85rem;
}

.email-suggestion button {
  border: none;
  background: none;
  color: var(--accent);
  text-decoration: underline;
  cursor: pointer;
  font: inherit;
  padding: 0;
}

.file-input-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.attach-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  margin-top: 0.4rem;
  padding: 1.5rem 1rem;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  background: #fff;
  text-align: center;
  min-height: 130px;
  transition: border-color 0.15s, background 0.15s;
}

.attach-zone:hover,
.attach-zone:focus-within {
  border-color: var(--accent);
  background: #eef7f3;
}

.attach-icon {
  width: 2.25rem;
  height: 2.25rem;
  color: var(--accent);
}

.attach-zone-label {
  font-size: 0.975rem;
  font-weight: 600;
  color: var(--accent);
}

.attach-zone-hint {
  font-size: 0.78rem;
  color: var(--muted);
}

.attach-preview {
  margin-top: 0.75rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem;
}

.attach-preview img {
  width: 80px;
  height: 80px;
  border-radius: 8px;
  border: 1px solid var(--border);
  object-fit: cover;
  flex-shrink: 0;
}

.consent-wrap {
  margin-bottom: 1rem;
}

.consent-label {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  cursor: pointer;
}

.consent-label input[type="checkbox"] {
  margin-top: 0.15rem;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.consent-label span {
  font-size: 0.95rem;
  line-height: 1.4;
}

.privacy-link-btn {
  all: unset;
  display: block;
  margin-top: 0.4rem;
  color: var(--accent);
  font-size: 0.875rem;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

button {
  display: block;
  width: 100%;
  min-height: 48px;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  border: none;
  background: var(--accent);
  color: var(--accent-contrast);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  margin-top: 0.5rem;
}

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

button.secondary {
  background: none;
  color: var(--accent);
  border: 1px solid var(--border);
}

.attach-remove {
  width: auto;
  background: none;
  color: var(--error);
  border: 1px solid var(--error);
  padding: 0.4rem 0.7rem;
  min-height: 36px;
}

.review-section-label {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 1.25rem 0 0.3rem;
}

.review-summary {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.25rem 1rem;
  margin: 0;
}

.cf-turnstile {
  margin-top: 1.25rem;
}

.review-row {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid #eee;
}

.review-row:last-child {
  border-bottom: none;
}

.review-row dt {
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.review-row dd {
  margin: 0;
  font-size: 1rem;
  word-break: break-word;
  white-space: pre-line;
}

.review-row--highlight dd {
  font-weight: 600;
  font-size: 1.05rem;
}

.review-email-callout {
  background: #eef7f3;
  border: 2px solid var(--accent);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  margin: 1rem 0 0.25rem;
}

.review-email-callout-title {
  margin: 0 0 0.2rem;
  font-size: 0.82rem;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.review-email-callout-value {
  margin: 0 0 0.35rem;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--accent);
  word-break: break-all;
}

.review-email-callout-note {
  margin: 0 0 0.85rem;
  font-size: 0.82rem;
  color: var(--muted);
}

.review-confirm-label {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  cursor: pointer;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(10, 110, 78, 0.25);
}

.review-confirm-label input[type="checkbox"] {
  margin-top: 0.1rem;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  accent-color: var(--accent);
}

.review-confirm-label span {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--accent);
  line-height: 1.4;
}

#success {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  margin-top: 1rem;
}

[hidden] {
  display: none !important;
}

/* ── Privacy modal ── */

#privacy-modal {
  position: fixed;
  inset: 0;
  z-index: 999;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: stretch;
}

@media (min-width: 600px) {
  #privacy-modal {
    align-items: center;
    justify-content: center;
    padding: 1rem;
  }
}

.modal-inner {
  display: flex;
  flex-direction: column;
  background: #fff;
  width: 100%;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

@media (min-width: 600px) {
  .modal-inner {
    flex: none;
    width: min(600px, 100%);
    max-height: 88vh;
    border-radius: 14px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.2);
  }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1rem 0.85rem 1.25rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: #fff;
}

.modal-header h2 {
  margin: 0;
  font-size: 1.05rem;
}

.modal-close-x {
  all: unset;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  color: var(--muted);
  cursor: pointer;
  flex-shrink: 0;
}

.modal-close-x:hover {
  background: #f0f0f0;
  color: var(--fg);
}

.modal-close-x svg {
  width: 20px;
  height: 20px;
}

.modal-footer {
  display: flex;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border);
  background: #fff;
  flex-shrink: 0;
}

.modal-btn-close {
  all: unset;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  color: var(--fg);
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  text-align: center;
}

.modal-btn-close:hover {
  background: #f5f5f5;
}

.modal-btn-accept {
  all: unset;
  flex: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
}

.modal-btn-accept:hover {
  opacity: 0.9;
}

.modal-body {
  padding: 1.1rem 1.25rem 1.5rem;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  flex: 1;
  min-height: 0;
}

.privacy-content h3 {
  font-size: 0.95rem;
  font-weight: 700;
  margin: 1.5rem 0 0.4rem;
  color: var(--fg);
}

.privacy-content h3:first-of-type {
  margin-top: 1rem;
}

.privacy-content p {
  margin: 0 0 0.75rem;
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--fg);
}

.privacy-content ul {
  margin: 0 0 0.75rem;
  padding-left: 1.4rem;
}

.privacy-content li {
  font-size: 0.9rem;
  line-height: 1.6;
  margin-bottom: 0.25rem;
}

/* ── Privacy standalone page ── */

.privacy-page {
  max-width: 680px;
  margin: 2rem auto;
  padding: 0 1rem;
  font-size: 0.95rem;
  line-height: 1.7;
}

.privacy-page h3 {
  font-size: 1rem;
  margin-top: 1.75rem;
}
