:root {
  --ink: #111111;
  --ink-soft: #3a3a3a;
  --gray: #6b6b6b;
  --gray-light: #9a9a9a;
  --line: #e6e6e6;
  --line-strong: #cfcfcf;
  --bg: #ffffff;
  --soft: #f7f7f7;
  --soft-2: #f0f0f0;
  --error: #b00020;
  --radius: 6px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.05);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  color: var(--ink);
  background: var(--soft);
  font-family: "Noto Sans JP", -apple-system, BlinkMacSystemFont, "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, sans-serif;
  font-size: 15px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: 1000px; margin: 0 auto; padding: 0 20px; }

/* ---- header / footer ---- */
.site-header {
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap { display: flex; align-items: center; gap: 14px; height: 60px; }
.brand-logo { height: 23px; width: auto; display: block; }
.title { color: var(--gray); font-size: 13px; letter-spacing: 0.02em; }

main.wrap { padding-top: 28px; padding-bottom: 72px; }

.site-footer { border-top: 1px solid var(--line); padding: 24px 0 28px; }
.footer-links { display: flex; flex-wrap: wrap; gap: 8px 22px; margin: 0 0 14px; }
.footer-links a { color: var(--gray); text-decoration: none; font-size: 12.5px; }
.footer-links a:hover { color: var(--ink); text-decoration: underline; }
.footer-copy { margin: 0; font-size: 12px; color: var(--gray-light); letter-spacing: 0.04em; }

@media (max-width: 540px) {
  .brand-logo { height: 20px; }
  .site-header .title { font-size: 12px; }
}

/* ---- stepper ---- */
.stepper {
  list-style: none;
  display: flex;
  margin: 0 0 22px;
  padding: 0;
  counter-reset: step;
}
.stepper li {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  position: relative;
  font-size: 12px;
  color: var(--gray-light);
  text-align: center;
}
.stepper li .num {
  width: 26px; height: 26px;
  border-radius: 50%;
  border: 1.5px solid var(--line-strong);
  display: grid; place-items: center;
  font-size: 12px; font-weight: 700;
  background: var(--bg);
  color: var(--gray-light);
  transition: all 0.2s ease;
  z-index: 1;
}
/* connector line */
.stepper li:not(:first-child)::before {
  content: "";
  position: absolute;
  top: 13px; left: -50%; width: 100%;
  height: 1.5px; background: var(--line-strong);
  z-index: 0;
}
.stepper li.done .num { background: var(--ink); border-color: var(--ink); color: #fff; }
.stepper li.done:not(:first-child)::before { background: var(--ink); }
.stepper li.active .num { border-color: var(--ink); color: var(--ink); }
.stepper li.active { color: var(--ink); font-weight: 700; }
.stepper li.active:not(:first-child)::before { background: var(--ink); }

/* ---- notice ---- */
.notice {
  background: var(--bg);
  border: 1px solid var(--line);
  border-left: 3px solid var(--ink);
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 12.5px;
  color: var(--gray);
  margin-bottom: 20px;
  line-height: 1.7;
}

/* ---- card / screen ---- */
.screen {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px 28px 26px;
  animation: fadeIn 0.28s ease;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

h2 { font-size: 21px; margin: 0 0 6px; letter-spacing: 0.01em; }
.section-label {
  font-size: 11.5px; font-weight: 700; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--gray-light);
  margin: 28px 0 12px; padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}
.section-label:first-of-type { margin-top: 18px; }
.lead { color: var(--gray); margin: 0 0 8px; font-size: 13.5px; }

/* ---- fields ---- */
.field { display: block; margin-bottom: 16px; }
.field > .label { display: flex; align-items: center; gap: 8px; font-size: 13px; margin-bottom: 6px; font-weight: 500; }
.field .req { color: var(--error); font-size: 10.5px; font-weight: 700; border: 1px solid currentColor; border-radius: 3px; padding: 0 4px; line-height: 1.5; }
.field .hint, .hint { display: block; font-size: 11.5px; color: var(--gray-light); margin-top: 5px; line-height: 1.6; }

input[type="text"], input[type="email"], input[type="tel"], input[type="url"],
input[type="number"], input[type="date"], select, textarea {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  font: inherit;
  color: var(--ink);
  background: #fff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input::placeholder, textarea::placeholder { color: var(--gray-light); }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(17, 17, 17, 0.08);
}
input:disabled, select:disabled, textarea:disabled { background: var(--soft-2); color: var(--gray); }
.field.invalid input, .field.invalid select, .field.invalid textarea { border-color: var(--error); }

/* ---- checkboxes ---- */
.checkgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px 16px; }
/* 職種は長いラベルが多いため、PCでは2列にして各ラベルを1行に収める（SPは1列） */
@media (min-width: 541px) {
  #r_occupations { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.checkgrid label, .check {
  font-size: 14px; display: flex; align-items: center; gap: 9px;
  cursor: pointer; user-select: none;
}
.checkgrid label input, .check input { width: 17px; height: 17px; accent-color: #111; cursor: pointer; flex: none; }
.check { margin-bottom: 10px; }
.agree-box { background: var(--soft); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.agree-box .check { margin-bottom: 10px; }
.agree-box .check label { cursor: pointer; }
.agree-box .check a { color: var(--ink); text-decoration: underline; }
.agree-note { margin: 4px 0 0; font-size: 12px; color: var(--gray); line-height: 1.7; }

/* ---- remember email ---- */
.remember-row {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 8px; margin-top: 12px;
}
.linklike { background: none; border: none; padding: 0; color: var(--gray); font: inherit; font-size: 12.5px; text-decoration: underline; cursor: pointer; }
.linklike:hover { color: var(--ink); }

/* ---- items table ---- */
.items-wrap { border: 1px solid var(--line); border-radius: var(--radius); overflow-x: auto; }
table.items { width: 100%; border-collapse: collapse; min-width: 540px; }
table.items th {
  background: var(--soft); font-size: 11px; font-weight: 700; letter-spacing: 0.04em;
  color: var(--gray); text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--line);
}
table.items th.amount { text-align: right; width: 150px; }
table.items th.qty { text-align: right; width: 90px; }
table.items th.unit { width: 84px; }
table.items th.del { width: 40px; }
table.items th:first-child, table.items td:first-child { max-width: 300px; } /* 摘要は少し短めに */
table.items td { border-bottom: 1px solid var(--line); padding: 4px 6px; vertical-align: middle; }
table.items tr:last-child td { border-bottom: none; }
table.items td input { width: 100%; border: 1px solid transparent; background: transparent; padding: 8px 6px; border-radius: 4px; }
table.items td input:focus { border-color: var(--line-strong); background: #fff; box-shadow: none; }
table.items td.amount input, table.items td.qty input { text-align: right; }
table.items td.lineamount { text-align: right; font-variant-numeric: tabular-nums; color: var(--ink); padding-right: 10px; white-space: nowrap; }
.row-del { background: none; border: none; color: var(--gray-light); cursor: pointer; font-size: 18px; line-height: 1; padding: 6px; border-radius: 4px; }
.row-del:hover { color: var(--error); background: var(--soft); }
.add-item {
  width: 100%; margin-top: 10px; padding: 11px;
  border: 1px dashed var(--line-strong); border-radius: var(--radius);
  background: #fff; color: var(--ink-soft); font: inherit; font-size: 13.5px; cursor: pointer;
}
.add-item:hover { border-color: var(--ink); background: var(--soft); }
.add-item:disabled { opacity: 0.45; cursor: default; }

/* ---- totals ---- */
.totals {
  margin-top: 22px; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 18px; background: var(--soft);
}
.totals .row { display: flex; justify-content: space-between; padding: 4px 0; font-size: 13.5px; color: var(--gray); }
.totals .row span:last-child { font-variant-numeric: tabular-nums; }
.totals .row.total {
  color: var(--ink); font-weight: 800; font-size: 19px;
  border-top: 1.5px solid var(--line-strong); margin-top: 8px; padding-top: 12px;
}

/* ---- 請求日まわり ---- */
.date-row { display: flex; gap: 16px; align-items: flex-start; }
.date-row .field { flex: 1 1 150px; margin-bottom: 6px; }
.due-value {
  padding: 11px 13px; border: 1px solid var(--line-strong); border-radius: var(--radius);
  background: var(--soft); color: var(--ink); font-weight: 700; min-height: 44px;
  display: flex; align-items: center;
}
#dateError { font-weight: 700; }

/* ---- meta line ---- */
.meta-line {
  display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center;
  background: var(--soft); border-radius: var(--radius); padding: 10px 14px;
  font-size: 12.5px; color: var(--gray); margin-bottom: 18px;
}
.meta-line strong { color: var(--ink); font-weight: 700; }
.tag { display: inline-block; border: 1px solid var(--line-strong); border-radius: 100px; padding: 1px 10px; font-size: 11.5px; color: var(--gray); }

/* ---- buttons ---- */
.actions { display: flex; gap: 12px; margin-top: 28px; align-items: center; }
.actions .spacer { flex: 1; }
button, .btn, a.primary, a.ghost {
  font: inherit; cursor: pointer; border-radius: var(--radius);
  padding: 12px 24px; font-size: 14.5px; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  transition: background 0.15s ease, opacity 0.15s ease, transform 0.05s ease;
  text-decoration: none;
}
button:active { transform: translateY(1px); }
button.primary, a.primary {
  background: var(--ink); color: #fff; border: 1px solid var(--ink);
}
button.primary:hover { background: #000; }
button.ghost, a.ghost { background: #fff; color: var(--ink); border: 1px solid var(--line-strong); }
button.ghost:hover, a.ghost:hover { background: var(--soft); }
button:disabled { opacity: 0.5; cursor: default; }
button.loading { pointer-events: none; }
button.loading .btn-label { opacity: 0.7; }
.spinner {
  width: 15px; height: 15px; border-radius: 50%;
  border: 2px solid currentColor; border-top-color: transparent;
  animation: spin 0.7s linear infinite; flex: none;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- messages ---- */
.error { color: var(--error); font-size: 13px; margin-top: 14px; min-height: 1em; white-space: pre-wrap; }
.error:empty { margin-top: 0; min-height: 0; }
.info { color: var(--gray); font-size: 12.5px; margin: 8px 0 0; min-height: 1em; }
.info:empty { margin: 0; min-height: 0; }
.resend-line { font-size: 12.5px; color: var(--gray-light); margin: 10px 0 0; }
.sub-link { font-size: 12.5px; color: var(--gray); margin: 16px 0 0; }
.sub-link a { color: var(--ink); }
#otpInput { letter-spacing: 0.4em; font-size: 18px; text-align: center; }
.banner-warn { margin-top: 16px; background: #fff8e6; border: 1px solid #e9d9a6; color: #7a5d00; border-radius: var(--radius); padding: 10px 14px; font-size: 13px; }
.banner-warn:empty { display: none; }

/* ---- PDF preview (実際に送付されるPDFを表示) ---- */
.pdf-frame {
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  overflow: hidden;
  background: #f3f3f3;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.02);
}
.pdf-frame iframe { width: 100%; aspect-ratio: 1 / 1.414; border: 0; display: block; background: #f3f3f3; }
.pdf-hint { font-size: 12px; color: var(--gray-light); margin: 10px 0 0; }
.pdf-hint a { color: var(--gray); }

/* ---- preview (旧HTMLプレビュー・未使用) ---- */
.preview { border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.preview h4 { margin: 0 0 16px; font-size: 15px; letter-spacing: 0.04em; color: var(--gray); font-weight: 700; }
.preview dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; font-size: 13.5px; margin: 0 0 16px; }
.preview dl dt { color: var(--gray-light); }
.preview dl dd { margin: 0; color: var(--ink); }
.preview table { width: 100%; border-collapse: collapse; }
.preview td { padding: 8px 6px; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.preview td:first-child { padding-left: 0; }
.preview td:last-child { padding-right: 0; }
.preview td.amount { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.preview tr.pv-head td { color: var(--gray-light); font-size: 11.5px; font-weight: 700; border-bottom: 1.5px solid var(--line-strong); }
.preview tr.sub td { color: var(--gray); border-bottom: none; padding: 3px 6px; }
.preview tr.sub td:first-child { padding-left: 0; }
.preview tr.pv-total td { font-weight: 800; font-size: 17px; border-top: 1.5px solid var(--line-strong); padding-top: 12px; }
.preview .pv-note { margin: 14px 0 0; font-size: 13px; color: var(--gray); }

/* ---- done ---- */
.done-card { text-align: center; }
.done-mark {
  width: 54px; height: 54px; border-radius: 50%; border: 2px solid var(--ink);
  margin: 6px auto 18px; display: grid; place-items: center;
}
.done-mark svg { width: 26px; height: 26px; }
.done-amount {
  display: inline-block; margin: 6px 0 4px; font-size: 26px; font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.done-sub { color: var(--gray); font-size: 13px; margin: 0 0 22px; }

/* ---- responsive ---- */
@media (max-width: 540px) {
  body { font-size: 14px; line-height: 1.7; }
  h2 { font-size: 18px; }
  h3, .section-label { font-size: 11px; }
  .lead { font-size: 12.5px; }
  .screen { padding: 20px 16px; }
  .stepper li .lbl { display: none; }
  .stepper { margin-bottom: 18px; }
  .field > .label { font-size: 12.5px; }
  input[type="text"], input[type="email"], input[type="tel"], input[type="url"],
  input[type="number"], input[type="date"], select, textarea { padding: 10px 12px; font-size: 14px; }
  .checkgrid { grid-template-columns: 1fr; gap: 4px 12px; }
  .checkgrid label, .check { font-size: 13.5px; }
  /* 「このブラウザを記憶する…」を1行に収める */
  .remember-row .check, .check.remember-line { font-size: 11px; line-height: 1.4; white-space: nowrap; }
  .remember-row .check input, .check.remember-line input { width: 15px; height: 15px; }
  .meta-line { font-size: 12px; }
  .totals .row { font-size: 13px; }
  .totals .row.total { font-size: 16px; }
  table.items th.amount, table.items td.amount { width: 92px; }
  .actions { flex-wrap: wrap; gap: 10px; }
  .actions button { flex: 1 1 auto; padding: 11px 16px; font-size: 14px; }
  .actions .spacer { display: none; }
}
