:root {
  --bg: #f5f6f8; --card: #fff; --text: #1d2430; --muted: #6b7380; --line: #e3e6ea;
  --accent: #1f4e79; --accent-soft: #e6eef6; --ok: #2e7d4f; --warn: #b26a00;
  --h0: #eceff3; --h1: #cfe0f0; --h2: #9fc2e2; --h3: #6b9fcf; --h4: #3d78b3; --h5: #1f4e79;
  --radius: 12px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12151a; --card: #1b2028; --text: #e6e9ee; --muted: #9aa3af; --line: #2a313c;
    --accent: #7fb2e5; --accent-soft: #1f2d3d; --ok: #6cc28f; --warn: #e0a64a;
    --h0: #232a33; --h1: #22394f; --h2: #2d5276; --h3: #3b6e9e; --h4: #5592c9; --h5: #7fb2e5;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text);
  font-family: -apple-system, "Pretendard", "Noto Sans KR", "Malgun Gothic", sans-serif; font-size: 16px; }
body { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
main { max-width: 720px; margin: 0 auto; padding: 12px; }
.top { position: sticky; top: 0; z-index: 5; display: flex; gap: 10px; align-items: center;
  padding: 10px 12px; padding-top: calc(10px + env(safe-area-inset-top));
  background: var(--card); border-bottom: 1px solid var(--line); }
.brand { font-weight: 700; color: var(--accent); }
.top select { flex: 1; max-width: 320px; margin-left: auto; }
.tabs { position: fixed; bottom: 0; left: 0; right: 0; display: flex; background: var(--card);
  border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); z-index: 5; }
.tabs button { flex: 1; padding: 14px 0; border: 0; background: none; color: var(--muted); font-size: 15px; }
.tabs button.active { color: var(--accent); font-weight: 700; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; }
h2 { font-size: 18px; margin: 0 0 8px; } h3 { font-size: 15px; margin: 0 0 8px; }
.muted { color: var(--muted); font-size: 13px; }
.dayhead { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.daynum { font-size: 28px; font-weight: 800; color: var(--accent); }
.badge { display: inline-block; padding: 2px 8px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 600; }
.badge.warn { background: transparent; border: 1px solid var(--warn); color: var(--warn); }
.item { display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-top: 1px solid var(--line); }
.item:first-child { border-top: 0; }
.item input[type=checkbox] { width: 24px; height: 24px; accent-color: var(--accent); flex: none; }
.item .body { flex: 1; min-width: 0; }
.item .title { font-weight: 600; }
.item.done .title { color: var(--muted); text-decoration: line-through; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; margin-top: 6px; }
.seg button { border: 0; background: none; padding: 4px 10px; font-size: 12px; color: var(--muted); }
.seg button.on { background: var(--accent); color: #fff; }
label.f { display: block; margin: 10px 0 4px; font-size: 13px; color: var(--muted); }
input[type=text], input[type=number], textarea, select {
  width: 100%; padding: 10px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--bg); color: var(--text); font-size: 16px; font-family: inherit; }
textarea { min-height: 70px; resize: vertical; }
.rating { display: flex; gap: 6px; }
.rating button { flex: 1; padding: 10px 0; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--text); font-size: 15px; }
.rating button.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn { display: block; width: 100%; padding: 14px; border: 0; border-radius: 10px; background: var(--accent); color: #fff; font-size: 16px; font-weight: 700; margin-top: 12px; }
.btn.ghost { background: transparent; color: var(--accent); border: 1px solid var(--accent); }
.btn.danger { background: transparent; color: #c0392b; border: 1px solid #c0392b; }
.row { display: flex; gap: 8px; } .row > * { flex: 1; }
.grid { display: grid; grid-template-columns: repeat(10, 1fr); gap: 4px; }
.cell { aspect-ratio: 1; border-radius: 6px; display: flex; align-items: center; justify-content: center; font-size: 11px; position: relative; }
.cell small { position: absolute; bottom: 1px; right: 3px; font-size: 9px; opacity: .8; }
.c0 { background: var(--h0); color: var(--muted); } .c1 { background: var(--h1); } .c2 { background: var(--h2); }
.c3 { background: var(--h3); color: #fff; } .c4 { background: var(--h4); color: #fff; } .c5 { background: var(--h5); color: #fff; }
.legend { display: flex; gap: 4px; align-items: center; margin-top: 8px; font-size: 12px; color: var(--muted); }
.legend span.sw { width: 14px; height: 14px; border-radius: 3px; display: inline-block; }
.bar { height: 10px; background: var(--h0); border-radius: 99px; overflow: hidden; }
.bar > div { height: 100%; background: var(--accent); }
.log { padding: 10px 0; border-top: 1px solid var(--line); font-size: 14px; }
.log:first-child { border-top: 0; }
.empty { text-align: center; padding: 30px 10px; }
#toast { position: fixed; left: 50%; bottom: 80px; transform: translateX(-50%); background: #222; color: #fff;
  padding: 10px 16px; border-radius: 8px; font-size: 14px; opacity: 0; transition: opacity .2s; pointer-events: none; z-index: 10; }
#toast.show { opacity: .95; }
.note { border-left: 3px solid var(--warn); padding: 6px 10px; font-size: 13px; color: var(--muted); margin-top: 8px; }
