body {
  background: var(--tt-cream, #f7f3eb);
  color: #0b1f33;
}

.form433d-shell {
  max-width: 1050px;
  margin: 0 auto;
  padding: 40px 20px;
}

.form433d-title-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 18px;
  padding: 20px 0 16px;
  border-bottom: 1px solid rgba(11, 58, 110, 0.14);
}

.form433d-title-row span {
  display: block;
  color: #b98518;
  font-size: 0.82rem;
  font-weight: 800;
  margin-bottom: 6px;
  text-transform: uppercase;
}

.form433d-title-row h1 {
  margin: 0;
  color: #0b3a6e;
  font-size: clamp(1.85rem, 4vw, 2.6rem);
  line-height: 1.05;
}

.form433d-title-row p {
  margin: 6px 0 0;
  color: #52657d;
}

.form433d-panel,
.form433d-section {
  background: #ffffff;
  border: 1px solid #d7e1ec;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: none;
}

.form433d-section {
  border-top: 1px solid #d7e1ec;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.section-head h2 {
  margin: 0;
  color: #0b3a6e;
  font-size: 1.16rem;
}

.section-head p {
  margin: 4px 0 0;
  color: #5c6f84;
  font-size: 0.9rem;
}

.agreement-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
}

.agreement-option {
  border: 1px solid #c9d6e4;
  border-radius: 8px;
  background: #f8fbfd;
  color: #0b1f33;
  padding: 13px;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.agreement-option:hover {
  border-color: #0b3a6e;
  box-shadow: 0 8px 18px rgba(16, 34, 52, 0.08);
  transform: translateY(-1px);
}

.agreement-option strong,
.agreement-option span {
  display: block;
}

.agreement-option strong {
  color: #0b3a6e;
  font-size: 0.95rem;
}

.agreement-option span {
  margin-top: 5px;
  font-weight: 800;
}

.agreement-option.selected {
  border-color: #b98518;
  background: #fff8e6;
  box-shadow: inset 0 0 0 1px #b98518;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.field-grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.field-grid.four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.field-grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 12px;
}

.field-grid label,
.table-wrap label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-weight: 800;
  color: #27384b;
  font-size: 0.85rem;
}

.field-grid .wide {
  grid-column: 1 / -1;
}

input,
select {
  border: 1px solid #bdc9d7;
  border-radius: 7px;
  min-height: 38px;
  padding: 8px 10px;
  font: inherit;
  background: #fff;
  color: #0b1f33;
}

input:focus,
select:focus {
  border-color: #0b3a6e;
  box-shadow: 0 0 0 3px rgba(11, 58, 110, 0.13);
  outline: 0;
}

input[readonly] {
  background: #f2f5f8;
  color: #26384c;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  border-bottom: 1px solid #e2e9f1;
  padding: 8px 6px;
  text-align: left;
  vertical-align: top;
}

th {
  background: #0b3a6e;
  color: #fff;
  font-size: 0.78rem;
  text-transform: uppercase;
}

td input {
  width: 100%;
}

.row-remove {
  border: 1px solid #b8c0ca;
  border-radius: 7px;
  background: #fff;
  color: #24313f;
  height: 30px;
  padding: 5px 8px;
  font-weight: 800;
}

.segmented {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.segmented label,
.checkline {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid #c9d6e4;
  border-radius: 8px;
  padding: 8px 10px;
  font-weight: 800;
  color: #24313f;
  background: #fff;
}

.checkline {
  margin-top: 10px;
}

.segmented input,
.checkline input {
  height: auto;
}

.schedule-list {
  display: grid;
  gap: 8px;
}

.schedule-row,
.review-row {
  display: grid;
  grid-template-columns: minmax(130px, 0.45fr) 1fr;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid #e7edf4;
}

.schedule-row strong,
.review-row strong {
  color: #52657d;
}

.form433d-warning,
.form433d-alert {
  border: 1px solid #d8b25f;
  border-radius: 8px;
  background: #fff7e6;
  color: #5c3a07;
  padding: 10px 12px;
  margin-bottom: 12px;
  font-weight: 700;
}

.form433d-alert.error {
  border-color: #d99a9a;
  background: #fff0f0;
  color: #8a2424;
}

.form433d-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 14px;
}

#balance-source,
#bank-link-status {
  color: #53657a;
  font-weight: 800;
}

@media (max-width: 760px) {
  .form433d-title-row,
  .section-head {
    display: block;
  }

  .form433d-title-row .btn-neutral,
  .section-head .btn-neutral {
    margin-top: 10px;
  }

  .field-grid,
  .field-grid.three,
  .field-grid.four,
  .field-grid.two {
    grid-template-columns: 1fr;
  }

  .schedule-row,
  .review-row {
    grid-template-columns: 1fr;
  }
}

/* Keep the form controls and review within the existing page at narrow widths. */
.form433d-shell *, .form433d-shell { box-sizing: border-box; }
.field-grid label, .field-grid input, .field-grid select { min-width: 0; width: 100%; }
.review-row span, .agreement-option { overflow-wrap: anywhere; }
.form433d-shell .btn-neutral, .form433d-shell .btn-blue-bright, .form433d-shell .btn-gold {
  display: inline-flex; align-items: center; justify-content: center; border: 1px solid #bdc9d7; border-radius: 8px;
  min-height: 40px; padding: 10px 14px; font: inherit; font-weight: 800; text-decoration: none; cursor: pointer;
}
.form433d-shell .btn-neutral { color: #0b3a6e; background: #fff; }
.form433d-shell .btn-blue-bright { color: #fff; background: #0b3a6e; }
.form433d-shell .btn-gold { color: #0b1f33; background: #f6cc6d; border-color: #b98518; }
@media (max-width: 480px) {
  .table-wrap table, .table-wrap tbody, .table-wrap tr, .table-wrap td { display: block; width: 100%; }
  .table-wrap thead { display: none; }
  .table-wrap tr { margin-bottom: 14px; }
  .table-wrap td:nth-child(1)::before { content: "Tax form"; }
  .table-wrap td:nth-child(2)::before { content: "Tax period"; }
  .table-wrap td:nth-child(3)::before { content: "Balance as of"; }
  .table-wrap td:nth-child(4)::before { content: "Balance"; }
}

.table-wrap input[type="checkbox"] { width: auto; height: auto; }
.form433d-shell button:disabled { cursor: wait; opacity: 0.65; }

@media (max-width: 480px) {
  .table-wrap td::before { display: block; margin-bottom: 4px; font-weight: 700; }
}

.form433d-shell > #workspace { background: #fff; padding: 20px; border: 1px solid #e6d9be; border-radius: 8px; }
.form433d-shell > #workspace[hidden] ~ .owner-bottom-actions { display: none; }

.form433d-shell .section-head:has(#fill-transcripts) { display: block; }
.form433d-shell .section-head:has(#fill-transcripts) .form433d-actions { justify-content: flex-start; }

/* Match the established IA Calculator shell and white working surface. */
.form433d-shell .form433d-section { border: 0; border-bottom: 1px solid #d7e1ec; border-radius: 0; padding: 20px 0; }
.form433d-shell .btn-neutral { background: #eef1f4; border-color: #b8c0ca; color: #24313f; }
.form433d-shell #save-draft { background: #1f6fd1; border-color: #1554a5; color: #fff; }

/* Keep the owner Easy Fill actions and injected planning controls aligned. */
.form433d-shell #monthly-payment,
.form433d-shell #payment-day,
.form433d-shell #first-payment-date,
.form433d-shell #setup-window-start,
.form433d-shell #setup-window-end {
  height: 42px;
  min-height: 42px;
  padding: 8px 10px;
}
.form433d-shell #select-ia-payment,
.form433d-shell #calculate-start-date {
  margin-top: 12px;
  width: auto;
}
.form433d-shell #fill-transcripts {
  width: auto;
  flex: none;
  background: #eef1f4;
  border-color: #b8c0ca;
  color: #24313f;
}
.form433d-shell .owner-bottom-actions {
  gap: 12px;
  flex-wrap: nowrap;
}

.form433d-shell #fill-transcripts {
  min-height: 36px;
  padding: 7px 11px;
  font-size: 0.88rem;
}
.form433d-shell #balance-source { margin: 16px 0 10px; line-height: 1.3; }
.form433d-shell .table-wrap th { text-align: center; vertical-align: middle; }
.form433d-shell .form433d-section:has(#first-payment-amount) .field-grid.four label { text-align: left; }
.form433d-shell .form433d-section:has(#first-payment-amount) .field-grid.four input { height: 38px; min-height: 38px; }

.form433d-shell .form433d-section:has(#send-bank-link) > p:first-of-type { margin: 0 0 12px; }
.form433d-shell .form433d-section:has(#send-bank-link) .form433d-actions {
  justify-content: flex-start;
  margin-top: 10px;
  gap: 10px;
}
.form433d-shell #send-bank-link,
.form433d-shell #refresh-client-info { width: auto; min-height: 38px; padding: 8px 12px; font-size: 0.88rem; }
.form433d-shell #bank-link-status { margin: 12px 0; line-height: 1.35; }
.form433d-shell #bank-fields input { height: 42px; min-height: 42px; }

.form433d-shell .form433d-section:has(#taxpayer-name) .section-head h2 { white-space: nowrap; }
.form433d-shell label.checkline:has(#joint-liability) {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  align-self: end;
  gap: 8px;
  min-height: 42px;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
}
.form433d-shell label.checkline:has(#joint-liability) input {
  width: 18px;
  height: 18px;
  min-height: 0;
  flex: none;
  margin: 0;
}

.form433d-shell #ia-payment-preview {
  border: 0;
  background: transparent;
  padding: 8px 0 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.form433d-shell #ia-payment-preview[hidden] { display: none; }
.form433d-shell #ia-payment-preview h3 { display: none; }
.form433d-shell #ia-payment-preview select { width: min(100%, 280px); height: 40px; min-height: 40px; }
.form433d-shell #ia-payment-preview > div { flex-basis: 100%; }
.form433d-shell #ia-payment-preview > p { flex-basis: 100%; margin: 2px 0 0; }
.form433d-shell #ia-payment-preview > button { width: auto; min-height: 38px; padding: 8px 12px; }

.form433d-shell #client-type-row:not([hidden]) {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  color: #27384b;
  font-size: 0.85rem;
}
.form433d-shell .client-type-row label { display: flex; align-items: center; gap: 10px; font-weight: 800; }
.form433d-shell .client-type-row select { width: 160px; min-height: 38px; }
.form433d-shell #client-type-row[hidden],
.form433d-shell #personal-filing-row[hidden],
.form433d-shell #spouse-name-field[hidden],
.form433d-shell #spouse-tin-field[hidden],
.form433d-shell #identifier-type[hidden],
.form433d-shell #joint-liability[hidden],
.form433d-shell #refresh-client-info[hidden],
.form433d-shell #bank-fields[hidden] { display: none; }

.form433d-shell .payment-structure-fields { margin-top: 16px; }
.form433d-shell .payment-structure-fields label { text-align: left; }
.form433d-shell .payment-structure-fields input {
  width: min(100%, 210px);
  height: 38px;
  min-height: 38px;
  padding: 6px 10px;
}

.form433d-shell .table-wrap th {
  background: transparent;
  color: #27384b;
  text-align: left;
  text-transform: none;
  font-size: 0.85rem;
  font-weight: 800;
  border-bottom: 0;
}
.form433d-shell .table-wrap table { table-layout: fixed; }
.form433d-shell #bank-link-status {
  display: inline-flex;
  align-items: center;
  margin: 0;
  color: #53657a;
  font-weight: 800;
}
