:root {
    --primary: #1d4ed8;
    --primary-hover: #1e40af;
    --accent: #0ea5e9;
    --accent-soft: rgba(14, 165, 233, 0.14);
    --secondary: #eef2ff;
    --secondary-hover: #dbeafe;
    --surface: #ffffff;
    --surface-strong: #f8fbff;
    --surface-soft: #f1f5f9;
    --background: #eff6ff;
    --background-alt: #f8fafc;
    --text-main: #0f172a;
    --text-muted: #475569;
    --border: #dbeafe;
    --success: #16a34a;
    --danger: #dc2626;
    --radius: 18px;
    --shadow: 0 18px 45px -18px rgba(15, 23, 42, 0.18), 0 8px 18px -12px rgba(15, 23, 42, 0.08);
    --shadow-hover: 0 22px 55px -20px rgba(15, 23, 42, 0.2), 0 12px 18px -10px rgba(15, 23, 42, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

input,
select,
textarea,
button {
    max-width: 100%;
    min-width: 0;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--background);
    background-image: radial-gradient(circle at 100% 0%, #e0e7ff 0%, transparent 40%),
                      radial-gradient(circle at 0% 100%, #dbeafe 0%, transparent 40%);
    color: var(--text-main);
    line-height: 1.6;
    min-height: 100vh;
    padding: clamp(0.75rem, 2vw, 2rem) clamp(0.5rem, 2vw, 1rem);
}

.container {
    width: min(100%, 1000px);
    max-width: 1000px;
    margin: 0 auto;
}

.header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: clamp(1rem, 3vw, 2rem);
    text-align: left;
    margin-bottom: 2.5rem;
}

.header-logo {
    width: clamp(105px, 16vw, 155px);
    height: auto;
    max-height: 72px;
    object-fit: contain;
    flex: 0 0 auto;
}

.header-copy {
    min-width: 0;
}

.title {
    font-size: clamp(1.55rem, 4vw, 2.25rem);
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.5rem;
    letter-spacing: 0;
}

.subtitle {
    color: var(--text-muted);
    font-size: clamp(0.92rem, 2vw, 1.1rem);
}

@media (max-width: 900px) {
    .glass-panel {
        padding: 1.75rem;
    }

    .contact-table {
        min-width: 0;
    }

    .contact-table th:first-child,
    .contact-table td:first-child,
    .accionistas-table th:first-child,
    .accionistas-table td:first-child {
        min-width: auto;
    }
}

@media (max-width: 768px) {
    .row-split {
        grid-template-columns: 1fr;
    }

    .options,
    .stacked-options {
        flex-direction: column;
    }

    .options label,
    .stacked-options label {
        width: 100%;
    }
}

@media (max-width: 640px) {
    .header {
        flex-direction: column;
        text-align: center;
        gap: 0.75rem;
        margin-bottom: 1.75rem;
    }

    .header-logo {
        width: 118px;
        max-height: 56px;
    }

    .title {
        font-size: 1.65rem;
    }

    .subtitle {
        font-size: 0.98rem;
    }
}

/* Glass panel */
.glass-panel {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: var(--radius);
    padding: 1.75rem;
    box-shadow: var(--shadow);
}

.form-section {
    margin-bottom: 1.35rem;
}

.form-section h2 {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-section h2 i {
    color: var(--primary);
}

.flex-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.flex-header h2 {
    margin-bottom: 0;
}

.badge {
    background: #eff6ff;
    color: var(--primary);
    padding: 0.3rem 0.8rem;
    border-radius: 99px;
    font-size: 0.8rem;
    font-weight: 600;
}

.help-text {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 1rem;
}

body {
    position: relative;
    overflow-x: hidden;
}

body::before {
    content: none;
}

.container {
    position: relative;
    z-index: 1;
}

.contact-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.contact-table-wrap {
    width: 100%;
    overflow-x: auto;
    margin-bottom: 1.5rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.contact-table {
    width: 100%;
    min-width: 960px;
    border-collapse: collapse;
    background: var(--surface);
}

.contact-table th,
.contact-table td {
    padding: 0.65rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.accionistas-table th:last-child,
.accionistas-table td:last-child {
    width: 110px;
    text-align: center;
}

.contact-table th:first-child,
.contact-table td:first-child {
    width: 180px;
    min-width: 180px;
}

.contact-table td input,
.contact-table td select {
    width: 100%;
    min-height: 40px;
    padding: 0.62rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.95rem;
    background: var(--surface);
    transition: all 0.2s;
}

.contact-table td input:focus,
.contact-table td select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(15, 82, 186, 0.15);
}

/* Responsive guardrails: keep this block last so it wins the cascade. */
@media (max-width: 1100px) {
    .container {
        width: 100%;
    }

    .glass-panel {
        padding: 1.35rem;
    }

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

    .tax-question {
        grid-template-columns: minmax(190px, 235px) 1fr;
    }

    .contact-table {
        min-width: 860px;
    }

    .accionistas-table {
        min-width: 880px;
    }
}

@media (max-width: 860px) {
    .header {
        align-items: center;
        margin-bottom: 1.5rem;
    }

    .glass-panel {
        border-radius: 12px;
        padding: 1rem;
    }

    .form-section {
        margin-bottom: 1rem;
    }

    .divider {
        margin: 1.5rem 0;
    }

    .flex-header,
    .contact-controls {
        align-items: flex-start;
        flex-direction: column;
        gap: 0.65rem;
    }

    .badge {
        width: fit-content;
    }

    .grid-2,
    .row-split {
        grid-template-columns: 1fr;
        gap: 0.8rem;
    }

    .grid-2 > [style*="grid-column: span 2"],
    .row-split > [style*="grid-column: span 2"] {
        grid-column: 1 / -1 !important;
    }

    .tax-question {
        grid-template-columns: 1fr;
        gap: 0.6rem;
    }

    .tax-question .options,
    .tax-question .stacked-options {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
        width: 100%;
    }

    .tax-question .options label,
    .tax-question .stacked-options label {
        width: 100%;
        min-width: 0;
    }

    .row-radio {
        align-items: stretch;
        flex-direction: column;
        gap: 0.65rem;
    }

    .row-radio .options {
        flex: 0 0 auto;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        justify-content: stretch;
        width: 100%;
    }

    .row-radio .options label {
        width: 100%;
        min-width: 0;
    }
}

@media (max-width: 720px) {
    body {
        padding: 0;
        background-image: none;
    }

    .container {
        max-width: none;
    }

    .header {
        padding: 1rem 0.85rem 0;
    }

    .glass-panel {
        border-left: 0;
        border-right: 0;
        border-radius: 0;
        padding: 0.9rem;
    }

    .contact-table-wrap {
        overflow-x: visible;
        box-shadow: none;
        border-radius: 0;
    }

    .contact-table,
    .accionistas-table {
        display: block;
        min-width: 0;
        margin-bottom: 1rem;
        background: transparent;
        box-shadow: none;
    }

    .contact-table thead {
        display: none;
    }

    .contact-table tbody,
    .contact-table tr,
    .contact-table td {
        display: block;
        width: 100%;
        min-width: 0;
    }

    .contact-table tr {
        background: var(--surface);
        border: 1px solid var(--border);
        border-radius: 8px;
        margin-bottom: 0.85rem;
        padding: 0.65rem;
        box-shadow: 0 10px 24px -20px rgba(15, 23, 42, 0.35);
    }

    .contact-table td {
        border-bottom: 0;
        padding: 0.35rem 0;
    }

    .contact-table td::before {
        display: block;
        margin-bottom: 0.25rem;
        color: var(--text-muted);
        font-size: 0.78rem;
        font-weight: 600;
    }

    .accionistas-table td:nth-child(1)::before { content: "Tipo de identificacion"; }
    .accionistas-table td:nth-child(2)::before { content: "Numero de identificacion"; }
    .accionistas-table td:nth-child(3)::before { content: "Nombre completo"; }
    .accionistas-table td:nth-child(4)::before { content: "% participacion"; }
    .accionistas-table td:nth-child(5)::before { content: "Accion"; }

    .contact-table:not(.accionistas-table) td:nth-child(1)::before { content: "Contacto"; }
    .contact-table:not(.accionistas-table) td:nth-child(2)::before { content: "Nombre"; }
    .contact-table:not(.accionistas-table) td:nth-child(3)::before { content: "Cargo"; }
    .contact-table:not(.accionistas-table) td:nth-child(4)::before { content: "Telefono"; }
    .contact-table:not(.accionistas-table) td:nth-child(5)::before { content: "Correo"; }

    .accionistas-table th:last-child,
    .accionistas-table td:last-child {
        width: 100%;
        text-align: left;
    }

    .accionistas-table .form-select {
        height: 42px;
    }

    .btn,
    .btn-small {
        width: 100%;
        min-height: 42px;
        padding: 0.65rem 0.85rem;
    }

    .btn-icon {
        width: auto;
        min-width: 44px;
    }

    .submit-area {
        margin-top: 1.5rem;
    }
}

@media (max-width: 480px) {
    .header {
        flex-direction: column;
        text-align: center;
    }

    .header-logo {
        width: 104px;
        max-height: 52px;
    }

    .form-section h2 {
        align-items: flex-start;
        font-size: 1.05rem;
        line-height: 1.35;
    }

    .pep-section,
    .legal-box,
    .conditional-fields,
    .tax-question {
        padding: 0.75rem;
    }

    .tax-question .options,
    .tax-question .stacked-options {
        grid-template-columns: 1fr;
    }

    .row-radio .options {
        grid-template-columns: 1fr 1fr;
    }

    .options label,
    .stacked-options label {
        min-height: 40px;
        padding: 0.55rem 0.65rem;
    }

    .input-group input,
    .input-group select,
    .contact-table td input,
    .contact-table td select {
        font-size: 16px;
        min-height: 42px;
    }

    .full-checkbox {
        border-radius: 8px;
        padding: 0.75rem;
    }
}

@media (max-width: 360px) {
    .glass-panel {
        padding: 0.7rem;
    }

    .row-radio .options {
        grid-template-columns: 1fr;
    }

    .title {
        font-size: 1.35rem;
    }
}

/* Compact grid cards: avoid inner two-column layouts inside already narrow cards. */
.grid-2 > .tax-question {
    grid-template-columns: 1fr;
    align-content: start;
    min-width: 0;
}

.grid-2 > .tax-question .options {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
}

.grid-2 > .tax-question .options label {
    width: 100%;
    min-width: 0;
}

.grid-2 > .tax-question .input-group,
.grid-2 > .tax-question input[type="file"] {
    width: 100%;
    min-width: 0;
}

.grid-2 > .tax-question input[type="file"] {
    font-size: 0.85rem;
}

@media (max-width: 420px) {
    .grid-2 > .tax-question .options {
        grid-template-columns: 1fr;
    }
}

/* Compact grid cards: avoid inner two-column layouts inside already narrow cards. */
.grid-2 > .tax-question {
    grid-template-columns: 1fr;
    align-content: start;
    min-width: 0;
}

.grid-2 > .tax-question .options {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
}

.grid-2 > .tax-question .options label {
    width: 100%;
    min-width: 0;
}

.grid-2 > .tax-question .input-group,
.grid-2 > .tax-question input[type="file"] {
    width: 100%;
    min-width: 0;
}

.grid-2 > .tax-question input[type="file"] {
    font-size: 0.85rem;
}

@media (max-width: 420px) {
    .grid-2 > .tax-question .options {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 1100px) {
    .container {
        width: 100%;
    }

    .glass-panel {
        padding: 1.35rem;
    }

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

    .tax-question {
        grid-template-columns: minmax(190px, 235px) 1fr;
    }

    .contact-table {
        min-width: 860px;
    }

    .accionistas-table {
        min-width: 880px;
    }
}

@media (max-width: 860px) {
    .header {
        align-items: center;
        margin-bottom: 1.5rem;
    }

    .glass-panel {
        border-radius: 12px;
        padding: 1rem;
    }

    .form-section {
        margin-bottom: 1rem;
    }

    .divider {
        margin: 1.5rem 0;
    }

    .flex-header,
    .contact-controls {
        align-items: flex-start;
        flex-direction: column;
        gap: 0.65rem;
    }

    .badge {
        width: fit-content;
    }

    .grid-2,
    .row-split {
        grid-template-columns: 1fr;
        gap: 0.8rem;
    }

    .grid-2 > [style*="grid-column: span 2"],
    .row-split > [style*="grid-column: span 2"] {
        grid-column: 1 / -1 !important;
    }

    .tax-question {
        grid-template-columns: 1fr;
        gap: 0.6rem;
    }

    .tax-question .options,
    .tax-question .stacked-options {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
        width: 100%;
    }

    .tax-question .options label,
    .tax-question .stacked-options label {
        width: 100%;
        min-width: 0;
    }

    .row-radio {
        align-items: stretch;
        flex-direction: column;
        gap: 0.65rem;
    }

    .row-radio .options {
        flex: 0 0 auto;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        justify-content: stretch;
        width: 100%;
    }

    .row-radio .options label {
        width: 100%;
        min-width: 0;
    }
}

@media (max-width: 720px) {
    body {
        padding: 0;
        background-image: none;
    }

    .container {
        max-width: none;
    }

    .header {
        padding: 1rem 0.85rem 0;
    }

    .glass-panel {
        border-left: 0;
        border-right: 0;
        border-radius: 0;
        padding: 0.9rem;
    }

    .contact-table-wrap {
        overflow-x: visible;
        box-shadow: none;
        border-radius: 0;
    }

    .contact-table,
    .accionistas-table {
        display: block;
        min-width: 0;
        margin-bottom: 1rem;
        background: transparent;
        box-shadow: none;
    }

    .contact-table thead {
        display: none;
    }

    .contact-table tbody,
    .contact-table tr,
    .contact-table td {
        display: block;
        width: 100%;
        min-width: 0;
    }

    .contact-table tr {
        background: var(--surface);
        border: 1px solid var(--border);
        border-radius: 8px;
        margin-bottom: 0.85rem;
        padding: 0.65rem;
        box-shadow: 0 10px 24px -20px rgba(15, 23, 42, 0.35);
    }

    .contact-table td {
        border-bottom: 0;
        padding: 0.35rem 0;
    }

    .contact-table td::before {
        display: block;
        margin-bottom: 0.25rem;
        color: var(--text-muted);
        font-size: 0.78rem;
        font-weight: 600;
    }

    .accionistas-table td:nth-child(1)::before { content: "Tipo de identificacion"; }
    .accionistas-table td:nth-child(2)::before { content: "Numero de identificacion"; }
    .accionistas-table td:nth-child(3)::before { content: "Nombre completo"; }
    .accionistas-table td:nth-child(4)::before { content: "% participacion"; }
    .accionistas-table td:nth-child(5)::before { content: "Accion"; }

    .contact-table:not(.accionistas-table) td:nth-child(1)::before { content: "Contacto"; }
    .contact-table:not(.accionistas-table) td:nth-child(2)::before { content: "Nombre"; }
    .contact-table:not(.accionistas-table) td:nth-child(3)::before { content: "Cargo"; }
    .contact-table:not(.accionistas-table) td:nth-child(4)::before { content: "Telefono"; }
    .contact-table:not(.accionistas-table) td:nth-child(5)::before { content: "Correo"; }

    .accionistas-table th:last-child,
    .accionistas-table td:last-child {
        width: 100%;
        text-align: left;
    }

    .accionistas-table .form-select {
        height: 42px;
    }

    .btn,
    .btn-small {
        width: 100%;
        min-height: 42px;
        padding: 0.65rem 0.85rem;
    }

    .btn-icon {
        width: auto;
        min-width: 44px;
    }

    .submit-area {
        margin-top: 1.5rem;
    }
}

@media (max-width: 480px) {
    .header {
        flex-direction: column;
        text-align: center;
    }

    .header-logo {
        width: 104px;
        max-height: 52px;
    }

    .form-section h2 {
        align-items: flex-start;
        font-size: 1.05rem;
        line-height: 1.35;
    }

    .pep-section,
    .legal-box,
    .conditional-fields,
    .tax-question {
        padding: 0.75rem;
    }

    .tax-question .options,
    .tax-question .stacked-options {
        grid-template-columns: 1fr;
    }

    .row-radio .options {
        grid-template-columns: 1fr 1fr;
    }

    .options label,
    .stacked-options label {
        min-height: 40px;
        padding: 0.55rem 0.65rem;
    }

    .input-group input,
    .input-group select,
    .contact-table td input,
    .contact-table td select {
        font-size: 16px;
        min-height: 42px;
    }

    .full-checkbox {
        border-radius: 8px;
        padding: 0.75rem;
    }
}

@media (max-width: 360px) {
    .glass-panel {
        padding: 0.7rem;
    }

    .row-radio .options {
        grid-template-columns: 1fr;
    }

    .title {
        font-size: 1.35rem;
    }
}

.accionistas-table {
    table-layout: fixed;
    min-width: 980px;
}

.accionistas-table th:first-child,
.accionistas-table td:first-child {
    width: 210px;
    min-width: 210px;
}

.accionistas-table th:nth-child(2),
.accionistas-table td:nth-child(2) {
    width: 190px;
}

.accionistas-table th:nth-child(4),
.accionistas-table td:nth-child(4) {
    width: 120px;
}

.accionistas-table .form-select {
    display: block;
    width: 100%;
    height: 52px;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.95rem;
    line-height: 1.5;
    color: var(--text-main);
    background-color: var(--surface);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.accionistas-table .form-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(15, 82, 186, 0.15);
}

.contact-table td input[readonly] {
    background: var(--secondary);
    color: var(--text-main);
    font-weight: 600;
}

.muted-cell {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.fixed-action-cell {
    color: var(--text-muted);
}

.btn-delete-contacto {
    border-radius: 8px;
    padding: 0.65rem 0.8rem;
    min-width: 44px;
}

.grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1rem;
}

.row-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

@media (max-width: 768px) {
    .row-split {
        grid-template-columns: 1fr;
    }
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.input-group label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-main);
}

.input-group input, 
.input-group select {
    padding: 0.62rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.95rem;
    background: var(--surface);
    transition: all 0.2s;
}

.input-group input:focus, 
.input-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(15, 82, 186, 0.15);
}

.pep-section {
    background: #f8fafc;
    border-radius: var(--radius);
    padding: 1rem;
    margin-top: 1rem;
    border: 1px solid var(--border);
}

.pep-section h3 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    color: var(--text-main);
}

.row-radio {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.5rem;
    padding: 0.8rem 0;
    border-bottom: 1px solid var(--border);
}

.row-radio:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.row-radio > label, .radio-group > label {
    font-size: 0.95rem;
    color: var(--text-main);
}

.row-radio > label {
    flex: 1 1 auto;
    min-width: 0;
}

.row-radio .options {
    flex: 0 0 390px;
    flex-wrap: nowrap;
    justify-content: flex-end;
}

.row-radio .options label {
    width: 150px;
    min-width: 150px;
}

@media (max-width: 768px) {
    .row-radio {
        align-items: stretch;
        flex-direction: column;
        gap: 0.75rem;
    }

    .row-radio .options {
        flex: 0 0 auto;
        flex-direction: row;
        justify-content: flex-start;
    }

    .row-radio .options label {
        width: auto;
        min-width: 120px;
    }

    .tax-question {
        grid-template-columns: 1fr;
    }
}

.options {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.options label,
.stacked-options label {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.55rem 0.7rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text-main);
    cursor: pointer;
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
    min-width: 96px;
    min-height: 38px;
    font-size: 0.9rem;
    font-weight: 500;
}

.options label:hover,
.stacked-options label:hover {
    border-color: var(--accent);
    box-shadow: 0 12px 28px rgba(14, 165, 233, 0.08);
}

.options input[type="radio"],
.stacked-options input[type="checkbox"],
.radio-group input[type="radio"] {
    appearance: none;
    -webkit-appearance: none;
    width: 1.2rem;
    height: 1.2rem;
    min-width: 1.2rem;
    border: 2px solid var(--border);
    background: var(--surface);
    position: relative;
    border-radius: 50%;
    box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.06);
    transition: border-color 0.2s ease, background-color 0.2s ease;
    cursor: pointer;
}

.stacked-options input[type="checkbox"] {
    border-radius: 10px;
}

.options input[type="radio"]::before,
.stacked-options input[type="checkbox"]::before,
.radio-group input[type="radio"]::before {
    content: '';
    position: absolute;
    inset: 4px;
    border-radius: 50%;
    transform: scale(0);
    transition: transform 0.18s ease-in-out, background-color 0.18s ease-in-out;
    background: var(--primary);
}

.stacked-options input[type="checkbox"]::before {
    border-radius: 4px;
}

.options input[type="radio"]:checked::before,
.stacked-options input[type="checkbox"]:checked::before,
.radio-group input[type="radio"]:checked::before {
    transform: scale(1);
}

.options input[type="radio"]:checked,
.stacked-options input[type="checkbox"]:checked,
.radio-group input[type="radio"]:checked {
    border-color: var(--primary);
    background: var(--accent-soft);
}

.tax-section {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.6rem;
}

.tax-question {
    display: grid;
    grid-template-columns: minmax(210px, 260px) 1fr;
    align-items: start;
    gap: 0.75rem;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.75rem;
}

.tax-question > label {
    display: block;
    margin-bottom: 0;
    font-weight: 600;
    line-height: 1.35;
}

.stacked-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, max-content));
    align-items: start;
    gap: 0.5rem;
}

.tax-question .options label {
    min-width: 120px;
}

.tax-question .stacked-options label {
    min-width: 150px;
}

.stacked-options input[type="checkbox"] {
    accent-color: var(--primary);
    width: 1.1rem;
    height: 1.1rem;
}

.conditional-fields {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.85rem;
}

.conditional-fields[hidden] {
    display: none !important;
}

.admin-test-page {
    max-width: 760px;
}

.admin-test-panel {
    display: grid;
    gap: 1.25rem;
}

.admin-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.admin-result {
    min-height: 140px;
    white-space: pre-wrap;
    word-break: break-word;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #f8fafc;
    padding: 1rem;
    font-family: Consolas, monospace;
    font-size: 0.9rem;
    color: var(--text-main);
}

.admin-result.success {
    border-color: #86efac;
    background: #f0fdf4;
}

.admin-result.error {
    border-color: #fecaca;
    background: #fef2f2;
    color: #991b1b;
}

.divider {
    border: none;
    height: 1px;
    background: var(--border);
    margin: 2.5rem 0;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.btn-primary {
    background-color: var(--primary);
    color: white;
    width: 100%;
    padding: 1rem;
    font-size: 1.1rem;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(15, 82, 186, 0.3);
}

.btn-secondary {
    background-color: var(--secondary);
    color: var(--text-main);
}

.btn-secondary:hover {
    background-color: var(--secondary-hover);
}

.btn-small {
    padding: 0.65rem 1rem;
    font-size: 0.92rem;
    min-width: auto;
}

.full-checkbox {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem 1rem 1rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--surface-soft);
    color: var(--text-main);
    line-height: 1.5;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.full-checkbox:hover {
    border-color: var(--accent);
    box-shadow: 0 12px 24px rgba(14, 165, 233, 0.08);
}

.full-checkbox input {
    margin-top: 0.2rem;
    accent-color: var(--primary);
}

.input-group a.btn {
    display: inline-flex;
    align-items: center;
}

.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.4rem;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.btn-icon:hover {
    background: #fee2e2;
}

.text-danger {
    color: var(--danger);
}

.submit-area {
    margin-top: 3rem;
}

/* Legal text */
.legal-box {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
}

.legal-box p {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.legal-read-more {
    margin-top: 0.9rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.legal-read-more summary {
    color: var(--primary);
    cursor: pointer;
    font-weight: 600;
}

.legal-read-more p {
    margin-top: 0.75rem;
    margin-bottom: 0;
}

.legal-read-more ul {
    margin: 0.55rem 0 0 1.1rem;
    display: grid;
    gap: 0.35rem;
}

.checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
}

.mt-3 {
    margin-top: 1rem;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
    animation: fadeIn 0.2s ease-out forwards;
}

.modal-content {
    background: var(--surface);
    padding: 3rem 2rem;
    border-radius: 16px;
    max-width: 450px;
    width: 90%;
    text-align: center;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    transform: scale(0.95);
    transition: transform 0.2s;
}

.modal.active .modal-content {
    transform: scale(1);
}

.modal-content h2 {
    margin: 1rem 0;
    color: var(--text-main);
}

.modal-content p {
    color: var(--text-muted);
    margin-bottom: 2rem;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Contact Table Styles */
.contact-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1.5rem;
    background: var(--surface);
    min-width: 960px;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.contact-table th,
.contact-table td {
    padding: 0.65rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.contact-table th {
    background-color: var(--secondary);
    font-weight: 600;
    color: var(--text-main);
}

.contact-table td input,
.contact-table td select {
    width: 100%;
    min-height: 40px;
    padding: 0.62rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.95rem;
    background: var(--surface);
    transition: all 0.2s;
}

.contact-table td input:focus,
.contact-table td select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(15, 82, 186, 0.15);
}

/* Responsive guardrails: keep this block last so it wins the cascade. */
@media (max-width: 1100px) {
    .container {
        width: 100%;
    }

    .glass-panel {
        padding: 1.35rem;
    }

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

    .tax-question {
        grid-template-columns: minmax(190px, 235px) 1fr;
    }

    .contact-table {
        min-width: 860px;
    }

    .accionistas-table {
        min-width: 880px;
    }
}

@media (max-width: 860px) {
    .header {
        align-items: center;
        margin-bottom: 1.5rem;
    }

    .glass-panel {
        border-radius: 12px;
        padding: 1rem;
    }

    .form-section {
        margin-bottom: 1rem;
    }

    .divider {
        margin: 1.5rem 0;
    }

    .flex-header,
    .contact-controls {
        align-items: flex-start;
        flex-direction: column;
        gap: 0.65rem;
    }

    .badge {
        width: fit-content;
    }

    .grid-2,
    .row-split {
        grid-template-columns: 1fr;
        gap: 0.8rem;
    }

    .grid-2 > [style*="grid-column: span 2"],
    .row-split > [style*="grid-column: span 2"] {
        grid-column: 1 / -1 !important;
    }

    .tax-question {
        grid-template-columns: 1fr;
        gap: 0.6rem;
    }

    .tax-question .options,
    .tax-question .stacked-options {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
        width: 100%;
    }

    .tax-question .options label,
    .tax-question .stacked-options label {
        width: 100%;
        min-width: 0;
    }

    .row-radio {
        align-items: stretch;
        flex-direction: column;
        gap: 0.65rem;
    }

    .row-radio .options {
        flex: 0 0 auto;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        justify-content: stretch;
        width: 100%;
    }

    .row-radio .options label {
        width: 100%;
        min-width: 0;
    }
}

@media (max-width: 720px) {
    body {
        padding: 0;
        background-image: none;
    }

    .container {
        max-width: none;
    }

    .header {
        padding: 1rem 0.85rem 0;
    }

    .glass-panel {
        border-left: 0;
        border-right: 0;
        border-radius: 0;
        padding: 0.9rem;
    }

    .contact-table-wrap {
        overflow-x: visible;
        box-shadow: none;
        border-radius: 0;
    }

    .contact-table,
    .accionistas-table {
        display: block;
        min-width: 0;
        margin-bottom: 1rem;
        background: transparent;
        box-shadow: none;
    }

    .contact-table thead {
        display: none;
    }

    .contact-table tbody,
    .contact-table tr,
    .contact-table td {
        display: block;
        width: 100%;
        min-width: 0;
    }

    .contact-table tr {
        background: var(--surface);
        border: 1px solid var(--border);
        border-radius: 8px;
        margin-bottom: 0.85rem;
        padding: 0.65rem;
        box-shadow: 0 10px 24px -20px rgba(15, 23, 42, 0.35);
    }

    .contact-table td {
        border-bottom: 0;
        padding: 0.35rem 0;
    }

    .contact-table td::before {
        display: block;
        margin-bottom: 0.25rem;
        color: var(--text-muted);
        font-size: 0.78rem;
        font-weight: 600;
    }

    .accionistas-table td:nth-child(1)::before { content: "Tipo de identificacion"; }
    .accionistas-table td:nth-child(2)::before { content: "Numero de identificacion"; }
    .accionistas-table td:nth-child(3)::before { content: "Nombre completo"; }
    .accionistas-table td:nth-child(4)::before { content: "% participacion"; }
    .accionistas-table td:nth-child(5)::before { content: "Accion"; }

    .contact-table:not(.accionistas-table) td:nth-child(1)::before { content: "Contacto"; }
    .contact-table:not(.accionistas-table) td:nth-child(2)::before { content: "Nombre"; }
    .contact-table:not(.accionistas-table) td:nth-child(3)::before { content: "Cargo"; }
    .contact-table:not(.accionistas-table) td:nth-child(4)::before { content: "Telefono"; }
    .contact-table:not(.accionistas-table) td:nth-child(5)::before { content: "Correo"; }

    .accionistas-table th:last-child,
    .accionistas-table td:last-child {
        width: 100%;
        text-align: left;
    }

    .accionistas-table .form-select {
        height: 42px;
    }

    .btn,
    .btn-small {
        width: 100%;
        min-height: 42px;
        padding: 0.65rem 0.85rem;
    }

    .btn-icon {
        width: auto;
        min-width: 44px;
    }

    .submit-area {
        margin-top: 1.5rem;
    }
}

@media (max-width: 480px) {
    .header {
        flex-direction: column;
        text-align: center;
    }

    .header-logo {
        width: 104px;
        max-height: 52px;
    }

    .form-section h2 {
        align-items: flex-start;
        font-size: 1.05rem;
        line-height: 1.35;
    }

    .pep-section,
    .legal-box,
    .conditional-fields,
    .tax-question {
        padding: 0.75rem;
    }

    .tax-question .options,
    .tax-question .stacked-options {
        grid-template-columns: 1fr;
    }

    .row-radio .options {
        grid-template-columns: 1fr 1fr;
    }

    .options label,
    .stacked-options label {
        min-height: 40px;
        padding: 0.55rem 0.65rem;
    }

    .input-group input,
    .input-group select,
    .contact-table td input,
    .contact-table td select {
        font-size: 16px;
        min-height: 42px;
    }

    .full-checkbox {
        border-radius: 8px;
        padding: 0.75rem;
    }
}

@media (max-width: 360px) {
    .glass-panel {
        padding: 0.7rem;
    }

    .row-radio .options {
        grid-template-columns: 1fr;
    }

    .title {
        font-size: 1.35rem;
    }
}

/* Compact grid cards: avoid inner two-column layouts inside already narrow cards. */
.grid-2 > .tax-question {
    grid-template-columns: 1fr;
    align-content: start;
    min-width: 0;
}

.grid-2 > .tax-question .options {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
}

.grid-2 > .tax-question .options label {
    width: 100%;
    min-width: 0;
}

.grid-2 > .tax-question .input-group,
.grid-2 > .tax-question input[type="file"] {
    width: 100%;
    min-width: 0;
}

.grid-2 > .tax-question input[type="file"] {
    font-size: 0.85rem;
}

@media (max-width: 420px) {
    .grid-2 > .tax-question .options {
        grid-template-columns: 1fr;
    }
}
