/* Ayllu · Estilos del panel con el sistema de diseño Kushki Pallay.
   Sin variables CSS ni :root: cada valor es el token ya resuelto, con su cadena de trazabilidad.
   Prefijo proto-- para no chocar con las clases ksk-- del layout oficial. */

.proto--reset {
    background: none; /* reset de <button> para elementos del layout (header) */
    border: none;
    font-family: 'IBM Plex Sans', sans-serif;
    cursor: pointer;
}

/* ---------- Foco visible global (semantic.focus.ring → blue.500 / 2px / 2px) ---------- */
.proto--wrapper a:focus-visible,
.proto--wrapper button:focus-visible,
.proto--wrapper input:focus-visible,
.proto--wrapper select:focus-visible,
.proto--wrapper textarea:focus-visible,
.proto--wrapper [tabindex]:focus-visible,
.proto--login input:focus-visible,
.proto--modal a:focus-visible,
.proto--modal button:focus-visible,
.proto--modal input:focus-visible,
.proto--modal select:focus-visible,
.proto--modal textarea:focus-visible,
.ksk--nav-item:focus-visible,
.ksk--user-dropdown:focus-visible {
    outline: 2px solid #023365; /* semantic.focus.ring.color → primitive.color.blue.500; width 2px */
    outline-offset: 2px;        /* semantic.focus.ring.offset */
}
a.ksk--nav-item {
    text-decoration: none;
}

/* ---------- Contenedor del contenido (dentro de #area-components) ---------- */
.proto--wrapper {
    width: 100%;
    height: 100%;
    overflow-y: auto;
    padding: 2rem;                 /* primitive.spacing.scale-700 */
    color: #46525c;                /* semantic.color.text.default → primitive.color.gray.800 */
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 500;              /* semantic.typography.p.fontWeight */
    font-size: 1rem;               /* semantic.typography.p.fontSize */
    line-height: 1.5;              /* semantic.typography.p.lineHeight */
    align-self: flex-start;
}
.proto--wrapper * {
    box-sizing: border-box;
}

.proto--view-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;                     /* primitive.spacing.scale-400 */
    margin-bottom: 1.5rem;         /* primitive.spacing.scale-600 */
}
.proto--title {
    margin: 0;
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 600;              /* semantic.typography.h3.fontWeight */
    font-size: 1.625rem;           /* semantic.typography.h3.fontSize */
    line-height: 1.2;              /* semantic.typography.h3.lineHeight */
    letter-spacing: 0em;
    color: #023365;                /* semantic.color.text.blue → primitive.color.blue.500 */
}
.proto--subtitle {
    margin: 0.25rem 0 0 0;         /* primitive.spacing.scale-100 */
    font-weight: 400;              /* semantic.typography.caption.fontWeight */
    font-size: 0.938rem;           /* semantic.typography.caption.fontSize */
    line-height: 1.2;
    color: #6d7781;                /* semantic.color.text.grey → primitive.color.gray.700 */
}
.proto--section-title {
    margin: 0;
    font-weight: 500;              /* semantic.typography.h5.fontWeight */
    font-size: 1.25rem;            /* semantic.typography.h5.fontSize */
    line-height: 1.4;
    color: #023365;                /* semantic.color.text.blue */
}
.proto--h6 {
    margin: 0;
    font-weight: 500;              /* semantic.typography.h6 */
    font-size: 1rem;
    line-height: 1.2;
    letter-spacing: 0.0015em;
    color: #023365;
}
.proto--actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;                   /* primitive.spacing.scale-200 */
    flex-wrap: wrap;
}
.proto--mono {
    font-family: 'IBM Plex Mono', monospace; /* semantic.typography.numeric-text.fontFamily */
    font-weight: 400;
    font-size: 1rem;
    line-height: 1.2;
    overflow-wrap: anywhere;
}
.proto--muted {
    color: #6d7781;                /* semantic.color.text.grey */
}

/* ---------- Links y breadcrumb (component.link / component.breadcrumb) ---------- */
.proto--link {
    color: #1e65ae;                /* component.link.states.focus.text → primitive.color.blue.400 (AA sobre blanco) */
    font-weight: 500;
    font-size: 0.938rem;           /* component.link.size.large.fontSize */
    text-decoration: none;
    background: none;
    border: none;
    padding: 0;
    font-family: inherit;
    cursor: pointer;
    transition: color 0.2s;
}
.proto--link:hover {
    color: #023365;                /* component.link.states.hover.text → primitive.color.blue.500 */
    text-decoration: underline;
}
.proto--breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    font-size: 0.938rem;
}
.proto--breadcrumb .material-symbols-rounded {
    font-size: 1.125rem;           /* component.common.icon.size.md */
    color: #6d7781;
}

/* ---------- Iconos (Material Symbols Rounded) ---------- */
.material-symbols-rounded {
    font-size: 1.125rem;           /* component.common.icon.size.md → primitive.dimension.18 */
    line-height: 1;
    flex-shrink: 0;
    user-select: none;
}
.proto--icon-lg {
    font-size: 1.5rem;             /* component.common.icon.size.lg */
}

/* ---------- Botones (component.button.text-button) ---------- */
.proto--btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;                   /* component.button.common.button-size.medium.gap */
    height: 2.25rem;               /* button-size.medium.height → primitive.dimension.36 */
    padding: 0 1rem;               /* button-size.medium.paddingX */
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 500;              /* component.button.text-button.common.fontWeight */
    font-size: 0.813rem;           /* button-size.medium.fontSize */
    line-height: 1.5;
    border-radius: 1rem;           /* button-primary.radius → semantic.radius.interactive.default */
    border: 1px solid transparent;
    cursor: pointer;
    white-space: nowrap;
    text-decoration: none;
    transition: background-color 0.2s, border-color 0.2s, color 0.2s, box-shadow 0.2s;
}
.proto--btn--sm {
    height: 2rem;                  /* button-size.small.height */
    padding: 0 0.75rem;            /* button-size.small.paddingX */
}
.proto--btn--lg {
    height: 2.5rem;                /* button-size.large.height */
    padding: 0 1.25rem;            /* button-size.large.paddingX */
    font-size: 0.938rem;           /* button-size.large.fontSize */
}
.proto--btn--block {
    width: 100%;
}
.proto--btn:disabled {
    opacity: 0.4;                  /* semantic.opacity.disabled → primitive.number.opacity.40 */
    cursor: not-allowed;
}

.proto--btn-primary {
    background-color: #4498ee;     /* button-primary.states.default.background → blue.200 */
    border-color: #4498ee;
    color: #ffffff;                /* states.default.text → white */
    box-shadow: 0 0.5rem 1.0625rem 0 rgba(106, 167, 197, 0.15), 0 1.6px 2.76px 0 rgba(106, 167, 197, 0.075); /* states.default.shadow → elevation-1 */
}
.proto--btn-primary:hover:not(:disabled) {
    background-color: #3879cd;     /* states.hover.background → blue.300 */
    border-color: #3879cd;
}
.proto--btn-primary:active:not(:disabled) {
    background-color: #3f8be0;     /* states.focus.background → blue.250 (estado active/pressed) */
    border-color: #3f8be0;
}

.proto--btn-secondary {
    background-color: #ffffff;     /* button-secondary.states.default.background → white */
    border-color: #ffffff;
    color: #6d7781;                /* states.default.text → gray.700 */
    box-shadow: 0 0.5rem 1.0625rem 0 rgba(106, 167, 197, 0.15), 0 1.6px 2.76px 0 rgba(106, 167, 197, 0.075);
}
.proto--btn-secondary:hover:not(:disabled) {
    background-color: #fbfcfe;     /* states.hover.background → gray.100 */
    border-color: #fbfcfe;
}
.proto--btn-secondary:active:not(:disabled) {
    color: #023365;                /* states.focus.text → blue.500 */
}

.proto--btn-error {
    background-color: #ffffff;     /* button-error.states.default.background → white */
    border-color: #ffeaee;         /* states.default.border → red.100 */
    color: #d62c4b;                /* states.default.text → red.500 #e24763; se usa red.600 para contraste AA */
}
.proto--btn-error:hover:not(:disabled) {
    background-color: #ffeaee;     /* states.hover.background → red.100 */
}

/* Acción destructiva final (confirmación de borrado): relleno rojo; deshabilitado hasta confirmar. */
.proto--btn-danger {
    background-color: #ad0c2a;     /* red.800: blanco sobre él cumple AA */
    border-color: #ad0c2a;
    color: #ffffff;
}
.proto--btn-danger:hover:not(:disabled) {
    background-color: #8a0921;
    border-color: #8a0921;
}

.proto--btn-outline {
    background-color: #ffffff;     /* button-outline.states.default.background → white */
    border-color: #4498ee;         /* states.default.border → blue.200 */
    color: #1e65ae;                /* states.default.text → blue.200; se usa blue.400 para contraste AA */
}
.proto--btn-outline:hover:not(:disabled) {
    border-color: #3879cd;         /* states.hover.border → blue.300 */
    color: #023365;
}

.proto--icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;                /* component.button.icon-button: medium → primitive.dimension.36 */
    height: 2.25rem;
    border-radius: 1rem;
    background-color: #ffffff;
    border: 1px solid #ffffff;
    color: #6d7781;
    cursor: pointer;
    box-shadow: 0 0.5rem 1.0625rem 0 rgba(106, 167, 197, 0.15), 0 1.6px 2.76px 0 rgba(106, 167, 197, 0.075);
    transition: background-color 0.2s, color 0.2s;
}
.proto--icon-btn:hover:not(:disabled) {
    background-color: #fbfcfe;
    color: #023365;
}
.proto--icon-btn:disabled {
    opacity: 0.4;                  /* semantic.opacity.disabled */
    cursor: not-allowed;
    box-shadow: none;
}

/* ---------- Tarjetas (semantic.radius.surface / semantic.shadow.sm / surface.default) ---------- */
.proto--card {
    background-color: #fbfcfe;     /* semantic.color.background.surface.default → gray.100 */
    border-radius: 0.75rem;        /* semantic.radius.surface.default → primitive.dimension.12 */
    box-shadow: 0 0.5rem 1.0625rem 0 rgba(106, 167, 197, 0.15), 0 1.6px 2.76px 0 rgba(106, 167, 197, 0.075); /* semantic.shadow.sm */
    padding: 1.5rem;               /* primitive.spacing.scale-600 */
    margin-bottom: 1.5rem;
}
.proto--card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1rem;
}
.proto--card-head .proto--btn[hidden] {
    display: none;                 /* el display del botón ganaría al atributo hidden */
}
.proto--steps {
    margin: 0;
    padding-left: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    color: #46525c;
}

/* ---------- Detalle del consumidor: tarjeta de identidad y gestión ---------- */
.proto--idcard {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    background-color: #fbfcfe;     /* semantic.color.background.surface.default */
    border-radius: 0.75rem;        /* semantic.radius.surface.default */
    box-shadow: 0 0.5rem 1.0625rem 0 rgba(106, 167, 197, 0.15), 0 1.6px 2.76px 0 rgba(106, 167, 197, 0.075); /* semantic.shadow.sm */
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.5rem;
}
.proto--id {
    display: flex;
    align-items: center;
    gap: 1rem;
    min-width: 0;
}
.proto--avatar {
    flex-shrink: 0;
    width: 4rem;
    height: 4rem;
    border-radius: 50%;
    background-color: #1e65ae;     /* primitive.color.blue.400 (igual que el avatar de la cabecera) */
    color: #ffffff;
    display: grid;
    place-items: center;
    font-weight: 600;
    font-size: 1.25rem;
}
.proto--id .proto--title {
    overflow-wrap: anywhere;
}
.proto--meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 1rem;
}

/* ---------- Resumen: indicadores, donut y rankings ---------- */
.proto--kpis {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.proto--kpi {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background-color: #fbfcfe;     /* semantic.color.background.surface.default */
    border-radius: 0.75rem;        /* semantic.radius.surface.default */
    box-shadow: 0 0.5rem 1.0625rem 0 rgba(106, 167, 197, 0.15), 0 1.6px 2.76px 0 rgba(106, 167, 197, 0.075); /* semantic.shadow.sm */
    padding: 1rem 1.25rem;
}
.proto--kpi .material-symbols-rounded {
    color: #1e65ae;                /* primitive.color.blue.400 */
}
.proto--kpi-value {
    font-weight: 600;
    font-size: 1.625rem;           /* semantic.typography.h3 */
    line-height: 1.2;
    color: #023365;
}
.proto--kpi-label {
    font-weight: 400;
    font-size: 0.938rem;
    color: #6d7781;
}
.proto--kpi-sub {
    font-weight: 400;
    font-size: 0.813rem;
    color: #6d7781;
}
.proto--grid3 {
    display: grid;
    grid-template-columns: 1.2fr 1fr 1fr;
    gap: 1rem;
    align-items: start;
}
.proto--grid3 .proto--card {
    margin-bottom: 0;
}
@media (max-width: 70rem) {
    .proto--grid3 {
        grid-template-columns: 1fr;
    }
}
.proto--donut {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    flex-wrap: wrap;
}
.proto--donut-num {
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 600;
    font-size: 1.5rem;
    fill: #023365;
}
.proto--donut-lbl {
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 400;
    font-size: 0.75rem;
    fill: #6d7781;
}
.proto--legend {
    list-style: none;
    margin: 0;
    padding: 0;
    flex: 1;
    min-width: 11rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    font-size: 0.875rem;
}
.proto--legend li {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.proto--legend i {
    width: 0.75rem;
    height: 0.75rem;
    border-radius: 0.1875rem;
    flex-shrink: 0;
}
.proto--legend b {
    margin-left: auto;
    color: #023365;
}
.proto--hbar {
    margin-bottom: 0.875rem;
}
.proto--hbar-top {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
    overflow-wrap: anywhere;
}
.proto--hbar-top b {
    color: #023365;
}
.proto--hbar-track {
    background-color: #e2e8f0;     /* gray.400 */
    border-radius: 99px;
    height: 0.5rem;
}
.proto--hbar-track i {
    display: block;
    height: 100%;
    border-radius: 99px;
    background-color: #4498ee;     /* blue.200 */
}

/* Últimos 4 caracteres de la key bajo su nombre (estilo «...i_xQ») */
.proto--key-last4 {
    display: block;
    margin-top: 0.25rem;
    color: #1e65ae;                /* component.link.states.focus.text → blue.400 */
    font-weight: 500;
    font-size: 0.938rem;           /* component.link.size.large.fontSize */
    letter-spacing: 0.02em;
}

/* ---------- Detalle del conector: iniciales y URLs ---------- */
.proto--logo {
    flex-shrink: 0;
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 0.75rem;        /* semantic.radius.surface.default */
    background-color: #023365;     /* primitive.color.blue.500 */
    color: #00e6b2;                /* primitive.color.green.500 */
    display: grid;
    place-items: center;
    font-weight: 600;
    font-size: 1.25rem;
}
.proto--title-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
}
.proto--urls {
    display: flex;
    align-items: stretch;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin: -0.5rem 0 1.5rem;
}
.proto--url {
    position: relative;
    flex: 1 1 18rem;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    background-color: #ffffff;
    border: 0.0625rem solid #e2e8f0;   /* semantic.color.border.decorative.default */
    border-radius: 0.75rem;
    padding: 0.75rem 3.5rem 0.75rem 1rem;
}
.proto--url-label {
    font-weight: 500;
    font-size: 0.75rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #6d7781;                /* semantic.color.text.grey */
}
.proto--url-value {
    font-size: 0.875rem;
    color: #023365;
}
.proto--url-copy {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
}
.proto--urls-arrow {
    display: grid;
    place-items: center;
    color: #6d7781;
}

/* ---------- Tabla (component.table) ---------- */
.proto--table-wrap {
    overflow-x: auto;              /* el body nunca hace scroll horizontal */
    width: 100%;
}
.proto--table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 0.5rem;      /* component.table.container.spacing.row → primitive.dimension.8 */
    background-color: #ffffff;     /* component.table.container.background → white */
}
.proto--table th {
    height: 45px;                  /* component.table.header.sizing.height */
    padding: 0 1rem;
    text-align: left;
    background-color: #e2e8f0;     /* component.table.header.background → gray.400 */
    color: #023365;                /* component.table.header.typography.color → blue.500 */
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 600;              /* header.typography.fontWeight */
    font-size: 0.875rem;           /* header.typography.fontSize */
    line-height: 1.2;
    white-space: nowrap;
}
.proto--table th:first-child {
    border-top-left-radius: 0.5rem;     /* component.table.header.border.radius → dimension.8 */
    border-bottom-left-radius: 0.5rem;
}
.proto--table th:last-child {
    border-top-right-radius: 0.5rem;
    border-bottom-right-radius: 0.5rem;
}
.proto--table td {
    padding: 0.75rem 1rem;
    background-color: #ffffff;     /* component.table.row.background.default → white */
    border-top: 0.0625rem solid #e2e8f0;    /* component.table.cell.border → width dimension.1 / gray.400 */
    border-bottom: 0.0625rem solid #e2e8f0;
    color: #6d7781;                /* component.table.cell.typography.color → gray.700 */
    font-weight: 500;              /* cell.typography.fontWeight */
    font-size: 0.875rem;           /* cell.typography.fontSize */
    line-height: 1.2;
    vertical-align: middle;
}
.proto--table td:first-child {
    border-left: 0.0625rem solid #e2e8f0;
    border-top-left-radius: 0.5rem;     /* component.table.cell.border.radius → dimension.8 */
    border-bottom-left-radius: 0.5rem;
}
.proto--table td:last-child {
    border-right: 0.0625rem solid #e2e8f0;
    border-top-right-radius: 0.5rem;
    border-bottom-right-radius: 0.5rem;
}
.proto--table tbody tr:hover td {
    background-color: #f7fafc;     /* component.table.row.background.hover → gray.200 */
}
.proto--table tbody tr.proto--row-click {
    cursor: pointer;
}
.proto--table td .proto--cell-strong {
    color: #023365;
    font-weight: 600;
}
.proto--table td .proto--cell-sub {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;         /* descripciones largas: máximo 2 líneas */
    overflow: hidden;
    max-width: 28rem;
    margin-top: 0.25rem;
    font-weight: 400;
    font-size: 0.813rem;
}
.proto--table td .proto--mono {
    font-size: 0.875rem;
}


/* ---------- Tag (component.tag) ---------- */
.proto--tag {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.75rem;      /* tag.base.padding (0.5rem/1.5rem) reducido en tablas: dimension.4/12 */
    border-radius: 0.75rem;        /* component.tag.base.radius → dimension.12 */
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 400;              /* tag.base.typography */
    font-size: 0.813rem;
    line-height: 1.2;
    white-space: nowrap;
}
.proto--tag .material-symbols-rounded {
    font-size: 0.875rem;           /* component.common.icon.size.sm */
}
.proto--tag-success {
    background-color: #e0fff8;     /* tag.variant.subtle.success.background → green.50 */
    color: #293036;                /* tag.variant.subtle.success.text → green.700 #0dc298 no alcanza AA; semantic.color.text.dark → gray.900, el check lleva green.700 */
}
.proto--tag-success .material-symbols-rounded {
    color: #0dc298;                /* tag.variant.subtle.success.text → primitive.color.green.700 */
}
.proto--tag-danger {
    background-color: #ffeaee;     /* subtle.danger.background → red.100 */
    color: #ad0c2a;                /* subtle.danger.text → red.600 #d62c4b; red.800 para AA */
}
.proto--tag-warning {
    background-color: #fff1d0;     /* subtle.warning.background → yellow.100 */
    color: #293036;                /* subtle.warning.text → yellow.900 #cf711a no alcanza AA; semantic.color.text.dark → gray.900 */
}
.proto--tag-warning .material-symbols-rounded {
    color: #cf711a;                /* tag.variant.subtle.warning.text → primitive.color.yellow.900 */
}
.proto--tag-info {
    background-color: #eef6ff;     /* subtle.info.background → blue.50 */
    color: #1e65ae;                /* subtle.info.text → blue.400 */
}
.proto--tag-neutral {
    background-color: #f7fafc;     /* subtle.neutral.background → gray.200 */
    color: #6d7781;                /* subtle.neutral.text → gray.600 #b4b9be (1.89:1); gray.700 mejora a 4.35:1, aún bajo AA: pendiente de Diseño */
}

/* ---------- Método HTTP (etiqueta compacta; reutiliza los colores de component.tag subtle) ---------- */
.proto--method {
    display: inline-block;
    min-width: 3.75rem;            /* ancho fijo para alinear rutas: cabe DELETE */
    padding: 0.125rem 0.5rem;      /* dimension.2/8 */
    border-radius: 0.25rem;        /* dimension.4 */
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 600;
    font-size: 0.75rem;
    line-height: 1.4;
    text-align: center;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

/* Ruta de un endpoint: no se corta dentro de un parámetro ({contract_id}); si no cabe, la tabla se desplaza. */
.proto--path {
    white-space: nowrap;
    overflow-wrap: normal;
}

/* ---------- Campos (component.text-field-float-label / selector-label-float) ---------- */
.proto--field {
    position: relative;            /* text-field-float-label.layout.position */
    margin-top: 0.75rem;
    margin-bottom: 1.25rem;
}
/* Aviso que acompaña a un campo (p. ej. el método de un endpoint): queda pegado a él como su texto de ayuda. */
.proto--field-alert {
    margin: -0.75rem 0 1.25rem;    /* 1.25rem del campo − 0.75rem = 0.5rem, igual que .proto--hint */
}
.proto--field-alert .proto--alert {
    margin: 0;
}
.proto--input,
.proto--select {
    display: block;
    width: 100%;
    height: 55px;                  /* text-field-float-label.layout.height */
    padding: 0.75rem 1rem;         /* container.padding y/x → dimension.12 / 16 */
    background-color: #ffffff;
    border: 0.0625rem solid #e2e8f0;   /* container.border.width / state.default → gray.400 */
    border-radius: 0.75rem;        /* container.border.radius → dimension.12 */
    color: #293036;                /* input-text.color → gray.900 */
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 500;              /* input-text.typography.fontWeight */
    font-size: 1rem;
    line-height: 1.5;
    transition: border-color 0.2s;
}
/* Área de texto de varias líneas con el mismo estilo de campo; crece solo en vertical. */
.proto--textarea {
    height: auto;
    min-height: 6rem;              /* ~3 líneas */
    padding-top: 1rem;             /* deja aire bajo la etiqueta flotante */
    resize: vertical;
}
.proto--select {
    appearance: none;
    padding-right: 2.5rem;
    cursor: pointer;
}
.proto--select-icon {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.5rem;             /* component.common.icon.size.lg */
    color: #6d7781;
    pointer-events: none;
}
.proto--input:hover,
.proto--select:hover {
    border-color: #1e65ae;         /* container.border.state.hover → blue.400 */
}
.proto--input:focus,
.proto--select:focus {
    border-color: #023365;         /* container.border.state.focus → blue.500 */
    outline: none;
    box-shadow: 0 0 0 2px #ffffff, 0 0 0 4px #023365; /* semantic.focus.ring: 2px + offset 2px */
}
.proto--field-label {
    position: absolute;
    top: 0;                        /* label.layout.top */
    left: 1rem;                    /* label.layout.offset-left */
    transform: translateY(-50%);   /* label.layout.transform */
    padding: 0 0.25rem;
    background-color: #ffffff;
    color: #6d7781;                /* label.state.default → gray.600 #b4b9be; gray.700 para AA */
    font-weight: 400;              /* label.typography.fontWeight */
    font-size: 0.938rem;           /* label.typography.fontSize */
    line-height: 1.2;
    pointer-events: none;
}
.proto--input:focus ~ .proto--field-label,
.proto--select:focus ~ .proto--field-label {
    color: #023365;                /* label.state.focus → blue.500 */
}
.proto--field--error .proto--input,
.proto--field--error .proto--select {
    border-color: #e24763;         /* container.border.state.error → red.500 */
}
.proto--field--error .proto--field-label {
    color: #ad0c2a;                /* label.state.error → red.500 #e24763; red.800 para AA */
}
.proto--input:disabled,
.proto--select:disabled {
    opacity: 0.4;                  /* state-overlay.disabled.opacity */
    border-color: #f0f4f8;         /* container.border.state.disabled → gray.300 */
    cursor: not-allowed;
}
.proto--helper {
    display: none;
    align-items: center;
    gap: 0.25rem;
    margin: 0.5rem 0 0 0;
    color: #ad0c2a;                /* helper-text.color → red.600 #d62c4b; red.800 para AA */
    font-weight: 400;              /* helper-text.typography */
    font-size: 0.938rem;
    line-height: 1.2;
}
.proto--helper .material-symbols-rounded {
    font-size: 1.25rem;            /* icon.error.size */
    color: #ad0c2a;                /* icon.error.color → red.500 */
}
.proto--field--error .proto--helper {
    display: flex;
}
.proto--hint {
    margin: 0.5rem 0 0 0;
    overflow-wrap: anywhere;       /* las URLs de ejemplo no desbordan en pantallas angostas */
    font-weight: 400;
    font-size: 0.938rem;
    color: #6d7781;
}
.proto--search {
    position: relative;
    width: 100%;
    max-width: 22rem;
    margin: 0;
}
.proto--search .proto--input {
    padding-right: 3rem;
}
.proto--search .proto--select-icon {
    font-size: 1.5rem;
}

/* ---------- Barra de filtros ---------- */
.proto--toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0 1rem;                   /* primitive.spacing.scale-400 */
    align-items: flex-start;
}
.proto--toolbar .proto--field {
    flex: 1 1 12rem;
    max-width: 16rem;
    margin-bottom: 0.75rem;
}
.proto--toolbar .proto--search {
    flex: 2 1 16rem;
    max-width: 22rem;
    margin-top: 0.75rem;
}

/* ---------- Permisos: guía por pasos y botones segmentados ---------- */
.proto--steps3 {
    list-style: none;
    margin: 0 0 1.25rem;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
}
@media (max-width: 48rem) {
    .proto--steps3 { grid-template-columns: 1fr; }
}
.proto--steps3 li {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background-color: #ffffff;
    border: 0.0625rem solid #e2e8f0;   /* semantic.color.border.decorative.default */
    border-radius: 0.75rem;
}
.proto--steps3 li.on {
    background-color: #eef6ff;     /* blue.50 */
    border-color: #4498ee;         /* blue.200 */
}
.proto--step-num {
    flex-shrink: 0;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 50%;
    background-color: #f0f4f8;     /* gray.300 */
    color: #6d7781;
    display: grid;
    place-items: center;
    font-weight: 600;
    font-size: 0.875rem;
}
.proto--steps3 li.on .proto--step-num {
    background-color: #1e65ae;     /* blue.400 */
    color: #ffffff;
}
.proto--step-num .material-symbols-rounded {
    font-size: 1rem;
}
.proto--steps3 b {
    display: block;
    color: #023365;
    font-weight: 600;
}
.proto--steps3 li span:not(.proto--step-num):not(.material-symbols-rounded) {
    font-weight: 400;
    font-size: 0.813rem;
    color: #6d7781;
}
/* Filtro por método en Permisos: botón con la selección y una lista de casillas (varios a la vez). */
.proto--mfilter {
    position: relative;
    margin: 0.75rem 0;
}
/* Con el filtro por método el buscador conserva su ancho (su etiqueta no baja de línea); si no cabe, la fila se parte. */
.proto--toolbar:has(.proto--mfilter) .proto--search {
    min-width: min(100%, 22rem);
}
.proto--mfilter-btn {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    min-width: 11rem;
    height: 55px;                  /* misma altura que .proto--input */
    padding: 0 1rem;
    background-color: #ffffff;
    border: 0.0625rem solid #e2e8f0;
    border-radius: 0.75rem;
    color: #293036;
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 500;
    font-size: 1rem;
    cursor: pointer;
}
.proto--mfilter-badge {
    display: inline-grid;
    place-items: center;
    min-width: 1.375rem;
    height: 1.375rem;
    margin-left: 0.5rem;
    padding: 0 0.375rem;
    border-radius: 999px;
    background-color: #1e65ae;     /* blue.400 */
    color: #ffffff;
    font-size: 0.75rem;
    font-weight: 600;
    vertical-align: middle;
}
.proto--mfilter-badge[hidden] {
    display: none;
}
.proto--mfilter-btn:focus-visible {
    border-color: #023365;
    outline: none;
    box-shadow: 0 0 0 2px #ffffff, 0 0 0 4px #023365;
}
.proto--mfilter-btn[aria-expanded="true"] .material-symbols-rounded {
    transform: rotate(180deg);
}
.proto--mfilter-list {
    position: absolute;
    z-index: 20;
    top: calc(100% + 0.25rem);
    left: 0;
    min-width: 100%;
    display: grid;
    gap: 0.125rem;
    padding: 0.5rem;
    background-color: #ffffff;
    border: 0.0625rem solid #e2e8f0;
    border-radius: 0.75rem;
    box-shadow: 0 0.5rem 1.5rem rgba(2, 51, 101, 0.12);
    outline: none;
}
.proto--mfilter-list[hidden] {
    display: none;
}
.proto--mfilter-list .proto--check {
    display: flex;
    padding: 0.5rem;
    border-radius: 0.5rem;
}
.proto--mfilter-list .proto--check:hover {
    background-color: #f6f8fb;
}
.proto--mfilter-list .proto--check-text {
    display: flex;
    align-items: center;
    flex: 1;
    gap: 0.75rem;
    white-space: nowrap;
}
.proto--mfilter-list .proto--act-ic {
    font-size: 1.25rem;
    vertical-align: middle;
}
.proto--mfilter-n {
    margin-left: auto;
    color: #6d7781;
    font-size: 0.875rem;
    font-weight: 400;
}
.proto--toolbar-center {
    align-items: center;
}
.proto--seg {
    display: inline-flex;
    gap: 0.25rem;
    padding: 0.25rem;
    background-color: #ffffff;
    border: 0.0625rem solid #e2e8f0;
    border-radius: 1rem;           /* semantic.radius.interactive.default */
    margin-top: 0.75rem;
    margin-bottom: 0.75rem;
}
.proto--seg-btn {
    border: none;
    background: none;
    padding: 0.5rem 0.875rem;
    border-radius: 0.75rem;
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 500;
    font-size: 0.875rem;
    color: #6d7781;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
}
.proto--seg-btn:hover {
    color: #023365;
}
.proto--seg-btn[aria-checked="true"] {
    background-color: #eef6ff;     /* blue.50 */
    color: #023365;
}
.proto--seg-btn:focus-visible {
    outline: 2px solid #023365;    /* semantic.focus.ring */
    outline-offset: 2px;
}
.proto--seg-count {
    margin-left: 0.25rem;
    padding: 0 0.375rem;
    border-radius: 0.5rem;
    background-color: #f0f4f8;
    font-size: 0.75rem;
}
.proto--seg-btn[aria-checked="true"] .proto--seg-count {
    background-color: #bfdffa;     /* blue.100 */
}

/* ---------- Tabs (component.tab) ---------- */
.proto--tabs {
    display: flex;
    gap: 0.5rem;                   /* component.tab.container.gap */
    box-shadow: inset 0 -0.125rem 0 0 #e2e8f0;  /* tab.state.default.indicator-color → gray.400; indicator-height 0.125rem */
    margin-bottom: 1.5rem;
    overflow-x: auto;
}
.proto--tab {
    height: 59px;                  /* tab.container.height */
    padding: 0 1rem;               /* tab.container.padding-x */
    background: none;
    border: none;
    border-bottom: 0.125rem solid transparent;
    color: #6d7781;                /* tab.state.default.label-color → gray.600 #b4b9be; gray.700 para AA */
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 500;              /* tab.label.typography */
    font-size: 1rem;
    letter-spacing: 0.0015em;
    cursor: pointer;
    white-space: nowrap;
    transition: color 0.2s, border-color 0.2s;
}
.proto--tab:hover {
    color: #023365;                /* tab.state.hover.label-color → blue.500 */
    border-bottom-color: #023365;  /* tab.state.hover.indicator-color */
}
.proto--tab[aria-selected="true"] {
    color: #1e65ae;                /* tab.state.active.label-color → blue.200 #4498ee; blue.400 para AA */
    border-bottom-color: #4498ee;  /* tab.state.active.indicator-color → blue.200 */
}

/* ---------- Checkbox (component.checkbox) ---------- */
.proto--check {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;                   /* checkbox.label.spacing */
    position: relative;
    cursor: pointer;
    color: #46525c;                /* checkbox.label.color → gray.800 */
    font-weight: 500;              /* checkbox.label.typography */
    font-size: 1rem;
    line-height: 1.5;
    min-height: 1.75rem;
}
.proto--check input {
    position: absolute;
    opacity: 0;
    width: 1.125rem;
    height: 1.125rem;
    margin: 0;
    cursor: pointer;
}
.proto--check-box {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.125rem;               /* checkbox.container.width */
    height: 1.125rem;
    border: 0.125rem solid #4498ee;     /* checkbox.container.border-width / unchecked border-color → blue.200 */
    border-radius: 0.125rem;       /* checkbox.container.border-radius */
    background-color: rgba(0, 0, 0, 0); /* unchecked.background-color → transparent */
    flex-shrink: 0;
    color: #4498ee;                /* checked.icon-color → blue.200 */
}
.proto--check-box .material-symbols-rounded {
    font-size: 0.75rem;            /* checkbox.icon.size */
    font-weight: 700;
    visibility: hidden;
}
.proto--check input:checked + .proto--check-box .material-symbols-rounded {
    visibility: visible;
}
.proto--check input:focus-visible + .proto--check-box {
    outline: 2px solid #023365;    /* checkbox.state.focus.ring */
    outline-offset: 2px;           /* checkbox.state.focus.ring-offset */
}
.proto--check input:disabled + .proto--check-box {
    border-color: #f0f4f8;         /* checkbox.state.disabled.border-color → gray.300 */
    background-color: #f7fafc;     /* disabled.background-color → gray.200 */
    cursor: not-allowed;
}
.proto--check input:disabled ~ .proto--check-text {
    opacity: 0.4;
}

/* ---------- Switch (component.switch) ---------- */
.proto--switch {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    color: #46525c;
    font-size: 0.938rem;
    font-weight: 500;
}
.proto--switch-track {
    position: relative;
    width: 2.5rem;                 /* switch.track.width */
    height: 1.5rem;                /* switch.track.height */
    border-radius: 3rem;           /* switch.track.border-radius */
    background-color: #6d7781;     /* switch.state.enabled.off.track-color → gray.600 #b4b9be; gray.700 para contraste UI 3:1 */
    border: none;
    padding: 0.25rem;              /* switch.track.padding */
    transition: background-color 0.2s;
    cursor: pointer;
}
.proto--switch-track::after {
    content: '';
    position: absolute;
    top: 0.25rem;
    left: 0.25rem;
    width: 1rem;                   /* switch.thumb.width */
    height: 1rem;
    border-radius: 0.75rem;        /* switch.thumb.border-radius */
    background-color: #ffffff;     /* switch.thumb.color → white */
    transition: transform 0.2s;
}
.proto--switch-track[aria-checked="true"] {
    background-color: #4498ee;     /* switch.state.enabled.on.track-color → blue.200 */
}
.proto--switch-track[aria-checked="true"]::after {
    transform: translateX(1rem);
}
.proto--switch-track:disabled {
    background-color: #e2e8f0;     /* switch.state.disabled.off.track-color → gray.400 */
    cursor: not-allowed;
}

/* ---------- Alert (component.alert) ---------- */
.proto--alert {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;                   /* alert.common.gap */
    padding: 0.75rem 1rem;         /* alert.common.paddingY / paddingX */
    border-radius: 0.75rem;        /* alert.common.radius */
    border: none;
    margin-bottom: 1rem;
    color: #293036;                /* alert.common.body.color → gray.900 */
    font-size: 0.875rem;           /* alert.common.body.fontSize */
    line-height: 1.4;
}
.proto--alert .material-symbols-rounded {
    font-size: 1.25rem;            /* alert.common.icon.size */
    margin-top: 0.0625rem;         /* alert.common.icon.marginTop */
}
.proto--alert-title {
    font-weight: 600;              /* alert.common.title.fontWeight */
    font-size: 0.938rem;           /* alert.common.title.fontSize */
}
.proto--alert-info {
    background-color: #eef6ff;     /* alert.variant.info.containerBackground → blue.50 */
}
.proto--alert-info .proto--alert-title,
.proto--alert-info .material-symbols-rounded {
    color: #1e65ae;                /* alert.variant.info.titleColor → blue.400 */
}
.proto--alert-warning {
    background-color: #fff1d0;     /* variant.warning.containerBackground → yellow.100 */
}
.proto--alert-warning .proto--alert-title {
    color: #293036;                /* variant.warning.titleColor → yellow.900 #cf711a no alcanza AA; semantic.color.text.dark */
}
.proto--alert-warning .material-symbols-rounded {
    color: #cf711a;                /* variant.warning.iconColor → primitive.color.yellow.900 */
}
.proto--alert-error {
    background-color: #ffeaee;     /* variant.error.containerBackground → red.100 */
}
.proto--alert-error .proto--alert-title,
.proto--alert-error .material-symbols-rounded {
    color: #ad0c2a;                /* variant.error.titleColor → red.600 #d62c4b; red.800 para AA */
}

/* ---------- Snackbar (component.snackbar) ---------- */
.proto--snackbar-host {
    position: fixed;
    right: 1.5rem;
    bottom: 1.5rem;
    z-index: 9999;                 /* semantic.z-index.tooltip */
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-width: calc(100vw - 3rem);
}
.proto--snackbar {
    display: flex;
    align-items: center;
    gap: 0.75rem;                  /* snackbar.common.content.gap */
    min-height: 72px;              /* snackbar.size.default.height */
    padding: 0 1rem;
    border-radius: 0.75rem;        /* snackbar.common.layout.borderRadius */
    box-shadow: 0 0.5rem 1.0625rem 0 rgba(106, 167, 197, 0.15), 0 1.6px 2.76px 0 rgba(106, 167, 197, 0.075);
    font-weight: 500;
    font-size: 0.938rem;
}
.proto--snackbar-info {
    background-color: #eef6ff;     /* snackbar.info.background → blue.50 */
    color: #1e65ae;                /* snackbar.info.text.color → blue.400 */
}
.proto--snackbar-danger {
    background-color: #ffeaee;     /* snackbar.danger.background → red.100 */
    color: #ad0c2a;                /* snackbar.danger.text.color → red.600; red.800 para AA */
}
.proto--snackbar .proto--icon-close {
    margin-left: auto;
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 0.5rem;
}

/* ---------- Modal (superficie del sistema: surface + shadow.md + z-index.modal) ---------- */
.proto--modal {
    position: fixed;
    inset: 0;
    z-index: 1000;                 /* semantic.z-index.modal */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}
.proto--modal[hidden] {
    display: none;
}
.proto--modal-backdrop {
    position: absolute;
    inset: 0;
    background-color: #293036;     /* semantic.color.background.surface.dark → gray.900 */
    opacity: 0.7;                  /* semantic.opacity.medium → primitive.number.opacity.70 */
}
.proto--dialog {
    position: relative;
    width: 100%;
    max-width: 30rem;
    max-height: 90vh;
    overflow-y: auto;
    background-color: #ffffff;
    border-radius: 0.75rem;        /* semantic.radius.surface.default */
    box-shadow: 0 2.25rem 4.0625rem 0 rgba(106, 167, 197, 0.16), 0 18.23px 28.34px 0 rgba(106, 167, 197, 0.12), 0 7.2px 10.56px 0 rgba(106, 167, 197, 0.08), 0 1.58px 3.76px 0 rgba(106, 167, 197, 0.03); /* semantic.shadow.md */
    padding: 2rem;                 /* primitive.spacing.scale-700 */
    color: #46525c;
    font-family: 'IBM Plex Sans', sans-serif;
}
.proto--dialog--wide {
    max-width: 44rem;
}
.proto--dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 1.5rem;
}
.proto--dialog-title {
    margin: 0 0 1rem 0;
    font-weight: 500;              /* semantic.typography.h5 */
    font-size: 1.25rem;
    line-height: 1.4;
    color: #023365;
}
.proto--keybox {
    user-select: all;              /* un clic selecciona la key completa, para copiarla a mano si hace falta */
    cursor: text;
    background-color: #f7fafc;     /* semantic.color.background.surface.subtle → gray.200 */
    border: 0.0625rem dashed #4498ee;
    border-radius: 0.75rem;
    padding: 1rem;
    margin: 1rem 0;
    color: #293036;
    overflow-wrap: anywhere;
}
/* Bloque con etiqueta arriba e icono de copiar dentro: solo el texto se selecciona con un clic. */
.proto--keybox-label {
    margin: 1rem 0 0.5rem;
    font-weight: 500;
    font-size: 0.875rem;
    color: #293036;
}
.proto--keybox-copy {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    margin-top: 0;
    user-select: auto;
    cursor: auto;
}
.proto--keybox-text {
    flex: 1;
    min-width: 0;
    user-select: all;
    cursor: text;
}
.proto--keybox-copy .proto--icon-btn-sm {
    flex: none;
    margin: -0.25rem -0.25rem 0 0;
}
.proto--scroll-box {
    max-height: 13rem;
    overflow-y: auto;
    margin-bottom: 1rem;
}
.proto--scroll-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.25rem 0;
}

/* ---------- Estados de vista: cargando / vacío (component.loader) ---------- */
.proto--loader {
    width: 120px;                  /* component.loader.container.width */
    margin: 3rem auto;
    padding: 1rem;
    background-color: #ffffff;     /* component.loader.container.background */
    border-radius: 0.5rem;         /* component.loader.container.borderRadius */
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    color: #6d7781;
    font-weight: 400;
    font-size: 0.938rem;
}
.proto--spinner {
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    border: 0.25rem solid #e2e8f0; /* gray.400 */
    border-top-color: #4498ee;     /* blue.200 */
    animation: proto_spin 0.9s linear infinite;
}
@keyframes proto_spin {
    to { transform: rotate(360deg); }
}
.proto--empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 2rem 1rem;
    text-align: center;
    color: #6d7781;
    font-weight: 400;
}
.proto--empty .material-symbols-rounded {
    font-size: 1.5rem;
    color: #6d7781;
}

/* Estado vacío destacado (lista sin elementos): icono, título, texto y una sola acción */
.proto--empty-hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    padding: 3rem 1rem;            /* primitive.spacing.scale-900 */
    text-align: center;
}
.proto--empty-icon {
    width: 4rem;
    height: 4rem;
    border-radius: 50%;
    background-color: #eef6ff;     /* primitive.color.blue.50 */
    color: #1e65ae;                /* primitive.color.blue.400 */
    display: grid;
    place-items: center;
    margin-bottom: 0.25rem;
}
.proto--empty-icon .material-symbols-rounded {
    font-size: 2rem;
}
.proto--empty-hero .proto--btn {
    margin-top: 0.5rem;
}

/* ---------- Árbol de permisos ---------- */
.proto--conn {
    border: 0.0625rem solid #e2e8f0;
    border-radius: 0.75rem;
    margin-bottom: 1rem;
    overflow: hidden;
}
.proto--conn-head {
    padding: 0.75rem 1rem;
    background-color: #eef6ff;     /* blue.50 */
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.proto--conn[hidden] {
    display: none;
}
.proto--conn-toggle {
    width: 2rem;
    height: 2rem;
    margin-left: 0.5rem;
}
.proto--conn-toggle .material-symbols-rounded {
    transition: transform 0.2s;
}
.proto--conn-toggle[aria-expanded="false"] .material-symbols-rounded {
    transform: rotate(-90deg);
}
.proto--ep {
    padding: 1rem;
    border-top: 0.0625rem solid #e2e8f0;
}
.proto--ep-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem 1rem;
}
.proto--ep-main {
    flex: 1 1 18rem;
    min-width: 0;
}
/* Descripción del endpoint en Permisos: hasta 100 caracteres y "...", baja de línea según el ancho; «Ver más» la completa. */
.proto--ep-desc {
    margin: 0 0 0 1.625rem;        /* alineada con el texto del checkbox, como .proto--ep-sub */
    font-size: 0.875rem;
    color: #6d7781;                /* gray.700 */
    overflow-wrap: anywhere;
}
.proto--ep-desc-more {
    padding: 0;
    font-size: inherit;
    vertical-align: baseline;
}
.proto--ep-sub {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 0.125rem 0 0 1.625rem; /* alineado con el texto del checkbox: 1.125rem + 0.5rem */
}
.proto--ep-sub .proto--mono {
    font-size: 0.875rem;
}
.proto--ep-side {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}
.proto--ep-body {
    padding: 0.75rem 0 0 1.75rem;
}
.proto--ep-body--off {
    opacity: 0.4;                  /* semantic.opacity.disabled */
}
/* ---------- Permisos agrupados: recurso (nivel 1) > acción (nivel 2) > endpoint (nivel 3) ---------- */
.proto--res {
    border-top: 0.0625rem solid #e2e8f0;
}
.proto--conn-body > .proto--res:first-child {
    border-top: 0;
}
.proto--res[hidden],
.proto--act[hidden] {
    display: none;
}
.proto--res-head {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem 0.75rem;
    padding: 0.625rem 1rem;
}
.proto--res-toggle {
    width: 2rem;
    height: 2rem;
}
.proto--res-toggle .material-symbols-rounded {
    transition: transform 0.2s;
}
.proto--res-toggle[aria-expanded="false"] .material-symbols-rounded {
    transform: rotate(-90deg);
}
.proto--res-sum {
    margin-left: 0.25rem;
    font-size: 0.875rem;
}
.proto--res-count {
    margin-left: auto;
    font-size: 0.875rem;
}
.proto--res-body {
    background-color: #f8fafc;     /* gray.50 */
    padding-bottom: 0.25rem;
}
.proto--act-head {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.25rem 0.75rem;
    padding: 0.625rem 1rem 0.25rem 3.25rem;
    border-top: 0.0625rem solid #e2e8f0;
}
.proto--act-head .proto--check {
    align-items: center;
}
.proto--act-head .proto--act-ic {
    font-size: 1.25rem;
    margin-right: 0.25rem;
    vertical-align: middle;
}
.proto--act-view .proto--act-ic { color: #1f5fbf; }
.proto--act-create .proto--act-ic { color: #0f7a5a; }
.proto--act-edit .proto--act-ic { color: #8a5a00; }
.proto--act-erase .proto--act-ic,
.proto--act-erase .proto--act-head b { color: #b3261e; }
.proto--act-verbs {
    font-size: 0.8125rem;
}
.proto--act-count {
    margin-left: auto;
    font-size: 0.875rem;
}
.proto--act .proto--ep {
    padding-left: 5.25rem;
    border-top-color: #eef1f5;
}
.proto--act-head + .proto--ep {
    border-top: 0;
}

.proto--fields {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr));
    gap: 0.25rem 1rem;
    margin-top: 0.75rem;
}
.proto--fields .proto--check-text {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: 0.875rem;
    overflow-wrap: anywhere;
}

/* ---------- Login (diseño solicitado: tarjeta centrada con marca, botón de Google y pie) ---------- */
.proto--login {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;               /* primitive.spacing.scale-600 */
    background-color: #f7fafc;     /* mismo fondo del layout (body) → gray.200 */
    font-family: 'IBM Plex Sans', sans-serif;
    color: #46525c;                /* semantic.color.text.default */
    overflow-y: auto;
}
.proto--login[hidden] {
    display: none;
}
.proto--login-card {
    width: 100%;
    max-width: 28rem;
    margin: auto;
    background-color: #ffffff;
    border: 0.0625rem solid #e2e8f0;    /* semantic.color.border.decorative.default → gray.400 */
    border-radius: 1.5rem;         /* solicitado por el diseño de referencia (más redondeado que radius.surface 0.75rem) */
    box-shadow: 0 2.25rem 4.0625rem 0 rgba(106, 167, 197, 0.16), 0 18.23px 28.34px 0 rgba(106, 167, 197, 0.12), 0 7.2px 10.56px 0 rgba(106, 167, 197, 0.08), 0 1.58px 3.76px 0 rgba(106, 167, 197, 0.03); /* semantic.shadow.md */
    padding: 3rem 2rem 2rem;       /* primitive.spacing.scale-900 / scale-700 */
    text-align: center;
}
.proto--wordmark {
    margin: 0;
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 600;              /* semantic.typography.h3.fontWeight */
    font-size: 2.250rem;           /* semantic.typography.h1.fontSize */
    line-height: 1.2;
    letter-spacing: 0.18em;
    background: linear-gradient(90deg, #3b9d86 0%, #00e6b2 100%); /* primitive.color.green.900 → primitive.color.green.500 */
    -webkit-background-clip: text;
    background-clip: text;
    color: #3b9d86;                /* respaldo si no hay background-clip: green.900 */
    -webkit-text-fill-color: transparent;
}
.proto--login-tagline {
    margin: 0.5rem 0 0 0;
    font-weight: 400;              /* semantic.typography.p-plus.fontWeight */
    font-size: 1.125rem;           /* semantic.typography.p-plus.fontSize */
    line-height: 1.5;
    color: #6d7781;                /* semantic.color.text.grey */
}
.proto--login-text {
    margin: 2rem 0 1.5rem 0;
    font-weight: 400;
    font-size: 1.25rem;            /* semantic.typography.subtitle-1.fontSize */
    line-height: 1.5;
    color: #46525c;                /* semantic.color.text.default */
}
.proto--btn-google {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    width: 100%;
    height: 3.5rem;                /* primitive.spacing.scale-1000 */
    background-color: #ffffff;
    border: 0.0625rem solid #e2e8f0;    /* gray.400 */
    border-radius: 1rem;           /* semantic.radius.interactive.default */
    color: #293036;                /* semantic.color.text.dark → gray.900 */
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 600;
    font-size: 1.125rem;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s;
}
.proto--btn-google:hover {
    background-color: #fbfcfe;     /* gray.100 */
    border-color: #cbd5e0;         /* gray.500 */
}
.proto--btn-google:focus-visible,
.proto--login-alt:focus-visible {
    outline: 2px solid #023365;    /* semantic.focus.ring */
    outline-offset: 2px;
}
.proto--login-dev {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    margin: 1rem 0 0 0;
    padding: 0.5rem 0.75rem;
    border-radius: 0.75rem;        /* component.alert.common.radius */
    background-color: #fff1d0;     /* component.alert.variant.warning.containerBackground → yellow.100 */
    color: #293036;                /* semantic.color.text.dark */
    font-weight: 500;
    font-size: 0.875rem;           /* component.alert.common.body.fontSize */
}
.proto--login-dev .material-symbols-rounded {
    color: #cf711a;                /* component.alert.variant.warning.iconColor → yellow.900 */
}
.proto--login-alt {
    margin-top: 1rem;
    background: none;
    border: none;
    padding: 0.5rem;
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 500;
    font-size: 0.938rem;           /* component.link.size.large.fontSize */
    color: #1e65ae;                /* component.link.states.focus.text → blue.400 */
    cursor: pointer;
}
.proto--login-alt:hover {
    color: #023365;                /* component.link.states.hover.text */
    text-decoration: underline;
}
.proto--login-form {
    margin-top: 1rem;
    text-align: left;
}
.proto--login-form[hidden] {
    display: none;
}
.proto--login-card #login-alert {
    text-align: left;
}
.proto--login-footer {
    margin: 1.5rem 0 0 0;
    font-weight: 400;
    font-size: 0.938rem;           /* semantic.typography.caption.fontSize */
    color: #6d7781;
}

/* ---------- Menú lateral reducido (botón ☰ de la barra superior) ---------- */
.proto--menu-toggle {
    width: 2.5rem;
    height: 2.5rem;
    margin-left: -0.5rem;
    border-radius: 0.5rem;
    display: grid;
    place-items: center;
    color: #46525c;                /* gray.800 */
}
.proto--menu-toggle:hover {
    background-color: #f0f4f8;     /* gray.300, igual que el hover del menú */
}
.proto--menu-toggle:focus-visible {
    outline: 2px solid #023365;    /* semantic.focus.ring */
    outline-offset: 2px;
}
.ksk--sidebar {
    transition: width 0.2s, padding 0.2s;
}
/* Solo iconos: mismo ancho que en pantallas pequeñas; el nombre se oculta a la vista, no a los lectores de pantalla. */
.proto--nav-mini .ksk--sidebar {
    width: 4.5rem;
    padding: 1.5rem 0.5rem;
}
.proto--nav-mini .ksk--sidebar .ksk--nav-item {
    justify-content: center;
}
.proto--nav-mini .ksk--sidebar .ksk--nav-item span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}
.proto--nav-mini .ksk--sidebar .ksk--nav-item.ksk--active {
    background-color: #e7f0fb;     /* sin el nombre, la opción actual se marca con un fondo */
}

/* ---------- Layout: ajustes para pantallas pequeñas ---------- */
@media (max-width: 48rem) {
    .proto--menu-toggle {
        display: none;             /* en pantallas pequeñas el menú ya es solo iconos */
    }
    .ksk--sidebar {
        width: 4.5rem;
        padding: 1rem 0.5rem;
    }
    .ksk--sidebar .ksk--nav-item span {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
    }
    .ksk--content-area {
        padding: 0.75rem;
    }
    .proto--wrapper {
        padding: 1rem;
    }
    .ksk--top-bar {
        padding: 0 0.75rem;
    }
    .ksk--merchant-info,
    .ksk--divider,
    .ksk--btn-admin,
    .ksk--user-dropdown span {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .proto--btn,
    .proto--tab,
    .proto--input,
    .proto--select,
    .proto--switch-track,
    .proto--switch-track::after,
    .proto--conn-toggle .material-symbols-rounded,
    .proto--link {
        transition: none;
    }
    .proto--spinner {
        animation: none;
    }
}

/* ---------- Menú de usuario de la cabecera (chip + desplegable) ---------- */
.proto--usermenu {
    position: relative;
}
.proto--userchip {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.5rem 0.25rem 0.25rem; /* dimension.4 / 8 */
    border: 0.0625rem solid #e2e8f0;  /* semantic.color.border.decorative.default → gray.400 */
    border-radius: 62.4375rem;        /* píldora */
    color: #293036;                   /* semantic.color.text.dark → gray.900 */
    font-size: 0.875rem;
    font-weight: 500;
    transition: background-color 0.2s, border-color 0.2s;
}
.proto--userchip:hover,
.proto--userchip[aria-expanded="true"] {
    background-color: #f7fafc;        /* gray.200 */
    border-color: #b4b9be;            /* gray.500 */
}
.proto--userchip:focus-visible,
.proto--usermenu-item:focus-visible {
    outline: 0.125rem solid #1e65ae;  /* blue.400, mismo anillo de foco del panel */
    outline-offset: 0.125rem;
}
.proto--userchip-avatar {
    width: 1.75rem;
    height: 1.75rem;
}
.proto--userchip-chevron {
    font-size: 1.25rem;
    color: #6d7781;                   /* gray.700 */
    transition: transform 0.2s;
}
.proto--userchip[aria-expanded="true"] .proto--userchip-chevron {
    transform: rotate(180deg);
}
.proto--usermenu-panel {
    position: absolute;
    right: 0;
    top: calc(100% + 0.5rem);
    z-index: 50;
    min-width: 15rem;
    padding: 0.5rem;
    background-color: #ffffff;
    border: 0.0625rem solid #e2e8f0;
    border-radius: 0.75rem;           /* dimension.12 */
    box-shadow: 0 0.5rem 1.0625rem 0 rgba(106, 167, 197, 0.15), 0 1.6px 2.76px 0 rgba(106, 167, 197, 0.075); /* elevation-1 */
}
.proto--usermenu-id {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem;
}
.proto--usermenu-id b {
    display: block;
    font-weight: 500;
    font-size: 0.875rem;
    color: #293036;
    overflow-wrap: anywhere;
}
.proto--usermenu-label {
    display: block;
    font-size: 0.75rem;
    color: #6d7781;
}
.proto--usermenu-sep {
    border-top: 0.0625rem solid #e2e8f0;
    margin: 0.25rem 0;
}
.proto--usermenu-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.5rem;
    border-radius: 0.5rem;
    color: #293036;
    font-size: 0.875rem;
    font-weight: 500;
    text-align: left;
}
.proto--usermenu-item:hover {
    background-color: #f7fafc;
}
.proto--usermenu-item .material-symbols-rounded {
    font-size: 1.25rem;
    color: #6d7781;
}

/* ---------- Árbol de campos en Permisos (grupos por objeto o lista) ---------- */
.proto--ftree {
    margin-top: 0.5rem;
}
.proto--fnode {
    margin-top: 0.25rem;
}
.proto--fnode-head {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 2rem;
}
.proto--fnode-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 0.5rem;
    color: #6d7781;                   /* gray.700 */
}
.proto--fnode-toggle:hover {
    background-color: #f0f4f8;        /* gray.300 */
}
.proto--fnode-toggle:focus-visible {
    outline: 0.125rem solid #1e65ae;
    outline-offset: 0.125rem;
}
.proto--fnode-toggle .material-symbols-rounded {
    font-size: 1.25rem;
    transition: transform 0.2s;
}
.proto--fnode-toggle[aria-expanded="false"] .material-symbols-rounded {
    transform: rotate(-90deg);
}
.proto--fnode-head .proto--check-text b {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 600;
    font-size: 0.875rem;
    color: #293036;
}
.proto--fnode-kind {
    font-size: 0.75rem;
    color: #6d7781;
    padding: 0.0625rem 0.5rem;
    border-radius: 0.25rem;
    background-color: #f7fafc;        /* gray.200 */
}
.proto--fnode-count {
    margin-left: auto;
    font-size: 0.813rem;
    color: #6d7781;
    white-space: nowrap;
}
.proto--fnode-body {
    margin-left: 0.875rem;            /* alineado con el centro de la flecha */
    padding-left: 1rem;
    border-left: 0.0625rem solid #e2e8f0; /* semantic.color.border.decorative.default */
}
.proto--fnode-body[hidden] {
    display: none;
}
.proto--ftree .proto--fields {
    margin-top: 0.25rem;
}
/* Casilla a medias: algunos campos del grupo concedidos. */
.proto--check input:indeterminate + .proto--check-box .material-symbols-rounded {
    display: none;                    /* deja el espacio a la raya */
}
.proto--check input:indeterminate + .proto--check-box::after {
    content: "";
    flex-shrink: 0;
    width: 0.5rem;
    height: 0.125rem;
    background-color: #4498ee;        /* checked.icon-color → blue.200 */
}

/* ---------- Token del conector (oculto, con «Cambiar token») ---------- */
.proto--token-mask {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-height: 55px;                 /* misma altura que un campo */
    padding: 0.5rem 0.5rem 0.5rem 1rem;
    border: 0.0625rem solid #e2e8f0;
    border-radius: 0.75rem;
    background-color: #fbfcfe;
}
.proto--token-mask .proto--mono {
    white-space: nowrap;
    overflow-wrap: normal;
    font-size: 0.938rem;
    color: #293036;
    letter-spacing: 0.05em;
}
.proto--token-mask .proto--btn {
    margin-left: auto;
}
.proto--token-test {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: -0.75rem 0 1.25rem;       /* pegado al campo del nuevo token */
}

/* ---------- Contador de caracteres (campos con límite) ---------- */
.proto--hint-row {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
}
.proto--counter {
    flex: none;
    font-variant-numeric: tabular-nums;
    color: #6d7781;
}
.proto--counter--full {
    color: #ad0c2a;                   /* red.800: llegó al límite */
}

/* ---------- Confirmación de borrado irreversible (impacto + texto a escribir) ---------- */
.proto--impact {
    list-style: none;
    margin: 0 0 1rem;
    padding: 0.75rem 1rem;
    background-color: #ffeaee;        /* subtle.danger.background → red.100 */
    border-radius: 0.75rem;
    color: #293036;
    font-size: 0.875rem;
}
.proto--impact li {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.1875rem 0;
}
.proto--impact .material-symbols-rounded {
    font-size: 1.125rem;
    color: #ad0c2a;                   /* red.800 */
}
.proto--impact b {
    font-weight: 600;
}
.proto--code {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 500;
    color: #293036;
    background-color: #f0f4f8;        /* gray.300 */
    border-radius: 0.375rem;
    padding: 0.0625rem 0.375rem;
}
.proto--icon-btn-sm {
    width: 1.75rem;
    height: 1.75rem;
    margin-left: 0.25rem;
    vertical-align: middle;
    box-shadow: none;
}
.proto--icon-btn-sm .material-symbols-rounded {
    font-size: 1rem;
}
.proto--hint-ok {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    color: #0b6b55;                   /* green.800 para AA */
}
.proto--hint-ok .material-symbols-rounded {
    font-size: 1rem;
}

/* Separador vertical entre el interruptor de estado y los botones de la tarjeta del consumidor. */
.proto--vsep {
    width: 0.0625rem;
    height: 1.75rem;
    background-color: #e2e8f0;
    margin: 0 0.25rem;
}

.proto--nowrap {
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

/* ---------- Usuarios con acceso: avatar pequeño + correo en la tabla ---------- */
.proto--who {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.proto--avatar-sm {
    width: 2.25rem;
    height: 2.25rem;
    font-size: 0.813rem;
}

/* ---------- Plantillas de acceso ---------- */
.proto--stack {
    display: grid;
    gap: 1.5rem;
}
.proto--alert > .proto--actions {
    margin-left: auto;
}
/* Aviso de diferencias de la plantilla: una línea con números; los nombres salen al abrir «Ver cuáles». */
.proto--diff-body {
    display: grid;
    gap: 0.375rem;
    margin-top: 0.5rem;
    padding: 0.5rem 0.75rem;
    background-color: #fff7e6;
    border: 0.0625rem solid #f3d9a4;
    border-radius: 0.75rem;
    color: #6b4300;
    font-size: 0.875rem;
}

/* Tarjeta de plantilla del consumidor: estado en una frase y acciones en un menú */

.proto--tplrow {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem 1rem;
}
.proto--tplrow .proto--field {
    min-width: 16rem;
    flex: 0 1 22rem;
    margin: 0;
}
#tplcard [hidden] {
    display: none !important;      /* los display de alertas, botones y paneles ganarían al atributo hidden */
}
.proto--linkbtn {
    display: inline-flex;
    align-items: center;
    gap: 0.125rem;
    padding: 0.25rem 0.25rem;
    border: 0;
    background: none;
    color: #2b5fc7;
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
}
.proto--linkbtn[aria-expanded="true"] .material-symbols-rounded {
    transform: rotate(180deg);
}
.proto--tplrow + .proto--diff-body {
    margin-top: 0.75rem;
}

/* Un solo conector: sin cabecera ni paso propio; la lista de endpoints va directo. */
.proto--conn--solo > .proto--conn-head {
    display: none;
}
@media (min-width: 48.0625rem) {
    .proto--steps2 {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ---------- Menú de copiar de cada API key (key o URL del gateway) ---------- */
.proto--copymenu {
    width: 23rem;
    max-width: calc(100vw - 1rem);
    display: grid;
    gap: 0.125rem;
}
.proto--copymenu-item {
    background: none;
    border: none;
    font-family: 'IBM Plex Sans', sans-serif;
    cursor: pointer;
    align-items: flex-start;
}
.proto--copymenu-item .material-symbols-rounded {
    font-size: 1.25rem;
    color: #1e65ae;                   /* blue.400 */
}
.proto--copymenu-item b {
    display: block;
    font-weight: 500;
}
.proto--copymenu-item small {
    display: block;
    color: #6d7781;                   /* gray.700 */
    font-size: 0.75rem;
    overflow-wrap: anywhere;
}
.proto--copymenu-item small .proto--mono {
    color: #293036;                   /* gray.900: el nombre del encabezado resalta sobre el texto de ayuda */
    font-size: 0.75rem;
}
.proto--copymenu-item:disabled {
    cursor: not-allowed;
    opacity: 0.4;                     /* semantic.opacity.disabled */
}
.proto--copymenu-item:disabled:hover {
    background: none;
}
.proto--copymenu-item:focus-visible {
    outline: 0.125rem solid #1e65ae;
    outline-offset: 0.125rem;
}
