/* 金銭管理 v2 — 白×ゴールド（Claude Design「収支アプリ_ホーム」準拠） */
:root {
  /* デザインパレット（home-screen.jsx / クラシックゴールド） */
  --ink: #1D1B16;
  --sub: #8C867A;
  --faint: #B6B0A3;
  --line: #EDE9DF;
  --card: #FFFFFF;
  --bg: #FFFFFF;
  --gold: #B8902E;
  --gold-deep: #9A7A22;
  --gold-soft: #F6EFDD;
  --gold-line: #E7D9B4;
  --gold-grad: #C8A442;
  --pos: #2E9E6B;
  --neg: #C9603A;

  /* 旧名エイリアス（既存マークアップ互換） */
  --surface: var(--card);
  --surface-soft: var(--gold-soft);
  --accent: var(--gold);
  --accent-deep: var(--gold-deep);
  --income: var(--pos);
  --expense: var(--neg);
  --loan: var(--gold);
  --repay: var(--pos);
  --text: var(--ink);
  --text-soft: var(--sub);
  --danger: var(--neg);
  --radius: 18px;
  --shadow: 0 6px 20px -8px rgba(29, 27, 22, 0.16);
  --shadow-soft: 0 1px 2px rgba(0, 0, 0, 0.03);
}

* { -webkit-tap-highlight-color: transparent; }

html, body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Zen Kaku Gothic New", system-ui, -apple-system, "Hiragino Kaku Gothic ProN", "Segoe UI", sans-serif;
  font-feature-settings: "palt";
  margin: 0;
  -webkit-font-smoothing: antialiased;
}

/* 金額数字（Sora + tabular-nums） */
.money {
  font-family: "Sora", sans-serif;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

/* タップ領域・safe-area */
.app-shell {
  min-height: 100dvh;
  padding-bottom: calc(110px + env(safe-area-inset-bottom));
  max-width: 480px;
  margin: 0 auto;
}

.tap { min-height: 44px; min-width: 44px; }

/* インラインSVGアイコン */
.ico { display: block; flex: none; }

/* カード */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}

/* ヒーロー（貸付残高・ゴールド） */
.hero {
  position: relative; border-radius: 24px; padding: 22px 22px 20px; overflow: hidden;
  background: linear-gradient(135deg, var(--gold-grad) 0%, var(--gold-deep) 100%);
  box-shadow: 0 14px 30px -12px rgba(154, 122, 34, 0.55);
}
.hero::before {
  content: ""; position: absolute; inset: 0; opacity: 0.5;
  background: radial-gradient(120% 80% at 85% 0%, rgba(255, 255, 255, 0.28), transparent 60%);
}
.hero > * { position: relative; }
.hero-head {
  display: flex; align-items: center; gap: 7px; margin-bottom: 12px;
  color: rgba(255, 253, 245, 0.92); font-size: 13px; font-weight: 600;
  letter-spacing: .04em; white-space: nowrap;
}
.hero-amount { font-size: 38px; font-weight: 700; color: #FFFDF6; line-height: 1; }
.hero-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 14px; }
.hero-note { font-size: 12.5px; color: rgba(255, 253, 245, 0.78); font-weight: 500; white-space: nowrap; }
.hero-pill {
  display: flex; align-items: center; gap: 4px;
  font-size: 12.5px; font-weight: 600; color: #FFFDF6;
  background: rgba(255, 255, 255, 0.18); padding: 5px 11px; border-radius: 999px;
  border: none; cursor: pointer; font-family: inherit;
}

/* StatCard（お手当） */
.stat-card {
  display: block; width: 100%; text-align: left;
  background: var(--card); border: 1px solid var(--line); border-radius: 18px;
  padding: 15px 15px 14px; box-shadow: var(--shadow-soft);
  cursor: pointer; font-family: inherit; color: var(--ink);
}
.stat-head { display: flex; align-items: center; gap: 7px; margin-bottom: 12px; }
.stat-tile {
  width: 28px; height: 28px; border-radius: 9px; background: var(--gold-soft);
  display: grid; place-items: center; color: var(--gold); flex: none;
}
.stat-label { font-size: 12.5px; color: var(--sub); font-weight: 600; white-space: nowrap; }
.stat-amount { font-size: 22px; font-weight: 700; color: var(--ink); line-height: 1; }
.stat-bar { height: 5px; border-radius: 999px; background: var(--gold-soft); overflow: hidden; margin-top: 11px; }
.stat-bar > span { display: block; height: 100%; border-radius: 999px; background: var(--gold); transition: width .4s ease; }
.stat-foot { font-size: 11.5px; color: var(--faint); margin-top: 7px; font-weight: 500; }

/* FlowCard（今月の収支） */
.flow-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 18px;
  padding: 16px 6px; box-shadow: var(--shadow-soft);
}
.flow-head { display: flex; align-items: center; justify-content: space-between; padding: 0 14px; margin-bottom: 14px; }
.flow-title { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--ink); font-weight: 700; }
.flow-title .ico { color: var(--gold); }
.flow-link {
  display: flex; align-items: center; gap: 4px; font-size: 12.5px;
  color: var(--gold); font-weight: 600; white-space: nowrap;
  background: none; border: none; cursor: pointer; font-family: inherit; padding: 0;
}
.flow-cols { display: flex; align-items: center; }
.flow-col { flex: 1; text-align: center; }
.flow-label { font-size: 11.5px; color: var(--sub); font-weight: 600; margin-bottom: 6px; }
.flow-col .money { font-size: 17px; font-weight: 600; }
.flow-div { width: 1px; height: 26px; background: var(--line); flex: none; }

/* サッと記録 */
.quick-title { font-size: 13px; color: var(--ink); font-weight: 700; margin: 0 4px 11px; }
.quick-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; }
.quick-btn {
  display: flex; align-items: center; gap: 11px;
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  padding: 14px 16px; cursor: pointer; box-shadow: var(--shadow-soft);
  font-family: inherit; transition: transform .12s;
}
.quick-btn:active { transform: scale(0.97); }
.quick-tile {
  width: 34px; height: 34px; border-radius: 11px; background: var(--gold-soft);
  display: grid; place-items: center; color: var(--gold); flex: none;
}
.quick-label { font-size: 15px; color: var(--ink); font-weight: 600; }

/* ボトムナビ */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: linear-gradient(to top, #fff 72%, rgba(255, 255, 255, 0));
  padding-bottom: calc(env(safe-area-inset-bottom) + 10px);
  z-index: 40;
}
.bottom-nav-inner {
  max-width: 480px; margin: 0 auto; display: flex;
  border-top: 1px solid var(--line); padding: 10px 14px 4px;
}
.nav-item {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; flex: 1; padding: 2px 0; min-height: 44px;
  color: var(--faint); font-size: 10px; font-weight: 500;
  background: none; border: none; cursor: pointer; font-family: inherit; transition: color .15s;
}
.nav-item .ico { width: 22px; height: 22px; stroke-width: 1.7; }
.nav-item[aria-current="page"] { color: var(--gold); font-weight: 700; }
.nav-item[aria-current="page"] .ico { stroke-width: 2; }
.nav-item:focus-visible { outline: 2px solid var(--gold); outline-offset: -4px; border-radius: 12px; }
/* もっと の未読バッジ（金色ドット） */
.nav-ico-wrap { position: relative; display: grid; place-items: center; }
.nav-dot {
  position: absolute; top: -2px; right: -4px; width: 8px; height: 8px;
  border-radius: 50%; background: var(--gold); border: 1.5px solid #fff;
}

/* FAB */
.fab {
  position: fixed;
  right: max(18px, env(safe-area-inset-right));
  bottom: calc(92px + env(safe-area-inset-bottom));
  width: 56px; height: 56px; border-radius: 18px;
  background: linear-gradient(135deg, var(--gold-grad), var(--gold-deep));
  color: #FFFDF6; border: none; cursor: pointer;
  box-shadow: 0 12px 24px -8px rgba(154, 122, 34, 0.7);
  display: grid; place-items: center;
  z-index: 45;
  transition: transform .18s ease;
}
.fab:active { transform: scale(0.92); }
.fab:focus-visible { outline: 3px solid var(--gold-line); outline-offset: 2px; }

/* ボトムシート / モーダル */
.sheet-backdrop {
  position: fixed; inset: 0; background: rgba(29, 27, 22, 0.42);
  z-index: 50; display: flex; align-items: flex-end; justify-content: center;
  opacity: 0; transition: opacity .2s;
}
.sheet-backdrop.open { opacity: 1; }
.sheet {
  background: var(--surface);
  width: 100%; max-width: 480px;
  border-radius: 24px 24px 0 0;
  padding: 20px 18px calc(20px + env(safe-area-inset-bottom));
  max-height: 92dvh; overflow-y: auto;
  transform: translateY(100%); transition: transform .26s cubic-bezier(.32,.72,0,1);
  box-shadow: 0 -10px 40px -12px rgba(29, 27, 22, 0.3);
}
.sheet-backdrop.open .sheet { transform: translateY(0); }
.sheet-grip { width: 40px; height: 4px; border-radius: 99px; background: var(--line); margin: 0 auto 14px; }

/* チップ（goldSoft地 + gold文字） */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: 999px;
  background: var(--gold-soft); color: var(--gold);
  border: 1.5px solid transparent; font-size: 13px; font-weight: 600;
  cursor: pointer; transition: all .12s; min-height: 38px;
  font-family: inherit;
}
.chip:active { transform: scale(0.96); }
.chip[aria-pressed="true"], .chip.active {
  background: #fff; border-color: var(--gold); color: var(--gold-deep);
}
.chip:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }

/* タグ（リスト内のカテゴリ表示） */
.tag {
  display: inline-flex; align-items: center;
  font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px;
  background: var(--gold-soft); color: var(--gold);
}

/* 入力 */
.field {
  width: 100%; padding: 12px 14px; border-radius: 14px;
  border: 1.5px solid var(--line); background: #fff; color: var(--ink);
  font-size: 16px; font-family: inherit;
}
.field:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(184, 144, 46, 0.16); }
.amount-input {
  font-family: "Sora", sans-serif; font-variant-numeric: tabular-nums;
  font-size: 32px; font-weight: 700; text-align: right; letter-spacing: -0.01em;
  padding: 14px 16px;
}

/* ボタン */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 14px 18px; border-radius: 16px; font-weight: 700; font-size: 15px;
  border: none; cursor: pointer; min-height: 50px; transition: filter .12s, transform .12s;
  font-family: inherit;
}
.btn:active { transform: scale(0.98); }
.btn-primary {
  background: linear-gradient(135deg, var(--gold-grad), var(--gold-deep));
  color: #FFFDF6;
  box-shadow: 0 8px 18px -8px rgba(154, 122, 34, 0.6);
}
.btn-primary:hover { filter: brightness(1.03); }
.btn-ghost { background: var(--gold-soft); color: var(--ink); }
.btn:focus-visible { outline: 2px solid var(--gold-deep); outline-offset: 2px; }

/* トースト */
.toast-wrap {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(96px + env(safe-area-inset-bottom)); z-index: 60;
  display: flex; flex-direction: column; gap: 8px; width: calc(100% - 32px); max-width: 440px;
}
.toast {
  background: var(--ink); color: #FFFDF6; border-radius: 14px;
  padding: 12px 16px; box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 12px; font-size: 14px;
  animation: toastIn .2s ease;
}
.toast .toast-action {
  margin-left: auto; color: #E0C877; font-weight: 700;
  background: none; border: none; cursor: pointer; font-size: 14px; padding: 4px 6px;
  font-family: inherit;
}
@keyframes toastIn { from { opacity:0; transform: translateY(8px);} to {opacity:1; transform:none;} }

/* スケルトン */
.skeleton {
  background: linear-gradient(90deg, #F2EFE7 25%, #F9F7F1 50%, #F2EFE7 75%);
  background-size: 200% 100%; animation: shimmer 1.3s infinite; border-radius: 12px;
}
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* 金額表示 */
.money-pos { color: var(--pos); }
.money-neg { color: var(--neg); }

/* ドーナツ凡例 */
.legend-dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

/* 進捗バー（お手当ページ） */
.progress { height: 12px; border-radius: 999px; background: var(--gold-soft); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: 999px; transition: width .4s ease; }

/* アクセシビリティ：reduce motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* 区切り */
.list-row { border-bottom: 1px solid var(--line); }
.list-row:last-child { border-bottom: none; }

/* スクロールバー控えめ */
.sheet::-webkit-scrollbar { width: 6px; }
.sheet::-webkit-scrollbar-thumb { background: var(--line); border-radius: 99px; }

/* sr-only */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* セグメント */
.seg { display: flex; gap: 6px; background: var(--gold-soft); padding: 4px; border-radius: 14px; }
.seg button {
  flex: 1; border: none; background: none; padding: 8px; border-radius: 11px;
  font-weight: 700; color: var(--sub); cursor: pointer; font-size: 13px; min-height: 40px;
  font-family: inherit;
}
.seg button[aria-pressed="true"] { background: #fff; color: var(--gold-deep); box-shadow: var(--shadow-soft); }
