:root {
  --bg: #f6f7f9; --card: #fff; --text: #1d2329; --muted: #67717b; --line: #dde2e7;
  --main: #1f5f8b; --main-text: #fff; --warn: #b3261e; --soon: #a15c00; --ok: #2e7d32;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15191d; --card: #1f252b; --text: #e6e9ec; --muted: #9aa4ad; --line: #333b43;
    --main: #5aa3d6; --main-text: #0c1116; --warn: #ff8a80; --soon: #ffb74d; --ok: #81c784;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.5 -apple-system, "Hiragino Sans", "Yu Gothic UI", sans-serif;
  padding-bottom: env(safe-area-inset-bottom);
}
header {
  position: sticky; top: 0; z-index: 2; background: var(--card); border-bottom: 1px solid var(--line);
  padding: calc(env(safe-area-inset-top) + 8px) 16px 0;
}
h1 { font-size: 18px; margin: 0 0 6px; }
h2 { font-size: 16px; margin: 24px 0 8px; }
nav { display: flex; gap: 4px; }
nav button {
  flex: 1; background: none; color: var(--muted); border: 0; border-bottom: 3px solid transparent;
  border-radius: 0; padding: 8px 0; font-size: 15px;
}
nav button.on { color: var(--main); border-bottom-color: var(--main); font-weight: 600; }
main { padding: 12px 16px 40px; max-width: 640px; margin: 0 auto; }
.hidden { display: none !important; }
button, .big-btn {
  font: inherit; background: var(--main); color: var(--main-text); border: 0; border-radius: 10px;
  padding: 10px 14px; cursor: pointer;
}
button.sub, .big-btn.sub { background: var(--card); color: var(--main); border: 1px solid var(--line); }
button.danger { background: none; color: var(--warn); border: 1px solid var(--warn); margin-top: 16px; }
button:disabled { opacity: .5; }
.big-btn { display: block; text-align: center; padding: 18px; margin-bottom: 10px; font-weight: 600; }
#capture > button { width: 100%; }
.row { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
.row > button { flex: 1; }
label { display: block; margin: 10px 0; font-size: 14px; color: var(--muted); }
label.inline { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: 15px; }
input:not([type=checkbox]):not([type=radio]), select, textarea {
  display: block; width: 100%; margin-top: 4px; font: inherit; font-size: 16px; color: var(--text);
  background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 9px 10px;
}
input[type=checkbox] { width: 22px; height: 22px; }
.notice { background: #fff4d6; color: #5a4300; border-radius: 10px; padding: 10px 12px; font-size: 14px; margin-bottom: 12px; }
.summary { font-size: 15px; margin: 4px 0 8px; }
.summary b { font-size: 20px; }
.group h3 { font-size: 14px; color: var(--muted); margin: 18px 0 6px; }
.item {
  display: flex; gap: 10px; align-items: flex-start; background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; padding: 10px 12px; margin-bottom: 8px;
}
.item.paid { opacity: .55; }
.item .chk { padding-top: 2px; }
.item .body { flex: 1; min-width: 0; }
.item .t { font-weight: 600; }
.item .meta { font-size: 14px; color: var(--muted); }
.item .meta.over { color: var(--warn); font-weight: 600; }
.item .meta.soon { color: var(--soon); font-weight: 600; }
.item .amt { font-weight: 700; white-space: nowrap; }
.item .acts { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.item .acts button { padding: 6px 10px; font-size: 14px; }
#preview { max-width: 100%; max-height: 260px; display: block; margin: 0 auto 8px; border-radius: 8px; }
.status { font-size: 14px; color: var(--muted); min-height: 1.5em; white-space: pre-wrap; }
.small { font-size: 13px; color: var(--muted); }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
td, th { border-bottom: 1px solid var(--line); padding: 5px 4px; text-align: left; vertical-align: top; word-break: break-all; }
.toast {
  position: fixed; left: 16px; right: 16px; bottom: calc(env(safe-area-inset-bottom) + 16px);
  background: #222; color: #fff; padding: 12px 14px; border-radius: 10px; font-size: 14px; z-index: 9;
}
.empty { color: var(--muted); text-align: center; padding: 30px 0; }
