.pki-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 0.35rem 0.35rem 0 0;
    padding: 1rem 1.25rem;
    border-bottom: none;
    min-height: 4rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.pki-header h6 {
    color: white;
    margin: 0;
    font-weight: 700;
    line-height: 1.2;
    display: flex;
    align-items: center;
}

.pki-header .btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 0.375rem 0.75rem;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
}

.pki-header .btn:hover {
    background: rgba(255, 255, 255, 0.3);
    color: white;
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: 0 0.25rem 0.5rem rgba(0, 0, 0, 0.2);
}

.pki-header .btn i {
    margin-right: 0.5rem;
    font-size: 0.7rem;
}

.pki-body {
    padding: 1.25rem;
    background-color: #fff;
    border-radius: 0 0 0.35rem 0.35rem;
}

.pki-filter-label {
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
    color: #5a5c69;
    font-weight: 700;
}

.pki-filter-label i {
    color: #858796;
    width: 14px;
}

.pki-column-filter {
    font-size: 0.875rem;
}

.pki-column-filter:focus {
    border-color: #667eea !important;
    box-shadow: 0 0 0 0.1rem rgba(102, 126, 234, 0.25) !important;
}

.expiration-badge-expired {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.5rem;
    border-radius: 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    background-color: #f8d7da;
    color: #dc3545;
    border: 1px solid #f5c6cb;
}

.expiration-badge-critical {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.5rem;
    border-radius: 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    background-color: #f8d7da;
    color: #dc3545;
    border: 1px solid #f5c6cb;
}

.expiration-badge-warning {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.5rem;
    border-radius: 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.expiration-badge-valid {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.5rem;
    border-radius: 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.expiration-badge-expired i,
.expiration-badge-critical i,
.expiration-badge-warning i,
.expiration-badge-valid i {
    font-size: 1rem;
    margin-bottom: 0.25rem;
    color: inherit;
}

.expiration-badge-expired small,
.expiration-badge-critical small,
.expiration-badge-warning small,
.expiration-badge-valid small {
    font-size: 0.65rem;
    opacity: 0.8;
    color: inherit;
}

.status-badge-active {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 600;
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.status-badge-revoked {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 600;
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.status-badge-expired {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 600;
    background-color: #e2e3e5;
    color: #383d41;
    border: 1px solid #d6d8db;
}

.status-badge-active i,
.status-badge-revoked i,
.status-badge-expired i {
    margin-right: 0.25rem;
}

.type-badge-client {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 600;
    background-color: #cce5ff;
    color: #004085;
    border: 1px solid #b8daff;
}

.type-badge-server {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 600;
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.type-badge-email {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 600;
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
}

.type-badge-code {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 600;
    background-color: #e2d5f1;
    color: #6f42c1;
    border: 1px solid #d4c4e8;
}

.type-badge-client i,
.type-badge-server i,
.type-badge-email i,
.type-badge-code i {
    margin-right: 0.25rem;
}

.usage-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 600;
    background-color: #f8f9fc;
    color: #5a5c69;
    border: 1px solid #e3e6f0;
}

.usage-badge i {
    margin-right: 0.25rem;
}

#pkiCertificatesTable,
#pkiCAsTable,
#pkiProfilesTable {
    width: 100% !important;
    table-layout: auto;
}

#pkiCertificatesTable td,
#pkiCAsTable td,
#pkiProfilesTable td {
    vertical-align: middle;
    padding: 0.75rem;
    word-wrap: break-word;
}

#pkiCertificatesTable .btn-action,
#pkiCAsTable .btn-action,
#pkiProfilesTable .btn-action {
    width: 32px;
    height: 32px;
    padding: 0;
    border-radius: 50%;
    font-size: 0.75rem;
    line-height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    margin: 0 0.125rem;
}

#pkiCertificatesTable .btn-action:hover,
#pkiCAsTable .btn-action:hover,
#pkiProfilesTable .btn-action:hover {
    transform: translateY(-1px);
    box-shadow: 0 0.25rem 0.5rem rgba(0, 0, 0, 0.15);
}

.pki-form-section {
    background-color: #f8f9fc;
    border-radius: 0.35rem;
    padding: 1.25rem;
    margin-bottom: 1.5rem;
    border: 1px solid #e3e6f0;
}

.pki-form-section h6 {
    color: #5a5c69;
    font-weight: 700;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #667eea;
}

.pki-form-section h6 i {
    color: #667eea;
    margin-right: 0.5rem;
}

.san-container {
    border: 1px solid #e3e6f0;
    border-radius: 0.35rem;
    padding: 1rem;
    background-color: #fff;
}

.san-entry {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    align-items: center;
}

.san-entry:last-child {
    margin-bottom: 0;
}

.san-entry select {
    flex: 0 0 120px;
}

.san-entry input {
    flex: 1;
}

.san-entry .btn-remove-san {
    flex: 0 0 auto;
    width: 32px;
    height: 32px;
    padding: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

#addSanBtn {
    margin-top: 0.5rem;
}

.pki-success-modal .modal-header {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    border-bottom: none;
}

.pki-success-modal .modal-header .close {
    color: white;
    opacity: 0.8;
}

.pki-success-modal .modal-header .close:hover {
    opacity: 1;
}

.pki-success-modal .certificate-output {
    background-color: #2d3748;
    color: #e2e8f0;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.75rem;
    border-radius: 0.35rem;
    padding: 1rem;
    white-space: pre-wrap;
    word-break: break-all;
    max-height: 200px;
    overflow-y: auto;
}

.pki-success-modal .download-buttons {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

.pki-success-modal .download-buttons .btn {
    flex: 1;
}

.pki-warning-alert {
    background-color: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 0.35rem;
    padding: 1rem;
    margin-bottom: 1rem;
}

.pki-warning-alert i {
    color: #856404;
    margin-right: 0.5rem;
}

.pki-import-modal .modal-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-bottom: none;
}

.pki-import-modal .modal-header .close {
    color: white;
    opacity: 0.8;
}

.pki-import-modal .modal-header .close:hover {
    opacity: 1;
}

.pki-import-modal .pem-textarea {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.75rem;
    min-height: 150px;
    resize: vertical;
}

.pki-import-modal .custom-file-label.text-success,
.pki-form-section .custom-file-label.text-success {
    border-color: #28a745;
    background-color: #d4edda;
}

.pki-import-modal .custom-file-label.text-success::after,
.pki-form-section .custom-file-label.text-success::after {
    content: "\f00c";
    font-family: "Font Awesome 5 Free";
    font-weight: 900;
    background-color: #28a745;
    color: white;
}

.action-column {
    width: 120px;
    min-width: 120px;
    max-width: 120px;
}

@media (max-width: 768px) {
    .pki-header {
        flex-direction: column;
        gap: 0.5rem;
        min-height: auto;
        padding: 0.75rem 1rem;
    }

    .pki-header .btn {
        font-size: 0.7rem;
        padding: 0.25rem 0.5rem;
    }

    .san-entry {
        flex-wrap: wrap;
    }

    .san-entry select {
        flex: 1 1 100%;
        margin-bottom: 0.25rem;
    }

    .san-entry input {
        flex: 1 1 calc(100% - 40px);
    }

    .expiration-badge-expired,
    .expiration-badge-critical,
    .expiration-badge-warning,
    .expiration-badge-valid {
        padding: 0.3rem;
        font-size: 0.65rem;
    }

    .action-column {
        width: 100px;
        min-width: 100px;
        max-width: 100px;
    }
}

@media (max-width: 576px) {
    .pki-form-section {
        padding: 1rem;
    }

    .pki-success-modal .download-buttons {
        flex-direction: column;
    }
}

.autocomplete-wrapper {
    position: relative;
    width: 100%;
}

input.autocomplete-input {
    background-color: white !important;
    border: 2px solid #d1d3e2 !important;
    border-radius: 0.35rem;
    padding: 0.5rem 2.5rem 0.5rem 0.75rem;
    transition: all 0.3s ease;
    width: 100%;
    font-size: 0.95rem;
}

input.autocomplete-input:hover {
    border-color: #667eea !important;
    box-shadow: 0 0 0 0.15rem rgba(102, 126, 234, 0.15);
}

input.autocomplete-input:focus {
    background-color: white !important;
    border-color: #667eea !important;
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25) !important;
    outline: none;
}

.autocomplete-icon {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: #858796;
    font-size: 0.75rem;
    pointer-events: none;
    transition: transform 0.2s ease;
}

input.autocomplete-input:focus + .autocomplete-icon {
    color: #667eea;
    transform: translateY(-50%) rotate(180deg);
}

.autocomplete-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #e3e6f0;
    border-radius: 0.5rem;
    box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.15);
    max-height: 250px;
    overflow-y: auto;
    z-index: 1050;
    display: none;
}

.autocomplete-dropdown.show {
    display: block;
    animation: slideDownFade 0.2s ease;
}

@keyframes slideDownFade {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.autocomplete-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: all 0.15s ease;
    border-bottom: 1px solid #f8f9fc;
    display: flex;
    flex-direction: column;
    font-size: 0.9rem;
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.autocomplete-item:hover {
    background: linear-gradient(135deg, #e7f3ff 0%, #d6ebff 100%);
    color: #2c5aa0;
    padding-left: 1.25rem;
}

.autocomplete-item .responsible-name {
    font-weight: 600;
    color: #3a3b45;
}

.autocomplete-item .responsible-email {
    font-size: 0.8rem;
    color: #858796;
    margin-top: 0.125rem;
}

.autocomplete-item:hover .responsible-name {
    color: #2c5aa0;
}

.autocomplete-item:hover .responsible-email {
    color: #4e73df;
}

.autocomplete-empty {
    padding: 1rem;
    text-align: center;
    color: #858796;
    font-style: italic;
    font-size: 0.85rem;
}

.autocomplete-loading {
    padding: 1rem;
    text-align: center;
    color: #667eea;
}

.autocomplete-dropdown::-webkit-scrollbar {
    width: 8px;
}

.autocomplete-dropdown::-webkit-scrollbar-track {
    background: #f8f9fc;
    border-radius: 0 0.5rem 0.5rem 0;
}

.autocomplete-dropdown::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 10px;
}

.autocomplete-dropdown::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}

input.autocomplete-input.has-value {
    background-color: #f8f9fc !important;
    border-color: #1cc88a !important;
    font-weight: 600;
}

input.autocomplete-input::placeholder {
    color: #a0a0a0;
    font-style: italic;
    opacity: 0.8;
}

