:root {
  --ink: #172536;
  --muted: #667487;
  --paper: #f4f7fa;
  --surface: #ffffff;
  --line: #d9e1e8;
  --blue: #1b4f7d;
  --blue-dark: #103451;
  --blue-soft: #e7f0f7;
  --signal: #ed773c;
  --signal-soft: #fff0e8;
  --green: #1f765d;
  --shadow: 0 18px 60px rgba(20, 45, 70, 0.09);
  --radius: 5px;
  font-family: "Yu Gothic UI", "Hiragino Sans", "Noto Sans JP", sans-serif;
  color: var(--ink);
  background: #dfe7ed;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; background: linear-gradient(140deg, #e8eef3 0%, #d9e2e9 100%); }
button, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, textarea:focus-visible, input:focus-visible { outline: 3px solid rgba(237, 119, 60, 0.42); outline-offset: 3px; }

.page-shell { width: min(1500px, calc(100% - 36px)); margin: 18px auto; background: var(--paper); box-shadow: 0 30px 90px rgba(20, 45, 70, 0.16); border: 1px solid rgba(255,255,255,.7); }
.topbar { height: 76px; padding: 0 42px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.72); backdrop-filter: blur(12px); }
.wordmark { color: var(--ink); text-decoration: none; display: inline-flex; align-items: center; gap: 12px; }
.wordmark-mark { width: 38px; height: 38px; display: grid; place-items: center; background: var(--blue); color: white; font: 700 20px/1 Georgia, serif; transform: skewX(-8deg); }
.wordmark b { display: block; font-size: 15px; letter-spacing: .08em; }
.wordmark small { display: block; margin-top: 2px; color: var(--muted); font: 600 10px/1.3 Consolas, monospace; letter-spacing: .12em; }
.safety-label { display: flex; align-items: center; gap: 9px; color: #456174; font-size: 12px; font-weight: 700; letter-spacing: .04em; }
.safety-label span { width: 8px; height: 8px; background: var(--green); border-radius: 50%; box-shadow: 0 0 0 5px rgba(31,118,93,.11); }

main { padding: 0 42px 58px; }
.hero { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(440px, .7fr); gap: 80px; align-items: end; padding: 74px 24px 60px; border-bottom: 1px solid var(--line); position: relative; overflow: hidden; }
.hero::after { content: ""; position: absolute; width: 360px; height: 360px; right: 8%; top: -285px; border: 1px solid #b8c8d5; border-radius: 50%; box-shadow: 0 0 0 44px rgba(181,199,212,.15), 0 0 0 88px rgba(181,199,212,.08); }
.eyebrow, .panel-kicker { color: var(--blue); font: 700 11px/1.3 Consolas, "SFMono-Regular", monospace; letter-spacing: .16em; margin: 0 0 14px; }
h1 { margin: 0; font-family: "Yu Mincho", "Hiragino Mincho ProN", serif; font-size: clamp(48px, 5vw, 76px); line-height: 1.13; letter-spacing: -.045em; font-weight: 600; }
h1 em { font-style: normal; color: var(--blue); position: relative; }
h1 em::after { content: ""; position: absolute; left: 0; right: 0; bottom: -7px; height: 3px; background: var(--signal); transform: scaleX(.72); transform-origin: left; }
.lead { max-width: 700px; margin: 30px 0 0; color: #526173; font-size: 15px; line-height: 2; }
.process-rail { position: relative; padding: 4px 0; }
.process-rail ol { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(4, 1fr); position: relative; }
.rail-line { position: absolute; top: 27px; left: 7%; right: 7%; height: 1px; background: #b7c5d0; }
.process-rail li { position: relative; display: grid; justify-items: center; text-align: center; gap: 6px; }
.process-rail li > span { width: 46px; height: 46px; display: grid; place-items: center; color: #708090; background: var(--paper); border: 1px solid #bdc9d3; border-radius: 50%; font: 700 11px/1 Consolas, monospace; z-index: 1; }
.process-rail li.is-done > span { background: var(--blue); border-color: var(--blue); color: white; }
.process-rail li.is-active > span { border: 2px solid var(--signal); color: var(--signal); box-shadow: 0 0 0 6px var(--signal-soft); }
.process-rail b { font-size: 13px; margin-top: 5px; }
.process-rail small { color: var(--muted); font-size: 10px; }

.workspace { display: grid; grid-template-columns: minmax(340px, .74fr) minmax(560px, 1.26fr); gap: 22px; padding: 34px 0 0; align-items: start; min-width: 0; }
.input-panel, .output-panel { background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); }
.input-panel { padding: 28px; position: sticky; top: 18px; min-width: 0; }
.output-panel { min-height: 650px; padding: 28px; min-width: 0; }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.panel-heading h2 { margin: 0; font: 700 22px/1.35 "Yu Mincho", "Hiragino Mincho ProN", serif; letter-spacing: .02em; }
.panel-kicker { margin-bottom: 8px; }
.text-button, .copy-button { border: 0; color: var(--blue); background: transparent; cursor: pointer; font-size: 12px; font-weight: 700; padding: 7px 0; }
.text-button { border-bottom: 1px solid currentColor; }
.copy-button { display: inline-flex; gap: 7px; align-items: center; padding: 8px 11px; border: 1px solid var(--line); background: #f8fafc; }
.copy-button svg { width: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; }
textarea { width: 100%; min-height: 292px; margin-top: 24px; padding: 20px; resize: vertical; color: #26384a; background: #f8fafb; border: 1px solid #cfd9e1; border-left: 3px solid var(--blue); border-radius: 0; line-height: 1.9; font-size: 14px; }
.input-note { display: flex; gap: 11px; margin: 16px 0 22px; color: #627082; font-size: 11px; line-height: 1.7; }
.input-note p { margin: 0; }
.input-note b { color: #3b4d5d; }
.note-icon { flex: 0 0 auto; width: 19px; height: 19px; margin-top: 2px; display: grid; place-items: center; border: 1px solid #91a2af; border-radius: 50%; font: 700 11px/1 Georgia, serif; }
.primary-button { width: 100%; min-height: 54px; padding: 0 18px 0 22px; display: flex; justify-content: space-between; align-items: center; border: 0; background: var(--blue); color: white; cursor: pointer; font-weight: 700; letter-spacing: .04em; box-shadow: 5px 5px 0 var(--blue-dark); transition: transform .18s ease, box-shadow .18s ease, background .18s ease; }
.primary-button:hover { background: #24608f; transform: translate(-2px, -2px); box-shadow: 7px 7px 0 var(--blue-dark); }
.primary-button:active { transform: translate(3px, 3px); box-shadow: 2px 2px 0 var(--blue-dark); }
.primary-button:disabled { cursor: wait; background: #6f8495; box-shadow: none; transform: none; }
.primary-button svg { width: 21px; fill: none; stroke: currentColor; stroke-width: 2; }
.primary-button.is-busy svg { animation: nudge 1s ease-in-out infinite; }
.error-message { margin: 15px 0 0; color: #a44128; font-size: 12px; }

.status-strip { margin: 25px 0 0; padding: 16px 18px; display: flex; align-items: center; justify-content: space-between; gap: 20px; background: var(--blue-dark); color: white; }
.status-strip > div { display: flex; align-items: center; gap: 9px; font-size: 12px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #70d9b5; box-shadow: 0 0 0 5px rgba(112,217,181,.13); }
.status-strip dl { display: flex; margin: 0; }
.status-strip dl div { min-width: 92px; padding-left: 18px; border-left: 1px solid rgba(255,255,255,.2); }
.status-strip dt { color: #b5c9d7; font-size: 9px; letter-spacing: .1em; }
.status-strip dd { margin: 3px 0 0; font: 700 14px/1.2 Consolas, monospace; }

.tabs { display: flex; gap: 0; margin-top: 24px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: thin; }
.tabs button { flex: 0 0 auto; border: 0; border-bottom: 3px solid transparent; background: transparent; color: #748190; padding: 13px 14px 11px; cursor: pointer; font-size: 11px; font-weight: 700; white-space: nowrap; }
.tabs button[aria-selected="true"] { color: var(--blue); border-bottom-color: var(--signal); }
.tabs button span { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; margin-left: 4px; background: var(--signal-soft); color: #b54d1c; border-radius: 20px; font: 700 9px/1 Consolas, monospace; }
.tab-panels { min-height: 415px; padding-top: 25px; }
.tab-panel[hidden] { display: none; }
.result-intro { display: flex; justify-content: space-between; gap: 28px; align-items: end; padding-bottom: 19px; }
.result-intro > div { flex: 0 0 auto; }
.result-intro h3 { margin: 7px 0 0; font: 700 21px/1.3 "Yu Mincho", "Hiragino Mincho ProN", serif; }
.result-intro > p { max-width: 360px; margin: 0; color: var(--muted); font-size: 11px; line-height: 1.7; text-align: right; }
.draft-badge { display: inline-flex; padding: 4px 7px; background: var(--blue-soft); color: var(--blue); font: 700 9px/1.2 Consolas, monospace; letter-spacing: .08em; }
.draft-badge.warning { background: var(--signal-soft); color: #ad481b; }
.overview-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 0; border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.overview-grid div { min-height: 78px; padding: 15px 17px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.overview-grid dt { color: var(--muted); font-size: 10px; letter-spacing: .08em; }
.overview-grid dd { margin: 8px 0 0; font-size: 13px; font-weight: 700; line-height: 1.5; }
.overview-grid dd.is-unconfirmed { color: #b04c20; }
.department-list { display: grid; gap: 10px; }
.department-card { display: grid; grid-template-columns: 90px 140px 1fr; align-items: center; gap: 12px; padding: 17px; border: 1px solid var(--line); border-left: 3px solid #abb8c2; }
.department-card.is-primary { border-left-color: var(--blue); background: #f7fafc; }
.department-card > span { color: var(--blue); font: 700 10px/1.3 Consolas, monospace; }
.department-card h4, .department-card p { margin: 0; }
.department-card h4 { font-size: 13px; }
.department-card p { color: var(--muted); font-size: 11px; line-height: 1.6; }
.missing-list { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--line); }
.missing-list li { display: grid; grid-template-columns: 42px 1fr; gap: 13px; padding: 14px 8px; border-bottom: 1px solid var(--line); }
.missing-list li > span { color: var(--signal); font: 700 11px/1.5 Consolas, monospace; }
.missing-list h4, .missing-list p { margin: 0; }
.missing-list h4 { font-size: 12px; }
.missing-list p { color: var(--muted); font-size: 10px; line-height: 1.6; margin-top: 4px; }
.resource-list { display: grid; gap: 10px; }
.resource-list a { display: grid; grid-template-columns: 78px 1fr 24px; gap: 14px; align-items: center; padding: 16px; color: inherit; text-decoration: none; border: 1px solid var(--line); transition: border .15s ease, background .15s ease; }
.resource-list a:hover { background: #f6f9fb; border-color: #a9bbc9; }
.resource-type { color: var(--blue); font: 700 10px/1.4 Consolas, monospace; }
.resource-list h4, .resource-list p { margin: 0; }
.resource-list h4 { font-size: 12px; }
.resource-list p { margin-top: 4px; color: var(--muted); font-size: 10px; line-height: 1.6; }
.resource-list svg { width: 20px; fill: none; stroke: var(--blue); stroke-width: 1.6; }
.checklist-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 11px; }
.checklist-grid section { padding: 15px; border: 1px solid var(--line); }
.checklist-grid h4 { margin: 0 0 10px; color: var(--blue); font-size: 11px; }
.checklist-grid label { display: grid; grid-template-columns: 17px 1fr; gap: 8px; margin-top: 8px; color: #47586a; font-size: 10px; line-height: 1.55; cursor: pointer; }
.checklist-grid input { width: 14px; height: 14px; margin: 1px 0 0; accent-color: var(--blue); }
.reply-paper { border: 1px solid var(--line); background: repeating-linear-gradient(#fff 0, #fff 27px, #eef2f5 28px); }
.paper-meta { display: grid; grid-template-columns: 70px 1fr; padding: 14px 18px; background: #eef3f7; border-bottom: 1px solid var(--line); font-size: 11px; }
.paper-meta span { color: var(--muted); }
.reply-paper pre { padding: 19px; margin: 0; white-space: pre-wrap; font: 11px/2 "Yu Gothic UI", sans-serif; color: #3e4c59; }
.output-panel.has-updated .tab-panel:not([hidden]) { animation: reveal .38s ease both; }

.review-gate { margin-top: 22px; padding: 27px 30px; display: grid; grid-template-columns: 130px 1fr auto; gap: 28px; align-items: center; background: #edf2f5; border: 1px solid #cbd6de; border-top: 4px solid var(--signal); }
.review-stamp { width: 112px; height: 88px; display: grid; place-content: center; border: 2px solid var(--signal); color: var(--signal); text-align: center; transform: rotate(-3deg); }
.review-stamp span { font: 700 10px/1.2 Consolas, monospace; letter-spacing: .18em; }
.review-stamp b { margin-top: 4px; font-size: 16px; letter-spacing: .08em; }
.review-gate h2 { margin: 0; font: 700 20px/1.5 "Yu Mincho", "Hiragino Mincho ProN", serif; }
.review-gate p:not(.panel-kicker) { margin: 8px 0 0; max-width: 720px; color: var(--muted); font-size: 11px; line-height: 1.8; }
.review-gate ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; color: #485b6a; font-size: 11px; font-weight: 700; }
.review-gate li { white-space: nowrap; }
.review-gate li span { color: var(--green); margin-right: 7px; }

footer { display: flex; justify-content: space-between; gap: 24px; padding: 24px 42px; color: #778593; border-top: 1px solid var(--line); background: #eef2f5; font-size: 10px; }
footer p { margin: 0; }
footer nav { display: flex; gap: 18px; }
footer a { color: var(--blue); }
.toast { position: fixed; left: 50%; bottom: 28px; padding: 11px 17px; color: white; background: var(--blue-dark); font-size: 12px; font-weight: 700; opacity: 0; transform: translate(-50%, 16px); pointer-events: none; transition: .22s ease; box-shadow: var(--shadow); }
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@keyframes reveal { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: translateY(0); } }
@keyframes nudge { 0%,100% { transform: translateX(0); } 50% { transform: translateX(4px); } }

@media (max-width: 1040px) {
  .hero { grid-template-columns: 1fr; gap: 48px; }
  .workspace { grid-template-columns: 1fr; }
  .input-panel { position: static; }
  .review-gate { grid-template-columns: 110px 1fr; }
  .review-gate ul { grid-column: 2; grid-template-columns: repeat(3, auto); justify-content: start; }
}

@media (max-width: 680px) {
  .page-shell { width: 100%; margin: 0; border: 0; }
  .topbar { height: 68px; padding: 0 18px; }
  .safety-label { font-size: 9px; }
  .wordmark small { display: none; }
  main { padding: 0 14px 30px; }
  .hero { padding: 48px 5px 38px; gap: 38px; }
  h1 { font-size: clamp(34px, 10vw, 46px); }
  .lead { font-size: 13px; line-height: 1.85; }
  .process-rail b { font-size: 11px; }
  .process-rail small { display: none; }
  .workspace { padding-top: 18px; gap: 14px; }
  .input-panel, .output-panel { padding: 20px 16px; }
  .output-heading { align-items: flex-start; }
  .copy-button span { display: none; }
  textarea { min-height: 330px; }
  .status-strip { align-items: flex-start; flex-direction: column; }
  .status-strip dl { width: 100%; }
  .status-strip dl div { flex: 1; min-width: 0; padding-left: 11px; }
  .tabs { width: calc(100% + 32px); max-width: calc(100% + 32px); margin-left: -16px; margin-right: -16px; padding-left: 8px; }
  .result-intro { display: block; }
  .result-intro > p { margin-top: 10px; text-align: left; }
  .overview-grid, .checklist-grid { grid-template-columns: 1fr; }
  .department-card { grid-template-columns: 88px 1fr; }
  .department-card p { grid-column: 1 / -1; }
  .resource-list a { grid-template-columns: 68px minmax(0, 1fr) 20px; }
  .resource-list h4, .resource-list p { overflow-wrap: anywhere; }
  .review-gate { grid-template-columns: 1fr; padding: 24px 20px; }
  .review-stamp { width: 96px; height: 72px; }
  .review-gate ul { grid-column: 1; grid-template-columns: 1fr; }
  footer { padding: 22px 18px; flex-direction: column; }
  footer nav { flex-wrap: wrap; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
