:root {
    --navy: #09337F;
    --navy2: #06245A;
    --blue: #09337F;
    --sky: #0E84D4;
    --green: #00D6BC;
    --orange: #f2a322;
    --red: #df5353;
    --purple: #0E84D4;
    --ink: #173042;
    --muted: #6d7e8b;
    --line: #e2e8ed;
    --bg: #f3f6f9;
    --white: #fff;
    --shadow: 0 10px 30px rgba(21, 48, 66, 0.09);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Inter, "Segoe UI", Arial, sans-serif;
    color: var(--ink);
    background: var(--bg);
}

button,
input,
select,
textarea {
    font: inherit;
}

button {
    cursor: pointer;
}

button:disabled {
    cursor: not-allowed;
    opacity: 0.58;
}

.hidden {
    display: none !important;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 10px 14px;
    border: 0;
    border-radius: 9px;
    font-weight: 750;
}

.btn:hover:not(:disabled) {
    filter: brightness(0.97);
}

.btn.blue {
    color: #fff;
    background: var(--blue);
}

.btn.green {
    color: #fff;
    background: var(--green);
}

.btn.light {
    color: var(--ink);
    background: #eef2f5;
}

.btn.outline {
    color: var(--ink);
    background: #fff;
    border: 1px solid var(--line);
}

.btn.sm {
    padding: 7px 10px;
    font-size: 12px;
}

.login {
    min-height: 100vh;
    padding: 34px;
    background:
        radial-gradient(circle at top right, #dfeaff 0, transparent 33%),
        linear-gradient(#f9fbfd, #eef4f7);
}

.wrap {
    max-width: 1180px;
    margin: auto;
}

.intro,
.card,
.panel {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 15px;
    box-shadow: var(--shadow);
}

.intro {
    padding: 20px 23px;
    margin-bottom: 22px;
}

.eyebrow {
    color: var(--blue);
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}

.intro h1 {
    margin: 7px 0 4px;
    font-size: clamp(25px, 3vw, 39px);
}

.intro p,
.muted {
    color: var(--muted);
}

.role-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.role-card {
    padding: 24px;
    transition: transform 0.18s ease, border-color 0.18s ease;
}

.role-card:hover,
.role-card.role-selected {
    border-color: #b9c9e8;
    transform: translateY(-2px);
}

.role-card h2 {
    margin: 10px 0 7px;
}

.role-icon {
    width: 54px;
    height: 54px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    font-size: 22px;
    font-weight: 900;
}

.role-icon.f {
    color: var(--blue);
    background: #e9f0ff;
}

.role-icon.a {
    color: var(--green);
    background: #e6f7f1;
}

.features {
    display: grid;
    gap: 9px;
    padding: 0;
    color: #476171;
    font-size: 14px;
    list-style: none;
}

.features li::before {
    margin-right: 8px;
    color: var(--blue);
    font-weight: 900;
    content: "✓";
}

.admin-card .features li::before {
    color: var(--green);
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
}

.login-box {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 25px;
    padding: 22px;
    margin-top: 20px;
}

.login-box h3 {
    margin: 8px 0 16px;
}

.form-group {
    display: grid;
    gap: 6px;
}

.form-group label {
    color: #40596b;
    font-size: 12px;
    font-weight: 800;
}

.control {
    width: 100%;
    padding: 10px 11px;
    color: var(--ink);
    background: #fff;
    border: 1px solid #d4dee6;
    border-radius: 9px;
    outline: none;
}

.control:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(9, 51, 127, 0.13);
}

.acceso-actions {
    margin-top: 13px;
}

.valid {
    padding: 15px;
    background: #e9f8f2;
    border: 1px solid #b8e5d5;
    border-radius: 12px;
}

.valid-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 11px 18px;
    font-size: 13px;
}

.valid-grid-login {
    margin-top: 10px;
}

.valid-grid span {
    display: block;
    margin-bottom: 2px;
    color: var(--muted);
    font-size: 11px;
}

.boton-entrar {
    width: 100%;
    margin-top: 14px;
}

.error-box {
    color: #a63232;
    background: #fdeeee;
    border-color: #efc2c2;
}

.demo {
    padding: 14px;
    color: #536b7a;
    font-size: 13px;
    background: #f8fafb;
    border: 1px dashed #cbd7df;
    border-radius: 11px;
}

.login-footer {
    display: flex;
    justify-content: space-between;
    margin-top: 14px;
    color: var(--muted);
    font-size: 11px;
}

.shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 220px 1fr;
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 23px 14px;
    color: #fff;
    background: linear-gradient(var(--navy), var(--navy2));
}

.brand {
    padding: 0 11px 20px;
    border-bottom: 1px solid #ffffff20;
}

.brand strong {
    display: block;
    font-size: 17px;
}

.brand small {
    color: #ffffff9c;
}

.chip {
    display: inline-block;
    padding: 5px 8px;
    margin-top: 11px;
    color: #ffffffc9;
    font-size: 10px;
    background: #ffffff16;
    border-radius: 999px;
}

.nav {
    display: grid;
    gap: 6px;
    margin-top: 20px;
}

.nav button {
    padding: 11px;
    color: #ffffffb5;
    font-weight: 700;
    text-align: left;
    background: transparent;
    border: 0;
    border-radius: 9px;
}

.nav button:hover,
.nav button.active {
    color: #fff;
    background: #49a6d633;
}

.side-bottom {
    margin-top: auto;
}

.user-box {
    padding: 10px;
    background: #ffffff08;
    border: 1px solid #ffffff20;
    border-radius: 10px;
}

.user-box strong,
.user-box small {
    display: block;
}

.user-box small {
    margin-top: 2px;
    color: #ffffff9e;
}

.logout {
    width: 100%;
    padding: 9px;
    margin-top: 8px;
    color: #ffffffb8;
    text-align: left;
    background: transparent;
    border: 0;
}

.main {
    min-width: 0;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    height: 74px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 27px;
    background: #fffffff2;
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(8px);
}

.topbar-title {
    display: flex;
    gap: 10px;
    align-items: center;
}

.topbar h1 {
    margin: 0;
    font-size: 21px;
}

.topbar p {
    margin: 3px 0 0;
    color: var(--muted);
    font-size: 11px;
}

.content {
    padding: 25px 27px 38px;
}

.page-head {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.page-head h2 {
    margin: 4px 0;
    font-size: 24px;
}

.page-head p {
    margin: 0;
    color: var(--muted);
}

.kpis {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-bottom: 18px;
}

.kpi {
    padding: 15px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 13px;
}

.kpi span {
    color: var(--muted);
    font-size: 11px;
}

.kpi strong {
    display: block;
    margin: 5px 0;
    font-size: 27px;
}

.kpi small {
    color: var(--muted);
}

.kpi.blue strong {
    color: var(--blue);
}

.kpi.green strong {
    color: var(--green);
}

.kpi.orange strong {
    color: var(--orange);
}

.kpi.purple strong {
    color: var(--purple);
}

.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 17px 19px;
    border-bottom: 1px solid var(--line);
}

.panel-head h3 {
    margin: 0;
    font-size: 15px;
}

.panel-head p {
    margin: 3px 0 0;
    color: var(--muted);
    font-size: 11px;
}

.profile-mini {
    display: grid;
    gap: 3px;
    color: var(--muted);
    font-size: 11px;
    text-align: right;
}

.panel-message {
    padding: 13px 19px;
    color: #a63232;
    background: #fdeeee;
    border-bottom: 1px solid #efc2c2;
}

.table-wrap {
    overflow: auto;
}

table {
    width: 100%;
    min-width: 720px;
    border-collapse: collapse;
}

th,
td {
    padding: 11px 12px;
    font-size: 12px;
    text-align: left;
    border-bottom: 1px solid #edf1f3;
}

th {
    color: #647684;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: #fafbfc;
}

.folio {
    font-weight: 900;
}

.sub {
    display: block;
    margin-top: 3px;
    color: var(--muted);
    font-size: 10px;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 8px;
    font-size: 10px;
    font-weight: 850;
    white-space: nowrap;
    border-radius: 999px;
}

.badge::before {
    width: 6px;
    height: 6px;
    background: currentColor;
    border-radius: 50%;
    content: "";
}

.review {
    color: #b87600;
    background: #fff2d9;
}

.pending {
    color: #09337F;
    background: #e4f2fc;
}

.approved,
.final {
    color: #0c8a5c;
    background: #e6f7f0;
}

.rejected {
    color: #c23c3c;
    background: #fde9e9;
}

.received {
    color: #2d63c8;
    background: #e8f0ff;
}

.draft {
    color: #64737e;
    background: #edf1f4;
}

.empty {
    padding: 35px;
    color: var(--muted);
    text-align: center;
}

.pagination-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    padding: 14px 19px;
    color: var(--muted);
    font-size: 12px;
    border-top: 1px solid var(--line);
}

.modal-bg {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: grid;
    place-items: center;
    padding: 20px;
    background: #0d2638a8;
}

.modal {
    width: min(720px, 100%);
    max-height: 92vh;
    overflow: auto;
    background: #fff;
    border-radius: 15px;
    box-shadow: 0 28px 70px #0005;
}

.modal-head,
.modal-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 17px 19px;
}

.modal-head {
    border-bottom: 1px solid var(--line);
}

.modal-head h3 {
    margin: 4px 0 0;
}

.modal-foot {
    justify-content: flex-end;
    gap: 9px;
    border-top: 1px solid var(--line);
}

.modal-body {
    padding: 19px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.modal-row {
    margin-top: 16px;
}

.modal-label {
    display: block;
    margin-bottom: 4px;
    font-size: 11px;
}

.toast {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 80;
    padding: 12px 15px;
    color: #fff;
    background: #173b50;
    border-radius: 10px;
    box-shadow: var(--shadow);
}

.menu-btn {
    display: none;
}

@media (max-width: 820px) {
    .login {
        padding: 18px;
    }

    .role-grid,
    .login-box {
        grid-template-columns: 1fr;
    }

    .shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: fixed;
        left: -235px;
        z-index: 30;
        width: 220px;
        transition: left 0.2s ease;
    }

    .sidebar.open {
        left: 0;
    }

    .menu-btn {
        display: inline-flex;
    }

    .content {
        padding: 20px 15px;
    }

    .topbar {
        padding: 0 15px;
    }

    .kpis {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 520px) {
    .valid-grid,
    .form-row,
    .kpis {
        grid-template-columns: 1fr;
    }

    .page-head {
        flex-direction: column;
        align-items: start;
    }

    .page-head > .btn,
    .topbar > .btn,
    .role-card .btn {
        width: 100%;
    }

    .topbar > .btn {
        display: none;
    }

    .actions {
        flex-direction: column;
    }

    .pagination-bar {
        align-items: stretch;
        flex-direction: column;
    }

    .profile-mini {
        display: none;
    }

    .login-footer {
        gap: 8px;
        flex-direction: column;
    }
}

.admin-kpis {
    grid-template-columns: repeat(6, 1fr);
}

.kpi.red strong {
    color: var(--red);
}

@media (max-width: 1100px) {
    .admin-kpis {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 820px) {
    .admin-kpis {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 520px) {
    .admin-kpis {
        grid-template-columns: 1fr;
    }
}
/* --------------------------------------------------------------------------
   Administrador · Constructor de formularios
   -------------------------------------------------------------------------- */

.prototype-note {
    padding: 12px 14px;
    margin-bottom: 16px;
    color: #40596b;
    font-size: 12px;
    line-height: 1.5;
    background: #eef5ff;
    border: 1px solid #cdddf8;
    border-radius: 11px;
}

.formularios-kpis {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}

.mini-kpi {
    padding: 13px 14px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 12px;
}

.mini-kpi span {
    display: block;
    color: var(--muted);
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.mini-kpi strong {
    display: block;
    margin-top: 4px;
    font-size: 23px;
}

.formularios-layout {
    display: grid;
    grid-template-columns: minmax(260px, 310px) minmax(0, 1fr);
    gap: 16px;
    align-items: start;
}

.formularios-catalogo,
.formulario-editor {
    min-width: 0;
}

.formularios-catalogo {
    position: sticky;
    top: 94px;
    max-height: calc(100vh - 120px);
    overflow: hidden;
}

.catalogo-search {
    padding: 12px 14px;
    border-bottom: 1px solid var(--line);
}

.lista-formularios {
    max-height: calc(100vh - 235px);
    overflow: auto;
    padding: 10px;
}

.catalogo-empty {
    padding: 22px 12px;
    font-size: 12px;
}

.formulario-card {
    width: 100%;
    display: grid;
    gap: 5px;
    padding: 12px;
    margin-bottom: 8px;
    color: var(--ink);
    text-align: left;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 11px;
}

.formulario-card:hover,
.formulario-card.active {
    border-color: #aebfe7;
    background: #f7faff;
}

.formulario-card.active {
    box-shadow: inset 3px 0 0 var(--blue);
}

.formulario-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
}

.formulario-card-head strong {
    font-size: 12px;
    line-height: 1.35;
}

.formulario-card small,
.form-code {
    color: var(--muted);
    font-size: 10px;
}

.form-code {
    font-family: Consolas, monospace;
    font-weight: 700;
}

.form-status {
    display: inline-flex;
    align-items: center;
    flex: 0 0 auto;
    padding: 4px 7px;
    font-size: 9px;
    font-weight: 850;
    border-radius: 999px;
}

.form-status.published {
    color: #08744e;
    background: #e4f7ef;
}

.form-status.draft-form {
    color: #946000;
    background: #fff0cf;
}

.form-status.inactive-form {
    color: #687985;
    background: #eef1f3;
}

.editor-head {
    align-items: flex-start;
}

.editor-title-line {
    display: flex;
    align-items: center;
    gap: 8px;
}

.editor-body {
    padding: 0 19px 19px;
}

.editor-empty {
    padding: 55px 20px;
    color: var(--muted);
    text-align: center;
}

.builder-section {
    padding: 19px 0;
    border-bottom: 1px solid var(--line);
}

.builder-section:last-child {
    padding-bottom: 0;
    border-bottom: 0;
}

.section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 13px;
}

.section-heading h4 {
    margin: 0;
    font-size: 14px;
}

.section-heading p {
    margin: 3px 0 0;
    color: var(--muted);
    font-size: 11px;
}

.lista-campos,
.lista-plantillas {
    display: grid;
    gap: 9px;
}

.campo-item {
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr) auto;
    align-items: center;
    gap: 11px;
    padding: 11px;
    background: #fbfcfd;
    border: 1px solid var(--line);
    border-radius: 11px;
}

.campo-order {
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    color: #547086;
    font-size: 10px;
    font-weight: 900;
    background: #eef3f6;
    border-radius: 8px;
}

.campo-info {
    min-width: 0;
}

.campo-title-line,
.campo-meta {
    display: flex;
    align-items: center;
    gap: 7px;
    flex-wrap: wrap;
}

.campo-title-line strong {
    font-size: 12px;
}

.campo-meta {
    margin-top: 5px;
}

.campo-meta code {
    color: #4f6776;
    font-size: 9px;
    background: #edf2f5;
    padding: 3px 5px;
    border-radius: 5px;
}

.campo-info > small {
    display: block;
    margin-top: 5px;
    color: var(--muted);
    font-size: 10px;
}

.field-type,
.required-pill,
.file-pill {
    display: inline-flex;
    align-items: center;
    padding: 3px 6px;
    font-size: 9px;
    font-weight: 800;
    border-radius: 999px;
}

.field-type {
    color: #365fbb;
    background: #eaf0ff;
}

.required-pill {
    color: #b33e3e;
    background: #fdeaea;
}

.file-pill {
    color: #09337F;
    background: #e4f2fc;
}

.campo-actions {
    display: flex;
    align-items: center;
    gap: 5px;
}

.icon-btn {
    width: 29px;
    height: 29px;
    display: grid;
    place-items: center;
    color: #4d6677;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 7px;
}

.btn.danger-light {
    color: #b33c3c;
    background: #fff2f2;
    border: 1px solid #f1cccc;
}

.builder-empty {
    padding: 25px;
    color: var(--muted);
    font-size: 11px;
    text-align: center;
    background: #fafbfc;
    border: 1px dashed #ccd6dd;
    border-radius: 10px;
}

.builder-empty.compact {
    padding: 17px;
}

.file-picker {
    position: relative;
    overflow: hidden;
}

.file-picker input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.plantilla-item {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) auto;
    align-items: center;
    gap: 11px;
    padding: 11px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 11px;
}

.pdf-icon {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    color: #b53f3f;
    font-size: 10px;
    font-weight: 900;
    background: #fdecec;
    border-radius: 9px;
}

.plantilla-info {
    min-width: 0;
}

.plantilla-info strong,
.plantilla-info small {
    display: block;
}

.plantilla-info strong {
    overflow: hidden;
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.plantilla-info small {
    margin-top: 3px;
    color: var(--muted);
    font-size: 9px;
}

.check-card {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 10px;
}

.check-card input {
    width: 17px;
    height: 17px;
}

.check-card span,
.check-card strong,
.check-card small {
    display: block;
}

.check-card strong {
    font-size: 11px;
}

.check-card small {
    margin-top: 2px;
    color: var(--muted);
    font-size: 9px;
}

.modal-field-editor {
    width: min(760px, 100%);
}

.preview-modal {
    width: min(780px, 100%);
}

.preview-description {
    margin: 0 0 15px;
    color: var(--muted);
    line-height: 1.5;
}

.preview-downloads {
    display: grid;
    gap: 7px;
    padding: 12px;
    margin-bottom: 16px;
    background: #f5f8fb;
    border: 1px solid var(--line);
    border-radius: 10px;
}

.preview-downloads > strong {
    font-size: 11px;
}

.preview-download-item {
    padding: 8px 10px;
    color: #476171;
    font-size: 10px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.preview-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 13px;
}

.preview-field:has(textarea),
.preview-field:has(input[type="file"]) {
    grid-column: 1 / -1;
}

.required-mark {
    color: var(--red);
}

.field-help {
    color: var(--muted);
    font-size: 9px;
}

.preview-foot-note {
    margin-right: auto;
    color: var(--muted);
    font-size: 10px;
}

@media (max-width: 1050px) {
    .formularios-layout {
        grid-template-columns: 1fr;
    }

    .formularios-catalogo {
        position: static;
        max-height: none;
    }

    .lista-formularios {
        max-height: 300px;
    }

    .formularios-kpis {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 700px) {
    .form-page-head,
    .section-heading,
    .editor-head,
    .plantilla-item {
        align-items: stretch;
        flex-direction: column;
    }

    .campo-item {
        grid-template-columns: 32px minmax(0, 1fr);
    }

    .campo-actions {
        grid-column: 1 / -1;
        justify-content: flex-end;
        flex-wrap: wrap;
    }

    .preview-fields,
    .formularios-kpis {
        grid-template-columns: 1fr;
    }

    .plantilla-item {
        display: flex;
        align-items: center;
        flex-wrap: wrap;
    }

    .plantilla-info {
        flex: 1 1 180px;
    }
}

/* --------------------------------------------------------------------------
   Administrador · Gestión de solicitudes
   -------------------------------------------------------------------------- */

.solicitudes-page-head {
    align-items: flex-end;
}

.solicitudes-panel-head {
    align-items: flex-end;
    gap: 16px;
}

.solicitudes-filtros {
    display: grid;
    grid-template-columns: minmax(260px, 1fr) minmax(190px, 220px);
    gap: 9px;
    width: min(620px, 100%);
}

.solicitudes-admin-table {
    min-width: 980px;
}

.attachment-count {
    display: inline-flex;
    padding: 4px 7px;
    color: var(--muted);
    font-size: 9px;
    font-weight: 800;
    background: #eef2f4;
    border-radius: 999px;
}

.attachment-count.has-files {
    color: #09337F;
    background: #e4f2fc;
}

.solicitud-detail-modal {
    width: min(980px, 100%);
}

.solicitud-detail-head {
    align-items: flex-start;
}

.solicitud-detail-head h3 {
    margin: 4px 0 0;
}

.solicitud-detail-head p {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 11px;
}

.solicitud-head-actions {
    display: flex;
    align-items: center;
    gap: 9px;
}

.solicitud-detail-body {
    display: grid;
    gap: 18px;
}

.solicitud-detail-section {
    padding-bottom: 18px;
    border-bottom: 1px solid var(--line);
}

.solicitud-detail-section:last-child {
    padding-bottom: 0;
    border-bottom: 0;
}

.detail-section-title {
    margin-bottom: 10px;
    color: #40596b;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.solicitud-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.solicitud-summary-item {
    min-width: 0;
    padding: 10px;
    background: #f7f9fb;
    border: 1px solid var(--line);
    border-radius: 9px;
}

.solicitud-summary-item span,
.solicitud-summary-item strong {
    display: block;
}

.solicitud-summary-item span {
    margin-bottom: 4px;
    color: var(--muted);
    font-size: 9px;
    font-weight: 800;
    text-transform: uppercase;
}

.solicitud-summary-item strong {
    overflow-wrap: anywhere;
    font-size: 11px;
    line-height: 1.4;
}

.solicitud-respuestas {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 9px;
}

.solicitud-respuesta-item {
    padding: 11px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 9px;
}

.solicitud-respuesta-item span {
    display: block;
    margin-bottom: 5px;
    color: var(--muted);
    font-size: 9px;
    font-weight: 800;
    text-transform: uppercase;
}

.solicitud-respuesta-item p {
    margin: 0;
    color: var(--ink);
    font-size: 11px;
    line-height: 1.5;
    white-space: pre-wrap;
}

.solicitud-adjuntos {
    display: grid;
    gap: 8px;
}

.solicitud-adjunto-item {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) auto;
    align-items: center;
    gap: 11px;
    padding: 10px;
    background: #fbfcfd;
    border: 1px solid var(--line);
    border-radius: 10px;
}

.solicitud-adjunto-info {
    min-width: 0;
}

.solicitud-adjunto-info strong,
.solicitud-adjunto-info small {
    display: block;
}

.solicitud-adjunto-info strong {
    overflow: hidden;
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.solicitud-adjunto-info small {
    margin-top: 3px;
    color: var(--muted);
    font-size: 9px;
}

.solicitud-state-section {
    padding: 14px;
    background: #f7faff;
    border: 1px solid #dce6fb;
    border-radius: 11px;
}

.solicitud-state-grid {
    display: grid;
    grid-template-columns: minmax(220px, 300px) 1fr;
    gap: 14px;
    align-items: end;
}

.state-prototype-note {
    padding: 10px 12px;
    color: #526b7c;
    font-size: 10px;
    line-height: 1.5;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 9px;
}

@media (max-width: 900px) {
    .solicitudes-panel-head {
        align-items: stretch;
        flex-direction: column;
    }

    .solicitudes-filtros {
        width: 100%;
    }

    .solicitud-summary-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 620px) {
    .solicitudes-filtros,
    .solicitud-summary-grid,
    .solicitud-respuestas,
    .solicitud-state-grid {
        grid-template-columns: 1fr;
    }

    .solicitud-detail-head {
        gap: 12px;
        flex-direction: column;
    }

    .solicitud-head-actions {
        width: 100%;
        justify-content: space-between;
    }

    .solicitud-adjunto-item {
        grid-template-columns: 42px minmax(0, 1fr);
    }

    .solicitud-adjunto-item .btn {
        grid-column: 1 / -1;
    }
}

/* --------------------------------------------------------------------------
   Funcionario · Historial y creación de solicitudes
   -------------------------------------------------------------------------- */

.solicitud-create-layout {
    display: grid;
    grid-template-columns: minmax(260px, 330px) minmax(0, 1fr);
    gap: 18px;
    align-items: start;
}

.solicitud-form-catalogo,
.solicitud-form-panel {
    overflow: hidden;
}

.solicitud-form-catalogo {
    position: sticky;
    top: 92px;
}

.funcionario-form-list {
    display: grid;
    gap: 9px;
    padding: 14px;
}

.funcionario-form-card {
    width: 100%;
    display: grid;
    grid-template-columns: 40px 1fr;
    gap: 11px;
    align-items: center;
    padding: 13px;
    color: var(--ink);
    text-align: left;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 12px;
    transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}

.funcionario-form-card:hover,
.funcionario-form-card.active {
    border-color: #adc3ec;
    box-shadow: 0 7px 20px rgba(9, 51, 127, .08);
    transform: translateY(-1px);
}

.funcionario-form-card.active {
    background: #f7f9ff;
}

.funcionario-form-card strong,
.funcionario-form-card small {
    display: block;
}

.funcionario-form-card strong {
    font-size: 13px;
}

.funcionario-form-card small {
    margin-top: 4px;
    color: var(--muted);
    font-size: 11px;
}

.funcionario-form-icon,
.funcionario-empty-icon {
    display: grid;
    place-items: center;
    color: var(--blue);
    background: #eaf1ff;
    border-radius: 10px;
    font-weight: 900;
}

.funcionario-form-icon {
    width: 40px;
    height: 40px;
}

.funcionario-editor-empty {
    min-height: 420px;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 8px;
    padding: 40px 24px;
    text-align: center;
}

.funcionario-empty-icon {
    width: 58px;
    height: 58px;
    margin-bottom: 5px;
    font-size: 24px;
}

.funcionario-editor-empty h3,
.funcionario-editor-empty p {
    margin: 0;
}

.funcionario-editor-empty p {
    max-width: 390px;
    color: var(--muted);
    font-size: 13px;
}

.funcionario-form-head {
    padding: 20px 22px;
    border-bottom: 1px solid var(--line);
}

.funcionario-form-head h3 {
    margin: 5px 0 6px;
    font-size: 21px;
}

.funcionario-form-head p {
    max-width: 760px;
    margin: 0;
    color: var(--muted);
    line-height: 1.55;
}

.plantillas-funcionario {
    margin: 18px 22px 0;
    padding: 15px;
    background: #f8fbff;
    border: 1px solid #dce7f8;
    border-radius: 12px;
}

.section-mini-head strong,
.section-mini-head small {
    display: block;
}

.section-mini-head small {
    margin-top: 3px;
    color: var(--muted);
    font-size: 11px;
}

.plantillas-funcionario-list {
    display: grid;
    gap: 9px;
    margin-top: 12px;
}

.plantilla-funcionario-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 11px 12px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 10px;
}

.plantilla-funcionario-item strong,
.plantilla-funcionario-item small {
    display: block;
}

.plantilla-funcionario-item strong {
    font-size: 12px;
}

.plantilla-funcionario-item small {
    margin-top: 3px;
    color: var(--muted);
    font-size: 10px;
}

.funcionario-dynamic-form {
    display: grid;
    gap: 17px;
    padding: 22px;
}

.funcionario-field {
    display: grid;
    gap: 7px;
}

.field-label-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.field-label-line label {
    color: #344f61;
    font-size: 12px;
    font-weight: 850;
}

.required-mark,
.optional-mark {
    padding: 3px 7px;
    font-size: 9px;
    font-weight: 850;
    border-radius: 999px;
}

.required-mark {
    color: #b34d30;
    background: #fff0e9;
}

.optional-mark {
    color: #647684;
    background: #eef2f5;
}

.field-help {
    color: var(--muted);
    font-size: 10px;
    line-height: 1.45;
}

.pdf-upload-box {
    min-height: 76px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    color: #40596b;
    background: #fbfcfd;
    border: 1px dashed #bfcbd4;
    border-radius: 11px;
    cursor: pointer;
}

.pdf-upload-box:hover {
    border-color: var(--blue);
    background: #f7faff;
}

.pdf-upload-box input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.pdf-upload-box strong,
.pdf-upload-box small {
    display: block;
}

.pdf-upload-box strong {
    font-size: 12px;
}

.pdf-upload-box small {
    margin-top: 3px;
    color: var(--muted);
    font-size: 10px;
}

.pdf-upload-icon {
    min-width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    color: #c23c3c;
    background: #fdeaea;
    border-radius: 9px;
    font-size: 10px;
    font-weight: 950;
}

.archivo-seleccionado {
    color: var(--muted);
    font-size: 10px;
}

.funcionario-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding-top: 8px;
    border-top: 1px solid var(--line);
}

.form-security-note {
    margin: -7px 0 0;
    color: var(--muted);
    font-size: 10px;
    text-align: right;
}

.solicitud-funcionario-modal {
    width: min(900px, 100%);
}

.funcionario-detail-summary {
    margin-bottom: 8px;
}

.solicitud-funcionario-modal .modal-head p {
    margin: 4px 0 0;
    font-size: 11px;
}

@media (max-width: 980px) {
    .solicitud-create-layout {
        grid-template-columns: 1fr;
    }

    .solicitud-form-catalogo {
        position: static;
    }

    .funcionario-form-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 620px) {
    .funcionario-form-list {
        grid-template-columns: 1fr;
    }

    .plantilla-funcionario-item,
    .funcionario-form-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .plantilla-funcionario-item .btn,
    .funcionario-form-actions .btn {
        width: 100%;
    }

    .form-security-note {
        text-align: left;
    }
}


/* ==========================================================
   Compatibilidad de componentes dinámicos v4.1
   admin.js usa estas clases para componentes creados por AJAX.
   Mantienen la misma apariencia del sistema visual existente.
   ========================================================== */
.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: grid;
    place-items: center;
    padding: 20px;
    background: #0d2638a8;
}

.modal-card {
    width: min(720px, 100%);
    max-height: 92vh;
    overflow: auto;
    background: #fff;
    border-radius: 15px;
    box-shadow: 0 28px 70px #0005;
}

.solicitud-admin-modal {
    width: min(980px, 100%);
}

.campo-builder-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 11px;
    padding: 11px;
    background: #fbfcfd;
    border: 1px solid var(--line);
    border-radius: 11px;
}

.campo-builder-main {
    min-width: 0;
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr);
    align-items: center;
    gap: 11px;
}

.campo-builder-main > div {
    min-width: 0;
}

.campo-builder-main strong,
.campo-builder-main small {
    display: block;
}

.campo-builder-main strong {
    font-size: 12px;
}

.campo-builder-main small {
    margin-top: 5px;
    color: var(--muted);
    font-size: 10px;
}

.campo-builder-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 5px;
    flex-wrap: wrap;
}

.btn.danger {
    color: #b33c3c;
    background: #fff2f2;
    border: 1px solid #f1cccc;
}

@media (max-width: 720px) {
    .campo-builder-card {
        grid-template-columns: 1fr;
    }

    .campo-builder-actions {
        justify-content: flex-start;
        padding-left: 47px;
    }
}

/* Identidad institucional: azul, verde y celeste. */
.institucional-roles { grid-template-columns:repeat(3,minmax(0,1fr)); }
.institucional-roles .role-card { display:flex; flex-direction:column; gap:12px; }
.institucional-roles .role-card .btn { margin-top:auto; }
.role-icon.rad { background:#e4f2fc; color:#09337F; }
.btn.green { background:#00D6BC; color:#06245A; }
.btn.sky { background:#dff1fc; color:#09337F; border:2px solid #0E84D4; }
.role-selected { border-color:#09337F; box-shadow:0 0 0 2px #09337F; }
.link-button { background:transparent; border:0; color:#09337F; text-decoration:underline; padding:12px 0; text-align:left; }
.cuenta-link { color:white; font-size:13px; }
.notice { border-left:4px solid #0E84D4; background:#eaf5fd; color:#09337F; padding:16px; margin-bottom:20px; border-radius:8px; }
.account-form { padding:24px; max-width:640px; }
.area-options { display:flex; flex-wrap:wrap; gap:20px; padding:16px; border:1px solid var(--line); border-radius:8px; }
.area-options input { accent-color:#09337F; }
.catalogo-filters { display:grid; gap:10px; padding:0 16px 16px; }
.account-alert { display:block; font-size:12px; margin-top:5px; color:#855400; background:#fff3cc; border-radius:5px; padding:4px 8px; width:fit-content; }
.pending-accounts { margin:16px 0; padding:18px; background:#fff8e6; border-radius:10px; border:1px solid #e8cb80; }
.pending-accounts summary { cursor:pointer; font-weight:700; }
.area-pill { color:#09337F; background:#e7f1ff; border-radius:5px; padding:3px 7px; font-size:12px; }
@media(max-width:900px){ .institucional-roles { grid-template-columns:1fr; } }

.role-icon.a { background:#d7faf5; color:#09337F; }
.kpi.green strong { color:#09337F; }


/* --------------------------------------------------------------------------
   Administrador · Búsqueda de perfiles
   -------------------------------------------------------------------------- */
.perfiles-panel-head { align-items: flex-end; }
.perfil-search-wrap { width: min(460px, 100%); }
.perfil-search-help { padding: 10px 19px; color: var(--muted); font-size: 11px; border-bottom: 1px solid var(--line); }
.perfiles-admin-table { min-width: 900px; }
.perfil-admin-modal { width: min(1080px, 100%); }
.perfil-summary-grid { grid-template-columns: repeat(3, 1fr); }
.perfil-readonly-note { margin: 10px 0 0; color: var(--muted); font-size: 11px; }
.perfil-solicitudes-table { min-width: 820px; }
.perfiles-admin-table .area-pill, .perfil-solicitudes-table .area-pill { display: inline-flex; margin: 1px 3px 1px 0; }
@media (max-width: 760px) {
    .perfiles-panel-head { align-items: stretch; flex-direction: column; }
    .perfil-search-wrap { width: 100%; }
    .perfil-summary-grid { grid-template-columns: 1fr; }
}

/* ADMINISTRACIÓN: DISTRIBUCIÓN DE FILTROS DE SOLICITUDES */

.solicitudes-panel .solicitudes-panel-head {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 20px;
}

.solicitudes-panel .solicitudes-panel-head > div:first-child {
    width: 100%;
}

.solicitudes-panel .solicitudes-filtros {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    width: 100%;
    max-width: none;
    align-items: end;
}

.solicitudes-panel .solicitudes-filtros > .form-group {
    min-width: 0;
    margin: 0;
}

.solicitudes-panel .solicitudes-filtros .control {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

/* Buscar ocupa media fila; los botones, la otra mitad. */

.solicitudes-panel .solicitudes-filtros > .form-group:nth-child(5) {
    grid-column: span 2;
}

.solicitudes-panel .solicitudes-filtros > .form-group:nth-child(6) {
    grid-column: span 2;
    display: flex;
    gap: 12px;
}

.solicitudes-panel .solicitudes-filtros > .form-group:nth-child(6) .btn {
    flex: 1;
    min-width: 0;
}

/* Pantallas medianas */

@media (max-width: 1100px) {
    .solicitudes-panel .solicitudes-filtros {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .solicitudes-panel .solicitudes-filtros > .form-group:nth-child(5),
    .solicitudes-panel .solicitudes-filtros > .form-group:nth-child(6) {
        grid-column: span 2;
    }
}

/* Celulares */

@media (max-width: 650px) {
    .solicitudes-panel .solicitudes-filtros {
        grid-template-columns: minmax(0, 1fr);
    }

    .solicitudes-panel .solicitudes-filtros > .form-group:nth-child(5),
    .solicitudes-panel .solicitudes-filtros > .form-group:nth-child(6) {
        grid-column: auto;
    }

    .solicitudes-panel .solicitudes-filtros > .form-group:nth-child(6) {
        flex-direction: column;
        align-items: stretch;
    }
}

.barra-exportar-solicitudes {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    padding: 0 20px 18px;
}

.barra-exportar-solicitudes[hidden] {
    display: none;
}

/* ADMINISTRACIÓN: CATEGORÍAS DE FORMULARIOS */

.selector-categoria-formularios {
    margin-bottom: 20px;
}

.categorias-formularios {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    padding: 0 20px 20px;
}

.categoria-formulario-btn {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    min-height: 120px;
    padding: 20px;
    border: 1px solid #d8e2f0;
    border-radius: 12px;
    background: #fff;
    color: #17345c;
    text-align: left;
    cursor: pointer;
}

.categoria-formulario-btn strong {
    font-size: 18px;
}

.categoria-formulario-btn span {
    font-size: 13px;
    line-height: 1.5;
    color: #64748b;
}

.categoria-formulario-btn:hover,
.categoria-formulario-btn.active {
    border-color: #17418d;
    background: #edf4ff;
}

.formularios-kpis[hidden],
.formularios-layout[hidden],
#nuevoFormulario[hidden] {
    display: none !important;
}

@media (max-width: 750px) {
    .categorias-formularios {
        grid-template-columns: 1fr;
    }
}