:root {
  --bg: #f6f5f2;
  --surface: #ffffff;
  --text: #1f2328;
  --muted: #646b73;
  --border: #dcdad4;
  --primary: #1d5f8a;
  --primary-text: #ffffff;
  --accent-bg: #e8f1f7;
  --danger: #b42318;
  --ok: #1a7f37;
  --radius: 10px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15171a;
    --surface: #1e2125;
    --text: #e8e6e3;
    --muted: #9aa1a9;
    --border: #353a40;
    --primary: #5aa7d6;
    --primary-text: #0d1b24;
    --accent-bg: #1c2c38;
    --danger: #f2826f;
    --ok: #6fcf8a;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Hiragino Sans", "Noto Sans JP", "Yu Gothic UI", Meiryo, sans-serif;
  line-height: 1.7;
}
.wrap { max-width: 880px; margin: 0 auto; padding: 0 16px; }
[hidden] { display: none !important; }

.site-header { background: var(--surface); border-bottom: 1px solid var(--border); padding: 20px 0 12px; margin-bottom: 24px; }
.site-header h1 { font-size: 1.4rem; margin: 0 0 4px; }
.site-header p { margin: 0 0 12px; color: var(--muted); font-size: .92rem; }
.steps { display: flex; gap: 8px; list-style: none; padding: 0; margin: 0; font-size: .85rem; }
.steps li { padding: 4px 12px; border-radius: 999px; color: var(--muted); border: 1px solid var(--border); }
.steps li.is-current { background: var(--primary); color: var(--primary-text); border-color: var(--primary); }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin: 0 0 20px; }
fieldset.card { min-width: 0; }
legend, .card h2 { font-weight: 700; font-size: 1.05rem; padding: 0 4px; margin: 0; }
.card h2 { margin-bottom: 12px; padding: 0; }
.section-note { color: var(--muted); font-size: .85rem; margin: 0 0 8px; }

.field { margin-top: 14px; }
.field > label, .field > .label { display: block; font-weight: 600; font-size: .92rem; margin-bottom: 4px; }
.req { color: var(--danger); font-size: .78rem; margin-left: 6px; font-weight: 600; }
input[type="text"], select, textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
}
textarea { min-height: 84px; resize: vertical; }
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.field.has-error input, .field.has-error textarea, .field.has-error select { border-color: var(--danger); }

.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 6px 12px; margin-top: 10px; }
.check-grid label { display: flex; align-items: center; gap: 6px; font-size: .92rem; cursor: pointer; }

.actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; margin: 8px 0 40px; }
.btn {
  padding: 10px 18px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.btn:hover { border-color: var(--primary); }
.btn-primary { background: var(--primary); color: var(--primary-text); border-color: var(--primary); }
.btn-ghost { background: transparent; }
.btn-small { padding: 5px 12px; font-size: .85rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.lead { color: var(--muted); }

/* 提案の編集 */
.editor-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.editor-head h2 { margin: 0; }
.choice { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 8px; }
.choice input[type="radio"] { margin-top: 13px; }
.choice textarea { min-height: 44px; }
.choice.is-selected textarea { border-color: var(--primary); background: var(--accent-bg); }
.reason { border-top: 1px dashed var(--border); padding-top: 10px; margin-top: 10px; }
.reason:first-child { border-top: 0; padding-top: 0; margin-top: 0; }
.reason input { margin-bottom: 6px; font-weight: 600; }
.count { text-align: right; color: var(--muted); font-size: .78rem; }

.revise { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.revise select { width: auto; flex: 0 0 auto; }
.revise input { flex: 1 1 200px; width: auto; }

.final-list dt { font-weight: 700; margin-top: 14px; color: var(--primary); font-size: .9rem; }
.final-list dd { margin: 2px 0 0; white-space: pre-wrap; }
.send-result { text-align: right; font-weight: 600; }
.send-result.ok { color: var(--ok); }
.send-result.ng { color: var(--danger); }

/* 読み込み中・通知 */
.loading { position: fixed; inset: 0; background: rgba(0, 0, 0, .45); display: grid; place-items: center; z-index: 10; padding: 16px; }
.loading-box { background: var(--surface); border-radius: var(--radius); padding: 28px 32px; text-align: center; max-width: 360px; }
.loading-box p { margin: 6px 0 0; }
.muted { color: var(--muted); font-size: .85rem; }
.spinner { width: 36px; height: 36px; margin: 0 auto 8px; border: 4px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--danger); color: #fff; padding: 12px 18px; border-radius: 8px; max-width: calc(100% - 32px); z-index: 20; }

@media (max-width: 600px) {
  .actions { justify-content: stretch; }
  .actions .btn { flex: 1 1 100%; }
}
