:root {
  color-scheme: light;
  --page: #f3f6fa;
  --paper: #ffffff;
  --ink: #152b46;
  --muted: #52657a;
  --line: #d7e1ea;
  --blue: #234f7c;
  --green: #17664f;
  --green-wash: #edf7f2;
  --amber-wash: #fff5db;
  --error: #a62c3b;
  font-family: "Hiragino Kaku Gothic ProN", "Yu Gothic", "Meiryo", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}
* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--page); font-size: 15px; line-height: 1.65; }
button, input, select { font: inherit; }
button, a, input, select, summary { -webkit-tap-highlight-color: transparent; }
button, select, summary { cursor: pointer; }
button { touch-action: manipulation; }
a { color: var(--blue); text-underline-offset: 4px; }
a:hover { text-decoration-thickness: 2px; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible {
  outline: 3px solid #4a81b9;
  outline-offset: 4px;
}
button:disabled, input:disabled, select:disabled { cursor: not-allowed; opacity: .6; }
input:disabled, select:disabled { background: #edf1f5; }
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(25px, 3.4vw, 36px); line-height: 1.4; letter-spacing: -.035em; font-weight: 700; }
h2 { font-size: 20px; line-height: 1.5; letter-spacing: -.025em; }
h3 { font-size: 16px; }
ul { margin: 0; padding: 0; list-style: none; }
strong { font-weight: 700; }
.muted { color: var(--muted); }
.small-text { font-size: 12px; }
.skip-link { position: fixed; top: -70px; left: 12px; z-index: 10; padding: 12px; background: white; }
.skip-link:focus { top: 12px; }
.app-shell { width: min(1120px, calc(100% - 80px)); margin-inline: auto; }
.app-header { display: flex; align-items: center; justify-content: space-between; padding: 28px 0 25px; gap: 20px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); font-family: "Avenir Next", "Trebuchet MS", sans-serif; font-size: 23px; font-weight: 650; letter-spacing: -.06em; text-decoration: none; }
.brand-mark { color: var(--green); font-size: 34px; line-height: 1; transform: rotate(-45deg); }
.account-name { font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.account-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px 16px; font-size: 13px; }
.primary-nav { display: flex; gap: 34px; border-bottom: 1px solid var(--line); }
.nav-button { position: relative; padding: 15px 0 17px; border: 0; background: transparent; color: var(--muted); font-weight: 600; }
.nav-button.active { color: var(--ink); }
.nav-button.active::after { position: absolute; content: ""; height: 3px; inset: auto 0 -1px; background: var(--green); }
main { min-height: 65vh; }
.page-heading { display: flex; align-items: center; justify-content: space-between; gap: 28px; margin: 43px 0 30px; }
.page-heading p { margin-top: 10px; }
.page-actions { display: flex; gap: 10px; flex-shrink: 0; }
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 10px 17px; gap: 8px; border: 1px solid transparent; border-radius: 8px; font-weight: 600; text-decoration: none; white-space: nowrap; }
.button.primary { background: var(--green); color: white; }
.button.primary:hover:not(:disabled) { background: #0f513e; }
.button.secondary { color: var(--ink); background: var(--paper); border-color: #bacbda; }
.button.secondary:hover:not(:disabled) { border-color: var(--blue); background: #f8fafc; }
.button.small { min-height: 36px; padding: 5px 11px; font-size: 12px; border-radius: 6px; }
.text-button { padding: 7px 3px; border: 0; background: transparent; color: var(--blue); font-weight: 600; }
.text-button:hover:not(:disabled) { text-decoration: underline; text-underline-offset: 4px; }
.personal-summary { display: flex; align-items: center; justify-content: space-between; gap: 30px; padding: 25px 30px; margin-bottom: 35px; background: var(--paper); border-left: 4px solid var(--green); border-radius: 0 10px 10px 0; }
.personal-summary > div { display: grid; gap: 3px; }
.summary-label { font-size: 14px; font-weight: 600; }
.summary-amount { font-family: "Avenir Next", "Trebuchet MS", sans-serif; font-size: 40px; line-height: 1.3; letter-spacing: -.045em; font-variant-numeric: tabular-nums; }
.personal-summary .muted { font-size: 12px; }
.summary-breakdown { display: grid; gap: 10px; min-width: 180px; margin: 0; }
.summary-breakdown > div, .shared-totals > div { display: flex; justify-content: space-between; gap: 28px; }
dt { color: var(--muted); }
dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 13px; }
.privacy-note { color: var(--muted); font-size: 12px; }
.records-section { margin-top: 35px; }
.transaction-list { border-top: 1px solid var(--line); }
.transaction-row { display: grid; grid-template-columns: 96px minmax(0, 1fr) auto 90px; align-items: center; gap: 20px; padding: 20px 4px; border-bottom: 1px solid var(--line); }
.transaction-date { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.transaction-description { overflow-wrap: anywhere; }
.transaction-description strong { display: block; font-size: 15px; }
.transaction-meta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 4px; color: var(--muted); font-size: 12px; }
.transaction-amount { text-align: right; font-size: 17px; white-space: nowrap; font-family: "Avenir Next", "Trebuchet MS", sans-serif; font-variant-numeric: tabular-nums; }
.transaction-amount.refund { color: var(--green); }
.transaction-sharing { text-align: right; }
.status-pill { display: inline-flex; align-items: center; padding: 3px 8px; border-radius: 5px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.status-pill.shared { background: var(--green-wash); color: var(--green); }
.status-pill.overlap { background: var(--amber-wash); color: #77570a; }
.status-pill.matched { background: #edf2f7; color: var(--muted); }
.empty-state { text-align: center; padding: 55px 24px; border-top: 1px solid var(--line); }
.empty-state h3 { font-size: 19px; margin: 12px 0 8px; }
.empty-state p { color: var(--muted); font-size: 14px; max-width: 440px; margin-inline: auto; }
.empty-symbol { display: inline-grid; place-items: center; border: 1px solid #bdcddc; border-radius: 50%; width: 44px; height: 44px; font-size: 25px; color: var(--blue); }
.empty-state .text-button { margin-top: 15px; }
.entry-panel { background: var(--paper); border: 1px solid #bdcddc; border-radius: 12px; padding: 28px; margin: 22px 0 30px; }
.entry-panel > p { font-size: 13px; margin-bottom: 23px; }
form { margin: 0; }
.field, .source-field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.field > label, .source-field > label, .file-picker > label, .amount-field > label { display: block; font-size: 13px; font-weight: 600; }
input:not([type="checkbox"]), select { width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid #a8bbce; background: white; border-radius: 6px; color: var(--ink); }
input::placeholder { color: #728398; }
input[type="checkbox"] { width: 19px; height: 19px; margin: 0; accent-color: var(--green); cursor: pointer; flex-shrink: 0; }
input[type="file"] { padding: 8px; font-size: 13px; }
input[type="file"]::file-selector-button { font: inherit; border: 0; background: #eaf0f6; color: var(--ink); padding: 6px 10px; border-radius: 4px; margin-right: 10px; cursor: pointer; }
.amount-field { max-width: 330px; margin-bottom: 24px; }
.amount-input { display: flex; align-items: center; gap: 12px; margin-top: 7px; border-bottom: 2px solid var(--ink); }
.amount-input > span { font-size: 26px; color: var(--muted); }
.amount-input > input { border: 0; border-radius: 0; padding: 4px 0; font-size: 35px; font-family: "Avenir Next", "Trebuchet MS", sans-serif; font-variant-numeric: tabular-nums; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.source-picker-row { display: flex; gap: 10px; align-items: center; }
.source-picker-row > select { min-width: 0; flex: 1; }
.source-add { display: grid; gap: 8px; padding: 12px; margin-top: 4px; background: #f3f6fa; border-radius: 7px; font-size: 12px; }
.source-add .button { justify-self: start; min-height: 36px; padding: 6px 10px; }
.optional-fields { margin-top: 23px; }
.optional-fields > summary { color: var(--blue); font-size: 13px; font-weight: 600; }
.optional-fields .form-grid { margin-top: 14px; }
.form-actions { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-top: 24px; }
.form-error { padding: 14px 16px; background: #fff1f2; color: #8e2432; border-left: 3px solid var(--error); border-radius: 0 5px 5px 0; margin-top: 18px; font-size: 13px; overflow-wrap: anywhere; }
.form-error p + p, .form-error a { margin-top: 8px; }
.form-error a { display: inline-block; color: #792438; }
.success-message { margin-top: 18px; color: var(--green); padding: 13px 15px; background: var(--green-wash); border-radius: 5px; font-size: 13px; }
.import-controls { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) auto; gap: 18px; align-items: end; }
.file-picker { display: grid; gap: 7px; }
.file-picker .small-text { overflow-wrap: anywhere; }
.preview-heading { display: flex; justify-content: space-between; gap: 15px; align-items: center; margin-top: 28px; margin-bottom: 7px; }
.preview-heading > span { font-size: 12px; color: var(--muted); }
.preview-scroll { max-height: 420px; overflow: auto; margin-top: 15px; border: 1px solid var(--line); border-radius: 6px; }
.preview-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.preview-table th { position: sticky; top: 0; background: #edf2f7; font-weight: 600; color: var(--muted); text-align: left; padding: 10px 12px; z-index: 1; }
.preview-table td { padding: 12px; border-top: 1px solid var(--line); }
.preview-table td > strong, .preview-table td > span { display: block; }
.preview-table .preview-money { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.preview-table td:first-child { width: 55px; text-align: center; }
.preview-table th:nth-child(3) { text-align: right; }
.reconciliation-choice { min-width: 220px; max-width: 360px; }
.reconciliation-choice label { display: block; margin-bottom: 6px; font-weight: 600; }
.reconciliation-choice select { font-size: 12px; }
.reconciliation-choice p { margin: 6px 0 0; }
.duplicate-confirmation { display: flex; gap: 10px; align-items: start; padding: 14px; background: var(--amber-wash); color: #715109; margin-top: 15px; border-radius: 5px; font-size: 13px; }
.duplicate-confirmation input { margin-top: 2px; }
.notice { padding: 10px 13px; background: var(--amber-wash); font-size: 13px; margin-top: 14px; }
.group-picker { min-width: 170px; }
.group-picker label { font-size: 12px; color: var(--muted); }
.group-title { margin: 20px 0 15px; font-size: 17px; }
.settlement-panel { background: var(--paper); border: 1px solid var(--line); border-top: 4px solid var(--green); border-radius: 0 0 10px 10px; padding: 28px 30px; }
.settlement-panel h3 { font-size: 13px; font-weight: 600; margin-bottom: 18px; }
.settlement-panel > .muted { margin-top: 18px; font-size: 12px; }
.settlement-row { display: flex; justify-content: space-between; align-items: baseline; gap: 20px; }
.settlement-row + .settlement-row { border-top: 1px solid var(--line); padding-top: 18px; margin-top: 18px; }
.settlement-parties { display: flex; gap: 9px; flex-wrap: wrap; align-items: baseline; font-size: 18px; }
.settlement-parties > span { font-size: 13px; color: var(--muted); }
.settlement-amount { font-family: "Avenir Next", "Trebuchet MS", sans-serif; font-size: 35px; letter-spacing: -.035em; white-space: nowrap; font-variant-numeric: tabular-nums; }
.settlement-clear { font-size: 24px; font-weight: 600; }
.shared-totals { display: flex; gap: 40px; padding: 20px 4px; margin: 0; font-size: 13px; }
.shared-details { margin-top: 15px; border-top: 1px solid var(--line); }
.shared-details > summary { font-size: 14px; font-weight: 600; padding: 20px 2px; }
.shared-details .transaction-list { border-top: 0; }
.shared-expense-row { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 20px; padding: 18px 4px; border-top: 1px solid var(--line); }
.shared-expense-row > div { display: grid; gap: 3px; }
.shared-expense-row strong { overflow-wrap: anywhere; }
.split-detail { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.empty-detail { padding: 10px 2px 25px; color: var(--muted); font-size: 13px; }
.share-dialog { width: min(560px, calc(100% - 32px)); max-height: calc(100dvh - 40px); padding: 28px; border: 1px solid var(--line); border-radius: 14px; color: var(--ink); background: white; overflow: auto; }
.share-dialog::backdrop { background: rgb(21 43 70 / 38%); }
.share-dialog .section-heading h2 { font-size: 20px; }
.share-dialog > p { margin-bottom: 20px; font-size: 13px; }
.share-dialog .field { margin-bottom: 20px; }
.share-record { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 16px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.share-record > div { display: grid; gap: 4px; overflow-wrap: anywhere; }
.share-record-amount { font-size: 24px; font-family: "Avenir Next", "Trebuchet MS", sans-serif; white-space: nowrap; }
.split-fields { padding: 0; margin: 0; border: 0; }
.split-fields > legend { font-size: 13px; font-weight: 600; margin-bottom: 12px; }
.split-member { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 9px 0; }
.split-member label { font-size: 14px; }
.percent-input { display: flex; align-items: center; gap: 9px; }
.percent-input input { width: 85px; text-align: right; font-variant-numeric: tabular-nums; }
.split-total { display: flex; justify-content: space-between; border-top: 1px solid var(--line); margin-top: 10px; padding-top: 12px; color: var(--green); }
.split-total.invalid { color: var(--error); }
.share-dialog .form-actions { justify-content: flex-end; }
.error-panel { margin: 30px 0; padding: 22px; border: 1px solid #e7c4ca; border-radius: 8px; background: white; }
.error-panel h2 { font-size: 18px; }
.error-panel p { margin: 10px 0 20px; color: var(--muted); }
.loading-panel { padding: 60px 0; color: var(--muted); }
.app-footer { display: flex; align-items: baseline; justify-content: space-between; gap: 20px; padding: 35px 0; margin-top: 45px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.qa-switcher { font-size: 12px; }
.qa-switcher a { display: block; margin-top: 7px; }
.boot { width: min(600px, calc(100% - 48px)); margin: 18vh auto; min-height: auto; }
.boot strong { font-size: 25px; }
.boot p { margin-top: 12px; color: var(--muted); }
.boot button { margin-top: 16px; border: 1px solid var(--line); padding: 10px 15px; border-radius: 6px; color: var(--ink); background: white; }
@media (max-width: 900px) {
  .app-shell { width: calc(100% - 48px); }
  .page-heading { align-items: flex-start; flex-direction: column; gap: 20px; }
  .page-actions { width: 100%; }
  .page-actions .button { flex: 1; }
  .import-controls { grid-template-columns: 1fr 1.3fr; }
  .import-controls > .button { grid-column: 1 / -1; justify-self: start; }
  .transaction-row { grid-template-columns: 80px minmax(0,1fr) auto 82px; gap: 12px; }
}
@media (max-width: 600px) {
  body { font-size: 14px; }
  .app-shell { width: calc(100% - 36px); }
  .app-header { padding: 21px 0 15px; }
  .brand { font-size: 21px; }
  .brand-mark { font-size: 30px; }
  .account-name { font-size: 11px; max-width: 40%; text-align: right; }
  .primary-nav { gap: 26px; }
  .nav-button { padding-top: 14px; font-size: 13px; }
  .page-heading { margin-top: 29px; margin-bottom: 24px; }
  .page-heading p { font-size: 12px; }
  .page-actions { gap: 8px; }
  .page-actions .button { padding-inline: 10px; font-size: 12px; }
  .personal-summary { display: block; padding: 20px; margin-bottom: 27px; }
  .summary-amount { font-size: 37px; }
  .summary-breakdown { display: flex; gap: 24px; padding-top: 18px; margin-top: 16px; border-top: 1px solid var(--line); min-width: 0; font-size: 12px; }
  .summary-breakdown > div { gap: 9px; }
  .section-heading { align-items: flex-start; gap: 12px; }
  .section-heading h2 { font-size: 18px; }
  .records-section > .section-heading { flex-direction: column; gap: 5px; }
  .transaction-row { grid-template-columns: minmax(0,1fr) auto; column-gap: 13px; row-gap: 6px; padding: 16px 0; }
  .transaction-date { grid-column: 1; font-size: 11px; }
  .transaction-description { grid-column: 1; grid-row: 2; }
  .transaction-description strong { font-size: 14px; }
  .transaction-meta { gap: 9px; font-size: 11px; }
  .transaction-amount { grid-column: 2; grid-row: 2; font-size: 18px; align-self: start; }
  .transaction-sharing { grid-column: 2; grid-row: 1; }
  .transaction-sharing .button { min-height: 32px; padding: 4px 9px; font-size: 11px; }
  .entry-panel { padding: 20px 16px; border-radius: 9px; margin-inline: -1px; }
  .entry-panel > p { font-size: 12px; }
  .form-grid, .import-controls { grid-template-columns: 1fr; gap: 17px; }
  .import-controls > .button { justify-self: stretch; }
  .form-actions { flex-direction: column; align-items: stretch; gap: 12px; }
  .form-actions > .button { width: 100%; white-space: normal; }
  .amount-field { max-width: 100%; }
  .preview-heading { align-items: flex-start; flex-direction: column; gap: 3px; }
  .preview-table th, .preview-table td { padding: 10px 8px; font-size: 11px; }
  .preview-table td:first-child { width: 36px; }
  .preview-table th:last-child, .preview-table td:last-child { min-width: 90px; }
  .preview-table td:nth-child(2) { min-width: 130px; }
  .settlement-panel { padding: 22px 20px; }
  .settlement-row { flex-direction: column; gap: 9px; }
  .settlement-parties { font-size: 16px; }
  .settlement-amount { font-size: 35px; }
  .settlement-clear { font-size: 19px; }
  .shared-totals { flex-direction: column; gap: 10px; padding: 20px 2px; }
  .shared-expense-row { gap: 12px; }
  .shared-expense-row .transaction-amount { grid-column: 2; grid-row: 1; align-self: center; font-size: 16px; }
  .share-dialog { padding: 22px 18px; max-height: calc(100dvh - 24px); }
  .share-record-amount { font-size: 22px; }
  .share-record > div strong { font-size: 14px; }
  .empty-state { padding: 40px 10px; }
  .empty-state p { font-size: 12px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; } }
