:root {
  --bg: #fbf8f2; --card: #ffffff; --ink: #2b2622; --muted: #6f655c; --line: #e6ddd0;
  --accent: #d9661c; --accent-soft: #fbe7d6; --accent-ink: #ffffff;
  --good: #2f7a4d; --good-soft: #e3f2e8; --warn: #9a5b00; --warn-soft: #fbefd6; --bad: #b3261e; --bad-soft: #fbe3e1;
  --radius: 12px; --tap: 48px;
  font-family: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic", system-ui, sans-serif;
  color: var(--ink); background: var(--bg); font-size: 16px; line-height: 1.6;
  -webkit-text-size-adjust: 100%;
}
* { box-sizing: border-box; }
body { margin: 0; padding-bottom: calc(72px + env(safe-area-inset-bottom)); background: var(--bg); }
a { color: inherit; }
h1 { font-size: 1.35rem; margin: 4px 0 12px; letter-spacing: .02em; }
h2 { font-size: 1.05rem; margin: 22px 0 8px; }
.pad { padding: 16px; }
.muted { color: var(--muted); }
.small { font-size: .86rem; }
.top { position: sticky; top: 0; z-index: 5; display: flex; justify-content: space-between; align-items: center; padding: 10px 16px; background: rgba(251,248,242,.94); backdrop-filter: blur(6px); border-bottom: 1px solid var(--line); }
.brand { display: flex; gap: 8px; align-items: center; text-decoration: none; font-weight: 700; }
.dot { width: 14px; height: 14px; border-radius: 50%; background: var(--accent); box-shadow: inset -2px -2px 0 rgba(0,0,0,.12); }
.who { font-size: .8rem; color: var(--muted); }
main { max-width: 760px; margin: 0 auto; padding: 16px; outline: none; }
.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; display: grid; grid-template-columns: repeat(5, 1fr); background: var(--card); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.tabs a { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 2px 6px; font-size: .7rem; text-decoration: none; color: var(--muted); min-height: 58px; }
.tabs a.on { color: var(--accent); font-weight: 700; }
.tabs svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.badge { position: absolute; top: 4px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--accent); color: #fff; font-size: .7rem; line-height: 18px; text-align: center; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin: 10px 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat { display: block; text-decoration: none; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.stat b { display: block; font-size: 1.9rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat span { font-size: .85rem; color: var(--muted); }
.stat.hot { border-color: var(--accent); background: var(--accent-soft); }
.stat.warn { border-color: #e8c27a; background: var(--warn-soft); }
.stat.zero b { color: #b9ada0; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: var(--tap); padding: 0 18px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.danger { color: var(--bad); border-color: #efc2be; }
.btn.block { width: 100%; }
.btn.sm { min-height: 38px; padding: 0 12px; font-size: .9rem; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row > .grow { flex: 1; min-width: 0; }
label.f { display: block; margin: 12px 0 4px; font-size: .88rem; font-weight: 600; }
input, select, textarea { width: 100%; min-height: var(--tap); padding: 10px 12px; border: 1px solid #d6cbbb; border-radius: 10px; background: #fff; font: inherit; color: var(--ink); }
textarea { min-height: 96px; }
input:focus, select:focus, textarea:focus, .btn:focus-visible { outline: 3px solid rgba(217,102,28,.35); outline-offset: 1px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 42px; padding: 0 14px; border-radius: 21px; border: 1px solid #d6cbbb; background: #fff; font: inherit; cursor: pointer; }
.chip.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { border-bottom: 1px solid var(--line); }
.list a, .list .li { display: block; padding: 12px 4px; text-decoration: none; }
.tag { display: inline-block; padding: 1px 8px; border-radius: 6px; font-size: .75rem; font-weight: 700; background: #efe8de; color: var(--muted); vertical-align: 1px; }
.tag.accent { background: var(--accent-soft); color: #9a430c; }
.tag.good { background: var(--good-soft); color: var(--good); }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.tag.bad { background: var(--bad-soft); color: var(--bad); }
.note { padding: 10px 12px; border-radius: 10px; background: var(--warn-soft); color: #5e3a00; font-size: .9rem; margin: 10px 0; }
.note.bad { background: var(--bad-soft); color: #6e1610; }
.note.good { background: var(--good-soft); color: #164a2c; }
.kv { display: grid; grid-template-columns: 7.5em 1fr; gap: 4px 10px; font-size: .94rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.check { display: flex; gap: 12px; align-items: flex-start; padding: 12px 4px; border-bottom: 1px solid var(--line); }
.check input { width: 24px; height: 24px; min-height: 0; margin-top: 2px; flex: none; accent-color: var(--accent); }
.raw { white-space: pre-wrap; font-size: .82rem; background: #f4efe7; border-radius: 10px; padding: 12px; max-height: 360px; overflow: auto; font-family: ui-monospace, Menlo, monospace; }
.split { display: grid; gap: 12px; }
@media (min-width: 720px) { .split { grid-template-columns: 1fr 1fr; } }
.sticky-bottom { position: sticky; bottom: calc(66px + env(safe-area-inset-bottom)); padding: 10px 0; background: linear-gradient(to top, var(--bg) 70%, transparent); }
.stepper { display: flex; align-items: center; gap: 6px; }
.stepper button { width: 44px; height: 44px; border-radius: 10px; border: 1px solid #d6cbbb; background: #fff; font-size: 1.3rem; }
.stepper input { width: 64px; text-align: center; }
#toast { position: fixed; left: 50%; bottom: calc(84px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 10px; font-size: .92rem; opacity: 0; pointer-events: none; transition: opacity .2s; max-width: calc(100% - 32px); z-index: 20; }
#toast.show { opacity: 1; }
#toast.bad { background: var(--bad); }
dialog { border: none; border-radius: 16px; padding: 0; width: min(520px, calc(100% - 24px)); }
dialog::backdrop { background: rgba(43,38,34,.45); }
#dlg-form { padding: 18px; }
table.t { width: 100%; border-collapse: collapse; font-size: .92rem; }
table.t th, table.t td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); }
table.t td.n, table.t th.n { text-align: right; font-variant-numeric: tabular-nums; }
.seg { display: flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; margin: 6px 0 12px; }
.seg a { flex: 1; text-align: center; padding: 10px 4px; text-decoration: none; font-size: .9rem; background: #fff; }
.seg a.on { background: var(--ink); color: #fff; font-weight: 700; }
.mono { font-family: ui-monospace, Menlo, monospace; letter-spacing: .02em; }

/* 質問ボックスのボタン（上の帯の右。どの画面にも出す） */
.help-btn { width: 40px; height: 40px; border-radius: 20px; border: 1px solid var(--line); background: var(--card); color: var(--ink); font: inherit; font-size: 1.1rem; font-weight: 700; cursor: pointer; }
.ai-answer { white-space: pre-wrap; background: var(--accent-soft); border-radius: 10px; padding: 12px; margin: 8px 0; }
.op-reply { white-space: pre-wrap; background: var(--good-soft); border-radius: 10px; padding: 12px; margin: 8px 0; }
.q-body { white-space: pre-wrap; }
