/* スマホ最適化 家計簿UI */
:root {
  --bg: #f4f6f9;
  --card: #ffffff;
  --primary: #0E2841;
  --accent: #156082;
  --expense: #C00000;
  --income: #00B050;
  --point: #E97132;
  --text: #222;
  --text-sub: #666;
  --border: #e3e6ec;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; padding: 0;
  font-family: -apple-system, "Hiragino Sans", "Yu Gothic UI", "Noto Sans JP", sans-serif;
  background: var(--bg); color: var(--text);
  font-size: 14px;
}
header {
  position: sticky; top: 0; z-index: 10;
  background: var(--primary); color: white;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; box-shadow: 0 2px 4px rgba(0,0,0,.1);
}
header h1 { margin: 0; font-size: 18px; font-weight: 500; }
.nav-btn {
  background: rgba(255,255,255,.15); color: white; border: none;
  width: 36px; height: 36px; border-radius: 50%; font-size: 20px;
  cursor: pointer;
}
.nav-btn:active { background: rgba(255,255,255,.3); }

main { padding: 12px; max-width: 600px; margin: 0 auto; }

.card {
  background: var(--card); border-radius: 12px; padding: 16px;
  margin-bottom: 12px; box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.card h2 {
  margin: 0 0 12px 0; font-size: 15px; font-weight: 600; color: var(--primary);
}

.summary-row {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 6px 0;
}
.summary-row.sub { border-top: 1px dashed var(--border); margin-top: 6px; padding-top: 10px; font-size: 13px; }
.summary-label { color: var(--text-sub); }
.summary-value { font-size: 22px; font-weight: 600; }
.summary-value.expense { color: var(--expense); }
.summary-value.income { color: var(--income); }
.summary-value.point { color: var(--point); font-size: 16px; }
.summary-row.sub .summary-value { font-size: 15px; }

.chart-wrap { position: relative; height: 220px; }

.legend { list-style: none; padding: 0; margin: 12px 0 0 0; }
.legend li {
  display: flex; align-items: center; padding: 4px 0; font-size: 13px;
}
.legend .dot { width: 10px; height: 10px; border-radius: 50%; margin-right: 8px; flex-shrink: 0; }
.legend .name { flex: 1; }
.legend .amount { font-weight: 600; }

.balance-list { list-style: none; padding: 0; margin: 0; }
.balance-list li {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 8px 0; border-bottom: 1px solid var(--border);
}
.balance-list li:last-child { border-bottom: none; }
.balance-list .name { font-size: 14px; }
.balance-list .name .type-tag {
  font-size: 10px; background: #eee; color: #666;
  padding: 2px 6px; border-radius: 4px; margin-right: 6px; vertical-align: middle;
}
.balance-list .amount { font-weight: 600; font-size: 15px; }
.balance-list .amount.zero { color: var(--text-sub); font-weight: normal; }
.balance-total {
  text-align: right; padding-top: 10px; border-top: 2px solid var(--primary);
  margin-top: 10px; font-size: 16px;
}
.balance-total span { font-weight: 700; color: var(--primary); font-size: 20px; }

.filter-row { margin-bottom: 8px; }
.filter-row input {
  width: 100%; padding: 8px 12px; border: 1px solid var(--border);
  border-radius: 6px; font-size: 14px;
}
.tx-list { list-style: none; padding: 0; margin: 0; }
.tx-list li {
  padding: 10px 0; border-bottom: 1px solid var(--border);
  display: grid; grid-template-columns: 60px 1fr auto; gap: 10px;
  align-items: center;
}
.tx-list .date {
  font-size: 12px; color: var(--text-sub);
}
.tx-list .info { min-width: 0; }
.tx-list .shop {
  font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tx-list .meta {
  font-size: 11px; color: var(--text-sub); margin-top: 2px;
}
.tx-list .meta .cat-tag {
  display: inline-block; padding: 1px 6px; border-radius: 4px;
  background: #eee; margin-right: 6px;
}
.tx-list .amount {
  font-weight: 600; text-align: right; white-space: nowrap;
}
.tx-list .amount.expense { color: var(--expense); }
.tx-list .amount.income { color: var(--income); }
.tx-list .amount.point { font-size: 11px; color: var(--point); }
