:root {
    color-scheme: light;
    --report-ink: #263238;
    --report-muted: #687579;
    --report-line: #d8dfdf;
    --report-accent: #8f3d46;
    --report-paper: #f3f5f6;
    font-family: "Yu Gothic UI", "Meiryo", sans-serif;
    color: var(--report-ink);
    background: var(--report-paper);
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: var(--report-paper); }
button, input { font: inherit; }
button:focus-visible, input:focus-visible, a:focus-visible { outline: 2px solid var(--report-accent); outline-offset: 2px; }
.family-report { width: min(100%, 820px); margin: 0 auto; padding: 8px 8px 12px; background: #fff; }
.report-back { display: inline-block; margin-bottom: 6px; color: #71313a; font-size: 12px; }
.report-kicker { margin: 0 0 2px; color: var(--report-accent); font-size: 9px; font-weight: 700; letter-spacing: 1px; }
h1 { margin: 0 0 8px; color: #71313a; font-size: 20px; }
.report-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.report-controls label { color: var(--report-muted); font-size: 12px; font-weight: 700; }
.report-controls input { min-height: 30px; padding: 2px 6px; border: 1px solid #ccc; border-radius: 3px; background: white; }
.report-controls input[type="number"] { width: 64px; }
.report-range-modes,
.report-range-value { display: inline-flex; align-items: center; gap: 4px; }
.report-range-modes label { display: inline-flex; align-items: center; gap: 2px; }
.report-range-modes input[type="radio"] { width: auto; min-height: 0; margin: 0; padding: 0; accent-color: var(--report-accent); }
.report-range-value[hidden] { display: none; }
.report-range-value > span { color: var(--report-muted); font-size: 12px; }
.report-range-value input[type="month"] { min-height: 30px; padding: 2px 4px; }
.report-controls button { min-height: 30px; padding: 2px 8px; border: 1px solid #8f3d46; border-radius: 3px; color: white; background: #8f3d46; font-size: 12px; cursor: pointer; }
.report-summary { display: grid; grid-template-columns: minmax(0, 1.8fr) minmax(0, 1fr) auto; gap: 4px 12px; margin: 8px 0 10px; padding: 6px 0; border-top: 2px solid var(--report-accent); border-bottom: 1px solid var(--report-line); }
.report-summary div { display: flex; flex-direction: column; gap: 1px; }
.report-summary span { color: var(--report-muted); font-size: 14px; }
.report-summary strong { font-size: 20px; }
.report-summary div:nth-child(3) { text-align: right; }
.report-section-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; margin-bottom: 2px; }
h2 { margin: 0; font-size: 15px; }
.report-section-heading span { color: var(--report-muted); font-size: 11px; }
.report-entry { display: grid; grid-template-columns: 30% minmax(0, 1fr); gap: 0 8px; padding: 7px 0; border-bottom: 1px solid var(--report-line); background: #fff; break-inside: avoid; line-height: 1.2; }
.report-entry-main { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto; align-content: start; gap: 2px 4px; background: #fff; }
.report-entry-main > div { grid-column: 1; grid-row: 1; min-width: 0; }
.report-entry time { color: var(--report-muted); font-size: 13px; }
.report-entry h3 { margin: 1px 0 0; font-size: 20px; }
.report-main-memo { margin: 2px 0 0; overflow-wrap: anywhere; color: #111; font-size: 22px; font-weight: 700; line-height: 1.2; }
.report-main-memo span { margin-right: 4px; color: var(--report-muted); font-size: 15px; font-weight: 600; }
.report-amount { grid-column: 2; grid-row: 1; align-self: start; color: #71313a; font-size: 22px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.report-details { display: grid; width: 100%; max-width: 100%; grid-template-columns: repeat(2, minmax(0, 1fr)); justify-self: stretch; align-content: start; gap: 4px 8px; margin: 0; padding: 0 0 0 8px; border-left: 1px solid var(--report-line); background: #fff; }
.report-details div:nth-child(1) { grid-area: 1 / 1; }
.report-details div:nth-child(2) { grid-area: 1 / 2; }
.report-details div:nth-child(3) { grid-area: 2 / 1; }
.report-details div:nth-child(4) { grid-area: 2 / 2; }
.report-details div:nth-child(5) { grid-area: 3 / 1; }
.report-details div:nth-child(6) { grid-area: 3 / 2; }
.report-details div { display: flex; min-width: 0; align-items: baseline; justify-content: space-between; gap: 6px; padding-bottom: 2px; border-bottom: 1px solid #edf0f0; }
.report-details dt { flex: 0 0 auto; margin: 0; color: var(--report-muted); font-size: 13px; line-height: 1.2; }
.report-details dd { min-width: 0; margin: 0; overflow-wrap: anywhere; text-align: right; font-size: 18px; font-weight: 600; line-height: 1.2; }
.report-empty { padding: 10px 0; color: var(--report-muted); text-align: center; }
.report-footer { margin-top: 8px; color: var(--report-muted); font-size: 10px; text-align: right; }
@media (max-width: 520px) {
    .family-report { padding: 4px 0 8px 4px; }
    .report-back { margin-bottom: 2px; font-size: 11px; }
    .report-kicker { display: none; }
    h1 { margin-bottom: 4px; font-size: 18px; }
    .report-controls { gap: 2px 4px; }
    .report-controls input,
    .report-controls button { min-height: 30px; }
    .report-controls button { padding: 2px 6px; font-size: 11px; }
    .report-summary { gap: 2px 6px; margin: 6px 0 8px; padding: 4px 0; }
    .report-summary { grid-template-columns: minmax(0, 1fr) 1fr; }
    .report-summary div:first-child { grid-column: 1 / -1; }
    .report-summary div:nth-child(2) { grid-row: 2; }
    .report-summary div:nth-child(3) { grid-row: 2; grid-column: 2; text-align: right; }
    .report-summary div { gap: 1px; }
    .report-summary span { font-size: 13px; }
    .report-summary strong { font-size: 19px; }
    .report-section-heading { margin-bottom: 1px; }
    h2 { font-size: 14px; }
    .report-entry { grid-template-columns: minmax(0, 1fr); gap: 0; padding: 5px 0; }
    .report-entry-main { gap: 2px 3px; }
    .report-entry time { font-size: 12px; }
    .report-entry h3 { margin-top: 1px; font-size: 19px; }
    .report-main-memo { font-size: 22px; }
    .report-main-memo span { font-size: 15px; }
    .report-amount { font-size: 21px; }
    .report-details { grid-column: 1; width: 100%; max-width: 100%; grid-template-columns: repeat(2, minmax(0, 1fr)); justify-self: stretch; gap: 4px 6px; margin-top: 4px; padding: 4px 0 0; border-top: 1px solid var(--report-line); border-left: 0; }
    .report-details dt { font-size: 12px; }
    .report-details dd { font-size: 17px; line-height: 1.2; }
    .report-empty { padding: 8px 0; }
    .report-footer { margin-top: 6px; }
}
@page { size: A4 portrait; margin: 8mm; }
@media print {
    :root, body { background: #fff; color: #111; }
    .family-report { width: 100%; margin: 0; padding: 0; }
    .report-back, .report-controls { display: none !important; }
    h1 { margin-bottom: 5px; font-size: 24px; }
    .report-summary span { font-size: 16px; }
    .report-summary strong { font-size: 24px; }
    .report-summary { margin: 6px 0 8px; padding: 5px 0; }
    h2 { font-size: 18px; }
    .report-section-heading span { font-size: 13px; }
    .report-entry { grid-template-columns: 30% minmax(0, 1fr); gap: 0 8px; padding: 5px 0; }
    .report-entry time { font-size: 15px; }
    .report-entry h3 { font-size: 24px; }
    .report-main-memo { font-size: 28px; }
    .report-main-memo span { font-size: 16px; }
    .report-amount { color: #111; font-size: 28px; }
    .report-details { width: 100%; max-width: 100%; grid-template-columns: repeat(2, minmax(0, 1fr)); justify-self: stretch; gap: 4px 12px; margin: 0; padding: 0 0 0 8px; }
    .report-details div { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding-bottom: 2px; border-bottom: 1px solid #edf0f0; }
    .report-details dt { flex: 0 0 auto; margin: 0; font-size: 16px; }
    .report-details dd { min-width: 0; margin: 0; overflow-wrap: anywhere; text-align: right; font-size: 22px; }
    .report-footer { margin-top: 8px; }
}
