.hba-shell {
  --hba-ink: #152949;
  --hba-muted: #435573;
  --hba-accent: #214ea1;
  --hba-line: #ccd7ea;
  --hba-tint: #f2f6ff;
  color: var(--hba-ink);
  width: min(1130px, calc(100% - 2rem));
  margin: 2rem auto 3rem;
  font-family: system-ui, sans-serif;
  overflow-wrap: anywhere;
}

.hba-shell [hidden] { display: none !important; }
.hba-shell h1, .hba-shell h2, .hba-shell h3 { color: var(--hba-ink); font-family: inherit; font-weight: 750; }
.hba-shell h2 { font-size: clamp(1.2rem, 3vw, 1.55rem); margin: 0 0 .5rem; }
.hba-shell h3 { font-size: 1.15rem; margin: 0 0 .35rem; }
.hba-shell h2 small { font-size: .72rem; color: var(--hba-muted); margin-inline-start: .4rem; }
.hba-shell p { color: var(--hba-muted); line-height: 1.55; margin: 0 0 .8rem; }
.hba-shell p:last-child { margin-bottom: 0; }
.hba-shell :focus-visible { outline: 3px solid #2d67cf; outline-offset: 3px; }
.hba-shell a:not(.hba-button) { color: #18458f; text-underline-offset: .18em; text-decoration: underline; }

.hba-hero {
  padding: clamp(1.25rem, 5vw, 3.4rem);
  border: 1px solid var(--hba-line);
  border-radius: 1.35rem;
  background: radial-gradient(ellipse at 90% 12%, #e4ddfc, transparent 66%), #eaf4ff;
}
.hba-hero nav { display: flex; flex-wrap: wrap; gap: .5rem; font-size: .9rem; margin-bottom: 1.2rem; }
.hba-hero h1 { font-size: clamp(2rem, 6vw, 3.75rem); letter-spacing: -.045em; line-height: 1.05; margin: 0 0 1rem; }
.hba-hero h1 span { color: var(--hba-accent); }
.hba-hero p { max-width: 43rem; font-size: 1.06rem; }
.hba-hero .hba-button { margin-top: .65rem; }

.hba-panel, .hba-notice {
  background: #fff;
  border: 1px solid var(--hba-line);
  padding: clamp(1rem, 3vw, 1.6rem);
  border-radius: 1rem;
  margin-top: 1rem;
}
.hba-panel { box-shadow: 0 .55rem 1.4rem rgba(19, 45, 84, .06); scroll-margin-top: 1.25rem; }
.hba-notice { background: #f6f7ff; border-inline-start: .3rem solid #7460b0; font-size: .94rem; }
.hba-section-top { display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; gap: .75rem 1.2rem; margin-bottom: 1rem; }
.hba-section-top h2 { margin-bottom: .3rem; }
.hba-section-top p { margin-bottom: 0; }
.hba-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; margin-block: .7rem; }
.hba-shell label { display: grid; align-content: start; gap: .35rem; font-size: .91rem; font-weight: 650; min-width: 0; margin: 0; }
.hba-shell input, .hba-shell select {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  min-height: 2.75rem;
  padding: .48rem .6rem;
  background: #fff;
  border: 1px solid #8399bc;
  color: var(--hba-ink);
  border-radius: .5rem;
  font: inherit;
  font-size: 1rem;
  font-weight: 450;
}
.hba-shell input[aria-invalid="true"], .hba-shell select[aria-invalid="true"] { border: 2px solid #b32135; }
.hba-method { background: var(--hba-tint); padding: .75rem 1rem; border-radius: .6rem; margin-top: 1rem; }
.hba-method summary { font-weight: 650; cursor: pointer; }
.hba-method p { font-size: .91rem; margin: .6rem 0; }
.hba-method p:last-child { margin-bottom: .18rem; }
.hba-help { font-size: .9rem; }

.hba-ledger { display: grid; gap: .65rem; }
.hba-transaction {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr) minmax(0, 1fr) auto;
  align-items: end;
  gap: .7rem;
  min-width: 0;
  padding: .65rem .85rem .85rem;
  margin: 0;
  background: var(--hba-tint);
  border: 1px solid var(--hba-line);
  border-radius: .65rem;
}
.hba-transaction legend { float: none; width: auto; padding: 0 .3rem; margin: 0; font-size: .83rem; font-weight: 700; color: var(--hba-muted); }
.hba-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .55rem; }
#hba-form > .hba-actions { margin: 1rem 0 .65rem; }
.hba-button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: .45rem;
  min-height: 2.75rem;
  max-width: 100%;
  border: 1px solid var(--hba-accent);
  border-radius: .55rem;
  padding: .5rem .85rem;
  background: var(--hba-accent);
  color: #fff;
  text-decoration: none;
  font: inherit;
  font-size: .91rem;
  font-weight: 700;
  line-height: 1.35;
}
.hba-button:hover { background: #173e84; color: #fff; }
.hba-secondary { background: #fff; color: var(--hba-accent); border-color: #859cc8; }
.hba-secondary:hover { background: #eaf1ff; color: #173e84; }
.hba-remove { background: #fff; color: #922640; border-color: #bc8490; }
.hba-remove:hover { background: #fdeef1; color: #7d1e33; }
.hba-button:disabled { opacity: .55; cursor: default; pointer-events: none; }
.hba-error { padding: .8rem 1rem; background: #fef1f3; color: #7b1b2e; border: 1px solid #b84056; border-radius: .55rem; margin-bottom: .65rem; }
.hba-status { font-size: .91rem; }

.hba-report { border-top: .25rem solid var(--hba-accent); }
.hba-report-context { font-size: .82rem; font-weight: 700; }
.hba-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .65rem; margin: 1rem 0; }
.hba-metric { background: var(--hba-tint); border-radius: .65rem; padding: .7rem; }
.hba-metric dt { color: var(--hba-muted); font-size: .81rem; font-weight: 650; }
.hba-metric dd { font-size: clamp(.93rem, 2vw, 1.2rem); font-weight: 750; margin: .25rem 0 0; font-variant-numeric: tabular-nums; }
.hba-report-notes { padding: .7rem .85rem .7rem 1.8rem; background: #fff7e7; border-radius: .6rem; color: #634414; font-size: .91rem; }
.hba-report-notes li + li { margin-top: .35rem; }
.hba-table-wrap { overflow-x: auto; margin: .7rem 0; border: 1px solid var(--hba-line); border-radius: .65rem; }
.hba-table { width: 100%; border-collapse: collapse; font-size: .84rem; font-variant-numeric: tabular-nums; }
.hba-table caption { caption-side: top; padding: .65rem; text-align: left; color: var(--hba-ink); font-weight: 700; }
.hba-table caption span { font-size: .78rem; margin-left: .4rem; font-weight: 500; }
.hba-table th, .hba-table td { padding: .48rem .6rem; text-align: right; border-top: 1px solid var(--hba-line); }
.hba-table td, .hba-table tbody th { white-space: nowrap; }
.hba-table thead th { background: #e8effd; vertical-align: bottom; line-height: 1.3; }
.hba-table th:first-child { text-align: left; }
.hba-table tbody tr:nth-child(even) { background: #f6f8fc; }
.hba-interest-report { margin-top: 1.4rem; }

@media (max-width: 760px) {
  .hba-fields, .hba-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hba-transaction { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .hba-transaction .hba-remove { justify-self: start; }
}

@media (max-width: 420px) {
  .hba-shell { width: calc(100% - 1rem); margin-top: 1rem; }
  .hba-fields { grid-template-columns: minmax(0, 1fr); gap: .7rem; }
  .hba-transaction { grid-template-columns: minmax(0, 1fr); }
}

@media print {
  body.page-hba_calculator > :not(#hba-main),
  #hba-main > :not(#hba-report),
  .hba-report-actions { display: none !important; }
  body.page-hba_calculator, #hba-main, #hba-report { width: 100%; margin: 0; padding: 0; background: #fff; color: #000; }
  #hba-report { border: 0; box-shadow: none; }
  #hba-report .hba-metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  #hba-report .hba-table-wrap { overflow: visible; }
  #hba-report .hba-table { font-size: 8pt; }
  #hba-report .hba-table th, #hba-report .hba-table td { padding: .25rem .22rem; }
  #hba-report thead { display: table-header-group; }
  #hba-report tr, #hba-report .hba-metric { break-inside: avoid; }
  #hba-report h3 { break-after: avoid; }
}
