:root {
    --brand: #23a455;
    --brand-dark: #1b8444;
    --brand-light: #e8f8ee;
    --ink: #1a2b49;
    --muted: #64748b;
    --line: #e2e8f0;
    --surface: #ffffff;
    --bg: #f4f7fb;
    --success: #067647;
    --danger: #b42318;
    --shadow: 0 12px 40px rgba(26, 43, 73, 0.08);
    --radius: 14px;
}

* {
    box-sizing: border-box;
}

body {
    background: var(--bg);
    color: var(--ink);
    font-family: Inter, "Segoe UI", Arial, sans-serif;
    line-height: 1.5;
    margin: 0;
}

a {
    color: var(--brand);
    text-decoration: none;
}

.site-header {
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    align-items: center;
    display: flex;
    gap: 24px;
    margin: 0 auto;
    max-width: 1280px;
    padding: 14px 24px;
}

.logo {
    align-items: center;
    display: flex;
    gap: 10px;
}

.logo-mark {
    align-items: center;
    background: var(--brand);
    border-radius: 10px;
    color: #fff;
    display: inline-flex;
    font-size: 18px;
    font-weight: 800;
    height: 36px;
    justify-content: center;
    width: 36px;
}

.logo-text {
    color: var(--ink);
    font-size: 22px;
    font-weight: 800;
}

.main-nav {
    display: flex;
    flex: 1;
    gap: 20px;
}

.main-nav a {
    color: var(--muted);
    font-size: 15px;
    font-weight: 600;
}

.main-nav a.active,
.main-nav a:hover {
    color: var(--brand);
}

.header-cta {
    background: var(--brand);
    border-radius: 999px;
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    padding: 10px 18px;
    white-space: nowrap;
}

.header-cta:hover {
    background: var(--brand-dark);
    color: #fff;
}

.page-shell {
    margin: 0 auto;
    max-width: 1280px;
    padding: 28px 20px 80px;
}

.page-title {
    margin-bottom: 24px;
    text-align: center;
}

.page-title h1 {
    font-size: clamp(28px, 4vw, 38px);
    margin: 0 0 8px;
}

.page-title p {
    color: var(--muted);
    font-size: 16px;
    margin: 0;
}

.remote-api-banner {
    background: var(--brand-light);
    border: 1px solid rgba(35, 164, 85, 0.25);
    border-radius: 999px;
    color: var(--brand-dark);
    display: inline-block;
    font-size: 14px;
    margin-top: 12px;
    padding: 8px 14px;
}

.stepper {
    display: flex;
    gap: 0;
    justify-content: center;
    margin: 0 auto 32px;
    max-width: 640px;
}

.step {
    align-items: center;
    color: var(--muted);
    display: flex;
    flex: 1;
    flex-direction: column;
    font-size: 13px;
    font-weight: 700;
    gap: 8px;
    position: relative;
    text-transform: uppercase;
}

.step::after {
    background: var(--line);
    content: "";
    height: 3px;
    left: 50%;
    position: absolute;
    top: 18px;
    width: 100%;
    z-index: 0;
}

.step:last-child::after {
    display: none;
}

.step-icon {
    align-items: center;
    background: var(--surface);
    border: 2px solid var(--line);
    border-radius: 50%;
    display: flex;
    font-size: 18px;
    height: 36px;
    justify-content: center;
    position: relative;
    width: 36px;
    z-index: 1;
}

.step.active .step-icon,
.step.done .step-icon {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
}

.step.active,
.step.done {
    color: var(--brand);
}

.layout-grid {
    align-items: start;
    display: grid;
    gap: 24px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.form-column {
    display: grid;
    gap: 20px;
    grid-column: 1;
}

.preview-column {
    grid-column: 2 / 4;
    position: sticky;
    top: 88px;
}

.section-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.section-head {
    align-items: center;
    background: linear-gradient(180deg, #fafcff 0%, #fff 100%);
    border-bottom: 1px solid var(--line);
    display: flex;
    gap: 12px;
    padding: 18px 22px;
}

.section-head h2 {
    font-size: 20px;
    margin: 0;
}

.section-icon {
    align-items: center;
    background: var(--brand-light);
    border-radius: 10px;
    color: var(--brand);
    display: flex;
    font-size: 20px;
    height: 40px;
    justify-content: center;
    width: 40px;
}

.section-body {
    padding: 22px;
}

.section-note {
    background: #f8fafc;
    border-left: 3px solid var(--brand);
    border-radius: 8px;
    color: var(--muted);
    font-size: 14px;
    margin: 0 0 18px;
    padding: 10px 12px;
}

.grid-2 {
    display: grid;
    gap: 16px;
    grid-template-columns: 1fr;
}

.grid-3 {
    display: grid;
    gap: 16px;
    grid-template-columns: 1fr;
}

.grid-auto {
    display: grid;
    gap: 16px;
    grid-template-columns: 1fr;
}

label.field {
    display: block;
    font-size: 14px;
    font-weight: 600;
}

label.field .req {
    color: var(--danger);
    margin-right: 2px;
}

label.field input,
label.field select,
label.field textarea {
    display: block;
    margin-top: 6px;
}

label.field .hint {
    color: var(--muted);
    font-size: 12px;
    font-weight: 400;
}

.company-logo-field input[type="file"] {
    display: block;
    margin-top: 6px;
}

.company-logo-preview {
    align-items: center;
    display: flex;
    gap: 12px;
    margin-top: 10px;
}

.company-logo-preview.hidden {
    display: none;
}

.company-logo-preview img {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    max-height: 72px;
    max-width: 180px;
    object-fit: contain;
    padding: 6px;
}

input,
select,
textarea {
    background: #fff;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    color: var(--ink);
    font: inherit;
    font-size: 15px;
    padding: 11px 12px;
    width: 100%;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(35, 164, 85, 0.15);
    outline: none;
}

input[readonly],
select[readonly],
textarea[readonly] {
    background: #f8fafc;
    color: var(--muted);
    cursor: default;
}

.radio-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.radio-pill {
    align-items: center;
    background: #f8fafc;
    border: 1px solid var(--line);
    border-radius: 999px;
    cursor: pointer;
    display: inline-flex;
    font-size: 14px;
    font-weight: 600;
    gap: 8px;
    padding: 10px 16px;
}

.radio-pill input {
    accent-color: var(--brand);
    height: 16px;
    width: 16px;
}

.radio-pill:has(input:checked) {
    background: var(--brand-light);
    border-color: var(--brand);
    color: var(--brand-dark);
}

.checkbox-row {
    align-items: center;
    display: flex;
    font-size: 14px;
    font-weight: 600;
    gap: 10px;
    min-height: 42px;
}

.checkbox-row input {
    accent-color: var(--brand);
    height: 18px;
    width: 18px;
}

.collapsible {
    border: 1px dashed var(--line);
    border-radius: 12px;
    margin-top: 16px;
    overflow: hidden;
}

.collapsible-toggle {
    align-items: center;
    background: #f8fafc;
    border: 0;
    color: var(--brand);
    cursor: pointer;
    display: flex;
    font: inherit;
    font-size: 14px;
    font-weight: 700;
    gap: 8px;
    justify-content: space-between;
    padding: 14px 16px;
    width: 100%;
}

.collapsible-body {
    display: none;
    padding: 16px;
}

.collapsible.open .collapsible-body {
    display: block;
}

.collapsible.open .collapsible-toggle .chevron {
    transform: rotate(180deg);
}

.paydate-accordion {
    display: grid;
    gap: 10px;
    margin-top: 16px;
}

.paydate-accordion-item {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 12px;
    overflow: hidden;
}

.paydate-accordion-header {
    align-items: center;
    display: flex;
    gap: 8px;
}

.paydate-accordion-toggle {
    align-items: center;
    background: #f8fafc;
    border: 0;
    color: var(--ink);
    cursor: pointer;
    display: flex;
    flex: 1;
    font: inherit;
    gap: 12px;
    justify-content: space-between;
    min-height: 52px;
    padding: 12px 16px;
    text-align: left;
    transition: background 0.15s ease;
}

.paydate-accordion-toggle:hover {
    background: #f1f5f9;
}

.paydate-accordion-label {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 8px 12px;
    min-width: 0;
}

.paydate-accordion-badge {
    color: var(--brand);
    font-size: 14px;
    font-weight: 800;
    letter-spacing: 0.03em;
}

.paydate-accordion-summary {
    color: var(--muted);
    font-size: 14px;
    font-weight: 500;
}

.paydate-accordion-chevron {
    color: var(--brand);
    flex-shrink: 0;
    font-size: 12px;
    transition: transform 0.2s ease;
}

.paydate-accordion-item.open .paydate-accordion-chevron {
    transform: rotate(180deg);
}

.paydate-accordion-remove {
    flex-shrink: 0;
    font-size: 13px;
    margin-right: 12px;
    padding: 6px 10px;
}

.paydate-accordion-body {
    border-top: 1px solid var(--line);
    display: none;
    padding: 16px;
}

.paydate-accordion-item.open .paydate-accordion-body {
    display: block;
}

.paydate-panel {
    background: #f8fafc;
    border: 1px solid var(--line);
    border-radius: 12px;
    margin-top: 14px;
    padding: 16px;
}

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

.paydate-panel-head h3 {
    font-size: 16px;
    margin: 0;
}

.add-info-block {
    border-top: 1px solid var(--line);
    margin-top: 14px;
    padding-top: 14px;
}

.add-info-block-head h4 {
    color: var(--muted);
    font-size: 13px;
    letter-spacing: 0.04em;
    margin: 0 0 10px;
    text-transform: uppercase;
}

.add-info-list {
    display: grid;
    gap: 12px;
    margin-bottom: 12px;
}

.add-info-row {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 12px;
}

.add-info-row-head {
    align-items: center;
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
}

.add-info-row-head strong {
    color: var(--brand-dark);
    font-size: 13px;
}

.company-policy-block {
    margin-top: 0;
}

.company-policy-row strong {
    color: var(--ink);
}

.btn-text-danger {
    background: transparent;
    border: 0;
    color: var(--danger);
    cursor: pointer;
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    padding: 0;
}

.btn-add-info {
    font-size: 14px;
    padding: 10px 18px;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 20px;
}

.btn {
    align-items: center;
    background: var(--brand);
    border: 0;
    border-radius: 999px;
    color: #fff;
    cursor: pointer;
    display: inline-flex;
    font: inherit;
    font-size: 16px;
    font-weight: 700;
    gap: 8px;
    justify-content: center;
    padding: 14px 28px;
}

.btn:hover {
    background: var(--brand-dark);
}

.btn-secondary {
    background: #eef2f7;
    color: var(--ink);
}

.btn-secondary:hover {
    background: #e2e8f0;
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--brand);
    color: var(--brand);
}

.btn-block {
    width: 100%;
}

.preview-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.preview-card-head {
    background: var(--brand);
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    padding: 14px 18px;
}

.preview-card-body {
    padding: 18px;
}

.stub-preview-carousel {
    margin-bottom: 4px;
}

.stub-preview-controls {
    align-items: center;
    display: none;
    gap: 10px;
    justify-content: space-between;
    margin-bottom: 10px;
}

.stub-preview-carousel.has-multiple .stub-preview-controls {
    display: flex;
}

.stub-preview-counter {
    color: var(--ink);
    font-size: 14px;
    font-weight: 700;
    margin: 0;
    text-align: center;
}

.stub-preview-nav {
    background: #f8fafc;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--ink);
    cursor: pointer;
    flex-shrink: 0;
    font-size: 28px;
    height: 40px;
    line-height: 1;
    width: 40px;
}

.stub-preview-nav:disabled {
    cursor: not-allowed;
    opacity: 0.4;
}

.stub-preview-viewport {
    overflow: hidden;
    width: 100%;
}

.stub-preview-track {
    display: flex;
    transition: transform 0.28s ease;
    width: 100%;
}

.stub-preview-slide {
    flex: 0 0 100%;
    min-width: 100%;
}

.stub-preview-frame-wrap {
    background: #eef2f7;
    border: 1px solid var(--line);
    border-radius: 12px;
    min-height: 220px;
    overflow: visible;
    position: relative;
    width: 100%;
}

.stub-preview-image {
    display: none;
    height: auto;
    max-width: 100%;
    width: 100%;
}

.stub-preview-image.is-visible {
    display: block;
}

.stub-preview-placeholder {
    align-items: center;
    color: var(--muted);
    display: flex;
    font-size: 14px;
    inset: 0;
    justify-content: center;
    padding: 24px;
    position: absolute;
    text-align: center;
}

.stub-preview-loading {
    align-items: center;
    background: rgba(248, 250, 252, 0.92);
    display: flex;
    inset: 0;
    justify-content: center;
    position: absolute;
    z-index: 2;
}

.stub-preview-loading.hidden {
    display: none;
}

.stub-preview-loading-card {
    align-items: center;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: var(--shadow);
    display: grid;
    gap: 12px;
    justify-items: center;
    min-width: 220px;
    padding: 22px 24px;
    text-align: center;
}

.stub-preview-spinner {
    animation: stub-preview-spin 0.8s linear infinite;
    border: 3px solid #dbe4f0;
    border-radius: 50%;
    border-top-color: var(--brand);
    height: 34px;
    width: 34px;
}

.stub-preview-loading-text {
    color: var(--ink);
    font-size: 14px;
    font-weight: 600;
    margin: 0;
}

@keyframes stub-preview-spin {
    to {
        transform: rotate(360deg);
    }
}

.stub-preview-placeholder.hidden {
    display: none;
}

.template-label {
    color: var(--muted);
    font-size: 13px;
    margin: 14px 0 0;
}

.template-picker-row {
    align-items: flex-end;
    display: flex;
    gap: 12px;
    justify-content: space-between;
    margin-top: 14px;
}

.template-picker-current {
    min-width: 0;
}

.template-current-name {
    font-size: 15px;
    font-weight: 700;
    margin: 4px 0 0;
}

.template-change-btn {
    border-radius: 999px;
    flex-shrink: 0;
    font-size: 14px;
    padding: 10px 18px;
}

.template-sample-pdf-row {
    margin-top: 10px;
}

.template-sample-pdf-btn {
    border-radius: 999px;
    font-size: 14px;
    padding: 10px 18px;
    width: 100%;
}

.template-modal {
    inset: 0;
    position: fixed;
    z-index: 1000;
}

.template-modal[hidden] {
    display: none;
}

body.modal-open {
    overflow: hidden;
}

.template-modal-backdrop {
    background: rgba(15, 23, 42, 0.55);
    inset: 0;
    position: absolute;
}

.template-modal-dialog {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.28);
    display: grid;
    gap: 16px;
    left: 50%;
    max-height: calc(100vh - 40px);
    max-width: 920px;
    overflow-y: auto;
    padding: 20px;
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    width: calc(100% - 32px);
}

.template-modal-header {
    align-items: center;
    display: flex;
    gap: 12px;
    justify-content: space-between;
}

.template-modal-header h2 {
    font-size: 20px;
    margin: 0;
}

.template-modal-close {
    background: transparent;
    border: 0;
    color: var(--muted);
    cursor: pointer;
    font-size: 28px;
    line-height: 1;
    padding: 4px 8px;
}

.template-modal-carousel {
    align-items: center;
    display: grid;
    gap: 10px;
    grid-template-columns: auto 1fr auto;
}

.template-carousel-nav {
    background: #f8fafc;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--ink);
    cursor: pointer;
    font-size: 28px;
    height: 44px;
    line-height: 1;
    width: 44px;
}

.template-carousel-nav:disabled {
    cursor: not-allowed;
    opacity: 0.4;
}

.template-modal-viewport {
    overflow: hidden;
    transition: height 0.28s ease;
    width: 100%;
}

.template-modal-track {
    display: flex;
    transition: transform 0.28s ease;
    width: 100%;
}

.template-modal-slide {
    flex: 0 0 100%;
    min-width: 100%;
    padding: 0 4px;
}

.template-modal-slide-label {
    font-size: 14px;
    font-weight: 700;
    margin: 0 0 10px;
    text-align: center;
}

.template-modal-frame-wrap {
    background: #eef2f7;
    border: 1px solid var(--line);
    border-radius: 12px;
    min-height: 220px;
    overflow: visible;
    position: relative;
    width: 100%;
}

.template-modal-image {
    display: none;
    height: auto;
    max-width: 100%;
    width: 100%;
}

.template-modal-image.is-visible {
    display: block;
}

.template-modal-loading {
    align-items: center;
    color: var(--muted);
    display: flex;
    font-size: 14px;
    inset: 0;
    justify-content: center;
    position: absolute;
}

.template-modal-loading.hidden {
    display: none;
}

.template-modal-footer {
    align-items: center;
    display: flex;
    gap: 12px;
    justify-content: space-between;
}

.template-modal-counter {
    color: var(--muted);
    font-size: 14px;
    margin: 0;
}

.template-modal-footer .btn {
    margin-left: auto;
}

.color-picker-grid {
    display: grid;
    gap: 12px;
    grid-template-columns: 1fr;
    margin-top: 8px;
}

.color-picker-field > span {
    color: var(--muted);
    display: block;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 6px;
}

.color-picker-note {
    color: var(--muted);
    font-size: 11px;
    line-height: 1.4;
    margin: 0 0 8px;
}

.color-picker-control {
    align-items: center;
    background: #f8fafc;
    border: 1px solid var(--line);
    border-radius: 10px;
    display: flex;
    gap: 10px;
    padding: 8px 10px;
}

.color-picker-control input[type="color"] {
    background: transparent;
    border: 1px solid var(--line);
    border-radius: 8px;
    cursor: pointer;
    height: 36px;
    padding: 2px;
    width: 44px;
}

.color-hex-input {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    flex: 1;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 13px;
    letter-spacing: 0.04em;
    min-width: 0;
    padding: 8px 10px;
    text-transform: uppercase;
}

.color-swatch-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.color-swatch {
    background: var(--swatch-color, #0066cc);
    border: 1px solid rgba(15, 23, 42, 0.18);
    border-radius: 6px;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
    cursor: pointer;
    flex: 0 0 24px;
    height: 24px;
    padding: 0;
    transition: transform 0.12s ease, box-shadow 0.12s ease;
    width: 24px;
}

.color-swatch:hover {
    transform: scale(1.08);
}

.color-swatch.selected {
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--brand);
}

.color-swatch:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
}

.results-section {
    margin-top: 24px;
    grid-column: 1 / -1;
}

.status {
    border-radius: 10px;
    font-size: 14px;
    margin-bottom: 14px;
    padding: 10px 12px;
}

.status.error {
    background: #fee4e2;
    color: var(--danger);
}

.status.warning {
    background: #fef3c7;
    color: #92400e;
}

.status.success {
    background: #ecfdf3;
    color: var(--success);
}

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

table.results {
    border-collapse: collapse;
    font-size: 13px;
    min-width: 640px;
    width: 100%;
}

table.results th,
table.results td {
    border-bottom: 1px solid var(--line);
    padding: 8px 10px;
    text-align: left;
}

table.results th {
    background: #f8fafc;
    font-size: 11px;
    text-transform: uppercase;
}

.tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.tab {
    background: #eef2f7;
    border: 0;
    border-radius: 999px;
    color: var(--ink);
    cursor: pointer;
    font-size: 13px;
    font-weight: 700;
    padding: 8px 14px;
}

.tab.active {
    background: var(--brand);
    color: #fff;
}

pre.json-output {
    background: #101828;
    border-radius: 10px;
    color: #d1e7ff;
    font-size: 11px;
    max-height: 320px;
    overflow: auto;
    padding: 12px;
}

.hidden {
    display: none !important;
}

.site-footer {
    background: var(--ink);
    color: #cbd5e1;
    margin-top: 40px;
    padding: 40px 20px;
}

.footer-inner {
    display: grid;
    gap: 24px;
    margin: 0 auto;
    max-width: 1280px;
}

.footer-brand strong {
    color: #fff;
    display: block;
    font-size: 18px;
    margin: 8px 0;
}

.footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

.footer-links a {
    color: #cbd5e1;
}

.footer-copy {
    color: #94a3b8;
    font-size: 13px;
    margin: 0;
}

.state-fields-section {
    background: #f8fafc;
    border: 1px solid var(--line);
    border-radius: 12px;
    margin-top: 18px;
    padding: 16px;
}

.state-fields-section.is-loading {
    opacity: 0.72;
}

.state-fields-section.is-loading #state-fields-container::before {
    color: var(--muted);
    content: 'Loading state withholding fields…';
    display: block;
    font-size: 14px;
    grid-column: 1 / -1;
}

.state-fields-heading {
    font-size: 15px;
    margin: 0 0 8px;
}

.state-field-empty {
    color: var(--muted);
    font-size: 14px;
    grid-column: 1 / -1;
    margin: 0;
}

@media (max-width: 1024px) {
    .layout-grid {
        grid-template-columns: 1fr;
    }

    .form-column,
    .preview-column {
        grid-column: auto;
    }

    .preview-column {
        position: static;
    }

    .header-cta {
        display: none;
    }
}

@media (max-width: 720px) {
    .main-nav {
        display: none;
    }
}

.address-autocomplete-wrap {
    position: relative;
}

.address-autocomplete-suggestions {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 10px;
    box-shadow: var(--shadow);
    left: 0;
    list-style: none;
    margin: 6px 0 0;
    max-height: 240px;
    overflow-y: auto;
    padding: 6px 0;
    position: absolute;
    right: 0;
    top: 100%;
    z-index: 30;
}

.address-autocomplete-item {
    color: var(--ink);
    cursor: pointer;
    font-size: 14px;
    line-height: 1.4;
    padding: 10px 14px;
}

.address-autocomplete-item:hover,
.address-autocomplete-item:focus {
    background: var(--brand-light);
}
