/* ============ トークン ============ */
:root {
  --page: #f9f9f7;
  --surface-1: #fcfcfb;
  --text-primary: #0b0b0b;
  --text-secondary: #52514e;
  --text-muted: #898781;
  --gridline: #e1e0d9;
  --baseline: #c3c2b7;
  --border: rgba(11, 11, 11, 0.10);
  --series-1: #2a78d6;
  --critical: #d03b3b;
  --good-text: #006300;
  --chip-selected-bg: rgba(42, 120, 214, 0.12);
  --row-hover: rgba(11, 11, 11, 0.05);
  --income: #2a78d6;
  --expense: #e34948;
  --balance: #eda100;
  --cat-1: #2a78d6;
  --cat-2: #1baf7a;
  --cat-3: #eda100;
  --cat-4: #008300;
  --cat-5: #4a3aa7;
  --cat-6: #e34948;
  --cat-7: #e87ba4;
  --cat-8: #eb6834;
  --pie-other: #898781;
}

/* ダークトークン: OS設定がダーク かつ 手動指定なし（data-theme未設定）のとき自動適用。
   手動で「ダーク」を選んだ場合は :root[data-theme="dark"] で同じ値を明示適用する。
   手動「ライト」は :root[data-theme="light"] となり、下のメディアクエリの対象外になる。 */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --page: #0d0d0d;
    --surface-1: #1a1a19;
    --text-primary: #ffffff;
    --text-secondary: #c3c2b7;
    --text-muted: #898781;
    --gridline: #2c2c2a;
    --baseline: #383835;
    --border: rgba(255, 255, 255, 0.10);
    --series-1: #3987e5;
    --critical: #e66767;
    --good-text: #0ca30c;
    --chip-selected-bg: rgba(57, 135, 229, 0.18);
    --row-hover: rgba(255, 255, 255, 0.07);
    --income: #3987e5;
    --expense: #e66767;
    --balance: #c98500;
    --cat-1: #3987e5;
    --cat-2: #199e70;
    --cat-3: #c98500;
    --cat-4: #008300;
    --cat-5: #9085e9;
    --cat-6: #e66767;
    --cat-7: #d55181;
    --cat-8: #d95926;
    --pie-other: #898781;
  }
}

/* 手動でダークを選択したとき（OS設定に関わらず適用） */
:root[data-theme="dark"] {
  --page: #0d0d0d;
  --surface-1: #1a1a19;
  --text-primary: #ffffff;
  --text-secondary: #c3c2b7;
  --text-muted: #898781;
  --gridline: #2c2c2a;
  --baseline: #383835;
  --border: rgba(255, 255, 255, 0.10);
  --series-1: #3987e5;
  --critical: #e66767;
  --good-text: #0ca30c;
  --chip-selected-bg: rgba(57, 135, 229, 0.18);
  --row-hover: rgba(255, 255, 255, 0.07);
  --income: #3987e5;
  --expense: #e66767;
  --balance: #c98500;
  --cat-1: #3987e5;
  --cat-2: #199e70;
  --cat-3: #c98500;
  --cat-4: #008300;
  --cat-5: #9085e9;
  --cat-6: #e66767;
  --cat-7: #d55181;
  --cat-8: #d95926;
  --pie-other: #898781;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

/* display 指定を持つクラスより hidden 属性を優先する */
[hidden] { display: none !important; }

body {
  font-family: system-ui, -apple-system, "Segoe UI", "Hiragino Kaku Gothic ProN", "Noto Sans JP", sans-serif;
  background: var(--page);
  color: var(--text-primary);
  line-height: 1.6;
  font-size: 15px;
}

/* ============ レイアウト ============ */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 1080px;
  margin: 0 auto;
  padding: 20px 20px 4px;
}
.app-header h1 { font-size: 20px; font-weight: 700; white-space: nowrap; }
.header-brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.header-logo { height: 26px; width: auto; display: block; }
.header-logo-dark { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .header-logo-light { display: none; }
  :root:not([data-theme]) .header-logo-dark { display: block; }
}
:root[data-theme="dark"] .header-logo-light { display: none; }
:root[data-theme="dark"] .header-logo-dark { display: block; }
.header-actions { display: flex; gap: 8px; align-items: center; }

/* ヘッダーのハンバーガーメニュー */
.header-menu-wrap { position: relative; }
.btn-menu { font-size: 17px; line-height: 1; padding: 7px 11px; }
.header-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 230px;
  padding: 6px;
  z-index: 300;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.14);
  display: flex;
  flex-direction: column;
}
.header-menu[hidden] { display: none; }
.menu-email {
  font-size: 12px;
  color: var(--text-muted);
  padding: 6px 10px;
  word-break: break-all;
}
.menu-item {
  display: block;
  width: 100%;
  text-align: left;
  font: inherit;
  font-size: 14px;
  color: var(--text-primary);
  background: none;
  border: none;
  border-radius: 6px;
  padding: 8px 10px;
  cursor: pointer;
  text-decoration: none;
}
.menu-item:hover { background: var(--border); }
.menu-divider { border-top: 1px solid var(--border); margin: 4px 0; }
@media (max-width: 800px) {
  .app-header { padding: 16px 16px 4px; }
  .header-brand { gap: 8px; }
  .header-logo { height: 21px; }
  .app-header h1 { font-size: 16px; }
}

.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 12px 20px 40px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
}
.card h2 { font-size: 15px; font-weight: 700; margin-bottom: 12px; }
.card-note { font-size: 12px; color: var(--text-muted); margin: -8px 0 10px; }

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 800px) {
  .two-col { grid-template-columns: 1fr; }
}

/* ============ セクションのドラッグ並び替え・2カラム配置 ============ */
.sortable-sections {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.sortable-card { grid-column: 1 / -1; min-width: 0; }
.sortable-card.half-width { grid-column: auto / span 1; }
.width-toggle {
  margin-left: auto;
  align-self: center;
  flex-shrink: 0;
  font-size: 11px;
  color: var(--text-muted);
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 8px;
  cursor: pointer;
}
.width-toggle:hover { color: var(--text-secondary); background: var(--border); }
@media (max-width: 800px) {
  /* モバイルは常に1カラムなので切り替えボタンごと隠す */
  .sortable-card.half-width { grid-column: 1 / -1; }
  .width-toggle { display: none; }
}
.drag-handle {
  color: var(--text-muted);
  font-size: 15px;
  line-height: 1;
  cursor: grab;
  user-select: none;
  padding: 2px 2px;
  border-radius: 4px;
  align-self: center;
  touch-action: none;
}
.drag-handle:hover { color: var(--text-secondary); background: var(--border); }
.drag-handle:active { cursor: grabbing; }
.sortable-card.dragging {
  opacity: 0.5;
  outline: 2px dashed var(--series-1);
  outline-offset: 2px;
}
.sortable-card.drop-target { outline: 2px solid var(--series-1); outline-offset: 2px; }

/* ============ 汎用小見出し ============ */
.sub-heading { font-size: 13px; font-weight: 700; color: var(--text-secondary); }

/* ============ カレンダービュー ============ */
.cal-nav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cal-title { font-weight: 700; font-size: 15px; min-width: 100px; text-align: center; font-variant-numeric: tabular-nums; }
.cal-note { margin: 0 0 0 auto; }
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.cal-head { text-align: center; font-size: 11px; color: var(--text-muted); padding: 2px 0; }
.cal-blank { min-height: 0; }
.cal-cell {
  font: inherit;
  color: inherit;
  text-align: left;
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  min-height: 64px;
  padding: 4px 6px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  cursor: pointer;
  min-width: 0;
}
.cal-cell:hover { background: var(--row-hover); }
.cal-date { font-size: 12px; }
.cal-in, .cal-out, .cal-bal {
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cal-in { color: var(--income); }
.cal-out { color: var(--expense); }
.cal-bal {
  margin-top: auto;
  padding-top: 1px;
  border-top: 1px dotted var(--border);
  color: var(--text-muted);
  font-weight: 700;
}
.cal-bal-neg { color: var(--critical); }
.cal-cell.cal-neg { border-color: var(--critical); background: color-mix(in srgb, var(--critical) 8%, transparent); }
.cal-cell.cal-basis { outline: 2px solid var(--series-1); outline-offset: -1px; }
.cal-cell.cal-today .cal-date { font-weight: 700; }
.cal-cell.cal-selected { border-color: var(--series-1); background: color-mix(in srgb, var(--series-1) 10%, transparent); }
@media (max-width: 800px) {
  .cal-cell { min-height: 48px; padding: 2px 4px; }
  .cal-in, .cal-out, .cal-bal { font-size: 10px; }
}

/* ============ 売掛・買掛の遅延管理 ============ */
.aging-block { display: flex; flex-direction: column; gap: 8px; }
.aging-summary { font-size: 13px; font-weight: 700; color: var(--critical); }

/* ============ 前年同月比・全期間比較 / レポート出力 ============ */
.compare-controls .field,
.report-controls .field { max-width: 180px; }
.report-controls {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}
.data-table tr.row-group td {
  font-weight: 700;
  color: var(--text-secondary);
  background: var(--row-hover);
}
.data-table tr.row-total td { font-weight: 700; border-top: 2px solid var(--baseline); }

/* ============ 印刷用レポート ============ */
#report-print { display: none; }
@media print {
  @page { size: A4 landscape; margin: 12mm; }
  body.printing-report > *:not(#report-print) { display: none !important; }
  body.printing-report #report-print {
    display: block;
    color: #000;
    background: #fff;
    font-family: "Hiragino Sans", "Yu Gothic", sans-serif;
  }
  #report-print h1 { font-size: 16pt; margin: 0 0 6pt; }
  #report-print .report-meta {
    display: flex;
    justify-content: space-between;
    gap: 12pt;
    font-size: 9pt;
    margin-bottom: 8pt;
  }
  #report-print table { width: 100%; border-collapse: collapse; font-size: 8.5pt; }
  #report-print th, #report-print td { border: 1pt solid #000; padding: 3pt 5pt; text-align: left; }
  #report-print th.num, #report-print td.num { text-align: right; font-variant-numeric: tabular-nums; }
  #report-print thead { display: table-header-group; }
  #report-print tr.row-group td { font-weight: 700; background: #eee; }
  #report-print tr.row-total td { font-weight: 700; }
  #report-print td.negative { font-weight: 700; }
  #report-print .report-note { font-size: 8pt; margin-top: 6pt; }
}

.app-footer {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 20px 32px;
  font-size: 12px;
  color: var(--text-muted);
}
.footer-copy { margin-top: 8px; }
.app-footer a { color: inherit; }
.app-footer a:hover { color: var(--text-secondary); }

/* ============ フォーム部品 ============ */
.field { display: flex; flex-direction: column; gap: 4px; }
.field-label { font-size: 12px; color: var(--text-secondary); font-weight: 600; }
.field-note { font-size: 12px; color: var(--text-muted); align-self: end; }

input[type="date"],
input[type="number"],
input[type="text"],
input[type="search"],
input[type="email"],
input[type="password"],
select {
  font: inherit;
  color: var(--text-primary);
  background: var(--surface-1);
  border: 1px solid var(--baseline);
  border-radius: 6px;
  padding: 7px 10px;
  min-width: 0;
}
input:focus-visible, select:focus-visible, button:focus-visible {
  outline: 2px solid var(--series-1);
  outline-offset: 1px;
}

.settings-row {
  display: grid;
  grid-template-columns: auto auto 1fr;
  gap: 16px;
  align-items: end;
}
@media (max-width: 800px) {
  .settings-row { grid-template-columns: 1fr; }
}

/* ============ 折りたたみカード（基準設定・口座 / 各セクション） ============ */
details.settings-card summary,
details.collapse-card summary {
  display: flex;
  align-items: baseline;
  gap: 10px;
  cursor: pointer;
  list-style: none;
  font-weight: 700;
  font-size: 15px;
}
details.settings-card summary::-webkit-details-marker,
details.collapse-card summary::-webkit-details-marker { display: none; }
details.collapse-card summary h2 { margin: 0; }
.settings-caret,
.collapse-caret {
  color: var(--text-muted);
  font-size: 12px;
  transition: transform 0.15s;
  display: inline-block;
}
details[open] .settings-caret,
details[open] .collapse-caret { transform: rotate(90deg); }
.settings-summary {
  font-weight: 400;
  font-size: 12px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.settings-body,
.collapse-body {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.settings-subtitle { font-size: 13px; font-weight: 700; color: var(--text-secondary); }
.account-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.account-item {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) auto minmax(120px, 180px) auto;
  gap: 8px;
  align-items: center;
}
@media (max-width: 800px) {
  .account-item { grid-template-columns: 1fr 1fr; }
}
.account-actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.account-total { font-size: 12px; color: var(--text-muted); }
.chip-group { display: flex; gap: 8px; flex-wrap: wrap; }

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 16px;
}
.field-wide { grid-column: 1 / -1; }
.type-field { border: none; display: flex; flex-direction: row; gap: 16px; align-items: center; }
.type-field legend { margin-bottom: 4px; }
.radio { display: inline-flex; gap: 6px; align-items: center; cursor: pointer; }
.radio input[value="income"] + span { color: var(--good-text); font-weight: 700; }
.radio input[value="expense"] + span { color: var(--critical); font-weight: 700; }
.radio input[value="transfer"] + span { color: var(--series-1); font-weight: 700; }

.form-actions { display: flex; gap: 8px; margin-top: 16px; }

.btn {
  font: inherit;
  font-weight: 600;
  border-radius: 6px;
  padding: 8px 16px;
  cursor: pointer;
  border: 1px solid var(--baseline);
  background: var(--surface-1);
  color: var(--text-primary);
}
.btn:hover { background: var(--chip-selected-bg); }
.btn-primary {
  background: var(--series-1);
  border-color: var(--series-1);
  color: #fff;
}
.btn-primary:hover { opacity: 0.9; background: var(--series-1); }
.btn-ghost { background: transparent; }
.btn-small { padding: 3px 10px; font-size: 12px; font-weight: 500; }

/* ============ フィルター ============ */
.filter-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.filter-label { font-size: 12px; color: var(--text-secondary); font-weight: 600; margin-right: 4px; }
.chip {
  font: inherit;
  font-size: 13px;
  padding: 5px 14px;
  border-radius: 999px;
  border: 1px solid var(--baseline);
  background: var(--surface-1);
  color: var(--text-secondary);
  cursor: pointer;
}
.chip:hover { background: var(--chip-selected-bg); }
.chip.selected {
  background: var(--chip-selected-bg);
  border-color: var(--series-1);
  color: var(--text-primary);
  font-weight: 700;
}

/* ============ 警告バナー ============ */
.banner {
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: 10px;
  padding: 12px 16px;
  font-weight: 600;
}
.banner-critical {
  border: 1px solid var(--critical);
  color: var(--critical);
  background: color-mix(in srgb, var(--critical) 8%, var(--surface-1));
}
.banner-icon { font-size: 18px; line-height: 1; }
.banner-lines { display: flex; flex-direction: column; gap: 2px; }
.banner-note { font-size: 12px; font-weight: 400; opacity: 0.85; }

/* ============ スタットタイル ============ */
.tiles {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
@media (max-width: 800px) {
  .tiles { grid-template-columns: repeat(2, 1fr); }
}
.tile {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.tile-label { font-size: 12px; color: var(--text-secondary); }
.tile-value { font-size: 24px; font-weight: 600; }
.tile-value.negative { color: var(--critical); }
.tile-sub { font-size: 12px; color: var(--text-muted); }

.noscript-note {
  max-width: 1080px;
  margin: 0 auto;
  padding: 20px;
}

/* ============ チャート ============ */
.chart-wrap { position: relative; width: 100%; }
#chart .chart-num { font-variant-numeric: tabular-nums; }
#chart { display: block; width: 100%; }
.chart-empty, .empty-note { font-size: 13px; color: var(--text-muted); padding: 8px 0; }

.chart-tooltip {
  position: absolute;
  pointer-events: none;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  padding: 8px 12px;
  font-size: 12px;
  min-width: 150px;
  max-width: 280px;
  z-index: 10;
}
.chart-tooltip .tt-sep { border-top: 1px solid var(--gridline); margin: 6px 0 4px; }
.chart-tooltip .tt-more { color: var(--text-muted); font-size: 11px; }
.chart-tooltip .tt-date { color: var(--text-secondary); margin-bottom: 4px; }
.chart-tooltip .tt-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}
.chart-tooltip .tt-key {
  display: inline-block;
  width: 12px;
  height: 0;
  border-top: 2px solid var(--series-1);
  margin-right: 6px;
  vertical-align: middle;
}
.chart-tooltip .tt-label { color: var(--text-secondary); }
.chart-tooltip .tt-value { font-weight: 700; font-variant-numeric: tabular-nums; }
.chart-tooltip .tt-value.negative { color: var(--critical); }

/* ============ 予定一覧 ============ */
.tx-filters { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.tx-filter-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.tx-filter-row select { font-size: 13px; padding: 5px 8px; max-width: 100%; }
.tx-filter-check {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
}
.tx-filter-count { font-size: 12px; color: var(--text-muted); }
.tx-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  max-height: 520px;
  overflow-y: auto;
}
.tx-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 2px;
  border-bottom: 1px solid var(--gridline);
}
.tx-item:last-child { border-bottom: none; }
.tx-item-main { flex: 1; min-width: 0; }
.tx-item-label { font-weight: 600; }
.tx-item-sub { font-size: 12px; color: var(--text-muted); }
.tx-item-amount { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.tx-item-amount.expense { color: var(--critical); }
.tx-item-amount.income { color: var(--good-text); }
.tx-item-amount.transfer { color: var(--series-1); }
.tx-item-actions { display: flex; gap: 6px; }

/* 状態バッジ */
.badge-status {
  display: inline-block;
  margin-left: 6px;
  padding: 0 6px;
  font-size: 10px;
  font-weight: 600;
  border-radius: 999px;
  border: 1px solid var(--baseline);
  color: var(--text-muted);
  vertical-align: 1px;
  white-space: nowrap;
}
.badge-status.st-confirmed, .badge-status.st-approved {
  border-color: var(--series-1);
  color: var(--series-1);
  background: var(--chip-selected-bg);
}
.badge-status.st-done { border-color: var(--good-text); color: var(--good-text); }
.badge-status.st-delayed { border-color: var(--critical); color: var(--critical); font-weight: 700; }
.badge-status.st-transfer { border-color: var(--series-1); color: var(--series-1); }

/* ============ テーブル ============ */
.table-wrap { overflow-x: auto; }
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.data-table th, .data-table td {
  padding: 7px 10px;
  border-bottom: 1px solid var(--gridline);
  text-align: left;
  white-space: nowrap;
}
.data-table th {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 12px;
  border-bottom: 1px solid var(--baseline);
}
.data-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.data-table td.negative { color: var(--critical); font-weight: 700; }
.data-table .cell-sub { color: var(--text-muted); }

/* 行ホバーのハイライト（明細行は対象外） */
.data-table tbody tr:not(.detail-row):hover td { background: var(--row-hover); }

/* 明細の展開 */
.content-toggle {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  text-align: left;
}
.content-toggle .chevron {
  display: inline-block;
  margin-right: 4px;
  color: var(--text-muted);
  transition: transform 0.15s;
}
.content-toggle .chevron.open { transform: rotate(90deg); }
.content-toggle .tx-count { color: var(--text-muted); }
.detail-row td { padding-top: 0; }
.detail-list {
  list-style: none;
  padding: 2px 0 6px 24px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.detail-list li {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  font-size: 12px;
  white-space: normal;
}
.detail-label { color: var(--text-secondary); overflow-wrap: anywhere; }
.detail-amount { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.detail-amount.income { color: var(--good-text); }
.detail-amount.expense { color: var(--critical); }

/* 曜日の色（土=青・日=赤） */
.wd-sat { color: var(--series-1); }
.wd-sun { color: var(--critical); }

/* 月の切り替わり */
.data-table tr.month-start td { border-top: 2px solid var(--baseline); }

/* 期間内の最低残高の行 */
.badge-min {
  display: inline-block;
  margin-left: 6px;
  padding: 0 6px;
  font-size: 10px;
  font-weight: 700;
  border-radius: 999px;
  background: var(--chip-selected-bg);
  color: var(--text-secondary);
  vertical-align: 1px;
}

/* 内容列（折り返し + 幅可変） */
.data-table td.cell-content { white-space: normal; }
.cell-content-inner {
  max-width: var(--content-col-w, 360px);
  white-space: normal;
  overflow-wrap: anywhere;
}
.th-content { position: relative; }
.col-resizer {
  position: absolute;
  top: 0;
  right: -7px;
  width: 14px;
  height: 100%;
  cursor: col-resize;
  user-select: none;
  touch-action: none;
}
.col-resizer::after {
  content: '';
  position: absolute;
  top: 15%;
  bottom: 15%;
  left: 6px;
  width: 2px;
  border-radius: 1px;
  background: var(--baseline);
}
.col-resizer:hover::after, .col-resizer.dragging::after { background: var(--series-1); }

/* ============ 月次収支グラフ ============ */
.chart-legend {
  display: flex;
  gap: 16px;
  margin-bottom: 8px;
  font-size: 12px;
  color: var(--text-secondary);
}
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.legend-swatch { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.swatch-income { background: var(--income); }
.swatch-expense { background: var(--expense); }
.legend-line { width: 14px; height: 0; border-top: 2px solid var(--balance); display: inline-block; }
.legend-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.dot-income { background: var(--income); }
.dot-expense { background: var(--expense); }
.legend-dash { width: 16px; height: 0; border-top: 2px dashed var(--critical); display: inline-block; }

/* ============ 円グラフ ============ */
.pie-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}
@media (max-width: 800px) {
  .pie-grid { grid-template-columns: 1fr; }
}
.pie-panel h3 {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 10px;
}
.pie-wrap { width: 240px; margin: 0 auto 12px; }
.pie-legend {
  list-style: none;
  flex: 1;
  min-width: 220px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
}
.pie-legend-item { display: flex; align-items: center; gap: 8px; }
.pie-swatch { width: 10px; height: 10px; border-radius: 2px; flex: 0 0 auto; }
.pie-legend-label { flex: 1; min-width: 0; color: var(--text-secondary); overflow-wrap: anywhere; }
.pie-legend-value { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.pie-legend-pct {
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  width: 52px;
  text-align: right;
  white-space: nowrap;
}

/* ============ 初回チュートリアル ============ */
.tutorial-mask { position: fixed; inset: 0; z-index: 1000; }
.tutorial-spotlight {
  position: fixed;
  border-radius: 12px;
  border: 2px solid var(--series-1);
  box-shadow: 0 0 0 200vmax rgba(8, 15, 30, 0.55);
  pointer-events: none;
  transition: top 0.25s ease, left 0.25s ease, width 0.25s ease, height 0.25s ease;
}
.tutorial-pop {
  position: fixed;
  width: min(400px, calc(100vw - 32px));
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 20px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
}
.tutorial-pop:focus { outline: none; }
.tutorial-step { font-size: 12px; font-weight: 600; color: var(--text-muted); margin-bottom: 6px; }
.tutorial-title { font-size: 16px; font-weight: 700; margin-bottom: 8px; }
.tutorial-text { font-size: 13px; color: var(--text-secondary); line-height: 1.8; margin-bottom: 14px; }
.tutorial-actions { display: flex; justify-content: flex-end; gap: 8px; }
