:root {
  color-scheme: light;
  --forest: #375542;
  --deep: #212322;
  --leaf: #71984a;
  --lime: #c2e76b;
  --mist: #eef3e6;
  --line: #d8dfd1;
  --paper: #fffef9;
  --danger: #a33b35;
  --muted: #687168;
  --shadow: 0 22px 55px rgba(33, 35, 34, .10);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body { margin: 0; background: #f6f8f2; color: var(--deep); font-family: Poppins, Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: var(--forest); }

.site-header { max-width: 1180px; margin: 0 auto; padding: 26px 28px; display: flex; align-items: center; justify-content: space-between; }
.brand { display: inline-flex; gap: 12px; align-items: center; color: var(--deep); text-decoration: none; }
.brand-logo { width: clamp(175px, 24vw, 245px); height: auto; display: block; }
.brand-context { padding-left: 12px; border-left: 1px solid var(--line); color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .1em; white-space: nowrap; }
.privacy-pill { display: inline-flex; gap: 8px; align-items: center; border: 1px solid var(--line); border-radius: 999px; padding: 8px 12px; background: rgba(255,255,255,.72); font-size: 12px; font-weight: 700; }
.privacy-pill span { color: var(--leaf); font-size: 10px; }

main { overflow: hidden; }
.intro { max-width: 1180px; margin: 28px auto 45px; padding: 0 28px; display: grid; grid-template-columns: 1.45fr .55fr; gap: 52px; align-items: end; }
.eyebrow, .step-kicker { margin: 0 0 10px; color: var(--leaf); font-size: 11px; font-weight: 800; letter-spacing: .17em; }
h1, h2, h3, p { margin-top: 0; }
h1 { max-width: 820px; margin-bottom: 20px; font: 500 clamp(38px, 6vw, 72px)/.99 Georgia, "Times New Roman", serif; letter-spacing: -.035em; color: var(--forest); }
h2 { margin-bottom: 8px; font: 500 32px/1.1 Georgia, "Times New Roman", serif; color: var(--forest); }
h3 { color: var(--forest); }
.lede { max-width: 730px; margin-bottom: 0; color: var(--muted); font-size: 17px; line-height: 1.65; }
.trust-card { display: flex; gap: 14px; padding: 20px; border: 1px solid var(--line); border-radius: 18px; background: rgba(255,255,255,.72); }
.shield { flex: 0 0 auto; width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%; background: var(--lime); color: var(--forest); font-weight: 900; }
.trust-card strong, .trust-card span { display: block; }
.trust-card strong { margin: 1px 0 5px; font-size: 14px; }
.trust-card div span { color: var(--muted); font-size: 12px; line-height: 1.5; }

.workspace { padding: 40px 28px 70px; background: var(--forest); }
.progress-wrap, .form-shell { max-width: 980px; margin: 0 auto; }
.progress { margin: 0 0 28px; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); list-style: none; }
.progress li { position: relative; display: flex; gap: 9px; align-items: center; color: rgba(255,255,255,.48); font-size: 12px; }
.progress li::after { content: ""; position: absolute; z-index: 0; top: 16px; left: 40px; right: 10px; height: 1px; background: rgba(255,255,255,.22); }
.progress li:last-child::after { display: none; }
.progress span { position: relative; z-index: 1; width: 32px; height: 32px; display: grid; place-items: center; border: 1px solid rgba(255,255,255,.3); border-radius: 50%; font-weight: 800; }
.progress .active, .progress .done { color: white; }
.progress .active span { color: var(--forest); border-color: var(--lime); background: var(--lime); }
.progress .done span { border-color: white; background: rgba(255,255,255,.1); }
.form-shell { min-height: 520px; padding: clamp(24px, 5vw, 52px); border-radius: 24px; background: var(--paper); box-shadow: var(--shadow); }
.step-heading { margin-bottom: 28px; display: flex; gap: 24px; align-items: flex-start; justify-content: space-between; }
.step-kicker { margin-bottom: 8px; }
.required-note { color: var(--muted); font-size: 12px; }
.text-button, .icon-button { border: 0; background: transparent; color: var(--forest); cursor: pointer; font-weight: 750; }
.text-button { padding: 6px 0; border-bottom: 1px solid currentColor; font-size: 12px; }
.icon-button { width: 38px; height: 38px; font-size: 30px; font-weight: 300; }

fieldset { margin: 0; padding: 0; border: 0; }
.creditor-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.choice-card { position: relative; min-height: 115px; display: flex; align-items: flex-start; padding: 20px 46px 18px 18px; border: 1px solid var(--line); border-radius: 16px; cursor: pointer; transition: .18s ease; }
.choice-card:hover { transform: translateY(-2px); border-color: var(--leaf); }
.choice-card:has(input:checked) { border-color: var(--forest); background: var(--mist); box-shadow: inset 0 0 0 1px var(--forest); }
.choice-card input { position: absolute; opacity: 0; }
.choice-content strong, .choice-content small { display: block; }
.choice-content strong { font-size: 14px; line-height: 1.4; }
.choice-content small { margin-top: 9px; color: var(--muted); font-size: 11px; }
.radio-ui { position: absolute; top: 18px; right: 18px; width: 20px; height: 20px; border: 1px solid #a8b2a2; border-radius: 50%; }
.choice-card input:checked ~ .radio-ui { border: 6px solid var(--forest); background: white; }
.creditor-card { min-height: 168px; cursor: default; border-color: var(--forest); background: var(--mist); box-shadow: inset 0 0 0 1px var(--forest); }
.creditor-card:hover { transform: none; }
.choice-content b { display: block; margin-top: 12px; color: var(--danger); font-size: 10px; line-height: 1.35; overflow-wrap: anywhere; }
.choice-content b.configured { color: var(--forest); }
.creditor-check { position: absolute; top: 18px; right: 18px; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; background: var(--lime); color: var(--forest); font-size: 12px; font-weight: 900; }
.field-row { display: grid; gap: 16px; margin-top: 20px; }
.field-row.two { grid-template-columns: repeat(2, 1fr); }
.field-row.three { grid-template-columns: .7fr 1.2fr 1fr; }
.field { display: block; margin-top: 20px; }
.field-row .field { margin-top: 0; }
.field > span { display: block; margin-bottom: 8px; font-size: 12px; font-weight: 750; }
.field input, .field select { width: 100%; min-height: 48px; padding: 0 14px; border: 1px solid #c9d1c3; border-radius: 10px; outline: none; background: white; color: var(--deep); transition: .15s ease; }
.field input:focus, .field select:focus { border-color: var(--forest); box-shadow: 0 0 0 3px rgba(113,152,74,.15); }
.field input[readonly] { cursor: default; background: var(--mist); color: var(--forest); }
.field input.invalid, .field select.invalid { border-color: var(--danger); }
.field small { display: block; margin-top: 7px; color: var(--muted); font-size: 11px; line-height: 1.45; }
.field-note { margin: 12px 0 0; color: var(--muted); font-size: 11px; line-height: 1.55; }
.conditional-address { margin-top: 20px; padding: 18px; border: 1px solid var(--line); border-radius: 14px; background: #fbfcf8; }
.conditional-address > p { margin: 0; color: #485048; font-size: 11px; line-height: 1.55; }
.conditional-address > .field { margin-top: 16px; }
.fixed-purpose-field > span { margin-bottom: 8px; }
.fixed-purpose { margin: 0; padding: 15px 16px; border: 1px solid #c9d1c3; border-radius: 10px; background: var(--mist); color: var(--forest); font-size: 14px; font-weight: 750; line-height: 1.5; }
.inline-input { display: flex; }
.inline-input input { border-radius: 10px 0 0 10px; }
.inline-input button { padding: 0 14px; border: 1px solid #c9d1c3; border-left: 0; border-radius: 0 10px 10px 0; background: var(--mist); color: var(--forest); cursor: pointer; font-size: 11px; font-weight: 800; }
.field-error { min-height: 17px; margin: 7px 0 0; color: var(--danger); font-size: 11px; font-style: normal; }
.form-actions { margin-top: 34px; padding-top: 24px; display: flex; gap: 12px; border-top: 1px solid var(--line); }
.spacer { flex: 1; }
.button { min-height: 48px; padding: 0 22px; border: 1px solid var(--forest); border-radius: 999px; cursor: pointer; font-size: 13px; font-weight: 800; transition: .15s ease; }
.button:hover { transform: translateY(-1px); }
.button:disabled { cursor: wait; opacity: .65; transform: none; }
.button.primary { background: var(--forest); color: white; }
.button.primary:hover { background: #294333; }
.button.secondary { background: transparent; color: var(--forest); }
.button-link { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.icon-label-button { display: inline-flex; gap: 9px; align-items: center; justify-content: center; }
.icon-label-button svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.form-status { min-height: 18px; margin: 12px 0 0; color: var(--danger); text-align: right; font-size: 12px; }

.review-card { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: var(--line); }
.review-item { padding: 15px; background: white; }
.review-item.full { grid-column: 1 / -1; }
.review-item span, .review-item strong { display: block; }
.review-item span { color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.review-item strong { margin-top: 5px; font-size: 13px; overflow-wrap: anywhere; }
.review-creditors { display: grid; gap: 8px; }
.review-creditor { padding-top: 8px; border-top: 1px solid var(--line); }
.review-creditor:first-child { padding-top: 0; border-top: 0; }
.review-creditor strong, .review-creditor small { display: block; }
.review-creditor small { margin-top: 3px; color: var(--muted); font-size: 10px; }
.mandate-copy { margin: 22px 0; padding: 20px; border-left: 3px solid var(--lime); background: var(--mist); }
.mandate-copy h3 { margin-bottom: 10px; font-size: 15px; }
.mandate-copy p { margin-bottom: 8px; color: #3f493f; font-size: 12px; line-height: 1.6; }
.mandate-copy p:last-child { margin-bottom: 0; }
.privacy-summary { margin: 0 0 12px; padding: 18px; border: 1px solid var(--line); border-radius: 12px; color: #485048; font-size: 11px; line-height: 1.55; }
.privacy-summary h3 { margin: 0 0 12px; font-size: 14px; }
.privacy-summary dl { margin: 0; }
.privacy-summary dl div { display: grid; grid-template-columns: 110px 1fr; gap: 12px; padding: 7px 0; border-top: 1px solid #e7eadf; }
.privacy-summary dl div:first-child { padding-top: 0; border-top: 0; }
.privacy-summary dt { color: var(--deep); font-weight: 800; }
.privacy-summary dd { margin: 0; }
.privacy-details { margin: 0 0 22px; border: 1px solid var(--line); border-radius: 12px; background: white; }
.privacy-details summary { padding: 14px 18px; color: var(--forest); cursor: pointer; font-size: 12px; font-weight: 800; }
.privacy-details-content { padding: 0 18px 18px; columns: 2 280px; column-gap: 28px; }
.privacy-details-content section { break-inside: avoid; margin: 0 0 14px; }
.privacy-details-content h4 { margin: 0 0 4px; color: var(--forest); font-size: 11px; }
.privacy-details-content p { margin: 0; color: #485048; font-size: 10.5px; line-height: 1.55; }
.consents { display: grid; gap: 10px; }
.check-row { display: grid; grid-template-columns: 20px 1fr; gap: 10px; align-items: start; color: #3c443d; font-size: 12px; line-height: 1.5; }
.check-row input { width: 18px; height: 18px; margin: 1px 0 0; accent-color: var(--forest); }
.signature-field { margin-top: 22px; }
.signature-pad-field { margin-top: 22px; }
.signature-pad-field legend { padding: 0; font-size: 12px; font-weight: 750; }
.signature-pad-field > p { margin: 7px 0 10px; color: var(--muted); font-size: 11px; }
.signature-canvas-wrap { position: relative; height: 190px; overflow: hidden; border: 1px solid #c9d1c3; border-radius: 12px; background: repeating-linear-gradient(0deg, #fff, #fff 37px, #f0f2ed 38px); touch-action: none; }
.signature-canvas-wrap::after { content: "Signa aquí"; position: absolute; left: 18px; bottom: 14px; color: #a7afa4; font: italic 13px Georgia, serif; pointer-events: none; }
#signatureCanvas { position: relative; z-index: 1; width: 100%; height: 100%; display: block; cursor: crosshair; touch-action: none; }
.signature-pad-actions { min-height: 34px; display: flex; gap: 20px; align-items: flex-start; justify-content: space-between; }
.signature-pad-actions .text-button { white-space: nowrap; }
.form-status.sending { color: var(--forest); }

.completed { text-align: center; }
.success-icon { width: 60px; height: 60px; margin: 0 auto 20px; display: grid; place-items: center; border-radius: 50%; background: var(--lime); color: var(--forest); font-size: 25px; font-weight: 900; }
.completed > p:not(.eyebrow) { max-width: 560px; margin: 0 auto; color: var(--muted); line-height: 1.6; }
.complete-actions { margin: 26px 0 34px; display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.mandate-document { text-align: left; }
.doc-sheet { max-width: 760px; margin: 0 auto 24px; padding: 36px; border: 1px solid var(--line); background: white; }
.doc-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 30px; padding-bottom: 22px; border-bottom: 2px solid var(--forest); }
.doc-head h2 { margin: 0; font-size: 25px; }
.doc-badge { padding: 7px 10px; border: 1px solid var(--forest); border-radius: 999px; color: var(--forest); white-space: nowrap; font-size: 10px; font-weight: 800; }
.doc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 25px; margin: 22px 0; }
.doc-field { padding: 11px 0; border-bottom: 1px solid #e4e6e1; }
.doc-field.full { grid-column: 1 / -1; }
.doc-field span, .doc-field strong { display: block; }
.doc-field span { color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.doc-field strong { margin-top: 5px; font-size: 12px; overflow-wrap: anywhere; }
.doc-creditor-list { grid-column: 1 / -1; display: grid; gap: 10px; margin-bottom: 8px; }
.doc-creditor { padding: 12px 14px; border: 1px solid #dce1d7; border-radius: 8px; background: #fbfcf8; }
.doc-creditor strong, .doc-creditor span { display: block; }
.doc-creditor strong { color: var(--forest); font-size: 12px; }
.doc-creditor span { margin-top: 4px; color: #555f56; font-size: 9px; line-height: 1.45; overflow-wrap: anywhere; }
.doc-legal { color: #394039; font-size: 10px; line-height: 1.55; }
.doc-sign { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 25px; }
.doc-sign div { min-height: 70px; padding-top: 10px; border-top: 1px solid var(--deep); }
.doc-sign span, .doc-sign strong { display: block; }
.doc-sign span { color: var(--muted); font-size: 9px; }
.doc-sign strong { margin-top: 6px; font: italic 17px Georgia, serif; }
.doc-signature-image { max-width: 220px; max-height: 80px; margin-top: 6px; object-fit: contain; object-position: left center; }
.doc-basic-privacy { margin-top: 22px; padding: 14px; border: 1px solid var(--line); border-radius: 8px; background: #fbfcf8; }
.doc-basic-privacy h3 { margin: 0 0 6px; font-size: 11px; }
.doc-basic-privacy p { margin: 0; color: #4d564e; font-size: 9px; line-height: 1.5; }
.doc-privacy-policy { margin-top: 24px; columns: 2 280px; column-gap: 30px; }
.doc-privacy-policy section { break-inside: avoid; margin: 0 0 16px; }
.doc-privacy-policy h3 { margin: 0 0 5px; font-size: 11px; }
.doc-privacy-policy p { margin: 0; color: #414941; font-size: 9.5px; line-height: 1.55; }
.doc-foot { margin-top: 25px; color: var(--muted); font-size: 9px; text-align: center; }

.info-section { max-width: 1180px; margin: 0 auto; padding: 75px 28px; display: grid; grid-template-columns: .7fr 1.3fr; gap: 70px; }
.info-section p { color: var(--muted); font-size: 13px; line-height: 1.65; }
.entity-list { border-top: 1px solid var(--line); }
.entity-list article { display: grid; grid-template-columns: .8fr 1.2fr; gap: 24px; padding: 18px 0; border-bottom: 1px solid var(--line); font-size: 12px; }
.entity-list span { color: var(--muted); }
footer { max-width: 1180px; margin: 0 auto; padding: 26px 28px 34px; display: flex; justify-content: space-between; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; }

dialog { width: min(620px, calc(100% - 32px)); padding: 0; border: 0; border-radius: 22px; box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(25,35,29,.58); backdrop-filter: blur(3px); }
dialog form { padding: 30px; }
.dialog-head { display: flex; justify-content: space-between; align-items: flex-start; }
.dialog-copy { color: var(--muted); font-size: 12px; line-height: 1.6; }
.notice { margin: 20px 0 0; padding: 12px 14px; border-radius: 10px; background: #fff7dc; color: #62541b; font-size: 11px; line-height: 1.5; }
.dialog-actions { margin-top: 24px; display: flex; gap: 10px; justify-content: flex-end; }
.save-dialog { width: min(480px, calc(100% - 28px)); max-height: calc(100dvh - 28px); overflow: auto; text-align: center; }
.save-dialog-content { position: relative; padding: clamp(28px, 7vw, 44px); }
.save-dialog-close { position: absolute; top: 12px; right: 12px; }
.save-document-icon { width: 70px; height: 70px; margin: 0 auto 19px; display: grid; place-items: center; border-radius: 22px; background: var(--lime); color: var(--forest); }
.save-document-icon svg { width: 38px; height: 38px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.save-dialog h2 { margin-bottom: 14px; font-size: clamp(29px, 8vw, 38px); }
.save-dialog-content > p:not(.eyebrow, .save-dialog-status) { margin-bottom: 24px; color: var(--muted); font-size: 14px; line-height: 1.65; }
.save-dialog-content > p strong { color: var(--deep); overflow-wrap: anywhere; }
.delivery-note a { color: var(--forest); font-weight: 800; }
.save-pdf-button { width: 100%; min-height: 56px; font-size: 15px; }
.save-dialog .text-button { margin-top: 19px; }
.save-dialog-status { min-height: 20px; margin: 15px 0 0; color: var(--muted); font-size: 12px; }
.save-dialog-status[data-state="ready"] { color: var(--forest); font-weight: 750; }
.save-dialog-status[data-state="error"] { color: var(--danger); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

@media (max-width: 760px) {
  .site-header { padding: 18px; }
  .brand { gap: 8px; }
  .brand-logo { width: 158px; }
  .brand-context { display: none; }
  .privacy-pill { font-size: 0; }
  .privacy-pill span { font-size: 10px; }
  .intro { margin-top: 20px; padding: 0 18px; grid-template-columns: 1fr; gap: 25px; }
  h1 { font-size: clamp(39px, 13vw, 58px); }
  .workspace { padding: 28px 12px 50px; }
  .progress b { display: none; }
  .progress li { justify-content: center; }
  .progress li::after { left: calc(50% + 24px); right: calc(-50% + 24px); }
  .form-shell { padding: 22px 16px; border-radius: 18px; }
  .step-heading { display: block; }
  .step-heading .text-button { margin-top: 10px; }
  .creditor-grid, .field-row.two, .field-row.three, .review-card, .doc-grid, .doc-sign { grid-template-columns: 1fr; }
  .privacy-summary dl div { grid-template-columns: 1fr; gap: 3px; }
  .privacy-details-content, .doc-privacy-policy { columns: 1; }
  .review-item.full, .doc-field.full { grid-column: auto; }
  .choice-card { min-height: 90px; }
  .button { width: 100%; }
  .form-actions { flex-wrap: wrap; }
  .spacer { display: none; }
  .complete-actions { display: grid; }
  .doc-sheet { padding: 22px 18px; }
  .doc-head { display: block; }
  .doc-badge { display: inline-block; margin-top: 14px; }
  .info-section { padding: 55px 18px; grid-template-columns: 1fr; gap: 25px; }
  .entity-list article { grid-template-columns: 1fr; gap: 6px; }
  footer { margin: 0 18px; padding: 24px 0; flex-direction: column; gap: 8px; }
}

@media print {
  body { background: white; }
  .site-header, .intro, .progress-wrap, #sepaForm, .completed > :not(.mandate-document), .info-section, footer { display: none !important; }
  .workspace, .form-shell { margin: 0; padding: 0; background: white; box-shadow: none; }
  .form-shell, .completed, .mandate-document, .doc-sheet { display: block !important; width: 100%; max-width: none; border: 0; }
  .doc-sheet { padding: 12mm; break-after: page; }
  .doc-sheet:last-child { break-after: auto; }
  @page { size: A4; margin: 10mm; }
}
