:root {
  color-scheme: light;
  --ink: #172c2b;
  --muted: #546766;
  --paper: #f3f6f3;
  --white: #fff;
  --line: #dce5e0;
  --side: #142526;
  --green: #096453;
  --green-dark: #06493d;
  --green-light: #e6f4ed;
  --amber: #79521a;
  --amber-bg: #fff3d6;
  --radius: 15px;
  font-family: "Aptos", "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; line-height: 1.45; }
a { color: var(--green); font-weight: 620; text-underline-offset: 3px; }
a:hover { color: var(--green-dark); }
button, input, select { font: inherit; }
button, select, summary { cursor: pointer; }
:focus-visible { outline: 2px solid #008c75; outline-offset: 3px; }
h1, h2, h3, p, ul { margin-top: 0; }
h1 { font-size: clamp(2rem, 4vw, 3rem); font-weight: 650; line-height: 1.08; letter-spacing: -.055em; margin-bottom: 8px; overflow-wrap: anywhere; }
h2 { font-size: 1.17rem; line-height: 1.25; letter-spacing: -.02em; margin-bottom: 0; }
h3 { font-size: 1rem; margin-bottom: 3px; line-height: 1.3; }
p { margin-bottom: 12px; }
small { font-size: .8em; }
:target { scroll-margin-top: 24px; }

.workspace { display: grid; grid-template-columns: 222px minmax(0, 1fr); }
.side { background: var(--side); color: #f2faf5; padding: 32px 17px 24px; display: flex; flex-direction: column; position: sticky; top: 0; height: 100dvh; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-size: 1.29rem; line-height: 1; font-weight: 680; letter-spacing: -.035em; color: inherit; width: fit-content; }
.side .brand { margin: 4px 0 41px 10px; }
.side .brand:hover { color: white; }
.mark { width: 34px; height: 34px; border-radius: 10px; background: #a9e3c4; display: flex; align-items: flex-end; justify-content: center; padding: 9px 7px; gap: 3px; }
.mark i { width: 3px; border-radius: 2px; height: 8px; background: #123c32; }
.mark i:nth-child(2) { height: 12px; }
.mark i:nth-child(3) { height: 16px; }
.nav { display: grid; gap: 5px; }
.nav a, .signout button { display: flex; gap: 12px; align-items: center; min-height: 45px; padding: 0 12px; color: #b8ccc7; border-radius: 8px; text-decoration: none; font-weight: 550; font-size: .92rem; }
.nav a:hover, .nav a[aria-current="page"], .signout button:hover { background: #28413d; color: #f6fff8; }
.nav a[aria-current="page"] .nav-icon { color: #b7efd0; }
.signout { margin-top: auto; border-top: 1px solid #324846; padding-top: 14px; }
.signout button { background: transparent; border: 0; width: 100%; text-align: left; }
.nav-icon { display: inline-block; width: 17px; height: 17px; flex: 0 0 17px; position: relative; color: currentColor; }
.icon-overview { border: 1.5px solid currentColor; border-radius: 4px; }
.icon-overview::before { content: ""; position: absolute; top: 5px; left: 0; width: 100%; height: 1.5px; background: currentColor; }
.icon-overview::after { content: ""; position: absolute; left: 5px; bottom: 0; width: 1.5px; height: 9px; background: currentColor; }
.icon-transactions::before { content: ""; position: absolute; top: 3px; left: 2px; width: 13px; height: 1.5px; background: currentColor; box-shadow: 0 5px currentColor, 0 10px currentColor; }
.icon-imports { border: 1.5px solid currentColor; border-top: 0; border-radius: 0 0 4px 4px; height: 11px; margin-top: 4px; }
.icon-imports::before { content: ""; position: absolute; left: 6px; top: -5px; background: currentColor; width: 1.5px; height: 10px; }
.icon-imports::after { content: ""; position: absolute; left: 4px; top: 1px; width: 5px; height: 5px; border-right: 1.5px solid; border-bottom: 1.5px solid; transform: rotate(45deg); }
.icon-review { border: 1.5px solid currentColor; border-radius: 50%; }
.icon-review::before { content: ""; position: absolute; top: 3px; left: 6px; width: 1.5px; height: 6px; background: currentColor; }
.icon-review::after { content: ""; position: absolute; top: 8px; left: 6px; width: 4px; height: 1.5px; background: currentColor; }
.icon-signout { border: 1.5px solid currentColor; border-right: 0; width: 12px; flex-basis: 17px; border-radius: 3px 0 0 3px; }
.icon-signout::before { content: ""; position: absolute; width: 10px; height: 1.5px; top: 6px; right: 0; background: currentColor; }
.icon-signout::after { content: ""; position: absolute; right: 1px; top: 4px; width: 5px; height: 5px; border-right: 1.5px solid; border-top: 1.5px solid; transform: rotate(45deg); }
.skip { position: absolute; inset: 8px auto auto 8px; transform: translateY(-150%); z-index: 4; padding: 8px; background: white; }
.skip:focus { transform: none; }

.content { width: min(100%, 1440px); margin-inline: auto; padding: 42px clamp(20px, 3.4vw, 52px) 48px; min-width: 0; }
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 18px; margin-bottom: 27px; }
.page-meta { display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: .91rem; }
.dot { width: 7px; height: 7px; background: #8d9a93; border-radius: 50%; display: inline-block; }
.dot.online { background: #27856b; }
.button { appearance: none; display: inline-flex; align-items: center; justify-content: center; min-height: 42px; padding: 8px 15px; text-align: center; color: var(--ink); background: var(--white); border: 1px solid var(--line); border-radius: 8px; font-size: .9rem; font-weight: 650; line-height: 1.2; text-decoration: none; white-space: nowrap; }
.button.primary { background: var(--green); color: white; border-color: var(--green); }
.button.primary:hover { background: var(--green-dark); color: white; border-color: var(--green-dark); }
.button.subtle:hover { background: #edf5ef; border-color: #a9c7b8; color: var(--ink); }
.button:disabled { opacity: .55; cursor: wait; }
.button.mini { min-height: 32px; padding: 5px 10px; font-size: .8rem; }
.text-button { color: var(--muted); background: transparent; border: 0; padding: 8px 3px; font-weight: 550; text-decoration: underline; text-underline-offset: 3px; }
.button-row { display: flex; align-items: center; gap: 8px 11px; flex-wrap: wrap; }
.filters { display: flex; align-items: end; gap: 10px; flex-wrap: wrap; margin-bottom: 22px; }
.filters.compact { margin-bottom: 16px; }
.filters .search { min-width: min(235px, 100%); }
.control { display: grid; min-width: 0; gap: 5px; font-size: .9rem; font-weight: 610; }
.control small { color: var(--muted); font-size: .8em; font-weight: 450; }
.control input:not([type=checkbox]), .control select { border: 1px solid #cddbd3; border-radius: 8px; background: white; color: var(--ink); padding: 8px 11px; min-height: 42px; width: 100%; min-width: 0; font-weight: 450; }
.control select { appearance: none; padding-right: 30px; background-image: linear-gradient(45deg, transparent 50%, #45645b 50%), linear-gradient(135deg, #45645b 50%, transparent 50%); background-position: calc(100% - 15px) 52%, calc(100% - 11px) 52%; background-size: 4px 5px; background-repeat: no-repeat; }
.control input[type="file"] { padding: 9px; font-size: .87rem; }
.control input::file-selector-button { border: 0; border-radius: 5px; color: var(--green-dark); background: var(--green-light); padding: 3px 8px; margin-right: 9px; font: inherit; font-weight: 630; cursor: pointer; }

.metrics { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 14px; margin-bottom: 18px; }
.metric { min-width: 0; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 21px 21px 19px; }
.metric-main { background: #e6f4ec; border-color: #c7e5d5; }
.metric p { color: #2e5148; font-weight: 650; font-size: .92rem; margin-bottom: 8px; }
.metric strong, .detail-total { font-size: clamp(1.5rem, 2.8vw, 2.58rem); font-variant-numeric: tabular-nums; font-weight: 640; letter-spacing: -.07em; line-height: 1.15; display: block; overflow-wrap: anywhere; margin-bottom: 7px; }
.metric strong small, .detail-total small { font-size: .4em; color: #415f57; font-weight: 680; letter-spacing: .02em; }
.metric span, .metric a { font-size: .85rem; }
.metric span { color: var(--muted); }
.overview-grid { display: grid; grid-template-columns: minmax(245px, 1fr) minmax(0, 2.25fr); align-items: start; gap: 16px; }
.panel { min-width: 0; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); }
.padded { padding: 23px; }
.panel-head { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 21px 22px 15px; }
.panel-head.unpadded { padding: 0 0 12px; }
.panel-head a, .panel-head .muted { flex: 0 0 auto; font-size: .86rem; }
.muted, .td-secondary { color: var(--muted); }
.nums { font-variant-numeric: tabular-nums; white-space: nowrap; }
.align-right { text-align: right; }
.credit { color: var(--green); }
.caution { color: var(--amber); }
.category-bars { padding: 1px 22px 22px; margin: 0; list-style: none; display: grid; gap: 16px; }
.category-bars li > div { display: flex; justify-content: space-between; gap: 10px; align-items: center; font-size: .9rem; }
.category-bars a { color: var(--ink); text-decoration: none; font-weight: 620; }
.category-bars a:hover { text-decoration: underline; }
.category-bars progress { appearance: none; display: block; width: 100%; height: 8px; margin-top: 7px; border: 0; border-radius: 9px; background: #e7eeea; overflow: hidden; color: #399779; }
.category-bars progress::-webkit-progress-bar { background: #e7eeea; border-radius: 9px; }
.category-bars progress::-webkit-progress-value { background: #399779; border-radius: 9px; }
.category-bars progress::-moz-progress-bar { background: #399779; border-radius: 9px; }

.table-scroller { overflow-x: auto; }
.transactions-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.transactions-table th, .transactions-table td { padding: 12px 12px; text-align: left; vertical-align: middle; }
.transactions-table th:first-child, .transactions-table td:first-child { padding-left: 22px; }
.transactions-table th:last-child, .transactions-table td:last-child { padding-right: 22px; text-align: right; }
.transactions-table th { font-size: .78rem; font-weight: 690; color: #415c55; background: #f7faf8; white-space: nowrap; border-top: 1px solid #e7eeea; border-bottom: 1px solid #e7eeea; }
.transactions-table td { border-bottom: 1px solid #e7eeea; }
.transactions-table tr:last-child td { border-bottom: 0; }
.transactions-table .merchant { color: var(--ink); font-weight: 660; text-decoration: none; overflow-wrap: anywhere; }
.transactions-table .merchant:hover { color: var(--green); text-decoration: underline; }
.td-secondary { display: block; font-size: .77rem; margin-top: 3px; }
.mobile-transaction-meta { display: none; }
.row-date { white-space: nowrap; color: #3d5551; }
.amount-unit { display: block; font-size: .7rem; color: var(--muted); font-weight: 600; }
.pill { display: inline-flex; align-items: center; font-size: .75rem; padding: 4px 8px; min-height: 25px; font-weight: 670; border-radius: 20px; line-height: 1; white-space: nowrap; }
.pill.neutral { color: #4c5f5b; background: #edf3ef; }
.pill.positive { color: #125c49; background: #e4f3e9; }
.pill.warning { color: var(--amber); background: var(--amber-bg); }
.empty { display: grid; justify-items: center; text-align: center; padding: 49px 18px; }
.empty.empty-small { padding: 29px 18px 34px; }
.empty p { color: var(--muted); margin: 6px 0 13px; }
.empty.empty-small p { margin-bottom: 0; }
.empty .empty-icon { color: var(--green); margin-bottom: 13px; }

.import-grid, .detail-grid { display: grid; align-items: start; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; margin-bottom: 18px; }
.detail-grid { grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); }
.upload-panel h2 { margin-bottom: 10px; }
.email-address { margin-bottom: 4px; overflow-wrap: anywhere; font-weight: 650; }
.stack { display: grid; gap: 13px; justify-items: start; }
.stack > .control, .stack > .setup, .stack > fieldset { width: 100%; min-width: 0; }
.stack > .button { margin-top: 1px; }
.setup { border-top: 1px solid var(--line); margin-top: 15px; padding-top: 11px; }
.setup summary { font-size: .92rem; font-weight: 640; color: var(--ink); }
.setup[open] summary { margin-bottom: 12px; }
.steps { margin: 0 0 15px; padding-left: 20px; color: var(--muted); font-size: .9rem; }
.steps li + li { margin-top: 7px; }
.copy-line { display: flex; align-items: center; flex-wrap: wrap; gap: 5px; margin: 7px 0 2px; }
.copy-line code { color: var(--ink); background: #eef5f1; font-size: .79rem; padding: 5px 7px; border-radius: 5px; overflow-wrap: anywhere; max-width: 100%; }
.import-options { width: 100%; display: grid; gap: 11px; }
.upload-panel .setup .import-options { margin-bottom: 11px; }
.source-setup { max-width: 520px; margin: 11px 0; }
.statement-panel .panel-head { padding-bottom: 18px; }
.statements { list-style: none; padding: 0; margin: 0; }
.statements > li { border-top: 1px solid var(--line); padding: 16px 22px; }
.statement-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.statement-identity { display: flex; align-items: flex-start; gap: 12px; min-width: 0; color: var(--green); }
.statement-identity h3 { color: var(--ink); overflow-wrap: anywhere; }
.statement-identity p, .statement-note { color: var(--muted); font-size: .87rem; margin-bottom: 0; }
.statement-note { margin-top: 8px; }
.statement-stats { color: var(--muted); display: flex; gap: 6px 15px; flex-wrap: wrap; margin-top: 10px; font-size: .85rem; }
.statement-mail { display: inline-block; margin-top: 8px; font-size: .84rem; }
.sync-progress { padding: 10px 12px; margin: 10px 0 0; border-radius: 6px; background: var(--green-light); color: var(--green-dark); font-size: .87rem; }

.back-link { display: inline-block; margin: 0 0 13px; font-size: .89rem; }
.detail-total { flex: 0 0 auto; }
.detail-grid h2 { margin-bottom: 13px; }
.detail-grid .panel-head h2 { margin-bottom: 0; }
.checkbox, .candidate { display: flex; align-items: flex-start; gap: 9px; font-size: .9rem; }
input[type="radio"], input[type="checkbox"] { accent-color: var(--green); inline-size: 17px; block-size: 17px; margin: 2px 0 0; flex-shrink: 0; }
.evidence { list-style: none; padding: 0; display: grid; margin: 0; }
.evidence li { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 0; border-top: 1px solid var(--line); align-items: flex-start; }
.evidence li div { flex: 1 1 160px; min-width: 0; overflow-wrap: anywhere; }
.evidence li strong { display: block; font-size: .9rem; }
.evidence li small { color: var(--muted); }
.evidence li a { font-size: .85rem; }
.review-hint { color: var(--muted); margin-bottom: 17px; }
.review-list { display: grid; gap: 13px; }
.review-header { display: flex; justify-content: space-between; gap: 11px; margin-bottom: 14px; }
.review-header p { margin: 4px 0 0; font-size: .9rem; }
.review-header h2 a { color: var(--ink); text-decoration: none; overflow-wrap: anywhere; }
.review-header h2 a:hover { text-decoration: underline; }
.candidates { border: 0; padding: 0; margin: 0; }
.candidates legend { font-weight: 640; margin-bottom: 6px; }
.candidate { padding: 11px 10px; background: #f6f9f7; border: 1px solid #ebf0ed; border-radius: 7px; margin-bottom: 6px; cursor: pointer; }
.candidate input + span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.candidate small { display: block; color: var(--muted); }
.pagination { margin-top: 16px; display: flex; align-items: center; justify-content: center; gap: 12px; color: var(--muted); }
.notice { padding: 12px 15px; border-radius: 9px; margin-bottom: 15px; font-size: .91rem; color: var(--green-dark); background: var(--green-light); }
.notice.error, .form-error { color: #842d20; background: #fff0eb; border-radius: 8px; padding: 10px 12px; }
.notice.warning { color: var(--amber); background: var(--amber-bg); }
.entry-content { width: min(100%, 475px); padding: 25px; margin: min(15vh, 140px) auto 0; }
.auth-brand { margin: 0 0 20px; }
.auth-panel, .error-panel { padding: clamp(20px, 5vw, 32px); }
.auth-panel h1 { font-size: 2.2rem; }
.auth-panel .stack { margin-top: 21px; }
.auth-panel .button { width: 100%; }
.error-panel { max-width: 600px; }

@media (max-width: 1180px) {
  .overview-grid { grid-template-columns: minmax(225px, .9fr) minmax(0, 2fr); }
  .overview-grid .transactions-table th, .overview-grid .transactions-table td { padding-inline: 9px; }
  .overview-grid .transactions-table th:first-child, .overview-grid .transactions-table td:first-child { padding-left: 16px; }
  .overview-grid .transactions-table th:last-child, .overview-grid .transactions-table td:last-child { padding-right: 16px; }
}
@media (max-width: 1050px) {
  .workspace { grid-template-columns: 180px minmax(0, 1fr); }
  .side { padding-inline: 12px; }
  .overview-grid { grid-template-columns: 1fr; }
  .category-bars { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 24px; }
}
@media (max-width: 740px) {
  .workspace { display: block; }
  .side { position: static; height: auto; padding: 15px 17px 9px; display: grid; grid-template-columns: 1fr auto; gap: 10px; }
  .side .brand { margin: 0; font-size: 1.19rem; }
  .side .mark { width: 31px; height: 31px; }
  .nav { grid-column: 1 / -1; grid-row: 2; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; }
  .nav a { min-height: 36px; padding: 5px 3px; gap: 5px; font-size: .8rem; justify-content: center; }
  .nav a .nav-icon { display: none; }
  .signout { grid-column: 2; grid-row: 1; margin: 0; padding: 0; border: 0; }
  .signout button { gap: 7px; min-height: 33px; padding-inline: 6px; font-size: .82rem; }
  .content { padding: 25px 16px 32px; }
  .page-head { gap: 10px; margin-bottom: 19px; }
  .page-head > .button { white-space: normal; min-height: 38px; padding: 7px 10px; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .metric-main { grid-column: 1 / -1; }
  .metric { padding: 14px; border-radius: 11px; }
  .metric strong { font-size: clamp(1.23rem, 6.1vw, 1.6rem); }
  .metric-main strong { font-size: 2rem; }
  .metric p { font-size: .81rem; }
  .metric span, .metric a { font-size: .75rem; }
  .metric strong small { display: block; margin-top: 3px; }
  .metric-main strong small { display: inline; }
  .import-grid, .detail-grid { grid-template-columns: 1fr; }
  .padded { padding: 18px; }
  .transactions-table th, .transactions-table td { padding-inline: 9px; }
  .transactions-table th:first-child, .transactions-table td:first-child { padding-left: 14px; }
  .transactions-table th:last-child, .transactions-table td:last-child { padding-right: 14px; }
  .transactions-table .merchant { display: block; min-width: 86px; }
}
@media (max-width: 430px) {
  .category-bars { grid-template-columns: 1fr; }
  .transactions-table :is(.col-date, .col-category, .col-source) { display: none; }
  .mobile-transaction-meta { display: block; color: var(--muted); font-size: .77rem; margin-top: 2px; }
  .panel-head { padding-inline: 16px; }
  .statement-head { flex-wrap: wrap; gap: 7px; }
  .statements > li { padding-inline: 16px; }
  .detail-total { font-size: 1.35rem; }
  .candidate { flex-wrap: wrap; }
  .candidate .align-right { margin-left: 26px; }
}
