:root {
    --n41-bg: #f5f8fb;
    --n41-bg-soft: #eef5fa;
    --n41-ink: #122033;
    --n41-text: #1f2f43;
    --n41-muted: #66758a;
    --n41-subtle: #8a98aa;
    --n41-card: #ffffff;
    --n41-card-soft: #f8fbfd;
    --n41-line: #e4ebf2;
    --n41-line-strong: #ccd8e5;
    --n41-primary: #20364d;
    --n41-primary-hover: #17283b;
    --n41-primary-soft: #e9f0f7;
    --n41-accent: #24768b;
    --n41-accent-soft: #e7f5f8;
    --n41-danger: #b64343;
    --n41-danger-soft: #fff1f1;
    --n41-ok: #177a55;
    --n41-ok-soft: #e8f6ef;
    --n41-shadow: 0 18px 50px rgba(18, 32, 51, .09);
    --n41-shadow-soft: 0 12px 34px rgba(18, 32, 51, .07);
    --n41-focus: 0 0 0 4px rgba(36, 118, 139, .16);
    --n41-radius: 22px;
    --n41-radius-sm: 14px;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body.testamentos-publico,
body.testamentos-solicitud {
    min-height: 100vh;
    margin: 0;
    background:
        radial-gradient(circle at 8% 0%, rgba(36, 118, 139, .11), transparent 34rem),
        radial-gradient(circle at 94% 12%, rgba(32, 54, 77, .08), transparent 30rem),
        linear-gradient(180deg, #fbfdff 0%, var(--n41-bg) 48%, #eef4f8 100%);
    color: var(--n41-text);
    font-family: Inter, "Segoe UI", Arial, sans-serif;
    font-size: 15px;
    line-height: 1.55;
    text-rendering: optimizeLegibility;
}

body.testamentos-publico::before,
body.testamentos-solicitud::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    background-image:
        linear-gradient(rgba(32, 54, 77, .035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(32, 54, 77, .035) 1px, transparent 1px);
    background-size: 44px 44px;
    mask-image: linear-gradient(180deg, rgba(0, 0, 0, .45), transparent 62%);
    pointer-events: none;
}

.testamentos-shell {
    min-height: 100vh;
}

.testamentos-topbar {
    position: relative;
    overflow: hidden;
    padding: 34px 0 112px;
    border: 0;
    background:
        linear-gradient(135deg, rgba(32, 54, 77, .98) 0%, rgba(22, 39, 57, .98) 68%),
        var(--n41-primary);
    color: #fff;
}

.testamentos-topbar::after {
    content: "";
    position: absolute;
    right: -10rem;
    top: -16rem;
    width: 34rem;
    height: 34rem;
    border-radius: 999px;
    background: rgba(103, 188, 204, .14);
    filter: blur(4px);
}

.testamentos-topbar .container,
.testamentos-wrap {
    position: relative;
    z-index: 1;
    width: min(1160px, calc(100% - 32px));
    max-width: none;
}

.testamentos-brand {
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 0;
}

.testamentos-brand img {
    width: 64px;
    height: 64px;
    object-fit: contain;
    border-radius: 18px;
    background: rgba(255, 255, 255, .94);
    box-shadow: 0 16px 36px rgba(0, 0, 0, .18);
    padding: 8px;
}

.testamentos-brand h1 {
    margin: 3px 0 4px;
    color: #fff;
    font-size: clamp(34px, 5vw, 58px);
    font-weight: 900;
    letter-spacing: -.045em;
    line-height: .98;
}

.testamentos-brand h1::before {
    content: "Tramite publico";
    display: flex;
    width: max-content;
    margin-bottom: 8px;
    color: #8bd4df;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.testamentos-brand p {
    max-width: 680px;
    margin: 0;
    color: rgba(235, 244, 250, .86);
    font-size: 16px;
}

.testamentos-main {
    padding: 0 0 72px;
}

.testamentos-wrap {
    margin-top: -70px;
}

.testamentos-panel {
    overflow: hidden;
    border: 1px solid rgba(204, 216, 229, .72);
    border-radius: 30px;
    background: rgba(255, 255, 255, .94);
    box-shadow: var(--n41-shadow);
    backdrop-filter: blur(16px);
}

.testamentos-panel-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    border: 0;
    border-bottom: 1px solid var(--n41-line);
    background: transparent;
    padding: 34px 38px 24px;
}

.testamentos-panel-header h2,
.testamentos-panel-header h3 {
    margin: 0;
    color: var(--n41-ink);
    font-size: clamp(27px, 3vw, 38px);
    font-weight: 900;
    letter-spacing: -.035em;
    line-height: 1.08;
}

.testamentos-panel-header p {
    max-width: 680px;
    margin: 10px 0 0;
    color: var(--n41-muted);
    font-size: 15px;
}

.testamentos-panel-body {
    padding: 30px 38px 38px;
}

.testamentos-tip {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin: 0 0 22px;
    border: 1px solid rgba(36, 118, 139, .18);
    border-radius: 18px;
    padding: 14px 16px;
    background: linear-gradient(180deg, rgba(231, 245, 248, .82), rgba(248, 251, 253, .95));
    color: var(--n41-muted);
    font-size: 14px;
}

.testamentos-tip::before {
    content: "i";
    display: inline-grid;
    flex: 0 0 auto;
    width: 24px;
    height: 24px;
    place-items: center;
    border-radius: 999px;
    background: var(--n41-accent);
    color: #fff;
    font-size: 13px;
    font-weight: 900;
    font-style: italic;
}

body.testamentos-publico #miFormulario.form,
body.testamentos-solicitud #miFormulario.form,
.testamento-form {
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    border: 1px solid rgba(204, 216, 229, .78) !important;
    border-radius: 26px !important;
    padding: 30px !important;
    background: rgba(255, 255, 255, .96) !important;
    box-shadow: var(--n41-shadow-soft) !important;
}

body.testamentos-publico #miFormulario fieldset,
body.testamentos-solicitud #miFormulario fieldset,
.testamento-form fieldset {
    min-width: 0;
    margin: 0;
    border: 0;
    padding: 0;
}

body.testamentos-publico #miFormulario legend,
body.testamentos-solicitud #miFormulario legend,
.testamento-form legend {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    margin: 0 0 24px !important;
    color: var(--n41-ink);
    font-size: 18px;
    font-weight: 900;
    letter-spacing: -.02em;
    line-height: 1.2;
    text-align: left !important;
}

body.testamentos-publico #miFormulario legend::before,
body.testamentos-solicitud #miFormulario legend::before,
.testamento-form legend::before {
    content: "";
    display: inline-grid;
    width: 36px;
    height: 36px;
    place-items: center;
    border-radius: 12px;
    background: var(--n41-primary-soft);
    box-shadow: inset 0 0 0 10px #fff, inset 0 0 0 12px var(--n41-accent);
}

body.testamentos-publico #miFormulario .row,
body.testamentos-solicitud #miFormulario .row {
    row-gap: 18px;
}

body.testamentos-publico #miFormulario .mb-3,
body.testamentos-solicitud #miFormulario .mb-3 {
    margin-bottom: 18px !important;
}

body.testamentos-publico #miFormulario label,
body.testamentos-solicitud #miFormulario label,
.testamento-form label {
    display: block;
    margin-bottom: 7px !important;
    color: var(--n41-ink);
    font-size: 13px;
    font-weight: 800;
}

body.testamentos-publico #miFormulario .form-control,
body.testamentos-publico #miFormulario .form-select,
body.testamentos-solicitud #miFormulario .form-control,
body.testamentos-solicitud #miFormulario .form-select,
.testamento-form .form-control,
.testamento-form .form-select {
    width: 100%;
    min-height: 48px;
    border: 1px solid var(--n41-line-strong) !important;
    border-radius: var(--n41-radius-sm) !important;
    background: #fff !important;
    color: var(--n41-text);
    box-shadow: none !important;
    font: inherit;
    font-size: 14px;
    margin-bottom: 0 !important;
    padding: 12px 14px !important;
    outline: 0;
    transition: border-color .18s ease, box-shadow .18s ease, background .18s ease, transform .18s ease;
}

body.testamentos-publico #miFormulario .form-control:hover,
body.testamentos-publico #miFormulario .form-select:hover,
body.testamentos-solicitud #miFormulario .form-control:hover,
body.testamentos-solicitud #miFormulario .form-select:hover {
    border-color: #b8c7d8 !important;
}

body.testamentos-publico #miFormulario .form-control:focus,
body.testamentos-publico #miFormulario .form-select:focus,
body.testamentos-solicitud #miFormulario .form-control:focus,
body.testamentos-solicitud #miFormulario .form-select:focus,
.testamento-form .form-control:focus,
.testamento-form .form-select:focus {
    border-color: var(--n41-accent) !important;
    box-shadow: var(--n41-focus) !important;
    background: #fff !important;
}

body.testamentos-publico #miFormulario select.form-control,
body.testamentos-solicitud #miFormulario select.form-control {
    cursor: pointer;
}

body.testamentos-publico #miFormulario input[type="file"],
body.testamentos-solicitud #miFormulario input[type="file"],
.testamento-step input[type="file"] {
    min-height: 54px;
    border-style: dashed !important;
    background: var(--n41-card-soft) !important;
}

body.testamentos-publico #miFormulario input[type="file"]::file-selector-button,
body.testamentos-solicitud #miFormulario input[type="file"]::file-selector-button,
.testamento-step input[type="file"]::file-selector-button {
    margin-right: 12px;
    border: 0;
    border-radius: 999px;
    background: var(--n41-primary);
    color: #fff;
    padding: 8px 12px;
    font-weight: 800;
    cursor: pointer;
}

body.testamentos-publico #miFormulario ::placeholder,
body.testamentos-solicitud #miFormulario ::placeholder {
    color: var(--n41-subtle);
}

.testamento-step-nav {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    border-bottom: 1px solid var(--n41-line);
    background: var(--n41-card-soft);
    padding: 16px 30px;
}

.testamento-step-nav button {
    flex: 0 0 auto;
    border: 1px solid var(--n41-line-strong);
    border-radius: 999px;
    background: #fff;
    color: var(--n41-ink);
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 800;
    transition: background .18s ease, color .18s ease, border-color .18s ease, transform .18s ease;
}

.testamento-step-nav button:hover {
    transform: translateY(-1px);
    border-color: rgba(36, 118, 139, .34);
    background: var(--n41-accent-soft);
}

.testamento-step-nav button.is-active {
    border-color: var(--n41-primary);
    background: var(--n41-primary);
    color: #fff;
}

.testamentos-section,
.testamento-step {
    border-top: 1px solid var(--n41-line);
    margin-top: 24px;
    padding-top: 24px;
}

.testamento-step:first-of-type {
    border-top: 0;
    margin-top: 0;
    padding-top: 0;
}

.testamento-step h4,
.testamentos-section h4 {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 20px;
    color: var(--n41-ink);
    font-size: 18px;
    font-weight: 900;
    letter-spacing: -.02em;
}

.testamento-step h4::before,
.testamentos-section h4::before {
    content: "";
    display: inline-block;
    width: 8px;
    height: 28px;
    border-radius: 999px;
    background: var(--n41-accent);
}

.testamento-step-help {
    margin: -8px 0 18px;
    border: 1px solid rgba(36, 118, 139, .18);
    border-radius: 16px;
    background: var(--n41-accent-soft);
    color: var(--n41-muted);
    padding: 12px 14px;
}

.testamento-step[hidden] {
    display: none !important;
}

.testamento-actions {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    border-top: 1px solid var(--n41-line);
    margin-top: 24px;
    padding-top: 24px;
}

.btn-n41,
.btn-primary,
.btn-success,
.btn-secondary,
body.testamentos-publico input[type="submit"].btn,
body.testamentos-solicitud input[type="submit"].btn {
    display: inline-flex !important;
    min-height: 44px !important;
    align-items: center;
    justify-content: center;
    gap: 9px;
    border: 1px solid var(--n41-primary) !important;
    border-radius: 999px !important;
    background: var(--n41-primary) !important;
    color: #fff !important;
    box-shadow: 0 12px 24px rgba(32, 54, 77, .18);
    font-family: inherit;
    font-size: 14px;
    font-weight: 900 !important;
    padding: 11px 18px !important;
    text-decoration: none;
    transition: transform .18s ease, box-shadow .18s ease, background .18s ease, border-color .18s ease;
}

.btn-n41:hover,
.btn-primary:hover,
.btn-success:hover,
.btn-secondary:hover,
body.testamentos-publico input[type="submit"].btn:hover,
body.testamentos-solicitud input[type="submit"].btn:hover {
    transform: translateY(-1px);
    border-color: var(--n41-primary-hover) !important;
    background: var(--n41-primary-hover) !important;
    box-shadow: 0 16px 30px rgba(32, 54, 77, .22);
    color: #fff !important;
}

.btn-outline-n41 {
    display: inline-flex;
    min-height: 42px;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--n41-line-strong) !important;
    border-radius: 999px !important;
    background: #fff !important;
    color: var(--n41-primary) !important;
    font-weight: 900;
    padding: 10px 16px;
    transition: transform .18s ease, background .18s ease, border-color .18s ease;
}

.btn-outline-n41:hover {
    transform: translateY(-1px);
    border-color: rgba(36, 118, 139, .34) !important;
    background: var(--n41-accent-soft) !important;
    color: var(--n41-primary) !important;
}

.btn-n41:focus-visible,
.btn-primary:focus-visible,
.btn-success:focus-visible,
.btn-secondary:focus-visible,
.btn-outline-n41:focus-visible,
body.testamentos-publico input[type="submit"].btn:focus-visible,
body.testamentos-solicitud input[type="submit"].btn:focus-visible {
    outline: 0;
    box-shadow: var(--n41-focus) !important;
}

.alert {
    border: 0;
    border-radius: 18px;
    padding: 14px 16px;
    font-size: 14px;
    font-weight: 700;
}

.alert-danger {
    background: var(--n41-danger-soft);
    color: var(--n41-danger);
}

.modal-dialog {
    max-width: min(920px, calc(100% - 28px)) !important;
}

.modal-content {
    overflow: hidden;
    border: 1px solid rgba(204, 216, 229, .82) !important;
    border-radius: 24px !important;
    box-shadow: 0 26px 70px rgba(18, 32, 51, .22) !important;
}

.modal-header,
.modal-footer {
    border-color: var(--n41-line) !important;
    background: var(--n41-card-soft);
}

.modal-title {
    color: var(--n41-ink);
    font-weight: 900;
}

.modal-body h5 {
    color: var(--n41-ink);
    font-weight: 900;
}

.modal-body p,
.modal-body li {
    color: var(--n41-muted);
}

.testamento-file-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 14px;
}

.testamento-file-grid .mb-3 {
    min-height: 100%;
    border: 1px solid var(--n41-line);
    border-radius: 18px;
    background: #fff;
    padding: 14px;
}

.testamento-file-grid .form-label {
    display: block;
    margin-bottom: 10px;
}

.testamento-file-grid small,
.campo-ayuda {
    color: var(--n41-muted) !important;
}

.add_button,
.add_button2,
.add_buttonf,
.add_buttonh,
.add_buttons {
    width: auto !important;
    height: auto !important;
    min-height: 40px;
    border: 0 !important;
    border-radius: 999px !important;
    background: var(--n41-primary) !important;
    color: #fff !important;
    padding: 8px 13px !important;
    font-weight: 900;
}

.add_button:hover,
.add_button2:hover,
.add_buttonf:hover,
.add_buttonh:hover,
.add_buttons:hover {
    background: var(--n41-primary-hover) !important;
}

.add_button::after,
.add_button2::after,
.add_buttonf::after {
    content: "Agregar hijo";
}

.add_buttonh::after {
    content: "Agregar heredero";
}

.add_buttons::after {
    content: "Agregar sustituto";
}

.remove_circle,
.remove_buttont {
    border: 0 !important;
    border-radius: 999px !important;
    background: var(--n41-danger) !important;
    color: #fff !important;
}

.archivo-seleccionado {
    color: var(--n41-ok);
    font-weight: 800;
}

.border-primary {
    border-color: var(--n41-line-strong) !important;
}

.shadow {
    box-shadow: none !important;
}

.bg-light {
    background-color: #fff !important;
}

.testamentos-footer {
    padding: 24px 0 32px;
    color: var(--n41-muted);
    text-align: center;
    font-size: 13px;
}

.testamentos-footer a {
    color: var(--n41-primary);
    font-weight: 800;
    text-decoration: none;
}

.testamentos-footer a:hover {
    text-decoration: underline;
}

@media (max-width: 900px) {
    .testamentos-topbar {
        padding: 26px 0 92px;
    }

    .testamentos-panel-header {
        display: block;
    }

    .testamentos-panel-header .btn {
        margin-top: 18px !important;
    }
}

@media (max-width: 767px) {
    body.testamentos-publico,
    body.testamentos-solicitud {
        font-size: 14px;
    }

    .testamentos-topbar .container,
    .testamentos-wrap {
        width: min(100% - 24px, 1160px);
    }

    .testamentos-brand {
        align-items: flex-start;
    }

    .testamentos-brand img {
        width: 54px;
        height: 54px;
        border-radius: 15px;
    }

    .testamentos-brand h1 {
        font-size: 32px;
    }

    .testamentos-brand p {
        font-size: 14px;
    }

    .testamentos-panel {
        border-radius: 24px;
    }

    .testamentos-panel-header,
    .testamentos-panel-body,
    .testamento-step-nav {
        padding-left: 18px;
        padding-right: 18px;
    }

    body.testamentos-publico #miFormulario.form,
    body.testamentos-solicitud #miFormulario.form,
    .testamento-form {
        padding: 22px 18px !important;
        border-radius: 22px !important;
    }

    .testamento-actions,
    .testamentos-panel-header,
    body.testamentos-publico #miFormulario .d-flex.justify-content-end,
    body.testamentos-solicitud #miFormulario .d-flex.justify-content-end {
        flex-direction: column;
        align-items: stretch !important;
    }

    .btn-n41,
    .btn-primary,
    .btn-success,
    .btn-secondary,
    .btn-outline-n41,
    body.testamentos-publico input[type="submit"].btn,
    body.testamentos-solicitud input[type="submit"].btn {
        width: 100%;
    }
}
