:root {
    color-scheme: light;
    font-family: 'Noto Sans JP', 'Hiragino Kaku Gothic ProN', Meiryo, sans-serif;
    color: #23332d;
    background: #f5f7f5;
    font-synthesis: none;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    --green: #237a57;
    --green-dark: #175f42;
    --mint: #e8f4ed;
    --muted: #829089;
    --line: #e8ece8;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }
.site-header { height: 72px; padding: 0 max(24px, calc((100% - 1120px) / 2)); display: flex; align-items: center; justify-content: space-between; background: #fff; border-bottom: 1px solid var(--line); }
.header-actions, .heading-actions { display: flex; align-items: center; gap: 9px; }
.member-indicator { color: #536159; font-size: 12px; font-weight: 600; }
.member-switch { padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; color: #718078; font-size: 11px; }
.member-switch:hover { color: var(--green); border-color: #b6d6c1; }
.brand { display: flex; align-items: center; gap: 10px; color: #1d3129; font-size: 19px; font-weight: 700; }
.brand-mark { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 11px; color: #fff; background: var(--green); font-size: 16px; }
.header-caption, .site-footer { color: var(--muted); font-size: 12px; }
.page-shell { width: min(1120px, calc(100% - 48px)); margin: 38px auto 64px; min-height: calc(100vh - 190px); }
.page-heading, .panel-heading { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.page-heading { margin-bottom: 24px; }
.eyebrow { margin: 0 0 5px; color: #9aa79f; font-size: 10px; font-weight: 700; letter-spacing: .16em; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: 26px; letter-spacing: -.04em; }
h2 { margin: 0; font-size: 16px; }
h3 { margin-bottom: 6px; font-size: 15px; }
.button { min-height: 42px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 0 17px; border: 0; border-radius: 9px; font-size: 13px; font-weight: 600; cursor: pointer; transition: background .15s, transform .15s; }
.button:hover { transform: translateY(-1px); }
.button-primary { background: var(--green); color: white; box-shadow: 0 4px 10px #237a5724; }
.button-primary:hover { background: var(--green-dark); }
.button-secondary { border: 1px solid #d7e8dd; color: var(--green-dark); background: white; }
.button-quiet { color: #6f7d75; background: #f2f4f2; }
.month-switcher { display: flex; align-items: center; justify-content: center; gap: 18px; margin-bottom: 20px; }
.month-switcher input { border: 0; color: #33433b; background: transparent; font-size: 15px; font-weight: 700; cursor: pointer; }
.month-arrow { width: 30px; height: 30px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; color: #74827a; background: #fff; font-size: 23px; line-height: 1; }
.summary-grid { display: grid; grid-template-columns: 1.15fr 1fr 1fr; gap: 16px; margin-bottom: 20px; }
.summary-card, .panel { border: 1px solid var(--line); border-radius: 15px; background: #fff; box-shadow: 0 6px 24px #263a2d05; }
.summary-card { min-height: 132px; display: flex; flex-direction: column; justify-content: center; padding: 19px 22px; }
.balance-card { color: #fff; border-color: #237a57; background: linear-gradient(135deg, #287f5d, #1d684a); }
.summary-label { margin-bottom: 8px; color: #7d8b83; font-size: 12px; font-weight: 500; }
.balance-card .summary-label, .balance-card .summary-note { color: #d3e9dc; }
.summary-value { font-size: 27px; letter-spacing: -.04em; }
.summary-note { margin-top: 6px; color: #a0aaa4; font-size: 11px; }
.income-text { color: #24835c; }
.expense-text, .is-negative { color: #d26c56; }
.content-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(280px, 1fr); align-items: start; gap: 18px; }
.panel { padding: 22px; }
.panel-heading { margin-bottom: 18px; }
.income-panel { margin-bottom: 18px; }
.income-table-wrap { overflow-x: auto; }
.income-table { width: 100%; border-collapse: collapse; font-size: 12px; white-space: nowrap; }
.income-table th, .income-table td { padding: 12px 10px; border-bottom: 1px solid #f0f2f0; text-align: right; }
.income-table thead th { color: #8d9991; font-size: 10px; font-weight: 500; }
.income-table th:first-child, .income-table td:first-child { text-align: left; }
.income-table tbody th { color: #435249; font-weight: 600; }
.income-table .row-actions { justify-content: flex-end; }
.income-total-row th, .income-total-row td { border-top: 1px solid #dfe7e1; border-bottom: 0; font-weight: 700; }
.empty-income { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.empty-income p, .legacy-income-note { margin: 0; color: #929e96; font-size: 11px; }
.legacy-income-note { margin-top: 12px; }
.income-calculation { margin: -4px 0 0; color: #87948b; font-size: 11px; }
.count-badge { padding: 5px 9px; border-radius: 20px; color: #718078; background: #f2f5f2; font-size: 11px; }
.transaction-list { border-top: 1px solid #f0f2f0; }
.transaction-row { min-height: 69px; display: flex; align-items: center; gap: 13px; border-bottom: 1px solid #f0f2f0; }
.category-icon { width: 36px; height: 36px; flex: 0 0 36px; display: grid; place-items: center; border-radius: 11px; font-size: 16px; font-weight: 700; }
.icon-income { color: #29815c; background: #eaf5ee; }
.icon-expense { color: #d27861; background: #fff0ec; }
.transaction-info { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 4px; }
.transaction-info strong { overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.transaction-info span { overflow: hidden; color: #99a39d; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.transaction-amount { white-space: nowrap; font-size: 12px; }
.row-actions { display: flex; align-items: center; gap: 8px; margin-left: 4px; color: #8a968e; font-size: 10px; }
.row-actions a:hover, .link-button:hover { color: var(--green); }
.link-button { padding: 0; border: 0; color: inherit; background: transparent; font-size: inherit; cursor: pointer; }
.empty-state { padding: 33px 10px 24px; text-align: center; }
.empty-icon { width: 45px; height: 45px; display: grid; place-items: center; margin: 0 auto 13px; border-radius: 50%; color: var(--green); background: var(--mint); font-weight: 700; }
.empty-state p, .muted-message { color: #929e96; font-size: 12px; }
.empty-state .button { margin-top: 8px; }
.pagination { margin-top: 18px; }
.pagination nav > div:first-child { display: none; }
.pagination nav > div:last-child { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.pagination nav span, .pagination nav a { padding: 6px 10px; border: 1px solid var(--line); border-radius: 7px; color: #66756c; font-size: 11px; }
.category-list { display: flex; flex-direction: column; gap: 18px; }
.category-line { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 8px; font-size: 11px; }
.category-line strong { color: #48584e; font-size: 11px; }
.bar-track { height: 6px; overflow: hidden; border-radius: 5px; background: #f0f3f0; }
.bar-fill { height: 100%; display: block; border-radius: inherit; background: linear-gradient(90deg, #71b78f, #28835c); }
.site-footer { padding: 0 24px 24px; text-align: center; }
.notice { margin-bottom: 18px; padding: 12px 15px; border: 1px solid #d2e8d9; border-radius: 9px; color: #246746; background: #edf8f0; font-size: 13px; }
.form-page { max-width: 600px; margin: 0 auto; }
.back-link { display: inline-block; margin-bottom: 16px; color: #728078; font-size: 12px; }
.back-link:hover { color: var(--green); }
.form-panel { padding: 27px 30px; }
.form-panel .panel-heading { margin-bottom: 24px; }
.form-panel h1 { font-size: 21px; }
.field { margin-bottom: 20px; }
.field-label { display: block; margin-bottom: 8px; color: #536159; font-size: 12px; font-weight: 600; }
.optional-label { margin-left: 5px; color: #a1aaa4; font-size: 10px; font-weight: 400; }
.field input:not([type=radio]), .field select { width: 100%; height: 44px; padding: 0 12px; border: 1px solid #e1e7e2; border-radius: 8px; outline: none; color: #34443b; background: #fff; font-size: 13px; }
.field input:focus, .field select:focus { border-color: #7cbd98; box-shadow: 0 0 0 3px #68a8831a; }
.type-choice { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.type-option input { position: absolute; opacity: 0; }
.type-option span { height: 42px; display: grid; place-items: center; border: 1px solid #e2e8e3; border-radius: 8px; color: #738078; background: #fff; font-size: 13px; cursor: pointer; }
.income-option input:checked + span { border-color: #83c39b; color: #26734e; background: #edf8f0; }
.expense-option input:checked + span { border-color: #ebac9b; color: #be604b; background: #fff3ef; }
.amount-input { position: relative; }
.amount-input > span { position: absolute; top: 50%; left: 13px; color: #7b8880; transform: translateY(-50%); font-size: 14px; }
.amount-input input { padding-left: 30px !important; }
.form-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 26px; }
.validation-errors { margin-bottom: 20px; padding: 13px 15px; border: 1px solid #f0c9bd; border-radius: 8px; color: #a94e3d; background: #fff5f2; font-size: 12px; }
.validation-errors p { margin-bottom: 5px; font-weight: 600; }
.validation-errors ul { margin: 0; padding-left: 18px; }
.member-page .form-panel > .muted-message { margin-bottom: 20px; line-height: 1.8; }
.member-choice-list { display: grid; gap: 10px; }
.member-choice { width: 100%; display: flex; align-items: center; gap: 13px; padding: 14px; border: 1px solid var(--line); border-radius: 11px; color: #34443b; background: white; text-align: left; cursor: pointer; }
.member-choice:hover, .member-choice.is-current { border-color: #9dc9ac; background: #f5fbf6; }
.member-avatar { width: 42px; height: 42px; flex: 0 0 42px; display: grid; place-items: center; border-radius: 13px; color: var(--green); background: var(--mint); font-weight: 700; }
.member-choice-copy { flex: 1; display: grid; gap: 4px; }
.member-choice-copy strong { font-size: 13px; }
.member-choice-copy small { color: #96a198; font-size: 10px; }
.member-chevron { color: #94a198; font-size: 22px; }
.member-cancel { width: 100%; margin-top: 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; clip-path: inset(50%); }

@media (max-width: 760px) {
    .page-shell { width: min(100% - 30px, 580px); margin-top: 25px; }
    .site-header { height: 62px; padding: 0 16px; }
    .header-caption { font-size: 10px; }
    .member-indicator { font-size: 10px; }
    .member-switch { padding: 6px 7px; font-size: 9px; }
    .heading-actions { gap: 5px; }
    .summary-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
    .balance-card { grid-column: 1 / -1; min-height: 115px; }
    .summary-card:not(.balance-card) { min-height: 105px; padding: 15px; }
    .summary-value { font-size: 22px; }
    .content-grid { grid-template-columns: 1fr; gap: 12px; }
    .panel { padding: 18px; }
    .transaction-row { gap: 9px; }
    .transaction-amount { font-size: 11px; }
    .row-actions { flex-direction: column; gap: 4px; margin-left: 0; }
    .empty-income { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 400px) {
    .page-heading { align-items: flex-start; }
    .page-heading h1 { font-size: 22px; }
    .page-heading .button { min-height: 38px; padding: 0 8px; font-size: 10px; }
    .transaction-row { gap: 7px; }
    .category-icon { width: 31px; height: 31px; flex-basis: 31px; }
}
