/* =========================================================================
   tools/wht-cert/style.css — ใบหัก ณ ที่จ่าย 50 ทวิ
   ========================================================================= */

/* Theme override (เขียวให้เข้าชุด WHT) */
body {
  --blue:        #22C485;
  --blue-dark:   #1AAC73;
  --primary-bg:  #E8F8F1;
  --primary-mid: #C9F0DD;
  --primary-tint: rgba(34, 196, 133, 0.12);
  --primary-text: #15803D;
  --accent-light: #6FE3B0;
}

/* ใช้พื้นที่เต็มหน้าจอ ไม่จำกัดความกว้าง */
body .container {
  max-width: 100%;
  padding: 0;
}
body .site-header-inner {
  max-width: 100%;
  padding: 0.85rem 1.5rem;
}

/* Back link */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
  margin: 1.25rem 0 0 1.5rem;
  padding: 0.5rem 1rem;
  background: #fff;
  border-radius: 999px;
  box-shadow: var(--shadow-pill);
  transition: color 0.15s;
}
.back-link:hover { color: var(--blue); }

/* ============ Layout ============ */
.cert-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  gap: 0;
  background: #FAFBFC;
  margin-top: 1.25rem;
  align-items: stretch;
}
.cert-form {
  padding: 2rem 2rem 3rem;
  min-width: 0;
}
.cert-preview {
  padding: 2rem 2rem 3rem;
  min-width: 0;
  background: #F1F5F9;
}

@media (max-width: 900px) {
  .cert-layout {
    grid-template-columns: 1fr;
  }
  .cert-form,
  .cert-preview { padding: 1.25rem 1rem 1.5rem; }
}

/* ============ Form column ============ */
.page-title {
  font-size: clamp(1.6rem, 4vw, 2rem);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.2;
  margin-bottom: 0.6rem;
  color: var(--text);
}
.page-subtitle {
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.6;
  margin-bottom: 2rem;
}

.form-card {
  background: #fff;
  border: 1px solid var(--border-soft);
  border-radius: 16px;
  padding: 1.5rem 1.75rem;
  box-shadow: 0 1px 3px rgba(15,23,42,0.04), 0 6px 18px rgba(15,23,42,0.04);
}

/* Section in form */
.form-section {
  padding: 1rem 0;
  border-top: 1px solid var(--border-soft);
}
.form-section:first-of-type {
  padding-top: 0;
  border-top: none;
}
.form-section-title {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 1.1rem;
}
.form-section-hint {
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.8rem;
  color: var(--muted);
  opacity: 0.8;
  margin-left: 0.4rem;
}

/* ============ Party section (ผู้จ่าย / ผู้รับ) — แยกชัด ============ */
.party-section.form-section {
  padding: 1.4rem 1.4rem 1.25rem;
  border-top: none;
  border: 1.5px solid;
  border-radius: 14px;
  margin: 0 0 1rem;
  position: relative;
}
.party-section + .form-section {
  border-top: 1px solid var(--border-soft);
  padding-top: 1.5rem;
  margin-top: 0.5rem;
}
.party-section-payer {
  background: linear-gradient(180deg, #F0FBF5 0%, #FAFEFC 100%);
  border-color: var(--accent-light);
}
.party-section-payee {
  background: linear-gradient(180deg, #F8FAFC 0%, #FFFFFF 100%);
  border-color: #CBD5E1;
}

/* Override form-section-title inside party-section */
.party-section .form-section-title {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
  font-size: 0.95rem;
  font-weight: 600;
  text-transform: none;
  letter-spacing: -0.005em;
  color: var(--text);
  padding-bottom: 0.9rem;
  margin: 0 0 1.1rem;
  border-bottom: 1px dashed rgba(15,23,42,0.08);
}

/* Pill tags */
.party-tag {
  background: var(--blue);
  color: #fff;
  padding: 0.28rem 0.7rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(34,196,133,0.25);
}
.party-tag-payee {
  background: #475569;
  box-shadow: 0 2px 6px rgba(71,85,105,0.20);
}

.party-name {
  color: var(--text);
  font-weight: 600;
}

/* Field — underline style */
.field { margin-bottom: 1.1rem; }
.field:last-child { margin-bottom: 0; }
.field-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.45rem;
  letter-spacing: -0.005em;
}
.field-input {
  display: flex;
  align-items: baseline;
  gap: 0.55rem;
  border-bottom: 1.5px solid var(--border);
  padding-bottom: 0.4rem;
  transition: border-color 0.15s;
}
.field-input:focus-within { border-color: var(--blue); }
.field-prefix,
.field-suffix {
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--muted);
  line-height: 1;
  flex-shrink: 0;
}
.field-suffix { font-size: 0.95rem; }
.field-input input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 1.05rem;
  font-weight: 500;
  font-family: inherit;
  color: var(--text);
  padding: 0;
  width: 100%;
  -moz-appearance: textfield;
}
.field-input input::-webkit-outer-spin-button,
.field-input input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.field-input input::placeholder {
  color: #CBD5E1;
  font-weight: 400;
}

.field-textarea {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 0.65rem 0.85rem;
  font-size: 1rem;
  font-family: inherit;
  font-weight: 500;
  color: var(--text);
  background: #fff;
  resize: vertical;
  transition: border-color 0.15s, box-shadow 0.15s;
  line-height: 1.55;
}
.field-textarea:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(34,196,133,0.12);
}
.field-textarea::placeholder {
  color: #CBD5E1;
  font-weight: 400;
}

/* Select underline */
.field-select {
  position: relative;
  border-bottom: 1.5px solid var(--border);
  padding-bottom: 0.4rem;
  transition: border-color 0.15s;
}
.field-select:focus-within { border-color: var(--blue); }
.field-select::after {
  content: "▾";
  position: absolute;
  right: 0.25rem;
  top: 50%;
  transform: translateY(-65%);
  pointer-events: none;
  color: var(--muted);
  font-size: 0.95rem;
}
.field-select select {
  width: 100%;
  border: none;
  outline: none;
  background: transparent;
  font-size: 1rem;
  font-weight: 500;
  font-family: inherit;
  color: var(--text);
  padding: 0 1.75rem 0 0;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
}

/* row-2 layout */
.row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}
@media (max-width: 480px) {
  .row-2 { grid-template-columns: 1fr; gap: 0; }
}

/* Segmented control */
.seg-control {
  display: flex;
  background: #F1F5F9;
  border-radius: 12px;
  padding: 4px;
  gap: 4px;
}
.seg-control input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.seg-control label {
  flex: 1;
  text-align: center;
  padding: 0.6rem 0.5rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--muted);
  transition: background 0.18s, color 0.18s, box-shadow 0.18s;
  user-select: none;
  margin: 0;
}
.seg-control input:checked + label {
  background: #fff;
  color: var(--blue);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(15,23,42,0.08);
}
.seg-control-3 label { font-size: 0.82rem; }
.seg-control-4 label { font-size: 0.78rem; padding: 0.55rem 0.35rem; }

/* Hint inside form label */
.lbl-hint {
  font-weight: 400;
  font-size: 0.78rem;
  color: var(--muted);
  margin-left: 0.3rem;
}

/* Required marker */
.req {
  color: #DC2626;
  font-weight: 700;
  margin: 0 0.1rem;
}

/* Error state — input/textarea ที่จำเป็นแต่ไม่กรอก */
.field-input input.field-error,
.field-input.field-error,
.field-input:has(input.field-error) {
  border-bottom-color: #EF4444 !important;
}
.field-textarea.field-error {
  border-color: #EF4444 !important;
  background: #FEF2F2 !important;
}

/* Accordion form-section (เงินกองทุน) */
details.form-section-collapsible {
  padding: 0;
}
details.form-section-collapsible > summary.form-section-title {
  cursor: pointer;
  list-style: none;
  padding: 1rem 0;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  user-select: none;
  transition: color 0.15s;
}
details.form-section-collapsible > summary::-webkit-details-marker { display: none; }
details.form-section-collapsible > summary::after {
  content: "";
  width: 8px;
  height: 8px;
  border-right: 1.5px solid var(--muted);
  border-bottom: 1.5px solid var(--muted);
  transform: rotate(45deg);
  margin-bottom: 3px;
  margin-left: auto;
  transition: transform 0.2s, border-color 0.15s;
}
details.form-section-collapsible[open] > summary::after {
  transform: rotate(-135deg);
  margin-bottom: -3px;
  border-color: var(--blue);
}
details.form-section-collapsible:hover > summary { color: var(--text-soft); }
details.form-section-collapsible[open] > summary {
  color: var(--text-soft);
  padding-bottom: 0.5rem;
}
details.form-section-collapsible[open] {
  padding-bottom: 1rem;
}

/* Field note — system info below input */
.field-note {
  margin-top: 0.45rem;
  font-size: 0.78rem;
  color: var(--primary-text);
  background: var(--primary-tint);
  padding: 0.35rem 0.7rem;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-weight: 500;
}

/* ============ PND radio list ============ */
.pnd-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.pnd-option {
  display: flex;
  align-items: stretch;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: #fff;
  position: relative;
  transition: border-color 0.18s, background 0.18s;
}
.pnd-option:hover {
  border-color: var(--accent-light);
  background: #FAFEFC;
}
.pnd-option:has(input:checked) {
  border-color: var(--blue);
  background: var(--primary-bg);
}

.pnd-label {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 0.85rem;
  cursor: pointer;
  user-select: none;
  margin: 0;
  color: var(--text);
  font-weight: normal;
}

.pnd-label input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 1px;
  height: 1px;
}

.pnd-check {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1.5px solid #CBD5E1;
  background: #fff;
  flex-shrink: 0;
  position: relative;
  transition: border-color 0.15s, background 0.15s;
}
.pnd-option input:checked ~ .pnd-check {
  background: var(--blue);
  border-color: var(--blue);
}
.pnd-option input:checked ~ .pnd-check::after {
  content: "";
  position: absolute;
  left: 6px;
  top: 3px;
  width: 5px;
  height: 9px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.pnd-label input:focus-visible ~ .pnd-check {
  box-shadow: 0 0 0 3px rgba(34,196,133,0.25);
}

.pnd-name {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text);
  letter-spacing: -0.005em;
}
.pnd-option:has(input:checked) .pnd-name {
  color: var(--primary-text);
  font-weight: 600;
}

/* "?" help icon + tooltip */
.pnd-help {
  align-self: center;
  margin-right: 0.7rem;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: help;
  flex-shrink: 0;
  transition: color 0.15s, border-color 0.15s;
  position: relative;
}
.pnd-help:hover,
.pnd-help:focus {
  color: var(--blue);
  border-color: var(--accent-light);
  outline: none;
}

/* tooltip — ใช้ CSS pseudo */
.pnd-help::before {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 10px);
  right: 0;
  background: #0F172A;
  color: #fff;
  font-size: 0.78rem;
  font-weight: 400;
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  width: max-content;
  max-width: 240px;
  text-align: left;
  line-height: 1.55;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s, visibility 0.15s;
  z-index: 20;
  box-shadow: 0 6px 18px rgba(0,0,0,0.12);
  white-space: normal;
}
.pnd-help::after {
  content: "";
  position: absolute;
  bottom: 100%;
  right: 7px;
  border: 5px solid transparent;
  border-top-color: #0F172A;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s, visibility 0.15s;
  z-index: 20;
}
.pnd-help:hover::before,
.pnd-help:hover::after,
.pnd-help:focus::before,
.pnd-help:focus::after {
  opacity: 1;
  visibility: visible;
}

/* Primary button */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  width: 100%;
  padding: 1rem;
  background: var(--blue);
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  margin-top: 1.5rem;
  transition: background 0.15s, box-shadow 0.15s;
  box-shadow: 0 4px 14px rgba(34,196,133,0.30);
}
.btn:hover {
  background: var(--blue-dark);
  box-shadow: 0 6px 20px rgba(34,196,133,0.38);
}
.btn svg { stroke: currentColor; }

/* ============ Certificate paper preview — official format ============ */
.cert-paper {
  background: #fff;
  border: 1px solid #E2E8F0;
  border-radius: 4px;
  box-shadow: 0 4px 18px rgba(15,23,42,0.06);
  padding: 1.75rem 1.85rem;
  font-size: 0.78rem;
  line-height: 1.55;
  color: #000;
  position: relative;
  max-width: 100%;
  margin: 0 auto;
  font-family: "Sarabun", "TH Sarabun", sans-serif;
}

/* Top: copy labels (left) + เล่ม/เลข (right) */
.paper-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 0.75rem;
}
.paper-copy-labels {
  font-size: 0.72rem;
  color: #000;
  line-height: 1.5;
}
.paper-copy-labels div { font-style: italic; }
.paper-book {
  font-size: 0.78rem;
  white-space: nowrap;
  text-align: right;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

/* Title */
.paper-title-block {
  text-align: center;
  margin: 0.25rem 0 1rem;
}
.paper-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.005em;
  color: #000;
}
.paper-subtitle {
  font-size: 0.85rem;
  color: #000;
  margin-top: 0.15rem;
}

/* Tax ID 13 boxes */
.taxid-boxes {
  display: inline-flex;
  gap: 1px;
  margin-left: 0.4rem;
  vertical-align: middle;
}
.taxid-box {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 18px;
  border: 1px solid #000;
  font-family: ui-monospace, "SF Mono", monospace;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0;
  background: #fff;
}
.taxid-label {
  font-size: 0.7rem;
  color: #000;
  margin-left: 0.5rem;
}

/* Party blocks */
.party-block {
  padding: 0.4rem 0;
  margin-bottom: 0.3rem;
}
.party-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
  font-size: 0.82rem;
}
.party-head strong { font-weight: 700; }
.party-row {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  margin: 0.15rem 0;
  font-size: 0.82rem;
}
.party-row .lbl { flex-shrink: 0; }
.party-hint {
  font-size: 0.65rem;
  color: #475569;
  font-style: italic;
  margin: 0.05rem 0 0.35rem 1.5rem;
  line-height: 1.4;
}

/* Underline-fill cells */
.fill, .fill-sm, .fill-tiny, .inline-fill {
  display: inline-block;
  border-bottom: 1px dotted #475569;
  font-weight: 500;
  color: #000;
  text-decoration: none;
  padding: 0 0.25rem 1px;
  min-height: 1em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.fill {
  flex: 1;
  min-width: 5rem;
  white-space: normal;
}
.fill-sm { min-width: 2.75rem; text-align: center; }
.fill-tiny { min-width: 2rem; text-align: center; }
.inline-fill { min-width: 4rem; }

.dots { color: #94A3B8; letter-spacing: 0.05em; }
.dim { color: #94A3B8; font-weight: 400; font-style: italic; }
.mono { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; letter-spacing: 0; }
.muted { color: #64748B; font-size: 0.7rem; }

.paper-tag {
  background: var(--primary-tint);
  color: var(--blue);
  padding: 0.05rem 0.45rem;
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 700;
  margin-left: 0.4rem;
  font-style: normal;
}

/* สำนักงานใหญ่ / สาขา 00050 — แสดงข้าง tax id */
.office-tag {
  display: inline-block;
  margin-left: 0.5rem;
  padding: 0.05rem 0.5rem;
  border: 1px solid #000;
  font-size: 0.72rem;
  font-weight: 600;
  color: #000;
  background: #fff;
  font-family: ui-monospace, "SF Mono", monospace;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

/* PND row */
.pnd-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.85rem;
  font-size: 0.78rem;
  margin-top: 0.6rem;
  padding: 0.35rem 0;
}
.pnd-cb {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  white-space: nowrap;
}

/* Income table */
.income-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0.5rem;
  font-size: 0.74rem;
}
.income-table th,
.income-table td {
  padding: 0.3rem 0.4rem;
  border: 1px solid #000;
  vertical-align: top;
  line-height: 1.45;
}
.income-table th {
  background: #fff;
  font-weight: 600;
  text-align: center;
  font-size: 0.72rem;
  color: #000;
}
.income-table th:first-child { text-align: left; }
.income-table .r { text-align: right; }
.income-table .c { text-align: center; }
.paper-total td {
  background: #F8FAFC;
  font-weight: 600;
}
.income-table .indent-1 { display: inline-block; padding-left: 0.85rem; }
.income-table .indent-2 { display: inline-block; padding-left: 1.7rem; }
.income-table .indent-3 { display: inline-block; padding-left: 2.55rem; }
.income-table .sub-row td {
  background: #FAFBFC;
  font-size: 0.7rem;
  color: #334155;
}

/* Baht text row */
.baht-text {
  margin-top: 0.4rem;
  padding: 0.4rem 0.6rem;
  border: 1px solid #000;
  border-top: none;
  font-size: 0.78rem;
  color: #000;
}
.baht-text strong { font-weight: 600; }

/* Funds row */
.funds-row {
  margin: 0.6rem 0;
  padding: 0.4rem 0;
  font-size: 0.74rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1rem;
  border-bottom: 1px solid #000;
  padding-bottom: 0.5rem;
}

/* Issue row */
.issue-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 1rem;
  font-size: 0.78rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid #000;
}
.issue-row strong { font-weight: 700; }
.issue-cb {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  white-space: nowrap;
}

/* Checkbox marker */
.cb {
  display: inline-block;
  width: 11px;
  height: 11px;
  border: 1px solid #000;
  background: #fff;
  vertical-align: middle;
  flex-shrink: 0;
  position: relative;
}
.cb.cb-on::after {
  content: "✓";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 700;
  color: #000;
  line-height: 1;
}

/* Footer (warning + signature + stamp) */
.paper-footer {
  display: grid;
  grid-template-columns: 1.1fr 1.5fr 0.6fr;
  gap: 0.85rem;
  margin-top: 0.85rem;
  padding-top: 0.85rem;
  align-items: stretch;
}
.paper-warning {
  font-size: 0.7rem;
  line-height: 1.55;
  color: #000;
  border: 1px solid #000;
  padding: 0.5rem 0.65rem;
  background: #fff;
}
.paper-warning strong { font-weight: 700; }

.paper-sign-area {
  font-size: 0.78rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.paper-sign-cert { font-size: 0.72rem; }
.paper-sign-line { font-size: 0.82rem; padding-top: 0.5rem; }
.paper-sign-pos { font-size: 0.72rem; color: #334155; }
.paper-sign-date { font-size: 0.72rem; color: #000; }

.paper-stamp {
  border: 1px dashed #475569;
  padding: 0.85rem 0.5rem;
  font-size: 0.7rem;
  color: #475569;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1.5;
  min-height: 5rem;
}

/* Note */
.paper-note {
  margin-top: 0.85rem;
  padding-top: 0.65rem;
  border-top: 1px solid #94A3B8;
  font-size: 0.7rem;
  color: #000;
  line-height: 1.6;
}
.paper-note strong { font-weight: 700; }
.paper-note ol {
  margin: 0.2rem 0 0 1.2rem;
  padding: 0;
}
.paper-note li { margin-bottom: 0.1rem; }

/* Credit footer at bottom of certificate */
.paper-credit {
  margin-top: 0.85rem;
  padding-top: 0.55rem;
  border-top: 1px dotted #94A3B8;
  font-size: 0.7rem;
  color: var(--muted);
  text-align: center;
  letter-spacing: 0.02em;
}
.paper-credit strong {
  color: var(--blue);
  font-weight: 600;
}

/* ============ Stats section (social proof) — compact bar ============ */
.stats-section {
  max-width: 1400px;
  margin: 2rem auto 0;
  padding: 0 2rem;
}
.stats-card {
  text-align: center;
  padding: 1.5rem 1.5rem;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
}
.stats-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 0.45rem;
}
.stats-row {
  font-size: clamp(1.4rem, 3vw, 1.75rem);
  font-weight: 800;
  color: #0F172A;
  letter-spacing: -0.02em;
  line-height: 1.2;
}
.stats-number {
  font-weight: 800;
  color: var(--primary-text);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
  margin: 0 0.2rem;
}

@media (max-width: 600px) {
  .stats-section { padding: 0 1rem; margin: 1.5rem auto 0; }
  .stats-card    { padding: 1rem 1.1rem; gap: 0.9rem; border-radius: 12px; }
  .stats-icon    { font-size: 1.5rem; }
}

/* ============ Info / FAQ (เหมือน WHT) ============ */
.info-grid {
  max-width: 1400px;
  margin: 2rem auto 5rem;
  padding: 0 2rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4rem;
  align-items: start;
}
@media (max-width: 768px) {
  .info-grid {
    grid-template-columns: 1fr;
    gap: 3rem;
    padding: 0 1rem;
    margin: 3rem auto 4rem;
  }
}
.info-accordion { margin: 0; padding: 0; max-width: none; }
.info-accordion-title {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--text);
  margin: 0 0 0.5rem;
}
.info-accordion-faq .faq-grid { display: block; }

.info-acc {
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border-soft);
  border-radius: 0;
  margin: 0;
  padding: 0;
}
.info-acc:first-of-type { border-top: 1px solid var(--border-soft); }

.info-acc summary {
  padding: 1.25rem 0.25rem;
  cursor: pointer;
  list-style: none;
  font-size: 0.95rem;
  font-weight: 400;
  color: var(--text-soft);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.25rem;
  user-select: none;
  transition: color 0.15s;
}
.info-acc summary::-webkit-details-marker { display: none; }
.info-acc summary::after {
  content: "";
  width: 9px;
  height: 9px;
  border-right: 1.5px solid var(--muted);
  border-bottom: 1.5px solid var(--muted);
  transform: rotate(45deg);
  margin-bottom: 4px;
  transition: transform 0.25s, border-color 0.15s;
  flex-shrink: 0;
  opacity: 0.7;
}
.info-acc[open] summary::after {
  transform: rotate(225deg);
  margin-bottom: -4px;
  border-color: var(--blue);
  opacity: 1;
}
.info-acc summary:hover { color: var(--text); }
.info-acc[open] summary { font-weight: 500; color: var(--text); }
.info-acc-body {
  padding: 0 0.25rem 1.4rem;
  color: var(--text-soft);
  font-size: 0.95rem;
  line-height: 1.85;
}
.info-acc-body p { margin-bottom: 0.8rem; }
.info-acc-body p:last-child { margin-bottom: 0; }
.info-acc-body strong { color: var(--text); font-weight: 600; }

.rate-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.5rem; }
.rate-list li {
  display: flex; align-items: center; gap: 0.85rem;
  padding: 0.65rem 0.85rem;
  background: #F8FAFC;
  border-radius: 8px;
  font-size: 0.9rem;
  color: var(--text-soft);
}
.rate-pct {
  flex-shrink: 0;
  min-width: 2.75rem;
  text-align: center;
  background: var(--primary-tint);
  color: var(--blue);
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
}

/* ============ Print ============ */
/* ============ Print — A4 1 หน้า ============ */
@media print {
  @page { size: A4; margin: 0.85cm 1.1cm; }

  body, html {
    background: #fff !important;
    color: #000 !important;
    font-size: 8pt;
    line-height: 1.35;
  }

  .site-header,
  .site-footer,
  .back-link,
  .cert-form,
  .info-grid,
  .no-print {
    display: none !important;
  }

  body .container { max-width: 100% !important; padding: 0 !important; }
  .cert-layout {
    display: block !important;
    grid-template-columns: 1fr !important;
    background: #fff !important;
    margin: 0 !important;
  }
  .cert-preview {
    padding: 0 !important;
    background: none !important;
  }
  .cert-paper {
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    max-width: 100% !important;
    font-size: 8pt !important;
    line-height: 1.35 !important;
  }

  /* === Sections === */
  .paper-top { margin-bottom: 0.3rem; }
  .paper-copy-labels { font-size: 6.5pt; line-height: 1.3; }
  .paper-book { font-size: 7.8pt; gap: 0.05rem; }

  .paper-title-block { margin: 0.15rem 0 0.4rem; }
  .paper-title { font-size: 10.5pt; line-height: 1.2; }
  .paper-subtitle { font-size: 7.6pt; margin-top: 0.05rem; }

  .party-block { padding: 0.15rem 0; margin-bottom: 0.1rem; }
  .party-head { font-size: 8pt; margin-bottom: 0.18rem; gap: 0.35rem; line-height: 1.3; }
  .party-row { font-size: 8pt; margin: 0.05rem 0; line-height: 1.4; }
  .party-hint { font-size: 6.2pt; margin: 0 0 0.15rem 1rem; line-height: 1.3; }

  .pnd-row {
    font-size: 7.5pt;
    gap: 0.15rem 0.55rem;
    padding: 0.2rem 0;
    margin-top: 0.2rem;
    line-height: 1.4;
  }

  .taxid-box { width: 12px; height: 14px; font-size: 7.6pt; }
  .taxid-label { font-size: 6.5pt; margin-left: 0.3rem; }

  .income-table {
    font-size: 7.2pt;
    margin-top: 0.25rem;
  }
  .income-table th {
    font-size: 7.2pt;
    padding: 0.18rem 0.35rem;
    line-height: 1.3;
  }
  .income-table td {
    padding: 0.18rem 0.35rem;
    line-height: 1.35;
  }
  .income-table .sub-row td {
    font-size: 6.6pt;
    padding: 0.08rem 0.35rem;
    line-height: 1.25;
  }
  .income-table .indent-1 { padding-left: 0.5rem; }
  .income-table .indent-2 { padding-left: 1rem; }
  .income-table .indent-3 { padding-left: 1.5rem; }

  .baht-text {
    font-size: 7.4pt;
    padding: 0.25rem 0.5rem;
    line-height: 1.4;
  }

  .funds-row {
    font-size: 6.9pt;
    padding: 0.25rem 0;
    margin: 0.3rem 0;
    gap: 0.2rem 0.6rem;
    line-height: 1.4;
  }

  .issue-row {
    font-size: 7.6pt;
    padding: 0.3rem 0;
    gap: 0.25rem 0.7rem;
    line-height: 1.4;
  }

  /* Footer (warning + signature + stamp) */
  .paper-footer {
    gap: 0.5rem;
    margin-top: 0.5rem;
    padding-top: 0.4rem;
    grid-template-columns: 1.05fr 1.5fr 0.5fr;
  }
  .paper-warning {
    font-size: 6.5pt;
    padding: 0.4rem 0.5rem;
    line-height: 1.45;
  }
  .paper-sign-area { gap: 0.3rem; }
  .paper-sign-cert { font-size: 6.7pt; line-height: 1.4; }
  .paper-sign-line { font-size: 8pt; padding-top: 0.4rem; line-height: 1.3; }
  .paper-sign-pos { font-size: 6.7pt; }
  .paper-sign-date { font-size: 6.7pt; line-height: 1.4; }
  .paper-stamp {
    font-size: 6.5pt;
    padding: 0.55rem 0.35rem;
    min-height: 3.2rem;
    line-height: 1.4;
  }

  .paper-note {
    font-size: 6.5pt;
    margin-top: 0.45rem;
    padding-top: 0.35rem;
    line-height: 1.45;
  }
  .paper-note ol { margin: 0.15rem 0 0 1rem; }
  .paper-note li { margin-bottom: 0.05rem; }

  .paper-credit {
    margin-top: 0.4rem;
    padding-top: 0.3rem;
    font-size: 5.8pt;
    line-height: 1.35;
    color: #64748B !important;
  }
  .paper-credit strong { color: #15803D !important; }

  .cb { width: 10px; height: 10px; }
  .cb.cb-on::after { font-size: 8pt; }

  /* === Color forcing === */
  .paper-tag,
  .baht-text,
  .paper-warning,
  .income-table th,
  .paper-total td,
  .income-table .sub-row td,
  .taxid-box,
  .cb {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .taxid-box,
  .income-table th,
  .income-table td,
  .baht-text,
  .funds-row,
  .issue-row,
  .paper-warning { border-color: #000 !important; }

  /* Page-break controls — keep all on one page */
  .cert-paper,
  .income-table,
  .income-table tbody,
  .paper-footer { page-break-inside: avoid; }

  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}
