* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background: #f5f5f5;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

/* Header */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 25px;
    border-radius: 15px;
    margin-bottom: 25px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.header h1 {
    font-size: 28px;
    margin-bottom: 10px;
}

.header p {
    opacity: 0.9;
    font-size: 16px;
}

/* Stats Cards */
.stats-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.stat-card {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    text-align: center;
}

.stat-number {
    font-size: 32px;
    font-weight: bold;
    color: #667eea;
    margin-bottom: 5px;
}

.stat-label {
    color: #666;
    font-size: 14px;
}

/* Filtros y búsqueda */
.filters-section {
    background: white;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 25px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.search-box {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.search-box input {
    flex: 1;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.search-box input:focus {
    outline: none;
    border-color: #667eea;
}

.filter-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 8px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 20px;
    background: white;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 13px;
}

.filter-btn:hover {
    background: #f0f0f0;
}

.filter-btn.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

/* Tabla de usuarios */
.users-table-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    overflow-x: auto;
    margin-bottom: 25px;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    background: #f8f9fa;
    padding: 15px;
    text-align: left;
    font-weight: 600;
    color: #333;
    border-bottom: 2px solid #e0e0e0;
}

td {
    padding: 15px;
    border-bottom: 1px solid #e0e0e0;
    vertical-align: middle;
}

tr:hover {
    background: #f8f9fa;
}

/* Checkboxes de apps */
.apps-container {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.app-checkbox {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    background: #f0f0f0;
    border-radius: 20px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s;
}

.app-checkbox input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.app-checkbox.app1 { background: #e3f2fd; }
.app-checkbox.app2 { background: #e8f5e8; }
.app-checkbox.app3 { background: #fff3e0; }
.app-checkbox.app4 { background: #f3e5f5; }

/* Badges de estado */
.status-badge {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.status-active {
    background: #d4edda;
    color: #155724;
}

.status-inactive {
    background: #f8d7da;
    color: #721c24;
}

/* Botones de acción */
.action-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.3s;
}

.btn-save {
    background: #28a745;
    color: white;
}

.btn-save:hover {
    background: #218838;
}

.btn-delete {
    background: #dc3545;
    color: white;
}

.btn-delete:hover {
    background: #c82333;
}

.btn-edit {
    background: #ffc107;
    color: #333;
}

.btn-edit:hover {
    background: #e0a800;
}

.btn-bulk {
    background: #667eea;
    color: white;
    padding: 10px 20px;
}

.btn-bulk:hover {
    background: #5a67d8;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
}

.modal-content {
    position: relative;
    background: white;
    width: 90%;
    max-width: 500px;
    margin: 50px auto;
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    max-height: 80vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.close {
    font-size: 24px;
    cursor: pointer;
    color: #999;
}

.close:hover {
    color: #333;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #333;
}

.form-group input, .form-group select {
    width: 100%;
    padding: 10px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
}

/* Loading */
.loading {
    text-align: center;
    padding: 50px;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Toast notifications */
.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 15px 25px;
    background: #333;
    color: white;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.2);
    z-index: 1001;
    animation: slideIn 0.3s ease;
}

.toast.success { background: #28a745; }
.toast.error { background: #dc3545; }
.toast.warning { background: #ffc107; color: #333; }

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Acciones masivas */
.bulk-actions {
    background: white;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 25px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.bulk-title {
    font-weight: 600;
    margin-bottom: 15px;
    color: #333;
}

.bulk-apps {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    margin-bottom: 15px;
}

.bulk-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* Responsive */
@media (max-width: 768px) {
    .apps-container {
        flex-direction: column;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    td {
        min-width: 150px;
    }
    
    .bulk-apps {
        flex-direction: column;
    }
}

/* Carga masiva de usuarios */
.bulk-upload-card{display:flex;align-items:center;justify-content:space-between;gap:22px;background:#fff;border:1px solid #eadde0;border-left:6px solid #7a1f2b;border-radius:12px;padding:22px 24px;margin:0 0 24px;box-shadow:0 2px 5px rgba(0,0,0,.06)}
.bulk-upload-copy h2{font-size:20px;color:#7a1f2b;margin-bottom:7px}.bulk-upload-copy p{color:#4b5563;margin-bottom:7px;line-height:1.45}.bulk-upload-copy small{color:#687386}.bulk-upload-actions{display:flex;gap:10px;flex-wrap:wrap;flex-shrink:0}
.csv-modal-content{max-width:850px;width:94%;max-height:88vh}.csv-subtitle{color:#687386;font-size:13px;margin-top:4px}.csv-instructions{background:#f8f1f2;border:1px solid #ead5d8;border-radius:9px;padding:14px 16px;margin-bottom:16px;color:#454545;line-height:1.5}.csv-instructions p{margin-top:6px;font-size:13px}.csv-dropzone{border:2px dashed #b98a91;border-radius:12px;background:#fcf8f9;padding:28px 16px;text-align:center;display:flex;align-items:center;flex-direction:column;gap:7px;cursor:pointer;color:#7a1f2b}.csv-dropzone.dragover{background:#f3e5e7;border-color:#7a1f2b}.csv-dropzone span{font-size:13px;color:#687386}.csv-drop-icon{font-size:34px;font-weight:700}.csv-file-name{margin-top:10px;color:#315b42;font-size:13px}.csv-preview{margin-top:18px}.csv-preview-heading{display:flex;justify-content:space-between;align-items:center;margin-bottom:8px}.csv-preview-heading h3{font-size:16px}.csv-preview-heading span{font-size:12px;color:#687386}.csv-table-wrap{max-height:260px;overflow:auto;border:1px solid #e2e5e9;border-radius:8px}.csv-table-wrap table{width:100%;border-collapse:collapse;font-size:12px;white-space:nowrap}.csv-table-wrap th,.csv-table-wrap td{padding:8px 10px;border-bottom:1px solid #edf0f2;text-align:left}.csv-table-wrap th{position:sticky;top:0;background:#f4f5f7}.csv-validation-summary{font-size:13px;margin-top:9px}.csv-validation-summary .valid{color:#237447}.csv-validation-summary .invalid{color:#b42318}.csv-results{margin-top:16px}.csv-progress-track{height:9px;background:#eceff2;border-radius:20px;overflow:hidden;margin-bottom:12px}.csv-progress-track div{height:100%;width:0;background:#287a50;transition:width .2s}.csv-modal-actions{display:flex;justify-content:flex-end;gap:10px;margin-top:20px}.csv-error-list{max-height:180px;overflow:auto;margin:8px 0 0 18px;font-size:12px;color:#a12a35}.csv-result-counts{display:flex;gap:16px;flex-wrap:wrap;font-size:14px}
@media(max-width:700px){.bulk-upload-card{align-items:stretch;flex-direction:column}.bulk-upload-actions{flex-direction:column}.bulk-upload-actions button{width:100%}.csv-modal-content{padding:16px}.csv-modal-actions{flex-direction:column-reverse}.csv-modal-actions button{width:100%}}

.user-detail-filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr));
    gap: 15px;
    margin-bottom: 15px;
    padding: 15px;
    background: white;
    border-radius: 12px;
}

.user-detail-filters .form-group {
    min-width: 0;
    margin: 0;
}

.app-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.app-links a { text-decoration: underline; text-underline-offset: 2px; color: #253248; }
.app-links a:focus-visible { outline: 2px solid #24496d; outline-offset: 3px; }
