:root {
  --ink: #172033;
  --muted: #596579;
  --paper: #ffffff;
  --line: #cfd6e0;
  --line-light: #e4e8ee;
  --navy: #17365d;
  --navy-dark: #102844;
  --navy-pale: #eef3f8;
  --amber: #8a5a18;
  --amber-pale: #faf6ed;
  --background: #eef1f5;
}

* { box-sizing: border-box; }
html { color: var(--ink); background: var(--background); font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", "Noto Sans JP", sans-serif; line-height: 1.75; }
body { margin: 0; }
button, input, select, textarea { font: inherit; }
p, li, h1, h2, h3, label { line-break: strict; text-wrap: pretty; }

/* ログイン画面 */
.login-page { min-height: 100vh; padding: 48px 24px; background: var(--background); }
.login-shell { width: min(100%, 1040px); margin: 0 auto; overflow: hidden; background: var(--paper); border: 1px solid #bcc5d1; border-radius: 6px; }
.login-document-header { display: flex; justify-content: space-between; align-items: center; gap: 32px; padding: 26px 36px; color: white; background: var(--navy); border-bottom: 4px solid #9aaabd; }
.login-document-header h1 { margin: 2px 0 0; font-size: 27px; line-height: 1.35; letter-spacing: .02em; }
.login-document-header .eyebrow { color: rgba(255,255,255,.76); }
.document-type { flex: 0 0 auto; margin: 0; padding: 5px 12px; border: 1px solid rgba(255,255,255,.45); font-size: 12px; letter-spacing: .06em; }
.login-introduction { padding: 24px 36px; border-bottom: 1px solid var(--line); }
.login-introduction p { margin: 0; color: #3f4d61; font-size: 14px; }
.login-introduction .recipient { margin-bottom: 8px; color: var(--ink); font-size: 16px; font-weight: 700; }
.login-layout { display: grid; grid-template-columns: minmax(330px, .82fr) minmax(440px, 1.18fr); }
.login-main { padding: 34px 36px 38px; border-right: 1px solid var(--line); }
.login-aside { padding: 34px 36px 38px; background: #f7f9fb; }
.section-heading { display: grid; grid-template-columns: 34px 1fr; gap: 13px; align-items: start; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.section-heading > span { display: grid; place-items: center; width: 34px; height: 28px; color: white; background: var(--navy); font-size: 11px; font-weight: 800; }
.section-heading h2 { margin: -2px 0 2px; font-size: 20px; line-height: 1.45; }
.section-heading p { margin: 0; color: var(--muted); font-size: 13px; }
.login-form { display: grid; gap: 19px; margin-top: 24px; }
.login-form .primary-button { width: 100%; margin-top: 2px; }
.login-document-footer { padding: 15px 36px; color: #667085; background: #f2f4f7; border-top: 1px solid var(--line); font-size: 12px; text-align: right; }
.login-document-footer p { margin: 0; }

.security-panel { padding: 0 0 26px 18px; border-left: 3px solid var(--navy); }
.security-panel strong, .retention-notice strong { display: block; color: var(--navy-dark); font-size: 15px; }
.security-panel p { margin: 7px 0 0; color: #455469; font-size: 13px; }
.security-panel ul { margin: 12px 0 0; padding-left: 20px; color: #3f4d61; font-size: 13px; }
.security-panel li + li { margin-top: 5px; }
.retention-notice { margin-top: 26px; padding: 23px 0 0 21px; border-top: 1px solid var(--line); border-left: 3px solid #a77b3c; }
.retention-notice p { margin: 7px 0 0; color: #4c4a45; font-size: 13px; }

/* 共通ヘッダー・ページ */
.site-header { position: sticky; top: 0; z-index: 10; color: white; background: var(--navy); border-bottom: 4px solid #9aaabd; }
.header-inner { width: min(calc(100% - 48px), 1040px); min-height: 76px; margin: auto; display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 20px; }
.eyebrow, .header-title { margin: 0; line-height: 1.4; }
.eyebrow { color: var(--muted); font-size: 11px; letter-spacing: .08em; }
.site-header .eyebrow { color: rgba(255,255,255,.72); }
.header-title { font-size: 17px; font-weight: 700; letter-spacing: .025em; }
.status-chip { padding: 4px 11px; color: white; border: 1px solid rgba(255,255,255,.45); font-size: 12px; font-weight: 700; }
.hero, .form-card, .site-footer { width: min(calc(100% - 48px), 1040px); margin-inline: auto; }
.hero { padding: 42px 0 26px; }
.compact-hero { padding-bottom: 24px; }
.kicker { margin: 0 0 8px; color: var(--navy); font-size: 14px; font-weight: 700; }
.hero h1 { max-width: 820px; margin: 0; font-size: clamp(28px, 4vw, 38px); line-height: 1.4; letter-spacing: .005em; }
.lead { max-width: 820px; margin: 15px 0 0; color: #465469; font-size: 15px; }
.mobile-break { display: none; }
.notice, .sharing-notice, .sharing-review { padding: 15px 18px; border: 1px solid var(--line); border-left: 4px solid var(--navy); background: #f7f9fb; }
.notice { display: flex; gap: 12px; align-items: flex-start; margin-top: 22px; color: #664514; background: var(--amber-pale); border-left-color: #a77b3c; }
.notice p { margin: 0; font-size: 13px; }
.notice-icon { flex: 0 0 auto; display: grid; place-items: center; width: 22px; height: 22px; color: white; background: #93621f; font-size: 12px; font-weight: 800; }
.sharing-notice { margin-top: 12px; }
.sharing-review { margin: 22px 0 4px; }
.sharing-notice p, .sharing-review p { margin: 5px 0 0; color: #405068; font-size: 13px; }
.hero > .security-panel { margin-top: 18px; padding: 18px 20px; background: #f7f9fb; border: 1px solid var(--line); border-left: 4px solid var(--navy); }
.hero > .retention-notice { margin-top: 12px; padding: 15px 18px; background: var(--amber-pale); border: 1px solid #ddd3c1; border-left: 4px solid #a77b3c; }

/* 入力フォーム */
.form-card { margin-bottom: 52px; padding: clamp(28px, 5vw, 48px); background: var(--paper); border: 1px solid #bcc5d1; border-radius: 5px; }
.respondent-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; padding-bottom: 30px; border-bottom: 2px solid #c4ccd7; }
label { display: grid; gap: 7px; color: #28364a; font-size: 13px; font-weight: 700; }
input, textarea, select { width: 100%; color: var(--ink); background: white; border: 1px solid #aeb7c5; border-radius: 3px; outline: none; transition: border-color .14s ease, box-shadow .14s ease; }
input, select { height: 46px; padding: 0 12px; }
select { padding-right: 38px; }
textarea { min-height: 126px; padding: 11px 12px; resize: vertical; line-height: 1.75; }
input:focus, textarea:focus, select:focus { border-color: #2f5f91; box-shadow: 0 0 0 3px rgba(47,95,145,.12); }
::placeholder { color: #8b95a5; }
.wide-field { grid-column: 1 / -1; }
.required { margin-left: 5px; color: #a32626; }
.optional { margin-left: 5px; color: var(--muted); font-weight: 500; }
.sharing-consent { display: flex; grid-template-columns: none; gap: 11px; align-items: flex-start; padding: 14px 16px; background: #f5f7f9; border: 1px solid var(--line); line-height: 1.65; cursor: pointer; }
.sharing-consent input, .confirmation-check input { flex: 0 0 auto; width: 18px; height: 18px; margin-top: 3px; }
.questions { display: grid; }
.question-block { padding: 34px 0; border-bottom: 1px solid var(--line); }
.question-heading { display: grid; grid-template-columns: 36px 1fr; gap: 13px; align-items: start; }
.question-number { display: grid; place-items: center; min-height: 28px; color: white; background: var(--navy); font-size: 11px; font-weight: 800; letter-spacing: .06em; }
.question-block h2, .question-heading h2 { margin: -2px 0 0; font-size: 18px; line-height: 1.55; }
.question-block > p { margin: 12px 0 17px 49px; color: #455469; font-size: 14px; }
.answer-grid { display: grid; gap: 16px; margin-left: 49px; }
.primary-button, .secondary-button { min-height: 48px; padding: 11px 24px; border-radius: 3px; font-weight: 700; cursor: pointer; }
.primary-button { color: white; background: var(--navy); border: 1px solid var(--navy); }
.primary-button:hover { background: var(--navy-dark); }
.secondary-button { color: var(--navy); background: white; border: 1px solid #8e9bac; }
.primary-button:disabled, .secondary-button:disabled { opacity: .5; cursor: not-allowed; }
.submit-area { padding-top: 32px; text-align: center; }
.submit-area p { margin: 0 0 12px; color: var(--muted); font-size: 13px; }
.submit-area button { width: min(100%, 360px); }
.error-message { margin: 0 0 15px !important; padding: 11px 13px; color: #9e2424 !important; background: #fff5f4; border: 1px solid #e3b7b2; text-align: left; }

/* 確認・保存済み画面 */
.state-page { min-height: 100vh; display: grid; place-items: center; padding: 28px; }
.state-card { width: min(100%, 560px); padding: 40px; text-align: center; background: white; border: 1px solid var(--line); }
.state-card h1 { margin: 16px 0 8px; font-size: 23px; }
.state-card p { margin: 0; color: var(--muted); }
.spinner { display: block; width: 32px; height: 32px; margin: auto; border: 3px solid #d9dee6; border-top-color: var(--navy); border-radius: 50%; animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.locked-hero { text-align: center; }
.lock-symbol { display: grid; place-items: center; width: 44px; height: 44px; margin: 0 auto 15px; color: white; background: #2f684f; font-size: 20px; }
.identity-review { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; padding-bottom: 28px; border-bottom: 1px solid var(--line); }
.identity-review dt { color: var(--muted); font-size: 12px; font-weight: 700; }
.identity-review dd { margin: 0; overflow-wrap: anywhere; }
.answer-review article { padding: 28px 0; border-bottom: 1px solid var(--line); }
.review-question { margin: 12px 0 13px 49px; color: #455469; font-size: 14px; }
.answer-status { display: inline-block; margin-left: 49px; padding: 3px 9px; border: 1px solid currentColor; font-size: 12px; font-weight: 700; }
.answer-status.answered { color: #275f43; background: #f1f7f3; }
.answer-status.cannot_answer { color: #82520f; background: #fff8ec; }
.answer-status.decline_answer { color: #526072; background: #f2f4f6; }
.review-answer { margin: 13px 0 0 49px; padding: 13px 15px; white-space: pre-wrap; background: #f6f8fa; border: 1px solid var(--line-light); }
.review-answer h3, .review-answer p { margin: 0; }
.review-answer h3 { color: var(--muted); font-size: 12px; }
.final-confirmation { margin-top: 32px; padding: 21px; background: var(--amber-pale); border: 1px solid #ddd0ba; border-left: 4px solid #a77b3c; }
.final-confirmation h2 { margin: 0 0 12px; color: #704b16; font-size: 18px; }
.confirmation-check { display: flex; grid-template-columns: none; gap: 10px; align-items: flex-start; color: #59401d; cursor: pointer; }
.review-actions { display: flex; justify-content: center; gap: 11px; margin-top: 22px; }
.receipt { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin: 24px 0 0; padding: 18px; text-align: left; background: #f0f7f3; border: 1px solid #bad5c5; }
.receipt dt { color: #52705f; font-size: 12px; }
.receipt dd { margin: 3px 0 0; font-weight: 700; overflow-wrap: anywhere; }
.site-footer { padding-bottom: 40px; color: #6f7887; text-align: center; font-size: 12px; }
.site-footer p { margin: 0; }

@media (max-width: 820px) {
  .login-page { padding: 24px 16px; }
  .login-layout { grid-template-columns: 1fr; }
  .login-main { border-right: 0; border-bottom: 1px solid var(--line); }
  .login-aside { background: #f7f9fb; }
  .header-inner, .hero, .form-card, .site-footer { width: min(calc(100% - 32px), 1040px); }
  .respondent-grid { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .login-page { padding: 0; }
  .login-shell { min-height: 100vh; border: 0; border-radius: 0; }
  .login-document-header { align-items: flex-start; padding: 22px 20px; }
  .login-document-header h1 { font-size: 23px; }
  .document-type { display: none; }
  .login-introduction, .login-main, .login-aside { padding-left: 20px; padding-right: 20px; }
  .login-document-footer { padding: 14px 20px; text-align: left; }
  .header-inner { min-height: 68px; }
  .hero { padding: 34px 0 22px; }
  .hero h1 { font-size: 27px; }
  .form-card { padding: 24px 18px; }
  .question-heading { grid-template-columns: 32px 1fr; gap: 10px; }
  .question-block > p, .answer-grid, .review-question, .answer-status, .review-answer { margin-left: 0; }
  .identity-review, .receipt { grid-template-columns: 1fr; }
  .review-actions { flex-direction: column-reverse; }
  .review-actions button { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
