/* SOFT brand direction, 11 October 2026: midnight navy, cyan and amber,
   condensed display headings and readable system-font financial evidence. */
:root {
  color-scheme: dark;
  --canvas: #040b25;
  --surface: #0b1733;
  --ink: #f4f7ff;
  --muted: #b3c1d9;
  --accent: #4fc9ef;
  --soft: #13354d;
  --border: #2c3b58;
  --warning: #ffd176;
  --error: #ff8c9c;
  --surface-raised: #28334d;
  --rail: #030a20;
  --on-accent: #041326;
  --accent-hover: #82ddf8;
  --body-font: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --display-font: Impact, "Arial Narrow", "Helvetica Neue Condensed", sans-serif;
  font-family: var(--body-font);
  font-size: 15px;
  color: var(--ink);
  background: var(--canvas);
  line-height: 1.5;
  font-synthesis: none;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
button,
input,
select,
textarea {
  font: inherit;
}
button,
select,
input,
textarea {
  min-height: 44px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
}
button {
  padding: 9px 15px;
  cursor: pointer;
  font-weight: 550;
}
button:hover {
  background: var(--soft);
}
button:disabled {
  opacity: 0.45;
  cursor: default;
}
input,
select,
textarea {
  padding: 9px 12px;
  max-width: 100%;
}
input[type="checkbox"] {
  min-height: 18px;
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid #4fc9ef;
  outline-offset: 3px;
}
a {
  color: var(--accent);
}
h1,
h2,
h3,
p {
  margin: 0;
}
h1 {
  font-size: 38px;
  letter-spacing: -1.25px;
  line-height: 1.15;
}
h2 {
  font-size: 20px;
  letter-spacing: -0.4px;
  line-height: 1.3;
}
h3 {
  font-size: 16px;
  line-height: 1.4;
}
p + p {
  margin-top: 10px;
}
small,
.small {
  font-size: 12px;
  color: var(--muted);
}
.muted,
.section-copy {
  color: var(--muted);
}
.section-copy {
  font-size: 14px;
  margin-top: 7px;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}
.skip-link {
  position: fixed;
  top: -100px;
  left: 20px;
  background: var(--surface);
  padding: 12px;
  z-index: 30;
}
.skip-link:focus {
  top: 10px;
}
[hidden] {
  display: none !important;
}
.site-header {
  min-height: 88px;
  background: var(--rail);
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 16px 36px;
  border-bottom: 1px solid var(--border);
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 0;
  padding: 0;
  background: transparent;
  text-align: left;
  white-space: nowrap;
}
.brand svg {
  width: 29px;
  height: 36px;
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
}
.brand span {
  font-weight: 750;
  font-size: 25px;
  letter-spacing: -1px;
  line-height: 1;
}
.brand small {
  display: block;
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0;
  margin-top: 6px;
}
.main-nav {
  display: flex;
  align-self: stretch;
  align-items: center;
  gap: 12px;
  margin: auto;
}
.main-nav button {
  border: 0;
  border-bottom: 3px solid transparent;
  border-radius: 0;
  background: transparent;
  padding: 10px 12px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 7px;
}
.main-nav svg {
  display: none;
}
.main-nav button[aria-current="page"] {
  color: var(--accent);
  border-color: var(--accent);
}
.header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}
.header-actions > button:not(.primary) {
  border: 0;
  background: transparent;
  font-size: 13px;
}
.header-actions span#reviewCount {
  font-size: 12px;
  margin-left: 4px;
  background: var(--soft);
  padding: 2px 6px;
  border-radius: 4px;
}
.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}
.primary:hover {
  background: #82ddf8;
}
.danger {
  color: var(--error);
}
.text-button {
  padding: 4px 0;
  border: 0;
  background: transparent;
  min-height: 32px;
  color: var(--accent);
  font-size: 13px;
}
.text-button:hover {
  text-decoration: underline;
  background: transparent;
}
.icon-button {
  font-size: 24px;
  min-width: 44px;
  padding: 0;
  border: 0;
}
.mobile-text {
  display: none;
}
main {
  max-width: 1420px;
  padding: 24px 36px 0;
  margin: auto;
  min-height: calc(100vh - 88px);
}
.context-bar {
  display: flex;
  gap: 20px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
}
.account-control {
  max-width: 390px;
  min-width: 220px;
  flex: 1;
}
.account-control select {
  width: 100%;
  text-overflow: ellipsis;
}
.segmented {
  display: flex;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  width: max-content;
  flex-wrap: wrap;
  background: var(--surface);
}
.segmented button {
  border: 0;
  border-radius: 0;
  min-height: 40px;
  color: var(--muted);
  padding: 8px 18px;
}
.segmented button[aria-pressed="true"] {
  background: var(--soft);
  color: var(--accent);
}
.period-picker {
  display: flex;
  align-items: center;
  max-width: 330px;
}
.period-picker button {
  border-radius: 0;
  min-width: 44px;
  font-size: 22px;
}
.period-picker button:first-child {
  border-radius: 6px 0 0 6px;
}
.period-picker button:last-child {
  border-radius: 0 6px 6px 0;
}
.period-picker select {
  border-left: 0;
  border-right: 0;
  border-radius: 0;
  width: 180px;
  text-align: center;
}
.date-range {
  display: flex;
  gap: 8px;
  align-items: end;
}
.date-range label {
  font-size: 12px;
  display: grid;
}
.page-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}
.page-heading p {
  margin-top: 8px;
  color: var(--muted);
  font-size: 14px;
}
.metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin: 0 0 24px;
}
.metric {
  min-width: 0;
  padding: 18px 22px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
}
.metric span {
  display: block;
  font-size: 14px;
  color: var(--ink);
}
.metric strong {
  font-size: clamp(25px, 2.7vw, 36px);
  line-height: 1.25;
  letter-spacing: -1px;
  display: block;
  margin: 8px 0 0;
  color: var(--accent);
  font-weight: 600;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.metric.positive strong {
  color: var(--accent);
}
.metric small {
  display: block;
  margin-top: 7px;
}
.split {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  gap: 20px;
  margin-bottom: 20px;
}
.split.equal {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 22px;
  min-width: 0;
  margin-bottom: 20px;
}
.split > .panel {
  margin-bottom: 0;
}
.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 16px;
}
.panel > h2,
.panel > h3 {
  margin-bottom: 12px;
}
.panel .panel {
  border: 0;
  padding: 0;
}
.list {
  display: grid;
}
.list-row {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  padding: 16px 0;
  display: flex;
  gap: 16px;
  align-items: center;
  text-align: left;
  background: transparent;
  min-width: 0;
}
.list-row:last-child {
  border-bottom: 0;
}
.list-row > div:first-child {
  flex: 1;
  min-width: 0;
}
.list-row strong {
  display: block;
  font-size: 14px;
  font-weight: 600;
  overflow-wrap: anywhere;
}
.list-row small {
  display: block;
  margin-top: 4px;
  font-weight: 400;
}
.amount {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  font-weight: 550;
}
.chevron {
  color: var(--muted);
  margin-left: 6px;
}
.category-row {
  display: grid;
  grid-template-columns: minmax(100px, 1fr) minmax(40px, 1fr) auto;
  gap: 15px;
  align-items: center;
}
.category-row progress {
  width: 100%;
  height: 8px;
  border: 0;
  border-radius: 4px;
  overflow: hidden;
  background: #24334d;
}
.category-row progress::-webkit-progress-bar {
  background: #24334d;
}
.category-row progress::-webkit-progress-value {
  background: var(--accent);
  border-radius: 4px;
}
.category-row progress::-moz-progress-bar {
  background: var(--accent);
}
.notice,
#status {
  background: var(--soft);
  border-left: 3px solid var(--accent);
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 20px;
}
.notice.warning {
  background: #30271e;
  border-color: var(--warning);
  color: #ffe0a6;
}
#status.error {
  color: var(--error);
  background: #351d2b;
  border-color: var(--error);
}
.undo-bar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 16px;
  font-size: 12px;
  color: var(--muted);
  margin: -12px 0 12px;
}
.empty {
  padding: 28px 0;
  color: var(--muted);
  font-size: 14px;
}
.toolbar {
  display: flex;
  align-items: end;
  gap: 12px;
  flex-wrap: wrap;
  margin: 0 0 20px;
}
.toolbar .spacer {
  flex: 1;
}
.toolbar label {
  display: grid;
  gap: 5px;
  font-size: 12px;
}
.toolbar input[type="search"] {
  min-width: 210px;
}
.toolbar select {
  max-width: 200px;
}
.table-wrap {
  overflow: auto;
  max-width: 100%;
  border-radius: 4px;
}
table {
  border-collapse: collapse;
  width: 100%;
  font-size: 13px;
  text-align: left;
}
th {
  color: var(--muted);
  font-weight: 550;
  background: #242f49;
  white-space: nowrap;
}
th,
td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
td:first-child,
th:first-child {
  padding-left: 0;
}
th .text-button {
  font-size: 12px;
  color: var(--muted);
  font-weight: 550;
}
td button.text-button {
  text-align: left;
  font-size: 13px;
  line-height: 1.4;
  padding: 0;
}
.numeric {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.transaction-description {
  min-width: 160px;
  max-width: 380px;
}
td small {
  display: block;
}
.table-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 16px 0;
  font-size: 13px;
  color: var(--muted);
}
.actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.actions.end {
  justify-content: flex-end;
}
.tag {
  display: inline-block;
  border-radius: 4px;
  background: var(--soft);
  color: var(--accent);
  padding: 3px 7px;
  font-size: 11px;
  line-height: 1.4;
  font-weight: 500;
}
.tag.warning {
  background: #332a1b;
  color: #ffd176;
}
.tag.neutral {
  background: #26324b;
  color: var(--muted);
}
.chart {
  width: 100%;
  height: auto;
  max-height: 300px;
  display: block;
  overflow: visible;
}
.chart text {
  font-family: inherit;
  font-size: 12px;
  fill: var(--muted);
}
.chart .bar-in {
  fill: var(--accent);
}
.chart .bar-out {
  fill: #ffb85c;
}
.chart .grid {
  stroke: #263451;
  stroke-width: 1;
}
.chart [role="button"] {
  cursor: pointer;
}
.chart [role="button"]:hover {
  opacity: 0.75;
}
.chart-legend {
  font-size: 12px;
  color: var(--muted);
  display: flex;
  gap: 18px;
  margin: 14px 0;
}
.dot {
  width: 9px;
  height: 9px;
  display: inline-block;
  border-radius: 50%;
  margin-right: 6px;
  background: var(--accent);
}
.dot.out {
  background: #ffb85c;
}
details {
  margin-top: 16px;
  font-size: 13px;
}
summary {
  cursor: pointer;
  color: var(--accent);
  padding: 6px 0;
  min-height: 44px;
}
.calendar {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 5px;
  margin-top: 16px;
}
.calendar-label {
  text-align: center;
  font-size: 12px;
  color: var(--muted);
}
.calendar button {
  padding: 8px 4px;
  min-height: 74px;
  text-align: left;
  font-size: 12px;
}
.calendar button strong {
  display: block;
  font-size: 12px;
  margin-top: 5px;
}
.calendar .intensity-1 {
  background: #122540;
}
.calendar .intensity-2 {
  background: #143654;
}
.calendar .intensity-3 {
  background: #1a4968;
}
.calendar .intensity-4 {
  background: #245d7d;
}
.calendar .outside {
  opacity: 0.35;
}
.month-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.month-grid button {
  text-align: left;
}
.month-grid strong {
  display: block;
}
.payment-map {
  width: 100%;
  height: 350px;
}
.payment-map rect {
  stroke: var(--canvas);
  stroke-width: 3;
  fill: #153952;
}
.payment-map text {
  fill: var(--ink);
  font-family: inherit;
  font-size: 13px;
  pointer-events: none;
}
.payment-map g:nth-child(3n) rect {
  fill: #174766;
}
.payment-map g:nth-child(3n + 1) rect {
  fill: #1c304d;
}
.payment-map g {
  cursor: pointer;
}
.payment-map g:hover rect {
  fill: #236188;
}
.fact-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin: 20px 0;
}
.fact {
  border-bottom: 1px solid var(--border);
  padding-bottom: 14px;
}
.fact span,
.fact small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}
.fact strong {
  display: block;
  margin-top: 5px;
  font-size: 20px;
  font-variant-numeric: tabular-nums;
}
.explanation {
  padding-left: 20px;
  color: var(--muted);
  font-size: 13px;
}
.explanation li {
  margin: 8px 0;
}
.welcome {
  max-width: 990px;
  margin: 64px auto 80px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 36px 60px;
  align-items: center;
}
.welcome h1 {
  font-size: 54px;
  letter-spacing: -2px;
  margin-bottom: 20px;
}
.welcome-copy > p {
  font-size: 18px;
  color: var(--muted);
  max-width: 380px;
}
.drop-zone {
  border: 1px dashed #42637b;
  background: #0b1733;
  padding: 36px;
  border-radius: 8px;
}
.drop-zone p {
  margin: 12px 0 22px;
}
.drop-zone p.small {
  margin: 24px 0 0;
}
.drop-zone.is-over {
  background: var(--soft);
  border-color: var(--accent);
}
.privacy-details {
  grid-column: 1/-1;
  max-width: 650px;
}
.privacy-details p {
  color: var(--muted);
}
footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
  padding: 26px 0;
  color: var(--muted);
  font-size: 12px;
}
dialog {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 26px;
  width: min(760px, calc(100vw - 32px));
  max-height: calc(100dvh - 36px);
  color: var(--ink);
  background: var(--surface);
  box-shadow: 0 20px 70px #00030db3;
  overflow: auto;
}
dialog::backdrop {
  background: #000515ba;
}
dialog .dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}
dialog form > p {
  margin: 16px 0 24px;
}
.detail-dialog {
  position: fixed;
  inset: 0 0 0 auto;
  margin: 0;
  width: min(580px, 96vw);
  height: 100dvh;
  max-height: 100dvh;
  border-radius: 0;
  padding: 26px;
  max-width: none;
}
.detail-dialog .dialog-head {
  position: sticky;
  top: -26px;
  background: var(--surface);
  padding: 20px 0;
  z-index: 1;
  border-bottom: 1px solid var(--border);
}
.detail-dialog h2 {
  overflow-wrap: anywhere;
}
.detail-section {
  margin: 26px 0;
}
.detail-section h3 {
  margin-bottom: 12px;
}
.detail-dialog .table-wrap {
  font-size: 12px;
}
.detail-dialog .metrics {
  grid-template-columns: 1fr 1fr;
}
.detail-dialog .metric {
  padding: 0 12px;
}
.detail-dialog .metric:first-child {
  padding-left: 0;
}
.detail-dialog .metric strong {
  font-size: 24px;
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin: 20px 0;
}
.form-grid label {
  display: grid;
  gap: 5px;
  font-size: 12px;
}
.form-grid label.full {
  grid-column: 1/-1;
}
.form-grid textarea {
  min-height: 80px;
}
.import-preview {
  max-height: 240px;
  overflow: auto;
  margin: 18px 0;
}
.import-preview td {
  max-width: 220px;
  overflow-wrap: anywhere;
}
.import-progress {
  color: var(--muted);
  font-size: 12px;
  margin: 8px 0;
}
.file-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  padding: 18px 0;
  border-bottom: 1px solid var(--border);
}
.file-row p {
  font-size: 12px;
  color: var(--muted);
  margin: 5px 0;
}
.file-row .actions {
  gap: 8px;
}
.file-row button {
  font-size: 12px;
}
.coverage-facts {
  list-style: none;
  padding: 0;
}
.coverage-facts li {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.coverage-facts strong {
  text-align: right;
}
.inline-check {
  display: flex !important;
  align-items: center;
  gap: 8px !important;
}
.insight-kind {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}
.row-actions {
  display: flex;
  gap: 8px;
}
.reviewed {
  opacity: 0.6;
}
.review-list .list-row {
  align-items: start;
}
.status-message {
  min-height: 24px;
  color: var(--error);
  font-size: 13px;
}
.nowrap {
  white-space: nowrap;
}
@media (min-width: 1600px) {
  .site-header {
    padding-left: max(36px, calc((100vw - 1420px) / 2 + 36px));
    padding-right: max(36px, calc((100vw - 1420px) / 2 + 36px));
  }
}
@media (max-width: 1180px) {
  .site-header {
    flex-wrap: wrap;
    gap: 8px 20px;
  }
  .main-nav {
    order: 3;
    width: 100%;
    justify-content: center;
    margin: 0;
  }
  .header-actions {
    margin-left: auto;
  }
  .context-bar {
    flex-wrap: wrap;
    gap: 12px;
  }
  .account-control {
    flex-basis: 100%;
    max-width: none;
  }
  .split {
    grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
  }
  .brand small {
    font-size: 10px;
  }
}
@media (max-width: 760px) {
  :root {
    font-size: 14px;
  }
  .site-header {
    min-height: 70px;
    padding: 14px 16px;
    flex-wrap: nowrap;
    gap: 8px;
  }
  .brand {
    gap: 7px;
  }
  .brand svg {
    width: 21px;
    height: 29px;
  }
  .brand span {
    font-size: 23px;
  }
  .brand small {
    display: none;
  }
  .header-actions {
    gap: 2px;
  }
  .header-actions > button:not(.primary) {
    padding: 8px;
    font-size: 12px;
  }
  .add-button,
  .desktop-text {
    display: none;
  }
  .mobile-text {
    display: inline;
  }
  .main-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    z-index: 10;
    background: #0b1733;
    border-top: 1px solid var(--border);
    padding: 5px 4px max(5px, env(safe-area-inset-bottom));
    justify-content: space-around;
    gap: 0;
    min-height: 66px;
  }
  .main-nav button {
    display: flex;
    flex-direction: column;
    gap: 2px;
    align-items: center;
    font-size: 11px;
    padding: 5px;
    min-width: 64px;
    min-height: 50px;
    border-bottom: 0;
    border-top: 2px solid transparent;
  }
  .main-nav button[aria-current="page"] {
    border-top-color: var(--accent);
  }
  .main-nav svg {
    display: block;
    width: 21px;
    height: 21px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
  }
  .context-bar {
    gap: 10px;
    margin-bottom: 24px;
  }
  .account-control {
    min-width: 0;
  }
  .account-control select {
    font-size: 13px;
  }
  .segmented button {
    padding: 8px 11px;
    font-size: 12px;
  }
  .period-picker {
    flex: 1;
    max-width: none;
    justify-content: flex-end;
  }
  .period-picker select {
    width: 126px;
    font-size: 12px;
    padding: 9px 2px;
  }
  .period-picker button {
    min-width: 44px;
    padding: 4px;
  }
  .date-range {
    flex-wrap: wrap;
    width: 100%;
  }
  .date-range label {
    flex: 1;
    min-width: 0;
  }
  .date-range input {
    width: 100%;
    padding: 8px 4px;
    font-size: 12px;
  }
  main {
    padding: 20px 16px 80px;
  }
  h1 {
    font-size: 27px;
  }
  .page-heading {
    margin-bottom: 20px;
  }
  .page-heading p {
    font-size: 12px;
  }
  .metrics {
    margin: 20px 0 24px;
  }
  .metric {
    padding: 0 10px;
  }
  .metric span {
    font-size: 11px;
  }
  .metric strong {
    font-size: 18px;
    letter-spacing: -0.6px;
  }
  .metric small {
    font-size: 10px;
  }
  .split,
  .split.equal {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .panel {
    padding: 18px;
    margin-bottom: 16px;
  }
  .split > .panel {
    margin-bottom: 0;
  }
  .panel-head {
    gap: 8px;
  }
  h2 {
    font-size: 18px;
  }
  .panel-head .text-button {
    font-size: 11px;
  }
  .chart {
    max-height: 250px;
  }
  .chart text {
    font-size: 16px;
  }
  .category-row {
    grid-template-columns: minmax(80px, 1fr) minmax(24px, 0.65fr) auto;
    gap: 8px;
  }
  .category-row strong {
    font-size: 12px;
  }
  .category-row .amount {
    font-size: 12px;
  }
  .toolbar {
    gap: 10px;
  }
  .toolbar > label {
    flex: 1;
    min-width: 120px;
  }
  .toolbar select,
  .toolbar input {
    width: 100%;
    max-width: none;
  }
  .toolbar input[type="search"] {
    min-width: 0;
  }
  .toolbar .segmented {
    max-width: 100%;
  }
  .calendar {
    gap: 2px;
  }
  .calendar button {
    min-width: 0;
    min-height: 64px;
    padding: 6px 1px;
    font-size: 12px;
    font-variant-numeric: tabular-nums;
  }
  .calendar button strong {
    font-size: 12px;
    white-space: nowrap;
  }
  .month-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .welcome {
    margin: 32px auto 40px;
    display: block;
  }
  .welcome h1 {
    font-size: 43px;
  }
  .welcome-copy > p {
    font-size: 16px;
    margin-bottom: 28px;
  }
  .drop-zone {
    padding: 24px;
  }
  .privacy-details {
    margin-top: 24px;
  }
  footer {
    font-size: 10px;
    align-items: start;
  }
  footer .text-button {
    font-size: 10px;
    min-height: 24px;
    text-align: right;
  }
  dialog {
    padding: 20px;
  }
  .detail-dialog {
    width: 100vw;
    padding: 20px;
  }
  .detail-dialog .dialog-head {
    top: -20px;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
  .file-row {
    grid-template-columns: 1fr;
  }
  .table-summary {
    flex-wrap: wrap;
  }
  .table-wrap table {
    font-size: 12px;
  }
  .fact-grid {
    gap: 14px;
  }
  .fact strong {
    font-size: 18px;
  }
  .notice,
  #status {
    font-size: 12px;
  }
  .review-list .row-actions {
    flex-direction: column;
  }
  .row-actions button {
    font-size: 11px;
    padding: 6px;
  }
  .payment-map {
    height: 260px;
  }
  .payment-map text {
    font-size: 11px;
  }
}
@media (max-width: 380px) {
  .calendar {
    gap: 1px;
    margin-inline: -10px;
  }
  .context-bar > .segmented {
    width: 100%;
    justify-content: center;
  }
  .period-picker {
    justify-content: space-between;
    width: 100%;
  }
  .period-picker label {
    flex: 1;
  }
  .period-picker select {
    width: 100%;
  }
  .metric strong {
    font-size: 16px;
  }
  .metric {
    padding: 0 7px;
  }
  .metric span {
    font-size: 10px;
  }
  .header-actions > button:not(.primary) {
    padding: 6px;
  }
  .brand svg {
    display: none;
  }
  .panel {
    padding: 14px;
  }
}
@media (prefers-reduced-motion: no-preference) {
  button {
    transition: background-color 0.12s ease;
  }
  dialog[open] {
    animation: appear 0.15s ease;
  }
  @keyframes appear {
    from {
      opacity: 0.3;
      transform: translateY(5px);
    }
    to {
      opacity: 1;
      transform: none;
    }
  }
}

#demoNotice {
  padding: 0;
  border: 0;
  background: transparent;
  font-size: 12px;
  color: var(--muted);
  margin-top: -12px;
  margin-bottom: 16px;
}
.date-metric {
  font-size: 23px;
}
.net-line { fill: none; stroke: #baa7ff; stroke-width: 2; pointer-events: none; }
.net-point, .dot.net { fill: #baa7ff; background: #baa7ff; }
.income-trends { margin: 18px 0; display: grid; gap: 12px; }
.income-trend { display: grid; grid-template-columns: 90px minmax(100px,1fr) auto; align-items: center; gap: 12px; font-size: 13px; }
.income-trend svg { width: 100%; max-height: 22px; }
.salary-segment { fill: #4fc9ef; }
.bonus-segment, .dot.bonus { fill: #ffd176; background: #ffd176; }
.other-segment, .dot.other { fill: #9db8f5; background: #9db8f5; }
.month-grid .intensity-1 { background: #122540; }
.month-grid .intensity-2 { background: #143654; }
.month-grid .intensity-3 { background: #1a4968; }
.month-grid .intensity-4 { background: #245d7d; }
.toolbar select { max-width: 100%; }
@media (max-width: 760px) {
  .income-trend { grid-template-columns: 70px minmax(65px,1fr) auto; gap: 6px; font-size: 11px; }
  .toolbar > label { max-width: 100%; }
  .chart-legend { flex-wrap: wrap; }
}
.detail-dialog .dialog-head h2 {
  flex: 1;
}
.detail-dialog .dialog-head #detailBack {
  font-size: 12px;
}
.review-list .tag {
  max-width: 100px;
}
.review-list .list-row {
  gap: 10px;
}

.metric strong.unavailable {
  font-size: 16px;
  white-space: normal;
  letter-spacing: 0;
}
.metric strong.large-number {
  font-size: 25px;
}
@media (max-width: 760px) {
  .metric strong.large-number {
    font-size: 14px;
  }
  .metric strong.unavailable {
    font-size: 13px;
  }
  .segmented button,
  .text-button,
  summary {
    min-height: 44px;
  }
  .date-metric {
    white-space: normal;
    font-size: 14px;
  }
  .detail-dialog .metric strong {
    font-size: 20px;
  }
}
@media (max-width: 1000px) {
  .split,
  .split.equal {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 760px) {
  .review-list .list-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
  }
  .review-list .list-row > div {
    grid-column: 1 / -1;
  }
  .review-list .tag {
    justify-self: start;
  }
}

/* SOFT 0.4: evidence charts and compact Regulars. */
/* Compact Regulars evidence: actual charges and estimates remain distinct. */
.regular-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(175px, auto) 12px; gap: 14px; }
.regular-row-copy .tag { margin-top: 5px; }
.regular-row-evidence { font-size: 11px; line-height: 1.5; }
.regular-row-price { text-align: right; min-width: 0; }
.regular-row-actual { display: flex; justify-content: flex-end; align-items: center; gap: 12px; }
.regular-row-actual > span { min-width: 96px; }
.regular-row-actual strong { font-variant-numeric: tabular-nums; white-space: nowrap; }
.regular-row-actual small, .regular-row-monthly { font-size: 11px; }
.regular-sparkline { flex: 0 0 80px; width: 80px; height: 32px; color: var(--accent); }
.regular-sparkline polyline { fill: none; stroke: currentColor; stroke-width: 1.8; vector-effect: non-scaling-stroke; }
.regular-sparkline circle { fill: currentColor; }
.regular-sparkline-empty { max-width: 80px; font-size: 10px; color: var(--muted); }
.regular-price-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin: 18px 0 12px; }
.regular-price-strip .fact strong { font-size: 18px; overflow-wrap: anywhere; }
.regular-rise-summary { margin: 12px 0 20px; line-height: 1.6; }
.regular-rise-summary strong { font-weight: 600; }
@media (max-width: 640px) {
  .regular-row { grid-template-columns: minmax(0, 1fr) minmax(124px, auto); gap: 10px; padding: 14px 0; }
  .regular-row > .chevron { display: none; }
  .regular-row-actual { gap: 5px; }
  .regular-row-actual > span { min-width: 76px; }
  .regular-sparkline { flex-basis: 46px; width: 46px; height: 27px; }
  .regular-row-actual small, .regular-row-monthly { font-size: 10px; }
  .regular-row-evidence { font-size: 10px; }
  .regular-price-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
}

/* SOFT chart parity: plain SVG, exact-data fallbacks, no animated marks. */
.comparison-chart { margin: 18px 0; min-width: 0; }
.comparison-chart figcaption { font-weight: 650; margin-bottom: 12px; }
.comparison-chart .chart { max-height: none; overflow: visible; }
.comparison-chart .chart text { font-size: 14px; font-variant-numeric: tabular-nums; }
.comparison-chart .chart .grid { stroke: var(--border); stroke-width: .75; shape-rendering: crispEdges; }
.comparison-chart .comparison-line { fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.comparison-chart .series-0 { stroke: #4fc9ef; color: #4fc9ef; }
.comparison-chart .series-1 { stroke: #ffb85c; color: #ffb85c; stroke-dasharray: 7 4; }
.comparison-chart .series-2 { stroke: #baa7ff; color: #baa7ff; stroke-dasharray: 2 4; }
.comparison-chart .series-3 { stroke: #ff8c9c; color: #ff8c9c; stroke-dasharray: 10 3 2 3; }
.comparison-chart .series-4 { stroke: #7baeff; color: #7baeff; stroke-dasharray: 12 5; }
.comparison-chart .comparison-mark { fill: var(--surface); stroke-width: 1.5; stroke-dasharray: none; vector-effect: non-scaling-stroke; }
.comparison-chart .chart-baseline { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 5 5; vector-effect: non-scaling-stroke; }
.comparison-chart .chart-selection { stroke: #243f58; stroke-width: 14; vector-effect: non-scaling-stroke; }
.comparison-chart .chart-legend { flex-wrap: wrap; gap: 8px 18px; }
.comparison-chart .chart-legend > span { display: inline-flex; align-items: center; gap: 7px; }
.comparison-chart .line-key { width: 23px; border-top: 2px solid currentColor; display: inline-block; }
.comparison-chart .line-key.series-1, .comparison-chart .line-key.series-3, .comparison-chart .line-key.series-4 { border-top-style: dashed; }
.comparison-chart .line-key.series-2 { border-top-style: dotted; }
.comparison-chart .line-key.baseline { border-top: 1px dashed var(--muted); }
.comparison-chart .selected-key { padding: 2px 6px; background: var(--soft); color: var(--ink); }
.chart-data summary { min-height: 44px; padding-block: 10px; cursor: pointer; }
.chart-data .text-button { min-height: 44px; }
.chart-data .selected-period { background: var(--soft); }
.forecast-date-group { padding-block: 14px; border-top: 1px solid var(--border); }
.forecast-date-group:first-of-type { border-top: 0; }
.forecast-date-group h3, .forecast-date-group p { margin: 0 0 8px; }
.calendar-ranking { padding-left: 26px; }
.calendar-ranking li { padding-left: 3px; }
.ranked-evidence { display: flex; justify-content: space-between; gap: 14px; align-items: center; width: 100%; text-align: left; min-height: 44px; border: 0; border-bottom: 1px solid var(--border); border-radius: 0; background: transparent; }
.ranked-evidence strong { white-space: nowrap; font-variant-numeric: tabular-nums; }
@media (max-width: 600px) {
  .comparison-chart { margin-block: 14px; }
  .comparison-chart .chart-legend { font-size: 12px; }
  .forecast-date-group .list-row { min-height: 48px; }
}

/* Keep the selected account and period compact without hiding either. */
.pattern-correction .form-grid { margin: 16px 0; }
.pattern-correction input, .pattern-correction select { width: 100%; }
.regular-rise-summary { margin: 12px 0 20px; }
.regular-rise-summary summary { font-weight: 500; }
@media (max-width: 759px) {
  .context-bar { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; margin-bottom: 18px; }
  .context-bar .account-control, .context-bar .date-range { grid-column: 1 / -1; width: 100%; }
  .context-bar > .segmented { width: 100%; justify-content: space-between; flex-wrap: nowrap; }
  .context-bar > .segmented button { min-width: 0; padding: 8px 7px; flex: 1; }
  .context-bar .period-picker { width: 100%; min-width: 0; }
  .context-bar .period-picker label { flex: 1; min-width: 0; }
  .context-bar .period-picker select { width: 100%; min-width: 0; }
  .context-bar .period-picker button { min-width: 32px; min-height: 44px; }
  .regular-rise-summary { margin: 8px 0 16px; }
}

/* This label must outrank the general .toolbar label display rule. */
.toolbar label.regular-filter-select { display: none; }
@media (max-width: 759px) {
  .toolbar .regular-filter-buttons { display: none; }
  .toolbar label.regular-filter-select { display: flex; min-width: 0; flex: 1; }
  .regular-filter-select select { width: 100%; }
  .regular-filter-select ~ .spacer { flex: 0; }
}

.regular-cost-mobile { display: none; }
@media (max-width: 759px) {
  .regular-cost-desktop { display: none; }
  .regular-cost-mobile { display: block; margin: 0 0 16px; }
  .regular-cost-mobile > summary { display: flex; justify-content: space-between; align-items: center; gap: 12px; color: var(--ink); font-size: 13px; }
  .regular-cost-mobile > summary strong { display: block; font-size: 24px; margin-top: 4px; }
  .regular-cost-mobile > summary .small::after { content: " ▾"; }
  .regular-cost-mobile[open] > summary .small::after { content: " ▴"; }
  .regular-cost-mobile .metrics { margin-top: 20px; }
}

/* Responsive workspace shell: four destinations on every screen. */
body.has-session main {
  padding-top: 0;
}
#content,
.context-bar,
.overview-analysis > *,
.page-heading > div,
.panel-head > h2 {
  min-width: 0;
}
.context-bar {
  position: relative;
  gap: 12px;
  min-height: 76px;
  margin-bottom: 30px;
  padding-block: 14px;
  border-bottom: 1px solid var(--border);
}
.account-control {
  max-width: 460px;
  min-width: 180px;
  margin-right: auto;
}
.account-control select {
  border-color: transparent;
  background-color: transparent;
  padding-left: 0;
  font-weight: 550;
}
.account-control select:hover {
  border-color: var(--border);
}
.period-picker {
  flex: 0 1 auto;
  max-width: 270px;
}
.period-picker button {
  border-color: transparent;
  background: transparent;
  font-size: 21px;
  padding-inline: 8px;
}
.period-picker button:hover {
  background: var(--soft);
}
.period-picker select {
  width: 140px;
  border: 0;
  background-color: transparent;
  font-weight: 550;
}
.period-options {
  flex: 0 0 auto;
  margin: 0;
  font-size: 13px;
}
.period-options > summary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 9px 13px;
  border: 1px solid #48617e;
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  list-style: none;
  font-weight: 500;
  white-space: nowrap;
}
.period-options > summary::-webkit-details-marker {
  display: none;
}
.period-options > summary svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
}
.period-options[open] > summary,
.period-options > summary:hover {
  background: var(--soft);
  border-color: #4fc9ef;
}
.period-options-body {
  position: absolute;
  top: calc(100% - 6px);
  right: 0;
  z-index: 5;
  width: min(440px, 100%);
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 12px 28px #00030d80;
}
.period-options-body .segmented {
  width: 100%;
  flex-wrap: nowrap;
  margin-top: 12px;
}
.period-options-body .segmented button {
  flex: 1;
  min-height: 44px;
  padding-inline: 10px;
}
.period-options-body .date-range {
  flex-wrap: wrap;
  margin-top: 16px;
}
.period-options-body .date-range label {
  flex: 1;
  min-width: 0;
  gap: 5px;
}
.period-options-body input {
  width: 100%;
}
.rail-note {
  display: none;
}
.overview-focus {
  margin-bottom: 22px;
}
.overview-focus .panel {
  margin: 0;
  padding-bottom: 6px;
}
.overview-focus .panel-head {
  margin-bottom: 4px;
}
.overview-focus .list-row {
  padding-block: 17px;
  min-height: 62px;
}
.overview-focus .list-row:first-child {
  border-top: 1px solid var(--border);
}
.overview-focus .list-row .tag {
  flex: 0 0 auto;
  max-width: none;
  padding: 2px 6px;
  white-space: nowrap;
  font-size: 10px;
}
.overview-focus .insight-kind {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0;
  text-transform: none;
}
.overview-analysis {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(270px, 1fr);
  gap: 18px;
  margin-bottom: 22px;
}
.overview-analysis > .panel {
  margin-bottom: 0;
}
.overview-analysis .category-row {
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  min-height: 61px;
}
.overview-analysis .category-row progress {
  display: none;
}
.overview-analysis .category-row strong {
  font-weight: 500;
}
.overview-analysis .chart-legend {
  justify-content: center;
}
.overview-secondary,
.forecast-more,
.forecast-context {
  margin: 0 0 22px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  padding: 0 22px;
}
.overview-secondary > summary,
.forecast-more > summary,
.forecast-context > summary {
  min-height: 58px;
  padding-block: 17px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 550;
}
.overview-secondary > .panel,
.forecast-context > .panel,
.forecast-context > .split > .panel {
  border: 0;
  padding: 12px 0;
  margin-bottom: 0;
}
.overview-secondary[open],
.forecast-context[open] {
  padding-bottom: 12px;
}
.overview-secondary[open] > summary,
.forecast-context[open] > summary {
  border-bottom: 1px solid var(--border);
}
.chart-options {
  margin: 0 0 8px;
}
.chart-options > summary {
  width: fit-content;
  min-height: 44px;
  font-size: 12px;
  padding-block: 10px;
}
.chart-options[open] {
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.chart-options .toolbar {
  gap: 10px;
  margin-block: 8px;
}
.chart-scope {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
}
.overview-coverage {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
  margin-block: 20px;
}
.overview-coverage .text-button {
  flex: 0 0 auto;
}
.explore-nav {
  margin-bottom: 20px;
  max-width: 100%;
}
.explore-nav .segmented {
  width: fit-content;
  max-width: 100%;
}
.explore-nav .segmented button {
  min-height: 44px;
  padding-inline: 18px;
}
.toolbar input,
.toolbar select,
.form-grid input,
.form-grid select {
  min-width: 0;
}
.detail-source-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  margin-block: 8px;
  font-size: 13px;
  text-underline-offset: 4px;
}
.detail-source,
.detail-calculation {
  padding-block: 8px;
  border-top: 1px solid var(--border);
  scroll-margin-top: 108px;
}
.detail-source > summary,
.detail-calculation > summary {
  min-height: 48px;
  padding-block: 12px;
  font-weight: 550;
}
.detail-dialog .metrics {
  gap: 10px;
  margin-block: 20px;
}
.detail-dialog .metric,
.detail-dialog .metric:first-child {
  padding: 14px;
  background: var(--canvas);
  border-color: transparent;
}
.detail-dialog .metric strong {
  font-size: clamp(20px, 2.1vw, 25px);
}
.detail-dialog .metric span {
  font-size: 12px;
}
.detail-dialog .metric strong.unavailable {
  font-size: 15px;
}
.detail-dialog .metric strong.large-number {
  font-size: 21px;
}
.detail-section,
.detail-source,
.detail-calculation {
  min-width: 0;
}
.table-wrap {
  overscroll-behavior-x: contain;
}
.table-wrap a,
.table-wrap button {
  text-underline-offset: 3px;
}
.table-wrap tbody tr:hover {
  background-color: #111f3b;
}

@media (min-width: 1000px) {
  body.has-session .site-header {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 10;
    display: flex;
    flex-flow: column nowrap;
    align-items: stretch;
    gap: 0;
    width: 220px;
    min-height: 0;
    padding: 28px 17px 22px;
    border-right: 1px solid var(--border);
    border-bottom: 0;
    overflow-y: auto;
  }
  body.has-session .brand {
    flex: 0 0 auto;
    padding: 0 12px;
    align-self: flex-start;
  }
  body.has-session .brand svg {
    display: none;
  }
  body.has-session .brand span {
    font-size: 34px;
    letter-spacing: -1.5px;
  }
  body.has-session .brand small {
    margin-top: 7px;
    max-width: 150px;
    font-size: 13px;
    line-height: 1.4;
    white-space: normal;
  }
  body.has-session .main-nav {
    flex: 0 0 auto;
    order: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 5px;
    width: auto;
    margin: 34px 0 0;
  }
  body.has-session .main-nav button {
    gap: 14px;
    padding: 13px 14px;
    border: 0;
    border-radius: 6px;
    min-height: 50px;
    color: #d4deee;
    font-weight: 450;
    text-align: left;
  }
  body.has-session .main-nav button[aria-current="page"] {
    background: var(--soft);
    color: var(--accent);
    font-weight: 650;
  }
  body.has-session .main-nav button:hover {
    background: #172b44;
  }
  body.has-session .main-nav svg,
  body.has-session .header-actions svg {
    display: block;
    flex: 0 0 21px;
    width: 21px;
    height: 21px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
  }
  body.has-session .header-actions {
    flex: 1 0 auto;
    flex-direction: column;
    align-items: stretch;
    gap: 5px;
    margin: 25px 0 0;
    padding-top: 20px;
    border-top: 1px solid var(--border);
  }
  body.has-session .header-actions > button:not(.primary) {
    display: flex;
    align-items: center;
    gap: 14px;
    min-height: 49px;
    padding: 12px 14px;
    text-align: left;
    color: #d4deee;
    font-size: 14px;
    font-weight: 450;
  }
  body.has-session .header-actions > button[aria-current="page"] {
    background: var(--soft);
    color: var(--accent);
    font-weight: 600;
  }
  body.has-session .header-actions > button:hover {
    background: var(--soft);
  }
  body.has-session .header-actions span#reviewCount {
    margin-left: auto;
    padding: 2px 7px;
    border-radius: 20px;
    font-size: 12px;
  }
  body.has-session .header-actions .add-button {
    margin-top: auto;
    margin-bottom: 0;
    flex: 0 0 auto;
  }
  body.has-session .rail-note {
    display: block;
    flex: 0 0 auto;
    margin-top: 20px;
    padding: 18px 9px 0;
    border-top: 1px solid var(--border);
    color: var(--muted);
    font-size: 11px;
    line-height: 1.55;
  }
  body.has-session .rail-note strong {
    display: block;
    color: #c2d1e8;
    font-weight: 500;
    font-size: 11px;
    margin-bottom: 6px;
  }
  body.has-session main {
    max-width: none;
    min-height: 100dvh;
    margin-left: 220px;
    padding: 0 32px;
  }
  body.has-session #content,
  body.has-session footer,
  body.has-session #demoNotice,
  body.has-session .undo-bar {
    max-width: 1200px;
    margin-inline: auto;
  }
  body.has-session .context-bar {
    flex-wrap: nowrap;
    margin-inline: -32px;
    padding-inline: 32px;
    background: var(--surface);
  }
  body.has-session .context-bar .account-control {
    flex-basis: auto;
  }
  body.has-session .period-options-body {
    right: 32px;
  }
  body.has-session #demoNotice {
    margin-top: -16px;
    margin-bottom: 20px;
  }
  .overview-analysis .panel-head {
    align-items: baseline;
  }
  .overview-analysis .panel-head .text-button {
    flex: 0 0 auto;
  }
}

@media (min-width: 1000px) and (max-width: 1199px) {
  body.has-session main {
    padding-inline: 24px;
  }
  body.has-session .context-bar {
    margin-inline: -24px;
    padding-inline: 24px;
  }
  .overview-analysis {
    grid-template-columns: minmax(0, 1.65fr) minmax(240px, 1fr);
    gap: 14px;
  }
  .overview-analysis > .panel {
    padding: 18px;
  }
  .overview-analysis .panel-head {
    flex-wrap: wrap;
    gap: 4px;
  }
  .metric {
    padding: 16px;
  }
  .metric strong {
    font-size: 28px;
  }
}

@media (min-width: 1200px) {
  .overview-focus .list-row > div:first-child {
    display: grid;
    grid-template-columns: minmax(180px, .8fr) minmax(0, 1.6fr);
    gap: 24px;
    align-items: center;
  }
  .overview-focus .list-row small {
    margin-top: 0;
    font-size: 13px;
    line-height: 1.5;
  }
}

@media (max-width: 999px) {
  body.has-session .site-header {
    min-height: 72px;
    padding: 13px 24px;
    flex-wrap: nowrap;
    gap: 12px;
  }
  body.has-session .brand small,
  body.has-session .header-actions svg,
  body.has-session .add-button {
    display: none;
  }
  body.has-session .header-actions {
    margin-left: auto;
  }
  body.has-session .main-nav {
    position: fixed;
    inset: auto 0 0;
    z-index: 10;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
    width: 100%;
    margin: 0;
    min-height: 69px;
    padding: 6px 8px max(6px, env(safe-area-inset-bottom));
    border-top: 1px solid var(--border);
    background: var(--surface);
  }
  body.has-session .main-nav button {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-width: 0;
    min-height: 54px;
    padding: 5px;
    border: 0;
    border-radius: 6px;
    font-size: 11px;
    color: var(--muted);
  }
  body.has-session .main-nav button[aria-current="page"] {
    background: var(--soft);
    color: var(--accent);
    font-weight: 650;
  }
  body.has-session .main-nav svg {
    display: block;
    width: 21px;
    height: 21px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
  }
  body.has-session main {
    padding: 0 24px 88px;
  }
  .context-bar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 6px 10px;
    min-height: 0;
    padding: 12px 0 16px;
    margin-bottom: 24px;
  }
  .context-bar .account-control {
    grid-column: 1 / -1;
    max-width: none;
    min-width: 0;
    width: 100%;
    margin: 0;
  }
  .context-bar .period-picker {
    grid-column: 1;
    justify-content: flex-start;
    width: 100%;
    max-width: 270px;
    min-width: 0;
  }
  .context-bar .period-picker label {
    flex: 1;
    min-width: 0;
  }
  .context-bar .period-picker select {
    width: 100%;
    min-width: 0;
    padding-inline: 0;
  }
  .context-bar .period-picker button {
    min-width: 44px;
  }
  .context-bar .period-options {
    grid-column: 2;
    justify-self: end;
  }
  .overview-analysis {
    grid-template-columns: minmax(0, 1.7fr) minmax(240px, 1fr);
    gap: 16px;
  }
  .overview-analysis .panel-head {
    flex-wrap: wrap;
    gap: 4px;
  }
  .overview-analysis .category-row {
    min-height: 58px;
  }
  .detail-dialog {
    width: min(620px, 96vw);
  }
}

@media (max-width: 760px) {
  input,
  select,
  textarea,
  .account-control select,
  .period-picker select,
  .date-range input,
  .context-bar .period-picker select {
    font-size: 16px;
  }
  body.has-session .site-header {
    min-height: 64px;
    padding: 9px 16px;
  }
  body.has-session main {
    padding: 0 16px 84px;
  }
  .context-bar {
    padding-top: 8px;
    padding-bottom: 12px;
    margin-bottom: 22px;
  }
  .period-options > summary {
    padding-inline: 11px;
    font-size: 12px;
  }
  .period-options-body {
    padding: 14px;
    width: min(400px, 100%);
  }
  .page-heading {
    gap: 10px;
    margin-bottom: 20px;
  }
  .page-heading h1 {
    font-size: 30px;
    letter-spacing: -.9px;
  }
  .page-heading p {
    font-size: 12px;
    margin-top: 7px;
    line-height: 1.5;
  }
  .metrics {
    gap: 7px;
    margin: 0 0 20px;
  }
  .metric,
  .metric:first-child,
  .metric:last-child {
    padding: 12px 9px;
    border: 1px solid var(--border);
  }
  .metric span {
    font-size: 11px;
    line-height: 1.35;
  }
  .metric strong {
    font-size: clamp(16px, 4.6vw, 26px);
    letter-spacing: -.55px;
    margin-top: 7px;
  }
  .metric small {
    font-size: 10px;
    line-height: 1.4;
    margin-top: 5px;
  }
  .metric strong.large-number {
    font-size: clamp(13px, 3.8vw, 21px);
  }
  .metric strong.unavailable {
    font-size: 13px;
  }
  .overview-analysis {
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
    margin-bottom: 16px;
  }
  .overview-analysis .panel-head {
    flex-wrap: nowrap;
    gap: 8px;
  }
  .panel {
    padding: 16px;
  }
  .panel-head {
    margin-bottom: 10px;
  }
  .panel-head .text-button {
    flex: 0 0 auto;
    font-size: 12px;
  }
  .overview-focus {
    margin-bottom: 16px;
  }
  .overview-focus .list-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    padding-block: 14px;
    gap: 9px;
  }
  .overview-focus .list-row small {
    font-size: 12px;
    line-height: 1.5;
  }
  .overview-secondary,
  .forecast-more,
  .forecast-context {
    margin-bottom: 16px;
    padding-inline: 16px;
  }
  .overview-secondary > summary,
  .forecast-more > summary,
  .forecast-context > summary {
    min-height: 54px;
    font-size: 13px;
  }
  .overview-coverage {
    font-size: 11px;
  }
  .explore-nav .segmented {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .explore-nav .segmented button {
    min-width: 0;
    padding: 8px 5px;
    font-size: 12px;
  }
  .toolbar {
    align-items: end;
  }
  .toolbar > .segmented {
    flex-wrap: wrap;
  }
  .toolbar > label {
    min-width: 130px;
  }
  .regular-cost-mobile {
    padding-block: 3px 9px;
    border-bottom: 1px solid var(--border);
  }
  .regular-cost-mobile > summary strong {
    color: var(--accent);
    font-size: 28px;
    letter-spacing: -.6px;
  }
  .regular-row {
    gap: 10px;
  }
  .detail-dialog {
    width: 100vw;
    padding: 18px;
  }
  .detail-dialog .dialog-head {
    top: -18px;
    gap: 10px;
    padding-block: 14px;
  }
  .detail-dialog .dialog-head h2 {
    font-size: 19px;
  }
  .detail-dialog .metric,
  .detail-dialog .metric:first-child {
    padding: 13px;
    border-color: transparent;
  }
  .detail-dialog .metric strong {
    font-size: 21px;
  }
  .detail-dialog .metric strong.large-number {
    font-size: 18px;
  }
  .detail-dialog .metric strong.unavailable {
    font-size: 13px;
  }
  .detail-dialog .fact-grid {
    gap: 14px;
  }
  .detail-dialog .coverage-facts strong {
    overflow-wrap: anywhere;
    max-width: 65%;
  }
  .ledger-table,
  .ledger-table tbody {
    display: block;
    width: 100%;
  }
  .ledger-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
  }
  .ledger-table tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 4px 12px;
    padding-block: 14px;
    border-bottom: 1px solid var(--border);
  }
  .ledger-table td {
    display: block;
    grid-column: 1 / -1;
    min-width: 0;
    padding: 0;
    border: 0;
    overflow-wrap: anywhere;
    font-size: 12px;
  }
  .ledger-table td[data-label="Date"] {
    grid-column: 1;
    grid-row: 1;
    align-self: center;
    color: var(--muted);
  }
  .ledger-table td[data-label="Amount"] {
    grid-column: 2;
    grid-row: 1;
    align-self: center;
    color: var(--ink);
    font-size: 15px;
    font-weight: 650;
  }
  .ledger-table td[data-label="Description"] {
    min-width: 0;
    max-width: none;
    grid-row: 2;
  }
  .ledger-table td[data-label="Description"] > button {
    font-size: 14px;
    font-weight: 550;
  }
  .ledger-table td[data-label="Category"],
  .ledger-table td[data-label="Type"],
  .ledger-table td[data-label="Source"] {
    display: flex;
    align-items: baseline;
    gap: 9px;
  }
  .ledger-table td[data-label="Category"]::before,
  .ledger-table td[data-label="Type"]::before,
  .ledger-table td[data-label="Source"]::before {
    content: attr(data-label);
    flex: 0 0 52px;
    color: var(--muted);
    font-size: 11px;
  }
  .ledger-table td[data-label="Source"] small {
    min-width: 0;
    font-size: 11px;
  }
  .ledger-table td button.text-button {
    min-height: 44px;
  }
  footer {
    gap: 12px;
    align-items: center;
    padding-block: 18px;
    font-size: 11px;
  }
  footer .text-button {
    font-size: 11px;
    min-height: 44px;
  }
}

@media (max-width: 600px) {
  #content .metrics {
    grid-template-columns: minmax(0, 1fr);
    gap: 7px;
  }
  #content .metric {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 5px 14px;
    padding: 12px 15px;
  }
  #content .metric > span {
    font-size: 12px;
  }
  #content .metric > strong {
    margin: 0;
    font-size: 23px;
    text-align: right;
  }
  #content .metric > small {
    grid-column: 1 / -1;
    margin: 0;
    font-size: 11px;
  }
  #content .metric > strong.large-number {
    font-size: 20px;
  }
  #content .metric > strong.unavailable {
    max-width: 155px;
    font-size: 14px;
  }
  #content .metric > strong.date-metric {
    font-size: 18px;
  }
}

@media (max-width: 420px) {
  .context-bar {
    column-gap: 6px;
  }
  .context-bar .period-picker button {
    display: none;
  }
  .context-bar .period-picker select {
    text-align: left;
    padding-left: 0;
  }
  .period-options > summary {
    gap: 5px;
    padding-inline: 9px;
  }
  .period-options > summary svg {
    width: 16px;
    height: 16px;
  }
  .metric,
  .metric:first-child,
  .metric:last-child {
    padding-inline: 8px;
  }
  .overview-analysis .panel-head {
    align-items: center;
  }
  .overview-analysis .panel-head h2 {
    font-size: 17px;
  }
}

/* Brand treatment. Colour is supported by labels and chart line patterns. */
.ui-icon {
  display: inline-block;
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  vertical-align: middle;
}
.chevron.ui-icon,
.chevron > .ui-icon {
  width: 16px;
  height: 16px;
}
.brand .ui-icon {
  width: 24px;
  height: 24px;
}
.text-button:has(> .ui-icon) {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
summary > .ui-icon {
  margin-right: 6px;
}
.period-options > summary > .ui-icon {
  margin-right: 0;
}
::selection {
  background: var(--accent);
  color: var(--on-accent);
}
input::placeholder,
textarea::placeholder {
  color: #93a4c0;
  opacity: 1;
}
select option {
  background: var(--surface);
  color: var(--ink);
}
h1,
h2,
h3,
.brand > span {
  font-family: var(--display-font);
  font-weight: 400;
  letter-spacing: .5px;
  text-transform: uppercase;
}
h1 {
  font-size: 46px;
  line-height: 1.08;
}
h2 {
  font-size: 25px;
  line-height: 1.12;
}
h3 {
  font-size: 19px;
  line-height: 1.25;
}
.brand small {
  font-family: var(--body-font);
  text-transform: none;
}
.brand > span {
  font-size: 34px;
  letter-spacing: .4px;
}
.metric strong {
  color: var(--ink);
}
.metric.positive strong {
  color: var(--accent);
}
.metric {
  border-top-color: #4a6585;
}
.metric.positive {
  border-top-color: var(--accent);
}
.panel > .panel-head {
  margin: -22px -22px 18px;
  padding: 15px 22px;
  border-bottom: 1px solid var(--border);
  border-radius: 5px 5px 0 0;
  background: var(--surface-raised);
}
.panel .panel > .panel-head,
.overview-secondary > .panel > .panel-head,
.forecast-context > .panel > .panel-head,
.forecast-context > .split > .panel > .panel-head {
  margin: 0 0 14px;
  padding: 0 0 12px;
  border-radius: 0;
  background: transparent;
}
.overview-focus .panel > .panel-head {
  margin-bottom: 0;
}
.overview-focus .list-row:first-child {
  border-top: 0;
}
.overview-focus .list-row .tag {
  background: #29344d;
  color: #d4deee;
}
.overview-secondary > summary,
.forecast-context > summary,
.forecast-more > summary {
  color: #d9e6f7;
}
.overview-secondary[open] > summary,
.forecast-context[open] > summary,
.forecast-more[open] > summary {
  color: var(--accent);
}
.drop-zone {
  border-color: #46718d;
}
.drop-zone.is-over {
  border-color: var(--accent);
  background: var(--soft);
}
.calendar .outside {
  opacity: .5;
}
.calendar button:hover,
.month-grid button:hover {
  border-color: var(--accent);
}
.payment-map rect {
  stroke: var(--canvas);
}
.detail-dialog .dialog-head {
  background: var(--surface);
}
.detail-dialog .metric,
.detail-dialog .metric:first-child {
  background: #101f3b;
}
.detail-dialog .metric.positive {
  border-top-color: var(--accent);
}
body.has-session .main-nav button[aria-current="page"],
body.has-session .header-actions > button[aria-current="page"] {
  box-shadow: inset 3px 0 0 var(--accent);
}
body.has-session .header-actions > .primary:hover {
  background: var(--accent-hover);
  color: var(--on-accent);
}
body.has-session .brand span {
  font-family: var(--display-font);
  font-size: 44px;
  font-weight: 400;
  letter-spacing: .5px;
}
body.has-session .brand small {
  font-family: var(--body-font);
  color: var(--muted);
}
body.has-session .context-bar {
  background: var(--rail);
}

@media (min-width: 1000px) and (max-width: 1199px) {
  .overview-analysis > .panel > .panel-head {
    margin: -18px -18px 16px;
    padding: 14px 18px;
  }
}

@media (max-width: 999px) {
  body.has-session .context-bar {
    background: transparent;
  }
  body.has-session .brand span {
    font-size: 31px;
  }
  body.has-session .main-nav button[aria-current="page"] {
    box-shadow: inset 0 -2px 0 var(--accent);
  }
}

@media (max-width: 760px) {
  .page-heading h1 {
    font-size: 37px;
    letter-spacing: .4px;
  }
  h2,
  .overview-analysis .panel-head h2 {
    font-size: 23px;
    letter-spacing: .4px;
  }
  .panel > .panel-head {
    margin: -16px -16px 14px;
    padding: 14px 16px;
  }
  .panel .panel > .panel-head,
  .overview-secondary > .panel > .panel-head,
  .forecast-context > .panel > .panel-head,
  .forecast-context > .split > .panel > .panel-head {
    margin: 0 0 14px;
    padding: 0 0 12px;
  }
  .detail-dialog .dialog-head h2 {
    font-size: 25px;
  }
  .welcome h1 {
    font-size: 54px;
    letter-spacing: .5px;
  }
}

/* Keep inline library symbols aligned with their labels and row actions. */
@media (min-width: 1000px) {
  body.has-session .header-actions .add-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
  }
}
@media (max-width: 600px) {
  .overview-focus .list-row > div {
    grid-column: 1;
    grid-row: 1;
  }
  .overview-focus .list-row > .chevron {
    grid-column: 2;
    grid-row: 1;
    align-self: center;
  }
}

/* Keep chart labels readable after the SVG scales to its available panel. */
.welcome button[data-action="choose"],
.page-heading > button:has(> .ui-icon),
#localBadge:not([hidden]) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.page-heading > button:has(> .ui-icon) {
  flex: 0 0 auto;
  min-height: 44px;
  white-space: nowrap;
}
.comparison-chart figcaption {
  line-height: 1.5;
}
.comparison-chart .chart-scale-note {
  margin-block: 0 14px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}
.comparison-chart .chart-legend > span {
  min-width: 0;
}
.comparison-chart .line-key {
  flex: 0 0 23px;
}
@media (min-width: 761px) {
  .detail-dialog {
    width: min(680px, 96vw);
  }
}
@media (min-width: 761px) and (max-width: 1199px) {
  .overview-analysis {
    grid-template-columns: minmax(0, 1fr);
  }
}
@media (max-width: 760px) {
  .comparison-chart .chart text {
    font-size: 16px;
  }
  .comparison-chart figcaption {
    font-size: 14px;
  }
  .comparison-chart .chart-legend,
  .comparison-chart > .small,
  .chart-scope,
  .chart-options > summary,
  .chart-data > summary {
    font-size: 13px;
    line-height: 1.6;
  }
  .comparison-chart .chart-legend {
    gap: 8px 14px;
  }
  .chart-data .table-wrap table {
    font-size: 13px;
  }
}

/* Statement imports: one account history, concise merge summary. */
.import-totals { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; margin: 20px 0; }
.import-totals > div { padding: 14px; border: 1px solid var(--border); border-radius: 5px; background: var(--surface); }
.import-totals strong { display: block; color: var(--accent); font-size: 26px; font-variant-numeric: tabular-nums; }
.import-totals span { display: block; margin-top: 4px; font-size: 13px; color: var(--muted); }
.import-settings, .import-sample { margin: 16px 0; }
.import-settings label { display: grid; gap: 6px; margin-top: 14px; }
.overlap-details .list-row { align-items: start; }
.overlap-details .list-row > div { min-width: 0; overflow-wrap: anywhere; }
.overlap-details .list-row small { display: block; margin-top: 5px; }
@media (max-width: 600px) {
  #importForm .form-grid { grid-template-columns: minmax(0, 1fr); }
  .overlap-details .list-row { grid-template-columns: minmax(0, 1fr); }
}

.direction-choice { display: grid; gap: 6px; margin-top: 16px; }
#importForm > .actions.end { position: sticky; bottom: -26px; z-index: 2; padding: 14px 0; margin-bottom: -12px; background: var(--surface); border-top: 1px solid var(--border); }
@media (max-width: 600px) { #importForm > .actions.end { bottom: -20px; } }

.account-type-field { display: grid; gap: 6px; margin-top: 16px; font-size: 13px; }
.aggregate-accounts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr)); gap: 16px; }
.aggregate-account-card { min-width: 0; padding: 16px; border: 1px solid var(--border); border-radius: 6px; }
.aggregate-account-card h3 { margin: 0; }
.aggregate-account-card h3 .text-button { font: 600 16px var(--body-font); text-align: left; }
.aggregate-account-card > .small { margin: 4px 0 14px; }
.aggregate-account-card > label { display: grid; gap: 6px; margin-top: 16px; }
.aggregate-account-totals { display: grid; gap: 8px; font-size: 14px; }
.aggregate-account-totals > span { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 6px 16px; color: var(--muted); }
.aggregate-account-totals strong { color: var(--ink); font-variant-numeric: tabular-nums; }
.aggregate-flow { width: 100%; overflow: hidden; }
.aggregate-flow svg { width: 100%; max-width: 760px; height: auto; display: block; margin-inline: auto; }
.aggregate-flow text { fill: var(--muted); font: 16px var(--body-font); }
.aggregate-flow .aggregate-in { fill: var(--accent); }
.aggregate-flow .aggregate-out { fill: var(--warning); }
.aggregate-in-label::before, .aggregate-out-label::before { content: ''; display: inline-block; width: 10px; height: 10px; margin-right: 6px; border-radius: 2px; background: var(--accent); }
.aggregate-out-label::before { background: var(--warning); }
.aggregate-categories { display: grid; gap: 14px; }
.aggregate-category-row { display: grid; grid-template-columns: minmax(120px, 1fr) minmax(80px, 2fr) auto; align-items: center; gap: 8px 16px; }
.aggregate-category-row > .text-button { text-align: left; overflow-wrap: anywhere; }
.aggregate-category-row > strong { font-variant-numeric: tabular-nums; text-align: right; }
.aggregate-category-row progress { width: 100%; height: 6px; border: 0; border-radius: 3px; background: var(--border); accent-color: var(--accent); overflow: hidden; }
.aggregate-category-row progress::-webkit-progress-bar { background: var(--border); }
.aggregate-category-row progress::-webkit-progress-value { background: var(--accent); }
.aggregate-category-row progress::-moz-progress-bar { background: var(--accent); }
.aggregate-list { min-width: 0; }
.aggregate-list .list-row > div { min-width: 0; }
.aggregate-list small { display: block; overflow-wrap: anywhere; }
.aggregate-forecast .coverage-facts { margin-top: 14px; }
.aggregate-calendar-months { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.aggregate-calendar-months > button { display: grid; gap: 5px; text-align: left; }
.aggregate-calendar-months strong { font-variant-numeric: tabular-nums; }
.aggregate-calendar-months small { color: var(--muted); }
@media (max-width: 600px) {
 .aggregate-accounts { grid-template-columns: minmax(0, 1fr); }
 .aggregate-list .list-row { gap: 10px; }
 .aggregate-category-row { grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; }
 .aggregate-category-row progress { grid-column: 1; grid-row: 2; }
 .aggregate-category-row > strong { grid-column: 2; grid-row: 1 / 3; }
}
