
:root { color-scheme: light dark; --accent: #e8590c; --link: #d9480f; --danger: #c92a2a; --muted: #868e96; --line: color-mix(in srgb, currentColor 15%, transparent); }
@media (prefers-color-scheme: dark) { :root { --link: #ff922b; } }
a { color: var(--link); }
* { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, -apple-system, "Segoe UI", sans-serif; line-height: 1.7; }
header { display: flex; flex-wrap: wrap; gap: 8px 24px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); }
header nav { display: flex; flex-wrap: wrap; gap: 4px; margin-left: -10px; }
header nav a { color: inherit; text-decoration: none; padding: 4px 10px; border-radius: 999px; line-height: 1.6; }
header nav a:hover { background: var(--line); }
header nav a.active { font-weight: 700; background: color-mix(in srgb, var(--accent) 22%, transparent); }
.brand { font-weight: 700; text-decoration: none; color: inherit; }
main { max-width: 860px; margin: 0 auto; padding: 16px; }
section { margin: 24px 0; }
h1 { font-size: 1.5rem; } h2 { font-size: 1.15rem; margin-top: 32px; }
code { white-space: nowrap; }
.button, button { display: inline-block; padding: 8px 16px; border: 0; border-radius: 6px; background: var(--accent); color: #fff; font: inherit; text-decoration: none; cursor: pointer; }
button.secondary, .button.secondary-link { background: transparent; color: inherit; border: 1px solid var(--line); }
button.danger { background: var(--danger); }
form { margin: 8px 0; }
form.inline { display: inline-block; margin: 0 8px 0 0; }
.notice { padding: 8px 12px; border-left: 4px solid var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); }
.notice.error { border-color: var(--danger); background: color-mix(in srgb, var(--danger) 10%, transparent); }
.announcement p { white-space: pre-line; margin: 4px 0; }
.muted { color: var(--muted); font-size: 0.9em; }
footer { max-width: 860px; margin: 32px auto 0; padding: 16px; border-top: 1px solid var(--line); font-size: 0.9em; display: flex; flex-wrap: wrap; gap: 4px 16px; }
footer a { color: var(--muted); }
label { display: block; margin: 12px 0 4px; font-weight: 600; }
label.toggle { font-weight: 400; margin: 6px 0; cursor: pointer; }
select { padding: 6px 8px; font: inherit; border: 1px solid var(--line); border-radius: 6px; background: transparent; color: inherit; }
input[type=text], input[type=number], textarea { width: 100%; padding: 6px 8px; font: inherit; border: 1px solid var(--line); border-radius: 6px; background: transparent; color: inherit; }
input[type=number] { width: 8em; }
textarea { min-height: 4.5em; resize: vertical; }
fieldset { border: 1px solid var(--line); border-radius: 8px; margin: 16px 0; padding: 8px 16px 16px; }
legend { font-weight: 700; padding: 0 4px; }
.card { border: 1px solid var(--line); border-radius: 8px; padding: 12px 16px; margin: 12px 0; }
.card.off { opacity: 0.6; }
.card .head { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; }
/* 登録した返答や本文の改行を、そのまま見せる */
.card .body { white-space: pre-wrap; }
.card .actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.card .actions form { margin: 0; }
.badge { display: inline-block; padding: 0 8px; border-radius: 999px; font-size: 0.8em; border: 1px solid var(--line); }
.badge.on { background: color-mix(in srgb, #2b8a3e 20%, transparent); }
.status { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; }
.status dt { color: var(--muted); }
.status dd { margin: 0; }
details { margin-top: 8px; } summary { cursor: pointer; }
table { border-collapse: collapse; width: 100%; }
th, td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.actions form { margin: 0; }
ol.steps { padding-left: 1.4em; }
ol.steps li { margin: 8px 0; }
/* ページ内の目次 */
.toc { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0; padding: 0; list-style: none; }
.toc a { display: inline-block; padding: 2px 10px; border: 1px solid var(--line); border-radius: 999px; text-decoration: none; color: inherit; font-size: 0.9em; }
fieldset[id] { scroll-margin-top: 12px; }
/* 長いフォームの保存ボタン。画面の下に残す */
.save-bar { position: sticky; bottom: 0; z-index: 1; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin: 16px -16px 0; padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); background: Canvas; border-top: 1px solid var(--line); }
/* 狭い画面: 表を1行ずつのかたまりにし、余白を詰める */
@media (max-width: 600px) {
  header { padding: 10px 12px; }
  header nav { margin-left: -6px; }
  main { padding: 12px; }
  h1 { font-size: 1.3rem; }
  fieldset { padding: 4px 12px 12px; }
  .save-bar { margin: 16px -12px 0; padding-left: 12px; padding-right: 12px; }
  table.stack, table.stack tbody, table.stack tr, table.stack td { display: block; }
  table.stack tr { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
  table.stack td { border: 0; padding: 0; }
  table.stack td:first-child { flex-basis: 100%; }
  .card { padding: 10px 12px; }
}

.tabs { display: flex; flex-wrap: wrap; align-items: baseline; gap: 12px; margin: 8px 0; }
.tabs a.active { font-weight: 700; text-decoration: none; color: inherit; }
.toggles { margin-left: 24px; }
