.tks-contact-form {
  --tks-bg: #f7f9fc;
  --tks-surface: #ffffff;
  --tks-text: #1f2937;
  --tks-muted: #6b7280;
  --tks-border: #d8e1eb;
  --tks-accent: #ef5b2b;
  --tks-accent-dark: #d94a1b;
  --tks-required: #e84b4b;
  --tks-optional: #97a3b6;
  --tks-focus: rgba(239, 91, 43, 0.22);

  color: var(--tks-text);
  max-width: 860px;
  margin: 24px auto;
  padding: 28px 24px;
  border: 1px solid var(--tks-border);
  border-radius: 16px;
  background:
    radial-gradient(1200px 300px at 0% -10%, rgba(239, 91, 43, 0.08), transparent 40%),
    linear-gradient(180deg, #ffffff 0%, var(--tks-bg) 100%);
  box-sizing: border-box;
}

.tks-contact-form > p {
  margin: 0 0 24px;
  color: #334155;
  line-height: 1.9;
}

.tks-contact-form > p a {
  color: #0d5ea8;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.tks-contact-form .tks-form-intro,
.tks-contact-form > p:first-of-type {
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.tks-contact-form .tks-form-intro strong {
  display: block;
  margin-bottom: 8px;
  color: #1e3a5f;
  font-size: 15px;
  line-height: 1.5;
}

.tks-contact-form .tks-form-intro p,
.tks-contact-form > p:first-of-type {
  margin: 0;
  color: #334155;
  font-size: 15px;
  line-height: 1.7;
}

.tks-contact-form .tks-form-intro p + p {
  margin-top: 8px;
}

.tks-contact-form .tks-form-intro .tks-form-intro-note {
  color: #52657d;
  font-size: 14px;
}

.tks-contact-form .tks-form-intro a,
.tks-contact-form > p:first-of-type a {
  color: #0d5ea8;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 2px;
  border-bottom: 0;
}

.tks-contact-form .tks-form-intro a:hover,
.tks-contact-form > p:first-of-type a:hover {
  color: #0a4d88;
  opacity: 0.85;
}

.tks-contact-form > p:first-of-type br {
  display: block;
  content: "";
  margin-top: 2px;
}

.tks-contact-form > p:first-of-type.tks-form-intro-note,
.tks-contact-form > p:first-of-type + p,
.tks-contact-form .tks-form-intro-note {
  margin-top: 0;
  margin-bottom: 16px;
  padding: 0;
  border: 0;
  color: #7a8593;
  font-size: 13px;
  line-height: 1.6;
}

.tks-contact-form .tks-form-intro-note a,
.tks-contact-form > p:first-of-type.tks-form-intro-note a,
.tks-contact-form > p:first-of-type + p a {
  color: #0d5ea8;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
  opacity: 0.85;
}

.tks-contact-form .tks-form-intro-note a:hover,
.tks-contact-form > p:first-of-type.tks-form-intro-note a:hover,
.tks-contact-form > p:first-of-type + p a:hover {
  opacity: 1;
}

.tks-contact-form dl {
  margin: 0 0 18px;
  padding: 0;
}

.tks-contact-form dt,
.tks-contact-form dd {
  margin: 0;
  padding: 0;
}

.tks-contact-form dt {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 16px;
  line-height: 1.5;
  margin-bottom: 4px;
}

/* ラベル直下の入力欄までの隙間を最小化 */
.tks-contact-form dd {
  margin-top: 0 !important;
}

.tks-contact-form dd > *:first-child {
  margin-top: 0 !important;
}

.tks-contact-form dd .wpcf7-form-control-wrap {
  margin-top: 0 !important;
}

.tks-contact-form dd .wpcf7-form-control {
  margin-top: 0 !important;
}

/* CF7 / wpautop による <p> 自動挿入の余白を打ち消す */
.tks-contact-form dt > p,
.tks-contact-form dd > p {
  margin: 0 !important;
  padding: 0 !important;
}

.tks-contact-form dd > p > .wpcf7-form-control-wrap {
  display: block;
  margin: 0 !important;
}

.tks-contact-form .tks-badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 11px;
  line-height: 1.5;
  letter-spacing: 0.03em;
  font-weight: 700;
  background: #fff;
  transform: translateY(-1px);
}

.tks-contact-form .tks-badge.is-required {
  color: #d92f2f;
  border-color: #ef7f7f;
  background: #fff5f5;
}

.tks-contact-form .tks-badge.is-optional {
  color: #4c6786;
  border-color: #b9c6d8;
  background: #f5f8fc;
}

/* .tks-contact-form が付かない環境向けフォールバック（CF7フォーム直下にも適用） */
.wpcf7 form .tks-badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 11px;
  line-height: 1.5;
  letter-spacing: 0.03em;
  font-weight: 700;
  background: #fff;
  transform: translateY(-1px);
  margin-left: 6px;
}

.wpcf7 form .tks-badge.is-required {
  color: #d92f2f;
  border-color: #ef7f7f;
  background: #fff5f5;
}

.wpcf7 form .tks-badge.is-optional {
  color: #4c6786;
  border-color: #b9c6d8;
  background: #f5f8fc;
}

/* 旧フォームのインラインstyle付き span バッジにも同じ見た目を適用 */
.tks-contact-form dt > span[style*="ea4747"],
.tks-contact-form dt > span[style*="#ea4747"],
.tks-contact-form dt > span[style*="a8a8a8"],
.tks-contact-form dt > span[style*="#a8a8a8"] {
  display: inline-block !important;
  padding: 1px 8px !important;
  border-radius: 999px !important;
  border: 1px solid transparent !important;
  font-size: 11px !important;
  line-height: 1.5 !important;
  letter-spacing: 0.03em !important;
  font-weight: 700 !important;
  margin-left: 6px !important;
}

.tks-contact-form dt > span[style*="ea4747"],
.tks-contact-form dt > span[style*="#ea4747"] {
  color: #d92f2f !important;
  border-color: #ef7f7f !important;
  background: #fff5f5 !important;
}

.tks-contact-form dt > span[style*="a8a8a8"],
.tks-contact-form dt > span[style*="#a8a8a8"] {
  color: #4c6786 !important;
  border-color: #b9c6d8 !important;
  background: #f5f8fc !important;
}

/* 親要素不一致や style 属性の大文字小文字差分対策 */
.wpcf7 form span[style*="ea4747" i],
.wpcf7 form span[style*="#ea4747" i],
.wpcf7 form span[style*="a8a8a8" i],
.wpcf7 form span[style*="#a8a8a8" i] {
  display: inline-block !important;
  padding: 1px 8px !important;
  border-radius: 999px !important;
  border: 1px solid transparent !important;
  font-size: 11px !important;
  line-height: 1.5 !important;
  letter-spacing: 0.03em !important;
  font-weight: 700 !important;
  margin-left: 6px !important;
}

.wpcf7 form span[style*="ea4747" i],
.wpcf7 form span[style*="#ea4747" i] {
  color: #d92f2f !important;
  border-color: #ef7f7f !important;
  background: #fff5f5 !important;
}

.wpcf7 form span[style*="a8a8a8" i],
.wpcf7 form span[style*="#a8a8a8" i] {
  color: #4c6786 !important;
  border-color: #b9c6d8 !important;
  background: #f5f8fc !important;
}

.tks-contact-form .wpcf7-form-control-wrap {
  display: block;
}

.tks-contact-form .wpcf7-form-control {
  display: block !important;
  width: 100%;
  visibility: visible !important;
  opacity: 1 !important;
}

.tks-contact-form input[type="text"],
.tks-contact-form input[type="email"],
.tks-contact-form input[type="tel"],
.tks-contact-form select,
.tks-contact-form textarea {
  width: 100% !important;
  display: block !important;
  min-height: 48px;
  color: var(--tks-text);
  background: var(--tks-surface);
  border: 1px solid #c6d2df;
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 16px;
  line-height: 1.5;
  box-sizing: border-box;
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.02);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.tks-contact-form textarea {
  min-height: 170px;
  resize: vertical;
}

.tks-contact-form input::placeholder,
.tks-contact-form textarea::placeholder {
  color: #94a3b8;
}

.tks-contact-form input:focus,
.tks-contact-form select:focus,
.tks-contact-form textarea:focus {
  outline: none;
  border-color: var(--tks-accent);
  box-shadow: 0 0 0 4px var(--tks-focus);
  background: #fffefd;
}

.tks-contact-form .wpcf7-list-item {
  margin: 0;
}

.tks-contact-form .wpcf7-form-control.wpcf7-checkbox,
.tks-contact-form .wpcf7-acceptance {
  display: block;
}

.tks-contact-form .wpcf7-form-control.wpcf7-checkbox .wpcf7-list-item-label,
.tks-contact-form .wpcf7-acceptance .wpcf7-list-item-label {
  color: var(--tks-text);
}

/* 「資料を送ってほしい」チェックのUI改善 */
.tks-contact-form .wpcf7-form-control.wpcf7-checkbox .wpcf7-list-item label {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  line-height: 1.5;
  cursor: pointer;
}

.tks-contact-form .wpcf7-form-control.wpcf7-checkbox input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  border: 2px solid #b8c6d8;
  border-radius: 6px;
  background: #fff;
  position: relative;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tks-contact-form .wpcf7-form-control.wpcf7-checkbox input[type="checkbox"]:hover {
  border-color: #7a93b2;
  box-shadow: 0 0 0 3px rgba(122, 147, 178, 0.16);
}

.tks-contact-form .wpcf7-form-control.wpcf7-checkbox input[type="checkbox"]:checked {
  background: linear-gradient(135deg, #ef5b2b 0%, #f39a2f 100%);
  border-color: #ef5b2b;
}

.tks-contact-form .wpcf7-form-control.wpcf7-checkbox input[type="checkbox"]:checked::after {
  content: "";
  position: absolute;
  left: 6px;
  top: 2px;
  width: 6px;
  height: 12px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

/* 同意チェックも同系トーンに揃える */
.tks-contact-form .agree-check .wpcf7-list-item label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
  width: 100%;
  font-size: 15px;
  line-height: 1.45;
  font-weight: 500;
  color: #23344a;
  cursor: pointer;
}

.tks-contact-form .agree-check input[type="checkbox"] {
  width: 20px;
  height: 20px;
  transform: translateY(0);
}

.tks-contact-form .agree-check {
  margin-top: 10px;
  padding: 10px 14px 8px;
  border: 1px solid #d9e2ee;
  border-radius: 12px;
  background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
  box-shadow: 0 3px 10px rgba(27, 54, 89, 0.05);
}

/* wpautop で挿入される p の余白を除去 */
.tks-contact-form .agree-check > p {
  margin: 0 !important;
  padding: 0 !important;
}

.tks-contact-form .agree-check .wpcf7-acceptance,
.tks-contact-form .agree-check .wpcf7-list-item {
  margin: 0 !important;
  display: block;
}

.tks-contact-form .agree-check .policy-link {
  margin: 4px 0 0;
  font-size: 13px;
  text-align: center;
}

.tks-contact-form .agree-check .policy-link a {
  color: #2c5f98;
  text-decoration: none;
  border-bottom: 1px solid rgba(44, 95, 152, 0.4);
  padding-bottom: 1px;
}

.tks-contact-form .agree-check .policy-link a:hover {
  color: #17497f;
  border-bottom-color: rgba(23, 73, 127, 0.65);
}

.tks-contact-form .wpcf7-submit,
.tks-contact-form input[type="submit"] {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 15px 30px;
  min-width: 180px;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #fff;
  cursor: pointer;
  background: linear-gradient(135deg, #f05f2f 0%, #f29a39 55%, #efb24c 100%);
  box-shadow: 0 10px 24px rgba(239, 91, 43, 0.3);
  transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.tks-contact-form .wpcf7-submit:hover,
.tks-contact-form input[type="submit"]:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 28px rgba(239, 91, 43, 0.34);
  background: linear-gradient(135deg, #e95425 0%, #eb8a28 55%, #e6a43d 100%);
}

.tks-contact-form .wpcf7-submit:active,
.tks-contact-form input[type="submit"]:active {
  transform: translateY(0);
}

.tks-contact-form .wpcf7-spinner {
  margin-left: 10px;
}

.tks-contact-form .wpcf7-not-valid-tip {
  margin-top: 6px;
  color: #d92f2f;
  font-size: 13px;
}

.tks-contact-form .wpcf7 form.invalid .wpcf7-response-output,
.tks-contact-form .wpcf7 form.failed .wpcf7-response-output,
.tks-contact-form .wpcf7 form.sent .wpcf7-response-output {
  margin: 16px 0 0;
  border-radius: 10px;
  padding: 12px 14px;
}

section.p-section-single.p-section {
  padding-top:50px;
}

@media (max-width: 680px) {
  .tks-contact-form {
    margin: 14px auto;
    padding: 18px 14px;
    border-radius: 12px;
  }

  .tks-contact-form .tks-form-intro,
  .tks-contact-form > p:first-of-type {
    padding-bottom: 16px;
  }

  .tks-contact-form .tks-form-intro strong {
    font-size: 14px;
  }

  .tks-contact-form dt {
    font-size: 15px;
  }

  .tks-contact-form input[type="text"],
  .tks-contact-form input[type="email"],
  .tks-contact-form input[type="tel"],
  .tks-contact-form select,
  .tks-contact-form textarea {
    font-size: 16px;
  }

  .tks-contact-form .wpcf7-submit,
  .tks-contact-form input[type="submit"] {
    width: 100%;
  }

}
