/* Layout: 手順レール | 申込画面 | 状態パネルの3列。狭い幅では1列に積む。 */
:root {
  --bg: #F2F6F9;
  --surface: #FFFFFF;
  --surface-2: #E8EFF4;
  --fg: #13222D;
  --muted: #566874;
  --line: #D3DDE5;
  --brand: #1790D6;
  --brand-strong: #0B6DA6;
  --on-brand: #FFFFFF;
  --accent: #FFD400;
  --on-accent: #2B2300;
  --ok: #1B7A4B;
  --ok-bg: #E2F3E9;
  --warn: #7A5200;
  --warn-bg: #FFF2C2;
  --danger: #B3261E;
  --danger-bg: #FBE6E4;
  --info-bg: #E3F1FA;
  --font-body: 'Noto Sans JP', 'Hiragino Sans', 'Yu Gothic', 'Meiryo', sans-serif;
  --font-num: 'IBM Plex Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0D1923; --surface: #14232F; --surface-2: #1B2E3B; --fg: #E5EDF3; --muted: #9AAFBD; --line: #29404F;
    --brand: #3AA8E8; --brand-strong: #3AA8E8; --on-brand: #04202E; --accent: #FFD400; --on-accent: #2B2300;
    --ok: #5DD39A; --ok-bg: #12332A; --warn: #FFD76A; --warn-bg: #3A3110; --danger: #FF8F87; --danger-bg: #3C1B1A; --info-bg: #12303F;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0D1923; --surface: #14232F; --surface-2: #1B2E3B; --fg: #E5EDF3; --muted: #9AAFBD; --line: #29404F;
  --brand: #3AA8E8; --brand-strong: #3AA8E8; --on-brand: #04202E; --accent: #FFD400; --on-accent: #2B2300;
  --ok: #5DD39A; --ok-bg: #12332A; --warn: #FFD76A; --warn-bg: #3A3110; --danger: #FF8F87; --danger-bg: #3C1B1A; --info-bg: #12303F;
  color-scheme: dark;
}

body { background: var(--bg); color: var(--fg); font-family: var(--font-body); font-size: 15px; line-height: 1.7; padding-left: max(clamp(16px, 4vw, 32px), env(safe-area-inset-left, 0px)); padding-right: max(clamp(16px, 4vw, 32px), env(safe-area-inset-right, 0px)); padding-block: 20px 56px; }
.page { max-width: 1120px; margin-inline: auto; display: flex; flex-direction: column; gap: 28px; }
.page * { box-sizing: border-box; }
h1, h2, h3, p, dl, dd, ol, ul { margin: 0; }
h1 { font-size: 20px; line-height: 1.4; }
h2 { font-size: 22px; line-height: 1.4; text-wrap: balance; }
h3 { font-size: 16px; line-height: 1.5; }
.mono { font-family: var(--font-num); font-variant-numeric: tabular-nums; letter-spacing: 0.04em; }

.top { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 24px; }
.top > div { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.sub { color: var(--muted); font-size: 13px; }

.app { display: grid; grid-template-columns: 172px minmax(0, 1fr) 256px; gap: 24px; align-items: start; }

/* 手順レール */
.rail ol { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.rail li { min-width: 0; }
.rail button, .rail .stepline { all: unset; box-sizing: border-box; display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: 6px; font-size: 14px; }
.rail button { cursor: pointer; }
.rail button:hover { background: var(--surface-2); }
.rail button:focus-visible { outline: 2px solid var(--brand-strong); outline-offset: 2px; }
.rail i { font-style: normal; font-family: var(--font-num); font-size: 12px; width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; border: 1.5px solid var(--line); color: var(--muted); flex: none; }
.rail b { font-weight: 500; color: var(--muted); }
.rail .cur i { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 500; }
.rail .cur b { color: var(--fg); font-weight: 700; }
.rail .done i { background: var(--brand-strong); border-color: var(--brand-strong); color: var(--on-brand); }
.rail .done b { color: var(--fg); }

/* 申込画面 */
.screen { min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: clamp(18px, 3vw, 32px); display: flex; flex-direction: column; gap: 20px; }
.lead { color: var(--muted); }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field label, .field .lbl { font-weight: 700; font-size: 14px; }
.field input[type=text], .field input[type=email], .field input[type=tel], .field input[type=date], .field input[type=time], .field input[type=number], .field select, .field textarea {
  font: inherit; font-size: 16px; color: var(--fg); background: var(--bg); border: 1.5px solid var(--line); border-radius: 6px; padding: 9px 12px; width: 100%; min-width: 0;
}
.field textarea { min-height: 120px; resize: vertical; }
.field input:focus-visible, .field select:focus-visible, .field textarea:focus-visible { outline: 2px solid var(--brand-strong); outline-offset: 1px; border-color: var(--brand-strong); }
.field input[readonly] { color: var(--muted); }
.field.err input, .field.err select, .field.err textarea { border-color: var(--danger); }
.hint { font-size: 13px; color: var(--muted); }
.errtxt { font-size: 13px; color: var(--danger); font-weight: 500; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.check { display: flex; align-items: flex-start; gap: 10px; font-size: 14px; }
.check input { margin-top: 5px; width: 18px; height: 18px; accent-color: var(--brand-strong); flex: none; }
.check.err span { color: var(--danger); }

.actions { display: flex; flex-wrap: wrap; gap: 10px; }
.btn { font: inherit; font-size: 15px; font-weight: 700; padding: 10px 20px; border-radius: 6px; border: 1.5px solid var(--line); background: var(--surface); color: var(--fg); cursor: pointer; }
.btn.primary { background: var(--brand-strong); border-color: var(--brand-strong); color: var(--on-brand); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.secondary:hover, .btn.ghost:hover { background: var(--surface-2); }
.btn.ghost { font-weight: 500; font-size: 14px; padding: 7px 14px; }
.btn.small { font-size: 13px; padding: 6px 12px; font-weight: 500; }

.samples { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.note { font-size: 13px; color: var(--muted); border-top: 1px solid var(--line); padding-top: 14px; }

/* 結果と通知 */
.result, .banner { border-radius: 8px; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; border: 1px solid transparent; min-width: 0; }
.result.ok, .banner.ok { background: var(--ok-bg); border-color: var(--ok); }
.result.warn, .banner.warn { background: var(--warn-bg); border-color: var(--warn); }
.banner.danger { background: var(--danger-bg); border-color: var(--danger); }
.banner.info { background: var(--info-bg); border-color: var(--brand-strong); }
.result-h { font-weight: 700; display: flex; align-items: center; gap: 8px; }
.result.ok .result-h { color: var(--ok); }
.result.warn .result-h { color: var(--warn); }
.banner .bt { font-weight: 700; }

.kv { display: flex; flex-direction: column; }
.kv > div { display: grid; grid-template-columns: 9em minmax(0, 1fr); gap: 4px 16px; padding: 8px 0; border-top: 1px solid var(--line); }
.kv > div:first-child { border-top: 0; }
.kv dt { color: var(--muted); font-size: 13px; }
.kv dd { overflow-wrap: anywhere; }
.result .kv > div { border-color: color-mix(in srgb, currentColor 14%, transparent); }

.accordion { border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; font-size: 14px; }
.accordion summary { cursor: pointer; font-weight: 500; }
.accordion p { margin-top: 8px; color: var(--muted); font-size: 13px; }

.cardstub { border: 1.5px dashed var(--line); border-radius: 8px; padding: 22px 16px; text-align: center; color: var(--muted); font-size: 14px; background: var(--bg); }

.appno { display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; background: var(--info-bg); border-radius: 8px; }
.appno .mono { font-size: 26px; font-weight: 500; color: var(--brand-strong); }
.appno span:first-child { font-size: 13px; color: var(--muted); }


.opts { display: flex; flex-direction: column; gap: 8px; }
.opt { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: 8px; cursor: pointer; }
.opt:has(input:checked) { border-color: var(--brand-strong); background: var(--info-bg); }
.opt input { width: 18px; height: 18px; accent-color: var(--brand-strong); flex: none; }
.opt .p { margin-left: auto; font-family: var(--font-num); font-weight: 500; }
.camp { border: 1.5px solid var(--brand-strong); border-radius: 8px; padding: 14px; background: var(--info-bg); display: flex; flex-direction: column; gap: 10px; }
.camp .ct { font-weight: 700; }
.camp p { margin: 0; font-size: 14px; }
.camp details { font-size: 13px; color: var(--muted); }
.camp details ul { margin: 6px 0 0; padding-left: 18px; }
.camp label.chk { display: flex; align-items: center; gap: 10px; font-weight: 600; cursor: pointer; background: #fff; border: 1.5px solid var(--line); border-radius: 8px; padding: 10px 12px; }
.camp label.chk input { width: 18px; height: 18px; accent-color: var(--brand-strong); }
.opt .sub2 { font-size: 13px; color: var(--muted); font-weight: 400; }



/* 状態パネル */
.panel { min-width: 0; display: flex; flex-direction: column; gap: 18px; }
.panel .box { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.panel h3 { font-size: 14px; }
.panel .st { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 13px; padding-top: 8px; border-top: 1px solid var(--line); }
.panel .st:first-of-type { border-top: 0; padding-top: 0; }
.panel .st > span:first-child { color: var(--muted); }
.panel ul { padding-left: 1.1em; display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.chip { display: inline-block; font-size: 12px; font-weight: 700; padding: 1px 8px; border-radius: 3px; border: 1px solid transparent; white-space: nowrap; }
.chip.ok { background: var(--ok-bg); color: var(--ok); border-color: var(--ok); }
.chip.warn { background: var(--warn-bg); color: var(--warn); border-color: var(--warn); }
.chip.info { background: var(--info-bg); color: var(--brand-strong); border-color: var(--brand-strong); }
.chip.mute { background: var(--surface-2); color: var(--muted); border-color: var(--line); }


@media (max-width: 1000px) {
  .app { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .rail { overflow-x: auto; }
  .rail ol { flex-direction: row; gap: 4px; }
  .rail li { flex: none; }
  .rail button, .rail .stepline { width: auto; white-space: nowrap; padding: 6px 10px; }
  .panel { flex-direction: column; }
}
@media (max-width: 640px) {
  .grid2, .grid3 { grid-template-columns: minmax(0, 1fr); }
  .kv > div { grid-template-columns: minmax(0, 1fr); gap: 0; }
}
@media (prefers-reduced-motion: no-preference) {
  .screen { animation: rise .25s ease-out; }
  @keyframes rise { from { opacity: .4; transform: translateY(6px); } to { opacity: 1; transform: none; } }
}
/* 準備期間版 */
.grp { font-size: 14px; font-weight: 700; margin: 6px 0 -4px; }
.tl { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; }
.tl li { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.tl li:first-child { border-top: 0; }
.tl li > div:first-child { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tl .d { font-size: 13px; color: var(--muted); font-weight: 400; }
.box2 { border: 1.5px solid var(--warn); background: var(--warn-bg); border-radius: 8px; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.saveerr { color: var(--danger); font-weight: 700; font-size: 14px; }
/* 照会・送信中は二重に押せないようにする */
.btn:disabled { opacity: .6; cursor: progress; }
.btn.primary:disabled:hover { filter: none; }
