:root {
  --bg: #f6f5f1;
  --card: #ffffff;
  --ink: #26241f;
  --sub: #8a857a;
  --line: #e5e2da;
  --accent: #b4542e;
  --accent-ink: #ffffff;
  --ok: #3d7a4f;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Noto Sans JP", sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.6;
}
header {
  display: flex; align-items: baseline; justify-content: space-between;
  padding: 18px 20px 10px;
  max-width: 720px; margin: 0 auto;
}
header h1 { font-size: 20px; margin: 0; font-weight: 700; letter-spacing: .02em; }
header nav a {
  color: var(--accent); text-decoration: none; font-size: 14px; margin-left: 14px; font-weight: 600;
}
main { max-width: 720px; margin: 0 auto; padding: 0 16px 60px; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 18px; margin-bottom: 16px;
}
label { display: block; font-size: 13px; color: var(--sub); margin: 12px 0 4px; font-weight: 600; }
input[type="date"], input[type="month"], input[type="number"], input[type="text"], select, textarea {
  width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px;
  font-size: 16px; background: #fff; color: var(--ink); appearance: none;
}
textarea { resize: vertical; min-height: 56px; }
button {
  font-size: 16px; font-weight: 700; border: none; border-radius: 12px;
  padding: 13px 18px; cursor: pointer;
}
.btn-primary { background: var(--accent); color: var(--accent-ink); width: 100%; margin-top: 18px; }
.btn-primary:disabled { opacity: .5; }
.btn-ghost { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.pickers { display: flex; gap: 10px; }
.pickers button { flex: 1; padding: 20px 10px; font-size: 15px; background: #fff; border: 1.5px dashed var(--accent); color: var(--accent); border-radius: 14px; }
.drop { border: 1.5px dashed var(--line); border-radius: 14px; padding: 14px; text-align: center; color: var(--sub); font-size: 13px; margin-top: 10px; }
.drop.over { border-color: var(--accent); color: var(--accent); }
#preview { max-width: 100%; max-height: 240px; border-radius: 10px; display: block; margin: 12px auto 0; }
.status { font-size: 14px; color: var(--sub); margin-top: 10px; text-align: center; }
.status.busy::before { content: "⏳ "; }
.status.ok { color: var(--ok); }
.status.err { color: #b3261e; }
.row-list { width: 100%; border-collapse: collapse; font-size: 14px; }
.row-list th { text-align: left; color: var(--sub); font-size: 12px; font-weight: 600; padding: 6px 8px; border-bottom: 1px solid var(--line); }
.row-list td { padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.row-list tr:active { background: #faf8f4; }
.amount { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.thumb { width: 42px; height: 42px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); background:#eee; }
.total-bar { display: flex; justify-content: space-between; align-items: baseline; margin: 10px 2px; }
.total-bar strong { font-size: 20px; }
.toolbar { display: flex; gap: 10px; margin: 14px 0; flex-wrap: wrap; align-items: center; }
.toolbar input[type="month"] { flex: 1; min-width: 150px; }
.tag { display: inline-block; font-size: 11px; background: #f0ece4; border-radius: 999px; padding: 1px 8px; color: var(--sub); }
dialog { border: none; border-radius: 16px; padding: 20px; width: min(92vw, 420px); }
dialog::backdrop { background: rgba(0,0,0,.35); }
.dialog-actions { display: flex; gap: 10px; margin-top: 18px; }
.dialog-actions button { flex: 1; }
.btn-danger { background: #fff; color: #b3261e; border: 1px solid #e7c4c1; }
footer { text-align: center; color: var(--sub); font-size: 12px; padding: 20px; }
