:root {
  color-scheme: light;
  font-family: Inter, "Segoe UI", "Noto Sans", Arial, sans-serif;
  color: #56678f;
  background: #fff;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  --green: #08b994;
  --green-dark: #079c80;
  --ink: #56678f;
  --border: #c9cdd2;
  --panel: #f3f3f3;
}

.select-trigger [data-select-value] {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: #fff;
  font-size: 14px;
  line-height: 1.5;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.application {
  width: min(96%, 1100px);
  margin: 14px auto 28px;
  padding: 18px 15px 20px;
  border: 1px solid #e7eaf0;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 28px rgb(34 49 76 / 5%);
}

.top-placeholder {
  height: 28px;
  margin: 0 0 9px;
  border-radius: 5px;
  background: #f1f1f1;
}

.stepper {
  min-height: 90px;
  padding: 23px 20px 15px;
  border: 1px solid #e7eaf0;
  border-radius: 7px;
}

.stepper ol {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.step {
  min-width: 0;
  text-align: center;
}

.step-indicator {
  height: 13px;
  margin-bottom: 20px;
  border-radius: 9px;
  background: #ccc;
  transition: background-color 160ms ease;
}

.step.is-current .step-indicator,
.step.is-complete .step-indicator {
  background: var(--green);
}

.step-label {
  color: #66728a;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

.step.is-current .step-label {
  font-weight: 600;
}

.form-panel {
  min-height: 400px;
  margin-top: 5px;
  padding: 34px 28px 30px;
  border: 1px solid #edf0f3;
  border-radius: 7px;
  background: #f7f8fa;
}

.step-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(210px, 0.85fr);
  align-items: center;
  gap: 38px;
}

.step-fields {
  min-width: 0;
}

.step-fields.address-fields {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: start;
  gap: 0 10px;
}

.project-fields {
  margin-bottom: 24px;
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0 12px;
}

.project-grid .field {
  margin-top: 10px;
}

.project-selection-hint {
  grid-column: 1 / -1;
  margin: 10px 0 4px;
}

.project-check {
  display: flex;
  min-height: 46px;
  align-items: center;
  gap: 9px;
  margin-top: 10px;
  color: #52617e;
  font-weight: 600;
}

.project-check input {
  width: 17px;
  height: 17px;
  accent-color: var(--green);
}

.readonly-value {
  background: #f1f3f6;
  color: #53617b;
  font-weight: 600;
}

.table-section {
  margin-top: 20px;
}

.table-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  margin-bottom: 10px;
}

.table-heading .section-title {
  margin: 0;
}

.table-total {
  color: #56678f;
  font-size: 13px;
}

.table-total strong {
  color: #34425e;
  font-variant-numeric: tabular-nums;
}

.data-table-wrap {
  overflow-x: auto;
  border: 1px solid #d5dce7;
  background: #fff;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  color: #56678f;
  font-size: 12px;
}

.expense-table {
  min-width: 930px;
  table-layout: fixed;
}

.income-table {
  min-width: 1120px;
}

.payment-table {
  min-width: 1050px;
}

.financial-indicators-table {
  min-width: 620px;
}

.financial-indicators-table th:first-child {
  min-width: 155px;
  text-align: left;
}

.financial-indicators-table td {
  min-width: 112px;
  font-variant-numeric: tabular-nums;
}

.financial-indicators-table .financial-indicator-other th,
.financial-indicators-table .financial-indicator-other td {
  background: #fbfcfe;
}

.financial-other-input {
  width: 100%;
  min-width: 92px;
  text-align: right;
}

.financial-subtitle {
  margin: 20px 0 10px;
  color: #34425e;
  font-size: 15px;
}

.payment-graph-disclosure {
  margin-top: 12px;
  border: 1px solid #d5dce7;
  border-radius: 7px;
  background: #fff;
}

.payment-graph-disclosure summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  color: #34425e;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  list-style-position: inside;
}

.payment-graph-disclosure summary span {
  color: #64718a;
  font-size: 12px;
  font-weight: 500;
}

.payment-graph-disclosure[open] .data-table-wrap {
  border: 0;
  border-top: 1px solid #d5dce7;
}

.submission-consent {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-top: 20px;
  padding: 22px;
  border: 2px solid #b8c5d6;
  border-radius: 14px;
  background: linear-gradient(135deg, #f8fafc, #f0f7ff);
  color: #263650;
  cursor: pointer;
  font-size: 17px;
  line-height: 1.65;
  transition: border-color 160ms ease, background-color 160ms ease, box-shadow 160ms ease;
}

.submission-consent:has(input:checked) {
  border-color: #159570;
  background: #effaf6;
  box-shadow: 0 0 0 3px rgb(21 149 112 / 10%);
}

.submission-consent > span {
  display: grid;
  gap: 5px;
}

.submission-consent strong {
  color: #20304a;
  font-size: 18px;
}

.submission-consent input {
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  margin: 3px 0 0;
  accent-color: #159570;
  cursor: pointer;
}

.document-link {
  display: inline-flex;
  width: fit-content;
  margin-top: 10px;
  text-decoration: none;
}

.financial-section {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid #e1e6ee;
}

.financial-section .table-heading {
  align-items: center;
  margin-bottom: 12px;
}

.financial-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(155px, 1fr));
  gap: 10px;
  margin: 0 0 14px;
}

.financial-metric {
  display: grid;
  gap: 7px;
  min-width: 0;
  padding: 12px;
  border: 1px solid #e0e6ee;
  border-radius: 7px;
  background: #f8fafc;
}

.financial-metric span {
  color: #64718a;
  font-size: 11px;
}

.financial-metric strong {
  overflow-wrap: anywhere;
  color: #27344a;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.financial-metric-total {
  border-color: #b7e9dc;
  background: #effbf7;
}

.data-table th,
.data-table td {
  padding: 7px 6px;
  border: 1px solid #d5dce7;
  text-align: center;
  vertical-align: middle;
}

.data-table thead th {
  height: 42px;
  overflow: hidden;
  background: #f4f6f9;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.data-table tfoot th,
.data-table tfoot td {
  background: #f4f6f9;
  font-weight: 700;
}

.expense-table.is-over-limit tfoot th,
.expense-table.is-over-limit tfoot td {
  background: #fff0f1;
  color: #c43b4b;
}

.expense-table tfoot td.is-over-limit {
  font-weight: 800;
}

.data-table th:first-child,
.data-table td:first-child {
  width: 34px;
}

.expense-table th:nth-child(2) { width: 210px; }
.expense-table th:nth-child(3) { width: 135px; }
.expense-table th:nth-child(4) { width: 95px; }
.expense-table th:nth-child(5) { width: 140px; }
.expense-table th:nth-child(6) { width: 130px; }
.expense-table th:last-child { width: 58px; }

.income-table th:first-child { width: 36px; }
.income-table th:nth-child(2) { min-width: 210px; }
.income-table th:nth-child(3) { min-width: 135px; }
.income-table th:last-child { min-width: 58px; }

.table-select,
.table-input {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 34px;
  padding: 5px 7px;
  border: 1px solid #c9ced8;
  border-radius: 3px;
  background: #fff;
  color: #56678f;
  font: inherit;
}

.table-select {
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: left;
  white-space: nowrap;
}

.table-input {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.table-select:focus,
.table-input:focus {
  border-color: var(--green);
  outline: 2px solid rgb(8 185 148 / 13%);
}

.table-select:disabled {
  background: #f3f5f8;
  color: #8992a2;
}

.table-input[aria-invalid="true"],
.table-select[aria-invalid="true"] {
  border-color: #e85c69;
  box-shadow: 0 0 0 2px rgb(232 92 105 / 13%);
}

.expense-validation {
  margin: 8px 0 0;
  padding: 10px 12px;
  border: 1px solid #f1b8be;
  border-radius: 6px;
  background: #fff5f5;
  color: #b52e40;
  font-weight: 600;
}

.expense-allocation {
  margin-top: 14px;
  padding: 16px;
  border: 1px solid #f0cd88;
  border-radius: 10px;
  background: #fffaf0;
  color: #59451d;
}

.expense-allocation.is-balanced {
  border-color: #a7dcc7;
  background: #f0faf6;
  color: #185b45;
}

.expense-allocation.is-over-limit {
  border-color: #f1b8be;
  background: #fff5f5;
  color: #9c2735;
}

.expense-allocation-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.expense-allocation-heading > div {
  display: grid;
  gap: 4px;
}

.expense-allocation-label {
  font-size: 13px;
  font-weight: 700;
}

.expense-allocation-heading strong {
  font-size: 18px;
}

.expense-allocation-total {
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.expense-progress {
  height: 10px;
  margin-top: 12px;
  overflow: hidden;
  border-radius: 99px;
  background: #e7e9eb;
}

.expense-progress span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: #d29a32;
  transition: width 180ms ease, background-color 180ms ease;
}

.expense-allocation.is-balanced .expense-progress span {
  background: #159570;
}

.expense-allocation.is-over-limit .expense-progress span {
  background: #d64252;
}

.expense-allocation > p {
  margin: 9px 0 0;
  font-size: 13px;
  line-height: 1.5;
}

.expense-other-input {
  margin-top: 6px;
}

.row-number,
.row-total,
.data-table tfoot td {
  font-variant-numeric: tabular-nums;
}

.field-error {
  margin: 12px 0 0;
  color: #c43b4b;
}

.address-fields .section-title,
.address-fields .loading-indicator {
  grid-column: 1 / -1;
}

.address-fields .select-input,
.address-fields input:not([data-mask="phone"]) {
  text-align: left;
}

.address-fields .full-address {
  grid-column: span 2;
}

.section-title {
  margin: 1px 0 8px;
  color: #263248;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.field {
  min-width: 0;
  margin-top: 13px;
}

.field-label {
  display: block;
  min-width: 0;
  overflow: hidden;
  margin-bottom: 6px;
  color: #52617e;
  font-size: 13px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.required {
  color: #e85c69;
}

.text-input,
.select-input,
.select-search {
  display: block;
  width: 100%;
  min-height: 40px;
  padding: 9px 12px;
  border: 1px solid #c9ced8;
  border-radius: 5px;
  outline: none;
  background: #fff;
  color: #34425e;
  text-align: center;
  transition: border-color 150ms ease, box-shadow 150ms ease, background-color 150ms ease;
}

.select-input {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.field-hint {
  display: block;
  margin-top: 5px;
  color: #748099;
  font-size: 11px;
  line-height: 1.35;
}

.text-input::placeholder {
  color: #9ba4b4;
  text-align: center;
}

.text-input:focus,
.select-input:focus,
.select-search:focus {
  border-color: var(--green);
  background: #fff;
  box-shadow: 0 0 0 3px rgb(8 185 148 / 13%);
}

.text-input[aria-invalid="true"],
.select-input[aria-invalid="true"],
.text-input.is-invalid {
  border-color: #e85c69;
  box-shadow: 0 0 0 2px rgb(232 92 105 / 13%);
}

.text-input.is-verified {
  border-color: var(--green);
  box-shadow: 0 0 0 2px rgb(8 185 148 / 13%);
}

.select-control {
  display: grid;
  gap: 6px;
}

.searchable-select {
  position: relative;
  display: block;
}

.address-select-native {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  clip-path: inset(50%);
}

.select-trigger {
  display: flex;
  width: 100%;
  min-height: 40px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  border: 1px solid #c9ced8;
  border-radius: 5px;
  background: #fff;
  color: #34425e;
  text-align: left;
}

.select-trigger:focus-visible,
.select-trigger[aria-expanded="true"] {
  border-color: var(--green);
  outline: 2px solid rgb(8 185 148 / 13%);
}

.select-trigger:disabled {
  cursor: not-allowed;
  background: #f3f5f8;
  color: #8992a2;
}

.select-caret {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  transform: translateY(-2px) rotate(45deg);
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
}

.select-menu {
  position: absolute;
  z-index: 20;
  top: calc(100% + 3px);
  right: 0;
  left: 0;
  display: block;
  padding: 6px;
  border: 1px solid #c9ced8;
  border-radius: 5px;
  background: #fff;
  box-shadow: 0 8px 18px rgb(34 49 76 / 16%);
}

.select-menu[hidden] {
  display: none;
}

.select-search {
  display: block;
  min-height: 34px;
  padding: 6px 10px;
  color: #34425e;
  text-align: left;
}

.select-options {
  max-height: 220px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.select-option {
  display: block;
  width: 100%;
  min-height: 32px;
  padding: 6px 9px;
  border: 0;
  border-radius: 3px;
  background: #fff;
  color: #52617e;
  text-align: left;
}

.select-option:hover,
.select-option:focus-visible {
  outline: none;
  background: #edf5ff;
}

.select-option.is-selected {
  background: #2769c7;
  color: #fff;
}

.select-option[hidden] {
  display: none;
}

.select-empty {
  padding: 8px 9px;
  color: #8992a2;
  font-size: 12px;
}

.select-search::placeholder {
  color: #9ba4b4;
}

.select-input:disabled {
  cursor: not-allowed;
  background: #f3f5f8;
  color: #8992a2;
}

.text-input:disabled {
  cursor: not-allowed;
  background: #f3f5f8;
  color: #8992a2;
}

.text-input[readonly] {
  background: #f3f5f8;
}

.loading-indicator {
  display: block;
  width: 18px;
  height: 18px;
  margin: 12px auto 0;
  border: 2px solid #dce5e2;
  border-top-color: var(--green);
  border-radius: 50%;
  animation: address-loading 700ms linear infinite;
}

@keyframes address-loading {
  to { transform: rotate(360deg); }
}

.consent input[aria-invalid="true"] {
  outline: 2px solid #e85c69;
  outline-offset: 2px;
}

.input-with-icon {
  position: relative;
}

.input-with-icon .text-input {
  padding-right: 40px;
}

.date-picker {
  position: absolute;
  top: 0;
  right: 0;
  width: 42px;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.date-picker:focus-visible {
  outline: 3px solid rgb(8 185 148 / 25%);
  outline-offset: 2px;
}

.calendar-icon {
  position: absolute;
  top: 50%;
  right: 12px;
  width: 15px;
  height: 15px;
  transform: translateY(-50%);
  color: #61708f;
  pointer-events: none;
}

.example-wrap {
  align-self: center;
  padding: 0;
}

.example-image {
  display: block;
  width: min(100%, 270px);
  height: auto;
  border-radius: 3px;
  box-shadow: 0 8px 20px rgb(34 49 76 / 8%);
}

.field-help {
  margin: 6px 0 0;
  color: #7a849a;
  font-size: 12px;
}

.consent {
  display: flex;
  max-width: 360px;
  align-items: flex-start;
  gap: 9px;
  margin-top: 14px;
  line-height: 1.65;
}

.consent input {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  margin: 2px 0 0;
  accent-color: var(--green);
}

.consent a {
  color: inherit;
  text-decoration: none;
}

.consent a:hover {
  text-decoration: underline;
}

.form-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  padding: 20px 3px 0;
}

.navigation-buttons {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 9px;
}

.button {
  display: inline-flex;
  min-height: 39px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 16px;
  border: 1px solid transparent;
  border-radius: 5px;
  font-weight: 600;
}

.button-primary {
  border-color: var(--green);
  background: var(--green);
  color: #fff;
}

.button-primary:hover {
  border-color: var(--green-dark);
  background: var(--green-dark);
}

.button-primary:disabled {
  border-color: #d7dce3;
  background: #d7dce3;
  color: #70798a;
  cursor: not-allowed;
}

.button-secondary {
  border-color: #cbd0d7;
  background: #fff;
  color: var(--ink);
}

.button[hidden] {
  display: none;
}

.notice {
  position: fixed;
  z-index: 2;
  top: 18px;
  right: 18px;
  width: min(360px, calc(100vw - 36px));
  padding: 14px 16px;
  border: 1px solid #f1c7c7;
  border-left: 4px solid #e85c69;
  border-radius: 4px;
  background: #fff;
  box-shadow: 0 5px 20px rgb(20 30 55 / 12%);
  color: #8e3e47;
}

.notice.is-success {
  border-color: #b7e5d7;
  border-left-color: var(--green);
  color: #24785f;
}

.repeat-list {
  display: grid;
  gap: 10px;
}

.repeat-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(130px, 0.42fr) auto;
  gap: 10px;
}

.repeat-row.expense-row {
  grid-template-columns: repeat(3, minmax(0, 1fr)) minmax(120px, 0.45fr) auto;
  align-items: center;
}

.table-remove {
  min-height: 32px;
  width: 32px;
  border: 0;
  color: #df5361;
  font-size: 20px;
}

.remove-button,
.add-button {
  min-height: 35px;
  border: 1px solid #cbd0d7;
  border-radius: 3px;
  background: white;
  color: var(--ink);
}

.remove-button {
  width: 36px;
  color: #aa5962;
  font-size: 18px;
}

.add-button {
  margin-top: 12px;
  padding: 7px 12px;
}

.result-card {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  align-items: center;
  gap: 24px;
  padding: 22px;
  border-radius: 4px;
  background: #fff;
}

.result-card--review {
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 26px;
  padding: 28px;
  border: 1px solid #e1e8f0;
  border-radius: 14px;
  box-shadow: 0 8px 24px rgb(36 57 86 / 6%);
}

.result-card--review .eyebrow {
  margin: 0 0 6px;
  color: #168263;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.result-card--review h2 {
  font-size: 24px;
}

.result-card--review p {
  font-size: 16px;
}

.result-card img {
  width: 100%;
  height: auto;
}

.result-card h2 {
  margin: 0 0 8px;
  color: #30394f;
  font-size: 20px;
}

.result-card p {
  margin: 6px 0;
  line-height: 1.6;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 18px;
}

.summary-item {
  padding: 12px;
  border: 1px solid #eceef1;
  border-radius: 4px;
  background: #fff;
}

.summary-item strong {
  display: block;
  margin-bottom: 4px;
  color: #30394f;
}

@media (max-width: 760px) {
  .application {
    width: calc(100% - 24px);
    margin-top: 12px;
    padding: 18px 12px 20px;
  }

  .stepper {
    padding: 18px 10px 13px;
  }

  .stepper ol {
    gap: 5px;
  }

  .step-indicator {
    height: 12px;
    margin-bottom: 15px;
  }

  .step-label {
    font-size: 11px;
  }

  .form-panel {
    padding: 28px;
  }

  .step-layout {
    grid-template-columns: minmax(0, 1.15fr) minmax(170px, 0.85fr);
    gap: 28px;
  }

  .project-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .step-fields.address-fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .form-footer {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 520px) {
  .application {
    width: calc(100% - 16px);
    margin: 8px auto 16px;
    padding: 10px;
  }

  .stepper {
    min-height: 78px;
    padding: 16px 7px 11px;
  }

  .project-grid {
    grid-template-columns: 1fr;
  }

  .stepper ol {
    gap: 4px;
  }

  .step-label {
    font-size: 9px;
  }

  .step-indicator {
    height: 9px;
    margin-bottom: 13px;
  }

  .form-panel {
    min-height: 360px;
    padding: 22px 16px;
  }

  .step-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 18px;
  }

  .step-fields.address-fields {
    grid-column: 1;
    grid-template-columns: minmax(0, 1fr);
  }

  .address-fields .full-address {
    grid-column: auto;
  }

  .example-wrap {
    order: 1;
    padding: 4px 0 0;
  }

  .example-image {
    width: min(100%, 270px);
    margin: 0 auto;
  }

  .type-options {
    gap: 7px;
    margin-bottom: 20px;
  }

  .repeat-row {
    grid-template-columns: minmax(0, 1fr) 100px auto;
    gap: 6px;
  }

  .result-card {
    grid-template-columns: 76px minmax(0, 1fr);
    gap: 14px;
    padding: 14px;
  }

  .result-card--review {
    grid-template-columns: 56px minmax(0, 1fr);
    gap: 12px;
    padding: 16px;
  }

  .result-card h2 {
    font-size: 17px;
  }

  .result-card--review h2 {
    font-size: 19px;
  }

  .result-card--review p {
    font-size: 14px;
  }

  .submission-consent {
    gap: 12px;
    padding: 16px;
    font-size: 15px;
  }

  .submission-consent strong {
    font-size: 16px;
  }

  .expense-allocation-heading {
    flex-direction: column;
  }

  .expense-allocation-total {
    text-align: left;
  }

  .summary-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .navigation-buttons {
    width: 100%;
    justify-content: flex-end;
  }
}
