/* 資産ログ — ブルー系デザイン（バケットログと同系統の部品構成） */
:root {
  --bg: #e9f2fa;
  --card: #ffffff;
  --ink: #12293d;
  --sub: #56708a;
  --primary: #1668b4;
  --primary-d: #0d4a82;
  --accent: #35a2e6;
  --forecast: #a9cdf2;
  --line: #cfdff0;
  --danger: #d64545;
  --ok: #1e8e5a;
  --chip: #dceefb;
  --radius: 16px;
}
* { box-sizing: border-box; }
html, body { overscroll-behavior: none; }
body {
  margin: 0;
  font-family: -apple-system, "Hiragino Kaku Gothic ProN", "Noto Sans JP", sans-serif;
  background: var(--bg);
  color: var(--ink);
  padding-bottom: 76px;
  -webkit-tap-highlight-color: transparent;
}
.app-header {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
  background: linear-gradient(90deg, var(--primary-d), var(--primary));
  color: #fff;
  box-shadow: 0 2px 8px rgba(13, 74, 130, .25);
}
.app-title { font-size: 19px; font-weight: 700; letter-spacing: .04em; }
.header-btn {
  background: rgba(255,255,255,.18); border: none; color: #fff;
  width: 38px; height: 38px; border-radius: 50%; font-size: 18px; cursor: pointer;
}
main { max-width: 560px; margin: 0 auto; padding: 12px; }
.card {
  background: var(--card); border-radius: var(--radius);
  padding: 14px 14px 16px; margin-bottom: 12px;
  box-shadow: 0 1px 4px rgba(13, 74, 130, .08);
}
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.card-head h2 { font-size: 16px; margin: 0; color: var(--primary-d); }
.seg { display: flex; background: var(--chip); border-radius: 999px; padding: 3px; }
.seg-btn {
  border: none; background: transparent; padding: 5px 14px; border-radius: 999px;
  font-size: 13px; color: var(--sub); cursor: pointer;
}
.seg-btn.active { background: var(--primary); color: #fff; font-weight: 700; }
.summary-strip { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 10px; }
.sum-item { background: #f2f8fd; border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; min-width: 100px; }
.sum-item .sum-label { font-size: 11px; color: var(--sub); display: block; }
.sum-item .sum-value { font-size: 16px; font-weight: 700; color: var(--primary-d); }
.chart-box { width: 100%; }
.chart-box svg { width: 100%; height: auto; display: block; }
.chart-note { font-size: 12px; color: var(--sub); margin: 6px 0 0; line-height: 1.5; }
.sub-chart-title { font-size: 13px; color: var(--primary-d); margin: 14px 0 4px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 12px; font-size: 12px; color: var(--sub); margin-top: 6px; }
.legend .swatch { display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-right: 4px; vertical-align: -1px; }
.nisa-progress { margin: 4px 0 10px; }
.nisa-progress-head { display: flex; justify-content: space-between; font-size: 12px; color: var(--sub); margin-bottom: 4px; }
.nisa-bar { height: 12px; background: var(--chip); border-radius: 999px; overflow: hidden; }
.nisa-bar-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--primary)); border-radius: 999px; transition: width .4s; }
.row-item {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 10px 4px; border: none; border-bottom: 1px solid #eef4fa;
  background: transparent; text-align: left; font-size: 14px; color: var(--ink); cursor: pointer;
}
.row-item:last-child { border-bottom: none; }
.row-year { font-weight: 700; color: var(--primary-d); min-width: 58px; }
.row-main { flex: 1; line-height: 1.45; }
.row-sub { font-size: 12px; color: var(--sub); display: block; }
.chip { font-size: 11px; padding: 2px 8px; border-radius: 999px; background: var(--chip); color: var(--primary-d); white-space: nowrap; }
.chip.warn { background: #fdeeda; color: #a05a00; }
.chip.done { background: #e2f4ea; color: var(--ok); }
.add-btn {
  width: 100%; margin-top: 8px; padding: 11px; border-radius: 12px;
  border: 1.5px dashed var(--primary); background: #f4faff; color: var(--primary);
  font-size: 14px; font-weight: 700; cursor: pointer;
}
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex; background: #fff; border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tab {
  flex: 1; border: none; background: transparent; padding: 8px 0 10px;
  font-size: 12px; color: var(--sub); cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.tab .tab-ic { font-size: 19px; }
.tab.active { color: var(--primary); font-weight: 700; }

/* ゲート（起動・ロック・ログイン） */
.gate {
  position: fixed; inset: 0; z-index: 50; background: var(--bg);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.gate[hidden] { display: none; }
.gate-card {
  background: var(--card); border-radius: 20px; padding: 28px 22px;
  width: 100%; max-width: 360px; text-align: center;
  box-shadow: 0 4px 20px rgba(13, 74, 130, .12);
  display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.gate-icon { font-size: 44px; }
.gate-title { font-size: 20px; font-weight: 700; margin: 0; color: var(--primary-d); }
.gate-note { font-size: 13px; color: var(--sub); margin: 0; line-height: 1.6; }
.gate-error { font-size: 13px; color: var(--danger); margin: 0; min-height: 1em; }
.google-btn { min-height: 44px; display: flex; justify-content: center; }
.link-btn { background: none; border: none; color: var(--primary); font-size: 12px; text-decoration: underline; cursor: pointer; }

/* シート */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 40; background: rgba(10, 40, 70, .45);
  display: flex; align-items: flex-end; justify-content: center;
}
.sheet-backdrop[hidden] { display: none; }
.sheet {
  background: #fff; width: 100%; max-width: 560px; max-height: 92vh;
  border-radius: 20px 20px 0 0; display: flex; flex-direction: column;
}
.sheet-head {
  display: flex; align-items: center; gap: 8px;
  padding: 14px 16px 8px; border-bottom: 1px solid #eef4fa;
}
.sheet-head h3 { flex: 1; margin: 0; font-size: 16px; color: var(--primary-d); }
.sheet-close { border: none; background: #eef4fa; width: 32px; height: 32px; border-radius: 50%; font-size: 14px; cursor: pointer; color: var(--sub); }
.trash-btn { border: none; background: transparent; color: var(--sub); cursor: pointer; padding: 6px; border-radius: 8px; }
.trash-btn.armed { background: var(--danger); color: #fff; }
.sheet-body { padding: 12px 16px; overflow-y: auto; }
.sheet-foot {
  display: flex; gap: 10px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid #eef4fa;
}
.field { display: block; margin-bottom: 12px; }
.field > span { display: block; font-size: 12px; color: var(--sub); margin-bottom: 4px; }
.field input, .field select {
  width: 100%; padding: 10px; font-size: 16px; border: 1.5px solid var(--line);
  border-radius: 10px; background: #fbfdff; color: var(--ink);
}
.field input:focus, .field select:focus { outline: none; border-color: var(--primary); }
.field-row { display: flex; gap: 10px; align-items: flex-end; }
.field.grow, .sub-btn.grow { flex: 1; }
.form-section { font-size: 13px; color: var(--primary-d); margin: 16px 0 8px; border-bottom: 2px solid var(--chip); padding-bottom: 4px; }
.form-note { font-size: 12px; color: var(--sub); line-height: 1.6; }
.sheet-error { font-size: 13px; color: var(--danger); min-height: 1em; }
.inc-grid-head, .inc-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; align-items: center; }
.inc-grid-head { font-size: 11px; color: var(--sub); padding: 4px 0; }
.inc-row { padding: 3px 0; }
.inc-row .inc-name { font-size: 13px; }
.inc-row input { width: 100%; padding: 8px; font-size: 15px; border: 1.5px solid var(--line); border-radius: 8px; background: #fbfdff; }
.inc-row input:focus { outline: none; border-color: var(--primary); }
.primary-btn {
  background: var(--primary); color: #fff; border: none; border-radius: 12px;
  padding: 12px 20px; font-size: 15px; font-weight: 700; cursor: pointer; flex: 1;
}
.gate-card .primary-btn { flex: none; width: 100%; }
.primary-btn:disabled { opacity: .55; }
.primary-btn.block { width: 100%; flex: none; }
.cancel-btn {
  background: #eef4fa; color: var(--sub); border: none; border-radius: 12px;
  padding: 12px 18px; font-size: 15px; cursor: pointer;
}
.sub-btn {
  background: #fff; color: var(--primary); border: 1.5px solid var(--primary);
  border-radius: 10px; padding: 10px 14px; font-size: 13px; font-weight: 700; cursor: pointer;
  margin-bottom: 12px;
}
.danger-btn {
  background: #fff; color: var(--danger); border: 1.5px solid var(--danger);
  border-radius: 12px; padding: 12px 20px; font-size: 15px; font-weight: 700; cursor: pointer;
}
.danger-btn.block { width: 100%; }
.app-version { text-align: center; font-size: 11px; color: var(--sub); margin-top: 18px; }
.toast {
  position: fixed; left: 50%; bottom: 92px; transform: translateX(-50%);
  background: var(--primary-d); color: #fff; padding: 10px 18px; border-radius: 999px;
  font-size: 13px; z-index: 60; box-shadow: 0 4px 14px rgba(13,74,130,.35); max-width: 88vw; text-align: center;
}
