/*
 * 見た目（app.css の後に読み込んで上書きする）
 * 題材は紙の帳簿：薄い青の罫線、藍のインク、合計の下の二重線、赤字は朱。
 * 朱は「赤字・注意」にだけ使い、飾りには使わない。文字は業務文書向けの BIZ UD ゴシック（Windows 標準）。
 */
:root {
  --bg: #f2f5f8;
  --surface: #ffffff;
  --text: #1b2533;
  --muted: #586579;
  --line: #c9d6e3;
  --rule-strong: #1d3557;
  --ink: #1d3557;
  --accent: #1f4e8c;
  --accent-text: #ffffff;
  --danger: #b8322a;
  --notice: #e8f0f8;
  --inactive: #8793a3;
  --header-bg: #1d3557;
  --header-text: #e9eff7;
  --font: "BIZ UDPGothic", "BIZ UDPゴシック", "Hiragino Sans", "Noto Sans JP", "Yu Gothic UI", "Meiryo", system-ui, sans-serif;
  --font-num: "Segoe UI", "Helvetica Neue", "BIZ UDPGothic", "Hiragino Sans", "Noto Sans JP", "Yu Gothic UI", "Meiryo", system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121820;
    --surface: #18212c;
    --text: #e3e9f0;
    --muted: #9aa7b6;
    --line: #2e3b4b;
    --rule-strong: #9db8dc;
    --ink: #b9cde8;
    --accent: #8fb3e6;
    --accent-text: #0e1520;
    --danger: #f08a7e;
    --notice: #1b2838;
    --inactive: #6f7b8a;
    --header-bg: #0e1520;
    --header-text: #d5deea;
  }
}

body { font-family: var(--font); font-size: 15px; line-height: 1.7; letter-spacing: 0.01em; }
h1, h2, h3 { color: var(--ink); line-height: 1.35; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.08rem; }
a { color: var(--accent); text-underline-offset: 0.18em; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* 上の帯 */
header.site { background: var(--header-bg); border-bottom: 0; padding: 0 16px; gap: 0 28px; min-height: 52px; }
header.site .brand { color: #fff; font-size: 1.02rem; letter-spacing: 0.04em; }
header.site nav { gap: 4px; flex-wrap: wrap; }
header.site nav a { color: var(--header-text); opacity: 0.78; padding: 15px 10px 13px; border-bottom: 3px solid transparent; }
header.site nav a:hover { opacity: 1; }
header.site nav a[aria-current="page"] { color: #fff; opacity: 1; font-weight: 700; border-bottom-color: #fff; }
header.site .me { color: var(--header-text); }
header.site .me button.link { color: var(--header-text); }

main { padding: 20px 16px 48px; }

/* ボタン */
button, .button { border-radius: 3px; padding: 7px 16px; font-weight: 700; }
button.secondary, .button.secondary { background: var(--surface); color: var(--accent); border-color: var(--accent); }
input, select, textarea { border-color: var(--line); border-radius: 3px; }

/* お知らせ */
.flash { border: 0; border-left: 4px solid var(--accent); border-radius: 0; background: var(--notice); }
.flash.error { border-left-color: var(--danger); }

/* 帳簿の表：見出しの下は藍の線、行は薄い罫線、合計の上は二重線 */
table.list, table.ledger { border-collapse: collapse; background: var(--surface); }
table.list thead th, table.ledger thead th {
  color: var(--ink); font-weight: 700; border-bottom: 2px solid var(--rule-strong); background: var(--surface);
}
table.list td, table.list th, table.ledger td, table.ledger th { border-bottom: 1px solid var(--line); }
td.num, th.num, .num { font-family: var(--font-num); font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }
table.report tr.subtotal td { background: var(--notice); }
table.report tr.total td, table.ledger tr.total td, table.ledger tr.total th { border-top: 3px double var(--rule-strong); font-weight: 700; }
.neg, td.num.neg { color: var(--danger); }

/* ---------- ホーム ---------- */
.year-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 32px; margin: 4px 0 20px; }
.year-head h1 { margin: 0; font-size: 1.3rem; font-weight: 700; }
.year-head .year-num { font-family: var(--font-num); font-size: 2.6rem; letter-spacing: 0.02em; margin-right: 2px; }
.year-facts { display: flex; flex-wrap: wrap; gap: 4px 28px; margin: 0; }
.year-facts div { display: flex; gap: 8px; align-items: baseline; }
.year-facts dt { color: var(--muted); font-size: 0.88rem; }
.year-facts dd { margin: 0; font-family: var(--font-num); }

.sheet { border-top: 2px solid var(--rule-strong); padding-top: 4px; }
.sheet > h2 { margin: 8px 0 6px; }
table.ledger { width: 100%; }
table.ledger th, table.ledger td { padding: 8px 10px; text-align: left; vertical-align: baseline; }
table.ledger td.num, table.ledger th.num { text-align: right; white-space: nowrap; }
table.ledger tbody th { font-weight: 400; }
table.ledger.compact th, table.ledger.compact td { padding: 6px 4px; }

.years { margin-top: 40px; }
details.new-year { margin-top: 16px; }
details.new-year summary { cursor: pointer; color: var(--accent); font-weight: 700; }
details.new-year form { margin-top: 12px; flex-wrap: wrap; }

@media (max-width: 560px) {
  .year-head .year-num { font-size: 2.1rem; }
}

/* 狭い画面：上の帯は「名前と自分」の段と、横に流せるメニューの段に分ける */
header.site nav a { white-space: nowrap; }
@media (max-width: 900px) {
  header.site { padding: 8px 16px 0; }
  header.site .me { margin-left: auto; }
  header.site nav { order: 3; flex: 1 0 100%; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 6px; }
  header.site nav a { padding: 10px 10px 9px; }
}


/* メニューのバッジ（16 §4）：まだ済んでいないものの件数。薄い赤の地に赤い文字（暗い帯の上でも読めるよう、色は固定） */
header.site nav .badge {
  background: #fde4e1; color: #b8322a; border: 0; border-radius: 9px;
  padding: 1px 7px; margin-left: 5px; font-family: var(--font-num); font-variant-numeric: tabular-nums; font-weight: 700; font-size: 0.78em;
}
