:root {
  --bg: #f2f2f7; --card: #ffffff; --text: #111111; --sub: #6b6b72; --line: #d9d9de;
  --accent: #0a6cff; --ok: #1a7f37; --warn: #b45309; --bad: #c62828; --chip-bg: rgba(0,0,0,.06);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #000000; --card: #1c1c1e; --text: #f2f2f7; --sub: #a1a1a8; --line: #38383a;
    --accent: #4da3ff; --ok: #4cd964; --warn: #ffb340; --bad: #ff6b6b; --chip-bg: rgba(255,255,255,.12); }
}
* { box-sizing: border-box; }
html { font: -apple-system-body; -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: -apple-system, "Hiragino Sans", "Noto Sans JP", sans-serif;
  font-size: 1rem; line-height: 1.5; padding-bottom: calc(4.5rem + env(safe-area-inset-bottom)); }
h1 { font-size: 1.7rem; margin: .4rem 0 .8rem; }
h2 { font-size: 1.1rem; margin: 0 0 .3rem; }
.page { max-width: 640px; margin: 0 auto; padding: calc(.6rem + env(safe-area-inset-top)) 1rem 1rem; }
.card { background: var(--card); border-radius: 16px; padding: 1rem; margin: 0 0 .9rem; }
.sub, .note { color: var(--sub); font-size: .85rem; }
.big { font-size: 2rem; font-weight: 700; line-height: 1.2; }
.mid { font-size: 1.4rem; font-weight: 700; }
.row { display: flex; justify-content: space-between; gap: .6rem; align-items: baseline; padding: .35rem 0; }
.row + .row { border-top: 1px solid var(--line); }
.row .r { text-align: right; }
.chip { display: inline-block; font-size: .72rem; font-weight: 700; padding: .1rem .5rem; border-radius: 99px; background: var(--chip-bg); color: var(--sub); white-space: nowrap; }
.chip.actual { color: var(--accent); background: color-mix(in srgb, var(--accent) 15%, transparent); }
.chip.planned { color: var(--warn); background: color-mix(in srgb, var(--warn) 15%, transparent); }
.chip.warn { color: var(--bad); background: color-mix(in srgb, var(--bad) 15%, transparent); }
.banner { background: color-mix(in srgb, var(--warn) 18%, var(--card)); border-radius: 12px; padding: .6rem .8rem; margin-bottom: .9rem; font-size: .9rem; }
.err { color: var(--bad); font-size: .9rem; }
button, .btn { font: inherit; border: 0; border-radius: 12px; padding: .55rem .9rem; background: var(--chip-bg); color: var(--text); cursor: pointer; min-height: 44px; }
button.primary { background: var(--accent); color: #fff; font-weight: 600; }
button.danger { color: var(--bad); }
button.link { background: none; color: var(--accent); padding: .4rem .2rem; min-height: 0; }
button:disabled { opacity: .45; }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .5rem; }
.list-item { display: block; width: 100%; text-align: left; background: var(--card); border-radius: 14px; padding: .8rem 1rem; margin-bottom: .6rem; }
input, select, textarea { font: inherit; width: 100%; padding: .6rem .7rem; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--text); min-height: 44px; }
textarea { min-height: 8rem; }
label { display: block; font-size: .85rem; color: var(--sub); margin: .7rem 0 .2rem; }
label.inline { display: flex; align-items: center; gap: .5rem; color: var(--text); font-size: 1rem; }
label.inline input { width: auto; min-height: 0; }
.toolbar { display: flex; gap: .5rem; margin-bottom: .7rem; }
.toolbar > * { flex: 1; }
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; display: flex; background: color-mix(in srgb, var(--card) 92%, transparent);
  backdrop-filter: blur(16px); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); z-index: 5; }
.tabbar button { flex: 1; background: none; border-radius: 0; font-size: .72rem; color: var(--sub); padding: .5rem 0 .4rem; min-height: 56px; }
.tabbar button[aria-selected="true"] { color: var(--accent); font-weight: 700; }
.tabbar .ic { display: block; font-size: 1.3rem; line-height: 1.2; }
.sheet { position: fixed; inset: 0; background: var(--bg); z-index: 10; overflow-y: auto; }
.sheet-head { position: sticky; top: 0; display: flex; justify-content: space-between; align-items: center; background: var(--bg);
  padding: calc(.5rem + env(safe-area-inset-top)) 1rem .5rem; border-bottom: 1px solid var(--line); z-index: 2; }
.sheet-head strong { font-size: 1.05rem; }
.toast { position: fixed; left: 1rem; right: 1rem; bottom: calc(5rem + env(safe-area-inset-bottom)); background: #222; color: #fff; padding: .7rem 1rem;
  border-radius: 12px; z-index: 20; font-size: .9rem; }
details { margin: .4rem 0; } summary { cursor: pointer; color: var(--accent); }
ul.plain { padding-left: 1.1rem; margin: .3rem 0; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
@media (prefers-reduced-motion: no-preference) { .sheet { animation: up .18s ease-out; } @keyframes up { from { transform: translateY(12px); opacity: 0; } } }
