:root {
    color-scheme: light;
    --color-bg: #faf7f2;
    --color-surface: #fff;
    --color-panel: #f3efe8;
    --color-line: #dcd6cc;
    --color-text: #1f1c18;
    --color-text-muted: #5a554d;
    --color-accent: #1a1a1a;
    --color-focus: #1a73e8;
    --fx-chart: #235a78;
    --fx-negative: #9d342b;
    --radius-sm: 8px;
    --radius-md: 14px;
    --font-sans: 'Helvetica Neue', 'Hiragino Kaku Gothic ProN', 'Yu Gothic', Arial, sans-serif;
    --font-serif: 'Times New Roman', 'Hiragino Mincho ProN', 'Yu Mincho', serif;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--color-bg); color: var(--color-text); font: 1rem/1.55 var(--font-sans); }
h1, h2, p { margin: 0; }
h2 { font-size: 1rem; font-weight: 700; }
a { color: inherit; }
button, input, select { font: inherit; }
:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 3px; }
input, select { max-width: 100%; }
input[type='checkbox'] { accent-color: var(--color-accent); }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .55; }
.fx-container { width: calc(100% - 48px); margin-inline: auto; }
.fx-heading {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0 16px;
    min-height: 40px;
    border-bottom: 1px solid var(--color-line);
}
.fx-heading-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 0 12px; }
.fx-heading h1 { font: 500 clamp(1.375rem, 2vw, 1.625rem)/1.12 var(--font-serif); letter-spacing: -.035em; }
.fx-apps-link { font-size: .875rem; text-underline-offset: .25em; }
.fx-tax, .fx-tax label, .fx-check { display: flex; align-items: center; gap: 7px; }
.fx-tax { font-size: .9rem; flex-wrap: wrap; }
.fx-tabs { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 6px; border-bottom: 1px solid var(--color-line); }
.fx-tabs > button { border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--color-text-muted); padding: 4px 12px; font-size: .875rem; }
.fx-tabs > button[aria-selected='true'] { color: var(--color-text); border-color: var(--color-text); font-weight: 700; }
.fx-tabs > button:hover { background: var(--color-panel); }
.fx-workspace { display: grid; grid-template-columns: minmax(260px, 310px) minmax(0, 1fr); gap: 16px; align-items: start; }
.fx-result { display: grid; gap: 12px; min-width: 0; }
.fx-surface { background: var(--color-surface); border: 1px solid var(--color-line); border-radius: var(--radius-md); }
.fx-form { padding: 18px; display: grid; gap: 16px; }
.fx-form-actions { display: flex; gap: 8px; }
.fx-form-actions > button { flex: 1; }
.fx-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.fx-form-grid label { display: grid; align-content: start; gap: 4px; font-size: .875rem; }
.fx-wide { grid-column: 1 / -1; }
.fx-form :is(input, select), .fx-toolbar select, .fx-tax #tax-rate {
    border: 1px solid var(--color-line); border-radius: var(--radius-sm); color: var(--color-text);
    background: var(--color-surface); padding: 6px 9px; min-width: 0; min-height: 42px;
}
.fx-tax #tax-rate { width: 74px; min-height: 32px; padding: 4px 8px; text-align: right; }
.fx-tax #tax-rate:disabled { background: var(--color-panel); color: var(--color-text-muted); }
.fx-form input { width: 100%; font-size: 1rem; }
.fx-form select, .fx-toolbar select {
    appearance: none; padding-right: 28px;
    background-image: linear-gradient(45deg, transparent 50%, #5a554d 50%), linear-gradient(135deg, #5a554d 50%, transparent 50%);
    background-position: right 13px center, right 8px center; background-size: 5px 5px; background-repeat: no-repeat;
}
.fx-button { padding: 8px 14px; min-height: 42px; border: 1px solid var(--color-line); border-radius: var(--radius-sm); background: var(--color-panel); color: var(--color-text); }
.fx-primary { background: var(--color-accent); border-color: var(--color-accent); color: #fff; }
.fx-button:hover:not(:disabled) { filter: brightness(.93); }
.fx-cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.fx-card { margin: 0; padding: 11px 14px; min-width: 0; }
.fx-card dt, .fx-status { color: var(--color-text-muted); font-size: .875rem; }
.fx-card dd { margin: 3px 0 0; font-size: clamp(1.15rem, 2vw, 1.55rem); font-weight: 650; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.fx-negative { color: var(--fx-negative); }
.fx-alert { color: var(--fx-negative); font-size: .875rem; }
.fx-status:empty { display: none; }
.fx-migration-status { margin-bottom: 12px; }
.fx-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 12px 14px; }
.fx-toolbar h2 { flex: 1 1 120px; }
.fx-chart-panel canvas { display: block; width: 100%; height: 220px; }
.fx-table-panel { overflow: hidden; }
.fx-table-export { display: flex; justify-content: flex-end; align-items: center; flex-wrap: wrap; gap: 8px; padding: 8px 14px; }
.fx-table-scroll { max-height: 350px; overflow: auto; }
.fx-table-scroll table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .875rem; font-variant-numeric: tabular-nums; }
.fx-table-scroll :is(th, td) { border-bottom: 1px solid var(--color-line); padding: 8px clamp(5px, .65vw, 10px); text-align: right; }
.fx-table-scroll td { white-space: nowrap; }
.fx-table-scroll tr > :first-child { text-align: left; }
.fx-table-scroll thead th { position: sticky; z-index: 1; top: 0; background: var(--color-panel); }
.fx-table-scroll tbody tr:last-child > * { border-bottom: 0; }
.fx-memo-panel { padding: clamp(12px, 2vw, 18px); }
.fx-memo-heading { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 8px; }
.fx-memo-heading label { font-weight: 650; }
#memo-count { color: var(--color-text-muted); font-size: .875rem; }
#memo-text {
    display: block; width: 100%; min-height: 12rem; resize: vertical;
    padding: 8px 10px; border: 1px solid var(--color-line); border-radius: var(--radius-sm);
    color: var(--color-text); background: var(--color-surface); font: inherit;
}
.fx-method { margin-block: 22px 28px; color: var(--color-text-muted); font-size: .875rem; }
.fx-method summary { cursor: pointer; width: fit-content; }
.fx-method p { margin-block: 8px; }
.fx-footer { border-top: 1px solid var(--color-line); padding-block: 18px; color: var(--color-text-muted); font-family: var(--font-serif); }
.fx-footer-inner, .fx-storage { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.fx-footer-inner { justify-content: space-between; }
.fx-storage { font-family: var(--font-sans); font-size: .875rem; }
.fx-storage button { min-height: 36px; }
.fx-storage p:empty { display: none; }
.fx-mobile-jump, .fx-mobile-result-title, .fx-mobile-table-hint { display: none; }
.fx-sr-only, .fx-skip:not(:focus) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.fx-skip:focus { position: absolute; top: 8px; left: 8px; background: #fff; z-index: 5; padding: 8px; }
@media (max-width: 950px) {
    .fx-workspace { grid-template-columns: minmax(220px, 260px) minmax(0, 1fr); }
    .fx-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 780px) {
    .fx-workspace { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 740px) {
    .fx-container { width: calc(100% - 24px); }
    .fx-apps-link, .fx-tax label { display: inline-flex; align-items: center; min-height: 44px; }
    .fx-apps-link { min-width: 44px; justify-content: flex-end; }
    .fx-tabs {
        position: sticky;
        top: 0;
        z-index: 4;
        display: grid;
        grid-template-columns: repeat(5, minmax(0, 1fr));
        gap: 2px;
        background: var(--color-bg);
    }
    .fx-tabs > button { min-height: 44px; padding: 4px 2px; font-size: .875rem; line-height: 1.2; overflow-wrap: anywhere; }
    [role="tabpanel"], .fx-form, .fx-result, #main { scroll-margin-top: 54px; }
    .fx-form { padding: 12px; gap: 12px; }
    .fx-form-grid { gap: 10px; align-items: end; }
    .fx-form :is(input, select), .fx-toolbar select, .fx-tax #tax-rate { min-height: 44px; font-size: 1rem; }
    .fx-button { min-height: 44px; }
    .fx-mobile-jump { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
    .fx-mobile-result-title { display: flex; justify-content: space-between; align-items: center; column-gap: .5rem; }
    .fx-mobile-result-title > a { display: inline-flex; align-items: center; min-height: 44px; font-size: .875rem; }
    .fx-mobile-table-hint { display: block; color: var(--color-text-muted); font-size: .8125rem; }
    .fx-card { padding: 9px 12px; }
    .fx-chart-panel canvas { height: 205px; }
    .fx-table-panel .fx-mobile-table-hint { margin: 0 14px 6px; }
    .fx-table-scroll :is(th, td) { white-space: nowrap; }
    .fx-table-scroll tr > :first-child {
        position: sticky;
        inset-inline-start: 0;
        background: var(--color-surface);
        box-shadow: 1px 0 var(--color-line);
    }
    .fx-table-scroll thead tr > :first-child { z-index: 2; background: var(--color-panel); }
    .fx-storage { width: 100%; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .fx-storage > :is(#storage-status, #clear-storage) { grid-column: 1 / -1; }
    .fx-storage button { min-height: 44px; }
}
@media (max-width: 530px) {
    .fx-heading-tools { flex: 1 0 auto; justify-content: space-between; }
}
